@@ -44,11 +44,6 @@ class Program
4444 { "float&" , "float*" } ,
4545 { "ImVec2[2]" , "Vector2*" } ,
4646 { "char* []" , "byte**" } ,
47-
48- // TODO: These shouldn't exist
49- { "ImVector_ImWchar" , "ImVector" } ,
50- { "ImVector_TextRange" , "ImVector" } ,
51- { "ImVector_TextRange&" , "ImVector*" } ,
5247 } ;
5348
5449 private static readonly Dictionary < string , string > s_wellKnownFieldReplacements = new Dictionary < string , string > ( )
@@ -170,7 +165,8 @@ static void Main(string[] args)
170165 {
171166 string ov_cimguiname = val [ "ov_cimguiname" ] ? . ToString ( ) ;
172167 string cimguiname = val [ "cimguiname" ] . ToString ( ) ;
173- string friendlyName = val [ "funcname" ] . ToString ( ) ;
168+ string friendlyName = val [ "funcname" ] ? . ToString ( ) ;
169+ if ( friendlyName == null ) { return null ; }
174170
175171 string exportedName = ov_cimguiname ;
176172 if ( exportedName == null )
@@ -191,10 +187,6 @@ static void Main(string[] args)
191187 }
192188
193189 List < TypeReference > parameters = new List < TypeReference > ( ) ;
194- if ( selfTypeName != null )
195- {
196- parameters . Add ( new TypeReference ( "self" , selfTypeName + "*" , enums ) ) ;
197- }
198190
199191 foreach ( JToken p in val [ "argsT" ] )
200192 {
@@ -624,8 +616,11 @@ private static void EmitOverload(
624616 else
625617 {
626618 preCallLines . Add ( $ "byte* { nativeArgName } ;") ;
627- preCallLines . Add ( $ "if ({ textToEncode } != null)") ;
628- preCallLines . Add ( "{" ) ;
619+ if ( ! hasDefault )
620+ {
621+ preCallLines . Add ( $ "if ({ textToEncode } != null)") ;
622+ preCallLines . Add ( "{" ) ;
623+ }
629624 preCallLines . Add ( $ " int { correctedIdentifier } _byteCount = Encoding.UTF8.GetByteCount({ textToEncode } );") ;
630625 preCallLines . Add ( $ " byte* { nativeArgName } _stackBytes = stackalloc byte[{ correctedIdentifier } _byteCount + 1];") ;
631626 preCallLines . Add ( $ " { nativeArgName } = { nativeArgName } _stackBytes;") ;
@@ -634,8 +629,11 @@ private static void EmitOverload(
634629 preCallLines . Add ( $ " int { nativeArgName } _offset = Encoding.UTF8.GetBytes({ correctedIdentifier } _ptr, { textToEncode } .Length, { nativeArgName } , { correctedIdentifier } _byteCount);") ;
635630 preCallLines . Add ( $ " { nativeArgName } [{ nativeArgName } _offset] = 0;") ;
636631 preCallLines . Add ( " }" ) ;
637- preCallLines . Add ( "}" ) ;
638- preCallLines . Add ( $ "else {{ { nativeArgName } = null; }}") ;
632+ if ( ! hasDefault )
633+ {
634+ preCallLines . Add ( "}" ) ;
635+ preCallLines . Add ( $ "else {{ { nativeArgName } = null; }}") ;
636+ }
639637 }
640638 }
641639 else if ( tr . Type == "char* []" )
@@ -727,7 +725,7 @@ private static void EmitOverload(
727725 nonPtrType = GetTypeString ( tr . Type . Substring ( 0 , tr . Type . Length - 1 ) , false ) ;
728726 }
729727 string nativeArgName = "native_" + tr . Name ;
730- bool isOutParam = tr . Name . Contains ( "out_" ) ;
728+ bool isOutParam = tr . Name . Contains ( "out_" ) || tr . Name == "out" ;
731729 string direction = isOutParam ? "out" : "ref" ;
732730 marshalledParameters [ i ] = new MarshalledParameter ( $ "{ direction } { nonPtrType } ", true , nativeArgName , false ) ;
733731 marshalledParameters [ i ] . PinTarget = CorrectIdentifier ( tr . Name ) ;
@@ -853,7 +851,7 @@ private static string GetSafeType(TypeReference typeRef)
853851
854852 private static bool GetWrappedType ( string nativeType , out string wrappedType )
855853 {
856- if ( nativeType . StartsWith ( "Im" ) && nativeType . EndsWith ( "*" ) )
854+ if ( nativeType . StartsWith ( "Im" ) && nativeType . EndsWith ( "*" ) && ! nativeType . StartsWith ( "ImVector" ) )
857855 {
858856 int pointerLevel = nativeType . Length - nativeType . IndexOf ( '*' ) ;
859857 if ( pointerLevel > 1 )
@@ -1031,6 +1029,20 @@ public TypeReference(string name, string type, string templateType, EnumDefiniti
10311029 {
10321030 Name = name ;
10331031 Type = type . Replace ( "const" , string . Empty ) . Trim ( ) ;
1032+
1033+
1034+ if ( Type . StartsWith ( "ImVector_" ) )
1035+ {
1036+ if ( Type . EndsWith ( "*" ) )
1037+ {
1038+ Type = "ImVector*" ;
1039+ }
1040+ else
1041+ {
1042+ Type = "ImVector" ;
1043+ }
1044+ }
1045+
10341046 TemplateType = templateType ;
10351047 int startBracket = name . IndexOf ( '[' ) ;
10361048 if ( startBracket != - 1 )
0 commit comments