diff --git a/src/app-utils/app-utils.i b/src/app-utils/app-utils.i index 435430e2b0..ea5eb3b0e2 100644 --- a/src/app-utils/app-utils.i +++ b/src/app-utils/app-utils.i @@ -91,13 +91,13 @@ void gnc_register_kvp_option_generator(QofIdType id_type, SCM generator); %typemap(in) GList * { SCM path_scm = $input; GList *path = NULL; - while (!SCM_NULLP (path_scm)) + while (!scm_is_null (path_scm)) { SCM key_scm = SCM_CAR (path_scm); char *key; - if (!SCM_STRINGP (key_scm)) + if (!scm_is_string (key_scm)) break; - key = g_strdup (SCM_STRING_CHARS (key_scm)); + key = g_strdup (scm_to_locale_string (key_scm)); path = g_list_prepend (path, key); path_scm = SCM_CDR (path_scm); } diff --git a/src/app-utils/file-utils.c b/src/app-utils/file-utils.c index 3054ff7583..24485a5b1b 100644 --- a/src/app-utils/file-utils.c +++ b/src/app-utils/file-utils.c @@ -60,8 +60,8 @@ gncFindFile (const char * filename) scm_filename = scm_makfrom0str ((char *) filename); scm_result = scm_call_1(find_doc_file, scm_filename); - if (SCM_STRINGP(scm_result)) - full_filename = SCM_STRING_CHARS(scm_result); + if (scm_is_string(scm_result)) + full_filename = scm_to_locale_string(scm_result); return g_strdup (full_filename); } diff --git a/src/app-utils/gfec.c b/src/app-utils/gfec.c index 3b47956b06..ecd331643c 100644 --- a/src/app-utils/gfec.c +++ b/src/app-utils/gfec.c @@ -25,14 +25,14 @@ gfec_catcher(void *data, SCM tag, SCM throw_args) { SCM func; SCM result; - char *msg = NULL; + const char *msg = NULL; func = scm_c_eval_string("gnc:error->string"); - if (SCM_PROCEDUREP(func)) + if (scm_is_procedure(func)) { result = scm_call_2(func, tag, throw_args); - if (SCM_STRINGP(result)) - msg = SCM_STRING_CHARS(result); + if (scm_is_string(result)) + msg = scm_to_locale_string(result); } if (msg == NULL) diff --git a/src/app-utils/gnc-exp-parser.c b/src/app-utils/gnc-exp-parser.c index 642fec7854..7b8f271c2c 100644 --- a/src/app-utils/gnc-exp-parser.c +++ b/src/app-utils/gnc-exp-parser.c @@ -350,7 +350,7 @@ func_op(const char *fname, int argc, void **argv) (scm_t_catch_body)scm_c_eval_string, realFnName->str, scm_handle_by_message_noexit, NULL); g_string_free( realFnName, TRUE ); - if (!SCM_PROCEDUREP(scmFn)) + if (!scm_is_procedure(scmFn)) { /* FIXME: handle errors correctly. */ printf( "gnc:\"%s\" is not a scm procedure\n", fname ); diff --git a/src/app-utils/gnc-helpers.c b/src/app-utils/gnc-helpers.c index 22e9ef73e6..8b9879bc23 100644 --- a/src/app-utils/gnc-helpers.c +++ b/src/app-utils/gnc-helpers.c @@ -75,22 +75,22 @@ gnc_scm2printinfo(SCM info_scm) G_STRFUNC); info_scm = SCM_CDR (info_scm); - info.use_separators = SCM_NFALSEP (SCM_CAR (info_scm)); + info.use_separators = scm_is_true (SCM_CAR (info_scm)); info_scm = SCM_CDR (info_scm); - info.use_symbol = SCM_NFALSEP (SCM_CAR (info_scm)); + info.use_symbol = scm_is_true (SCM_CAR (info_scm)); info_scm = SCM_CDR (info_scm); - info.use_locale = SCM_NFALSEP (SCM_CAR (info_scm)); + info.use_locale = scm_is_true (SCM_CAR (info_scm)); info_scm = SCM_CDR (info_scm); - info.monetary = SCM_NFALSEP (SCM_CAR (info_scm)); + info.monetary = scm_is_true (SCM_CAR (info_scm)); info_scm = SCM_CDR (info_scm); - info.force_fit = SCM_NFALSEP (SCM_CAR (info_scm)); + info.force_fit = scm_is_true (SCM_CAR (info_scm)); info_scm = SCM_CDR (info_scm); - info.round = SCM_NFALSEP (SCM_CAR (info_scm)); + info.round = scm_is_true (SCM_CAR (info_scm)); return info; } @@ -100,11 +100,11 @@ gnc_printinfo_p(SCM info_scm) { const gchar *symbol; - if (!SCM_LISTP(info_scm) || SCM_NULLP(info_scm)) + if (!scm_is_list(info_scm) || scm_is_null(info_scm)) return 0; info_scm = SCM_CAR (info_scm); - if (!SCM_SYMBOLP (info_scm)) + if (!scm_is_symbol (info_scm)) return 0; symbol = SCM_SYMBOL_CHARS (info_scm); diff --git a/src/app-utils/gnc-ui-util.c b/src/app-utils/gnc-ui-util.c index 095a400298..008a13b661 100644 --- a/src/app-utils/gnc-ui-util.c +++ b/src/app-utils/gnc-ui-util.c @@ -526,8 +526,8 @@ gnc_ui_account_get_tax_info_string (const Account *account) ("(false-if-exception gnc:txf-get-description)"); } - g_return_val_if_fail (SCM_PROCEDUREP (get_form), NULL); - g_return_val_if_fail (SCM_PROCEDUREP (get_desc), NULL); + g_return_val_if_fail (scm_is_procedure (get_form), NULL); + g_return_val_if_fail (scm_is_procedure (get_desc), NULL); category = scm_c_eval_string (atype == ACCT_TYPE_INCOME ? "txf-income-categories" : @@ -559,7 +559,7 @@ gnc_ui_account_get_tax_info_string (const Account *account) code_scm = scm_str2symbol (code); scm = scm_call_3 (get_form, category, code_scm, tax_entity_type); - if (!SCM_STRINGP (scm)) + if (!scm_is_string (scm)) { if (tax_related) return g_strdup_printf @@ -569,7 +569,7 @@ gnc_ui_account_get_tax_info_string (const Account *account) (_("Not tax-related; invalid code %s for tax type %s"), code, tax_type); } - form = SCM_STRING_CHARS (scm); + form = scm_to_locale_string (scm); if (!form) { if (tax_related) @@ -581,7 +581,7 @@ gnc_ui_account_get_tax_info_string (const Account *account) } scm = scm_call_3 (get_desc, category, code_scm, tax_entity_type); - if (!SCM_STRINGP (scm)) + if (!scm_is_string (scm)) { if (tax_related) return g_strdup_printf @@ -593,7 +593,7 @@ gnc_ui_account_get_tax_info_string (const Account *account) form, code, tax_type); } - desc = SCM_STRING_CHARS (scm); + desc = scm_to_locale_string (scm); if (!desc) { if (tax_related) diff --git a/src/app-utils/guile-util.c b/src/app-utils/guile-util.c index 96a9f36706..f6d932cbb8 100644 --- a/src/app-utils/guile-util.c +++ b/src/app-utils/guile-util.c @@ -154,12 +154,12 @@ gnc_guile_call1_to_string(SCM func, SCM arg) { SCM value; - if (SCM_PROCEDUREP(func)) + if (scm_is_procedure(func)) { value = scm_call_1(func, arg); - if (SCM_STRINGP(value)) - return g_strdup(SCM_STRING_CHARS(value)); + if (scm_is_string(value)) + return g_strdup(scm_to_locale_string(value)); else { PERR("bad value\n"); @@ -189,11 +189,11 @@ gnc_guile_call1_symbol_to_string(SCM func, SCM arg) { SCM value; - if (SCM_PROCEDUREP(func)) + if (scm_is_procedure(func)) { value = scm_call_1(func, arg); - if (SCM_SYMBOLP(value)) + if (scm_is_symbol(value)) return g_strdup(SCM_SYMBOL_CHARS(value)); else { @@ -223,11 +223,11 @@ gnc_guile_call1_to_procedure(SCM func, SCM arg) { SCM value; - if (SCM_PROCEDUREP(func)) + if (scm_is_procedure(func)) { value = scm_call_1(func, arg); - if (SCM_PROCEDUREP(value)) + if (scm_is_procedure(value)) return value; else { @@ -257,11 +257,11 @@ gnc_guile_call1_to_list(SCM func, SCM arg) { SCM value; - if (SCM_PROCEDUREP(func)) + if (scm_is_procedure(func)) { value = scm_call_1(func, arg); - if (SCM_LISTP(value)) + if (scm_is_list(value)) return value; else { @@ -291,11 +291,11 @@ gnc_guile_call1_to_vector(SCM func, SCM arg) { SCM value; - if (SCM_PROCEDUREP(func)) + if (scm_is_procedure(func)) { value = scm_call_1(func, arg); - if (SCM_VECTORP(value)) + if (scm_is_vector(value)) return value; else { @@ -393,7 +393,7 @@ gnc_copy_split(Split *split, gboolean use_cut_semantics) return SCM_UNDEFINED; func = scm_c_eval_string("gnc:split->split-scm"); - if (!SCM_PROCEDUREP(func)) + if (!scm_is_procedure(func)) return SCM_UNDEFINED; if (!split_type) @@ -431,15 +431,15 @@ gnc_copy_split_scm_onto_split(SCM split_scm, Split *split, g_return_if_fail (book); func = scm_c_eval_string("gnc:split-scm?"); - if (!SCM_PROCEDUREP(func)) + if (!scm_is_procedure(func)) return; result = scm_call_1(func, split_scm); - if (!SCM_NFALSEP(result)) + if (!scm_is_true(result)) return; func = scm_c_eval_string("gnc:split-scm-onto-split"); - if (!SCM_PROCEDUREP(func)) + if (!scm_is_procedure(func)) return; if (!split_type) @@ -463,7 +463,7 @@ gnc_is_split_scm(SCM scm) { initialize_scm_functions(); - return SCM_NFALSEP(scm_call_1(predicates.is_split_scm, scm)); + return scm_is_true(scm_call_1(predicates.is_split_scm, scm)); } @@ -479,7 +479,7 @@ gnc_is_trans_scm(SCM scm) { initialize_scm_functions(); - return SCM_NFALSEP(scm_call_1(predicates.is_trans_scm, scm)); + return scm_is_true(scm_call_1(predicates.is_trans_scm, scm)); } @@ -654,10 +654,10 @@ gnc_split_scm_get_memo(SCM split_scm) return NULL; result = scm_call_1(getters.split_scm_memo, split_scm); - if (!SCM_STRINGP(result)) + if (!scm_is_string(result)) return NULL; - return g_strdup(SCM_STRING_CHARS(result)); + return g_strdup(scm_to_locale_string(result)); } @@ -679,10 +679,10 @@ gnc_split_scm_get_action(SCM split_scm) return NULL; result = scm_call_1(getters.split_scm_action, split_scm); - if (!SCM_STRINGP(result)) + if (!scm_is_string(result)) return NULL; - return g_strdup(SCM_STRING_CHARS(result)); + return g_strdup(scm_to_locale_string(result)); } @@ -756,7 +756,7 @@ gnc_copy_trans(Transaction *trans, gboolean use_cut_semantics) return SCM_UNDEFINED; func = scm_c_eval_string("gnc:transaction->transaction-scm"); - if (!SCM_PROCEDUREP(func)) + if (!scm_is_procedure(func)) return SCM_UNDEFINED; if (!trans_type) @@ -821,15 +821,15 @@ gnc_copy_trans_scm_onto_trans_swap_accounts(SCM trans_scm, g_return_if_fail (book); func = scm_c_eval_string("gnc:transaction-scm?"); - if (!SCM_PROCEDUREP(func)) + if (!scm_is_procedure(func)) return; result = scm_call_1(func, trans_scm); - if (!SCM_NFALSEP(result)) + if (!scm_is_true(result)) return; func = scm_c_eval_string("gnc:transaction-scm-onto-transaction"); - if (!SCM_PROCEDUREP(func)) + if (!scm_is_procedure(func)) return; if (!trans_type) @@ -1077,7 +1077,7 @@ gnc_trans_scm_get_num_splits(SCM trans_scm) result = scm_call_1(getters.trans_scm_split_scms, trans_scm); - if (!SCM_LISTP(result)) + if (!scm_is_list(result)) return 0; return SCM_LENGTH(result); @@ -1109,10 +1109,10 @@ gnc_get_debit_string(GNCAccountType account_type) arg = scm_long2num(account_type); result = scm_call_1(getters.debit_string, arg); - if (!SCM_STRINGP(result)) + if (!scm_is_string(result)) return NULL; - string = SCM_STRING_CHARS(result); + string = scm_to_locale_string(result); if (string) return g_strdup(string); return NULL; @@ -1144,10 +1144,10 @@ gnc_get_credit_string(GNCAccountType account_type) arg = scm_long2num(account_type); result = scm_call_1(getters.credit_string, arg); - if (!SCM_STRINGP(result)) + if (!scm_is_string(result)) return NULL; - string = SCM_STRING_CHARS(result); + string = scm_to_locale_string(result); if (string) return g_strdup(string); return NULL; diff --git a/src/app-utils/option-util.c b/src/app-utils/option-util.c index 26066f4086..654e7e67f3 100644 --- a/src/app-utils/option-util.c +++ b/src/app-utils/option-util.c @@ -290,7 +290,7 @@ gnc_option_db_load_from_kvp(GNCOptionDB* odb, kvp_frame *slots) if (kvp_to_scm == SCM_UNDEFINED) { kvp_to_scm = scm_c_eval_string("gnc:options-kvp->scm"); - if (!SCM_PROCEDUREP (kvp_to_scm)) + if (!scm_is_procedure (kvp_to_scm)) { PERR ("not a procedure\n"); kvp_to_scm = SCM_UNDEFINED; @@ -324,7 +324,7 @@ gnc_option_db_save_to_kvp(GNCOptionDB* odb, kvp_frame *slots) if (scm_to_kvp == SCM_UNDEFINED) { scm_to_kvp = scm_c_eval_string("gnc:options-scm->kvp"); - if (!SCM_PROCEDUREP (scm_to_kvp)) + if (!scm_is_procedure (scm_to_kvp)) { PERR ("not a procedure\n"); scm_to_kvp = SCM_UNDEFINED; @@ -450,7 +450,7 @@ gnc_option_db_register_change_callback(GNCOptionDB *odb, /* Get the register procedure */ register_proc = scm_c_eval_string("gnc:options-register-c-callback"); - if (!SCM_PROCEDUREP(register_proc)) + if (!scm_is_procedure(register_proc)) { PERR("not a procedure\n"); return SCM_UNDEFINED; @@ -515,7 +515,7 @@ gnc_option_db_unregister_change_callback_id(GNCOptionDB *odb, SCM callback_id) return; proc = scm_c_eval_string("gnc:options-unregister-callback-id"); - if (!SCM_PROCEDUREP(proc)) + if (!scm_is_procedure(proc)) { PERR("not a procedure\n"); return; @@ -536,7 +536,7 @@ gnc_call_option_change_callbacks(GNCOptionDB *odb) SCM proc; proc = scm_c_eval_string("gnc:options-run-callbacks"); - if (!SCM_PROCEDUREP(proc)) + if (!scm_is_procedure(proc)) { PERR("not a procedure\n"); return; @@ -764,12 +764,12 @@ gnc_option_widget_changed_proc_getter(GNCOption *option) initialize_getters(); - if ( SCM_PROCEDUREP( getters.option_widget_changed_cb ) ) + if ( scm_is_procedure( getters.option_widget_changed_cb ) ) { /* call the callback function getter to get the actual callback function */ cb = scm_call_1(getters.option_widget_changed_cb, option->guile_option); - if ( SCM_PROCEDUREP( cb ) ) /* a callback exists */ + if ( scm_is_procedure( cb ) ) /* a callback exists */ { return( cb ); } @@ -829,7 +829,7 @@ gnc_option_num_permissible_values(GNCOption *option) value = scm_call_1(getters.number_of_indices, option->guile_option); - if (SCM_EXACTP(value)) + if (scm_is_exact(value)) { return scm_num2int(value, SCM_ARG1, G_STRFUNC); } @@ -916,10 +916,10 @@ gnc_option_permissible_value_name(GNCOption *option, int index) scm_int2num(index)); if (name == SCM_UNDEFINED) return NULL; - if (!SCM_STRINGP(name)) + if (!scm_is_string(name)) return NULL; - return g_strdup(SCM_STRING_CHARS(name)); + return g_strdup(scm_to_locale_string(name)); } @@ -947,10 +947,10 @@ gnc_option_permissible_value_description(GNCOption *option, int index) scm_int2num(index)); if (help == SCM_UNDEFINED) return NULL; - if (!SCM_STRINGP(help)) + if (!scm_is_string(help)) return NULL; - return g_strdup(SCM_STRING_CHARS(help)); + return g_strdup(scm_to_locale_string(help)); } @@ -971,7 +971,7 @@ gnc_option_show_time(GNCOption *option) value = scm_call_1(getters.date_option_show_time, option->guile_option); - return SCM_NFALSEP(value); + return scm_is_true(value); } /********************************************************************\ @@ -1007,7 +1007,7 @@ gnc_option_multiple_selection(GNCOption *option) pair = scm_call_1(getters.option_data, option->guile_option); - return !SCM_NFALSEP(scm_not(SCM_CAR(pair))); + return !scm_is_true(scm_not(SCM_CAR(pair))); } /********************************************************************\ @@ -1031,7 +1031,7 @@ gnc_option_get_account_type_list(GNCOption *option) pair = scm_call_1(getters.option_data, option->guile_option); lst = SCM_CDR(pair); - while (!SCM_NULLP (lst)) + while (!scm_is_null (lst)) { GNCAccountType type; SCM item; @@ -1040,7 +1040,7 @@ gnc_option_get_account_type_list(GNCOption *option) item = SCM_CAR (lst); lst = SCM_CDR (lst); - if (SCM_FALSEP (scm_integer_p (item))) + if (scm_is_false (scm_integer_p (item))) { PERR ("Invalid type"); } @@ -1077,40 +1077,40 @@ gboolean gnc_option_get_range_info(GNCOption *option, list = scm_call_1(getters.option_data, option->guile_option); - if (!SCM_LISTP(list) || SCM_NULLP(list)) + if (!scm_is_list(list) || scm_is_null(list)) return FALSE; /* lower bound */ value = SCM_CAR(list); list = SCM_CDR(list); - if (!SCM_NUMBERP(value)) + if (!scm_is_number(value)) return FALSE; if (lower_bound != NULL) *lower_bound = scm_num2dbl(value, G_STRFUNC); - if (!SCM_LISTP(list) || SCM_NULLP(list)) + if (!scm_is_list(list) || scm_is_null(list)) return FALSE; /* upper bound */ value = SCM_CAR(list); list = SCM_CDR(list); - if (!SCM_NUMBERP(value)) + if (!scm_is_number(value)) return FALSE; if (upper_bound != NULL) *upper_bound = scm_num2dbl(value, G_STRFUNC); - if (!SCM_LISTP(list) || SCM_NULLP(list)) + if (!scm_is_list(list) || scm_is_null(list)) return FALSE; /* number of decimals */ value = SCM_CAR(list); list = SCM_CDR(list); - if (!SCM_NUMBERP(value)) + if (!scm_is_number(value)) return FALSE; /* Guile-1.6 returns this as a double, so let's use that in all cases. @@ -1122,14 +1122,14 @@ gboolean gnc_option_get_range_info(GNCOption *option, *num_decimals = (int)decimals; } - if (!SCM_LISTP(list) || SCM_NULLP(list)) + if (!scm_is_list(list) || scm_is_null(list)) return FALSE; /* step size */ value = SCM_CAR(list); list = SCM_CDR(list); - if (!SCM_NUMBERP(value)) + if (!scm_is_number(value)) return FALSE; if (step_size != NULL) @@ -1156,11 +1156,11 @@ gnc_option_color_range(GNCOption *option) initialize_getters(); list = scm_call_1(getters.option_data, option->guile_option); - if (!SCM_LISTP(list) || SCM_NULLP(list)) + if (!scm_is_list(list) || scm_is_null(list)) return 0.0; value = SCM_CAR(list); - if (!SCM_NUMBERP(value)) + if (!scm_is_number(value)) return 0.0; return scm_num2dbl(value, G_STRFUNC); @@ -1184,18 +1184,18 @@ gnc_option_use_alpha(GNCOption *option) initialize_getters(); list = scm_call_1(getters.option_data, option->guile_option); - if (!SCM_LISTP(list) || SCM_NULLP(list)) + if (!scm_is_list(list) || scm_is_null(list)) return FALSE; list = SCM_CDR(list); - if (!SCM_LISTP(list) || SCM_NULLP(list)) + if (!scm_is_list(list) || scm_is_null(list)) return FALSE; value = SCM_CAR(list); - if (!SCM_BOOLP(value)) + if (!scm_is_bool(value)) return FALSE; - return SCM_NFALSEP(value); + return scm_is_true(value); } @@ -1267,7 +1267,7 @@ gnc_option_get_color_info(GNCOption *option, return FALSE; value = scm_call_0(getter); - if (!SCM_LISTP(value) || SCM_NULLP(value) || !SCM_NUMBERP(SCM_CAR(value))) + if (!scm_is_list(value) || scm_is_null(value) || !scm_is_number(SCM_CAR(value))) return FALSE; scale = gnc_option_color_range(option); @@ -1281,7 +1281,7 @@ gnc_option_get_color_info(GNCOption *option, *red = MIN(1.0, rgba * scale); value = SCM_CDR(value); - if (!SCM_LISTP(value) || SCM_NULLP(value) || !SCM_NUMBERP(SCM_CAR(value))) + if (!scm_is_list(value) || scm_is_null(value) || !scm_is_number(SCM_CAR(value))) return FALSE; rgba = scm_num2dbl(SCM_CAR(value), G_STRFUNC); @@ -1289,7 +1289,7 @@ gnc_option_get_color_info(GNCOption *option, *green = MIN(1.0, rgba * scale); value = SCM_CDR(value); - if (!SCM_LISTP(value) || SCM_NULLP(value) || !SCM_NUMBERP(SCM_CAR(value))) + if (!scm_is_list(value) || scm_is_null(value) || !scm_is_number(SCM_CAR(value))) return FALSE; rgba = scm_num2dbl(SCM_CAR(value), G_STRFUNC); @@ -1297,7 +1297,7 @@ gnc_option_get_color_info(GNCOption *option, *blue = MIN(1.0, rgba * scale); value = SCM_CDR(value); - if (!SCM_LISTP(value) || SCM_NULLP(value) || !SCM_NUMBERP(SCM_CAR(value))) + if (!scm_is_list(value) || scm_is_null(value) || !scm_is_number(SCM_CAR(value))) return FALSE; rgba = scm_num2dbl(SCM_CAR(value), G_STRFUNC); @@ -1649,18 +1649,18 @@ gnc_option_valid_value(GNCOption *option, SCM value) validator = gnc_option_value_validator(option); result = scm_call_1(validator, value); - if (!SCM_LISTP(result) || SCM_NULLP(result)) + if (!scm_is_list(result) || scm_is_null(result)) return SCM_UNDEFINED; ok = SCM_CAR(result); - if (!SCM_BOOLP(ok)) + if (!scm_is_bool(ok)) return SCM_UNDEFINED; - if (!SCM_NFALSEP(ok)) + if (!scm_is_true(ok)) return SCM_UNDEFINED; result = SCM_CDR(result); - if (!SCM_LISTP(result) || SCM_NULLP(result)) + if (!scm_is_list(result) || scm_is_null(result)) return SCM_UNDEFINED; return SCM_CAR(result); @@ -1681,7 +1681,7 @@ gnc_commit_option(GNCOption *option) validator = gnc_option_value_validator(option); result = scm_call_1(validator, value); - if (!SCM_LISTP(result) || SCM_NULLP(result)) + if (!scm_is_list(result) || scm_is_null(result)) { PERR("bad validation result\n"); return; @@ -1689,13 +1689,13 @@ gnc_commit_option(GNCOption *option) /* First element determines validity */ ok = SCM_CAR(result); - if (!SCM_BOOLP(ok)) + if (!scm_is_bool(ok)) { PERR("bad validation result\n"); return; } - if (SCM_NFALSEP(ok)) + if (scm_is_true(ok)) { /* Second element is value to use */ value = SCM_CADR(result); @@ -1715,13 +1715,13 @@ gnc_commit_option(GNCOption *option) /* Second element is error message */ oops = SCM_CADR(result); - if (!SCM_STRINGP(oops)) + if (!scm_is_string(oops)) { PERR("bad validation result\n"); return; } - message = SCM_STRING_CHARS(oops); + message = scm_to_locale_string(oops); name = gnc_option_name(option); section = gnc_option_section(option); @@ -1907,14 +1907,14 @@ gnc_option_db_get_default_section(GNCOptionDB *odb) return NULL; getter = scm_c_eval_string("gnc:options-get-default-section"); - if (!SCM_PROCEDUREP(getter)) + if (!scm_is_procedure(getter)) return NULL; value = scm_call_1(getter, odb->guile_options); - if (!SCM_STRINGP(value)) + if (!scm_is_string(value)) return NULL; - return g_strdup(SCM_STRING_CHARS(value)); + return g_strdup(scm_to_locale_string(value)); } @@ -1982,8 +1982,8 @@ gnc_option_db_lookup_boolean_option(GNCOptionDB *odb, value = scm_call_0(getter); - if (SCM_BOOLP(value)) - return SCM_NFALSEP(value); + if (scm_is_bool(value)) + return scm_is_true(value); else return default_value; } @@ -2019,8 +2019,8 @@ gnc_option_db_lookup_string_option(GNCOptionDB *odb, if (getter != SCM_UNDEFINED) { value = scm_call_0(getter); - if (SCM_STRINGP(value)) - return g_strdup(SCM_STRING_CHARS(value)); + if (scm_is_string(value)) + return g_strdup(scm_to_locale_string(value)); } } @@ -2084,7 +2084,7 @@ gnc_option_db_lookup_multichoice_option(GNCOptionDB *odb, if (getter != SCM_UNDEFINED) { value = scm_call_0(getter); - if (SCM_SYMBOLP(value)) + if (scm_is_symbol(value)) return g_strdup(SCM_SYMBOL_CHARS(value)); } } @@ -2161,7 +2161,7 @@ gnc_option_db_lookup_date_option(GNCOptionDB *odb, { value = scm_call_0(getter); - if (SCM_CONSP(value)) + if (scm_is_pair(value)) { Timespec absolute; @@ -2231,7 +2231,7 @@ gnc_option_db_lookup_number_option(GNCOptionDB *odb, if (getter != SCM_UNDEFINED) { value = scm_call_0(getter); - if (SCM_NUMBERP(value)) + if (scm_is_number(value)) return scm_num2dbl(value, G_STRFUNC); } } @@ -2328,12 +2328,12 @@ gnc_option_db_lookup_list_option(GNCOptionDB *odb, return default_value; value = scm_call_0(getter); - while (SCM_LISTP(value) && !SCM_NULLP(value)) + while (scm_is_list(value) && !scm_is_null(value)) { item = SCM_CAR(value); value = SCM_CDR(value); - if (!SCM_SYMBOLP(item)) + if (!scm_is_symbol(item)) { gnc_free_list_option_value(list); @@ -2343,7 +2343,7 @@ gnc_option_db_lookup_list_option(GNCOptionDB *odb, list = g_slist_prepend(list, g_strdup(SCM_SYMBOL_CHARS(item))); } - if (!SCM_LISTP(value) || !SCM_NULLP(value)) + if (!scm_is_list(value) || !scm_is_null(value)) { gnc_free_list_option_value(list); @@ -2601,7 +2601,7 @@ gnc_option_date_option_get_subtype(GNCOption *option) value = scm_call_1(getters.date_option_subtype, option->guile_option); - if (SCM_SYMBOLP(value)) + if (scm_is_symbol(value)) return g_strdup(SCM_SYMBOL_CHARS(value)); else return NULL; @@ -2622,7 +2622,7 @@ gnc_date_option_value_get_type (SCM option_value) initialize_getters(); value = scm_call_1 (getters.date_option_value_type, option_value); - if (!SCM_SYMBOLP (value)) + if (!scm_is_symbol (value)) return NULL; return g_strdup(SCM_SYMBOL_CHARS (value)); @@ -2703,7 +2703,7 @@ gboolean gnc_dateformat_option_value_parse(SCM value, QofDateFormat *format, SCM val; const char *str; - if (!SCM_LISTP(value) || SCM_NULLP(value)) + if (!scm_is_list(value) || scm_is_null(value)) return TRUE; do @@ -2712,7 +2712,7 @@ gboolean gnc_dateformat_option_value_parse(SCM value, QofDateFormat *format, /* Parse the format */ val = SCM_CAR(value); value = SCM_CDR(value); - if (!SCM_SYMBOLP(val)) + if (!scm_is_symbol(val)) break; str = SCM_SYMBOL_CHARS (val); if (!str) @@ -2729,7 +2729,7 @@ gboolean gnc_dateformat_option_value_parse(SCM value, QofDateFormat *format, /* parse the months */ val = SCM_CAR(value); value = SCM_CDR(value); - if (!SCM_SYMBOLP(val)) + if (!scm_is_symbol(val)) break; str = SCM_SYMBOL_CHARS (val); if (!str) @@ -2746,22 +2746,22 @@ gboolean gnc_dateformat_option_value_parse(SCM value, QofDateFormat *format, /* parse the years */ val = SCM_CAR(value); value = SCM_CDR(value); - if (!SCM_BOOLP(val)) + if (!scm_is_bool(val)) break; if (years) - *years = SCM_NFALSEP(val); + *years = scm_is_true(val); /* parse the custom */ val = SCM_CAR(value); value = SCM_CDR(value); - if (!SCM_STRINGP(val)) + if (!scm_is_string(val)) break; - if (!SCM_NULLP(value)) + if (!scm_is_null(value)) break; if (custom) - *custom = g_strdup(SCM_STRING_CHARS(val)); + *custom = g_strdup(scm_to_locale_string(val)); return FALSE; diff --git a/src/app-utils/test/test-print-queries.c b/src/app-utils/test/test-print-queries.c index 924204ae6c..3e5073ce52 100644 --- a/src/app-utils/test/test-print-queries.c +++ b/src/app-utils/test/test-print-queries.c @@ -39,7 +39,7 @@ run_tests (int count) int i; val2str = scm_c_eval_string ("gnc:value->string"); - g_return_if_fail (SCM_PROCEDUREP (val2str)); + g_return_if_fail (scm_is_procedure (val2str)); for (i = 0; i < count; i++) { diff --git a/src/app-utils/test/test-scm-query-string.c b/src/app-utils/test/test-scm-query-string.c index da400b6ee3..79f3d4f43f 100644 --- a/src/app-utils/test/test-scm-query-string.c +++ b/src/app-utils/test/test-scm-query-string.c @@ -30,7 +30,7 @@ test_query (Query *q, SCM val2str) args = scm_cons (scm_makfrom0str ("'"), scm_cons (str_q, SCM_EOL)); str_q = scm_string_append (args); - str = SCM_STRING_CHARS (str_q); + str = scm_to_locale_string (str_q); if (str) str2 = g_strdup(str); if (str2) { @@ -69,7 +69,7 @@ run_tests (void) int i; val2str = scm_c_eval_string ("gnc:value->string"); - g_return_if_fail (SCM_PROCEDUREP (val2str)); + g_return_if_fail (scm_is_procedure (val2str)); for (i = 0; i < 1000; i++) { diff --git a/src/base-typemaps.i b/src/base-typemaps.i index baac9f57c3..fbb69cb9b9 100644 --- a/src/base-typemaps.i +++ b/src/base-typemaps.i @@ -14,14 +14,14 @@ typedef char gchar; %typemap (out) char * { $result = scm_makfrom0str((const char *)$1); - if (!SCM_NFALSEP($result)) { + if (!scm_is_true($result)) { $result = scm_makstr(0, 0); } } %typemap(in) GNCPrintAmountInfo "$1 = gnc_scm2printinfo($input);" %typemap(out) GNCPrintAmountInfo "$result = gnc_printinfo2scm($1);" -%typemap(in) gboolean "$1 = SCM_NFALSEP($input) ? TRUE : FALSE;" +%typemap(in) gboolean "$1 = scm_is_true($input) ? TRUE : FALSE;" %typemap(out) gboolean "$result = $1 ? SCM_BOOL_T : SCM_BOOL_F;" %typemap(in) Timespec "$1 = gnc_timepair2timespec($input);" @@ -43,11 +43,11 @@ typedef char gchar; SCM list = $input; GList *c_list = NULL; - while (!SCM_NULLP(list)) { + while (!scm_is_null(list)) { void *p; SCM p_scm = SCM_CAR(list); - if (SCM_FALSEP(p_scm) || SCM_NULLP(p_scm)) + if (scm_is_false(p_scm) || scm_is_null(p_scm)) p = NULL; else p = SWIG_MustGetPtr(p_scm, ElemSwigType, 1, 0); diff --git a/src/bin/gnucash-bin.c b/src/bin/gnucash-bin.c index 22d3b337df..09b41c0880 100644 --- a/src/bin/gnucash-bin.c +++ b/src/bin/gnucash-bin.c @@ -409,7 +409,7 @@ inner_main_add_price_quotes(void *closure, int argc, char **argv) if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR) goto fail; qof_session_destroy(session); - if (!SCM_NFALSEP(scm_result)) { + if (!scm_is_true(scm_result)) { g_warning("Failed to add quotes to %s.", add_quotes_file); goto fail; } diff --git a/src/business/business-core/business-core.i b/src/business/business-core/business-core.i index 2665f7ef2d..8bf8a1846e 100644 --- a/src/business/business-core/business-core.i +++ b/src/business/business-core/business-core.i @@ -81,11 +81,11 @@ GLIST_HELPER_INOUT(GncTaxTableEntryList, SWIGTYPE_p__gncTaxTableEntry); SCM list = $input; GList *c_list = NULL; - while (!SCM_NULLP(list)) { + while (!scm_is_null(list)) { GncAccountValue *p; SCM p_scm = SCM_CAR(list); - if (SCM_FALSEP(p_scm) || SCM_NULLP(p_scm)) + if (scm_is_false(p_scm) || scm_is_null(p_scm)) p = NULL; else p = gnc_scm_to_account_value_ptr(p_scm); diff --git a/src/business/business-core/gncBusGuile.c b/src/business/business-core/gncBusGuile.c index 273bb46754..6d21222aaa 100644 --- a/src/business/business-core/gncBusGuile.c +++ b/src/business/business-core/gncBusGuile.c @@ -43,7 +43,7 @@ int gnc_account_value_pointer_p (SCM arg) { swig_type_info * account_type = get_acct_type(); - return (SCM_CONSP (arg) && + return (scm_is_pair (arg) && SWIG_IsPointerOfType(SCM_CAR (arg), account_type) && gnc_numeric_p (SCM_CDR (arg))); } diff --git a/src/business/business-gnome/dialog-invoice.c b/src/business/business-gnome/dialog-invoice.c index 686a3c2804..f3e8364a21 100644 --- a/src/business/business-gnome/dialog-invoice.c +++ b/src/business/business-gnome/dialog-invoice.c @@ -580,7 +580,7 @@ gnc_invoice_window_printCB (GtkWidget *widget, gpointer data) g_return_if_fail (invoice); func = scm_c_eval_string ("gnc:invoice-report-create"); - g_return_if_fail (SCM_PROCEDUREP (func)); + g_return_if_fail (scm_is_procedure (func)); arg = SWIG_NewPointerObj(invoice, SWIG_TypeQuery("_p__gncInvoice"), 0); args = scm_cons (arg, args); @@ -588,7 +588,7 @@ gnc_invoice_window_printCB (GtkWidget *widget, gpointer data) /* scm_gc_protect_object(func); */ arg = scm_apply (func, args, SCM_EOL); - g_return_if_fail (SCM_EXACTP (arg)); + g_return_if_fail (scm_is_exact (arg)); report_id = scm_num2int (arg, SCM_ARG1, G_STRFUNC); /* scm_gc_unprotect_object(func); */ @@ -846,7 +846,7 @@ void gnc_business_call_owner_report (GncOwner *owner, Account *acc) args = SCM_EOL; func = scm_c_eval_string ("gnc:owner-report-create"); - g_return_if_fail (SCM_PROCEDUREP (func)); + g_return_if_fail (scm_is_procedure (func)); if (acc) { swig_type_info * qtype = SWIG_TypeQuery("_p_Account"); @@ -865,7 +865,7 @@ void gnc_business_call_owner_report (GncOwner *owner, Account *acc) /* Apply the function to the args */ arg = scm_apply (func, args, SCM_EOL); - g_return_if_fail (SCM_EXACTP (arg)); + g_return_if_fail (scm_is_exact (arg)); id = scm_num2int (arg, SCM_ARG1, G_STRFUNC); if (id >= 0) diff --git a/src/engine/engine-helpers.c b/src/engine/engine-helpers.c index 1fe5af1f6b..18dc61b969 100644 --- a/src/engine/engine-helpers.c +++ b/src/engine/engine-helpers.c @@ -114,7 +114,7 @@ gnc_timepair2timespec(SCM x) int gnc_timepair_p(SCM x) { - return(SCM_CONSP(x) && + return(scm_is_pair(x) && gnc_gh_gint64_p(SCM_CAR(x)) && gnc_gh_gint64_p(SCM_CDR(x))); } @@ -136,11 +136,11 @@ gnc_scm2guid(SCM guid_scm) GUID guid; const gchar * str; - if (GUID_ENCODING_LENGTH != SCM_STRING_LENGTH (guid_scm)) + if (GUID_ENCODING_LENGTH != scm_i_string_length (guid_scm)) { return *guid_null(); } - str = SCM_STRING_CHARS (guid_scm); + str = scm_to_locale_string (guid_scm); string_to_guid(str, &guid); return guid; } @@ -151,14 +151,14 @@ gnc_guid_p(SCM guid_scm) GUID guid; const gchar * str; - if (!SCM_STRINGP(guid_scm)) + if (!scm_is_string(guid_scm)) return FALSE; - if (GUID_ENCODING_LENGTH != SCM_STRING_LENGTH (guid_scm)) + if (GUID_ENCODING_LENGTH != scm_i_string_length (guid_scm)) { return FALSE; } - str = SCM_STRING_CHARS (guid_scm); + str = scm_to_locale_string (guid_scm); return string_to_guid(str, &guid); } @@ -308,10 +308,10 @@ gnc_scm2bitfield (SCM field_scm) { int field = 0; - if (!SCM_LISTP (field_scm)) + if (!scm_is_list (field_scm)) return 0; - while (!SCM_NULLP (field_scm)) + while (!scm_is_null (field_scm)) { SCM scm; int bit; @@ -337,14 +337,14 @@ gnc_scm2balance_match_how (SCM how_scm, gboolean *resp) { const gchar *how; - if (!SCM_LISTP (how_scm)) + if (!scm_is_list (how_scm)) return FALSE; - if (SCM_NULLP (how_scm)) + if (scm_is_null (how_scm)) return FALSE; /* Only allow a single-entry list */ - if (!SCM_NULLP (SCM_CDR (how_scm))) + if (!scm_is_null (SCM_CDR (how_scm))) return FALSE; how = SCM_SYMBOL_CHARS (SCM_CAR(how_scm)); @@ -363,7 +363,7 @@ gnc_scm2kvp_match_where (SCM where_scm) QofIdType res; const gchar *where; - if (!SCM_LISTP (where_scm)) + if (!scm_is_list (where_scm)) return NULL; where = SCM_SYMBOL_CHARS (SCM_CAR(where_scm)); @@ -403,10 +403,10 @@ gnc_scm2guid_glist (SCM guids_scm) { GList *guids = NULL; - if (!SCM_LISTP (guids_scm)) + if (!scm_is_list (guids_scm)) return NULL; - while (!SCM_NULLP (guids_scm)) + while (!scm_is_null (guids_scm)) { SCM guid_scm = SCM_CAR (guids_scm); GUID *guid = NULL; @@ -446,7 +446,7 @@ gnc_query_numeric2scm (gnc_numeric val) static gboolean gnc_query_numeric_p (SCM pair) { - return (SCM_CONSP (pair)); + return (scm_is_pair (pair)); } static gnc_numeric @@ -484,18 +484,18 @@ gnc_query_scm2path (SCM path_scm) { GSList *path = NULL; - if (!SCM_LISTP (path_scm)) + if (!scm_is_list (path_scm)) return NULL; - while (!SCM_NULLP (path_scm)) + while (!scm_is_null (path_scm)) { SCM key_scm = SCM_CAR (path_scm); char *key; - if (!SCM_STRINGP (key_scm)) + if (!scm_is_string (key_scm)) break; - key = g_strdup (SCM_STRING_CHARS (key_scm)); + key = g_strdup (scm_to_locale_string (key_scm)); path = g_slist_prepend (path, key); @@ -637,14 +637,14 @@ gnc_scm2KvpValue (SCM value_scm) SCM type_scm; SCM val_scm; - if (!SCM_LISTP (value_scm) || SCM_NULLP (value_scm)) + if (!scm_is_list (value_scm) || scm_is_null (value_scm)) return NULL; type_scm = SCM_CAR (value_scm); value_t = gnc_scm2KvpValueTypeype (type_scm); value_scm = SCM_CDR (value_scm); - if (!SCM_LISTP (value_scm) || SCM_NULLP (value_scm)) + if (!scm_is_list (value_scm) || scm_is_null (value_scm)) return NULL; val_scm = SCM_CAR (value_scm); @@ -660,7 +660,7 @@ gnc_scm2KvpValue (SCM value_scm) break; case KVP_TYPE_STRING: { - const gchar * str = SCM_STRING_CHARS (val_scm); + const gchar * str = scm_to_locale_string (val_scm); value = kvp_value_new_string (str); break; } @@ -702,7 +702,7 @@ gnc_scm2KvpValue (SCM value_scm) GList *list = NULL; GList *node; - for (; SCM_LISTP (val_scm) && !SCM_NULLP (val_scm); + for (; scm_is_list (val_scm) && !scm_is_null (val_scm); val_scm = SCM_CDR (val_scm)) { SCM scm = SCM_CAR (val_scm); @@ -742,11 +742,11 @@ gnc_scm2KvpFrame (SCM frame_scm) { KvpFrame * frame; - if (!SCM_LISTP (frame_scm)) return NULL; + if (!scm_is_list (frame_scm)) return NULL; frame = kvp_frame_new (); - for (; SCM_LISTP (frame_scm) && !SCM_NULLP (frame_scm); + for (; scm_is_list (frame_scm) && !scm_is_null (frame_scm); frame_scm = SCM_CDR (frame_scm)) { SCM pair = SCM_CAR (frame_scm); @@ -755,16 +755,16 @@ gnc_scm2KvpFrame (SCM frame_scm) SCM val_scm; const gchar *key; - if (!SCM_CONSP (pair)) + if (!scm_is_pair (pair)) continue; key_scm = SCM_CAR (pair); val_scm = SCM_CDR (pair); - if (!SCM_STRINGP (key_scm)) + if (!scm_is_string (key_scm)) continue; - key = SCM_STRING_CHARS (key_scm); + key = scm_to_locale_string (key_scm); if (!key) continue; @@ -862,35 +862,35 @@ gnc_scm2query_term_query_v2 (SCM qt_scm) gboolean inverted = FALSE; QofQueryCompare compare_how; - if (!SCM_LISTP (qt_scm) || SCM_NULLP (qt_scm)) + if (!scm_is_list (qt_scm) || scm_is_null (qt_scm)) return NULL; do { /* param path */ scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (!SCM_LISTP (scm)) + if (!scm_is_list (scm)) break; path = gnc_query_scm2path (scm); /* inverted */ scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (!SCM_BOOLP (scm)) + if (!scm_is_bool (scm)) break; - inverted = SCM_NFALSEP (scm); + inverted = scm_is_true (scm); /* type */ scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (!SCM_SYMBOLP (scm)) + if (!scm_is_symbol (scm)) break; type = SCM_SYMBOL_CHARS (scm); /* QofCompareFunc */ scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (SCM_NULLP (scm)) + if (scm_is_null (scm)) break; compare_how = gnc_query_scm2compare (scm); @@ -904,19 +904,19 @@ gnc_scm2query_term_query_v2 (SCM qt_scm) scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (SCM_NULLP (scm)) break; + if (scm_is_null (scm)) break; options = gnc_query_scm2string (scm); scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (!SCM_BOOLP (scm)) break; - is_regex = SCM_NFALSEP (scm); + if (!scm_is_bool (scm)) break; + is_regex = scm_is_true (scm); scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (!SCM_STRINGP (scm)) break; + if (!scm_is_string (scm)) break; - matchstring = SCM_STRING_CHARS (scm); + matchstring = scm_to_locale_string (scm); pd = qof_query_string_predicate (compare_how, matchstring, options, is_regex); @@ -928,13 +928,13 @@ gnc_scm2query_term_query_v2 (SCM qt_scm) scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (SCM_NULLP (scm)) + if (scm_is_null (scm)) break; options = gnc_query_scm2date (scm); scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (SCM_NULLP (scm)) + if (scm_is_null (scm)) break; date = gnc_timepair2timespec (scm); @@ -946,7 +946,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm) scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (SCM_NULLP (scm)) + if (scm_is_null (scm)) break; options = gnc_query_scm2numericop (scm); @@ -964,13 +964,13 @@ gnc_scm2query_term_query_v2 (SCM qt_scm) scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (SCM_NULLP (scm)) + if (scm_is_null (scm)) break; options = gnc_query_scm2guid (scm); scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (!SCM_LISTP (scm)) + if (!scm_is_list (scm)) break; guids = gnc_scm2guid_glist (scm); @@ -983,7 +983,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm) scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (SCM_NULLP (scm)) + if (scm_is_null (scm)) break; val = gnc_scm_to_gint64 (scm); @@ -994,7 +994,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm) scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (!SCM_NUMBERP (scm)) + if (!scm_is_number (scm)) break; val = scm_num2dbl (scm, G_STRFUNC); @@ -1005,9 +1005,9 @@ gnc_scm2query_term_query_v2 (SCM qt_scm) scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (!SCM_BOOLP (scm)) + if (!scm_is_bool (scm)) break; - val = SCM_NFALSEP (scm); + val = scm_is_true (scm); pd = qof_query_boolean_predicate (compare_how, val); @@ -1017,15 +1017,15 @@ gnc_scm2query_term_query_v2 (SCM qt_scm) scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (SCM_NULLP (scm)) + if (scm_is_null (scm)) break; options = gnc_query_scm2char (scm); scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (!SCM_STRINGP (scm)) + if (!scm_is_string (scm)) break; - char_list = SCM_STRING_CHARS (scm); + char_list = scm_to_locale_string (scm); pd = qof_query_char_predicate (options, char_list); } @@ -1036,13 +1036,13 @@ gnc_scm2query_term_query_v2 (SCM qt_scm) scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (!SCM_LISTP (scm)) + if (!scm_is_list (scm)) break; kvp_path = gnc_query_scm2path (scm); scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); - if (SCM_NULLP (scm)) { + if (scm_is_null (scm)) { gnc_query_path_free (kvp_path); break; } @@ -1084,8 +1084,8 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) QofQuery *q = NULL; SCM scm; - if (!SCM_LISTP (query_term_scm) || - SCM_NULLP (query_term_scm)) { + if (!scm_is_list (query_term_scm) || + scm_is_null (query_term_scm)) { PINFO ("null term"); return NULL; } @@ -1097,7 +1097,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) pd_type = SCM_SYMBOL_CHARS (scm); /* pr_type */ - if (SCM_NULLP (query_term_scm)) { + if (scm_is_null (query_term_scm)) { PINFO ("null pr_type"); break; } @@ -1106,13 +1106,13 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) pr_type = SCM_SYMBOL_CHARS (scm); /* sense */ - if (SCM_NULLP (query_term_scm)) { + if (scm_is_null (query_term_scm)) { PINFO ("null sense"); break; } scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); - sense = SCM_NFALSEP (scm); + sense = scm_is_true (scm); q = xaccMallocQuery (); @@ -1123,17 +1123,17 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) Timespec end; /* use_start */ - if (SCM_NULLP (query_term_scm)) { + if (scm_is_null (query_term_scm)) { PINFO ("null use_start"); break; } scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); - use_start = SCM_NFALSEP (scm); + use_start = scm_is_true (scm); /* start */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); @@ -1141,15 +1141,15 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) start = gnc_timepair2timespec (scm); /* use_end */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); - use_end = SCM_NFALSEP (scm); + use_end = scm_is_true (scm); /* end */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); @@ -1169,21 +1169,21 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) gnc_numeric val; /* how */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); how = gnc_scm2amt_match_how (scm); /* amt_sgn */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); amt_sgn = gnc_query_scm2numericop (scm); /* amount */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); @@ -1215,7 +1215,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) GList *account_guids; /* how */ - if (SCM_NULLP (query_term_scm)) { + if (scm_is_null (query_term_scm)) { PINFO ("pd-account: null how"); break; } @@ -1225,7 +1225,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) how = gnc_scm2acct_match_how (scm); /* account guids */ - if (SCM_NULLP (query_term_scm)) { + if (scm_is_null (query_term_scm)) { PINFO ("pd-account: null guids"); break; } @@ -1247,28 +1247,28 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) const gchar *matchstring; /* case_sens */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); - case_sens = SCM_NFALSEP (scm); + case_sens = scm_is_true (scm); /* use_regexp */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); - use_regexp = SCM_NFALSEP (scm); + use_regexp = scm_is_true (scm); /* matchstring */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); - matchstring = SCM_STRING_CHARS (scm); + matchstring = scm_to_locale_string (scm); if (!safe_strcmp (pr_type, "pr-action")) { xaccQueryAddActionMatch (q, matchstring, case_sens, use_regexp, @@ -1298,7 +1298,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) cleared_match_t how; /* how */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); @@ -1312,7 +1312,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) gboolean how; /* how */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); @@ -1328,7 +1328,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) QofIdType id_type; /* guid */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); @@ -1338,7 +1338,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) /* id type */ scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); - id_type = g_strdup (SCM_STRING_CHARS (scm)); + id_type = g_strdup (scm_to_locale_string (scm)); xaccQueryAddGUIDMatch (q, &guid, id_type, QOF_QUERY_OR); ok = TRUE; @@ -1350,28 +1350,28 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) QofIdType where; /* how */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); how = gnc_scm2kvp_match_how (scm); /* where */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); where = gnc_scm2kvp_match_where (scm); /* path */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); path = gnc_query_scm2path (scm); /* value */ - if (SCM_NULLP (query_term_scm)) + if (scm_is_null (query_term_scm)) break; scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); @@ -1454,10 +1454,10 @@ gnc_scm2query_and_terms (SCM and_terms, query_version_t vers) { Query *q = NULL; - if (!SCM_LISTP (and_terms)) + if (!scm_is_list (and_terms)) return NULL; - while (!SCM_NULLP (and_terms)) + while (!scm_is_null (and_terms)) { SCM term; @@ -1494,12 +1494,12 @@ gnc_scm2query_or_terms (SCM or_terms, query_version_t vers) { Query *q = NULL; - if (!SCM_LISTP (or_terms)) + if (!scm_is_list (or_terms)) return NULL; q = xaccMallocQuery (); - while (!SCM_NULLP (or_terms)) + while (!scm_is_null (or_terms)) { SCM and_terms; @@ -1560,24 +1560,24 @@ gnc_query_scm2sort (SCM sort_scm, GSList **path, gint *options, gboolean *inc) g_return_val_if_fail (*path == NULL, FALSE); /* This is ok -- it means we have an empty sort. Don't do anything */ - if (SCM_BOOLP (sort_scm)) + if (scm_is_bool (sort_scm)) return TRUE; /* Ok, this had better be a list */ - if (!SCM_LISTP (sort_scm)) + if (!scm_is_list (sort_scm)) return FALSE; /* Parse the path, options, and increasing */ val = SCM_CAR (sort_scm); sort_scm = SCM_CDR (sort_scm); - if (!SCM_LISTP (val)) + if (!scm_is_list (val)) return FALSE; p = gnc_query_scm2path (val); /* options */ val = SCM_CAR (sort_scm); sort_scm = SCM_CDR (sort_scm); - if (!SCM_NUMBERP (val)) { + if (!scm_is_number (val)) { gnc_query_path_free (p); return FALSE; } @@ -1586,14 +1586,14 @@ gnc_query_scm2sort (SCM sort_scm, GSList **path, gint *options, gboolean *inc) /* increasing */ val = SCM_CAR (sort_scm); sort_scm = SCM_CDR (sort_scm); - if (!SCM_BOOLP (val)) { + if (!scm_is_bool (val)) { gnc_query_path_free (p); return FALSE; } - i = SCM_NFALSEP (val); + i = scm_is_true (val); /* EOL */ - if (!SCM_NULLP (sort_scm)) { + if (!scm_is_null (sort_scm)) { gnc_query_path_free (p); return FALSE; } @@ -1735,7 +1735,7 @@ gnc_scm2query_v1 (SCM query_scm) gboolean tertiary_increasing = TRUE; int max_splits = -1; - while (!SCM_NULLP (query_scm)) + while (!scm_is_null (query_scm)) { const gchar *symbol; SCM sym_scm; @@ -1745,7 +1745,7 @@ gnc_scm2query_v1 (SCM query_scm) pair = SCM_CAR (query_scm); query_scm = SCM_CDR (query_scm); - if (!SCM_CONSP (pair)) { + if (!scm_is_pair (pair)) { PERR ("Not a Pair"); ok = FALSE; break; @@ -1754,7 +1754,7 @@ gnc_scm2query_v1 (SCM query_scm) sym_scm = SCM_CAR (pair); value = SCM_CADR (pair); - if (!SCM_SYMBOLP (sym_scm)) { + if (!scm_is_symbol (sym_scm)) { PERR ("Not a symbol"); ok = FALSE; break; @@ -1779,7 +1779,7 @@ gnc_scm2query_v1 (SCM query_scm) } } else if (safe_strcmp ("primary-sort", symbol) == 0) { - if (!SCM_SYMBOLP (value)) { + if (!scm_is_symbol (value)) { PINFO ("Invalid primary sort"); ok = FALSE; break; @@ -1788,7 +1788,7 @@ gnc_scm2query_v1 (SCM query_scm) primary_sort = SCM_SYMBOL_CHARS (value); } else if (safe_strcmp ("secondary-sort", symbol) == 0) { - if (!SCM_SYMBOLP (value)) { + if (!scm_is_symbol (value)) { PINFO ("Invalid secondary sort"); ok = FALSE; break; @@ -1797,7 +1797,7 @@ gnc_scm2query_v1 (SCM query_scm) secondary_sort = SCM_SYMBOL_CHARS (value); } else if (safe_strcmp ("tertiary-sort", symbol) == 0) { - if (!SCM_SYMBOLP (value)) { + if (!scm_is_symbol (value)) { PINFO ("Invalid tertiary sort"); ok = FALSE; break; @@ -1806,16 +1806,16 @@ gnc_scm2query_v1 (SCM query_scm) tertiary_sort = SCM_SYMBOL_CHARS (value); } else if (safe_strcmp ("primary-increasing", symbol) == 0) { - primary_increasing = SCM_NFALSEP (value); + primary_increasing = scm_is_true (value); } else if (safe_strcmp ("secondary-increasing", symbol) == 0) { - secondary_increasing = SCM_NFALSEP (value); + secondary_increasing = scm_is_true (value); } else if (safe_strcmp ("tertiary-increasing", symbol) == 0) { - tertiary_increasing = SCM_NFALSEP (value); + tertiary_increasing = scm_is_true (value); } else if (safe_strcmp ("max-splits", symbol) == 0) { - if (!SCM_NUMBERP (value)) { + if (!scm_is_number (value)) { PERR ("invalid max-splits"); ok = FALSE; break; @@ -1863,7 +1863,7 @@ gnc_scm2query_v2 (SCM query_scm) ++scm_block_gc; #endif - while (!SCM_NULLP (query_scm)) + while (!scm_is_null (query_scm)) { const gchar *symbol; SCM sym_scm; @@ -1873,7 +1873,7 @@ gnc_scm2query_v2 (SCM query_scm) pair = SCM_CAR (query_scm); query_scm = SCM_CDR (query_scm); - if (!SCM_CONSP (pair)) { + if (!scm_is_pair (pair)) { ok = FALSE; break; } @@ -1881,7 +1881,7 @@ gnc_scm2query_v2 (SCM query_scm) sym_scm = SCM_CAR (pair); value = SCM_CADR (pair); - if (!SCM_SYMBOLP (sym_scm)) { + if (!scm_is_symbol (sym_scm)) { ok = FALSE; break; } @@ -1903,7 +1903,7 @@ gnc_scm2query_v2 (SCM query_scm) } } else if (!safe_strcmp ("search-for", symbol)) { - if (!SCM_SYMBOLP (value)) { + if (!scm_is_symbol (value)) { ok = FALSE; break; } @@ -1928,7 +1928,7 @@ gnc_scm2query_v2 (SCM query_scm) } } else if (!safe_strcmp ("max-results", symbol)) { - if (!SCM_NUMBERP (value)) { + if (!scm_is_number (value)) { ok = FALSE; break; } @@ -1967,14 +1967,14 @@ gnc_scm2query (SCM query_scm) Query *q = NULL; /* Not a list or NULL? No need to go further */ - if (!SCM_LISTP (query_scm) || SCM_NULLP (query_scm)) + if (!scm_is_list (query_scm) || scm_is_null (query_scm)) return NULL; /* Grab the 'type' (for v2 and above) */ q_type = SCM_CAR (query_scm); - if (!SCM_SYMBOLP (q_type)) { - if (SCM_CONSP (q_type)) { + if (!scm_is_symbol (q_type)) { + if (scm_is_pair (q_type)) { /* Version-1 queries are just a list */ return gnc_scm2query_v1 (query_scm); } else { @@ -2098,7 +2098,7 @@ gnc_gh_gint64_p(SCM num) initialized = 1; } - return (SCM_EXACTP(num) && + return (scm_is_exact(num) && (scm_geq_p(num, minval) != SCM_BOOL_F) && (scm_leq_p(num, maxval) != SCM_BOOL_F)); } diff --git a/src/engine/engine.i b/src/engine/engine.i index 988bf4ec79..6f0f24ccd4 100644 --- a/src/engine/engine.i +++ b/src/engine/engine.i @@ -153,15 +153,15 @@ gchar * gnc_build_book_path (const gchar *filename); SCM path_scm = $input; GList *path = NULL; - while (!SCM_NULLP (path_scm)) + while (!scm_is_null (path_scm)) { SCM key_scm = SCM_CAR (path_scm); char *key; - if (!SCM_STRINGP (key_scm)) + if (!scm_is_string (key_scm)) break; - key = g_strdup (SCM_STRING_CHARS (key_scm)); + key = g_strdup (scm_to_locale_string (key_scm)); path = g_list_prepend (path, key); diff --git a/src/engine/glib-helpers.c b/src/engine/glib-helpers.c index 51619b9353..06c700b0a1 100644 --- a/src/engine/glib-helpers.c +++ b/src/engine/glib-helpers.c @@ -59,9 +59,9 @@ gnc_scm_list_to_glist(SCM rest) SCM scm_item; SWIG_GetModule(NULL); /* Work-around for SWIG bug. */ - SCM_ASSERT(SCM_LISTP(rest), rest, SCM_ARG1, "gnc_scm_list_to_glist"); + SCM_ASSERT(scm_is_list(rest), rest, SCM_ARG1, "gnc_scm_list_to_glist"); - while(!SCM_NULLP(rest)) + while(!scm_is_null(rest)) { void *item; @@ -119,9 +119,9 @@ gnc_scm_to_glist_string(SCM list) { GList *glist = NULL; - while (!SCM_NULLP (list)) + while (!scm_is_null (list)) { - const gchar * str = SCM_STRING_CHARS (SCM_CAR(list)); + const gchar * str = scm_to_locale_string (SCM_CAR(list)); if (str) glist = g_list_prepend (glist, g_strdup (str)); list = SCM_CDR (list); @@ -135,9 +135,9 @@ gnc_scm_to_gslist_string(SCM list) { GSList *gslist = NULL; - while (!SCM_NULLP (list)) + while (!scm_is_null (list)) { - const gchar * str = SCM_STRING_CHARS (SCM_CAR(list)); + const gchar * str = scm_to_locale_string (SCM_CAR(list)); if (str) gslist = g_slist_prepend (gslist, g_strdup (str)); list = SCM_CDR (list); @@ -152,5 +152,5 @@ gnc_scm_to_gslist_string(SCM list) int gnc_glist_string_p(SCM list) { - return SCM_LISTP(list); + return scm_is_list(list); } diff --git a/src/engine/gnc-hooks.c b/src/engine/gnc-hooks.c index 33ce2f16cc..2e39c5bb4b 100644 --- a/src/engine/gnc-hooks.c +++ b/src/engine/gnc-hooks.c @@ -225,7 +225,7 @@ hook_remove_scm_runner (GHook *hook, gpointer data) SCM res; res = scm_equal_p(scm1->proc, scm2->proc); - return(SCM_NFALSEP(res)); + return(scm_is_true(res)); } void diff --git a/src/engine/kvp-scm.c b/src/engine/kvp-scm.c index 93ececd05f..9b28e4ada4 100644 --- a/src/engine/kvp-scm.c +++ b/src/engine/kvp-scm.c @@ -23,10 +23,10 @@ gnc_kvp_value_ptr_p(SCM arg) KvpValue * gnc_scm_to_kvp_value_ptr(SCM val) { - if(SCM_NUMBERP(val)) + if(scm_is_number(val)) { /* in guile 1.8 (exact? ) only works on numbers */ - if(SCM_EXACTP (val) && gnc_gh_gint64_p(val)) + if(scm_is_exact (val) && gnc_gh_gint64_p(val)) { return kvp_value_new_gint64(gnc_scm_to_gint64(val)); } @@ -49,11 +49,11 @@ gnc_scm_to_kvp_value_ptr(SCM val) Timespec ts = gnc_timepair2timespec(val); return kvp_value_new_timespec(ts); } - else if(SCM_STRINGP(val)) + else if(scm_is_string(val)) { const gchar *newstr; KvpValue *ret; - newstr = SCM_STRING_CHARS (val); + newstr = scm_to_locale_string (val); ret = kvp_value_new_string(newstr); return ret; } diff --git a/src/gnome-utils/dialog-options.c b/src/gnome-utils/dialog-options.c index 80387ca7e8..add33f5c6a 100644 --- a/src/gnome-utils/dialog-options.c +++ b/src/gnome-utils/dialog-options.c @@ -2183,10 +2183,10 @@ static gboolean gnc_option_set_ui_value_boolean (GNCOption *option, gboolean use_default, GtkWidget *widget, SCM value) { - if (SCM_BOOLP(value)) + if (scm_is_bool(value)) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), - SCM_NFALSEP(value)); + scm_is_true(value)); return FALSE; } else @@ -2197,9 +2197,9 @@ static gboolean gnc_option_set_ui_value_string (GNCOption *option, gboolean use_default, GtkWidget *widget, SCM value) { - if (SCM_STRINGP(value)) + if (scm_is_string(value)) { - const gchar *string = SCM_STRING_CHARS(value); + const gchar *string = scm_to_locale_string(value); gtk_entry_set_text(GTK_ENTRY(widget), string); return FALSE; } @@ -2218,10 +2218,10 @@ gnc_option_set_ui_value_text (GNCOption *option, gboolean use_default, else buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(object)); - if (SCM_STRINGP(value)) + if (scm_is_string(value)) { - const gchar *string = SCM_STRING_CHARS(value); - gtk_text_buffer_set_text (buffer, string, strlen (string)); + const gchar *string = scm_to_locale_string(value); + gtk_text_buffer_set_text (buffer, string, scm_i_string_length(value)); return FALSE; } else @@ -2293,7 +2293,7 @@ gnc_option_set_ui_value_date (GNCOption *option, gboolean use_default, date_option_type = gnc_option_date_option_get_subtype(option); - if (SCM_CONSP(value)) + if (scm_is_pair(value)) { symbol_str = gnc_date_option_value_get_type (value); if (symbol_str) @@ -2432,7 +2432,7 @@ gnc_option_set_ui_value_list (GNCOption *option, gboolean use_default, selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)); gtk_tree_selection_unselect_all(selection); - while (SCM_LISTP(value) && !SCM_NULLP(value)) + while (scm_is_list(value) && !scm_is_null(value)) { SCM item; @@ -2450,7 +2450,7 @@ gnc_option_set_ui_value_list (GNCOption *option, gboolean use_default, gtk_tree_path_free(path); } - if (!SCM_LISTP(value) || !SCM_NULLP(value)) + if (!scm_is_list(value) || !scm_is_null(value)) return TRUE; return FALSE; @@ -2465,7 +2465,7 @@ gnc_option_set_ui_value_number_range (GNCOption *option, gboolean use_default, spinner = GTK_SPIN_BUTTON(widget); - if (SCM_NUMBERP(value)) + if (scm_is_number(value)) { d_value = scm_num2dbl(value, G_STRFUNC); gtk_spin_button_set_value(spinner, d_value); @@ -2506,9 +2506,9 @@ static gboolean gnc_option_set_ui_value_font (GNCOption *option, gboolean use_default, GtkWidget *widget, SCM value) { - if (SCM_STRINGP(value)) + if (scm_is_string(value)) { - const gchar *string = SCM_STRING_CHARS(value); + const gchar *string = scm_to_locale_string(value); if ((string != NULL) && (*string != '\0')) { GtkFontButton *font_button = GTK_FONT_BUTTON(widget); @@ -2525,9 +2525,9 @@ gnc_option_set_ui_value_pixmap (GNCOption *option, gboolean use_default, GtkWidget *widget, SCM value) { ENTER("option %p(%s)", option, gnc_option_name(option)); - if (SCM_STRINGP(value)) + if (scm_is_string(value)) { - const gchar *string = SCM_STRING_CHARS(value); + const gchar *string = scm_to_locale_string(value); if (string && *string) { @@ -2556,7 +2556,7 @@ static gboolean gnc_option_set_ui_value_budget( GtkTreeModel *tm; GtkTreeIter iter; -// if (!SCM_NULLP(value)) { +// if (!scm_is_null(value)) { if (value != SCM_BOOL_F) { if (!SWIG_IsPointer(value)) scm_misc_error("gnc_option_set_ui_value_budget", diff --git a/src/gnome-utils/dialog-transfer.c b/src/gnome-utils/dialog-transfer.c index 7698ac52a6..51c0ead9ae 100644 --- a/src/gnome-utils/dialog-transfer.c +++ b/src/gnome-utils/dialog-transfer.c @@ -1583,13 +1583,13 @@ gnc_xfer_dialog_fetch (GtkButton *button, XferDialog *xferData) quotes_func = scm_c_eval_string ("gnc:book-add-quotes"); - if (!SCM_PROCEDUREP (quotes_func)) { + if (!scm_is_procedure (quotes_func)) { LEAVE("quote retrieval failed"); return; } book_scm = gnc_book_to_scm (xferData->book); - if (SCM_NFALSEP (scm_not (book_scm))) { + if (scm_is_true (scm_not (book_scm))) { LEAVE("no book"); return; } @@ -1597,7 +1597,7 @@ gnc_xfer_dialog_fetch (GtkButton *button, XferDialog *xferData) scm_window = SWIG_NewPointerObj(xferData->dialog, SWIG_TypeQuery("_p_GtkWidget"), 0); - if (SCM_NFALSEP (scm_not (book_scm))) { + if (scm_is_true (scm_not (book_scm))) { LEAVE("no scm window"); return; } diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c index d5b7c180b2..1cedaca34a 100644 --- a/src/gnome-utils/gnc-main-window.c +++ b/src/gnome-utils/gnc-main-window.c @@ -3286,7 +3286,7 @@ static void gnc_main_window_cmd_file_properties (GtkAction *action, GncMainWindow *window) { SCM func = scm_c_eval_string("gnc:main-window-properties-cb"); - if (!SCM_PROCEDUREP (func)) { + if (!scm_is_procedure (func)) { PERR ("not a procedure\n"); return; } diff --git a/src/gnome-utils/gnc-menu-extensions.c b/src/gnome-utils/gnc-menu-extensions.c index ee6bd4e887..989068be4e 100644 --- a/src/gnome-utils/gnc-menu-extensions.c +++ b/src/gnome-utils/gnc-menu-extensions.c @@ -132,7 +132,7 @@ gnc_extension_path (SCM extension, char **fullpath) initialize_getters(); path = gnc_guile_call1_to_list(getters.path, extension); - if ((path == SCM_UNDEFINED) || SCM_NULLP(path)) { + if ((path == SCM_UNDEFINED) || scm_is_null(path)) { *fullpath = g_strdup(""); return; } @@ -142,19 +142,19 @@ gnc_extension_path (SCM extension, char **fullpath) strings[0] = "/menubar"; i = 1; - while (!SCM_NULLP(path)) + while (!scm_is_null(path)) { SCM item; item = SCM_CAR(path); path = SCM_CDR(path); - if (SCM_STRINGP(item)) + if (scm_is_string(item)) { if (i == 1) - strings[i] = g_strdup(SCM_STRING_CHARS(item)); + strings[i] = g_strdup(scm_to_locale_string(item)); else - strings[i] = g_strdup(gettext(SCM_STRING_CHARS(item))); + strings[i] = g_strdup(gettext(scm_to_locale_string(item))); } else { diff --git a/src/gnome/dialog-price-edit-db.c b/src/gnome/dialog-price-edit-db.c index fabf207897..737171626a 100644 --- a/src/gnome/dialog-price-edit-db.c +++ b/src/gnome/dialog-price-edit-db.c @@ -267,13 +267,13 @@ gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data) ENTER(" "); quotes_func = scm_c_eval_string ("gnc:book-add-quotes"); - if (!SCM_PROCEDUREP (quotes_func)) { + if (!scm_is_procedure (quotes_func)) { LEAVE(" no procedure"); return; } book_scm = gnc_book_to_scm (pdb_dialog->book); - if (SCM_NFALSEP (scm_not (book_scm))) { + if (scm_is_true (scm_not (book_scm))) { LEAVE("no book"); return; } diff --git a/src/gnome/dialog-progress.c b/src/gnome/dialog-progress.c index 0bdef7e3e0..4cab7906b3 100644 --- a/src/gnome/dialog-progress.c +++ b/src/gnome/dialog-progress.c @@ -115,7 +115,7 @@ cancel_cb(GtkWidget * widget, gpointer data) result = scm_call_0(progress->cancel_scm_func); - if (!SCM_NFALSEP(result)) + if (!scm_is_true(result)) return; } @@ -160,7 +160,7 @@ delete_cb(GtkWidget *widget, GdkEvent *event, gpointer data) result = scm_call_0(progress->cancel_scm_func); - if (SCM_NFALSEP(result)) + if (scm_is_true(result)) { if (progress->dialog != NULL) gtk_widget_hide(progress->dialog); @@ -601,7 +601,7 @@ gnc_progress_dialog_set_cancel_scm_func(GNCProgressDialog *progress, if (progress->cancel_scm_func != SCM_UNDEFINED) scm_gc_unprotect_object(progress->cancel_scm_func); - if (SCM_PROCEDUREP(cancel_scm_func)) + if (scm_is_procedure(cancel_scm_func)) { progress->cancel_scm_func = cancel_scm_func; scm_gc_protect_object(cancel_scm_func); diff --git a/src/gnome/dialog-tax-info.c b/src/gnome/dialog-tax-info.c index ec7190c66f..fae613022d 100644 --- a/src/gnome/dialog-tax-info.c +++ b/src/gnome/dialog-tax-info.c @@ -265,13 +265,13 @@ load_txf_info (gint acct_category, TaxInfoDialog *ti_dialog) } codes = scm_call_2 (getters.codes, category, tax_entity_type); - if (!SCM_LISTP (codes)) + if (!scm_is_list (codes)) { destroy_txf_infos (infos); return NULL; } - while (!SCM_NULLP (codes)) + while (!scm_is_null (codes)) { TXFInfo *txf_info; SCM code_scm; @@ -301,31 +301,31 @@ load_txf_info (gint acct_category, TaxInfoDialog *ti_dialog) else txf_info->payer_name_source = g_strdup (str); - str = SCM_SYMBOLP(code_scm) ? SCM_SYMBOL_CHARS(code_scm) : ""; + str = scm_is_symbol(code_scm) ? SCM_SYMBOL_CHARS(code_scm) : ""; txf_info->code = g_strdup (str); scm = scm_call_3 (getters.form, category, code_scm, tax_entity_type); - str = SCM_STRINGP(scm) ? SCM_STRING_CHARS(scm) : ""; + str = scm_is_string(scm) ? scm_to_locale_string(scm) : ""; txf_info->form = g_strdup (str); scm = scm_call_3 (getters.description, category, code_scm, tax_entity_type); - str = SCM_STRINGP(scm) ? SCM_STRING_CHARS(scm) : ""; + str = scm_is_string(scm) ? scm_to_locale_string(scm) : ""; txf_info->description = g_strdup (str); scm = scm_call_2 (getters.help, category, code_scm); - str = SCM_STRINGP(scm) ? SCM_STRING_CHARS(scm) : ""; + str = scm_is_string(scm) ? scm_to_locale_string(scm) : ""; scm = scm_call_3 (getters.last_year, category, code_scm, tax_entity_type); /* year = scm_is_bool (scm) ? 0 : scm_to_int(scm); <- Req's guile 1.8 */ - year = SCM_BOOLP (scm) ? 0 : SCM_INUM(scm); /* <-guile 1.6 */ + year = scm_is_bool (scm) ? 0 : SCM_INUM(scm); /* <-guile 1.6 */ scm = scm_call_3 (getters.line_data, category, code_scm, tax_entity_type); - if (SCM_LISTP (scm)) + if (scm_is_list (scm)) { const gchar *until = _("now"); if (year != 0) until = g_strdup_printf ("%d", year); form_line_data = g_strconcat ("\n", "\n", form_line, NULL); - while (!SCM_NULLP (scm)) + while (!scm_is_null (scm)) { SCM year_scm; gint line_year; @@ -337,10 +337,10 @@ load_txf_info (gint acct_category, TaxInfoDialog *ti_dialog) /* line_year = scm_is_bool (SCM_CAR (year_scm)) ? 0 : scm_to_int (SCM_CAR (year_scm)); <- Req's guile 1.8 */ - line_year = SCM_BOOLP (SCM_CAR (year_scm)) ? 0 : + line_year = scm_is_bool (SCM_CAR (year_scm)) ? 0 : SCM_INUM (SCM_CAR (year_scm)); /* <-guile 1.6 */ - line = SCM_STRINGP((SCM_CAR (SCM_CDR (year_scm)))) - ? SCM_STRING_CHARS((SCM_CAR (SCM_CDR (year_scm)))) : ""; + line = scm_is_string((SCM_CAR (SCM_CDR (year_scm)))) + ? scm_to_locale_string((SCM_CAR (SCM_CDR (year_scm)))) : ""; temp = g_strconcat (form_line_data, "\n", g_strdup_printf ("%d", line_year), " - ", until, " ", line, NULL); @@ -372,7 +372,7 @@ load_txf_info (gint acct_category, TaxInfoDialog *ti_dialog) scm = scm_call_3 (getters.copy, category, code_scm, tax_entity_type); /* cpy = scm_is_bool (scm) ? (scm_is_false (scm) ? FALSE : TRUE): FALSE; <- Req's guile 1.8 */ - cpy = SCM_BOOLP (scm) ? (SCM_FALSEP (scm) ? FALSE : TRUE): FALSE; /* <-guile 1.6 */ + cpy = scm_is_bool (scm) ? (scm_is_false (scm) ? FALSE : TRUE): FALSE; /* <-guile 1.6 */ txf_info->copy = cpy; infos = g_list_prepend (infos, txf_info); @@ -402,13 +402,13 @@ load_tax_entity_type_list (TaxInfoDialog *ti_dialog) ti_dialog->tax_type_combo_text = NULL; tax_types = scm_call_0 (getters.tax_entity_types); - if (!SCM_LISTP (tax_types)) + if (!scm_is_list (tax_types)) { destroy_tax_type_infos (types); return; } - while (!SCM_NULLP (tax_types)) + while (!scm_is_null (tax_types)) { TaxTypeInfo *tax_type_info; SCM type_scm; @@ -422,15 +422,15 @@ load_tax_entity_type_list (TaxInfoDialog *ti_dialog) tax_type_info = g_new0 (TaxTypeInfo, 1); - str = SCM_SYMBOLP(type_scm) ? SCM_SYMBOL_CHARS(type_scm) : ""; + str = scm_is_symbol(type_scm) ? SCM_SYMBOL_CHARS(type_scm) : ""; tax_type_info->type_code = g_strdup (str); scm = scm_call_1 (getters.tax_entity_type, type_scm); - str = SCM_STRINGP(scm) ? SCM_STRING_CHARS (scm) : ""; + str = scm_is_string(scm) ? scm_to_locale_string (scm) : ""; tax_type_info->type = g_strdup (str); scm = scm_call_1 (getters.tax_entity_desc, type_scm); - str = SCM_STRINGP(scm) ? SCM_STRING_CHARS (scm) : ""; + str = scm_is_string(scm) ? scm_to_locale_string (scm) : ""; tax_type_info->description = g_strdup (str); tax_type_info->combo_box_entry = g_strconcat(tax_type_info->type, " - ", diff --git a/src/gnome/gnc-plugin-page-register.c b/src/gnome/gnc-plugin-page-register.c index 1dcfffcd7c..1d7d61cab9 100644 --- a/src/gnome/gnc-plugin-page-register.c +++ b/src/gnome/gnc-plugin-page-register.c @@ -1820,7 +1820,7 @@ report_helper (GNCLedgerDisplay *ledger, Split *split, Query *query) args = SCM_EOL; func = scm_c_eval_string ("gnc:register-report-create"); - g_return_val_if_fail (SCM_PROCEDUREP (func), -1); + g_return_val_if_fail (scm_is_procedure (func), -1); arg = scm_makfrom0str (gnc_split_register_get_credit_string (reg)); args = scm_cons (arg, args); @@ -1878,7 +1878,7 @@ report_helper (GNCLedgerDisplay *ledger, Split *split, Query *query) /* Apply the function to the args */ arg = scm_apply (func, args, SCM_EOL); - g_return_val_if_fail (SCM_EXACTP (arg), -1); + g_return_val_if_fail (scm_is_exact (arg), -1); return scm_num2int (arg, SCM_ARG1, G_STRFUNC); } diff --git a/src/guile-mappings.h b/src/guile-mappings.h index ac12ae0625..f986ee002b 100644 --- a/src/guile-mappings.h +++ b/src/guile-mappings.h @@ -19,7 +19,7 @@ /* Convenience macros */ -#define SCM_EQUALP(obj1,obj2) SCM_NFALSEP(scm_equal_p(obj1,obj2)) -#define SCM_EXACTP(obj) SCM_NFALSEP(scm_exact_p(obj)) -#define SCM_LISTP(obj) SCM_NFALSEP(scm_list_p(obj)) -#define SCM_PROCEDUREP(obj) SCM_NFALSEP(scm_procedure_p(obj)) +#define scm_is_equal(obj1,obj2) scm_is_true(scm_equal_p(obj1,obj2)) +#define scm_is_exact(obj) scm_is_true(scm_exact_p(obj)) +#define scm_is_list(obj) scm_is_true(scm_list_p(obj)) +#define scm_is_procedure(obj) scm_is_true(scm_procedure_p(obj)) diff --git a/src/import-export/qif-import/dialog-account-picker.c b/src/import-export/qif-import/dialog-account-picker.c index b5f9f607b7..23d7ae65cd 100644 --- a/src/import-export/qif-import/dialog-account-picker.c +++ b/src/import-export/qif-import/dialog-account-picker.c @@ -70,27 +70,27 @@ acct_tree_add_accts(SCM accts, GtkTreeRowReference **reference) { GtkTreeIter iter; - char * compname; + const char * compname; char * acctname; gboolean leafnode; SCM current; gboolean checked; - while(!SCM_NULLP(accts)) { + while(!scm_is_null(accts)) { current = SCM_CAR(accts); - if(SCM_NULLP(current)) { + if(scm_is_null(current)) { g_critical("QIF import: BUG DETECTED in acct_tree_add_accts!"); accts = SCM_CDR(accts); continue; } - if (SCM_STRINGP(SCM_CAR(current))) - compname = SCM_STRING_CHARS(SCM_CAR(current)); + if (scm_is_string(SCM_CAR(current))) + compname = scm_to_locale_string(SCM_CAR(current)); else compname = ""; - if (!SCM_NULLP(SCM_CADDR(current))) { + if (!scm_is_null(SCM_CADDR(current))) { leafnode = FALSE; } else { @@ -309,7 +309,7 @@ qif_account_picker_dialog(QIFImportWindow * qif_wind, SCM map_entry) scm_gc_protect_object(wind->map_entry); /* Set the initial account to be selected. */ - wind->selected_name = g_strdup(SCM_STRING_CHARS(orig_acct)); + wind->selected_name = g_strdup(scm_to_locale_string(orig_acct)); xml = gnc_glade_xml_new("qif.glade", "QIF Import Account Picker"); diff --git a/src/import-export/qif-import/druid-qif-import.c b/src/import-export/qif-import/druid-qif-import.c index 07d575ec84..60af595b60 100644 --- a/src/import-export/qif-import/druid-qif-import.c +++ b/src/import-export/qif-import/druid-qif-import.c @@ -236,9 +236,9 @@ update_account_picker_page(QIFImportWindow * wind, SCM make_display, /* clear the list */ gtk_list_store_clear(store); - while(!SCM_NULLP(accts_left)) { - qif_name = SCM_STRING_CHARS(scm_call_1(get_qif_name, SCM_CAR(accts_left))); - gnc_name = SCM_STRING_CHARS(scm_call_1(get_gnc_name, SCM_CAR(accts_left))); + while(!scm_is_null(accts_left)) { + qif_name = scm_to_locale_string(scm_call_1(get_qif_name, SCM_CAR(accts_left))); + gnc_name = scm_to_locale_string(scm_call_1(get_gnc_name, SCM_CAR(accts_left))); checked = (scm_call_1(get_new, SCM_CAR(accts_left)) == SCM_BOOL_T); gtk_list_store_append(store, &iter); @@ -489,7 +489,7 @@ get_prev_druid_page(QIFImportWindow * wind, GnomeDruidPage * page) } /* If no duplicates were found, skip all post-conversion pages. */ - if (where == 3 && SCM_NULLP(wind->match_transactions)) + if (where == 3 && scm_is_null(wind->match_transactions)) prev = NULL; else prev = current->prev; @@ -651,7 +651,7 @@ gnc_ui_qif_import_load_file_back_cb(GnomeDruidPage * page, gpointer arg1, { QIFImportWindow * wind = user_data; - if (SCM_LISTP(wind->imported_files) && + if (scm_is_list(wind->imported_files) && (scm_ilength(wind->imported_files) > 0)) { gnome_druid_set_page(GNOME_DRUID(wind->druid), get_named_page(wind, "loaded_files_page")); @@ -828,7 +828,7 @@ gnc_ui_qif_import_load_progress_show_cb(GtkWidget *widget, wind->busy = FALSE; return; } - else if (load_return == SCM_BOOL_F || !SCM_LISTP(load_return)) + else if (load_return == SCM_BOOL_F || !scm_is_list(load_return)) { /* A bug was detected. */ @@ -847,9 +847,9 @@ gnc_ui_qif_import_load_progress_show_cb(GtkWidget *widget, wind->busy = FALSE; return; } - else if (!SCM_NULLP(load_return)) + else if (!scm_is_null(load_return)) { - const gchar *str = SCM_STRING_CHARS(SCM_CADR(load_return)); + const gchar *str = scm_to_locale_string(SCM_CADR(load_return)); if (SCM_CAR(load_return) == SCM_BOOL_F) { @@ -901,7 +901,7 @@ gnc_ui_qif_import_load_progress_show_cb(GtkWidget *widget, wind->busy = FALSE; return; } - else if (parse_return == SCM_BOOL_F || !SCM_LISTP(parse_return)) + else if (parse_return == SCM_BOOL_F || !scm_is_list(parse_return)) { /* A bug was detected. */ @@ -924,7 +924,7 @@ gnc_ui_qif_import_load_progress_show_cb(GtkWidget *widget, wind->busy = FALSE; return; } - else if (!SCM_NULLP(parse_return)) + else if (!scm_is_null(parse_return)) { /* Are there only warnings? */ if (SCM_CAR(parse_return) == SCM_BOOL_T) @@ -949,7 +949,7 @@ gnc_ui_qif_import_load_progress_show_cb(GtkWidget *widget, gtk_combo_box_remove_text(GTK_COMBO_BOX(wind->date_format_combo), 0); /* Add the formats for the user to select from. */ - while(SCM_LISTP(date_formats) && !SCM_NULLP(date_formats)) + while(scm_is_list(date_formats) && !scm_is_null(date_formats)) { gtk_combo_box_append_text(GTK_COMBO_BOX(wind->date_format_combo), SCM_SYMBOL_CHARS(SCM_CAR(date_formats))); @@ -1061,7 +1061,7 @@ gnc_ui_qif_import_load_progress_next_cb(GnomeDruidPage * page, const gchar * default_acctname; /* Go to the "ask account name" page. */ - default_acctname = SCM_STRING_CHARS(scm_call_1(default_acct, + default_acctname = scm_to_locale_string(scm_call_1(default_acct, wind->selected_file)); gtk_entry_set_text(GTK_ENTRY(wind->acct_entry), default_acctname); @@ -1162,7 +1162,7 @@ gnc_ui_qif_import_date_format_next_cb(GnomeDruidPage * page, SCM default_acct = scm_c_eval_string("qif-file:path-to-accountname"); const gchar * default_acctname; - default_acctname = SCM_STRING_CHARS(scm_call_1(default_acct, + default_acctname = scm_to_locale_string(scm_call_1(default_acct, wind->selected_file)); gtk_entry_set_text(GTK_ENTRY(wind->acct_entry), default_acctname); @@ -1193,7 +1193,7 @@ update_file_page(QIFImportWindow * wind) SCM scm_qiffile = SCM_BOOL_F; SCM qif_file_path; int row = 0; - char * row_text; + const char * row_text; GtkTreeView *view; GtkListStore *store; GtkTreeIter iter; @@ -1206,9 +1206,9 @@ update_file_page(QIFImportWindow * wind) gtk_list_store_clear(store); qif_file_path = scm_c_eval_string("qif-file:path"); - while(!SCM_NULLP(loaded_file_list)) { + while(!scm_is_null(loaded_file_list)) { scm_qiffile = SCM_CAR(loaded_file_list); - row_text = SCM_STRING_CHARS(scm_call_1(qif_file_path, scm_qiffile)); + row_text = scm_to_locale_string(scm_call_1(qif_file_path, scm_qiffile)); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, @@ -1254,7 +1254,7 @@ gnc_ui_qif_import_select_loaded_file_cb(GtkTreeSelection *selection, button = gnc_glade_lookup_widget(wind->window, "unload_file_button"); if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_tree_model_get(model, &iter, FILENAME_COL_INDEX, &row, -1); - if (SCM_LISTP(wind->imported_files) && + if (scm_is_list(wind->imported_files) && (scm_ilength(wind->imported_files) > row)) { scm_gc_unprotect_object(wind->selected_file); wind->selected_file = scm_list_ref(wind->imported_files, @@ -1799,11 +1799,11 @@ gnc_ui_qif_import_account_next_cb(GnomeDruidPage * page, QIFImportWindow * wind = user_data; /* If there are category mappings then proceed as usual. */ - if (SCM_LISTP(wind->cat_display_info) && !SCM_NULLP(wind->cat_display_info)) + if (scm_is_list(wind->cat_display_info) && !scm_is_null(wind->cat_display_info)) return gnc_ui_qif_import_generic_next_cb(page, arg1, user_data); /* If there are memo mappings then skip to that step. */ - if (SCM_LISTP(wind->memo_display_info) && !SCM_NULLP(wind->memo_display_info)) + if (scm_is_list(wind->memo_display_info) && !scm_is_null(wind->memo_display_info)) { if (wind->show_doc_pages) gnome_druid_set_page(GNOME_DRUID(wind->druid), @@ -1859,7 +1859,7 @@ gnc_ui_qif_import_category_next_cb(GnomeDruidPage * page, QIFImportWindow * wind = user_data; /* If there aren't any payee/memo mappings then skip that step. */ - if (!SCM_LISTP(wind->memo_display_info) || SCM_NULLP(wind->memo_display_info)) + if (!scm_is_list(wind->memo_display_info) || scm_is_null(wind->memo_display_info)) { gnome_druid_set_page(GNOME_DRUID(wind->druid), get_named_page(wind, "currency_page")); @@ -1906,7 +1906,7 @@ gnc_ui_qif_import_memo_doc_back_cb(GnomeDruidPage * page, gpointer arg1, QIFImportWindow * wind = user_data; /* If there are no categories to show, go to account matching. */ - if (!SCM_LISTP(wind->cat_display_info) || SCM_NULLP(wind->cat_display_info)) + if (!scm_is_list(wind->cat_display_info) || scm_is_null(wind->cat_display_info)) { gnome_druid_set_page(GNOME_DRUID(wind->druid), @@ -1933,7 +1933,7 @@ gnc_ui_qif_import_memo_back_cb(GnomeDruidPage * page, gpointer arg1, /* If documentation is off and there are no categories to show, * skip directly to account matching. */ if (!wind->show_doc_pages && - (!SCM_LISTP(wind->cat_display_info) || SCM_NULLP(wind->cat_display_info))) + (!scm_is_list(wind->cat_display_info) || scm_is_null(wind->cat_display_info))) { gnome_druid_set_page(GNOME_DRUID(wind->druid), @@ -2003,7 +2003,7 @@ gnc_ui_qif_import_currency_back_cb(GnomeDruidPage * page, QIFImportWindow * wind = user_data; /* If there are payee/memo mappings to display, go there. */ - if (SCM_LISTP(wind->memo_display_info) && !SCM_NULLP(wind->memo_display_info)) + if (scm_is_list(wind->memo_display_info) && !scm_is_null(wind->memo_display_info)) { gnome_druid_set_page(GNOME_DRUID(wind->druid), get_named_page(wind, "memo_match_page")); @@ -2011,7 +2011,7 @@ gnc_ui_qif_import_currency_back_cb(GnomeDruidPage * page, } /* If there are category mappings to display, go there. */ - if (SCM_LISTP(wind->cat_display_info) && !SCM_NULLP(wind->cat_display_info)) + if (scm_is_list(wind->cat_display_info) && !scm_is_null(wind->cat_display_info)) { gnome_druid_set_page(GNOME_DRUID(wind->druid), get_named_page(wind, "category_match_page")); @@ -2279,7 +2279,7 @@ prepare_security_pages(QIFImportWindow * wind) gnc_set_busy_cursor(NULL, TRUE); securities = wind->new_securities; current = wind->commodity_pages; - while (!SCM_NULLP(securities) && (securities != SCM_BOOL_F)) + while (!scm_is_null(securities) && (securities != SCM_BOOL_F)) { if (current) { @@ -2430,12 +2430,12 @@ gnc_ui_qif_import_prepare_duplicates(QIFImportWindow * wind) store = GTK_LIST_STORE(gtk_tree_view_get_model(view)); gtk_list_store_clear(store); - if (!SCM_LISTP(wind->match_transactions)) + if (!scm_is_list(wind->match_transactions)) return; /* Loop through the list of new, potentially duplicate transactions. */ duplicates = wind->match_transactions; - while (!SCM_NULLP(duplicates)) + while (!scm_is_null(duplicates)) { current_xtn = SCM_CAAR(duplicates); #define FUNC_NAME "xaccTransCountSplits" @@ -2643,7 +2643,7 @@ gnc_ui_qif_import_convert_progress_show_cb(GtkWidget *widget, wind->busy = FALSE; return; } - else if (SCM_SYMBOLP(retval)) + else if (scm_is_symbol(retval)) { /* An error was encountered during conversion. */ @@ -2789,7 +2789,7 @@ gnc_ui_qif_import_convert_progress_next_cb(GnomeDruidPage * page, { QIFImportWindow *wind = user_data; - if (SCM_NULLP(wind->match_transactions)) + if (scm_is_null(wind->match_transactions)) { /* No potential duplicates, so skip to the last page. */ gnome_druid_set_page(GNOME_DRUID(wind->druid), @@ -2881,7 +2881,7 @@ refresh_old_transactions(QIFImportWindow * wind, int selection) scm_call_2(scm_c_eval_string("qif-import:refresh-match-selection"), possible_matches, scm_int2num(selection)); - while(!SCM_NULLP(possible_matches)) { + while(!scm_is_null(possible_matches)) { current_xtn = SCM_CAR(possible_matches); #define FUNC_NAME "xaccTransCountSplits" gnc_xtn = SWIG_MustGetPtr(SCM_CAR(current_xtn), diff --git a/src/report/report-gnome/dialog-column-view.c b/src/report/report-gnome/dialog-column-view.c index 195dc7c3ff..421a9c8bc7 100644 --- a/src/report/report-gnome/dialog-column-view.c +++ b/src/report/report-gnome/dialog-column-view.c @@ -126,7 +126,7 @@ update_display_lists(gnc_column_view_edit * view) /* Update the list of available reports (left selection box). */ row = view->available_selected; - if(SCM_LISTP(view->available_list) && !SCM_NULLP (view->available_list)) { + if(scm_is_list(view->available_list) && !scm_is_null (view->available_list)) { row = MIN (row, scm_ilength (view->available_list) - 1); selection = scm_list_ref (view->available_list, scm_int2num (row)); } @@ -141,11 +141,11 @@ update_display_lists(gnc_column_view_edit * view) store = GTK_LIST_STORE(gtk_tree_view_get_model(view->available)); gtk_list_store_clear(store); - if(SCM_LISTP(names)) { - for(i = 0; !SCM_NULLP(names); names = SCM_CDR(names), i++) { - if (SCM_EQUALP (SCM_CAR(names), selection)) + if(scm_is_list(names)) { + for(i = 0; !scm_is_null(names); names = SCM_CDR(names), i++) { + if (scm_is_equal (SCM_CAR(names), selection)) row = i; - name = _(SCM_STRING_CHARS(scm_call_2(template_menu_name, SCM_CAR(names), + name = _(scm_to_locale_string(scm_call_2(template_menu_name, SCM_CAR(names), SCM_BOOL_F))); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, @@ -165,7 +165,7 @@ update_display_lists(gnc_column_view_edit * view) /* Update the list of selected reports (right selection box). */ row = view->contents_selected; - if(SCM_LISTP(view->contents_list) && !SCM_NULLP (view->contents_list)) { + if(scm_is_list(view->contents_list) && !scm_is_null (view->contents_list)) { row = MIN (row, scm_ilength (view->contents_list) - 1); selection = scm_list_ref (view->contents_list, scm_int2num (row)); } @@ -179,14 +179,14 @@ update_display_lists(gnc_column_view_edit * view) store = GTK_LIST_STORE(gtk_tree_view_get_model(view->contents)); gtk_list_store_clear(store); - if(SCM_LISTP(contents)) { - for(i = 0; !SCM_NULLP(contents); contents = SCM_CDR(contents), i++) { - if (SCM_EQUALP (SCM_CAR(contents), selection)) + if(scm_is_list(contents)) { + for(i = 0; !scm_is_null(contents); contents = SCM_CDR(contents), i++) { + if (scm_is_equal (SCM_CAR(contents), selection)) row = i; id = scm_num2int(SCM_CAAR(contents), SCM_ARG1, G_STRFUNC); this_report = gnc_report_find(id); - name = _(SCM_STRING_CHARS(scm_call_1(report_menu_name, this_report))); + name = _(scm_to_locale_string(scm_call_1(report_menu_name, this_report))); gtk_list_store_append(store, &iter); gtk_list_store_set @@ -409,7 +409,7 @@ gnc_column_view_edit_add_cb(GtkButton * button, gpointer user_data) int count; int oldlength, id; - if(SCM_LISTP(r->available_list) && + if(scm_is_list(r->available_list) && (scm_ilength(r->available_list) > r->available_selected)) { template_name = scm_list_ref(r->available_list, scm_int2num(r->available_selected)); @@ -464,7 +464,7 @@ gnc_column_view_edit_remove_cb(GtkButton * button, gpointer user_data) int count; int oldlength; - if(SCM_LISTP(r->contents_list)) { + if(scm_is_list(r->contents_list)) { oldlength = scm_ilength(r->contents_list); if(oldlength > r->contents_selected) { for(count=0; count < r->contents_selected; count++) { diff --git a/src/report/report-gnome/dialog-custom-report.c b/src/report/report-gnome/dialog-custom-report.c index 599a56f6bb..39e86e7bca 100644 --- a/src/report/report-gnome/dialog-custom-report.c +++ b/src/report/report-gnome/dialog-custom-report.c @@ -112,13 +112,13 @@ update_report_list(GtkListStore *store, CustomReportDialog *crd) gtk_list_store_clear(store); - if(SCM_LISTP(names)) { + if(scm_is_list(names)) { /* for all the names in the list, store them, with a reference, in the gtkliststore */ - for (i=0; !SCM_NULLP(names); i++) { + for (i=0; !scm_is_null(names); i++) { - name = SCM_STRING_CHARS(scm_call_2(template_menu_name, SCM_CAR(names), SCM_BOOL_F)); + name = scm_to_locale_string(scm_call_2(template_menu_name, SCM_CAR(names), SCM_BOOL_F)); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, @@ -184,7 +184,7 @@ custom_report_run_report(SCM guid, int report_id; GncMainWindow *window = crd->window; - if(!SCM_NULLP(guid)) + if(!scm_is_null(guid)) { /* this runs the report */ @@ -295,15 +295,15 @@ on_delete_custom_report_clicked(GtkWidget *button, SCM template_menu_name = scm_c_eval_string("gnc:report-template-menu-name/report-guid"); SCM guid; - gchar* report_name; + const gchar* report_name; sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(crd->reportview)); guid = get_custom_report_selection(crd, _("You must select a report to delete.")); - report_name = SCM_STRING_CHARS(scm_call_2(template_menu_name, guid, SCM_BOOL_F)); + report_name = scm_to_locale_string(scm_call_2(template_menu_name, guid, SCM_BOOL_F)); /* we must confirm the user wants to delete their precious custom report! */ - if (!SCM_NULLP(guid) + if (!scm_is_null(guid) && gnc_verify_dialog(crd->dialog, FALSE, "Are you sure you want to delete %s?", report_name)) { SCM del_report = scm_c_eval_string("gnc:delete-report"); diff --git a/src/report/report-gnome/dialog-style-sheet.c b/src/report/report-gnome/dialog-style-sheet.c index 8e8366cf62..2a0847e07f 100644 --- a/src/report/report-gnome/dialog-style-sheet.c +++ b/src/report/report-gnome/dialog-style-sheet.c @@ -71,15 +71,15 @@ dirty_same_stylesheet(gpointer key, gpointer val, gpointer data) SCM func = NULL; func = scm_c_eval_string("gnc:report-stylesheet"); - if (SCM_PROCEDUREP(func)) + if (scm_is_procedure(func)) rep_ss = scm_call_1(func, report); else return; - if (SCM_NFALSEP(scm_eq_p(rep_ss, dirty_ss))) { + if (scm_is_true(scm_eq_p(rep_ss, dirty_ss))) { func = scm_c_eval_string("gnc:report-set-dirty?!"); /* This makes _me_ feel dirty! */ - if (SCM_PROCEDUREP(func)) + if (scm_is_procedure(func)) scm_call_2(func, report, SCM_BOOL_T); } } @@ -191,10 +191,10 @@ gnc_style_sheet_new (StyleSheetDialog * ssd) gtk_list_store_clear(GTK_LIST_STORE(template_model)); /* put in the list of style sheet type names */ - for(; !SCM_NULLP(templates); templates=SCM_CDR(templates)) { + for(; !scm_is_null(templates); templates=SCM_CDR(templates)) { SCM t = SCM_CAR(templates); gtk_combo_box_append_text(GTK_COMBO_BOX(template_combo), - SCM_STRING_CHARS(scm_call_1(t_name, t))); + scm_to_locale_string(scm_call_1(t_name, t))); } gtk_combo_box_set_active(GTK_COMBO_BOX(template_combo), 0); @@ -233,7 +233,7 @@ gnc_style_sheet_select_dialog_add_one(StyleSheetDialog * ss, get_name = scm_c_eval_string("gnc:html-style-sheet-name"); scm_name = scm_call_1(get_name, sheet_info); - c_name = SCM_STRING_CHARS(scm_name); + c_name = scm_to_locale_string(scm_name); if (!c_name) return; @@ -258,7 +258,7 @@ gnc_style_sheet_select_dialog_fill(StyleSheetDialog * ss) SCM sheet_info; /* pack it full of content */ - for(; !SCM_NULLP(stylesheets); stylesheets=SCM_CDR(stylesheets)) { + for(; !scm_is_null(stylesheets); stylesheets=SCM_CDR(stylesheets)) { sheet_info = SCM_CAR(stylesheets); gnc_style_sheet_select_dialog_add_one(ss, sheet_info, FALSE); } diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c index f8669c8146..3e9e03bf29 100644 --- a/src/report/report-gnome/gnc-plugin-page-report.c +++ b/src/report/report-gnome/gnc-plugin-page-report.c @@ -705,7 +705,7 @@ gnc_plugin_page_report_save_page (GncPluginPage *plugin_page, report = GNC_PLUGIN_PAGE_REPORT(plugin_page); priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report); - if (!priv || !priv->cur_report || SCM_NULLP(priv->cur_report) || + if (!priv || !priv->cur_report || scm_is_null(priv->cur_report) || SCM_UNBNDP(priv->cur_report) || SCM_BOOL_F == priv->cur_report) { LEAVE("not saving invalid report"); return; @@ -718,30 +718,30 @@ gnc_plugin_page_report_save_page (GncPluginPage *plugin_page, while (count-- > 0) { item = SCM_CAR(embedded); embedded = SCM_CDR(embedded); - if (!SCM_NUMBERP(item)) + if (!scm_is_number(item)) continue; id = SCM_INUM(item); tmp_report = gnc_report_find(id); scm_text = scm_call_1(gen_save_text, tmp_report); - if (!SCM_STRINGP (scm_text)) { + if (!scm_is_string (scm_text)) { DEBUG("child report %d: nothing to save", id); continue; } key_name = g_strdup_printf(SCHEME_OPTIONS_N, id); - text = gnc_guile_strip_comments(SCM_STRING_CHARS(scm_text)); + text = gnc_guile_strip_comments(scm_to_locale_string(scm_text)); g_key_file_set_string(key_file, group_name, key_name, text); g_free(text); g_free(key_name); } scm_text = scm_call_1(gen_save_text, priv->cur_report); - if (!SCM_STRINGP (scm_text)) { + if (!scm_is_string (scm_text)) { LEAVE("nothing to save"); return; } - text = gnc_guile_strip_comments(SCM_STRING_CHARS(scm_text)); + text = gnc_guile_strip_comments(scm_to_locale_string(scm_text)); g_key_file_set_string(key_file, group_name, SCHEME_OPTIONS, text); g_free(text); LEAVE(" "); @@ -924,7 +924,7 @@ gnc_plugin_page_report_destroy(GncPluginPageReportPrivate * priv) SCM edited, editor; /* close any open editors */ - for (edited = scm_list_copy(priv->edited_reports); !SCM_NULLP(edited); + for (edited = scm_list_copy(priv->edited_reports); !scm_is_null(edited); edited = SCM_CDR(edited)) { editor = scm_call_1(get_editor, SCM_CAR(edited)); scm_call_2(set_editor, SCM_CAR(edited), SCM_BOOL_F); @@ -1251,16 +1251,16 @@ gnc_get_export_type_choice (SCM export_types) int choice; SCM tail; - if (!SCM_LISTP (export_types)) + if (!scm_is_list (export_types)) return SCM_BOOL_F; - for (tail = export_types; !SCM_NULLP (tail); tail = SCM_CDR (tail)) + for (tail = export_types; !scm_is_null (tail); tail = SCM_CDR (tail)) { SCM pair = SCM_CAR (tail); const gchar * name; SCM scm; - if (!SCM_CONSP (pair)) + if (!scm_is_pair (pair)) { g_warning ("unexpected list element"); bad = TRUE; @@ -1268,14 +1268,14 @@ gnc_get_export_type_choice (SCM export_types) } scm = SCM_CAR (pair); - if (!SCM_STRINGP (scm)) + if (!scm_is_string (scm)) { g_warning ("unexpected pair element"); bad = TRUE; break; } - name = SCM_STRING_CHARS (scm); + name = scm_to_locale_string (scm); choices = g_list_prepend (choices, g_strdup (name)); } @@ -1323,7 +1323,7 @@ gnc_get_export_filename (SCM choice) type = _("HTML"); else { - type = SCM_STRING_CHARS(SCM_CAR (choice)); + type = scm_to_locale_string(SCM_CAR (choice)); } /* %s is the type of what is about to be saved, e.g. "HTML". */ @@ -1412,7 +1412,7 @@ gnc_plugin_page_report_export_cb( GtkAction *action, GncPluginPageReport *report export_thunk = scm_call_1 (scm_c_eval_string ("gnc:report-export-thunk"), priv->cur_report); - if (SCM_LISTP (export_types) && SCM_PROCEDUREP (export_thunk)) + if (scm_is_list (export_types) && scm_is_procedure (export_thunk)) choice = gnc_get_export_type_choice (export_types); else choice = SCM_BOOL_T; @@ -1424,7 +1424,7 @@ gnc_plugin_page_report_export_cb( GtkAction *action, GncPluginPageReport *report if (!filepath) return; - if (SCM_CONSP (choice)) + if (scm_is_pair (choice)) { SCM file_scm; SCM res; diff --git a/src/report/report-gnome/window-report.c b/src/report/report-gnome/window-report.c index b3ae92f464..b05a7cc37e 100644 --- a/src/report/report-gnome/window-report.c +++ b/src/report/report-gnome/window-report.c @@ -153,8 +153,8 @@ gnc_report_window_default_params_editor(SCM options, SCM report) ptr = scm_call_1(get_template, ptr); if (ptr != SCM_BOOL_F) { ptr = scm_call_1(get_template_name, ptr); - if (SCM_STRINGP(ptr)) - title = SCM_STRING_CHARS(ptr); + if (scm_is_string(ptr)) + title = scm_to_locale_string(ptr); } } diff --git a/src/report/report-system/gnc-report.c b/src/report/report-system/gnc-report.c index 248e5e5d01..8513ef1350 100644 --- a/src/report/report-system/gnc-report.c +++ b/src/report/report-system/gnc-report.c @@ -76,7 +76,7 @@ gint gnc_report_add(SCM report) gnc_report_init_table(); value = scm_call_1(get_id, report); - if (SCM_NUMBERP(value)) { + if (scm_is_number(value)) { id = scm_num2int(value, SCM_ARG1, G_STRFUNC); if (!g_hash_table_lookup(reports, &id)) { key = g_new(gint, 1); @@ -146,10 +146,10 @@ gnc_run_report (gint report_id, char ** data) scm_text = gfec_eval_string(str, error_handler); g_free(str); - if (scm_text == SCM_UNDEFINED || !SCM_STRINGP (scm_text)) + if (scm_text == SCM_UNDEFINED || !scm_is_string (scm_text)) return FALSE; - free_data = SCM_STRING_CHARS (scm_text); + free_data = scm_to_locale_string (scm_text); *data = g_strdup (free_data); return TRUE; @@ -183,9 +183,9 @@ gnc_report_name( SCM report ) return NULL; value = scm_call_1(get_name, report); - if (!SCM_STRINGP(value)) + if (!scm_is_string(value)) return NULL; - return g_strdup(SCM_STRING_CHARS(value)); + return g_strdup(scm_to_locale_string(value)); }