- Timestamp:
- Jul 9, 2020, 8:51:43 AM (4 years ago)
- Location:
- EcnlProtoTool/trunk/mruby-2.1.1
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/mruby-2.1.1/mrbgems/mruby-inline-struct/test/inline.c
r331 r439 12 12 mrb_get_args(mrb, "o", &object); 13 13 14 if (mrb_float_p(object)) 15 { 16 snprintf(string, size, "float(%.3f)", mrb_float(object)); 14 if (mrb_fixnum_p(object)) { 15 strncpy(string, "fixnum", size-1); 17 16 } 18 else if (mrb_fixnum_p(object)) 19 {20 s nprintf(string, size, "fixnum(%" MRB_PRId ")", mrb_fixnum(object));17 #ifndef MRB_WITHOUT_FLOAT 18 else if (mrb_float_p(object)) { 19 strncpy(string, "float", size-1); 21 20 } 22 else if (mrb_string_p(object)) 23 { 24 snprintf(string, size, "string(%s)", mrb_string_value_cstr(mrb, &object)); 21 #endif 22 else if (mrb_string_p(object)) { 23 strncpy(string, "string", size-1); 24 } 25 else { 26 strncpy(string, "anything", size-1); 25 27 } 26 28 … … 48 50 if (mrb_obj_class(mrb, object) != mrb_class_get(mrb, "InlineStructTest")) 49 51 { 50 mrb_raise f(mrb, E_TYPE_ERROR, "Expected InlineStructTest");52 mrb_raise(mrb, E_TYPE_ERROR, "Expected InlineStructTest"); 51 53 } 52 54 return mrb_bool_value(((char*)mrb_istruct_ptr(object))[0] == 's');
Note:
See TracChangeset
for help on using the changeset viewer.