当前位置: 首页>>代码示例>>C++>>正文


C++ LONG2NUM函数代码示例

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


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

示例1: rb_tinytds_result_do

static VALUE rb_tinytds_result_do(VALUE self) {
  GET_RESULT_WRAPPER(self);
  if (rwrap->client) {
    rb_tinytds_result_exec_helper(rwrap->client);
    return LONG2NUM((long)dbcount(rwrap->client));
  } else {
    return Qnil;
  }
}
开发者ID:Monishonline,项目名称:tiny_tds,代码行数:9,代码来源:result.c

示例2: call_error

inline static void
call_error(const char *msg, ParseInfo pi, const char* file, int line) {
    char	buf[128];
    const char	*s = pi->s;
    int		jline = 1;
    int		col = 1;

    for (; pi->str < s && '\n' != *s; s--) {
	col++;
    }
    for (; pi->str < s; s--) {
	if ('\n' == *s) {
	    jline++;
	}
    }
    sprintf(buf, "%s at line %d, column %d [%s:%d]", msg, jline, col, file, line);
    rb_funcall(pi->handler, oj_error_id, 3, rb_str_new2(buf), LONG2NUM(jline), LONG2NUM(col));
}
开发者ID:00zl00,项目名称:AlfredWorkflow.com,代码行数:18,代码来源:saj.c

示例3: lazy_take_size

static VALUE
lazy_take_size(VALUE generator, VALUE args, VALUE lazy)
{
    VALUE receiver = lazy_size(lazy);
    long len = NUM2LONG(RARRAY_AREF(rb_ivar_get(lazy, id_arguments), 0));
    if (NIL_P(receiver) || (FIXNUM_P(receiver) && FIX2LONG(receiver) < len))
	return receiver;
    return LONG2NUM(len);
}
开发者ID:takuto-h,项目名称:ruby,代码行数:9,代码来源:enumerator.c

示例4: ossl_sslctx_get_session_cache_size

/*
 *  call-seq:
 *     ctx.session_cache_size -> integer
 *
 */
static VALUE
ossl_sslctx_get_session_cache_size(VALUE self)
{
    SSL_CTX *ctx;

    Data_Get_Struct(self, SSL_CTX, ctx);

    return LONG2NUM(SSL_CTX_sess_get_cache_size(ctx));
}
开发者ID:2220142,项目名称:ruby,代码行数:14,代码来源:ossl_ssl.c

示例5: memory_size

static VALUE
memory_size(VALUE self) 
{
    AbstractMemory* ptr;

    Data_Get_Struct(self, AbstractMemory, ptr);

    return LONG2NUM(ptr->size);
}
开发者ID:Flameeyes,项目名称:ffi,代码行数:9,代码来源:AbstractMemory.c

示例6: memptr_s_from_string

/*
 * call-seq: from_string(s)
 * @param [String] s string
 * @return [MemoryPointer]
 * Create a {MemoryPointer} with +s+ inside.
 */
static VALUE
memptr_s_from_string(VALUE klass, VALUE to_str)
{
    VALUE s = StringValue(to_str);
    VALUE args[] = { INT2FIX(1), LONG2NUM(RSTRING_LEN(s) + 1), Qfalse };
    VALUE obj = rb_class_new_instance(3, args, klass);
    rb_funcall(obj, rb_intern("put_string"), 2, INT2FIX(0), s);

    return obj;
}
开发者ID:AndreasDattilo,项目名称:sample_app,代码行数:16,代码来源:MemoryPointer.c

示例7: HDFS_File_System_capacity

/**
 * call-seq:
 *    hdfs.capacity -> retval
 *
 * Returns the capacity of this HDFS file system in bytes, raising a
 * DFSException if this was unsuccessful.
 */
VALUE HDFS_File_System_capacity(VALUE self) {
  FSData* data = get_FSData(self);
  long capacity = hdfsGetCapacity(data->fs);
  if (capacity < 0) {
    rb_raise(e_dfs_exception, "Error while retrieving capacity: %s",
        get_error(errno));
    return Qnil;
  }
  return LONG2NUM(capacity);
}
开发者ID:ssalevan,项目名称:ruby-hdfs,代码行数:17,代码来源:file_system.c

示例8: HDFS_File_System_default_block_size

/**
 * call-seq:
 *    hdfs.default_block_size -> retval
 *
 * Returns the default block size of this HDFS file system in bytes, raising a
 * DFSException if this was unsuccessful.
 */
VALUE HDFS_File_System_default_block_size(VALUE self) {
  FSData* data = get_FSData(self);
  long block_size = hdfsGetDefaultBlockSize(data->fs);
  if (block_size == -1) {
    rb_raise(e_dfs_exception, "Error while retrieving default block size: %s",
        get_error(errno));
    return Qnil;
  }
  return LONG2NUM(block_size);
}
开发者ID:ssalevan,项目名称:ruby-hdfs,代码行数:17,代码来源:file_system.c

示例9: f_imul

inline static VALUE
f_imul(long a, long b)
{
    VALUE r;
    long c;

    if (a == 0 || b == 0)
	return ZERO;
    else if (a == 1)
	return LONG2NUM(b);
    else if (b == 1)
	return LONG2NUM(a);

    c = a * b;
    r = LONG2NUM(c);
    if (NUM2LONG(r) != c || (c / a) != b)
	r = rb_big_mul(rb_int2big(a), rb_int2big(b));
    return r;
}
开发者ID:alloy,项目名称:mr-experimental,代码行数:19,代码来源:rational.c

示例10: rb_mysql_result_count

static VALUE rb_mysql_result_count(VALUE self) {
  mysql2_result_wrapper *wrapper;

  GetMysql2Result(self, wrapper);
  if(wrapper->resultFreed) {
    return LONG2NUM(RARRAY_LEN(wrapper->rows));
  } else {
    return INT2FIX(mysql_num_rows(wrapper->result));
  }
}
开发者ID:theokorigroup,项目名称:mysql2,代码行数:10,代码来源:result.c

示例11: HDFS_File_System_used

/**
 * call-seq:
 *    hdfs.used -> retval
 *
 * Returns the bytes currently in use by this filesystem, raising a
 * DFSException if unsuccessful.
 */
VALUE HDFS_File_System_used(VALUE self) {
  FSData* data = get_FSData(self);
  tOffset used = hdfsGetUsed(data->fs);
  if (used == -1) {
    rb_raise(e_dfs_exception, "Error while retrieving used capacity: %s",
        get_error(errno));
    return Qnil;
  }
  return LONG2NUM(used);
}
开发者ID:ssalevan,项目名称:ruby-hdfs,代码行数:17,代码来源:file_system.c

示例12: rb_singleton_class_attached

void
rb_singleton_class_attached(VALUE klass, VALUE obj)
{
    if (RCLASS_SINGLETON(klass)) {
	// Weak ref.
	VALUE wobj = LONG2NUM((long)obj);
	rb_ivar_set(klass, idAttached, wobj);
	// FIXME commented for now as it breaks some RubySpecs.
	//rb_singleton_class_promote_for_gc(klass);
    }
}
开发者ID:MSch,项目名称:MacRuby,代码行数:11,代码来源:class.c

示例13: ossl_x509crl_get_version

static VALUE 
ossl_x509crl_get_version(VALUE self)
{
    X509_CRL *crl;
    long ver;

    GetX509CRL(self, crl);
    ver = X509_CRL_get_version(crl);

    return LONG2NUM(ver);
}
开发者ID:tflynn,项目名称:ruby19-norubygems,代码行数:11,代码来源:ossl_x509crl.c

示例14: ptrace_getsiginfo

static VALUE
ptrace_getsiginfo(VALUE self)
{
    pid_t pid = get_pid(self);
    siginfo_t si;
    void *data_ptr = (void *)&si;
    long ret;
    VALUE v;

    CALL_PTRACE(ret, PT_GETSIGINFO, pid, 0, data_ptr);

    v = rb_hash_new();

#define SI_SET(name, val) rb_hash_aset(v, ID2SYM(rb_intern("si_" #name)), val)
    SI_SET(sig, si_signo_symbol(si.si_signo));
    SI_SET(signo, INT2NUM(si.si_signo));
    SI_SET(errno, INT2NUM(si.si_errno));
    SI_SET(code, si_code_symbol(si.si_signo, si.si_code));
    SI_SET(codeno, INT2NUM(si.si_code));

    switch (si.si_signo) {
      case SIGKILL:
	SI_SET(pid, ULONG2NUM(si.si_pid));
	SI_SET(uid, ULONG2NUM(si.si_uid));
	break;

      case SIGILL:
      case SIGFPE:
      case SIGSEGV:
      case SIGBUS:
	SI_SET(addr, ULONG2NUM((unsigned long)si.si_addr));
	break;

      case SIGCHLD:
	SI_SET(pid, ULONG2NUM(si.si_pid));
	SI_SET(uid, ULONG2NUM(si.si_uid));
	SI_SET(status, INT2NUM(si.si_status));
	SI_SET(utime, ULONG2NUM(si.si_utime));
	SI_SET(stime, ULONG2NUM(si.si_stime));
	break;

      case SIGPOLL:
	SI_SET(band, LONG2NUM(si.si_band));
	SI_SET(fd, INT2NUM(si.si_fd));
	break;

      default: /* POSIX.1b signal? */
	;
    }

#undef SI_SET

    return v;
}
开发者ID:garaemon,项目名称:ruby-ptrace,代码行数:54,代码来源:ptrace.c

示例15: subColorInstantiate

/* subColorInstantiate {{{ */
VALUE
subColorInstantiate(unsigned long pixel)
{
  VALUE klass = Qnil, color = Qnil;

  /* Create new instance */
  klass  = rb_const_get(mod, rb_intern("Color"));
  color = rb_funcall(klass, rb_intern("new"), 1, LONG2NUM(pixel));

  return color;
} /* }}} */
开发者ID:MinasMazar,项目名称:subtle,代码行数:12,代码来源:color.c


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