@@ -123,7 +123,9 @@ struct CPyCppyy_tagPyCArgObject { // not public (but stable; note that olde
123
123
#define ct_c_fcomplex 21
124
124
#define ct_c_complex 22
125
125
#define ct_c_pointer 23
126
- #define NTYPES 24
126
+ #define ct_c_int16 24
127
+ #define ct_c_int32 25
128
+ #define NTYPES 26
127
129
128
130
static std::array<const char *, NTYPES> gCTypesNames = {
129
131
" c_bool" , " c_char" , " c_wchar" , " c_byte" , " c_ubyte" , " c_short" , " c_ushort" , " c_uint16" ,
@@ -387,6 +389,10 @@ static inline type CPyCppyy_PyLong_As##name(PyObject* pyobject) \
387
389
388
390
CPPYY_PYLONG_AS_TYPE (UInt8 , uint8_t , 0 , UCHAR_MAX)
389
391
CPPYY_PYLONG_AS_TYPE(Int8, int8_t , SCHAR_MIN, SCHAR_MAX)
392
+ CPPYY_PYLONG_AS_TYPE(UInt16 , uint16_t , 0 , UINT16_MAX)
393
+ CPPYY_PYLONG_AS_TYPE(Int16, int16_t , INT16_MIN, INT16_MAX)
394
+ CPPYY_PYLONG_AS_TYPE(UInt32 , uint32_t , 0 , UINT32_MAX)
395
+ CPPYY_PYLONG_AS_TYPE(Int32, int32_t , INT_MIN, INT32_MAX)
390
396
CPPYY_PYLONG_AS_TYPE(UShort, unsigned short , 0 , USHRT_MAX)
391
397
CPPYY_PYLONG_AS_TYPE(Short, short , SHRT_MIN, SHRT_MAX)
392
398
CPPYY_PYLONG_AS_TYPE(StrictInt, int , INT_MIN, INT_MAX)
@@ -782,6 +788,10 @@ CPPYY_IMPL_BASIC_CONST_CHAR_REFCONVERTER(UChar, unsigned char, c_uchar, 0
782
788
CPPYY_IMPL_BASIC_CONST_REFCONVERTER(Bool, bool , c_bool, CPyCppyy_PyLong_AsBool)
783
789
CPPYY_IMPL_BASIC_CONST_REFCONVERTER(Int8, int8_t , c_int8, CPyCppyy_PyLong_AsInt8)
784
790
CPPYY_IMPL_BASIC_CONST_REFCONVERTER(UInt8 , uint8_t , c_uint8, CPyCppyy_PyLong_AsUInt8)
791
+ CPPYY_IMPL_BASIC_CONST_REFCONVERTER(Int16, int16_t , c_int16, CPyCppyy_PyLong_AsInt16)
792
+ CPPYY_IMPL_BASIC_CONST_REFCONVERTER(UInt16 , uint16_t , c_uint16, CPyCppyy_PyLong_AsUInt16)
793
+ CPPYY_IMPL_BASIC_CONST_REFCONVERTER(Int32, int32_t , c_int32, CPyCppyy_PyLong_AsInt32)
794
+ CPPYY_IMPL_BASIC_CONST_REFCONVERTER(UInt32 , uint32_t , c_uint32, CPyCppyy_PyLong_AsUInt32)
785
795
CPPYY_IMPL_BASIC_CONST_REFCONVERTER(Short, short , c_short, CPyCppyy_PyLong_AsShort)
786
796
CPPYY_IMPL_BASIC_CONST_REFCONVERTER(UShort, unsigned short , c_ushort, CPyCppyy_PyLong_AsUShort)
787
797
CPPYY_IMPL_BASIC_CONST_REFCONVERTER(Int, int , c_int, CPyCppyy_PyLong_AsStrictInt)
@@ -857,6 +867,10 @@ CPPYY_IMPL_REFCONVERTER(SChar, c_byte, signed char, 'b');
857
867
CPPYY_IMPL_REFCONVERTER (UChar, c_ubyte, unsigned char , ' B' );
858
868
CPPYY_IMPL_REFCONVERTER (Int8, c_int8, int8_t , ' b' );
859
869
CPPYY_IMPL_REFCONVERTER (UInt8 , c_uint8, uint8_t , ' B' );
870
+ CPPYY_IMPL_REFCONVERTER (Int16, c_int16, int16_t , ' h' );
871
+ CPPYY_IMPL_REFCONVERTER (UInt16 , c_uint16, uint16_t , ' H' );
872
+ CPPYY_IMPL_REFCONVERTER (Int32, c_int32, int32_t , ' i' );
873
+ CPPYY_IMPL_REFCONVERTER (UInt32 , c_uint32, uint32_t , ' I' );
860
874
CPPYY_IMPL_REFCONVERTER (Short, c_short, short , ' h' );
861
875
CPPYY_IMPL_REFCONVERTER (UShort, c_ushort, unsigned short , ' H' );
862
876
CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (Int, c_int);
@@ -1015,6 +1029,14 @@ CPPYY_IMPL_BASIC_CONVERTER_IB(
1015
1029
Int8, int8_t , long , c_int8, PyInt_FromLong, CPyCppyy_PyLong_AsInt8, ' l' )
1016
1030
CPPYY_IMPL_BASIC_CONVERTER_IB(
1017
1031
UInt8 , uint8_t , long , c_uint8, PyInt_FromLong, CPyCppyy_PyLong_AsUInt8, ' l' )
1032
+ CPPYY_IMPL_BASIC_CONVERTER_IB(
1033
+ Int16, int16_t , long , c_int16, PyInt_FromLong, CPyCppyy_PyLong_AsInt16, ' l' )
1034
+ CPPYY_IMPL_BASIC_CONVERTER_IB(
1035
+ UInt16 , uint16_t , long , c_uint16, PyInt_FromLong, CPyCppyy_PyLong_AsUInt16, ' l' )
1036
+ CPPYY_IMPL_BASIC_CONVERTER_IB(
1037
+ Int32, int32_t , long , c_int32, PyInt_FromLong, CPyCppyy_PyLong_AsInt32, ' l' )
1038
+ CPPYY_IMPL_BASIC_CONVERTER_IB(
1039
+ UInt32 , uint32_t , long , c_uint32, PyInt_FromLong, CPyCppyy_PyLong_AsUInt32, ' l' )
1018
1040
CPPYY_IMPL_BASIC_CONVERTER_IB(
1019
1041
Short, short , long , c_short, PyInt_FromLong, CPyCppyy_PyLong_AsShort, ' l' )
1020
1042
CPPYY_IMPL_BASIC_CONVERTER_IB(
@@ -1750,7 +1772,11 @@ CPPYY_IMPL_ARRAY_CONVERTER(UChar, c_ubyte, unsigned char, 'B', )
1750
1772
CPPYY_IMPL_ARRAY_CONVERTER (Byte , c_ubyte, std::byte, ' B' , )
1751
1773
#endif
1752
1774
CPPYY_IMPL_ARRAY_CONVERTER (Int8, c_byte, int8_t , ' b' , _i8)
1775
+ CPPYY_IMPL_ARRAY_CONVERTER(Int16, c_byte, int16_t , ' h' , _i16)
1776
+ CPPYY_IMPL_ARRAY_CONVERTER(Int32, c_byte, int32_t , ' i' , _i32)
1753
1777
CPPYY_IMPL_ARRAY_CONVERTER(UInt8 , c_ubyte, uint8_t , ' B' , _i8)
1778
+ CPPYY_IMPL_ARRAY_CONVERTER(UInt16 , c_byte, int16_t , ' H' , _i16)
1779
+ CPPYY_IMPL_ARRAY_CONVERTER(UInt32 , c_byte, int32_t , ' I' , _i32)
1754
1780
CPPYY_IMPL_ARRAY_CONVERTER(Short, c_short, short , ' h' , )
1755
1781
CPPYY_IMPL_ARRAY_CONVERTER(UShort, c_ushort, unsigned short , ' H' , )
1756
1782
CPPYY_IMPL_ARRAY_CONVERTER(Int, c_int, int , ' i' , )
@@ -3464,8 +3490,12 @@ static struct InitConvFactories_t {
3464
3490
gf[" char16_t&" ] = (cf_t )+[](cdims_t ) { static Char16RefConverter c{}; return &c; };
3465
3491
gf[" char32_t&" ] = (cf_t )+[](cdims_t ) { static Char32RefConverter c{}; return &c; };
3466
3492
gf[" int8_t" ] = (cf_t )+[](cdims_t ) { static Int8Converter c{}; return &c; };
3493
+ gf[" int16_t" ] = (cf_t )+[](cdims_t ) { static Int16Converter c{}; return &c; };
3494
+ gf[" int32_t" ] = (cf_t )+[](cdims_t ) { static Int32Converter c{}; return &c; };
3467
3495
gf[" const int8_t&" ] = (cf_t )+[](cdims_t ) { static ConstInt8RefConverter c{}; return &c; };
3468
3496
gf[" int8_t&" ] = (cf_t )+[](cdims_t ) { static Int8RefConverter c{}; return &c; };
3497
+ gf[" int16_t&" ] = (cf_t )+[](cdims_t ) { static Int16RefConverter c{}; return &c; };
3498
+ gf[" int32_t&" ] = (cf_t )+[](cdims_t ) { static Int32RefConverter c{}; return &c; };
3469
3499
gf[" uint8_t" ] = (cf_t )+[](cdims_t ) { static UInt8Converter c{}; return &c; };
3470
3500
gf[" const uint8_t&" ] = (cf_t )+[](cdims_t ) { static ConstUInt8RefConverter c{}; return &c; };
3471
3501
gf[" uint8_t&" ] = (cf_t )+[](cdims_t ) { static UInt8RefConverter c{}; return &c; };
@@ -3476,7 +3506,11 @@ static struct InitConvFactories_t {
3476
3506
gf[" const unsigned short&" ] = (cf_t )+[](cdims_t ) { static ConstUShortRefConverter c{}; return &c; };
3477
3507
gf[" unsigned short&" ] = (cf_t )+[](cdims_t ) { static UShortRefConverter c{}; return &c; };
3478
3508
gf[" int" ] = (cf_t )+[](cdims_t ) { static IntConverter c{}; return &c; };
3509
+ // gf["int16_t"] = gf["short"];
3510
+ // gf["int32_t"] = gf["int"];
3479
3511
gf[" int&" ] = (cf_t )+[](cdims_t ) { static IntRefConverter c{}; return &c; };
3512
+ // gf["int16_t&"] = gf["short&"];
3513
+ // gf["int32_t&"] = gf["int&"];
3480
3514
gf[" const int&" ] = (cf_t )+[](cdims_t ) { static ConstIntRefConverter c{}; return &c; };
3481
3515
gf[" unsigned int" ] = (cf_t )+[](cdims_t ) { static UIntConverter c{}; return &c; };
3482
3516
gf[" const unsigned int&" ] = (cf_t )+[](cdims_t ) { static ConstUIntRefConverter c{}; return &c; };
@@ -3521,10 +3555,15 @@ static struct InitConvFactories_t {
3521
3555
gf[" std::byte ptr" ] = (cf_t )+[](cdims_t d) { return new ByteArrayConverter{d}; };
3522
3556
#endif
3523
3557
gf[" int8_t ptr" ] = (cf_t )+[](cdims_t d) { return new Int8ArrayConverter{d}; };
3558
+ gf[" int16_t ptr" ] = (cf_t )+[](cdims_t d) { return new Int16ArrayConverter{d}; };
3559
+ gf[" int32_t ptr" ] = (cf_t )+[](cdims_t d) { return new Int32ArrayConverter{d}; };
3524
3560
gf[" uint8_t ptr" ] = (cf_t )+[](cdims_t d) { return new UInt8ArrayConverter{d}; };
3525
3561
gf[" short ptr" ] = (cf_t )+[](cdims_t d) { return new ShortArrayConverter{d}; };
3562
+ // Upstream cppyy resolves int16_t to short (TClasssEdit::ResolveTypedef), this is another approach that can fix the issue
3563
+ // gf["int16_t ptr"] = gf["short ptr"];
3526
3564
gf[" unsigned short ptr" ] = (cf_t )+[](cdims_t d) { return new UShortArrayConverter{d}; };
3527
3565
gf[" int ptr" ] = (cf_t )+[](cdims_t d) { return new IntArrayConverter{d}; };
3566
+ // gf["int32_t ptr"] = gf["int ptr"];
3528
3567
gf[" unsigned int ptr" ] = (cf_t )+[](cdims_t d) { return new UIntArrayConverter{d}; };
3529
3568
gf[" long ptr" ] = (cf_t )+[](cdims_t d) { return new LongArrayConverter{d}; };
3530
3569
gf[" unsigned long ptr" ] = (cf_t )+[](cdims_t d) { return new ULongArrayConverter{d}; };
0 commit comments