[Qtcsharp-patches] Bugtussle/src/Writers KylixWriter.cs,1.10,1.11
Status: Inactive
Brought to you by:
manyoso
From: Andreas H. <ah...@us...> - 2004-10-11 19:03:06
|
Update of /cvsroot/qtcsharp/Bugtussle/src/Writers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3697/src/Writers Modified Files: KylixWriter.cs Log Message: QRectH -> PRect QPointH -> PPoint Index: KylixWriter.cs =================================================================== RCS file: /cvsroot/qtcsharp/Bugtussle/src/Writers/KylixWriter.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** KylixWriter.cs 1 Oct 2004 11:33:31 -0000 1.10 --- KylixWriter.cs 11 Oct 2004 19:02:49 -0000 1.11 *************** *** 14,17 **** --- 14,22 ---- }; + private enum NativeType { + Yes, + No + } + public enum PointerRequire { None, // name *************** *** 566,570 **** string s; ! if(IsClass(td)) typeName += "H"; else if(td.Reference is FunctionPtr) --- 571,575 ---- string s; ! if(IsClass(td, NativeType.No)) typeName += "H"; else if(td.Reference is FunctionPtr) *************** *** 1586,1590 **** if(value.IndexOf('(') > 0 && value.IndexOf(')') > 0) { ! if(t.Mode != PassByMode.Value || IsClass(tb) || IsPointer(tb)) return "nil"; else --- 1591,1595 ---- if(value.IndexOf('(') > 0 && value.IndexOf(')') > 0) { ! if(t.Mode != PassByMode.Value || IsClass(tb, NativeType.Yes) || IsPointer(tb)) return "nil"; else *************** *** 1601,1605 **** if(tb == null) tb = API.GetTypeByName(cname); ! if(IsClass(tb)) { string v = ParseEnumValue(value.Substring(pos + 2), null, (Class)tb); --- 1606,1610 ---- if(tb == null) tb = API.GetTypeByName(cname); ! if(IsClass(tb, NativeType.Yes)) { string v = ParseEnumValue(value.Substring(pos + 2), null, (Class)tb); *************** *** 1630,1634 **** if((value == "0" || value == "NULL") && ! (t.Mode == PassByMode.Pointer || IsClass(tb))) // classes are always references/pointers return "nil"; --- 1635,1639 ---- if((value == "0" || value == "NULL") && ! (t.Mode == PassByMode.Pointer || IsClass(tb, NativeType.Yes))) // classes are always references/pointers return "nil"; *************** *** 1639,1643 **** if(!ParseEnumValueEx(value, null, container, null, out ret)) ret = "0"; ! if(ret == "0" && t.Mode != PassByMode.Value || IsClass(tb) || IsPointer(tb)) ret = "nil"; return ret; --- 1644,1648 ---- if(!ParseEnumValueEx(value, null, container, null, out ret)) ret = "0"; ! if(ret == "0" && t.Mode != PassByMode.Value || IsClass(tb, NativeType.Yes) || IsPointer(tb)) ret = "nil"; return ret; *************** *** 1673,1680 **** } /* Returns true if the type if a Class or a typedef to a Class. */ ! private bool IsClass(TypeBase tb) { ! if(tb != null && tb.Name == "QChar") return false; if(tb is Class) --- 1678,1696 ---- } + private bool IsNativeType(string typeName) + { + return typeName == "QChar"; + } + + private void ChangeToNativeType(ref string typeName) + { + if(typeName == "QChar") + typeName = "WideChar"; + } + /* Returns true if the type if a Class or a typedef to a Class. */ ! private bool IsClass(TypeBase tb, NativeType nt) { ! if(tb != null && (nt == NativeType.Yes && IsNativeType(tb.Name))) return false; if(tb is Class) *************** *** 1683,1687 **** { Typedef td = (Typedef)tb; ! bool ret = IsClass(td.Reference); if(ret && td.TypeRef != null && td.TypeRef.Mode != PassByMode.Value) ret = false; --- 1699,1703 ---- { Typedef td = (Typedef)tb; ! bool ret = IsClass(td.Reference, nt); if(ret && td.TypeRef != null && td.TypeRef.Mode != PassByMode.Value) ret = false; *************** *** 1746,1750 **** else if(typeName != "Pointer") { ! if(!IsClass(tb) && !IsPointer(tb) && !(tb is Enum)) return 'P' + typeName; } --- 1762,1766 ---- else if(typeName != "Pointer") { ! if(!IsClass(tb, NativeType.Yes) && !IsPointer(tb) && !(tb is Enum)) return 'P' + typeName; } *************** *** 1788,1792 **** modifier = ""; ! if(IsClass(tb)) { // class instances are always passed by reference/pointer --- 1804,1808 ---- modifier = ""; ! if(IsClass(tb, NativeType.Yes)) { // class instances are always passed by reference/pointer *************** *** 1829,1833 **** } else ! { // isClass switch(t.Mode) { --- 1845,1849 ---- } else ! { switch(t.Mode) { *************** *** 1845,1850 **** else { ! if(typeName == "QChar") ! typeName = "WideChar"; switch(t.Mode) --- 1861,1865 ---- else { ! ChangeToNativeType(ref typeName); switch(t.Mode) *************** *** 1980,1989 **** // ANN: Maybe move this to GetTypeMode ! if(PCharToString && modifier == "" && parameters[i].Type.Const && typeName == "PChar" ) { ! // ANN: Maybe limit this to QObjectH.connect/disconnect where it works in all cases. ! modifier = "const"; ! typeName = "string"; } if(modifier != "") --- 1995,2011 ---- // ANN: Maybe move this to GetTypeMode ! if(modifier == "" && parameters[i].Type.Const) { ! if(PCharToString && typeName == "PChar" ) ! { ! modifier = "const"; ! typeName = "string"; ! } } + // for easier handling QRect is binary compatible to TRect and QPoint to TPoint + if(typeName == "QRectH" ) + typeName = "PRect"; + else if(typeName == "QPointH" ) + typeName = "PPoint"; if(modifier != "") *************** *** 2064,2068 **** cw.WriteLine("uses"); cw.Indent++; ! cw.WriteLine("{0}Library;", ApiName); cw.Indent--; cw.WriteLine(); --- 2086,2090 ---- cw.WriteLine("uses"); cw.Indent++; ! cw.WriteLine("{0}Library, Types;", ApiName); cw.Indent--; cw.WriteLine(); |