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

C++ PyInt_AsUnsignedLongMask函数代码示例

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

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



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

示例1: clearRegion

static void clearRegion(gPainter &painter, eWindowStyle &style, eListboxStyle *local_style, ePyObject pforeColor, ePyObject pforeColorSelected, ePyObject pbackColor, ePyObject pbackColorSelected, int selected, gRegion &rc, eRect &sel_clip, const ePoint &offset, bool cursorValid, bool clear=true)
{
	if (selected && sel_clip.valid())
	{
		gRegion part = rc - sel_clip;
		if (!part.empty())
		{
			painter.clip(part);
			style.setStyle(painter, eWindowStyle::styleListboxNormal);
			clearRegionHelper(painter, local_style, offset, pbackColor, cursorValid, clear);
			painter.clippop();
			selected = 0;
		}
		part = rc & sel_clip;
		if (!part.empty())
		{
			painter.clip(part);
			style.setStyle(painter, eWindowStyle::styleListboxSelected);
			clearRegionSelectedHelper(painter, local_style, offset, pbackColorSelected, cursorValid, clear);
			painter.clippop();
			selected = 1;
		}
	}
	else if (selected)
	{
		style.setStyle(painter, eWindowStyle::styleListboxSelected);
		clearRegionSelectedHelper(painter, local_style, offset, pbackColorSelected, cursorValid, clear);
		if (local_style && local_style->m_selection)
			painter.blit(local_style->m_selection, offset, eRect(), gPainter::BT_ALPHATEST);
	}
	else
	{
		style.setStyle(painter, eWindowStyle::styleListboxNormal);
		clearRegionHelper(painter, local_style, offset, pbackColor, cursorValid, clear);
	}

	if (selected)
	{
		if (pforeColorSelected)
		{
			unsigned int color = PyInt_AsUnsignedLongMask(pforeColorSelected);
			painter.setForegroundColor(gRGB(color));
		}
		/* if we have a local foreground color set, use that. */
		else if (local_style && local_style->m_foreground_color_selected_set)
			painter.setForegroundColor(local_style->m_foreground_color_selected);
	}
	else
	{
		if (pforeColor)
		{
			unsigned int color = PyInt_AsUnsignedLongMask(pforeColor);
			painter.setForegroundColor(gRGB(color));
		}
		/* if we have a local foreground color set, use that. */
		else if (local_style && local_style->m_foreground_color_set)
			painter.setForegroundColor(local_style->m_foreground_color);
	}
}
开发者ID:Akki01,项目名称:enigma2,代码行数:59,代码来源:elistboxcontent.cpp


示例2: PyInt_AsUnsignedLongMask

/* This function not only tests the 'k' getargs code, but also the
   PyInt_AsUnsignedLongMask() and PyInt_AsUnsignedLongMask() functions. */
static PyObject *
test_k_code(PyObject *self)
{
	PyObject *tuple, *num;
	unsigned long value;

        tuple = PyTuple_New(1);
        if (tuple == NULL)
        	return NULL;

	/* a number larger than ULONG_MAX even on 64-bit platforms */
        num = PyLong_FromString("FFFFFFFFFFFFFFFFFFFFFFFF", NULL, 16);
        if (num == NULL)
        	return NULL;

	value = PyInt_AsUnsignedLongMask(num);
	if (value != ULONG_MAX)
        	return raiseTestError("test_k_code",
	    "PyInt_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF");

        PyTuple_SET_ITEM(tuple, 0, num);

        value = 0;
        if (PyArg_ParseTuple(tuple, "k:test_k_code", &value) < 0)
        	return NULL;
        if (value != ULONG_MAX)
        	return raiseTestError("test_k_code",
			"k code returned wrong value for long 0xFFF...FFF");

	Py_DECREF(num);
        num = PyLong_FromString("-FFFFFFFF000000000000000042", NULL, 16);
        if (num == NULL)
        	return NULL;

	value = PyInt_AsUnsignedLongMask(num);
	if (value != (unsigned long)-0x42)
        	return raiseTestError("test_k_code",
	    "PyInt_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF");

        PyTuple_SET_ITEM(tuple, 0, num);

	value = 0;
        if (PyArg_ParseTuple(tuple, "k:test_k_code", &value) < 0)
        	return NULL;
        if (value != (unsigned long)-0x42)
        	return raiseTestError("test_k_code",
			"k code returned wrong value for long -0xFFF..000042");

	Py_DECREF(tuple);
	Py_INCREF(Py_None);
	return Py_None;
}
开发者ID:Oize,项目名称:pspstacklesspython,代码行数:54,代码来源:_testcapimodule.c


示例3: win32_SetNamedPipeHandleState

static PyObject *
win32_SetNamedPipeHandleState(PyObject *self, PyObject *args)
{
    HANDLE hNamedPipe;
    PyObject *oArgs[3];
    DWORD dwArgs[3], *pArgs[3] = {NULL, NULL, NULL};
    int i;

    if (!PyArg_ParseTuple(args, F_HANDLE "OOO",
                          &hNamedPipe, &oArgs[0], &oArgs[1], &oArgs[2]))
        return NULL;

    PyErr_Clear();

    for (i = 0 ; i < 3 ; i++) {
        if (oArgs[i] != Py_None) {
            dwArgs[i] = PyInt_AsUnsignedLongMask(oArgs[i]);
            if (PyErr_Occurred())
                return NULL;
            pArgs[i] = &dwArgs[i];
        }
    }

    if (!SetNamedPipeHandleState(hNamedPipe, pArgs[0], pArgs[1], pArgs[2]))
        return PyErr_SetFromWindowsErr(0);

    Py_RETURN_NONE;
}
开发者ID:0xcc,项目名称:pyston,代码行数:28,代码来源:win32_functions.c


示例4: PyWinObject_AsPROPSPECs

// @object PROPSPEC|Identifies a property.  Can be either an int property id, or a str/unicode property name.
BOOL PyWinObject_AsPROPSPECs( PyObject *ob, PROPSPEC **ppRet, ULONG *pcRet)
{
	TmpPyObject tuple=PyWinSequence_Tuple(ob, pcRet);
	if (tuple==NULL)
		return FALSE;
	size_t numBytes = sizeof(PROPSPEC) * *pcRet;
	*ppRet = (PROPSPEC *)malloc(numBytes);
	if (*ppRet==NULL) {
		PyErr_NoMemory();
		return FALSE;
	}
	ZeroMemory(*ppRet, numBytes);
	for (DWORD i=0; i<*pcRet; i++) {
		PyObject *sub = PyTuple_GET_ITEM((PyObject *)tuple, i);
		(*ppRet)[i].propid = PyInt_AsUnsignedLongMask(sub);
		if ((*ppRet)[i].propid != (ULONG)-1 || !PyErr_Occurred())
			(*ppRet)[i].ulKind = PRSPEC_PROPID;
		else{
			PyErr_Clear();
			(*ppRet)[i].lpwstr = NULL;
			if (PyWinObject_AsWCHAR(sub, &(*ppRet)[i].lpwstr))
				(*ppRet)[i].ulKind = PRSPEC_LPWSTR;
			else{
				PyErr_Clear();
				PyErr_SetString(PyExc_TypeError, "PROPSPECs must be a sequence of strings or integers");
				PyObject_FreePROPSPECs(*ppRet, *pcRet);
				*ppRet=NULL;
				return FALSE;
				}
			}
		}
	return TRUE;
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:34,代码来源:PyIPropertyStorage.cpp


示例5: Cache_iterload

static PyObject* Cache_iterload(Cache* self, PyObject *args, PyObject *kwds)
{
    PyObject *addrs;
    unsigned int length = 1;
    
    static char *kwlist[] = {"addrs", "length", NULL};
    PyArg_ParseTupleAndKeywords(args, kwds, "O|I", kwlist, &addrs, &length);
    
    // Get and check iterator
    PyObject *addrs_iter = PyObject_GetIter(addrs);
    if(addrs_iter == NULL) {
        PyErr_SetString(PyExc_ValueError, "addrs is not iteratable");
        return NULL;
    }

    // Iterate of elements in addrs
    PyObject *addr;
    while((addr = PyIter_Next(addrs_iter))) {
        // Each address is expanded to a certain length (default is 1)
        for(int i=0; i<length; i++) {
#if PY_MAJOR_VERSION >= 3
            Cache__load(self, PyLong_AsUnsignedLongMask(addr)+i);
#else
            Cache__load(self, PyInt_AsUnsignedLongMask(addr)+i);
#endif
        }
        Py_DECREF(addr);
    }
    Py_DECREF(addrs_iter);
    Py_RETURN_NONE;
}
开发者ID:chubbymaggie,项目名称:pycachesim,代码行数:31,代码来源:backend.c


示例6: clearRegionHelper

static void clearRegionHelper(gPainter &painter, eListboxStyle *local_style, const ePoint &offset, ePyObject &pbackColor, bool cursorValid, bool clear=true)
{
	if (pbackColor)
	{
		unsigned int color = PyInt_AsUnsignedLongMask(pbackColor);
		painter.setBackgroundColor(gRGB(color));
	}
	else if (local_style)
	{
		if (local_style && local_style->m_background_color_set)
			painter.setBackgroundColor(local_style->m_background_color);
		if (local_style->m_background && cursorValid)
		{
			if (local_style->m_transparent_background)
				painter.blit(local_style->m_background, offset, eRect(), gPainter::BT_ALPHATEST);
			else
				painter.blit(local_style->m_background, offset, eRect(), 0);
			return;
		}
		else if (local_style->m_transparent_background)
			return;
	}
	if (clear)
		painter.clear();
}
开发者ID:Akki01,项目名称:enigma2,代码行数:25,代码来源:elistboxcontent.cpp


示例7: pybackend_ip_choose

static void pybackend_ip_choose(u_int32_t *addr)
{
    PyObject *ret = NULL;
    PyObject *arg0 = NULL;

    dbglog("pybackend plugin: ip_choose_hook(addr = %d)", *addr);

    arg0 = PyInt_FromSize_t(*addr);
    ret = pybackend_call_function("ip_choose_hook", 1, arg0);
    if (ret == NULL || ret == Py_None)
    {
        goto Exit;
    }

    if (!PyInt_Check(ret))
    {
        warn("pybackend plugin: return value of ip_choose_hook() is not an int");
        goto Exit;
    }

    //
    // No failure.
    //

    *addr = PyInt_AsUnsignedLongMask(ret);

Exit:

    Py_CLEAR(arg0);
    Py_CLEAR(ret);

    dbglog("pybackend plugin: ip_choose_hook: %d", *addr);
    return;
}
开发者ID:ziyan,项目名称:pppd-backend,代码行数:34,代码来源:pybackend.c


示例8: P_set

static PyObject *
P_set(void *ptr, PyObject *value, Py_ssize_t size)
{
    void *v;
    if (value == Py_None) {
        *(void **)ptr = NULL;
        _RET(value);
    }

    if (!PyInt_Check(value) && !PyLong_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "cannot be converted to pointer");
        return NULL;
    }

#if SIZEOF_VOID_P <= SIZEOF_LONG
    v = (void *)PyInt_AsUnsignedLongMask(value);
#else
#ifndef HAVE_LONG_LONG
#   error "PyLong_AsVoidPtr: sizeof(void*) > sizeof(long), but no long long"
#elif SIZEOF_LONG_LONG < SIZEOF_VOID_P
#   error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)"
#endif
    v = (void *)PyInt_AsUnsignedLongLongMask(value);
#endif

    if (PyErr_Occurred())
        return NULL;

    *(void **)ptr = v;
    _RET(value);
}
开发者ID:nanwu,项目名称:pyston,代码行数:32,代码来源:cfield.c


示例9: do_close_file

static PyObject *
do_close_file (PyObject *self, PyObject *args, PyObject *kwds)
{
    PyObject       *cobj;
    PyObject       *iobj;
    NsLibrary      *lib;
    ns_RESULT       res;
    uint32          file_id;

    if (!PyArg_ParseTuple (args, "OO", &cobj, &iobj))
    {
        PyErr_SetString (PyExc_StandardError, "Could not parse arguments");
        return NULL;
    }

    if (!PyCObject_Check (cobj) || !PyInt_Check (iobj))
    {
        PyErr_SetString (PyExc_TypeError, "Wrong argument type(s)");
        return NULL;
    }

    lib = PyCObject_AsVoidPtr (cobj);
    file_id = (uint32) PyInt_AsUnsignedLongMask (iobj);

    res = lib->CloseFile (file_id);

    if (check_result_is_error (res, lib))
        return NULL;

    Py_RETURN_NONE;
}
开发者ID:jthorniley,项目名称:python-neuroshare,代码行数:31,代码来源:nspy_glue.c


示例10: z_set

static PyObject *
z_set(void *ptr, PyObject *value, Py_ssize_t size)
{
    if (value == Py_None) {
        *(char **)ptr = NULL;
        Py_INCREF(value);
        return value;
    }
    if (PyString_Check(value)) {
        *(char **)ptr = PyString_AS_STRING(value);
        Py_INCREF(value);
        return value;
    } else if (PyUnicode_Check(value)) {
        PyObject *str = PyUnicode_AsEncodedString(value,
                                                  _ctypes_conversion_encoding,
                                                  _ctypes_conversion_errors);
        if (str == NULL)
            return NULL;
        *(char **)ptr = PyString_AS_STRING(str);
        return str;
    } else if (PyInt_Check(value) || PyLong_Check(value)) {
#if SIZEOF_VOID_P == SIZEOF_LONG_LONG
        *(char **)ptr = (char *)PyInt_AsUnsignedLongLongMask(value);
#else
        *(char **)ptr = (char *)PyInt_AsUnsignedLongMask(value);
#endif
        _RET(value);
    }
    PyErr_Format(PyExc_TypeError,
                 "string or integer address expected instead of %s instance",
                 value->ob_type->tp_name);
    return NULL;
}
开发者ID:nanwu,项目名称:pyston,代码行数:33,代码来源:cfield.c


示例11: PythonScriptController_pyObjectToValue

void PythonScriptController_pyObjectToValue(PyObject* pyObject, unsigned int & val)
{
    if (pyObject && pyObject!=Py_None && PyInt_Check(pyObject))
        val = (unsigned int)PyInt_AsUnsignedLongMask(pyObject);
    else
        SP_MESSAGE_ERROR("Cannot convert pyObject to unsigned int");
}
开发者ID:151706061,项目名称:sofa,代码行数:7,代码来源:PythonScriptControllerHelper.cpp


示例12: do_get_index_by_time

static PyObject *
do_get_index_by_time(PyObject *self, PyObject *args, PyObject *kwds)
{
    NsLibrary  *lib;
    PyObject   *cobj;
    PyObject   *iobj, *id_obj, *tp_obj, *fl_obj;
    double      timepoint;
    uint32      file_id;
    uint32      entity_id;
    uint32      index;
    uint32      flags;
    ns_RESULT   res;


    if (!PyArg_ParseTuple (args, "OOOOO", &cobj, &iobj, &id_obj, &tp_obj, &fl_obj))
    {
        PyErr_SetString (PyExc_StandardError, "Could not parse arguments");
        return NULL;
    }

    if (!PyCObject_Check (cobj) || !PyInt_Check (iobj) ||
            !PyInt_Check (id_obj) || !PyFloat_Check (tp_obj) ||
            !PyInt_Check (fl_obj))
    {
        PyErr_SetString (PyExc_TypeError, "Wrong argument type(s)");
        return NULL;
    }

    lib = PyCObject_AsVoidPtr (cobj);
    file_id = (uint32) PyInt_AsUnsignedLongMask (iobj);
    entity_id = (uint32) PyInt_AsUnsignedLongMask (id_obj);
    timepoint = PyFloat_AsDouble (tp_obj);
    flags = (uint32) PyInt_AsUnsignedLongMask (fl_obj);

    res = lib->GetIndexByTime (file_id,
                               entity_id,
                               timepoint,
                               flags,
                               &index);

    if (check_result_is_error (res, lib))
        return NULL;

    return PyInt_FromLong (index);
}
开发者ID:jthorniley,项目名称:python-neuroshare,代码行数:45,代码来源:nspy_glue.c


示例13: _extract

 void _extract(PyObject *obj, unsigned long &val)
 {
     if (PyInt_Check(obj))
         val = (unsigned long)PyInt_AsUnsignedLongMask(obj);
     else if (PyFloat_Check(obj))
         val = (unsigned long)PyFloat_AsDouble(obj);
     else
         val = PyLong_AsUnsignedLong(obj);
 }
开发者ID:BackupTheBerlios,项目名称:pythonwrapper-svn,代码行数:9,代码来源:PWExtract.cpp


示例14: fs_dir_iterate

static PyObject *
fs_dir_iterate (Filesystem *self,
                PyObject   *args,
                PyObject   *kwargs)
{
  errcode_t  ret;
  WalkData   wdata;
  PyObject  *py_func, *py_data = NULL, *py_dir = NULL;
  uint64_t   dir;
  int        flags = OCFS2_DIRENT_FLAG_EXCLUDE_DOTS;

  static char *kwlist[] = { "callback", "data", "dir", "flags", NULL };

  if (!PyArg_ParseTupleAndKeywords (args, kwargs,
				    "O|OOi:dir_iterate", kwlist,
				    &py_func, &py_data, &py_dir, &flags))
    return NULL;

  if (!PyCallable_Check (py_func))
    {
      PyErr_SetString (PyExc_TypeError, "callback must be a callable object");
      return NULL;
    }

  if (py_dir == NULL || py_dir == Py_None)
    dir = self->fs->fs_root_blkno;
  else if (DirEntry_Check (py_dir))
    dir = ((DirEntry *) py_dir)->dentry.inode;
  else if (PyInt_Check (py_dir))
    dir = PyInt_AsUnsignedLongMask (py_dir);
  else if (PyLong_Check (py_dir))
    dir = PyLong_AsUnsignedLongLongMask (py_dir);
  else
    {
      PyErr_SetString (PyExc_TypeError, "dir must be DirEntry or integer");
      return NULL;
    }

  Py_INCREF (py_func);
  wdata.func = py_func;

  Py_XINCREF (py_data);
  wdata.data = py_data;

  wdata.fs = self;

  /* XXX: handle errors */
  ret = ocfs2_dir_iterate (self->fs, dir, flags, NULL, walk_dirs, &wdata);

  Py_DECREF (py_func);
  Py_XDECREF (py_data);

  Py_INCREF (Py_None);
  return Py_None;
}
开发者ID:pepe5,项目名称:ocfs2-tools,代码行数:55,代码来源:ocfs2module.c


示例15: hdrAppendItem

static int hdrAppendItem(Header h, rpmTagVal tag, rpmTagType type, PyObject *item)
{
    int rc = 0;

    switch (type) {
    case RPM_I18NSTRING_TYPE: /* XXX this needs to be handled separately */
    case RPM_STRING_TYPE:
    case RPM_STRING_ARRAY_TYPE: {
	PyObject *str = NULL;
	if (utf8FromPyObject(item, &str)) 
	    rc = headerPutString(h, tag, PyBytes_AsString(str));
	Py_XDECREF(str);
	} break;
    case RPM_BIN_TYPE: {
	uint8_t *val = (uint8_t *) PyBytes_AsString(item);
	rpm_count_t len = PyBytes_Size(item);
	rc = headerPutBin(h, tag, val, len);
	} break;
    case RPM_INT64_TYPE: {
	uint64_t val = PyInt_AsUnsignedLongLongMask(item);
	rc = headerPutUint64(h, tag, &val, 1);
	} break;
    case RPM_INT32_TYPE: {
	uint32_t val = PyInt_AsUnsignedLongMask(item);
	rc = headerPutUint32(h, tag, &val, 1);
	} break;
    case RPM_INT16_TYPE: {
	uint16_t val = PyInt_AsUnsignedLongMask(item);
	rc = headerPutUint16(h, tag, &val, 1);
	} break;
    case RPM_INT8_TYPE:
    case RPM_CHAR_TYPE: {
	uint8_t val = PyInt_AsUnsignedLongMask(item);
	rc = headerPutUint8(h, tag, &val, 1);
	} break;
    default:
	PyErr_SetString(PyExc_TypeError, "unhandled datatype");
    }
    return rc;
}
开发者ID:kaltsi,项目名称:rpm,代码行数:40,代码来源:header-py.c


示例16: do_get_time_by_index

static PyObject *
do_get_time_by_index (PyObject *self, PyObject *args, PyObject *kwds)
{
    NsLibrary      *lib;
    PyObject       *cobj;
    PyObject       *iobj, *id_obj, *idx_obj;
    uint32          file_id;
    uint32          entity_id;
    uint32          index;
    double          timepoint;
    ns_RESULT       res;

    if (!PyArg_ParseTuple (args, "OOOO", &cobj, &iobj, &id_obj, &idx_obj))
    {
        PyErr_SetString (PyExc_StandardError, "Could not parse arguments");
        return NULL;
    }

    if (!PyCObject_Check (cobj) || !PyInt_Check (iobj) ||
            !PyInt_Check (id_obj) || !PyInt_Check (idx_obj))
    {
        PyErr_SetString (PyExc_TypeError, "Wrong argument type(s)");
        return NULL;
    }

    lib = PyCObject_AsVoidPtr (cobj);
    file_id = (uint32) PyInt_AsUnsignedLongMask (iobj);
    entity_id = (uint32) PyInt_AsUnsignedLongMask (id_obj);
    index = (uint32) PyInt_AsUnsignedLongMask (idx_obj);

    res = lib->GetTimeByIndex (file_id,
                               entity_id,
                               index,
                               &timepoint);

    if (check_result_is_error (res, lib))
        return NULL;

    return Py_BuildValue ("d", timepoint);
}
开发者ID:jthorniley,项目名称:python-neuroshare,代码行数:40,代码来源:nspy_glue.c


示例17: graph_colorize

PyObject* graph_colorize(PyObject* self, PyObject* pyobject) {
   INIT_SELF_GRAPH();
   unsigned int ncolors = PyInt_AsUnsignedLongMask(pyobject);
   try {
      so->_graph->colorize(ncolors);
      RETURN_VOID();
   }
   catch (std::runtime_error e) {
      PyErr_SetString(PyExc_RuntimeError, e.what());
      return NULL;
   }
   
}
开发者ID:DDMAL,项目名称:Gamera,代码行数:13,代码来源:graphobject_algorithm.cpp


示例18: ETContext_open

static PyObject *
ETContext_open(ETContextObject* self, PyObject *args)
{
    DWORD dwRet;
    ET_OPENINFO OpenInfo;
    PyObject *pyOpenInfo=NULL;
    if (!PyArg_ParseTuple(args, "|O", &pyOpenInfo)) {
      return NULL;
    }
    Py_XINCREF(pyOpenInfo);
  #if defined(WIN32)
    if(NULL != pyOpenInfo){
      //printf("PyTuple_Check(pyOpenInfo)=%d\n",PyTuple_Check(pyOpenInfo));
      //printf("PyTuple_Size(pyOpenInfo)=%d\n",PyTuple_Size(pyOpenInfo));
      //printf("PyInt_Check(PyTuple_GetItem(pyOpenInfo,0)=%d\n",PyInt_Check(PyTuple_GetItem(pyOpenInfo,0)));
      //printf("PyInt_Check(PyTuple_GetItem(pyOpenInfo,1))=%d\n",PyInt_Check(PyTuple_GetItem(pyOpenInfo,1)));
      if(!PyTuple_Check(pyOpenInfo) 
        || 2!=PyTuple_Size(pyOpenInfo)
        || !PyInt_Check(PyTuple_GetItem(pyOpenInfo,0))
        || !PyInt_Check(PyTuple_GetItem(pyOpenInfo,1))){
        INVALID_PARAMS("Open Info must be a tuple with 2 integers.",NULL);
      }
      OpenInfo.dwOpenInfoSize=PyInt_AsUnsignedLongMask(PyTuple_GetItem(pyOpenInfo,0));
      OpenInfo.dwShareMode=PyInt_AsUnsignedLongMask(PyTuple_GetItem(pyOpenInfo,1));
      //printf("OpenInfo: %08x,%08x\n",OpenInfo.dwOpenInfoSize,OpenInfo.dwShareMode);
      dwRet= ETOpenEx(&self->context,&OpenInfo);
    }else{
      dwRet = ETOpen(&self->context);
    }
  #else
      dwRet = ETOpen(&self->context);
  #endif /*WIN32 | LINUX*/
    Py_XDECREF(pyOpenInfo);
    DWRET_VALIDATE(dwRet,NULL);
    Py_XINCREF(self);
    return self;
}
开发者ID:archsh,项目名称:pyet199,代码行数:37,代码来源:pyet199.c


示例19: get_ulong

static int
get_ulong(PyObject *v, unsigned long *p)
{
    unsigned long x;
    if (PyFloat_Check(v)) {
        PyErr_SetString(PyExc_TypeError,
                        "int expected instead of float");
        return -1;
    }
    x = PyInt_AsUnsignedLongMask(v);
    if (x == (unsigned long)-1 && PyErr_Occurred())
        return -1;
    *p = x;
    return 0;
}
开发者ID:nanwu,项目名称:pyston,代码行数:15,代码来源:cfield.c


示例20: seq2array

static inline int seq2array(const PyObject *seq, u8 *arr) {
	u8 i, j;
	PyObject *item;

	for(i = 0; i < 10; i++) {
		arr[i] = 0;
		for (j = 0; j < 8; j++) {
			item = PySequence_Fast_GET_ITEM(seq, 8 * i + j);
			if(!item)
				return 1;

			arr[i] |= (((u8)PyInt_AsUnsignedLongMask(item)) << j);
		}
	}

	return 0;
}	
开发者ID:angzy,项目名称:cube-attack-like,代码行数:17,代码来源:trivium-wrapper.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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