diff --git a/c/xlib/type.c b/c/xlib/type.c deleted file mode 100644 index 92b4189..0000000 --- a/c/xlib/type.c +++ /dev/null @@ -1,542 +0,0 @@ -#include "xlib.h" -#include "scheme48.h" -#include - - -/* Scheme48 "Extensions" - */ - -char* s48_extract_symbol(s48_value sym) { - return s48_extract_string(S48_SYMBOL_TO_STRING(sym)); -} - - -s48_value string_to_symbol_binding = S48_FALSE; - -s48_value s48_enter_symbol(char* name) { - return s48_call_scheme(S48_SHARED_BINDING_REF(string_to_symbol_binding), - 1, s48_enter_string(name)); -} - - - -/* Types, functions and variables for the conversion between XLib constants - and the scheme symbols: -*/ - -s48_value Bits_To_Symbols(unsigned long bits, SYMDESCR* table) { - s48_value res = S48_NULL; - char* name; - unsigned long val; - int i = 0; - - S48_DECLARE_GC_PROTECT(1); - S48_GC_PROTECT_1(res); - - while (table[i].name != (char*)0) { - name = table[i].name; - val = table[i].val; - - if ((val & bits) == val) { - res = s48_cons(s48_enter_symbol(name), res); - } - i++; - } - //if (res == S48_NULL) res = s48_enter_integer(bits); - - S48_GC_UNPROTECT(); - return res; -} - -s48_value Bit_To_Symbol(unsigned long bits, SYMDESCR* table) { - int i = 0; - while (table[i].name != (char*)0) { - if (table[i].val == bits) - return s48_enter_symbol(table[i].name); - else i++; - } - return s48_enter_integer(bits); // or what?? -} - -unsigned long Symbol_To_Bit(s48_value Sym, SYMDESCR* table) { - unsigned long res = 0; - char* sym = s48_extract_symbol(Sym); - int i; - for (i=0; table[i].name != (char*)0; i++) { - if (strcmp(sym, table[i].name) == 0) { - return table[i].val; - } - } - return res; -} - -unsigned long Symbols_To_Bits(s48_value Syms, SYMDESCR* table) { - unsigned long res = 0; - s48_value l = Syms; - - for (; !S48_NULL_P(l); l = S48_CDR(l)) { - res |= Symbol_To_Bit(S48_CAR(l), table); - } - - return res; -} - -SYMDESCR Event_Syms[] = { - { "key-press", KeyPress }, - { "key-release", KeyRelease }, - { "button-press", ButtonPress }, - { "button-release", ButtonRelease }, - { "motion-notify", MotionNotify }, - { "enter-notify", EnterNotify }, - { "leave-notify", LeaveNotify }, - { "focus-in", FocusIn }, - { "focus-out", FocusOut }, - { "keymap-notify", KeymapNotify }, - { "expose", Expose }, - { "graphics-expose", GraphicsExpose }, - { "no-expose", NoExpose }, - { "visibility-notify", VisibilityNotify }, - { "create-notify", CreateNotify }, - { "destroy-notify", DestroyNotify }, - { "unmap-notify", UnmapNotify }, - { "map-notify", MapNotify }, - { "map-request", MapRequest }, - { "reparent-notify", ReparentNotify }, - { "configure-notify", ConfigureNotify }, - { "configure-request", ConfigureRequest }, - { "gravity-notify", GravityNotify }, - { "resize-request", ResizeRequest }, - { "circulate-notify", CirculateNotify }, - { "circulate-request", CirculateRequest }, - { "property-notify", PropertyNotify }, - { "selection-clear", SelectionClear }, - { "selection-notify", SelectionNotify }, - { "colormap-notify", ColormapNotify }, - { "client-message", ClientMessage }, - { "mapping-notify", MappingNotify }, - { 0, 0 } -}; - -SYMDESCR Func_Syms[] = { - { "clear", GXclear }, - { "and", GXand }, - { "and-reverse", GXandReverse }, - { "copy", GXcopy }, - { "and-inverted", GXandInverted }, - { "no-op", GXnoop }, - { "xor", GXxor }, - { "or", GXor }, - { "nor", GXnor }, - { "equiv", GXequiv }, - { "invert", GXinvert }, - { "or-reverse", GXorReverse }, - { "copy-inverted", GXcopyInverted }, - { "or-inverted", GXorInverted }, - { "nand", GXnand }, - { "set", GXset }, - { 0, 0 } -}; - -SYMDESCR Bit_Grav_Syms[] = { - { "forget", ForgetGravity }, - { "north-west", NorthWestGravity }, - { "north", NorthGravity }, - { "north-east", NorthEastGravity }, - { "west", WestGravity }, - { "center", CenterGravity }, - { "east", EastGravity }, - { "south-west", SouthWestGravity }, - { "south", SouthGravity }, - { "south-east", SouthEastGravity }, - { "static", StaticGravity }, - { 0, 0 } -}; - -SYMDESCR Grav_Syms[] = { - { "unmap", UnmapGravity }, - { "north-west", NorthWestGravity }, - { "north", NorthGravity }, - { "north-east", NorthEastGravity }, - { "west", WestGravity }, - { "center", CenterGravity }, - { "east", EastGravity }, - { "south-west", SouthWestGravity }, - { "south", SouthGravity }, - { "south-east", SouthEastGravity }, - { "static", StaticGravity }, - { 0, 0 } -}; - -SYMDESCR Backing_Store_Syms[] = { - { "not-useful", NotUseful }, - { "when-mapped", WhenMapped }, - { "always", Always }, - { 0, 0 } -}; - -SYMDESCR Stack_Mode_Syms[] = { - { "above", Above }, - { "below", Below }, - { "top-if", TopIf }, - { "bottom-if", BottomIf }, - { "opposite", Opposite }, - { 0, 0 } -}; - -SYMDESCR Line_Style_Syms[] = { - { "solid", LineSolid }, - { "dash", LineOnOffDash }, - { "double-dash", LineDoubleDash }, - { 0, 0 } -}; - -SYMDESCR Cap_Style_Syms[] = { - { "not-last", CapNotLast }, - { "butt", CapButt }, - { "round", CapRound }, - { "projecting", CapProjecting }, - { 0, 0 } -}; - -SYMDESCR Join_Style_Syms[] = { - { "miter", JoinMiter }, - { "round", JoinRound }, - { "bevel", JoinBevel }, - { 0, 0 } -}; - -SYMDESCR Fill_Style_Syms[] = { - { "solid", FillSolid }, - { "tiled", FillTiled }, - { "stippled", FillStippled }, - { "opaque-stippled", FillOpaqueStippled }, - { 0, 0 } -}; - -SYMDESCR Fill_Rule_Syms[] = { - { "even-odd", EvenOddRule }, - { "winding", WindingRule }, - { 0, 0 } -}; - -SYMDESCR Arc_Mode_Syms[] = { - { "chord", ArcChord }, - { "pie-slice", ArcPieSlice }, - { 0, 0 } -}; - -SYMDESCR Subwin_Mode_Syms[] = { - { "clip-by-children", ClipByChildren }, - { "include-inferiors", IncludeInferiors }, - { 0, 0 } -}; - -SYMDESCR Class_Syms[] = { - { "input-output", InputOutput }, - { "input-only", InputOnly }, - { 0, 0 } -}; - -SYMDESCR Map_State_Syms[] = { - { "unmapped", IsUnmapped }, - { "unviewable", IsUnviewable }, - { "viewable", IsViewable }, - { 0, 0 } -}; - -SYMDESCR State_Syms[] = { - { "shift", ShiftMask }, - { "lock", LockMask }, - { "control", ControlMask }, - { "mod1", Mod1Mask }, - { "mod2", Mod2Mask }, - { "mod3", Mod3Mask }, - { "mod4", Mod4Mask }, - { "mod5", Mod5Mask }, - { "button1", Button1Mask }, - { "button2", Button2Mask }, - { "button3", Button3Mask }, - { "button4", Button4Mask }, - { "button5", Button5Mask }, - { "any-modifier", AnyModifier }, - { 0, 0 } -}; - -SYMDESCR Button_Syms[] = { - { "any-button", AnyButton }, - { "button1", Button1 }, - { "button2", Button2 }, - { "button3", Button3 }, - { "button4", Button4 }, - { "button5", Button5 }, - { 0, 0 } -}; - -SYMDESCR Cross_Mode_Syms[] = { - { "normal", NotifyNormal }, - { "grab", NotifyGrab }, - { "ungrab", NotifyUngrab }, - { 0, 0 } -}; - -SYMDESCR Cross_Detail_Syms[] = { - { "ancestor", NotifyAncestor }, - { "virtual", NotifyVirtual }, - { "inferior", NotifyInferior }, - { "nonlinear", NotifyNonlinear }, - { "nonlinear-virtual", NotifyNonlinearVirtual }, - { 0, 0 } -}; - -SYMDESCR Focus_Detail_Syms[] = { - { "ancestor", NotifyAncestor }, - { "virtual", NotifyVirtual }, - { "inferior", NotifyInferior }, - { "nonlinear", NotifyNonlinear }, - { "nonlinear-virtual", NotifyNonlinearVirtual }, - { "pointer", NotifyPointer }, - { "pointer-root", NotifyPointerRoot }, - { "none", NotifyDetailNone }, - { 0, 0 } -}; - -SYMDESCR Visibility_Syms[] = { - { "unobscured", VisibilityUnobscured }, - { "partially-obscured", VisibilityPartiallyObscured }, - { "fully-obscured", VisibilityFullyObscured }, - { 0, 0 } -}; - -SYMDESCR Place_Syms[] = { - { "top", PlaceOnTop }, - { "bottom", PlaceOnBottom }, - { 0, 0 } -}; - -SYMDESCR Prop_Syms[] = { - { "new-value", PropertyNewValue }, - { "deleted", PropertyDelete }, - { 0, 0 } -}; - -SYMDESCR Mapping_Syms[] = { - { "modifier", MappingModifier }, - { "keyboard", MappingKeyboard }, - { "pointer", MappingPointer }, - { 0, 0 } -}; - -SYMDESCR Direction_Syms[] = { - { "left-to-right", FontLeftToRight }, - { "right-to-left", FontRightToLeft }, - { 0, 0 } -}; - -SYMDESCR Polyshape_Syms[] = { - { "complex", Complex }, - { "non-convex", Nonconvex }, - { "convex", Convex }, - { 0, 0 } -}; - -SYMDESCR Propmode_Syms[] = { - { "replace", PropModeReplace }, - { "prepend", PropModePrepend }, - { "append", PropModeAppend }, - { 0, 0 } -}; - -SYMDESCR Grabstatus_Syms[] = { - { "success", Success }, - { "not-viewable", GrabNotViewable }, - { "already-grabbed", AlreadyGrabbed }, - { "frozen", GrabFrozen }, - { "invalid-time", GrabInvalidTime }, - { 0, 0 } -}; - -SYMDESCR Bitmapstatus_Syms[] = { - { "success", BitmapSuccess }, - { "open-failed", BitmapOpenFailed }, - { "file-invalid", BitmapFileInvalid }, - { "no-memory", BitmapNoMemory }, - { 0, 0 } -}; - -SYMDESCR Circulate_Syms[] = { - { "raise-lowest", RaiseLowest }, - { "lower-highest", LowerHighest }, - { 0, 0 } -}; - -SYMDESCR Allow_Events_Syms[] = { - { "async-pointer", AsyncPointer }, - { "sync-pointer", SyncPointer }, - { "replay-pointer", ReplayPointer }, - { "async-keyboard", AsyncKeyboard }, - { "sync-keyboard", SyncKeyboard }, - { "replay-keyboard", ReplayKeyboard }, - { "async-both", AsyncBoth }, - { "sync-both", SyncBoth }, - { 0, 0 } -}; - -SYMDESCR Revert_Syms[] = { - { "none", RevertToNone }, - { "pointer-root", RevertToPointerRoot }, - { "parent", RevertToParent }, - { 0, 0 } -}; - -SYMDESCR Shape_Syms[] = { - { "cursor", CursorShape }, - { "tile", TileShape }, - { "stipple", StippleShape }, - { 0, 0 } -}; - -SYMDESCR Initial_State_Syms[] = { - { "dont-care", DontCareState }, - { "normal", NormalState }, - { "zoom", ZoomState }, - { "iconic", IconicState }, - { "inactive", InactiveState }, - { 0, 0 } -}; - -SYMDESCR Ordering_Syms[] = { - { "unsorted", Unsorted }, - { "y-sorted", YSorted }, - { "yx-sorted", YXSorted }, - { "yx-banded", YXBanded }, - { 0, 0 } -}; - -SYMDESCR Byte_Order_Syms[] = { - { "lsb-first", LSBFirst }, - { "msb-first", MSBFirst }, - { 0, 0 } -}; - -SYMDESCR Saveset_Syms[] = { - { "insert", SetModeInsert }, - { "delete", SetModeDelete }, - { 0, 0 } -}; - -SYMDESCR Closemode_Syms[] = { - { "destroy-all", DestroyAll }, - { "retain-permanent", RetainPermanent }, - { "retain-temporary", RetainTemporary }, - { 0, 0 } -}; - -SYMDESCR Event_Mask_Syms[] = { - { "key-press", KeyPressMask }, - { "key-release", KeyReleaseMask }, - { "button-press", ButtonPressMask }, - { "button-release", ButtonReleaseMask }, - { "enter-window", EnterWindowMask }, - { "leave-window", LeaveWindowMask }, - { "pointer-motion", PointerMotionMask }, - { "pointer-motion-hint", PointerMotionHintMask }, - { "button-1-motion", Button1MotionMask }, - { "button-2-motion", Button2MotionMask }, - { "button-3-motion", Button3MotionMask }, - { "button-4-motion", Button4MotionMask }, - { "button-5-motion", Button5MotionMask }, - { "button-motion", ButtonMotionMask }, - { "keymap-state", KeymapStateMask }, - { "exposure", ExposureMask }, - { "visibility-change", VisibilityChangeMask }, - { "structure-notify", StructureNotifyMask }, - { "resize-redirect", ResizeRedirectMask }, - { "substructure-notify", SubstructureNotifyMask }, - { "substructure-redirect", SubstructureRedirectMask }, - { "focus-change", FocusChangeMask }, - { "property-change", PropertyChangeMask }, - { "colormap-change", ColormapChangeMask }, - { "owner-grab-button", OwnerGrabButtonMask }, - { "all-events", KeyPressMask | KeyReleaseMask | ButtonPressMask | - ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | LeaveWindowMask | - PointerMotionMask | PointerMotionHintMask | Button1MotionMask | - Button2MotionMask | Button3MotionMask | Button4MotionMask | - Button5MotionMask | ButtonMotionMask | KeymapStateMask | ExposureMask | - VisibilityChangeMask | StructureNotifyMask | ResizeRedirectMask | - SubstructureNotifyMask | ResizeRedirectMask | SubstructureNotifyMask | - SubstructureRedirectMask | FocusChangeMask | PropertyChangeMask | - ColormapChangeMask | OwnerGrabButtonMask }, - { 0, 0 } -}; - -SYMDESCR Error_Syms[] = { - { "bad-request", BadRequest }, - { "bad-value", BadValue }, - { "bad-window", BadWindow }, - { "bad-pixmap", BadPixmap }, - { "bad-atom", BadAtom }, - { "bad-cursor", BadCursor }, - { "bad-font", BadFont }, - { "bad-match", BadMatch }, - { "bad-drawable", BadDrawable }, - { "bad-access", BadAccess }, - { "bad-alloc", BadAlloc }, - { "bad-color", BadColor }, - { "bad-gcontext", BadGC }, - { "bad-id-choice", BadIDChoice }, - { "bad-name", BadName }, - { "bad-length", BadLength }, - { "bad-implementation", BadImplementation }, - { 0, 0 } -}; - -SYMDESCR Visual_Class_Syms[] = { - { "direct-color", DirectColor }, - { "gray-scale", GrayScale }, - { "pseudo-color", PseudoColor }, - { "static-color", StaticColor }, - { "static-gray", StaticGray }, - { "true-color", TrueColor }, - { 0, 0 } -}; - -SYMDESCR Color_Flags_Syms[] = { - { "do-red", DoRed }, - { "do-green", DoGreen }, - { "do-blue", DoBlue }, - { 0, 0 } -}; - -SYMDESCR Gcontext_Values_Syms[] = { - { "function", GCFunction }, - { "plane-make", GCPlaneMask }, - { "foreground", GCForeground }, - { "background", GCBackground }, - { "line-width", GCLineWidth }, - { "line-style", GCLineStyle }, - { "cap-style", GCCapStyle }, - { "join-style", GCJoinStyle }, - { "fill-style", GCFillStyle }, - { "fill-rule", GCFillRule }, - { "arc-mode", GCArcMode }, - { "tile", GCTile }, - { "stipple", GCStipple }, - { "ts-x-origin", GCTileStipXOrigin }, - { "ts-y-origin", GCTileStipYOrigin }, - { "font", GCFont }, - { "subwindow-mode", GCSubwindowMode }, - { "graphics-exposures", GCGraphicsExposures }, - { "clip-x-origin", GCClipXOrigin }, - { "clip-y-origin", GCClipYOrigin }, - { "clip-mask", GCClipMask }, - { "dash-offset", GCDashOffset }, - { "dashes", GCDashList }, - { "all", ~0L }, // or all ORed ? - { 0, 0 } -}; - -void scx_init_type(void) { - S48_GC_PROTECT_GLOBAL(string_to_symbol_binding); - string_to_symbol_binding = s48_get_imported_binding("string->symbol"); - // string_to_symbol_binding = S48_SHARED_BINDING_REF(string_to_symbol_binding); -} diff --git a/scheme/xlib/event-type.scm b/scheme/xlib/event-type.scm deleted file mode 100644 index 271946d..0000000 --- a/scheme/xlib/event-type.scm +++ /dev/null @@ -1,5 +0,0 @@ -(define-record-type event-type :event - (make-event type args) - event? - (type event-type event-set-type!) ;a symbol - (args event-args event-set-args!)) ;a vector