void mus_error_to_snd(int type, char *msg) { /* it's possible to get here outside any catch, and in Guile a throw in that case * kills the main program! */ if (!ss) { fprintf(stderr, msg); return; } if (!(ignore_mus_error(type, msg))) { if (ss->catch_exists) { if (msg == NULL) XEN_ERROR(XEN_ERROR_TYPE("mus-error"), XEN_LIST_1(C_TO_XEN_STRING((char *)mus_error_type_to_string(type)))); else XEN_ERROR(XEN_ERROR_TYPE("mus-error"), XEN_LIST_1(C_TO_XEN_STRING(msg))); } else { snd_error("%s: %s", mus_error_type_to_string(type), msg); #if HAVE_SETJMP_H ss->jump_ok = true; top_level_catch(1); /* sigh -- try to keep going */ #endif } } }
static void snd_gsl_error(const char *reason, const char *file, int line, int gsl_errno) { XEN_ERROR(XEN_ERROR_TYPE("gsl-error"), XEN_LIST_3(C_TO_XEN_STRING("GSL"), C_TO_XEN_STRING("~A, ~A in ~A line ~A, gsl err: ~A"), XEN_LIST_5(C_TO_XEN_STRING(gsl_strerror(gsl_errno)), C_TO_XEN_STRING(reason), C_TO_XEN_STRING(file), C_TO_XEN_INT(line), C_TO_XEN_INT(gsl_errno)))); }
static XEN g_mus_midi_device_name(XEN dev) { /* sndlib style sys|dev packing, dev optional */ #define H_mus_midi_device_name "(" S_mus_midi_device_name " :optional (sys-dev 0)): returns a name suitable for " S_mus_midi_open_read " and write" XEN_ASSERT_TYPE(XEN_INTEGER_IF_BOUND_P(dev), dev, XEN_ONLY_ARG, S_mus_midi_device_name, "and integer"); return(C_TO_XEN_STRING(mus_midi_device_name(XEN_TO_C_INT_OR_ELSE(dev, 0)))); }
static XEN g_window_property(XEN winat, XEN name) { #define H_window_property "(" S_window_property " win-name name): get or set the window property." Window window; Display *dpy; Atom type = None; int format; unsigned long len, bytesafter; unsigned char *data[1]; XEN result = XEN_FALSE; XEN_ASSERT_TYPE(XEN_STRING_P(winat), winat, XEN_ARG_1, S_window_property, "a string"); XEN_ASSERT_TYPE(XEN_STRING_P(name), name, XEN_ARG_2, S_window_property, "a string"); dpy = MAIN_DISPLAY(ss); if (((window = find_window(dpy, DefaultRootWindow(dpy), XEN_TO_C_STRING(winat), compare_window))) && ((XGetWindowProperty(dpy, window, XInternAtom(dpy, XEN_TO_C_STRING(name), 0), 0L, (long)BUFSIZ, False, XA_STRING, &type, &format, &len, &bytesafter, (unsigned char **)data)) == Success) && (type != None) && (len > 0)) { if (type == XA_STRING) result = C_TO_XEN_STRING((char *)data[0]); else result = C_TO_XEN_STRINGN((char *)data[0], len * format / 8); if (data[0]) XFree((char *)(data[0])); } return(result); }
static XEN g_get_help(XEN name) { #define H_get_help S_get_help"([name=:"S_get_help"]) \ return help associated with name (String or Symbol) or false" if (XEN_NOT_BOUND_P(name)) return(C_TO_XEN_STRING(H_get_help)); else return(rb_documentation(name)); }
static bool ignore_mus_error(int type, char *msg) { XEN result = XEN_FALSE; if (XEN_HOOKED(mus_error_hook)) result = run_or_hook(mus_error_hook, XEN_LIST_2(C_TO_XEN_INT(type), C_TO_XEN_STRING(msg)), S_mus_error_hook); return(XEN_NOT_FALSE_P(result)); }
static XEN g_mus_midi_describe(void) { #define H_mus_midi_describe "(" S_mus_midi_describe "): returns a description of the midi hardware" char *str; XEN res = XEN_FALSE; str = mus_midi_describe(); if (str) { res = C_TO_XEN_STRING(str); FREE(str); } return(res); }
static XEN g_listener_selection(void) { #define H_listener_selection "(" S_listener_selection "): currently selected text in listener or " PROC_FALSE XEN res = XEN_FALSE; if (listener_text) { char *txt; txt = XmTextGetSelection(listener_text); if (txt) { res = C_TO_XEN_STRING(txt); XtFree(txt); } } return(res); }