/********************************************************************\ * gnc_guile_call1_to_string * * returns the malloc'ed string returned by the guile function * * or NULL if it can't be retrieved * * * * Args: func - the guile function to call * * arg - the single function argument * * Returns: g_malloc'ed char * or NULL * \********************************************************************/ char * gnc_guile_call1_to_string(SCM func, SCM arg) { SCM value; if (scm_is_procedure(func)) { value = scm_call_1(func, arg); if (scm_is_string(value)) { return gnc_scm_to_locale_string(value); } else { PERR("bad value\n"); } } else { PERR("not a procedure\n"); } return NULL; }
/********************************************************************\ * gnc_split_scm_get_action * * return the newly allocated action of a scheme split, or NULL. * * * * Args: split_scm - the scheme split * * Returns: newly allocated action string * \********************************************************************/ char * gnc_split_scm_get_action(SCM split_scm) { SCM result; initialize_scm_functions(); if (!gnc_is_split_scm(split_scm)) return NULL; result = scm_call_1(getters.split_scm_action, split_scm); if (!scm_is_string(result)) return NULL; return gnc_scm_to_locale_string(result); }
GSList * gnc_scm_to_gslist_string(SCM list) { GSList *gslist = NULL; while (!scm_is_null (list)) { if (scm_is_string(SCM_CAR(list))) { gchar * str; str = gnc_scm_to_locale_string (SCM_CAR(list)); if (str) gslist = g_slist_prepend (gslist, g_strdup (str)); g_free (str); } list = SCM_CDR (list); } return g_slist_reverse (gslist); }
/********************************************************************\ * gnc_get_credit_string * * return a credit string for a given account type * * * * Args: account_type - type of account to get credit string for * * Return: g_malloc'd credit string or NULL * \********************************************************************/ char * gnc_get_credit_string(GNCAccountType account_type) { const gchar *string; SCM result; SCM arg; initialize_scm_functions(); if (gnc_gconf_get_bool(GCONF_GENERAL, KEY_ACCOUNTING_LABELS, NULL)) return g_strdup(_("Credit")); if ((account_type < ACCT_TYPE_NONE) || (account_type >= NUM_ACCOUNT_TYPES)) account_type = ACCT_TYPE_NONE; arg = scm_long2num(account_type); result = scm_call_1(getters.credit_string, arg); if (!scm_is_string(result)) return NULL; return gnc_scm_to_locale_string(result); }