本文整理汇总了C++中LL2NUM函数的典型用法代码示例。如果您正苦于以下问题:C++ LL2NUM函数的具体用法?C++ LL2NUM怎么用?C++ LL2NUM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LL2NUM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init_limits
void
Init_limits(void)
{
VALUE mLimits;
mLimits = rb_define_module("Limits");
rb_define_const(mLimits, "CHAR_BIT", INT2FIX(CHAR_BIT));
rb_define_const(mLimits, "MB_LEN_MAX", INT2FIX(MB_LEN_MAX));
rb_define_const(mLimits, "CHAR_MAX", INT2FIX(CHAR_MAX));
rb_define_const(mLimits, "CHAR_MIN", INT2FIX(CHAR_MIN));
rb_define_const(mLimits, "UCHAR_MAX", INT2FIX(UCHAR_MAX));
rb_define_const(mLimits, "SHRT_MAX", INT2FIX(SHRT_MAX));
rb_define_const(mLimits, "SHRT_MIN", INT2FIX(SHRT_MIN));
rb_define_const(mLimits, "USHRT_MAX", INT2FIX(USHRT_MAX));
rb_define_const(mLimits, "INT_MAX", INT2FIX(INT_MAX));
rb_define_const(mLimits, "INT_MIN", INT2FIX(INT_MIN));
rb_define_const(mLimits, "UINT_MAX", INT2FIX(UINT_MAX));
rb_define_const(mLimits, "LONG_MAX", LL2NUM(LONG_MAX));
rb_define_const(mLimits, "LONG_MIN", LL2NUM(LONG_MIN));
rb_define_const(mLimits, "ULONG_MAX", ULL2NUM(ULONG_MAX));
rb_define_const(mLimits, "LLONG_MAX", LL2NUM(LLONG_MAX));
rb_define_const(mLimits, "LLONG_MIN", LL2NUM(LLONG_MIN));
rb_define_const(mLimits, "ULLONG_MAX", ULL2NUM(ULLONG_MAX));
}
示例2: rd_die_new
static VALUE rd_die_new(rd_shared_data_t *sd, VALUE top, VALUE cu, Dwarf_Die die)
{
rd_die_t *rd_die;
Dwarf_Off off;
Dwarf_Half tag;
Dwarf_Error err;
VALUE obj;
VALUE klass;
chkerr1(dwarf_dieoffset(die, &off, &err), &err, Qnil);
obj = rb_hash_aref(sd->off2die, LL2NUM(off));
if (!NIL_P(obj)) {
return obj;
}
chkerr1(dwarf_tag(die, &tag, &err), &err, Qnil);
klass = rb_hash_aref(rdwarf_tag2class, INT2FIX(tag));
if (NIL_P(klass)) {
rb_raise(rb_eRuntimeError, "unknown tag %d\n", tag);
}
obj = rd_die_s_alloc(klass);
rd_die = GetDie(obj);
rd_die->shared_data = rd_shared_data_ref(sd);
rd_die->die = die;
rb_ivar_set(obj, id_at_top, top);
rb_ivar_set(obj, id_at_cu, NIL_P(cu) ? obj : cu);
rb_hash_aset(sd->off2die, LL2NUM(off), obj);
return obj;
}
示例3: array_from_stat
static VALUE array_from_stat(const struct Stat* stat) {
return rb_ary_new3(8,
LL2NUM(stat->czxid),
LL2NUM(stat->mzxid),
LL2NUM(stat->ctime),
LL2NUM(stat->mtime),
INT2NUM(stat->version),
INT2NUM(stat->cversion),
INT2NUM(stat->aversion),
LL2NUM(stat->ephemeralOwner));
}
示例4: rb_grn_bulk_to_ruby_object_by_range_id
static VALUE
rb_grn_bulk_to_ruby_object_by_range_id (grn_ctx *context, grn_obj *bulk,
grn_id range_id,
VALUE related_object, VALUE *rb_value)
{
grn_bool success = GRN_TRUE;
switch (range_id) {
case GRN_DB_VOID:
*rb_value = rb_str_new(GRN_TEXT_VALUE(bulk), GRN_TEXT_LEN(bulk));
break;
case GRN_DB_BOOL:
*rb_value = GRN_BOOL_VALUE(bulk) ? Qtrue : Qfalse;
break;
case GRN_DB_INT32:
*rb_value = INT2NUM(GRN_INT32_VALUE(bulk));
break;
case GRN_DB_UINT32:
*rb_value = UINT2NUM(GRN_UINT32_VALUE(bulk));
break;
case GRN_DB_INT64:
*rb_value = LL2NUM(GRN_INT64_VALUE(bulk));
break;
case GRN_DB_UINT64:
*rb_value = ULL2NUM(GRN_UINT64_VALUE(bulk));
break;
case GRN_DB_FLOAT:
*rb_value = rb_float_new(GRN_FLOAT_VALUE(bulk));
break;
case GRN_DB_TIME:
{
int64_t time_value, sec, usec;
time_value = GRN_TIME_VALUE(bulk);
GRN_TIME_UNPACK(time_value, sec, usec);
*rb_value = rb_funcall(rb_cTime, rb_intern("at"), 2,
LL2NUM(sec), LL2NUM(usec));
}
break;
case GRN_DB_SHORT_TEXT:
case GRN_DB_TEXT:
case GRN_DB_LONG_TEXT:
*rb_value = rb_grn_context_rb_string_new(context,
GRN_TEXT_VALUE(bulk),
GRN_TEXT_LEN(bulk));
break;
default:
success = GRN_FALSE;
break;
}
return success;
}
示例5: convert_parse
static VALUE
convert_parse(VALUE self)
{
GstFormat src_format, dest_format;
gint64 src_value, dest_value;
gst_query_parse_convert(RVAL2GST_QUERY(self), &src_format, &src_value,
&dest_format, &dest_value);
return rb_ary_new3(4, GST_FORMAT2RVAL(src_format), LL2NUM(src_value),
RVAL2GST_FORMAT(dest_format), LL2NUM(dest_value));
}
示例6: rdo_mysql_result_info_new
/** Extract result information from the given result */
static VALUE rdo_mysql_result_info_new(MYSQL * conn, MYSQL_RES * res) {
unsigned long long count = (res == NULL) ? 0 : mysql_num_rows(res);
VALUE info = rb_hash_new();
rb_hash_aset(info, ID2SYM(rb_intern("count")), LL2NUM(count));
rb_hash_aset(info, ID2SYM(rb_intern("insert_id")),
LL2NUM(mysql_insert_id(conn)));
rb_hash_aset(info, ID2SYM(rb_intern("affected_rows")),
LL2NUM(mysql_affected_rows(conn)));
return info;
}
示例7: seeking_parse
static VALUE
seeking_parse(VALUE self)
{
GstFormat format;
gboolean seekable;
gint64 segment_start, segment_end;
gst_query_parse_seeking(RVAL2GST_QUERY(self), &format, &seekable,
&segment_start, &segment_end);
return rb_ary_new3(4, GST_FORMAT2RVAL(format), CBOOL2RVAL(seekable),
LL2NUM(segment_start), LL2NUM(segment_end));
}
示例8: segment_parse
static VALUE
segment_parse(VALUE self)
{
GstFormat format;
gdouble rate;
gint64 start_value, stop_value;
gst_query_parse_segment(RVAL2GST_QUERY(self), &rate, &format,
&start_value, &stop_value);
return rb_ary_new3(4, rb_dbl2big(rate), GST_FORMAT2RVAL(format),
LL2NUM(start_value), LL2NUM(stop_value));
}
示例9: buffersize_parse
static VALUE
buffersize_parse(VALUE self)
{
GstFormat format;
gint64 minsize;
gint64 maxsize;
gboolean async;
gst_event_parse_buffer_size(RGST_EVENT(self), &format, &minsize,
&maxsize, &async);
return rb_ary_new3(4, GST_FORMAT2RVAL(format), LL2NUM(minsize),
LL2NUM(maxsize), CBOOL2RVAL(async));
}
示例10: Data_Get_Struct
VALUE FileWrapper::rb_get_size(VALUE self)
{
File *fl;
Data_Get_Struct(self, File, fl);
return LL2NUM(fl->get_size());
}
示例11: newsegment_parse
static VALUE
newsegment_parse(VALUE self)
{
gboolean update;
gdouble rate, applied_rate;
GstFormat format;
gint64 start, stop, position;
gst_event_parse_new_segment_full(RGST_EVENT(self), &update, &rate,
&applied_rate, &format, &start, &stop,
&position);
return rb_ary_new3(7, CBOOL2RVAL(update), DBL2NUM(update), DBL2NUM(rate),
GST_FORMAT2RVAL(format), LL2NUM(start), LL2NUM(stop),
LL2NUM(position));
}
示例12: buffered_file_pos
/* Get the current file position */
static VALUE buffered_file_pos(VALUE self) {
VALUE parent_pos = rb_call_super(0, NULL);
long long ll_pos = NUM2LL(parent_pos);
long buffer_length = RSTRING_LEN(rb_ivar_get(self, id_ivar_buffer));
long buffer_index = FIX2INT(rb_ivar_get(self, id_ivar_buffer_index));
return LL2NUM(ll_pos - (long long)(buffer_length - buffer_index));
}
示例13: value_from_default
static VALUE value_from_default(const upb_fielddef *field) {
switch (upb_fielddef_type(field)) {
case UPB_TYPE_FLOAT: return DBL2NUM(upb_fielddef_defaultfloat(field));
case UPB_TYPE_DOUBLE: return DBL2NUM(upb_fielddef_defaultdouble(field));
case UPB_TYPE_BOOL:
return upb_fielddef_defaultbool(field) ? Qtrue : Qfalse;
case UPB_TYPE_MESSAGE: return Qnil;
case UPB_TYPE_ENUM: {
const upb_enumdef *enumdef = upb_fielddef_enumsubdef(field);
int32_t num = upb_fielddef_defaultint32(field);
const char *label = upb_enumdef_iton(enumdef, num);
if (label) {
return ID2SYM(rb_intern(label));
} else {
return INT2NUM(num);
}
}
case UPB_TYPE_INT32: return INT2NUM(upb_fielddef_defaultint32(field));
case UPB_TYPE_INT64: return LL2NUM(upb_fielddef_defaultint64(field));;
case UPB_TYPE_UINT32: return UINT2NUM(upb_fielddef_defaultuint32(field));
case UPB_TYPE_UINT64: return ULL2NUM(upb_fielddef_defaultuint64(field));
case UPB_TYPE_STRING:
case UPB_TYPE_BYTES: {
size_t size;
const char *str = upb_fielddef_defaultstr(field, &size);
return rb_str_new(str, size);
}
default: return Qnil;
}
}
示例14: ruby_libvirt_typed_params_to_hash
void ruby_libvirt_typed_params_to_hash(void *voidparams, int i, VALUE hash)
{
virTypedParameterPtr params = (virTypedParameterPtr)voidparams;
VALUE val;
switch (params[i].type) {
case VIR_TYPED_PARAM_INT:
val = INT2NUM(params[i].value.i);
break;
case VIR_TYPED_PARAM_UINT:
val = UINT2NUM(params[i].value.ui);
break;
case VIR_TYPED_PARAM_LLONG:
val = LL2NUM(params[i].value.l);
break;
case VIR_TYPED_PARAM_ULLONG:
val = ULL2NUM(params[i].value.ul);
break;
case VIR_TYPED_PARAM_DOUBLE:
val = rb_float_new(params[i].value.d);
break;
case VIR_TYPED_PARAM_BOOLEAN:
val = (params[i].value.b == 0) ? Qfalse : Qtrue;
break;
case VIR_TYPED_PARAM_STRING:
val = rb_str_new2(params[i].value.s);
break;
default:
rb_raise(rb_eArgError, "Invalid parameter type");
}
rb_hash_aset(hash, rb_str_new2(params[i].field), val);
}
示例15: cQuery_searchcount
static VALUE cQuery_searchcount(VALUE vself){
VALUE vqry;
RDBQRY *qry;
vqry = rb_iv_get(vself, RDBQRYVNDATA);
Data_Get_Struct(vqry, RDBQRY, qry);
return LL2NUM(tcrdbqrysearchcount(qry));
}