/*! \brief Exports the keymap in scheme to a GLib GArray. * \par Function Description * This function converts the list of key sequence/action pairs * returned by the scheme function \c dump-current-keymap into an * array of C structures. * * The returned value must be freed by caller. * * \return A GArray with keymap data. */ GArray* g_keys_dump_keymap (void) { SCM dump_proc = scm_c_lookup ("dump-current-keymap"); SCM scm_ret; GArray *ret = NULL; struct keyseq_action_t { gchar *keyseq, *action; }; dump_proc = scm_variable_ref (dump_proc); g_return_val_if_fail (SCM_NFALSEP (scm_procedure_p (dump_proc)), NULL); scm_ret = scm_call_0 (dump_proc); g_return_val_if_fail (SCM_CONSP (scm_ret), NULL); ret = g_array_sized_new (FALSE, FALSE, sizeof (struct keyseq_action_t), (guint)scm_ilength (scm_ret)); for (; scm_ret != SCM_EOL; scm_ret = SCM_CDR (scm_ret)) { SCM scm_keymap_entry = SCM_CAR (scm_ret); struct keyseq_action_t keymap_entry; g_return_val_if_fail (SCM_CONSP (scm_keymap_entry) && scm_is_symbol (SCM_CAR (scm_keymap_entry)) && scm_is_string (SCM_CDR (scm_keymap_entry)), ret); keymap_entry.action = g_strdup (SCM_SYMBOL_CHARS (SCM_CAR (scm_keymap_entry))); keymap_entry.keyseq = g_strdup (SCM_STRING_CHARS (SCM_CDR (scm_keymap_entry))); ret = g_array_append_val (ret, keymap_entry); } return ret; }
SWIGINTERN int SWIG_Guile_GetArgs (SCM *dest, SCM rest, int reqargs, int optargs, const char *procname) { int i; int num_args_passed = 0; for (i = 0; i<reqargs; i++) { if (!SCM_CONSP(rest)) scm_wrong_num_args(scm_from_locale_string((char *) procname)); *dest++ = SCM_CAR(rest); rest = SCM_CDR(rest); num_args_passed++; } for (i = 0; i<optargs && SCM_CONSP(rest); i++) { *dest++ = SCM_CAR(rest); rest = SCM_CDR(rest); num_args_passed++; } for (; i<optargs; i++) *dest++ = SCM_UNDEFINED; if (!SCM_NULLP(rest)) scm_wrong_num_args(scm_from_locale_string((char *) procname)); return num_args_passed; }
/*! \todo Finish function documentation!!! * \brief * \par Function Description * */ SCM g_rc_add_menu(SCM menu_name, SCM menu_items) { SCM_ASSERT (scm_is_string (menu_name), menu_name, SCM_ARG1, "add-menu"); SCM_ASSERT (SCM_NIMP (menu_items) && SCM_CONSP (menu_items), menu_items, SCM_ARG2, "add-menu"); s_menu_add_entry(SCM_STRING_CHARS (menu_name), menu_items); return SCM_BOOL_T; }
/*! \todo Finish function documentation!!! * \brief * \par Function Description * */ SCM g_rc_add_menu(SCM scm_menu_name, SCM scm_menu_items) { char *menu_name; SCM_ASSERT (scm_is_string (scm_menu_name), scm_menu_name, SCM_ARG1, "add-menu"); SCM_ASSERT (SCM_NIMP (scm_menu_items) && SCM_CONSP (scm_menu_items), scm_menu_items, SCM_ARG2, "add-menu"); menu_name = scm_to_utf8_string (scm_menu_name); s_menu_add_entry(menu_name, scm_menu_items); free (menu_name); return SCM_BOOL_T; }
int scm_is_pair(SCM x) { return SCM_CONSP (x); }