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

C++ PyLong_FromUnsignedLong函数代码示例

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

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



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

示例1: PyErr_SetString

static PyObject *get_scale(instruction_t *self, PyObject *args)
{
    unsigned int i;
    xed_decoded_inst_t *decoded_inst;
    xed_uint_t scale;

    PyObject *r = NULL;

    if(PyArg_ParseTuple(args, "I", &i) == 0)
        goto _err;

    decoded_inst = self->decoded_inst;
    if(i >= xed_decoded_inst_number_of_memory_operands(decoded_inst))
    {
        PyErr_SetString(PyExc_IndexError, "Invalid operand index");
        goto _err;
    }

    scale = xed_decoded_inst_get_scale(decoded_inst, i);
    r = PyLong_FromUnsignedLong(scale);

_err:
    return r;
}
开发者ID:huku-,项目名称:pyxed,代码行数:24,代码来源:instruction.c


示例2: __pyx_f_13cunsignedlong_f

static void __pyx_f_13cunsignedlong_f(void) {
  unsigned long __pyx_v_x;
  PyObject *__pyx_v_y;
  unsigned long __pyx_1;
  PyObject *__pyx_2 = 0;
  __pyx_v_y = Py_None; Py_INCREF(Py_None);

  /* "/Local/Projects/D/Pyrex/Source/Tests/8/cunsignedlong.pyx":4 */
  __pyx_1 = PyInt_AsUnsignedLongMask(__pyx_v_y); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;}
  __pyx_v_x = __pyx_1;

  /* "/Local/Projects/D/Pyrex/Source/Tests/8/cunsignedlong.pyx":5 */
  __pyx_2 = PyLong_FromUnsignedLong(__pyx_v_x); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
  Py_DECREF(__pyx_v_y);
  __pyx_v_y = __pyx_2;
  __pyx_2 = 0;

  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_WriteUnraisable("cunsignedlong.f");
  __pyx_L0:;
  Py_DECREF(__pyx_v_y);
}
开发者ID:jwilk,项目名称:Pyrex,代码行数:24,代码来源:cunsignedlong.c


示例3: ue_py_check

PyObject *py_ue_skeletal_mesh_get_active_bone_indices(ue_PyUObject *self, PyObject * args)
{
	ue_py_check(self);

	int lod_index = 0;
	if (!PyArg_ParseTuple(args, "|i:skeletal_mesh_get_active_bone_indices", &lod_index))
		return nullptr;

	USkeletalMesh *mesh = ue_py_check_type<USkeletalMesh>(self);
	if (!mesh)
		return PyErr_Format(PyExc_Exception, "uobject is not a USkeletalMesh");

#if ENGINE_MINOR_VERSION < 19
	FSkeletalMeshResource *resource = mesh->GetImportedResource();
#else
	FSkeletalMeshModel *resource = mesh->GetImportedModel();
#endif

	if (lod_index < 0 || lod_index >= resource->LODModels.Num())
		return PyErr_Format(PyExc_Exception, "invalid LOD index, must be between 0 and %d", resource->LODModels.Num() - 1);

#if ENGINE_MINOR_VERSION < 19
	FStaticLODModel &model = resource->LODModels[lod_index];
#else
	FSkeletalMeshLODModel &model = resource->LODModels[lod_index];
#endif

	PyObject *py_list = PyList_New(0);

	for (uint16 index : model.ActiveBoneIndices)
	{
		PyList_Append(py_list, PyLong_FromUnsignedLong(index));
	}

	return py_list;
}
开发者ID:rdsgautier,项目名称:UnrealEnginePython,代码行数:36,代码来源:UEPySkeletal.cpp


示例4: get_attrs

/* {{{ get_attrs
 */
PyObject *
get_attrs(LIBSSH2_SFTP_ATTRIBUTES *attr)
{
    PyObject *attrs=NULL;

    attrs = PyList_New(0);
    PyList_Append(attrs, PyLong_FromUnsignedLong(
        (unsigned long)attr->filesize));
    PyList_Append(attrs, PyLong_FromUnsignedLong(
        (unsigned long)attr->uid));
    PyList_Append(attrs, PyLong_FromUnsignedLong(
        (unsigned long)attr->gid));
    PyList_Append(attrs, PyLong_FromUnsignedLong(
        (unsigned long)attr->permissions));
    PyList_Append(attrs, PyLong_FromUnsignedLong(
        (unsigned long)attr->atime));
    PyList_Append(attrs, PyLong_FromUnsignedLong(
        (unsigned long)attr->mtime));

    return attrs; 
}
开发者ID:DeathFlower,项目名称:pylibssh2,代码行数:23,代码来源:sftp.c


示例5: PYTHON_METHOD_DEFINITION_NOARGS

PYTHON_METHOD_DEFINITION_NOARGS(ptGUIControl, getFontSize)
{
    return PyLong_FromUnsignedLong(self->fThis->GetFontSize());
}
开发者ID:Asteral,项目名称:Plasma,代码行数:4,代码来源:pyGUIControlGlue.cpp


示例6: PYTHON_METHOD_DEFINITION_NOARGS

PYTHON_METHOD_DEFINITION_NOARGS(ptGameMgrInviteRevokedMsg, newGameID)
{
    return PyLong_FromUnsignedLong(self->fThis->NewGameID());
}
开发者ID:Asteral,项目名称:Plasma,代码行数:4,代码来源:pyGameMgrMsgGlue.cpp


示例7: switch

PyObject* PythonQtConv::ConvertQtValueToPythonInternal(int type, const void* data) {
  switch (type) {
  case QMetaType::Void:
    Py_INCREF(Py_None);
    return Py_None;
  case QMetaType::Char:
    return PyInt_FromLong(*((char*)data));
  case QMetaType::UChar:
    return PyInt_FromLong(*((unsigned char*)data));
  case QMetaType::Short:
    return PyInt_FromLong(*((short*)data));
  case QMetaType::UShort:
    return PyInt_FromLong(*((unsigned short*)data));
  case QMetaType::Long:
    return PyInt_FromLong(*((long*)data));
  case QMetaType::ULong:
    // does not fit into simple int of python
    return PyLong_FromUnsignedLong(*((unsigned long*)data));
  case QMetaType::Bool:
    return PythonQtConv::GetPyBool(*((bool*)data));
  case QMetaType::Int:
    return PyInt_FromLong(*((int*)data));
  case QMetaType::UInt:
    // does not fit into simple int of python
    return PyLong_FromUnsignedLong(*((unsigned int*)data));
  case QMetaType::QChar:
    return PyInt_FromLong(*((short*)data));
  case QMetaType::Float:
    return PyFloat_FromDouble(*((float*)data));
  case QMetaType::Double:
    return PyFloat_FromDouble(*((double*)data));
  case QMetaType::LongLong:
    return PyLong_FromLongLong(*((qint64*)data));
  case QMetaType::ULongLong:
    return PyLong_FromUnsignedLongLong(*((quint64*)data));
      // implicit conversion from QByteArray to str has been removed:
  //case QMetaType::QByteArray: {
  //  QByteArray* v = (QByteArray*) data;
  //  return PyString_FromStringAndSize(*v, v->size());
  //                            }
  case QMetaType::QVariantMap:
    return PythonQtConv::QVariantMapToPyObject(*((QVariantMap*)data));
  case QMetaType::QVariantList:
    return PythonQtConv::QVariantListToPyObject(*((QVariantList*)data));
  case QMetaType::QString:
    return PythonQtConv::QStringToPyObject(*((QString*)data));
  case QMetaType::QStringList:
    return PythonQtConv::QStringListToPyObject(*((QStringList*)data));

  case PythonQtMethodInfo::Variant:
    return PythonQtConv::QVariantToPyObject(*((QVariant*)data));
  case QMetaType::QObjectStar:
  case QMetaType::QWidgetStar:
    return PythonQt::priv()->wrapQObject(*((QObject**)data));

  default:
    if (PythonQt::priv()->isPythonQtObjectPtrMetaId(type)) {
      // special case, it is a PythonQtObjectPtr which contains a PyObject, take it directly:
      PyObject* o = ((PythonQtObjectPtr*)data)->object();
      Py_INCREF(o);
      return o;
    } else {
      if (type > 0) {
        // if the type is known, we can construct it via QMetaType::construct
        void* newCPPObject = QMetaType::construct(type, data);
        // XXX this could be optimized by using metatypeid directly
        PythonQtInstanceWrapper* wrap = (PythonQtInstanceWrapper*)PythonQt::priv()->wrapPtr(newCPPObject, QMetaType::typeName(type));
        wrap->_ownedByPythonQt = true;
        wrap->_useQMetaTypeDestroy = true;
        return (PyObject*)wrap;
      }
      std::cerr << "Unknown type that can not be converted to Python: " << type << ", in " << __FILE__ << ":" << __LINE__ << std::endl;
    }
}
Py_INCREF(Py_None);
return Py_None;
 }
开发者ID:Aico,项目名称:mudlet,代码行数:77,代码来源:PythonQtConversion.cpp


示例8: demarshal_value

static PyObject *
demarshal_value(CORBA_TypeCode tc, gconstpointer *val)
{
    PyObject *ret = NULL;

    while (tc->kind == CORBA_tk_alias)
	tc = tc->subtypes[0];

    switch (tc->kind) {
    case CORBA_tk_null:
    case CORBA_tk_void:
	ret = Py_None;
	Py_INCREF(ret);
	break;
    case CORBA_tk_short:
	alignval(val, ORBIT_ALIGNOF_CORBA_SHORT);
	ret = PyInt_FromLong(getval(val, CORBA_short));
	advanceptr(val, sizeof(CORBA_short));
	break;
    case CORBA_tk_long:
	alignval(val, ORBIT_ALIGNOF_CORBA_LONG);
	ret = PyInt_FromLong(getval(val, CORBA_long));
	advanceptr(val, sizeof(CORBA_long));
	break;
    case CORBA_tk_ushort:
	alignval(val, ORBIT_ALIGNOF_CORBA_SHORT);
	ret = PyInt_FromLong(getval(val, CORBA_unsigned_short));
	advanceptr(val, sizeof(CORBA_unsigned_short));
	break;
    case CORBA_tk_ulong:
	alignval(val, ORBIT_ALIGNOF_CORBA_LONG);
	ret = PyLong_FromUnsignedLong(getval(val, CORBA_unsigned_long));
	advanceptr(val, sizeof(CORBA_unsigned_long));
	break;
    case CORBA_tk_float:
	alignval(val, ORBIT_ALIGNOF_CORBA_FLOAT);
	ret = PyFloat_FromDouble(getval(val, CORBA_float));
	advanceptr(val, sizeof(CORBA_float));
	break;
    case CORBA_tk_double:
	alignval(val, ORBIT_ALIGNOF_CORBA_DOUBLE);
	ret = PyFloat_FromDouble(getval(val, CORBA_double));
	advanceptr(val, sizeof(CORBA_double));
	break;
    case CORBA_tk_boolean:
	ret = getval(val, CORBA_boolean) ? Py_True : Py_False;
	Py_INCREF(ret);
	advanceptr(val, sizeof(CORBA_boolean));
	break;
    case CORBA_tk_char: {
	char charbuf[2];

	charbuf[0] = getval(val, CORBA_char);
	charbuf[1] = '\0';
	ret = PyString_FromString(charbuf);
	advanceptr(val, sizeof(CORBA_char));
	break;
    }
    case CORBA_tk_octet:
	ret = PyInt_FromLong(getval(val, CORBA_octet));
	advanceptr(val, sizeof(CORBA_octet));
	break;
    case CORBA_tk_any:
	alignval(val, ORBIT_ALIGNOF_CORBA_ANY);
	ret = pycorba_any_new(&getval(val, CORBA_any));
	advanceptr(val, sizeof(CORBA_any));
	break;
    case CORBA_tk_TypeCode:
	alignval(val, ORBIT_ALIGNOF_CORBA_POINTER);
	ret = pycorba_typecode_new(getval(val, CORBA_TypeCode));
	advanceptr(val, sizeof(CORBA_TypeCode));
	break;
    case CORBA_tk_Principal:
	g_warning("can't demarshal Principal's");
	break;
    case CORBA_tk_objref:
	alignval(val, ORBIT_ALIGNOF_CORBA_POINTER);
	ret = pycorba_object_new_with_type(getval(val, CORBA_Object), tc);
	advanceptr(val, sizeof(CORBA_Object));
	break;
    case CORBA_tk_struct:
    case CORBA_tk_except: {
	PyObject *stub;
	PyObject *instance;
	gint i;

	alignval(val, tc->c_align);
	stub = pyorbit_get_stub(tc);
	if (!stub) {
	    if (tc->kind == CORBA_tk_struct)
		stub = (PyObject *)&PyBaseObject_Type;
	    else
		stub = pyorbit_exception;
	}
	instance = PyObject_CallFunction(stub, "()");
	if (!instance)
	    break;
	if (stub == pyorbit_exception) {
	    PyObject *pytc = pycorba_typecode_new(tc);

//.........这里部分代码省略.........
开发者ID:GNOME,项目名称:pyorbit,代码行数:101,代码来源:pycorba-marshal.c


示例9: PYTHON_METHOD_DEFINITION_NOARGS

PYTHON_METHOD_DEFINITION_NOARGS(ptVaultAgeInfoNode, getCzarID)
{
    return PyLong_FromUnsignedLong(self->fThis->GetCzarID());
}
开发者ID:Asteral,项目名称:Plasma,代码行数:4,代码来源:pyVaultAgeInfoNodeGlue.cpp


示例10: xed_decoded_inst_get_immediate_width_bits

static PyObject *get_immediate_width_bits(instruction_t *self)
{
    xed_uint_t width;
    width = xed_decoded_inst_get_immediate_width_bits(self->decoded_inst);
    return PyLong_FromUnsignedLong(width);
}
开发者ID:huku-,项目名称:pyxed,代码行数:6,代码来源:instruction.c


示例11: PyLong_FromUnsignedLong

static PyObject *py_ue_frandomstream_get_unsigned_int(ue_PyFRandomStream *self, PyObject * args) {
	return PyLong_FromUnsignedLong(self->rstream.GetUnsignedInt());
}
开发者ID:20tab,项目名称:UnrealEnginePython,代码行数:3,代码来源:UEPyFRandomStream.cpp


示例12: PyList_New


//.........这里部分代码省略.........
			case PBK_Text_Custom3:
				convert_text("Text_Custom3");
				break;
			case PBK_Text_Custom4:
				convert_text("Text_Custom4");
				break;
			case PBK_Text_LUID:
				convert_text("Text_LUID");
				break;
			case PBK_Text_VOIP:
				convert_text("Text_VOIP");
				break;
			case PBK_Text_SWIS:
				convert_text("Text_SWIS");
				break;
			case PBK_Text_WVID:
				convert_text("Text_WVID");
				break;
			case PBK_Text_SIP:
				convert_text("Text_SIP");
				break;
			case PBK_Text_DTMF:
				convert_text("Text_DTMF");
				break;
			case PBK_Text_UserID:
				convert_text("Text_UserID");
				break;
			case PBK_Text_PictureName:
				convert_text("Text_PictureName");
				break;
			case PBK_RingtoneID:
				f = Py_BuildValue("{s:s,s:O}", "Type",
						  "RingtoneID", "Value",
						  PyLong_FromUnsignedLong
						  (entry->Entries[i].Number));
				break;
			case PBK_PictureID:
				f = Py_BuildValue("{s:s,s:O}", "Type",
						  "PictureID", "Value",
						  PyLong_FromUnsignedLong
						  (entry->Entries[i].Number));
				break;
			case PBK_CallLength:
				f = Py_BuildValue("{s:s,s:i}", "Type",
						  "CallLength", "Value",
						  entry->Entries[i].CallLength);
				break;
			case PBK_Number_Messaging:
				convert_number("Messaging");
				break;
			case PBK_Number_Video:
				convert_number("Video");
				break;
			case PBK_PushToTalkID:
				convert_text("PushToTalkID");
				break;
			case PBK_Photo:
				bitmap = &(entry->Entries[i].Picture);
				d = PyString_FromStringAndSize((char *)bitmap->
							       Buffer,
							       bitmap->Length);
				if (d == NULL) {
					Py_DECREF(v);
					return NULL;
				}
				bmptype = "";
开发者ID:back2arie,项目名称:gammu,代码行数:67,代码来源:memory.c


示例13: shm_get_value

static PyObject *
shm_get_value(int shared_memory_id, enum GET_SET_IDENTIFIERS field) {
    struct shmid_ds shm_info;
    PyObject *py_value = NULL;

    DPRINTF("Calling shmctl(...IPC_STAT...), field = %d\n", field);
    if (-1 == shmctl(shared_memory_id, IPC_STAT, &shm_info)) {
        switch (errno) {
            case EIDRM:
            case EINVAL:
                PyErr_Format(pExistentialException,
                             "No shared memory with id %d exists",
                             shared_memory_id);
            break;

            case EACCES:
                PyErr_SetString(pPermissionsException,
                                "You do not have permission to read the shared memory attribute");
            break;

            default:
                PyErr_SetFromErrno(PyExc_OSError);
            break;
        }

        goto error_return;
    }

    switch (field) {
        case SVIFP_SHM_SIZE:
            py_value = SIZE_T_TO_PY(shm_info.shm_segsz);
        break;

        case SVIFP_SHM_LAST_ATTACH_TIME:
            py_value = TIME_T_TO_PY(shm_info.shm_atime);
        break;

        case SVIFP_SHM_LAST_DETACH_TIME:
            py_value = TIME_T_TO_PY(shm_info.shm_dtime);
        break;

        case SVIFP_SHM_LAST_CHANGE_TIME:
            py_value = TIME_T_TO_PY(shm_info.shm_ctime);
        break;

        case SVIFP_SHM_CREATOR_PID:
            py_value = PID_T_TO_PY(shm_info.shm_cpid);
        break;

        case SVIFP_SHM_LAST_AT_DT_PID:
            py_value = PID_T_TO_PY(shm_info.shm_lpid);
        break;

        case SVIFP_SHM_NUMBER_ATTACHED:
            // shm_nattch is unsigned
            // ref: http://www.opengroup.org/onlinepubs/007908799/xsh/sysshm.h.html
#if PY_MAJOR_VERSION > 2
            py_value = PyLong_FromUnsignedLong(shm_info.shm_nattch);
#else
            py_value = py_int_or_long_from_ulong(shm_info.shm_nattch);
#endif
        break;

        case SVIFP_IPC_PERM_UID:
            py_value = UID_T_TO_PY(shm_info.shm_perm.uid);
        break;

        case SVIFP_IPC_PERM_GID:
            py_value = GID_T_TO_PY(shm_info.shm_perm.gid);
        break;

        case SVIFP_IPC_PERM_CUID:
            py_value = UID_T_TO_PY(shm_info.shm_perm.cuid);
        break;

        case SVIFP_IPC_PERM_CGID:
            py_value = GID_T_TO_PY(shm_info.shm_perm.cgid);
        break;

        case SVIFP_IPC_PERM_MODE:
            py_value = MODE_T_TO_PY(shm_info.shm_perm.mode);
        break;

        default:
            PyErr_Format(pInternalException, "Bad field %d passed to shm_get_value", field);
            goto error_return;
        break;
    }

    return py_value;

    error_return:
    return NULL;
}
开发者ID:mruffalo,项目名称:sysv_ipc,代码行数:94,代码来源:memory.c


示例14: PySfSound_GetStatus

static PyObject*
PySfSound_GetStatus(PySfSound *self)
{
	return PyLong_FromUnsignedLong(self->obj->GetStatus());
}
开发者ID:TheMiss,项目名称:SFML,代码行数:5,代码来源:Sound.cpp


示例15: xed_decoded_inst_get_second_immediate

static PyObject *get_second_immediate(instruction_t *self)
{
    xed_uint8_t imm;
    imm = xed_decoded_inst_get_second_immediate(self->decoded_inst);
    return PyLong_FromUnsignedLong(imm);
}
开发者ID:huku-,项目名称:pyxed,代码行数:6,代码来源:instruction.c


示例16: PYTHON_METHOD_DEFINITION_NOARGS

PYTHON_METHOD_DEFINITION_NOARGS(ptDniInfoSource, getAgeTime)
{
    return PyLong_FromUnsignedLong(self->fThis->GetAgeTime());
}
开发者ID:Deledrius,项目名称:Plasma,代码行数:4,代码来源:pyDniInfoSourceGlue.cpp


示例17: switch

PyObject* PythonQtConv::ConvertQtValueToPythonInternal(int type, const void* data) {
  switch (type) {
  case QMetaType::Void:
    Py_INCREF(Py_None);
    return Py_None;
  case QMetaType::Char:
    return PyLong_FromLong(*((char*)data));
  case QMetaType::UChar:
    return PyLong_FromLong(*((unsigned char*)data));
  case QMetaType::Short:
    return PyLong_FromLong(*((short*)data));
  case QMetaType::UShort:
    return PyLong_FromLong(*((unsigned short*)data));
  case QMetaType::Long:
    return PyLong_FromLong(*((long*)data));
  case QMetaType::ULong:
    // does not fit into simple int of python
    return PyLong_FromUnsignedLong(*((unsigned long*)data));
  case QMetaType::Bool:
    return PythonQtConv::GetPyBool(*((bool*)data));
  case QMetaType::Int:
    return PyLong_FromLong(*((int*)data));
  case QMetaType::UInt:
    // does not fit into simple int of python
    return PyLong_FromUnsignedLong(*((unsigned int*)data));
  case QMetaType::QChar:
    return PyLong_FromLong(*((unsigned short*)data));
  case QMetaType::Float:
    return PyFloat_FromDouble(*((float*)data));
  case QMetaType::Double:
    return PyFloat_FromDouble(*((double*)data));
  case QMetaType::LongLong:
    return PyLong_FromLongLong(*((qint64*)data));
  case QMetaType::ULongLong:
    return PyLong_FromUnsignedLongLong(*((quint64*)data));
      // implicit conversion from QByteArray to str has been removed:
  //case QMetaType::QByteArray: {
  //  QByteArray* v = (QByteArray*) data;
  //  return PyBytes_FromStringAndSize(*v, v->size());
  //                            }
  case QMetaType::QVariantHash:
    return PythonQtConv::QVariantHashToPyObject(*((QVariantHash*)data));
  case QMetaType::QVariantMap:
    return PythonQtConv::QVariantMapToPyObject(*((QVariantMap*)data));
  case QMetaType::QVariantList:
    return PythonQtConv::QVariantListToPyObject(*((QVariantList*)data));
  case QMetaType::QString:
    return PythonQtConv::QStringToPyObject(*((QString*)data));
  case QMetaType::QStringList:
    return PythonQtConv::QStringListToPyObject(*((QStringList*)data));

  case PythonQtMethodInfo::Variant:
#if QT_VERSION >= 0x040800
  case QMetaType::QVariant:
#endif
    return PythonQtConv::QVariantToPyObject(*((QVariant*)data));
  case QMetaType::QObjectStar:
#if( QT_VERSION < QT_VERSION_CHECK(5,0,0) )
  case QMetaType::QWidgetStar:
#endif
    return PythonQt::priv()->wrapQObject(*((QObject**)data));

  default:
    if (PythonQt::priv()->isPythonQtObjectPtrMetaId(type)) {
      // special case, it is a PythonQtObjectPtr which contains a PyObject, take it directly:
      PyObject* o = ((PythonQtObjectPtr*)data)->object();
      Py_INCREF(o);
      return o;
    } else {
      if (type > 0) {
        return createCopyFromMetaType(type, data);
      } else {
        std::cerr << "Unknown type that can not be converted to Python: " << type << ", in " << __FILE__ << ":" << __LINE__ << std::endl;
      }
    }
  }
  Py_INCREF(Py_None);
  return Py_None;
 }
开发者ID:robby31,项目名称:PythonQt,代码行数:79,代码来源:PythonQtConversion.cpp


示例18: xed_decoded_inst_number_of_memory_operands

static PyObject *get_number_of_memory_operands(instruction_t *self)
{
    xed_uint_t num;
    num = xed_decoded_inst_number_of_memory_operands(self->decoded_inst);
    return PyLong_FromUnsignedLong(num);
}
开发者ID:huku-,项目名称:pyxed,代码行数:6,代码来源:instruction.c


示例19: PyTuple_Size

PyObject* EntityApp<E>::__py_getWatcher(PyObject* self, PyObject* args)
{
	int argCount = PyTuple_Size(args);
	if(argCount != 1)
	{
		PyErr_Format(PyExc_TypeError, "KBEngine::getWatcher(): args[strpath] is error!");
		PyErr_PrintEx(0);
		return 0;
	}
	
	char* path;

	if(PyArg_ParseTuple(args, "s", &path) == -1)
	{
		PyErr_Format(PyExc_TypeError, "KBEngine::getWatcher(): args[strpath] is error!");
		PyErr_PrintEx(0);
		return 0;
	}

	//DebugHelper::getSingleton().setScriptMsgType(type);

	KBEShared_ptr< WatcherObject > pWobj = WatcherPaths::root().getWatcher(path);
	if(pWobj.get() == NULL)
	{
		PyErr_Format(PyExc_TypeError, "KBEngine::getWatcher(): not found watcher[%s]!", path);
		PyErr_PrintEx(0);
		return 0;
	}

	WATCHER_VALUE_TYPE wtype = pWobj->getType();
	PyObject* pyval = NULL;
	MemoryStream* stream = MemoryStream::ObjPool().createObject();
	pWobj->addToStream(stream);
	WATCHER_ID id;
	(*stream) >> id;

	switch(wtype)
	{
	case WATCHER_VALUE_TYPE_UINT8:
		{
			uint8 v;
			(*stream) >> v;
			pyval = PyLong_FromUnsignedLong(v);
		}
		break;
	case WATCHER_VALUE_TYPE_UINT16:
		{
			uint16 v;
			(*stream) >> v;
			pyval = PyLong_FromUnsignedLong(v);
		}
		break;
	case WATCHER_VALUE_TYPE_UINT32:
		{
			uint32 v;
			(*stream) >> v;
			pyval = PyLong_FromUnsignedLong(v);
		}
		break;
	case WATCHER_VALUE_TYPE_UINT64:
		{
			uint64 v;
			(*stream) >> v;
			pyval = PyLong_FromUnsignedLongLong(v);
		}
		break;
	case WATCHER_VALUE_TYPE_INT8:
		{
			int8 v;
			(*stream) >> v;
			pyval = PyLong_FromLong(v);
		}
		break;
	case WATCHER_VALUE_TYPE_INT16:
		{
			int16 v;
			(*stream) >> v;
			pyval = PyLong_FromLong(v);
		}
		break;
	case WATCHER_VALUE_TYPE_INT32:
		{
			int32 v;
			(*stream) >> v;
			pyval = PyLong_FromLong(v);
		}
		break;
	case WATCHER_VALUE_TYPE_INT64:
		{
			int64 v;
			(*stream) >> v;
			pyval = PyLong_FromLongLong(v);
		}
		break;
	case WATCHER_VALUE_TYPE_FLOAT:
		{
			float v;
			(*stream) >> v;
			pyval = PyLong_FromDouble(v);
		}
//.........这里部分代码省略.........
开发者ID:MapleEve,项目名称:kbengine,代码行数:101,代码来源:entity_app.hpp


示例20: RET_NULL_IF_INVALID

static PyObject *PyBan_time_get(PyBan *self, void *closure)
{
    BAN_REC *data = self->data;
    RET_NULL_IF_INVALID(self->data);
    return PyLong_FromUnsignedLong(data->time);
}
开发者ID:SteveClement,项目名称:irssi-python,代码行数:6,代码来源:ban-object.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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