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

C++ IS_INTEGER函数代码示例

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

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



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

示例1: GMPy_Integer_PowMod

static PyObject *
GMPy_Integer_PowMod(PyObject *self, PyObject *args)
{
    PyObject *x, *y, *m;

    if (PyTuple_GET_SIZE(args) != 3) {
        TYPE_ERROR("powmod() requires 3 arguments.");
        return NULL;
    }

    x = PyTuple_GET_ITEM(args, 0);
    y = PyTuple_GET_ITEM(args, 1);
    m = PyTuple_GET_ITEM(args, 2);

    if (IS_INTEGER(x) && IS_INTEGER(y) && IS_INTEGER(m))
        return GMPy_Integer_Pow(x, y, m, NULL);

    TYPE_ERROR("powmod() argument types not supported");
    return NULL;
}
开发者ID:fuzzylogician,项目名称:gmpy,代码行数:20,代码来源:gmpy2_pow.c


示例2: GMPy_Context_Digits

static PyObject *
GMPy_Context_Digits(PyObject *self, PyObject *args)
{
    PyObject *arg0, *tuple, *temp, *result;
    Py_ssize_t argc;

    argc = PyTuple_GET_SIZE(args);
    if (argc == 0) {
        TYPE_ERROR("digits() requires at least one argument");
        return NULL;
    }

    if (argc > 3) {
        TYPE_ERROR("digits() accepts at most three arguments");
        return NULL;
    }

    arg0 = PyTuple_GET_ITEM(args, 0);
    if (!(tuple = PyTuple_GetSlice(args, 1, argc))) {
        return NULL;
    }

    if (IS_INTEGER(arg0)) {
        temp = (PyObject*)GMPy_MPZ_From_Integer(arg0, NULL);
        result = GMPy_MPZ_Digits_Method(temp, tuple);
        Py_DECREF(temp);
        Py_DECREF(tuple);
        return result;
    }
    if (IS_RATIONAL(arg0)) {
        temp = (PyObject*)GMPy_MPQ_From_Rational(arg0, NULL);
        result = GMPy_MPQ_Digits_Method(temp, tuple);
        Py_DECREF(temp);
        Py_DECREF(tuple);
        return result;
    }
    if (IS_REAL(arg0)) {
        temp = (PyObject*)GMPy_MPFR_From_Real(arg0, 1, NULL);
        result = GMPy_MPFR_Digits_Method(temp, tuple);
        Py_DECREF(temp);
        Py_DECREF(tuple);
        return result;
    }
    if (IS_COMPLEX(arg0)) {
        temp = (PyObject*)GMPy_MPC_From_Complex(arg0, 1, 1, NULL);
        result = GMPy_MPC_Digits_Method(temp, tuple);
        Py_DECREF(temp);
        Py_DECREF(tuple);
        return result;
    }

    TYPE_ERROR("digits() argument type not supported");
    return NULL;
}
开发者ID:godbomb,项目名称:gmpy,代码行数:54,代码来源:gmpy2_format.c


示例3: INTEGER

/*
 * A low-level helper for "superficial" checking of the 'space' vector
 * associated with a Ranges object.
 */
static const int *check_Ranges_space(SEXP space, int len, const char *what)
{
	if (space == R_NilValue)
		return NULL;
	if (!IS_INTEGER(space))
		error("'%s_space' must be an integer vector or NULL", what);
	if (LENGTH(space) != len)
		error("when not NULL, '%s_space' must have "
		      "the same length as 'start(%s)'", what, what);
	return INTEGER(space);
}
开发者ID:genome-vendor,项目名称:r-bioc-iranges,代码行数:15,代码来源:encodeOverlaps_methods.c


示例4:

*/	void Trap_Stack()
/*
***********************************************************************/
{
	if (IS_INTEGER(TASK_THIS_ERROR)) return; // composing prior error.

	if (!Saved_State) Crash(RP_NO_SAVED_STATE);

	*TASK_THIS_ERROR = *TASK_STACK_ERROR; // pre-allocated

	longjmp(*Saved_State, 1);
}
开发者ID:51weekend,项目名称:r3,代码行数:12,代码来源:c-error.c


示例5: tlocs2rlocs

SEXP tlocs2rlocs(SEXP tlocs, SEXP exonStarts, SEXP exonEnds,
		SEXP strand, SEXP decreasing_rank_on_minus_strand)
{
	SEXP ans, starts, ends, ans_elt;
	int decreasing_rank_on_minus_strand0, ans_length,
	    i, transcript_width, on_minus_strand, nlocs, j, tloc;

	decreasing_rank_on_minus_strand0 =
		LOGICAL(decreasing_rank_on_minus_strand)[0];
	ans_length = LENGTH(tlocs);
	PROTECT(ans = duplicate(tlocs));
	for (i = 0; i < ans_length; i++) {
		starts = VECTOR_ELT(exonStarts, i);
		ends = VECTOR_ELT(exonEnds, i);
		transcript_width = get_transcript_width(starts, ends, -1);
		if (transcript_width == -1) {
			UNPROTECT(1);
			error("%s", errmsg_buf);
		}
		on_minus_strand = strand_is_minus(strand, i);
		if (on_minus_strand == -1) {
			UNPROTECT(1);
			error("%s", errmsg_buf);
		}
		ans_elt = VECTOR_ELT(ans, i);
		if (ans_elt == R_NilValue) {
			nlocs = 0;
		} else if (IS_INTEGER(ans_elt)) {
			nlocs = LENGTH(ans_elt);
		} else {
			UNPROTECT(1);
			error("'tlocs' has invalid elements");
		}
		for (j = 0; j < nlocs; j++) {
			tloc = INTEGER(ans_elt)[j];
			if (tloc == NA_INTEGER)
				continue;
			if (tloc < 1 || tloc > transcript_width) {
				UNPROTECT(1);
				error("'tlocs[[%d]]' contains \"out of limits\" "
				      "transcript locations (length of "
				      "transcript is %d)", j + 1, transcript_width);
			}
			INTEGER(ans_elt)[j] = tloc2rloc(tloc,
				starts, ends,
				on_minus_strand,
				decreasing_rank_on_minus_strand0);
		}
	}
	UNPROTECT(1);
	return ans;
}
开发者ID:hcorrada,项目名称:GenomicRanges,代码行数:52,代码来源:transcript_utils.c


示例6: plr_SPI_cursor_fetch

SEXP
plr_SPI_cursor_fetch(SEXP cursor_in,SEXP forward_in, SEXP rows_in)
{
	Portal				portal=NULL;
	int					ntuples;
	SEXP				result = NULL;
	MemoryContext		oldcontext;
	int					forward;
	int					rows;
	PREPARE_PG_TRY;
	PUSH_PLERRCONTEXT(rsupport_error_callback, "pg.spi.cursor_fetch");

	portal = R_ExternalPtrAddr(cursor_in);
	if(!IS_LOGICAL(forward_in))
	{
		error("pg.spi.cursor_fetch arg2 must be boolean");
		return result;
	}
	if(!IS_INTEGER(rows_in))
	{
		error("pg.spi.cursor_fetch arg3 must be an integer");
		return result;
	}
	forward = LOGICAL_DATA(forward_in)[0];
	rows  = INTEGER_DATA(rows_in)[0];

	/* switch to SPI memory context */
	oldcontext = MemoryContextSwitchTo(plr_SPI_context);
	PG_TRY();
	{
		/* Open the cursor */
		SPI_cursor_fetch(portal,forward,rows);
		
	}
	PLR_PG_CATCH();
	PLR_PG_END_TRY();
	/* back to caller's memory context */
	MemoryContextSwitchTo(oldcontext);

	/* check the result */
	ntuples = SPI_processed;
	if (ntuples > 0)
	{
		result = rpgsql_get_results(ntuples, SPI_tuptable);
		SPI_freetuptable(SPI_tuptable);
	}
	else
		result = R_NilValue;

	POP_PLERRCONTEXT;
	return result;
}
开发者ID:Khalefa,项目名称:VLDB12Demo,代码行数:52,代码来源:pg_rsupport.c


示例7: GMPy_Number_Sign

static PyObject *
GMPy_Number_Sign(PyObject *x, CTXT_Object *context)
{
    if (IS_INTEGER(x))
        return GMPy_Integer_Sign(x, context);
    else if (IS_RATIONAL_ONLY(x))
        return GMPy_Rational_Sign(x, context);
    else if (IS_REAL_ONLY(x))
        return GMPy_Real_Sign(x, context);

    TYPE_ERROR("sign() argument type not supported");
    return NULL;
}
开发者ID:godbomb,项目名称:gmpy,代码行数:13,代码来源:gmpy2_sign.c


示例8: VAL_SET

*/	REBFLG MT_String(REBVAL *out, REBVAL *data, REBCNT type)
/*
***********************************************************************/
{
	REBCNT i;

	if (!ANY_BINSTR(data)) return FALSE;
	*out = *data++;
	VAL_SET(out, type);
	i = IS_INTEGER(data) ? Int32(data) - 1 : 0;
	if (i > VAL_TAIL(out)) i = VAL_TAIL(out); // clip it
	VAL_INDEX(out) = i;
	return TRUE;
}
开发者ID:RamchandraApte,项目名称:rebol,代码行数:14,代码来源:t-string.c


示例9: PD_Tuple

//
//  PD_Tuple: C
//
// Implements PATH and SET_PATH for tuple.
// Sets DS_TOP if found. Always returns 0.
//
REBINT PD_Tuple(REBPVS *pvs)
{
    const REBVAL *setval;
    REBINT n;
    REBINT i;
    REBYTE *dat;
    REBINT len;

    dat = VAL_TUPLE(pvs->value);
    len = VAL_TUPLE_LEN(pvs->value);

    if (len < 3) {
        len = 3;
    }

    n = Get_Num_From_Arg(pvs->selector);

    if ((setval = pvs->opt_setval)) {
        if (n <= 0 || n > cast(REBINT, MAX_TUPLE))
            fail (Error_Bad_Path_Select(pvs));

        if (IS_INTEGER(setval) || IS_DECIMAL(setval))
            i = Int32(setval);
        else if (IS_BLANK(setval)) {
            n--;
            CLEAR(dat + n, MAX_TUPLE - n);
            VAL_TUPLE_LEN(pvs->value) = n;
            return PE_OK;
        }
        else
            fail (Error_Bad_Path_Set(pvs));

        if (i < 0) i = 0;
        else if (i > 255) i = 255;

        dat[n - 1] = i;
        if (n > len)
            VAL_TUPLE_LEN(pvs->value) = n;

        return PE_OK;
    }
    else {
        if (n > 0 && n <= len) {
            SET_INTEGER(pvs->store, dat[n - 1]);
            return PE_USE_STORE;
        }
        else return PE_NONE;
    }
}
开发者ID:hostilefork,项目名称:rebol,代码行数:55,代码来源:t-tuple.c


示例10: sizeof

*/	static void Sort_Block(REBVAL *block, REBFLG ccase, REBVAL *skipv, REBVAL *compv, REBVAL *part, REBFLG all, REBFLG rev)
/*
**		series [series!]
**		/case {Case sensitive sort}
**		/skip {Treat the series as records of fixed size}
**		size [integer!] {Size of each record}
**		/compare  {Comparator offset, block or function}
**		comparator [integer! block! function!]
**		/part {Sort only part of a series}
**		length [number! series!] {Length of series to sort}
**		/all {Compare all fields}
**		/reverse {Reverse sort order}
**
***********************************************************************/
{
	REBCNT len;
	REBCNT skip = 1;
	REBCNT size = sizeof(REBVAL);
//	int (*sfunc)(const void *v1, const void *v2);

	sort_flags.cased = ccase;
	sort_flags.reverse = rev;
	sort_flags.compare = 0;
	sort_flags.offset = 0;

	if (IS_INTEGER(compv)) sort_flags.offset = Int32(compv)-1; 
	if (ANY_FUNC(compv)) sort_flags.compare = compv; 

	// Determine length of sort:
	len = Partial1(block, part);
	if (len <= 1) return;

	// Skip factor:
	if (!IS_NONE(skipv)) {
		skip = Get_Num_Arg(skipv);
		if (skip <= 0 || len % skip != 0 || skip > len)
			Trap_Range(skipv);
	}

	// Use fast quicksort library function:
	if (skip > 1) len /= skip, size *= skip;

	if (sort_flags.compare)
		qsort((void *)VAL_BLK_DATA(block), len, size, Compare_Call);
	else
		qsort((void *)VAL_BLK_DATA(block), len, size, Compare_Val);

}
开发者ID:51weekend,项目名称:r3,代码行数:48,代码来源:t-block.c


示例11: GetNumeric

double GetNumeric(SEXP p, double default_val, int* err_code){
	if(p == R_NilValue){
		if(err_code) *err_code = 1;
		return default_val;
	}else if(IS_INTEGER(p)){
		return INTEGER(p)[0];
	}else if(IS_LOGICAL(p)){
		if(LOGICAL(p)[0]) return 1.0;
		else return 0.0;
	}else if(IS_NUMERIC(p)){
		return REAL(p)[0];
	}else{
		if(err_code) *err_code = 2;
		return default_val;
	}
}
开发者ID:cran,项目名称:cghFLasso,代码行数:16,代码来源:L2L1VitExact.c


示例12: GetInt

int GetInt(SEXP p, int default_val, int* err_code){
	if(p == R_NilValue){
		if(err_code) *err_code = 1;
		return default_val;
	}else if(IS_INTEGER(p)){
		return INTEGER(p)[0];
	}else if(IS_LOGICAL(p)){
		if(LOGICAL(p)[0]) return 1;
		else return 0;
	}else if(IS_NUMERIC(p)){
		return (int)(REAL(p)[0]);
	}else{
		if(err_code) *err_code = 2;
		return default_val;
	}
}
开发者ID:cran,项目名称:cghFLasso,代码行数:16,代码来源:L2L1VitExact.c


示例13: if

*/  REBFLG MT_Decimal(REBVAL *out, REBVAL *data, REBCNT type)
/*
***********************************************************************/
{
    if (!IS_END(data+1)) return FALSE;

    if (IS_DECIMAL(data))
        *out = *data;
    else if (IS_INTEGER(data)) {
        SET_DECIMAL(out, (REBDEC)VAL_INT64(data));
    }
    else return FALSE;

    SET_TYPE(out, type);
    return TRUE;
}
开发者ID:kealist,项目名称:ren-c,代码行数:16,代码来源:t-decimal.c


示例14: if

static REBSER *make_string(REBVAL *arg, REBOOL make)
{
	REBSER *ser = 0;

	// MAKE <type> 123
	if (make && (IS_INTEGER(arg) || IS_DECIMAL(arg))) {
		ser = Make_Binary(Int32s(arg, 0));
	}
	// MAKE/TO <type> <binary!>
	else if (IS_BINARY(arg)) {
		REBYTE *bp = VAL_BIN_DATA(arg);
		REBCNT len = VAL_LEN(arg);
		switch (What_UTF(bp, len)) {
		case 0:
			break;
		case 8: // UTF-8 encoded
			bp  += 3;
			len -= 3;
			break;
		default:
			Trap0(RE_BAD_DECODE);
		}
		ser = Decode_UTF_String(bp, len, 8); // UTF-8
	}
	// MAKE/TO <type> <any-string>
	else if (ANY_BINSTR(arg)) {
		ser = Copy_String(VAL_SERIES(arg), VAL_INDEX(arg), VAL_LEN(arg));
	}
	// MAKE/TO <type> <any-word>
	else if (ANY_WORD(arg)) {
		ser = Copy_Mold_Value(arg, TRUE);
		//ser = Append_UTF8(0, Get_Word_Name(arg), -1);
	}
	// MAKE/TO <type> #"A"
	else if (IS_CHAR(arg)) {
		ser = (VAL_CHAR(arg) > 0xff) ? Make_Unicode(2) : Make_Binary(2);
		Append_Byte(ser, VAL_CHAR(arg));
	}
	// MAKE/TO <type> <any-value>
//	else if (IS_NONE(arg)) {
//		ser = Make_Binary(0);
//	}
	else
		ser = Copy_Form_Value(arg, 1<<MOPT_TIGHT);

	return ser;
}
开发者ID:RamchandraApte,项目名称:rebol,代码行数:47,代码来源:t-string.c


示例15: VAL_SET

*/	REBFLG MT_Block(REBVAL *out, REBVAL *data, REBCNT type)
/*
***********************************************************************/
{
	REBCNT i;

	if (!ANY_BLOCK(data)) return FALSE;
	if (type >= REB_PATH && type <= REB_LIT_PATH)
		if (!ANY_WORD(VAL_BLK(data))) return FALSE;

	*out = *data++;
	VAL_SET(out, type);
	i = IS_INTEGER(data) ? Int32(data) - 1 : 0;
	if (i > VAL_TAIL(out)) i = VAL_TAIL(out); // clip it
	VAL_INDEX(out) = i;
	return TRUE;
}
开发者ID:51weekend,项目名称:r3,代码行数:17,代码来源:t-block.c


示例16: MAKE_Vector

//
//  MAKE_Vector: C
//
void MAKE_Vector(REBVAL *out, enum Reb_Kind kind, const REBVAL *arg)
{
    // CASE: make vector! 100
    if (IS_INTEGER(arg) || IS_DECIMAL(arg)) {
        REBINT size = Int32s(arg, 0);
        if (size < 0) goto bad_make;
        REBSER *ser = Make_Vector(0, 0, 1, 32, size);
        Val_Init_Vector(out, ser);
        return;
    }

    TO_Vector(out, kind, arg); // may fail()
    return;

bad_make:
    fail (Error_Bad_Make(kind, arg));
}
开发者ID:rgchris,项目名称:ren-c,代码行数:20,代码来源:t-vector.c


示例17: GMPy_XMPZ_ILshift_Slot

static PyObject *
GMPy_XMPZ_ILshift_Slot(PyObject *self, PyObject *other)
{
    mp_bitcnt_t shift;

    if (IS_INTEGER(other)) {
        shift = mp_bitcnt_t_From_Integer(other);
        if (shift == (mp_bitcnt_t)(-1) && PyErr_Occurred())
            return NULL;

        mpz_mul_2exp(MPZ(self), MPZ(self), shift);
        Py_INCREF(self);
        return self;
    }

    Py_RETURN_NOTIMPLEMENTED;
}
开发者ID:BrianGladman,项目名称:gmpy2,代码行数:17,代码来源:gmpy2_xmpz_inplace.c


示例18: N_debug

REB_R N_debug(REBFRM *frame_) {
    PARAM(1, value);
    REBVAL *value = ARG(value);

    if (IS_VOID(value)) {
        //
        // e.g. just `>> debug` and [enter] in the console.  Ideally this
        // would shift the REPL into a mode where all commands issued were
        // assumed to be in the debug dialect, similar to Ren Garden's
        // modalities like `debug>>`.
        //
        Debug_Fmt("Sorry, there is no debug>> 'mode' yet in the console.");
        goto modify_with_confidence;
    }

    if (IS_INTEGER(value) || IS_FRAME(value) || IS_FUNCTION(value)) {
        REBFRM *frame;

        // We pass TRUE here to account for an extra stack level... the one
        // added by DEBUG itself, which presumably should not count.
        //
        if (!(frame = Frame_For_Stack_Level(&HG_Stack_Level, value, TRUE)))
            fail (Error_Invalid_Arg(value));

        Val_Init_Block(D_OUT, Make_Where_For_Frame(frame));
        return R_OUT;
    }

    assert(IS_BLOCK(value));

    Debug_Fmt(
        "Sorry, but the `debug [...]` dialect is not defined yet.\n"
        "Change the stack level (integer!, frame!, function!)\n"
        "Or try out these commands:\n"
        "\n"
        "    BREAKPOINT, RESUME, BACKTRACE\n"
    );

modify_with_confidence:
    Debug_Fmt(
        "(Note: Ren-C is 'modify-with-confidence'...so just because a debug\n"
        "feature you want isn't implemented doesn't mean you can't add it!)\n"
    );

    return R_BLANK;
}
开发者ID:IngoHohmann,项目名称:ren-c,代码行数:46,代码来源:host-main.c


示例19: GMPy_Number_Abs

static PyObject *
GMPy_Number_Abs(PyObject *x, CTXT_Object *context)
{
    if (IS_INTEGER(x))
        return GMPy_Integer_Abs(x, context);

    if (IS_RATIONAL_ONLY(x))
        return GMPy_Rational_Abs(x, context);

    if (IS_REAL_ONLY(x))
        return GMPy_Real_Abs(x, context);

    if (IS_COMPLEX_ONLY(x))
        return GMPy_Complex_Abs(x, context);

    TYPE_ERROR("abs() argument type not supported");
    return NULL;
}
开发者ID:godbomb,项目名称:gmpy,代码行数:18,代码来源:gmpy2_abs.c


示例20: RGnumeric_sheetInWorkbook

/**
  Get a reference to a particular sheet in a Gnumeric workbook,
  identifying it either by index or by name. If an integer
  is specified, this should be 1-based (rather than 0-based).
 */
USER_OBJECT_
RGnumeric_sheetInWorkbook(USER_OBJECT_ workbookRef, USER_OBJECT_ index)
{
  Workbook *workbook;
  USER_OBJECT_ ans = NULL_USER_OBJECT;
  Sheet *sheet;

  workbook = RGnumeric_resolveWorkbookReference(workbookRef);
  if(IS_INTEGER(index))
    sheet = workbook_sheet_by_index(workbook, INTEGER_DATA(index)[0] - 1);
  else {
    sheet = workbook_sheet_by_name(workbook, CHAR_DEREF(STRING_ELT(index, 0)));
  }
  if(sheet)
    ans = RGnumeric_sheetReference(sheet);

  return(ans);
}
开发者ID:omegahat,项目名称:Gnumeric,代码行数:23,代码来源:RWorkbook.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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