/* Scheme interface to scm_error_scm. */ void scm_error (SCM key, const char *subr, const char *message, SCM args, SCM rest) { scm_error_scm (key, (subr == NULL) ? SCM_BOOL_F : scm_from_locale_string (subr), (message == NULL) ? SCM_BOOL_F : scm_from_locale_string (message), args, rest); }
SCM mu_guile_g_error (const char *func_name, GError *err) { scm_error_scm (scm_from_locale_symbol ("MuError"), scm_from_utf8_string (func_name), scm_from_utf8_string (err ? err->message : "error"), SCM_UNDEFINED, SCM_UNDEFINED); return SCM_UNSPECIFIED; }
SCM mu_guile_error (const char *func_name, int status, const char *fmt, SCM args) { scm_error_scm (scm_from_locale_symbol ("MuError"), scm_from_utf8_string (func_name ? func_name : "<nameless>"), scm_from_utf8_string (fmt), args, scm_list_1 (scm_from_int (status))); return SCM_UNSPECIFIED; }
// Load one of data into the model. The vararg should be a list of values with // length equal to the number of discrete columns plus the number of continuous // columns. The first values in the vararg are taken to be discrete, followed // by the continuous values. // SCM thit_load_row_x(SCM s_model, SCM s_varargs) { scm_assert_smob_type(thit_model_tag, s_model); banmi_model_t *model = (banmi_model_t*)SCM_SMOB_DATA(s_model); int n_col = model->n_disc + model->n_cont; int n_args = scm_to_int(scm_length(s_varargs)); if (model->n_rows == model->disc->size1) scm_error_scm(thit_error, scm_from_locale_string("load-row!"), scm_from_locale_string("The model is full, can't add more rows."), scm_list_2(scm_from_int(n_col), scm_from_int(n_args)), SCM_BOOL_F); if (n_args != n_col) scm_error_scm(thit_error, scm_from_locale_string("load-row!"), scm_from_locale_string("Expected ~A values, got ~A."), scm_list_2(scm_from_int(n_col), scm_from_int(n_args)), SCM_BOOL_F); int j, ival; for (j = 0; j < model->n_disc; j++) { ival = scm_to_int(scm_list_ref(s_varargs, scm_from_int(j))); gsl_matrix_int_set(model->disc, model->n_rows, j, ival); } double dval; for (j = 0; j < model->n_cont; j++) { dval = scm_to_double(scm_list_ref(s_varargs, scm_from_int(j + model->n_disc))); gsl_matrix_set(model->cont, model->n_rows, j, dval); } model->n_rows++; return SCM_BOOL_T; }
static void error_unrecognized_keyword (SCM proc) { scm_error_scm (scm_from_latin1_symbol ("keyword-argument-error"), proc, scm_from_locale_string ("Unrecognized keyword"), SCM_EOL, SCM_BOOL_F); }
static void error_invalid_keyword (SCM proc, SCM obj) { scm_error_scm (scm_from_latin1_symbol ("keyword-argument-error"), proc, scm_from_locale_string ("Invalid keyword"), SCM_EOL, scm_list_1 (obj)); }