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

C++ PyModule_AddIntConstant函数代码示例

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

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



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

示例1: add_module_constants

static void add_module_constants(PyObject* simulator)
{
    // Make the GPI constants accessible from the C world
    int rc = 0;
    rc |= PyModule_AddIntConstant(simulator, "UNKNOWN",       GPI_UNKNOWN);
    rc |= PyModule_AddIntConstant(simulator, "MEMORY",        GPI_MEMORY);
    rc |= PyModule_AddIntConstant(simulator, "MODULE",        GPI_MODULE);
    rc |= PyModule_AddIntConstant(simulator, "NET",           GPI_NET);
    rc |= PyModule_AddIntConstant(simulator, "PARAMETER",     GPI_PARAMETER);
    rc |= PyModule_AddIntConstant(simulator, "REG",           GPI_REGISTER);
    rc |= PyModule_AddIntConstant(simulator, "NETARRAY",      GPI_ARRAY);
    rc |= PyModule_AddIntConstant(simulator, "ENUM",          GPI_ENUM);
    rc |= PyModule_AddIntConstant(simulator, "STRUCTURE",     GPI_STRUCTURE);
    rc |= PyModule_AddIntConstant(simulator, "REAL",          GPI_REAL);
    rc |= PyModule_AddIntConstant(simulator, "INTEGER",       GPI_INTEGER);
    rc |= PyModule_AddIntConstant(simulator, "STRING",        GPI_STRING);
    rc |= PyModule_AddIntConstant(simulator, "GENARRAY",      GPI_GENARRAY);
    rc |= PyModule_AddIntConstant(simulator, "OBJECTS",       GPI_OBJECTS);
    rc |= PyModule_AddIntConstant(simulator, "DRIVERS",       GPI_DRIVERS);
    rc |= PyModule_AddIntConstant(simulator, "LOADS",         GPI_LOADS);

    if (rc != 0)
        fprintf(stderr, "Failed to add module constants!\n");
}
开发者ID:TC01,项目名称:cocotb,代码行数:24,代码来源:simulatormodule.c


示例2: PyInit_tesserpy

PyMODINIT_FUNC PyInit_tesserpy(void) {
#else
#define INITERROR return

PyMODINIT_FUNC inittesserpy(void) {
#endif

	PyBoundingBox_Type.tp_new = PyType_GenericNew;
	if (PyType_Ready(&PyBoundingBox_Type) < 0) {
		INITERROR;
	}

	PyPageInfo_Type.tp_new = PyType_GenericNew;
	if (PyType_Ready(&PyPageInfo_Type) < 0) {
		INITERROR;
	}

	PyResult_Type.tp_new = PyType_GenericNew;
	if (PyType_Ready(&PyResult_Type) < 0) {
		INITERROR;
	}

	if (PyType_Ready(&PyResultIterator_Type) < 0) {
		INITERROR;
	}

	if (PyType_Ready(&PyTesseract_Type) < 0) {
		INITERROR;
	}

#ifdef IS_PY3K
	PyObject *module = PyModule_Create(&TesserPyModuleDef);
#else
	PyObject *module = Py_InitModule("tesserpy", TesserPyMethods);
#endif

	if (module == NULL) {
		INITERROR;
	}

	import_array();

	Py_INCREF(&PyBoundingBox_Type);
	PyModule_AddObject(module, "BoundingBox", (PyObject *)&PyBoundingBox_Type);

	Py_INCREF(&PyPageInfo_Type);
	PyModule_AddObject(module, "PageInfo", (PyObject *)&PyPageInfo_Type);

	Py_INCREF(&PyResult_Type);
	PyModule_AddObject(module, "Result", (PyObject *)&PyResult_Type);

	Py_INCREF(&PyResultIterator_Type);
	PyModule_AddObject(module, "ResultIterator", (PyObject *)&PyResultIterator_Type);

	Py_INCREF(&PyTesseract_Type);
	PyModule_AddObject(module, "Tesseract", (PyObject *)&PyTesseract_Type);

	// CONSTANTS
	// TessOcrEngineMode
	PyModule_AddIntConstant(module, "OEM_TESSERACT_ONLY", tesseract::OEM_TESSERACT_ONLY);
	PyModule_AddIntConstant(module, "OEM_CUBE_ONLY", tesseract::OEM_CUBE_ONLY);
	PyModule_AddIntConstant(module, "OEM_TESSERACT_CUBE_COMBINED", tesseract::OEM_TESSERACT_CUBE_COMBINED);
	PyModule_AddIntConstant(module, "OEM_DEFAULT", tesseract::OEM_DEFAULT);

	// TessPageSegMode
	PyModule_AddIntConstant(module, "PSM_OSD_ONLY", tesseract::PSM_OSD_ONLY);
	PyModule_AddIntConstant(module, "PSM_AUTO_OSD", tesseract::PSM_AUTO_OSD);
	PyModule_AddIntConstant(module, "PSM_AUTO_ONLY", tesseract::PSM_AUTO_ONLY);
	PyModule_AddIntConstant(module, "PSM_AUTO", tesseract::PSM_AUTO);
	PyModule_AddIntConstant(module, "PSM_SINGLE_COLUMN", tesseract::PSM_SINGLE_COLUMN);
	PyModule_AddIntConstant(module, "PSM_SINGLE_BLOCK_VERT_TEXT", tesseract::PSM_SINGLE_BLOCK_VERT_TEXT);
	PyModule_AddIntConstant(module, "PSM_SINGLE_BLOCK", tesseract::PSM_SINGLE_BLOCK);
	PyModule_AddIntConstant(module, "PSM_SINGLE_LINE", tesseract::PSM_SINGLE_LINE);
	PyModule_AddIntConstant(module, "PSM_SINGLE_WORD", tesseract::PSM_SINGLE_WORD);
	PyModule_AddIntConstant(module, "PSM_CIRCLE_WORD", tesseract::PSM_CIRCLE_WORD);
	PyModule_AddIntConstant(module, "PSM_SINGLE_CHAR", tesseract::PSM_SINGLE_CHAR);
	PyModule_AddIntConstant(module, "PSM_COUNT", tesseract::PSM_COUNT);

	// PageIteratorLevel
	PyModule_AddIntConstant(module, "RIL_BLOCK", tesseract::RIL_BLOCK);
	PyModule_AddIntConstant(module, "RIL_PARA", tesseract::RIL_PARA);
	PyModule_AddIntConstant(module, "RIL_TEXTLINE", tesseract::RIL_TEXTLINE);
	PyModule_AddIntConstant(module, "RIL_WORD", tesseract::RIL_WORD);
	PyModule_AddIntConstant(module, "RIL_SYMBOL", tesseract::RIL_SYMBOL);

	// Orientation
	PyModule_AddIntConstant(module, "ORIENTATION_PAGE_UP", tesseract::ORIENTATION_PAGE_UP);
	PyModule_AddIntConstant(module, "ORIENTATION_PAGE_RIGHT", tesseract::ORIENTATION_PAGE_RIGHT);
	PyModule_AddIntConstant(module, "ORIENTATION_PAGE_DOWN", tesseract::ORIENTATION_PAGE_DOWN);
	PyModule_AddIntConstant(module, "ORIENTATION_PAGE_LEFT", tesseract::ORIENTATION_PAGE_LEFT);

	// WritingDirection
	PyModule_AddIntConstant(module, "WRITING_DIRECTION_LEFT_TO_RIGHT", tesseract::WRITING_DIRECTION_LEFT_TO_RIGHT);
	PyModule_AddIntConstant(module, "WRITING_DIRECTION_RIGHT_TO_LEFT", tesseract::WRITING_DIRECTION_RIGHT_TO_LEFT);
	PyModule_AddIntConstant(module, "WRITING_DIRECTION_TOP_TO_BOTTOM", tesseract::WRITING_DIRECTION_TOP_TO_BOTTOM);

	// TextlineOrder
	PyModule_AddIntConstant(module, "TEXTLINE_ORDER_LEFT_TO_RIGHT", tesseract::TEXTLINE_ORDER_LEFT_TO_RIGHT);
	PyModule_AddIntConstant(module, "TEXTLINE_ORDER_RIGHT_TO_LEFT", tesseract::TEXTLINE_ORDER_RIGHT_TO_LEFT);
	PyModule_AddIntConstant(module, "TEXTLINE_ORDER_TOP_TO_BOTTOM", tesseract::TEXTLINE_ORDER_TOP_TO_BOTTOM);
//.........这里部分代码省略.........
开发者ID:gpjt,项目名称:tesserpy,代码行数:101,代码来源:tesserpy.cpp


示例3: InitXBMCModule

  PyMODINIT_FUNC
  InitXBMCModule()
  {
    // init general xbmc modules
    PyObject* pXbmcModule;

    Py_INCREF(&Keyboard_Type);
    Py_INCREF(&Player_Type);
    Py_INCREF(&PlayList_Type);
    Py_INCREF(&PlayListItem_Type);
    Py_INCREF(&InfoTagMusic_Type);
    Py_INCREF(&InfoTagVideo_Type);

    pXbmcModule = Py_InitModule((char*)"xbmc", xbmcMethods);
    if (pXbmcModule == NULL) return;

    PyModule_AddObject(pXbmcModule, (char*)"Keyboard", (PyObject*)&Keyboard_Type);
    PyModule_AddObject(pXbmcModule, (char*)"Player", (PyObject*)&Player_Type);
    PyModule_AddObject(pXbmcModule, (char*)"PlayList", (PyObject*)&PlayList_Type);
    PyModule_AddObject(pXbmcModule, (char*)"PlayListItem", (PyObject*)&PlayListItem_Type);
    PyModule_AddObject(pXbmcModule, (char*)"InfoTagMusic", (PyObject*)&InfoTagMusic_Type);
    PyModule_AddObject(pXbmcModule, (char*)"InfoTagVideo", (PyObject*)&InfoTagVideo_Type);

    // constants
    PyModule_AddStringConstant(pXbmcModule, (char*)"__author__", (char*)PY_XBMC_AUTHOR);
    PyModule_AddStringConstant(pXbmcModule, (char*)"__date__", (char*)"15 November 2005");
    PyModule_AddStringConstant(pXbmcModule, (char*)"__version__", (char*)"1.3");
    PyModule_AddStringConstant(pXbmcModule, (char*)"__credits__", (char*)PY_XBMC_CREDITS);
    PyModule_AddStringConstant(pXbmcModule, (char*)"__platform__", (char*)PY_XBMC_PLATFORM);

    // playlist constants
    PyModule_AddIntConstant(pXbmcModule, (char*)"PLAYLIST_MUSIC", PLAYLIST_MUSIC);
    //PyModule_AddIntConstant(pXbmcModule, (char*)"PLAYLIST_MUSIC_TEMP", (char*)PLAYLIST_MUSIC_TEMP);
    PyModule_AddIntConstant(pXbmcModule, (char*)"PLAYLIST_VIDEO", PLAYLIST_VIDEO);
    //PyModule_AddIntConstant(pXbmcModule, (char*)"PLAYLIST_VIDEO_TEMP", PLAYLIST_VIDEO_TEMP);

    // player constants
    PyModule_AddIntConstant(pXbmcModule, (char*)"PLAYER_CORE_AUTO", EPC_NONE);
    PyModule_AddIntConstant(pXbmcModule, (char*)"PLAYER_CORE_DVDPLAYER", EPC_DVDPLAYER);
    PyModule_AddIntConstant(pXbmcModule, (char*)"PLAYER_CORE_MPLAYER", EPC_MPLAYER);
    PyModule_AddIntConstant(pXbmcModule, (char*)"PLAYER_CORE_PAPLAYER", EPC_PAPLAYER);

    // dvd state constants
    PyModule_AddIntConstant(pXbmcModule, (char*)"TRAY_OPEN", TRAY_OPEN);
    PyModule_AddIntConstant(pXbmcModule, (char*)"DRIVE_NOT_READY", DRIVE_NOT_READY);
    PyModule_AddIntConstant(pXbmcModule, (char*)"TRAY_CLOSED_NO_MEDIA", TRAY_CLOSED_NO_MEDIA);
    PyModule_AddIntConstant(pXbmcModule, (char*)"TRAY_CLOSED_MEDIA_PRESENT", TRAY_CLOSED_MEDIA_PRESENT);

    // log levels
    PyModule_AddIntConstant(pXbmcModule, (char*)"LOGDEBUG", LOGDEBUG);
    PyModule_AddIntConstant(pXbmcModule, (char*)"LOGINFO", LOGINFO);
    PyModule_AddIntConstant(pXbmcModule, (char*)"LOGNOTICE", LOGNOTICE);
    PyModule_AddIntConstant(pXbmcModule, (char*)"LOGWARNING", LOGWARNING);
    PyModule_AddIntConstant(pXbmcModule, (char*)"LOGERROR", LOGERROR);
    PyModule_AddIntConstant(pXbmcModule, (char*)"LOGSEVERE", LOGSEVERE);
    PyModule_AddIntConstant(pXbmcModule, (char*)"LOGFATAL", LOGFATAL);
    PyModule_AddIntConstant(pXbmcModule, (char*)"LOGNONE", LOGNONE);
    PyModule_AddObject(pXbmcModule, (char*)"abortRequested", PyBool_FromLong(0));
  }
开发者ID:bobo1on1,项目名称:xbmc,代码行数:59,代码来源:xbmcmodule.cpp


示例4: add_compat_enums

static void
add_compat_enums(PyObject *m)
{
    PyModule_AddIntConstant(m, "ADD_WHITE_MASK",
                            GIMP_ADD_MASK_WHITE);
    PyModule_AddIntConstant(m, "ADD_BLACK_MASK",
                            GIMP_ADD_MASK_BLACK);
    PyModule_AddIntConstant(m, "ADD_ALPHA_MASK",
                            GIMP_ADD_MASK_ALPHA);
    PyModule_AddIntConstant(m, "ADD_ALPHA_TRANSFER_MASK",
                            GIMP_ADD_MASK_ALPHA_TRANSFER);
    PyModule_AddIntConstant(m, "ADD_SELECTION_MASK",
                            GIMP_ADD_MASK_SELECTION);
    PyModule_AddIntConstant(m, "ADD_COPY_MASK",
                            GIMP_ADD_MASK_COPY);
    PyModule_AddIntConstant(m, "ADD_CHANNEL_MASK",
                            GIMP_ADD_MASK_CHANNEL);

    PyModule_AddIntConstant(m, "FG_BG_RGB_MODE",
                            GIMP_BLEND_FG_BG_RGB);
    PyModule_AddIntConstant(m, "FG_BG_HSV_MODE",
                            GIMP_BLEND_FG_BG_HSV);
    PyModule_AddIntConstant(m, "FG_TRANSPARENT_MODE",
                            GIMP_BLEND_FG_TRANSPARENT);
    PyModule_AddIntConstant(m, "CUSTOM_MODE",
                            GIMP_BLEND_CUSTOM);

    PyModule_AddIntConstant(m, "FG_BUCKET_FILL",
                            GIMP_BUCKET_FILL_FG);
    PyModule_AddIntConstant(m, "BG_BUCKET_FILL",
                            GIMP_BUCKET_FILL_BG);
    PyModule_AddIntConstant(m, "PATTERN_BUCKET_FILL",
                            GIMP_BUCKET_FILL_PATTERN);

    PyModule_AddIntConstant(m, "BLUR_CONVOLVE",
                            GIMP_CONVOLVE_BLUR);
    PyModule_AddIntConstant(m, "SHARPEN_CONVOLVE",
                            GIMP_CONVOLVE_SHARPEN);

    PyModule_AddIntConstant(m, "IMAGE_CLONE",
                            GIMP_CLONE_IMAGE);
    PyModule_AddIntConstant(m, "PATTERN_CLONE",
                            GIMP_CLONE_PATTERN);

    PyModule_AddIntConstant(m, "FOREGROUND_FILL",
                            GIMP_FILL_FOREGROUND);
    PyModule_AddIntConstant(m, "BACKGROUND_FILL",
                            GIMP_FILL_BACKGROUND);
    PyModule_AddIntConstant(m, "WHITE_FILL",
                            GIMP_FILL_WHITE);
    PyModule_AddIntConstant(m, "TRANSPARENT_FILL",
                            GIMP_FILL_TRANSPARENT);
    PyModule_AddIntConstant(m, "PATTERN_FILL",
                            GIMP_FILL_PATTERN);

    PyModule_AddIntConstant(m, "DODGE",
                            GIMP_DODGE_BURN_TYPE_DODGE);
    PyModule_AddIntConstant(m, "BURN",
                            GIMP_DODGE_BURN_TYPE_BURN);

    PyModule_AddIntConstant(m, "SHADOWS",
                            GIMP_TRANSFER_SHADOWS);
    PyModule_AddIntConstant(m, "MIDTONES",
                            GIMP_TRANSFER_MIDTONES);
    PyModule_AddIntConstant(m, "HIGHLIGHTS",
                            GIMP_TRANSFER_HIGHLIGHTS);

    PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_RGB",
                            GIMP_EXPORT_CAN_HANDLE_RGB);
    PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_GRAY",
                            GIMP_EXPORT_CAN_HANDLE_GRAY);
    PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_INDEXED",
                            GIMP_EXPORT_CAN_HANDLE_INDEXED);
    PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_BITMAP",
                            GIMP_EXPORT_CAN_HANDLE_BITMAP);
    PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_ALPHA",
                            GIMP_EXPORT_CAN_HANDLE_ALPHA);
    PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_LAYERS",
                            GIMP_EXPORT_CAN_HANDLE_LAYERS);
    PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION",
                            GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION);
    PyModule_AddIntConstant(m, "EXPORT_CAN_HANDLE_LAYER_MASKS",
                            GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS);
    PyModule_AddIntConstant(m, "EXPORT_NEEDS_ALPHA",
                            GIMP_EXPORT_NEEDS_ALPHA);

    PyModule_AddIntConstant(m, "EXPORT_CANCEL",
                            GIMP_EXPORT_CANCEL);
    PyModule_AddIntConstant(m, "EXPORT_IGNORE",
                            GIMP_EXPORT_IGNORE);
    PyModule_AddIntConstant(m, "EXPORT_EXPORT",
                            GIMP_EXPORT_EXPORT);
}
开发者ID:K-Sonoda,项目名称:gimp,代码行数:93,代码来源:gimpenumsmodule.c


示例5: PyInit_netconf

/* module initializer */
PyMODINIT_FUNC PyInit_netconf(void)
{
	PyObject *nc;

	/* initiate libnetconf - all subsystems */
	nc_init(NC_INIT_ALL);

	/* set print callback */
	nc_callback_print(clb_print);

	/* get default caapbilities */
	global_cpblts = nc_session_get_cpblts_default();

	ncSessionType.tp_new = PyType_GenericNew;
	if (PyType_Ready(&ncSessionType) < 0) {
	    return NULL;
	}

	/* create netconf as the Python module */
	nc = PyModule_Create(&ncModule);
	if (nc == NULL) {
		return NULL;
	}

    Py_INCREF(&ncSessionType);
    PyModule_AddObject(nc, "Session", (PyObject *)&ncSessionType);

    datastores = PyDict_New();
    PyModule_AddObject(nc, "Datastores", datastores);

    PyModule_AddStringConstant(nc, "NETCONFv1_0", NETCONF_CAP_BASE10);
    PyModule_AddStringConstant(nc, "NETCONFv1_1", NETCONF_CAP_BASE11);
    PyModule_AddStringConstant(nc, "TRANSPORT_SSH", NETCONF_TRANSPORT_SSH);
    PyModule_AddStringConstant(nc, "TRANSPORT_TLS", NETCONF_TRANSPORT_TLS);

    PyModule_AddIntConstant(nc, "WD_ALL", NCWD_MODE_ALL);
    PyModule_AddIntConstant(nc, "WD_ALL_TAGGED", NCWD_MODE_ALL_TAGGED);
    PyModule_AddIntConstant(nc, "WD_TRIM", NCWD_MODE_TRIM);
    PyModule_AddIntConstant(nc, "WD_MODE_EXPLICIT", NCWD_MODE_EXPLICIT);

    PyModule_AddIntConstant(nc, "RUNNING", NC_DATASTORE_RUNNING);
    PyModule_AddIntConstant(nc, "STARTUP", NC_DATASTORE_STARTUP);
    PyModule_AddIntConstant(nc, "CANDIDATE", NC_DATASTORE_CANDIDATE);

    PyModule_AddIntConstant(nc, "NC_EDIT_DEFOP_NOTSET", NC_EDIT_DEFOP_NOTSET);
    PyModule_AddIntConstant(nc, "NC_EDIT_DEFOP_MERGE", NC_EDIT_DEFOP_MERGE);
    PyModule_AddIntConstant(nc, "NC_EDIT_DEFOP_REPLACE", NC_EDIT_DEFOP_REPLACE);
    PyModule_AddIntConstant(nc, "NC_EDIT_DEFOP_NONE", NC_EDIT_DEFOP_NONE);

    PyModule_AddIntConstant(nc, "NC_EDIT_ERROPT_NOTSET", NC_EDIT_ERROPT_NOTSET);
    PyModule_AddIntConstant(nc, "NC_EDIT_ERROPT_STOP", NC_EDIT_ERROPT_STOP);
    PyModule_AddIntConstant(nc, "NC_EDIT_ERROPT_CONT", NC_EDIT_ERROPT_CONT);
    PyModule_AddIntConstant(nc, "NC_EDIT_ERROPT_ROLLBACK", NC_EDIT_ERROPT_ROLLBACK);

    PyModule_AddIntConstant(nc, "NC_EDIT_TESTOPT_NOTSET", NC_EDIT_TESTOPT_NOTSET);
    PyModule_AddIntConstant(nc, "NC_EDIT_TESTOPT_TESTSET", NC_EDIT_TESTOPT_TESTSET);
    PyModule_AddIntConstant(nc, "NC_EDIT_TESTOPT_SET", NC_EDIT_TESTOPT_SET);
    PyModule_AddIntConstant(nc, "NC_EDIT_TESTOPT_TEST", NC_EDIT_TESTOPT_TEST);

	/* init libnetconf exceptions for use in clb_print() */
	libnetconfError = PyErr_NewExceptionWithDoc("netconf.Error", "Error passed from the underlying libnetconf library.", NULL, NULL);
	Py_INCREF(libnetconfError);
	PyModule_AddObject(nc, "Error", libnetconfError);

	libnetconfWarning = PyErr_NewExceptionWithDoc("netconf.Warning", "Warning passed from the underlying libnetconf library.", PyExc_Warning, NULL);
	Py_INCREF(libnetconfWarning);
	PyModule_AddObject(nc, "Warning", libnetconfWarning);

	return nc;
}
开发者ID:ADTRAN,项目名称:libnetconf,代码行数:71,代码来源:netconf.c


示例6: initSSL

/*
 * Initialize SSL sub module
 *
 * Arguments: None
 * Returns:   None
 */
void
initSSL(void)
{
    static void *ssl_API[ssl_API_pointers];
    PyObject *ssl_api_object;
    PyObject *module;

    SSL_library_init();
    ERR_load_SSL_strings();

    import_crypto();

    if ((module = Py_InitModule3("SSL", ssl_methods, ssl_doc)) == NULL) {
        return;
    }

    /* Initialize the C API pointer array */
    ssl_API[ssl_Context_New_NUM]    = (void *)ssl_Context_New;
    ssl_API[ssl_Connection_New_NUM] = (void *)ssl_Connection_New;
    ssl_api_object = PyCObject_FromVoidPtr((void *)ssl_API, NULL);
    if (ssl_api_object != NULL)
        PyModule_AddObject(module, "_C_API", ssl_api_object);

    /* Exceptions */
/*
 * ADD_EXCEPTION(dict,name,base) expands to a correct Exception declaration,
 * inserting OpenSSL.SSL.name into dict, derviving the exception from base.
 */
#define ADD_EXCEPTION(_name, _base)                                    \
do {                                                                          \
    ssl_##_name = PyErr_NewException("OpenSSL.SSL."#_name, _base, NULL);\
    if (ssl_##_name == NULL)                                            \
        goto error;                                                           \
    if (PyModule_AddObject(module, #_name, ssl_##_name) != 0)           \
        goto error;                                                           \
} while (0)

    ssl_Error = PyErr_NewException("OpenSSL.SSL.Error", NULL, NULL);
    if (ssl_Error == NULL)
        goto error;
    if (PyModule_AddObject(module, "Error", ssl_Error) != 0)
        goto error;

    ADD_EXCEPTION(ZeroReturnError,     ssl_Error);
    ADD_EXCEPTION(WantReadError,       ssl_Error);
    ADD_EXCEPTION(WantWriteError,      ssl_Error);
    ADD_EXCEPTION(WantX509LookupError, ssl_Error);
    ADD_EXCEPTION(SysCallError,        ssl_Error);
#undef ADD_EXCEPTION

    /* Method constants */
    PyModule_AddIntConstant(module, "SSLv2_METHOD",  ssl_SSLv2_METHOD);
    PyModule_AddIntConstant(module, "SSLv3_METHOD",  ssl_SSLv3_METHOD);
    PyModule_AddIntConstant(module, "SSLv23_METHOD", ssl_SSLv23_METHOD);
    PyModule_AddIntConstant(module, "TLSv1_METHOD",  ssl_TLSv1_METHOD);

    /* Verify constants */
    PyModule_AddIntConstant(module, "VERIFY_NONE", SSL_VERIFY_NONE);
    PyModule_AddIntConstant(module, "VERIFY_PEER", SSL_VERIFY_PEER);
    PyModule_AddIntConstant(module, "VERIFY_FAIL_IF_NO_PEER_CERT",
                            SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
    PyModule_AddIntConstant(module, "VERIFY_CLIENT_ONCE",
                            SSL_VERIFY_CLIENT_ONCE);

    /* File type constants */
    PyModule_AddIntConstant(module, "FILETYPE_PEM",  SSL_FILETYPE_PEM);
    PyModule_AddIntConstant(module, "FILETYPE_ASN1", SSL_FILETYPE_ASN1);

    /* SSL option constants */
    PyModule_AddIntConstant(module, "OP_SINGLE_DH_USE", SSL_OP_SINGLE_DH_USE);
    PyModule_AddIntConstant(module, "OP_EPHEMERAL_RSA", SSL_OP_EPHEMERAL_RSA);
    PyModule_AddIntConstant(module, "OP_NO_SSLv2", SSL_OP_NO_SSLv2);
    PyModule_AddIntConstant(module, "OP_NO_SSLv3", SSL_OP_NO_SSLv3);
    PyModule_AddIntConstant(module, "OP_NO_TLSv1", SSL_OP_NO_TLSv1);

    /* More SSL option constants */
    PyModule_AddIntConstant(module, "OP_MICROSOFT_SESS_ID_BUG", SSL_OP_MICROSOFT_SESS_ID_BUG);
    PyModule_AddIntConstant(module, "OP_NETSCAPE_CHALLENGE_BUG", SSL_OP_NETSCAPE_CHALLENGE_BUG);
    PyModule_AddIntConstant(module, "OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG", SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG);
    PyModule_AddIntConstant(module, "OP_SSLREF2_REUSE_CERT_TYPE_BUG", SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG);
    PyModule_AddIntConstant(module, "OP_MICROSOFT_BIG_SSLV3_BUFFER", SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER);
    PyModule_AddIntConstant(module, "OP_MSIE_SSLV2_RSA_PADDING", SSL_OP_MSIE_SSLV2_RSA_PADDING);
    PyModule_AddIntConstant(module, "OP_SSLEAY_080_CLIENT_DH_BUG", SSL_OP_SSLEAY_080_CLIENT_DH_BUG);
    PyModule_AddIntConstant(module, "OP_TLS_D5_BUG", SSL_OP_TLS_D5_BUG);
    PyModule_AddIntConstant(module, "OP_TLS_BLOCK_PADDING_BUG", SSL_OP_TLS_BLOCK_PADDING_BUG);
    PyModule_AddIntConstant(module, "OP_DONT_INSERT_EMPTY_FRAGMENTS", SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS);
    PyModule_AddIntConstant(module, "OP_ALL", SSL_OP_ALL);
    PyModule_AddIntConstant(module, "OP_CIPHER_SERVER_PREFERENCE", SSL_OP_CIPHER_SERVER_PREFERENCE);
    PyModule_AddIntConstant(module, "OP_TLS_ROLLBACK_BUG", SSL_OP_TLS_ROLLBACK_BUG);
    PyModule_AddIntConstant(module, "OP_PKCS1_CHECK_1", SSL_OP_PKCS1_CHECK_1);
    PyModule_AddIntConstant(module, "OP_PKCS1_CHECK_2", SSL_OP_PKCS1_CHECK_2);
    PyModule_AddIntConstant(module, "OP_NETSCAPE_CA_DN_BUG", SSL_OP_NETSCAPE_CA_DN_BUG);
    PyModule_AddIntConstant(module, "OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG", SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);

//.........这里部分代码省略.........
开发者ID:arcean,项目名称:pyopenssl,代码行数:101,代码来源:ssl.c


示例7: initpyodbc

PyMODINIT_FUNC
initpyodbc()
{
#ifdef _DEBUG
    #ifndef Py_REF_DEBUG
    #error Py_REF_DEBUG not set!
    #endif

    int grfDebugFlags = _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF;
    _CrtSetDbgFlag(grfDebugFlags);
#endif

    ErrorInit();

    if (PyType_Ready(&ConnectionType) < 0 || PyType_Ready(&CursorType) < 0 || PyType_Ready(&RowType) < 0 || PyType_Ready(&CnxnInfoType) < 0)
        return;

    pModule = Py_InitModule4("pyodbc", pyodbc_methods, module_doc, NULL, PYTHON_API_VERSION);

    if (!import_types())
        return;

    init_locale_info();

    if (!CreateExceptions())
        return;

    // The 'build' version number is a beta identifier.  For example, if it is 7, then we are on beta7 of the
    // (major,minor.micro) version.  On Windows, we poke these values into the DLL's version resource, so when we make
    // an official build (which come *after* the betas), we set the BUILD to 9999 so installers will know that it
    // should replace any installed betas.  However, we obviously don't want to see these.

    PyObject* pVersion;
    if (PYODBC_BUILD == 9999)
        pVersion = PyString_FromFormat("%d.%d.%d", PYODBC_MAJOR, PYODBC_MINOR, PYODBC_MICRO);
    else
        pVersion = PyString_FromFormat("%d.%d.%d-beta%d", PYODBC_MAJOR, PYODBC_MINOR, PYODBC_MICRO, PYODBC_BUILD);
    PyModule_AddObject(pModule, "version", pVersion);

    PyModule_AddIntConstant(pModule, "threadsafety", 1);
    PyModule_AddStringConstant(pModule, "apilevel", "2.0");
    PyModule_AddStringConstant(pModule, "paramstyle", "qmark");
    PyModule_AddObject(pModule, "pooling", Py_True);
    Py_INCREF(Py_True);
    PyModule_AddObject(pModule, "lowercase", Py_False);
    Py_INCREF(Py_False);
                       
    PyModule_AddObject(pModule, "Connection", (PyObject*)&ConnectionType);
    Py_INCREF((PyObject*)&ConnectionType);
    PyModule_AddObject(pModule, "Cursor", (PyObject*)&CursorType);
    Py_INCREF((PyObject*)&CursorType);
    PyModule_AddObject(pModule, "Row", (PyObject*)&RowType);
    Py_INCREF((PyObject*)&RowType);

    // Add the SQL_XXX defines from ODBC.
    for (unsigned int i = 0; i < _countof(aConstants); i++)
        PyModule_AddIntConstant(pModule, (char*)aConstants[i].szName, aConstants[i].value);

    PyModule_AddObject(pModule, "Date", (PyObject*)PyDateTimeAPI->DateType);
    Py_INCREF((PyObject*)PyDateTimeAPI->DateType);
    PyModule_AddObject(pModule, "Time", (PyObject*)PyDateTimeAPI->TimeType);
    Py_INCREF((PyObject*)PyDateTimeAPI->TimeType);
    PyModule_AddObject(pModule, "Timestamp", (PyObject*)PyDateTimeAPI->DateTimeType);
    Py_INCREF((PyObject*)PyDateTimeAPI->DateTimeType);
    PyModule_AddObject(pModule, "DATETIME", (PyObject*)PyDateTimeAPI->DateTimeType);
    Py_INCREF((PyObject*)PyDateTimeAPI->DateTimeType);
    PyModule_AddObject(pModule, "STRING", (PyObject*)&PyString_Type);
    Py_INCREF((PyObject*)&PyString_Type);
    PyModule_AddObject(pModule, "NUMBER", (PyObject*)&PyFloat_Type);
    Py_INCREF((PyObject*)&PyFloat_Type);
    PyModule_AddObject(pModule, "ROWID", (PyObject*)&PyInt_Type);
    Py_INCREF((PyObject*)&PyInt_Type);
    PyModule_AddObject(pModule, "BINARY", (PyObject*)&PyBuffer_Type);
    Py_INCREF((PyObject*)&PyBuffer_Type);
    PyModule_AddObject(pModule, "Binary", (PyObject*)&PyBuffer_Type);
    Py_INCREF((PyObject*)&PyBuffer_Type);
    
    if (PyErr_Occurred())
        ErrorCleanup();
}
开发者ID:ramiro,项目名称:pyodbc,代码行数:80,代码来源:pyodbcmodule.cpp


示例8: initpaho_mqtt3c

PyMODINIT_FUNC initpaho_mqtt3c(void)
{
	PyObject *m;

	PyEval_InitThreads();

	callbacks = ListInitialize();

	m = Py_InitModule("paho_mqtt3c", MqttV3Methods);
	if (m == NULL)
		return;

	MqttV3Error = PyErr_NewException("paho_mqtt3c.error", NULL, NULL);
	Py_INCREF(MqttV3Error);
	PyModule_AddObject(m, "error", MqttV3Error);

	PyModule_AddIntConstant(m, "SUCCESS", MQTTCLIENT_SUCCESS);
	PyModule_AddIntConstant(m, "FAILURE", MQTTCLIENT_FAILURE);
	PyModule_AddIntConstant(m, "DISCONNECTED", MQTTCLIENT_DISCONNECTED);
	PyModule_AddIntConstant(m, "MAX_MESSAGES_INFLIGHT",	MQTTCLIENT_MAX_MESSAGES_INFLIGHT);
	PyModule_AddIntConstant(m, "BAD_UTF8_STRING", MQTTCLIENT_BAD_UTF8_STRING);
	PyModule_AddIntConstant(m, "BAD_NULL_PARAMETER", MQTTCLIENT_NULL_PARAMETER);
	PyModule_AddIntConstant(m, "BAD_TOPICNAME_TRUNCATED", MQTTCLIENT_TOPICNAME_TRUNCATED);
	PyModule_AddIntConstant(m, "PERSISTENCE_DEFAULT", MQTTCLIENT_PERSISTENCE_DEFAULT);
	PyModule_AddIntConstant(m, "PERSISTENCE_NONE", MQTTCLIENT_PERSISTENCE_NONE);
	PyModule_AddIntConstant(m, "PERSISTENCE_USER", MQTTCLIENT_PERSISTENCE_USER);
	PyModule_AddIntConstant(m, "PERSISTENCE_ERROR",
	MQTTCLIENT_PERSISTENCE_ERROR);
}
开发者ID:CJxD,项目名称:paho.mqtt.c,代码行数:29,代码来源:mqttclient_module.c


示例9: initicu

PyMODINIT_FUNC
initicu(void) 
{
    PyObject* m;
    UVersionInfo ver, uver;
    UErrorCode status = U_ZERO_ERROR;
    char version[U_MAX_VERSION_STRING_LENGTH+1] = {0}, uversion[U_MAX_VERSION_STRING_LENGTH+5] = {0};

    if (sizeof(Py_UNICODE) != 2 && sizeof(Py_UNICODE) != 4) {
        PyErr_SetString(PyExc_RuntimeError, "This module only works on python versions <= 3.2");
        return;
    }

    u_init(&status);
    if (U_FAILURE(status)) {
        PyErr_SetString(PyExc_RuntimeError, u_errorName(status));
        return;
    }
    u_getVersion(ver);
    u_versionToString(ver, version);
    u_getUnicodeVersion(uver);
    u_versionToString(uver, uversion);

    if (PyType_Ready(&icu_CollatorType) < 0)
        return;
    if (PyType_Ready(&icu_BreakIteratorType) < 0)
        return;

    m = Py_InitModule3("icu", icu_methods,
                       "Wrapper for the ICU internationalization library");

    Py_INCREF(&icu_CollatorType); Py_INCREF(&icu_BreakIteratorType);
    PyModule_AddObject(m, "Collator", (PyObject *)&icu_CollatorType);
    PyModule_AddObject(m, "BreakIterator", (PyObject *)&icu_BreakIteratorType);
    // uint8_t must be the same size as char
    PyModule_AddIntConstant(m, "ok", (U_SUCCESS(status) && sizeof(uint8_t) == sizeof(char)) ? 1 : 0);
    PyModule_AddStringConstant(m, "icu_version", version);
    PyModule_AddStringConstant(m, "unicode_version", uversion);

    ADDUCONST(USET_SPAN_NOT_CONTAINED);
    ADDUCONST(USET_SPAN_CONTAINED);
    ADDUCONST(USET_SPAN_SIMPLE);
    ADDUCONST(UCOL_DEFAULT);
    ADDUCONST(UCOL_PRIMARY);
    ADDUCONST(UCOL_SECONDARY);
    ADDUCONST(UCOL_TERTIARY);
    ADDUCONST(UCOL_DEFAULT_STRENGTH);
    ADDUCONST(UCOL_QUATERNARY);
    ADDUCONST(UCOL_IDENTICAL);
    ADDUCONST(UCOL_OFF);
    ADDUCONST(UCOL_ON);
    ADDUCONST(UCOL_SHIFTED);
    ADDUCONST(UCOL_NON_IGNORABLE);
    ADDUCONST(UCOL_LOWER_FIRST);
    ADDUCONST(UCOL_UPPER_FIRST);

    ADDUCONST(UNORM_NONE);
    ADDUCONST(UNORM_NFD);
    ADDUCONST(UNORM_NFKD);
    ADDUCONST(UNORM_NFC);
    ADDUCONST(UNORM_DEFAULT);
    ADDUCONST(UNORM_NFKC);
    ADDUCONST(UNORM_FCD);

    ADDUCONST(UPPER_CASE);
    ADDUCONST(LOWER_CASE);
    ADDUCONST(TITLE_CASE);

    ADDUCONST(UBRK_CHARACTER);
    ADDUCONST(UBRK_WORD);
    ADDUCONST(UBRK_LINE);
    ADDUCONST(UBRK_SENTENCE);

}
开发者ID:charliehower,项目名称:calibre,代码行数:74,代码来源:icu.c


示例10: PyInit_syslog

PyMODINIT_FUNC
PyInit_syslog(void)
{
    PyObject *m;

    /* Create the module and add the functions */
    m = PyModule_Create(&syslogmodule);
    if (m == NULL)
        return NULL;

    /* Add some symbolic constants to the module */

    /* Priorities */
    PyModule_AddIntConstant(m, "LOG_EMERG",       LOG_EMERG);
    PyModule_AddIntConstant(m, "LOG_ALERT",       LOG_ALERT);
    PyModule_AddIntConstant(m, "LOG_CRIT",        LOG_CRIT);
    PyModule_AddIntConstant(m, "LOG_ERR",         LOG_ERR);
    PyModule_AddIntConstant(m, "LOG_WARNING", LOG_WARNING);
    PyModule_AddIntConstant(m, "LOG_NOTICE",  LOG_NOTICE);
    PyModule_AddIntConstant(m, "LOG_INFO",        LOG_INFO);
    PyModule_AddIntConstant(m, "LOG_DEBUG",       LOG_DEBUG);

    /* openlog() option flags */
    PyModule_AddIntConstant(m, "LOG_PID",         LOG_PID);
    PyModule_AddIntConstant(m, "LOG_CONS",        LOG_CONS);
    PyModule_AddIntConstant(m, "LOG_NDELAY",  LOG_NDELAY);
#ifdef LOG_ODELAY
    PyModule_AddIntConstant(m, "LOG_ODELAY",  LOG_ODELAY);
#endif
#ifdef LOG_NOWAIT
    PyModule_AddIntConstant(m, "LOG_NOWAIT",  LOG_NOWAIT);
#endif
#ifdef LOG_PERROR
    PyModule_AddIntConstant(m, "LOG_PERROR",  LOG_PERROR);
#endif

    /* Facilities */
    PyModule_AddIntConstant(m, "LOG_KERN",        LOG_KERN);
    PyModule_AddIntConstant(m, "LOG_USER",        LOG_USER);
    PyModule_AddIntConstant(m, "LOG_MAIL",        LOG_MAIL);
    PyModule_AddIntConstant(m, "LOG_DAEMON",  LOG_DAEMON);
    PyModule_AddIntConstant(m, "LOG_AUTH",        LOG_AUTH);
    PyModule_AddIntConstant(m, "LOG_LPR",         LOG_LPR);
    PyModule_AddIntConstant(m, "LOG_LOCAL0",  LOG_LOCAL0);
    PyModule_AddIntConstant(m, "LOG_LOCAL1",  LOG_LOCAL1);
    PyModule_AddIntConstant(m, "LOG_LOCAL2",  LOG_LOCAL2);
    PyModule_AddIntConstant(m, "LOG_LOCAL3",  LOG_LOCAL3);
    PyModule_AddIntConstant(m, "LOG_LOCAL4",  LOG_LOCAL4);
    PyModule_AddIntConstant(m, "LOG_LOCAL5",  LOG_LOCAL5);
    PyModule_AddIntConstant(m, "LOG_LOCAL6",  LOG_LOCAL6);
    PyModule_AddIntConstant(m, "LOG_LOCAL7",  LOG_LOCAL7);

#ifndef LOG_SYSLOG
#define LOG_SYSLOG              LOG_DAEMON
#endif
#ifndef LOG_NEWS
#define LOG_NEWS                LOG_MAIL
#endif
#ifndef LOG_UUCP
#define LOG_UUCP                LOG_MAIL
#endif
#ifndef LOG_CRON
#define LOG_CRON                LOG_DAEMON
#endif

    PyModule_AddIntConstant(m, "LOG_SYSLOG",  LOG_SYSLOG);
    PyModule_AddIntConstant(m, "LOG_CRON",        LOG_CRON);
    PyModule_AddIntConstant(m, "LOG_UUCP",        LOG_UUCP);
    PyModule_AddIntConstant(m, "LOG_NEWS",        LOG_NEWS);

#ifdef LOG_AUTHPRIV
    PyModule_AddIntConstant(m, "LOG_AUTHPRIV",    LOG_AUTHPRIV);
#endif

    return m;
}
开发者ID:IgnusIndia,项目名称:pythonexperiment,代码行数:76,代码来源:syslogmodule.c


示例11: py_init

int py_init(void)
{
	PyObject *PyObj, *PyWmPluginModule;
	int i;

	Py_InitializeEx(0);

	if (!(PyCWiidModule = PyImport_ImportModule("cwiid"))) {
		PyErr_Print();
		goto ERR_HND;
	}

	if (!(PySysModule = PyImport_ImportModule("sys"))) {
		PyErr_Print();
		goto ERR_HND;
	}

	if (!(PyPath = PyObject_GetAttrString(PySysModule, "path"))) {
		PyErr_Print();
		goto ERR_HND;
	}

	if (!(PyObj = PyObject_GetAttrString(PyCWiidModule,
	                                      "ConvertMesgArray"))) {
		PyErr_Print();
		goto ERR_HND;
	}
	ConvertMesgArray = PyCObject_AsVoidPtr(PyObj);
	Py_DECREF(PyObj);

	/* note: PyWmPluginModule is a borrowed reference - do not decref */
	if (!(PyWmPluginModule = Py_InitModule3("wmplugin", Module_Methods,
	                                        "wminput plugin interface"))) {
		PyErr_Print();
		goto ERR_HND;
	}

	for (i = 0; wmplugin_constants[i].name; i++) {
		if (PyModule_AddIntConstant(PyWmPluginModule,
		                            wmplugin_constants[i].name,
		                            wmplugin_constants[i].value)) {
			PyErr_Print();
			goto ERR_HND;
		}
	}

	return 0;

ERR_HND:
	if (PyCWiidModule) {
		Py_DECREF(PyCWiidModule);
		PyCWiidModule = NULL;
	}

	if (PyPath) {
		Py_DECREF(PyPath);
		PyPath = NULL;
	}

	if (PySysModule) {
		Py_DECREF(PySysModule);
		PySysModule = NULL;
	}

	Py_Finalize();

	return -1;
}
开发者ID:alama,项目名称:cwiid,代码行数:68,代码来源:py_plugin.c


示例12: InitPluginModule

  PyMODINIT_FUNC
  InitPluginModule()
  {
    // init general xbmc modules
    PyObject* pXbmcPluginModule;

    pXbmcPluginModule = Py_InitModule((char*)"xbmcplugin", pluginMethods);
    if (pXbmcPluginModule == NULL) return;

    // constants
    PyModule_AddStringConstant(pXbmcPluginModule, (char*)"__author__", (char*)PY_XBMC_AUTHOR);
    PyModule_AddStringConstant(pXbmcPluginModule, (char*)"__date__", (char*)"20 August 2007");
    PyModule_AddStringConstant(pXbmcPluginModule, (char*)"__version__", (char*)"1.0");
    PyModule_AddStringConstant(pXbmcPluginModule, (char*)"__credits__", (char*)PY_XBMC_CREDITS);
    PyModule_AddStringConstant(pXbmcPluginModule, (char*)"__platform__", (char*)PY_XBMC_PLATFORM);

    // sort method constants
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_NONE", SORT_METHOD_NONE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_LABEL", SORT_METHOD_LABEL);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_LABEL_IGNORE_THE", SORT_METHOD_LABEL_IGNORE_THE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_DATE", SORT_METHOD_DATE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_SIZE", SORT_METHOD_SIZE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_FILE", SORT_METHOD_FILE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_DRIVE_TYPE", SORT_METHOD_DRIVE_TYPE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_TRACKNUM", SORT_METHOD_TRACKNUM);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_DURATION", SORT_METHOD_DURATION);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_TITLE", SORT_METHOD_TITLE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_TITLE_IGNORE_THE", SORT_METHOD_TITLE_IGNORE_THE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_ARTIST", SORT_METHOD_ARTIST);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_ARTIST_IGNORE_THE", SORT_METHOD_ARTIST_IGNORE_THE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_ALBUM", SORT_METHOD_ALBUM);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_ALBUM_IGNORE_THE", SORT_METHOD_ALBUM_IGNORE_THE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_GENRE", SORT_METHOD_GENRE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_VIDEO_YEAR", SORT_METHOD_YEAR);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_VIDEO_RATING", SORT_METHOD_VIDEO_RATING);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_PROGRAM_COUNT", SORT_METHOD_PROGRAM_COUNT);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_PLAYLIST_ORDER", SORT_METHOD_PLAYLIST_ORDER);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_EPISODE", SORT_METHOD_EPISODE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_VIDEO_TITLE", SORT_METHOD_VIDEO_TITLE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_PRODUCTIONCODE", SORT_METHOD_PRODUCTIONCODE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_SONG_RATING", SORT_METHOD_SONG_RATING);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_MPAA_RATING", SORT_METHOD_MPAA_RATING);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_VIDEO_RUNTIME", SORT_METHOD_VIDEO_RUNTIME);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_STUDIO", SORT_METHOD_STUDIO);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_STUDIO_IGNORE_THE", SORT_METHOD_STUDIO_IGNORE_THE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_UNSORTED", SORT_METHOD_UNSORTED);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_BITRATE", SORT_METHOD_BITRATE);
    PyModule_AddIntConstant(pXbmcPluginModule, (char*)"SORT_METHOD_LISTENERS", SORT_METHOD_LISTENERS);
  }
开发者ID:Alxandr,项目名称:spotyxbmc2,代码行数:49,代码来源:xbmcplugin.cpp


示例13: initaerospike

PyMODINIT_FUNC initaerospike(void)
{

	static char version[6] = "1.0.58";
	// Makes things "thread-safe"
	PyEval_InitThreads();
	int i = 0;

	// aerospike Module
	PyObject * aerospike = Py_InitModule3("aerospike", Aerospike_Methods,
			"Aerospike Python Client");

	py_global_hosts = PyDict_New();
	declare_policy_constants(aerospike);

	PyModule_AddStringConstant(aerospike, "__version__", version);

	PyObject * exception = AerospikeException_New();
	Py_INCREF(exception);
	PyModule_AddObject(aerospike, "exception", exception);

	PyTypeObject * client = AerospikeClient_Ready();
	Py_INCREF(client);
	PyModule_AddObject(aerospike, "Client", (PyObject *) client);

	PyTypeObject * key = AerospikeKey_Ready();
	Py_INCREF(key);
	PyModule_AddObject(aerospike, "Key", (PyObject *) key);

	PyTypeObject * query = AerospikeQuery_Ready();
	Py_INCREF(query);
	PyModule_AddObject(aerospike, "Query", (PyObject *) query);

	declare_policy_constants(aerospike);
	declare_log_constants(aerospike);

	PyTypeObject * scan = AerospikeScan_Ready();
	Py_INCREF(scan);
	PyModule_AddObject(aerospike, "Scan", (PyObject *) scan);

	for (i = 0; i <= OPERATOR_CONSTANTS_ARR_SIZE; i++) {
		PyModule_AddIntConstant(aerospike,
				operator_constants[i].constant_str,
				operator_constants[i].constantno);
	}

	/*
	 * Add constants to module.
	 */
	declare_policy_constants(aerospike);

	PyObject * predicates = AerospikePredicates_New();
	Py_INCREF(predicates);
	PyModule_AddObject(aerospike, "predicates", predicates);


	PyTypeObject * lstack = AerospikeLStack_Ready();
	Py_INCREF(lstack);
	PyModule_AddObject(aerospike, "lstack", (PyObject *) lstack);

	PyTypeObject * lset = AerospikeLSet_Ready();
	Py_INCREF(lset);
	PyModule_AddObject(aerospike, "lset", (PyObject *) lset);

	PyTypeObject * llist = AerospikeLList_Ready();
	Py_INCREF(llist);
	PyModule_AddObject(aerospike, "llist", (PyObject *) llist);

	PyTypeObject * lmap = AerospikeLMap_Ready();
	Py_INCREF(lmap);
	PyModule_AddObject(aerospike, "lmap", (PyObject *) lmap);

	PyTypeObject * geospatial = AerospikeGeospatial_Ready();
	Py_INCREF(geospatial);
	PyModule_AddObject(aerospike, "GeoJSON", (PyObject *) geospatial);

	PyObject * null_object = AerospikeNullObject_New();
	Py_INCREF(null_object);
	PyModule_AddObject(aerospike, "null", (PyObject *) null_object);
}
开发者ID:minewhat,项目名称:aerospike-client-python,代码行数:80,代码来源:aerospike.c


示例14: initfract4dc

initfract4dc(void)
#endif
{
    pymod = Py_InitModule(MODULE_NAME, PfMethods);

#ifdef USE_GMP
    mpf_t x;
    mpf_init(x);
#endif
    /* expose some constants */
    PyModule_AddIntConstant(pymod, "CALC_DONE", GF4D_FRACTAL_DONE);
    PyModule_AddIntConstant(pymod, "CALC_CALCULATING", GF4D_FRACTAL_CALCULATING);
    PyModule_AddIntConstant(pymod, "CALC_DEEPENING", GF4D_FRACTAL_DEEPENING);
    PyModule_AddIntConstant(pymod, "CALC_ANTIALIASING", GF4D_FRACTAL_ANTIALIASING);
    PyModule_AddIntConstant(pymod, "CALC_PAUSED", GF4D_FRACTAL_PAUSED);

    PyModule_AddIntConstant(pymod, "AA_NONE", AA_NONE);
    PyModule_AddIntConstant(pymod, "AA_FAST", AA_FAST);
    PyModule_AddIntConstant(pymod, "AA_BEST", AA_BEST);

    PyModule_AddIntConstant(pymod, "RENDER_TWO_D", RENDER_TWO_D);
    PyModule_AddIntConstant(pymod, "RENDER_LANDSCAPE", RENDER_LANDSCAPE);
    PyModule_AddIntConstant(pymod, "RENDER_THREE_D", RENDER_THREE_D);

    PyModule_AddIntConstant(pymod, "DRAW_GUESSING", DRAW_GUESSING);
    PyModule_AddIntConstant(pymod, "DRAW_TO_DISK", DRAW_TO_DISK);

    PyModule_AddIntConstant(pymod, "DELTA_X", DELTA_X);
    PyModule_AddIntConstant(pymod, "DELTA_Y", DELTA_Y);
    PyModule_AddIntConstant(pymod, "TOPLEFT", TOPLEFT);

    /* cf image_dims */
    PyModule_AddIntConstant(pymod, "IMAGE_WIDTH", 0);
    PyModule_AddIntConstant(pymod, "IMAGE_HEIGHT", 1);
    PyModule_AddIntConstant(pymod, "IMAGE_TOTAL_WIDTH", 2);
    PyModule_AddIntConstant(pymod, "IMAGE_TOTAL_HEIGHT", 3);
    PyModule_AddIntConstant(pymod, "IMAGE_XOFFSET", 4);
    PyModule_AddIntConstant(pymod, "IMAGE_YOFFSET", 5);

    /* image type consts */
    PyModule_AddIntConstant(pymod, "FILE_TYPE_TGA", FILE_TYPE_TGA);
    PyModule_AddIntConstant(pymod, "FILE_TYPE_PNG", FILE_TYPE_PNG);
    PyModule_AddIntConstant(pymod, "FILE_TYPE_JPG", FILE_TYPE_JPG);
}
开发者ID:Bookaa,项目名称:gnofract4d.simplify,代码行数:44,代码来源:fract4dmodule_gmp.cpp


示例15: initc

该文章已有0人参与评论

请发表评论

全部评论

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