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

C++ Py_InitModule函数代码示例

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

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



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

示例1: initmedcoin_hybrid

PyMODINIT_FUNC initmedcoin_hybrid(void) {
    (void) Py_InitModule("medcoin_hybrid", ScryptMethods);
}
开发者ID:jjkosby,项目名称:medcoin_hybrid,代码行数:3,代码来源:hybridmodule.c


示例2: init5422a3dec735a78746c65b95ef4de399

PyMODINIT_FUNC init5422a3dec735a78746c65b95ef4de399(void){
   import_array();
   (void) Py_InitModule("5422a3dec735a78746c65b95ef4de399", MyMethods);
}
开发者ID:ejake,项目名称:tensor-factorization,代码行数:4,代码来源:mod.cpp


示例3: init_webp

PyMODINIT_FUNC
init_webp(void)
{
    PyObject* m = Py_InitModule("_webp", webpMethods);
    setup_module(m);
}
开发者ID:dvska,项目名称:Pillow,代码行数:6,代码来源:_webp.c


示例4: initzlibextras

PyMODINIT_FUNC initzlibextras(void)
{
    (void) Py_InitModule("zlibextras", ZlibExtrasMethods);
}
开发者ID:cmsdaq,项目名称:hltd,代码行数:4,代码来源:zlibextras.c


示例5: inithungarian

PyMODINIT_FUNC
inithungarian(void)
{
  (void) Py_InitModule("hungarian", HungarianMethods);
  import_array();
}
开发者ID:Anupam02,项目名称:hungarian,代码行数:6,代码来源:hungarian.cpp


示例6: initutil

PyMODINIT_FUNC initutil(void) {
    (void) Py_InitModule("compass.util", compass_util_methods);
}
开发者ID:josephcourtney,项目名称:compass,代码行数:3,代码来源:util.c


示例7: init70420f6d255528e496b6dcec592c9bfd

PyMODINIT_FUNC init70420f6d255528e496b6dcec592c9bfd(void){
   import_array();
   (void) Py_InitModule("70420f6d255528e496b6dcec592c9bfd", MyMethods);
}
开发者ID:liyong3forever,项目名称:Theano-LSTM,代码行数:4,代码来源:mod.cpp


示例8: init_pyfs

PyMODINIT_FUNC init_pyfs(void)
{
    (void) Py_InitModule("_pyfs", pyfsMethods);
}
开发者ID:Tourountzis,项目名称:bits,代码行数:4,代码来源:pyfsmodule.c


示例9: initTCR_module

/*
 * Python calls this to let us initialize our module
 */
void initTCR_module(void)
{
	(void) Py_InitModule("TCR_module", TCR_methods);
}
开发者ID:bmountjoy,项目名称:LMTools,代码行数:7,代码来源:TCR_module.c


示例10: init78d2ae1ecd52ae272965fb280fc1bbcb

PyMODINIT_FUNC init78d2ae1ecd52ae272965fb280fc1bbcb(void){
   import_array();
   (void) Py_InitModule("78d2ae1ecd52ae272965fb280fc1bbcb", MyMethods);
}
开发者ID:fengxianyun,项目名称:ji_ti_zhi_hui,代码行数:4,代码来源:mod.cpp


示例11: init_billiard

PyMODINIT_FUNC
init_billiard(void)
{
    PyObject *module, *temp, *value;

    /* Initialize module */
    module = Py_InitModule("_billiard", Billiard_module_methods);
    if (!module)
        return;

    /* Get copy of objects from pickle */
    temp = PyImport_ImportModule(PICKLE_MODULE);
    if (!temp)
        return;
    Billiard_pickle_dumps = PyObject_GetAttrString(temp, "dumps");
    Billiard_pickle_loads = PyObject_GetAttrString(temp, "loads");
    Billiard_pickle_protocol = PyObject_GetAttrString(temp, "HIGHEST_PROTOCOL");
    Py_XDECREF(temp);

    /* Get copy of BufferTooShort */
    temp = PyImport_ImportModule("billiard");
    if (!temp)
        return;
    Billiard_BufferTooShort = PyObject_GetAttrString(temp, "BufferTooShort");
    Py_XDECREF(temp);

    /* Add connection type to module */
    if (PyType_Ready(&BilliardConnectionType) < 0)
        return;
    Py_INCREF(&BilliardConnectionType);
    PyModule_AddObject(module, "Connection", (PyObject*)&BilliardConnectionType);

#if defined(MS_WINDOWS) ||                                              \
  (defined(HAVE_SEM_OPEN) && !defined(POSIX_SEMAPHORES_NOT_ENABLED))
    /* Add SemLock type to module */
    if (PyType_Ready(&BilliardSemLockType) < 0)
        return;
    Py_INCREF(&BilliardSemLockType);
    PyDict_SetItemString(BilliardSemLockType.tp_dict, "SEM_VALUE_MAX",
                         Py_BuildValue("i", SEM_VALUE_MAX));
    PyModule_AddObject(module, "SemLock", (PyObject*)&BilliardSemLockType);
#endif

#ifdef MS_WINDOWS
    /* Add PipeConnection to module */
    if (PyType_Ready(&BilliardPipeConnectionType) < 0)
        return;
    Py_INCREF(&BilliardPipeConnectionType);
    PyModule_AddObject(module, "PipeConnection",
                       (PyObject*)&BilliardPipeConnectionType);

    /* Initialize win32 class and add to multiprocessing */
    temp = create_win32_namespace();
    if (!temp)
        return;
    PyModule_AddObject(module, "win32", temp);

    /* Initialize the event handle used to signal Ctrl-C */
    sigint_event = CreateEvent(NULL, TRUE, FALSE, NULL);
    if (!sigint_event) {
        PyErr_SetFromWindowsErr(0);
        return;
    }
    if (!SetConsoleCtrlHandler(ProcessingCtrlHandler, TRUE)) {
        PyErr_SetFromWindowsErr(0);
        return;
    }
#endif

    /* Add configuration macros */
    temp = PyDict_New();
    if (!temp)
        return;
#define ADD_FLAG(name)                                            \
    value = Py_BuildValue("i", name);                             \
    if (value == NULL) { Py_DECREF(temp); return; }               \
    if (PyDict_SetItemString(temp, #name, value) < 0) {           \
        Py_DECREF(temp); Py_DECREF(value); return; }              \
    Py_DECREF(value)

#if defined(HAVE_SEM_OPEN) && !defined(POSIX_SEMAPHORES_NOT_ENABLED)
    ADD_FLAG(HAVE_SEM_OPEN);
#endif
#ifdef HAVE_SEM_TIMEDWAIT
    ADD_FLAG(HAVE_SEM_TIMEDWAIT);
#endif
#ifdef HAVE_FD_TRANSFER
    ADD_FLAG(HAVE_FD_TRANSFER);
#endif
#ifdef HAVE_BROKEN_SEM_GETVALUE
    ADD_FLAG(HAVE_BROKEN_SEM_GETVALUE);
#endif
#ifdef HAVE_BROKEN_SEM_UNLINK
    ADD_FLAG(HAVE_BROKEN_SEM_UNLINK);
#endif
    if (PyModule_AddObject(module, "flags", temp) < 0)
        return;
}
开发者ID:Matthias-Wagner,项目名称:billiard,代码行数:98,代码来源:multiprocessing.c


示例12: INIT_MODULE


//.........这里部分代码省略.........
#endif
    }
#endif

    /* import python builtin datetime module, if available */
    pyDateTimeModuleP = PyImport_ImportModule("datetime");
    if (pyDateTimeModuleP == NULL) {
        Dprintf("initpsycopg: can't import datetime module");
        PyErr_SetString(PyExc_ImportError, "can't import datetime module");
        goto exit;
    }

    /* Initialize the PyDateTimeAPI everywhere is used */
    PyDateTime_IMPORT;
    if (psyco_adapter_datetime_init()) { goto exit; }

    Py_TYPE(&pydatetimeType) = &PyType_Type;
    if (PyType_Ready(&pydatetimeType) == -1) goto exit;

    /* import psycopg2.tz anyway (TODO: replace with C-level module?) */
    pyPsycopgTzModule = PyImport_ImportModule("psycopg2.tz");
    if (pyPsycopgTzModule == NULL) {
        Dprintf("initpsycopg: can't import psycopg2.tz module");
        PyErr_SetString(PyExc_ImportError, "can't import psycopg2.tz module");
        goto exit;
    }
    pyPsycopgTzLOCAL =
        PyObject_GetAttrString(pyPsycopgTzModule, "LOCAL");
    pyPsycopgTzFixedOffsetTimezone =
        PyObject_GetAttrString(pyPsycopgTzModule, "FixedOffsetTimezone");

    /* initialize the module and grab module's dictionary */
#if PY_MAJOR_VERSION < 3
    module = Py_InitModule("_psycopg", psycopgMethods);
#else
    module = PyModule_Create(&psycopgmodule);
#endif
    if (!module) { goto exit; }

    dict = PyModule_GetDict(module);

    /* initialize all the module's exported functions */
    /* PyBoxer_API[PyBoxer_Fake_NUM] = (void *)PyBoxer_Fake; */

    /* Create a CObject containing the API pointer array's address */
    /* If anybody asks for a PyCapsule we'll deal with it. */
#if PY_VERSION_HEX < 0x03020000
    c_api_object = PyCObject_FromVoidPtr((void *)PSYCOPG_API, NULL);
    if (c_api_object != NULL)
        PyModule_AddObject(module, "_C_API", c_api_object);
#endif

    /* other mixed initializations of module-level variables */
    if (!(psycoEncodings = PyDict_New())) { goto exit; }
    if (0 != psyco_encodings_fill(psycoEncodings)) { goto exit; }
    psyco_null = Bytes_FromString("NULL");
    if (!(psyco_DescriptionType = psyco_make_description_type())) { goto exit; }

    /* set some module's parameters */
    PyModule_AddStringConstant(module, "__version__", PSYCOPG_VERSION);
    PyModule_AddStringConstant(module, "__doc__", "psycopg PostgreSQL driver");
    PyModule_AddObject(module, "apilevel", Text_FromUTF8(APILEVEL));
    PyModule_AddObject(module, "threadsafety", PyInt_FromLong(THREADSAFETY));
    PyModule_AddObject(module, "paramstyle", Text_FromUTF8(PARAMSTYLE));

    /* put new types in module dictionary */
开发者ID:Instagram,项目名称:psycopg2,代码行数:67,代码来源:psycopgmodule.c


示例13: initPartGui

void PartGuiExport initPartGui()
{
    if (!Gui::Application::Instance) {
        PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
        return;
    }

    // load needed modules
    try {
        Base::Interpreter().runString("import Part");
    }
    catch(const Base::Exception& e) {
        PyErr_SetString(PyExc_ImportError, e.what());
        return;
    }

    (void) Py_InitModule("PartGui", PartGui_methods);   /* mod name, table ptr */
    Base::Console().Log("Loading GUI of Part module... done\n");

    PartGui::SoBrepFaceSet                  ::initClass();
    PartGui::SoBrepEdgeSet                  ::initClass();
    PartGui::SoBrepPointSet                 ::initClass();
    PartGui::SoFCControlPoints              ::initClass();
    PartGui::ViewProviderPartBase           ::init();
    PartGui::ViewProviderPartExt            ::init();
    PartGui::ViewProviderPart               ::init();
    PartGui::ViewProviderEllipsoid          ::init();
    PartGui::ViewProviderPython             ::init();
    PartGui::ViewProviderBox                ::init();
    PartGui::ViewProviderPrism              ::init();
    PartGui::ViewProviderWedge              ::init();
    PartGui::ViewProviderImport             ::init();
    PartGui::ViewProviderCurveNet           ::init();
    PartGui::ViewProviderExtrusion          ::init();
    PartGui::ViewProvider2DObject           ::init();
    PartGui::ViewProvider2DObjectPython     ::init();
    PartGui::ViewProviderMirror             ::init();
    PartGui::ViewProviderFillet             ::init();
    PartGui::ViewProviderChamfer            ::init();
    PartGui::ViewProviderRevolution         ::init();
    PartGui::ViewProviderLoft               ::init();
    PartGui::ViewProviderSweep              ::init();
    PartGui::ViewProviderOffset             ::init();
    PartGui::ViewProviderThickness          ::init();
    PartGui::ViewProviderCustom             ::init();
    PartGui::ViewProviderCustomPython       ::init();
    PartGui::ViewProviderBoolean            ::init();
    PartGui::ViewProviderMultiFuse          ::init();
    PartGui::ViewProviderMultiCommon        ::init();
    PartGui::ViewProviderCompound           ::init();
    PartGui::ViewProviderSpline             ::init();
    PartGui::ViewProviderCircleParametric   ::init();
    PartGui::ViewProviderLineParametric     ::init();
    PartGui::ViewProviderPointParametric    ::init();
    PartGui::ViewProviderEllipseParametric  ::init();
    PartGui::ViewProviderHelixParametric    ::init();
    PartGui::ViewProviderSpiralParametric   ::init();
    PartGui::ViewProviderPlaneParametric    ::init();
    PartGui::ViewProviderSphereParametric   ::init();
    PartGui::ViewProviderCylinderParametric ::init();
    PartGui::ViewProviderConeParametric     ::init();
    PartGui::ViewProviderTorusParametric    ::init();
    PartGui::ViewProviderRuledSurface       ::init();

    PartGui::Workbench                      ::init();

    // instantiating the commands
    CreatePartCommands();
    CreateSimplePartCommands();
    CreateParamPartCommands();

    // register preferences pages
    (void)new Gui::PrefPageProducer<PartGui::DlgSettingsGeneral>      ( QT_TRANSLATE_NOOP("QObject","Part design") );
    (void)new Gui::PrefPageProducer<PartGui::DlgSettings3DViewPart>   ( QT_TRANSLATE_NOOP("QObject","Part design") );
    (void)new Gui::PrefPageProducer<PartGui::DlgSettingsObjectColor>  ( QT_TRANSLATE_NOOP("QObject","Display") );
    Gui::ViewProviderBuilder::add(
        Part::PropertyPartShape::getClassTypeId(),
        PartGui::ViewProviderPart::getClassTypeId());

    // add resources and reloads the translators
    loadPartResource();

    // register bitmaps
    Gui::BitmapFactoryInst& rclBmpFactory = Gui::BitmapFactory();
    rclBmpFactory.addXPM("PartFeature",(const char**) PartFeature_xpm);
    rclBmpFactory.addXPM("PartFeatureImport",(const char**) PartFeatureImport_xpm);
}
开发者ID:jmaustpc,项目名称:FreeCAD_sf_master,代码行数:87,代码来源:AppPartGui.cpp


示例14:

EnumModule::EnumModule(PyObject *parent, char* name)
{
	module =Py_InitModule(name, enum_methods);
	Py_INCREF(module);
	PyModule_AddObject(parent, name, module);
}
开发者ID:hkoehler,项目名称:cute,代码行数:6,代码来源:python_api.cpp


示例15: main


//.........这里部分代码省略.........
        i = atoi( s );

        if( i < 0 || i >= DEBUG_MAX )
        {
            printf( "Invalid debug level '%s'.\n", s );
            continue;
        }

        /* n turns on levels 1-n */
        /* +n turns on level n */

        if( *s == '+' )
            globs.debug[i] = 1;
        else while( i )
            globs.debug[i--] = 1;
    }

    { PROFILE_ENTER(MAIN);

    #ifdef HAVE_PYTHON
    {
        PROFILE_ENTER(MAIN_PYTHON);
        Py_Initialize();
    
        {
            static PyMethodDef BjamMethods[] = {
                {"call", bjam_call, METH_VARARGS,
                 "Call the specified bjam rule."},
                {"import_rule", bjam_import_rule, METH_VARARGS,
                 "Imports Python callable to bjam."},
                {NULL, NULL, 0, NULL}
            };
    
            Py_InitModule("bjam", BjamMethods);
        }
        PROFILE_EXIT(MAIN_PYTHON);
    }
    #endif
    
#ifndef NDEBUG
    run_unit_tests();
#endif
#if YYDEBUG != 0
    if ( DEBUG_PARSE )
        yydebug = 1;
#endif

    /* Set JAMDATE first */

    {
        char *date;
        time_t clock;
        time( &clock );
        date = newstr( ctime( &clock ) );

        /* Trim newline from date */

        if( strlen( date ) == 25 )
            date[ 24 ] = 0;

        var_set( "JAMDATE", list_new( L0, newstr( date ) ), VAR_SET );
    }

 
    var_set( "JAM_VERSION",
             list_new( list_new( list_new( L0, newstr( VERSION_MAJOR_SYM ) ), 
开发者ID:iceberry,项目名称:flyffsf,代码行数:67,代码来源:jam.c


示例16: inityami4py

extern "C" PyMODINIT_FUNC inityami4py(void)
{
    Py_InitModule("yami4py", yami4pyMethods);
}
开发者ID:morambro,项目名称:TrainProject,代码行数:4,代码来源:yami4py.cpp


示例17: initPyBCM2835

PyMODINIT_FUNC
initPyBCM2835(void)
{
    PyObject *m;

    m = Py_InitModule("PyBCM2835", PyBCM2835Methods);
    if (m == NULL)
        return;

	// Constants
	PyModule_AddIntConstant(m,"HIGH",1);
	PyModule_AddIntConstant(m,"LOW",0);
	PyModule_AddIntConstant(m,"PERI_BASE",BCM2835_PERI_BASE);
	PyModule_AddIntConstant(m,"GPIO_PADS",BCM2835_GPIO_PADS);
	PyModule_AddIntConstant(m,"CLOCK_BASE",BCM2835_CLOCK_BASE);
	PyModule_AddIntConstant(m,"GPIO_BASE",BCM2835_GPIO_BASE);
	PyModule_AddIntConstant(m,"SPI0_BASE",BCM2835_SPI0_BASE);
	PyModule_AddIntConstant(m,"GPIO_PWM",BCM2835_GPIO_PWM);
	PyModule_AddIntConstant(m,"PAGE_SIZE",BCM2835_PAGE_SIZE);
	PyModule_AddIntConstant(m,"BLOCK_SIZE",BCM2835_BLOCK_SIZE);
	PyModule_AddIntConstant(m,"GPFSEL0",BCM2835_GPFSEL0);
	PyModule_AddIntConstant(m,"GPFSEL1",BCM2835_GPFSEL1);
	PyModule_AddIntConstant(m,"GPFSEL2",BCM2835_GPFSEL2);
	PyModule_AddIntConstant(m,"GPFSEL3",BCM2835_GPFSEL3);
	PyModule_AddIntConstant(m,"GPFSEL4",BCM2835_GPFSEL4);
	PyModule_AddIntConstant(m,"GPFSEL5",BCM2835_GPFSEL5);
	PyModule_AddIntConstant(m,"GPSET0",BCM2835_GPSET0);
	PyModule_AddIntConstant(m,"GPSET1",BCM2835_GPSET1);
	PyModule_AddIntConstant(m,"GPCLR0",BCM2835_GPCLR0);
	PyModule_AddIntConstant(m,"GPCLR1",BCM2835_GPCLR1);
	PyModule_AddIntConstant(m,"GPLEV0",BCM2835_GPLEV0);
	PyModule_AddIntConstant(m,"GPLEV1",BCM2835_GPLEV1);
	PyModule_AddIntConstant(m,"GPEDS0",BCM2835_GPEDS0);
	PyModule_AddIntConstant(m,"GPEDS1",BCM2835_GPEDS1);
	PyModule_AddIntConstant(m,"GPREN0",BCM2835_GPREN0);
	PyModule_AddIntConstant(m,"GPREN1",BCM2835_GPREN1);
	PyModule_AddIntConstant(m,"GPFEN0",BCM2835_GPFEN0);
	PyModule_AddIntConstant(m,"GPFEN1",BCM2835_GPFEN1);
	PyModule_AddIntConstant(m,"GPAFEN0",BCM2835_GPAFEN0);
	PyModule_AddIntConstant(m,"GPAFEN1",BCM2835_GPAFEN1);
	PyModule_AddIntConstant(m,"GPPUD",BCM2835_GPPUD);
	PyModule_AddIntConstant(m,"GPPUDCLK0",BCM2835_GPPUDCLK0);
	PyModule_AddIntConstant(m,"GPPUDCLK1",BCM2835_GPPUDCLK1);
	PyModule_AddIntConstant(m,"BCM2835_PADS_GPIO_0_27",BCM2835_PADS_GPIO_0_27);
	PyModule_AddIntConstant(m,"BCM2835_PADS_GPIO_28_45",BCM2835_PADS_GPIO_28_45);
	PyModule_AddIntConstant(m,"BCM2835_PADS_GPIO_46_53",BCM2835_PADS_GPIO_46_53);
	PyModule_AddIntConstant(m,"BCM2835_PAD_PASSWRD",BCM2835_PAD_PASSWRD);
	PyModule_AddIntConstant(m,"BCM2835_PAD_SLEW_RATE_UNLIMITED",BCM2835_PAD_SLEW_RATE_UNLIMITED);
	PyModule_AddIntConstant(m,"BCM2835_PAD_HYSTERESIS_ENABLED",BCM2835_PAD_HYSTERESIS_ENABLED);
	PyModule_AddIntConstant(m,"BCM2835_PAD_DRIVE_2mA",BCM2835_PAD_DRIVE_2mA);
	PyModule_AddIntConstant(m,"BCM2835_PAD_DRIVE_4mA",BCM2835_PAD_DRIVE_4mA);
	PyModule_AddIntConstant(m,"BCM2835_PAD_DRIVE_6mA",BCM2835_PAD_DRIVE_6mA);
	PyModule_AddIntConstant(m,"BCM2835_PAD_DRIVE_8mA",BCM2835_PAD_DRIVE_8mA);
	PyModule_AddIntConstant(m,"BCM2835_PAD_DRIVE_10mA",BCM2835_PAD_DRIVE_10mA);
	PyModule_AddIntConstant(m,"BCM2835_PAD_DRIVE_12mA",BCM2835_PAD_DRIVE_12mA);
	PyModule_AddIntConstant(m,"BCM2835_PAD_DRIVE_14mA",BCM2835_PAD_DRIVE_14mA);
	PyModule_AddIntConstant(m,"BCM2835_PAD_DRIVE_16mA",BCM2835_PAD_DRIVE_16mA);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS",BCM2835_SPI0_CS);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_FIFO",BCM2835_SPI0_FIFO);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CLK",BCM2835_SPI0_CLK);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_DLEN",BCM2835_SPI0_DLEN);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_LTOH",BCM2835_SPI0_LTOH);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_DC",BCM2835_SPI0_DC);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_LEN_LONG",BCM2835_SPI0_CS_LEN_LONG);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_DMA_LEN",BCM2835_SPI0_CS_DMA_LEN);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_CSPOL2",BCM2835_SPI0_CS_CSPOL2);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_CSPOL1",BCM2835_SPI0_CS_CSPOL1);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_CSPOL0",BCM2835_SPI0_CS_CSPOL0);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_RXF",BCM2835_SPI0_CS_RXF);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_RXR",BCM2835_SPI0_CS_RXR);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_TXD",BCM2835_SPI0_CS_TXD);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_DONE",BCM2835_SPI0_CS_DONE);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_TE_EN",BCM2835_SPI0_CS_TE_EN);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_LMONO",BCM2835_SPI0_CS_LMONO);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_LEN",BCM2835_SPI0_CS_LEN);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_REN",BCM2835_SPI0_CS_REN);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_ADCS",BCM2835_SPI0_CS_ADCS);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_INTR",BCM2835_SPI0_CS_INTR);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_INTD",BCM2835_SPI0_CS_INTD);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_DMAEN",BCM2835_SPI0_CS_DMAEN);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_TA",BCM2835_SPI0_CS_TA);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_CSPOL",BCM2835_SPI0_CS_CSPOL);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_CLEAR",BCM2835_SPI0_CS_CLEAR);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_CLEAR_RX",BCM2835_SPI0_CS_CLEAR_RX);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_CLEAR_TX",BCM2835_SPI0_CS_CLEAR_TX);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_CPOL",BCM2835_SPI0_CS_CPOL);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_CPHA",BCM2835_SPI0_CS_CPHA);
	PyModule_AddIntConstant(m,"BCM2835_SPI0_CS_CS",BCM2835_SPI0_CS_CS);
	//PyModule_AddIntConstant(m,"",);

    // Function Select
	PyModule_AddIntConstant(m,"GPIO_FSEL_INPT",BCM2835_GPIO_FSEL_INPT);
	PyModule_AddIntConstant(m,"GPIO_FSEL_OUTP",BCM2835_GPIO_FSEL_OUTP);
	PyModule_AddIntConstant(m,"GPIO_FSEL_ALT0",BCM2835_GPIO_FSEL_ALT0);
	PyModule_AddIntConstant(m,"GPIO_FSEL_ALT1",BCM2835_GPIO_FSEL_ALT1);
	PyModule_AddIntConstant(m,"GPIO_FSEL_ALT2",BCM2835_GPIO_FSEL_ALT2);
	PyModule_AddIntConstant(m,"GPIO_FSEL_ALT3",BCM2835_GPIO_FSEL_ALT3);
	PyModule_AddIntConstant(m,"GPIO_FSEL_ALT4",BCM2835_GPIO_FSEL_ALT4);
	PyModule_AddIntConstant(m,"GPIO_FSEL_ALT5",BCM2835_GPIO_FSEL_ALT5);
	PyModule_AddIntConstant(m,"GPIO_FSEL_MASK",BCM2835_GPIO_FSEL_MASK);
//.........这里部分代码省略.........
开发者ID:klobyone,项目名称:PyBCM2835,代码行数:101,代码来源:PyBCM2835.c


示例18: Py_Initialize

void CPythonEngine::init()
{
	if (!initialised)
	{
		initialised = 1;

		/* Initialize the Python interpreter.*/
		Py_Initialize();
		PyEval_InitThreads();


		PyGILState_STATE gstate;
		gstate = PyGILState_Ensure();

		/* Initialize TA Python env. */
		Py_InitModule("tibiaauto", Methods_tibiaauto);
		Py_InitModule("tareader", Methods_tareader);
		Py_InitModule("tasender", Methods_tasender);
		Py_InitModule("tamap", Methods_tamap);
		Py_InitModule("taregexp", Methods_taregexp);
		Py_InitModule("taalice", Methods_taalice);
		Py_InitModule("taitem", Methods_taitem);
		Py_InitModule("tacrstat", Methods_tacrstat);
		Py_InitModule("takernel", Methods_takernel);
		Py_InitModule("tapacket", Methods_tapacket);
		PyRun_SimpleString("import tibiaauto");
		PyRun_SimpleString("import tareader");
		PyRun_SimpleString("import tasender");
		PyRun_SimpleString("import tamap");
		PyRun_SimpleString("import taregexp");
		PyRun_SimpleString("import taalice");
		PyRun_SimpleString("import taitem");
		PyRun_SimpleString("import tacrstat");
		PyRun_SimpleString("import takernel");
		PyRun_SimpleString("import sys");
		PyRun_SimpleString("import time");

		char pathBuf[2048];
		sprintf(pathBuf, "%s\\tascripts\\tautil.py", CInstallPath::getInstallPath().c_str());

		// load tautil.py
		FILE *f = fopen(pathBuf, "r");
		if (f)
		{
			fseek(f, 0, SEEK_END);
			int fileSize = ftell(f);
			fseek(f, 0, SEEK_SET);
			char *fileBuf = (char *)malloc(fileSize + 1);
			memset(fileBuf, 0, fileSize + 1);
			fread(fileBuf, 1, fileSize, f);

			int ret = PyRun_SimpleString(fileBuf);
			if (ret == -1)
				AfxMessageBox("Loading tautil.py script failed!");
			fclose(f);
		}
		else
		{
			AfxMessageBox("Unable to find tascripts\\tautil.py!");
		}

		PyGILState_Release(gstate);

		InitializeCriticalSection(&ScriptEngineCriticalSection);


		// now load all scripts from 'tascripts' subdirectory
		sprintf(pathBuf, "%s\\tascripts\\*.py", CInstallPath::getInstallPath().c_str());
		WIN32_FIND_DATA findFileData;
		HANDLE hFind = FindFirstFile(pathBuf, &findFileData);
		if (hFind != INVALID_HANDLE_VALUE)
		{
			char buf[1024];

			do
			{
				snprintf(buf, 1023, "%s\\tascripts\\%s", CInstallPath::getInstallPath().c_str(), findFileData.cFileName);
				// tautil.py will be loaded in a special way
				if (!strstr(buf, "tascripts\\tautil.py"))
					loadScript(buf);
			}
			while (FindNextFile(hFind, &findFileData));
			FindClose(hFind);
		}
	}
}
开发者ID:Wisling,项目名称:tibiaauto,代码行数:86,代码来源:PythonEngine.cpp


示例19: init_librepo

PyMODINIT_FUNC
init_librepo(void)
{
    PyObject *m = Py_InitModule("_librepo", librepo_methods);
    if (!m)
        return;

    /* Exceptions */
    if (!init_exceptions())
        return;
    PyModule_AddObject(m, "LibrepoException", LrErr_Exception);

    /* Objects */
    /* _librepo.Handle */
    if (PyType_Ready(&Handle_Type) < 0)
        return;
    Py_INCREF(&Handle_Type);
    PyModule_AddObject(m, "Handle", (PyObject *)&Handle_Type);
    /* _librepo.Result */
    if (PyType_Ready(&Result_Type) < 0)
        return;
    Py_INCREF(&Result_Type);
    PyModule_AddObject(m, "Result", (PyObject *)&Result_Type);

    /* Module constants */

    /* Version */
    PyModule_AddIntConstant(m, "VERSION_MAJOR", LR_VERSION_MAJOR);
    PyModule_AddIntConstant(m, "VERSION_MINOR", LR_VERSION_MINOR);
    PyModule_AddIntConstant(m, "VERSION_PATCH", LR_VERSION_PATCH);

    /* Handle options */
    PyModule_AddIntConstant(m, "LRO_UPDATE", LRO_UPDATE);
    PyModule_AddIntConstant(m, "LRO_URL", LRO_URL);
    PyModule_AddIntConstant(m, "LRO_MIRRORLIST", LRO_MIRRORLIST);
    PyModule_AddIntConstant(m, "LRO_LOCAL", LRO_LOCAL);
    PyModule_AddIntConstant(m, "LRO_HTTPAUTH", LRO_HTTPAUTH);
    PyModule_AddIntConstant(m, "LRO_USERPWD", LRO_USERPWD);
    PyModule_AddIntConstant(m, "LRO_PROXY", LRO_PROXY);
    PyModule_AddIntConstant(m, "LRO_PROXYPORT", LRO_PROXYPORT);
    PyModule_AddIntConstant(m, "LRO_PROXYTYPE", LRO_PROXYTYPE);
    PyModule_AddIntConstant(m, "LRO_PROXYAUTH", LRO_PROXYAUTH);
    PyModule_AddIntConstant(m, "LRO_PROXYUSERPWD", LRO_PROXYUSERPWD);
    PyModule_AddIntConstant(m, "LRO_PROGRESSCB", LRO_PROGRESSCB);
    PyModule_AddIntConstant(m, "LRO_PROGRESSDATA", LRO_PROGRESSDATA);
    PyModule_AddIntConstant(m, "LRO_RETRIES", LRO_RETRIES);
    PyModule_AddIntConstant(m, "LRO_MAXSPEED", LRO_MAXSPEED);
    PyModule_AddIntConstant(m, "LRO_DESTDIR", LRO_DESTDIR);
    PyModule_AddIntConstant(m, "LRO_REPOTYPE", LRO_REPOTYPE);
    PyModule_AddIntConstant(m, "LRO_CONNECTTIMEOUT", LRO_CONNECTTIMEOUT);
    PyModule_AddIntConstant(m, "LRO_IGNOREMISSING", LRO_IGNOREMISSING);
    PyModule_AddIntConstant(m, "LRO_GPGCHECK", LRO_GPGCHECK);
    PyModule_AddIntConstant(m, "LRO_CHECKSUM", LRO_CHECKSUM);
    PyModule_AddIntConstant(m, "LRO_YUMDLIST", LRO_YUMDLIST);
    PyModule_AddIntConstant(m, "LRO_YUMBLIST", LRO_YUMBLIST);
    PyModule_AddIntConstant(m, "LRO_SENTINEL", LRO_SENTINEL);

    /* Handle info options */
    PyModule_AddIntConstant(m, "LRI_UPDATE", LRI_UPDATE);
    PyModule_AddIntConstant(m, "LRI_URL", LRI_URL);
    PyModule_AddIntConstant(m, "LRI_MIRRORLIST", LRI_MIRRORLIST);
    PyModule_AddIntConstant(m, "LRI_LOCAL", LRI_LOCAL);
    PyModule_AddIntConstant(m, "LRI_PROGRESSCB", LRI_PROGRESSCB);
    PyModule_AddIntConstant(m, "LRI_PROGRESSDATA", LRI_PROGRESSDATA);
    PyModule_AddIntConstant(m, "LRI_DESTDIR", LRI_DESTDIR);
    PyModule_AddIntConstant(m, "LRI_REPOTYPE", LRI_REPOTYPE);
    PyModule_AddIntConstant(m, "LRI_YUMDLIST", LRI_YUMDLIST);
    PyModule_AddIntConstant(m, "LRI_YUMBLIST", LRI_YUMBLIST);
    PyModule_AddIntConstant(m, "LRI_LASTCURLERR", LRI_LASTCURLERR);
    PyModule_AddIntConstant(m, "LRI_LASTCURLMERR", LRI_LASTCURLMERR);
    PyModule_AddIntConstant(m, "LRI_LASTCURLSTRERR", LRI_LASTCURLSTRERR);
    PyModule_AddIntConstant(m, "LRI_LASTCURLMSTRERR", LRI_LASTCURLMSTRERR);
    PyModule_AddIntConstant(m, "LRI_LASTBADSTATUSCODE", LRI_LASTBADSTATUSCODE);

    /* Check options */
    PyModule_AddIntConstant(m, "LR_CHECK_GPG", LR_CHECK_GPG);
    PyModule_AddIntConstant(m, "LR_CHECK_CHECKSUM", LR_CHECK_CHECKSUM);

    /* Repo type */
    PyModule_AddIntConstant(m, "LR_YUMREPO", LR_YUMREPO);
    PyModule_AddIntConstant(m, "LR_SUSEREPO", LR_SUSEREPO);
    PyModule_AddIntConstant(m, "LR_DEBREPO", LR_DEBREPO);

    /* Proxy type */
    PyModule_AddIntConstant(m, "LR_PROXY_HTTP", LR_PROXY_HTTP);
    PyModule_AddIntConstant(m, "LR_PROXY_HTTP_1_0", LR_PROXY_HTTP_1_0);
    PyModule_AddIntConstant(m, "LR_PROXY_SOCKS4", LR_PROXY_SOCKS4);
    PyModule_AddIntConstant(m, "LR_PROXY_SOCKS5", LR_PROXY_SOCKS5);
    PyModule_AddIntConstant(m, "LR_PROXY_SOCKS4A", LR_PROXY_SOCKS4A);
    PyModule_AddIntConstant(m, "LR_PROXY_SOCKS5_HOSTNAME", LR_PROXY_SOCKS5_HOSTNAME);

    /* Return codes */
    PyModule_AddIntConstant(m, "LRE_OK", LRE_OK);
    PyModule_AddIntConstant(m, "LRE_BADFUNCARG", LRE_BADFUNCARG);
    PyModule_AddIntConstant(m, "LRE_BADOPTARG", LRE_BADOPTARG);
    PyModule_AddIntConstant(m, "LRE_UNKNOWNOPT", LRE_UNKNOWNOPT);
    PyModule_AddIntConstant(m, "LRE_CURLSETOPT", LRE_CURLSETOPT);
    PyModule_AddIntConstant(m, "LRE_ALREADYUSEDRESULT", LRE_ALREADYUSEDRESULT);
    PyModule_AddIntConstant(m, "LRE_INCOMPLETERESULT", LRE_INCOMPLETERESULT);
    PyModule_AddIntConstant(m, "LRE_CURLDUP", LRE_CURLDUP);
//.........这里部分代码省略.........
开发者ID:akozumpl,项目名称:librepo,代码行数:101,代码来源:librepomodule.c


示例20: init_imagingtk

PyMODINIT_FUNC
init_imagingtk(void)
{
    Py_InitModule("_imagingtk", functions);
}
开发者ID:1060460048,项目名称:Pillow,代码行数:5,代码来源:_imagingtk.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ Py_InitModule3函数代码示例发布时间:2022-05-30
下一篇:
C++ Py_INCREF函数代码示例发布时间: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