scx/c/xlib/extension.c

47 lines
1.1 KiB
C
Raw Normal View History

2001-05-08 10:21:00 -04:00
#include "xlib.h"
2001-08-29 10:54:05 -04:00
s48_value scx_List_Extensions (s48_value d) {
s48_value ret;
int n, i;
char **p;
S48_DECLARE_GC_PROTECT(1);
//Disable_Interrupts;
p = XListExtensions (SCX_EXTRACT_DISPLAY(d), &n);
//Enable_Interrupts;
ret = s48_make_vector (n, S48_FALSE);
S48_GC_PROTECT_1 (ret);
for (i = 0; i < n; i++) {
S48_VECTOR_SET(ret, i, s48_enter_string(p[i]));
}
S48_GC_UNPROTECT();
XFreeExtensionList (p);
return ret;
2001-05-08 10:21:00 -04:00
}
2001-08-29 10:54:05 -04:00
s48_value scx_Query_Extension (s48_value d, s48_value name) {
int opcode, event, error;
s48_value ret;
S48_DECLARE_GC_PROTECT(1);
if (!XQueryExtension (SCX_EXTRACT_DISPLAY(d),
s48_extract_string(name),
&opcode, &event, &error))
return S48_FALSE;
ret = s48_make_vector(3, S48_FALSE);
S48_GC_PROTECT_1(ret);
S48_VECTOR_SET(ret, 0, opcode ? s48_enter_integer (opcode) : S48_FALSE);
S48_VECTOR_SET(ret, 1, event ? s48_enter_integer (event) : S48_FALSE);
S48_VECTOR_SET(ret, 2, error ? s48_enter_integer (error) : S48_FALSE);
2001-05-08 10:21:00 -04:00
2001-08-29 10:54:05 -04:00
S48_GC_UNPROTECT();
return ret;
2001-05-08 10:21:00 -04:00
}
2001-08-29 10:54:05 -04:00
scx_init_extension () {
S48_EXPORT_FUNCTION(scx_List_Extensions);
S48_EXPORT_FUNCTION(scx_Query_Extension);
2001-05-08 10:21:00 -04:00
}