本文整理汇总了C++中scm_call_1函数的典型用法代码示例。如果您正苦于以下问题:C++ scm_call_1函数的具体用法?C++ scm_call_1怎么用?C++ scm_call_1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scm_call_1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: game_process_event
static void
game_process_event (Game *game)
{
static ALLEGRO_EVENT event;
al_wait_for_event(game->event_queue, &event);
if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
{
game->running = false;
}
else if (event.type == ALLEGRO_EVENT_TIMER)
{
game_update (game);
}
else if (event.type == ALLEGRO_EVENT_KEY_UP)
{
if (scm_is_true (game->on_key_released))
{
scm_call_1 (game->on_key_released, scm_from_int (event.keyboard.keycode));
}
}
else if (event.type == ALLEGRO_EVENT_KEY_DOWN)
{
if (scm_is_true (game->on_key_pressed))
{
scm_call_1 (game->on_key_pressed, scm_from_int (event.keyboard.keycode));
}
}
}
示例2: gnc_get_credit_string
/********************************************************************\
* 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;
string = scm_to_locale_string(result);
if (string)
return g_strdup(string);
return NULL;
}
示例3: servlet_run
static int servlet_run(lua_State *l)
{
SCM run_ref = (SCM)lua_touserdata(l, lua_upvalueindex(1));
SCM s = scm_from_pointer(l, NULL);
scm_call_1(run_ref, s);
return 0;
}
示例4: g_return_val_if_fail
/*! \brief Get symbol data from a Scheme-based component source.
* \par Function Description
* Get symbol data from a Scheme-based component source. The return
* value should be free()'d when no longer needed.
*
* Private function used only in s_clib.c.
*
* \param symbol Symbol to get data for.
* \return Allocated buffer containing symbol data.
*/
static gchar *get_data_scm (const CLibSymbol *symbol)
{
SCM symdata;
char *tmp;
gchar *result;
g_return_val_if_fail ((symbol != NULL), NULL);
g_return_val_if_fail ((symbol->source->type == CLIB_SCM), NULL);
symdata = scm_call_1 (symbol->source->get_fn,
scm_from_utf8_string (symbol->name));
if (!scm_is_string (symdata)) {
s_log_message (_("Failed to load symbol data [%1$s] from source [%2$s]"),
symbol->name, symbol->source->name);
return NULL;
}
/* Need to make sure that the correct free() function is called
* on strings allocated by Guile. */
tmp = scm_to_utf8_string (symdata);
result = g_strdup(tmp);
free (tmp);
return result;
}
示例5: scm_c_primitive_eval
static SCM
scm_c_primitive_eval (SCM exp)
{
if (!SCM_EXPANDED_P (exp))
exp = scm_call_1 (scm_current_module_transformer (), exp);
return eval (scm_memoize_expression (exp), SCM_BOOL_F);
}
示例6: gnc_guile_call1_to_string
/********************************************************************\
* 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;
}
示例7: scscm_call_1_body
static SCM
scscm_call_1_body (void *argsp)
{
SCM *args = argsp;
return scm_call_1 (args[0], args[1]);
}
示例8: gnc_is_trans_scm
/********************************************************************\
* gnc_is_trans_scm *
* returns true if the scm object is a scheme transaction *
* *
* Args: scm - a scheme object *
* Returns: true if scm is a scheme transaction *
\********************************************************************/
gboolean
gnc_is_trans_scm(SCM scm)
{
initialize_scm_functions();
return scm_is_true(scm_call_1(predicates.is_trans_scm, scm));
}
示例9: scm_gsl_errno_to_symbol
VISIBLE SCM
scm_gsl_errno_to_symbol (SCM errval)
{
return
scm_call_1 (scm_c_public_ref ("sortsmill math gsl", "gsl-errno->symbol"),
errval);
}
示例10: ragnarok_go
static void ragnarok_go()
{
SCM main = RAG_GET_FROM_MODULE("ragnarok main" ,"main");
SCM args = scm_program_arguments();
scm_call_1(main ,args);
}
示例11: gfec_eval_string
SCM
gfec_eval_string(const char *str, gfec_error_handler error_handler)
{
SCM result = SCM_UNDEFINED;
SCM func = scm_c_eval_string("gnc:eval-string-with-error-handling");
if (scm_is_procedure(func))
{
char *err_msg = NULL;
SCM call_result, error = SCM_UNDEFINED;
call_result = scm_call_1 (func, scm_from_utf8_string (str));
error = scm_list_ref (call_result, scm_from_uint (1));
if (scm_is_true (error))
err_msg = gnc_scm_to_utf8_string (error);
else
result = scm_list_ref (call_result, scm_from_uint (0));
if (err_msg != NULL)
{
if (error_handler)
error_handler (err_msg);
free(err_msg);
}
}
return result;
}
示例12: gnc_plugin_business_reload_module
static void
gnc_plugin_business_reload_module (const gchar *name)
{
SCM file_scm;
file_scm = scm_makfrom0str (name);
scm_call_1(scm_c_eval_string("gnc:reload-module"), file_scm);
}
示例13: body_proc
static SCM body_proc(void *data) {
SCM obj;
char *linebuf = (char *)data;
obj = scm_c_eval_string(linebuf);
if (obj == SCM_UNSPECIFIED) return SCM_BOOL_T;
scm_call_1(console_display, obj);
scm_remember_upto_here_1(obj);
return SCM_BOOL_T;
}
示例14: weechat_guile_scm_call_1
SCM
weechat_guile_scm_call_1 (void *proc)
{
struct t_guile_function *guile_function;
guile_function = (struct t_guile_function *)proc;
return scm_call_1 (guile_function->proc, guile_function->args);
}
示例15: gnc_ui_custom_report_edit_name
/***********************************************************
* gnc_ui_custom_report_edit_name
*
* open the custom report dialog and highlight the given
* report's name for editing.
***********************************************************/
void
gnc_ui_custom_report_edit_name (GncMainWindow * window, SCM scm_guid)
{
SCM is_custom_report;
CustomReportDialog *crd = gnc_ui_custom_report_internal (window);
GtkTreeModel *model;
GtkTreeIter iter;
GncGUID *guid;
gchar *guid_str;
gboolean valid_iter;
is_custom_report = scm_c_eval_string ("gnc:report-template-is-custom/template-guid?");
if (scm_is_false (scm_call_1 (is_custom_report, scm_guid)))
return;
guid = guid_malloc ();
guid_str = scm_to_utf8_string (scm_guid);
if (!string_to_guid (guid_str, guid))
goto cleanup;
/* Look up the row for the requested guid */
model = gtk_tree_view_get_model (GTK_TREE_VIEW (crd->reportview));
valid_iter = gtk_tree_model_get_iter_first (model, &iter);
while (valid_iter)
{
GValue value = { 0, };
GncGUID *row_guid;
gtk_tree_model_get_value (model, &iter, COL_NUM, &value);
row_guid = (GncGUID *) g_value_get_pointer (&value);
if (guid_equal (guid, row_guid))
{
/* We found the row for the requested guid
* Now let's set the report's name cell in edit mode
* so the user can edit the name.
*/
GtkTreePath *path;
GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (crd->reportview));
gtk_tree_selection_select_iter (selection, &iter);
path = gtk_tree_model_get_path (model, &iter);
g_object_set(G_OBJECT(crd->namerenderer), "editable", TRUE, NULL);
gtk_tree_view_set_cursor_on_cell (GTK_TREE_VIEW (crd->reportview),
path, crd->namecol,
crd->namerenderer, TRUE);
break;
}
g_value_unset (&value);
valid_iter = gtk_tree_model_iter_next (model, &iter);
}
cleanup:
guid_free (guid);
}