diff --git a/c/xlib/client.c b/c/xlib/client.c index 35f6046..575bed8 100644 --- a/c/xlib/client.c +++ b/c/xlib/client.c @@ -127,11 +127,17 @@ s48_value scx_Set_Wm_Class(s48_value dpy, s48_value w, s48_value name, return S48_UNSPECIFIC; } -#define scx_extract_initial_state(x) S48_EXTRACT_ENUM(x, "scx-initial-state") -#define scx_enter_initial_state(x) S48_ENTER_ENUM(x, "scx-initial-states") +s48_value scx_initial_state_binding = S48_FALSE; +#define scx_extract_initial_state(x) \ + S48_EXTRACT_ENUM(x, scx_initial_state_binding) +s48_value scx_initial_states_binding = S48_FALSE; +#define scx_enter_initial_state(x) \ + S48_ENTER_ENUM(x, scx_initial_states_binding) -#define scx_extract_wm_hint(x) S48_EXTRACT_ENUM(x, "scx-wm-hint") -#define scx_enter_wm_hint(x) S48_ENTER_ENUM(x, "scx-wm-hints") +s48_value scx_wm_hint_binding = S48_FALSE; +#define scx_extract_wm_hint(x) S48_EXTRACT_ENUM(x, scx_wm_hint_binding) +s48_value scx_wm_hints_binding = S48_FALSE; +#define scx_enter_wm_hint(x) S48_ENTER_ENUM(x, scx_wm_hints_binding) s48_value scx_enter_wm_hint_alist(XWMHints* p) { s48_value res = S48_NULL, t = S48_FALSE; @@ -282,8 +288,10 @@ s48_value scx_Set_Text_Property(s48_value dpy, s48_value w, s48_value prop, return S48_UNSPECIFIC; } -#define scx_extract_size_hint(h) S48_EXTRACT_ENUM(h, "scx-size-hint") -#define scx_enter_size_hint(h) S48_ENTER_ENUM(h, "scx-size-hints") +s48_value scx_size_hint_binding = S48_FALSE; +#define scx_extract_size_hint(h) S48_EXTRACT_ENUM(h, scx_size_hint_binding) +s48_value scx_size_hints_binding = S48_FALSE; +#define scx_enter_size_hint(h) S48_ENTER_ENUM(h, scx_size_hints_binding) s48_value scx_enter_size_hint_alist(XSizeHints* sh) { int i; @@ -404,8 +412,10 @@ s48_value scx_Set_Wm_Normal_Hints(s48_value dpy, s48_value win, return S48_UNSPECIFIC; } +s48_value scx_icon_size_binding = S48_FALSE; + s48_value scx_enter_icon_size(XIconSize* is) { - s48_value res = s48_make_record(s48_get_imported_binding("scx-icon-size")); + s48_value res = s48_make_record(scx_icon_size_binding); S48_DECLARE_GC_PROTECT(1); S48_GC_PROTECT_1(res); S48_RECORD_SET(res, 0, s48_enter_integer(is->min_width)); @@ -419,7 +429,7 @@ s48_value scx_enter_icon_size(XIconSize* is) { } void scx_extract_icon_size(s48_value r, XIconSize* is) { - s48_check_record_type(r, s48_get_imported_binding("scx-icon-size")); + s48_check_record_type(r, scx_icon_size_binding); is->min_width = s48_extract_integer(S48_RECORD_REF(r, 0)); is->min_height = s48_extract_integer(S48_RECORD_REF(r, 1)); is->max_width = s48_extract_integer(S48_RECORD_REF(r, 2)); @@ -461,6 +471,14 @@ s48_value scx_Set_Icon_Sizes(s48_value dpy, s48_value w, s48_value v) { } scx_init_client() { + SCX_PRO_IMP(scx_icon_size_binding, "scx-icon-size"); + SCX_PRO_IMP(scx_initial_state_binding, "scx-initial-state"); + SCX_PRO_IMP(scx_initial_states_binding, "scx-initial-states"); + SCX_PRO_IMP(scx_wm_hint_binding, "scx-wm-hint"); + SCX_PRO_IMP(scx_wm_hints_binding, "scx-wm-hints"); + SCX_PRO_IMP(scx_size_hint_binding, "scx-size-hint"); + SCX_PRO_IMP(scx_size_hints_binding, "scx-size-hints"); + S48_EXPORT_FUNCTION(scx_Iconify_Window); S48_EXPORT_FUNCTION(scx_Withdraw_Window); S48_EXPORT_FUNCTION(scx_Reconfigure_Wm_Window); diff --git a/c/xlib/colormap.c b/c/xlib/colormap.c index 9a9e2b3..72a2e4f 100644 --- a/c/xlib/colormap.c +++ b/c/xlib/colormap.c @@ -1,6 +1,7 @@ #include "xlib.h" -#define scx_extract_colormap_alloc(x) S48_EXTRACT_ENUM(x, "scx-colormap-alloc") +s48_value scx_colormap_alloc_binding = S48_FALSE; +#define scx_extract_colormap_alloc(x) S48_EXTRACT_ENUM(x, scx_colormap_alloc_binding) double s48_extract_number(s48_value v) { if (S48_DOUBLE_P(v)) @@ -257,6 +258,8 @@ s48_value scx_Store_Named_Color(s48_value display, s48_value colormap, } void scx_init_colormap(void) { + SCX_PRO_IMP(scx_colormap_alloc_binding, "scx-colormap-alloc"); + S48_EXPORT_FUNCTION(scx_Create_Colormap); S48_EXPORT_FUNCTION(scx_Copy_Colormap_And_Free); S48_EXPORT_FUNCTION(scx_Free_Colormap); diff --git a/c/xlib/display.c b/c/xlib/display.c index 315f389..5817923 100644 --- a/c/xlib/display.c +++ b/c/xlib/display.c @@ -2,9 +2,10 @@ #include "xlib.h" +s48_value scx_screen_format_binding = S48_FALSE; + s48_value scx_enter_screenformat(ScreenFormat* sf) { - s48_value res = - s48_make_record(s48_get_imported_binding("scx-screen-format")); + s48_value res = s48_make_record(scx_screen_format_binding); S48_DECLARE_GC_PROTECT(1); S48_GC_PROTECT_1(res); S48_RECORD_SET(res, 0, s48_enter_integer(sf->depth)); @@ -49,15 +50,17 @@ s48_value scx_enter_screen(Screen* scr) { } s48_value scx_display_list = S48_NULL; +s48_value scx_general_after_function_binding = S48_FALSE; static int scx_after_function_wrapper(Display* dpy) { s48_value display = scx_enter_display(dpy); - s48_value fun = S48_SHARED_BINDING_REF( - s48_get_imported_binding("scx-general-after-function")); + s48_value fun = S48_SHARED_BINDING_REF(scx_general_after_function_binding); s48_call_scheme(fun, 1, display); return 0; } +s48_value scx_initialize_display_binding = S48_FALSE; + s48_value scx_enter_display(Display* dpy) { s48_value d = scx_struct_cache_ref(dpy, scx_display_list); if (d == S48_FALSE) { @@ -91,8 +94,8 @@ s48_value scx_enter_display(Display* dpy) { S48_RECORD_SET(d, 14, S48_FALSE); XSetAfterFunction(dpy, &scx_after_function_wrapper); S48_RECORD_SET(d, 15, S48_FALSE); - s48_call_scheme(S48_SHARED_BINDING_REF(s48_get_imported_binding( - "scx-initialize-display")), 1, d); + s48_call_scheme(S48_SHARED_BINDING_REF(scx_initialize_display_binding), + 1, d); S48_GC_UNPROTECT(); } return d; @@ -145,6 +148,10 @@ s48_value scx_Display_Select_Input(s48_value display, s48_value window, } void scx_init_display(void) { + SCX_PRO_IMP(scx_screen_format_binding, "scx-screen-format"); + SCX_PRO_IMP(scx_general_after_function_binding, + "scx-general-after-function"); + SCX_PRO_IMP(scx_initialize_display_binding, "scx-initialize-display"); S48_GC_PROTECT_GLOBAL(scx_display_list); S48_GC_PROTECT_GLOBAL(scx_screen_list); diff --git a/c/xlib/error.c b/c/xlib/error.c index 72e66ec..da17c07 100644 --- a/c/xlib/error.c +++ b/c/xlib/error.c @@ -1,9 +1,11 @@ #include "xlib.h" #include +s48_value scx_error_code_binding = S48_FALSE; +s48_value scx_error_codes_binding = S48_FALSE; + s48_value scx_enter_error_code(int code) { - s48_value v = - S48_SHARED_BINDING_REF(s48_get_imported_binding("scx-error-codes")); + s48_value v = S48_SHARED_BINDING_REF(scx_error_codes_binding); if (code < S48_VECTOR_LENGTH(v)) return S48_VECTOR_REF(v, code); else @@ -11,16 +13,17 @@ s48_value scx_enter_error_code(int code) { } s48_value scx_extract_error_code(s48_value code) { - if (S48_RECORD_P(code)) { - s48_value t = - S48_SHARED_BINDING_REF(s48_get_imported_binding("scx-error-code")); - return s48_extract_integer(s48_checked_record_ref(code, 1, t)); - } else + if (S48_RECORD_P(code)) + return s48_extract_integer(s48_checked_record_ref(code, 1, + scx_error_code_binding)); + else return s48_extract_integer(code); } +s48_value scx_x_error_binding = S48_FALSE; + s48_value scx_enter_x_error(XErrorEvent* xe) { - s48_value e = s48_make_record(s48_get_imported_binding("scx-x-error")); + s48_value e = s48_make_record(scx_x_error_binding); char s[1024]; S48_DECLARE_GC_PROTECT(1); S48_GC_PROTECT_1(e); @@ -39,7 +42,7 @@ s48_value scx_enter_x_error(XErrorEvent* xe) { } void scx_extract_x_error(s48_value e, XErrorEvent* xe) { - s48_check_record_type(e, s48_get_imported_binding("scx-x-error")); + s48_check_record_type(e, scx_x_error_binding); xe->type = 1; xe->display = scx_extract_display(S48_RECORD_REF(e, 0)); xe->serial = s48_extract_integer(S48_RECORD_REF(e, 1)); @@ -111,6 +114,9 @@ static int fatal_error_handler_wrapper(Display* d) { } void scx_init_error() { + SCX_PRO_IMP(scx_error_code_binding, "scx-error-code"); + SCX_PRO_IMP(scx_error_codes_binding, "scx-error-codes"); + SCX_PRO_IMP(scx_x_error_binding, "scx-x-error"); S48_GC_PROTECT_GLOBAL(internal_x_error_handler_binding); S48_GC_PROTECT_GLOBAL(internal_x_fatal_error_handler_binding); diff --git a/c/xlib/event-types.c b/c/xlib/event-types.c index 2e012f0..4029140 100644 --- a/c/xlib/event-types.c +++ b/c/xlib/event-types.c @@ -4,8 +4,8 @@ #define EENTER(i, n, f) S48_RECORD_SET(e, i, f(xe->n)) -#define EENTER_START(stype) \ - s48_value e = s48_make_record(s48_get_imported_binding(stype)); \ +#define EENTER_START(rtype) \ + s48_value e = s48_make_record(rtype); \ S48_DECLARE_GC_PROTECT(1); \ S48_GC_PROTECT_1(e); \ EENTER(0, type, scx_enter_event_type); \ @@ -17,8 +17,10 @@ S48_GC_UNPROTECT(); \ return e +s48_value scx_key_event_binding = S48_FALSE; + s48_value scx_enter_key_event(XKeyEvent* xe) { - EENTER_START("scx-key-event"); + EENTER_START(scx_key_event_binding); EENTER(4, window, scx_enter_window); EENTER(5, root, scx_enter_window); EENTER(6, subwindow, scx_enter_window); @@ -33,8 +35,10 @@ s48_value scx_enter_key_event(XKeyEvent* xe) { EENTER_END(); } +s48_value scx_button_event_binding = S48_FALSE; + s48_value scx_enter_button_event(XButtonEvent* xe) { - EENTER_START("scx-button-event"); + EENTER_START(scx_button_event_binding); EENTER(4, window, scx_enter_window); EENTER(5, root, scx_enter_window); EENTER(6, subwindow, scx_enter_window); @@ -49,8 +53,10 @@ s48_value scx_enter_button_event(XButtonEvent* xe) { EENTER_END(); } +s48_value scx_motion_event_binding = S48_FALSE; + s48_value scx_enter_motion_event(XMotionEvent* xe) { - EENTER_START("scx-motion-event"); + EENTER_START(scx_motion_event_binding); EENTER(4, window, scx_enter_window); EENTER(5, root, scx_enter_window); EENTER(6, subwindow, scx_enter_window); @@ -65,8 +71,10 @@ s48_value scx_enter_motion_event(XMotionEvent* xe) { EENTER_END(); } +s48_value scx_crossing_event_binding = S48_FALSE; + s48_value scx_enter_crossing_event(XCrossingEvent* xe) { - EENTER_START("scx-crossing-event"); + EENTER_START(scx_crossing_event_binding); EENTER(4, window, scx_enter_window); EENTER(5, root, scx_enter_window); EENTER(6, subwindow, scx_enter_window); @@ -83,16 +91,20 @@ s48_value scx_enter_crossing_event(XCrossingEvent* xe) { EENTER_END(); } +s48_value scx_focus_change_event_binding = S48_FALSE; + s48_value scx_enter_focus_change_event(XFocusChangeEvent* xe) { - EENTER_START("scx-focus-change-event"); + EENTER_START(scx_focus_change_event_binding); EENTER(4, window, scx_enter_window); EENTER(5, mode, scx_enter_notify_mode); EENTER(6, detail, scx_enter_notify_detail); EENTER_END(); } +s48_value scx_expose_event_binding = S48_FALSE; + s48_value scx_enter_expose_event(XExposeEvent* xe) { - EENTER_START("scx-expose-event"); + EENTER_START(scx_expose_event_binding); EENTER(4, window, scx_enter_window); EENTER(5, x, s48_enter_integer); EENTER(6, y, s48_enter_integer); @@ -102,8 +114,10 @@ s48_value scx_enter_expose_event(XExposeEvent* xe) { EENTER_END(); } +s48_value scx_graphics_expose_event_binding = S48_FALSE; + s48_value scx_enter_graphics_expose_event(XGraphicsExposeEvent* xe) { - EENTER_START("scx-graphics-expose-event"); + EENTER_START(scx_graphics_expose_event_binding); EENTER(4, drawable, scx_enter_drawable); EENTER(5, x, s48_enter_integer); EENTER(6, y, s48_enter_integer); @@ -115,23 +129,29 @@ s48_value scx_enter_graphics_expose_event(XGraphicsExposeEvent* xe) { EENTER_END(); } +s48_value scx_no_expose_event_binding = S48_FALSE; + s48_value scx_enter_no_expose_event(XNoExposeEvent* xe) { - EENTER_START("scx-no-expose-event"); + EENTER_START(scx_no_expose_event_binding); EENTER(4, drawable, scx_enter_drawable); EENTER(5, major_code, s48_enter_integer); EENTER(6, minor_code, s48_enter_integer); EENTER_END(); } +s48_value scx_visibility_event_binding = S48_FALSE; + s48_value scx_enter_visibility_event(XVisibilityEvent* xe) { - EENTER_START("scx-visibility-event"); + EENTER_START(scx_visibility_event_binding); EENTER(4, window, scx_enter_window); EENTER(5, state, scx_enter_visibility_state); EENTER_END(); } +s48_value scx_create_window_event_binding = S48_FALSE; + s48_value scx_enter_create_window_event(XCreateWindowEvent* xe) { - EENTER_START("scx-create-window-event"); + EENTER_START(scx_create_window_event_binding); EENTER(4, parent, scx_enter_window); EENTER(5, window, scx_enter_window); EENTER(6, x, s48_enter_integer); @@ -143,38 +163,48 @@ s48_value scx_enter_create_window_event(XCreateWindowEvent* xe) { EENTER_END(); } +s48_value scx_destroy_window_event_binding = S48_FALSE; + s48_value scx_enter_destroy_window_event(XDestroyWindowEvent* xe) { - EENTER_START("scx-destroy-window-event"); + EENTER_START(scx_destroy_window_event_binding); EENTER(4, event, scx_enter_window); EENTER(5, window, scx_enter_window); EENTER_END(); } +s48_value scx_unmap_event_binding = S48_FALSE; + s48_value scx_enter_unmap_event(XUnmapEvent* xe) { - EENTER_START("scx-unmap-event"); + EENTER_START(scx_unmap_event_binding); EENTER(4, event, scx_enter_window); EENTER(5, window, scx_enter_window); EENTER(6, from_configure, S48_ENTER_BOOLEAN); EENTER_END(); } +s48_value scx_map_event_binding = S48_FALSE; + s48_value scx_enter_map_event(XMapEvent* xe) { - EENTER_START("scx-map-event"); + EENTER_START(scx_map_event_binding); EENTER(4, event, scx_enter_window); EENTER(5, window, scx_enter_window); EENTER(6, override_redirect, S48_ENTER_BOOLEAN); EENTER_END(); } +s48_value scx_map_request_event_binding = S48_FALSE; + s48_value scx_enter_map_request_event(XMapRequestEvent* xe) { - EENTER_START("scx-map-request-event"); + EENTER_START(scx_map_request_event_binding); EENTER(4, parent, scx_enter_window); EENTER(5, window, scx_enter_window); EENTER_END(); } +s48_value scx_reparent_event_binding = S48_FALSE; + s48_value scx_enter_reparent_event(XReparentEvent* xe) { - EENTER_START("scx-reparent-event"); + EENTER_START(scx_reparent_event_binding); EENTER(4, event, scx_enter_window); EENTER(5, window, scx_enter_window); EENTER(6, parent, scx_enter_window); @@ -184,8 +214,10 @@ s48_value scx_enter_reparent_event(XReparentEvent* xe) { EENTER_END(); } +s48_value scx_configure_event_binding = S48_FALSE; + s48_value scx_enter_configure_event(XConfigureEvent* xe) { - EENTER_START("scx-configure-event"); + EENTER_START(scx_configure_event_binding); EENTER(4, event, scx_enter_window); EENTER(5, window, scx_enter_window); EENTER(6, x, s48_enter_integer); @@ -198,8 +230,10 @@ s48_value scx_enter_configure_event(XConfigureEvent* xe) { EENTER_END(); } +s48_value scx_gravity_event_binding = S48_FALSE; + s48_value scx_enter_gravity_event(XGravityEvent* xe) { - EENTER_START("scx-gravity-event"); + EENTER_START(scx_gravity_event_binding); EENTER(4, event, scx_enter_window); EENTER(5, window, scx_enter_window); EENTER(6, x, s48_enter_integer); @@ -207,17 +241,21 @@ s48_value scx_enter_gravity_event(XGravityEvent* xe) { EENTER_END(); } +s48_value scx_resize_request_event_binding = S48_FALSE; + s48_value scx_enter_resize_request_event(XResizeRequestEvent* xe) { - EENTER_START("scx-resize-request-event"); + EENTER_START(scx_resize_request_event_binding); EENTER(4, window, scx_enter_window); EENTER(5, width, s48_enter_integer); EENTER(6, height, s48_enter_integer); EENTER_END(); } +s48_value scx_configure_request_event_binding = S48_FALSE; + s48_value scx_enter_configure_request_event(XConfigureRequestEvent* xe) { XWindowChanges WC; - EENTER_START("scx-configure-request-event"); + EENTER_START(scx_configure_request_event_binding); EENTER(4, parent, scx_enter_window); EENTER(5, window, scx_enter_window); WC.x = xe->x; @@ -231,24 +269,30 @@ s48_value scx_enter_configure_request_event(XConfigureRequestEvent* xe) { EENTER_END(); } +s48_value scx_circulate_event_binding = S48_FALSE; + s48_value scx_enter_circulate_event(XCirculateEvent* xe) { - EENTER_START("scx-circulate-event"); + EENTER_START(scx_circulate_event_binding); EENTER(4, event, scx_enter_window); EENTER(5, window, scx_enter_window); EENTER(6, place, scx_enter_place); EENTER_END(); } +s48_value scx_circulate_request_event_binding = S48_FALSE; + s48_value scx_enter_circulate_request_event(XCirculateRequestEvent* xe) { - EENTER_START("scx-circulate-request-event"); + EENTER_START(scx_circulate_request_event_binding); EENTER(4, parent, scx_enter_window); EENTER(5, window, scx_enter_window); EENTER(6, place, scx_enter_place); EENTER_END(); } +s48_value scx_property_event_binding = S48_FALSE; + s48_value scx_enter_property_event(XPropertyEvent* xe) { - EENTER_START("scx-property-event"); + EENTER_START(scx_property_event_binding); EENTER(4, window, scx_enter_window); EENTER(5, atom, scx_enter_atom); EENTER(6, time, scx_enter_time); @@ -256,16 +300,20 @@ s48_value scx_enter_property_event(XPropertyEvent* xe) { EENTER_END(); } +s48_value scx_selection_clear_event_binding = S48_FALSE; + s48_value scx_enter_selection_clear_event(XSelectionClearEvent* xe) { - EENTER_START("scx-selection-clear-event"); + EENTER_START(scx_selection_clear_event_binding); EENTER(4, window, scx_enter_window); EENTER(5, selection, scx_enter_atom); EENTER(6, time, scx_enter_time); EENTER_END(); } +s48_value scx_selection_request_event_binding = S48_FALSE; + s48_value scx_enter_selection_request_event(XSelectionRequestEvent* xe) { - EENTER_START("scx-selection-request-event"); + EENTER_START(scx_selection_request_event_binding); EENTER(4, owner, scx_enter_window); EENTER(5, requestor, scx_enter_window); EENTER(6, selection, scx_enter_atom); @@ -275,8 +323,10 @@ s48_value scx_enter_selection_request_event(XSelectionRequestEvent* xe) { EENTER_END(); } +s48_value scx_selection_event_binding = S48_FALSE; + s48_value scx_enter_selection_event(XSelectionEvent* xe) { - EENTER_START("scx-selection-event"); + EENTER_START(scx_selection_event_binding); EENTER(4, requestor, scx_enter_window); EENTER(5, selection, scx_enter_atom); EENTER(6, target, scx_enter_atom); @@ -285,8 +335,10 @@ s48_value scx_enter_selection_event(XSelectionEvent* xe) { EENTER_END(); } +s48_value scx_colormap_event_binding = S48_FALSE; + s48_value scx_enter_colormap_event(XColormapEvent* xe) { - EENTER_START("scx-colormap-event"); + EENTER_START(scx_colormap_event_binding); EENTER(4, window, scx_enter_window); EENTER(5, colormap, scx_enter_colormap); EENTER(6, new, S48_ENTER_BOOLEAN); @@ -294,8 +346,10 @@ s48_value scx_enter_colormap_event(XColormapEvent* xe) { EENTER_END(); } +s48_value scx_client_message_event_binding = S48_FALSE; + s48_value scx_enter_client_message_event(XClientMessageEvent* xe) { - EENTER_START("scx-client-message-event"); + EENTER_START(scx_client_message_event_binding); EENTER(4, window, scx_enter_window); S48_RECORD_SET(e, 5, scx_enter_property(xe->message_type, xe->format, @@ -304,8 +358,10 @@ s48_value scx_enter_client_message_event(XClientMessageEvent* xe) { EENTER_END(); } +s48_value scx_mapping_event_binding = S48_FALSE; + s48_value scx_enter_mapping_event(XMappingEvent* xe) { - EENTER_START("scx-mapping-event"); + EENTER_START(scx_mapping_event_binding); EENTER(4, window, scx_enter_window); EENTER(5, request, scx_enter_mapping_request); EENTER(6, first_keycode, scx_enter_keycode); @@ -313,9 +369,11 @@ s48_value scx_enter_mapping_event(XMappingEvent* xe) { EENTER_END(); } +s48_value scx_keymap_event_binding = S48_FALSE; + s48_value scx_enter_keymap_event(XKeymapEvent* xe) { s48_value temp; int i; - EENTER_START("scx-keymap-event"); + EENTER_START(scx_keymap_event_binding); temp = s48_make_vector(32*8, s48_enter_fixnum(0)); for (i = 0; i < 32; i++) { int j; char b = xe->key_vector[i]; @@ -391,8 +449,8 @@ s48_value scx_enter_event(XEvent* e) { /*** extraction ****************************************************/ #define EEXTRACT(i, name, f) xe->name = f(S48_RECORD_REF(e, i)) -#define EEXTRACT_START(stype) \ - s48_check_record_type(e, s48_get_imported_binding(stype)); \ +#define EEXTRACT_START(rtype) \ + s48_check_record_type(e, rtype); \ EEXTRACT(0, type, scx_extract_event_type); \ EEXTRACT(1, serial, s48_extract_integer); \ EEXTRACT(2, send_event, S48_EXTRACT_BOOLEAN); \ @@ -400,7 +458,7 @@ s48_value scx_enter_event(XEvent* e) { #define EEXTRACT_END() void scx_extract_key_event(s48_value e, XKeyEvent* xe) { - EEXTRACT_START("scx-key-event"); + EEXTRACT_START(scx_key_event_binding); EEXTRACT(4, window, scx_extract_window); EEXTRACT(5, root, scx_extract_window); EEXTRACT(6, subwindow, scx_extract_window); @@ -416,7 +474,7 @@ void scx_extract_key_event(s48_value e, XKeyEvent* xe) { } void scx_extract_button_event(s48_value e, XButtonEvent* xe) { - EEXTRACT_START("scx-button-event"); + EEXTRACT_START(scx_button_event_binding); EEXTRACT(4, window, scx_extract_window); EEXTRACT(5, root, scx_extract_window); EEXTRACT(6, subwindow, scx_extract_window); @@ -432,7 +490,7 @@ void scx_extract_button_event(s48_value e, XButtonEvent* xe) { } void scx_extract_motion_event(s48_value e, XMotionEvent* xe) { - EEXTRACT_START("scx-motion-event"); + EEXTRACT_START(scx_motion_event_binding); EEXTRACT(4, window, scx_extract_window); EEXTRACT(5, root, scx_extract_window); EEXTRACT(6, subwindow, scx_extract_window); @@ -448,7 +506,7 @@ void scx_extract_motion_event(s48_value e, XMotionEvent* xe) { } void scx_extract_crossing_event(s48_value e, XCrossingEvent* xe) { - EEXTRACT_START("scx-crossing-event"); + EEXTRACT_START(scx_crossing_event_binding); EEXTRACT(4, window, scx_extract_window); EEXTRACT(5, root, scx_extract_window); EEXTRACT(6, subwindow, scx_extract_window); @@ -466,7 +524,7 @@ void scx_extract_crossing_event(s48_value e, XCrossingEvent* xe) { } void scx_extract_focus_change_event(s48_value e, XFocusChangeEvent* xe) { - EEXTRACT_START("scx-focus-change-event"); + EEXTRACT_START(scx_focus_change_event_binding); EEXTRACT(4, window, scx_extract_window); EEXTRACT(5, mode, scx_extract_notify_mode); EEXTRACT(6, detail, scx_extract_notify_detail); @@ -474,7 +532,7 @@ void scx_extract_focus_change_event(s48_value e, XFocusChangeEvent* xe) { } void scx_extract_expose_event(s48_value e, XExposeEvent* xe) { - EEXTRACT_START("scx-expose-event"); + EEXTRACT_START(scx_expose_event_binding); EEXTRACT(4, window, scx_extract_window); EEXTRACT(5, x, s48_extract_integer); EEXTRACT(6, y, s48_extract_integer); @@ -485,7 +543,7 @@ void scx_extract_expose_event(s48_value e, XExposeEvent* xe) { } void scx_extract_graphics_expose_event(s48_value e, XGraphicsExposeEvent* xe) { - EEXTRACT_START("scx-graphics-expose-event"); + EEXTRACT_START(scx_graphics_expose_event_binding); EEXTRACT(4, drawable, scx_extract_drawable); EEXTRACT(5, x, s48_extract_integer); EEXTRACT(6, y, s48_extract_integer); @@ -498,7 +556,7 @@ void scx_extract_graphics_expose_event(s48_value e, XGraphicsExposeEvent* xe) { } void scx_extract_no_expose_event(s48_value e, XNoExposeEvent* xe) { - EEXTRACT_START("scx-no-expose-event"); + EEXTRACT_START(scx_no_expose_event_binding); EEXTRACT(4, drawable, scx_extract_drawable); EEXTRACT(5, major_code, s48_extract_integer); EEXTRACT(6, minor_code, s48_extract_integer); @@ -506,14 +564,14 @@ void scx_extract_no_expose_event(s48_value e, XNoExposeEvent* xe) { } void scx_extract_visibility_event(s48_value e, XVisibilityEvent* xe) { - EEXTRACT_START("scx-visibility-event"); + EEXTRACT_START(scx_visibility_event_binding); EEXTRACT(4, window, scx_extract_window); EEXTRACT(5, state, scx_extract_visibility_state); EEXTRACT_END(); } void scx_extract_create_window_event(s48_value e, XCreateWindowEvent* xe) { - EEXTRACT_START("scx-create-window-event"); + EEXTRACT_START(scx_create_window_event_binding); EEXTRACT(4, parent, scx_extract_window); EEXTRACT(5, window, scx_extract_window); EEXTRACT(6, x, s48_extract_integer); @@ -526,14 +584,14 @@ void scx_extract_create_window_event(s48_value e, XCreateWindowEvent* xe) { } void scx_extract_destroy_window_event(s48_value e, XDestroyWindowEvent* xe) { - EEXTRACT_START("scx-destroy-window-event"); + EEXTRACT_START(scx_destroy_window_event_binding); EEXTRACT(4, event, scx_extract_window); EEXTRACT(5, window, scx_extract_window); EEXTRACT_END(); } void scx_extract_unmap_event(s48_value e, XUnmapEvent* xe) { - EEXTRACT_START("scx-unmap-event"); + EEXTRACT_START(scx_unmap_event_binding); EEXTRACT(4, event, scx_extract_window); EEXTRACT(5, window, scx_extract_window); EEXTRACT(6, from_configure, S48_EXTRACT_BOOLEAN); @@ -541,7 +599,7 @@ void scx_extract_unmap_event(s48_value e, XUnmapEvent* xe) { } void scx_extract_map_event(s48_value e, XMapEvent* xe) { - EEXTRACT_START("scx-map-event"); + EEXTRACT_START(scx_map_event_binding); EEXTRACT(4, event, scx_extract_window); EEXTRACT(5, window, scx_extract_window); EEXTRACT(6, override_redirect, S48_EXTRACT_BOOLEAN); @@ -549,14 +607,14 @@ void scx_extract_map_event(s48_value e, XMapEvent* xe) { } void scx_extract_map_request_event(s48_value e, XMapRequestEvent* xe) { - EEXTRACT_START("scx-map-request-event"); + EEXTRACT_START(scx_map_request_event_binding); EEXTRACT(4, parent, scx_extract_window); EEXTRACT(5, window, scx_extract_window); EEXTRACT_END(); } void scx_extract_reparent_event(s48_value e, XReparentEvent* xe) { - EEXTRACT_START("scx-reparent-event"); + EEXTRACT_START(scx_reparent_event_binding); EEXTRACT(4, event, scx_extract_window); EEXTRACT(5, window, scx_extract_window); EEXTRACT(6, parent, scx_extract_window); @@ -567,7 +625,7 @@ void scx_extract_reparent_event(s48_value e, XReparentEvent* xe) { } void scx_extract_configure_event(s48_value e, XConfigureEvent* xe) { - EEXTRACT_START("scx-configure-event"); + EEXTRACT_START(scx_configure_event_binding); EEXTRACT(4, event, scx_extract_window); EEXTRACT(5, window, scx_extract_window); EEXTRACT(6, x, s48_extract_integer); @@ -581,7 +639,7 @@ void scx_extract_configure_event(s48_value e, XConfigureEvent* xe) { } void scx_extract_gravity_event(s48_value e, XGravityEvent* xe) { - EEXTRACT_START("scx-gravity-event"); + EEXTRACT_START(scx_gravity_event_binding); EEXTRACT(4, event, scx_extract_window); EEXTRACT(5, window, scx_extract_window); EEXTRACT(6, x, s48_extract_integer); @@ -590,7 +648,7 @@ void scx_extract_gravity_event(s48_value e, XGravityEvent* xe) { } void scx_extract_resize_request_event(s48_value e, XResizeRequestEvent* xe) { - EEXTRACT_START("scx-resize-request-event"); + EEXTRACT_START(scx_resize_request_event_binding); EEXTRACT(4, window, scx_extract_window); EEXTRACT(5, width, s48_extract_integer); EEXTRACT(6, height, s48_extract_integer); @@ -600,7 +658,7 @@ void scx_extract_resize_request_event(s48_value e, XResizeRequestEvent* xe) { void scx_extract_configure_request_event(s48_value e, XConfigureRequestEvent* xe) { XWindowChanges WC; - EEXTRACT_START("scx-configure-request-event"); + EEXTRACT_START(scx_configure_request_event_binding); EEXTRACT(4, parent, scx_extract_window); EEXTRACT(5, window, scx_extract_window); xe->value_mask = scx_extract_window_changes(S48_RECORD_REF(e, 6), &WC); @@ -615,7 +673,7 @@ void scx_extract_configure_request_event(s48_value e, } void scx_extract_circulate_event(s48_value e, XCirculateEvent* xe) { - EEXTRACT_START("scx-circulate-event"); + EEXTRACT_START(scx_circulate_event_binding); EEXTRACT(4, event, scx_extract_window); EEXTRACT(5, window, scx_extract_window); EEXTRACT(6, place, scx_extract_place); @@ -624,7 +682,7 @@ void scx_extract_circulate_event(s48_value e, XCirculateEvent* xe) { void scx_extract_circulate_request_event(s48_value e, XCirculateRequestEvent* xe) { - EEXTRACT_START("scx-circulate-request-event"); + EEXTRACT_START(scx_circulate_request_event_binding); EEXTRACT(4, parent, scx_extract_window); EEXTRACT(5, window, scx_extract_window); EEXTRACT(6, place, scx_extract_place); @@ -632,7 +690,7 @@ void scx_extract_circulate_request_event(s48_value e, } void scx_extract_property_event(s48_value e, XPropertyEvent* xe) { - EEXTRACT_START("scx-property-event"); + EEXTRACT_START(scx_property_event_binding); EEXTRACT(4, window, scx_extract_window); EEXTRACT(5, atom, scx_extract_atom); EEXTRACT(6, time, scx_extract_time); @@ -641,7 +699,7 @@ void scx_extract_property_event(s48_value e, XPropertyEvent* xe) { } void scx_extract_selection_clear_event(s48_value e, XSelectionClearEvent* xe) { - EEXTRACT_START("scx-selection-clear-event"); + EEXTRACT_START(scx_selection_clear_event_binding); EEXTRACT(4, window, scx_extract_window); EEXTRACT(5, selection, scx_extract_atom); EEXTRACT(6, time, scx_extract_time); @@ -650,7 +708,7 @@ void scx_extract_selection_clear_event(s48_value e, XSelectionClearEvent* xe) { void scx_extract_selection_request_event(s48_value e, XSelectionRequestEvent* xe) { - EEXTRACT_START("scx-selection-request-event"); + EEXTRACT_START(scx_selection_request_event_binding); EEXTRACT(4, owner, scx_extract_window); EEXTRACT(5, requestor, scx_extract_window); EEXTRACT(6, selection, scx_extract_atom); @@ -661,7 +719,7 @@ void scx_extract_selection_request_event(s48_value e, } void scx_extract_selection_event(s48_value e, XSelectionEvent* xe) { - EEXTRACT_START("scx-selection-event"); + EEXTRACT_START(scx_selection_event_binding); EEXTRACT(4, requestor, scx_extract_window); EEXTRACT(5, selection, scx_extract_atom); EEXTRACT(6, target, scx_extract_atom); @@ -671,7 +729,7 @@ void scx_extract_selection_event(s48_value e, XSelectionEvent* xe) { } void scx_extract_colormap_event(s48_value e, XColormapEvent* xe) { - EEXTRACT_START("scx-colormap-event"); + EEXTRACT_START(scx_colormap_event_binding); EEXTRACT(4, window, scx_extract_window); EEXTRACT(5, colormap, scx_extract_colormap); EEXTRACT(6, new, S48_EXTRACT_BOOLEAN); @@ -682,7 +740,7 @@ void scx_extract_colormap_event(s48_value e, XColormapEvent* xe) { void scx_extract_client_message_event(s48_value e, XClientMessageEvent* xe) { int nelements, i; char* data; int bytes; - EEXTRACT_START("scx-client-message-event"); + EEXTRACT_START(scx_client_message_event_binding); EEXTRACT(4, window, scx_extract_window); scx_extract_property(S48_RECORD_REF(e, 5), &xe->message_type, &xe->format, &data, &nelements); @@ -699,7 +757,7 @@ void scx_extract_client_message_event(s48_value e, XClientMessageEvent* xe) { } void scx_extract_mapping_event(s48_value e, XMappingEvent* xe) { - EEXTRACT_START("scx-mapping-event"); + EEXTRACT_START(scx_mapping_event_binding); EEXTRACT(4, window, scx_extract_window); EEXTRACT(5, request, scx_extract_mapping_request); EEXTRACT(6, first_keycode, scx_extract_keycode); @@ -709,7 +767,7 @@ void scx_extract_mapping_event(s48_value e, XMappingEvent* xe) { void scx_extract_keymap_event(s48_value e, XKeymapEvent* xe) { s48_value temp; int i; - EEXTRACT_START("scx-keymap-event"); + EEXTRACT_START(scx_keymap_event_binding); xe->window = (Window)0; temp = S48_RECORD_REF(e, 4); for (i = 0; i < 32; i++) { @@ -782,3 +840,37 @@ void scx_extract_event(s48_value se, XEvent* e) { scx_extract_mapping_event(se, (XMappingEvent*)e); break; } } + +void scx_init_event_types() { + SCX_PRO_IMP(scx_key_event_binding, "scx-key-event"); + SCX_PRO_IMP(scx_button_event_binding, "scx-button-event"); + SCX_PRO_IMP(scx_motion_event_binding, "scx-motion-event"); + SCX_PRO_IMP(scx_crossing_event_binding, "scx-crossing-event"); + SCX_PRO_IMP(scx_focus_change_event_binding, "scx-focus-change-event"); + SCX_PRO_IMP(scx_expose_event_binding, "scx-expose-event"); + SCX_PRO_IMP(scx_graphics_expose_event_binding, "scx-graphics-expose-event"); + SCX_PRO_IMP(scx_no_expose_event_binding, "scx-no-expose-event"); + SCX_PRO_IMP(scx_visibility_event_binding, "scx-visibility-event"); + SCX_PRO_IMP(scx_create_window_event_binding, "scx-create-window-event"); + SCX_PRO_IMP(scx_destroy_window_event_binding, "scx-destroy-window-event"); + SCX_PRO_IMP(scx_unmap_event_binding, "scx-unmap-event"); + SCX_PRO_IMP(scx_map_event_binding, "scx-map-event"); + SCX_PRO_IMP(scx_map_request_event_binding, "scx-map-request-event"); + SCX_PRO_IMP(scx_reparent_event_binding, "scx-reparent-event"); + SCX_PRO_IMP(scx_configure_event_binding, "scx-configure-event"); + SCX_PRO_IMP(scx_gravity_event_binding, "scx-gravity-event"); + SCX_PRO_IMP(scx_resize_request_event_binding, "scx-resize-request-event"); + SCX_PRO_IMP(scx_configure_request_event_binding, + "scx-configure-request-event"); + SCX_PRO_IMP(scx_circulate_event_binding, "scx-circulate-event"); + SCX_PRO_IMP(scx_circulate_event_binding, "scx-circulate-request-event"); + SCX_PRO_IMP(scx_property_event_binding, "scx-property-event"); + SCX_PRO_IMP(scx_selection_clear_event_binding, "scx-selection-clear-event"); + SCX_PRO_IMP(scx_selection_request_event_binding, + "scx-selection-request-event"); + SCX_PRO_IMP(scx_selection_event_binding, "scx-selection-event"); + SCX_PRO_IMP(scx_colormap_event_binding, "scx-colormap-event"); + SCX_PRO_IMP(scx_client_message_event_binding, "scx-client-message-event"); + SCX_PRO_IMP(scx_mapping_event_binding, "scx-mapping-event"); + SCX_PRO_IMP(scx_keymap_event_binding, "scx-keymap-event"); +} diff --git a/c/xlib/event.c b/c/xlib/event.c index 4e5dacc..d78160a 100644 --- a/c/xlib/event.c +++ b/c/xlib/event.c @@ -2,7 +2,8 @@ #include "xlib.h" -#define scx_extract_queued_mode(x) S48_EXTRACT_ENUM(x, "scx-queued-mode") +s48_value scx_queued_mode_binding = S48_FALSE; +#define scx_extract_queued_mode(x) S48_EXTRACT_ENUM(x, scx_queued_mode_binding) s48_value scx_Events_Queued(s48_value display, s48_value mode) { int r = XEventsQueued(scx_extract_display(display), @@ -76,6 +77,8 @@ s48_value scx_add_pending_channel(channel) { } void scx_init_event(void) { + SCX_PRO_IMP(scx_queued_mode_binding, "scx-queued-mode"); + S48_EXPORT_FUNCTION(scx_Events_Queued); S48_EXPORT_FUNCTION(scx_Events_Pending); S48_EXPORT_FUNCTION(scx_Next_Event); @@ -84,4 +87,3 @@ void scx_init_event(void) { S48_EXPORT_FUNCTION(scx_Send_Event); S48_EXPORT_FUNCTION(scx_add_pending_channel); } - diff --git a/c/xlib/gcontext.c b/c/xlib/gcontext.c index e255e8d..74973ae 100644 --- a/c/xlib/gcontext.c +++ b/c/xlib/gcontext.c @@ -2,30 +2,52 @@ #include "xlib.h" -#define scx_extract_gc_function(x) S48_EXTRACT_ENUM(x, "scx-gc-function") -#define scx_extract_line_style(x) S48_EXTRACT_ENUM(x, "scx-line-style") -#define scx_extract_cap_style(x) S48_EXTRACT_ENUM(x, "scx-cap-style") -#define scx_extract_join_style(x) S48_EXTRACT_ENUM(x, "scx-join-style") -#define scx_extract_fill_style(x) S48_EXTRACT_ENUM(x, "scx-fill-style") -#define scx_extract_fill_rule(x) S48_EXTRACT_ENUM(x, "scx-fill-rule") -#define scx_extract_subwindow_mode(x) S48_EXTRACT_ENUM(x, "scx-subwindow-mode") -#define scx_extract_arc_mode(x) S48_EXTRACT_ENUM(x, "scx-arc-mode") +s48_value scx_gc_function_binding = S48_FALSE; +s48_value scx_line_style_binding = S48_FALSE; +s48_value scx_cap_style_binding = S48_FALSE; +s48_value scx_join_style_binding = S48_FALSE; +s48_value scx_fill_style_binding = S48_FALSE; +s48_value scx_fill_rule_binding = S48_FALSE; +s48_value scx_subwindow_mode_binding = S48_FALSE; +s48_value scx_arc_mode_binding = S48_FALSE; +#define scx_extract_gc_function(x) S48_EXTRACT_ENUM(x, scx_gc_function_binding) +#define scx_extract_line_style(x) S48_EXTRACT_ENUM(x, scx_line_style_binding) +#define scx_extract_cap_style(x) S48_EXTRACT_ENUM(x, scx_cap_style_binding) +#define scx_extract_join_style(x) S48_EXTRACT_ENUM(x, scx_join_style_binding) +#define scx_extract_fill_style(x) S48_EXTRACT_ENUM(x, scx_fill_style_binding) +#define scx_extract_fill_rule(x) S48_EXTRACT_ENUM(x, scx_fill_rule_binding) +#define scx_extract_subwindow_mode(x) \ + S48_EXTRACT_ENUM(x, scx_subwindow_mode_binding) +#define scx_extract_arc_mode(x) S48_EXTRACT_ENUM(x, scx_arc_mode_binding) -#define scx_enter_gc_function(x) S48_ENTER_ENUM(x, "scx-gc-functions") -#define scx_enter_line_style(x) S48_ENTER_ENUM(x, "scx-line-styles") -#define scx_enter_cap_style(x) S48_ENTER_ENUM(x, "scx-cap-styles") -#define scx_enter_join_style(x) S48_ENTER_ENUM(x, "scx-join-styles") -#define scx_enter_fill_style(x) S48_ENTER_ENUM(x, "scx-fill-styles") -#define scx_enter_fill_rule(x) S48_ENTER_ENUM(x, "scx-fill-rules") -#define scx_enter_subwindow_mode(x) S48_ENTER_ENUM(x, "scx-subwindow-modes") -#define scx_enter_arc_mode(x) S48_ENTER_ENUM(x, "scx-arc-modes") +s48_value scx_gc_functions_binding = S48_FALSE; +s48_value scx_line_styles_binding = S48_FALSE; +s48_value scx_cap_styles_binding = S48_FALSE; +s48_value scx_join_styles_binding = S48_FALSE; +s48_value scx_fill_styles_binding = S48_FALSE; +s48_value scx_fill_rules_binding = S48_FALSE; +s48_value scx_subwindow_modes_binding = S48_FALSE; +s48_value scx_arc_modes_binding = S48_FALSE; +#define scx_enter_gc_function(x) S48_ENTER_ENUM(x, scx_gc_functions_binding) +#define scx_enter_line_style(x) S48_ENTER_ENUM(x, scx_line_styles_binding) +#define scx_enter_cap_style(x) S48_ENTER_ENUM(x, scx_cap_styles_binding) +#define scx_enter_join_style(x) S48_ENTER_ENUM(x, scx_join_styles_binding) +#define scx_enter_fill_style(x) S48_ENTER_ENUM(x, scx_fill_styles_binding) +#define scx_enter_fill_rule(x) S48_ENTER_ENUM(x, scx_fill_rules_binding) +#define scx_enter_subwindow_mode(x) \ + S48_ENTER_ENUM(x, scx_subwindow_modes_binding) +#define scx_enter_arc_mode(x) S48_ENTER_ENUM(x, scx_arc_modes_binding) -#define scx_extract_gc_value_set(x) S48_EXTRACT_ENUM_SET(x, "scx-gc-value-set") -#define scx_enter_gc_value_set(x) s48_enter_enum_set(x, "scx-gc-value-set") +s48_value scx_gc_value_set_binding = S48_FALSE; +#define scx_extract_gc_value_set(x) \ + S48_EXTRACT_ENUM_SET(x, scx_gc_value_set_binding) +#define scx_enter_gc_value_set(x) \ + s48_enter_enum_set(x, scx_gc_value_set_binding) + +s48_value scx_char_struct_binding = S48_FALSE; s48_value scx_enter_charstruct(XCharStruct* cs) { - s48_value res = - s48_make_record(s48_get_imported_binding("scx-char-struct")); + s48_value res = s48_make_record(scx_char_struct_binding); S48_DECLARE_GC_PROTECT(1); S48_GC_PROTECT_1(res); S48_RECORD_SET(res, 0, s48_enter_fixnum(cs->lbearing)); @@ -284,8 +306,9 @@ s48_value scx_Set_Dashes(s48_value display, s48_value gc, s48_value dashoffset, return S48_UNSPECIFIC; } +s48_value scx_rectangle_ordering_binding = S48_FALSE; #define scx_extract_rectangle_ordering(x) \ - S48_EXTRACT_ENUM(x, "scx-rectangle-ordering") + S48_EXTRACT_ENUM(x, scx_rectangle_ordering_binding) s48_value scx_Set_Clip_Rectangles(s48_value display, s48_value gc, s48_value x_origin, s48_value y_origin, @@ -324,6 +347,27 @@ s48_value scx_Query_Best_Size(s48_value screen, s48_value class, } void scx_init_gcontext(void) { + SCX_PRO_IMP(scx_gc_function_binding, "scx-gc-function"); + SCX_PRO_IMP(scx_line_style_binding, "scx-line-style"); + SCX_PRO_IMP(scx_cap_style_binding, "scx-cap-style"); + SCX_PRO_IMP(scx_join_style_binding, "scx-join-style"); + SCX_PRO_IMP(scx_fill_style_binding, "scx-fill-style"); + SCX_PRO_IMP(scx_fill_rule_binding, "scx-fill-rule"); + SCX_PRO_IMP(scx_subwindow_mode_binding, "scx-subwindow-mode"); + SCX_PRO_IMP(scx_arc_mode_binding, "scx-arc-mode"); + SCX_PRO_IMP(scx_gc_functions_binding, "scx-gc-functions"); + SCX_PRO_IMP(scx_line_styles_binding, "scx-line-styles"); + SCX_PRO_IMP(scx_cap_styles_binding, "scx-cap-styles"); + SCX_PRO_IMP(scx_join_styles_binding, "scx-join-styles"); + SCX_PRO_IMP(scx_fill_styles_binding, "scx-fill-styles"); + SCX_PRO_IMP(scx_fill_rules_binding, "scx-fill-rules"); + SCX_PRO_IMP(scx_subwindow_modes_binding, "scx-subwindow-modes"); + SCX_PRO_IMP(scx_arc_modes_binding, "scx-arc-modes"); + + SCX_PRO_IMP(scx_gc_value_set_binding, "scx-gc-value-set"); + SCX_PRO_IMP(scx_char_struct_binding, "scx-char-struct"); + SCX_PRO_IMP(scx_rectangle_ordering_binding, "scx-rectangle-ordering"); + S48_EXPORT_FUNCTION(scx_Create_Gc); S48_EXPORT_FUNCTION(scx_Copy_Gc); S48_EXPORT_FUNCTION(scx_Change_Gc); diff --git a/c/xlib/grab.c b/c/xlib/grab.c index 56ac59b..708f726 100644 --- a/c/xlib/grab.c +++ b/c/xlib/grab.c @@ -2,8 +2,10 @@ #include "xlib.h" -#define scx_extract_grab_mode(x) S48_EXTRACT_ENUM(x, "scx-grab-mode") -#define scx_enter_grab_status(x) S48_ENTER_ENUM(x, "scx-grab-states") +s48_value scx_grab_mode_binding = S48_FALSE; +#define scx_extract_grab_mode(x) S48_EXTRACT_ENUM(x, scx_grab_mode_binding) +s48_value scx_grab_states_binding = S48_FALSE; +#define scx_enter_grab_status(x) S48_ENTER_ENUM(x, scx_grab_states_binding) s48_value scx_Grab_Pointer(s48_value dpy, s48_value win, s48_value ownerp, s48_value events, @@ -102,7 +104,8 @@ s48_value scx_Ungrab_Key(s48_value dpy, s48_value key, s48_value mods, return S48_UNSPECIFIC; } -#define scx_extract_event_mode(x) S48_EXTRACT_ENUM(x, "scx-event-mode") +s48_value scx_event_mode_binding = S48_FALSE; +#define scx_extract_event_mode(x) S48_EXTRACT_ENUM(x, scx_event_mode_binding) s48_value scx_Allow_Events(s48_value dpy, s48_value event_mode, s48_value time) { @@ -123,6 +126,10 @@ s48_value scx_Ungrab_Server(s48_value dpy){ } void scx_init_grab(void) { + SCX_PRO_IMP(scx_grab_mode_binding, "scx-grab-mode"); + SCX_PRO_IMP(scx_grab_states_binding, "scx-grab-states"); + SCX_PRO_IMP(scx_event_mode_binding, "scx-event-mode"); + S48_EXPORT_FUNCTION(scx_Grab_Pointer); S48_EXPORT_FUNCTION(scx_Ungrab_Pointer); S48_EXPORT_FUNCTION(scx_Grab_Button); diff --git a/c/xlib/graphics.c b/c/xlib/graphics.c index 9ffbc6f..6cee602 100644 --- a/c/xlib/graphics.c +++ b/c/xlib/graphics.c @@ -2,8 +2,11 @@ #include "xlib.h" -#define scx_extract_coord_mode(x) S48_EXTRACT_ENUM(x, "scx-coord-mode") -#define scx_extract_polygon_shape(x) S48_EXTRACT_ENUM(x, "scx-polygon-shape") +s48_value scx_coord_mode_binding = S48_FALSE; +#define scx_extract_coord_mode(x) S48_EXTRACT_ENUM(x, scx_coord_mode_binding) +s48_value scx_polygon_shape_binding = S48_FALSE; +#define scx_extract_polygon_shape(x) \ + S48_EXTRACT_ENUM(x, scx_polygon_shape_binding) s48_value scx_Copy_Area(s48_value display, s48_value src, s48_value dest, s48_value gc, s48_value srcx, s48_value srcy, @@ -80,12 +83,13 @@ s48_value scx_Draw_Lines(s48_value display, s48_value drawable, return S48_UNSPECIFIC; } +s48_value scx_segment_binding = S48_FALSE; + static void List_To_XSegments(s48_value l, XSegment* p, int n) { int i; - s48_value rectype = s48_get_imported_binding("scx-segment"); for (i = 0; i < n; i++) { s48_value s = S48_CAR(l); - s48_check_record_type(s, rectype); + s48_check_record_type(s, scx_segment_binding); p[i].x1 = (int)s48_extract_integer(S48_RECORD_REF(s, 0)); p[i].y1 = (int)s48_extract_integer(S48_RECORD_REF(s, 1)); p[i].x2 = (int)s48_extract_integer(S48_RECORD_REF(s, 2)); @@ -116,9 +120,11 @@ s48_value scx_Draw_Rectangle(s48_value display, s48_value drawable, return S48_UNSPECIFIC; } +s48_value scx_rectangle_binding = S48_FALSE; + static void List_To_XRectangles(s48_value l, XRectangle* p, int n) { int i; - s48_value rectype = s48_get_imported_binding("scx-rectangle"); + s48_value rectype = scx_rectangle_binding; for (i = 0; i < n; i++) { s48_value r = S48_CAR(l); s48_check_record_type(r, rectype); @@ -151,9 +157,11 @@ s48_value scx_Draw_Arc(s48_value display, s48_value drawable, return S48_UNSPECIFIC; } +s48_value scx_arc_binding = S48_FALSE; + static void List_To_XArcs(s48_value l, XArc* p, int n) { int i; - s48_value rectype = s48_get_imported_binding("scx-arc"); + s48_value rectype = scx_arc_binding; for (i = 0; i < n; i++) { s48_value r = S48_CAR(l); s48_check_record_type(r, rectype); @@ -234,6 +242,12 @@ s48_value scx_Fill_Arcs(s48_value display, s48_value drawable, } void scx_init_graphics(void) { + SCX_PRO_IMP(scx_coord_mode_binding, "scx-coord-mode"); + SCX_PRO_IMP(scx_polygon_shape_binding, "scx-polygon-shape"); + SCX_PRO_IMP(scx_segment_binding, "scx-segment"); + SCX_PRO_IMP(scx_rectangle_binding, "scx-rectangle"); + SCX_PRO_IMP(scx_arc_binding, "scx-arc"); + S48_EXPORT_FUNCTION(scx_Copy_Area); S48_EXPORT_FUNCTION(scx_Copy_Plane); S48_EXPORT_FUNCTION(scx_Draw_Point); diff --git a/c/xlib/init.c b/c/xlib/init.c index 1df3f48..c18b7b6 100644 --- a/c/xlib/init.c +++ b/c/xlib/init.c @@ -43,6 +43,7 @@ extern void scx_init_util(); extern void scx_init_grab(); extern void scx_init_visual(); extern void scx_init_region(); +extern void scx_init_event_types(); void scx_init_xlib(void) { S48_EXPORT_FUNCTION(scx_Xlib_Release_4_Or_Later); @@ -68,6 +69,7 @@ void scx_init_xlib(void) { scx_init_pixmap(); scx_init_client(); scx_init_util(); + scx_init_event_types(); } diff --git a/c/xlib/property.c b/c/xlib/property.c index 81da0d0..b286a3f 100644 --- a/c/xlib/property.c +++ b/c/xlib/property.c @@ -79,14 +79,18 @@ s48_value scx_Delete_Property(s48_value display, s48_value window, return S48_UNSPECIFIC; } +s48_value scx_property_binding = S48_FALSE; +s48_value scx_property_format_binding = S48_FALSE; +s48_value scx_property_formats_binding = S48_FALSE; + void scx_extract_property(s48_value p, Atom* type, int* format, char** data, int* nelements) { int i; s48_value d = S48_RECORD_REF(p, 2); - s48_check_record_type(p, s48_get_imported_binding("scx-property")); + s48_check_record_type(p, scx_property_binding); *type = scx_extract_atom(S48_RECORD_REF(p, 0)); *format = S48_EXTRACT_ENUM(S48_RECORD_REF(p, 1), - "scx-property-format"); + scx_property_format_binding); switch (*format) { case 0: *format = 8; @@ -117,7 +121,7 @@ void scx_extract_property(s48_value p, Atom* type, int* format, s48_value scx_enter_property(Atom type, int format, char* data, int nelements) { - s48_value p = s48_make_record(s48_get_imported_binding("scx-property")); + s48_value p = s48_make_record(scx_property_binding); s48_value l = S48_NULL; int i; S48_DECLARE_GC_PROTECT(2); @@ -126,17 +130,17 @@ s48_value scx_enter_property(Atom type, int format, char* data, S48_RECORD_SET(p, 0, scx_enter_atom(type)); switch (format) { case 8: - S48_RECORD_SET(p, 1, S48_ENTER_ENUM(0, "scx-property-formats")); + S48_RECORD_SET(p, 1, S48_ENTER_ENUM(0, scx_property_formats_binding)); S48_RECORD_SET(p, 2, s48_enter_substring(data, nelements)); break; case 16: - S48_RECORD_SET(p, 1, S48_ENTER_ENUM(1, "scx-property-formats")); + S48_RECORD_SET(p, 1, S48_ENTER_ENUM(1, scx_property_formats_binding)); for (i = nelements-1; i >= 0; i--) l = s48_cons(s48_enter_integer(((short*)data)[i]), l); S48_RECORD_SET(p, 2, l); break; case 32: - S48_RECORD_SET(p, 1, S48_ENTER_ENUM(2, "scx-property-formats")); + S48_RECORD_SET(p, 1, S48_ENTER_ENUM(2, scx_property_formats_binding)); for (i = nelements-1; i >= 0; i--) l = s48_cons(s48_enter_integer(((long*)data)[i]), l); S48_RECORD_SET(p, 2, l); @@ -180,8 +184,9 @@ s48_value scx_Get_Window_Property(s48_value display, s48_value window, return S48_FALSE; } +s48_value scx_change_property_mode_binding = S48_FALSE; #define scx_extract_change_property_mode(x) \ - S48_EXTRACT_ENUM(x, "scx-change-property-mode") + S48_EXTRACT_ENUM(x, scx_change_property_mode_binding) s48_value scx_Change_Property(s48_value display, s48_value window, s48_value atom, s48_value mode, @@ -222,6 +227,11 @@ s48_value scx_Convert_Selection(s48_value display, s48_value selection, } void scx_init_property(void) { + SCX_PRO_IMP(scx_property_binding, "scx-property"); + SCX_PRO_IMP(scx_property_format_binding, "scx-property-format"); + SCX_PRO_IMP(scx_property_formats_binding, "scx-property-formats"); + SCX_PRO_IMP(scx_change_property_mode_binding, "scx-change-property-mode"); + S48_EXPORT_FUNCTION(scx_Intern_Atom); S48_EXPORT_FUNCTION(scx_Intern_Atoms); S48_EXPORT_FUNCTION(scx_Get_Atom_Name); diff --git a/c/xlib/types.c b/c/xlib/types.c index 469beed..08b6531 100644 --- a/c/xlib/types.c +++ b/c/xlib/types.c @@ -2,6 +2,58 @@ #include "xlib.h" +s48_value scx_display = S48_FALSE; +s48_value scx_color = S48_FALSE; +s48_value scx_gc = S48_FALSE; +s48_value scx_fontstruct = S48_FALSE; +s48_value scx_screenformat = S48_FALSE; +s48_value scx_visual = S48_FALSE; +s48_value scx_screen = S48_FALSE; +s48_value scx_event_mask_binding = S48_FALSE; +s48_value scx_gc_value_binding = S48_FALSE; +s48_value scx_gc_values_binding = S48_FALSE; +s48_value scx_byte_order_binding = S48_FALSE; +s48_value scx_byte_orders_binding = S48_FALSE; +s48_value scx_bit_order_binding = S48_FALSE; +s48_value scx_bit_orders_binding = S48_FALSE; +s48_value scx_bit_gravity_binding = S48_FALSE; +s48_value scx_bit_gravities_binding = S48_FALSE; +s48_value scx_win_gravity_binding = S48_FALSE; +s48_value scx_win_gravities_binding = S48_FALSE; +s48_value scx_event_type_binding = S48_FALSE; +s48_value scx_event_types_binding = S48_FALSE; +s48_value scx_font_direction_binding = S48_FALSE; +s48_value scx_font_directions_binding = S48_FALSE; +s48_value scx_state_binding = S48_FALSE; +s48_value scx_states_binding = S48_FALSE; +s48_value scx_state_set_binding = S48_FALSE; +s48_value scx_button_binding = S48_FALSE; +s48_value scx_buttons_binding = S48_FALSE; +s48_value scx_notify_mode_binding = S48_FALSE; +s48_value scx_notify_modes_binding = S48_FALSE; +s48_value scx_notify_detail_binding = S48_FALSE; +s48_value scx_notify_details_binding = S48_FALSE; +s48_value scx_visibility_state_binding = S48_FALSE; +s48_value scx_visibility_states_binding = S48_FALSE; +s48_value scx_place_binding = S48_FALSE; +s48_value scx_places_binding = S48_FALSE; +s48_value scx_property_state_binding = S48_FALSE; +s48_value scx_property_states_binding = S48_FALSE; +s48_value scx_colormap_state_binding = S48_FALSE; +s48_value scx_colormap_states_binding = S48_FALSE; +s48_value scx_mapping_request_binding = S48_FALSE; +s48_value scx_mapping_requests_binding = S48_FALSE; +s48_value scx_backing_store_binding = S48_FALSE; +s48_value scx_backing_stores_binding = S48_FALSE; +s48_value scx_map_state_binding = S48_FALSE; +s48_value scx_map_states_binding = S48_FALSE; +s48_value scx_window_class_binding = S48_FALSE; +s48_value scx_window_classes_binding = S48_FALSE; +s48_value scx_stack_mode_binding = S48_FALSE; +s48_value scx_stack_modes_binding = S48_FALSE; +s48_value scx_window_change_binding = S48_FALSE; +s48_value scx_window_changes_binding = S48_FALSE; + s48_value s48_checked_record_ref(s48_value value, int i, s48_value rectype) { s48_check_record_type(value, rectype); @@ -17,9 +69,10 @@ int s48_list_length(s48_value list) { return res; } -extern unsigned long s48_extract_enum_set(s48_value v, char* typestr) { - s48_value enum_set_type = s48_get_imported_binding("s48-enum-set-type"); - s48_value type = s48_get_imported_binding(typestr); +s48_value scx_enum_set_type_binding = S48_FALSE; + +extern unsigned long s48_extract_enum_set(s48_value v, s48_value type) { + s48_value enum_set_type = scx_enum_set_type_binding; s48_check_record_type(v, enum_set_type); if (S48_UNSAFE_SHARED_BINDING_REF(type) != S48_UNSAFE_RECORD_REF(v, 0)) @@ -27,12 +80,11 @@ extern unsigned long s48_extract_enum_set(s48_value v, char* typestr) { return s48_extract_integer(S48_UNSAFE_RECORD_REF(v, 1)); } -s48_value s48_enter_enum_set(unsigned long v, char* typestr) { - s48_value r = s48_make_record(s48_get_imported_binding("s48-enum-set-type")); +s48_value s48_enter_enum_set(unsigned long v, s48_value type) { + s48_value r = s48_make_record(scx_enum_set_type_binding); S48_DECLARE_GC_PROTECT(1); S48_GC_PROTECT_1(r); - S48_RECORD_SET(r, 0, - S48_SHARED_BINDING_REF(s48_get_imported_binding(typestr))); + S48_RECORD_SET(r, 0, S48_SHARED_BINDING_REF(type)); S48_RECORD_SET(r, 1, s48_enter_integer(v)); S48_GC_UNPROTECT(); return r; @@ -74,4 +126,57 @@ void scx_struct_cache_set(void* cpointer, s48_value* l, s48_value v) { } void scx_init_types(void) { + SCX_PRO_IMP(scx_enum_set_type_binding, "s48-enum-set-type"); + SCX_PRO_IMP(scx_display, "scx-display"); + SCX_PRO_IMP(scx_color, "scx-color"); + SCX_PRO_IMP(scx_gc, "scx-gc"); + SCX_PRO_IMP(scx_fontstruct, "scx-fontstruct"); + SCX_PRO_IMP(scx_screenformat, "scx-screenformat"); + SCX_PRO_IMP(scx_visual, "scx-visual"); + SCX_PRO_IMP(scx_screen, "scx-screen"); + + SCX_PRO_IMP(scx_event_mask_binding, "scx-event-mask"); + SCX_PRO_IMP(scx_gc_value_binding, "scx-gc-value"); + SCX_PRO_IMP(scx_gc_values_binding, "scx-gc-values"); + SCX_PRO_IMP(scx_byte_order_binding, "scx-byte-order"); + SCX_PRO_IMP(scx_byte_orders_binding, "scx-byte-orders"); + SCX_PRO_IMP(scx_bit_order_binding, "scx-bit-order"); + SCX_PRO_IMP(scx_bit_orders_binding, "scx-bit-orders"); + SCX_PRO_IMP(scx_bit_gravity_binding, "scx-bit-gravity"); + SCX_PRO_IMP(scx_bit_gravities_binding, "scx-bit-gravities"); + SCX_PRO_IMP(scx_win_gravity_binding, "scx-win-gravity"); + SCX_PRO_IMP(scx_win_gravities_binding, "scx-win-gravities"); + SCX_PRO_IMP(scx_event_type_binding, "scx-event-type"); + SCX_PRO_IMP(scx_event_types_binding, "scx-event-types"); + SCX_PRO_IMP(scx_font_direction_binding, "scx-font-direction"); + SCX_PRO_IMP(scx_font_directions_binding, "scx-font-directions"); + SCX_PRO_IMP(scx_state_binding, "scx-state"); + SCX_PRO_IMP(scx_states_binding, "scx-states"); + SCX_PRO_IMP(scx_state_set_binding, "scx-state-set"); + SCX_PRO_IMP(scx_button_binding, "scx-button"); + SCX_PRO_IMP(scx_buttons_binding, "scx-buttons"); + SCX_PRO_IMP(scx_notify_mode_binding, "scx-notify-mode"); + SCX_PRO_IMP(scx_notify_modes_binding, "scx-notify-modes"); + SCX_PRO_IMP(scx_notify_detail_binding, "scx-notify-detail"); + SCX_PRO_IMP(scx_notify_details_binding, "scx-notify-details"); + SCX_PRO_IMP(scx_visibility_state_binding, "scx-visibility-state"); + SCX_PRO_IMP(scx_visibility_states_binding, "scx-visibility-states"); + SCX_PRO_IMP(scx_place_binding, "scx-place"); + SCX_PRO_IMP(scx_places_binding, "scx-places"); + SCX_PRO_IMP(scx_property_state_binding, "scx-property-state"); + SCX_PRO_IMP(scx_property_states_binding, "scx-property-states"); + SCX_PRO_IMP(scx_colormap_state_binding, "scx-colormap-state"); + SCX_PRO_IMP(scx_colormap_state_binding, "scx-colormap-states"); + SCX_PRO_IMP(scx_mapping_request_binding, "scx-mapping-request"); + SCX_PRO_IMP(scx_mapping_requests_binding, "scx-mapping-requests"); + SCX_PRO_IMP(scx_backing_store_binding, "scx-backing-store"); + SCX_PRO_IMP(scx_backing_stores_binding, "scx-backing-stores"); + SCX_PRO_IMP(scx_map_state_binding, "scx-map-state"); + SCX_PRO_IMP(scx_map_states_binding, "scx-map-states"); + SCX_PRO_IMP(scx_window_class_binding, "scx-window-class"); + SCX_PRO_IMP(scx_window_classes_binding, "scx-window-classes"); + SCX_PRO_IMP(scx_stack_mode_binding, "scx-stack-mode"); + SCX_PRO_IMP(scx_stack_modes_binding, "scx-stack-modes"); + SCX_PRO_IMP(scx_window_change_binding, "scx-window-change"); + SCX_PRO_IMP(scx_window_changes_binding, "scx-window-changes"); } diff --git a/c/xlib/visual.c b/c/xlib/visual.c index e1b0822..a06baf2 100644 --- a/c/xlib/visual.c +++ b/c/xlib/visual.c @@ -2,8 +2,11 @@ #include "xlib.h" -#define scx_extract_visual_class(x) S48_EXTRACT_ENUM(x, "scx-visual-class") -#define scx_enter_visual_class(x) S48_ENTER_ENUM(x, "scx-visual-classes") +s48_value scx_visual_class_binding = S48_FALSE; +#define scx_extract_visual_class(x) \ + S48_EXTRACT_ENUM(x, scx_visual_class_binding) +s48_value scx_visual_classes_binding = S48_FALSE; +#define scx_enter_visual_class(x) S48_ENTER_ENUM(x, scx_visual_classes_binding) s48_value scx_enter_visual(Visual* vis) { s48_value v = s48_make_record(scx_visual); @@ -14,10 +17,10 @@ s48_value scx_enter_visual(Visual* vis) { return v; } -#define scx_visual_info s48_get_imported_binding("scx-visual-info") +s48_value scx_visual_info_binding = S48_FALSE; s48_value scx_enter_visual_info(XVisualInfo* vi) { - s48_value v = s48_make_record(scx_visual_info); + s48_value v = s48_make_record(scx_visual_info_binding); S48_DECLARE_GC_PROTECT(1); S48_GC_PROTECT_1(v); S48_RECORD_SET(v, 0, scx_enter_visual(vi->visual)); @@ -36,7 +39,7 @@ s48_value scx_enter_visual_info(XVisualInfo* vi) { unsigned int scx_extract_visual_info(s48_value v, XVisualInfo* vi) { unsigned long mask = 0; - s48_check_record_type(v, scx_visual_info); + s48_check_record_type(v, scx_visual_info_binding); if (!S48_FALSE_P(S48_RECORD_REF(v, 0))) vi->visual = scx_extract_visual(S48_RECORD_REF(v, 0)); if (!S48_FALSE_P(S48_RECORD_REF(v, 1))) { @@ -115,6 +118,10 @@ s48_value scx_VisualIDFromVisual(s48_value visual) { } void scx_init_visual(void) { + SCX_PRO_IMP(scx_visual_class_binding, "scx-visual-class"); + SCX_PRO_IMP(scx_visual_classes_binding, "scx-visual-classes"); + SCX_PRO_IMP(scx_visual_info_binding, "scx-visual-info"); + S48_EXPORT_FUNCTION(scx_Get_Visual_Info); S48_EXPORT_FUNCTION(scx_Match_Visual_Info); S48_EXPORT_FUNCTION(scx_VisualIDFromVisual); diff --git a/c/xlib/window.c b/c/xlib/window.c index 01bed35..d7f26a7 100644 --- a/c/xlib/window.c +++ b/c/xlib/window.c @@ -2,8 +2,9 @@ #include "xlib.h" +s48_value scx_set_window_attribute_binding = S48_FALSE; #define scx_extract_set_window_attribute(x) \ - S48_EXTRACT_ENUM(x, "scx-set-window-attribute") + S48_EXTRACT_ENUM(x, scx_set_window_attribute_binding) static unsigned long scx_extract_set_window_attribute_alist(s48_value attribs, @@ -184,9 +185,10 @@ s48_value scx_Configure_Window(s48_value display, s48_value window, return S48_UNSPECIFIC; } +s48_value scx_window_attibutes_binding = S48_FALSE; + s48_value scx_enter_window_attributes(XWindowAttributes* WA) { - s48_value v = s48_make_record( - s48_get_imported_binding("scx-window-attributes")); + s48_value v = s48_make_record(scx_window_attibutes_binding); S48_DECLARE_GC_PROTECT(1); S48_GC_PROTECT_1(v); S48_RECORD_SET(v, 0, s48_enter_integer(WA->x)); @@ -300,7 +302,9 @@ s48_value scx_Lower_Window(s48_value display, s48_value window) { return S48_UNSPECIFIC; } -#define scx_extract_direction(x) S48_EXTRACT_ENUM(x, "scx-circulate-direction") +s48_value scx_circulate_direction_binding = S48_FALSE; +#define scx_extract_direction(x) \ + S48_EXTRACT_ENUM(x, scx_circulate_direction_binding) s48_value scx_Circulate_Subwindows(s48_value display, s48_value window, s48_value dir) { @@ -420,6 +424,10 @@ s48_value scx_Query_Pointer(s48_value display, s48_value window) { } void scx_init_window(void) { + SCX_PRO_IMP(scx_set_window_attribute_binding, "scx-set-window-attribute"); + SCX_PRO_IMP(scx_window_attibutes_binding, "scx-window-attributes"); + SCX_PRO_IMP(scx_circulate_direction_binding, "scx-circulate-direction"); + S48_EXPORT_FUNCTION(scx_Create_Window); S48_EXPORT_FUNCTION(scx_Create_Simple_Window); S48_EXPORT_FUNCTION(scx_Change_Window_Attributes); diff --git a/c/xlib/wm.c b/c/xlib/wm.c index 1fc10d0..5c79eff 100644 --- a/c/xlib/wm.c +++ b/c/xlib/wm.c @@ -40,8 +40,10 @@ s48_value scx_List_Installed_Colormaps(s48_value display, s48_value window) { return l; } -#define scx_extract_revert_to(x) S48_EXTRACT_ENUM(x, "scx-revert-to") -#define scx_enter_revert_to(x) S48_ENTER_ENUM(x, "scx-revert-tos") +s48_value scx_revert_to_binding = S48_FALSE; +s48_value scx_revert_tos_binding = S48_FALSE; +#define scx_extract_revert_to(x) S48_EXTRACT_ENUM(x, scx_revert_to_binding) +#define scx_enter_revert_to(x) S48_ENTER_ENUM(x, scx_revert_tos_binding) s48_value scx_Set_Input_Focus(s48_value display, s48_value window, s48_value revert_to, s48_value time) { @@ -88,7 +90,8 @@ s48_value scx_Set_Access_Control(s48_value display, s48_value on) { return S48_UNSPECIFIC; } -#define scx_extract_save_set(x) S48_EXTRACT_ENUM(x, "scx-save-set") +s48_value scx_save_set_binding = S48_FALSE; +#define scx_extract_save_set(x) S48_EXTRACT_ENUM(x, scx_save_set_binding) s48_value scx_Change_Save_Set(s48_value display, s48_value win, s48_value mode) { @@ -97,8 +100,9 @@ s48_value scx_Change_Save_Set(s48_value display, s48_value win, return S48_UNSPECIFIC; } +s48_value scx_close_down_mode_binding = S48_FALSE; #define scx_extract_close_down_mode(x) \ - S48_EXTRACT_ENUM(x, "scx-close-down-mode") + S48_EXTRACT_ENUM(x, scx_close_down_mode_binding) s48_value scx_Set_Close_Down_Mode(s48_value display, s48_value mode) { XSetCloseDownMode(scx_extract_display(display), @@ -136,6 +140,11 @@ s48_value scx_Set_Pointer_Mapping(s48_value display, s48_value map) { } void scx_init_wm(void) { + SCX_PRO_IMP(scx_revert_to_binding, "scx-revert-to"); + SCX_PRO_IMP(scx_revert_tos_binding, "scx-revert-tos"); + SCX_PRO_IMP(scx_save_set_binding, "scx-save-set"); + SCX_PRO_IMP(scx_close_down_mode_binding, "scx-close-down-mode"); + S48_EXPORT_FUNCTION(scx_Reparent_Window); S48_EXPORT_FUNCTION(scx_Install_Colormap); S48_EXPORT_FUNCTION(scx_Uninstall_Colormap); diff --git a/c/xlib/xlib.h b/c/xlib/xlib.h index aaf5fb3..9e61ab6 100644 --- a/c/xlib/xlib.h +++ b/c/xlib/xlib.h @@ -33,19 +33,21 @@ extern s48_value s48_checked_record_ref(s48_value value, int i, s48_value rectype); +#define SCX_PRO_IMP(var, name) \ + do { S48_GC_PROTECT_GLOBAL(var); var = s48_get_imported_binding(name); } \ + while (0) + extern int s48_list_length(s48_value list); -#define S48_EXTRACT_ENUM(x, typestr) \ - s48_extract_integer(s48_checked_record_ref(x, 1, \ - s48_get_imported_binding(typestr))) +#define S48_EXTRACT_ENUM(x, type) \ + s48_extract_integer(s48_checked_record_ref(x, 1, type)) -#define S48_ENTER_ENUM(index, vvectorstr) \ - S48_VECTOR_REF(S48_SHARED_BINDING_REF(s48_get_imported_binding(vvectorstr)),\ - index) +#define S48_ENTER_ENUM(index, vvector) \ + S48_VECTOR_REF(S48_SHARED_BINDING_REF(vvector), index) -#define S48_EXTRACT_ENUM_SET(x, typestr) s48_extract_enum_set(x, typestr) -extern unsigned long s48_extract_enum_set(s48_value v, char* typestr); -extern s48_value s48_enter_enum_set(unsigned long v, char* typestr); +#define S48_EXTRACT_ENUM_SET(x, type) s48_extract_enum_set(x, type) +extern unsigned long s48_extract_enum_set(s48_value v, s48_value type); +extern s48_value s48_enter_enum_set(unsigned long v, s48_value type); /*** Extraction-Macros for the XIDs ********************************/ @@ -84,43 +86,43 @@ extern s48_value s48_enter_enum_set(unsigned long v, char* typestr); /* records */ -#define scx_display s48_get_imported_binding("scx-display") +extern s48_value scx_display; #define scx_extract_display(x) \ (Display*)s48_extract_integer(s48_checked_record_ref(x, 0, scx_display)) extern s48_value scx_enter_display(Display* dpy); #define SCX_DISPLAY_AFTER_FUNCTION(d) \ s48_checked_record_ref(d, 14, scx_display) -#define scx_color s48_get_imported_binding("scx-color") +extern s48_value scx_color; extern void scx_extract_color(s48_value v, XColor* c); extern void scx_copy_color(const XColor* c, s48_value v); extern s48_value scx_enter_color(const XColor* c); -#define scx_gc s48_get_imported_binding("scx-gc") +extern s48_value scx_gc; #define scx_extract_gc(x) \ (GC)s48_extract_integer(s48_checked_record_ref(x, 0, scx_gc)) extern s48_value scx_enter_gc(GC gc); -#define scx_fontstruct s48_get_imported_binding("scx-fontstruct") +extern s48_value scx_fontstruct; #define scx_extract_fontstruct(x)\ (XFontStruct*)s48_extract_integer(s48_checked_record_ref(x, 0,\ scx_fontstruct)) extern s48_value scx_enter_charstruct(XCharStruct* cs); extern s48_value scx_enter_fontstruct(XFontStruct* fs); -#define scx_screenformat s48_get_imported_binding("scx-screenformat") +extern s48_value scx_screenformat; #define scx_extract_screenformat(x)\ (ScreenFormat*)s48_extract_integer(s48_checked_record_ref(x, 0,\ scx_screenformat)) extern s48_value scx_enter_screenformat(ScreenFormat* sf); -#define scx_visual s48_get_imported_binding("scx-visual") +extern s48_value scx_visual; #define scx_extract_visual(x)\ (Visual*)s48_extract_integer(s48_checked_record_ref(x, 0,\ scx_visual)) extern s48_value scx_enter_visual(Visual* vis); -#define scx_screen s48_get_imported_binding("scx-screen") +extern s48_value scx_screen; #define scx_extract_screen(x)\ (Screen*)s48_extract_integer(s48_checked_record_ref(x, 0,\ scx_screen)) @@ -140,79 +142,136 @@ extern void scx_extract_x_error(s48_value e, XErrorEvent* xe); /* more types */ -#define scx_extract_state(x) S48_EXTRACT_ENUM(x, "scx-state") -#define scx_enter_state(x) S48_ENTER_ENUM(x, "scx-states") +extern s48_value scx_event_mask_binding; +#define scx_extract_event_mask(x) \ + S48_EXTRACT_ENUM_SET(x, scx_event_mask_binding) +#define scx_enter_event_mask(x) s48_enter_enum_set(x, scx_event_mask_binding) -#define scx_extract_event_mask(x) S48_EXTRACT_ENUM_SET(x, "scx-event-mask") -#define scx_enter_event_mask(x) s48_enter_enum_set(x, "scx-event-mask") +extern s48_value scx_gc_value_binding; +extern s48_value scx_gc_values_binding; +#define scx_extract_gc_value(x) S48_EXTRACT_ENUM(x, scx_gc_value_binding) +#define scx_enter_gc_value(x) S48_ENTER_ENUM(x, scx_gc_values_binding) -#define scx_extract_gc_value(x) S48_EXTRACT_ENUM(x, "scx-gc-value") -#define scx_enter_gc_value(x) S48_ENTER_ENUM(x, "scx-gc-values") +extern s48_value scx_byte_order_binding; +extern s48_value scx_byte_orders_binding; +#define scx_extract_byte_order(x) S48_EXTRACT_ENUM(x, scx_byte_order_binding) +#define scx_enter_byte_order(x) S48_ENTER_ENUM(x, scx_byte_orders_binding) -#define scx_extract_byte_order(x) S48_EXTRACT_ENUM(x, "scx-byte-order") -#define scx_enter_byte_order(x) S48_ENTER_ENUM(x, "scx-byte-orders") +extern s48_value scx_bit_order_binding; +extern s48_value scx_bit_orders_binding; +#define scx_extract_bit_order(x) S48_EXTRACT_ENUM(x, scx_bit_order_binding) +#define scx_enter_bit_order(x) S48_ENTER_ENUM(x, scx_bit_orders_binding) -#define scx_extract_bit_order(x) S48_EXTRACT_ENUM(x, "scx-bit-order") -#define scx_enter_bit_order(x) S48_ENTER_ENUM(x, "scx-bit-orders") +extern s48_value scx_bit_gravity_binding; +extern s48_value scx_bit_gravities_binding; +#define scx_extract_bit_gravity(x) S48_EXTRACT_ENUM(x, scx_bit_gravity_binding) +#define scx_enter_bit_gravity(x) S48_ENTER_ENUM(x, scx_bit_gravities_binding) -#define scx_extract_bit_gravity(x) S48_EXTRACT_ENUM(x, "scx-bit-gravity") -#define scx_enter_bit_gravity(x) S48_ENTER_ENUM(x, "scx-bit-gravities") +extern s48_value scx_win_gravity_binding; +extern s48_value scx_win_gravities_binding; +#define scx_extract_win_gravity(x) S48_EXTRACT_ENUM(x, scx_win_gravity_binding) +#define scx_enter_win_gravity(x) S48_ENTER_ENUM(x, scx_win_gravities_binding) -#define scx_extract_win_gravity(x) S48_EXTRACT_ENUM(x, "scx-win-gravity") -#define scx_enter_win_gravity(x) S48_ENTER_ENUM(x, "scx-win-gravities") +extern s48_value scx_event_type_binding; +extern s48_value scx_event_types_binding; +#define scx_extract_event_type(x) S48_EXTRACT_ENUM(x, scx_event_type_binding) +#define scx_enter_event_type(x) S48_ENTER_ENUM(x, scx_event_types_binding) -#define scx_extract_event_type(x) S48_EXTRACT_ENUM(x, "scx-event-type") -#define scx_enter_event_type(x) S48_ENTER_ENUM(x, "scx-event-types") +extern s48_value scx_font_direction_binding; +extern s48_value scx_font_directions_binding; +#define scx_extract_font_direction(x) \ + S48_EXTRACT_ENUM(x, scx_font_direction_binding) +#define scx_enter_font_direction(x) \ + S48_ENTER_ENUM(x, scx_font_directions_binding) -#define scx_extract_font_direction(x) S48_EXTRACT_ENUM(x, "scx-font-direction") -#define scx_enter_font_direction(x) S48_ENTER_ENUM(x, "scx-font-directions") +extern s48_value scx_state_binding; +extern s48_value scx_states_binding; +#define scx_extract_state(x) S48_EXTRACT_ENUM(x, scx_state_binding) +#define scx_enter_state(x) S48_ENTER_ENUM(x, scx_states_binding) -#define scx_extract_state(x) S48_EXTRACT_ENUM(x, "scx-state") -#define scx_enter_state(x) S48_ENTER_ENUM(x, "scx-states") +extern s48_value scx_state_set_binding; +#define scx_extract_state_set(x) S48_EXTRACT_ENUM_SET(x, scx_state_set_binding) +#define scx_enter_state_set(x) s48_enter_enum_set(x, scx_state_set_binding) -#define scx_extract_state_set(x) S48_EXTRACT_ENUM_SET(x, "scx-state-set") -#define scx_enter_state_set(x) s48_enter_enum_set(x, "scx-state-set") +extern s48_value scx_button_binding; +extern s48_value scx_buttons_binding; +#define scx_extract_button(x) S48_EXTRACT_ENUM(x, scx_button_binding) +#define scx_enter_button(x) S48_ENTER_ENUM(x, scx_buttons_binding) -#define scx_extract_button(x) S48_EXTRACT_ENUM(x, "scx-button") -#define scx_enter_button(x) S48_ENTER_ENUM(x, "scx-buttons") +extern s48_value scx_notify_mode_binding; +extern s48_value scx_notify_modes_binding; +#define scx_extract_notify_mode(x) S48_EXTRACT_ENUM(x, scx_notify_mode_binding) +#define scx_enter_notify_mode(x) S48_ENTER_ENUM(x, scx_notify_modes_binding) -#define scx_extract_notify_mode(x) S48_EXTRACT_ENUM(x, "scx-notify-mode") -#define scx_enter_notify_mode(x) S48_ENTER_ENUM(x, "scx-notify-modes") - -#define scx_extract_notify_detail(x) S48_EXTRACT_ENUM(x, "scx-notify-detail") -#define scx_enter_notify_detail(x) S48_ENTER_ENUM(x, "scx-notify-details") +extern s48_value scx_notify_detail_binding; +extern s48_value scx_notify_details_binding; +#define scx_extract_notify_detail(x) \ + S48_EXTRACT_ENUM(x, scx_notify_detail_binding) +#define scx_enter_notify_detail(x) \ + S48_ENTER_ENUM(x, scx_notify_details_binding) +extern s48_value scx_visibility_state_binding; +extern s48_value scx_visibility_states_binding; #define scx_extract_visibility_state(x) \ - S48_EXTRACT_ENUM(x, "scx-visibility-state") + S48_EXTRACT_ENUM(x, scx_visibility_state_binding) #define scx_enter_visibility_state(x) \ - S48_ENTER_ENUM(x, "scx-visibility-states") + S48_ENTER_ENUM(x, scx_visibility_states_binding) -#define scx_extract_place(x) S48_EXTRACT_ENUM(x, "scx-place") -#define scx_enter_place(x) S48_ENTER_ENUM(x, "scx-places") +extern s48_value scx_place_binding; +extern s48_value scx_places_binding; +#define scx_extract_place(x) S48_EXTRACT_ENUM(x, scx_place_binding) +#define scx_enter_place(x) S48_ENTER_ENUM(x, scx_places_binding) -#define scx_extract_property_state(x) S48_EXTRACT_ENUM(x, "scx-property-state") -#define scx_enter_property_state(x) S48_ENTER_ENUM(x, "scx-property-states") +extern s48_value scx_property_state_binding; +extern s48_value scx_property_states_binding; +#define scx_extract_property_state(x) \ + S48_EXTRACT_ENUM(x, scx_property_state_binding) +#define scx_enter_property_state(x) \ + S48_ENTER_ENUM(x, scx_property_states_binding) -#define scx_extract_colormap_state(x) S48_EXTRACT_ENUM(x, "scx-colormap-state") -#define scx_enter_colormap_state(x) S48_ENTER_ENUM(x, "scx-colormap-states") +extern s48_value scx_colormap_state_binding; +extern s48_value scx_colormap_states_binding; +#define scx_extract_colormap_state(x) \ + S48_EXTRACT_ENUM(x, scx_colormap_state_binding) +#define scx_enter_colormap_state(x) \ + S48_ENTER_ENUM(x, scx_colormap_states_binding) +extern s48_value scx_mapping_request_binding; +extern s48_value scx_mapping_requests_binding; #define scx_extract_mapping_request(x) \ - S48_EXTRACT_ENUM(x, "scx-mapping-request") -#define scx_enter_mapping_request(x) S48_ENTER_ENUM(x, "scx-mapping-requests") + S48_EXTRACT_ENUM(x, scx_mapping_request_binding) +#define scx_enter_mapping_request(x) \ + S48_ENTER_ENUM(x, scx_mapping_requests_binding) -#define scx_extract_backing_store(x) S48_EXTRACT_ENUM(x, "scx-backing-store") -#define scx_enter_backing_store(x) S48_ENTER_ENUM(x, "scx-backing-stores") +extern s48_value scx_backing_store_binding; +extern s48_value scx_backing_stores_binding; +#define scx_extract_backing_store(x) \ + S48_EXTRACT_ENUM(x, scx_backing_store_binding) +#define scx_enter_backing_store(x) \ + S48_ENTER_ENUM(x, scx_backing_stores_binding) -#define scx_extract_map_state(x) S48_EXTRACT_ENUM(x, "scx-map-state") -#define scx_enter_map_state(x) S48_ENTER_ENUM(x, "scx-map-states") +extern s48_value scx_map_state_binding; +extern s48_value scx_map_states_binding; +#define scx_extract_map_state(x) S48_EXTRACT_ENUM(x, scx_map_state_binding) +#define scx_enter_map_state(x) S48_ENTER_ENUM(x, scx_map_states_binding) -#define scx_extract_window_class(x) S48_EXTRACT_ENUM(x, "scx-window-class") -#define scx_enter_window_class(x) S48_ENTER_ENUM(x, "scx-window-classes") +extern s48_value scx_window_class_binding; +extern s48_value scx_window_classes_binding; +#define scx_extract_window_class(x) \ + S48_EXTRACT_ENUM(x, scx_window_class_binding) +#define scx_enter_window_class(x) \ + S48_ENTER_ENUM(x, scx_window_classes_binding) -#define scx_extract_stack_mode(x) S48_EXTRACT_ENUM(x, "scx-stack-mode") -#define scx_enter_stack_mode(x) S48_ENTER_ENUM(x, "scx-stack-modes") +extern s48_value scx_stack_mode_binding; +extern s48_value scx_stack_modes_binding; +#define scx_extract_stack_mode(x) S48_EXTRACT_ENUM(x, scx_stack_mode_binding) +#define scx_enter_stack_mode(x) S48_ENTER_ENUM(x, scx_stack_modes_binding) -#define scx_extract_window_change(x) S48_EXTRACT_ENUM(x, "scx-window-change") -#define scx_enter_window_change(x) S48_ENTER_ENUM(x, "scx-window-changes") +extern s48_value scx_window_change_binding; +extern s48_value scx_window_changes_binding; +#define scx_extract_window_change(x) \ + S48_EXTRACT_ENUM(x, scx_window_change_binding) +#define scx_enter_window_change(x) \ + S48_ENTER_ENUM(x, scx_window_changes_binding) #endif