Added suffix "scx_" to all functions and macros. Added initialization

for all GC_PROTECTed variables.
This commit is contained in:
frese 2001-07-31 14:51:21 +00:00
parent 6fffd9346a
commit 193a14a544
19 changed files with 680 additions and 661 deletions

View File

@ -1,4 +1,4 @@
OBJECTS = main.o display.o window.o type.o color.o colormap.o pixel.o gcontext.o event.o pixmap.o graphics.o font.o
OBJECTS = main.o display.o window.o type.o color.o colormap.o pixel.o gcontext.o event.o pixmap.o graphics.o font.o cursor.o text.o property.o wm.o
$(OBJECTS): xlib.h
.c.o:

View File

@ -1,7 +1,7 @@
#include "xlib.h"
#include "scheme48.h"
s48_value Create_Color(s48_value r, s48_value g, s48_value b) {
s48_value scx_Create_Color(s48_value r, s48_value g, s48_value b) {
s48_value col = S48_MAKE_VALUE(XColor);
XColor* c = S48_EXTRACT_VALUE_POINTER(col, XColor);
c->red = s48_extract_integer(r);
@ -11,7 +11,7 @@ s48_value Create_Color(s48_value r, s48_value g, s48_value b) {
return col;
}
s48_value Int_Extract_RGB_Values(XColor col) {
s48_value scx_Int_Extract_RGB_Values(XColor col) {
s48_value res = S48_NULL;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
@ -24,24 +24,26 @@ s48_value Int_Extract_RGB_Values(XColor col) {
return res;
}
s48_value Extract_RGB_Values(s48_value Xcolor) {
return Int_Extract_RGB_Values(*EXTRACT_COLOR(Xcolor));
s48_value scx_Extract_RGB_Values(s48_value Xcolor) {
return scx_Int_Extract_RGB_Values(*SCX_EXTRACT_COLOR(Xcolor));
}
s48_value Query_Color (s48_value Xcolormap, s48_value Xpixel,
s48_value Xdisplay) {
s48_value scx_Query_Color (s48_value Xcolormap, s48_value Xpixel,
s48_value Xdisplay) {
XColor c;
c.pixel = EXTRACT_PIXEL(Xpixel);
XQueryColor(EXTRACT_DISPLAY(Xdisplay), EXTRACT_COLORMAP(Xcolormap), &c);
c.pixel = SCX_EXTRACT_PIXEL(Xpixel);
XQueryColor(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_COLORMAP(Xcolormap),
&c);
return Int_Extract_RGB_Values(c);
return scx_Int_Extract_RGB_Values(c);
}
s48_value Query_Colors(s48_value Xcolormap, s48_value Xpixels,
s48_value Xdisplay) {
s48_value result;
s48_value scx_Query_Colors(s48_value Xcolormap, s48_value Xpixels,
s48_value Xdisplay) {
s48_value result = S48_FALSE;
S48_DECLARE_GC_PROTECT(1);
long n = S48_VECTOR_LENGTH(Xpixels);
@ -49,41 +51,43 @@ s48_value Query_Colors(s48_value Xcolormap, s48_value Xpixels,
int i;
for (i=0; i < n; i++)
p[i].pixel = EXTRACT_PIXEL(S48_VECTOR_REF(Xpixels, i));
p[i].pixel = SCX_EXTRACT_PIXEL(S48_VECTOR_REF(Xpixels, i));
XQueryColors( EXTRACT_DISPLAY(Xdisplay), EXTRACT_COLORMAP(Xcolormap), p, n );
XQueryColors( SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_COLORMAP(Xcolormap), p, n );
S48_GC_PROTECT_1(result);
result = s48_make_vector(n, S48_FALSE);
for (i=0; i < n; i++)
S48_VECTOR_SET(result, i, Int_Extract_RGB_Values(p[i]));
S48_VECTOR_SET(result, i, scx_Int_Extract_RGB_Values(p[i]));
S48_GC_UNPROTECT();
return result;
}
s48_value Lookup_Color(s48_value Xcolormap, s48_value Xdisplay,
s48_value color_name) {
s48_value scx_Lookup_Color(s48_value Xcolormap, s48_value Xdisplay,
s48_value color_name) {
XColor visual, exact;
s48_value res = S48_FALSE;
S48_DECLARE_GC_PROTECT(1);
if (XLookupColor( EXTRACT_DISPLAY(Xdisplay), EXTRACT_COLORMAP(Xcolormap),
if (XLookupColor( SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_COLORMAP(Xcolormap),
s48_extract_string(color_name), &visual, &exact )) {
S48_GC_PROTECT_1(res);
res = s48_cons( Int_Extract_RGB_Values( visual ),
Int_Extract_RGB_Values( exact ) );
res = s48_cons( scx_Int_Extract_RGB_Values( visual ),
scx_Int_Extract_RGB_Values( exact ) );
}
S48_GC_UNPROTECT();
return res;
}
void s48_init_color(void) {
S48_EXPORT_FUNCTION(Create_Color);
S48_EXPORT_FUNCTION(Extract_RGB_Values);
S48_EXPORT_FUNCTION(Query_Color);
S48_EXPORT_FUNCTION(Query_Colors);
S48_EXPORT_FUNCTION(Lookup_Color);
void scx_init_color(void) {
S48_EXPORT_FUNCTION(scx_Create_Color);
S48_EXPORT_FUNCTION(scx_Extract_RGB_Values);
S48_EXPORT_FUNCTION(scx_Query_Color);
S48_EXPORT_FUNCTION(scx_Query_Colors);
S48_EXPORT_FUNCTION(scx_Lookup_Color);
}

View File

@ -1,39 +1,41 @@
#include "xlib.h"
#include "scheme48.h"
s48_value Free_Colormap (s48_value Xcolormap, s48_value Xdisplay) {
XFreeColormap(EXTRACT_DISPLAY(Xdisplay), EXTRACT_COLORMAP(Xcolormap));
s48_value scx_Free_Colormap (s48_value Xcolormap, s48_value Xdisplay) {
XFreeColormap(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_COLORMAP(Xcolormap));
return S48_UNSPECIFIC;
}
s48_value Alloc_Color(s48_value Xcolormap, s48_value Xcolor,
s48_value Xdisplay) {
XColor* cp = EXTRACT_COLOR(Xcolor);
s48_value scx_Alloc_Color(s48_value Xcolormap, s48_value Xcolor,
s48_value Xdisplay) {
XColor* cp = SCX_EXTRACT_COLOR(Xcolor);
if (!XAllocColor(EXTRACT_DISPLAY(Xdisplay), EXTRACT_COLORMAP(Xcolormap), cp))
if (!XAllocColor(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_COLORMAP(Xcolormap), cp))
return S48_FALSE;
else
return ENTER_PIXEL(cp->pixel);
return SCX_ENTER_PIXEL(cp->pixel);
}
s48_value Alloc_Named_Color(s48_value Xcolormap, s48_value color_name,
s48_value Xdisplay) {
s48_value scx_Alloc_Named_Color(s48_value Xcolormap, s48_value color_name,
s48_value Xdisplay) {
XColor screen, exact;
int r;
s48_value ret;
s48_value ret = S48_FALSE;
S48_DECLARE_GC_PROTECT(1);
r = XAllocNamedColor (EXTRACT_DISPLAY(Xdisplay), EXTRACT_COLORMAP(Xcolormap),
r = XAllocNamedColor (SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_COLORMAP(Xcolormap),
s48_extract_string(color_name),
&screen, &exact);
if (!r) ret = S48_FALSE;
else {
if (r) {
S48_GC_PROTECT_1(ret);
ret = s48_cons(Int_Extract_RGB_Values(exact), S48_NULL);
ret = s48_cons(Int_Extract_RGB_Values(screen), ret);
ret = s48_cons(ENTER_PIXEL(screen.pixel), ret);
ret = s48_cons(scx_Int_Extract_RGB_Values(exact), S48_NULL);
ret = s48_cons(scx_Int_Extract_RGB_Values(screen), ret);
ret = s48_cons(SCX_ENTER_PIXEL(screen.pixel), ret);
}
S48_GC_UNPROTECT();
@ -41,8 +43,8 @@ s48_value Alloc_Named_Color(s48_value Xcolormap, s48_value color_name,
}
void s48_init_colormap(void) {
S48_EXPORT_FUNCTION(Free_Colormap);
S48_EXPORT_FUNCTION(Alloc_Color);
S48_EXPORT_FUNCTION(Alloc_Named_Color);
void scx_init_colormap(void) {
S48_EXPORT_FUNCTION(scx_Free_Colormap);
S48_EXPORT_FUNCTION(scx_Alloc_Color);
S48_EXPORT_FUNCTION(scx_Alloc_Named_Color);
}

View File

@ -1,52 +1,52 @@
#include "xlib.h"
#include "scheme48.h"
s48_value Free_Cursor(s48_value Xdisplay, s48_value Xcursor) {
XFreeCursor(EXTRACT_DISPLAY(Xdisplay),
EXTRACT_CURSOR(Xcursor));
s48_value scx_Free_Cursor(s48_value Xdisplay, s48_value Xcursor) {
XFreeCursor(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_CURSOR(Xcursor));
return S48_UNSPECIFIC;
}
s48_value Create_Pixmap_Cursor(s48_value Xdisplay,
s48_value scx_Create_Pixmap_Cursor(s48_value Xdisplay,
s48_value src, s48_value mask, s48_value x,
s48_value y, s48_value foreground,
s48_value background) {
Cursor xc = XCreatePixmapCursor(EXTRACT_DISPLAY(Xdisplay),
EXTRACT_PIXMAP(src),
EXTRACT_PIXMAP(mask),
EXTRACT_COLOR(foreground),
EXTRACT_COLOR(background),
Cursor xc = XCreatePixmapCursor(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_PIXMAP(src),
SCX_EXTRACT_PIXMAP(mask),
SCX_EXTRACT_COLOR(foreground),
SCX_EXTRACT_COLOR(background),
s48_extract_integer(x),
s48_extract_integer(y));
return ENTER_CURSOR(xc);
return SCX_ENTER_CURSOR(xc);
}
s48_value Create_Glyph_Cursor(s48_value Xdisplay,
s48_value scx_Create_Glyph_Cursor(s48_value Xdisplay,
s48_value src, s48_value srcc,
s48_value mask, s48_value maskc,
s48_value foreground, s48_value background) {
Cursor xc = XCreateGlyphCursor(EXTRACT_DISPLAY(Xdisplay),
EXTRACT_FONT(src),
EXTRACT_FONT(mask),
Cursor xc = XCreateGlyphCursor(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_FONT(src),
SCX_EXTRACT_FONT(mask),
s48_extract_integer(srcc),
s48_extract_integer(maskc),
EXTRACT_COLOR(foreground),
EXTRACT_COLOR(background));
return ENTER_CURSOR(xc);
SCX_EXTRACT_COLOR(foreground),
SCX_EXTRACT_COLOR(background));
return SCX_ENTER_CURSOR(xc);
}
s48_value Recolor_Cursor(s48_value Xdisplay, s48_value Xcursor,
s48_value scx_Recolor_Cursor(s48_value Xdisplay, s48_value Xcursor,
s48_value f, s48_value b) {
XRecolorCursor(EXTRACT_DISPLAY(Xdisplay),
EXTRACT_CURSOR(Xcursor),
EXTRACT_COLOR(f),
EXTRACT_COLOR(b));
XRecolorCursor(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_CURSOR(Xcursor),
SCX_EXTRACT_COLOR(f),
SCX_EXTRACT_COLOR(b));
return S48_UNSPECIFIC;
}
s48_init_cursor() {
S48_EXPORT_FUNCTION(Free_Cursor);
S48_EXPORT_FUNCTION(Create_Pixmap_Cursor);
S48_EXPORT_FUNCTION(Create_Glyph_Cursor);
S48_EXPORT_FUNCTION(Recolor_Cursor);
void scx_init_cursor(void) {
S48_EXPORT_FUNCTION(scx_Free_Cursor);
S48_EXPORT_FUNCTION(scx_Create_Pixmap_Cursor);
S48_EXPORT_FUNCTION(scx_Create_Glyph_Cursor);
S48_EXPORT_FUNCTION(scx_Recolor_Cursor);
}

View File

@ -3,25 +3,24 @@
#include <sys/time.h>
// Open_Display(name) name should be a string or S48_FALSE (=> Null)
s48_value Open_Display (s48_value name) {
s48_value scx_Open_Display (s48_value name) {
char* cname = (char*)0;
if (!S48_FALSE_P(name))
cname = s48_extract_string(name);
return ENTER_DISPLAY(XOpenDisplay(cname));
return SCX_ENTER_DISPLAY(XOpenDisplay(cname));
}
// Close_Display( Xdisplay ) Xdisplay should be a pointer to the X-lib struct
// cast into a Scheme-Integer.
s48_value Close_Display(s48_value Xdisplay) {
XCloseDisplay(EXTRACT_DISPLAY(Xdisplay));
s48_value scx_Close_Display(s48_value Xdisplay) {
XCloseDisplay(SCX_EXTRACT_DISPLAY(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));
// This function returns the file destriptor of the message-channel.
s48_value scx_Display_Message_fd(s48_value Xdisplay) {
int fd = ConnectionNumber(SCX_EXTRACT_DISPLAY(Xdisplay));
/* struct timeval timeout;
fd_set fdset;
@ -40,142 +39,141 @@ s48_value Display_Message_fd(s48_value Xdisplay) {
// The following procedure mainly wrap a corresponding XLib macro without
// underscores...
s48_value Display_Default_Root_Window(s48_value Xdisplay) {
Window wnd = DefaultRootWindow(EXTRACT_DISPLAY(Xdisplay));
return ENTER_WINDOW(wnd);
s48_value scx_Display_Default_Root_Window(s48_value Xdisplay) {
Window wnd = DefaultRootWindow(SCX_EXTRACT_DISPLAY(Xdisplay));
return SCX_ENTER_WINDOW(wnd);
}
s48_value Display_Default_Colormap(s48_value Xdisplay) {
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
s48_value scx_Display_Default_Colormap(s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
Colormap cmp = DefaultColormap(dpy, DefaultScreen(dpy));
return ENTER_COLORMAP(cmp);
return SCX_ENTER_COLORMAP(cmp);
}
s48_value Display_Default_Gcontext(s48_value Xdisplay) {
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
s48_value scx_Display_Default_Gcontext(s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
GC gc = DefaultGC(dpy, DefaultScreen(dpy));
return ENTER_GCONTEXT(gc);
return SCX_ENTER_GCONTEXT(gc);
}
s48_value Display_Default_Depth(s48_value Xdisplay) {
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
s48_value scx_Display_Default_Depth(s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
int depth = DefaultDepth(dpy, DefaultScreen(dpy));
return s48_enter_integer(depth);
}
s48_value Display_Default_Screen_Number(s48_value Xdisplay) {
return s48_enter_integer(DefaultScreen(EXTRACT_DISPLAY(Xdisplay)));
s48_value scx_Display_Default_Screen_Number(s48_value Xdisplay) {
return s48_enter_integer(DefaultScreen(SCX_EXTRACT_DISPLAY(Xdisplay)));
}
s48_value Display_Cells(s48_value Xdisplay, s48_value ScrNum) {
s48_value scx_Display_Cells(s48_value Xdisplay, s48_value ScrNum) {
int num = (int)s48_extract_integer(ScrNum);
return s48_enter_integer(DisplayCells(EXTRACT_DISPLAY(Xdisplay), num));
return s48_enter_integer(DisplayCells(SCX_EXTRACT_DISPLAY(Xdisplay), num));
}
s48_value Display_Planes(s48_value Xdisplay, s48_value ScrNum) {
s48_value scx_Display_Planes(s48_value Xdisplay, s48_value ScrNum) {
int num = (int)s48_extract_integer(ScrNum);
return s48_enter_integer(DisplayPlanes(EXTRACT_DISPLAY(Xdisplay), num));
return s48_enter_integer(DisplayPlanes(SCX_EXTRACT_DISPLAY(Xdisplay), num));
}
s48_value Display_String(s48_value Xdisplay) {
char* s = DisplayString(EXTRACT_DISPLAY(Xdisplay));
s48_value scx_Display_String(s48_value Xdisplay) {
char* s = DisplayString(SCX_EXTRACT_DISPLAY(Xdisplay));
return s48_enter_string(s);
}
s48_value Display_Vendor(s48_value Xdisplay) {
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
s48_value scx_Display_Vendor(s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
char* s = ServerVendor(dpy);
int i = VendorRelease(dpy);
return s48_cons( s48_enter_string(s),
s48_enter_integer(i) );
}
s48_value Display_Protocol_Version(s48_value Xdisplay) {
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
s48_value scx_Display_Protocol_Version(s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
int maj = ProtocolVersion(dpy);
int min = ProtocolRevision(dpy);
return s48_cons( s48_enter_integer(maj),
s48_enter_integer(min) );
}
s48_value Display_Screen_Count(s48_value Xdisplay) {
int cnt = ScreenCount(EXTRACT_DISPLAY(Xdisplay));
s48_value scx_Display_Screen_Count(s48_value Xdisplay) {
int cnt = ScreenCount(SCX_EXTRACT_DISPLAY(Xdisplay));
return s48_enter_integer(cnt);
}
s48_value Display_Image_Byte_Order(s48_value Xdisplay) {
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
s48_value scx_Display_Image_Byte_Order(s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
return Bits_To_Symbols( (unsigned long)ImageByteOrder(dpy),
Byte_Order_Syms );
}
s48_value Display_Bitmap_Unit(s48_value Xdisplay) {
int bu = BitmapUnit(EXTRACT_DISPLAY(Xdisplay));
s48_value scx_Display_Bitmap_Unit(s48_value Xdisplay) {
int bu = BitmapUnit(SCX_EXTRACT_DISPLAY(Xdisplay));
return s48_enter_integer(bu);
}
s48_value Display_Bitmap_Bit_Order(s48_value Xdisplay) {
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
s48_value scx_Display_Bitmap_Bit_Order(s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
return Bits_To_Symbols( (unsigned long)BitmapBitOrder(dpy),
Byte_Order_Syms );
}
s48_value Display_Bitmap_Pad(s48_value Xdisplay) {
int bp = BitmapPad(EXTRACT_DISPLAY(Xdisplay));
s48_value scx_Display_Bitmap_Pad(s48_value Xdisplay) {
int bp = BitmapPad(SCX_EXTRACT_DISPLAY(Xdisplay));
return s48_enter_integer(bp);
}
s48_value Display_Width(s48_value Xdisplay) {
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
s48_value scx_Display_Width(s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
return s48_enter_integer(DisplayWidth(dpy, DefaultScreen(dpy)));
}
s48_value Display_Height(s48_value Xdisplay) {
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
s48_value scx_Display_Height(s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
return s48_enter_integer(DisplayHeight(dpy, DefaultScreen(dpy)));
}
s48_value Display_Width_Mm (s48_value Xdisplay) {
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
s48_value scx_Display_Width_Mm (s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
return s48_enter_integer(DisplayWidthMM(dpy, DefaultScreen(dpy)));
}
s48_value Display_Height_Mm (s48_value Xdisplay) {
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
s48_value scx_Display_Height_Mm (s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
return s48_enter_integer(DisplayHeightMM(dpy, DefaultScreen(dpy)));
}
s48_value Display_Motion_Buffer_Size(s48_value Xdisplay) {
int mbs = XDisplayMotionBufferSize(EXTRACT_DISPLAY(Xdisplay));
s48_value scx_Display_Motion_Buffer_Size(s48_value Xdisplay) {
int mbs = XDisplayMotionBufferSize(SCX_EXTRACT_DISPLAY(Xdisplay));
return s48_enter_integer(mbs);
}
s48_value Display_Flush_Output (s48_value Xdisplay) {
XFlush (EXTRACT_DISPLAY(Xdisplay));
s48_value scx_Display_Flush_Output (s48_value Xdisplay) {
XFlush (SCX_EXTRACT_DISPLAY(Xdisplay));
return S48_UNSPECIFIC;
}
s48_value Display_Wait_Output (s48_value Xdisplay, s48_value discard) {
XSync (EXTRACT_DISPLAY(Xdisplay), !S48_FALSE_P(discard));
s48_value scx_Display_Wait_Output (s48_value Xdisplay, s48_value discard) {
XSync (SCX_EXTRACT_DISPLAY(Xdisplay), !S48_FALSE_P(discard));
return S48_UNSPECIFIC;
}
s48_value No_Op (s48_value Xdisplay) {
XNoOp(EXTRACT_DISPLAY(Xdisplay));
s48_value scx_No_Op (s48_value Xdisplay) {
XNoOp(SCX_EXTRACT_DISPLAY(Xdisplay));
return S48_UNSPECIFIC;
}
s48_value List_Depths (s48_value Xdisplay, s48_value scr) {
s48_value scx_List_Depths (s48_value Xdisplay, s48_value scr) {
int i, num;
int* p;
s48_value ret;
s48_value ret = S48_FALSE;
S48_DECLARE_GC_PROTECT(1);
p = XListDepths(EXTRACT_DISPLAY(Xdisplay), s48_extract_integer(scr), &num);
if (!p)
ret = S48_FALSE;
else {
p = XListDepths(SCX_EXTRACT_DISPLAY(Xdisplay),
s48_extract_integer(scr), &num);
if (p) {
S48_GC_PROTECT_1(ret);
ret = s48_make_vector(num, S48_NULL);
for (i = 0; i < num; i++)
@ -187,17 +185,15 @@ s48_value List_Depths (s48_value Xdisplay, s48_value scr) {
return ret;
}
s48_value List_Pixmap_Formats (s48_value Xdisplay) {
s48_value scx_List_Pixmap_Formats (s48_value Xdisplay) {
int num, i;
XPixmapFormatValues* p;
s48_value ret, t;
s48_value ret = S48_FALSE, t = S48_FALSE;
S48_DECLARE_GC_PROTECT(2);
p = XListPixmapFormats(EXTRACT_DISPLAY(Xdisplay), &num);
p = XListPixmapFormats(SCX_EXTRACT_DISPLAY(Xdisplay), &num);
if (!p)
ret = S48_FALSE;
else {
if (p) {
S48_GC_PROTECT_2(ret, t);
ret = s48_make_vector (num, S48_FALSE);
for (i = 0; i < num; i++) {
@ -214,33 +210,33 @@ s48_value List_Pixmap_Formats (s48_value Xdisplay) {
return ret;
}
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);
S48_EXPORT_FUNCTION(Display_Default_Depth);
S48_EXPORT_FUNCTION(Display_Default_Screen_Number);
S48_EXPORT_FUNCTION(Display_Cells);
S48_EXPORT_FUNCTION(Display_Planes);
S48_EXPORT_FUNCTION(Display_String);
S48_EXPORT_FUNCTION(Display_Vendor);
S48_EXPORT_FUNCTION(Display_Protocol_Version);
S48_EXPORT_FUNCTION(Display_Screen_Count);
S48_EXPORT_FUNCTION(Display_Image_Byte_Order);
S48_EXPORT_FUNCTION(Display_Bitmap_Unit);
S48_EXPORT_FUNCTION(Display_Bitmap_Bit_Order);
S48_EXPORT_FUNCTION(Display_Bitmap_Pad);
S48_EXPORT_FUNCTION(Display_Width);
S48_EXPORT_FUNCTION(Display_Height);
S48_EXPORT_FUNCTION(Display_Width_Mm);
S48_EXPORT_FUNCTION(Display_Height_Mm);
S48_EXPORT_FUNCTION(Display_Motion_Buffer_Size);
S48_EXPORT_FUNCTION(Display_Flush_Output);
S48_EXPORT_FUNCTION(Display_Wait_Output);
S48_EXPORT_FUNCTION(No_Op);
S48_EXPORT_FUNCTION(List_Depths);
S48_EXPORT_FUNCTION(List_Pixmap_Formats);
void scx_init_display(void) {
S48_EXPORT_FUNCTION(scx_Open_Display);
S48_EXPORT_FUNCTION(scx_Close_Display);
S48_EXPORT_FUNCTION(scx_Display_Message_fd);
S48_EXPORT_FUNCTION(scx_Display_Default_Root_Window);
S48_EXPORT_FUNCTION(scx_Display_Default_Colormap);
S48_EXPORT_FUNCTION(scx_Display_Default_Gcontext);
S48_EXPORT_FUNCTION(scx_Display_Default_Depth);
S48_EXPORT_FUNCTION(scx_Display_Default_Screen_Number);
S48_EXPORT_FUNCTION(scx_Display_Cells);
S48_EXPORT_FUNCTION(scx_Display_Planes);
S48_EXPORT_FUNCTION(scx_Display_String);
S48_EXPORT_FUNCTION(scx_Display_Vendor);
S48_EXPORT_FUNCTION(scx_Display_Protocol_Version);
S48_EXPORT_FUNCTION(scx_Display_Screen_Count);
S48_EXPORT_FUNCTION(scx_Display_Image_Byte_Order);
S48_EXPORT_FUNCTION(scx_Display_Bitmap_Unit);
S48_EXPORT_FUNCTION(scx_Display_Bitmap_Bit_Order);
S48_EXPORT_FUNCTION(scx_Display_Bitmap_Pad);
S48_EXPORT_FUNCTION(scx_Display_Width);
S48_EXPORT_FUNCTION(scx_Display_Height);
S48_EXPORT_FUNCTION(scx_Display_Width_Mm);
S48_EXPORT_FUNCTION(scx_Display_Height_Mm);
S48_EXPORT_FUNCTION(scx_Display_Motion_Buffer_Size);
S48_EXPORT_FUNCTION(scx_Display_Flush_Output);
S48_EXPORT_FUNCTION(scx_Display_Wait_Output);
S48_EXPORT_FUNCTION(scx_No_Op);
S48_EXPORT_FUNCTION(scx_List_Depths);
S48_EXPORT_FUNCTION(scx_List_Pixmap_Formats);
}

View File

@ -6,7 +6,7 @@
#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 scx_enter_event(XEvent* e) {
s48_value r = S48_FALSE;
s48_value temp = S48_FALSE;
int i;
@ -21,9 +21,9 @@ s48_value enter_event(XEvent* e) {
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+0, SCX_ENTER_WINDOW(q->root));
SET(sidx+1, SCX_ENTER_WINDOW(q->subwindow));
SET(sidx+2, SCX_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));
@ -51,9 +51,9 @@ s48_value enter_event(XEvent* e) {
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+0, SCX_ENTER_WINDOW(q->root));
SET(sidx+1, SCX_ENTER_WINDOW(q->subwindow));
SET(sidx+2, SCX_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));
@ -121,7 +121,7 @@ s48_value enter_event(XEvent* e) {
case CreateNotify : {
ECAST(q, XCreateWindowEvent);
SETSIZE(7);
SET(sidx+0, ENTER_WINDOW(q->window));
SET(sidx+0, SCX_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));
@ -133,34 +133,34 @@ s48_value enter_event(XEvent* e) {
case DestroyNotify : {
ECAST(q, XDestroyWindowEvent);
SETSIZE(1);
SET(sidx+0, ENTER_WINDOW(q->window));
SET(sidx+0, SCX_ENTER_WINDOW(q->window));
} break;
case UnmapNotify : {
ECAST(q, XUnmapEvent);
SETSIZE(2);
SET(sidx+0, ENTER_WINDOW(q->window));
SET(sidx+0, SCX_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+0, SCX_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));
SET(sidx+0, SCX_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+0, SCX_ENTER_WINDOW(q->window));
SET(sidx+1, SCX_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));
@ -169,26 +169,26 @@ s48_value enter_event(XEvent* e) {
case ConfigureNotify : {
ECAST(q, XConfigureEvent);
SETSIZE(8);
SET(sidx+0, ENTER_WINDOW(q->window));
SET(sidx+0, SCX_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+6, SCX_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+0, SCX_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+6, SCX_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;
@ -196,7 +196,7 @@ s48_value enter_event(XEvent* e) {
case GravityNotify : {
ECAST(q, XGravityEvent);
SETSIZE(3);
SET(sidx+0, ENTER_WINDOW(q->window));
SET(sidx+0, SCX_ENTER_WINDOW(q->window));
SET(sidx+1, s48_enter_integer(q->x));
SET(sidx+2, s48_enter_integer(q->y));
} break;
@ -211,48 +211,48 @@ s48_value enter_event(XEvent* e) {
case CirculateRequest : {
ECAST(q, XCirculateEvent);
SETSIZE(2);
SET(sidx+0, ENTER_WINDOW(q->window));
SET(sidx+0, SCX_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+0, SCX_ENTER_ATOM(q->atom));
SET(sidx+1, SCX_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));
SET(sidx+0, SCX_ENTER_ATOM(q->selection));
SET(sidx+1, SCX_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));
SET(sidx+0, SCX_ENTER_WINDOW(q->requestor));
SET(sidx+1, SCX_ENTER_ATOM(q->selection));
SET(sidx+2, SCX_ENTER_ATOM(q->target));
SET(sidx+3, SCX_ENTER_ATOM(q->property));
SET(sidx+4, SCX_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));
SET(sidx+0, SCX_ENTER_ATOM(q->selection));
SET(sidx+1, SCX_ENTER_ATOM(q->target));
SET(sidx+2, SCX_ENTER_ATOM(q->property));
SET(sidx+3, SCX_ENTER_TIME(q->time));
} break;
case ColormapNotify : {
ECAST(q, XColormapEvent);
SETSIZE(3);
SET(sidx+0, ENTER_COLORMAP(q->colormap));
SET(sidx+0, SCX_ENTER_COLORMAP(q->colormap));
SET(sidx+1, S48_ENTER_BOOLEAN(q->new));
SET(sidx+2, q->state == ColormapInstalled ? S48_TRUE : S48_FALSE);
} break;
@ -260,7 +260,7 @@ s48_value enter_event(XEvent* e) {
case ClientMessage : {
ECAST(q, XClientMessageEvent);
SETSIZE(2);
SET(sidx+0, ENTER_ATOM(q->message_type));
SET(sidx+0, SCX_ENTER_ATOM(q->message_type));
switch (q->format) {
case 8 : {
temp = s48_make_string(20, (char)0);
@ -298,8 +298,8 @@ s48_value enter_event(XEvent* e) {
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));
SET(2, SCX_ENTER_DISPLAY(q->display));
SET(3, SCX_ENTER_WINDOW(q->window));
}
// more??
@ -310,36 +310,36 @@ s48_value enter_event(XEvent* e) {
return r;
}
s48_value Next_Event(s48_value Xdisplay) {
s48_value scx_Next_Event(s48_value Xdisplay) {
XEvent e;
XNextEvent(EXTRACT_DISPLAY(Xdisplay), &e);
return enter_event(&e);
XNextEvent(SCX_EXTRACT_DISPLAY(Xdisplay), &e);
return scx_enter_event(&e);
}
s48_value Peek_Event(s48_value Xdisplay) {
s48_value scx_Peek_Event(s48_value Xdisplay) {
XEvent e;
XPeekEvent(EXTRACT_DISPLAY(Xdisplay), &e);
return enter_event(&e);
XPeekEvent(SCX_EXTRACT_DISPLAY(Xdisplay), &e);
return scx_enter_event(&e);
}
s48_value Events_Pending(s48_value Xdisplay) {
return s48_enter_integer(XPending(EXTRACT_DISPLAY(Xdisplay)));
s48_value scx_Events_Pending(s48_value Xdisplay) {
return s48_enter_integer(XPending(SCX_EXTRACT_DISPLAY(Xdisplay)));
}
s48_value Get_Motion_Events(s48_value Xdisplay, s48_value Xwindow,
s48_value scx_Get_Motion_Events(s48_value Xdisplay, s48_value Xwindow,
s48_value from, s48_value to) {
int n,i;
XTimeCoord *p = XGetMotionEvents(EXTRACT_DISPLAY(Xdisplay),
EXTRACT_WINDOW(Xwindow),
EXTRACT_TIME(from),
EXTRACT_TIME(to),
XTimeCoord *p = XGetMotionEvents(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_WINDOW(Xwindow),
SCX_EXTRACT_TIME(from),
SCX_EXTRACT_TIME(to),
&n);
s48_value v = s48_make_vector(n, S48_FALSE);
s48_value l = S48_NULL;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(v,l);
for (i = 0; i < n; i++) {
l = s48_cons(ENTER_TIME(p[i].time),
l = s48_cons(SCX_ENTER_TIME(p[i].time),
s48_cons(s48_enter_integer(p[i].x),
s48_cons(s48_enter_integer(p[i].y), S48_NULL)));
S48_VECTOR_SET(v, i, l);
@ -349,10 +349,10 @@ s48_value Get_Motion_Events(s48_value Xdisplay, s48_value Xwindow,
return v;
}
void s48_init_event(void) {
S48_EXPORT_FUNCTION(Next_Event);
S48_EXPORT_FUNCTION(Peek_Event);
S48_EXPORT_FUNCTION(Events_Pending);
S48_EXPORT_FUNCTION(Get_Motion_Events);
void scx_init_event(void) {
S48_EXPORT_FUNCTION(scx_Next_Event);
S48_EXPORT_FUNCTION(scx_Peek_Event);
S48_EXPORT_FUNCTION(scx_Events_Pending);
S48_EXPORT_FUNCTION(scx_Get_Motion_Events);
}

View File

@ -2,35 +2,35 @@
#include "scheme48.h"
s48_value Load_Font(s48_value Xdisplay, s48_value font_name) {
return ENTER_FONTSTRUCT(XLoadQueryFont(EXTRACT_DISPLAY(Xdisplay),
s48_value scx_Load_Font(s48_value Xdisplay, s48_value font_name) {
return SCX_ENTER_FONTSTRUCT(XLoadQueryFont(SCX_EXTRACT_DISPLAY(Xdisplay),
s48_extract_string(font_name)));
}
s48_value Free_Font(s48_value Xdisplay, s48_value Xfontstruct) {
XFreeFont(EXTRACT_DISPLAY(Xdisplay),
EXTRACT_FONTSTRUCT(Xfontstruct));
s48_value scx_Free_Font(s48_value Xdisplay, s48_value Xfontstruct) {
XFreeFont(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_FONTSTRUCT(Xfontstruct));
return S48_UNSPECIFIC;
}
s48_value Get_Xfont(s48_value Xfontstruct) {
return ENTER_FONT((EXTRACT_FONTSTRUCT(Xfontstruct))->fid);
s48_value scx_Get_Xfont(s48_value Xfontstruct) {
return SCX_ENTER_FONT((SCX_EXTRACT_FONTSTRUCT(Xfontstruct))->fid);
}
s48_value GContext_Font(s48_value Xdisplay, s48_value Xgcontext) {
GContext gc = XGContextFromGC(EXTRACT_GCONTEXT(Xgcontext));
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
return ENTER_FONTSTRUCT(XQueryFont(dpy, gc));
s48_value scx_GContext_Font(s48_value Xdisplay, s48_value Xgcontext) {
GContext gc = XGContextFromGC(SCX_EXTRACT_GCONTEXT(Xgcontext));
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
return SCX_ENTER_FONTSTRUCT(XQueryFont(dpy, gc));
}
s48_value Font_Path(s48_value Xdisplay) {
s48_value scx_Font_Path(s48_value Xdisplay) {
int n, i;
char** sa;
s48_value ret;
s48_value ret = S48_FALSE;
S48_DECLARE_GC_PROTECT(1);
// Enable/Disable Interrupts ??
sa = XGetFontPath(EXTRACT_DISPLAY(Xdisplay), &n);
sa = XGetFontPath(SCX_EXTRACT_DISPLAY(Xdisplay), &n);
ret = s48_make_vector(n, S48_FALSE);
S48_GC_PROTECT_1(ret);
for (i = 0; i < n; i++) {
@ -42,25 +42,25 @@ s48_value Font_Path(s48_value Xdisplay) {
return ret;
}
s48_value Set_Font_Path(s48_value Xdisplay, s48_value path) {
s48_value scx_Set_Font_Path(s48_value Xdisplay, s48_value path) {
int i, n = S48_VECTOR_LENGTH(path);
char* sa[n];
for (i = 0; i < n; i++) {
sa[i] = s48_extract_string(S48_VECTOR_REF(path, i));
}
XSetFontPath(EXTRACT_DISPLAY(Xdisplay), sa, n);
XSetFontPath(SCX_EXTRACT_DISPLAY(Xdisplay), sa, n);
return S48_UNSPECIFIC;
}
s48_value List_Font_Names(s48_value Xdisplay, s48_value pattern) {
s48_value scx_List_Font_Names(s48_value Xdisplay, s48_value pattern) {
char** sa;
int i,n;
s48_value v;
s48_value v = S48_FALSE;
S48_DECLARE_GC_PROTECT(1);
XListFonts(EXTRACT_DISPLAY(Xdisplay),
XListFonts(SCX_EXTRACT_DISPLAY(Xdisplay),
s48_extract_string(pattern),
65535,
&n);
@ -76,14 +76,14 @@ s48_value List_Font_Names(s48_value Xdisplay, s48_value pattern) {
return v;
}
s48_value List_Fonts(s48_value Xdisplay, s48_value pattern) {
s48_value scx_List_Fonts(s48_value Xdisplay, s48_value pattern) {
char** sa;
XFontStruct* fsa;
int i,n;
s48_value v;
s48_value v = S48_FALSE;
S48_DECLARE_GC_PROTECT(1);
XListFontsWithInfo(EXTRACT_DISPLAY(Xdisplay),
XListFontsWithInfo(SCX_EXTRACT_DISPLAY(Xdisplay),
s48_extract_string(pattern),
65535,
&n,
@ -93,7 +93,7 @@ s48_value List_Fonts(s48_value Xdisplay, s48_value pattern) {
S48_GC_PROTECT_1(v);
for (i = 0; i < n; i++) {
S48_VECTOR_SET(v, i, s48_cons(s48_enter_string(sa[i]),
ENTER_FONTSTRUCT(&fsa[i])));
SCX_ENTER_FONTSTRUCT(&fsa[i])));
}
S48_GC_UNPROTECT();
XFreeFontNames(sa);
@ -101,10 +101,10 @@ s48_value List_Fonts(s48_value Xdisplay, s48_value pattern) {
return v;
}
s48_value Font_Properties(s48_value Xfontstruct) {
s48_value v;
s48_value scx_Font_Properties(s48_value Xfontstruct) {
s48_value v = S48_FALSE;
int i,n;
XFontStruct* fs = EXTRACT_FONTSTRUCT(Xfontstruct);
XFontStruct* fs = SCX_EXTRACT_FONTSTRUCT(Xfontstruct);
XFontProp* p;
S48_DECLARE_GC_PROTECT(1);
@ -114,25 +114,25 @@ s48_value Font_Properties(s48_value Xfontstruct) {
for (i = 0; i < n; i++) {
p = fs->properties+i;
S48_VECTOR_SET(v, i, s48_cons( ENTER_ATOM(p->name),
S48_VECTOR_SET(v, i, s48_cons( SCX_ENTER_ATOM(p->name),
s48_enter_integer(p->card32) ));
}
S48_GC_UNPROTECT();
return v;
}
s48_value Font_Property(s48_value Xfontstruct, s48_value Xatom) {
s48_value scx_Font_Property(s48_value Xfontstruct, s48_value Xatom) {
unsigned long val;
if (XGetFontProperty(EXTRACT_FONTSTRUCT(Xfontstruct),
EXTRACT_ATOM(Xatom),
if (XGetFontProperty(SCX_EXTRACT_FONTSTRUCT(Xfontstruct),
SCX_EXTRACT_ATOM(Xatom),
&val))
return s48_enter_integer(val);
else
return S48_FALSE;
}
s48_value Font_Info(s48_value Xfontstruct) {
XFontStruct* fs = EXTRACT_FONTSTRUCT(Xfontstruct);
s48_value scx_Font_Info(s48_value Xfontstruct) {
XFontStruct* fs = SCX_EXTRACT_FONTSTRUCT(Xfontstruct);
s48_value v = s48_make_vector(9, S48_FALSE);
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(v);
@ -151,11 +151,11 @@ s48_value Font_Info(s48_value Xfontstruct) {
return v;
}
static s48_value Char_Info(s48_value Xfontstruct, s48_value index) {
s48_value scx_Char_Info(s48_value Xfontstruct, s48_value index) {
// index must be an integer, #f for 'min or #t for 'max
XCharStruct* cp;
XFontStruct* p = EXTRACT_FONTSTRUCT(Xfontstruct);
s48_value v;
XFontStruct* p = SCX_EXTRACT_FONTSTRUCT(Xfontstruct);
s48_value v = S48_FALSE;
S48_DECLARE_GC_PROTECT(1);
if (S48_FALSE_P(index))
@ -178,17 +178,17 @@ static s48_value Char_Info(s48_value Xfontstruct, s48_value index) {
return v;
}
s48_init_font() {
S48_EXPORT_FUNCTION(Load_Font);
S48_EXPORT_FUNCTION(Free_Font);
S48_EXPORT_FUNCTION(Get_Xfont);
S48_EXPORT_FUNCTION(GContext_Font);
S48_EXPORT_FUNCTION(Font_Path);
S48_EXPORT_FUNCTION(Set_Font_Path);
S48_EXPORT_FUNCTION(Font_Property);
S48_EXPORT_FUNCTION(Font_Properties);
S48_EXPORT_FUNCTION(List_Fonts);
S48_EXPORT_FUNCTION(List_Font_Names);
S48_EXPORT_FUNCTION(Font_Info);
S48_EXPORT_FUNCTION(Char_Info);
void scx_init_font(void) {
S48_EXPORT_FUNCTION(scx_Load_Font);
S48_EXPORT_FUNCTION(scx_Free_Font);
S48_EXPORT_FUNCTION(scx_Get_Xfont);
S48_EXPORT_FUNCTION(scx_GContext_Font);
S48_EXPORT_FUNCTION(scx_Font_Path);
S48_EXPORT_FUNCTION(scx_Set_Font_Path);
S48_EXPORT_FUNCTION(scx_Font_Property);
S48_EXPORT_FUNCTION(scx_Font_Properties);
S48_EXPORT_FUNCTION(scx_List_Fonts);
S48_EXPORT_FUNCTION(scx_List_Font_Names);
S48_EXPORT_FUNCTION(scx_Font_Info);
S48_EXPORT_FUNCTION(scx_Char_Info);
}

View File

@ -17,13 +17,13 @@ unsigned long AList_To_GCValues(s48_value alist, XGCValues* GCV) {
GCV->function = Symbol_To_Bit(value, Func_Syms);
mask |= GCFunction;
} else if (strcmp(cname, "plane-mask") == 0) {
GCV->plane_mask = EXTRACT_PIXEL(value);
GCV->plane_mask = SCX_EXTRACT_PIXEL(value);
mask |= GCPlaneMask;
} else if (strcmp(cname, "foreground") == 0) {
GCV->foreground = EXTRACT_PIXEL(value);
GCV->foreground = SCX_EXTRACT_PIXEL(value);
mask |= GCForeground;
} else if (strcmp(cname, "background") == 0) {
GCV->background = EXTRACT_PIXEL(value);
GCV->background = SCX_EXTRACT_PIXEL(value);
mask |= GCBackground;
} else if (strcmp(cname, "line-width") == 0) {
GCV->line_width = s48_extract_integer(value);
@ -47,10 +47,10 @@ unsigned long AList_To_GCValues(s48_value alist, XGCValues* GCV) {
GCV->arc_mode = Symbol_To_Bit(value, Arc_Mode_Syms);
mask |= GCArcMode;
} else if (strcmp(cname, "tile") == 0) {
GCV->tile = EXTRACT_PIXMAP(value);
GCV->tile = SCX_EXTRACT_PIXMAP(value);
mask |= GCTile;
} else if (strcmp(cname, "stipple") == 0) {
GCV->stipple = EXTRACT_PIXMAP(value);
GCV->stipple = SCX_EXTRACT_PIXMAP(value);
mask |= GCStipple;
} else if (strcmp(cname, "ts-x") == 0) {
GCV->ts_x_origin = s48_extract_integer(value);
@ -59,7 +59,7 @@ unsigned long AList_To_GCValues(s48_value alist, XGCValues* GCV) {
GCV->ts_y_origin = s48_extract_integer(value);
mask |= GCTileStipYOrigin;
} else if (strcmp(cname, "font") == 0) {
GCV->font = EXTRACT_FONT(value);
GCV->font = SCX_EXTRACT_FONT(value);
mask |= GCFont;
} else if (strcmp(cname, "subwindow-mode") == 0) {
GCV->subwindow_mode = Symbol_To_Bit(value, Subwin_Mode_Syms);
@ -74,7 +74,7 @@ unsigned long AList_To_GCValues(s48_value alist, XGCValues* GCV) {
GCV->clip_y_origin = s48_extract_integer(value);
mask |= GCClipYOrigin;
} else if (strcmp(cname, "clip-mask") == 0) {
GCV->clip_mask = EXTRACT_PIXMAP(value);
GCV->clip_mask = SCX_EXTRACT_PIXMAP(value);
mask |= GCClipMask;
} else if (strcmp(cname, "dash-offset") == 0) {
GCV->dash_offset = s48_extract_integer(value);
@ -89,25 +89,25 @@ unsigned long AList_To_GCValues(s48_value alist, XGCValues* GCV) {
return mask;
}
s48_value Create_Gc(s48_value Xdisplay, s48_value Xdrawable, s48_value args) {
s48_value scx_Create_Gc(s48_value Xdisplay, s48_value Xdrawable, s48_value args) {
XGCValues GCV;
unsigned long mask = AList_To_GCValues(args, &GCV);
GC Xgcontext = XCreateGC(EXTRACT_DISPLAY(Xdisplay),
EXTRACT_DRAWABLE(Xdrawable),
GC Xgcontext = XCreateGC(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_DRAWABLE(Xdrawable),
mask, &GCV);
return ENTER_GCONTEXT(Xgcontext);
return SCX_ENTER_GCONTEXT(Xgcontext);
}
s48_value Copy_Gc(s48_value Xdisplay, s48_value Xsource, s48_value Xdest) {
XCopyGC(EXTRACT_DISPLAY(Xdisplay), EXTRACT_GCONTEXT(Xsource),
~0L, EXTRACT_GCONTEXT(Xdest));
s48_value scx_Copy_Gc(s48_value Xdisplay, s48_value Xsource, s48_value Xdest) {
XCopyGC(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_GCONTEXT(Xsource),
~0L, SCX_EXTRACT_GCONTEXT(Xdest));
return S48_UNSPECIFIC;
}
s48_value Free_Gc(s48_value Xgcontext, s48_value Xdisplay) {
XFreeGC(EXTRACT_DISPLAY(Xdisplay), EXTRACT_GCONTEXT(Xgcontext));
s48_value scx_Free_Gc(s48_value Xgcontext, s48_value Xdisplay) {
XFreeGC(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_GCONTEXT(Xgcontext));
return S48_UNSPECIFIC;
}
@ -118,14 +118,15 @@ s48_value Free_Gc(s48_value Xgcontext, s48_value Xdisplay) {
GCSubwindowMode | GCGraphicsExposures | GCClipXOrigin | GCClipYOrigin |\
GCDashOffset | GCArcMode)
s48_value Get_Gc_Values (s48_value Xgcontext, s48_value Xdisplay) {
s48_value scx_Get_Gc_Values (s48_value Xgcontext, s48_value Xdisplay) {
unsigned long mask = ValidGCValuesBits;
XGCValues GCV;
s48_value res;
s48_value res = S48_FALSE;
S48_DECLARE_GC_PROTECT(1);
if (!XGetGCValues (EXTRACT_DISPLAY(Xdisplay), EXTRACT_GCONTEXT(Xgcontext),
if (!XGetGCValues (SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_GCONTEXT(Xgcontext),
mask, &GCV))
res = S48_FALSE;
else {
@ -133,9 +134,9 @@ s48_value Get_Gc_Values (s48_value Xgcontext, s48_value Xdisplay) {
S48_GC_PROTECT_1(res);
S48_VECTOR_SET(res, 0, Bit_To_Symbol(GCV.function, Func_Syms));
S48_VECTOR_SET(res, 1, ENTER_PIXEL(GCV.plane_mask));
S48_VECTOR_SET(res, 2, ENTER_PIXEL(GCV.foreground));
S48_VECTOR_SET(res, 3, ENTER_PIXEL(GCV.background));
S48_VECTOR_SET(res, 1, SCX_ENTER_PIXEL(GCV.plane_mask));
S48_VECTOR_SET(res, 2, SCX_ENTER_PIXEL(GCV.foreground));
S48_VECTOR_SET(res, 3, SCX_ENTER_PIXEL(GCV.background));
S48_VECTOR_SET(res, 4, s48_enter_integer(GCV.line_width));
S48_VECTOR_SET(res, 5, Bit_To_Symbol(GCV.line_style, Line_Style_Syms));
S48_VECTOR_SET(res, 6, Bit_To_Symbol(GCV.cap_style, Cap_Style_Syms));
@ -143,17 +144,17 @@ s48_value Get_Gc_Values (s48_value Xgcontext, s48_value Xdisplay) {
S48_VECTOR_SET(res, 8, Bit_To_Symbol(GCV.fill_style, Fill_Style_Syms));
S48_VECTOR_SET(res, 9, Bit_To_Symbol(GCV.fill_rule, Fill_Rule_Syms));
S48_VECTOR_SET(res, 10, Bit_To_Symbol(GCV.arc_mode, Arc_Mode_Syms));
S48_VECTOR_SET(res, 11, ENTER_PIXMAP(GCV.tile));
S48_VECTOR_SET(res, 12, ENTER_PIXMAP(GCV.stipple));
S48_VECTOR_SET(res, 11, SCX_ENTER_PIXMAP(GCV.tile));
S48_VECTOR_SET(res, 12, SCX_ENTER_PIXMAP(GCV.stipple));
S48_VECTOR_SET(res, 13, s48_enter_integer(GCV.ts_x_origin));
S48_VECTOR_SET(res, 14, s48_enter_integer(GCV.ts_y_origin));
S48_VECTOR_SET(res, 15, ENTER_FONT(GCV.font));
S48_VECTOR_SET(res, 15, SCX_ENTER_FONT(GCV.font));
S48_VECTOR_SET(res, 16, Bit_To_Symbol(GCV.subwindow_mode,
Subwin_Mode_Syms));
S48_VECTOR_SET(res, 17, GCV.graphics_exposures ? S48_TRUE : S48_FALSE);
S48_VECTOR_SET(res, 18, s48_enter_integer(GCV.clip_x_origin));
S48_VECTOR_SET(res, 19, s48_enter_integer(GCV.clip_y_origin));
S48_VECTOR_SET(res, 20, ENTER_PIXMAP(GCV.clip_mask));
S48_VECTOR_SET(res, 20, SCX_ENTER_PIXMAP(GCV.clip_mask));
S48_VECTOR_SET(res, 21, s48_enter_integer(GCV.dash_offset));
S48_VECTOR_SET(res, 22, s48_enter_integer(GCV.dashes));
}
@ -161,17 +162,17 @@ s48_value Get_Gc_Values (s48_value Xgcontext, s48_value Xdisplay) {
return res;
}
s48_value Change_Gc (s48_value Xgcontext, s48_value Xdisplay, s48_value args) {
s48_value scx_Change_Gc (s48_value Xgcontext, s48_value Xdisplay, s48_value args) {
XGCValues GCV;
unsigned long mask = AList_To_GCValues(args, &GCV);
XChangeGC(EXTRACT_DISPLAY(Xdisplay), EXTRACT_GCONTEXT(Xgcontext),
XChangeGC(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_GCONTEXT(Xgcontext),
mask, &GCV);
return S48_UNSPECIFIC;
}
s48_value Set_Gcontext_Dashlist(s48_value Xgcontext, s48_value Xdisplay,
s48_value scx_Set_Gcontext_Dashlist(s48_value Xgcontext, s48_value Xdisplay,
s48_value dashoffset, s48_value dashlist) {
int n = S48_VECTOR_LENGTH(dashlist);
char v[n];
@ -180,13 +181,13 @@ s48_value Set_Gcontext_Dashlist(s48_value Xgcontext, s48_value Xdisplay,
v[i] = (char)s48_extract_integer(S48_VECTOR_REF(dashlist, i));
}
XSetDashes( EXTRACT_DISPLAY(Xdisplay), EXTRACT_GCONTEXT(Xgcontext),
XSetDashes( SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_GCONTEXT(Xgcontext),
s48_extract_integer(dashoffset), v, n);
return S48_UNSPECIFIC;
}
s48_value Set_Gcontext_Clip_Rectangles (s48_value Xgcontext,
s48_value scx_Set_Gcontext_Clip_Rectangles (s48_value Xgcontext,
s48_value Xdisplay, s48_value x,
s48_value y, s48_value v,
s48_value ord) {
@ -209,7 +210,8 @@ s48_value Set_Gcontext_Clip_Rectangles (s48_value Xgcontext,
}
XSetClipRectangles (EXTRACT_DISPLAY(Xdisplay), EXTRACT_GCONTEXT(Xgcontext),
XSetClipRectangles (SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_GCONTEXT(Xgcontext),
(int)s48_extract_integer (x),
(int)s48_extract_integer (y), p, n,
Symbol_To_Bit(ord, Ordering_Syms));
@ -217,11 +219,11 @@ s48_value Set_Gcontext_Clip_Rectangles (s48_value Xgcontext,
return S48_UNSPECIFIC;
}
s48_value Query_Best_Size (s48_value Xdisplay, s48_value width,
s48_value scx_Query_Best_Size (s48_value Xdisplay, s48_value width,
s48_value height, s48_value shape) {
unsigned int rw, rh;
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
if (!XQueryBestSize (dpy,
Symbol_To_Bit (shape, Shape_Syms),
@ -235,13 +237,13 @@ s48_value Query_Best_Size (s48_value Xdisplay, s48_value width,
}
void s48_init_gcontext(void) {
S48_EXPORT_FUNCTION(Create_Gc);
S48_EXPORT_FUNCTION(Free_Gc);
S48_EXPORT_FUNCTION(Copy_Gc);
S48_EXPORT_FUNCTION(Get_Gc_Values);
S48_EXPORT_FUNCTION(Change_Gc);
S48_EXPORT_FUNCTION(Set_Gcontext_Dashlist);
S48_EXPORT_FUNCTION(Set_Gcontext_Clip_Rectangles);
S48_EXPORT_FUNCTION(Query_Best_Size);
void scx_init_gcontext(void) {
S48_EXPORT_FUNCTION(scx_Create_Gc);
S48_EXPORT_FUNCTION(scx_Free_Gc);
S48_EXPORT_FUNCTION(scx_Copy_Gc);
S48_EXPORT_FUNCTION(scx_Get_Gc_Values);
S48_EXPORT_FUNCTION(scx_Change_Gc);
S48_EXPORT_FUNCTION(scx_Set_Gcontext_Dashlist);
S48_EXPORT_FUNCTION(scx_Set_Gcontext_Clip_Rectangles);
S48_EXPORT_FUNCTION(scx_Query_Best_Size);
}

View File

@ -8,10 +8,10 @@ extern XDrawArcs(), XFillArcs(), XFillPolygon();
*/
s48_value Clear_Area(s48_value Xwindow, s48_value Xdisplay, s48_value x,
s48_value scx_Clear_Area(s48_value Xwindow, s48_value Xdisplay, s48_value x,
s48_value y, s48_value w, s48_value h, s48_value e){
Window win = EXTRACT_WINDOW(Xwindow);
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
Window win = SCX_EXTRACT_WINDOW(Xwindow);
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
XClearArea (dpy, win, (int)s48_extract_integer (x),
(int)s48_extract_integer (y), (int)s48_extract_integer (w),
@ -22,13 +22,13 @@ s48_value Clear_Area(s48_value Xwindow, s48_value Xdisplay, s48_value x,
}
s48_value Copy_Area(s48_value Xdisplay,
s48_value scx_Copy_Area(s48_value Xdisplay,
s48_value srcXdrawable,s48_value Xgcontext,s48_value srcx,
s48_value srcy, s48_value width, s48_value height,
s48_value destXdrawable, s48_value destx,s48_value desty){
XCopyArea (EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(srcXdrawable),
EXTRACT_DRAWABLE(destXdrawable), EXTRACT_GCONTEXT(Xgcontext),
XCopyArea (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(srcXdrawable),
SCX_EXTRACT_DRAWABLE(destXdrawable), SCX_EXTRACT_GCONTEXT(Xgcontext),
(int)s48_extract_integer(srcx), (int)s48_extract_integer(srcy),
(int)s48_extract_integer(width), (int)s48_extract_integer(height),
(int)s48_extract_integer(destx), (int)s48_extract_integer(desty));
@ -45,7 +45,7 @@ s48_value Copy_Area(s48_value Xdisplay,
*/
s48_value Copy_Plane(s48_value Xdisplay, s48_value srcXdrawable,
s48_value scx_Copy_Plane(s48_value Xdisplay, s48_value srcXdrawable,
s48_value Xgcontext, s48_value plane, s48_value srcx,
s48_value srcy, s48_value width, s48_value height,
s48_value destXdrawable, s48_value destx, s48_value desty){
@ -53,8 +53,8 @@ s48_value Copy_Plane(s48_value Xdisplay, s48_value srcXdrawable,
// Note: plane must have been set exactly one bit to 1.
// For further details, see the man-page.
unsigned long p = (unsigned long)s48_extract_integer(plane);
XCopyPlane(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(srcXdrawable),
EXTRACT_DRAWABLE(destXdrawable), EXTRACT_GCONTEXT(Xgcontext),
XCopyPlane(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(srcXdrawable),
SCX_EXTRACT_DRAWABLE(destXdrawable), SCX_EXTRACT_GCONTEXT(Xgcontext),
(int)s48_extract_integer(srcx), (int)s48_extract_integer(srcy),
(int)s48_extract_integer(width), (int)s48_extract_integer(height),
(int)s48_extract_integer(destx), (int)s48_extract_integer(desty),
@ -65,11 +65,11 @@ s48_value Copy_Plane(s48_value Xdisplay, s48_value srcXdrawable,
s48_value Draw_Point(s48_value Xdisplay, s48_value Xdrawable,
s48_value scx_Draw_Point(s48_value Xdisplay, s48_value Xdrawable,
s48_value Xgcontext, s48_value x, s48_value y){
XDrawPoint(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
XDrawPoint(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
(int)s48_extract_integer (y));
return S48_UNSPECIFIC;
@ -87,7 +87,7 @@ void Vector_To_XPoints(s48_value vec, XPoint* p, int n){
}
s48_value Draw_Points (s48_value Xdisplay, s48_value Xdrawable,
s48_value scx_Draw_Points (s48_value Xdisplay, s48_value Xdrawable,
s48_value Xgcontext, s48_value vec, s48_value relative){
// First, create a new XPoint from the vector of pairs...
@ -96,40 +96,40 @@ s48_value Draw_Points (s48_value Xdisplay, s48_value Xdrawable,
int mode;
Vector_To_XPoints(vec, p, n);
mode = !S48_FALSE_P(relative) ? CoordModePrevious : CoordModeOrigin;
XDrawPoints(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), p, n, mode);
XDrawPoints(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), p, n, mode);
return S48_UNSPECIFIC;
}
s48_value Draw_Line (s48_value Xdisplay,s48_value Xdrawable,
s48_value scx_Draw_Line (s48_value Xdisplay,s48_value Xdrawable,
s48_value Xgcontext, s48_value x1, s48_value y1,
s48_value x2, s48_value y2){
XDrawLine (EXTRACT_DISPLAY(Xdisplay),EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x1),
XDrawLine (SCX_EXTRACT_DISPLAY(Xdisplay),SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x1),
(int)s48_extract_integer (y1), (int)s48_extract_integer (x2),
(int)s48_extract_integer (y2));
return S48_UNSPECIFIC;
}
s48_value Draw_Lines(s48_value Xdisplay, s48_value Xdrawalbe,
s48_value scx_Draw_Lines(s48_value Xdisplay, s48_value Xdrawalbe,
s48_value Xgcontext, s48_value vec, s48_value relative){
int n = S48_VECTOR_LENGTH(vec);
XPoint p[n];
int mode;
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);
XDrawLines(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawalbe),
SCX_EXTRACT_GCONTEXT(Xgcontext), p, n, mode);
return S48_UNSPECIFIC;
}
s48_value Draw_Segments (s48_value Xdisplay, s48_value Xdrawable,
s48_value scx_Draw_Segments (s48_value Xdisplay, s48_value Xdrawable,
s48_value Xgcontext, s48_value vec){
int i;
int n = S48_VECTOR_LENGTH(vec);
@ -141,18 +141,18 @@ s48_value Draw_Segments (s48_value Xdisplay, s48_value Xdrawable,
p[i].x2 = (int)s48_extract_integer (S48_CAR (seg)); seg = S48_CDR (seg);
p[i].y2 = (int)s48_extract_integer (S48_CAR (seg));
}
XDrawSegments (EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), p, n);
XDrawSegments (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), p, n);
return S48_UNSPECIFIC;
}
s48_value Draw_Rectangle(s48_value Xdisplay, s48_value Xdrawable,
s48_value scx_Draw_Rectangle(s48_value Xdisplay, s48_value Xdrawable,
s48_value Xgcontext, s48_value x, s48_value y,
s48_value w, s48_value h){
XDrawRectangle (EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
XDrawRectangle (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
(int)s48_extract_integer(y), (int)s48_extract_integer(w),
(int)s48_extract_integer(h));
@ -160,11 +160,11 @@ s48_value Draw_Rectangle(s48_value Xdisplay, s48_value Xdrawable,
}
s48_value Fill_Rectangle (s48_value Xdisplay, s48_value Xdrawable,
s48_value scx_Fill_Rectangle (s48_value Xdisplay, s48_value Xdrawable,
s48_value Xgcontext, s48_value x, s48_value y,
s48_value w, s48_value h){
XFillRectangle(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
XFillRectangle(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
(int)s48_extract_integer(y), (int)s48_extract_integer(w),
(int)s48_extract_integer(h));
@ -188,35 +188,35 @@ void Vector_To_XRectangle(s48_value vec, XRectangle* p, int n){
}
s48_value Draw_Rectangles (s48_value Xdisplay, s48_value Xdrawable,
s48_value scx_Draw_Rectangles (s48_value Xdisplay, s48_value Xdrawable,
s48_value Xgcontext, s48_value vec){
int n = S48_VECTOR_LENGTH(vec);
XRectangle p[n];
Vector_To_XRectangle(vec, p, n);
XDrawRectangles(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), p, n);
XDrawRectangles(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), p, n);
return S48_UNSPECIFIC;
}
s48_value Fill_Rectangles (s48_value Xdisplay, s48_value Xdrawable,
s48_value scx_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_XRectangle(vec, p, n);
XFillRectangles(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), p, n);
XFillRectangles(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), p, n);
return S48_UNSPECIFIC;
}
s48_value Draw_Arc (s48_value Xdisplay, s48_value Xdrawable,
s48_value scx_Draw_Arc (s48_value Xdisplay, s48_value Xdrawable,
s48_value Xgcontext, s48_value x,s48_value y, s48_value w,
s48_value h, s48_value a1, s48_value a2){
XDrawArc(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
XDrawArc(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
(int)s48_extract_integer(y), (int)s48_extract_integer(w),
(int)s48_extract_integer(h), (int)s48_extract_integer(a1),
(int)s48_extract_integer(a2));
@ -225,11 +225,11 @@ s48_value Draw_Arc (s48_value Xdisplay, s48_value Xdrawable,
}
s48_value Fill_Arc (s48_value Xdisplay, s48_value Xdrawable,
s48_value scx_Fill_Arc (s48_value Xdisplay, s48_value Xdrawable,
s48_value Xgcontext, s48_value x,s48_value y, s48_value w,
s48_value h, s48_value a1, s48_value a2){
XFillArc(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
XFillArc(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
(int)s48_extract_integer(y), (int)s48_extract_integer(w),
(int)s48_extract_integer(h), (int)s48_extract_integer(a1),
(int)s48_extract_integer(a2));
@ -257,31 +257,31 @@ void Vector_To_XArc(s48_value vec, XArc* p, int n){
}
s48_value Draw_Arcs (s48_value Xdisplay, s48_value Xdrawable,
s48_value scx_Draw_Arcs (s48_value Xdisplay, s48_value Xdrawable,
s48_value Xgcontext, s48_value vec){
int n = S48_VECTOR_LENGTH(vec);
XArc p[n];
Vector_To_XArc(vec, p, n);
XDrawArcs(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), p, n);
XDrawArcs(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), p, n);
return S48_UNSPECIFIC;
}
s48_value Fill_Arcs (s48_value Xdisplay, s48_value Xdrawable,
s48_value scx_Fill_Arcs (s48_value Xdisplay, s48_value Xdrawable,
s48_value Xgcontext, s48_value vec){
int n = S48_VECTOR_LENGTH(vec);
XArc p[n];
Vector_To_XArc(vec, p, n);
XFillArcs(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), p, n);
XFillArcs(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), p, n);
return S48_UNSPECIFIC;
}
s48_value Fill_Polygon (s48_value Xdisplay, s48_value Xdrawable,
s48_value scx_Fill_Polygon (s48_value Xdisplay, s48_value Xdrawable,
s48_value Xgcontext, s48_value vec,
s48_value relative, s48_value shape){
int n = S48_VECTOR_LENGTH(vec);
@ -290,29 +290,29 @@ s48_value Fill_Polygon (s48_value Xdisplay, s48_value Xdrawable,
XPoint p[n];
Vector_To_XPoints(vec, p, n);
mode = !S48_FALSE_P(relative) ? CoordModePrevious : CoordModeOrigin;
XFillPolygon(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), p, n, sh, mode);
XFillPolygon(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), p, n, sh, mode);
return S48_UNSPECIFIC;
}
void s48_init_graphics(void) {
S48_EXPORT_FUNCTION(Clear_Area);
S48_EXPORT_FUNCTION(Copy_Area);
S48_EXPORT_FUNCTION(Copy_Plane);
S48_EXPORT_FUNCTION(Draw_Point);
S48_EXPORT_FUNCTION(Draw_Points);
S48_EXPORT_FUNCTION(Draw_Line);
S48_EXPORT_FUNCTION(Draw_Lines);
S48_EXPORT_FUNCTION(Draw_Segments);
S48_EXPORT_FUNCTION(Draw_Rectangle);
S48_EXPORT_FUNCTION(Fill_Rectangle);
S48_EXPORT_FUNCTION(Draw_Rectangles);
S48_EXPORT_FUNCTION(Fill_Rectangles);
S48_EXPORT_FUNCTION(Draw_Arc);
S48_EXPORT_FUNCTION(Fill_Arc);
S48_EXPORT_FUNCTION(Draw_Arcs);
S48_EXPORT_FUNCTION(Fill_Arcs);
S48_EXPORT_FUNCTION(Fill_Polygon);
void scx_init_graphics(void) {
S48_EXPORT_FUNCTION(scx_Clear_Area);
S48_EXPORT_FUNCTION(scx_Copy_Area);
S48_EXPORT_FUNCTION(scx_Copy_Plane);
S48_EXPORT_FUNCTION(scx_Draw_Point);
S48_EXPORT_FUNCTION(scx_Draw_Points);
S48_EXPORT_FUNCTION(scx_Draw_Line);
S48_EXPORT_FUNCTION(scx_Draw_Lines);
S48_EXPORT_FUNCTION(scx_Draw_Segments);
S48_EXPORT_FUNCTION(scx_Draw_Rectangle);
S48_EXPORT_FUNCTION(scx_Fill_Rectangle);
S48_EXPORT_FUNCTION(scx_Draw_Rectangles);
S48_EXPORT_FUNCTION(scx_Fill_Rectangles);
S48_EXPORT_FUNCTION(scx_Draw_Arc);
S48_EXPORT_FUNCTION(scx_Fill_Arc);
S48_EXPORT_FUNCTION(scx_Draw_Arcs);
S48_EXPORT_FUNCTION(scx_Fill_Arcs);
S48_EXPORT_FUNCTION(scx_Fill_Polygon);
}

View File

@ -1,30 +1,38 @@
#include "scheme48.h"
extern void s48_init_window();
extern void s48_init_display();
extern void s48_init_type();
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();
extern void s48_init_font();
extern void scx_init_window();
extern void scx_init_display();
extern void scx_init_type();
extern void scx_init_color();
extern void scx_init_colormap();
extern void scx_init_pixel();
extern void scx_init_gcontext();
extern void scx_init_event();
extern void scx_init_pixmap();
extern void scx_init_graphics();
extern void scx_init_font();
extern void scx_init_cursor();
extern void scx_init_text();
extern void scx_init_property();
extern void scx_init_wm();
int main(){
s48_add_external_init(s48_init_window);
s48_add_external_init(s48_init_display);
s48_add_external_init(s48_init_type);
s48_add_external_init(s48_init_color);
s48_add_external_init(s48_init_color);
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_add_external_init(s48_init_font);
s48_add_external_init(scx_init_window);
s48_add_external_init(scx_init_display);
s48_add_external_init(scx_init_type);
s48_add_external_init(scx_init_color);
s48_add_external_init(scx_init_color);
s48_add_external_init(scx_init_colormap);
s48_add_external_init(scx_init_pixel);
s48_add_external_init(scx_init_gcontext);
s48_add_external_init(scx_init_event);
s48_add_external_init(scx_init_pixmap);
s48_add_external_init(scx_init_graphics);
s48_add_external_init(scx_init_font);
s48_add_external_init(scx_init_text);
s48_add_external_init(scx_init_property);
s48_add_external_init(scx_init_cursor);
s48_add_external_init(scx_init_wm);
s48_main(8000000, 64000,
"/afs/wsi/home/dfreese/i386_fbsd43/scsh-0.6/lib/scheme48/scsh.image",

View File

@ -1,17 +1,17 @@
#include "xlib.h"
#include "scheme48.h"
s48_value Black_Pixel(s48_value Xdisplay) {
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
return ENTER_PIXEL( BlackPixel(dpy, DefaultScreen(dpy)) );
s48_value scx_Black_Pixel(s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
return SCX_ENTER_PIXEL( BlackPixel(dpy, DefaultScreen(dpy)) );
}
s48_value White_Pixel(s48_value Xdisplay) {
Display* dpy = EXTRACT_DISPLAY(Xdisplay);
return ENTER_PIXEL( WhitePixel(dpy, DefaultScreen(dpy)) );
s48_value scx_White_Pixel(s48_value Xdisplay) {
Display* dpy = SCX_EXTRACT_DISPLAY(Xdisplay);
return SCX_ENTER_PIXEL( WhitePixel(dpy, DefaultScreen(dpy)) );
}
void s48_init_pixel(void) {
S48_EXPORT_FUNCTION(Black_Pixel);
S48_EXPORT_FUNCTION(White_Pixel);
void scx_init_pixel(void) {
S48_EXPORT_FUNCTION(scx_Black_Pixel);
S48_EXPORT_FUNCTION(scx_White_Pixel);
}

View File

@ -2,56 +2,56 @@
#include "scheme48.h"
s48_value Free_Pixmap (s48_value Xdisplay, s48_value Xpixmap){
XFreePixmap (EXTRACT_DISPLAY(Xdisplay), EXTRACT_PIXMAP(Xpixmap));
s48_value scx_Free_Pixmap (s48_value Xdisplay, s48_value Xpixmap){
XFreePixmap (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_PIXMAP(Xpixmap));
return S48_UNSPECIFIC;
}
s48_value Create_Pixmap (s48_value Xdisplay, s48_value Xdrawable, s48_value w,
s48_value scx_Create_Pixmap (s48_value Xdisplay, s48_value Xdrawable, s48_value w,
s48_value h, s48_value depth){
Pixmap pm = XCreatePixmap (EXTRACT_DISPLAY(Xdisplay),
EXTRACT_DRAWABLE(Xdrawable),
Pixmap pm = XCreatePixmap (SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_DRAWABLE(Xdrawable),
(int)s48_extract_integer (w),
(int)s48_extract_integer (h),
(int)s48_extract_integer (depth));
return S48_ENTER_PIXMAP(pm);
return SCX_ENTER_PIXMAP(pm);
}
s48_value Create_Bitmap_From_Data (s48_value Xdisplay, s48_value Xdrawable,
s48_value scx_Create_Bitmap_From_Data (s48_value Xdisplay, s48_value Xdrawable,
s48_value data, s48_value w, s48_value h){
Pixmap pm = XCreateBitmapFromData (EXTRACT_DISPLAY(Xdisplay),
EXTRACT_DRAWABLE(Xdrawable),
Pixmap pm = XCreateBitmapFromData (SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_DRAWABLE(Xdrawable),
s48_extract_string(data),
s48_extract_integer(w),
s48_extract_integer(h));
return S48_ENTER_PIXMAP(pm);
return SCX_ENTER_PIXMAP(pm);
}
s48_value Create_Pixmap_From_Bitmap_Data (s48_value Xdisplay,
s48_value scx_Create_Pixmap_From_Bitmap_Data (s48_value Xdisplay,
s48_value Xdrawable, s48_value data,
s48_value w,s48_value h, s48_value f,
s48_value b, s48_value d){
Pixmap pm = XCreatePixmapFromBitmapData (EXTRACT_DISPLAY(Xdisplay),
EXTRACT_DRAWABLE(Xdrawable),
Pixmap pm = XCreatePixmapFromBitmapData (SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_DRAWABLE(Xdrawable),
s48_extract_string(data),
(int)s48_extract_integer(w),
(int)s48_extract_integer(h),
s48_extract_integer(f),
s48_extract_intgeger(b),
s48_extract_integer(b),
(int)s48_extract_integer(d));
return S48_ENTER_PIXMAP(pm);
return SCX_ENTER_PIXMAP(pm);
}
s48_value Read_Bitmap_File (s48_value Xdisplay, s48_value Xdrawable, s48_value file){
s48_value scx_Read_Bitmap_File (s48_value Xdisplay, s48_value Xdrawable,
s48_value file){
unsigned width, height;
int res, xhot, yhot;
Pixmap bitmap;
s48_value ret;
s48_value ret = S48_FALSE;
S48_DECLARE_GC_PROTECT(1);
// Not used: Disable_Interrupts;
res = XReadBitmapFile (EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
res = XReadBitmapFile (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
s48_extract_string(file), &width, &height, &bitmap,
&xhot, &yhot);
// Not used: Enable_Interrupts;
@ -63,20 +63,22 @@ s48_value Read_Bitmap_File (s48_value Xdisplay, s48_value Xdrawable, s48_value f
ret = s48_cons (s48_enter_integer(xhot), ret);
ret = s48_cons (s48_enter_integer(height), ret);
ret = s48_cons (s48_enter_integer(width), ret);
ret = s48_cons (S48_ENTER_PIXMAP(bitmap), ret);
ret = s48_cons (SCX_ENTER_PIXMAP(bitmap), ret);
S48_GC_UNPROTECT();
return ret;
}
s48_value Write_Bitmap_File (s48_value Xdisplay, s48_value file,
s48_value scx_Write_Bitmap_File (s48_value Xdisplay, s48_value file,
s48_value Xbitmap, s48_value w, s48_value h,
s48_value x, s48_value y){
int ret;
// Not used: Disable_Interrupts;
ret = XWriteBitmapFile (EXTRACT_DISPLAY(Xdisplay), s48_extract_string(file),
EXTRACT_PIXMAP(Xbitmap), (int)s48_extract_integer(w),
ret = XWriteBitmapFile (SCX_EXTRACT_DISPLAY(Xdisplay),
s48_extract_string(file),
SCX_EXTRACT_PIXMAP(Xbitmap),
(int)s48_extract_integer(w),
(int)s48_extract_integer(h),
(int)s48_extract_integer(x),
(int)s48_extract_integer(y));
@ -85,12 +87,12 @@ s48_value Write_Bitmap_File (s48_value Xdisplay, s48_value file,
}
void s48_init_pixmap(void) {
S48_EXPORT_FUNCTION(Free_Pixmap);
S48_EXPORT_FUNCTION(Create_Pixmap);
S48_EXPORT_FUNCTION(Create_Bitmap_From_Data);
S48_EXPORT_FUNCTION(Create_Pixmap_From_Bitmap_Data);
S48_EXPORT_FUNCTION(Read_Bitmap_File);
S48_EXPORT_FUNCTION(Write_Bitmap_File);
void scx_init_pixmap(void) {
S48_EXPORT_FUNCTION(scx_Free_Pixmap);
S48_EXPORT_FUNCTION(scx_Create_Pixmap);
S48_EXPORT_FUNCTION(scx_Create_Bitmap_From_Data);
S48_EXPORT_FUNCTION(scx_Create_Pixmap_From_Bitmap_Data);
S48_EXPORT_FUNCTION(scx_Read_Bitmap_File);
S48_EXPORT_FUNCTION(scx_Write_Bitmap_File);
}

View File

@ -1,37 +1,37 @@
#include "xlib.h"
#include "scheme48.h"
s48_value Sym_Now;
/* Should be used with care */
s48_value Intern_Atom (s48_value Xdisplay, s48_value name){
Atom a = XInternAtom(EXTRACT_DISPLAY(Xdisplay), s48_extract_string(name), 0);
return ENTER_ATOM(a);
s48_value scx_Intern_Atom (s48_value Xdisplay, s48_value name){
Atom a = XInternAtom(SCX_EXTRACT_DISPLAY(Xdisplay),
s48_extract_string(name), 0);
return SCX_ENTER_ATOM(a);
}
s48_value Find_Atom (s48_value Xdisplay, s48_value name){
Atom a = XInternAtom (EXTRACT_DISPLAY(Xdisplay), s48_extract_string(name), 1);
return ENTER_ATOM(a);
s48_value scx_Find_Atom (s48_value Xdisplay, s48_value name){
Atom a = XInternAtom (SCX_EXTRACT_DISPLAY(Xdisplay),
s48_extract_string(name), 1);
return SCX_ENTER_ATOM(a);
}
s48_value Atom_Name (s48_value Xdisplay, s48_value a) {
s48_value scx_Atom_Name (s48_value Xdisplay, s48_value a) {
register char *s;
// not used: Disalbe_Interrupts
s = XGetAtomName (EXTRACT_DISPLAY(Xdisplay), a);
s = XGetAtomName (SCX_EXTRACT_DISPLAY(Xdisplay), a);
// not used: Enable_Interrupts
return s48_enter_string (s);
}
s48_value List_Properties (s48_value Xwindow, s48_value Xdisplay){
s48_value scx_List_Properties (s48_value Xwindow, s48_value Xdisplay){
int n, i;
Atom *ap;
s48_value v;
s48_value v = S48_FALSE;
S48_DECLARE_GC_PROTECT(1);
//not used: Disable_Interrupts
ap = XListProperties (EXTRACT_DISPLAY(Xdisplay),
EXTRACT_WINDOW(Xwindow), &n);
ap = XListProperties (SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_WINDOW(Xwindow), &n);
//not used: Enable_Interrupts
v = s48_make_vector (n, S48_NULL);
S48_GC_PROTECT_1 (v);
@ -44,23 +44,26 @@ s48_value List_Properties (s48_value Xwindow, s48_value Xdisplay){
}
s48_value Get_Property(s48_value Xwindow, s48_value Xdisplay, s48_value Xatom_prop,
s48_value scx_Get_Property(s48_value Xwindow, s48_value Xdisplay,
s48_value Xatom_prop,
s48_value Xatom_type, s48_value start, s48_value len,
s48_value deletep) {
Atom req_type = AnyPropertyType, actual_type_ret;
int format_ret, i;
unsigned long nitems_ret, bytes_left_ret;
unsigned char* prop_ret;
s48_value ret, x, v;
s48_value ret = S48_FALSE, x, v = S48_FALSE;
S48_DECLARE_GC_PROTECT(2);
if (!S48_EQ_P(Xatom_type, S48_FALSE)){
if (!S48_FALSE_P(Xatom_type)){
req_type = s48_extract_integer(Xatom_type);
}
//not used: Disable_Interrupts
XGetWindowProperty (EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow),
s48_extract_integer(Xatom_prop), s48_extract_integer (start),
XGetWindowProperty (SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_WINDOW(Xwindow),
s48_extract_integer(Xatom_prop),
s48_extract_integer (start),
s48_extract_integer (len), S48_EXTRACT_BOOLEAN(deletep),
req_type, &actual_type_ret, &format_ret, &nitems_ret,
&bytes_left_ret, &prop_ret);
@ -93,7 +96,7 @@ s48_value Get_Property(s48_value Xwindow, s48_value Xdisplay, s48_value Xatom_pr
}
s48_value Change_Property(s48_value Xdisplay, s48_value Xwindow,
s48_value scx_Change_Property(s48_value Xdisplay, s48_value Xwindow,
s48_value Xatom_prop, s48_value Xatom_type,
s48_value format, s48_value mode,
s48_value data){
@ -110,75 +113,76 @@ s48_value Change_Property(s48_value Xdisplay, s48_value Xwindow,
nitems = S48_VECTOR_LENGTH(data);
// Alloca (buf, char*, nitems * (f / sizeof (char)));
for (i = 0; i < nitems; i++) {
x = (int)s48_extract_integer(s48_VECTOR_REF(data, nitems));
x = (int)s48_extract_integer(S48_VECTOR_REF(data, nitems));
if (f == 16) {
*((short *)buf + i) = x; /* Assumes short is 16 bits */
}else *((int *)buf + i) = x;
} /* and int is 32 bits. */
break;
}
XChangeProperty (EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow),
EXTRACT_ATOM(Xatom_prop), EXTRACT_ATOM(Xatom_type),
XChangeProperty (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xwindow),
SCX_EXTRACT_ATOM(Xatom_prop), SCX_EXTRACT_ATOM(Xatom_type),
f, m, (unsigned char *)buf, nitems);
return S48_UNSPECIFIC;
}
s48_value Delete_Property (s48_value Xdisplay, s48_value Xwindow,
s48_value scx_Delete_Property (s48_value Xdisplay, s48_value Xwindow,
s48_value Xatom_prop){
XDeleteProperty (EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow),
EXTRACT_ATOM(Xatom_prop));
XDeleteProperty (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xwindow),
SCX_EXTRACT_ATOM(Xatom_prop));
return S48_UNSPECIFIC;
}
s48_value Rotate_Properties (s48_value Xdisplay, s48_value Xwindow,
s48_value scx_Rotate_Properties (s48_value Xdisplay, s48_value Xwindow,
s48_value Xatom_vec, s48_value delta){
int n = S48_VECTOR_LENGTH(Xatom_vec), i;
Atom p[n];
for (i = 0; i < n; i++) {
p[i] = s48_extract_integer(S48_VECTOR_REF(Xatom_vec, i));
}
XRotateWindowProperties(EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow),
XRotateWindowProperties(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_WINDOW(Xwindow),
p, n, (int)s48_extract_integer(delta));
return S48_UNSPECIFIC;
}
s48_value Set_Selection_Owner (s48_value Xdisplay, s48_value Xatom_s,
s48_value scx_Set_Selection_Owner (s48_value Xdisplay, s48_value Xatom_s,
s48_value Xwindow_owner, s48_value time){
XSetSelectionOwner (EXTRACT_DISPLAY(Xdisplay), EXTRACT_ATOM(Xatom_s),
EXTRACT_WINDOW(Xwindow_owner), EXTRACT_TIME(time));
XSetSelectionOwner (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_ATOM(Xatom_s),
SCX_EXTRACT_WINDOW(Xwindow_owner), SCX_EXTRACT_TIME(time));
return S48_UNSPECIFIC;
}
s48_value Get_Selection_Owner (s48_value Xdisplay, s48_value Xatom_s){
return ENTER_WINDOW (XGetSelectionOwner (EXTRACT_DISPLAY(Xdisplay),
EXTRACT_ATOM(Xatom_s)));
s48_value scx_Get_Selection_Owner (s48_value Xdisplay, s48_value Xatom_s){
return SCX_ENTER_WINDOW (XGetSelectionOwner (SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_ATOM(Xatom_s)));
}
s48_value Convert_Selection (s48_value Xdisplay, s48_value Xatom_s,
s48_value scx_Convert_Selection (s48_value Xdisplay, s48_value Xatom_s,
s48_value Xatom_t, s48_value Xatom_p,
s48_value Xwindow, s48_value time){
XConvertSelection(EXTRACT_DISPLAY(Xdisplay), EXTRACT_ATOM(Xatom_s),
EXTRACT_ATOM(Xatom_t), EXTRACT_ATOM(Xatom_p),
EXTRACT_WINDOW(Xwindow), EXTRACT_TIME(time));
XConvertSelection(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_ATOM(Xatom_s),
SCX_EXTRACT_ATOM(Xatom_t), SCX_EXTRACT_ATOM(Xatom_p),
SCX_EXTRACT_WINDOW(Xwindow), SCX_EXTRACT_TIME(time));
return S48_UNSPECIFIC;
}
void s48_init_property(void) {
S48_EXPORT_FUNCTION(Intern_Atom);
S48_EXPORT_FUNCTION(Find_Atom);
S48_EXPORT_FUNCTION(Atom_Name);
S48_EXPORT_FUNCTION(List_Properties);
S48_EXPORT_FUNCTION(Get_Property);
S48_EXPORT_FUNCTION(Change_Property);
S48_EXPORT_FUNCTION(Delete_Property);
S48_EXPORT_FUNCTION(Rotate_Properties);
S48_EXPORT_FUNCTION(Set_Selection_Owner);
S48_EXPORT_FUNCTION(Get_Selection_Owner);
S48_EXPORT_FUNCTION(Convert_Selection);
void scx_init_property(void) {
S48_EXPORT_FUNCTION(scx_Intern_Atom);
S48_EXPORT_FUNCTION(scx_Find_Atom);
S48_EXPORT_FUNCTION(scx_Atom_Name);
S48_EXPORT_FUNCTION(scx_List_Properties);
S48_EXPORT_FUNCTION(scx_Get_Property);
S48_EXPORT_FUNCTION(scx_Change_Property);
S48_EXPORT_FUNCTION(scx_Delete_Property);
S48_EXPORT_FUNCTION(scx_Rotate_Properties);
S48_EXPORT_FUNCTION(scx_Set_Selection_Owner);
S48_EXPORT_FUNCTION(scx_Get_Selection_Owner);
S48_EXPORT_FUNCTION(scx_Convert_Selection);
}

Binary file not shown.

View File

@ -3,9 +3,6 @@
extern XDrawText(), XDrawText16();
/* Calculation of text widths and extents should not be done using
* the Xlib functions. For instance, the values returned by
* XTextExtents() are only shorts and can therefore overflow for
@ -16,8 +13,8 @@ extern XDrawText(), XDrawText16();
s48_value Text_Width(s48_value Xfontstruct, s48_value text, s48_value format){
char* s;
XChar2b* s2;
XFontStruct* font = EXTRACT_XFONTSTRUCT(Xfontstruct);
int len = (int)S48_VECTOR_LENGHT(text), i, tmp;
XFontStruct* font = SCX_EXTRACT_FONTSTRUCT(Xfontstruct);
int len = (int)S48_VECTOR_LENGTH(text), i, tmp;
if (s48_extract_integer(format) == 2){
for (i = 0; i < len; i++){
tmp = (int)s48_extract_integer(S48_VECTOR_REF(text, i));
@ -28,7 +25,7 @@ s48_value Text_Width(s48_value Xfontstruct, s48_value text, s48_value format){
}
else{
for (i = 0; i < len; i++){
s[i] = (int)S48_extract_integer(S48_VECTOR_REF(text, i));
s[i] = (int)s48_extract_integer(S48_VECTOR_REF(text, i));
}
i = XTextWidth(font, s, len);
}
@ -40,9 +37,9 @@ s48_value Extents_Text (s48_value Xfontstruct, s48_value text,
s48_value format, s48_value which){
char* s;
XChar2b* s2;
XFontStruct* font = EXTRACT_XFONTSTRUCT(Xfontstruct);
XFontStruct* font = SCX_EXTRACT_FONTSTRUCT(Xfontstruct);
XCharStruct CI;
int len = (int)S48_VECTOR_LENGHT(text), i, tmp, dir, fasc, fdesc;
int len = (int)S48_VECTOR_LENGTH(text), i, tmp, dir, fasc, fdesc;
if (s48_extract_integer(format) == 2){
for (i = 0; i < len; i++){
tmp = (int)s48_extract_integer(S48_VECTOR_REF(text, i));
@ -86,16 +83,16 @@ s48_value Draw_Image_Text (s48_value Xdisplay, s48_value Xdrawable,
s2[i].byte1 = (tmp >> 8) & 0xff;
s2[i].byte2 = tmp & 0xff;
}
XDrawImageString16 (EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext),
XDrawImageString16 (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext),
(int)s48_extract_integer(x),
(int)s48_extract_integer(y), s2, len);
}else{
for (i = 0; i < len; i++){
s[i] = (int)s48_extract_integer(S48_VECTOR_REF(text, i));
}
XDrawImageString (EXTRACT_DISPLAY(Xdisplay), EXTRACT_INTEGER(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext),
XDrawImageString (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext),
(int)s48_extract_integer(x),
(int)s48_extract_integer(y), s, len);
}
@ -112,10 +109,11 @@ s48_value Draw_Poly_Text (s48_value Xdisplay, s48_value Xdrawable,
int twobyte = (int)s48_extract_integer(format);
len = S48_VECTOR_LENGTH(text);
if (!len){
if (len == 0){
return S48_UNSPECIFIC;
}
// count the strings in text:
for (i = 0; i < len; i++){
if (S48_VECTOR_P(S48_VECTOR_REF(text, i))){
nitems++;
@ -149,17 +147,17 @@ s48_value Draw_Poly_Text (s48_value Xdisplay, s48_value Xdrawable,
}
set++;
}else{
item[set].font = EXTRACT_XFONT(S48_VECTOR_REF(text, i));
item[set].font = SCX_EXTRACT_FONT(S48_VECTOR_REF(text, i));
item[set].delta = 0;
}
}
if (twobyte){
XDrawText16(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
XDrawText16(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
(int)s48_extract_integer(y), (XTextItem16*) item, nitems);
}else{
XDrawText(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
XDrawText(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
SCX_EXTRACT_GCONTEXT(Xgcontext), (int)s48_extract_integer(x),
(int)s48_extract_integer(y), item, nitems);
}
return S48_UNSPECIFIC;
@ -167,7 +165,7 @@ s48_value Draw_Poly_Text (s48_value Xdisplay, s48_value Xdrawable,
void s48_init_text(void) {
void scx_init_text(void) {
S48_EXPORT_FUNCTION(Text_Width);
S48_EXPORT_FUNCTION(Extents_Text);
S48_EXPORT_FUNCTION(Draw_Image_Text);

View File

@ -11,7 +11,7 @@ char* s48_extract_symbol(s48_value sym) {
}
s48_value string_to_symbol_binding;
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),
@ -927,7 +927,7 @@ elk_init_xlib_type () {
*/
void s48_init_type(void) {
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);

View File

@ -74,7 +74,7 @@ int extract_background(s48_value value) {
return ParentRelative;
//else // error ...
}
return EXTRACT_PIXMAP(value);
return SCX_EXTRACT_PIXMAP(value);
}
int extract_border(s48_value value) {
@ -87,7 +87,7 @@ int extract_border(s48_value value) {
return s48_extract_integer(value);
}
s48_value Create_Window (s48_value Xdisplay, s48_value Xparent, s48_value x,
s48_value scx_Create_Window (s48_value Xdisplay, s48_value Xparent, s48_value x,
s48_value y, s48_value width, s48_value height,
s48_value border_width, s48_value attrAlist) {
@ -95,7 +95,7 @@ s48_value Create_Window (s48_value Xdisplay, s48_value Xparent, s48_value x,
unsigned long mask = AList_To_XSetWindowAttributes( attrAlist, &Xattrs );
Window win;
win = XCreateWindow( EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xparent),
win = XCreateWindow( SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xparent),
(int)s48_extract_integer(x),
(int)s48_extract_integer(y),
(int)s48_extract_integer (width),
@ -106,33 +106,33 @@ s48_value Create_Window (s48_value Xdisplay, s48_value Xparent, s48_value x,
CopyFromParent,
mask,
&Xattrs );
return ENTER_WINDOW(win);
return SCX_ENTER_WINDOW(win);
}
s48_value Destroy_Window (s48_value Xdisplay, s48_value Xwindow) {
XDestroyWindow (EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow));
s48_value scx_Destroy_Window (s48_value Xdisplay, s48_value Xwindow) {
XDestroyWindow (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xwindow));
return S48_UNSPECIFIC;
}
s48_value Change_Window_Attributes(s48_value Xwindow, s48_value Xdisplay,
s48_value scx_Change_Window_Attributes(s48_value Xwindow, s48_value Xdisplay,
s48_value attrAlist) {
XSetWindowAttributes Xattrs;
unsigned long mask = AList_To_XSetWindowAttributes( attrAlist, &Xattrs );
XChangeWindowAttributes(EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow),
XChangeWindowAttributes(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xwindow),
mask, &Xattrs);
return S48_UNSPECIFIC;
}
s48_value Get_Window_Attributes(s48_value Xdisplay, s48_value Xwindow) {
s48_value scx_Get_Window_Attributes(s48_value Xdisplay, s48_value Xwindow) {
XWindowAttributes WA;
S48_DECLARE_GC_PROTECT(1);
s48_value res = S48_NULL;
if (!XGetWindowAttributes(EXTRACT_DISPLAY(Xdisplay),EXTRACT_WINDOW(Xwindow),
if (!XGetWindowAttributes(SCX_EXTRACT_DISPLAY(Xdisplay),SCX_EXTRACT_WINDOW(Xwindow),
&WA))
res = S48_FALSE;
else {
@ -146,17 +146,17 @@ s48_value Get_Window_Attributes(s48_value Xdisplay, s48_value Xwindow) {
S48_VECTOR_SET(res, 3, s48_enter_integer(WA.height));
S48_VECTOR_SET(res, 4, s48_enter_integer(WA.border_width));
S48_VECTOR_SET(res, 5, s48_enter_integer(WA.depth));
S48_VECTOR_SET(res, 6, ENTER_VISUAL(WA.visual));
S48_VECTOR_SET(res, 7, ENTER_WINDOW(WA.root));
S48_VECTOR_SET(res, 6, SCX_ENTER_VISUAL(WA.visual));
S48_VECTOR_SET(res, 7, SCX_ENTER_WINDOW(WA.root));
S48_VECTOR_SET(res, 8, Bit_To_Symbol(WA.class, Class_Syms));
S48_VECTOR_SET(res, 9, Bit_To_Symbol(WA.bit_gravity, Bit_Grav_Syms));
S48_VECTOR_SET(res, 10, Bit_To_Symbol(WA.win_gravity, Grav_Syms));
S48_VECTOR_SET(res, 11, Bit_To_Symbol(WA.backing_store,
Backing_Store_Syms));
S48_VECTOR_SET(res, 12, s48_enter_integer(WA.backing_planes));
S48_VECTOR_SET(res, 13, ENTER_PIXEL(WA.backing_pixel));
S48_VECTOR_SET(res, 13, SCX_ENTER_PIXEL(WA.backing_pixel));
S48_VECTOR_SET(res, 14, WA.save_under ? S48_TRUE : S48_FALSE );
S48_VECTOR_SET(res, 15, ENTER_COLORMAP( WA.colormap ));
S48_VECTOR_SET(res, 15, SCX_ENTER_COLORMAP( WA.colormap ));
S48_VECTOR_SET(res, 16, WA.map_installed ? S48_TRUE : S48_FALSE);
S48_VECTOR_SET(res, 17, Bit_To_Symbol( WA.map_state, Map_State_Syms));
S48_VECTOR_SET(res, 18, Bits_To_Symbols( WA.all_event_masks,
@ -174,7 +174,7 @@ s48_value Get_Window_Attributes(s48_value Xdisplay, s48_value Xwindow) {
return res;
}
s48_value Configure_Window (s48_value Xwindow, s48_value Xdisplay,
s48_value scx_Configure_Window (s48_value Xwindow, s48_value Xdisplay,
s48_value alist) {
unsigned long mask = 0;
XWindowChanges WC;
@ -214,39 +214,39 @@ s48_value Configure_Window (s48_value Xwindow, s48_value Xdisplay,
}
} // for
XConfigureWindow (EXTRACT_DISPLAY(Xdisplay),EXTRACT_WINDOW(Xwindow),
XConfigureWindow (SCX_EXTRACT_DISPLAY(Xdisplay),SCX_EXTRACT_WINDOW(Xwindow),
mask, &WC);
return S48_UNSPECIFIC;
}
s48_value Map_Window(s48_value Xwindow, s48_value Xdisplay) {
XMapWindow(EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow));
s48_value scx_Map_Window(s48_value Xwindow, s48_value Xdisplay) {
XMapWindow(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xwindow));
return S48_UNSPECIFIC;
}
s48_value Unmap_Window(s48_value Xwindow, s48_value Xdisplay) {
XUnmapWindow(EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow));
s48_value scx_Unmap_Window(s48_value Xwindow, s48_value Xdisplay) {
XUnmapWindow(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xwindow));
return S48_UNSPECIFIC;
}
s48_value Destroy_Subwindows (s48_value Xwindow, s48_value Xdisplay) {
XDestroySubwindows(EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow));
s48_value scx_Destroy_Subwindows (s48_value Xwindow, s48_value Xdisplay) {
XDestroySubwindows(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xwindow));
return S48_UNSPECIFIC;
}
s48_value Map_Subwindows (s48_value Xwindow, s48_value Xdisplay) {
XMapSubwindows(EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow));
s48_value scx_Map_Subwindows (s48_value Xwindow, s48_value Xdisplay) {
XMapSubwindows(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xwindow));
return S48_UNSPECIFIC;
}
s48_value Unmap_Subwindows (s48_value Xwindow, s48_value Xdisplay) {
XUnmapSubwindows(EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow));
s48_value scx_Unmap_Subwindows (s48_value Xwindow, s48_value Xdisplay) {
XUnmapSubwindows(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xwindow));
return S48_UNSPECIFIC;
}
s48_value Circulate_Subwindows(s48_value Xwindow, s48_value Xdisplay,
s48_value scx_Circulate_Subwindows(s48_value Xwindow, s48_value Xdisplay,
s48_value dir) {
XCirculateSubwindows(EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow),
XCirculateSubwindows(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xwindow),
S48_FALSE_P(dir) ? RaiseLowest : LowerHighest);
return S48_UNSPECIFIC;
}
@ -267,15 +267,15 @@ static s48_value P_Get_Geometry (d) s48_value d; {
*/
s48_value Query_Tree (s48_value Xwindow, s48_value Xdisplay) {
s48_value scx_Query_Tree (s48_value Xwindow, s48_value Xdisplay) {
Window root, parent, *children;
int i;
unsigned n;
s48_value v, ret;
s48_value v = S48_FALSE, ret = S48_FALSE;
S48_DECLARE_GC_PROTECT(2);
XQueryTree (EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow),
XQueryTree (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xwindow),
&root, &parent, &children, &n);
ret = s48_make_vector(3, S48_FALSE);
@ -286,18 +286,18 @@ s48_value Query_Tree (s48_value Xwindow, s48_value Xdisplay) {
// vector of child-windows
v = s48_make_vector (n, S48_FALSE);
for (i = 0; i < n; i++) {
S48_VECTOR_SET(v, i, ENTER_WINDOW(children[i]));
S48_VECTOR_SET(v, i, SCX_ENTER_WINDOW(children[i]));
}
S48_VECTOR_SET(ret, 0, ENTER_WINDOW(root));
S48_VECTOR_SET(ret, 1, ENTER_WINDOW(parent));
S48_VECTOR_SET(ret, 0, SCX_ENTER_WINDOW(root));
S48_VECTOR_SET(ret, 1, SCX_ENTER_WINDOW(parent));
S48_VECTOR_SET(ret, 2, v);
S48_GC_UNPROTECT();
return ret;
}
s48_value Translate_Coordinates (s48_value Xdisplay, s48_value srcXwindow,
s48_value scx_Translate_Coordinates (s48_value Xdisplay, s48_value srcXwindow,
s48_value x, s48_value y,
s48_value dstXwindow) {
int rx, ry;
@ -306,9 +306,9 @@ s48_value Translate_Coordinates (s48_value Xdisplay, s48_value srcXwindow,
S48_DECLARE_GC_PROTECT(1);
if (!XTranslateCoordinates (EXTRACT_DISPLAY(Xdisplay),
EXTRACT_WINDOW(srcXwindow),
EXTRACT_WINDOW(dstXwindow),
if (!XTranslateCoordinates (SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_WINDOW(srcXwindow),
SCX_EXTRACT_WINDOW(dstXwindow),
(int)s48_extract_integer (x),
(int)s48_extract_integer (y),
&rx, &ry, &child))
@ -319,22 +319,22 @@ s48_value Translate_Coordinates (s48_value Xdisplay, s48_value srcXwindow,
v = s48_make_vector(3, S48_FALSE);
S48_VECTOR_SET(v, 0, s48_enter_integer(rx));
S48_VECTOR_SET(v, 1, s48_enter_integer(ry));
S48_VECTOR_SET(v, 2, ENTER_WINDOW(child));
S48_VECTOR_SET(v, 2, SCX_ENTER_WINDOW(child));
S48_GC_UNPROTECT();
return v;
}
s48_value Query_Pointer (s48_value Xdisplay, s48_value Xwindow) {
s48_value scx_Query_Pointer (s48_value Xdisplay, s48_value Xwindow) {
s48_value v;
s48_value v = S48_FALSE;
Bool ret;
Window root, child;
int r_x, r_y, x, y;
unsigned int mask;
S48_DECLARE_GC_PROTECT(1);
ret = XQueryPointer (EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(Xwindow),
ret = XQueryPointer (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xwindow),
&root, &child, &r_x, &r_y, &x, &y, &mask);
v = s48_make_vector(8, S48_FALSE);
@ -343,28 +343,28 @@ s48_value Query_Pointer (s48_value Xdisplay, s48_value Xwindow) {
S48_VECTOR_SET(v, 0, s48_enter_integer(x));
S48_VECTOR_SET(v, 1, s48_enter_integer(y));
S48_VECTOR_SET(v, 2, ret ? S48_TRUE : S48_FALSE);
S48_VECTOR_SET(v, 3, ENTER_WINDOW(root));
S48_VECTOR_SET(v, 3, SCX_ENTER_WINDOW(root));
S48_VECTOR_SET(v, 4, s48_enter_integer(r_x));
S48_VECTOR_SET(v, 5, s48_enter_integer(r_y));
S48_VECTOR_SET(v, 6, ENTER_WINDOW(child));
S48_VECTOR_SET(v, 6, SCX_ENTER_WINDOW(child));
S48_VECTOR_SET(v, 7, Bits_To_Symbols ((unsigned long)mask, State_Syms));
S48_GC_UNPROTECT();
return v;
}
s48_value Get_Geometry(s48_value Xdisplay, s48_value Xdrawable) {
s48_value v;
s48_value scx_Get_Geometry(s48_value Xdisplay, s48_value Xdrawable) {
s48_value v = S48_FALSE;
Window root;
unsigned int x,y,width,height,border_width,depth;
S48_DECLARE_GC_PROTECT(1);
XGetGeometry(EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable),
XGetGeometry(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_DRAWABLE(Xdrawable),
&root, &x, &y, &width, &height, &border_width, &depth);
v = s48_make_vector(7, S48_FALSE);
S48_GC_PROTECT_1(v);
S48_VECTOR_SET(v, 0, ENTER_WINDOW(root));
S48_VECTOR_SET(v, 0, SCX_ENTER_WINDOW(root));
S48_VECTOR_SET(v, 1, s48_enter_integer(x));
S48_VECTOR_SET(v, 2, s48_enter_integer(y));
S48_VECTOR_SET(v, 3, s48_enter_integer(width));
@ -375,21 +375,20 @@ s48_value Get_Geometry(s48_value Xdisplay, s48_value Xdrawable) {
return v;
}
void s48_init_window(void) {
S48_EXPORT_FUNCTION(Create_Window);
S48_EXPORT_FUNCTION(Destroy_Window);
S48_EXPORT_FUNCTION(Change_Window_Attributes);
S48_EXPORT_FUNCTION(Get_Window_Attributes);
S48_EXPORT_FUNCTION(Configure_Window);
S48_EXPORT_FUNCTION(Map_Window);
S48_EXPORT_FUNCTION(Unmap_Window);
S48_EXPORT_FUNCTION(Destroy_Subwindows);
S48_EXPORT_FUNCTION(Map_Subwindows);
S48_EXPORT_FUNCTION(Unmap_Subwindows);
S48_EXPORT_FUNCTION(Circulate_Subwindows);
S48_EXPORT_FUNCTION(Query_Tree);
S48_EXPORT_FUNCTION(Translate_Coordinates);
S48_EXPORT_FUNCTION(Query_Pointer);
S48_EXPORT_FUNCTION(Get_Geometry);
void scx_init_window(void) {
S48_EXPORT_FUNCTION(scx_Create_Window);
S48_EXPORT_FUNCTION(scx_Destroy_Window);
S48_EXPORT_FUNCTION(scx_Change_Window_Attributes);
S48_EXPORT_FUNCTION(scx_Get_Window_Attributes);
S48_EXPORT_FUNCTION(scx_Configure_Window);
S48_EXPORT_FUNCTION(scx_Map_Window);
S48_EXPORT_FUNCTION(scx_Unmap_Window);
S48_EXPORT_FUNCTION(scx_Destroy_Subwindows);
S48_EXPORT_FUNCTION(scx_Map_Subwindows);
S48_EXPORT_FUNCTION(scx_Unmap_Subwindows);
S48_EXPORT_FUNCTION(scx_Circulate_Subwindows);
S48_EXPORT_FUNCTION(scx_Query_Tree);
S48_EXPORT_FUNCTION(scx_Translate_Coordinates);
S48_EXPORT_FUNCTION(scx_Query_Pointer);
S48_EXPORT_FUNCTION(scx_Get_Geometry);
}

View File

@ -1,80 +1,81 @@
#include "xlib.h"
#include "scheme48.h"
s48_value Reparent_Window(s48_value Xdisplay, s48_value Xwindow,
s48_value scx_Reparent_Window(s48_value Xdisplay, s48_value Xwindow,
s48_value Xwindow_parent, s48_value x,
s48_value y) {
XReparentWindow(EXTRACT_DISPLAY(Xdisplay),
EXTRACT_WINDOW(Xwindow),
EXTRACT_WINDOW(Xwindow_parent),
XReparentWindow(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_WINDOW(Xwindow),
SCX_EXTRACT_WINDOW(Xwindow_parent),
(int)s48_extract_integer (x), (int)s48_extract_integer (y));
return S48_UNSPECIFIC;
}
s48_value Install_Colormap(s48_value Xdisplay, s48_value Xcolormap) {
XInstallColormap(EXTRACT_DISPLAY(Xdisplay), EXTRACT_COLORMAP(Xcolormap));
s48_value scx_Install_Colormap(s48_value Xdisplay, s48_value Xcolormap) {
XInstallColormap(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_COLORMAP(Xcolormap));
return S48_UNSPECIFIC;
}
s48_value Uninstall_Colormap(s48_value Xdisplay, s48_value Xcolormap) {
XUninstallColormap(EXTRACT_DISPLAY(Xdisplay), EXTRACT_COLORMAP(Xcolormap));
s48_value scx_Uninstall_Colormap(s48_value Xdisplay, s48_value Xcolormap) {
XUninstallColormap(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_COLORMAP(Xcolormap));
return S48_UNSPECIFIC;
}
s48_value List_Installed_Colormaps(s48_value Xdisplay, s48_value Xwindow) {
s48_value scx_List_Installed_Colormaps(s48_value Xdisplay, s48_value Xwindow) {
int i, n;
Colormap *ret;
s48_value v;
s48_value v = S48_FALSE;
S48_DECLARE_GC_PROTECT(1);
ret = XListInstalledColormaps(EXTRACT_DISPLAY(Xdisplay),
EXTRACT_WINDOW(Xwindow),
ret = XListInstalledColormaps(SCX_EXTRACT_DISPLAY(Xdisplay),
SCX_EXTRACT_WINDOW(Xwindow),
&n);
v = s48_make_vector (n, S48_FALSE);
S48_GC_PROTECT_1 (v);
for (i = 0; i < n; i++) {
S48_VECTOR_SET(v, i, ENTER_COLORMAP(ret[i]));
S48_VECTOR_SET(v, i, SCX_ENTER_COLORMAP(ret[i]));
}
XFree ((char *)ret);
S48_GC_UNPROTECT();
return v;
}
s48_value Set_Input_Focus(s48_value Xdisplay, s48_value Xwindow,
s48_value scx_Set_Input_Focus(s48_value Xdisplay, s48_value Xwindow,
s48_value revert_to, s48_value time) {
Window focus = PointerRoot;
if (!S48_SYMBOL_P(Xwindow))
focus = EXTRACT_WINDOW(Xwindow);
focus = SCX_EXTRACT_WINDOW(Xwindow);
XSetInputFocus (EXTRACT_DISPLAY(Xdisplay), focus,
XSetInputFocus (SCX_EXTRACT_DISPLAY(Xdisplay), focus,
Symbol_To_Bit (revert_to, Revert_Syms),
EXTRACT_TIME(time));
SCX_EXTRACT_TIME(time));
return S48_UNSPECIFIC;
}
s48_value Input_Focus (s48_value Xdisplay) {
s48_value scx_Input_Focus (s48_value Xdisplay) {
Window win;
int revert_to;
s48_value ret, x;
s48_value ret = S48_FALSE;
S48_DECLARE_GC_PROTECT(1);
XGetInputFocus (EXTRACT_DISPLAY(Xdisplay), &win, &revert_to);
XGetInputFocus (SCX_EXTRACT_DISPLAY(Xdisplay), &win, &revert_to);
ret = s48_cons (S48_NULL, S48_NULL);
S48_GC_PROTECT_1 (ret);
x = ENTER_WINDOW(win); S48_SET_CAR(ret, x);
x = Bit_To_Symbol((unsigned long)revert_to, Revert_Syms);
S48_SET_CDR(ret, x);
S48_SET_CAR(ret, SCX_ENTER_WINDOW(win));
S48_SET_CDR(ret, Bit_To_Symbol((unsigned long)revert_to, Revert_Syms));
S48_GC_UNPROTECT();
return ret;
}
s48_value General_Warp_Pointer(s48_value dpy, s48_value dst, s48_value dstx,
s48_value scx_General_Warp_Pointer(s48_value dpy, s48_value dst, s48_value dstx,
s48_value dsty, s48_value src, s48_value srcx,
s48_value srcy, s48_value srcw, s48_value srch) {
XWarpPointer (EXTRACT_DISPLAY(dpy),
EXTRACT_WINDOW(src), EXTRACT_WINDOW(dst),
XWarpPointer (SCX_EXTRACT_DISPLAY(dpy),
SCX_EXTRACT_WINDOW(src), SCX_EXTRACT_WINDOW(dst),
(int)s48_extract_integer (srcx),
(int)s48_extract_integer (srcy),
(int)s48_extract_integer (srcw),
@ -84,42 +85,43 @@ s48_value General_Warp_Pointer(s48_value dpy, s48_value dst, s48_value dstx,
return S48_UNSPECIFIC;
}
s48_value Bell(s48_value Xdisplay, s48_value percent) {
s48_value scx_Bell(s48_value Xdisplay, s48_value percent) {
int p = (int)s48_extract_integer(percent);
XBell (EXTRACT_DISPLAY(Xdisplay), p);
XBell (SCX_EXTRACT_DISPLAY(Xdisplay), p);
return S48_UNSPECIFIC;
}
s48_value Set_Access_Control(s48_value Xdisplay, s48_value on) {
XSetAccessControl (EXTRACT_DISPLAY(Xdisplay), !S48_FALSE_P(on));
s48_value scx_Set_Access_Control(s48_value Xdisplay, s48_value on) {
XSetAccessControl (SCX_EXTRACT_DISPLAY(Xdisplay), !S48_FALSE_P(on));
return S48_UNSPECIFIC;
}
s48_value Change_Save_Set(s48_value Xdisplay, s48_value win, s48_value mode) {
XChangeSaveSet(EXTRACT_DISPLAY(Xdisplay), EXTRACT_WINDOW(win),
s48_value scx_Change_Save_Set(s48_value Xdisplay, s48_value win,
s48_value mode) {
XChangeSaveSet(SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(win),
Symbol_To_Bit(mode, Saveset_Syms));
return S48_UNSPECIFIC;
}
s48_value Set_Close_Down_Mode(s48_value Xdisplay, s48_value mode) {
XSetCloseDownMode(EXTRACT_DISPLAY(Xdisplay),
s48_value scx_Set_Close_Down_Mode(s48_value Xdisplay, s48_value mode) {
XSetCloseDownMode(SCX_EXTRACT_DISPLAY(Xdisplay),
Symbol_To_Bit (mode, Closemode_Syms));
return S48_UNSPECIFIC;
}
static s48_value Get_Pointer_Mapping(s48_value Xdisplay) {
s48_value scx_Get_Pointer_Mapping(s48_value Xdisplay) {
unsigned char map[256];
int i, n;
s48_value ret;
n = XGetPointerMapping (EXTRACT_DISPLAY(Xdisplay), map, 256);
n = XGetPointerMapping (SCX_EXTRACT_DISPLAY(Xdisplay), map, 256);
ret = s48_make_vector (n, S48_NULL);
for (i = 0; i < n; i++)
S48_VECTOR_SET(ret, i, s48_enter_integer (map[i]));
return ret;
}
s48_value Set_Pointer_Mapping (s48_value Xdisplay, s48_value map) {
s48_value scx_Set_Pointer_Mapping (s48_value Xdisplay, s48_value map) {
int i, n = S48_VECTOR_LENGTH(map);
unsigned char p[n];
int ret;
@ -127,22 +129,22 @@ s48_value Set_Pointer_Mapping (s48_value Xdisplay, s48_value map) {
for (i = 0; i < n; i++)
p[i] = (int)s48_extract_integer(S48_VECTOR_REF(map, i));
ret = XSetPointerMapping (EXTRACT_DISPLAY(Xdisplay), p, n);
ret = XSetPointerMapping (SCX_EXTRACT_DISPLAY(Xdisplay), p, n);
return (ret == MappingSuccess) ? S48_TRUE : S48_FALSE;
}
void s48_init_wm(void) {
S48_EXPORT_FUNCTION(Reparent_Window);
S48_EXPORT_FUNCTION(Install_Colormap);
S48_EXPORT_FUNCTION(Uninstall_Colormap);
S48_EXPORT_FUNCTION(List_Installed_Colormaps);
S48_EXPORT_FUNCTION(Set_Input_Focus);
S48_EXPORT_FUNCTION(Input_Focus);
S48_EXPORT_FUNCTION(General_Warp_Pointer);
S48_EXPORT_FUNCTION(Bell);
S48_EXPORT_FUNCTION(Set_Access_Control);
S48_EXPORT_FUNCTION(Change_Save_Set);
S48_EXPORT_FUNCTION(Set_Close_Down_Mode);
S48_EXPORT_FUNCTION(Get_Pointer_Mapping);
S48_EXPORT_FUNCTION(Set_Pointer_Mapping);
void scx_init_wm(void) {
S48_EXPORT_FUNCTION(scx_Reparent_Window);
S48_EXPORT_FUNCTION(scx_Install_Colormap);
S48_EXPORT_FUNCTION(scx_Uninstall_Colormap);
S48_EXPORT_FUNCTION(scx_List_Installed_Colormaps);
S48_EXPORT_FUNCTION(scx_Set_Input_Focus);
S48_EXPORT_FUNCTION(scx_Input_Focus);
S48_EXPORT_FUNCTION(scx_General_Warp_Pointer);
S48_EXPORT_FUNCTION(scx_Bell);
S48_EXPORT_FUNCTION(scx_Set_Access_Control);
S48_EXPORT_FUNCTION(scx_Change_Save_Set);
S48_EXPORT_FUNCTION(scx_Set_Close_Down_Mode);
S48_EXPORT_FUNCTION(scx_Get_Pointer_Mapping);
S48_EXPORT_FUNCTION(scx_Set_Pointer_Mapping);
}

View File

@ -29,30 +29,32 @@ extern char* s48_extract_symbol(s48_value);
/* Extraction-Macros for the new types, from their s48_value wrapping.
*/
#define EXTRACT_DISPLAY(x) (Display*)s48_extract_integer(x)
#define ENTER_DISPLAY(x) s48_enter_integer((long)x)
#define EXTRACT_WINDOW(x) (Window)s48_extract_integer(x)
#define ENTER_WINDOW(x) s48_enter_integer((long)x)
#define EXTRACT_COLOR(x) (XColor*)S48_EXTRACT_VALUE_POINTER(x, XColor)
#define EXTRACT_COLORMAP(x) (Colormap)s48_extract_integer(x)
#define ENTER_COLORMAP(x) s48_enter_integer((long)x)
#define EXTRACT_PIXEL(x) (unsigned long)s48_extract_integer(x)
#define ENTER_PIXEL(x) s48_enter_integer((long)x)
#define EXTRACT_GCONTEXT(x) (GC)s48_extract_integer(x)
#define ENTER_GCONTEXT(x) s48_enter_integer((long)x)
#define EXTRACT_PIXMAP(x) (Pixmap)s48_extract_integer(x)
#define ENTER_PIXMAP(x) s48_enter_integer((long)x)
#define EXTRACT_DRAWABLE(x) (Drawable)s48_extract_integer(x)
#define ENTER_ATOM(x) s48_enter_integer((long)x)
#define EXTRACT_ATOM(x) (Atom)s48_extract_integer(x)
#define ENTER_TIME(x) x == CurrentTime ? s48_enter_symbol("now") : s48_enter_integer(x)
#define EXTRACT_TIME(x) S48_SYMBOL_P(x) ? CurrentTime : (int)s48_extract_integer(x)
#define SCX_EXTRACT_DISPLAY(x) (Display*)s48_extract_integer(x)
#define SCX_ENTER_DISPLAY(x) s48_enter_integer((long)x)
#define SCX_EXTRACT_WINDOW(x) (Window)s48_extract_integer(x)
#define SCX_ENTER_WINDOW(x) s48_enter_integer((long)x)
#define SCX_EXTRACT_COLOR(x) (XColor*)S48_EXTRACT_VALUE_POINTER(x, XColor)
#define SCX_EXTRACT_COLORMAP(x) (Colormap)s48_extract_integer(x)
#define SCX_ENTER_COLORMAP(x) s48_enter_integer((long)x)
#define SCX_EXTRACT_PIXEL(x) (unsigned long)s48_extract_integer(x)
#define SCX_ENTER_PIXEL(x) s48_enter_integer((long)x)
#define SCX_EXTRACT_GCONTEXT(x) (GC)s48_extract_integer(x)
#define SCX_ENTER_GCONTEXT(x) s48_enter_integer((long)x)
#define SCX_ENTER_PIXMAP(x) s48_enter_integer((long)x)
#define SCX_EXTRACT_PIXMAP(x) (Pixmap)s48_extract_integer(x)
#define SCX_EXTRACT_DRAWABLE(x) (Drawable)s48_extract_integer(x)
#define SCX_ENTER_ATOM(x) s48_enter_integer((long)x)
#define SCX_EXTRACT_ATOM(x) (Atom)s48_extract_integer(x)
#define SCX_ENTER_TIME(x) x == CurrentTime ? s48_enter_symbol("now") : s48_enter_integer(x)
#define SCX_EXTRACT_TIME(x) S48_SYMBOL_P(x) ? CurrentTime : (int)s48_extract_integer(x)
#define SCX_EXTRACT_CURSOR(x) (Cursor)s48_extract_integer(x)
#define SCX_ENTER_CURSOR(x) s48_enter_integer((long)x)
#define SCX_ENTER_FONT(x) s48_enter_integer((long)x)
#define SCX_EXTRACT_FONT(x) (Font)s48_extract_integer(x)
#define SCX_ENTER_FONTSTRUCT(x) s48_enter_integer((long)x)
#define SCX_EXTRACT_FONTSTRUCT(x) (XFontStruct*)s48_extract_integer(x)
// TODO:
#define ENTER_VISUAL(x) S48_FALSE
#define ENTER_FONT(x) s48_enter_integer((long)x)
#define EXTRACT_FONT(x) (Font)s48_extract_integer(x)
#define ENTER_FONTSTRUCT(x) s48_enter_integer((long)x)
#define EXTRACT_FONTSTRUCT(x) (XFontStruct*)s48_extract_integer(x)
#define SCX_ENTER_VISUAL(x) S48_FALSE
/*