diff options
Diffstat (limited to 'system')
44 files changed, 9890 insertions, 297 deletions
diff --git a/system/include/EGL/eglplatform.h b/system/include/EGL/eglplatform.h index 2db2cc47..77e885a8 100644 --- a/system/include/EGL/eglplatform.h +++ b/system/include/EGL/eglplatform.h @@ -75,7 +75,7 @@ typedef HDC EGLNativeDisplayType; typedef HBITMAP EGLNativePixmapType; typedef HWND EGLNativeWindowType; -#elif defined(EMSCRIPTEN) +#elif defined(__EMSCRIPTEN__) typedef int EGLNativeDisplayType; typedef int EGLNativeWindowType; diff --git a/system/include/GL/glew.h b/system/include/GL/glew.h index efd90d6f..8be23b60 100644 --- a/system/include/GL/glew.h +++ b/system/include/GL/glew.h @@ -827,7 +827,9 @@ GLenum glewInit (void); GLboolean glewIsSupported (const char *name); #define glewIsExtensionSupported(x) glewIsSupported(x) -GLboolean glewExperimental; +//GLboolean glewExperimental; +static GLboolean glewExperimental; // XXX Emscripten Added 'static' to work around a linkage issue. See https://github.com/kripken/emscripten/issues/2025 + GLboolean glewGetExtension (const char *name); const GLubyte * glewGetErrorString (GLenum error); const GLubyte * glewGetString (GLenum name); diff --git a/system/include/SDL/SDL_config_minimal.h b/system/include/SDL/SDL_config_minimal.h index ea0cec10..18951f18 100644 --- a/system/include/SDL/SDL_config_minimal.h +++ b/system/include/SDL/SDL_config_minimal.h @@ -33,7 +33,7 @@ #include <stddef.h> #include <stdarg.h> -#if !defined(EMSCRIPTEN) && !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) +#if !defined(__EMSCRIPTEN__) && !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) typedef unsigned int size_t; typedef signed char int8_t; typedef unsigned char uint8_t; diff --git a/system/include/SDL/SDL_stdinc.h b/system/include/SDL/SDL_stdinc.h index c4ce7ccd..508ecdb4 100644 --- a/system/include/SDL/SDL_stdinc.h +++ b/system/include/SDL/SDL_stdinc.h @@ -65,7 +65,7 @@ #endif #if defined(HAVE_INTTYPES_H) # include <inttypes.h> -#elif defined(EMSCRIPTEN) || defined(HAVE_STDINT_H) +#elif defined(__EMSCRIPTEN__) || defined(HAVE_STDINT_H) # include <stdint.h> #endif #ifdef HAVE_CTYPE_H diff --git a/system/include/X11/XKBlib.h b/system/include/X11/XKBlib.h new file mode 100644 index 00000000..8f6c72c1 --- /dev/null +++ b/system/include/X11/XKBlib.h @@ -0,0 +1,1149 @@ +/************************************************************ +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 _X11_XKBLIB_H_ +#define _X11_XKBLIB_H_ + +#include <X11/Xlib.h> +#include <X11/extensions/XKBstr.h> + +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 /* _X11_XKBLIB_H_ */ diff --git a/system/include/X11/Xfuncs.h b/system/include/X11/Xfuncs.h new file mode 100644 index 00000000..2bcf991a --- /dev/null +++ b/system/include/X11/Xfuncs.h @@ -0,0 +1,69 @@ +/* + * +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 <X11/Xosdefs.h> + +/* the old Xfuncs.h, for pre-R6 */ +# if !(defined(XFree86LOADER) && defined(IN_MODULE)) + +# ifdef X_USEBFUNCS +void bcopy(); +void bzero(); +int bcmp(); +# else +# if defined(SYSV) && !defined(__SCO__) && !defined(__sun) && !defined(__UNIXWARE__) +# include <memory.h> +void bcopy(); +# define bzero(b,len) memset(b, 0, len) +# define bcmp(b1,b2,len) memcmp(b1, b2, len) +# else +# include <string.h> +# if defined(__SCO__) || defined(__sun) || defined(__UNIXWARE__) || defined(__CYGWIN__) +# include <strings.h> +# endif +# define _XFUNCS_H_INCLUDED_STRING_H +# endif +# endif /* X_USEBFUNCS */ + +/* the new Xfuncs.h */ + +/* the ANSI C way */ +# ifndef _XFUNCS_H_INCLUDED_STRING_H +# include <string.h> +# endif +# undef bzero +# define bzero(b,len) memset(b,0,len) + +# if defined WIN32 && defined __MINGW32__ +# define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len)) +# endif + +# endif /* !(defined(XFree86LOADER) && defined(IN_MODULE)) */ + +#endif /* _XFUNCS_H_ */ diff --git a/system/include/X11/XlibConf.h b/system/include/X11/XlibConf.h new file mode 100644 index 00000000..9f9b9403 --- /dev/null +++ b/system/include/X11/XlibConf.h @@ -0,0 +1,38 @@ +/* include/X11/XlibConf.h. Generated from XlibConf.h.in by configure. */ +/* + * 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? */ +#define XTHREADS 1 + +/* Use multi-threaded libc functions? */ +#define XUSE_MTSAFE_API 1 + +#endif /* _XLIBCONF_H_ */ diff --git a/system/include/X11/Xlibint.h b/system/include/X11/Xlibint.h new file mode 100644 index 00000000..d04e8fd1 --- /dev/null +++ b/system/include/X11/Xlibint.h @@ -0,0 +1,1387 @@ + +/* + +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. + +*/ + +#ifndef _X11_XLIBINT_H_ +#define _X11_XLIBINT_H_ 1 + +/* + * 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 <X11/Xlib.h> +#include <X11/Xproto.h> /* to declare xEvent */ +#include <X11/XlibConf.h> /* for configured options like XTHREADS */ + +#ifdef WIN32 +#define _XFlush _XFlushIt +#endif + +/* + * If your BytesReadable correctly detects broken connections, then + * you should NOT define XCONN_CHECK_FREQ. + */ +#ifndef XCONN_CHECK_FREQ +#define XCONN_CHECK_FREQ 256 +#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 */ +}; + +#define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n) + +/* + * define the following if you want the Data macro to be a procedure instead + */ +#ifdef CRAY +#define DataRoutineIsProcedure +#endif /* CRAY */ + +#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 <X11/Xproto.h> +#ifdef __sgi +#define _SGI_MP_SOURCE /* turn this on to get MP safe errno */ +#endif +#include <errno.h> +#define _XBCOPYFUNC _Xbcopy +#include <X11/Xfuncs.h> +#include <X11/Xosdefs.h> + +/* Utek leaves kernel macros around in include files (bleah) */ +#ifdef dirty +#undef dirty +#endif + +#include <stdlib.h> +#include <string.h> + +#include <X11/Xfuncproto.h> + +_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 <stddef.h> + +#define LOCKED 1 +#define UNLOCKED 0 + +#ifndef BUFSIZE +#define BUFSIZE 2048 /* X output buffer size. */ +#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. + */ + +/* Need to start requests on 64 bit word boundaries + * on a CRAY computer so add a NoOp (127) if needed. + * A character pointer on a CRAY computer will be non-zero + * after shifting right 61 bits of it is not pointing to + * a word boundary. + */ +#ifdef WORD64 +#define WORD64ALIGN if ((long)dpy->bufptr >> 61) {\ + dpy->last_req = dpy->bufptr;\ + *(dpy->bufptr) = X_NoOperation;\ + *(dpy->bufptr+1) = 0;\ + *(dpy->bufptr+2) = 0;\ + *(dpy->bufptr+3) = 1;\ + dpy->request++;\ + dpy->bufptr += 4;\ + } +#else /* else does not require alignment on 64-bit boundaries */ +#define WORD64ALIGN +#endif /* WORD64 */ + +/** + * 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! */ + +#if !defined(UNIXCPP) || defined(ANSICPP) +#define GetReqSized(name, sz, req) \ + req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz) +#else +#define GetReqSized(name, sz, req) \ + req = (x/**/name/**/Req *) _XGetRequest(dpy, X_/**/name, sz) +#endif + + +/* + * 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. + * + */ + +#if !defined(UNIXCPP) || defined(ANSICPP) +#define GetReq(name, req) \ + GetReqSized(name, SIZEOF(x##name##Req), req) +#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ +#define GetReq(name, req) \ + GetReqSized(name, SIZEOF(x/**/name/**/Req), req) +#endif + +/* GetReqExtra is the same as GetReq, but allocates "n" additional + bytes after the request. "n" must be a multiple of 4! */ + +#if !defined(UNIXCPP) || defined(ANSICPP) +#define GetReqExtra(name, n, req) \ + GetReqSized(name, SIZEOF(x##name##Req) + n, req) +#else +#define GetReqExtra(name, n, req) \ + GetReqSized(name, SIZEOF(x/**/name/**/Req) + n, req) +#endif + + +/* + * 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. + */ + +#if !defined(UNIXCPP) || defined(ANSICPP) +#define GetResReq(name, rid, req) \ + req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \ + req->id = (rid) +#else +#define GetResReq(name, rid, req) \ + req = (xResourceReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xResourceReq)); \ + req->id = (rid) +#endif + +/* + * GetEmptyReq is for those requests that have no arguments + * at all. + */ +#if !defined(UNIXCPP) || defined(ANSICPP) +#define GetEmptyReq(name, req) \ + req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq)) +#else +#define GetEmptyReq(name, req) \ + req = (xReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xReq)) +#endif + +#ifdef WORD64 +#define MakeBigReq(req,n) \ + { \ + char _BRdat[4]; \ + unsigned long _BRlen = req->length - 1; \ + req->length = 0; \ + memcpy(_BRdat, ((char *)req) + (_BRlen << 2), 4); \ + memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ + memcpy(((char *)req) + 4, _BRdat, 4); \ + Data32(dpy, (long *)&_BRdat, 4); \ + } +#else +#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 << 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 << 2); \ + ((CARD32 *)req)[1] = _BRlen + n + 2; \ + Data32(dpy, &_BRdat, 4); \ + } +#endif +#endif + +#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 pinter 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); + +#ifdef WORD64 +#define Data16(dpy, data, len) _XData16(dpy, (short *)data, len) +#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len) +#else +#define Data16(dpy, data, len) Data((dpy), (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, (long *)data, len) +extern int _XData32( + Display *dpy, + register long *data, + unsigned len +); +extern void _XRead32( + Display *dpy, + register long *data, + long len +); +#else +#define Data32(dpy, data, len) Data((dpy), (char *)(data), (len)) +#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) +#endif +#endif /* not WORD64 */ + +#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); \ +} + + +#ifdef MUSTCOPY + +/* for when 32-bit alignment is not good enough */ +#define OneDataCard32(dpy,dstaddr,srcvar) \ + { dpy->bufptr -= 4; Data32 (dpy, (char *) &(srcvar), 4); } + +#else + +/* srcvar must be a variable for large architecture version */ +#define OneDataCard32(dpy,dstaddr,srcvar) \ + { *(CARD32 *)(dstaddr) = (srcvar); } + +#endif /* MUSTCOPY */ + +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; + +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 */ +) _X_NORETURN; +extern int (*_XIOErrorFunction)( + Display* /* dpy */ +); +extern int (*_XErrorFunction)( + Display* /* dpy */, + XErrorEvent* /* error_event */ +); +extern void _XEatData( + Display* /* dpy */, + unsigned long /* n */ +) _XLIB_COLD; +#ifdef XLIB_WANT_XEATDATAWORDS +extern void _XEatDataWords( + Display* /* dpy */, + unsigned long /* n */ +) _XLIB_COLD _X_HIDDEN; +#endif +#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; +}; + +#ifdef __UNIXOS2__ +extern char* __XOS2RedirRoot( + char* +); +#endif + +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 ( + register Display *dpy, + xChangeWindowAttributesReq *req, + register unsigned long valuemask, + register XSetWindowAttributes *attributes); + +extern int _XDefaultError( + Display *dpy, + XErrorEvent *event); + +extern int _XDefaultIOError( + Display *dpy); + +extern void _XSetClipRectangles ( + register Display *dpy, + GC gc, + int clip_x_origin, int clip_y_origin, + XRectangle *rectangles, + int n, + int ordering); + +Status _XGetWindowAttributes( + register Display *dpy, + Window w, + XWindowAttributes *attr); + +int _XPutBackEvent ( + register Display *dpy, + register 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 +); + +_XFUNCPROTOEND + +#endif /* _X11_XLIBINT_H_ */ diff --git a/system/include/X11/Xmd.h b/system/include/X11/Xmd.h new file mode 100644 index 00000000..f3868b36 --- /dev/null +++ b/system/include/X11/Xmd.h @@ -0,0 +1,185 @@ +/*********************************************************** + +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(__sun) && defined(__SVR4) +# include <sys/isa_defs.h> /* Solaris: defines _LP64 if necessary */ +# endif + +# if defined (_LP64) || defined(__LP64__) || \ + defined(__alpha) || defined(__alpha__) || \ + defined(__ia64__) || defined(ia64) || \ + defined(__sparc64__) || \ + defined(__s390x__) || \ + defined(__amd64__) || defined(amd64) || \ + defined(__powerpc64__) +# define LONG64 /* 32/64-bit architecture */ +# endif + +/* + * Stuff to handle large architecture machines; the constants were generated + * on a 32-bit machine and must correspond to the protocol. + */ +# ifdef WORD64 +# define MUSTCOPY +# endif /* WORD64 */ + + +/* + * 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 is to get macro arguments to expand correctly before + * the concatenation, rather than afterward. + */ +# define _SIZEOF(x) sz_##x +# define SIZEOF(x) _SIZEOF(x) + +/* + * Bitfield suffixes for the protocol structure elements, if you + * need them. Note that bitfields are not guaranteed to be signed + * (or even unsigned) according to ANSI C. + */ +# ifdef WORD64 +typedef long INT64; +typedef unsigned long CARD64; +# define B32 :32 +# define B16 :16 +# ifdef UNSIGNEDBITFIELDS +typedef unsigned int INT32; +typedef unsigned int INT16; +# else +typedef signed int INT32; +typedef signed int INT16; +# endif +# else +# define B32 +# define B16 +# ifdef LONG64 +typedef long INT64; +typedef int INT32; +# else +typedef long INT32; +# endif +typedef short INT16; +# endif + +typedef signed char INT8; + +# ifdef LONG64 +typedef unsigned long CARD64; +typedef unsigned int CARD32; +# else +typedef unsigned long CARD32; +# endif +# if !defined(WORD64) && !defined(LONG64) +typedef unsigned long long CARD64; +# endif +typedef unsigned short CARD16; +typedef unsigned char CARD8; + +typedef CARD32 BITS32; +typedef CARD16 BITS16; + +typedef CARD8 BYTE; +typedef CARD8 BOOL; + +/* + * definitions for sign-extending bitfields on 64-bit architectures + */ +# if defined(WORD64) && defined(UNSIGNEDBITFIELDS) +# define cvtINT8toInt(val) (((val) & 0x00000080) ? ((val) | 0xffffffffffffff00) : (val)) +# define cvtINT16toInt(val) (((val) & 0x00008000) ? ((val) | 0xffffffffffff0000) : (val)) +# define cvtINT32toInt(val) (((val) & 0x80000000) ? ((val) | 0xffffffff00000000) : (val)) +# define cvtINT8toShort(val) cvtINT8toInt(val) +# define cvtINT16toShort(val) cvtINT16toInt(val) +# define cvtINT32toShort(val) cvtINT32toInt(val) +# define cvtINT8toLong(val) cvtINT8toInt(val) +# define cvtINT16toLong(val) cvtINT16toInt(val) +# define cvtINT32toLong(val) cvtINT32toInt(val) +# else +# 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) +# endif /* WORD64 and UNSIGNEDBITFIELDS */ + + + +# ifdef MUSTCOPY +/* + * This macro must not cast or else pointers will get aligned and be wrong + */ +# define NEXTPTR(p,t) (((char *) p) + SIZEOF(t)) +# else /* else not MUSTCOPY, this is used for 32-bit machines */ +/* + * this version should leave result of type (t *), but that should only be + * used when not in MUSTCOPY + */ +# define NEXTPTR(p,t) (((t *)(p)) + 1) +# endif /* MUSTCOPY - used machines whose C structs don't line up with proto */ + +#endif /* XMD_H */ diff --git a/system/include/X11/Xproto.h b/system/include/X11/Xproto.h new file mode 100644 index 00000000..495d4419 --- /dev/null +++ b/system/include/X11/Xproto.h @@ -0,0 +1,2157 @@ +/* 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 <X11/Xmd.h> +#include <X11/Xprotostr.h> + +/* + * 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 structure. This is followed by + numRoots xWindowRoot structs. +*****************/ + +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; + +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; +#ifndef WORD64 + CARD32 walign1 B32; +#endif + xCharInfo maxBounds; +#ifndef WORD64 + CARD32 walign2 B32; +#endif + 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; +#ifndef WORD64 + CARD32 walign1 B32; +#endif + xCharInfo maxBounds; +#ifndef WORD64 + CARD32 walign2 B32; +#endif + 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; +#ifdef WORD64 + /* the structure should have been quad-aligned */ + BYTE eventdata[SIZEOF(xEvent)]; +#else + xEvent event; +#endif /* WORD64 */ +} 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 */ diff --git a/system/include/X11/Xprotostr.h b/system/include/X11/Xprotostr.h new file mode 100644 index 00000000..a9e854d3 --- /dev/null +++ b/system/include/X11/Xprotostr.h @@ -0,0 +1,77 @@ +#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 <X11/Xmd.h> + +/* 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 */ diff --git a/system/include/X11/cursorfont.h b/system/include/X11/cursorfont.h new file mode 100644 index 00000000..c69d508f --- /dev/null +++ b/system/include/X11/cursorfont.h @@ -0,0 +1,111 @@ +/* + +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 _X11_CURSORFONT_H_ +#define _X11_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 /* _X11_CURSORFONT_H_ */ diff --git a/system/include/X11/extensions/XKB.h b/system/include/X11/extensions/XKB.h new file mode 100644 index 00000000..ee4f7407 --- /dev/null +++ b/system/include/X11/extensions/XKB.h @@ -0,0 +1,786 @@ +/************************************************************ +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)<XkbNumKbdGroups)) + + /* + * GroupsWrap values: + * - The 'groupsWrap' field of an XkbControlsRec specifies the + * treatment of out of range groups. + * - Bits 6 and 7 of the group info field of a key symbol map + * specify the interpretation of out of range groups for the + * corresponding key. + */ +#define XkbWrapIntoRange (0x00) +#define XkbClampIntoRange (0x40) +#define XkbRedirectIntoRange (0x80) + + /* + * Action flags: Reported in the 'flags' field of most key actions. + * Interpretation depends on the type of the action; not all actions + * accept all flags. + * + * Option Used for Actions + * ------ ---------------- + * ClearLocks SetMods, LatchMods, SetGroup, LatchGroup + * LatchToLock SetMods, LatchMods, SetGroup, LatchGroup + * LockNoLock LockMods, ISOLock, LockPtrBtn, LockDeviceBtn + * LockNoUnlock LockMods, ISOLock, LockPtrBtn, LockDeviceBtn + * UseModMapMods SetMods, LatchMods, LockMods, ISOLock + * GroupAbsolute SetGroup, LatchGroup, LockGroup, ISOLock + * UseDfltButton PtrBtn, LockPtrBtn + * NoAcceleration MovePtr + * MoveAbsoluteX MovePtr + * MoveAbsoluteY MovePtr + * ISODfltIsGroup ISOLock + * ISONoAffectMods ISOLock + * ISONoAffectGroup ISOLock + * ISONoAffectPtr ISOLock + * ISONoAffectCtrls ISOLock + * MessageOnPress ActionMessage + * MessageOnRelease ActionMessage + * MessageGenKeyEvent ActionMessage + * AffectDfltBtn SetPtrDflt + * DfltBtnAbsolute SetPtrDflt + * SwitchApplication SwitchScreen + * SwitchAbsolute SwitchScreen + */ + +#define XkbSA_ClearLocks (1L << 0) +#define XkbSA_LatchToLock (1L << 1) + +#define XkbSA_LockNoLock (1L << 0) +#define XkbSA_LockNoUnlock (1L << 1) + +#define XkbSA_UseModMapMods (1L << 2) + +#define XkbSA_GroupAbsolute (1L << 2) +#define XkbSA_UseDfltButton 0 + +#define XkbSA_NoAcceleration (1L << 0) +#define XkbSA_MoveAbsoluteX (1L << 1) +#define XkbSA_MoveAbsoluteY (1L << 2) + +#define XkbSA_ISODfltIsGroup (1L << 7) +#define XkbSA_ISONoAffectMods (1L << 6) +#define XkbSA_ISONoAffectGroup (1L << 5) +#define XkbSA_ISONoAffectPtr (1L << 4) +#define XkbSA_ISONoAffectCtrls (1L << 3) +#define XkbSA_ISOAffectMask (0x78) + +#define XkbSA_MessageOnPress (1L << 0) +#define XkbSA_MessageOnRelease (1L << 1) +#define XkbSA_MessageGenKeyEvent (1L << 2) + +#define XkbSA_AffectDfltBtn 1 +#define XkbSA_DfltBtnAbsolute (1L << 2) + +#define XkbSA_SwitchApplication (1L << 0) +#define XkbSA_SwitchAbsolute (1L << 2) + + /* + * The following values apply to the SA_DeviceValuator + * action only. Valuator operations specify the action + * to be taken. Values specified in the action are + * multiplied by 2^scale before they are applied. + */ +#define XkbSA_IgnoreVal (0x00) +#define XkbSA_SetValMin (0x10) +#define XkbSA_SetValCenter (0x20) +#define XkbSA_SetValMax (0x30) +#define XkbSA_SetValRelative (0x40) +#define XkbSA_SetValAbsolute (0x50) +#define XkbSA_ValOpMask (0x70) +#define XkbSA_ValScaleMask (0x07) +#define XkbSA_ValOp(a) ((a)&XkbSA_ValOpMask) +#define XkbSA_ValScale(a) ((a)&XkbSA_ValScaleMask) + + /* + * Action types: specifies the type of a key action. Reported in the + * type field of all key actions. + */ +#define XkbSA_NoAction 0x00 +#define XkbSA_SetMods 0x01 +#define XkbSA_LatchMods 0x02 +#define XkbSA_LockMods 0x03 +#define XkbSA_SetGroup 0x04 +#define XkbSA_LatchGroup 0x05 +#define XkbSA_LockGroup 0x06 +#define XkbSA_MovePtr 0x07 +#define XkbSA_PtrBtn 0x08 +#define XkbSA_LockPtrBtn 0x09 +#define XkbSA_SetPtrDflt 0x0a +#define XkbSA_ISOLock 0x0b +#define XkbSA_Terminate 0x0c +#define XkbSA_SwitchScreen 0x0d +#define XkbSA_SetControls 0x0e +#define XkbSA_LockControls 0x0f +#define XkbSA_ActionMessage 0x10 +#define XkbSA_RedirectKey 0x11 +#define XkbSA_DeviceBtn 0x12 +#define XkbSA_LockDeviceBtn 0x13 +#define XkbSA_DeviceValuator 0x14 +#define XkbSA_LastAction XkbSA_DeviceValuator +#define XkbSA_NumActions (XkbSA_LastAction+1) + +#define XkbSA_XFree86Private 0x86 + + /* + * Specifies the key actions that clear latched groups or modifiers. + */ +#define XkbSA_BreakLatch \ + ((1<<XkbSA_NoAction)|(1<<XkbSA_PtrBtn)|(1<<XkbSA_LockPtrBtn)|\ + (1<<XkbSA_Terminate)|(1<<XkbSA_SwitchScreen)|(1<<XkbSA_SetControls)|\ + (1<<XkbSA_LockControls)|(1<<XkbSA_ActionMessage)|\ + (1<<XkbSA_RedirectKey)|(1<<XkbSA_DeviceBtn)|(1<<XkbSA_LockDeviceBtn)) + + /* + * Macros to classify key actions + */ +#define XkbIsModAction(a) (((a)->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_ */ diff --git a/system/include/X11/extensions/XKBstr.h b/system/include/X11/extensions/XKBstr.h new file mode 100644 index 00000000..e519e657 --- /dev/null +++ b/system/include/X11/extensions/XKBstr.h @@ -0,0 +1,613 @@ +/************************************************************ +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 <X11/extensions/XKB.h> + +#define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) +#define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff))) + +#if defined(WORD64) && defined(UNSIGNEDBITFIELDS) +#define Xkb2CharsToInt(h,l) ((h)&0x80?(int)(((h)<<8)|(l)|(~0xffff)):\ + (int)(((h)<<8)|(l)&0x7fff)) +#else +#define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l))) +#endif + + /* + * 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_ */ diff --git a/system/include/X11/extensions/XShm.h b/system/include/X11/extensions/XShm.h new file mode 100644 index 00000000..23f06511 --- /dev/null +++ b/system/include/X11/extensions/XShm.h @@ -0,0 +1,135 @@ +/************************************************************ + +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 */ + +#ifndef _XSHM_H_ +#define _XSHM_H_ + +#include <X11/Xfuncproto.h> +#include <X11/extensions/shm.h> + +#ifndef _XSHM_SERVER_ +typedef unsigned long ShmSeg; + +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 */ + Drawable drawable; /* drawable of request */ + int major_code; /* ShmReqCode */ + int minor_code; /* X_ShmPutImage */ + ShmSeg shmseg; /* the ShmSeg used in the request */ + unsigned long offset; /* the offset into ShmSeg used in the request */ +} XShmCompletionEvent; + +typedef struct { + ShmSeg shmseg; /* resource id */ + int shmid; /* kernel id */ + char *shmaddr; /* address in client */ + Bool readOnly; /* how the server should attach it */ +} XShmSegmentInfo; + +_XFUNCPROTOBEGIN + +Bool XShmQueryExtension( + Display* /* dpy */ +); + +int XShmGetEventBase( + Display* /* dpy */ +); + +Bool XShmQueryVersion( + Display* /* dpy */, + int* /* majorVersion */, + int* /* minorVersion */, + Bool* /* sharedPixmaps */ +); + +int XShmPixmapFormat( + Display* /* dpy */ +); + +Bool XShmAttach( + Display* /* dpy */, + XShmSegmentInfo* /* shminfo */ +); + +Bool XShmDetach( + Display* /* dpy */, + XShmSegmentInfo* /* shminfo */ +); + +Bool XShmPutImage( + Display* /* dpy */, + Drawable /* d */, + GC /* gc */, + XImage* /* image */, + int /* src_x */, + int /* src_y */, + int /* dst_x */, + int /* dst_y */, + unsigned int /* src_width */, + unsigned int /* src_height */, + Bool /* send_event */ +); + +Bool XShmGetImage( + Display* /* dpy */, + Drawable /* d */, + XImage* /* image */, + int /* x */, + int /* y */, + unsigned long /* plane_mask */ +); + +XImage *XShmCreateImage( + Display* /* dpy */, + Visual* /* visual */, + unsigned int /* depth */, + int /* format */, + char* /* data */, + XShmSegmentInfo* /* shminfo */, + unsigned int /* width */, + unsigned int /* height */ +); + +Pixmap XShmCreatePixmap( + Display* /* dpy */, + Drawable /* d */, + char* /* data */, + XShmSegmentInfo* /* shminfo */, + unsigned int /* width */, + unsigned int /* height */, + unsigned int /* depth */ +); + +_XFUNCPROTOEND +#endif /* _XSHM_SERVER_ */ + +#endif diff --git a/system/include/X11/extensions/Xext.h b/system/include/X11/extensions/Xext.h new file mode 100644 index 00000000..858592b7 --- /dev/null +++ b/system/include/X11/extensions/Xext.h @@ -0,0 +1,53 @@ +/* + * +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 _XEXT_H_ +#define _XEXT_H_ + +#include <X11/Xfuncproto.h> + +_XFUNCPROTOBEGIN + +typedef int (*XextErrorHandler) ( + Display * /* dpy */, + _Xconst char* /* ext_name */, + _Xconst char* /* reason */ +); + +extern XextErrorHandler XSetExtensionErrorHandler( + XextErrorHandler /* handler */ +); + +extern int XMissingExtension( + Display* /* dpy */, + _Xconst char* /* ext_name */ +); + +_XFUNCPROTOEND + +#define X_EXTENSION_UNKNOWN "unknown" +#define X_EXTENSION_MISSING "missing" + +#endif /* _XEXT_H_ */ diff --git a/system/include/X11/extensions/extutil.h b/system/include/X11/extensions/extutil.h new file mode 100644 index 00000000..29404d5a --- /dev/null +++ b/system/include/X11/extensions/extutil.h @@ -0,0 +1,190 @@ +/* + * +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: Jim Fulton, MIT The Open Group + * + * Xlib Extension-Writing Utilities + * + * This package contains utilities for writing the client API for various + * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND + * ARE SUBJECT TO CHANGE! + */ + +#ifndef _EXTUTIL_H_ +#define _EXTUTIL_H_ + +#include <X11/extensions/Xext.h> + +/* + * We need to keep a list of open displays since the Xlib display list isn't + * public. We also have to per-display info in a separate block since it isn't + * stored directly in the Display structure. + */ +typedef struct _XExtDisplayInfo { + struct _XExtDisplayInfo *next; /* keep a linked list */ + Display *display; /* which display this is */ + XExtCodes *codes; /* the extension protocol codes */ + XPointer data; /* extra data for extension to use */ +} XExtDisplayInfo; + +typedef struct _XExtensionInfo { + XExtDisplayInfo *head; /* start of list */ + XExtDisplayInfo *cur; /* most recently used */ + int ndisplays; /* number of displays */ +} XExtensionInfo; + +typedef struct _XExtensionHooks { + int (*create_gc)( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + int (*copy_gc)( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + int (*flush_gc)( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + int (*free_gc)( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + int (*create_font)( + Display* /* display */, + XFontStruct* /* fs */, + XExtCodes* /* codes */ +); + int (*free_font)( + Display* /* display */, + XFontStruct* /* fs */, + XExtCodes* /* codes */ +); + int (*close_display)( + Display* /* display */, + XExtCodes* /* codes */ +); + Bool (*wire_to_event)( + Display* /* display */, + XEvent* /* re */, + xEvent* /* event */ +); + Status (*event_to_wire)( + Display* /* display */, + XEvent* /* re */, + xEvent* /* event */ +); + int (*error)( + Display* /* display */, + xError* /* err */, + XExtCodes* /* codes */, + int* /* ret_code */ +); + char *(*error_string)( + Display* /* display */, + int /* code */, + XExtCodes* /* codes */, + char* /* buffer */, + int /* nbytes */ +); +} XExtensionHooks; + +extern XExtensionInfo *XextCreateExtension( + void +); +extern void XextDestroyExtension( + XExtensionInfo* /* info */ +); +extern XExtDisplayInfo *XextAddDisplay( + XExtensionInfo* /* extinfo */, + Display* /* dpy */, + _Xconst char* /* ext_name */, + XExtensionHooks* /* hooks */, + int /* nevents */, + XPointer /* data */ +); +extern int XextRemoveDisplay( + XExtensionInfo* /* extinfo */, + Display* /* dpy */ +); +extern XExtDisplayInfo *XextFindDisplay( + XExtensionInfo* /* extinfo */, + Display* /* dpy */ +); + +#define XextHasExtension(i) ((i) && ((i)->codes)) +#define XextCheckExtension(dpy,i,name,val) \ + if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; } +#define XextSimpleCheckExtension(dpy,i,name) \ + if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; } + + +/* + * helper macros to generate code that is common to all extensions; caller + * should prefix it with static if extension source is in one file; this + * could be a utility function, but have to stack 6 unused arguments for + * something that is called many, many times would be bad. + */ +#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \ +XExtDisplayInfo *proc (Display *dpy) \ +{ \ + XExtDisplayInfo *dpyinfo; \ + if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \ + if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \ + dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \ + return dpyinfo; \ +} + +#define XEXT_FIND_DISPLAY_PROTO(proc) \ + XExtDisplayInfo *proc(Display *dpy) + +#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \ +int proc (Display *dpy, XExtCodes *codes) \ +{ \ + return XextRemoveDisplay (extinfo, dpy); \ +} + +#define XEXT_CLOSE_DISPLAY_PROTO(proc) \ + int proc(Display *dpy, XExtCodes *codes) + +#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \ +char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \ +{ \ + code -= codes->first_error; \ + if (code >= 0 && code < nerr) { \ + char tmp[256]; \ + sprintf (tmp, "%s.%d", extname, code); \ + XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \ + return buf; \ + } \ + return (char *)0; \ +} + +#define XEXT_ERROR_STRING_PROTO(proc) \ + char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n) +#endif diff --git a/system/include/X11/extensions/shm.h b/system/include/X11/extensions/shm.h new file mode 100644 index 00000000..e076402a --- /dev/null +++ b/system/include/X11/extensions/shm.h @@ -0,0 +1,44 @@ +/************************************************************ + +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 */ + +#ifndef _SHM_H_ +#define _SHM_H_ + +#define SHMNAME "MIT-SHM" + +#define SHM_MAJOR_VERSION 1 /* current version numbers */ +#define SHM_MINOR_VERSION 1 + +#define ShmCompletion 0 +#define ShmNumberEvents (ShmCompletion + 1) + +#define BadShmSeg 0 +#define ShmNumberErrors (BadShmSeg + 1) + + +#endif /* _SHM_H_ */ diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h index 403d8084..390533f3 100644 --- a/system/include/emscripten/bind.h +++ b/system/include/emscripten/bind.h @@ -17,6 +17,8 @@ namespace emscripten { BY_EMVAL = 2, }; +#define EMSCRIPTEN_ALWAYS_INLINE __attribute__((always_inline)) + namespace internal { typedef long GenericEnumValue; @@ -533,6 +535,8 @@ namespace emscripten { template<typename ClassType> class value_array : public internal::noncopyable { public: + typedef ClassType class_type; + value_array(const char* name) { using namespace internal; _embind_register_value_array( @@ -605,6 +609,8 @@ namespace emscripten { template<typename ClassType> class value_object : public internal::noncopyable { public: + typedef ClassType class_type; + value_object(const char* name) { using namespace internal; _embind_register_value_object( @@ -689,6 +695,10 @@ namespace emscripten { static void* share(void* v) { return 0; // no sharing } + + static PointerType* construct_null() { + return new PointerType; + } }; // specialize if you have a different pointer type @@ -720,6 +730,10 @@ namespace emscripten { val_deleter(val::take_ownership(v))); } + static PointerType* construct_null() { + return new PointerType; + } + private: class val_deleter { public: @@ -745,6 +759,8 @@ namespace emscripten { template<typename T> class wrapper : public T { public: + typedef T class_type; + explicit wrapper(val&& wrapped) : wrapped(std::forward<val>(wrapped)) {} @@ -794,13 +810,14 @@ namespace emscripten { // NOTE: this returns the class type, not the pointer type template<typename T> inline TYPEID getActualType(T* ptr) { - assert(ptr); return reinterpret_cast<TYPEID>(&typeid(*ptr)); }; } template<typename BaseClass> struct base { + typedef BaseClass class_type; + template<typename ClassType> static void verify() { static_assert(!std::is_same<ClassType, BaseClass>::value, "Base must not have same type as class"); @@ -847,6 +864,9 @@ namespace emscripten { template<typename ClassType, typename BaseSpecifier = internal::NoBaseClass> class class_ { public: + typedef ClassType class_type; + typedef BaseSpecifier base_specifier; + class_() = delete; explicit class_(const char* name) { @@ -867,7 +887,7 @@ namespace emscripten { } template<typename PointerType> - class_& smart_ptr() { + const class_& smart_ptr() const { using namespace internal; typedef smart_ptr_trait<PointerType> PointerTrait; @@ -881,21 +901,21 @@ namespace emscripten { typeid(PointerType).name(), PointerTrait::get_sharing_policy(), reinterpret_cast<GenericFunction>(&PointerTrait::get), - reinterpret_cast<GenericFunction>(&operator_new<PointerType>), + reinterpret_cast<GenericFunction>(&PointerTrait::construct_null), reinterpret_cast<GenericFunction>(&PointerTrait::share), reinterpret_cast<GenericFunction>(&raw_destructor<PointerType>)); return *this; }; template<typename... ConstructorArgs, typename... Policies> - class_& constructor(Policies... policies) { + const class_& constructor(Policies... policies) const { return constructor( &internal::operator_new<ClassType, ConstructorArgs...>, policies...); } template<typename... Args, typename ReturnType, typename... Policies> - class_& constructor(ReturnType (*factory)(Args...), Policies...) { + const class_& constructor(ReturnType (*factory)(Args...), Policies...) const { using namespace internal; // TODO: allows all raw pointers... policies need a rethink @@ -910,7 +930,7 @@ namespace emscripten { } template<typename SmartPtr, typename... Args, typename... Policies> - class_& smart_ptr_constructor(SmartPtr (*factory)(Args...), Policies...) { + const class_& smart_ptr_constructor(SmartPtr (*factory)(Args...), Policies...) const { using namespace internal; smart_ptr<SmartPtr>(); @@ -926,7 +946,7 @@ namespace emscripten { } template<typename WrapperType, typename PointerType = WrapperType*> - class_& allow_subclass() { + const class_& allow_subclass() const { using namespace internal; auto cls = class_<WrapperType, base<ClassType>>(typeid(WrapperType).name()) @@ -940,7 +960,7 @@ namespace emscripten { } template<typename ReturnType, typename... Args, typename... Policies> - class_& function(const char* methodName, ReturnType (ClassType::*memberFunction)(Args...), Policies...) { + EMSCRIPTEN_ALWAYS_INLINE const class_& function(const char* methodName, ReturnType (ClassType::*memberFunction)(Args...), Policies...) const { using namespace internal; typename WithPolicies<Policies...>::template ArgTypeList<ReturnType, AllowedRawPointer<ClassType>, Args...> args; @@ -955,7 +975,7 @@ namespace emscripten { } template<typename ReturnType, typename... Args, typename... Policies> - class_& function(const char* methodName, ReturnType (ClassType::*memberFunction)(Args...) const, Policies...) { + EMSCRIPTEN_ALWAYS_INLINE const class_& function(const char* methodName, ReturnType (ClassType::*memberFunction)(Args...) const, Policies...) const { using namespace internal; typename WithPolicies<Policies...>::template ArgTypeList<ReturnType, AllowedRawPointer<const ClassType>, Args...> args; @@ -970,7 +990,7 @@ namespace emscripten { } template<typename ReturnType, typename ThisType, typename... Args, typename... Policies> - class_& function(const char* methodName, ReturnType (*function)(ThisType, Args...), Policies...) { + EMSCRIPTEN_ALWAYS_INLINE const class_& function(const char* methodName, ReturnType (*function)(ThisType, Args...), Policies...) const { using namespace internal; typename WithPolicies<Policies...>::template ArgTypeList<ReturnType, ThisType, Args...> args; @@ -985,7 +1005,7 @@ namespace emscripten { } template<typename FieldType, typename = typename std::enable_if<!std::is_function<FieldType>::value>::type> - class_& property(const char* fieldName, const FieldType ClassType::*field) { + EMSCRIPTEN_ALWAYS_INLINE const class_& property(const char* fieldName, const FieldType ClassType::*field) const { using namespace internal; _embind_register_class_property( @@ -1001,7 +1021,7 @@ namespace emscripten { } template<typename FieldType, typename = typename std::enable_if<!std::is_function<FieldType>::value>::type> - class_& property(const char* fieldName, FieldType ClassType::*field) { + EMSCRIPTEN_ALWAYS_INLINE const class_& property(const char* fieldName, FieldType ClassType::*field) const { using namespace internal; _embind_register_class_property( @@ -1017,7 +1037,7 @@ namespace emscripten { } template<typename Getter> - class_& property(const char* fieldName, Getter getter) { + EMSCRIPTEN_ALWAYS_INLINE const class_& property(const char* fieldName, Getter getter) const { using namespace internal; typedef GetterPolicy<Getter> GP; _embind_register_class_property( @@ -1033,7 +1053,7 @@ namespace emscripten { } template<typename Getter, typename Setter> - class_& property(const char* fieldName, Getter getter, Setter setter) { + EMSCRIPTEN_ALWAYS_INLINE const class_& property(const char* fieldName, Getter getter, Setter setter) const { using namespace internal; typedef GetterPolicy<Getter> GP; typedef SetterPolicy<Setter> SP; @@ -1050,7 +1070,7 @@ namespace emscripten { } template<typename ReturnType, typename... Args, typename... Policies> - class_& class_function(const char* methodName, ReturnType (*classMethod)(Args...), Policies...) { + EMSCRIPTEN_ALWAYS_INLINE const class_& class_function(const char* methodName, ReturnType (*classMethod)(Args...), Policies...) const { using namespace internal; typename WithPolicies<Policies...>::template ArgTypeList<ReturnType, Args...> args; @@ -1157,6 +1177,8 @@ namespace emscripten { template<typename EnumType> class enum_ { public: + typedef EnumType enum_type; + enum_(const char* name) { _embind_register_enum( internal::TypeID<EnumType>::get(), @@ -1199,7 +1221,7 @@ namespace emscripten { _embind_register_constant( name, TypeID<const ConstantType&>::get(), - asGenericValue(BindingType<const ConstantType&>::toWireType(v))); + asGenericValue(BT::toWireType(v))); } } diff --git a/system/include/emscripten/emscripten.h b/system/include/emscripten/emscripten.h index 918059f2..7a2b8175 100644 --- a/system/include/emscripten/emscripten.h +++ b/system/include/emscripten/emscripten.h @@ -14,7 +14,7 @@ extern "C" { #endif -#if !EMSCRIPTEN +#if !__EMSCRIPTEN__ #include <SDL/SDL.h> /* for SDL_Delay in async_call */ #endif @@ -40,28 +40,34 @@ extern "C" { #define EM_ASM(...) emscripten_asm_const(#__VA_ARGS__) /* - * Input-output versions of EM_ASM. EM_ASM_INT receives arguments of - * either int or double type and returns an int; EM_ASM_DOUBLE - * receives similar arguments (int or double) but returns a double. - * Arguments arrive as $0, $1 etc; output value should be returned: + * Input-output versions of EM_ASM. + * + * EM_ASM_ (an extra _ is added) allows sending values (ints + * or doubles) into the code. If you also want a return value, + * EM_ASM_INT receives arguments (of int or double type) + * and returns an int; EM_ASM_DOUBLE does the same and returns + * a double. + * + * Arguments arrive as $0, $1 etc. The output value should be returned: * * int x = EM_ASM_INT({ * console.log('I received: ' + [$0, $1]); * return $0 + $1; * }, calc(), otherCalc()); * - * Note the {,} + * Note the { and }. If you just want to receive an output value + * (int or double) but *not* to pass any values, you can use + * EM_ASM_INT_V and EM_ASM_DOUBLE_V respectively. */ +#define EM_ASM_(code, ...) emscripten_asm_const_int(#code, __VA_ARGS__) #define EM_ASM_INT(code, ...) emscripten_asm_const_int(#code, __VA_ARGS__) #define EM_ASM_DOUBLE(code, ...) emscripten_asm_const_double(#code, __VA_ARGS__) +#define EM_ASM_INT_V(code) emscripten_asm_const_int(#code) +#define EM_ASM_DOUBLE_V(code) emscripten_asm_const_double(#code) /* - * Forces LLVM to not dead-code-eliminate a function. Note that - * you still need to use EXPORTED_FUNCTIONS so it stays alive - * in JS, e.g. - * emcc -s EXPORTED_FUNCTIONS=["_main", "_myfunc"] - * and in the source file - * void EMSCRIPTEN_KEEPALIVE myfunc() {..} + * Forces LLVM to not dead-code-eliminate a function. This also + * exports the function, as if you added it to EXPORTED_FUNCTIONS. */ #define EMSCRIPTEN_KEEPALIVE __attribute__((used)) @@ -96,7 +102,13 @@ extern void emscripten_async_load_script(const char *script, void (*onload)(), v * Set a C function as the main event loop. The JS environment * will call that function at a specified number of frames per * second. Setting 0 or a negative value as the fps will use - * the browser's requestAnimationFrame mechanism. + * the browser's requestAnimationFrame mechanism. This is + * *HIGHLY* recommended if you are doing rendering, as + * the browser's requestAnimationFrame will make sure you + * render at a proper smooth rate that lines up with the + * the browser and monitor in a proper way. (If you do not + * render at all in your application, then you should pick a + * specific frame rate that makes sense for your code.) * * Pausing and resuming the main loop is useful if your app * needs to perform some synchronous operation, for example @@ -106,6 +118,9 @@ extern void emscripten_async_load_script(const char *script, void (*onload)(), v * asynchronous callbacks, but you must pause the main * loop until they complete. * + * If you want your main loop function to receive a void* + * argument, use emscripten_set_main_loop_arg. + * @simulate_infinite_loop If true, this function will throw an * exception in order to stop execution of the caller. This * will lead to the main loop being entered instead of code @@ -122,8 +137,9 @@ extern void emscripten_async_load_script(const char *script, void (*onload)(), v * you created an object on the stack, it will be cleaned up * before the main loop will be called the first time. */ -#if EMSCRIPTEN +#if __EMSCRIPTEN__ extern void emscripten_set_main_loop(void (*func)(), int fps, int simulate_infinite_loop); +extern void emscripten_set_main_loop_arg(void (*func)(void*), void *arg, int fps, int simulate_infinite_loop); extern void emscripten_pause_main_loop(); extern void emscripten_resume_main_loop(); extern void emscripten_cancel_main_loop(); @@ -146,7 +162,7 @@ extern void emscripten_cancel_main_loop(); * are not counted, do not block the main loop, and can fire * at specific time in the future. */ -#if EMSCRIPTEN +#if __EMSCRIPTEN__ extern void _emscripten_push_main_loop_blocker(void (*func)(void *), void *arg, const char *name); extern void _emscripten_push_uncounted_main_loop_blocker(void (*func)(void *), void *arg, const char *name); #else @@ -168,7 +184,7 @@ inline void _emscripten_push_uncounted_main_loop_blocker(void (*func)(void *), v * to 10, then push 10 blockers, as they complete the user will * see x/10 and so forth. */ -#if EMSCRIPTEN +#if __EMSCRIPTEN__ extern void emscripten_set_main_loop_expected_blockers(int num); #else inline void emscripten_set_main_loop_expected_blockers(int num) {} @@ -183,7 +199,7 @@ inline void emscripten_set_main_loop_expected_blockers(int num) {} * If millis is negative, the browser's requestAnimationFrame * mechanism is used. */ -#if EMSCRIPTEN +#if __EMSCRIPTEN__ extern void emscripten_async_call(void (*func)(void *), void *arg, int millis); #else inline void emscripten_async_call(void (*func)(void *), void *arg, int millis) { @@ -227,7 +243,14 @@ void emscripten_get_canvas_size(int *width, int *height, int *isFullscreen); * absolute time, and is only meaningful in comparison to * other calls to this function. The unit is ms. */ +#if __EMSCRIPTEN__ double emscripten_get_now(); +#else +#include <time.h> +double emscripten_get_now() { + return (1000*clock())/(double)CLOCKS_PER_SEC; +} +#endif /* * Simple random number generation in [0, 1), maps to Math.random(). @@ -408,6 +431,27 @@ int emscripten_get_worker_queue_size(worker_handle worker); #define EMSCRIPTEN_NETWORK_WEBRTC 1 void emscripten_set_network_backend(int backend); +/* + * Returns the value of a compiler setting. For example + * + * emscripten_get_compiler_setting("PRECISE_F32") + * + * will return an integer representing the value of + * PRECISE_F32 during compilation. For values containing + * anything other than an integer, a string is returned + * (you will need to cast the int return value to a char*). + * + * Some useful things this can do is provide the + * version of emscripten ("EMSCRIPTEN_VERSION"), the optimization + * level ("OPT_LEVEL"), debug level ("DEBUG_LEVEL"), etc. + * + * For this command to work, you must build with + * -s RETAIN_COMPILER_SETTINGS=1 + * as otherwise we do not want to increase the build size + * with this metadata. + */ +int emscripten_get_compiler_setting(const char *name); + /* Internal APIs. Be careful with these. */ /* diff --git a/system/include/emscripten/html5.h b/system/include/emscripten/html5.h new file mode 100644 index 00000000..6109d87f --- /dev/null +++ b/system/include/emscripten/html5.h @@ -0,0 +1,635 @@ +#ifndef __emscripten_events_h__ +#define __emscripten_events_h__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* This file defines Emscripten low-level glue bindings for interfacing with the following HTML5 APIs: + * - DOM Level 3 Events: Keyboard, Mouse, Mouse Wheel, Resize, Scroll, Focus. See https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html + * - DeviceOrientation Events for gyro and accelerometer. See http://www.w3.org/TR/orientation-event/ + * - Screen Orientation Events for portrait/landscape handling. See https://dvcs.w3.org/hg/screen-orientation/raw-file/tip/Overview.html + * - Fullscreen Events for browser canvas fullscreen modes transitioning. See https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html + * - Pointer Lock Events for relative-mode mouse motion control. See http://www.w3.org/TR/pointerlock/ + * - Vibration API for mobile device haptic vibration feedback control. See http://dev.w3.org/2009/dap/vibration/ + * - Page Visibility Events for power management control. See http://www.w3c-test.org/webperf/specs/PageVisibility/ + * - Touch Events. See http://www.w3.org/TR/touch-events/ + * - Gamepad API. See http://www.w3.org/TR/gamepad/ + * - Beforeunload event. See http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#beforeunloadevent + * - WebGL context events. See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2 + * + * Most web APIs are event-based, which means that the functionality is accessed by registering a callback function to be called when the event occurs. The + * Gamepad API is currently an exception, for which only a polling API is available. For some APIs, both an event-based and a polling-based API is exposed. + * + * Calling a callback registration function with a null pointer function causes an unregistration of that callback from the given target element. All event + * handlers are also automatically unregistered when the C exit() function is invoked during the atexit handler pass. Use either the function + * emscripten_set_main_loop() or set Module.noExitRuntime = true; to make sure that leaving main() will not immediately cause an exit() and clean up the + * event handlers. + * + * Throughout this file, the function signatures have a 'target' parameter. This parameter allows specifying the HTML Element ID to which the callback + * registration is to be applied to. This field has the following special meanings: + * - 0 or NULL: A default element is chosen automatically based on the event type, which should be reasonable most of the time. + * - "#window": The event listener is applied to the JS 'window' object. + * - "#document": The event listener is applied to the JS 'document' object. + * - "#screen": The event listener is applied to the JS 'window.screen' object. + * - "#canvas": The event listener is applied to the Emscripten default WebGL canvas element. + * - Any other string without a leading hash "#" sign: The event listener is applied to the element by the given ID on the page. + * + * The callback hook functions also take in a 'userData' parameter. This is a custom user-defineable value that will be carried through unchanged to all + * invocations of the registered event callback. Use this e.g. to pass a pointer to a C++ class or similar to enclose the C API in a clean object-oriented manner. + * + * Callback handlers that return an EM_BOOL may return nonzero to signal that the default action for that event is to be suppressed. This will call + * the .preventDefault(); member on the event. Returning zero will cause the default browser event action to be carried out. + * + * Most functions return the result using the type EMSCRIPTEN_RESULT. Nonzero and positive values denote success. Negative values + * signal failure. None of the functions fail or abort by throwing a JS or C++ exception. If a particular browser does not support the given feature, + * the value EMSCRIPTEN_RESULT_NOT_SUPPORTED will be returned at the time the callback is registered. + * + * Due to web security purposes, the pointer lock and fullscreen requests can only be invoked from inside an user-originated event handler. Such requests + * are automatically deferred until the user presses a keyboard or mouse button the next time. + */ + +#define EMSCRIPTEN_EVENT_KEYPRESS 1 +#define EMSCRIPTEN_EVENT_KEYDOWN 2 +#define EMSCRIPTEN_EVENT_KEYUP 3 +#define EMSCRIPTEN_EVENT_CLICK 4 +#define EMSCRIPTEN_EVENT_MOUSEDOWN 5 +#define EMSCRIPTEN_EVENT_MOUSEUP 6 +#define EMSCRIPTEN_EVENT_DBLCLICK 7 +#define EMSCRIPTEN_EVENT_MOUSEMOVE 8 +#define EMSCRIPTEN_EVENT_WHEEL 9 +#define EMSCRIPTEN_EVENT_RESIZE 10 +#define EMSCRIPTEN_EVENT_SCROLL 11 +#define EMSCRIPTEN_EVENT_BLUR 12 +#define EMSCRIPTEN_EVENT_FOCUS 13 +#define EMSCRIPTEN_EVENT_FOCUSIN 14 +#define EMSCRIPTEN_EVENT_FOCUSOUT 15 +#define EMSCRIPTEN_EVENT_DEVICEORIENTATION 16 +#define EMSCRIPTEN_EVENT_DEVICEMOTION 17 +#define EMSCRIPTEN_EVENT_ORIENTATIONCHANGE 18 +#define EMSCRIPTEN_EVENT_FULLSCREENCHANGE 19 +#define EMSCRIPTEN_EVENT_POINTERLOCKCHANGE 20 +#define EMSCRIPTEN_EVENT_VISIBILITYCHANGE 21 +#define EMSCRIPTEN_EVENT_TOUCHSTART 22 +#define EMSCRIPTEN_EVENT_TOUCHEND 23 +#define EMSCRIPTEN_EVENT_TOUCHMOVE 24 +#define EMSCRIPTEN_EVENT_TOUCHCANCEL 25 +#define EMSCRIPTEN_EVENT_GAMEPADCONNECTED 26 +#define EMSCRIPTEN_EVENT_GAMEPADDISCONNECTED 27 +#define EMSCRIPTEN_EVENT_BEFOREUNLOAD 28 +#define EMSCRIPTEN_EVENT_BATTERYCHARGINGCHANGE 29 +#define EMSCRIPTEN_EVENT_BATTERYLEVELCHANGE 30 +#define EMSCRIPTEN_EVENT_WEBGLCONTEXTLOST 31 +#define EMSCRIPTEN_EVENT_WEBGLCONTEXTRESTORED 32 + +#define EMSCRIPTEN_RESULT int + +// The operation succeeded +#define EMSCRIPTEN_RESULT_SUCCESS 0 + +// For web security reasons, the requested operation cannot be completed now, but was deferred for completion in the next event handler. +#define EMSCRIPTEN_RESULT_DEFERRED 1 + +// The given operation is not supported by this browser or the target element. +#define EMSCRIPTEN_RESULT_NOT_SUPPORTED -1 + +// For web security reasons, the requested operation could not be completed now, and it failed since the user requested the operation to not be deferred. +#define EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED -2 + +// The given target element for the operation is invalid. +#define EMSCRIPTEN_RESULT_INVALID_TARGET -3 + +// The given target element for the operation was not found. +#define EMSCRIPTEN_RESULT_UNKNOWN_TARGET -4 + +// An invalid parameter was passed to the function. +#define EMSCRIPTEN_RESULT_INVALID_PARAM -5 + +// The operation failed due to some generic reason. +#define EMSCRIPTEN_RESULT_FAILED -6 + +// Operation failed since no data is currently available. +#define EMSCRIPTEN_RESULT_NO_DATA -7 + +#define EM_BOOL int +#define EM_UTF8 char + +#define DOM_KEY_LOCATION int +#define DOM_KEY_LOCATION_STANDARD 0x00 +#define DOM_KEY_LOCATION_LEFT 0x01 +#define DOM_KEY_LOCATION_RIGHT 0x02 +#define DOM_KEY_LOCATION_NUMPAD 0x03 + +/* + * The event structure passed in keyboard events keypress, keydown and keyup. + * https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#keys + */ +typedef struct EmscriptenKeyboardEvent { + // The printed representation of the pressed key. + EM_UTF8 key[32]; + // A string that identifies the physical key being pressed. The value is not affected by the current keyboard + // layout or modifier state, so a particular key will always return the same value. + EM_UTF8 code[32]; + // Indicates the location of the key on the keyboard. One of the DOM_KEY_LOCATION_ values. + unsigned long location; + // Specifies which modifiers were active during the key event. + EM_BOOL ctrlKey; + EM_BOOL shiftKey; + EM_BOOL altKey; + EM_BOOL metaKey; + // Specifies if this keyboard event represents a repeated press. + EM_BOOL repeat; + // A locale string indicating the locale the keyboard is configured for. This may be the empty string if the + // browser or device doesn't know the keyboard's locale. + EM_UTF8 locale[32]; + // The following fields are values from previous versions of the DOM key events specifications. + // See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent?redirectlocale=en-US&redirectslug=DOM%2FKeyboardEvent + // The character representation of the key. + EM_UTF8 charValue[32]; + // The Unicode reference number of the key; this attribute is used only by the keypress event. For keys whose char attribute + // contains multiple characters, this is the Unicode value of the first character in that attribute. + unsigned long charCode; + // A system and implementation dependent numerical code identifying the unmodified value of the pressed key. + unsigned long keyCode; + // A system and implementation dependent numeric code identifying the unmodified value of the pressed key; this is usually the same as keyCode. + unsigned long which; +} EmscriptenKeyboardEvent; + +/* + * Registers a callback function for receiving browser-generated keyboard input events. + * See https://developer.mozilla.org/en/DOM/Event/UIEvent/KeyEvent + * and http://www.javascriptkit.com/jsref/eventkeyboardmouse.shtml + */ +extern EMSCRIPTEN_RESULT emscripten_set_keypress_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_keydown_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_keyup_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData)); + +/* + * The event structure passed in mouse events click, mousedown, mouseup, dblclick and mousemove. + * https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-MouseEvent + */ +typedef struct EmscriptenMouseEvent { + // A timestamp of when this data was generated by the browser. This is an absolute wallclock time in milliseconds. + double timestamp; + // The coordinate relative to the browser screen coordinate system. + long screenX; + long screenY; + // The coordinate relative to the viewport associate with the event. + long clientX; + long clientY; + // Specifies which modifiers were active during the mouse event. + EM_BOOL ctrlKey; + EM_BOOL shiftKey; + EM_BOOL altKey; + EM_BOOL metaKey; + // Which pointer device button changed state. + unsigned short button; + // A bitmask that indicates which combinations of mouse buttons were being held down at the time of the event. + unsigned short buttons; + // If pointer lock is active, these two extra fields give relative mouse movement since the last event. + long movementX; + long movementY; + // Emscripten-specific extension: These fields give the mouse coordinates mapped to the Emscripten canvas client area. + long canvasX; + long canvasY; + // Pad this struct to multiple of 8 bytes to make WheelEvent unambiguously align to 8 bytes. + long padding; +} EmscriptenMouseEvent; + +/* + * Registers a callback function for receiving browser-generated mouse input events. + * See https://developer.mozilla.org/en/DOM/MouseEvent + */ +extern EMSCRIPTEN_RESULT emscripten_set_click_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_mousedown_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_mouseup_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_dblclick_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_mousemove_callback(const char *target, void *userData, int useCapture, int (*func)(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)); +/* + * Returns the most recently received mouse event state. Note that for this function call to succeed, emscripten_set_xx_callback must have first + * been called with one of the mouse event types and a non-zero callback function pointer to enable the Mouse state capture. + */ +extern EMSCRIPTEN_RESULT emscripten_get_mouse_status(EmscriptenMouseEvent *mouseState); + +#define DOM_DELTA_PIXEL 0x00 +#define DOM_DELTA_LINE 0x01 +#define DOM_DELTA_PAGE 0x02 + +/* + * The event structure passed in mouse wheelevent. + * https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-WheelEvent + */ +typedef struct EmscriptenWheelEvent { + // Specifies general mouse information related to this event. + EmscriptenMouseEvent mouse; + // Measures along different axes the movement of the wheel. + double deltaX; + double deltaY; + double deltaZ; + // One of the DOM_DELTA_ values that indicates the units of measurement for the delta values. + unsigned long deltaMode; +} EmscriptenWheelEvent; + +/* + * Registers a callback function for receiving browser-generated mouse wheel events. + * See http://www.w3.org/TR/DOM-Level-3-Events/#event-type-wheel + */ +extern EMSCRIPTEN_RESULT emscripten_set_wheel_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData)); + +/* + * The event structure passed in DOM element resize and scroll events. + * https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-UIEvent + */ +typedef struct EmscriptenUiEvent { + // Specifies detail information about this event. + long detail; + // The clientWidth/clientHeight of the document.body element. + int documentBodyClientWidth; + int documentBodyClientHeight; + // The innerWidth/innerHeight of the window element. + int windowInnerWidth; + int windowInnerHeight; + // The outerWidth/outerHeight of the window element. + int windowOuterWidth; + int windowOuterHeight; + // The page scroll position. + int scrollTop; + int scrollLeft; +} EmscriptenUiEvent; + +/* + * Registers a callback function for receiving DOM element resize and scroll events. + * See https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-resize + */ +extern EMSCRIPTEN_RESULT emscripten_set_resize_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenUiEvent *uiEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_scroll_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenUiEvent *uiEvent, void *userData)); + +/* + * The event structure passed in DOM element blur, focus, focusin and focusout events. + * https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-FocusEvent + */ +typedef struct EmscriptenFocusEvent { + // The nodeName of the target HTML Element. See https://developer.mozilla.org/en-US/docs/Web/API/Node.nodeName + EM_UTF8 nodeName[128]; + // The HTML Element ID of the target element. + EM_UTF8 id[128]; +} EmscriptenFocusEvent; + +/* + * Registers a callback function for receiving DOM element blur, focus, focusin and focusout events. + * See https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-blur + */ +extern EMSCRIPTEN_RESULT emscripten_set_blur_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenFocusEvent *focusEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_focus_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenFocusEvent *focusEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_focusin_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenFocusEvent *focusEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_focusout_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenFocusEvent *focusEvent, void *userData)); + +/* + * The event structure passed in the deviceorientation event. + * http://dev.w3.org/geo/api/spec-source-orientation.html#deviceorientation + */ +typedef struct EmscriptenDeviceOrientationEvent { + // Absolute wallclock time in msec units of when the event occurred. + double timestamp; + // The orientation of the device in terms of the transformation from a coordinate frame fixed on the Earth to a coordinate frame fixed in the device. + double alpha; + double beta; + double gamma; + // If false, the orientation is only relative to some other bas orinetation, not to the fixed coordinate frame. + EM_BOOL absolute; +} EmscriptenDeviceOrientationEvent; + +/* + * Registers a callback function for receiving the deviceorientation event. + * See http://dev.w3.org/geo/api/spec-source-orientation.html + */ +extern EMSCRIPTEN_RESULT emscripten_set_deviceorientation_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenDeviceOrientationEvent *orientationEvent, void *userData)); +/* + * Returns the most recently received deviceorientation event state. Note that for this function call to succeed, emscripten_set_deviceorientation_callback + * must have first been called with one of the mouse event types and a non-zero callback function pointer to enable the Device Orientation state capture. + */ +extern EMSCRIPTEN_RESULT emscripten_get_deviceorientation_status(EmscriptenDeviceOrientationEvent *orientationState); + +/* + * The event structure passed in the devicemotion event. + * http://dev.w3.org/geo/api/spec-source-orientation.html#devicemotion + */ +typedef struct EmscriptenDeviceMotionEvent { + // Absolute wallclock time in msec units of when the event occurred. + double timestamp; + // Acceleration of the device excluding gravity. + double accelerationX; + double accelerationY; + double accelerationZ; + // Acceleration of the device including gravity. + double accelerationIncludingGravityX; + double accelerationIncludingGravityY; + double accelerationIncludingGravityZ; + // The rotational delta of the device. + double rotationRateAlpha; + double rotationRateBeta; + double rotationRateGamma; +} EmscriptenDeviceMotionEvent; + +/* + * Registers a callback function for receiving the devicemotion event. + * See http://dev.w3.org/geo/api/spec-source-orientation.html + */ +extern EMSCRIPTEN_RESULT emscripten_set_devicemotion_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenDeviceMotionEvent *motionEvent, void *userData)); +/* + * Returns the most recently received deviceomotion event state. Note that for this function call to succeed, emscripten_set_devicemotion_callback + * must have first been called with one of the mouse event types and a non-zero callback function pointer to enable the Device Motion state capture. + */ +extern EMSCRIPTEN_RESULT emscripten_get_devicemotion_status(EmscriptenDeviceMotionEvent *motionState); + +#define EMSCRIPTEN_ORIENTATION_PORTRAIT_PRIMARY 1 +#define EMSCRIPTEN_ORIENTATION_PORTRAIT_SECONDARY 2 +#define EMSCRIPTEN_ORIENTATION_LANDSCAPE_PRIMARY 4 +#define EMSCRIPTEN_ORIENTATION_LANDSCAPE_SECONDARY 8 + +/* + * The event structure passed in the orientationchange event. + * https://dvcs.w3.org/hg/screen-orientation/raw-file/tip/Overview.html + */ +typedef struct EmscriptenOrientationChangeEvent { + // One of EM_ORIENTATION_PORTRAIT_xx fields, or -1 if unknown. + int orientationIndex; + // Emscripten-specific extension: Some browsers refer to 'window.orientation', so report that as well. + // Orientation angle in degrees. 0: "default orientation", i.e. default upright orientation to hold the mobile device in. Could be either landscape or portrait. + int orientationAngle; +} EmscriptenOrientationChangeEvent; + +/* + * Registers a callback function for receiving the orientationchange event. + * https://dvcs.w3.org/hg/screen-orientation/raw-file/tip/Overview.html + */ +extern EMSCRIPTEN_RESULT emscripten_set_orientationchange_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenOrientationChangeEvent *orientationChangeEvent, void *userData)); +/* + * Returns the current device orientation state. + */ +extern EMSCRIPTEN_RESULT emscripten_get_orientation_status(EmscriptenOrientationChangeEvent *orientationStatus); +/* + * Locks the screen orientation to the given set of allowed orientations. + * allowedOrientations: A bitfield set of EM_ORIENTATION_xx flags. + */ +extern EMSCRIPTEN_RESULT emscripten_lock_orientation(int allowedOrientations); +/* + * Allows the screen to turn again into any orientation. + */ +extern EMSCRIPTEN_RESULT emscripten_unlock_orientation(); + +/* + * The event structure passed in the fullscreenchange event. + * https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html + */ +typedef struct EmscriptenFullscreenChangeEvent { + // Specifies whether an element on the browser page is currently fullscreen. + EM_BOOL isFullscreen; + // Specifies if the current page has the ability to display elements fullscreen. + EM_BOOL fullscreenEnabled; + // The nodeName of the target HTML Element that is in full screen mode. See https://developer.mozilla.org/en-US/docs/Web/API/Node.nodeName + // If isFullscreen is false, then nodeName, id and elementWidth/Height specify information about the element that just exited fullscreen mode. + EM_UTF8 nodeName[128]; + // The HTML Element ID of the target HTML element that is in full screen mode. + EM_UTF8 id[128]; + // The new pixel size of the element that changed fullscreen status. + int elementWidth; + int elementHeight; + // The size of the whole screen, in pixels. + int screenWidth; + int screenHeight; +} EmscriptenFullscreenChangeEvent; + +/* + * Registers a callback function for receiving the fullscreenchange event. + * https://dvcs.w3.org/hg/screen-orientation/raw-file/tip/Overview.html + */ +extern EMSCRIPTEN_RESULT emscripten_set_fullscreenchange_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData)); +/* + * Returns the current page fullscreen state. + */ +extern EMSCRIPTEN_RESULT emscripten_get_fullscreen_status(EmscriptenFullscreenChangeEvent *fullscreenStatus); +/* + * Requests the given target element to transition to full screen mode. + * Note: This function can only run inside a user-generated JavaScript event handler. + * deferUntilInEventHandler: If true and you called this function outside an event callback, this request will + * be queued to be executed the next time a JS event handler runs. If false, this + * function will instead fail if not running inside a JS event handler. + */ +extern EMSCRIPTEN_RESULT emscripten_request_fullscreen(const char *target, int deferUntilInEventHandler); +/* + * Returns back to windowed browsing mode. + */ +extern EMSCRIPTEN_RESULT emscripten_exit_fullscreen(); + +/* + * The event structure passed in the pointerlockchange event. + * http://www.w3.org/TR/pointerlock/ + */ +typedef struct EmscriptenPointerlockChangeEvent { + // Specifies whether an element on the browser page currently has pointer lock enabled. + EM_BOOL isActive; + // The nodeName of the target HTML Element that has the pointer lock active. See https://developer.mozilla.org/en-US/docs/Web/API/Node.nodeName + EM_UTF8 nodeName[128]; + // The HTML Element ID of the target HTML element that has the pointer lock active. + EM_UTF8 id[128]; +} EmscriptenPointerlockChangeEvent; + +/* + * Registers a callback function for receiving the pointerlockchange event. + * Pointer lock hides the mouse cursor and exclusively gives the target element relative mouse movement events via the mousemove event. + * http://www.w3.org/TR/pointerlock/ + */ +extern EMSCRIPTEN_RESULT emscripten_set_pointerlockchange_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenPointerlockChangeEvent *pointerlockChangeEvent, void *userData)); +/* + * Returns the current page pointerlock state. + */ +extern EMSCRIPTEN_RESULT emscripten_get_pointerlock_status(EmscriptenPointerlockChangeEvent *pointerlockStatus); +/* + * Requests the given target element to grab pointerlock. + * Note: This function can only run inside a user-generated JavaScript event handler. + * deferUntilInEventHandler: If true and you called this function outside an event callback, this request will + * be queued to be executed the next time a JS event handler runs. If false, this + * function will instead fail if not running inside a JS event handler. + */ +extern EMSCRIPTEN_RESULT emscripten_request_pointerlock(const char *target, int deferUntilInEventHandler); +/* + * Exits pointer lock state and restores the mouse cursor to be visible again. + */ +extern EMSCRIPTEN_RESULT emscripten_exit_pointerlock(); + +#define EMSCRIPTEN_VISIBILITY_HIDDEN 0 +#define EMSCRIPTEN_VISIBILITY_VISIBLE 1 +#define EMSCRIPTEN_VISIBILITY_PRERENDER 2 +#define EMSCRIPTEN_VISIBILITY_UNLOADED 3 + +/* + * The event structure passed in the visibilitychange event. + * http://www.w3c-test.org/webperf/specs/PageVisibility/ + */ +typedef struct EmscriptenVisibilityChangeEvent { + // If true, the current browser page is now hidden. + EM_BOOL hidden; + // Specifies a more fine-grained state of the current page visibility status. One of the EMSCRIPTEN_VISIBILITY_ values. + int visibilityState; +} EmscriptenVisibilityChangeEvent; + +/* + * Registers a callback function for receiving the visibilitychange event. + * http://www.w3c-test.org/webperf/specs/PageVisibility/ + */ +extern EMSCRIPTEN_RESULT emscripten_set_visibilitychange_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenVisibilityChangeEvent *visibilityChangeEvent, void *userData)); +/* + * Returns the current page visibility state. + */ +extern EMSCRIPTEN_RESULT emscripten_get_visibility_status(EmscriptenVisibilityChangeEvent *visibilityStatus); + +/* + * Specifies the status of a single touch point on the page. + * See http://www.w3.org/TR/touch-events/#touch-interface + */ +typedef struct EmscriptenTouchPoint +{ + // An identification number for each touch point. + long identifier; + // The touch coordinate relative to the whole screen origin, in pixels. + long screenX; + long screenY; + // The touch coordinate relative to the viewport, in pixels. + long clientX; + long clientY; + // The touch coordinate relative to the viewport, in pixels, and including any scroll offset. + long pageX; + long pageY; + // Specifies whether this touch point changed during this event. + EM_BOOL isChanged; + // Specifies whether this touch point is still above the original target on which it was initially pressed against. + EM_BOOL onTarget; + // The touch coordinates mapped to the Emscripten canvas client area, in pixels. + long canvasX; + long canvasY; +} EmscriptenTouchPoint; + +/* + * Specifies the data of a single touch event. + * See http://www.w3.org/TR/touch-events/#touchevent-interface + */ +typedef struct EmscriptenTouchEvent { + // The number of valid elements in the touches array. + int numTouches; + // Specifies which modifiers were active during the key event. + EM_BOOL ctrlKey; + EM_BOOL shiftKey; + EM_BOOL altKey; + EM_BOOL metaKey; + // An array of currently active touches, one for each finger. + EmscriptenTouchPoint touches[32]; +} EmscriptenTouchEvent; + +/* + * Registers a callback function for receiving the touchstart, touchend, touchmove and touchcancel events. + * http://www.w3.org/TR/touch-events/ + */ +extern EMSCRIPTEN_RESULT emscripten_set_touchstart_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_touchend_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_touchmove_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_touchcancel_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)); + +/* + * Represents the current snapshot state of a gamepad. + * http://www.w3.org/TR/gamepad/#gamepad-interface + */ +typedef struct EmscriptenGamepadEvent { + // Absolute wallclock time in msec units of when the data was recorded. + double timestamp; + // The number of valid axes entries in the axis array. + int numAxes; + // The number of valid button entries in the analogButton and digitalButton arrays. + int numButtons; + // The analog state of the gamepad axes, in the range [-1, 1]. + double axis[64]; + // The analog state of the gamepad buttons, in the range [0, 1]. + double analogButton[64]; + // The digital state of the gamepad buttons, either 0 or 1. + EM_BOOL digitalButton[64]; + // Specifies whether this gamepad is connected to the browser page. + EM_BOOL connected; + // An ordinal associated with this gamepad, zero-based. + long index; + // An ID for the brand or style of the connected gamepad device. Typically, this will include the USB vendor and a product ID. + EM_UTF8 id[64]; + // A string that identifies the layout or control mapping of this device. + EM_UTF8 mapping[64]; +} EmscriptenGamepadEvent; + +/* + * Registers a callback function for receiving the gamepadconnected and gamepaddisconnected events. + * http://www.w3.org/TR/gamepad/ + */ +extern EMSCRIPTEN_RESULT emscripten_set_gamepadconnected_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_gamepaddisconnected_callback(void *userData, int useCapture, EM_BOOL (*func)(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData)); + +/* + * Returns the number of gamepads connected to the system or EMSCRIPTEN_RESULT_NOT_SUPPORTED if the current browser does not support gamepads. + * Note: A gamepad does not show up as connected until a button on it is pressed. + */ +extern int emscripten_get_num_gamepads(); +/* + * Returns a snapshot of the current gamepad state. + */ +extern EMSCRIPTEN_RESULT emscripten_get_gamepad_status(int index, EmscriptenGamepadEvent *gamepadState); + +/* + * The event structure passed in the battery chargingchange and levelchange event. + * http://www.w3.org/TR/battery-status/#batterymanager-interface + */ +typedef struct EmscriptenBatteryEvent { + double chargingTime; + double dischargingTime; + double level; + EM_BOOL charging; +} EmscriptenBatteryEvent; + +/* + * Registers a callback function for receiving the battery chargingchange and levelchange events. + * http://www.w3.org/TR/battery-status/ + */ +extern EMSCRIPTEN_RESULT emscripten_set_batterychargingchange_callback(void *userData, EM_BOOL (*func)(int eventType, const EmscriptenBatteryEvent *batteryEvent, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_batterylevelchange_callback(void *userData, EM_BOOL (*func)(int eventType, const EmscriptenBatteryEvent *batteryEvent, void *userData)); +/* + * Returns the current battery status. + */ +extern EMSCRIPTEN_RESULT emscripten_get_battery_status(EmscriptenBatteryEvent *batteryState); + +/* + * Produces a vibration feedback for given msecs. + * http://dev.w3.org/2009/dap/vibration/ + */ +extern EMSCRIPTEN_RESULT emscripten_vibrate(int msecs); +/* + * Produces a complex vibration feedback pattern. + * msecsArray: An array of timing entries [on, off, on, off, on, off, ...] where every second one specifies a duration of vibration, and + * every other one specifies a duration of silence. + * numEntries: The number of integers in the array msecsArray. + */ +extern EMSCRIPTEN_RESULT emscripten_vibrate_pattern(int *msecsArray, int numEntries); + +/* + * Registers a callback function for receiving the page beforeunload event. + * Hook onto this event to perform process right prior to page close, and/or display a confirmation notification asking if the user really wants to leave the page. + * http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#beforeunloadevent + */ +extern EMSCRIPTEN_RESULT emscripten_set_beforeunload_callback(void *userData, const char *(*func)(int eventType, const void *reserved, void *userData)); + +/* + * Registers a callback function for the canvas webgl context webglcontextlost and webglcontextrestored events. + * See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2 + */ +extern EMSCRIPTEN_RESULT emscripten_set_webglcontextlost_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const void *reserved, void *userData)); +extern EMSCRIPTEN_RESULT emscripten_set_webglcontextrestored_callback(const char *target, void *userData, int useCapture, EM_BOOL (*func)(int eventType, const void *reserved, void *userData)); + +#ifdef __cplusplus +} // ~extern "C" +#endif + +#endif diff --git a/system/include/emscripten/val.h b/system/include/emscripten/val.h index b712d164..19b1beb1 100644 --- a/system/include/emscripten/val.h +++ b/system/include/emscripten/val.h @@ -11,10 +11,18 @@ namespace emscripten { void _emval_register_symbol(const char*); typedef struct _EM_VAL* EM_VAL; + typedef struct _EM_DESTRUCTORS* EM_DESTRUCTORS; + + // TODO: functions returning this are reinterpret_cast + // into the correct return type. this needs some thought + // for asm.js. + typedef void _POLYMORPHIC_RESULT; void _emval_incref(EM_VAL value); void _emval_decref(EM_VAL value); + void _emval_run_destructors(EM_DESTRUCTORS handle); + EM_VAL _emval_new_array(); EM_VAL _emval_new_object(); EM_VAL _emval_undefined(); @@ -32,7 +40,8 @@ namespace emscripten { EM_VAL _emval_get_module_property(const char* name); EM_VAL _emval_get_property(EM_VAL object, EM_VAL key); void _emval_set_property(EM_VAL object, EM_VAL key, EM_VAL value); - void _emval_as(EM_VAL value, TYPEID returnType); + _POLYMORPHIC_RESULT _emval_as(EM_VAL value, TYPEID returnType, EM_DESTRUCTORS* runDestructors); + EM_VAL _emval_call( EM_VAL value, unsigned argCount, @@ -57,7 +66,11 @@ namespace emscripten { template<typename ReturnType, typename... Args> struct Signature { - typedef typename BindingType<ReturnType>::WireType (*MethodCaller)(EM_VAL value, const char* methodName, typename BindingType<Args>::WireType...); + typedef typename BindingType<ReturnType>::WireType (*MethodCaller)( + EM_VAL value, + const char* methodName, + EM_DESTRUCTORS* destructors, + typename BindingType<Args>::WireType...); static MethodCaller get_method_caller() { static MethodCaller fp = reinterpret_cast<MethodCaller>(init_method_caller()); @@ -71,15 +84,34 @@ namespace emscripten { } }; + struct DestructorsRunner { + public: + explicit DestructorsRunner(EM_DESTRUCTORS d) + : destructors(d) + {} + ~DestructorsRunner() { + _emval_run_destructors(destructors); + } + + DestructorsRunner(const DestructorsRunner&) = delete; + void operator=(const DestructorsRunner&) = delete; + + private: + EM_DESTRUCTORS destructors; + }; + template<typename ReturnType, typename... Args> struct MethodCaller { static ReturnType call(EM_VAL handle, const char* methodName, Args&&... args) { auto caller = Signature<ReturnType, Args...>::get_method_caller(); + + EM_DESTRUCTORS destructors; auto wireType = caller( handle, methodName, + &destructors, toWireType(std::forward<Args>(args))...); - WireDeleter<ReturnType> deleter(wireType); + DestructorsRunner rd(destructors); return BindingType<ReturnType>::fromWireType(wireType); } }; @@ -88,10 +120,15 @@ namespace emscripten { struct MethodCaller<void, Args...> { static void call(EM_VAL handle, const char* methodName, Args&&... args) { auto caller = Signature<void, Args...>::get_method_caller(); - return caller( + + EM_DESTRUCTORS destructors; + caller( handle, methodName, + &destructors, toWireType(std::forward<Args>(args))...); + DestructorsRunner rd(destructors); + // void requires no translation } }; } @@ -262,11 +299,13 @@ namespace emscripten { typedef typename BT::WireType (*TypedAs)( EM_VAL value, - TYPEID returnType); + TYPEID returnType, + EM_DESTRUCTORS* runDestructors); TypedAs typedAs = reinterpret_cast<TypedAs>(&_emval_as); - typename BT::WireType wt = typedAs(handle, TypeID<T>::get()); - WireDeleter<T> deleter(wt); + EM_DESTRUCTORS destructors; + typename BT::WireType wt = typedAs(handle, TypeID<T>::get(), &destructors); + DestructorsRunner dr(destructors); return BT::fromWireType(wt); } @@ -292,8 +331,6 @@ namespace emscripten { static val fromWireType(WireType v) { return val::take_ownership(v); } - static void destroy(WireType v) { - } }; } diff --git a/system/include/emscripten/wire.h b/system/include/emscripten/wire.h index a5892216..c3ce8dd0 100644 --- a/system/include/emscripten/wire.h +++ b/system/include/emscripten/wire.h @@ -7,6 +7,7 @@ // // We'll call the on-the-wire type WireType. +#include <stdio.h> #include <cstdlib> #include <memory> #include <string> @@ -130,8 +131,6 @@ namespace emscripten { constexpr static type fromWireType(WireType v) { \ return v; \ } \ - static void destroy(WireType) { \ - } \ } EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE(char); @@ -160,8 +159,6 @@ namespace emscripten { static bool fromWireType(WireType wt) { return wt; } - static void destroy(WireType) { - } }; template<> @@ -179,9 +176,6 @@ namespace emscripten { static std::string fromWireType(WireType v) { return std::string(v->data, v->length); } - static void destroy(WireType v) { - free(v); - } }; template<> @@ -199,9 +193,6 @@ namespace emscripten { static std::wstring fromWireType(WireType v) { return std::wstring(v->data, v->length); } - static void destroy(WireType v) { - free(v); - } }; template<typename T> @@ -254,10 +245,6 @@ namespace emscripten { static ActualT& fromWireType(WireType p) { return *p; } - - static void destroy(WireType p) { - delete p; - } }; // Is this necessary? @@ -280,8 +267,6 @@ namespace emscripten { static Enum fromWireType(WireType v) { return v; } - static void destroy(WireType) { - } }; // catch-all generic binding @@ -296,21 +281,6 @@ namespace emscripten { auto toWireType(T&& v) -> typename BindingType<T>::WireType { return BindingType<T>::toWireType(std::forward<T>(v)); } - - template<typename T> - struct WireDeleter { - typedef typename BindingType<T>::WireType WireType; - - WireDeleter(WireType wt) - : wt(wt) - {} - - ~WireDeleter() { - BindingType<T>::destroy(wt); - } - - WireType wt; - }; } struct memory_view { diff --git a/system/include/execinfo.h b/system/include/execinfo.h deleted file mode 100644 index 17cda148..00000000 --- a/system/include/execinfo.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2003 Maxim Sobolev <sobomax@FreeBSD.org> - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - * - * $Id: execinfo.h,v 1.2 2004/07/19 05:20:29 sobomax Exp $ - */ - -#ifndef COMPAT_EXECINFO_H_INCLUDED -#define COMPAT_EXECINFO_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -int backtrace(void **, int); -char ** backtrace_symbols(void *const *, int); -void backtrace_symbols_fd(void *const *, int, int); - -#ifdef __cplusplus -} -#endif - -#endif /* COMPAT_EXECINFO_H_INCLUDED */ diff --git a/system/include/gc.h b/system/include/gc.h index a21fd410..affa615f 100644 --- a/system/include/gc.h +++ b/system/include/gc.h @@ -1,5 +1,7 @@ /* * Boehm-compatible GC API + * + * WARNING: this is deprecated. You should just build Boehm from source, it is much faster than the toy version written in emscripten */ #ifndef _GC_H_INCLUDED #define _GC_H_INCLUDED diff --git a/system/include/jansson.h b/system/include/jansson.h index 04c345e9..53715fcc 100644 --- a/system/include/jansson.h +++ b/system/include/jansson.h @@ -82,7 +82,7 @@ typedef long long json_int_t; typedef long json_int_t; #endif /* JSON_INTEGER_IS_LONG_LONG */ -#ifdef EMSCRIPTEN +#ifdef __EMSCRIPTEN__ extern "C" bool json_typeof(const void *object); extern "C" bool json_is_object(const void *object); extern "C" bool json_is_array(const void *object); diff --git a/system/include/libc/unistd.h b/system/include/libc/unistd.h index ef6ba3b3..995a84ea 100644 --- a/system/include/libc/unistd.h +++ b/system/include/libc/unistd.h @@ -7,9 +7,9 @@ extern "C" { #include <features.h> -#define STDIN_FILENO 1 -#define STDOUT_FILENO 2 -#define STDERR_FILENO 3 +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 #define SEEK_SET 0 #define SEEK_CUR 1 diff --git a/system/include/libcxx/exception b/system/include/libcxx/exception index ddd75bd4..cad802e0 100644 --- a/system/include/libcxx/exception +++ b/system/include/libcxx/exception @@ -91,8 +91,8 @@ class _LIBCPP_EXCEPTION_ABI exception { public: _LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {} - virtual ~exception() _NOEXCEPT {} // XXX EMSCRIPTEN - implement in header - virtual const char* what() const _NOEXCEPT { return "std::exception"; } // XXX EMSCRIPTEN - implement in header + virtual ~exception() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI bad_exception diff --git a/system/include/unwind.h b/system/include/unwind.h deleted file mode 100644 index f8d43d0d..00000000 --- a/system/include/unwind.h +++ /dev/null @@ -1,154 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang <davidm@hpl.hp.com> - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -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 _UNWIND_H -#define _UNWIND_H - -/* For uint64_t */ -#include <stdint.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* Minimal interface as per C++ ABI draft standard: - - http://www.codesourcery.com/cxx-abi/abi-eh.html */ - -typedef enum - { - _URC_NO_REASON = 0, - _URC_FOREIGN_EXCEPTION_CAUGHT = 1, - _URC_FATAL_PHASE2_ERROR = 2, - _URC_FATAL_PHASE1_ERROR = 3, - _URC_NORMAL_STOP = 4, - _URC_END_OF_STACK = 5, - _URC_HANDLER_FOUND = 6, - _URC_INSTALL_CONTEXT = 7, - _URC_CONTINUE_UNWIND = 8 - } -_Unwind_Reason_Code; - -typedef int _Unwind_Action; - -#define _UA_SEARCH_PHASE 1 -#define _UA_CLEANUP_PHASE 2 -#define _UA_HANDLER_FRAME 4 -#define _UA_FORCE_UNWIND 8 - -struct _Unwind_Context; /* opaque data-structure */ -struct _Unwind_Exception; /* forward-declaration */ - -typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, - struct _Unwind_Exception *); - -typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action, - uint64_t, - struct _Unwind_Exception *, - struct _Unwind_Context *, - void *); - -/* The C++ ABI requires exception_class, private_1, and private_2 to - be of type uint64 and the entire structure to be - double-word-aligned. Please note that exception_class stays 64-bit - even on 32-bit machines for gcc compatibility. */ -struct _Unwind_Exception - { - uint64_t exception_class; - _Unwind_Exception_Cleanup_Fn exception_cleanup; - unsigned long private_1; - unsigned long private_2; - } __attribute__((__aligned__)); - -extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); -extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, - _Unwind_Stop_Fn, void *); -extern void _Unwind_Resume (struct _Unwind_Exception *); -extern void _Unwind_DeleteException (struct _Unwind_Exception *); -extern unsigned long _Unwind_GetGR (struct _Unwind_Context *, int); -extern void _Unwind_SetGR (struct _Unwind_Context *, int, unsigned long); -extern unsigned long _Unwind_GetIP (struct _Unwind_Context *); -extern unsigned long _Unwind_GetIPInfo (struct _Unwind_Context *, int *); -extern void _Unwind_SetIP (struct _Unwind_Context *, unsigned long); -extern unsigned long _Unwind_GetLanguageSpecificData (struct _Unwind_Context*); -extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *); - -#ifdef _GNU_SOURCE - -/* Callback for _Unwind_Backtrace(). The backtrace stops immediately - if the callback returns any value other than _URC_NO_REASON. */ -typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (struct _Unwind_Context *, - void *); - -/* See http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00082.html for why - _UA_END_OF_STACK exists. */ -# define _UA_END_OF_STACK 16 - -/* If the unwind was initiated due to a forced unwind, resume that - operation, else re-raise the exception. This is used by - __cxa_rethrow(). */ -extern _Unwind_Reason_Code - _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); - -/* See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00154.html for why - _Unwind_GetBSP() exists. */ -extern unsigned long _Unwind_GetBSP (struct _Unwind_Context *); - -/* Return the "canonical frame address" for the given context. - This is used by NPTL... */ -extern unsigned long _Unwind_GetCFA (struct _Unwind_Context *); - -/* Return the base-address for data references. */ -extern unsigned long _Unwind_GetDataRelBase (struct _Unwind_Context *); - -/* Return the base-address for text references. */ -extern unsigned long _Unwind_GetTextRelBase (struct _Unwind_Context *); - -/* Call _Unwind_Trace_Fn once for each stack-frame, without doing any - cleanup. The first frame for which the callback is invoked is the - one for the caller of _Unwind_Backtrace(). _Unwind_Backtrace() - returns _URC_END_OF_STACK when the backtrace stopped due to - reaching the end of the call-chain or _URC_FATAL_PHASE1_ERROR if it - stops for any other reason. */ -extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); - -/* Find the start-address of the procedure containing the specified IP - or NULL if it cannot be found (e.g., because the function has no - unwind info). Note: there is not necessarily a one-to-one - correspondence between source-level functions and procedures: some - functions don't have unwind-info and others are split into multiple - procedures. */ -extern void *_Unwind_FindEnclosingFunction (void *); - -/* See also Linux Standard Base Spec: - http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/libgcc-s.html */ - -#endif /* _GNU_SOURCE */ - -#ifdef __cplusplus -}; -#endif - -#endif /* _UNWIND_H */ diff --git a/system/lib/compiler-rt/int_endianness.h b/system/lib/compiler-rt/int_endianness.h index 17905355..fa294c49 100644 --- a/system/lib/compiler-rt/int_endianness.h +++ b/system/lib/compiler-rt/int_endianness.h @@ -100,7 +100,7 @@ #endif /* Windows */ -#if defined(EMSCRIPTEN) +#if defined(__EMSCRIPTEN__) #define _YUGA_LITTLE_ENDIAN 1 #define _YUGA_BIG_ENDIAN 0 diff --git a/system/lib/dlmalloc.c b/system/lib/dlmalloc.c index ce2c25f1..04e9e47b 100644 --- a/system/lib/dlmalloc.c +++ b/system/lib/dlmalloc.c @@ -1,6 +1,6 @@ /* XXX Emscripten XXX */ -#if EMSCRIPTEN +#if __EMSCRIPTEN__ #define DLMALLOC_EXPORT __attribute__((__weak__, __visibility__("default"))) /* mmap uses malloc, so malloc can't use mmap */ #define HAVE_MMAP 0 diff --git a/system/lib/gl.c b/system/lib/gl.c new file mode 100644 index 00000000..bbc77437 --- /dev/null +++ b/system/lib/gl.c @@ -0,0 +1,1731 @@ +// GL proc address retrieval + +#include <string.h> +#include <stdlib.h> +#include <stdio.h> + +#define GL_GLEXT_PROTOTYPES +#include <GL/gl.h> +#include <GL/glext.h> + +// Define emscripten_ versions of gl functions, to avoid name collisions + +/* + * Miscellaneous + */ + +GLAPI void GLAPIENTRY emscripten_glClearIndex( GLfloat c ); + +GLAPI void GLAPIENTRY emscripten_glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); + +GLAPI void GLAPIENTRY emscripten_glClear( GLbitfield mask ); + +GLAPI void GLAPIENTRY emscripten_glIndexMask( GLuint mask ); + +GLAPI void GLAPIENTRY emscripten_glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); + +GLAPI void GLAPIENTRY emscripten_glAlphaFunc( GLenum func, GLclampf ref ); + +GLAPI void GLAPIENTRY emscripten_glBlendFunc( GLenum sfactor, GLenum dfactor ); + +GLAPI void GLAPIENTRY emscripten_glLogicOp( GLenum opcode ); + +GLAPI void GLAPIENTRY emscripten_glCullFace( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glFrontFace( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glPointSize( GLfloat size ); + +GLAPI void GLAPIENTRY emscripten_glLineWidth( GLfloat width ); + +GLAPI void GLAPIENTRY emscripten_glLineStipple( GLint factor, GLushort pattern ); + +GLAPI void GLAPIENTRY emscripten_glPolygonMode( GLenum face, GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glPolygonOffset( GLfloat factor, GLfloat units ); + +GLAPI void GLAPIENTRY emscripten_glPolygonStipple( const GLubyte *mask ); + +GLAPI void GLAPIENTRY emscripten_glGetPolygonStipple( GLubyte *mask ); + +GLAPI void GLAPIENTRY emscripten_glEdgeFlag( GLboolean flag ); + +GLAPI void GLAPIENTRY emscripten_glEdgeFlagv( const GLboolean *flag ); + +GLAPI void GLAPIENTRY emscripten_glScissor( GLint x, GLint y, GLsizei width, GLsizei height); + +GLAPI void GLAPIENTRY emscripten_glClipPlane( GLenum plane, const GLdouble *equation ); + +GLAPI void GLAPIENTRY emscripten_glGetClipPlane( GLenum plane, GLdouble *equation ); + +GLAPI void GLAPIENTRY emscripten_glDrawBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glReadBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glEnable( GLenum cap ); + +GLAPI void GLAPIENTRY emscripten_glDisable( GLenum cap ); + +GLAPI GLboolean GLAPIENTRY emscripten_glIsEnabled( GLenum cap ); + + +GLAPI void GLAPIENTRY emscripten_glEnableClientState( GLenum cap ); /* 1.1 */ + +GLAPI void GLAPIENTRY emscripten_glDisableClientState( GLenum cap ); /* 1.1 */ + + +GLAPI void GLAPIENTRY emscripten_glGetBooleanv( GLenum pname, GLboolean *params ); + +GLAPI void GLAPIENTRY emscripten_glGetDoublev( GLenum pname, GLdouble *params ); + +GLAPI void GLAPIENTRY emscripten_glGetFloatv( GLenum pname, GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glGetIntegerv( GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY emscripten_glPushAttrib( GLbitfield mask ); + +GLAPI void GLAPIENTRY emscripten_glPopAttrib( void ); + + +GLAPI void GLAPIENTRY emscripten_glPushClientAttrib( GLbitfield mask ); /* 1.1 */ + +GLAPI void GLAPIENTRY emscripten_glPopClientAttrib( void ); /* 1.1 */ + + +GLAPI GLint GLAPIENTRY emscripten_glRenderMode( GLenum mode ); + +GLAPI GLenum GLAPIENTRY emscripten_glGetError( void ); + +GLAPI const GLubyte * GLAPIENTRY emscripten_glGetString( GLenum name ); + +GLAPI void GLAPIENTRY emscripten_glFinish( void ); + +GLAPI void GLAPIENTRY emscripten_glFlush( void ); + +GLAPI void GLAPIENTRY emscripten_glHint( GLenum target, GLenum mode ); + + +/* + * Depth Buffer + */ + +GLAPI void GLAPIENTRY emscripten_glClearDepth( GLclampd depth ); + +GLAPI void GLAPIENTRY emscripten_glDepthFunc( GLenum func ); + +GLAPI void GLAPIENTRY emscripten_glDepthMask( GLboolean flag ); + +GLAPI void GLAPIENTRY emscripten_glDepthRange( GLclampd near_val, GLclampd far_val ); + + +/* + * Accumulation Buffer + */ + +GLAPI void GLAPIENTRY emscripten_glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); + +GLAPI void GLAPIENTRY emscripten_glAccum( GLenum op, GLfloat value ); + + +/* + * Transformation + */ + +GLAPI void GLAPIENTRY emscripten_glMatrixMode( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glOrtho( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY emscripten_glFrustum( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY emscripten_glViewport( GLint x, GLint y, + GLsizei width, GLsizei height ); + +GLAPI void GLAPIENTRY emscripten_glPushMatrix( void ); + +GLAPI void GLAPIENTRY emscripten_glPopMatrix( void ); + +GLAPI void GLAPIENTRY emscripten_glLoadIdentity( void ); + +GLAPI void GLAPIENTRY emscripten_glLoadMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY emscripten_glLoadMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY emscripten_glMultMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY emscripten_glMultMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY emscripten_glRotated( GLdouble angle, + GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY emscripten_glRotatef( GLfloat angle, + GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY emscripten_glScaled( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY emscripten_glScalef( GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY emscripten_glTranslated( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY emscripten_glTranslatef( GLfloat x, GLfloat y, GLfloat z ); + + +/* + * Display Lists + */ + +GLAPI GLboolean GLAPIENTRY emscripten_glIsList( GLuint list ); + +GLAPI void GLAPIENTRY emscripten_glDeleteLists( GLuint list, GLsizei range ); + +GLAPI GLuint GLAPIENTRY emscripten_glGenLists( GLsizei range ); + +GLAPI void GLAPIENTRY emscripten_glNewList( GLuint list, GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glEndList( void ); + +GLAPI void GLAPIENTRY emscripten_glCallList( GLuint list ); + +GLAPI void GLAPIENTRY emscripten_glCallLists( GLsizei n, GLenum type, + const GLvoid *lists ); + +GLAPI void GLAPIENTRY emscripten_glListBase( GLuint base ); + + +/* + * Drawing Functions + */ + +GLAPI void GLAPIENTRY emscripten_glBegin( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glEnd( void ); + + +GLAPI void GLAPIENTRY emscripten_glVertex2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY emscripten_glVertex2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY emscripten_glVertex2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY emscripten_glVertex2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY emscripten_glVertex3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY emscripten_glVertex3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY emscripten_glVertex3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY emscripten_glVertex3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY emscripten_glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY emscripten_glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY emscripten_glVertex4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY emscripten_glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY emscripten_glVertex2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glVertex2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glVertex2iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glVertex2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glVertex3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glVertex3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glVertex3iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glVertex3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glVertex4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glVertex4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glVertex4iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glVertex4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY emscripten_glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ); +GLAPI void GLAPIENTRY emscripten_glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ); +GLAPI void GLAPIENTRY emscripten_glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz ); +GLAPI void GLAPIENTRY emscripten_glNormal3i( GLint nx, GLint ny, GLint nz ); +GLAPI void GLAPIENTRY emscripten_glNormal3s( GLshort nx, GLshort ny, GLshort nz ); + +GLAPI void GLAPIENTRY emscripten_glNormal3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY emscripten_glNormal3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glNormal3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glNormal3iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glNormal3sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY emscripten_glIndexd( GLdouble c ); +GLAPI void GLAPIENTRY emscripten_glIndexf( GLfloat c ); +GLAPI void GLAPIENTRY emscripten_glIndexi( GLint c ); +GLAPI void GLAPIENTRY emscripten_glIndexs( GLshort c ); +GLAPI void GLAPIENTRY emscripten_glIndexub( GLubyte c ); /* 1.1 */ + +GLAPI void GLAPIENTRY emscripten_glIndexdv( const GLdouble *c ); +GLAPI void GLAPIENTRY emscripten_glIndexfv( const GLfloat *c ); +GLAPI void GLAPIENTRY emscripten_glIndexiv( const GLint *c ); +GLAPI void GLAPIENTRY emscripten_glIndexsv( const GLshort *c ); +GLAPI void GLAPIENTRY emscripten_glIndexubv( const GLubyte *c ); /* 1.1 */ + +GLAPI void GLAPIENTRY emscripten_glColor3b( GLbyte red, GLbyte green, GLbyte blue ); +GLAPI void GLAPIENTRY emscripten_glColor3d( GLdouble red, GLdouble green, GLdouble blue ); +GLAPI void GLAPIENTRY emscripten_glColor3f( GLfloat red, GLfloat green, GLfloat blue ); +GLAPI void GLAPIENTRY emscripten_glColor3i( GLint red, GLint green, GLint blue ); +GLAPI void GLAPIENTRY emscripten_glColor3s( GLshort red, GLshort green, GLshort blue ); +GLAPI void GLAPIENTRY emscripten_glColor3ub( GLubyte red, GLubyte green, GLubyte blue ); +GLAPI void GLAPIENTRY emscripten_glColor3ui( GLuint red, GLuint green, GLuint blue ); +GLAPI void GLAPIENTRY emscripten_glColor3us( GLushort red, GLushort green, GLushort blue ); + +GLAPI void GLAPIENTRY emscripten_glColor4b( GLbyte red, GLbyte green, + GLbyte blue, GLbyte alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4d( GLdouble red, GLdouble green, + GLdouble blue, GLdouble alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4f( GLfloat red, GLfloat green, + GLfloat blue, GLfloat alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4i( GLint red, GLint green, + GLint blue, GLint alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4s( GLshort red, GLshort green, + GLshort blue, GLshort alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4ub( GLubyte red, GLubyte green, + GLubyte blue, GLubyte alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4ui( GLuint red, GLuint green, + GLuint blue, GLuint alpha ); +GLAPI void GLAPIENTRY emscripten_glColor4us( GLushort red, GLushort green, + GLushort blue, GLushort alpha ); + + +GLAPI void GLAPIENTRY emscripten_glColor3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY emscripten_glColor3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glColor3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glColor3iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glColor3sv( const GLshort *v ); +GLAPI void GLAPIENTRY emscripten_glColor3ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY emscripten_glColor3uiv( const GLuint *v ); +GLAPI void GLAPIENTRY emscripten_glColor3usv( const GLushort *v ); + +GLAPI void GLAPIENTRY emscripten_glColor4bv( const GLbyte *v ); +GLAPI void GLAPIENTRY emscripten_glColor4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glColor4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glColor4iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glColor4sv( const GLshort *v ); +GLAPI void GLAPIENTRY emscripten_glColor4ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY emscripten_glColor4uiv( const GLuint *v ); +GLAPI void GLAPIENTRY emscripten_glColor4usv( const GLushort *v ); + + +GLAPI void GLAPIENTRY emscripten_glTexCoord1d( GLdouble s ); +GLAPI void GLAPIENTRY emscripten_glTexCoord1f( GLfloat s ); +GLAPI void GLAPIENTRY emscripten_glTexCoord1i( GLint s ); +GLAPI void GLAPIENTRY emscripten_glTexCoord1s( GLshort s ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord2d( GLdouble s, GLdouble t ); +GLAPI void GLAPIENTRY emscripten_glTexCoord2f( GLfloat s, GLfloat t ); +GLAPI void GLAPIENTRY emscripten_glTexCoord2i( GLint s, GLint t ); +GLAPI void GLAPIENTRY emscripten_glTexCoord2s( GLshort s, GLshort t ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord3d( GLdouble s, GLdouble t, GLdouble r ); +GLAPI void GLAPIENTRY emscripten_glTexCoord3f( GLfloat s, GLfloat t, GLfloat r ); +GLAPI void GLAPIENTRY emscripten_glTexCoord3i( GLint s, GLint t, GLint r ); +GLAPI void GLAPIENTRY emscripten_glTexCoord3s( GLshort s, GLshort t, GLshort r ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ); +GLAPI void GLAPIENTRY emscripten_glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ); +GLAPI void GLAPIENTRY emscripten_glTexCoord4i( GLint s, GLint t, GLint r, GLint q ); +GLAPI void GLAPIENTRY emscripten_glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord1dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord1fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord1iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord1sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord2iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord3iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glTexCoord4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord4iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glTexCoord4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY emscripten_glRasterPos2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY emscripten_glRasterPos2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY emscripten_glRasterPos2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY emscripten_glRasterPos2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY emscripten_glRasterPos3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY emscripten_glRasterPos3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY emscripten_glRasterPos3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY emscripten_glRasterPos3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY emscripten_glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY emscripten_glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY emscripten_glRasterPos4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY emscripten_glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY emscripten_glRasterPos2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos2iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glRasterPos3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos3iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glRasterPos4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos4iv( const GLint *v ); +GLAPI void GLAPIENTRY emscripten_glRasterPos4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY emscripten_glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ); +GLAPI void GLAPIENTRY emscripten_glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); +GLAPI void GLAPIENTRY emscripten_glRecti( GLint x1, GLint y1, GLint x2, GLint y2 ); +GLAPI void GLAPIENTRY emscripten_glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ); + + +GLAPI void GLAPIENTRY emscripten_glRectdv( const GLdouble *v1, const GLdouble *v2 ); +GLAPI void GLAPIENTRY emscripten_glRectfv( const GLfloat *v1, const GLfloat *v2 ); +GLAPI void GLAPIENTRY emscripten_glRectiv( const GLint *v1, const GLint *v2 ); +GLAPI void GLAPIENTRY emscripten_glRectsv( const GLshort *v1, const GLshort *v2 ); + + +/* + * Vertex Arrays (1.1) + */ + +GLAPI void GLAPIENTRY emscripten_glVertexPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY emscripten_glNormalPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY emscripten_glColorPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY emscripten_glIndexPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY emscripten_glTexCoordPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY emscripten_glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY emscripten_glGetPointerv( GLenum pname, GLvoid **params ); + +GLAPI void GLAPIENTRY emscripten_glArrayElement( GLint i ); + +GLAPI void GLAPIENTRY emscripten_glDrawArrays( GLenum mode, GLint first, GLsizei count ); + +GLAPI void GLAPIENTRY emscripten_glDrawElements( GLenum mode, GLsizei count, + GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY emscripten_glInterleavedArrays( GLenum format, GLsizei stride, + const GLvoid *pointer ); + +/* + * Lighting + */ + +GLAPI void GLAPIENTRY emscripten_glShadeModel( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glLightf( GLenum light, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glLighti( GLenum light, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY emscripten_glLightfv( GLenum light, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glLightiv( GLenum light, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glGetLightfv( GLenum light, GLenum pname, + GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glGetLightiv( GLenum light, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glLightModelf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glLightModeli( GLenum pname, GLint param ); +GLAPI void GLAPIENTRY emscripten_glLightModelfv( GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glLightModeliv( GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glMaterialf( GLenum face, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glMateriali( GLenum face, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY emscripten_glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glMaterialiv( GLenum face, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glGetMaterialiv( GLenum face, GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glColorMaterial( GLenum face, GLenum mode ); + + +/* + * Raster functions + */ + +GLAPI void GLAPIENTRY emscripten_glPixelZoom( GLfloat xfactor, GLfloat yfactor ); + +GLAPI void GLAPIENTRY emscripten_glPixelStoref( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glPixelStorei( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY emscripten_glPixelTransferf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glPixelTransferi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY emscripten_glPixelMapfv( GLenum map, GLsizei mapsize, + const GLfloat *values ); +GLAPI void GLAPIENTRY emscripten_glPixelMapuiv( GLenum map, GLsizei mapsize, + const GLuint *values ); +GLAPI void GLAPIENTRY emscripten_glPixelMapusv( GLenum map, GLsizei mapsize, + const GLushort *values ); + +GLAPI void GLAPIENTRY emscripten_glGetPixelMapfv( GLenum map, GLfloat *values ); +GLAPI void GLAPIENTRY emscripten_glGetPixelMapuiv( GLenum map, GLuint *values ); +GLAPI void GLAPIENTRY emscripten_glGetPixelMapusv( GLenum map, GLushort *values ); + +GLAPI void GLAPIENTRY emscripten_glBitmap( GLsizei width, GLsizei height, + GLfloat xorig, GLfloat yorig, + GLfloat xmove, GLfloat ymove, + const GLubyte *bitmap ); + +GLAPI void GLAPIENTRY emscripten_glReadPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLvoid *pixels ); + +GLAPI void GLAPIENTRY emscripten_glDrawPixels( GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY emscripten_glCopyPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum type ); + +/* + * Stenciling + */ + +GLAPI void GLAPIENTRY emscripten_glStencilFunc( GLenum func, GLint ref, GLuint mask ); + +GLAPI void GLAPIENTRY emscripten_glStencilMask( GLuint mask ); + +GLAPI void GLAPIENTRY emscripten_glStencilOp( GLenum fail, GLenum zfail, GLenum zpass ); + +GLAPI void GLAPIENTRY emscripten_glClearStencil( GLint s ); + + + +/* + * Texture mapping + */ + +GLAPI void GLAPIENTRY emscripten_glTexGend( GLenum coord, GLenum pname, GLdouble param ); +GLAPI void GLAPIENTRY emscripten_glTexGenf( GLenum coord, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glTexGeni( GLenum coord, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY emscripten_glTexGendv( GLenum coord, GLenum pname, const GLdouble *params ); +GLAPI void GLAPIENTRY emscripten_glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glTexGeniv( GLenum coord, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); +GLAPI void GLAPIENTRY emscripten_glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glGetTexGeniv( GLenum coord, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY emscripten_glTexEnvf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glTexEnvi( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY emscripten_glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glTexEnviv( GLenum target, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glGetTexEnviv( GLenum target, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY emscripten_glTexParameterf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY emscripten_glTexParameteri( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY emscripten_glTexParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glTexParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glGetTexParameterfv( GLenum target, + GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY emscripten_glGetTexParameteriv( GLenum target, + GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glGetTexLevelParameterfv( GLenum target, GLint level, + GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY emscripten_glGetTexLevelParameteriv( GLenum target, GLint level, + GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY emscripten_glTexImage1D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY emscripten_glTexImage2D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY emscripten_glGetTexImage( GLenum target, GLint level, + GLenum format, GLenum type, + GLvoid *pixels ); + + +/* 1.1 functions */ + +GLAPI void GLAPIENTRY emscripten_glGenTextures( GLsizei n, GLuint *textures ); + +GLAPI void GLAPIENTRY emscripten_glDeleteTextures( GLsizei n, const GLuint *textures); + +GLAPI void GLAPIENTRY emscripten_glBindTexture( GLenum target, GLuint texture ); + +GLAPI void GLAPIENTRY emscripten_glPrioritizeTextures( GLsizei n, + const GLuint *textures, + const GLclampf *priorities ); + +GLAPI GLboolean GLAPIENTRY emscripten_glAreTexturesResident( GLsizei n, + const GLuint *textures, + GLboolean *residences ); + +GLAPI GLboolean GLAPIENTRY emscripten_glIsTexture( GLuint texture ); + + +GLAPI void GLAPIENTRY emscripten_glTexSubImage1D( GLenum target, GLint level, + GLint xoffset, + GLsizei width, GLenum format, + GLenum type, const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY emscripten_glTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY emscripten_glCopyTexImage1D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLint border ); + + +GLAPI void GLAPIENTRY emscripten_glCopyTexImage2D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLint border ); + + +GLAPI void GLAPIENTRY emscripten_glCopyTexSubImage1D( GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, + GLsizei width ); + + +GLAPI void GLAPIENTRY emscripten_glCopyTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + + +/* + * Evaluators + */ + +GLAPI void GLAPIENTRY emscripten_glMap1d( GLenum target, GLdouble u1, GLdouble u2, + GLint stride, + GLint order, const GLdouble *points ); +GLAPI void GLAPIENTRY emscripten_glMap1f( GLenum target, GLfloat u1, GLfloat u2, + GLint stride, + GLint order, const GLfloat *points ); + +GLAPI void GLAPIENTRY emscripten_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 emscripten_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 emscripten_glGetMapdv( GLenum target, GLenum query, GLdouble *v ); +GLAPI void GLAPIENTRY emscripten_glGetMapfv( GLenum target, GLenum query, GLfloat *v ); +GLAPI void GLAPIENTRY emscripten_glGetMapiv( GLenum target, GLenum query, GLint *v ); + +GLAPI void GLAPIENTRY emscripten_glEvalCoord1d( GLdouble u ); +GLAPI void GLAPIENTRY emscripten_glEvalCoord1f( GLfloat u ); + +GLAPI void GLAPIENTRY emscripten_glEvalCoord1dv( const GLdouble *u ); +GLAPI void GLAPIENTRY emscripten_glEvalCoord1fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY emscripten_glEvalCoord2d( GLdouble u, GLdouble v ); +GLAPI void GLAPIENTRY emscripten_glEvalCoord2f( GLfloat u, GLfloat v ); + +GLAPI void GLAPIENTRY emscripten_glEvalCoord2dv( const GLdouble *u ); +GLAPI void GLAPIENTRY emscripten_glEvalCoord2fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY emscripten_glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); +GLAPI void GLAPIENTRY emscripten_glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); + +GLAPI void GLAPIENTRY emscripten_glMapGrid2d( GLint un, GLdouble u1, GLdouble u2, + GLint vn, GLdouble v1, GLdouble v2 ); +GLAPI void GLAPIENTRY emscripten_glMapGrid2f( GLint un, GLfloat u1, GLfloat u2, + GLint vn, GLfloat v1, GLfloat v2 ); + +GLAPI void GLAPIENTRY emscripten_glEvalPoint1( GLint i ); + +GLAPI void GLAPIENTRY emscripten_glEvalPoint2( GLint i, GLint j ); + +GLAPI void GLAPIENTRY emscripten_glEvalMesh1( GLenum mode, GLint i1, GLint i2 ); + +GLAPI void GLAPIENTRY emscripten_glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); + + +/* + * Fog + */ + +GLAPI void GLAPIENTRY emscripten_glFogf( GLenum pname, GLfloat param ); + +GLAPI void GLAPIENTRY emscripten_glFogi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY emscripten_glFogfv( GLenum pname, const GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glFogiv( GLenum pname, const GLint *params ); + + +/* + * Selection and Feedback + */ + +GLAPI void GLAPIENTRY emscripten_glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); + +GLAPI void GLAPIENTRY emscripten_glPassThrough( GLfloat token ); + +GLAPI void GLAPIENTRY emscripten_glSelectBuffer( GLsizei size, GLuint *buffer ); + +GLAPI void GLAPIENTRY emscripten_glInitNames( void ); + +GLAPI void GLAPIENTRY emscripten_glLoadName( GLuint name ); + +GLAPI void GLAPIENTRY emscripten_glPushName( GLuint name ); + +GLAPI void GLAPIENTRY emscripten_glPopName( void ); + + +GLAPI void GLAPIENTRY emscripten_glDrawRangeElements( GLenum mode, GLuint start, + GLuint end, GLsizei count, GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY emscripten_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 emscripten_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 emscripten_glCopyTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLint x, + GLint y, GLsizei width, + GLsizei height ); + + +GLAPI void GLAPIENTRY emscripten_glColorTable( GLenum target, GLenum internalformat, + GLsizei width, GLenum format, + GLenum type, const GLvoid *table ); + +GLAPI void GLAPIENTRY emscripten_glColorSubTable( GLenum target, + GLsizei start, GLsizei count, + GLenum format, GLenum type, + const GLvoid *data ); + +GLAPI void GLAPIENTRY emscripten_glColorTableParameteriv(GLenum target, GLenum pname, + const GLint *params); + +GLAPI void GLAPIENTRY emscripten_glColorTableParameterfv(GLenum target, GLenum pname, + const GLfloat *params); + +GLAPI void GLAPIENTRY emscripten_glCopyColorSubTable( GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY emscripten_glCopyColorTable( GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY emscripten_glGetColorTable( GLenum target, GLenum format, + GLenum type, GLvoid *table ); + +GLAPI void GLAPIENTRY emscripten_glGetColorTableParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glGetColorTableParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glBlendEquation( GLenum mode ); + +GLAPI void GLAPIENTRY emscripten_glBlendColor( GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha ); + +GLAPI void GLAPIENTRY emscripten_glHistogram( GLenum target, GLsizei width, + GLenum internalformat, GLboolean sink ); + +GLAPI void GLAPIENTRY emscripten_glResetHistogram( GLenum target ); + +GLAPI void GLAPIENTRY emscripten_glGetHistogram( GLenum target, GLboolean reset, + GLenum format, GLenum type, + GLvoid *values ); + +GLAPI void GLAPIENTRY emscripten_glGetHistogramParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glGetHistogramParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glMinmax( GLenum target, GLenum internalformat, + GLboolean sink ); + +GLAPI void GLAPIENTRY emscripten_glResetMinmax( GLenum target ); + +GLAPI void GLAPIENTRY emscripten_glGetMinmax( GLenum target, GLboolean reset, + GLenum format, GLenum types, + GLvoid *values ); + +GLAPI void GLAPIENTRY emscripten_glGetMinmaxParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glGetMinmaxParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glConvolutionFilter1D( GLenum target, + GLenum internalformat, GLsizei width, GLenum format, GLenum type, + const GLvoid *image ); + +GLAPI void GLAPIENTRY emscripten_glConvolutionFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *image ); + +GLAPI void GLAPIENTRY emscripten_glConvolutionParameterf( GLenum target, GLenum pname, + GLfloat params ); + +GLAPI void GLAPIENTRY emscripten_glConvolutionParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glConvolutionParameteri( GLenum target, GLenum pname, + GLint params ); + +GLAPI void GLAPIENTRY emscripten_glConvolutionParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glCopyConvolutionFilter1D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY emscripten_glCopyConvolutionFilter2D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width, + GLsizei height); + +GLAPI void GLAPIENTRY emscripten_glGetConvolutionFilter( GLenum target, GLenum format, + GLenum type, GLvoid *image ); + +GLAPI void GLAPIENTRY emscripten_glGetConvolutionParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY emscripten_glGetConvolutionParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY emscripten_glSeparableFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *row, const GLvoid *column ); + +GLAPI void GLAPIENTRY emscripten_glGetSeparableFilter( GLenum target, GLenum format, + GLenum type, GLvoid *row, GLvoid *column, GLvoid *span ); + + +GLAPI void GLAPIENTRY emscripten_glActiveTexture( GLenum texture ); + +GLAPI void GLAPIENTRY emscripten_glClientActiveTexture( GLenum texture ); + +GLAPI void GLAPIENTRY emscripten_glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY emscripten_glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY emscripten_glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY emscripten_glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY emscripten_glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY emscripten_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 emscripten_glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1d( GLenum target, GLdouble s ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1f( GLenum target, GLfloat s ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1i( GLenum target, GLint s ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1s( GLenum target, GLshort s ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2i( GLenum target, GLint s, GLint t ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2s( GLenum target, GLshort s, GLshort t ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q ); + +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4sv( GLenum target, const GLshort *v ); + + +GLAPI void GLAPIENTRY emscripten_glLoadTransposeMatrixd( const GLdouble m[16] ); + +GLAPI void GLAPIENTRY emscripten_glLoadTransposeMatrixf( const GLfloat m[16] ); + +GLAPI void GLAPIENTRY emscripten_glMultTransposeMatrixd( const GLdouble m[16] ); + +GLAPI void GLAPIENTRY emscripten_glMultTransposeMatrixf( const GLfloat m[16] ); + +GLAPI void GLAPIENTRY emscripten_glSampleCoverage( GLclampf value, GLboolean invert ); + + +GLAPI void GLAPIENTRY emscripten_glActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY emscripten_glClientActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1dARB(GLenum target, GLdouble s); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1fARB(GLenum target, GLfloat s); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1iARB(GLenum target, GLint s); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1sARB(GLenum target, GLshort s); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord1svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord2svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord3svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void GLAPIENTRY emscripten_glMultiTexCoord4svARB(GLenum target, const GLshort *v); + + +GLAPI void APIENTRY emscripten_glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GLAPI void APIENTRY emscripten_glBlendEquation (GLenum mode); +GLAPI void APIENTRY emscripten_glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +GLAPI void APIENTRY emscripten_glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY emscripten_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 APIENTRY emscripten_glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + + +GLAPI void APIENTRY emscripten_glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +GLAPI void APIENTRY emscripten_glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY emscripten_glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY emscripten_glCopyColorTable (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY emscripten_glGetColorTable (GLenum target, GLenum format, GLenum type, GLvoid *table); +GLAPI void APIENTRY emscripten_glGetColorTableParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetColorTableParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glColorSubTable (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCopyColorSubTable (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY emscripten_glConvolutionFilter1D (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +GLAPI void APIENTRY emscripten_glConvolutionFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +GLAPI void APIENTRY emscripten_glConvolutionParameterf (GLenum target, GLenum pname, GLfloat params); +GLAPI void APIENTRY emscripten_glConvolutionParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY emscripten_glConvolutionParameteri (GLenum target, GLenum pname, GLint params); +GLAPI void APIENTRY emscripten_glConvolutionParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY emscripten_glCopyConvolutionFilter1D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY emscripten_glCopyConvolutionFilter2D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY emscripten_glGetConvolutionFilter (GLenum target, GLenum format, GLenum type, GLvoid *image); +GLAPI void APIENTRY emscripten_glGetConvolutionParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetConvolutionParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetSeparableFilter (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +GLAPI void APIENTRY emscripten_glSeparableFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +GLAPI void APIENTRY emscripten_glGetHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +GLAPI void APIENTRY emscripten_glGetHistogramParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetHistogramParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +GLAPI void APIENTRY emscripten_glGetMinmaxParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetMinmaxParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glHistogram (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY emscripten_glMinmax (GLenum target, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY emscripten_glResetHistogram (GLenum target); +GLAPI void APIENTRY emscripten_glResetMinmax (GLenum target); + + +GLAPI void APIENTRY emscripten_glActiveTexture (GLenum texture); +GLAPI void APIENTRY emscripten_glSampleCoverage (GLclampf value, GLboolean invert); +GLAPI void APIENTRY emscripten_glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_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 APIENTRY emscripten_glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img); + + +GLAPI void APIENTRY emscripten_glClientActiveTexture (GLenum texture); +GLAPI void APIENTRY emscripten_glMultiTexCoord1d (GLenum target, GLdouble s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord1f (GLenum target, GLfloat s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord1i (GLenum target, GLint s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1iv (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord1s (GLenum target, GLshort s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2d (GLenum target, GLdouble s, GLdouble t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2f (GLenum target, GLfloat s, GLfloat t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2i (GLenum target, GLint s, GLint t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2iv (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2s (GLenum target, GLshort s, GLshort t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3d (GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3f (GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3i (GLenum target, GLint s, GLint t, GLint r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3iv (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3s (GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4d (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4i (GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4iv (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4s (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glLoadTransposeMatrixf (const GLfloat *m); +GLAPI void APIENTRY emscripten_glLoadTransposeMatrixd (const GLdouble *m); +GLAPI void APIENTRY emscripten_glMultTransposeMatrixf (const GLfloat *m); +GLAPI void APIENTRY emscripten_glMultTransposeMatrixd (const GLdouble *m); + + +GLAPI void APIENTRY emscripten_glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GLAPI void APIENTRY emscripten_glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GLAPI void APIENTRY emscripten_glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +GLAPI void APIENTRY emscripten_glPointParameterf (GLenum pname, GLfloat param); +GLAPI void APIENTRY emscripten_glPointParameterfv (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY emscripten_glPointParameteri (GLenum pname, GLint param); +GLAPI void APIENTRY emscripten_glPointParameteriv (GLenum pname, const GLint *params); + + +GLAPI void APIENTRY emscripten_glFogCoordf (GLfloat coord); +GLAPI void APIENTRY emscripten_glFogCoordfv (const GLfloat *coord); +GLAPI void APIENTRY emscripten_glFogCoordd (GLdouble coord); +GLAPI void APIENTRY emscripten_glFogCoorddv (const GLdouble *coord); +GLAPI void APIENTRY emscripten_glFogCoordPointer (GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY emscripten_glSecondaryColor3b (GLbyte red, GLbyte green, GLbyte blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3bv (const GLbyte *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3d (GLdouble red, GLdouble green, GLdouble blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3dv (const GLdouble *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3f (GLfloat red, GLfloat green, GLfloat blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3fv (const GLfloat *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3i (GLint red, GLint green, GLint blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3iv (const GLint *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3s (GLshort red, GLshort green, GLshort blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3sv (const GLshort *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3ub (GLubyte red, GLubyte green, GLubyte blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3ubv (const GLubyte *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3ui (GLuint red, GLuint green, GLuint blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3uiv (const GLuint *v); +GLAPI void APIENTRY emscripten_glSecondaryColor3us (GLushort red, GLushort green, GLushort blue); +GLAPI void APIENTRY emscripten_glSecondaryColor3usv (const GLushort *v); +GLAPI void APIENTRY emscripten_glSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY emscripten_glWindowPos2d (GLdouble x, GLdouble y); +GLAPI void APIENTRY emscripten_glWindowPos2dv (const GLdouble *v); +GLAPI void APIENTRY emscripten_glWindowPos2f (GLfloat x, GLfloat y); +GLAPI void APIENTRY emscripten_glWindowPos2fv (const GLfloat *v); +GLAPI void APIENTRY emscripten_glWindowPos2i (GLint x, GLint y); +GLAPI void APIENTRY emscripten_glWindowPos2iv (const GLint *v); +GLAPI void APIENTRY emscripten_glWindowPos2s (GLshort x, GLshort y); +GLAPI void APIENTRY emscripten_glWindowPos2sv (const GLshort *v); +GLAPI void APIENTRY emscripten_glWindowPos3d (GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY emscripten_glWindowPos3dv (const GLdouble *v); +GLAPI void APIENTRY emscripten_glWindowPos3f (GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY emscripten_glWindowPos3fv (const GLfloat *v); +GLAPI void APIENTRY emscripten_glWindowPos3i (GLint x, GLint y, GLint z); +GLAPI void APIENTRY emscripten_glWindowPos3iv (const GLint *v); +GLAPI void APIENTRY emscripten_glWindowPos3s (GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY emscripten_glWindowPos3sv (const GLshort *v); + + +GLAPI void APIENTRY emscripten_glGenQueries (GLsizei n, GLuint *ids); +GLAPI void APIENTRY emscripten_glDeleteQueries (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY emscripten_glIsQuery (GLuint id); +GLAPI void APIENTRY emscripten_glBeginQuery (GLenum target, GLuint id); +GLAPI void APIENTRY emscripten_glEndQuery (GLenum target); +GLAPI void APIENTRY emscripten_glGetQueryiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); +GLAPI void APIENTRY emscripten_glBindBuffer (GLenum target, GLuint buffer); +GLAPI void APIENTRY emscripten_glDeleteBuffers (GLsizei n, const GLuint *buffers); +GLAPI void APIENTRY emscripten_glGenBuffers (GLsizei n, GLuint *buffers); +GLAPI GLboolean APIENTRY emscripten_glIsBuffer (GLuint buffer); +GLAPI void APIENTRY emscripten_glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +GLAPI void APIENTRY emscripten_glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +GLAPI void APIENTRY emscripten_glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); +GLAPI GLvoid* APIENTRY emscripten_glMapBuffer (GLenum target, GLenum access); +GLAPI GLboolean APIENTRY emscripten_glUnmapBuffer (GLenum target); +GLAPI void APIENTRY emscripten_glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params); + + +GLAPI void APIENTRY emscripten_glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY emscripten_glDrawBuffers (GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY emscripten_glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GLAPI void APIENTRY emscripten_glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY emscripten_glStencilMaskSeparate (GLenum face, GLuint mask); +GLAPI void APIENTRY emscripten_glAttachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY emscripten_glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); +GLAPI void APIENTRY emscripten_glCompileShader (GLuint shader); +GLAPI GLuint APIENTRY emscripten_glCreateProgram (void); +GLAPI GLuint APIENTRY emscripten_glCreateShader (GLenum type); +GLAPI void APIENTRY emscripten_glDeleteProgram (GLuint program); +GLAPI void APIENTRY emscripten_glDeleteShader (GLuint shader); +GLAPI void APIENTRY emscripten_glDetachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY emscripten_glDisableVertexAttribArray (GLuint index); +GLAPI void APIENTRY emscripten_glEnableVertexAttribArray (GLuint index); +GLAPI void APIENTRY emscripten_glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY emscripten_glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY emscripten_glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); +GLAPI GLint APIENTRY emscripten_glGetAttribLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY emscripten_glGetProgramiv (GLuint program, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY emscripten_glGetShaderiv (GLuint shader, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY emscripten_glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GLAPI GLint APIENTRY emscripten_glGetUniformLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY emscripten_glGetUniformfv (GLuint program, GLint location, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetUniformiv (GLuint program, GLint location, GLint *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid* *pointer); +GLAPI GLboolean APIENTRY emscripten_glIsProgram (GLuint program); +GLAPI GLboolean APIENTRY emscripten_glIsShader (GLuint shader); +GLAPI void APIENTRY emscripten_glLinkProgram (GLuint program); +GLAPI void APIENTRY emscripten_glShaderSource (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); +GLAPI void APIENTRY emscripten_glUseProgram (GLuint program); +GLAPI void APIENTRY emscripten_glUniform1f (GLint location, GLfloat v0); +GLAPI void APIENTRY emscripten_glUniform2f (GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY emscripten_glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY emscripten_glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY emscripten_glUniform1i (GLint location, GLint v0); +GLAPI void APIENTRY emscripten_glUniform2i (GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY emscripten_glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY emscripten_glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY emscripten_glUniform1fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform2fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform3fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform4fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform1iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniform2iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniform3iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniform4iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glValidateProgram (GLuint program); +GLAPI void APIENTRY emscripten_glVertexAttrib1d (GLuint index, GLdouble x); +GLAPI void APIENTRY emscripten_glVertexAttrib1dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib1f (GLuint index, GLfloat x); +GLAPI void APIENTRY emscripten_glVertexAttrib1fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib1s (GLuint index, GLshort x); +GLAPI void APIENTRY emscripten_glVertexAttrib1sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY emscripten_glVertexAttrib2dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY emscripten_glVertexAttrib2fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib2s (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY emscripten_glVertexAttrib2sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY emscripten_glVertexAttrib3dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY emscripten_glVertexAttrib3fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY emscripten_glVertexAttrib3sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4Nbv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4Niv (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4Nsv (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY emscripten_glVertexAttrib4Nubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4Nuiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4Nusv (GLuint index, const GLushort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY emscripten_glVertexAttrib4dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY emscripten_glVertexAttrib4fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY emscripten_glVertexAttrib4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY emscripten_glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); + + +GLAPI void APIENTRY emscripten_glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + + +GLAPI void APIENTRY emscripten_glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GLAPI void APIENTRY emscripten_glGetBooleani_v (GLenum target, GLuint index, GLboolean *data); +GLAPI void APIENTRY emscripten_glGetIntegeri_v (GLenum target, GLuint index, GLint *data); +GLAPI void APIENTRY emscripten_glEnablei (GLenum target, GLuint index); +GLAPI void APIENTRY emscripten_glDisablei (GLenum target, GLuint index); +GLAPI GLboolean APIENTRY emscripten_glIsEnabledi (GLenum target, GLuint index); +GLAPI void APIENTRY emscripten_glBeginTransformFeedback (GLenum primitiveMode); +GLAPI void APIENTRY emscripten_glEndTransformFeedback (void); +GLAPI void APIENTRY emscripten_glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY emscripten_glBindBufferBase (GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY emscripten_glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +GLAPI void APIENTRY emscripten_glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY emscripten_glClampColor (GLenum target, GLenum clamp); +GLAPI void APIENTRY emscripten_glBeginConditionalRender (GLuint id, GLenum mode); +GLAPI void APIENTRY emscripten_glEndConditionalRender (void); +GLAPI void APIENTRY emscripten_glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY emscripten_glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); +GLAPI void APIENTRY emscripten_glVertexAttribI1i (GLuint index, GLint x); +GLAPI void APIENTRY emscripten_glVertexAttribI2i (GLuint index, GLint x, GLint y); +GLAPI void APIENTRY emscripten_glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY emscripten_glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY emscripten_glVertexAttribI1ui (GLuint index, GLuint x); +GLAPI void APIENTRY emscripten_glVertexAttribI2ui (GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY emscripten_glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY emscripten_glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY emscripten_glVertexAttribI1iv (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI2iv (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI3iv (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI1uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI2uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI3uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttribI4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY emscripten_glVertexAttribI4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttribI4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY emscripten_glVertexAttribI4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY emscripten_glGetUniformuiv (GLuint program, GLint location, GLuint *params); +GLAPI void APIENTRY emscripten_glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name); +GLAPI GLint APIENTRY emscripten_glGetFragDataLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY emscripten_glUniform1ui (GLint location, GLuint v0); +GLAPI void APIENTRY emscripten_glUniform2ui (GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY emscripten_glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY emscripten_glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY emscripten_glUniform1uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY emscripten_glUniform2uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY emscripten_glUniform3uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY emscripten_glUniform4uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY emscripten_glTexParameterIiv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY emscripten_glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY emscripten_glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY emscripten_glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI void APIENTRY emscripten_glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI void APIENTRY emscripten_glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI void APIENTRY emscripten_glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); + + +GLAPI void APIENTRY emscripten_glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY emscripten_glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +GLAPI void APIENTRY emscripten_glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY emscripten_glPrimitiveRestartIndex (GLuint index); + + +GLAPI void APIENTRY emscripten_glActiveTextureARB (GLenum texture); +GLAPI void APIENTRY emscripten_glClientActiveTextureARB (GLenum texture); +GLAPI void APIENTRY emscripten_glMultiTexCoord1dARB (GLenum target, GLdouble s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord1fARB (GLenum target, GLfloat s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord1iARB (GLenum target, GLint s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord1sARB (GLenum target, GLshort s); +GLAPI void APIENTRY emscripten_glMultiTexCoord1svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2dARB (GLenum target, GLdouble s, GLdouble t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2iARB (GLenum target, GLint s, GLint t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord2sARB (GLenum target, GLshort s, GLshort t); +GLAPI void APIENTRY emscripten_glMultiTexCoord2svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3iARB (GLenum target, GLint s, GLint t, GLint r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord3sARB (GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void APIENTRY emscripten_glMultiTexCoord3svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4iARB (GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY emscripten_glMultiTexCoord4sARB (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void APIENTRY emscripten_glMultiTexCoord4svARB (GLenum target, const GLshort *v); + + +GLAPI void APIENTRY emscripten_glLoadTransposeMatrixfARB (const GLfloat *m); +GLAPI void APIENTRY emscripten_glLoadTransposeMatrixdARB (const GLdouble *m); +GLAPI void APIENTRY emscripten_glMultTransposeMatrixfARB (const GLfloat *m); +GLAPI void APIENTRY emscripten_glMultTransposeMatrixdARB (const GLdouble *m); + + +GLAPI void APIENTRY emscripten_glCompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexSubImage3DARB (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 APIENTRY emscripten_glCompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glCompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY emscripten_glGetCompressedTexImageARB (GLenum target, GLint level, GLvoid *img); + + +GLAPI void APIENTRY emscripten_glVertexAttrib1dARB (GLuint index, GLdouble x); +GLAPI void APIENTRY emscripten_glVertexAttrib1dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib1fARB (GLuint index, GLfloat x); +GLAPI void APIENTRY emscripten_glVertexAttrib1fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib1sARB (GLuint index, GLshort x); +GLAPI void APIENTRY emscripten_glVertexAttrib1svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib2dARB (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY emscripten_glVertexAttrib2dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib2fARB (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY emscripten_glVertexAttrib2fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib2sARB (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY emscripten_glVertexAttrib2svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib3dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY emscripten_glVertexAttrib3dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib3fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY emscripten_glVertexAttrib3fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib3sARB (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY emscripten_glVertexAttrib3svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4NbvARB (GLuint index, const GLbyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4NivARB (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4NsvARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4NubARB (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY emscripten_glVertexAttrib4NubvARB (GLuint index, const GLubyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4NuivARB (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4NusvARB (GLuint index, const GLushort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4bvARB (GLuint index, const GLbyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY emscripten_glVertexAttrib4dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY emscripten_glVertexAttrib4fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4ivARB (GLuint index, const GLint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4sARB (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY emscripten_glVertexAttrib4svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4ubvARB (GLuint index, const GLubyte *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4uivARB (GLuint index, const GLuint *v); +GLAPI void APIENTRY emscripten_glVertexAttrib4usvARB (GLuint index, const GLushort *v); +GLAPI void APIENTRY emscripten_glVertexAttribPointerARB (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY emscripten_glEnableVertexAttribArrayARB (GLuint index); +GLAPI void APIENTRY emscripten_glDisableVertexAttribArrayARB (GLuint index); +GLAPI void APIENTRY emscripten_glProgramStringARB (GLenum target, GLenum format, GLsizei len, const GLvoid *string); +GLAPI void APIENTRY emscripten_glBindProgramARB (GLenum target, GLuint program); +GLAPI void APIENTRY emscripten_glDeleteProgramsARB (GLsizei n, const GLuint *programs); +GLAPI void APIENTRY emscripten_glGenProgramsARB (GLsizei n, GLuint *programs); +GLAPI void APIENTRY emscripten_glProgramEnvParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY emscripten_glProgramEnvParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY emscripten_glProgramEnvParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY emscripten_glProgramEnvParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY emscripten_glProgramLocalParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY emscripten_glProgramLocalParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY emscripten_glProgramLocalParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY emscripten_glProgramLocalParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY emscripten_glGetProgramEnvParameterdvARB (GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY emscripten_glGetProgramEnvParameterfvARB (GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetProgramLocalParameterdvARB (GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY emscripten_glGetProgramLocalParameterfvARB (GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetProgramivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetProgramStringARB (GLenum target, GLenum pname, GLvoid *string); +GLAPI void APIENTRY emscripten_glGetVertexAttribdvARB (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribfvARB (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribivARB (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetVertexAttribPointervARB (GLuint index, GLenum pname, GLvoid* *pointer); +GLAPI GLboolean APIENTRY emscripten_glIsProgramARB (GLuint program); + + +GLAPI void APIENTRY emscripten_glBindBufferARB (GLenum target, GLuint buffer); +GLAPI void APIENTRY emscripten_glDeleteBuffersARB (GLsizei n, const GLuint *buffers); +GLAPI void APIENTRY emscripten_glGenBuffersARB (GLsizei n, GLuint *buffers); +GLAPI GLboolean APIENTRY emscripten_glIsBufferARB (GLuint buffer); +GLAPI void APIENTRY emscripten_glBufferDataARB (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); +GLAPI void APIENTRY emscripten_glBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); +GLAPI void APIENTRY emscripten_glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); +GLAPI GLvoid* APIENTRY emscripten_glMapBufferARB (GLenum target, GLenum access); +GLAPI GLboolean APIENTRY emscripten_glUnmapBufferARB (GLenum target); +GLAPI void APIENTRY emscripten_glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetBufferPointervARB (GLenum target, GLenum pname, GLvoid* *params); + + +GLAPI void APIENTRY emscripten_glGenQueriesARB (GLsizei n, GLuint *ids); +GLAPI void APIENTRY emscripten_glDeleteQueriesARB (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY emscripten_glIsQueryARB (GLuint id); +GLAPI void APIENTRY emscripten_glBeginQueryARB (GLenum target, GLuint id); +GLAPI void APIENTRY emscripten_glEndQueryARB (GLenum target); +GLAPI void APIENTRY emscripten_glGetQueryivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetQueryObjectivARB (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *params); + + +GLAPI void APIENTRY emscripten_glDeleteObjectARB (GLhandleARB obj); +GLAPI GLhandleARB APIENTRY emscripten_glGetHandleARB (GLenum pname); +GLAPI void APIENTRY emscripten_glDetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj); +GLAPI GLhandleARB APIENTRY emscripten_glCreateShaderObjectARB (GLenum shaderType); +GLAPI void APIENTRY emscripten_glShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); +GLAPI void APIENTRY emscripten_glCompileShaderARB (GLhandleARB shaderObj); +GLAPI GLhandleARB APIENTRY emscripten_glCreateProgramObjectARB (void); +GLAPI void APIENTRY emscripten_glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj); +GLAPI void APIENTRY emscripten_glLinkProgramARB (GLhandleARB programObj); +GLAPI void APIENTRY emscripten_glUseProgramObjectARB (GLhandleARB programObj); +GLAPI void APIENTRY emscripten_glValidateProgramARB (GLhandleARB programObj); +GLAPI void APIENTRY emscripten_glUniform1fARB (GLint location, GLfloat v0); +GLAPI void APIENTRY emscripten_glUniform2fARB (GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY emscripten_glUniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY emscripten_glUniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY emscripten_glUniform1iARB (GLint location, GLint v0); +GLAPI void APIENTRY emscripten_glUniform2iARB (GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY emscripten_glUniform3iARB (GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY emscripten_glUniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY emscripten_glUniform1fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform2fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform3fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform4fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniform1ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniform2ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniform3ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniform4ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY emscripten_glUniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glUniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY emscripten_glGetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +GLAPI void APIENTRY emscripten_glGetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +GLAPI GLint APIENTRY emscripten_glGetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name); +GLAPI void APIENTRY emscripten_glGetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +GLAPI void APIENTRY emscripten_glGetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params); +GLAPI void APIENTRY emscripten_glGetUniformivARB (GLhandleARB programObj, GLint location, GLint *params); +GLAPI void APIENTRY emscripten_glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); + + +GLAPI void APIENTRY emscripten_glBindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name); +GLAPI void APIENTRY emscripten_glGetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +GLAPI GLint APIENTRY emscripten_glGetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name); + + +GLAPI void APIENTRY emscripten_glDrawArraysInstancedARB (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY emscripten_glDrawElementsInstancedARB (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); + + +GLAPI GLboolean APIENTRY emscripten_glIsRenderbuffer (GLuint renderbuffer); +GLAPI void APIENTRY emscripten_glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY emscripten_glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); +GLAPI void APIENTRY emscripten_glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY emscripten_glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY emscripten_glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY emscripten_glIsFramebuffer (GLuint framebuffer); +GLAPI void APIENTRY emscripten_glBindFramebuffer (GLenum target, GLuint framebuffer); +GLAPI void APIENTRY emscripten_glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); +GLAPI void APIENTRY emscripten_glGenFramebuffers (GLsizei n, GLuint *framebuffers); +GLAPI GLenum APIENTRY emscripten_glCheckFramebufferStatus (GLenum target); +GLAPI void APIENTRY emscripten_glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY emscripten_glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY emscripten_glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY emscripten_glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY emscripten_glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGenerateMipmap (GLenum target); +GLAPI void APIENTRY emscripten_glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI void APIENTRY emscripten_glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY emscripten_glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); + + +GLAPI void APIENTRY emscripten_glBindVertexArray (GLuint array); +GLAPI void APIENTRY emscripten_glDeleteVertexArrays (GLsizei n, const GLuint *arrays); +GLAPI void APIENTRY emscripten_glGenVertexArrays (GLsizei n, GLuint *arrays); +GLAPI GLboolean APIENTRY emscripten_glIsVertexArray (GLuint array); + + +GLAPI void APIENTRY emscripten_glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices); +GLAPI void APIENTRY emscripten_glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +GLAPI GLuint APIENTRY emscripten_glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); +GLAPI void APIENTRY emscripten_glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +GLAPI void APIENTRY emscripten_glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +GLAPI void APIENTRY emscripten_glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); + + +GLAPI void APIENTRY emscripten_glReleaseShaderCompiler (void); +GLAPI void APIENTRY emscripten_glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); +GLAPI void APIENTRY emscripten_glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GLAPI void APIENTRY emscripten_glDepthRangef (GLclampf n, GLclampf f); +GLAPI void APIENTRY emscripten_glClearDepthf (GLclampf d); + + +GLAPI void APIENTRY emscripten_glVertexAttribDivisor (GLuint index, GLuint divisor); + + +void* emscripten_GetProcAddress(const char *name_) { + char *name = malloc(strlen(name_)+1); + strcpy(name, name_); + // remove EXT|ARB|OES suffixes + char *end = strstr(name, "EXT"); + if (end) *end = 0; + end = strstr(name, "ARB"); + if (end) *end = 0; + end = strstr(name, "OES"); + if (end) *end = 0; + // misc renamings + if (!strcmp(name, "glCreateProgramObject")) name = "glCreateProgram"; + else if (!strcmp(name, "glUseProgramObject")) name = "glUseProgram"; + else if (!strcmp(name, "glCreateShaderObject")) name = "glCreateShader"; + else if (!strcmp(name, "glAttachObject")) name = "glAttachShader"; + else if (!strcmp(name, "glDetachObject")) name = "glDetachShader"; + // main list + if (!strcmp(name, "glPixelStorei")) return emscripten_glPixelStorei; + else if (!strcmp(name, "glGetString")) return emscripten_glGetString; + else if (!strcmp(name, "glGetIntegerv")) return emscripten_glGetIntegerv; + else if (!strcmp(name, "glGetFloatv")) return emscripten_glGetFloatv; + else if (!strcmp(name, "glGetBooleanv")) return emscripten_glGetBooleanv; + else if (!strcmp(name, "glGenTextures")) return emscripten_glGenTextures; + else if (!strcmp(name, "glDeleteTextures")) return emscripten_glDeleteTextures; + else if (!strcmp(name, "glCompressedTexImage2D")) return emscripten_glCompressedTexImage2D; + else if (!strcmp(name, "glCompressedTexSubImage2D")) return emscripten_glCompressedTexSubImage2D; + else if (!strcmp(name, "glTexImage2D")) return emscripten_glTexImage2D; + else if (!strcmp(name, "glTexSubImage2D")) return emscripten_glTexSubImage2D; + else if (!strcmp(name, "glReadPixels")) return emscripten_glReadPixels; + else if (!strcmp(name, "glBindTexture")) return emscripten_glBindTexture; + else if (!strcmp(name, "glGetTexParameterfv")) return emscripten_glGetTexParameterfv; + else if (!strcmp(name, "glGetTexParameteriv")) return emscripten_glGetTexParameteriv; + else if (!strcmp(name, "glTexParameterfv")) return emscripten_glTexParameterfv; + else if (!strcmp(name, "glTexParameteriv")) return emscripten_glTexParameteriv; + else if (!strcmp(name, "glIsTexture")) return emscripten_glIsTexture; + else if (!strcmp(name, "glGenBuffers")) return emscripten_glGenBuffers; + else if (!strcmp(name, "glDeleteBuffers")) return emscripten_glDeleteBuffers; + else if (!strcmp(name, "glGetBufferParameteriv")) return emscripten_glGetBufferParameteriv; + else if (!strcmp(name, "glBufferData")) return emscripten_glBufferData; + else if (!strcmp(name, "glBufferSubData")) return emscripten_glBufferSubData; + else if (!strcmp(name, "glIsBuffer")) return emscripten_glIsBuffer; + else if (!strcmp(name, "glGenRenderbuffers")) return emscripten_glGenRenderbuffers; + else if (!strcmp(name, "glDeleteRenderbuffers")) return emscripten_glDeleteRenderbuffers; + else if (!strcmp(name, "glBindRenderbuffer")) return emscripten_glBindRenderbuffer; + else if (!strcmp(name, "glGetRenderbufferParameteriv")) return emscripten_glGetRenderbufferParameteriv; + else if (!strcmp(name, "glIsRenderbuffer")) return emscripten_glIsRenderbuffer; + else if (!strcmp(name, "glGetUniformfv")) return emscripten_glGetUniformfv; + else if (!strcmp(name, "glGetUniformiv")) return emscripten_glGetUniformiv; + else if (!strcmp(name, "glGetUniformLocation")) return emscripten_glGetUniformLocation; + else if (!strcmp(name, "glGetVertexAttribfv")) return emscripten_glGetVertexAttribfv; + else if (!strcmp(name, "glGetVertexAttribiv")) return emscripten_glGetVertexAttribiv; + else if (!strcmp(name, "glGetVertexAttribPointerv")) return emscripten_glGetVertexAttribPointerv; + else if (!strcmp(name, "glGetActiveUniform")) return emscripten_glGetActiveUniform; + else if (!strcmp(name, "glUniform1f")) return emscripten_glUniform1f; + else if (!strcmp(name, "glUniform2f")) return emscripten_glUniform2f; + else if (!strcmp(name, "glUniform3f")) return emscripten_glUniform3f; + else if (!strcmp(name, "glUniform4f")) return emscripten_glUniform4f; + else if (!strcmp(name, "glUniform1i")) return emscripten_glUniform1i; + else if (!strcmp(name, "glUniform2i")) return emscripten_glUniform2i; + else if (!strcmp(name, "glUniform3i")) return emscripten_glUniform3i; + else if (!strcmp(name, "glUniform4i")) return emscripten_glUniform4i; + else if (!strcmp(name, "glUniform1iv")) return emscripten_glUniform1iv; + else if (!strcmp(name, "glUniform2iv")) return emscripten_glUniform2iv; + else if (!strcmp(name, "glUniform3iv")) return emscripten_glUniform3iv; + else if (!strcmp(name, "glUniform4iv")) return emscripten_glUniform4iv; + else if (!strcmp(name, "glUniform1fv")) return emscripten_glUniform1fv; + else if (!strcmp(name, "glUniform2fv")) return emscripten_glUniform2fv; + else if (!strcmp(name, "glUniform3fv")) return emscripten_glUniform3fv; + else if (!strcmp(name, "glUniform4fv")) return emscripten_glUniform4fv; + else if (!strcmp(name, "glUniformMatrix2fv")) return emscripten_glUniformMatrix2fv; + else if (!strcmp(name, "glUniformMatrix3fv")) return emscripten_glUniformMatrix3fv; + else if (!strcmp(name, "glUniformMatrix4fv")) return emscripten_glUniformMatrix4fv; + else if (!strcmp(name, "glBindBuffer")) return emscripten_glBindBuffer; + else if (!strcmp(name, "glVertexAttrib1fv")) return emscripten_glVertexAttrib1fv; + else if (!strcmp(name, "glVertexAttrib2fv")) return emscripten_glVertexAttrib2fv; + else if (!strcmp(name, "glVertexAttrib3fv")) return emscripten_glVertexAttrib3fv; + else if (!strcmp(name, "glVertexAttrib4fv")) return emscripten_glVertexAttrib4fv; + else if (!strcmp(name, "glGetAttribLocation")) return emscripten_glGetAttribLocation; + else if (!strcmp(name, "glGetActiveAttrib")) return emscripten_glGetActiveAttrib; + else if (!strcmp(name, "glCreateShader")) return emscripten_glCreateShader; + else if (!strcmp(name, "glDeleteShader")) return emscripten_glDeleteShader; + else if (!strcmp(name, "glGetAttachedShaders")) return emscripten_glGetAttachedShaders; + else if (!strcmp(name, "glShaderSource")) return emscripten_glShaderSource; + else if (!strcmp(name, "glGetShaderSource")) return emscripten_glGetShaderSource; + else if (!strcmp(name, "glCompileShader")) return emscripten_glCompileShader; + else if (!strcmp(name, "glGetShaderInfoLog")) return emscripten_glGetShaderInfoLog; + else if (!strcmp(name, "glGetShaderiv")) return emscripten_glGetShaderiv; + else if (!strcmp(name, "glGetProgramiv")) return emscripten_glGetProgramiv; + else if (!strcmp(name, "glIsShader")) return emscripten_glIsShader; + else if (!strcmp(name, "glCreateProgram")) return emscripten_glCreateProgram; + else if (!strcmp(name, "glDeleteProgram")) return emscripten_glDeleteProgram; + else if (!strcmp(name, "glAttachShader")) return emscripten_glAttachShader; + else if (!strcmp(name, "glDetachShader")) return emscripten_glDetachShader; + else if (!strcmp(name, "glGetShaderPrecisionFormat")) return emscripten_glGetShaderPrecisionFormat; + else if (!strcmp(name, "glLinkProgram")) return emscripten_glLinkProgram; + else if (!strcmp(name, "glGetProgramInfoLog")) return emscripten_glGetProgramInfoLog; + else if (!strcmp(name, "glUseProgram")) return emscripten_glUseProgram; + else if (!strcmp(name, "glValidateProgram")) return emscripten_glValidateProgram; + else if (!strcmp(name, "glIsProgram")) return emscripten_glIsProgram; + else if (!strcmp(name, "glBindAttribLocation")) return emscripten_glBindAttribLocation; + else if (!strcmp(name, "glBindFramebuffer")) return emscripten_glBindFramebuffer; + else if (!strcmp(name, "glGenFramebuffers")) return emscripten_glGenFramebuffers; + else if (!strcmp(name, "glDeleteFramebuffers")) return emscripten_glDeleteFramebuffers; + else if (!strcmp(name, "glFramebufferRenderbuffer")) return emscripten_glFramebufferRenderbuffer; + else if (!strcmp(name, "glFramebufferTexture2D")) return emscripten_glFramebufferTexture2D; + else if (!strcmp(name, "glGetFramebufferAttachmentParameteriv")) return emscripten_glGetFramebufferAttachmentParameteriv; + else if (!strcmp(name, "glIsFramebuffer")) return emscripten_glIsFramebuffer; + else if (!strcmp(name, "glDeleteObject")) return emscripten_glDeleteObjectARB; + else if (!strcmp(name, "glGetObjectParameteriv")) return emscripten_glGetObjectParameterivARB; + else if (!strcmp(name, "glGetInfoLog")) return emscripten_glGetInfoLogARB; + else if (!strcmp(name, "glBindProgram")) return emscripten_glBindProgramARB; + else if (!strcmp(name, "glGetPointerv")) return emscripten_glGetPointerv; + else if (!strcmp(name, "glDrawRangeElements")) return emscripten_glDrawRangeElements; + else if (!strcmp(name, "glEnableClientState")) return emscripten_glEnableClientState; + else if (!strcmp(name, "glVertexPointer")) return emscripten_glVertexPointer; + else if (!strcmp(name, "glTexCoordPointer")) return emscripten_glTexCoordPointer; + else if (!strcmp(name, "glNormalPointer")) return emscripten_glNormalPointer; + else if (!strcmp(name, "glColorPointer")) return emscripten_glColorPointer; + else if (!strcmp(name, "glClientActiveTexture")) return emscripten_glClientActiveTexture; + else if (!strcmp(name, "glGenVertexArrays")) return emscripten_glGenVertexArrays; + else if (!strcmp(name, "glDeleteVertexArrays")) return emscripten_glDeleteVertexArrays; + else if (!strcmp(name, "glBindVertexArray")) return emscripten_glBindVertexArray; + else if (!strcmp(name, "glMatrixMode")) return emscripten_glMatrixMode; + else if (!strcmp(name, "glLoadIdentity")) return emscripten_glLoadIdentity; + else if (!strcmp(name, "glLoadMatrixf")) return emscripten_glLoadMatrixf; + else if (!strcmp(name, "glFrustum")) return emscripten_glFrustum; + else if (!strcmp(name, "glRotatef")) return emscripten_glRotatef; + else if (!strcmp(name, "glVertexAttribPointer")) return emscripten_glVertexAttribPointer; + else if (!strcmp(name, "glEnableVertexAttribArray")) return emscripten_glEnableVertexAttribArray; + else if (!strcmp(name, "glDisableVertexAttribArray")) return emscripten_glDisableVertexAttribArray; + else if (!strcmp(name, "glDrawArrays")) return emscripten_glDrawArrays; + else if (!strcmp(name, "glDrawElements")) return emscripten_glDrawElements; + else if (!strcmp(name, "glShaderBinary")) return emscripten_glShaderBinary; + else if (!strcmp(name, "glReleaseShaderCompiler")) return emscripten_glReleaseShaderCompiler; + else if (!strcmp(name, "glGetError")) return emscripten_glGetError; + else if (!strcmp(name, "glVertexAttribDivisor")) return emscripten_glVertexAttribDivisor; + else if (!strcmp(name, "glDrawArraysInstanced")) return emscripten_glDrawArraysInstanced; + else if (!strcmp(name, "glDrawElementsInstanced")) return emscripten_glDrawElementsInstanced; + else if (!strcmp(name, "glFinish")) return emscripten_glFinish; + else if (!strcmp(name, "glFlush")) return emscripten_glFlush; + else if (!strcmp(name, "glClearDepth")) return emscripten_glClearDepth; + else if (!strcmp(name, "glClearDepthf")) return emscripten_glClearDepthf; + else if (!strcmp(name, "glDepthFunc")) return emscripten_glDepthFunc; + else if (!strcmp(name, "glEnable")) return emscripten_glEnable; + else if (!strcmp(name, "glDisable")) return emscripten_glDisable; + else if (!strcmp(name, "glFrontFace")) return emscripten_glFrontFace; + else if (!strcmp(name, "glCullFace")) return emscripten_glCullFace; + else if (!strcmp(name, "glClear")) return emscripten_glClear; + else if (!strcmp(name, "glLineWidth")) return emscripten_glLineWidth; + else if (!strcmp(name, "glClearStencil")) return emscripten_glClearStencil; + else if (!strcmp(name, "glDepthMask")) return emscripten_glDepthMask; + else if (!strcmp(name, "glStencilMask")) return emscripten_glStencilMask; + else if (!strcmp(name, "glCheckFramebufferStatus")) return emscripten_glCheckFramebufferStatus; + else if (!strcmp(name, "glGenerateMipmap")) return emscripten_glGenerateMipmap; + else if (!strcmp(name, "glActiveTexture")) return emscripten_glActiveTexture; + else if (!strcmp(name, "glBlendEquation")) return emscripten_glBlendEquation; + else if (!strcmp(name, "glIsEnabled")) return emscripten_glIsEnabled; + else if (!strcmp(name, "glBlendFunc")) return emscripten_glBlendFunc; + else if (!strcmp(name, "glBlendEquationSeparate")) return emscripten_glBlendEquationSeparate; + else if (!strcmp(name, "glDepthRange")) return emscripten_glDepthRange; + else if (!strcmp(name, "glDepthRangef")) return emscripten_glDepthRangef; + else if (!strcmp(name, "glStencilMaskSeparate")) return emscripten_glStencilMaskSeparate; + else if (!strcmp(name, "glHint")) return emscripten_glHint; + else if (!strcmp(name, "glPolygonOffset")) return emscripten_glPolygonOffset; + else if (!strcmp(name, "glVertexAttrib1f")) return emscripten_glVertexAttrib1f; + else if (!strcmp(name, "glSampleCoverage")) return emscripten_glSampleCoverage; + else if (!strcmp(name, "glTexParameteri")) return emscripten_glTexParameteri; + else if (!strcmp(name, "glTexParameterf")) return emscripten_glTexParameterf; + else if (!strcmp(name, "glVertexAttrib2f")) return emscripten_glVertexAttrib2f; + else if (!strcmp(name, "glStencilFunc")) return emscripten_glStencilFunc; + else if (!strcmp(name, "glStencilOp")) return emscripten_glStencilOp; + else if (!strcmp(name, "glViewport")) return emscripten_glViewport; + else if (!strcmp(name, "glClearColor")) return emscripten_glClearColor; + else if (!strcmp(name, "glScissor")) return emscripten_glScissor; + else if (!strcmp(name, "glVertexAttrib3f")) return emscripten_glVertexAttrib3f; + else if (!strcmp(name, "glColorMask")) return emscripten_glColorMask; + else if (!strcmp(name, "glRenderbufferStorage")) return emscripten_glRenderbufferStorage; + else if (!strcmp(name, "glBlendFuncSeparate")) return emscripten_glBlendFuncSeparate; + else if (!strcmp(name, "glBlendColor")) return emscripten_glBlendColor; + else if (!strcmp(name, "glStencilFuncSeparate")) return emscripten_glStencilFuncSeparate; + else if (!strcmp(name, "glStencilOpSeparate")) return emscripten_glStencilOpSeparate; + else if (!strcmp(name, "glVertexAttrib4f")) return emscripten_glVertexAttrib4f; + else if (!strcmp(name, "glCopyTexImage2D")) return emscripten_glCopyTexImage2D; + else if (!strcmp(name, "glCopyTexSubImage2D")) return emscripten_glCopyTexSubImage2D; + + fprintf(stderr, "bad name in getProcAddress: %s | %s\n", name_, name); + return 0; +} + diff --git a/system/lib/gl.symbols b/system/lib/gl.symbols new file mode 100644 index 00000000..8ba8d6f7 --- /dev/null +++ b/system/lib/gl.symbols @@ -0,0 +1 @@ + T emscripten_GetProcAddress diff --git a/system/lib/libc.symbols b/system/lib/libc.symbols index 6f80ef90..53a27082 100644 --- a/system/lib/libc.symbols +++ b/system/lib/libc.symbols @@ -72,7 +72,16 @@ W realloc_in_place T scalbn T scalbnl + T memcmp + T memcpy T strtod + T strcoll + T __strcoll_l + W strcoll_l + T strcmp + T strncmp + T strcasecmp + T strncasecmp T strtod_l T strtof T strtof_l diff --git a/system/lib/libc/musl/src/locale/strcoll.c b/system/lib/libc/musl/src/locale/strcoll.c new file mode 100644 index 00000000..39ea1123 --- /dev/null +++ b/system/lib/libc/musl/src/locale/strcoll.c @@ -0,0 +1,15 @@ +#include <string.h> +#include <locale.h> +#include "libc.h" + +int __strcoll_l(const char *l, const char *r, locale_t loc) +{ + return strcmp(l, r); +} + +int strcoll(const char *l, const char *r) +{ + return __strcoll_l(l, r, 0); +} + +weak_alias(__strcoll_l, strcoll_l); diff --git a/system/lib/libc/musl/src/regex/fnmatch.c b/system/lib/libc/musl/src/regex/fnmatch.c new file mode 100644 index 00000000..ffd3ea0d --- /dev/null +++ b/system/lib/libc/musl/src/regex/fnmatch.c @@ -0,0 +1,299 @@ +/* + * An implementation of what I call the "Sea of Stars" algorithm for + * POSIX fnmatch(). The basic idea is that we factor the pattern into + * a head component (which we match first and can reject without ever + * measuring the length of the string), an optional tail component + * (which only exists if the pattern contains at least one star), and + * an optional "sea of stars", a set of star-separated components + * between the head and tail. After the head and tail matches have + * been removed from the input string, the components in the "sea of + * stars" are matched sequentially by searching for their first + * occurrence past the end of the previous match. + * + * - Rich Felker, April 2012 + */ + +#include <string.h> +#include <fnmatch.h> +#include <stdlib.h> +#include <wchar.h> +#include <wctype.h> + +#define END -1 +#define UNMATCHABLE -2 +#define BRACKET -3 +#define QUESTION -4 +#define STAR -5 + +static int str_next(const char *str, size_t n, size_t *step) +{ + if (!n) { + *step = 0; + return 0; + } + if (str[0] >= 128U) { + wchar_t wc; + int k = mbtowc(&wc, str, n); + if (k<0) { + *step = 1; + return -1; + } + *step = k; + return wc; + } + *step = 1; + return str[0]; +} + +static int pat_next(const char *pat, size_t m, size_t *step, int flags) +{ + int esc = 0; + if (!m || !*pat) { + *step = 0; + return END; + } + *step = 1; + if (pat[0]=='\\' && !(flags & FNM_NOESCAPE)) { + *step = 2; + pat++; + esc = 1; + goto escaped; + } + if (pat[0]=='[') { + size_t k = 1; + if (k<m) if (pat[k] == '^' || pat[k] == '!') k++; + if (k<m) if (pat[k] == ']') k++; + for (; k<m && pat[k] && pat[k]!=']'; k++) { + if (k+1<m && pat[k+1] && pat[k]=='[' && (pat[k+1]==':' || pat[k+1]=='.' || pat[k+1]=='=')) { + int z = pat[k+1]; + k+=2; + if (k<m && pat[k]) k++; + while (k<m && pat[k] && (pat[k-1]!=z || pat[k]!=']')) k++; + if (k==m || !pat[k]) break; + } + } + if (k==m || !pat[k]) { + *step = 1; + return '['; + } + *step = k+1; + return BRACKET; + } + if (pat[0] == '*') + return STAR; + if (pat[0] == '?') + return QUESTION; +escaped: + if (pat[0] >= 128U) { + wchar_t wc; + int k = mbtowc(&wc, pat, m); + if (k<0) { + *step = 0; + return UNMATCHABLE; + } + *step = k + esc; + return wc; + } + return pat[0]; +} + +static int match_bracket(const char *p, int k) +{ + wchar_t wc; + int inv = 0; + p++; + if (*p=='^' || *p=='!') { + inv = 1; + p++; + } + if (*p==']') { + if (k==']') return !inv; + p++; + } else if (*p=='-') { + if (k=='-') return !inv; + p++; + } + wc = p[-1]; + for (; *p != ']'; p++) { + if (p[0]=='-' && p[1]!=']') { + wchar_t wc2; + int l = mbtowc(&wc2, p+1, 4); + if (l < 0) return 0; + if (wc<=wc2 && (unsigned)k-wc <= wc2-wc) return !inv; + p += l-1; + continue; + } + if (p[0]=='[' && (p[1]==':' || p[1]=='.' || p[1]=='=')) { + const char *p0 = p+2; + int z = p[1]; + p+=3; + while (p[-1]!=z || p[0]!=']') p++; + if (z == ':' && p-1-p0 < 16) { + char buf[16]; + memcpy(buf, p0, p-1-p0); + buf[p-1-p0] = 0; + if (iswctype(k, wctype(buf))) return !inv; + } + continue; + } + if (*p < 128U) { + wc = (unsigned char)*p; + } else { + int l = mbtowc(&wc, p, 4); + if (l < 0) return 0; + p += l-1; + } + if (wc==k) return !inv; + } + return inv; +} + +static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n, int flags) +{ + const char *p, *ptail, *endpat; + const char *s, *stail, *endstr; + size_t pinc, sinc, tailcnt=0; + int c, k; + + if (flags & FNM_PERIOD) { + if (*str == '.' && *pat != '.') + return FNM_NOMATCH; + } + for (;;) { + switch ((c = pat_next(pat, m, &pinc, flags))) { + case UNMATCHABLE: + return FNM_NOMATCH; + case STAR: + pat++; + m--; + break; + default: + k = str_next(str, n, &sinc); + if (k <= 0) + return (c==END) ? 0 : FNM_NOMATCH; + str += sinc; + n -= sinc; + if (c == BRACKET) { + if (!match_bracket(pat, k)) + return FNM_NOMATCH; + } else if (c != QUESTION && k != c) { + return FNM_NOMATCH; + } + pat+=pinc; + m-=pinc; + continue; + } + break; + } + + /* Compute real pat length if it was initially unknown/-1 */ + m = strnlen(pat, m); + endpat = pat + m; + + /* Find the last * in pat and count chars needed after it */ + for (p=ptail=pat; p<endpat; p+=pinc) { + switch (pat_next(p, endpat-p, &pinc, flags)) { + case UNMATCHABLE: + return FNM_NOMATCH; + case STAR: + tailcnt=0; + ptail = p+1; + break; + default: + tailcnt++; + break; + } + } + + /* Past this point we need not check for UNMATCHABLE in pat, + * because all of pat has already been parsed once. */ + + /* Compute real str length if it was initially unknown/-1 */ + n = strnlen(str, n); + endstr = str + n; + if (n < tailcnt) return FNM_NOMATCH; + + /* Find the final tailcnt chars of str, accounting for UTF-8. + * On illegal sequences we may get it wrong, but in that case + * we necessarily have a matching failure anyway. */ + for (s=endstr; s>str && tailcnt; tailcnt--) { + if (s[-1] < 128U) s--; + else while ((unsigned char)*--s-0x80U<0x40 && s>str); + } + if (tailcnt) return FNM_NOMATCH; + stail = s; + + /* Check that the pat and str tails match */ + p = ptail; + for (;;) { + c = pat_next(p, endpat-p, &pinc, flags); + p += pinc; + if ((k = str_next(s, endstr-s, &sinc)) <= 0) { + if (c != END) return FNM_NOMATCH; + break; + } + s += sinc; + if (c == BRACKET) { + if (!match_bracket(p-pinc, k)) + return FNM_NOMATCH; + } else if (c != QUESTION && k != c) { + return FNM_NOMATCH; + } + } + + /* We're all done with the tails now, so throw them out */ + endstr = stail; + endpat = ptail; + + /* Match pattern components until there are none left */ + while (pat<endpat) { + p = pat; + s = str; + for (;;) { + c = pat_next(p, endpat-p, &pinc, flags); + p += pinc; + /* Encountering * completes/commits a component */ + if (c == STAR) { + pat = p; + str = s; + break; + } + k = str_next(s, endstr-s, &sinc); + if (!k) + return FNM_NOMATCH; + if (c == BRACKET) { + if (!match_bracket(p-pinc, k)) + break; + } else if (c != QUESTION && k != c) { + break; + } + s += sinc; + } + if (c == STAR) continue; + /* If we failed, advance str, by 1 char if it's a valid + * char, or past all invalid bytes otherwise. */ + k = str_next(str, endstr-str, &sinc); + if (k > 0) str += sinc; + else for (str++; str_next(str, endstr-str, &sinc)<0; str++); + } + + return 0; +} + +int fnmatch(const char *pat, const char *str, int flags) +{ + const char *s, *p; + size_t inc; + int c; + if (flags & FNM_PATHNAME) for (;;) { + for (s=str; *s && *s!='/'; s++); + for (p=pat; (c=pat_next(p, -1, &inc, flags))!=END && c!='/'; p+=inc); + if (*s && *p!=*s) return FNM_NOMATCH; + if (fnmatch_internal(pat, p-pat, str, s-str, flags)) + return FNM_NOMATCH; + if (!*s && c==END) return 0; + str = s+1; + pat = p+1; + } + return fnmatch_internal(pat, -1, str, -1, flags); +} diff --git a/system/lib/libc/musl/src/string/memcmp.c b/system/lib/libc/musl/src/string/memcmp.c new file mode 100644 index 00000000..bdbce9f0 --- /dev/null +++ b/system/lib/libc/musl/src/string/memcmp.c @@ -0,0 +1,8 @@ +#include <string.h> + +int memcmp(const void *vl, const void *vr, size_t n) +{ + const unsigned char *l=vl, *r=vr; + for (; n && *l == *r; n--, l++, r++); + return n ? *l-*r : 0; +} diff --git a/system/lib/libc/musl/src/string/strcasecmp.c b/system/lib/libc/musl/src/string/strcasecmp.c new file mode 100644 index 00000000..02fd5f8c --- /dev/null +++ b/system/lib/libc/musl/src/string/strcasecmp.c @@ -0,0 +1,9 @@ +#include <strings.h> +#include <ctype.h> + +int strcasecmp(const char *_l, const char *_r) +{ + const unsigned char *l=(void *)_l, *r=(void *)_r; + for (; *l && *r && (*l == *r || tolower(*l) == tolower(*r)); l++, r++); + return tolower(*l) - tolower(*r); +} diff --git a/system/lib/libc/musl/src/string/strcmp.c b/system/lib/libc/musl/src/string/strcmp.c new file mode 100644 index 00000000..91eb7404 --- /dev/null +++ b/system/lib/libc/musl/src/string/strcmp.c @@ -0,0 +1,7 @@ +#include <string.h> + +int strcmp(const char *l, const char *r) +{ + for (; *l==*r && *l && *r; l++, r++); + return *(unsigned char *)l - *(unsigned char *)r; +} diff --git a/system/lib/libc/musl/src/string/strncasecmp.c b/system/lib/libc/musl/src/string/strncasecmp.c new file mode 100644 index 00000000..24659721 --- /dev/null +++ b/system/lib/libc/musl/src/string/strncasecmp.c @@ -0,0 +1,10 @@ +#include <strings.h> +#include <ctype.h> + +int strncasecmp(const char *_l, const char *_r, size_t n) +{ + const unsigned char *l=(void *)_l, *r=(void *)_r; + if (!n--) return 0; + for (; *l && *r && n && (*l == *r || tolower(*l) == tolower(*r)); l++, r++, n--); + return tolower(*l) - tolower(*r); +} diff --git a/system/lib/libc/musl/src/string/strncmp.c b/system/lib/libc/musl/src/string/strncmp.c new file mode 100644 index 00000000..e228843f --- /dev/null +++ b/system/lib/libc/musl/src/string/strncmp.c @@ -0,0 +1,9 @@ +#include <string.h> + +int strncmp(const char *_l, const char *_r, size_t n) +{ + const unsigned char *l=(void *)_l, *r=(void *)_r; + if (!n--) return 0; + for (; *l && *r && n && *l == *r ; l++, r++, n--); + return *l - *r; +} diff --git a/system/lib/libcextra.symbols b/system/lib/libcextra.symbols index 6f1039f1..54176b1d 100644 --- a/system/lib/libcextra.symbols +++ b/system/lib/libcextra.symbols @@ -187,3 +187,4 @@ T wmemmove T wmemset T wprintf + T fnmatch diff --git a/system/lib/sdl.cpp b/system/lib/sdl.cpp deleted file mode 100644 index 7038cdb1..00000000 --- a/system/lib/sdl.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -#include <stdlib.h> - -// force malloc&free to be included in from libc -struct Force { - Force() { - void *x = malloc(10); - free(x); - } -}; - -static Force f; - diff --git a/system/lib/sdl.symbols b/system/lib/sdl.symbols deleted file mode 100644 index c2c0af42..00000000 --- a/system/lib/sdl.symbols +++ /dev/null @@ -1 +0,0 @@ - W SDL_Init |