diff --git a/c/xlib/Makefile b/c/xlib/Makefile index b8b96ba..0fa8e7d 100644 --- a/c/xlib/Makefile +++ b/c/xlib/Makefile @@ -1,7 +1,7 @@ .c.o: gcc -g -c -I /usr/X11R6/include/ -I /afs/wsi/home/dfreese/scsh-0.6/c/ -o $@ $< -OBJECTS = main.o display.o window.o type.o color.o colormap.o pixel.o gcontext.o +OBJECTS = main.o display.o window.o type.o color.o colormap.o pixel.o gcontext.o event.o pixmap.o graphics.o test: $(OBJECTS) gcc -g -o test -L /afs/wsi/home/dfreese/i386_fbsd43/scsh-0.6/lib/scsh/ \ diff --git a/c/xlib/display.c b/c/xlib/display.c index f31777a..6ea8409 100644 --- a/c/xlib/display.c +++ b/c/xlib/display.c @@ -1,5 +1,6 @@ #include "xlib.h" #include "scheme48.h" +#include // Open_Display(name) name should be a string or S48_FALSE (=> Null) s48_value Open_Display (s48_value name) { @@ -17,6 +18,26 @@ s48_value Close_Display(s48_value Xdisplay) { return S48_UNSPECIFIC; } +// This funktion selects the fd field of the Display-struct. One shouldn't do +// that usually, but we need it. +s48_value Display_Message_fd(s48_value Xdisplay) { + int fd = ConnectionNumber(EXTRACT_DISPLAY(Xdisplay)); + /* struct timeval timeout; + fd_set fdset; + + FD_ZERO(&fdset); + FD_SET(fd, &fdset); + timeout.tv_sec = 20; // 20 seconds + timeout.tv_usec = 0; + + if (select(1, &fdset, NULL, NULL, &timeout) != 0) + return S48_TRUE; + else + return S48_FALSE; + */ + return s48_enter_integer(fd); +} + // The following procedure mainly wrap a corresponding XLib macro without // underscores... s48_value Display_Default_Root_Window(s48_value Xdisplay) { @@ -196,6 +217,7 @@ s48_value List_Pixmap_Formats (s48_value Xdisplay) { void s48_init_display(void) { S48_EXPORT_FUNCTION(Open_Display); S48_EXPORT_FUNCTION(Close_Display); + S48_EXPORT_FUNCTION(Display_Message_fd); S48_EXPORT_FUNCTION(Display_Default_Root_Window); S48_EXPORT_FUNCTION(Display_Default_Colormap); S48_EXPORT_FUNCTION(Display_Default_Gcontext); diff --git a/c/xlib/event.c b/c/xlib/event.c index 261be65..75b53b8 100644 --- a/c/xlib/event.c +++ b/c/xlib/event.c @@ -1,3 +1,369 @@ +#include "xlib.h" +#include "scheme48.h" + +SYMDESCR Event_Names[] = { + { "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 } +}; + +#define ECAST(name, type) type* name = (type*)e +#define sidx 4 +#define SET(i, v) S48_VECTOR_SET(r, i, v) +#define SETSIZE(i) r = s48_make_vector(sidx+i, S48_FALSE) + +s48_value enter_event(XEvent* e) { + s48_value r = S48_FALSE; + s48_value temp = S48_FALSE; + int i; + S48_DECLARE_GC_PROTECT(2); + S48_GC_PROTECT_2(r, temp); + + switch (e->type) { + + case KeyPress : case KeyRelease : + case ButtonPress : case ButtonRelease : + case MotionNotify : { + ECAST(q, XKeyEvent); + SETSIZE(10); + // all equal in the beginning + SET(sidx+0, ENTER_WINDOW(q->root)); + SET(sidx+1, ENTER_WINDOW(q->subwindow)); + SET(sidx+2, ENTER_TIME(q->time)); + SET(sidx+3, s48_enter_integer(q->x)); + SET(sidx+4, s48_enter_integer(q->y)); + SET(sidx+5, s48_enter_integer(q->x_root)); + SET(sidx+6, s48_enter_integer(q->y_root)); + SET(sidx+7, Bits_To_Symbols(q->state, State_Syms)); + // now they are different + switch (e->type) { + case KeyPress : case KeyRelease : { + SET(sidx+8, s48_enter_integer(q->keycode)); + SET(sidx+9, S48_ENTER_BOOLEAN(q->same_screen)); + } break; + case ButtonPress : case ButtonRelease : { + ECAST(q, XButtonEvent); + SET(sidx+8, Bit_To_Symbol(q->button, Button_Syms)); + SET(sidx+9, S48_ENTER_BOOLEAN(q->same_screen)); + } break; + case MotionNotify : { + ECAST(q, XMotionEvent); + SET(sidx+8, S48_ENTER_BOOLEAN(q->is_hint)); + SET(sidx+9, S48_ENTER_BOOLEAN(q->same_screen)); + } break; + } + } break; + + case EnterNotify : case LeaveNotify : { + ECAST(q, XCrossingEvent); + SETSIZE(12); + SET(sidx+0, ENTER_WINDOW(q->root)); + SET(sidx+1, ENTER_WINDOW(q->subwindow)); + SET(sidx+2, ENTER_TIME(q->time)); + SET(sidx+3, s48_enter_integer(q->x)); + SET(sidx+4, s48_enter_integer(q->y)); + SET(sidx+5, s48_enter_integer(q->x_root)); + SET(sidx+6, s48_enter_integer(q->y_root)); + SET(sidx+7, Bit_To_Symbol(q->mode, Cross_Mode_Syms)); + SET(sidx+8, Bit_To_Symbol(q->detail, Cross_Detail_Syms)); + SET(sidx+9, S48_ENTER_BOOLEAN(q->same_screen)); + SET(sidx+10, S48_ENTER_BOOLEAN(q->focus)); + // Elk does this; but why not State_Syms?? + SET(sidx+11, Bit_To_Symbol(q->state, Button_Syms)); + } break; + + case FocusIn : case FocusOut : { + ECAST(q, XFocusChangeEvent); + SETSIZE(2); + SET(sidx+0, Bit_To_Symbol(q->mode, Cross_Mode_Syms)); + SET(sidx+1, Bit_To_Symbol(q->detail, Focus_Detail_Syms)); + } break; + + case KeymapNotify : { + ECAST(q, XKeymapEvent); + SETSIZE(1); + temp = s48_make_string(32, (char)0); + for (i=0; i < 32; i++) + S48_STRING_SET(temp, i, q->key_vector[i]); + SET(sidx+0, temp); + } break; + + case Expose : { + ECAST(q, XExposeEvent); + SETSIZE(5); + SET(sidx+0, s48_enter_integer(q->x)); + SET(sidx+1, s48_enter_integer(q->y)); + SET(sidx+2, s48_enter_integer(q->width)); + SET(sidx+3, s48_enter_integer(q->height)); + SET(sidx+4, s48_enter_integer(q->count)); + } break; + + case GraphicsExpose : { + ECAST(q, XGraphicsExposeEvent); + SETSIZE(7); + // the ->window member is only a drawable here! ?? + SET(sidx+0, s48_enter_integer(q->x)); + SET(sidx+1, s48_enter_integer(q->y)); + SET(sidx+2, s48_enter_integer(q->width)); + SET(sidx+3, s48_enter_integer(q->height)); + SET(sidx+4, s48_enter_integer(q->count)); + SET(sidx+5, s48_enter_integer(q->major_code)); + SET(sidx+6, s48_enter_integer(q->minor_code)); + } break; + + case NoExpose : { + ECAST(q, XNoExposeEvent); + SETSIZE(2); + SET(sidx+0, s48_enter_integer(q->major_code)); + SET(sidx+1, s48_enter_integer(q->minor_code)); + } break; + + case VisibilityNotify : { + ECAST(q, XVisibilityEvent); + SETSIZE(1); + SET(sidx+0, Bit_To_Symbol(q->state, Visibility_Syms)); + } break; + + case CreateNotify : { + ECAST(q, XCreateWindowEvent); + SETSIZE(7); + SET(sidx+0, ENTER_WINDOW(q->window)); + SET(sidx+1, s48_enter_integer(q->x)); + SET(sidx+2, s48_enter_integer(q->y)); + SET(sidx+3, s48_enter_integer(q->width)); + SET(sidx+4, s48_enter_integer(q->height)); + SET(sidx+5, s48_enter_integer(q->border_width)); + SET(sidx+6, S48_ENTER_BOOLEAN(q->override_redirect)); + } break; + + case DestroyNotify : { + ECAST(q, XDestroyWindowEvent); + SETSIZE(1); + SET(sidx+0, ENTER_WINDOW(q->window)); + } break; + + case UnmapNotify : { + ECAST(q, XUnmapEvent); + SETSIZE(2); + SET(sidx+0, ENTER_WINDOW(q->window)); + SET(sidx+1, S48_ENTER_BOOLEAN(q->from_configure)); + } break; + + case MapNotify : { + ECAST(q, XMapEvent); + SETSIZE(2); + SET(sidx+0, ENTER_WINDOW(q->window)); + SET(sidx+1, S48_ENTER_BOOLEAN(q->override_redirect)); + } break; + + case MapRequest : { + ECAST(q, XMapRequestEvent); + SETSIZE(1); + SET(sidx+0, ENTER_WINDOW(q->window)); + } break; + + case ReparentNotify : { + ECAST(q, XReparentEvent); + SETSIZE(5); + SET(sidx+0, ENTER_WINDOW(q->window)); + SET(sidx+1, ENTER_WINDOW(q->parent)); + SET(sidx+2, s48_enter_integer(q->x)); + SET(sidx+3, s48_enter_integer(q->y)); + SET(sidx+4, S48_ENTER_BOOLEAN(q->override_redirect)); + } break; + + case ConfigureNotify : { + ECAST(q, XConfigureEvent); + SETSIZE(8); + SET(sidx+0, ENTER_WINDOW(q->window)); + SET(sidx+1, s48_enter_integer(q->x)); + SET(sidx+2, s48_enter_integer(q->y)); + SET(sidx+3, s48_enter_integer(q->width)); + SET(sidx+4, s48_enter_integer(q->height)); + SET(sidx+5, s48_enter_integer(q->border_width)); + SET(sidx+6, ENTER_WINDOW(q->above)); + SET(sidx+7, S48_ENTER_BOOLEAN(q->override_redirect)); + } break; + + case ConfigureRequest : { + ECAST(q, XConfigureRequestEvent); + SETSIZE(9); + SET(sidx+0, ENTER_WINDOW(q->window)); + SET(sidx+1, s48_enter_integer(q->x)); + SET(sidx+2, s48_enter_integer(q->y)); + SET(sidx+3, s48_enter_integer(q->width)); + SET(sidx+4, s48_enter_integer(q->height)); + SET(sidx+5, s48_enter_integer(q->border_width)); + SET(sidx+6, ENTER_WINDOW(q->above)); + SET(sidx+7, Bit_To_Symbol(q->detail, Stack_Mode_Syms)); + SET(sidx+8, s48_enter_integer(q->value_mask)); + } break; + + case GravityNotify : { + ECAST(q, XGravityEvent); + SETSIZE(3); + SET(sidx+0, ENTER_WINDOW(q->window)); + SET(sidx+1, s48_enter_integer(q->x)); + SET(sidx+2, s48_enter_integer(q->y)); + } break; + + case ResizeRequest : { + ECAST(q, XResizeRequestEvent); + SETSIZE(2); + SET(sidx+0, s48_enter_integer(q->width)); + SET(sidx+1, s48_enter_integer(q->height)); + } break; + + case CirculateRequest : { + ECAST(q, XCirculateEvent); + SETSIZE(2); + SET(sidx+0, ENTER_WINDOW(q->window)); + SET(sidx+1, Bit_To_Symbol(q->place, Place_Syms)); + } break; + + case PropertyNotify : { + ECAST(q, XPropertyEvent); + SETSIZE(3); + SET(sidx+0, ENTER_ATOM(q->atom)); + SET(sidx+1, ENTER_TIME(q->time)); + SET(sidx+2, Bit_To_Symbol(q->state, Prop_Syms)); + } break; + + case SelectionClear : { + ECAST(q, XSelectionClearEvent); + SETSIZE(2); + SET(sidx+0, ENTER_ATOM(q->selection)); + SET(sidx+1, ENTER_TIME(q->time)); + } break; + + case SelectionRequest : { + ECAST(q, XSelectionRequestEvent); + SETSIZE(5); + SET(sidx+0, ENTER_WINDOW(q->requestor)); + SET(sidx+1, ENTER_ATOM(q->selection)); + SET(sidx+2, ENTER_ATOM(q->target)); + SET(sidx+3, ENTER_ATOM(q->property)); + SET(sidx+4, ENTER_TIME(q->time)); + } break; + + case SelectionNotify : { + ECAST(q, XSelectionEvent); + SETSIZE(4); + SET(sidx+0, ENTER_ATOM(q->selection)); + SET(sidx+1, ENTER_ATOM(q->target)); + SET(sidx+2, ENTER_ATOM(q->property)); + SET(sidx+3, ENTER_TIME(q->time)); + } break; + + case ColormapNotify : { + ECAST(q, XColormapEvent); + SETSIZE(3); + SET(sidx+0, ENTER_COLORMAP(q->colormap)); + SET(sidx+1, S48_ENTER_BOOLEAN(q->new)); + SET(sidx+2, q->state == ColormapInstalled ? S48_TRUE : S48_FALSE); + } break; + + case ClientMessage : { + ECAST(q, XClientMessageEvent); + SETSIZE(2); + SET(sidx+0, ENTER_ATOM(q->message_type)); + switch (q->format) { + case 8 : { + temp = s48_make_string(20, (char)0); + for (i=0; i < 20; i++) + S48_STRING_SET(temp, i, q->data.b[i]); + } break; + case 16 : { + temp = s48_make_vector(10, S48_FALSE); + for (i=0; i < 10; i++) + S48_VECTOR_SET(temp, i, s48_enter_integer(q->data.s[i])); + } break; + case 32 : { + temp = s48_make_vector(5, S48_FALSE); + for (i=0; i < 5; i++) + S48_VECTOR_SET(temp, i, s48_enter_integer(q->data.l[i])); + } break; + default : temp = s48_enter_integer(q->format); //?? + } + + SET(sidx+1, temp); + } + + case MappingNotify : { + ECAST(q, XMappingEvent); + SETSIZE(3); + SET(sidx+0, Bit_To_Symbol(q->request, Mapping_Syms)); + SET(sidx+1, s48_enter_integer(q->first_keycode)); + SET(sidx+2, s48_enter_integer(q->count)); + } break; + + } // switch end + + // XAnyEvent entries + { + ECAST(q, XAnyEvent); + SET(0, s48_enter_integer(q->serial)); + SET(1, S48_ENTER_BOOLEAN(q->send_event)); + SET(2, ENTER_DISPLAY(q->display)); + SET(3, ENTER_WINDOW(q->window)); + } + // more?? + + // And the Event-Name + r = s48_cons( Bit_To_Symbol(e->type, Event_Names), r ); + + S48_GC_UNPROTECT(); + return r; +} + +s48_value Next_Event(s48_value Xdisplay) { + XEvent e; + XNextEvent(EXTRACT_DISPLAY(Xdisplay), &e); + return enter_event(&e); +} + +s48_value Peek_Event(s48_value Xdisplay) { + XEvent e; + XPeekEvent(EXTRACT_DISPLAY(Xdisplay), &e); + return enter_event(&e); +} + +s48_value Events_Pending(s48_value Xdisplay) { + return s48_enter_integer(XPending(EXTRACT_DISPLAY(Xdisplay))); +} + + +/* + #include "xlib.h" #define MAX_ARGS 14 @@ -51,7 +417,8 @@ struct predicate_arg { s48_value *ret; }; -/*ARGSUSED*/ +//ARGSUSED + static Event_Predicate (dpy, ep, ptr) Display *dpy; XEvent *ep; #ifdef XLIB_RELEASE_5_OR_LATER XPointer ptr; { @@ -73,12 +440,12 @@ static Event_Predicate (dpy, ep, ptr) Display *dpy; XEvent *ep; return S48_TRUE_P (*ap->ret); } -/* (handle-events display discard? peek? clause...) - * clause = (event function) or ((event...) function) or (else function) - * loops/blocks until a function returns x != #f, then returns x. - * discard?: discard unprocessed events. - * peek?: don't discard processed events. - */ +// (handle-events display discard? peek? clause...) +// clause = (event function) or ((event...) function) or (else function) +// loops/blocks until a function returns x != #f, then returns x. +// discard?: discard unprocessed events. +// peek?: don't discard processed events. +// static s48_value P_Handle_Events (argl) s48_value argl; { s48_value next, clause, func, ret, funcs[LASTEvent], args; @@ -143,7 +510,7 @@ static s48_value P_Handle_Events (argl) s48_value argl; { Destroy_Event_Args (args); } else { if (peek) - XNextEvent (dpy, &e); /* discard it */ + XNextEvent (dpy, &e); // discard it } } else { struct predicate_arg a; @@ -411,7 +778,7 @@ s48_value Get_Event_Args (ep) XEvent *ep; { S48_VECTOR_SET(a[3], i, s48_enter_integer (p->data.l[i]);) break; default: - a[3] = s48_enter_integer (p->format); /* ??? */ + a[3] = s48_enter_integer (p->format); // ??? } } break; case MappingNotify: { @@ -422,6 +789,7 @@ s48_value Get_Event_Args (ep) XEvent *ep; { a[4] = s48_enter_integer (p->count); } break; } + a[0] = Intern (Event_Table[e].name); for (vp = VECTOR(Argv)->data, i = 0; i < Event_Table[e].argc; i++) { if (i) vp++; @@ -440,6 +808,11 @@ void Destroy_Event_Args (args) s48_value args; { S48_CAR (t) = S48_NULL; } +*/ + + +/* + Encode_Event (e) s48_value e; { s48_value s; register char *p; @@ -512,3 +885,14 @@ elk_init_xlib_event () { "get-motion-events", 3, 3, EVAL); Define_Primitive (P_Event_Listen, "event-listen", 2, 2, EVAL); } + +*/ + +void s48_init_event(void) { + S48_EXPORT_FUNCTION(Next_Event); + S48_EXPORT_FUNCTION(Peek_Event); + S48_EXPORT_FUNCTION(Events_Pending); + // Encode_Event + // Get_Motion_Events ?? +} + diff --git a/c/xlib/graphics.c b/c/xlib/graphics.c index cb76aef..26d651d 100644 --- a/c/xlib/graphics.c +++ b/c/xlib/graphics.c @@ -1,11 +1,11 @@ #include "xlib.h" #include "scheme48.h" - +/* extern XDrawPoints(), XDrawLines(), XDrawRectangle(), XFillRectangle(); extern XDrawRectangles(), XFillRectangles(), XDrawArc(), XFillArc(); extern XDrawArcs(), XFillArcs(), XFillPolygon(); - +*/ s48_value Clear_Area(s48_value Xwindow, s48_value Xdisplay, s48_value x, @@ -95,7 +95,7 @@ s48_value Draw_Points (s48_value Xdisplay, s48_value Xdrawable, XPoint p[n]; int mode; Vector_To_XPoints(vec, p, n); - mode = !S48_EQ_P(relative, S48_FALSE) ? CoordModePrevious : CoordModeOrigin; + mode = !S48_FALSE_P(relative) ? CoordModePrevious : CoordModeOrigin; XDrawPoints(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable), EXTRACT_GCONTEXT(Xgcontext), p, n, mode); @@ -117,11 +117,11 @@ s48_value Draw_Line (s48_value Xdisplay,s48_value Xdrawable, s48_value Draw_Lines(s48_value Xdisplay, s48_value Xdrawalbe, s48_value Xgcontext, s48_value vec, s48_value relative){ - int n = S48_VECTOR_LENGHT(vec); + int n = S48_VECTOR_LENGTH(vec); XPoint p[n]; int mode; - Vector_To_Points(vec, p, n); - mode = !S48_EQ_P(relative, S48_FALSE) ? CoordModePrevious : CoordModeOrigin; + Vector_To_XPoints(vec, p, n); + mode = !S48_FALSE_P(relative) ? CoordModePrevious : CoordModeOrigin; XDrawLines(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawalbe), EXTRACT_GCONTEXT(Xgcontext), p, n, mode); @@ -204,7 +204,7 @@ s48_value Fill_Rectangles (s48_value Xdisplay, s48_value Xdrawable, s48_value Xgcontext, s48_value vec){ int n = S48_VECTOR_LENGTH(vec); XRectangle p[n]; - Vector_To_Rectangle(vec, p, n); + Vector_To_XRectangle(vec, p, n); XFillRectangles(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable), EXTRACT_GCONTEXT(Xgcontext), p, n); @@ -289,7 +289,7 @@ s48_value Fill_Polygon (s48_value Xdisplay, s48_value Xdrawable, int sh = (int)Symbol_To_Bit(shape, Polyshape_Syms); XPoint p[n]; Vector_To_XPoints(vec, p, n); - mode = !S48_EQ_P(relative, S48_FALSE) ? CoordModePrevious : CoordModeOrigin; + mode = !S48_FALSE_P(relative) ? CoordModePrevious : CoordModeOrigin; XFillPolygon(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable), EXTRACT_GCONTEXT(Xgcontext), p, n, sh, mode); diff --git a/c/xlib/main.c b/c/xlib/main.c index 6f2df7a..ca19e8c 100644 --- a/c/xlib/main.c +++ b/c/xlib/main.c @@ -7,6 +7,9 @@ extern void s48_init_color(); extern void s48_init_colormap(); extern void s48_init_pixel(); extern void s48_init_gcontext(); +extern void s48_init_event(); +extern void s48_init_pixmap(); +extern void s48_init_graphics(); int main(){ s48_add_external_init(s48_init_window); @@ -17,6 +20,9 @@ int main(){ s48_add_external_init(s48_init_colormap); s48_add_external_init(s48_init_pixel); s48_add_external_init(s48_init_gcontext); + s48_add_external_init(s48_init_event); + s48_add_external_init(s48_init_pixmap); + s48_add_external_init(s48_init_graphics); s48_main(8000000, 64000, "/afs/wsi/home/dfreese/i386_fbsd43/scsh-0.6/lib/scheme48/scsh.image", diff --git a/c/xlib/pixmap.c b/c/xlib/pixmap.c index c106d8e..dfbd895 100644 --- a/c/xlib/pixmap.c +++ b/c/xlib/pixmap.c @@ -1,4 +1,15 @@ #include "xlib.h" +#include "scheme48.h" + + +s48_value Free_Pixmap(s48_value Xpixmap, s48_value Xdisplay) { + XFreePixmap(EXTRACT_DISPLAY(Xdisplay), + EXTRACT_PIXMAP(Xpixmap)); + return S48_UNSPECIFIC; +} + + +/* Generic_Predicate (Pixmap) @@ -27,7 +38,7 @@ static s48_value Internal_Make_Pixmap (finalize, dpy, pix) return pm; } -/* Backwards compatibility: */ +// Backwards compatibility: s48_value Make_Pixmap (dpy, pix) Display *dpy; Pixmap pix; { return Internal_Make_Pixmap (1, dpy, pix); } @@ -146,3 +157,9 @@ elk_init_xlib_pixmap () { Define_Primitive (P_Read_Bitmap_File, "read-bitmap-file", 2, 2, EVAL); Define_Primitive (P_Write_Bitmap_File, "write-bitmap-file", 4, 6, VARARGS); } + +*/ + +void s48_init_pixmap(void) { + S48_EXPORT_FUNCTION(Free_Pixmap); +} diff --git a/c/xlib/test b/c/xlib/test index 2b4f426..a14428e 100755 Binary files a/c/xlib/test and b/c/xlib/test differ diff --git a/c/xlib/type.c b/c/xlib/type.c index b3fa3bf..65f320b 100644 --- a/c/xlib/type.c +++ b/c/xlib/type.c @@ -48,11 +48,13 @@ s48_value Bits_To_Symbols(unsigned long bits, SYMDESCR* table) { } s48_value Bit_To_Symbol(unsigned long bits, SYMDESCR* table) { - s48_value res = Bits_To_Symbols(bits, table); - if (S48_NULL_P(res)) - return s48_enter_integer(bits); - else - return S48_CAR(res); + int i = 0; + while (table[i].name != (char*)0) { + if ((table[i].val & bits) != 0) + 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) { diff --git a/c/xlib/xlib.h b/c/xlib/xlib.h index c2c6ee3..77d74a5 100644 --- a/c/xlib/xlib.h +++ b/c/xlib/xlib.h @@ -47,6 +47,8 @@ #define ENTER_PIXMAP(x) S48_FALSE #define ENTER_FONT(x) S48_FALSE #define EXTRACT_FONT(x) (Font)0 +#define ENTER_ATOM(x) S48_FALSE +#define ENTER_TIME(x) x == CurrentTime ? s48_enter_symbol("now") : s48_enter_integer(x) /*