• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ scm_c_eval_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中scm_c_eval_string函数的典型用法代码示例。如果您正苦于以下问题:C++ scm_c_eval_string函数的具体用法?C++ scm_c_eval_string怎么用?C++ scm_c_eval_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了scm_c_eval_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: libgncmod_report_system_gnc_module_init

int
libgncmod_report_system_gnc_module_init(int refcount)
{
    /* load the engine (we depend on it) */
    if (!gnc_module_load("gnucash/engine", 0))
    {
        return FALSE;
    }

    if (!gnc_module_load("gnucash/app-utils", 0))
    {
        return FALSE;
    }
    scm_init_sw_report_system_module();

    scm_c_eval_string("(use-modules (gnucash report report-system))");

    /* if this is the first time the module's being loaded, initialize
     * the relative date system */
    if (refcount == 0)
    {
        scm_c_eval_string("(gnc:reldate-initialize)");
    }

    return TRUE;
}
开发者ID:573,项目名称:gnucash,代码行数:26,代码来源:gncmod-report-system.c


示例2: update_report_list

/********************************************************************
 * update_report_list
 *
 * this procedure does the real work of displaying a sorted list of
 * available custom reports
 ********************************************************************/
static void
update_report_list(GtkListStore *store, CustomReportDialog *crd)
{
    SCM get_rpt_guids = scm_c_eval_string("gnc:custom-report-template-guids");
    SCM template_menu_name = scm_c_eval_string("gnc:report-template-menu-name/report-guid");
    SCM rpt_guids;
    int i;
    GtkTreeIter iter;
    GtkTreeModel *model = GTK_TREE_MODEL (store);
    gboolean valid_iter;

    gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), COL_NAME, GTK_SORT_ASCENDING);

    crd->reportlist = scm_call_0(get_rpt_guids);
    rpt_guids = crd->reportlist;

    /* Empty current liststore */
    valid_iter = gtk_tree_model_get_iter_first (model, &iter);
    while (valid_iter)
    {
        GValue value = { 0, };
        GncGUID *row_guid;
        g_value_init ( &value, G_TYPE_POINTER);
        gtk_tree_model_get_value (model, &iter, COL_NUM, &value);
        row_guid = (GncGUID *) g_value_get_pointer (&value);
        guid_free (row_guid);
        g_value_unset (&value);
        valid_iter = gtk_tree_model_iter_next (model, &iter);
    }
    gtk_list_store_clear(store);

    if (scm_is_list(rpt_guids))
    {
        /* for all the report guids in the list, store them, with a reference,
        	 in the gtkliststore */
        for (i = 0; !scm_is_null(rpt_guids); i++)
        {
            GncGUID *guid = guid_malloc ();
            gchar *guid_str = scm_to_utf8_string (SCM_CAR(rpt_guids));
            gchar *name = gnc_scm_to_utf8_string (scm_call_2(template_menu_name, SCM_CAR(rpt_guids), SCM_BOOL_F));

            if (string_to_guid (guid_str, guid))
            {
                gtk_list_store_append(store, &iter);
                gtk_list_store_set(store, &iter,
                                   COL_NAME, name,
                                   COL_NUM, guid,
                                   -1);
            }
            g_free (name);
            g_free (guid_str);

            rpt_guids = SCM_CDR(rpt_guids);
        }
    }
}
开发者ID:814ckf0x,项目名称:gnucash,代码行数:62,代码来源:dialog-custom-report.c


示例3: inner_main_add_price_quotes

static void
inner_main_add_price_quotes(void *closure, int argc, char **argv)
{
    SCM mod, add_quotes, scm_book, scm_result = SCM_BOOL_F;
    QofSession *session = NULL;

    scm_c_eval_string("(debug-set! stack 200000)");

    mod = scm_c_resolve_module("gnucash price-quotes");
    scm_set_current_module(mod);

    load_gnucash_modules();

    qof_event_suspend();
    scm_c_eval_string("(gnc:price-quotes-install-sources)");

    if (!gnc_quote_source_fq_installed())
    {
        g_print("%s", _("No quotes retrieved. Finance::Quote isn't "
                        "installed properly.\n"));
        goto fail;
    }

    add_quotes = scm_c_eval_string("gnc:book-add-quotes");
    session = gnc_get_current_session();
    if (!session) goto fail;

    qof_session_begin(session, add_quotes_file, FALSE, FALSE);
    if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR) goto fail;

    qof_session_load(session, NULL);
    if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR) goto fail;

    scm_book = gnc_book_to_scm(qof_session_get_book(session));
    scm_result = scm_call_2(add_quotes, SCM_BOOL_F, scm_book);

    qof_session_save(session, NULL);
    if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR) goto fail;

    qof_session_destroy(session);
    if (!scm_is_true(scm_result))
    {
        g_warning("Failed to add quotes to %s.", add_quotes_file);
        goto fail;
    }

    qof_event_resume();
    gnc_shutdown(0);
    return;
fail:
    if (session && qof_session_get_error(session) != ERR_BACKEND_NO_ERR)
        g_warning("Session Error: %s", qof_session_get_error_message(session));
    qof_event_resume();
    gnc_shutdown(1);
}
开发者ID:cstim,项目名称:gnucash-svn,代码行数:55,代码来源:gnucash-bin.c


示例4: libgncmodfoo_gnc_module_init

int
libgncmodfoo_gnc_module_init(int refcount)
{
    /* publish the wrapped Scheme bindings for libfoo */
    scm_init_sw_foo_module();
    scm_c_eval_string("(use-modules (sw_foo))");

    /* use the Scheme "foo" module */
    scm_c_eval_string("(use-modules (gnucash foo))");

    return TRUE;
}
开发者ID:573,项目名称:gnucash,代码行数:12,代码来源:gnc-mod-foo.c


示例5: libgncmod_bar_gnc_module_init

int
libgncmod_bar_gnc_module_init(int refcount)
{
    /* publish the wrapped Scheme bindings for libbar */
    scm_init_sw_bar_module();
    scm_c_eval_string("(use-modules (sw_bar))");

    /* use the Scheme "bar" module */
    scm_c_eval_string("(use-modules (gnucash bar))");

    return TRUE;
}
开发者ID:Mechtilde,项目名称:gnucash,代码行数:12,代码来源:gnc-mod-bar.c


示例6: libgncmod_business_gnome_gnc_module_init

int
libgncmod_business_gnome_gnc_module_init(int refcount)
{
    /* load app-utils: we depend on it -- and it depends on the engine */
    if (!gnc_module_load ("gnucash/app-utils", 0))
    {
        return FALSE;
    }
    /* We also depend on gnome-utils and gnome-search modules */
    if (!gnc_module_load ("gnucash/gnome-utils", 0))
    {
        return FALSE;
    }
    if (!gnc_module_load ("gnucash/gnome-search", 0))
    {
        return FALSE;
    }
    if (!gnc_module_load ("gnucash/report/report-gnome", 0))
    {
        return FALSE;
    }

    scm_c_eval_string("(use-modules (gnucash business-gnome))");
    scm_c_eval_string("(use-modules (gnucash report business-reports))");

    if (refcount == 0)
    {
        /* Register the Owner search type */
        gnc_search_core_register_type (GNC_OWNER_MODULE_NAME,
                                       (GNCSearchCoreNew) gnc_search_owner_new);
        gnc_business_urls_initialize ();
        gnc_business_options_gnome_initialize ();

        gnc_plugin_manager_add_plugin (gnc_plugin_manager_get (),
                                       gnc_plugin_business_new ());

        gnc_hook_add_dangler(HOOK_BOOK_OPENED,
                             (GFunc)gnc_invoice_remind_bills_due_cb, NULL);
        gnc_hook_add_dangler(HOOK_BOOK_OPENED,
                             (GFunc)gnc_invoice_remind_invoices_due_cb, NULL);

        /* Add to preferences under Business */
        /* The parameters are; glade file, items to add from glade file - last being the dialog, preference tab name */
        gnc_preferences_add_page("business-prefs.glade", "liststore_printinvoice,days_in_adj,cust_days_in_adj,business_prefs",
                                 _("Business"));
    }

    return TRUE;
}
开发者ID:Bob-IT,项目名称:gnucash,代码行数:49,代码来源:gncmod-business-gnome.c


示例7: gnm_guile_catcher

/*
 * This gets called if scm_apply throws an error.
 *
 * We use gh_scm2newstr to convert from Guile string to Scheme string. The
 * GH interface is deprecated, but doing it in scm takes more code. We'll
 * convert later if we have to.
 */
static SCM
gnm_guile_catcher (void *data, SCM tag, SCM throw_args)
{
	char const *header = _("Guile error");
	SCM smob;
	SCM func;
	SCM res;
	char *guilestr = NULL;
	char *msg;
	GnmValue *v;

	func = scm_c_eval_string ("gnm:error->string");
	if (scm_procedure_p (func)) {
		res = scm_apply (func, tag,
				 scm_cons (throw_args, scm_listofnull));
		if (scm_string_p (res))
			guilestr = gh_scm2newstr (res, NULL);
	}

	if (guilestr != NULL) {
		char *buf = g_strdup_printf ("%s: %s", header, guilestr);
		free (guilestr);
		v = value_new_error (NULL, buf);
		g_free (buf);
	} else {
		v = value_new_error (NULL, header);
	}

	smob = make_new_smob (v);
	value_release (v);
	return smob;
}
开发者ID:UIKit0,项目名称:gnumeric,代码行数:39,代码来源:plugin.c


示例8: lmod

static void
lmod(char * mn)
{
    char * form = g_strdup_printf("(use-modules %s)\n", mn);
    scm_c_eval_string(form);
    g_free(form);
}
开发者ID:Mechtilde,项目名称:gnucash,代码行数:7,代码来源:gncmod-tax-us.c


示例9: run_tests

static void
run_tests (void)
{
    Query *q;
    SCM val2str;
    int i;

    val2str = scm_c_eval_string ("gnc:value->string");
    g_return_if_fail (scm_is_procedure (val2str));

    for (i = 0; i < 1000; i++)
    {
        q = get_random_query ();
        test_query (q, val2str);
        qof_query_destroy (q);
        fflush(stdout);
    }

    {
        q = get_random_query ();
        test_query (q, val2str);
        qof_query_destroy (q);
        fflush(stdout);
    }

}
开发者ID:573,项目名称:gnucash,代码行数:26,代码来源:test-scm-query-string.c


示例10: go_plugin_init

G_MODULE_EXPORT void
go_plugin_init (GOPlugin *p, GOCmdContext *cc)
{
	char *name, *dir;

	*ret_error = NULL;

	 scm_init_guile ();

	/* Initialize just in case. */
	eval_pos = NULL;

	init_value_type ();

	scm_c_define_gsubr ("gnumeric-funcall", 2, 0, 0, scm_gnumeric_funcall);
	scm_c_define_gsubr ("register-function", 5, 0, 0, scm_register_function);

	dir = gnm_sys_data_dir ("guile");
	name = g_strconcat (dir, "gnumeric_startup.scm", NULL);
	scm_apply (scm_c_eval_string ("(lambda (filename)"
				  "  (if (access? filename R_OK)"
				  "    (load filename)"
				  "    (display (string-append \"could not read Guile plug-in init file\" filename \"\n\"))))"),
		  scm_cons (scm_makfrom0str (name), SCM_EOL),
		  SCM_EOL);
	g_free (name);
	g_free (dir);
	/* Don't try to deactivate the plugin */
	gnm_plugin_use_ref (PLUGIN);
}
开发者ID:UIKit0,项目名称:gnumeric,代码行数:30,代码来源:plugin.c


示例11: libgncmod_qif_import_gnc_module_init

int
libgncmod_qif_import_gnc_module_init(int refcount)
{
    if (!gnc_module_load("gnucash/engine", 0))
    {
        return FALSE;
    }

    if (!gnc_module_load("gnucash/app-utils", 0))
    {
        return FALSE;
    }

    if (!gnc_module_load("gnucash/gnome-utils", 0))
    {
        return FALSE;
    }

    /* If the recount == 0 then register the qif-import-druid for the new-user
     * dialog.
     */
    if (refcount == 0)
    {
        gnc_new_user_dialog_register_qif_druid
        ((void (*)())gnc_ui_qif_import_druid_make);
    }

    scm_c_eval_string("(use-modules (gnucash import-export qif-import))");

    gnc_plugin_qif_import_create_plugin();

    return TRUE;
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:33,代码来源:gncmod-qif-import.c


示例12: 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;
}
开发者ID:jralls,项目名称:gnucash,代码行数:28,代码来源:gfec.c


示例13: gfec_apply

SCM
gfec_apply(SCM proc, SCM arglist, gfec_error_handler error_handler)
{
    SCM result = SCM_UNDEFINED;
    SCM func = scm_c_eval_string("gnc:apply-with-error-handling");
    if (scm_is_procedure(func))
    {
        char *err_msg = NULL;
        SCM call_result, error;
        call_result = scm_call_2 (func, proc, arglist);

        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;
}
开发者ID:Mechtilde,项目名称:gnucash,代码行数:28,代码来源:gfec.c


示例14: gfec_catcher

/* We assume that data is actually a char**. The way we return results
 * from this function is to malloc a fresh string, and store it in
 * this pointer. It is the caller's responsibility to do something
 * smart with this freshly allocated storage. the caller can determine
 * whether there was an error by initializing the char* passed in to
 * NULL. If there is an error, the char string will not be NULL on
 * return. */
static SCM
gfec_catcher(void *data, SCM tag, SCM throw_args)
{
    SCM func;
    SCM result;
    const char *msg = NULL;

    func = scm_c_eval_string("gnc:error->string");
    if (scm_is_procedure(func))
    {
        result = scm_call_2(func, tag, throw_args);
        if (scm_is_string(result))
        {
            char * str;

            scm_dynwind_begin (0); 
            str = scm_to_locale_string (result);
            msg = g_strdup (str);
            scm_dynwind_free (str); 
            scm_dynwind_end (); 
        }
    }

    if (msg == NULL)
    {
        msg = "Error running guile function.";
    }

    *(char**)data = strdup(msg);

    return SCM_UNDEFINED;
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:39,代码来源:gfec.c


示例15: gfec_string_helper

static SCM
gfec_string_helper(void *data)
{
    char *string = data;

    return scm_c_eval_string(string);
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:7,代码来源:gfec.c


示例16: 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);
}
开发者ID:cstim,项目名称:gnucash-svn,代码行数:8,代码来源:gnc-plugin-business.c


示例17: init_env

static void init_env(void) {
	SCM smob;
	char *ver;
	SOURCE_HANDLE *handle;
	init_log();
	init_alsa_module();
	ver = scm_to_locale_string(scm_version());
	log_msg("Guile version %s\n", ver);
	free(ver);
	init_messaging(msg_port);
	init_time();
	init_json();
	init_scheduler();
	init_audiofile();
	if (use_jack) init_jackport();
	init_feeds();
	init_recorder();
	init_stream();
	init_source_mod();
	init_ladspa();
	init_unitgen();
	fader = (SOURCE_OBJ *)my_malloc(sizeof(SOURCE_OBJ), "main fader");
	handle = (SOURCE_HANDLE *)my_gc_malloc(sizeof(SOURCE_HANDLE), "mains",
				"mains");
	handle->body = (void *)fader;
	handle->src = fader;
	init_source(fader);
	mains_tag = scm_make_smob_type("mains", sizeof(SOURCE_OBJ));
	SCM_NEWSMOB(smob, mains_tag, handle);
	scm_c_define("mains", smob);
	if (use_jack) {
		scm_c_define("jack-client-name",
			scm_from_locale_string(client_name));
		scm_c_define_gsubr("patch-out", 2, 0, 0, patch_out);
		scm_c_define_gsubr("unpatch-out", 2, 0, 0, unpatch_out);
		}
	scm_c_define_gsubr("quit", 0, 0, 0, qmx_quit);
	scm_c_define_gsubr("db", 1, 0, 0, db20);
	scm_c_define_gsubr("period-duty-cycle", 0, 0, 0, get_duty_cycle);
	scm_permanent_object(console_display =
			scm_c_eval_string(console_display_src));
	scm_permanent_object(catch_display =
			scm_c_eval_string(catch_display_src));
	return;
	}
开发者ID:pmyadlowsky,项目名称:qmx,代码行数:45,代码来源:main.c


示例18: 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;
	}
开发者ID:pmyadlowsky,项目名称:qmx,代码行数:9,代码来源:main.c


示例19: gnc_column_view_edit_close_cb

static void
gnc_column_view_edit_close_cb(GNCOptionWin * win, gpointer user_data)
{
    gnc_column_view_edit * r = user_data;
    SCM set_editor = scm_c_eval_string("gnc:report-set-editor-widget!");

    scm_call_2(set_editor, r->view, SCM_BOOL_F);
    gnc_column_view_edit_destroy(r);
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:9,代码来源:dialog-column-view.c


示例20: gnc_column_view_edit_apply_cb

static void
gnc_column_view_edit_apply_cb(GNCOptionWin * w, gpointer user_data)
{
    SCM  dirty_report = scm_c_eval_string("gnc:report-set-dirty?!");
    gnc_column_view_edit * win = user_data;

    if (!win) return;
    gnc_option_db_commit(win->odb);
    scm_call_2(dirty_report, win->view, SCM_BOOL_T);
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:10,代码来源:dialog-column-view.c



注:本文中的scm_c_eval_string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ scm_call函数代码示例发布时间:2022-05-30
下一篇:
C++ sclose函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap