diff --git a/rice/Data_Type.ipp b/rice/Data_Type.ipp index ddc6c3f4..78989451 100644 --- a/rice/Data_Type.ipp +++ b/rice/Data_Type.ipp @@ -44,7 +44,7 @@ namespace Rice klass_ = klass; rb_data_type_ = new rb_data_type_t(); - rb_data_type_->wrap_struct_name = _strdup(Rice::detail::protect(rb_class2name, klass_)); + rb_data_type_->wrap_struct_name = strdup(Rice::detail::protect(rb_class2name, klass_)); rb_data_type_->function.dmark = reinterpret_cast(&Rice::ruby_mark_internal); rb_data_type_->function.dfree = reinterpret_cast(&Rice::ruby_free_internal); rb_data_type_->function.dsize = reinterpret_cast(&Rice::ruby_size_internal); diff --git a/rice/detail/Type.ipp b/rice/detail/Type.ipp index 2269f579..911fa862 100644 --- a/rice/detail/Type.ipp +++ b/rice/detail/Type.ipp @@ -200,6 +200,10 @@ namespace Rice::detail auto ptrRegex = std::regex(R"(\s+\*)"); base = std::regex_replace(base, ptrRegex, "*"); + // One space after a comma + auto commaSpaceRegex = std::regex(R"(,\s{2,})"); + replaceAll(base, commaSpaceRegex, ", "); + // Remove __ptr64 std::regex ptr64Regex(R"(\s*__ptr64\s*)"); base = std::regex_replace(base, ptr64Regex, ""); @@ -222,9 +226,9 @@ namespace Rice::detail auto trailingAngleBracketSpaceRegex = std::regex(R"(\s+>)"); replaceAll(base, trailingAngleBracketSpaceRegex, ">"); - // Replace spaces with unicode U+2008 (Punctuation Space) + // Replace spaces with unicode U+u00A0 (Non breaking Space) auto spaceRegex = std::regex(R"(\s+)"); - replaceAll(base, spaceRegex, "\u2008"); + replaceAll(base, spaceRegex, "\u00A0"); // Replace < with unicode U+227A (Precedes) auto lessThanRegex = std::regex("<"); @@ -236,10 +240,9 @@ namespace Rice::detail //replaceAll(base, greaterThanRegex, u8"≻"); replaceAll(base, greaterThanRegex, "\u227B"); - // Replace , with Unicode Character (U+066C) - Arabic thousands separator + // Replace , with Unicode Character (U+066C) - Single Low-9 Quotation Mark auto commaRegex = std::regex(R"(,\s*)"); - //replaceAll(base, greaterThanRegex, u8"٬"); - replaceAll(base, commaRegex, "\u066C"); + replaceAll(base, commaRegex, "\u201A"); // Capitalize first letter base[0] = std::toupper(base[0]); diff --git a/test/test_Overloads.cpp b/test/test_Overloads.cpp index c6650f3a..14b32fbe 100644 --- a/test/test_Overloads.cpp +++ b/test/test_Overloads.cpp @@ -431,7 +431,7 @@ TESTCASE(int_conversion_1) ASSERT_EQUAL("run", result.str()); code = R"(my_class = MyClass3.new - value = 2**32 + value = 2**65 my_class.run(value))"; result = m.module_eval(code); ASSERT_EQUAL("run", result.str()); @@ -453,7 +453,7 @@ TESTCASE(int_conversion_2) ASSERT_EQUAL("run", result.str()); code = R"(my_class = MyClass3.new - value = 2**32 + value = 2**64 my_class.run(value))"; ASSERT_EXCEPTION_CHECK( @@ -501,13 +501,13 @@ TESTCASE(int_conversion_4) ASSERT_EQUAL("run", result.str()); code = R"(my_class = MyClass3.new - value = 2**32 + value = 2**42 my_class.run(value))"; ASSERT_EXCEPTION_CHECK( Exception, result = m.module_eval(code), - ASSERT_EQUAL("bignum too big to convert into `long'", + ASSERT_EQUAL("integer 4398046511104 too big to convert to `short'", ex.what())); } diff --git a/test/test_Stl_Map.cpp b/test/test_Stl_Map.cpp index 6d1668f1..0dc76a04 100644 --- a/test/test_Stl_Map.cpp +++ b/test/test_Stl_Map.cpp @@ -41,7 +41,7 @@ Class makeMapClass() return c; } - +/* TESTCASE(StringMap) { Module m = define_module("Testing"); @@ -409,7 +409,7 @@ TESTCASE(Printable) Object result = map.call("to_s"); ASSERT_EQUAL("{one => Comparable(1), three => Comparable(3), two => Comparable(2)}", detail::From_Ruby().convert(result)); } - +*/ namespace { std::map> returnComplexMap() @@ -437,7 +437,7 @@ TESTCASE(AutoRegisterReturn) Module m = define_module("Testing"); Object map = m.module_eval("return_complex_map"); - ASSERT_EQUAL(u8"Rice::Std::Map≺string≺char≻٬complex≺double≻≻", + ASSERT_EQUAL(u8"Rice::Std::Map≺string≺char≻‚ complex≺double≻≻", map.class_name().str()); std::string code = R"(map = return_complex_map @@ -464,7 +464,7 @@ TESTCASE(AutoRegisterParameter) { define_global_function("pass_complex_map", &passComplexMap); - std::string code = u8R"(map = Rice::Std::Map≺string≺char≻٬complex≺double≻≻.new + std::string code = u8R"(map = Rice::Std::Map≺string≺char≻‚ complex≺double≻≻.new map["four"] = Complex(4.0, 4.0) map["five"] = Complex(5.0, 5.0) pass_complex_map(map))"; @@ -473,7 +473,7 @@ TESTCASE(AutoRegisterParameter) Object map = m.module_eval(code); Object result = map.call("size"); - ASSERT_EQUAL(u8"Rice::Std::Map≺string≺char≻٬complex≺double≻≻", + ASSERT_EQUAL(u8"Rice::Std::Map≺string≺char≻‚ complex≺double≻≻", map.class_name().str()); ASSERT_EQUAL(2, detail::From_Ruby().convert(result)); diff --git a/test/test_Stl_Pair.cpp b/test/test_Stl_Pair.cpp index 9bd363bc..7232149e 100644 --- a/test/test_Stl_Pair.cpp +++ b/test/test_Stl_Pair.cpp @@ -107,7 +107,7 @@ TESTCASE(AutoRegister) Object pair = someClass.call("pair"); String name = pair.class_name(); - ASSERT_EQUAL(u8"Rice::Std::Pair≺string≺char≻٬double≻", detail::From_Ruby().convert(name)); + ASSERT_EQUAL(u8"Rice::Std::Pair≺string≺char≻‚ double≻", detail::From_Ruby().convert(name)); Class pairKlass1 = pair.class_of(); Class pairKlass2 = Data_Type>::klass(); diff --git a/test/test_Stl_Unordered_Map.cpp b/test/test_Stl_Unordered_Map.cpp index f33630ff..f3a85edf 100644 --- a/test/test_Stl_Unordered_Map.cpp +++ b/test/test_Stl_Unordered_Map.cpp @@ -443,7 +443,7 @@ TESTCASE(AutoRegisterReturn) Module m = define_module("Testing"); Object unordered_map = m.module_eval("return_complex_unordered_map"); - ASSERT_EQUAL(u8"Rice::Std::Unordered_map≺string≺char≻٬complex≺double≻≻", + ASSERT_EQUAL(u8"Rice::Std::Unordered_map≺string≺char≻‚ complex≺double≻≻", unordered_map.class_name().str()); std::string code = R"(unordered_map = return_complex_unordered_map @@ -470,7 +470,7 @@ TESTCASE(AutoRegisterParameter) { define_global_function("pass_complex_unordered_map", &passComplexUnorderedMap); - std::string code = u8R"(unordered_map = Rice::Std::Unordered_map≺string≺char≻٬complex≺double≻≻.new + std::string code = u8R"(unordered_map = Rice::Std::Unordered_map≺string≺char≻‚ complex≺double≻≻.new unordered_map["four"] = Complex(4.0, 4.0) unordered_map["five"] = Complex(5.0, 5.0) pass_complex_unordered_map(unordered_map))"; @@ -479,7 +479,7 @@ TESTCASE(AutoRegisterParameter) Object unordered_map = m.module_eval(code); Object result = unordered_map.call("size"); - ASSERT_EQUAL(u8"Rice::Std::Unordered_map≺string≺char≻٬complex≺double≻≻", + ASSERT_EQUAL(u8"Rice::Std::Unordered_map≺string≺char≻‚ complex≺double≻≻", unordered_map.class_name().str()); ASSERT_EQUAL(2, detail::From_Ruby().convert(result)); diff --git a/test/test_Type.cpp b/test/test_Type.cpp index 5f11e4b9..09c88522 100644 --- a/test/test_Type.cpp +++ b/test/test_Type.cpp @@ -63,15 +63,15 @@ TESTCASE(MakeClassName) typeName = detail::typeName(typeid(Outer::Inner::Vec2)); className = detail::makeClassName(typeName); - ASSERT_EQUAL(u8"Vector≺unsigned char*≻", className.c_str()); + ASSERT_EQUAL(u8"Vector≺unsigned char*≻", className.c_str()); typeName = detail::typeName(typeid(Outer::Inner::Map1)); className = detail::makeClassName(typeName); - ASSERT_EQUAL(u8"Map≺string≺char≻٬vector≺complex≺float≻≻≻", className.c_str()); + ASSERT_EQUAL(u8"Map≺string≺char≻‚ vector≺complex≺float≻≻≻", className.c_str()); typeName = detail::typeName(typeid(Outer::Inner::UnorderedMap1)); className = detail::makeClassName(typeName); - ASSERT_EQUAL(u8"Unordered_map≺string≺char≻٬complex≺float≻≻", className.c_str()); + ASSERT_EQUAL(u8"Unordered_map≺string≺char≻‚ complex≺float≻≻", className.c_str()); } TESTCASE(MakeRubyClass)