#include "xlib.h" 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; } 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); S48_GC_UNPROTECT(); return ret; } scx_init_extension () { S48_EXPORT_FUNCTION(scx_List_Extensions); S48_EXPORT_FUNCTION(scx_Query_Extension); }