ikvm-commit Mailing List for IKVM.NET (Page 231)
Brought to you by:
jfrijters
You can subscribe to this list here.
2007 |
Jan
(25) |
Feb
(22) |
Mar
(32) |
Apr
(77) |
May
(111) |
Jun
(129) |
Jul
(223) |
Aug
(109) |
Sep
(60) |
Oct
(60) |
Nov
(36) |
Dec
(55) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(23) |
Feb
(76) |
Mar
(42) |
Apr
(49) |
May
(33) |
Jun
(64) |
Jul
(19) |
Aug
(124) |
Sep
(16) |
Oct
|
Nov
(87) |
Dec
(54) |
2009 |
Jan
(53) |
Feb
(116) |
Mar
(86) |
Apr
(64) |
May
(101) |
Jun
(99) |
Jul
(105) |
Aug
(63) |
Sep
(20) |
Oct
(110) |
Nov
(102) |
Dec
(36) |
2010 |
Jan
(87) |
Feb
(67) |
Mar
(5) |
Apr
(100) |
May
(178) |
Jun
(95) |
Jul
(22) |
Aug
(85) |
Sep
(82) |
Oct
(99) |
Nov
(119) |
Dec
(132) |
2011 |
Jan
(130) |
Feb
(18) |
Mar
(114) |
Apr
(8) |
May
(21) |
Jun
(53) |
Jul
(127) |
Aug
(111) |
Sep
(29) |
Oct
(28) |
Nov
(64) |
Dec
(94) |
2012 |
Jan
(56) |
Feb
(8) |
Mar
(65) |
Apr
(48) |
May
(22) |
Jun
(52) |
Jul
(73) |
Aug
(38) |
Sep
(18) |
Oct
(59) |
Nov
(16) |
Dec
(21) |
2013 |
Jan
(83) |
Feb
(151) |
Mar
(102) |
Apr
(13) |
May
(37) |
Jun
(1) |
Jul
(7) |
Aug
(42) |
Sep
(28) |
Oct
(13) |
Nov
(5) |
Dec
(3) |
2014 |
Jan
(3) |
Feb
(39) |
Mar
(11) |
Apr
(40) |
May
(62) |
Jun
(54) |
Jul
(21) |
Aug
(3) |
Sep
|
Oct
(15) |
Nov
(26) |
Dec
(7) |
2015 |
Jan
(6) |
Feb
(12) |
Mar
(51) |
Apr
(15) |
May
(7) |
Jun
(41) |
Jul
(2) |
Aug
(8) |
Sep
(5) |
Oct
(6) |
Nov
(11) |
Dec
(1) |
2016 |
Jan
|
Feb
(1) |
Mar
|
Apr
(1) |
May
|
Jun
(2) |
Jul
(19) |
Aug
(2) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
(2) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Jeroen F. <jfr...@us...> - 2007-02-03 14:26:20
|
Update of /cvsroot/ikvm/ikvm/ikvmstub In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv8093/ikvmstub Modified Files: AssemblyInfo.cs Log Message: Updated year in copyright messages. Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/ikvmstub/AssemblyInfo.cs,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** AssemblyInfo.cs 11 Dec 2006 13:13:28 -0000 1.29 --- AssemblyInfo.cs 3 Feb 2007 14:26:18 -0000 1.30 *************** *** 35,39 **** [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IKVM.NET")] ! [assembly: AssemblyCopyright("Copyright (C) 2002-2006 Jeroen Frijters")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] --- 35,39 ---- [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IKVM.NET")] ! [assembly: AssemblyCopyright("Copyright (C) 2002-2007 Jeroen Frijters")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] |
From: Jeroen F. <jfr...@us...> - 2007-02-03 14:26:20
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv8093/runtime Modified Files: AssemblyInfo.cs Log Message: Updated year in copyright messages. Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/AssemblyInfo.cs,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** AssemblyInfo.cs 11 Dec 2006 13:13:28 -0000 1.32 --- AssemblyInfo.cs 3 Feb 2007 14:26:18 -0000 1.33 *************** *** 35,39 **** [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IKVM.NET")] ! [assembly: AssemblyCopyright("Copyright (C) 2002-2006 Jeroen Frijters")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] --- 35,39 ---- [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IKVM.NET")] ! [assembly: AssemblyCopyright("Copyright (C) 2002-2007 Jeroen Frijters")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] |
From: Jeroen F. <jfr...@us...> - 2007-02-03 14:26:19
|
Update of /cvsroot/ikvm/ikvm/ikvm In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv8093/ikvm Modified Files: AssemblyInfo.cs Log Message: Updated year in copyright messages. Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/ikvm/AssemblyInfo.cs,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** AssemblyInfo.cs 11 Dec 2006 13:13:27 -0000 1.30 --- AssemblyInfo.cs 3 Feb 2007 14:26:17 -0000 1.31 *************** *** 35,39 **** [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IKVM.NET")] ! [assembly: AssemblyCopyright("Copyright (C) 2002-2006 Jeroen Frijters")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] --- 35,39 ---- [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IKVM.NET")] ! [assembly: AssemblyCopyright("Copyright (C) 2002-2007 Jeroen Frijters")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] |
From: Jeroen F. <jfr...@us...> - 2007-02-03 14:23:45
|
Update of /cvsroot/ikvm/ikvm/classpath/gnu/classpath In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv6965/classpath/gnu/classpath Modified Files: VMSystemProperties.java Log Message: Fixed system property initialization to handle case where IKVM.GNU.Classpath doesn't have a Location Index: VMSystemProperties.java =================================================================== RCS file: /cvsroot/ikvm/ikvm/classpath/gnu/classpath/VMSystemProperties.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** VMSystemProperties.java 5 Sep 2006 04:53:16 -0000 1.20 --- VMSystemProperties.java 3 Feb 2007 14:23:44 -0000 1.21 *************** *** 1,4 **** /* ! Copyright (C) 2004, 2005, 2006 Jeroen Frijters This software is provided 'as-is', without any express or implied --- 1,4 ---- /* ! Copyright (C) 2004, 2005, 2006, 2007 Jeroen Frijters This software is provided 'as-is', without any express or implied *************** *** 118,122 **** // HACK using the Assembly.Location property isn't correct cli.System.Reflection.Assembly asm = cli.System.Reflection.Assembly.GetExecutingAssembly(); ! p.setProperty("java.home", new cli.System.IO.FileInfo(GetAssemblyLocation(asm)).get_DirectoryName()); } catch(cli.System.MissingMethodException _1) --- 118,133 ---- // HACK using the Assembly.Location property isn't correct cli.System.Reflection.Assembly asm = cli.System.Reflection.Assembly.GetExecutingAssembly(); ! String loc = GetAssemblyLocation(asm); ! if(loc.length() == 0) ! { ! // The assembly was most likely loaded with Assembly.Load(byte[]) and so it doesn't ! // have a location. ! // TODO we may need to set some other value here ! p.setProperty("java.home", "."); ! } ! else ! { ! p.setProperty("java.home", new cli.System.IO.FileInfo(loc).get_DirectoryName()); ! } } catch(cli.System.MissingMethodException _1) |
From: Jeroen F. <jfr...@us...> - 2007-02-03 14:17:02
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv4304/runtime Modified Files: MemberWrapper.cs Log Message: Fixed workaround for Mono bug (lack of proper token support in reflection emit api) Index: MemberWrapper.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/MemberWrapper.cs,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** MemberWrapper.cs 6 Jan 2007 07:13:11 -0000 1.65 --- MemberWrapper.cs 3 Feb 2007 14:16:58 -0000 1.66 *************** *** 1298,1302 **** foreach(FieldInfo f in DeclaringType.TypeAsTBD.GetFields(bindings)) { ! if(f.Name == field.Name && f.FieldType == field.FieldType) { return f; --- 1298,1302 ---- foreach(FieldInfo f in DeclaringType.TypeAsTBD.GetFields(bindings)) { ! if(f.Name == field.Name && f.FieldType.Equals(field.FieldType)) { return f; |
From: Jeroen F. <jfr...@us...> - 2007-02-01 12:41:24
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv26998/runtime Modified Files: TypeWrapper.cs Log Message: - fixed handling of bridge methods with covariant return types in ikvmc (to allow other .NET languages to call these methods) - added EditorBrowsable(Never) attribute to bridge and synthetic methods Index: TypeWrapper.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/TypeWrapper.cs,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** TypeWrapper.cs 1 Feb 2007 07:13:02 -0000 1.155 --- TypeWrapper.cs 1 Feb 2007 12:41:22 -0000 1.156 *************** *** 6135,6138 **** --- 6135,6155 ---- } string name = m.Name; + #if STATIC_COMPILER + if((m.Modifiers & Modifiers.Bridge) != 0 && (m.IsPublic || m.IsProtected) && wrapper.IsPublic) + { + string sigbase = m.Signature.Substring(0, m.Signature.LastIndexOf(')') + 1); + foreach(MethodWrapper mw in methods) + { + if(mw.Name == m.Name && mw.Signature.StartsWith(sigbase) && mw.Signature != m.Signature) + { + // To prevent bridge methods with covariant return types from confusing + // other .NET compilers (like C#), we rename the bridge method. + name = "<bridge>" + name; + setNameSig = true; + break; + } + } + } + #endif // if a method is virtual, we need to find the method it overrides (if any), for several reasons: // - if we're overriding a method that has a different name (e.g. some of the virtual methods *************** *** 6331,6334 **** --- 6348,6366 ---- } } + if((m.Modifiers & (Modifiers.Synthetic | Modifiers.Bridge)) != 0 + && (m.IsPublic || m.IsProtected) && wrapper.IsPublic) + { + if(method is ConstructorBuilder) + { + AttributeHelper.SetEditorBrowsableNever((ConstructorBuilder)method); + } + else + { + AttributeHelper.SetEditorBrowsableNever((MethodBuilder)method); + } + #if WHIDBEY + // TODO apply CompilerGeneratedAttribute + #endif + } if(m.DeprecatedAttribute) { |
From: Jeroen F. <jfr...@us...> - 2007-02-01 08:35:12
|
Update of /cvsroot/ikvm/ikvm/classpath In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21426/classpath Modified Files: allsources.lst exclude.lst Log Message: - added ikvm.internal.LibraryVMInterface to exclude.lst to prevent new ikvmc warning message Index: allsources.lst =================================================================== RCS file: /cvsroot/ikvm/ikvm/classpath/allsources.lst,v retrieving revision 1.171 retrieving revision 1.172 diff -C2 -d -r1.171 -r1.172 *** allsources.lst 21 Jan 2007 10:10:00 -0000 1.171 --- allsources.lst 1 Feb 2007 08:35:04 -0000 1.172 *************** *** 646,650 **** ../../classpath/gnu/java/math/Fixed.java ../../classpath/gnu/java/math/MPN.java - ../../classpath/gnu/java/net/BASE64.java ../../classpath/gnu/java/net/CRLFInputStream.java ../../classpath/gnu/java/net/CRLFOutputStream.java --- 646,649 ---- *************** *** 935,939 **** ../../classpath/gnu/java/security/sig/SignatureCodecFactory.java ../../classpath/gnu/java/security/sig/SignatureFactory.java - ../../classpath/gnu/java/security/util/Base64.java ../../classpath/gnu/java/security/util/ByteArray.java ../../classpath/gnu/java/security/util/ByteBufferOutputStream.java --- 934,937 ---- *************** *** 984,987 **** --- 982,986 ---- ../../classpath/gnu/java/text/StringFormatBuffer.java ../../classpath/gnu/java/text/WordBreakIterator.java + ../../classpath/gnu/java/util/Base64.java ../../classpath/gnu/java/util/DoubleEnumeration.java ../../classpath/gnu/java/util/EmptyEnumeration.java *************** *** 1375,1379 **** ../../classpath/gnu/javax/naming/jndi/url/rmi/rmiURLContextFactory.java ../../classpath/gnu/javax/net/ssl/AbstractSessionContext.java - ../../classpath/gnu/javax/net/ssl/Base64.java ../../classpath/gnu/javax/net/ssl/EntropySource.java ../../classpath/gnu/javax/net/ssl/NullManagerParameters.java --- 1374,1377 ---- *************** *** 3336,3339 **** --- 3334,3338 ---- ../../classpath/javax/management/NotificationEmitter.java ../../classpath/javax/management/NotificationFilter.java + ../../classpath/javax/management/NotificationFilterSupport.java ../../classpath/javax/management/NotificationListener.java ../../classpath/javax/management/ObjectInstance.java *************** *** 3363,3366 **** --- 3362,3366 ---- ../../classpath/javax/management/openmbean/TabularType.java ../../classpath/javax/management/OperationsException.java + ../../classpath/javax/management/PersistentMBean.java ../../classpath/javax/management/QueryEval.java ../../classpath/javax/management/QueryExp.java Index: exclude.lst =================================================================== RCS file: /cvsroot/ikvm/ikvm/classpath/exclude.lst,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** exclude.lst 19 Oct 2006 06:12:48 -0000 1.2 --- exclude.lst 1 Feb 2007 08:35:05 -0000 1.3 *************** *** 2,4 **** java.lang.VMString java.lang.VMThrowable ! java.math.BigInteger\$NativeMPI \ No newline at end of file --- 2,5 ---- java.lang.VMString java.lang.VMThrowable ! java.math.BigInteger\$NativeMPI ! ikvm.internal.LibraryVMInterface |
From: Jeroen F. <jfr...@us...> - 2007-02-01 07:13:09
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21340/runtime Modified Files: TypeWrapper.cs verifier.cs Log Message: - Changed ikvmc to fail with a Link Error when it detects a loader constraints violation (instead of emitting code that throws a LinkageError at runtime). Index: verifier.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/verifier.cs,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** verifier.cs 31 Aug 2006 09:22:12 -0000 1.38 --- verifier.cs 1 Feb 2007 07:13:02 -0000 1.39 *************** *** 3244,3247 **** --- 3244,3250 ---- if(cpi.GetFieldType() != field.FieldTypeWrapper && !field.FieldTypeWrapper.IsUnloadable) { + #if STATIC_COMPILER + StaticCompiler.LinkageError("Field \"{2}.{3}\" is of type \"{0}\" instead of type \"{1}\" as expected by \"{4}\"", field.FieldTypeWrapper, cpi.GetFieldType(), cpi.GetClassType().Name, cpi.Name, wrapper.Name); + #endif instr.SetHardError(HardError.LinkageError, AllocErrorMessage("Loader constraints violated: " + field.DeclaringType.Name + "." + field.Name)); return; *************** *** 3306,3309 **** --- 3309,3315 ---- if(cpi.GetRetType() != mw.ReturnType && !mw.ReturnType.IsUnloadable) { + #if STATIC_COMPILER + StaticCompiler.LinkageError("Method \"{2}.{3}{4}\" has a return type \"{0}\" instead of type \"{1}\" as expected by \"{5}\"", mw.ReturnType, cpi.GetRetType(), cpi.GetClassType().Name, cpi.Name, cpi.Signature, classFile.Name); + #endif return "Loader constraints violated (return type): " + mw.DeclaringType.Name + "." + mw.Name + mw.Signature; } *************** *** 3314,3317 **** --- 3320,3326 ---- if(here[i] != there[i] && !there[i].IsUnloadable) { + #if STATIC_COMPILER + StaticCompiler.LinkageError("Method \"{2}.{3}{4}\" has a argument type \"{0}\" instead of type \"{1}\" as expected by \"{5}\"", there[i], here[i], cpi.GetClassType().Name, cpi.Name, cpi.Signature, classFile.Name); + #endif return "Loader constraints violated (arg " + i + "): " + mw.DeclaringType.Name + "." + mw.Name + mw.Signature; } Index: TypeWrapper.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/TypeWrapper.cs,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** TypeWrapper.cs 23 Jan 2007 15:45:45 -0000 1.154 --- TypeWrapper.cs 1 Feb 2007 07:13:02 -0000 1.155 *************** *** 4173,4176 **** --- 4173,4179 ---- else { + #if STATIC_COMPILER + StaticCompiler.LinkageError("Method \"{2}.{3}{4}\" has a return type \"{0}\" and tries to override method \"{5}.{3}{4}\" that has a return type \"{1}\"", mw.ReturnType, baseMethod.ReturnType, mw.DeclaringType.Name, mw.Name, mw.Signature, baseMethod.DeclaringType.Name); + #endif throw new LinkageError("Loader constraints violated"); } *************** *** 4191,4194 **** --- 4194,4200 ---- else { + #if STATIC_COMPILER + StaticCompiler.LinkageError("Method \"{2}.{3}{4}\" has an argument type \"{0}\" and tries to override method \"{5}.{3}{4}\" that has an argument type \"{1}\"", here[i], there[i], mw.DeclaringType.Name, mw.Name, mw.Signature, baseMethod.DeclaringType.Name); + #endif throw new LinkageError("Loader constraints violated"); } |
From: Jeroen F. <jfr...@us...> - 2007-02-01 07:13:06
|
Update of /cvsroot/ikvm/ikvm/ikvmc In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21340/ikvmc Modified Files: CompilerClassLoader.cs Log Message: - Changed ikvmc to fail with a Link Error when it detects a loader constraints violation (instead of emitting code that throws a LinkageError at runtime). Index: CompilerClassLoader.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/ikvmc/CompilerClassLoader.cs,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** CompilerClassLoader.cs 31 Jan 2007 11:26:41 -0000 1.35 --- CompilerClassLoader.cs 1 Feb 2007 07:13:02 -0000 1.36 *************** *** 2673,2676 **** --- 2673,2702 ---- Console.Error.WriteLine(msg, values); } + + internal static void LinkageError(string msg, TypeWrapper actualType, TypeWrapper expectedType, params object[] values) + { + object[] args = new object[values.Length + 2]; + values.CopyTo(args, 2); + args[0] = AssemblyQualifiedName(actualType); + args[1] = AssemblyQualifiedName(expectedType); + Console.Error.WriteLine("Link Error: " + msg, args); + Environment.Exit(1); + } + + private static string AssemblyQualifiedName(TypeWrapper tw) + { + ClassLoaderWrapper loader = tw.GetClassLoader(); + AssemblyClassLoader acl = loader as AssemblyClassLoader; + if(acl != null) + { + return tw.Name + ", " + acl.Assembly.FullName; + } + CompilerClassLoader ccl = loader as CompilerClassLoader; + if(ccl != null) + { + return tw.Name + ", " + ccl.GetTypeWrapperFactory().ModuleBuilder.Assembly.FullName; + } + return tw.Name + " (unknown assembly)"; + } } } |
From: Jeroen F. <jfr...@us...> - 2007-01-31 11:26:44
|
Update of /cvsroot/ikvm/ikvm/ikvmc In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv13994/ikvmc Modified Files: CompilerClassLoader.cs Log Message: - Added warning to ikvmc when skipping a class that is already in a referenced assembly. - Changed ikvmc -nowarn to use only the first variable string in a warning as the key. Index: CompilerClassLoader.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/ikvmc/CompilerClassLoader.cs,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** CompilerClassLoader.cs 5 Jan 2007 21:22:55 -0000 1.34 --- CompilerClassLoader.cs 31 Jan 2007 11:26:41 -0000 1.35 *************** *** 2355,2358 **** --- 2355,2363 ---- if(wrapper != null) { + if(wrapper.GetClassLoader() != loader) + { + StaticCompiler.IssueMessage(Message.SkippingReferencedClass, s, ((AssemblyClassLoader)wrapper.GetClassLoader()).Assembly.FullName); + continue; + } if(map == null) { *************** *** 2529,2532 **** --- 2534,2538 ---- DuplicateResourceName = 107, NotAClassFile = 108, + SkippingReferencedClass = 109, } *************** *** 2591,2597 **** StringBuilder sb = new StringBuilder(); sb.Append((int)msgId); ! foreach(string s in values) { ! sb.Append(':').Append(s); } string key = sb.ToString(); --- 2597,2603 ---- StringBuilder sb = new StringBuilder(); sb.Append((int)msgId); ! if(values.Length > 0) { ! sb.Append(':').Append(values[0]); } string key = sb.ToString(); *************** *** 2650,2653 **** --- 2656,2663 ---- " (class format error \"{1}\")"; break; + case Message.SkippingReferencedClass: + msg = "skipping class: \"{0}\"" + Environment.NewLine + + " (class is already available in referenced assembly \"{1}\")"; + break; default: throw new InvalidProgramException(); |
From: Small S. <sma...@us...> - 2007-01-28 09:57:41
|
Update of /cvsroot/ikvm/ikvm/awt In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv1010 Modified Files: toolkit.cs Log Message: Regression with setBounds() --> StackOverflow Index: toolkit.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/toolkit.cs,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** toolkit.cs 27 Jan 2007 15:40:42 -0000 1.49 --- toolkit.cs 28 Jan 2007 09:57:28 -0000 1.50 *************** *** 651,665 **** } private Point getParentOffset() { ! java.awt.Container parent = component.getParent(); ! if (parent != null) { ! ComponentPeer peer = parent.getPeer(); ! if (peer is NetComponentPeer) { ! return new Point( ! ((NetComponentPeer)peer).getInsetsLeft(), ! ((NetComponentPeer)peer).getInsetsTop()); } } --- 651,676 ---- } + + /// <summary> + /// .NET calculate the offset relative to the detail area. + /// Java is using the top left point of a window. + /// That be must compensate the cordinate of a component + /// if the parent is a window, frame or dialog. + /// </summary> + /// <returns>The offset of the details area in the parent</returns> private Point getParentOffset() { ! if (!(component is java.awt.Window)) { ! java.awt.Container parent = component.getParent(); ! if (parent != null) { ! ComponentPeer peer = parent.getPeer(); ! if (peer is NetComponentPeer) ! { ! return new Point( ! ((NetComponentPeer)peer).getInsetsLeft(), ! ((NetComponentPeer)peer).getInsetsTop()); ! } } } |
From: Small S. <sma...@us...> - 2007-01-27 15:40:44
|
Update of /cvsroot/ikvm/ikvm/awt In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv1924 Modified Files: IKVM.AWT.WinForms.csproj toolkit.cs Added Files: robot.cs Log Message: Robot for Windows Implementiert --- NEW FILE: robot.cs --- /* Copyright (C) 2007 Volker Berlin This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Jeroen Frijters je...@fr... */ using System; using System.Drawing; using System.Runtime.InteropServices; using System.Windows.Forms; using java.awt.peer; using java.awt.@event; namespace ikvm.awt { internal class WindowsRobot : RobotPeer { Screen screen; internal WindowsRobot(java.awt.GraphicsDevice device) { screen = ((NetGraphicsDevice)device).screen; } public int getRGBPixel(int x, int y) { #if WHIDBEY Bitmap bitmap = new Bitmap(1, 1); Graphics g = Graphics.FromImage(bitmap); g.CopyFromScreen( x, y, 0, 0, new Size(1,1)); g.Dispose(); Color color = bitmap.GetPixel(0,0); bitmap.Dispose(); return color.ToArgb(); #else return 0; #endif } public int[] getRGBPixels(java.awt.Rectangle r) { #if WHIDBEY int width = r.width; int height = r.height; Bitmap bitmap = new Bitmap(width, height); Graphics g = Graphics.FromImage(bitmap); g.CopyFromScreen(r.x, r.y, 0, 0, new Size(width, height)); g.Dispose(); int[] pixels = new int[width * height]; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { pixels[i+j*width] = bitmap.GetPixel(i, j).ToArgb(); } } bitmap.Dispose(); return pixels; #else return null; #endif } private byte MapKeyCode(int keyCode) { //TODO there need a keymap for some special chars //http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp switch (keyCode) { case KeyEvent.VK_DELETE: return VK_DELETE; default: return (byte)keyCode; } } public void keyPress(int keycode) { keybd_event(MapKeyCode(keycode), 0, KEYEVENTF_KEYDOWN, IntPtr.Zero); } public void keyRelease(int keycode) { keybd_event(MapKeyCode(keycode), 0, KEYEVENTF_KEYUP, IntPtr.Zero); } public void mouseMove(int x, int y) { Cursor.Position = new Point(x,y); } public void mousePress(int button) { int dwFlags = 0; switch (button) { case InputEvent.BUTTON1_MASK: dwFlags |= MOUSEEVENTF_LEFTDOWN; break; case InputEvent.BUTTON2_MASK: dwFlags |= MOUSEEVENTF_MIDDLEDOWN; break; case InputEvent.BUTTON3_MASK: dwFlags |= MOUSEEVENTF_RIGHTDOWN; break; } mouse_event(dwFlags, 0, 0, 0, IntPtr.Zero); } public void mouseRelease(int button) { int dwFlags = 0; switch (button) { case InputEvent.BUTTON1_MASK: dwFlags |= MOUSEEVENTF_LEFTUP; break; case InputEvent.BUTTON2_MASK: dwFlags |= MOUSEEVENTF_MIDDLEUP; break; case InputEvent.BUTTON3_MASK: dwFlags |= MOUSEEVENTF_RIGHTUP; break; } mouse_event(dwFlags, 0, 0, 0, IntPtr.Zero); } public void mouseWheel(int wheel) { mouse_event(0, 0, 0, wheel, IntPtr.Zero); } [DllImport("user32.dll")] private static extern void keybd_event(byte vk, byte scan, int flags, IntPtr extrainfo); private const int KEYEVENTF_KEYDOWN = 0x0000; private const int KEYEVENTF_KEYUP = 0x0002; [DllImport("user32.dll")] private static extern void mouse_event( int dwFlags, // motion and click options int dx, // horizontal position or change int dy, // vertical position or change int dwData, // wheel movement IntPtr dwExtraInfo // application-defined information ); private const int MOUSEEVENTF_LEFTDOWN = 0x0002; private const int MOUSEEVENTF_LEFTUP = 0x0004; private const int MOUSEEVENTF_RIGHTDOWN = 0x0008; private const int MOUSEEVENTF_RIGHTUP = 0x0010; private const int MOUSEEVENTF_MIDDLEDOWN = 0x0020; private const int MOUSEEVENTF_MIDDLEUP = 0x0040; private const int VK_BACK = 0x08; private const int VK_TAB = 0x09; /* * 0x0A - 0x0B : reserved */ private const int VK_CLEAR = 0x0C; private const int VK_RETURN = 0x0D; private const int VK_SHIFT = 0x10; private const int VK_CONTROL = 0x11; private const int VK_MENU = 0x12; private const int VK_PAUSE = 0x13; private const int VK_CAPITAL = 0x14; private const int VK_KANA = 0x15; private const int VK_HANGEUL = 0x15; /* old name - should be here for compatibility */ private const int VK_HANGUL = 0x15; private const int VK_JUNJA = 0x17; private const int VK_FINAL = 0x18; private const int VK_HANJA = 0x19; private const int VK_KANJI = 0x19; private const int VK_ESCAPE = 0x1B; private const int VK_CONVERT = 0x1C; private const int VK_NONCONVERT = 0x1D; private const int VK_ACCEPT = 0x1E; private const int VK_MODECHANGE = 0x1F; private const int VK_SPACE = 0x20; private const int VK_PRIOR = 0x21; private const int VK_NEXT = 0x22; private const int VK_END = 0x23; private const int VK_HOME = 0x24; private const int VK_LEFT = 0x25; private const int VK_UP = 0x26; private const int VK_RIGHT = 0x27; private const int VK_DOWN = 0x28; private const int VK_SELECT = 0x29; private const int VK_PRINT = 0x2A; private const int VK_EXECUTE = 0x2B; private const int VK_SNAPSHOT = 0x2C; private const int VK_INSERT = 0x2D; private const int VK_DELETE = 0x2E; private const int VK_HELP = 0x2F; /* * VK_0 - VK_9 are the same as ASCII '0' - '9' (0x30 - 0x39) * 0x40 : unassigned * VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A) */ private const int VK_LWIN = 0x5B; private const int VK_RWIN = 0x5C; private const int VK_APPS = 0x5D; /* * 0x5E : reserved */ private const int VK_SLEEP = 0x5F; private const int VK_NUMPAD0 = 0x60; private const int VK_NUMPAD1 = 0x61; private const int VK_NUMPAD2 = 0x62; private const int VK_NUMPAD3 = 0x63; private const int VK_NUMPAD4 = 0x64; private const int VK_NUMPAD5 = 0x65; private const int VK_NUMPAD6 = 0x66; private const int VK_NUMPAD7 = 0x67; private const int VK_NUMPAD8 = 0x68; private const int VK_NUMPAD9 = 0x69; private const int VK_MULTIPLY = 0x6A; private const int VK_ADD = 0x6B; private const int VK_SEPARATOR = 0x6C; private const int VK_SUBTRACT = 0x6D; private const int VK_DECIMAL = 0x6E; private const int VK_DIVIDE = 0x6F; private const int VK_F1 = 0x70; private const int VK_F2 = 0x71; private const int VK_F3 = 0x72; private const int VK_F4 = 0x73; private const int VK_F5 = 0x74; private const int VK_F6 = 0x75; private const int VK_F7 = 0x76; private const int VK_F8 = 0x77; private const int VK_F9 = 0x78; private const int VK_F10 = 0x79; private const int VK_F11 = 0x7A; private const int VK_F12 = 0x7B; private const int VK_F13 = 0x7C; private const int VK_F14 = 0x7D; private const int VK_F15 = 0x7E; private const int VK_F16 = 0x7F; private const int VK_F17 = 0x80; private const int VK_F18 = 0x81; private const int VK_F19 = 0x82; private const int VK_F20 = 0x83; private const int VK_F21 = 0x84; private const int VK_F22 = 0x85; private const int VK_F23 = 0x86; private const int VK_F24 = 0x87; /* * 0x88 - 0x8F : unassigned */ private const int VK_NUMLOCK = 0x90; private const int VK_SCROLL = 0x91; /* * NEC PC-9800 kbd definitions */ private const int VK_OEM_NEC_EQUAL = 0x92; // '=' key on numpad /* * Fujitsu/OASYS kbd definitions */ private const int VK_OEM_FJ_JISHO = 0x92; // 'Dictionary' key private const int VK_OEM_FJ_MASSHOU= 0x93; // 'Unregister word' key private const int VK_OEM_FJ_TOUROKU= 0x94; // 'Register word' key private const int VK_OEM_FJ_LOYA = 0x95; // 'Left OYAYUBI' key private const int VK_OEM_FJ_ROYA = 0x96; // 'Right OYAYUBI' key /* * 0x97 - 0x9F : unassigned */ /* * VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys. * Used only as parameters to GetAsyncKeyState() and GetKeyState(). * No other API or message will distinguish left and right keys in this way. */ private const int VK_LSHIFT = 0xA0; private const int VK_RSHIFT = 0xA1; private const int VK_LCONTROL = 0xA2; private const int VK_RCONTROL = 0xA3; private const int VK_LMENU = 0xA4; private const int VK_RMENU = 0xA5; private const int VK_BROWSER_BACK = 0xA6; private const int VK_BROWSER_FORWARD = 0xA7; private const int VK_BROWSER_REFRESH = 0xA8; private const int VK_BROWSER_STOP = 0xA9; private const int VK_BROWSER_SEARCH = 0xAA; private const int VK_BROWSER_FAVORITES = 0xAB; private const int VK_BROWSER_HOME = 0xAC; private const int VK_VOLUME_MUTE = 0xAD; private const int VK_VOLUME_DOWN = 0xAE; private const int VK_VOLUME_UP = 0xAF; private const int VK_MEDIA_NEXT_TRACK = 0xB0; private const int VK_MEDIA_PREV_TRACK = 0xB1; private const int VK_MEDIA_STOP = 0xB2; private const int VK_MEDIA_PLAY_PAUSE = 0xB3; private const int VK_LAUNCH_MAIL = 0xB4; private const int VK_LAUNCH_MEDIA_SELECT= 0xB5; private const int VK_LAUNCH_APP1 = 0xB6; private const int VK_LAUNCH_APP2 = 0xB7; /* * 0xB8 - 0xB9 : reserved */ private const int VK_OEM_1 = 0xBA; // ';:' for US private const int VK_OEM_PLUS = 0xBB; // '+' any country private const int VK_OEM_COMMA = 0xBC; // ',' any country private const int VK_OEM_MINUS = 0xBD; // '-' any country private const int VK_OEM_PERIOD = 0xBE; // '.' any country private const int VK_OEM_2 = 0xBF; // '/?' for US private const int VK_OEM_3 = 0xC0; // '`~' for US /* * 0xC1 - 0xD7 : reserved */ /* * 0xD8 - 0xDA : unassigned */ private const int VK_OEM_4 = 0xDB; // '[{' for US private const int VK_OEM_5 = 0xDC; // '\|' for US private const int VK_OEM_6 = 0xDD; // ']}' for US private const int VK_OEM_7 = 0xDE; // ''"' for US private const int VK_OEM_8 = 0xDF; /* * 0xE0 : reserved */ /* * Various extended or enhanced keyboards */ private const int VK_OEM_AX = 0xE1; // 'AX' key on Japanese AX kbd private const int VK_OEM_102 = 0xE2; // "<>" or "\|" on RT 102-key kbd. private const int VK_ICO_HELP = 0xE3; // Help key on ICO private const int VK_ICO_00 = 0xE4; // 00 key on ICO /* * 0xE8 : unassigned */ /* * Nokia/Ericsson definitions */ private const int VK_OEM_RESET = 0xE9; private const int VK_OEM_JUMP = 0xEA; private const int VK_OEM_PA1 = 0xEB; private const int VK_OEM_PA2 = 0xEC; private const int VK_OEM_PA3 = 0xED; private const int VK_OEM_WSCTRL = 0xEE; private const int VK_OEM_CUSEL = 0xEF; private const int VK_OEM_ATTN = 0xF0; private const int VK_OEM_FINISH = 0xF1; private const int VK_OEM_COPY = 0xF2; private const int VK_OEM_AUTO = 0xF3; private const int VK_OEM_ENLW = 0xF4; private const int VK_OEM_BACKTAB = 0xF5; private const int VK_ATTN = 0xF6; private const int VK_CRSEL = 0xF7; private const int VK_EXSEL = 0xF8; private const int VK_EREOF = 0xF9; private const int VK_PLAY = 0xFA; private const int VK_ZOOM = 0xFB; private const int VK_NONAME = 0xFC; private const int VK_PA1 = 0xFD; private const int VK_OEM_CLEAR = 0xFE; } } Index: toolkit.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/toolkit.cs,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** toolkit.cs 21 Jan 2007 20:29:52 -0000 1.48 --- toolkit.cs 27 Jan 2007 15:40:42 -0000 1.49 *************** *** 511,517 **** } ! public override RobotPeer createRobot(java.awt.GraphicsDevice param) { ! throw new NotImplementedException(); } --- 511,522 ---- } ! public override RobotPeer createRobot(java.awt.GraphicsDevice screen) { ! String osname = gnu.classpath.SystemProperties.getProperty("os.name"); ! if (osname.IndexOf("Windows") >= 0) ! { ! return new WindowsRobot(screen); ! } ! throw new java.awt.AWTException("Robot not supported for this OS"); } *************** *** 585,589 **** } } ! control.SetBounds(component.getX(), component.getY(), component.getWidth(), component.getHeight()); // we need the null check, because for a Window, at this time it doesn't have a foreground yet if(component.getForeground() != null) --- 590,594 ---- } } ! SetBoundsImpl(component.getX(), component.getY(), component.getWidth(), component.getHeight()); // we need the null check, because for a Window, at this time it doesn't have a foreground yet if(component.getForeground() != null) *************** *** 646,649 **** --- 651,670 ---- } + private Point getParentOffset() + { + java.awt.Container parent = component.getParent(); + if (parent != null) + { + ComponentPeer peer = parent.getPeer(); + if (peer is NetComponentPeer) + { + return new Point( + ((NetComponentPeer)peer).getInsetsLeft(), + ((NetComponentPeer)peer).getInsetsTop()); + } + } + return new Point(); + } + private void OnPaint(object sender, PaintEventArgs e) { *************** *** 849,854 **** private void componentSetBounds() { ! int x = control.Left; ! int y = control.Top; int width = control.Width; int height = control.Height; --- 870,876 ---- private void componentSetBounds() { ! Point offset = getParentOffset(); ! int x = control.Left + offset.X; ! int y = control.Top + offset.Y; int width = control.Width; int height = control.Height; *************** *** 1064,1068 **** public void reshape(int x, int y, int width, int height) { ! throw new NotImplementedException(); } --- 1086,1090 ---- public void reshape(int x, int y, int width, int height) { ! setBounds(x, y, width, height); } *************** *** 1077,1088 **** } ! protected virtual void setBoundsImpl(int x, int y, int width, int height) { ! control.SetBounds(x, y, width, height); } public void setBounds(int x, int y, int width, int height) { ! control.Invoke(new SetXYWH(setBoundsImpl), new object[] { x, y, width, height }); componentSetBounds(); } --- 1099,1111 ---- } ! protected virtual void SetBoundsImpl(int x, int y, int width, int height) { ! Point offset = getParentOffset(); ! control.SetBounds(x - offset.X, y - offset.Y, width, height); } public void setBounds(int x, int y, int width, int height) { ! control.Invoke(new SetXYWH(SetBoundsImpl), new object[] { x, y, width, height }); componentSetBounds(); } *************** *** 1257,1261 **** public void setBounds(int x, int y, int width, int height, int z) { ! control.Bounds = new Rectangle(x, y, width, height); } --- 1280,1285 ---- public void setBounds(int x, int y, int width, int height, int z) { ! setBounds(x, y, width, height); ! //TODO changing the Z-Order } *************** *** 1769,1773 **** } ! protected override void setBoundsImpl(int x, int y, int width, int height) { Form form = (Form)control; --- 1793,1797 ---- } ! protected override void SetBoundsImpl(int x, int y, int width, int height) { Form form = (Form)control; Index: IKVM.AWT.WinForms.csproj =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/IKVM.AWT.WinForms.csproj,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IKVM.AWT.WinForms.csproj 21 Jan 2007 14:18:02 -0000 1.7 --- IKVM.AWT.WinForms.csproj 27 Jan 2007 15:40:41 -0000 1.8 *************** *** 120,123 **** --- 120,128 ---- /> <File + RelPath = "robot.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "toolkit.cs" SubType = "Component" |
From: Small S. <sma...@us...> - 2007-01-27 15:37:44
|
Update of /cvsroot/ikvm/ikvm/awt In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv677 Modified Files: graphics.cs Log Message: Some fixes for GraphicsDevice Index: graphics.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/graphics.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** graphics.cs 21 Jan 2007 14:18:03 -0000 1.5 --- graphics.cs 27 Jan 2007 15:37:35 -0000 1.6 *************** *** 970,974 **** public override java.awt.GraphicsDevice getDevice() { ! return new NetGraphicsDevice(); } --- 970,974 ---- public override java.awt.GraphicsDevice getDevice() { ! return new NetGraphicsDevice(screen); } *************** *** 991,997 **** class NetGraphicsDevice : java.awt.GraphicsDevice { public override java.awt.GraphicsConfiguration[] getConfigurations() { ! throw new NotImplementedException(); } --- 991,1010 ---- class NetGraphicsDevice : java.awt.GraphicsDevice { + internal readonly Screen screen; + + internal NetGraphicsDevice(Screen screen) + { + this.screen = screen; + } + public override java.awt.GraphicsConfiguration[] getConfigurations() { ! Screen[] screens = Screen.AllScreens; ! NetGraphicsConfiguration[] configs = new NetGraphicsConfiguration[screens.Length]; ! for (int i = 0; i < screens.Length; i++) ! { ! configs[i] = new NetGraphicsConfiguration(screens[i]); ! } ! return configs; } *************** *** 1003,1007 **** public override string getIDstring() { ! throw new NotImplementedException(); } --- 1016,1020 ---- public override string getIDstring() { ! return screen.DeviceName; } *************** *** 1080,1089 **** public override java.awt.GraphicsDevice getDefaultScreenDevice() { ! return new NetGraphicsDevice(); } public override java.awt.GraphicsDevice[] getScreenDevices() { ! return new java.awt.GraphicsDevice[] { getDefaultScreenDevice() }; } } --- 1093,1108 ---- public override java.awt.GraphicsDevice getDefaultScreenDevice() { ! return new NetGraphicsDevice(Screen.PrimaryScreen); } public override java.awt.GraphicsDevice[] getScreenDevices() { ! Screen[] screens = Screen.AllScreens; ! NetGraphicsDevice[] devices = new NetGraphicsDevice[screens.Length]; ! for (int i = 0; i < screens.Length; i++) ! { ! devices[i] = new NetGraphicsDevice(screens[i]); ! } ! return devices; } } |
From: Jeroen F. <jfr...@us...> - 2007-01-23 15:48:49
|
Update of /cvsroot/ikvm/ikvm/classpath/ikvm/internal/stubgen In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv22325/classpath/ikvm/internal/stubgen Modified Files: StubGenerator.java Log Message: Implemented annotation support in StubGenerator. Index: StubGenerator.java =================================================================== RCS file: /cvsroot/ikvm/ikvm/classpath/ikvm/internal/stubgen/StubGenerator.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** StubGenerator.java 4 Jan 2007 12:54:10 -0000 1.6 --- StubGenerator.java 23 Jan 2007 15:48:48 -0000 1.7 *************** *** 1,4 **** /* ! Copyright (C) 2006 Jeroen Frijters This software is provided 'as-is', without any express or implied --- 1,4 ---- /* ! Copyright (C) 2006, 2007 Jeroen Frijters This software is provided 'as-is', without any express or implied *************** *** 29,33 **** --- 29,40 ---- import java.io.IOException; import java.io.OutputStream; + import java.lang.annotation.Annotation; + import java.lang.reflect.Array; + import java.lang.reflect.InvocationTargetException; + import java.lang.reflect.Method; + import java.security.AccessController; + import java.security.PrivilegedAction; import java.util.ArrayList; + import java.util.Arrays; import java.util.Hashtable; *************** *** 80,98 **** innername = innername.substring(idx + 1); } - if(c.isAnnotation()) - { - // HACK if we see the annotation, it must be runtime visible, but currently - // the classpath trunk doesn't yet have the required RetentionPolicy enum, - // so we have to fake it here - RuntimeVisibleAnnotationsAttribute annot = new RuntimeVisibleAnnotationsAttribute(f); - annot.Add(new Object[] - { - AnnotationDefaultAttribute.TAG_ANNOTATION, - "Ljava/lang/annotation/Retention;", - "value", - new Object[] { AnnotationDefaultAttribute.TAG_ENUM, "Ljava/lang/annotation/RetentionPolicy;", "RUNTIME" } - }); - f.AddAttribute(annot); - } innerClassesAttribute.Add(name, outer.getName().replace('.', '/'), innername, getModifiers(c)); } --- 87,90 ---- *************** *** 132,136 **** mods |= Modifiers.VarArgs; } - // TODO what happens if one of the argument types is non-public? Class[] args = constructors[i].getParameterTypes(); FieldOrMethod m = f.AddMethod(mods, "<init>", MakeSig(args, java.lang.Void.TYPE)); --- 124,127 ---- *************** *** 161,164 **** --- 152,165 ---- m.AddAttribute(f.MakeStringAttribute("Signature", signature)); } + Annotation[] annotations = constructors[i].getDeclaredAnnotations(); + if(annotations.length > 0) + { + m.AddAttribute(new RuntimeVisibleAnnotationsAttribute(f, annotations)); + } + Annotation[][] parameterAnnotations = constructors[i].getParameterAnnotations(); + if(hasParameterAnnotations(parameterAnnotations)) + { + m.AddAttribute(new RuntimeVisibleAnnotationsAttribute(f, parameterAnnotations)); + } } } *************** *** 204,208 **** mods |= Modifiers.VarArgs; } - // TODO what happens if one of the argument types (or the return type) is non-public? Class[] args = methods[i].getParameterTypes(); Class retType = methods[i].getReturnType(); --- 205,208 ---- *************** *** 225,228 **** --- 225,238 ---- m.AddAttribute(new AnnotationDefaultClassFileAttribute(f, defaultValue)); } + Annotation[] annotations = methods[i].getDeclaredAnnotations(); + if(annotations.length > 0) + { + m.AddAttribute(new RuntimeVisibleAnnotationsAttribute(f, annotations)); + } + Annotation[][] parameterAnnotations = methods[i].getParameterAnnotations(); + if(hasParameterAnnotations(parameterAnnotations)) + { + m.AddAttribute(new RuntimeVisibleAnnotationsAttribute(f, parameterAnnotations)); + } } } *************** *** 258,261 **** --- 268,276 ---- fld.AddAttribute(f.MakeStringAttribute("Signature", ToSigForm(fields[i].getGenericType()))); } + Annotation[] annotations = fields[i].getDeclaredAnnotations(); + if(annotations.length > 0) + { + fld.AddAttribute(new RuntimeVisibleAnnotationsAttribute(f, annotations)); + } } } *************** *** 264,267 **** --- 279,287 ---- f.AddAttribute(innerClassesAttribute); } + Annotation[] annotations = c.getDeclaredAnnotations(); + if(annotations.length > 0) + { + f.AddAttribute(new RuntimeVisibleAnnotationsAttribute(f, annotations)); + } try { *************** *** 276,279 **** --- 296,311 ---- } + private static boolean hasParameterAnnotations(Annotation[][] parameterAnnotations) + { + for(int i = 0; i < parameterAnnotations.length; i++) + { + if(parameterAnnotations[i].length > 0) + { + return true; + } + } + return false; + } + private static int getModifiers(Class c) { *************** *** 546,555 **** } - class AnnotationDefaultAttribute - { - static final byte TAG_ANNOTATION = (byte)'@'; - static final byte TAG_ENUM = (byte)'e'; - } - class Modifiers { --- 578,581 ---- *************** *** 1018,1067 **** { private ClassFileWriter classFile; ! private ByteArrayOutputStream mem; ! private DataOutputStream dos; ! private short count; ! RuntimeVisibleAnnotationsAttribute(ClassFileWriter classFile) { super(classFile.AddUtf8("RuntimeVisibleAnnotations")); this.classFile = classFile; ! mem = new ByteArrayOutputStream(); ! dos = new DataOutputStream(mem); } ! void Add(Object[] annot) { try { ! count++; ! dos.writeShort(classFile.AddUtf8((String)annot[1])); ! dos.writeShort((annot.length - 2) / 2); ! for(int i = 2; i < annot.length; i += 2) { ! dos.writeShort(classFile.AddUtf8((String)annot[i])); ! WriteElementValue(dos, annot[i + 1]); } } ! catch (IOException x) { - // this cannot happen, we're writing to a ByteArrayOutputStream throw new Error(x); } } ! private void WriteElementValue(DataOutputStream dos, Object val) throws IOException { ! if(val instanceof Object[]) { ! Object[] arr = (Object[])val; ! if(((Object)AnnotationDefaultAttribute.TAG_ENUM).equals(arr[0])) { ! dos.writeByte(AnnotationDefaultAttribute.TAG_ENUM); ! dos.writeShort(classFile.AddUtf8((String)arr[1])); ! dos.writeShort(classFile.AddUtf8((String)arr[2])); ! return; } } - throw new Error("Not Implemented"); } --- 1044,1298 ---- { private ClassFileWriter classFile; ! private byte[] buf; ! RuntimeVisibleAnnotationsAttribute(ClassFileWriter classFile, Annotation[] annotations) { super(classFile.AddUtf8("RuntimeVisibleAnnotations")); this.classFile = classFile; ! try ! { ! ByteArrayOutputStream mem = new ByteArrayOutputStream(); ! DataOutputStream dos = new DataOutputStream(mem); ! dos.writeShort((short)annotations.length); ! for(Annotation ann : annotations) ! { ! WriteAnnotation(classFile, dos, ann); ! } ! buf = mem.toByteArray(); ! } ! catch(Exception x) ! { ! throw new Error(x); ! } } ! RuntimeVisibleAnnotationsAttribute(ClassFileWriter classFile, Annotation[][] parameterAnnotations) { + super(classFile.AddUtf8("RuntimeVisibleParameterAnnotations")); + this.classFile = classFile; try { ! ByteArrayOutputStream mem = new ByteArrayOutputStream(); ! DataOutputStream dos = new DataOutputStream(mem); ! dos.writeByte(parameterAnnotations.length); ! for(Annotation[] annotations : parameterAnnotations) { ! dos.writeShort((short)annotations.length); ! for(Annotation ann : annotations) ! { ! WriteAnnotation(classFile, dos, ann); ! } } + buf = mem.toByteArray(); } ! catch(Exception x) { throw new Error(x); } } ! private static boolean deepEquals(Object o1, Object o2) { ! if (o1 == o2) ! return true; ! ! if (o1 == null || o2 == null) ! return false; ! ! if (o1 instanceof boolean[] && o2 instanceof boolean[]) ! return Arrays.equals((boolean[]) o1, (boolean[]) o2); ! ! if (o1 instanceof byte[] && o2 instanceof byte[]) ! return Arrays.equals((byte[]) o1, (byte[]) o2); ! ! if (o1 instanceof char[] && o2 instanceof char[]) ! return Arrays.equals((char[]) o1, (char[]) o2); ! ! if (o1 instanceof short[] && o2 instanceof short[]) ! return Arrays.equals((short[]) o1, (short[]) o2); ! ! if (o1 instanceof int[] && o2 instanceof int[]) ! return Arrays.equals((int[]) o1, (int[]) o2); ! ! if (o1 instanceof float[] && o2 instanceof float[]) ! return Arrays.equals((float[]) o1, (float[]) o2); ! ! if (o1 instanceof long[] && o2 instanceof long[]) ! return Arrays.equals((long[]) o1, (long[]) o2); ! ! if (o1 instanceof double[] && o2 instanceof double[]) ! return Arrays.equals((double[]) o1, (double[]) o2); ! ! if (o1 instanceof Object[] && o2 instanceof Object[]) ! return Arrays.equals((Object[]) o1, (Object[]) o2); ! ! return o1.equals(o2); ! } ! ! static void WriteValue(ClassFileWriter classFile, DataOutputStream dos, Object val) ! throws IOException, IllegalAccessException, InvocationTargetException ! { ! if(val instanceof Boolean) { ! dos.writeByte('Z'); ! dos.writeShort(classFile.AddInt(((Boolean)val).booleanValue() ? 1 : 0)); ! } ! else if(val instanceof Byte) ! { ! dos.writeByte('B'); ! dos.writeShort(classFile.AddInt(((Byte)val).byteValue())); ! } ! else if(val instanceof Character) ! { ! dos.writeByte('C'); ! dos.writeShort(classFile.AddInt(((Character)val).charValue())); ! } ! else if(val instanceof Short) ! { ! dos.writeByte('S'); ! dos.writeShort(classFile.AddInt(((Short)val).shortValue())); ! } ! else if(val instanceof Integer) ! { ! dos.writeByte('I'); ! dos.writeShort(classFile.AddInt(((Integer)val).intValue())); ! } ! else if(val instanceof Float) ! { ! dos.writeByte('F'); ! dos.writeShort(classFile.AddFloat(((Float)val).floatValue())); ! } ! else if(val instanceof Long) ! { ! dos.writeByte('J'); ! dos.writeShort(classFile.AddLong(((Long)val).longValue())); ! } ! else if(val instanceof Double) ! { ! dos.writeByte('D'); ! dos.writeShort(classFile.AddDouble(((Double)val).doubleValue())); ! } ! else if(val instanceof String) ! { ! dos.writeByte('s'); ! dos.writeShort(classFile.AddUtf8((String)val)); ! } ! else if(val instanceof Enum) ! { ! Enum enumVal = (Enum)val; ! Class enumType = enumVal.getDeclaringClass(); ! dos.writeByte('e'); ! dos.writeShort(classFile.AddUtf8("L" + enumType.getName().replace('.', '/') + ";")); ! dos.writeShort(classFile.AddUtf8(enumVal.name())); ! } ! else if(val instanceof Class) ! { ! dos.writeByte('c'); ! Class c = (Class)val; ! String sig; ! if(c.isArray()) { ! sig = c.getName(); ! } ! else if(c == Boolean.TYPE) ! { ! sig = "Z"; ! } ! else if(c == Byte.TYPE) ! { ! sig = "B"; ! } ! else if(c == Character.TYPE) ! { ! sig = "C"; ! } ! else if(c == Short.TYPE) ! { ! sig = "S"; ! } ! else if(c == Integer.TYPE) ! { ! sig = "I"; ! } ! else if(c == Float.TYPE) ! { ! sig = "F"; ! } ! else if(c == Long.TYPE) ! { ! sig = "J"; ! } ! else if(c == Double.TYPE) ! { ! sig = "D"; ! } ! else if(c == Void.TYPE) ! { ! sig = "V"; ! } ! else ! { ! sig = "L" + c.getName() + ";"; ! } ! dos.writeShort(classFile.AddUtf8(sig.replace('.', '/'))); ! } ! else if(val instanceof Annotation) ! { ! dos.writeByte('@'); ! WriteAnnotation(classFile, dos, (Annotation)val); ! } ! else if(val.getClass().isArray()) ! { ! dos.writeByte('['); ! int len = Array.getLength(val); ! dos.writeShort((short)len); ! for(int i = 0; i < len; i++) ! { ! WriteValue(classFile, dos, Array.get(val, i)); ! } ! } ! else ! { ! throw new Error("Not Implemented: " + val.getClass()); ! } ! } ! ! private static void WriteAnnotation(ClassFileWriter classFile, DataOutputStream dos, Annotation ann) ! throws IOException, IllegalAccessException, InvocationTargetException ! { ! Class annotationType = ann.annotationType(); ! dos.writeShort(classFile.AddUtf8("L" + annotationType.getName().replace('.', '/') + ";")); ! short numvalues = 0; ! Method[] methods = annotationType.getDeclaredMethods(); ! for(int i = 0; i < methods.length; i++) ! { ! final Method m = methods[i]; ! AccessController.doPrivileged(new PrivilegedAction() { ! public Object run() { ! m.setAccessible(true); ! return null; ! } ! }); ! // HACK since there's no way to query if the annotation value is the default value ! // (and I don't want to add a private API for that), we simply compare the value ! // with the default and if they match we won't list the value. ! if(deepEquals(m.invoke(ann), m.getDefaultValue())) ! { ! methods[i] = null; ! } ! else ! { ! numvalues++; ! } ! } ! dos.writeShort(numvalues); ! for(Method m : methods) ! { ! if(m != null) ! { ! dos.writeShort(classFile.AddUtf8(m.getName())); ! WriteValue(classFile, dos, m.invoke(ann)); } } } *************** *** 1069,1075 **** { super.Write(dos); ! byte[] buf = mem.toByteArray(); ! dos.writeInt(buf.length + 2); ! dos.writeShort(count); dos.write(buf); } --- 1300,1304 ---- { super.Write(dos); ! dos.writeInt(buf.length); dos.write(buf); } *************** *** 1089,1112 **** ByteArrayOutputStream mem = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(mem); ! if(val instanceof Boolean) ! { ! dos.writeByte('Z'); ! dos.writeShort(classFile.AddInt(((Boolean)val).booleanValue() ? 1 : 0)); ! } ! else if(val instanceof Enum) ! { ! dos.writeByte('e'); ! dos.writeShort(classFile.AddUtf8("L" + val.getClass().getName().replace('.', '/') + ";")); ! dos.writeShort(classFile.AddUtf8(((Enum)val).name())); ! } ! else ! { ! throw new Error("Not Implemented"); ! } buf = mem.toByteArray(); } ! catch (IOException x) { - // this cannot happen, we're writing to a ByteArrayOutputStream throw new Error(x); } --- 1318,1326 ---- ByteArrayOutputStream mem = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(mem); ! RuntimeVisibleAnnotationsAttribute.WriteValue(classFile, dos, val); buf = mem.toByteArray(); } ! catch (Exception x) { throw new Error(x); } *************** *** 1262,1276 **** } ! private short AddLong(long l) { return Add(new ConstantPoolItemLong(l)); } ! private short AddFloat(float f) { return Add(new ConstantPoolItemFloat(f)); } ! private short AddDouble(double d) { return Add(new ConstantPoolItemDouble(d)); --- 1476,1490 ---- } ! public short AddLong(long l) { return Add(new ConstantPoolItemLong(l)); } ! public short AddFloat(float f) { return Add(new ConstantPoolItemFloat(f)); } ! public short AddDouble(double d) { return Add(new ConstantPoolItemDouble(d)); |
From: Jeroen F. <jfr...@us...> - 2007-01-23 15:45:48
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21162/runtime Modified Files: TypeWrapper.cs Log Message: - Fixed AnnotationBuilder to add ImplementsAttribute to annotation attribute, so that reflection correctly reports the implemented annotation interface. - Fixed AnnotationBuilder to ignore annotation attribute properties of type annotation. Index: TypeWrapper.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/TypeWrapper.cs,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** TypeWrapper.cs 16 Jan 2007 10:14:47 -0000 1.153 --- TypeWrapper.cs 23 Jan 2007 15:45:45 -0000 1.154 *************** *** 1,4 **** /* ! Copyright (C) 2002, 2003, 2004, 2005, 2006 Jeroen Frijters This software is provided 'as-is', without any express or implied --- 1,4 ---- /* ! Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Jeroen Frijters This software is provided 'as-is', without any express or implied *************** *** 5126,5129 **** --- 5126,5130 ---- AttributeHelper.SetInnerClass(attributeTypeBuilder, o.classFile.Name.Substring(0, dotindex) + "$Proxy" + o.classFile.Name.Substring(dotindex), Modifiers.Final); attributeTypeBuilder.AddInterfaceImplementation(o.typeBuilder); + AttributeHelper.SetImplementsAttribute(attributeTypeBuilder, new TypeWrapper[] { o.wrapper }); if(o.classFile.Annotations != null) *************** *** 5431,5444 **** // now add a .NET property for this annotation optional parameter Type argType = TypeWrapperToAnnotationParameterType(o.methods[i].ReturnType); ! PropertyBuilder pb = attributeTypeBuilder.DefineProperty(o.methods[i].Name, PropertyAttributes.None, argType, Type.EmptyTypes); ! MethodBuilder setter = attributeTypeBuilder.DefineMethod("set_" + o.methods[i].Name, MethodAttributes.Public, typeof(void), new Type[] { argType }); ! pb.SetSetMethod(setter); ! ilgen = setter.GetILGenerator(); ! EmitSetValueCall(annotationAttributeBaseType, ilgen, o.methods[i].Name, o.methods[i].ReturnType, 1); ! ilgen.Emit(OpCodes.Ret); ! MethodBuilder getter = attributeTypeBuilder.DefineMethod("get_" + o.methods[i].Name, MethodAttributes.Public, argType, Type.EmptyTypes); ! pb.SetGetMethod(getter); ! // TODO implement the getter method ! getter.GetILGenerator().ThrowException(typeof(NotImplementedException)); } } --- 5432,5448 ---- // now add a .NET property for this annotation optional parameter Type argType = TypeWrapperToAnnotationParameterType(o.methods[i].ReturnType); ! if(argType != null) ! { ! PropertyBuilder pb = attributeTypeBuilder.DefineProperty(o.methods[i].Name, PropertyAttributes.None, argType, Type.EmptyTypes); ! MethodBuilder setter = attributeTypeBuilder.DefineMethod("set_" + o.methods[i].Name, MethodAttributes.Public, typeof(void), new Type[] { argType }); ! pb.SetSetMethod(setter); ! ilgen = setter.GetILGenerator(); ! EmitSetValueCall(annotationAttributeBaseType, ilgen, o.methods[i].Name, o.methods[i].ReturnType, 1); ! ilgen.Emit(OpCodes.Ret); ! MethodBuilder getter = attributeTypeBuilder.DefineMethod("get_" + o.methods[i].Name, MethodAttributes.Public, argType, Type.EmptyTypes); ! pb.SetGetMethod(getter); ! // TODO implement the getter method ! getter.GetILGenerator().ThrowException(typeof(NotImplementedException)); ! } } } |
From: Jeroen F. <jfr...@us...> - 2007-01-23 09:51:50
|
Update of /cvsroot/ikvm/ikvm/classpath/java/io In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv4532/classpath/java/io Modified Files: VMFile.java Log Message: Cleaned up error handling. Index: VMFile.java =================================================================== RCS file: /cvsroot/ikvm/ikvm/classpath/java/io/VMFile.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** VMFile.java 21 Aug 2006 13:12:09 -0000 1.7 --- VMFile.java 23 Jan 2007 09:51:46 -0000 1.8 *************** *** 1,4 **** /* ! Copyright (C) 2004 Jeroen Frijters This software is provided 'as-is', without any express or implied --- 1,4 ---- /* ! Copyright (C) 2004, 2007 Jeroen Frijters This software is provided 'as-is', without any express or implied *************** *** 48,58 **** try { ! // TODO what if "path" is a directory? return DateTimeToJavaLongTime(cli.System.IO.File.GetLastWriteTime(path)); } ! catch(Throwable x) { return 0; } } --- 48,84 ---- try { ! if(false) throw new cli.System.UnauthorizedAccessException(); ! if(false) throw new cli.System.ArgumentException(); ! if(false) throw new cli.System.IO.IOException(); ! if(false) throw new cli.System.NotSupportedException(); return DateTimeToJavaLongTime(cli.System.IO.File.GetLastWriteTime(path)); } ! catch(cli.System.UnauthorizedAccessException _) { return 0; } + catch(cli.System.ArgumentException _) + { + return 0; + } + catch(cli.System.IO.IOException _) + { + return 0; + } + catch(cli.System.NotSupportedException _) + { + return 0; + } + } + + private static cli.System.IO.FileInfo newFileInfo(String path) + throws cli.System.ArgumentNullException, + cli.System.Security.SecurityException, + cli.System.ArgumentException, + cli.System.UnauthorizedAccessException, + cli.System.IO.PathTooLongException, + cli.System.NotSupportedException + { + return new cli.System.IO.FileInfo(path); } *************** *** 61,65 **** try { ! cli.System.IO.FileInfo fileInfo = new cli.System.IO.FileInfo(path); cli.System.IO.FileAttributes attr = fileInfo.get_Attributes(); attr = cli.System.IO.FileAttributes.wrap(attr.Value | cli.System.IO.FileAttributes.ReadOnly); --- 87,91 ---- try { ! cli.System.IO.FileInfo fileInfo = newFileInfo(path); cli.System.IO.FileAttributes attr = fileInfo.get_Attributes(); attr = cli.System.IO.FileAttributes.wrap(attr.Value | cli.System.IO.FileAttributes.ReadOnly); *************** *** 67,74 **** return true; } ! catch(Throwable x) { return false; } } --- 93,116 ---- return true; } ! catch(cli.System.Security.SecurityException _) { return false; } + catch(cli.System.ArgumentException _) + { + return false; + } + catch(cli.System.UnauthorizedAccessException _) + { + return false; + } + catch(cli.System.IO.IOException _) + { + return false; + } + catch(cli.System.NotSupportedException _) + { + return false; + } } *************** *** 77,96 **** try { cli.System.IO.File.Open(path, cli.System.IO.FileMode.wrap(cli.System.IO.FileMode.CreateNew)).Close(); return true; } ! catch(Throwable x) ! { ! // TODO handle errors ! return false; ! } } static String[] list(String dirpath) { - // TODO error handling try { ! String[] l = cli.System.IO.Directory.GetFileSystemEntries(dirpath); for(int i = 0; i < l.length; i++) { --- 119,155 ---- try { + if(false) throw new cli.System.ArgumentException(); + if(false) throw new cli.System.IO.IOException(); + if(false) throw new cli.System.UnauthorizedAccessException(); + if(false) throw new cli.System.NotSupportedException(); cli.System.IO.File.Open(path, cli.System.IO.FileMode.wrap(cli.System.IO.FileMode.CreateNew)).Close(); return true; } ! catch(cli.System.ArgumentException _) ! { ! return false; ! } ! catch(cli.System.IO.IOException _) ! { ! return false; ! } ! catch(cli.System.UnauthorizedAccessException _) ! { ! return false; ! } ! catch(cli.System.NotSupportedException _) ! { ! return false; ! } } static String[] list(String dirpath) { try { ! if(false) throw new cli.System.ArgumentException(); ! if(false) throw new cli.System.IO.IOException(); ! if(false) throw new cli.System.UnauthorizedAccessException(); ! String[] l = cli.System.IO.Directory.GetFileSystemEntries(dirpath); for(int i = 0; i < l.length; i++) { *************** *** 103,110 **** return l; } ! catch(Throwable x) ! { ! return null; ! } } --- 162,177 ---- return l; } ! catch(cli.System.ArgumentException _) ! { ! return null; ! } ! catch(cli.System.IO.IOException _) ! { ! return null; ! } ! catch(cli.System.UnauthorizedAccessException _) ! { ! return null; ! } } *************** *** 113,153 **** try { ! new cli.System.IO.FileInfo(targetpath).MoveTo(destpath); return true; } ! catch(Throwable x) ! { ! return false; ! } } static long length(String path) { - // TODO handle errors try { ! return new cli.System.IO.FileInfo(path).get_Length(); ! } ! catch(Throwable x) ! { ! return 0; } } static boolean exists(String path) { ! try ! { ! return cli.System.IO.File.Exists(path) || cli.System.IO.Directory.Exists(path); ! } ! catch(Throwable x) ! { ! return false; ! } } static boolean delete(String path) { - // TODO handle errors try { --- 180,243 ---- try { ! newFileInfo(targetpath).MoveTo(destpath); return true; } ! catch(cli.System.Security.SecurityException _) ! { ! return false; ! } ! catch(cli.System.ArgumentException _) ! { ! return false; ! } ! catch(cli.System.UnauthorizedAccessException _) ! { ! return false; ! } ! catch(cli.System.IO.IOException _) ! { ! return false; ! } ! catch(cli.System.NotSupportedException _) ! { ! return false; ! } } static long length(String path) { try { ! return newFileInfo(path).get_Length(); } + catch(cli.System.Security.SecurityException _) + { + return 0; + } + catch(cli.System.ArgumentException _) + { + return 0; + } + catch(cli.System.UnauthorizedAccessException _) + { + return 0; + } + catch(cli.System.IO.IOException _) + { + return 0; + } + catch(cli.System.NotSupportedException _) + { + return 0; + } } static boolean exists(String path) { ! return cli.System.IO.File.Exists(path) || cli.System.IO.Directory.Exists(path); } static boolean delete(String path) { try { *************** *** 159,163 **** else if(cli.System.IO.File.Exists(path)) { ! fileInfo = new cli.System.IO.FileInfo(path); } else --- 249,253 ---- else if(cli.System.IO.File.Exists(path)) { ! fileInfo = newFileInfo(path); } else *************** *** 176,183 **** return true; } ! catch(Throwable x) ! { ! return false; ! } } --- 266,289 ---- return true; } ! catch(cli.System.Security.SecurityException _) ! { ! return false; ! } ! catch(cli.System.ArgumentException _) ! { ! return false; ! } ! catch(cli.System.UnauthorizedAccessException _) ! { ! return false; ! } ! catch(cli.System.IO.IOException _) ! { ! return false; ! } ! catch(cli.System.NotSupportedException _) ! { ! return false; ! } } *************** *** 186,206 **** try { ! new cli.System.IO.FileInfo(path).set_LastWriteTime(JavaLongTimeToDateTime(time)); return true; } ! catch(Throwable x) ! { ! return false; ! } } static boolean mkdir(String path) { - // TODO handle errors - cli.System.IO.DirectoryInfo parent; try { if(false) throw new cli.System.ArgumentException(); ! parent = cli.System.IO.Directory.GetParent(path); } catch(cli.System.ArgumentException _) --- 292,341 ---- try { ! newFileInfo(path).set_LastWriteTime(JavaLongTimeToDateTime(time)); return true; } ! catch(cli.System.Security.SecurityException _) ! { ! return false; ! } ! catch(cli.System.ArgumentException _) ! { ! return false; ! } ! catch(cli.System.UnauthorizedAccessException _) ! { ! return false; ! } ! catch(cli.System.IO.IOException _) ! { ! return false; ! } ! catch(cli.System.NotSupportedException _) ! { ! return false; ! } } static boolean mkdir(String path) { try { + if(false) throw new cli.System.IO.IOException(); + if(false) throw new cli.System.UnauthorizedAccessException(); if(false) throw new cli.System.ArgumentException(); ! if(false) throw new cli.System.NotSupportedException(); ! if(false) throw new cli.System.Security.SecurityException(); ! cli.System.IO.DirectoryInfo parent = cli.System.IO.Directory.GetParent(path); ! if (parent == null || ! !cli.System.IO.Directory.Exists(parent.get_FullName()) || ! cli.System.IO.Directory.Exists(path)) ! { ! return false; ! } ! return cli.System.IO.Directory.CreateDirectory(path) != null; ! } ! catch(cli.System.Security.SecurityException _) ! { ! return false; } catch(cli.System.ArgumentException _) *************** *** 208,232 **** return false; } ! if (parent == null || ! !cli.System.IO.Directory.Exists(parent.get_FullName()) || ! cli.System.IO.Directory.Exists(path)) ! { ! return false; ! } ! return cli.System.IO.Directory.CreateDirectory(path) != null; } static boolean isFile(String path) { ! // TODO handle errors ! // TODO make sure semantics are the same ! try ! { ! return cli.System.IO.File.Exists(path); ! } ! catch(Throwable x) ! { ! return false; ! } } --- 343,363 ---- return false; } ! catch(cli.System.UnauthorizedAccessException _) ! { ! return false; ! } ! catch(cli.System.IO.IOException _) ! { ! return false; ! } ! catch(cli.System.NotSupportedException _) ! { ! return false; ! } } static boolean isFile(String path) { ! return cli.System.IO.File.Exists(path); } *************** *** 235,239 **** try { ! cli.System.IO.FileInfo fileInfo = new cli.System.IO.FileInfo(path); cli.System.IO.FileAttributes attr = fileInfo.get_Attributes(); // Like the JDK we'll only look at the read-only attribute and not --- 366,370 ---- try { ! cli.System.IO.FileInfo fileInfo = newFileInfo(path); cli.System.IO.FileAttributes attr = fileInfo.get_Attributes(); // Like the JDK we'll only look at the read-only attribute and not *************** *** 241,248 **** return (attr.Value & cli.System.IO.FileAttributes.ReadOnly) == 0; } ! catch(Throwable x) ! { ! return false; ! } } --- 372,395 ---- return (attr.Value & cli.System.IO.FileAttributes.ReadOnly) == 0; } ! catch(cli.System.Security.SecurityException _) ! { ! return false; ! } ! catch(cli.System.ArgumentException _) ! { ! return false; ! } ! catch(cli.System.UnauthorizedAccessException _) ! { ! return false; ! } ! catch(cli.System.IO.IOException _) ! { ! return false; ! } ! catch(cli.System.NotSupportedException _) ! { ! return false; ! } } *************** *** 261,265 **** return true; } ! new cli.System.IO.FileInfo(path).Open( cli.System.IO.FileMode.wrap(cli.System.IO.FileMode.Open), cli.System.IO.FileAccess.wrap(cli.System.IO.FileAccess.Read), --- 408,412 ---- return true; } ! newFileInfo(path).Open( cli.System.IO.FileMode.wrap(cli.System.IO.FileMode.Open), cli.System.IO.FileAccess.wrap(cli.System.IO.FileAccess.Read), *************** *** 267,299 **** return true; } ! catch(Throwable x) ! { ! return false; ! } } static boolean isDirectory(String path) { ! // TODO handle errors ! // TODO make sure semantics are the same ! try ! { ! return cli.System.IO.Directory.Exists(path); ! } ! catch(Throwable x) ! { ! return false; ! } } static File[] listRoots() { ! String[] roots = cli.System.IO.Directory.GetLogicalDrives(); ! File[] fileRoots = new File[roots.length]; ! for(int i = 0; i < roots.length; i++) ! { ! fileRoots[i] = new File(roots[i]); ! } ! return fileRoots; } --- 414,466 ---- return true; } ! catch(cli.System.Security.SecurityException _) ! { ! return false; ! } ! catch(cli.System.ArgumentException _) ! { ! return false; ! } ! catch(cli.System.UnauthorizedAccessException _) ! { ! return false; ! } ! catch(cli.System.IO.IOException _) ! { ! return false; ! } ! catch(cli.System.NotSupportedException _) ! { ! return false; ! } } static boolean isDirectory(String path) { ! return cli.System.IO.Directory.Exists(path); } static File[] listRoots() { ! try ! { ! if(false) throw new cli.System.IO.IOException(); ! if(false) throw new cli.System.UnauthorizedAccessException(); ! String[] roots = cli.System.IO.Directory.GetLogicalDrives(); ! File[] fileRoots = new File[roots.length]; ! for(int i = 0; i < roots.length; i++) ! { ! fileRoots[i] = new File(roots[i]); ! } ! return fileRoots; ! } ! catch(cli.System.IO.IOException _) ! { ! return new File[0]; ! } ! catch(cli.System.UnauthorizedAccessException _) ! { ! return new File[0]; ! } } *************** *** 308,323 **** else { ! return (new cli.System.IO.FileInfo(path).get_Attributes().Value & cli.System.IO.FileAttributes.Hidden) != 0; } } ! catch(Throwable x) ! { ! return false; ! } } static String getName(String path) { ! return cli.System.IO.Path.GetFileName(path); } --- 475,517 ---- else { ! return (newFileInfo(path).get_Attributes().Value & cli.System.IO.FileAttributes.Hidden) != 0; } } ! catch(cli.System.Security.SecurityException _) ! { ! return false; ! } ! catch(cli.System.ArgumentException _) ! { ! return false; ! } ! catch(cli.System.UnauthorizedAccessException _) ! { ! return false; ! } ! catch(cli.System.IO.IOException _) ! { ! return false; ! } ! catch(cli.System.NotSupportedException _) ! { ! return false; ! } } static String getName(String path) { ! try ! { ! if(false) throw new cli.System.ArgumentException(); ! return cli.System.IO.Path.GetFileName(path); ! } ! catch(cli.System.ArgumentException _) ! { ! // HACK this is not quite compatible with the JDK, but ! // since we only do this for invalid paths anyway, it ! // probably isn't worthwhile to be 100% correct. ! return path.substring(path.lastIndexOf(File.separatorChar) + 1); ! } } *************** *** 331,340 **** try { ! if(false) throw new cli.System.Security.SecurityException(); ! if(false) throw new cli.System.ArgumentException(); ! if(false) throw new cli.System.UnauthorizedAccessException(); ! if(false) throw new cli.System.IO.IOException(); ! if(false) throw new cli.System.NotSupportedException(); ! return new cli.System.IO.FileInfo(path); } catch(cli.System.Security.SecurityException x1) --- 525,529 ---- try { ! return newFileInfo(path); } catch(cli.System.Security.SecurityException x1) |
From: Small S. <sma...@us...> - 2007-01-21 20:29:54
|
Update of /cvsroot/ikvm/ikvm/awt In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv19346 Modified Files: toolkit.cs Log Message: Fix some Winforms thread problems with calling of Invoke. Index: toolkit.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/toolkit.cs,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** toolkit.cs 21 Jan 2007 14:18:03 -0000 1.47 --- toolkit.cs 21 Jan 2007 20:29:52 -0000 1.48 *************** *** 54,57 **** --- 54,58 ---- delegate java.awt.Dimension GetDimension(); delegate Rectangle ConvertRectangle(Rectangle r); + delegate Point ConvertPoint(Point p); class UndecoratedForm : Form *************** *** 940,945 **** public java.awt.Point getLocationOnScreen() { ! // TODO use control.Invoke ! Point p = control.PointToScreen(new Point(0, 0)); return new java.awt.Point(p.X, p.Y); } --- 941,948 ---- public java.awt.Point getLocationOnScreen() { ! Point p = new Point(0, 0); ! p = control.InvokeRequired ? ! (Point)control.Invoke(new ConvertPoint(control.PointToScreen), new object[] { p }) : ! control.PointToScreen(p); return new java.awt.Point(p.X, p.Y); } *************** *** 1774,1783 **** public void toBack() { ! ((Form)control).SendToBack(); } public void toFront() { ! ((Form)control).Activate(); } --- 1777,1786 ---- public void toBack() { ! control.BeginInvoke(new SetVoid(((Form)control).SendToBack)); } public void toFront() { ! control.BeginInvoke(new SetVoid(((Form)control).Activate)); } |
From: Small S. <sma...@us...> - 2007-01-21 14:18:08
|
Update of /cvsroot/ikvm/ikvm/awt In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv4706 Modified Files: IKVM.AWT.WinForms.csproj converter.cs fonts.cs graphics.cs toolkit.cs Added Files: images.cs Log Message: Restructing the awt project part 2 Index: toolkit.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/toolkit.cs,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** toolkit.cs 14 Jan 2007 16:13:51 -0000 1.46 --- toolkit.cs 21 Jan 2007 14:18:03 -0000 1.47 *************** *** 1,5 **** /* ! Copyright (C) 2002, 2004, 2005, 2006 Jeroen Frijters, Volker Berlin Copyright (C) 2006 Active Endpoints, Inc. This software is provided 'as-is', without any express or implied --- 1,6 ---- /* ! Copyright (C) 2002, 2004, 2005, 2006, 2007 Jeroen Frijters Copyright (C) 2006 Active Endpoints, Inc. + Copyright (C) 2006, 2007 Volker Berlin This software is provided 'as-is', without any express or implied *************** *** 548,597 **** } - class NoImage : java.awt.Image - { - - public override int getWidth(java.awt.image.ImageObserver observer) - { - if(observer != null) - { - observer.imageUpdate(this, java.awt.image.ImageObserver.__Fields.ERROR | java.awt.image.ImageObserver.__Fields.ABORT, 0, 0, -1, -1); - } - return -1; - } - - public override int getHeight(java.awt.image.ImageObserver observer) - { - if(observer != null) - { - observer.imageUpdate(this, java.awt.image.ImageObserver.__Fields.ERROR | java.awt.image.ImageObserver.__Fields.ABORT, 0, 0, -1, -1); - } - return -1; - } - - public override ImageProducer getSource() - { - return null; - } - - public override java.awt.Graphics getGraphics() - { - // TODO throw java.lang.IllegalAccessError: getGraphics() only valid for images created with createImage(w, h) - return null; - } - - public override object getProperty(string name, java.awt.image.ImageObserver observer) - { - if(observer != null) - { - observer.imageUpdate(this, java.awt.image.ImageObserver.__Fields.ERROR | java.awt.image.ImageObserver.__Fields.ABORT, 0, 0, -1, -1); - } - return null; - } - - public override void flush() - { - } - } - class NetComponentPeer : ComponentPeer { --- 549,552 ---- *************** *** 1317,1548 **** } - class NetVolatileImage : java.awt.image.VolatileImage - { - internal Bitmap bitmap; - - internal NetVolatileImage(int width, int height) - { - bitmap = new Bitmap(width, height); - using(Graphics g = Graphics.FromImage(bitmap)) - { - g.Clear(Color.White); - } - } - - public override bool contentsLost() - { - return false; - } - - public override int getHeight(ImageObserver io) - { - return bitmap.Height; - } - - public override int getWidth(ImageObserver io) - { - return bitmap.Width; - } - - public override object getProperty(string str, ImageObserver io) - { - throw new NotImplementedException(); - } - - public override java.awt.Graphics2D createGraphics() - { - Graphics g = Graphics.FromImage(bitmap); - // HACK for off-screen images we don't want ClearType or anti-aliasing - // TODO I'm sure Java 2D has a way to control text rendering quality, we should honor that - g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; - return new BitmapGraphics(bitmap); - } - - public override int getHeight() - { - return bitmap.Height; - } - - public override int getWidth() - { - return bitmap.Width; - } - - public override BufferedImage getSnapshot() - { - return new NetBufferedImage(bitmap); - } - - public override int validate(java.awt.GraphicsConfiguration gc) - { - return 0; - } - - public override java.awt.ImageCapabilities getCapabilities() - { - throw new NotImplementedException(); - } - } - - // HACK Classpath should have a working BufferedImage, but currently it doesn't, until then, we - // provide a hacked up version - class NetBufferedImage : java.awt.image.BufferedImage - { - internal Bitmap bitmap; - - internal NetBufferedImage(Bitmap bitmap) - : base(bitmap.Width, bitmap.Height, java.awt.image.BufferedImage.TYPE_INT_RGB) - { - this.bitmap = bitmap; - } - - internal NetBufferedImage(int width, int height) - : base(width, height, java.awt.image.BufferedImage.TYPE_INT_RGB) - { - bitmap = new Bitmap(width, height); - using(Graphics g = Graphics.FromImage(bitmap)) - { - g.Clear(Color.White); - } - } - - public override java.awt.Graphics2D createGraphics() - { - Graphics g = Graphics.FromImage(bitmap); - // HACK for off-screen images we don't want ClearType or anti-aliasing - // TODO I'm sure Java 2D has a way to control text rendering quality, we should honor that - g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; - return new BitmapGraphics(bitmap); - } - - public override java.awt.image.ImageProducer getSource() - { - int[] pix = new int[bitmap.Width * bitmap.Height]; - for(int y = 0; y < bitmap.Height; y++) - { - for(int x = 0; x < bitmap.Width; x++) - { - pix[x + y * bitmap.Width] = bitmap.GetPixel(x, y).ToArgb(); - } - } - return new java.awt.image.MemoryImageSource(bitmap.Width, bitmap.Height, pix, 0, bitmap.Width); - } - } - - class NetProducerImage : java.awt.Image, java.awt.image.ImageConsumer - { - private java.awt.image.ImageProducer source; - - private int mHeight = 0; - - private int mWidth = 0; - - private int mHintFlags = 0; - - private ColorModel mColorModel = null; - - private Hashtable mProperties; - - private Bitmap mBitmap; - - internal NetProducerImage(java.awt.image.ImageProducer source) - { - this.source = source; - } - - public override void flush() - { - } - - public override java.awt.Graphics getGraphics() - { - return null; - } - - public override int getHeight(ImageObserver param) - { - return mHeight; - } - - public override int getWidth(ImageObserver param) - { - return mWidth; - } - - public override object getProperty(string param, ImageObserver obs) - { - return null; - } - - public override ImageProducer getSource() - { - return source; - } - - public void setHints(int hintflags) - { - mHintFlags = hintflags; - } - - public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, int scansize) - { - Console.WriteLine("NetBufferedImage: setPixels"); - } - - /// <summary> - /// Create a bitmap from the pixel array. The bitmap will be used - /// by drawImage. - /// </summary> - void java.awt.image.ImageConsumer.setPixels(int aX, int aY, int w, int h, ColorModel model, int[] pixels, int off, int scansize) - { - mWidth = w; - mHeight = h; - mColorModel = model; - mBitmap = new Bitmap(mWidth, mHeight); - int pixel = 0; - for (int y = 0; y < mHeight; ++y) - { - for (int x = 0; x < mWidth; x++) - { - uint argb = (uint)pixels[pixel++]; - int blue = (int)argb & 0xff; - argb >>= 8; - int green = (int)argb & 0xff; - argb >>= 8; - int red = (int)argb & 0xff; - argb >>= 8; - int alpha = (int)argb & 0xff; - mBitmap.SetPixel(x, y, Color.FromArgb(alpha, red, green, blue)); - } - } - } - - public Bitmap getBitmap() - { - return mBitmap; - } - - public void setDimensions(int width, int height) - { - mWidth = width; - mHeight = height; - } - - public void imageComplete(int status) - { - // Console.WriteLine("NetBufferedImage: imageComplete"); - } - - public void setColorModel(ColorModel model) - { - mColorModel = model; - } - - public void setProperties(Hashtable props) - { - mProperties = props; - } - } - class NetButtonPeer : NetComponentPeer, ButtonPeer { --- 1272,1275 ---- Index: graphics.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/graphics.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** graphics.cs 21 Jan 2007 13:04:58 -0000 1.4 --- graphics.cs 21 Jan 2007 14:18:03 -0000 1.5 *************** *** 1,5 **** /* ! Copyright (C) 2002, 2004, 2005, 2006 Jeroen Frijters, Volker Berlin Copyright (C) 2006 Active Endpoints, Inc. This software is provided 'as-is', without any express or implied --- 1,6 ---- /* ! Copyright (C) 2002, 2004, 2005, 2006, 2007 Jeroen Frijters Copyright (C) 2006 Active Endpoints, Inc. + Copyright (C) 2006, 2007 Volker Berlin This software is provided 'as-is', without any express or implied --- NEW FILE: images.cs --- /* Copyright (C) 2002, 2004, 2005, 2006 Jeroen Frijters Copyright (C) 2006 Active Endpoints, Inc. Copyright (C) 2006, 2007 Volker Berlin This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Jeroen Frijters je...@fr... */ using System; using System.Drawing; using java.awt.image; using java.util; namespace ikvm.awt { // HACK Classpath should have a working BufferedImage, but currently it doesn't, until then, we // provide a hacked up version class NetBufferedImage : java.awt.image.BufferedImage { internal Bitmap bitmap; internal NetBufferedImage(Bitmap bitmap) : base(bitmap.Width, bitmap.Height, java.awt.image.BufferedImage.TYPE_INT_RGB) { this.bitmap = bitmap; } internal NetBufferedImage(int width, int height) : base(width, height, java.awt.image.BufferedImage.TYPE_INT_RGB) { bitmap = new Bitmap(width, height); using (Graphics g = Graphics.FromImage(bitmap)) { g.Clear(Color.White); } } public override java.awt.Graphics2D createGraphics() { Graphics g = Graphics.FromImage(bitmap); // HACK for off-screen images we don't want ClearType or anti-aliasing // TODO I'm sure Java 2D has a way to control text rendering quality, we should honor that g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; return new BitmapGraphics(bitmap); } public override java.awt.image.ImageProducer getSource() { int[] pix = new int[bitmap.Width * bitmap.Height]; for (int y = 0; y < bitmap.Height; y++) { for (int x = 0; x < bitmap.Width; x++) { pix[x + y * bitmap.Width] = bitmap.GetPixel(x, y).ToArgb(); } } return new java.awt.image.MemoryImageSource(bitmap.Width, bitmap.Height, pix, 0, bitmap.Width); } } class NetProducerImage : java.awt.Image, java.awt.image.ImageConsumer { private java.awt.image.ImageProducer source; private int mHeight = 0; private int mWidth = 0; private int mHintFlags = 0; private ColorModel mColorModel = null; private Hashtable mProperties; private Bitmap mBitmap; internal NetProducerImage(java.awt.image.ImageProducer source) { this.source = source; } public override void flush() { } public override java.awt.Graphics getGraphics() { return null; } public override int getHeight(ImageObserver param) { return mHeight; } public override int getWidth(ImageObserver param) { return mWidth; } public override object getProperty(string param, ImageObserver obs) { return null; } public override ImageProducer getSource() { return source; } public void setHints(int hintflags) { mHintFlags = hintflags; } public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, int scansize) { Console.WriteLine("NetBufferedImage: setPixels"); } /// <summary> /// Create a bitmap from the pixel array. The bitmap will be used /// by drawImage. /// </summary> void java.awt.image.ImageConsumer.setPixels(int aX, int aY, int w, int h, ColorModel model, int[] pixels, int off, int scansize) { mWidth = w; mHeight = h; mColorModel = model; mBitmap = new Bitmap(mWidth, mHeight); int pixel = 0; for (int y = 0; y < mHeight; ++y) { for (int x = 0; x < mWidth; x++) { uint argb = (uint)pixels[pixel++]; int blue = (int)argb & 0xff; argb >>= 8; int green = (int)argb & 0xff; argb >>= 8; int red = (int)argb & 0xff; argb >>= 8; int alpha = (int)argb & 0xff; mBitmap.SetPixel(x, y, Color.FromArgb(alpha, red, green, blue)); } } } public Bitmap getBitmap() { return mBitmap; } public void setDimensions(int width, int height) { mWidth = width; mHeight = height; } public void imageComplete(int status) { // Console.WriteLine("NetBufferedImage: imageComplete"); } public void setColorModel(ColorModel model) { mColorModel = model; } public void setProperties(Hashtable props) { mProperties = props; } } class NetVolatileImage : java.awt.image.VolatileImage { internal Bitmap bitmap; internal NetVolatileImage(int width, int height) { bitmap = new Bitmap(width, height); using (Graphics g = Graphics.FromImage(bitmap)) { g.Clear(Color.White); } } public override bool contentsLost() { return false; } public override int getHeight(ImageObserver io) { return bitmap.Height; } public override int getWidth(ImageObserver io) { return bitmap.Width; } public override object getProperty(string str, ImageObserver io) { throw new NotImplementedException(); } public override java.awt.Graphics2D createGraphics() { Graphics g = Graphics.FromImage(bitmap); // HACK for off-screen images we don't want ClearType or anti-aliasing // TODO I'm sure Java 2D has a way to control text rendering quality, we should honor that g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; return new BitmapGraphics(bitmap); } public override int getHeight() { return bitmap.Height; } public override int getWidth() { return bitmap.Width; } public override BufferedImage getSnapshot() { return new NetBufferedImage(bitmap); } public override int validate(java.awt.GraphicsConfiguration gc) { return 0; } public override java.awt.ImageCapabilities getCapabilities() { throw new NotImplementedException(); } } class NoImage : java.awt.Image { public override int getWidth(java.awt.image.ImageObserver observer) { if (observer != null) { observer.imageUpdate(this, java.awt.image.ImageObserver.__Fields.ERROR | java.awt.image.ImageObserver.__Fields.ABORT, 0, 0, -1, -1); } return -1; } public override int getHeight(java.awt.image.ImageObserver observer) { if (observer != null) { observer.imageUpdate(this, java.awt.image.ImageObserver.__Fields.ERROR | java.awt.image.ImageObserver.__Fields.ABORT, 0, 0, -1, -1); } return -1; } public override ImageProducer getSource() { return null; } public override java.awt.Graphics getGraphics() { // TODO throw java.lang.IllegalAccessError: getGraphics() only valid for images created with createImage(w, h) return null; } public override object getProperty(string name, java.awt.image.ImageObserver observer) { if (observer != null) { observer.imageUpdate(this, java.awt.image.ImageObserver.__Fields.ERROR | java.awt.image.ImageObserver.__Fields.ABORT, 0, 0, -1, -1); } return null; } public override void flush() { } } } Index: converter.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/converter.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** converter.cs 21 Jan 2007 12:59:59 -0000 1.4 --- converter.cs 21 Jan 2007 14:18:03 -0000 1.5 *************** *** 1,5 **** /* ! Copyright (C) 2002, 2004, 2005, 2006 Jeroen Frijters, Volker Berlin Copyright (C) 2006 Active Endpoints, Inc. This software is provided 'as-is', without any express or implied --- 1,6 ---- /* ! Copyright (C) 2002, 2004, 2005, 2006, 2007 Jeroen Frijters Copyright (C) 2006 Active Endpoints, Inc. + Copyright (C) 2006, 2007 Volker Berlin This software is provided 'as-is', without any express or implied Index: IKVM.AWT.WinForms.csproj =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/IKVM.AWT.WinForms.csproj,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** IKVM.AWT.WinForms.csproj 5 Jan 2007 08:14:18 -0000 1.6 --- IKVM.AWT.WinForms.csproj 21 Jan 2007 14:18:02 -0000 1.7 *************** *** 115,118 **** --- 115,123 ---- /> <File + RelPath = "images.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "toolkit.cs" SubType = "Component" Index: fonts.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/fonts.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** fonts.cs 21 Jan 2007 13:03:05 -0000 1.4 --- fonts.cs 21 Jan 2007 14:18:03 -0000 1.5 *************** *** 1,5 **** /* ! Copyright (C) 2002, 2004, 2005, 2006 Jeroen Frijters, Volker Berlin Copyright (C) 2006 Active Endpoints, Inc. This software is provided 'as-is', without any express or implied --- 1,6 ---- /* ! Copyright (C) 2002, 2004, 2005, 2006, 2007 Jeroen Frijters Copyright (C) 2006 Active Endpoints, Inc. + Copyright (C) 2006, 2007 Volker Berlin This software is provided 'as-is', without any express or implied |
From: Small S. <sma...@us...> - 2007-01-21 13:05:02
|
Update of /cvsroot/ikvm/ikvm/awt In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv8878 Modified Files: graphics.cs Log Message: getPaint and setPaint implemented Index: graphics.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/graphics.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** graphics.cs 14 Jan 2007 16:13:51 -0000 1.3 --- graphics.cs 21 Jan 2007 13:04:58 -0000 1.4 *************** *** 85,89 **** { protected Graphics g; ! private java.awt.Color jcolor; private Color color = SystemColors.WindowText; private Color bgcolor; --- 85,90 ---- { protected Graphics g; ! private java.awt.Color javaColor; ! private java.awt.Paint javaPaint; private Color color = SystemColors.WindowText; private Color bgcolor; *************** *** 419,427 **** public override java.awt.Color getColor() { ! if (jcolor == null) { ! jcolor = new java.awt.Color(color.ToArgb()); } ! return jcolor; } --- 420,428 ---- public override java.awt.Color getColor() { ! if (javaColor == null) { ! javaColor = new java.awt.Color(color.ToArgb()); } ! return javaColor; } *************** *** 468,472 **** //throw new java.lang.IllegalArgumentException("Color can't be null"); } ! this.jcolor = color; this.color = Color.FromArgb(color.getRGB()); if (brush is SolidBrush) --- 469,473 ---- //throw new java.lang.IllegalArgumentException("Color can't be null"); } ! this.javaPaint = this.javaColor = color; this.color = Color.FromArgb(color.getRGB()); if (brush is SolidBrush) *************** *** 480,483 **** --- 481,485 ---- } pen.Color = this.color; + pen.Brush = brush; } *************** *** 584,588 **** public override void setPaint(java.awt.Paint paint) { ! throw new NotImplementedException(); } --- 586,659 ---- public override void setPaint(java.awt.Paint paint) { ! if (paint is java.awt.Color) ! { ! setColor((java.awt.Color)paint); ! return; ! } ! ! if (this.javaPaint == paint) ! { ! return; ! } ! this.javaPaint = paint; ! ! if (paint is java.awt.GradientPaint) ! { ! java.awt.GradientPaint gradient = (java.awt.GradientPaint)paint; ! LinearGradientBrush linear; ! if (gradient.isCyclic()) ! { ! linear = new LinearGradientBrush( ! J2C.ConvertPoint(gradient.getPoint1()), ! J2C.ConvertPoint(gradient.getPoint2()), ! J2C.ConvertColor(gradient.getColor1()), ! J2C.ConvertColor(gradient.getColor2())); ! } ! else ! { ! //HACK because .NET does not support continue gradient like Java else Tile Gradient ! //that we receize the rectangle very large (factor z) and set 4 color values ! // a exact solution will calculate the size of the Graphics with the current transform ! Color color1 = J2C.ConvertColor(gradient.getColor1()); ! Color color2 = J2C.ConvertColor(gradient.getColor2()); ! float x1 = (float)gradient.getPoint1().getX(); ! float x2 = (float)gradient.getPoint2().getX(); ! float y1 = (float)gradient.getPoint1().getY(); ! float y2 = (float)gradient.getPoint2().getY(); ! float diffX = x2 - x1; ! float diffY = y2 - y1; ! const float z = 60; //HACK zoom factor, with a larger factor .NET will make the gradient wider. ! linear = new LinearGradientBrush( ! new PointF(x1 - z * diffX, y1 - z * diffY), ! new PointF(x2 + z * diffX, y2 + z * diffY), ! color1, ! color1); ! ColorBlend colorBlend = new ColorBlend(4); ! Color[] colors = colorBlend.Colors; ! colors[0] = colors[1] = color1; ! colors[2] = colors[3] = color2; ! float[] positions = colorBlend.Positions; ! positions[1] = z / (2 * z + 1); ! positions[2] = (z + 1) / (2 * z + 1); ! positions[3] = 1.0f; ! linear.InterpolationColors = colorBlend; ! } ! linear.WrapMode = WrapMode.TileFlipXY; ! brush = linear; ! pen.Brush = brush; ! return; ! } ! ! if (paint is java.awt.TexturePaint) ! { ! java.awt.TexturePaint texture = (java.awt.TexturePaint)paint; ! brush = new TextureBrush( ! J2C.ConvertImage(texture.getImage()), ! J2C.ConvertRect(texture.getAnchorRect())); ! pen.Brush = brush; ! return; ! } ! ! throw new NotImplementedException("setPaint("+paint.GetType().FullName+")"); } *************** *** 793,797 **** public override java.awt.Paint getPaint() { ! throw new NotImplementedException(); } --- 864,868 ---- public override java.awt.Paint getPaint() { ! return javaPaint; } |
From: Small S. <sma...@us...> - 2007-01-21 13:03:10
|
Update of /cvsroot/ikvm/ikvm/awt In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv8127 Modified Files: fonts.cs Log Message: * canDisplay and canDisplayUpTo added with a hack Index: fonts.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/fonts.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** fonts.cs 14 Jan 2007 16:13:51 -0000 1.3 --- fonts.cs 21 Jan 2007 13:03:05 -0000 1.4 *************** *** 30,33 **** --- 30,37 ---- using java.awt.geom; using java.util; + #if WINFX + using System.Windows; + using System.Windows.Media; + #endif *************** *** 159,168 **** public override bool canDisplay(java.awt.Font font, char param2) { ! throw new NotImplementedException(); } public override int canDisplayUpTo(java.awt.Font font, java.text.CharacterIterator param2, int param3, int param4) { ! throw new NotImplementedException(); } --- 163,174 ---- public override bool canDisplay(java.awt.Font font, char param2) { ! //HACK There is no equivalent in C# http://msdn2.microsoft.com/en-us/library/sf4dhbw8(VS.80).aspx ! return true; } public override int canDisplayUpTo(java.awt.Font font, java.text.CharacterIterator param2, int param3, int param4) { ! //HACK There is no equivalent in C# http://msdn2.microsoft.com/en-us/library/e8bh4szw(VS.80).aspx ! return -1; } |
From: Small S. <sma...@us...> - 2007-01-21 13:00:06
|
Update of /cvsroot/ikvm/ikvm/awt In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv6891 Modified Files: converter.cs Log Message: * ConvertColor added * ConvertPoint added * ConvertFont changed Index: converter.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/converter.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** converter.cs 14 Jan 2007 16:13:51 -0000 1.3 --- converter.cs 21 Jan 2007 12:59:59 -0000 1.4 *************** *** 50,53 **** --- 50,58 ---- { + internal static Color ConvertColor(java.awt.Color color) + { + return Color.FromArgb(color.getRGB()); + } + internal static Image ConvertImage(java.awt.Image img) { *************** *** 60,63 **** --- 65,72 ---- return ((NetVolatileImage)img).bitmap; } + if (img is NetProducerImage) + { + return ((NetProducerImage)img).getBitmap(); + } if (img is BufferedImage) { *************** *** 104,107 **** --- 113,126 ---- } + internal static PointF ConvertPoint(java.awt.geom.Point2D point) + { + return new PointF((float)point.getX(), (float)point.getY()); + } + + internal static RectangleF ConvertRect(java.awt.geom.Rectangle2D rect) + { + return new RectangleF((float)rect.getX(), (float)rect.getY(), (float)rect.getWidth(), (float)rect.getHeight()); + } + /// <summary> /// Create a rounded rectangle using lines and arcs *************** *** 241,246 **** internal static Font ConvertFont(String name, int style, float size) { ! FontFamily fam = CreateFontFamily(name); ! return new Font(fam, size, ConvertFontStyle(style), GraphicsUnit.Pixel); } --- 260,286 ---- internal static Font ConvertFont(String name, int style, float size) { ! if (size <= 0) ! { ! size = 1; ! } ! FontFamily family = CreateFontFamily(name); ! FontStyle fontStyle = ConvertFontStyle(style); ! if (!family.IsStyleAvailable(fontStyle)) ! { ! //Some Fonts (for example Aharoni) does not support Regular style. This throw an exception else it is not documented. ! if(family.IsStyleAvailable(FontStyle.Regular)){ ! fontStyle = FontStyle.Regular; ! }else ! if(family.IsStyleAvailable(FontStyle.Bold)){ ! fontStyle = FontStyle.Bold; ! }else ! if(family.IsStyleAvailable(FontStyle.Italic)){ ! fontStyle = FontStyle.Italic; ! }else ! if(family.IsStyleAvailable(FontStyle.Bold | FontStyle.Italic)){ ! fontStyle = FontStyle.Bold | FontStyle.Italic; ! } ! } ! return new Font(family, size, fontStyle, GraphicsUnit.Pixel); } |
From: Jeroen F. <jfr...@us...> - 2007-01-21 10:10:07
|
Update of /cvsroot/ikvm/ikvm/classpath In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14780/classpath Modified Files: allsources.lst Log Message: Index: allsources.lst =================================================================== RCS file: /cvsroot/ikvm/ikvm/classpath/allsources.lst,v retrieving revision 1.170 retrieving revision 1.171 diff -C2 -d -r1.170 -r1.171 *** allsources.lst 16 Jan 2007 14:31:21 -0000 1.170 --- allsources.lst 21 Jan 2007 10:10:00 -0000 1.171 *************** *** 3198,3201 **** --- 3198,3204 ---- ../../classpath/javax/accessibility/AccessibleTextSequence.java ../../classpath/javax/accessibility/AccessibleValue.java + ../../classpath/javax/activity/ActivityCompletedException.java + ../../classpath/javax/activity/ActivityRequiredException.java + ../../classpath/javax/activity/InvalidActivityException.java ../../classpath/javax/crypto/BadPaddingException.java ../../classpath/javax/crypto/Cipher.java *************** *** 3330,3333 **** --- 3333,3337 ---- ../../classpath/javax/management/Notification.java ../../classpath/javax/management/NotificationBroadcaster.java + ../../classpath/javax/management/NotificationBroadcasterSupport.java ../../classpath/javax/management/NotificationEmitter.java ../../classpath/javax/management/NotificationFilter.java |
From: Jeroen F. <jfr...@us...> - 2007-01-16 14:31:30
|
Update of /cvsroot/ikvm/ikvm/classpath In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv13512/classpath Modified Files: allsources.lst Log Message: Index: allsources.lst =================================================================== RCS file: /cvsroot/ikvm/ikvm/classpath/allsources.lst,v retrieving revision 1.169 retrieving revision 1.170 diff -C2 -d -r1.169 -r1.170 *** allsources.lst 15 Jan 2007 05:52:00 -0000 1.169 --- allsources.lst 16 Jan 2007 14:31:21 -0000 1.170 *************** *** 3288,3296 **** --- 3288,3299 ---- ../../classpath/javax/management/Attribute.java ../../classpath/javax/management/AttributeChangeNotification.java + ../../classpath/javax/management/AttributeChangeNotificationFilter.java ../../classpath/javax/management/AttributeList.java ../../classpath/javax/management/AttributeNotFoundException.java + ../../classpath/javax/management/AttributeValueExp.java ../../classpath/javax/management/BadAttributeValueExpException.java ../../classpath/javax/management/BadBinaryOpValueExpException.java ../../classpath/javax/management/BadStringOperationException.java + ../../classpath/javax/management/DefaultLoaderRepository.java ../../classpath/javax/management/DynamicMBean.java ../../classpath/javax/management/InstanceAlreadyExistsException.java *************** *** 3356,3359 **** --- 3359,3363 ---- ../../classpath/javax/management/openmbean/TabularType.java ../../classpath/javax/management/OperationsException.java + ../../classpath/javax/management/QueryEval.java ../../classpath/javax/management/QueryExp.java ../../classpath/javax/management/ReflectionException.java *************** *** 3363,3366 **** --- 3367,3371 ---- ../../classpath/javax/management/ServiceNotFoundException.java ../../classpath/javax/management/StandardMBean.java + ../../classpath/javax/management/StringValueExp.java ../../classpath/javax/management/ValueExp.java ../../classpath/javax/naming/AuthenticationException.java |
From: Jeroen F. <jfr...@us...> - 2007-01-16 12:12:10
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv22783/runtime Modified Files: vm.cs Log Message: - Changed JVM.CriticalFailure to write text to console when in static compiler. - Added text to JVM.CriticalFailure message box to explain about Ctrl+C for copying the text. Index: vm.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/vm.cs,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** vm.cs 14 Sep 2006 12:55:25 -0000 1.83 --- vm.cs 16 Jan 2007 12:12:08 -0000 1.84 *************** *** 277,287 **** { Tracer.Error(Tracer.Runtime, "CRITICAL FAILURE: {0}", message); // NOTE we use reflection to invoke MessageBox.Show, to make sure we run in environments where WinForms isn't available Assembly winForms = IsUnix ? null : Assembly.Load("System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); - Type messageBox = null; if(winForms != null) { messageBox = winForms.GetType("System.Windows.Forms.MessageBox"); } new ReflectionPermission(ReflectionPermissionFlag.MemberAccess #if !WHIDBEY --- 277,289 ---- { Tracer.Error(Tracer.Runtime, "CRITICAL FAILURE: {0}", message); + Type messageBox = null; + #if !STATIC_COMPILER // NOTE we use reflection to invoke MessageBox.Show, to make sure we run in environments where WinForms isn't available Assembly winForms = IsUnix ? null : Assembly.Load("System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); if(winForms != null) { messageBox = winForms.GetType("System.Windows.Forms.MessageBox"); } + #endif new ReflectionPermission(ReflectionPermissionFlag.MemberAccess #if !WHIDBEY *************** *** 291,294 **** --- 293,297 ---- message = String.Format("****** Critical Failure: {1} ******{0}{0}" + "PLEASE FILE A BUG REPORT FOR IKVM.NET WHEN YOU SEE THIS MESSAGE{0}{0}" + + (messageBox != null ? "(on Windows you can use Ctrl+C to copy the contents of this message to the clipboard){0}{0}" : "") + "{2}{0}" + "{3}{0}" + |
From: Jeroen F. <jfr...@us...> - 2007-01-16 12:11:00
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv22311/runtime Modified Files: JniInterface.cs Log Message: - Made JNIEnv.FatalError more compatible with JDK and removed call to JVM.CriticalFailure (which is reserved for IKVM bugs). - Centralised OEM string decoding. Index: JniInterface.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/JniInterface.cs,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** JniInterface.cs 19 Oct 2006 06:12:48 -0000 1.44 --- JniInterface.cs 16 Jan 2007 12:10:53 -0000 1.45 *************** *** 1110,1113 **** --- 1110,1125 ---- } + private static string StringFromOEM(byte* psz) + { + for(int i = 0;; i++) + { + if(psz[i] == 0) + { + int oem = System.Globalization.CultureInfo.CurrentCulture.TextInfo.OEMCodePage; + return new String((sbyte*)psz, 0, i, Encoding.GetEncoding(oem)); + } + } + } + internal static string StringFromUTF8(byte* psz) { *************** *** 1239,1243 **** // TODO what should the protection domain be? // NOTE I'm assuming name is platform encoded (as opposed to UTF-8), but the Sun JVM only seems to work for ASCII. ! return pEnv->MakeLocalRef(IKVM.NativeCode.java.lang.VMClassLoader.defineClassImpl(pEnv->UnwrapRef(loader), name != null ? new String((sbyte*)name) : null, buf, 0, buf.Length, null)); } catch(Exception x) --- 1251,1255 ---- // TODO what should the protection domain be? // NOTE I'm assuming name is platform encoded (as opposed to UTF-8), but the Sun JVM only seems to work for ASCII. ! return pEnv->MakeLocalRef(IKVM.NativeCode.java.lang.VMClassLoader.defineClassImpl(pEnv->UnwrapRef(loader), name != null ? StringFromOEM(name) : null, buf, 0, buf.Length, null)); } catch(Exception x) *************** *** 1266,1270 **** try { ! string name = new String((sbyte*)pszName); // don't allow dotted names! if(name.IndexOf('.') >= 0) --- 1278,1282 ---- try { ! string name = StringFromOEM(pszName); // don't allow dotted names! if(name.IndexOf('.') >= 0) *************** *** 1368,1372 **** { wrapper.Finish(); ! exception = (Exception)mw.Invoke(null, new object[] { new String((sbyte*)msg) }, false); rc = JNI_OK; } --- 1380,1384 ---- { wrapper.Finish(); ! exception = (Exception)mw.Invoke(null, new object[] { StringFromOEM(msg) }, false); rc = JNI_OK; } *************** *** 1421,1425 **** internal static void FatalError(JNIEnv* pEnv, byte* msg) { ! JVM.CriticalFailure(new String((sbyte*)msg), null); } --- 1433,1439 ---- internal static void FatalError(JNIEnv* pEnv, byte* msg) { ! Console.Error.WriteLine("FATAL ERROR in native method: {0}", msg == null ? "(null)" : StringFromOEM(msg)); ! Console.Error.WriteLine(new StackTrace(1, true)); ! Environment.Exit(1); } |