Пример #1
0
static mpdm_t F_bincall(F_ARGS)
{
    void *func;
    char *ptr = mpdm_wcstombs(mpdm_string(mpdm_get_i(a, 0)), NULL);

    sscanf(ptr, "%p", &func);
    free(ptr);

    return MPDM_X(func);
}
Пример #2
0
extern "C" int kde4_drv_detect(int *argc, char ***argv)
{
    mpdm_t drv;
    KCmdLineOptions opts;
    Display *x11_display;
    int n;

    for (n = 0; n < *argc; n++) {
        if (strcmp(argv[0][n], "-txt") == 0 ||
            strcmp(argv[0][n], "-h") == 0)
            return 0;
    }

    /* try connecting directly to the Xserver */
    if ((x11_display = XOpenDisplay((char *) NULL)) == NULL)
        return 0;

    KAboutData aboutData("mp", 0,
                         ki18n("Minimum Profit"), VERSION,
                         ki18n("A programmer's text editor"),
                         KAboutData::License_GPL,
                         ki18n("Copyright (c) 1991-2009 Angel Ortega"),
                         ki18n(""),
                         "http://triptico.com", "*****@*****.**");

    KCmdLineArgs::init(*argc, *argv, &aboutData);

    /* command line options should be inserted here (I don't like this) */
    opts.add("t {tag}",         ki18n("Edits the file where tag is defined"));
    opts.add("e {mpsl_code}",   ki18n("Executes MPSL code"));
    opts.add("f {mpsl_script}", ki18n("Executes MPSL script file"));
    opts.add("d {directory}",   ki18n("Sets working directory"));
    opts.add("x {file}",        ki18n("Open file in the hexadecimal viewer"));
    opts.add(" +NNN",           ki18n("Moves to line number NNN of last file"));
    opts.add("txt",             ki18n("Use text mode instead of GUI"));
    opts.add("+[file(s)]",      ki18n("Documents to open"));
    KCmdLineArgs::addCmdLineOptions(opts);

    /* this is where it crashes if no X server */
    app = new KApplication(x11_display);

    drv = mpdm_hset_s(mpdm_root(), L"mp_drv", MPDM_H(0));

    mpdm_hset_s(drv, L"id",         MPDM_LS(L"kde4"));
    mpdm_hset_s(drv, L"startup",    MPDM_X(kde4_drv_startup));

    return 1;
}
Пример #3
0
mpdm_t mpsl_build_funcs(void)
/* build all functions */
{
    mpdm_t c;
    int n;

    /* creates all the symbols in the CORE library */
    c = MPDM_O();

    for (n = 0; mpsl_funcs[n].name != NULL; n++) {
        mpdm_t f = MPDM_S(mpsl_funcs[n].name);
        mpdm_t x = MPDM_X(mpsl_funcs[n].func);

        mpdm_set(mpdm_root(), x, f);
        mpdm_set(c, x, f);
    }

    return c;
}
Пример #4
0
static void register_functions(void)
{
    mpdm_t drv;

    drv = mpdm_hget_s(mpdm_root(), L"mp_drv");
    mpdm_hset_s(drv, L"main_loop",   MPDM_X(kde4_drv_main_loop));
    mpdm_hset_s(drv, L"shutdown",    MPDM_X(kde4_drv_shutdown));
    mpdm_hset_s(drv, L"clip_to_sys", MPDM_X(kde4_drv_clip_to_sys));
    mpdm_hset_s(drv, L"sys_to_clip", MPDM_X(kde4_drv_sys_to_clip));
    mpdm_hset_s(drv, L"update_ui",   MPDM_X(kde4_drv_update_ui));
    mpdm_hset_s(drv, L"timer",       MPDM_X(kde4_drv_timer));
    mpdm_hset_s(drv, L"busy",        MPDM_X(kde4_drv_busy));
    mpdm_hset_s(drv, L"alert",       MPDM_X(kde4_drv_alert));
    mpdm_hset_s(drv, L"confirm",     MPDM_X(kde4_drv_confirm));
    mpdm_hset_s(drv, L"openfile",    MPDM_X(kde4_drv_openfile));
    mpdm_hset_s(drv, L"savefile",    MPDM_X(kde4_drv_savefile));
    mpdm_hset_s(drv, L"form",        MPDM_X(kde4_drv_form));
}