コード例 #1
0
int python_exec_string(void)
{
    if( !python_is_initialised_check() )
        return 0;

    EmacsString command;

    if( cur_exec == NULL )
    {
        EmacsString prompt( ": Python-exec " );

        command = get_string_interactive( prompt );
    }
    else
    {
        if( check_args( 1, 1 ) )
            return 0;

        command = get_string_mlisp();
    }

    EmacsPythonExecCommand py_command( command );

    py_command.executeCommand();

    if( py_command.failed() )
        error( py_command.failureReason() );
    else
        ml_value = py_command.getResult();

    return 0;
}
コード例 #2
0
static PyObject *PyServer_command(PyServer *self, PyObject *args, PyObject *kwds)
{
    static char *kwlist[] = {"cmd", NULL};
    char *cmd;

    RET_NULL_IF_INVALID(self->data);
    
    if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist, &cmd))
        return NULL;

    py_command(cmd, self->data, NULL);
    
    Py_RETURN_NONE;
}
コード例 #3
0
//--------------------------------------------------------------------------------
//
//    Emacs Python Import
//
//--------------------------------------------------------------------------------
int python_import_module(void)
{
    if( !python_is_initialised_check() )
        return 0;

    EmacsString module_name;

    if( cur_exec == NULL )
    {
        EmacsString prompt( ": Python-import " );

        module_name = get_string_interactive( prompt );
    }
    else
    {
        if( check_args( 1, 1 ) )
            return 0;

        module_name = get_string_mlisp();
    }

    EmacsString command( FormatString
        (
        "import %s"
        ) << module_name );

    EmacsPythonExecCommand py_command( command );

    py_command.executeCommand();

    if( py_command.failed() )
        error( py_command.failureReason() );
    else
        ml_value = py_command.getResult();

    return 0;
}
コード例 #4
0
int python_eval_string(void)
{
    if( !python_is_initialised_check() )
        return 0;

    EmacsString expression;

    if( cur_exec == NULL )
    {
        EmacsString prompt( ": Python-eval " );

        expression = get_string_interactive( prompt );
    }
    else
    {
        if( check_args( 1, 1 ) )
            return 0;

        expression = get_string_mlisp();
    }

    EmacsString command( FormatString
        (
        "__bemacs_eval_tmp__ = %s"
        ) << expression );

    EmacsPythonEvalCommand py_command( command );

    py_command.executeCommand();

    if( py_command.failed() )
        error( py_command.failureReason() );
    else
        ml_value = py_command.getResult();

    return 0;
}