From b3dca00062ec0fcb42234f64b3ae66329fad1f27 Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Tue, 19 Apr 2016 22:28:16 -0400 Subject: [PATCH] [jnienv-gen] Import jnienv-gen from monodroid/c3f7a887 jnienv-gen.exe is used to generate a partial class declaration for Android.Runtime.JNIEnv. It will be needed to generate and build Mono.Android.dll. --- Xamarin.Android.sln | 7 + build-tools/jnienv-gen/Generator.cs | 700 ++++++ build-tools/jnienv-gen/Generator.g.cs | 2076 +++++++++++++++++ build-tools/jnienv-gen/Mono.Options-PCL.cs | 1414 +++++++++++ .../jnienv-gen/Properties/AssemblyInfo.cs | 27 + build-tools/jnienv-gen/jnienv-gen.csproj | 44 + build-tools/jnienv-gen/packages.config | 4 + 7 files changed, 4272 insertions(+) create mode 100644 build-tools/jnienv-gen/Generator.cs create mode 100644 build-tools/jnienv-gen/Generator.g.cs create mode 100644 build-tools/jnienv-gen/Mono.Options-PCL.cs create mode 100644 build-tools/jnienv-gen/Properties/AssemblyInfo.cs create mode 100644 build-tools/jnienv-gen/jnienv-gen.csproj create mode 100644 build-tools/jnienv-gen/packages.config diff --git a/Xamarin.Android.sln b/Xamarin.Android.sln index e896e3bf95b..72a54bb7d43 100644 --- a/Xamarin.Android.sln +++ b/Xamarin.Android.sln @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Tools.Boots EndProject Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "mono-runtimes", "build-tools\mono-runtimes\mono-runtimes.mdproj", "{C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jnienv-gen", "build-tools\jnienv-gen\jnienv-gen.csproj", "{AFB8F6D1-6EA9-42C3-950B-98F34C669AD2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|AnyCPU = Debug|AnyCPU @@ -27,11 +29,16 @@ Global {C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2}.Debug|AnyCPU.Build.0 = Debug|Any CPU {C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2}.Release|AnyCPU.ActiveCfg = Release|Any CPU {C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2}.Release|AnyCPU.Build.0 = Release|Any CPU + {AFB8F6D1-6EA9-42C3-950B-98F34C669AD2}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {AFB8F6D1-6EA9-42C3-950B-98F34C669AD2}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {AFB8F6D1-6EA9-42C3-950B-98F34C669AD2}.Release|AnyCPU.ActiveCfg = Release|Any CPU + {AFB8F6D1-6EA9-42C3-950B-98F34C669AD2}.Release|AnyCPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {8FF78EB6-6FC8-46A7-8A15-EBBA9045C5FA} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62} {E8492EFB-D14A-4F32-AA28-88848322ECEA} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62} {C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62} + {AFB8F6D1-6EA9-42C3-950B-98F34C669AD2} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62} EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution Policies = $0 diff --git a/build-tools/jnienv-gen/Generator.cs b/build-tools/jnienv-gen/Generator.cs new file mode 100644 index 00000000000..5ed4318b084 --- /dev/null +++ b/build-tools/jnienv-gen/Generator.cs @@ -0,0 +1,700 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; + +using Mono.Options; + +namespace Xamarin.Android.JniEnv +{ + partial class Generator + { + static string monodroid_root = Path.GetDirectoryName ( + Path.GetDirectoryName ( + Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly ().Location))); + static string jnienv_g_cs; + static bool useJavaInterop; + + public static int Main (string [] args) + { + var opts = new OptionSet { + { "use-java-interop", v => useJavaInterop = v != null }, + { "root=", v => monodroid_root = v }, + { "o=", v => jnienv_g_cs = v }, + }; + opts.Parse (args); + if (string.IsNullOrEmpty (jnienv_g_cs)) { + jnienv_g_cs = Path.Combine (monodroid_root, "Mono.Android", "src", "Runtime", "JNIEnv.g.cs"); + } + try { + using (TextWriter w = new StringWriter ()) { + w.NewLine = "\n"; + GenerateFile (w); + string content = w.ToString (); + if (jnienv_g_cs == "-") + Console.Out.WriteLine (content); + else if (!File.Exists (jnienv_g_cs) || !string.Equals (content, File.ReadAllText (jnienv_g_cs))) + File.WriteAllText (jnienv_g_cs, content); + } + return 0; + } catch (Exception ex) { + Console.WriteLine (ex); + return 1; + } + } + + static string Escape (string value) + { + switch (value) { + case "string": + case "ref": + return "@" + value; + default: return value; + } + } + + static void GenerateFile (TextWriter o) + { + o.WriteLine ("// Generated file; DO NOT EDIT!"); + o.WriteLine ("//"); + o.WriteLine ("// To make changes, edit monodroid/tools/jnienv-gen and rerun"); + o.WriteLine (); + o.WriteLine ("using System;"); + o.WriteLine ("using System.Runtime.ExceptionServices;"); + o.WriteLine ("using System.Runtime.InteropServices;"); + o.WriteLine ("using System.Threading;"); + if (useJavaInterop) { + o.WriteLine (); + o.WriteLine ("using Java.Interop;"); + } + o.WriteLine (); + o.WriteLine ("namespace Android.Runtime {"); + o.WriteLine (); + GenerateJniEnv (o); + o.WriteLine (); + GenerateJniNativeInterface (o); + o.WriteLine (); + GenerateJniNativeInterfaceInvoker (o); + o.WriteLine ("}"); + } + + static void GenerateJniNativeInterface (TextWriter o) + { + if (useJavaInterop) + return; + o.WriteLine ("\t[StructLayout (LayoutKind.Sequential)]"); + o.WriteLine ("\tpartial struct JniNativeInterfaceStruct {"); + o.WriteLine (); + + int maxName = JNIEnvEntries.Max (e => e.Name.Length); + + o.WriteLine ("#pragma warning disable 0649 // Field is assigned to, and will always have its default value `null`; ignore as it'll be set in native code."); + o.WriteLine ("#pragma warning disable 0169 // Field never used; ignore since these fields make the structure have the right layout."); + + for (int i = 0; i < 4; i++) + o.WriteLine ("\t\tprivate IntPtr reserved{0}; // void*", i); + + foreach (var e in JNIEnvEntries) { + o.WriteLine ("\t\tpublic IntPtr {0};{1} // {2}", e.Name, new string (' ', maxName - e.Name.Length), e.Prototype); + } + o.WriteLine ("#pragma warning restore 0169"); + o.WriteLine ("#pragma warning restore 0649"); + o.WriteLine ("\t}"); + } + + static string Initialize (JniFunction e, string prefix) + { + //return String.Format ("{2}{0} = GetDelegate<{1}>(JniEnv.{0});", e.Name, e.Delegate, prefix); + return String.Format ("{2}{0} = ({1}) Marshal.GetDelegateForFunctionPointer (JniEnv.{0}, typeof ({1}));", e.Name, e.Delegate, prefix); + } + + static void GenerateJniNativeInterfaceInvoker (TextWriter o) + { + if (useJavaInterop) + return; + o.WriteLine ("\tpartial class JniNativeInterfaceInvoker {"); + o.WriteLine (); + o.WriteLine ("\t\tJniNativeInterfaceStruct JniEnv;"); + o.WriteLine (); + o.WriteLine ("\t\tpublic unsafe JniNativeInterfaceInvoker (JniNativeInterfaceStruct* p)"); + o.WriteLine ("\t\t{"); + o.WriteLine ("\t\t\tJniEnv = *p;"); + + foreach (var e in JNIEnvEntries) { + if (e.Delegate == null) + continue; + if (!e.Prebind) + continue; + o.WriteLine ("\t\t\t{0}", Initialize (e, "")); + } + + o.WriteLine ("\t\t}"); + o.WriteLine (); + + foreach (var e in JNIEnvEntries) { + if (e.Delegate == null) + continue; + o.WriteLine (); + if (e.Prebind) + o.WriteLine ("\t\tpublic readonly {0} {1};\n", e.Delegate, e.Name); + else { + o.WriteLine ("\t\t{0} _{1};", e.Delegate, e.Name); + o.WriteLine ("\t\tpublic {0} {1} {{", e.Delegate, e.Name); + o.WriteLine ("\t\t\tget {"); + o.WriteLine ("\t\t\t\tif (_{0} == null)\n\t\t\t\t\t{1}", e.Name, Initialize (e, "_")); + o.WriteLine ("\t\t\t\treturn _{0};\n\t\t\t}}", e.Name); + o.WriteLine ("\t\t}"); + } + } + + o.WriteLine ("\t}"); + } + + + static HashSet created_delegates = new HashSet (); + + static void CreateDelegate (TextWriter o, JniFunction entry) + { + StringBuilder builder = new StringBuilder (); + StringBuilder name = new StringBuilder (); + bool has_char_array = false; + + Func FixupType = t => t.Replace ("*", "Ref").Replace ("[]", "Array").Replace (" ", ""); + + builder.AppendFormat ("\t\tinternal unsafe delegate {0} % (IntPtr env", entry.ReturnType.ManagedType, entry.Name); + name.Append ("IntPtr"); + for (int i = 0; i < entry.Parameters.Length; i++) { + if (i >= 0) { + builder.Append (", "); + builder.AppendFormat ("{0} {1}", entry.Parameters [i].Type.ManagedType, entry.Parameters [i].Name); + } + + if (entry.Parameters [i].Type.ManagedType == "va_list") + return; + if (entry.Parameters [i].Type.ManagedType == "char[]") + has_char_array = true; + + name.AppendFormat ("_").Append (FixupType (entry.Parameters [i].Type.ManagedType)); + } + name.Append ("_").Append (FixupType (entry.ReturnType.ManagedType)); + name.Append ("_Delegate"); + builder.Append (");\n"); + builder.Replace ("%", name.ToString ()); + + entry.Delegate = "JNIEnv." + name.ToString (); + if (created_delegates.Contains (name.ToString ())) + return; + + created_delegates.Add (name.ToString ()); + if (entry.Name == "NewString" || has_char_array) + o.WriteLine ("\t\t[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl, CharSet=CharSet.Unicode)]"); + o.Write (builder.ToString ()); + } + + static void GenerateJniEnv (TextWriter o) + { + o.WriteLine ("\tpublic static partial class JNIEnv {"); + foreach (JniFunction entry in JNIEnvEntries) { + if (entry.Parameters == null) + continue; + + o.WriteLine (); + if (!useJavaInterop) { + CreateDelegate (o, entry); + } + + if (entry.IsPrivate || entry.CustomWrapper) + continue; + + switch (entry.ApiName) { + case "NewArray": + var copyArray = JNIEnvEntries.Single (e => e.Name.StartsWith ("Get") && e.Name.EndsWith ("ArrayRegion") && + e.Parameters [0].Type.Type == entry.ReturnType.Type); + o.Write ("\t\t{2} static {0} {1} (", entry.ReturnType.ManagedType, entry.ApiName, entry.Visibility); + o.WriteLine ("{0} array)", copyArray.Parameters [3].Type.ManagedType); + o.WriteLine ("\t\t{"); + o.WriteLine ("\t\t\tif (array == null)"); + o.WriteLine ("\t\t\t\treturn IntPtr.Zero;"); + if (useJavaInterop) { + o.WriteLine ("\t\t\tJniObjectReference result;"); + o.WriteLine ("\t\t\tresult = JniEnvironment.{0}.{1} (array.Length);", entry.DeclaringType, entry.Name); + o.WriteLine ("\t\t\tCopyArray (array, result.Handle);"); + o.WriteLine ("\t\t\treturn result.Handle;"); + o.WriteLine ("\t\t}"); + break; + } + o.WriteLine ("\t\t\tIntPtr result;"); + o.WriteLine ("\t\t\tresult = Env.{0} (Handle, array.Length);", entry.Name); + RaiseException (o, entry); + o.WriteLine ("\t\t\tCopyArray (array, result);"); + o.WriteLine ("\t\t\treturn result;"); + o.WriteLine ("\t\t}"); + break; + case "CopyArray": + o.Write ("\t\t{2} static unsafe {0} {1} (", entry.ReturnType.ManagedType, entry.ApiName, entry.Visibility); + if (entry.Name.StartsWith ("G")) { + o.WriteLine ("IntPtr src, {0} dest)", entry.Parameters [3].Type.ManagedType); + o.WriteLine ("\t\t{"); + o.WriteLine ("\t\t\tif (src == IntPtr.Zero)"); + o.WriteLine ("\t\t\t\treturn;"); + if (useJavaInterop) { + var t = entry.Parameters [3].Type.ManagedType.Replace ("[]", "*"); + o.WriteLine ("\t\t\tfixed ({0} __p = dest)", t); + o.WriteLine ("\t\t\t\tJniEnvironment.{0}.{1} (new JniObjectReference (src), 0, dest.Length, {2}__p);", + entry.DeclaringType, + entry.Name, + t == "byte*" ? "(sbyte*) " : ""); + o.WriteLine ("\t\t}"); + break; + } + o.WriteLine ("\t\t\tEnv.{0} (Handle, src, 0, dest.Length, dest);", entry.Name); + } else { + o.WriteLine ("{0} src, IntPtr dest)", entry.Parameters [3].Type.ManagedType); + o.WriteLine ("\t\t{"); + o.WriteLine ("\t\t\tif (src == null)"); + o.WriteLine ("\t\t\t\tthrow new ArgumentNullException (\"src\");"); + if (useJavaInterop) { + var t = entry.Parameters [3].Type.ManagedType.Replace ("[]", "*"); + o.WriteLine ("\t\t\tfixed ({0} __p = src)", t); + o.WriteLine ("\t\t\t\tJniEnvironment.{0}.{1} (new JniObjectReference (dest), 0, src.Length, {2}__p);", + entry.DeclaringType, + entry.Name, + t == "byte*" ? "(sbyte*) " : ""); + o.WriteLine ("\t\t}"); + break; + } + o.WriteLine ("\t\t\tEnv.{0} (Handle, dest, 0, src.Length, src);", entry.Name); + } + RaiseException (o, entry); + o.WriteLine ("\t\t}"); + break; + default: + GenerateDefaultJniFunction (o, entry); + break; + } + } + o.WriteLine ("\t}"); + } + + static void WriteJniFunctionParameters (TextWriter o, JniFunction entry, bool generateParamsOverload) + { + o.Write ("("); + for (int i = 0; i < entry.Parameters.Length; i++) { + if (i > 0) + o.Write (", "); + if (!entry.Parameters [i].IsParamArray) { + o.Write ("{0} {1}", entry.Parameters [i].Type.ManagedType, Escape (entry.Parameters [i].Name)); + } else if (generateParamsOverload && i == entry.Parameters.Length -1) { + o.Write ("{0} {1}", entry.Parameters [i].Type.ManagedType, Escape (entry.Parameters [i].Name)); + } else { + o.Write ("params {0} {1}", entry.Parameters [i].Type.ManagedType.Replace ("*", "[]"), Escape (entry.Parameters [i].Name)); + } + } + o.WriteLine (")"); + } + + static void GenerateDefaultJniFunction (TextWriter o, JniFunction entry) + { + bool generateParamsOverload = entry.Parameters.Length > 1 && + entry.Parameters [entry.Parameters.Length-1].IsParamArray && + entry.Parameters [entry.Parameters.Length-1].Type.ManagedType == "JValue*"; + + if (GenerateDefaultJavaInteropForwarder (o, entry, generateParamsOverload)) + return; + + o.Write ("\t\t{0} static {1}{2} {3} ", + entry.Visibility, generateParamsOverload ? "unsafe " : "", entry.ReturnType.ManagedType, entry.ApiName); + bool is_void = entry.ReturnType.ManagedType == "void"; + var lastName = entry.Parameters.Length == 0 + ? "" + : entry.Parameters[entry.Parameters.Length - 1].Name; + WriteJniFunctionParameters (o, entry, generateParamsOverload); + o.WriteLine ("\t\t{"); + + NullCheckParameters (o, entry.Parameters); + o.Write ("\t\t\t"); + if (!is_void) + o.Write ("{0} tmp = ", entry.ReturnType.ManagedType); + o.Write ("Env.{0} (Handle", entry.Name); + for (int i = 0; i < entry.Parameters.Length; i++) { + o.Write (", "); + if (entry.Parameters [i].Type.ManagedType.StartsWith ("out ")) + o.Write ("out "); + o.Write (Escape (entry.Parameters [i].Name)); + } + o.WriteLine (");"); + RaiseException (o, entry); + if (is_void) { + } + else if (entry.ReturnType.ManagedType == "IntPtr" && entry.ReturnType.Type.StartsWith ("j") && !entry.ReturnType.Type.EndsWith ("ID")) { + o.WriteLine ("\t\t\treturn LogCreateLocalRef (tmp);"); + } else { + o.WriteLine ("\t\t\treturn tmp;"); + } + o.WriteLine ("\t\t}"); + + if (!generateParamsOverload) + return; + o.WriteLine (); + o.Write ("\t\t{0} static {1}{2} {3} ", + entry.Visibility, "unsafe ", entry.ReturnType.ManagedType, entry.ApiName); + WriteJniFunctionParameters (o, entry, false); + o.WriteLine ("\t\t{"); + o.WriteLine ("\t\t\tfixed (JValue* __p = {0}) {{", Escape (entry.Parameters [entry.Parameters.Length-1].Name)); + o.WriteLine ("\t\t\t\t{0}{1} ({2}, __p);", + is_void ? "" : "return ", + entry.ApiName, + string.Join (", ", entry.Parameters.Take (entry.Parameters.Length-1).Select (p => Escape (p.Name)))); + o.WriteLine ("\t\t\t}"); + o.WriteLine ("\t\t}"); + } + + static bool GenerateDefaultJavaInteropForwarder (TextWriter o, JniFunction entry, bool generateParamsOverload) + { + if (!useJavaInterop) + return false; + + switch (entry.Name) { + // These must be hand-bound + case "GetBooleanArrayRegion": + case "GetJavaVM": + case "GetStringChars": + case "GetVersion": + case "RegisterNatives": + case "ReleaseStringChars": + case "SetBooleanArrayRegion": + return true; + } + + o.Write ("\t\t{0} static unsafe {1} {2} ", + entry.Visibility, + entry.ReturnType.ManagedType, + entry.ApiName); + bool is_void = entry.ReturnType.ManagedType == "void"; + var lastName = entry.Parameters.Length == 0 + ? "" + : entry.Parameters[entry.Parameters.Length - 1].Name; + WriteJniFunctionParameters (o, entry, generateParamsOverload); + o.WriteLine ("\t\t{"); + o.Write ("\t\t\t"); + if (!is_void) + o.Write ("return "); + var n = entry.Name; + if (n.StartsWith ("Call")) + n = n.TrimEnd (new[]{'A'}); + o.Write ("JniEnvironment.{0}.{1} (", entry.DeclaringType, n); + for (int i = 0; i < entry.Parameters.Length; i++) { + if (i > 0) + o.Write (", "); + if (entry.Parameters [i].Type.ManagedType.StartsWith ("out ")) + o.Write ("out "); + if (entry.Parameters [i].Type.ManagedType == "JValue*") + o.Write ("(JniArgumentValue*) " + Escape (entry.Parameters [i].Name)); + else if (IsObjectReferenceType (entry.Parameters [i].Type)) + o.Write (string.Format ("new JniObjectReference ({0})", Escape (entry.Parameters [i].Name))); + else if (IsMemberID (entry.Parameters [i].Type)) { + string ctorFormat = null; + switch (entry.Parameters [i].Type.Type) { + case "jfieldID": ctorFormat = "new JniFieldInfo ({0}, isStatic: false)"; break; + case "jmethodID": ctorFormat = "new JniMethodInfo ({0}, isStatic: false)"; break; + case "jstaticfieldID": ctorFormat = "new JniFieldInfo ({0}, isStatic: true)"; break; + case "jstaticmethodID": ctorFormat = "new JniMethodInfo ({0}, isStatic: true)"; break; + default: + throw new NotSupportedException ("Don't know how to deal with: " + entry.Parameters [i].Type.Type); + } + o.Write (string.Format (ctorFormat, Escape (entry.Parameters [i].Name))); + } + else + o.Write (Escape (entry.Parameters [i].Name)); + } + o.Write (")"); + if (IsObjectReferenceType (entry.ReturnType)) + o.Write (".Handle"); + if (IsMemberID (entry.ReturnType)) + o.Write (".ID"); + o.WriteLine (";"); + o.WriteLine ("\t\t}"); + + if (!generateParamsOverload) + return true; + o.WriteLine (); + o.Write ("\t\t{0} static {1}{2} {3} ", + entry.Visibility, "unsafe ", entry.ReturnType.ManagedType, entry.ApiName); + WriteJniFunctionParameters (o, entry, false); + o.WriteLine ("\t\t{"); + o.WriteLine ("\t\t\tfixed (JValue* __p = {0}) {{", Escape (entry.Parameters [entry.Parameters.Length-1].Name)); + o.WriteLine ("\t\t\t\t{0}{1} ({2}, __p);", + is_void ? "" : "return ", + entry.ApiName, + string.Join (", ", entry.Parameters.Take (entry.Parameters.Length-1).Select (p => Escape (p.Name)))); + o.WriteLine ("\t\t\t}"); + o.WriteLine ("\t\t}"); + + return true; + } + + static bool IsObjectReferenceType (TypeInfo type) + { + switch (type.Type) { + case "jobject": + case "jclass": + case "jthrowable": + case "jstring": + case "jarray": + case "jweak": + return true; + } + if (type.Type.StartsWith ("j") && type.Type.EndsWith("Array")) + return true; + return false; + } + + static bool IsMemberID (TypeInfo type) + { + switch (type.Type) { + case "jfieldID": + case "jmethodID": + case "jstaticfieldID": + case "jstaticmethodID": + return true; + } + return false; + } + + static void NullCheckParameters (TextWriter o, ParamInfo[] ps) + { + bool haveChecks = false; + for (int i = 0; i < ps.Length; i++) { + var p = ps [i]; + if (p.CanBeNull) + continue; + if (p.Type.ManagedType == "IntPtr") { + haveChecks = true; + o.WriteLine ("\t\t\tif ({0} == IntPtr.Zero)", Escape (p.Name), p.Type.ManagedType); + o.WriteLine ("\t\t\t\tthrow new ArgumentException (\"'{0}' must not be IntPtr.Zero.\", \"{0}\");", Escape (p.Name)); + continue; + } + if (p.Type.ManagedType == "string") { + haveChecks = true; + o.WriteLine ("\t\t\tif ({0} == null)", Escape (p.Name), p.Type.ManagedType); + o.WriteLine ("\t\t\t\tthrow new ArgumentNullException (\"{0}\");", Escape (p.Name)); + continue; + } + } + if (haveChecks) + o.WriteLine (); + } + + static void RaiseException (TextWriter o, JniFunction entry) + { + if (!entry.Throws) + return; + + o.WriteLine (); + o.WriteLine ("\t\t\tException __e = AndroidEnvironment.GetExceptionForLastThrowable ();"); + o.WriteLine ("\t\t\tif (__e != null)"); + o.WriteLine ("\t\t\t\tExceptionDispatchInfo.Capture (__e).Throw ();"); + o.WriteLine (); + } + + } + + class JniFunction { + public string DeclaringType; + + // The java name + public string Name; + + // The name of the property/method we will generate. Defaults to the (java) name. + private string api_name; + public string ApiName + { + get { return api_name ?? Name; } + set { api_name = value; } + } + + // The C prototype that we are binding (for diagnostic purposes) + public string Prototype; + + public TypeInfo ReturnType; + public ParamInfo [] Parameters; + + // If true, then we initialize the binding on the static ctor, we dont lazy-define it + public bool Prebind; + + // If there is a custom wrapper in JNIEnv (so an automatic one shouldn't be generated) + public bool CustomWrapper; + + // If the JNI function can throw an exception (ExceptionOccurred needs to be invoked) + public bool Throws; + + // The signature of the C# delegate that we will use for the generated property + private string @delegate; + public string Delegate + { + get + { + StringBuilder d; + + if (@delegate != null) + return @delegate; + + if (Parameters == null) + return null; + + if (IsPrivate) + return null; + + d = new StringBuilder (); + bool is_void = ReturnType.Type == "void"; + + if (is_void) { + d.Append ("Action"); + + return d.ToString (); + } + set + { + @delegate = value; + } + } + + private string visibility; + public string Visibility { + get { + if (visibility == null) + return "public"; + return visibility; + } + set { + visibility = value; + } + } + + public bool IsPublic { get { return Visibility == "public"; } } + public bool IsPrivate { get { return visibility == "private"; } } + } + + class TypeInfo + { + public string Type; + + private string managed_type; + public string ManagedType + { + get { return managed_type ?? GetManagedType (Type); } + set { managed_type = value; } + } + + public string GetManagedType (string native_type) + { + switch (native_type) { + case "jvalue*": + return "JValue*"; + case "jbyte": return "sbyte"; + case "jchar": return "char"; + case "jshort": return "short"; + case "jsize": + case "jint": return "int"; + case "jlong": return "long"; + case "jfloat": return "float"; + case "jdouble": return "double"; + case "jboolean": return "bool"; + case "": return "void"; + case "jobject": + case "jclass": + case "void*": + case "jfieldID": + case "jmethodID": + case "jstaticfieldID": + case "jstaticmethodID": + case "jmethod": + case "jthrowable": + case "jstring": + case "jchar*": + case "jarray": + case "jweak": + return "IntPtr"; + case "const jchar*": + case "const char*": + return "string"; + case "JavaVM**": + return "out IntPtr"; + case "const JNINativeMethod*": + return "JNINativeMethod []"; + case "jobjectRefType": + return "int"; + default: + if (native_type.EndsWith ("Array")) + return "IntPtr"; + if (native_type.EndsWith ("*")) + return "IntPtr"; + return native_type; + } + } + + public TypeInfo () + { + } + + public TypeInfo (string Type, string ManagedType = null) + { + this.Type = Type; + this.ManagedType = ManagedType; + } + + public static implicit operator TypeInfo (string type) + { + return new TypeInfo (type); + } + } + + class ParamInfo + { + public TypeInfo Type; + public string Name; + public bool IsParamArray; + public bool CanBeNull; + + public ParamInfo (TypeInfo Type, string Name, bool IsParamArray) + { + this.Type = Type; + this.Name = Name; + this.IsParamArray = IsParamArray; + } + + public ParamInfo (TypeInfo Type, string Name = null, Modifier m = 0) + { + this.Type = Type; + this.Name = Name; + IsParamArray = (m & Modifier.Params) != 0; + CanBeNull = (m & Modifier.CanBeNull) != 0; + } + } + + [Flags] + enum Modifier { + None = 0, + Params = 1, + CanBeNull = 2, + } +} + diff --git a/build-tools/jnienv-gen/Generator.g.cs b/build-tools/jnienv-gen/Generator.g.cs new file mode 100644 index 00000000000..fb4a1f3675b --- /dev/null +++ b/build-tools/jnienv-gen/Generator.g.cs @@ -0,0 +1,2076 @@ +namespace Xamarin.Android.JniEnv +{ + partial class Generator + { + const string VersionsCategory = "Versions"; + const string ClassesCategory = "Types"; + const string ExceptionsCategory = "Exceptions"; + const string ReferencesCatgeory = "References"; + const string ObjectOperationsCategory = "Object"; + const string InstanceFieldsCategory = "InstanceFields"; + const string StaticFieldsCategory = "StaticFields"; + const string InstanceMethodsCategory = "InstanceMethods"; + const string StaticMethodsCategory = "StaticMethods"; + const string StringOperationsCategory = "Strings"; + const string ArrayOperationsCategory = "Arrays"; + const string NativeMethodsCategory = "Types"; + const string MonitorOperationsCategory = "Monitors"; + const string NIOSupportCategory = "IO"; + const string ReflectionSupportCategory = "Reflection"; + const string JavaVMCategory = "References"; + + static readonly JniFunction[] JNIEnvEntries = new JniFunction[]{ + new JniFunction { + DeclaringType = VersionsCategory, + Name = "GetVersion", + Visibility = "internal", + Prototype = "jint (*GetVersion)(JNIEnv*);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {}, + }, + new JniFunction { + DeclaringType = ClassesCategory, + Name = "DefineClass", + Visibility = "private", + Throws = true, + Prototype = "jclass (*DefineClass)(JNIEnv*, const char, jobject, const jbyte*, jsize);", + ReturnType = new TypeInfo ("jclass"), + Parameters = new ParamInfo [] {new ParamInfo ("const char*", "name"), new ParamInfo ("jobject", "loader"), new ParamInfo ("const jbyte*", "buf"), new ParamInfo ("jsize", "bufLen")}, + }, + new JniFunction { + DeclaringType = ClassesCategory, + Name = "FindClass", + ApiName = "_FindClass", + Visibility = "internal", + // Prebind = true, + Throws = true, + Prototype = "jclass (*FindClass)(JNIEnv*, const char*);", + ReturnType = new TypeInfo ("jclass"), + Parameters = new ParamInfo [] {new ParamInfo ("const char*", "classname")}, + }, + new JniFunction { + DeclaringType = ReflectionSupportCategory, + Name = "FromReflectedMethod", + Visibility = "private", + Prototype = "jmethodID (*FromReflectedMethod)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("jmethodID"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "method")}, + }, + new JniFunction { + DeclaringType = ReflectionSupportCategory, + Name = "FromReflectedField", + Visibility = "private", + Prototype = "jfieldID (*FromReflectedField)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("jfieldID"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "field")}, + }, + new JniFunction { + DeclaringType = ReflectionSupportCategory, + Name = "ToReflectedMethod", + Visibility = "private", + Prototype = "jobject (*ToReflectedMethod)(JNIEnv*, jclass, jmethodID, jboolean);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "cls"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jboolean", "isStatic")}, + }, + new JniFunction { + DeclaringType = ClassesCategory, + Name = "GetSuperclass", + Visibility = "public", + Prototype = "jclass (*GetSuperclass)(JNIEnv*, jclass);", + ReturnType = new TypeInfo ("jclass"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass")}, + }, + new JniFunction { + DeclaringType = ClassesCategory, + Name = "IsAssignableFrom", + Visibility = "public", + Prototype = "jboolean (*IsAssignableFrom)(JNIEnv*, jclass, jclass);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "clazz1"), new ParamInfo ("jclass", "clazz2")}, + }, + new JniFunction { + DeclaringType = ReflectionSupportCategory, + Name = "ToReflectedField", + Visibility = "private", + Prototype = "jobject (*ToReflectedField)(JNIEnv*, jclass, jfieldID, jboolean);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "cls"), new ParamInfo ("jfieldID", "jfieldID"), new ParamInfo ("jboolean", "isStatic")}, + }, + new JniFunction { + DeclaringType = ExceptionsCategory, + Name = "Throw", + CustomWrapper = true, + Visibility = "public", + // Throws = true, + Prototype = "jint (*Throw)(JNIEnv*, jthrowable);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jthrowable", "obj")}, + }, + new JniFunction { + DeclaringType = ExceptionsCategory, + Name = "ThrowNew", + CustomWrapper = true, + Visibility = "public", + // Throws = true, + Prototype = "jint (*ThrowNew)(JNIEnv*, jclass, const char*);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "clazz"), new ParamInfo ("const char*", "message")}, + }, + new JniFunction { + DeclaringType = ExceptionsCategory, + Name = "ExceptionOccurred", + Visibility = "public", + Prototype = "jthrowable (*ExceptionOccurred)(JNIEnv*);", + ReturnType = new TypeInfo ("jthrowable"), + Parameters = new ParamInfo [] {}, + }, + new JniFunction { + DeclaringType = ExceptionsCategory, + Name = "ExceptionDescribe", + Visibility = "public", + Prototype = "void (*ExceptionDescribe)(JNIEnv*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {}, + }, + new JniFunction { + DeclaringType = ExceptionsCategory, + Name = "ExceptionClear", + Visibility = "public", + Prototype = "void (*ExceptionClear)(JNIEnv*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {}, + }, + new JniFunction { + DeclaringType = ExceptionsCategory, + Name = "FatalError", + Visibility = "private", + Prototype = "void (*FatalError)(JNIEnv*, const char*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("const char*", "msg")}, + }, + new JniFunction { + DeclaringType = ReferencesCatgeory, + Name = "_PushLocalFrame", + CustomWrapper = true, + Visibility = "internal", + Prototype = "jint (*PushLocalFrame)(JNIEnv*, jint);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jint", "capacity")}, + }, + new JniFunction { + DeclaringType = ReferencesCatgeory, + Name = "PopLocalFrame", + Visibility = "public", + Prototype = "jobject (*PopLocalFrame)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "result", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ReferencesCatgeory, + Name = "NewGlobalRef", + CustomWrapper = true, + Visibility = "public", + // Prebind = true, + Prototype = "jobject (*NewGlobalRef)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ReferencesCatgeory, + Name = "DeleteGlobalRef", + CustomWrapper = true, + Visibility = "public", + Prototype = "void (*DeleteGlobalRef)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ReferencesCatgeory, + Name = "DeleteLocalRef", + CustomWrapper = true, + Visibility = "public", + // Prebind = true, + Prototype = "void (*DeleteLocalRef)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ClassesCategory, + Name = "IsSameObject", + Visibility = "public", + Prototype = "jboolean (*IsSameObject)(JNIEnv*, jobject, jobject);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "ref1", Modifier.CanBeNull), new ParamInfo ("jobject", "ref2", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ReferencesCatgeory, + Name = "NewLocalRef", + Visibility = "private", + Prototype = "jobject (*NewLocalRef)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "@ref", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ReferencesCatgeory, + Name = "_EnsureLocalCapacity", + CustomWrapper = true, + Visibility = "internal", + Prototype = "jint (*EnsureLocalCapacity)(JNIEnv*, jint);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jint", "capacity")}, + }, + new JniFunction { + DeclaringType = ObjectOperationsCategory, + Name = "AllocObject", + Visibility = "public", + Throws = true, + Prototype = "jobject (*AllocObject)(JNIEnv*, jclass);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass")}, + }, + new JniFunction { + DeclaringType = ObjectOperationsCategory, + Name = "NewObject", + CustomWrapper = true, + Visibility = "public", + Throws = true, + Prototype = "jobject (*NewObject)(JNIEnv*, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = ObjectOperationsCategory, + Name = "NewObjectV", + CustomWrapper = true, + Visibility = "private", + Throws = true, + Prototype = "jobject (*NewObjectV)(JNIEnv*, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = ObjectOperationsCategory, + Name = "NewObjectA", + CustomWrapper = true, + ApiName = "NewObject", + Visibility = "public", + Throws = true, + Prototype = "jobject (*NewObjectA)(JNIEnv*, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = ClassesCategory, + Name = "GetObjectClass", + Visibility = "public", + Prototype = "jclass (*GetObjectClass)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("jclass"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject")}, + }, + new JniFunction { + DeclaringType = ClassesCategory, + Name = "IsInstanceOf", + Visibility = "public", + Prototype = "jboolean (*IsInstanceOf)(JNIEnv*, jobject, jclass);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jclass", "clazz")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "GetMethodID", + Visibility = "public", + Throws = true, + Prototype = "jmethodID (*GetMethodID)(JNIEnv*, jclass, const char*, const char*);", + ReturnType = new TypeInfo ("jmethodID"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "kls"), new ParamInfo ("const char*", "name"), new ParamInfo ("const char*", "signature")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallObjectMethod", + Visibility = "public", + Throws = true, + Prototype = "jobject (*CallObjectMethod)(JNIEnv*, jobject, jmethodID, ...);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallObjectMethodV", + Visibility = "private", + Throws = true, + Prototype = "jobject (*CallObjectMethodV)(JNIEnv*, jobject, jmethodID, va_list);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallObjectMethodA", + ApiName = "CallObjectMethod", + Throws = true, + Visibility = "public", + Prototype = "jobject (*CallObjectMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallBooleanMethod", + Visibility = "public", + Throws = true, + Prototype = "jboolean (*CallBooleanMethod)(JNIEnv*, jobject, jmethodID, ...);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallBooleanMethodV", + Visibility = "private", + Throws = true, + Prototype = "jboolean (*CallBooleanMethodV)(JNIEnv*, jobject, jmethodID, va_list);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallBooleanMethodA", + ApiName = "CallBooleanMethod", + Visibility = "public", + Throws = true, + Prototype = "jboolean (*CallBooleanMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallByteMethod", + Visibility = "public", + Throws = true, + Prototype = "jbyte (*CallByteMethod)(JNIEnv*, jobject, jmethodID, ...);", + ReturnType = new TypeInfo ("jbyte"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallByteMethodV", + Visibility = "private", + Throws = true, + Prototype = "jbyte (*CallByteMethodV)(JNIEnv*, jobject, jmethodID, va_list);", + ReturnType = new TypeInfo ("jbyte"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallByteMethodA", + ApiName = "CallByteMethod", + Visibility = "public", + Throws = true, + Prototype = "jbyte (*CallByteMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jbyte"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallCharMethod", + Visibility = "public", + Throws = true, + Prototype = "jchar (*CallCharMethod)(JNIEnv*, jobject, jmethodID, ...);", + ReturnType = new TypeInfo ("jchar"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallCharMethodV", + Visibility = "private", + Throws = true, + Prototype = "jchar (*CallCharMethodV)(JNIEnv*, jobject, jmethodID, va_list);", + ReturnType = new TypeInfo ("jchar"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallCharMethodA", + ApiName = "CallCharMethod", + Visibility = "public", + Throws = true, + Prototype = "jchar (*CallCharMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jchar"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallShortMethod", + Visibility = "public", + Throws = true, + Prototype = "jshort (*CallShortMethod)(JNIEnv*, jobject, jmethodID, ...);", + ReturnType = new TypeInfo ("jshort"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallShortMethodV", + Visibility = "private", + Throws = true, + Prototype = "jshort (*CallShortMethodV)(JNIEnv*, jobject, jmethodID, va_list);", + ReturnType = new TypeInfo ("jshort"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallShortMethodA", + ApiName = "CallShortMethod", + Visibility = "public", + Throws = true, + Prototype = "jshort (*CallShortMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jshort"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallIntMethod", + Visibility = "public", + Throws = true, + Prototype = "jint (*CallIntMethod)(JNIEnv*, jobject, jmethodID, ...);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallIntMethodV", + Visibility = "private", + Throws = true, + Prototype = "jint (*CallIntMethodV)(JNIEnv*, jobject, jmethodID, va_list);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallIntMethodA", + ApiName = "CallIntMethod", + Visibility = "public", + Throws = true, + Prototype = "jint (*CallIntMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallLongMethod", + Visibility = "public", + Throws = true, + Prototype = "jlong (*CallLongMethod)(JNIEnv*, jobject, jmethodID, ...);", + ReturnType = new TypeInfo ("jlong"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallLongMethodV", + Visibility = "private", + Throws = true, + Prototype = "jlong (*CallLongMethodV)(JNIEnv*, jobject, jmethodID, va_list);", + ReturnType = new TypeInfo ("jlong"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallLongMethodA", + ApiName = "CallLongMethod", + Visibility = "public", + Throws = true, + Prototype = "jlong (*CallLongMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jlong"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallFloatMethod", + Visibility = "public", + Throws = true, + Prototype = "jfloat (*CallFloatMethod)(JNIEnv*, jobject, jmethodID, ...);", + ReturnType = new TypeInfo ("jfloat"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallFloatMethodV", + Visibility = "private", + Throws = true, + Prototype = "jfloat (*CallFloatMethodV)(JNIEnv*, jobject, jmethodID, va_list);", + ReturnType = new TypeInfo ("jfloat"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallFloatMethodA", + ApiName = "CallFloatMethod", + Visibility = "public", + Throws = true, + Prototype = "jfloat (*CallFloatMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jfloat"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallDoubleMethod", + Visibility = "public", + Throws = true, + Prototype = "jdouble (*CallDoubleMethod)(JNIEnv*, jobject, jmethodID, ...);", + ReturnType = new TypeInfo ("jdouble"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallDoubleMethodV", + Visibility = "private", + Throws = true, + Prototype = "jdouble (*CallDoubleMethodV)(JNIEnv*, jobject, jmethodID, va_list);", + ReturnType = new TypeInfo ("jdouble"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallDoubleMethodA", + ApiName = "CallDoubleMethod", + Visibility = "public", + Throws = true, + Prototype = "jdouble (*CallDoubleMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jdouble"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallVoidMethod", + Visibility = "public", + Throws = true, + Prototype = "void (*CallVoidMethod)(JNIEnv*, jobject, jmethodID, ...);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallVoidMethodV", + Visibility = "private", + Throws = true, + Prototype = "void (*CallVoidMethodV)(JNIEnv*, jobject, jmethodID, va_list);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallVoidMethodA", + ApiName = "CallVoidMethod", + Visibility = "public", + Throws = true, + Prototype = "void (*CallVoidMethodA)(JNIEnv*, jobject, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualObjectMethod", + Visibility = "public", + Throws = true, + Prototype = "jobject (*CallNonvirtualObjectMethod)(JNIEnv*, jobject, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualObjectMethodV", + Visibility = "private", + Throws = true, + Prototype = "jobject (*CallNonvirtualObjectMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualObjectMethodA", + ApiName = "CallNonvirtualObjectMethod", + Visibility = "public", + Throws = true, + Prototype = "jobject (*CallNonvirtualObjectMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualBooleanMethod", + Visibility = "public", + Throws = true, + Prototype = "jboolean (*CallNonvirtualBooleanMethod)(JNIEnv*, jobject, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualBooleanMethodV", + Visibility = "private", + Throws = true, + Prototype = "jboolean (*CallNonvirtualBooleanMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualBooleanMethodA", + ApiName = "CallNonvirtualBooleanMethod", + Visibility = "public", + Throws = true, + Prototype = "jboolean (*CallNonvirtualBooleanMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualByteMethod", + Visibility = "public", + Throws = true, + Prototype = "jbyte (*CallNonvirtualByteMethod)(JNIEnv*, jobject, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jbyte"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualByteMethodV", + Visibility = "private", + Throws = true, + Prototype = "jbyte (*CallNonvirtualByteMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jbyte"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualByteMethodA", + ApiName = "CallNonvirtualByteMethod", + Visibility = "public", + Throws = true, + Prototype = "jbyte (*CallNonvirtualByteMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jbyte"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualCharMethod", + Visibility = "public", + Throws = true, + Prototype = "jchar (*CallNonvirtualCharMethod)(JNIEnv*, jobject, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jchar"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualCharMethodV", + Visibility = "private", + Throws = true, + Prototype = "jchar (*CallNonvirtualCharMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jchar"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualCharMethodA", + ApiName = "CallNonvirtualCharMethod", + Visibility = "public", + Throws = true, + Prototype = "jchar (*CallNonvirtualCharMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jchar"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualShortMethod", + Visibility = "public", + Throws = true, + Prototype = "jshort (*CallNonvirtualShortMethod)(JNIEnv*, jobject, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jshort"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualShortMethodV", + Visibility = "private", + Throws = true, + Prototype = "jshort (*CallNonvirtualShortMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jshort"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualShortMethodA", + ApiName = "CallNonvirtualShortMethod", + Visibility = "public", + Throws = true, + Prototype = "jshort (*CallNonvirtualShortMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jshort"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualIntMethod", + Visibility = "public", + Throws = true, + Prototype = "jint (*CallNonvirtualIntMethod)(JNIEnv*, jobject, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualIntMethodV", + Visibility = "private", + Throws = true, + Prototype = "jint (*CallNonvirtualIntMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualIntMethodA", + ApiName = "CallNonvirtualIntMethod", + Visibility = "public", + Throws = true, + Prototype = "jint (*CallNonvirtualIntMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualLongMethod", + Visibility = "public", + Throws = true, + Prototype = "jlong (*CallNonvirtualLongMethod)(JNIEnv*, jobject, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jlong"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualLongMethodV", + Visibility = "private", + Throws = true, + Prototype = "jlong (*CallNonvirtualLongMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jlong"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualLongMethodA", + ApiName = "CallNonvirtualLongMethod", + Throws = true, + Visibility = "public", + Prototype = "jlong (*CallNonvirtualLongMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jlong"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualFloatMethod", + Visibility = "public", + Throws = true, + Prototype = "jfloat (*CallNonvirtualFloatMethod)(JNIEnv*, jobject, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jfloat"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualFloatMethodV", + Visibility = "private", + Throws = true, + Prototype = "jfloat (*CallNonvirtualFloatMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jfloat"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualFloatMethodA", + ApiName = "CallNonvirtualFloatMethod", + Visibility = "public", + Throws = true, + Prototype = "jfloat (*CallNonvirtualFloatMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jfloat"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualDoubleMethod", + Visibility = "public", + Throws = true, + Prototype = "jdouble (*CallNonvirtualDoubleMethod)(JNIEnv*, jobject, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jdouble"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualDoubleMethodV", + Visibility = "private", + Throws = true, + Prototype = "jdouble (*CallNonvirtualDoubleMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jdouble"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualDoubleMethodA", + ApiName = "CallNonvirtualDoubleMethod", + Visibility = "public", + Throws = true, + Prototype = "jdouble (*CallNonvirtualDoubleMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jdouble"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualVoidMethod", + Visibility = "public", + Throws = true, + Prototype = "void (*CallNonvirtualVoidMethod)(JNIEnv*, jobject, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualVoidMethodV", + Visibility = "private", + Throws = true, + Prototype = "void (*CallNonvirtualVoidMethodV)(JNIEnv*, jobject, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = InstanceMethodsCategory, + Name = "CallNonvirtualVoidMethodA", + ApiName = "CallNonvirtualVoidMethod", + Visibility = "public", + Throws = true, + Prototype = "void (*CallNonvirtualVoidMethodA)(JNIEnv*, jobject, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jclass", "jclass"), new ParamInfo ("jmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "GetFieldID", + Visibility = "public", + Throws = true, + Prototype = "jfieldID (*GetFieldID)(JNIEnv*, jclass, const char*, const char*);", + ReturnType = new TypeInfo ("jfieldID"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("const char*", "name"), new ParamInfo ("const char*", "sig")}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "GetObjectField", + Visibility = "public", + Prototype = "jobject (*GetObjectField)(JNIEnv*, jobject, jfieldID);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "GetBooleanField", + Visibility = "public", + Prototype = "jboolean (*GetBooleanField)(JNIEnv*, jobject, jfieldID);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "GetByteField", + Visibility = "public", + Prototype = "jbyte (*GetByteField)(JNIEnv*, jobject, jfieldID);", + ReturnType = new TypeInfo ("jbyte"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "GetCharField", + Visibility = "public", + Prototype = "jchar (*GetCharField)(JNIEnv*, jobject, jfieldID);", + ReturnType = new TypeInfo ("jchar"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "GetShortField", + Visibility = "public", + Prototype = "jshort (*GetShortField)(JNIEnv*, jobject, jfieldID);", + ReturnType = new TypeInfo ("jshort"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "GetIntField", + Visibility = "public", + Prototype = "jint (*GetIntField)(JNIEnv*, jobject, jfieldID);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "GetLongField", + Visibility = "public", + Prototype = "jlong (*GetLongField)(JNIEnv*, jobject, jfieldID);", + ReturnType = new TypeInfo ("jlong"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "GetFloatField", + Visibility = "public", + Prototype = "jfloat (*GetFloatField)(JNIEnv*, jobject, jfieldID);", + ReturnType = new TypeInfo ("jfloat"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "GetDoubleField", + Visibility = "public", + Prototype = "jdouble (*GetDoubleField)(JNIEnv*, jobject, jfieldID);", + ReturnType = new TypeInfo ("jdouble"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "SetObjectField", + ApiName = "SetField", + Visibility = "public", + Prototype = "void (*SetObjectField)(JNIEnv*, jobject, jfieldID, jobject);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID"), new ParamInfo ("jobject", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "SetBooleanField", + ApiName = "SetField", + Visibility = "public", + Prototype = "void (*SetBooleanField)(JNIEnv*, jobject, jfieldID, jboolean);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID"), new ParamInfo ("jboolean", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "SetByteField", + ApiName = "SetField", + Visibility = "public", + Prototype = "void (*SetByteField)(JNIEnv*, jobject, jfieldID, jbyte);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID"), new ParamInfo ("jbyte", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "SetCharField", + ApiName = "SetField", + Visibility = "public", + Prototype = "void (*SetCharField)(JNIEnv*, jobject, jfieldID, jchar);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID"), new ParamInfo ("jchar", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "SetShortField", + ApiName = "SetField", + Visibility = "public", + Prototype = "void (*SetShortField)(JNIEnv*, jobject, jfieldID, jshort);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID"), new ParamInfo ("jshort", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "SetIntField", + ApiName = "SetField", + Visibility = "public", + Prototype = "void (*SetIntField)(JNIEnv*, jobject, jfieldID, jint);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID"), new ParamInfo ("jint", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "SetLongField", + ApiName = "SetField", + Visibility = "public", + Prototype = "void (*SetLongField)(JNIEnv*, jobject, jfieldID, jlong);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID"), new ParamInfo ("jlong", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "SetFloatField", + ApiName = "SetField", + Visibility = "public", + Prototype = "void (*SetFloatField)(JNIEnv*, jobject, jfieldID, jfloat);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID"), new ParamInfo ("jfloat", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = InstanceFieldsCategory, + Name = "SetDoubleField", + ApiName = "SetField", + Visibility = "public", + Prototype = "void (*SetDoubleField)(JNIEnv*, jobject, jfieldID, jdouble);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject"), new ParamInfo ("jfieldID", "jfieldID"), new ParamInfo ("jdouble", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "GetStaticMethodID", + Visibility = "public", + Throws = true, + Prototype = "jmethodID (*GetStaticMethodID)(JNIEnv*, jclass, const char*, const char*);", + ReturnType = new TypeInfo ("jstaticmethodID"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("const char*", "name"), new ParamInfo ("const char*", "sig")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticObjectMethod", + Visibility = "public", + Throws = true, + Prototype = "jobject (*CallStaticObjectMethod)(JNIEnv*, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticObjectMethodV", + Visibility = "private", + Throws = true, + Prototype = "jobject (*CallStaticObjectMethodV)(JNIEnv*, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("va_list", "parms", true)}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticObjectMethodA", + ApiName = "CallStaticObjectMethod", + Visibility = "public", + Throws = true, + Prototype = "jobject (*CallStaticObjectMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticBooleanMethod", + Visibility = "public", + Throws = true, + Prototype = "jboolean (*CallStaticBooleanMethod)(JNIEnv*, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticBooleanMethodV", + Visibility = "private", + Throws = true, + Prototype = "jboolean (*CallStaticBooleanMethodV)(JNIEnv*, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticBooleanMethodA", + ApiName = "CallStaticBooleanMethod", + Visibility = "public", + Throws = true, + Prototype = "jboolean (*CallStaticBooleanMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticByteMethod", + Visibility = "public", + Throws = true, + Prototype = "jbyte (*CallStaticByteMethod)(JNIEnv*, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jbyte"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticByteMethodV", + Visibility = "private", + Throws = true, + Prototype = "jbyte (*CallStaticByteMethodV)(JNIEnv*, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jbyte"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticByteMethodA", + ApiName = "CallStaticByteMethod", + Throws = true, + Visibility = "public", + Prototype = "jbyte (*CallStaticByteMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jbyte"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticCharMethod", + Visibility = "public", + Throws = true, + Prototype = "jchar (*CallStaticCharMethod)(JNIEnv*, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jchar"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticCharMethodV", + Visibility = "private", + Throws = true, + Prototype = "jchar (*CallStaticCharMethodV)(JNIEnv*, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jchar"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticCharMethodA", + ApiName = "CallStaticCharMethod", + Visibility = "public", + Throws = true, + Prototype = "jchar (*CallStaticCharMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jchar"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticShortMethod", + Visibility = "public", + Throws = true, + Prototype = "jshort (*CallStaticShortMethod)(JNIEnv*, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jshort"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticShortMethodV", + Visibility = "private", + Throws = true, + Prototype = "jshort (*CallStaticShortMethodV)(JNIEnv*, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jshort"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticShortMethodA", + ApiName = "CallStaticShortMethod", + Visibility = "public", + Throws = true, + Prototype = "jshort (*CallStaticShortMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jshort"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticIntMethod", + Visibility = "public", + Throws = true, + Prototype = "jint (*CallStaticIntMethod)(JNIEnv*, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticIntMethodV", + Visibility = "private", + Throws = true, + Prototype = "jint (*CallStaticIntMethodV)(JNIEnv*, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticIntMethodA", + ApiName = "CallStaticIntMethod", + Visibility = "public", + Throws = true, + Prototype = "jint (*CallStaticIntMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticLongMethod", + Visibility = "public", + Throws = true, + Prototype = "jlong (*CallStaticLongMethod)(JNIEnv*, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jlong"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticLongMethodV", + Visibility = "private", + Throws = true, + Prototype = "jlong (*CallStaticLongMethodV)(JNIEnv*, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jlong"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticLongMethodA", + ApiName = "CallStaticLongMethod", + Visibility = "public", + Throws = true, + Prototype = "jlong (*CallStaticLongMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jlong"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticFloatMethod", + Visibility = "public", + Throws = true, + Prototype = "jfloat (*CallStaticFloatMethod)(JNIEnv*, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jfloat"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticFloatMethodV", + Visibility = "private", + Throws = true, + Prototype = "jfloat (*CallStaticFloatMethodV)(JNIEnv*, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jfloat"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticFloatMethodA", + ApiName = "CallStaticFloatMethod", + Visibility = "public", + Throws = true, + Prototype = "jfloat (*CallStaticFloatMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jfloat"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticDoubleMethod", + Visibility = "public", + Throws = true, + Prototype = "jdouble (*CallStaticDoubleMethod)(JNIEnv*, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("jdouble"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticDoubleMethodV", + Visibility = "private", + Throws = true, + Prototype = "jdouble (*CallStaticDoubleMethodV)(JNIEnv*, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("jdouble"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticDoubleMethodA", + ApiName = "CallStaticDoubleMethod", + Visibility = "public", + Throws = true, + Prototype = "jdouble (*CallStaticDoubleMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("jdouble"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticVoidMethod", + Visibility = "public", + Throws = true, + Prototype = "void (*CallStaticVoidMethod)(JNIEnv*, jclass, jmethodID, ...);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticVoidMethodV", + Visibility = "private", + Throws = true, + Prototype = "void (*CallStaticVoidMethodV)(JNIEnv*, jclass, jmethodID, va_list);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("va_list", "args")}, + }, + new JniFunction { + DeclaringType = StaticMethodsCategory, + Name = "CallStaticVoidMethodA", + ApiName = "CallStaticVoidMethod", + Visibility = "public", + Throws = true, + Prototype = "void (*CallStaticVoidMethodA)(JNIEnv*, jclass, jmethodID, jvalue*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticmethodID", "jmethod"), new ParamInfo ("jvalue*", "parms", true)}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "GetStaticFieldID", + Visibility = "public", + Throws = true, + Prototype = "jfieldID (*GetStaticFieldID)(JNIEnv*, jclass, const char*, const char*);", + ReturnType = new TypeInfo ("jstaticfieldID"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("const char*", "name"), new ParamInfo ("const char*", "sig")}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "GetStaticObjectField", + Visibility = "public", + Prototype = "jobject (*GetStaticObjectField)(JNIEnv*, jclass, jfieldID);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "GetStaticBooleanField", + Visibility = "public", + Prototype = "jboolean (*GetStaticBooleanField)(JNIEnv*, jclass, jfieldID);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "GetStaticByteField", + Visibility = "public", + Prototype = "jbyte (*GetStaticByteField)(JNIEnv*, jclass, jfieldID);", + ReturnType = new TypeInfo ("jbyte"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "GetStaticCharField", + Visibility = "public", + Prototype = "jchar (*GetStaticCharField)(JNIEnv*, jclass, jfieldID);", + ReturnType = new TypeInfo ("jchar"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "GetStaticShortField", + Visibility = "public", + Prototype = "jshort (*GetStaticShortField)(JNIEnv*, jclass, jfieldID);", + ReturnType = new TypeInfo ("jshort"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "GetStaticIntField", + Visibility = "public", + Prototype = "jint (*GetStaticIntField)(JNIEnv*, jclass, jfieldID);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "GetStaticLongField", + Visibility = "public", + Prototype = "jlong (*GetStaticLongField)(JNIEnv*, jclass, jfieldID);", + ReturnType = new TypeInfo ("jlong"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "GetStaticFloatField", + Visibility = "public", + Prototype = "jfloat (*GetStaticFloatField)(JNIEnv*, jclass, jfieldID);", + ReturnType = new TypeInfo ("jfloat"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "GetStaticDoubleField", + Visibility = "public", + Prototype = "jdouble (*GetStaticDoubleField)(JNIEnv*, jclass, jfieldID);", + ReturnType = new TypeInfo ("jdouble"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID")}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "SetStaticObjectField", + ApiName = "SetStaticField", + Visibility = "public", + Prototype = "void (*SetStaticObjectField)(JNIEnv*, jclass, jfieldID, jobject);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID"), new ParamInfo ("jobject", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "SetStaticBooleanField", + ApiName = "SetStaticField", + Visibility = "public", + Prototype = "void (*SetStaticBooleanField)(JNIEnv*, jclass, jfieldID, jboolean);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID"), new ParamInfo ("jboolean", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "SetStaticByteField", + ApiName = "SetStaticField", + Visibility = "public", + Prototype = "void (*SetStaticByteField)(JNIEnv*, jclass, jfieldID, jbyte);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID"), new ParamInfo ("jbyte", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "SetStaticCharField", + ApiName = "SetStaticField", + Visibility = "public", + Prototype = "void (*SetStaticCharField)(JNIEnv*, jclass, jfieldID, jchar);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID"), new ParamInfo ("jchar", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "SetStaticShortField", + ApiName = "SetStaticField", + Visibility = "public", + Prototype = "void (*SetStaticShortField)(JNIEnv*, jclass, jfieldID, jshort);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID"), new ParamInfo ("jshort", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "SetStaticIntField", + ApiName = "SetStaticField", + Visibility = "public", + Prototype = "void (*SetStaticIntField)(JNIEnv*, jclass, jfieldID, jint);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID"), new ParamInfo ("jint", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "SetStaticLongField", + ApiName = "SetStaticField", + Visibility = "public", + Prototype = "void (*SetStaticLongField)(JNIEnv*, jclass, jfieldID, jlong);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID"), new ParamInfo ("jlong", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "SetStaticFloatField", + ApiName = "SetStaticField", + Visibility = "public", + Prototype = "void (*SetStaticFloatField)(JNIEnv*, jclass, jfieldID, jfloat);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID"), new ParamInfo ("jfloat", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = StaticFieldsCategory, + Name = "SetStaticDoubleField", + ApiName = "SetStaticField", + Visibility = "public", + Prototype = "void (*SetStaticDoubleField)(JNIEnv*, jclass, jfieldID, jdouble);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("jstaticfieldID", "jfieldID"), new ParamInfo ("jdouble", "val", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = StringOperationsCategory, + Name = "NewString", + CustomWrapper = true, + Visibility = "internal", + Throws = true, + Prototype = "jstring (*NewString)(JNIEnv*, const jchar*, jsize);", + ReturnType = new TypeInfo ("jstring"), + Parameters = new ParamInfo [] {new ParamInfo (new TypeInfo ("const jchar*", "IntPtr"), "unicodeChars"), new ParamInfo ("jsize", "len")}, + }, + new JniFunction { + DeclaringType = StringOperationsCategory, + Name = "GetStringLength", + Visibility = "internal", + Prototype = "jsize (*GetStringLength)(JNIEnv*, jstring);", + ReturnType = new TypeInfo ("jsize"), + Parameters = new ParamInfo [] {new ParamInfo ("jstring", "@string")}, + }, + new JniFunction { + DeclaringType = StringOperationsCategory, + Name = "GetStringChars", + Visibility = "internal", + Prototype = "const jchar* (*GetStringChars)(JNIEnv*, jstring, jboolean*);", + ReturnType = new TypeInfo ("const jchar*", "IntPtr"), + Parameters = new ParamInfo [] {new ParamInfo ("jstring", "@string"), new ParamInfo ("jboolean*", "isCopy", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = StringOperationsCategory, + Name = "ReleaseStringChars", + Visibility = "internal", + Prototype = "void (*ReleaseStringChars)(JNIEnv*, jstring, const jchar*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jstring", "@string"), new ParamInfo (new TypeInfo ("const jchar*", "IntPtr"), "chars")}, + }, + new JniFunction { + DeclaringType = StringOperationsCategory, + Name = "NewStringUTF", + Visibility = "private", + Throws = true, + Prototype = "jstring (*NewStringUTF)(JNIEnv*, const char*);", + ReturnType = new TypeInfo ("jstring"), + Parameters = new ParamInfo [] {new ParamInfo ("const char*", "bytes")}, + }, + new JniFunction { + DeclaringType = StringOperationsCategory, + Name = "GetStringUTFLength", + Visibility = "private", + Prototype = "jsize (*GetStringUTFLength)(JNIEnv*, jstring);", + ReturnType = new TypeInfo ("jsize"), + Parameters = new ParamInfo [] {new ParamInfo ("jstring", "@string")}, + }, + new JniFunction { + DeclaringType = StringOperationsCategory, + Name = "GetStringUTFChars", + Visibility = "private", + Prototype = "const char* (*GetStringUTFChars)(JNIEnv*, jstring, jboolean*);", + ReturnType = new TypeInfo ("const char*"), + Parameters = new ParamInfo [] {new ParamInfo ("jstring", "@string"), new ParamInfo ("jboolean*", "isCopy", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = StringOperationsCategory, + Name = "ReleaseStringUTFChars", + Visibility = "private", + Prototype = "void (*ReleaseStringUTFChars)(JNIEnv*, jstring, const char*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jstring", "@string"), new ParamInfo ("const char*", "utf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetArrayLength", + CustomWrapper = true, + Visibility = "public", + Prototype = "jsize (*GetArrayLength)(JNIEnv*, jarray);", + ReturnType = new TypeInfo ("jsize"), + Parameters = new ParamInfo [] {new ParamInfo ("jarray", "array_ptr")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "NewObjectArray", + ApiName = "NewArray", + CustomWrapper = true, + Visibility = "public", + Throws = true, + Prototype = "jobjectArray (*NewObjectArray)(JNIEnv*, jsize, jclass, jobject);", + ReturnType = new TypeInfo ("jobjectArray"), + Parameters = new ParamInfo [] {new ParamInfo ("jsize", "length"), new ParamInfo ("jclass", "elementClass"), new ParamInfo ("jobject", "initialElement", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetObjectArrayElement", + Visibility = "public", + Throws = true, + Prototype = "jobject (*GetObjectArrayElement)(JNIEnv*, jobjectArray, jsize);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("jobjectArray", "array"), new ParamInfo ("jsize", "index")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "SetObjectArrayElement", + Visibility = "public", + Throws = true, + Prototype = "void (*SetObjectArrayElement)(JNIEnv*, jobjectArray, jsize, jobject);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jobjectArray", "array"), new ParamInfo ("jsize", "index"), new ParamInfo ("jobject", "value", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "NewBooleanArray", + CustomWrapper = true, + Visibility = "public", + Prototype = "jbooleanArray (*NewBooleanArray)(JNIEnv*, jsize);", + ReturnType = new TypeInfo ("jbooleanArray"), + Parameters = new ParamInfo [] {new ParamInfo ("jsize", "length")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "NewByteArray", + ApiName = "NewArray", + Visibility = "public", + Prototype = "jbyteArray (*NewByteArray)(JNIEnv*, jsize);", + ReturnType = new TypeInfo ("jbyteArray"), + Parameters = new ParamInfo [] {new ParamInfo ("jsize", "length")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "NewCharArray", + ApiName = "NewArray", + Visibility = "public", + Prototype = "jcharArray (*NewCharArray)(JNIEnv*, jsize);", + ReturnType = new TypeInfo ("jcharArray"), + Parameters = new ParamInfo [] {new ParamInfo ("jsize", "length")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "NewShortArray", + ApiName = "NewArray", + Visibility = "public", + Prototype = "jshortArray (*NewShortArray)(JNIEnv*, jsize);", + ReturnType = new TypeInfo ("jshortArray"), + Parameters = new ParamInfo [] {new ParamInfo ("jsize", "length")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "NewIntArray", + ApiName = "NewArray", + Visibility = "public", + Prototype = "jintArray (*NewIntArray)(JNIEnv*, jsize);", + ReturnType = new TypeInfo ("jintArray"), + Parameters = new ParamInfo [] {new ParamInfo ("jsize", "length")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "NewLongArray", + ApiName = "NewArray", + Visibility = "public", + Prototype = "jlongArray (*NewLongArray)(JNIEnv*, jsize);", + ReturnType = new TypeInfo ("jlongArray"), + Parameters = new ParamInfo [] {new ParamInfo ("jsize", "length")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "NewFloatArray", + ApiName = "NewArray", + Visibility = "public", + Prototype = "jfloatArray (*NewFloatArray)(JNIEnv*, jsize);", + ReturnType = new TypeInfo ("jfloatArray"), + Parameters = new ParamInfo [] {new ParamInfo ("jsize", "length")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "NewDoubleArray", + ApiName = "NewArray", + Visibility = "public", + Prototype = "jdoubleArray (*NewDoubleArray)(JNIEnv*, jsize);", + ReturnType = new TypeInfo ("jdoubleArray"), + Parameters = new ParamInfo [] {new ParamInfo ("jsize", "length")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetBooleanArrayElements", + Visibility = "private", + Prototype = "jboolean* (*GetBooleanArrayElements)(JNIEnv*, jbooleanArray, jboolean*);", + ReturnType = new TypeInfo ("jboolean*"), + Parameters = new ParamInfo [] {new ParamInfo ("jbooleanArray", "array"), new ParamInfo ("jboolean*", "isCopy", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetByteArrayElements", + Visibility = "private", + Prototype = "jbyte* (*GetByteArrayElements)(JNIEnv*, jbyteArray, jboolean*);", + ReturnType = new TypeInfo ("jbyte*"), + Parameters = new ParamInfo [] {new ParamInfo ("jbyteArray", "array"), new ParamInfo ("jboolean*", "isCopy", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetCharArrayElements", + Visibility = "private", + Prototype = "jchar* (*GetCharArrayElements)(JNIEnv*, jcharArray, jboolean*);", + ReturnType = new TypeInfo ("jchar*"), + Parameters = new ParamInfo [] {new ParamInfo ("jcharArray", "array"), new ParamInfo ("jboolean*", "isCopy", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetShortArrayElements", + Visibility = "private", + Prototype = "jshort* (*GetShortArrayElements)(JNIEnv*, jshortArray, jboolean*);", + ReturnType = new TypeInfo ("jshort*"), + Parameters = new ParamInfo [] {new ParamInfo ("jshortArray", "array"), new ParamInfo ("jboolean*", "isCopy", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetIntArrayElements", + Visibility = "private", + Prototype = "jint* (*GetIntArrayElements)(JNIEnv*, jintArray, jboolean*);", + ReturnType = new TypeInfo ("jint*"), + Parameters = new ParamInfo [] {new ParamInfo ("jintArray", "array"), new ParamInfo ("jboolean*", "isCopy", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetLongArrayElements", + Visibility = "private", + Prototype = "jlong* (*GetLongArrayElements)(JNIEnv*, jlongArray, jboolean*);", + ReturnType = new TypeInfo ("jlong*"), + Parameters = new ParamInfo [] {new ParamInfo ("jlongArray", "array"), new ParamInfo ("jboolean*", "isCopy", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetFloatArrayElements", + Visibility = "private", + Prototype = "jfloat* (*GetFloatArrayElements)(JNIEnv*, jfloatArray, jboolean*);", + ReturnType = new TypeInfo ("jfloat*"), + Parameters = new ParamInfo [] {new ParamInfo ("jfloatArray", "array"), new ParamInfo ("jboolean*", "isCopy", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetDoubleArrayElements", + Visibility = "private", + Prototype = "jdouble* (*GetDoubleArrayElements)(JNIEnv*, jdoubleArray, jboolean*);", + ReturnType = new TypeInfo ("jdouble*"), + Parameters = new ParamInfo [] {new ParamInfo ("jdoubleArray", "array"), new ParamInfo ("jboolean*", "isCopy", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "ReleaseBooleanArrayElements", + Visibility = "private", + Prototype = "void (*ReleaseBooleanArrayElements)(JNIEnv*, jbooleanArray, jboolean*, jint);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jbooleanArray", "array"), new ParamInfo ("jboolean*", "elems"), new ParamInfo ("jint", "mode")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "ReleaseByteArrayElements", + Visibility = "private", + Prototype = "void (*ReleaseByteArrayElements)(JNIEnv*, jbyteArray, jbyte*, jint);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jbyteArray", "array"), new ParamInfo ("jbyte*", "elems"), new ParamInfo ("jint", "mode")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "ReleaseCharArrayElements", + Visibility = "private", + Prototype = "void (*ReleaseCharArrayElements)(JNIEnv*, jcharArray, jchar*, jint);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jcharArray", "array"), new ParamInfo ("jchar*", "elems"), new ParamInfo ("jint", "mode")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "ReleaseShortArrayElements", + Visibility = "private", + Prototype = "void (*ReleaseShortArrayElements)(JNIEnv*, jshortArray, jshort*, jint);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jshortArray", "array"), new ParamInfo ("jshort*", "elems"), new ParamInfo ("jint", "mode")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "ReleaseIntArrayElements", + Visibility = "private", + Prototype = "void (*ReleaseIntArrayElements)(JNIEnv*, jintArray, jint*, jint);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jintArray", "array"), new ParamInfo ("jint*", "elems"), new ParamInfo ("jint", "mode")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "ReleaseLongArrayElements", + Visibility = "private", + Prototype = "void (*ReleaseLongArrayElements)(JNIEnv*, jlongArray, jlong*, jint);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jlongArray", "array"), new ParamInfo ("jlong*", "elems"), new ParamInfo ("jint", "mode")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "ReleaseFloatArrayElements", + Visibility = "private", + Prototype = "void (*ReleaseFloatArrayElements)(JNIEnv*, jfloatArray, jfloat*, jint);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jfloatArray", "array"), new ParamInfo ("jfloat*", "elems"), new ParamInfo ("jint", "mode")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "ReleaseDoubleArrayElements", + Visibility = "private", + Prototype = "void (*ReleaseDoubleArrayElements)(JNIEnv*, jdoubleArray, jdouble*, jint);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jdoubleArray", "array"), new ParamInfo ("jdouble*", "elems"), new ParamInfo ("jint", "mode")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetBooleanArrayRegion", + Visibility = "internal", + Throws = true, + Prototype = "void (*GetBooleanArrayRegion)(JNIEnv*, jbooleanArray, jsize, jsize, jboolean*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jbooleanArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("jboolean*", "byte[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetByteArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*GetByteArrayRegion)(JNIEnv*, jbyteArray, jsize, jsize, jbyte*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jbyteArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("jbyte*", "byte[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetCharArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*GetCharArrayRegion)(JNIEnv*, jcharArray, jsize, jsize, jchar*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jcharArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("jchar*", "char[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetShortArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*GetShortArrayRegion)(JNIEnv*, jshortArray, jsize, jsize, jshort*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jshortArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("jshort*", "short[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetIntArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*GetIntArrayRegion)(JNIEnv*, jintArray, jsize, jsize, jint*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jintArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("jint*", "int[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetLongArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*GetLongArrayRegion)(JNIEnv*, jlongArray, jsize, jsize, jlong*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jlongArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("jlong*", "long[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetFloatArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*GetFloatArrayRegion)(JNIEnv*, jfloatArray, jsize, jsize, jfloat*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jfloatArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("jfloat*", "float[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetDoubleArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*GetDoubleArrayRegion)(JNIEnv*, jdoubleArray, jsize, jsize, jdouble*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jdoubleArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("jdouble*", "double[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "SetBooleanArrayRegion", + Visibility = "internal", + Throws = true, + Prototype = "void (*SetBooleanArrayRegion)(JNIEnv*, jbooleanArray, jsize, jsize, const jboolean*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jbooleanArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("const jboolean*", "byte[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "SetByteArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*SetByteArrayRegion)(JNIEnv*, jbyteArray, jsize, jsize, const jbyte*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jbyteArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("const jbyte*", "byte[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "SetCharArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*SetCharArrayRegion)(JNIEnv*, jcharArray, jsize, jsize, const jchar*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jcharArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("const jchar*", "char[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "SetShortArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*SetShortArrayRegion)(JNIEnv*, jshortArray, jsize, jsize, const jshort*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jshortArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("const jshort*", "short[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "SetIntArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*SetIntArrayRegion)(JNIEnv*, jintArray, jsize, jsize, const jint*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jintArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("const jint*", "int[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "SetLongArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*SetLongArrayRegion)(JNIEnv*, jlongArray, jsize, jsize, const jlong*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jlongArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("const jlong*", "long[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "SetFloatArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*SetFloatArrayRegion)(JNIEnv*, jfloatArray, jsize, jsize, const jfloat*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jfloatArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("const jfloat*", "float[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "SetDoubleArrayRegion", + ApiName = "CopyArray", + Visibility = "public", + Throws = true, + Prototype = "void (*SetDoubleArrayRegion)(JNIEnv*, jdoubleArray, jsize, jsize, const jdouble*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jdoubleArray", "array"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo (new TypeInfo ("const jdouble*", "double[]"), "buf")}, + }, + new JniFunction { + DeclaringType = ClassesCategory, + Name = "RegisterNatives", + Visibility = "internal", + // Prebind = true, + Throws = true, + Prototype = "jint (*RegisterNatives)(JNIEnv*, jclass, const JNINativeMethod*, jint);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass"), new ParamInfo ("const JNINativeMethod*", "methods"), new ParamInfo ("jint", "nMethods")}, + }, + new JniFunction { + DeclaringType = ClassesCategory, + Name = "UnregisterNatives", + Visibility = "private", + Prototype = "jint (*UnregisterNatives)(JNIEnv*, jclass);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jclass", "jclass")}, + }, + new JniFunction { + DeclaringType = MonitorOperationsCategory, + Name = "MonitorEnter", + Visibility = "private", + Prototype = "jint (*MonitorEnter)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj")}, + }, + new JniFunction { + DeclaringType = MonitorOperationsCategory, + Name = "MonitorExit", + Visibility = "private", + Prototype = "jint (*MonitorExit)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj")}, + }, + new JniFunction { + DeclaringType = ReferencesCatgeory, + Name = "GetJavaVM", + Visibility = "internal", + // Prebind = true, + Prototype = "jint (*GetJavaVM)(JNIEnv*, JavaVM**);", + ReturnType = new TypeInfo ("jint"), + Parameters = new ParamInfo [] {new ParamInfo ("JavaVM**", "vm")}, + }, + new JniFunction { + DeclaringType = StringOperationsCategory, + Name = "GetStringRegion", + Visibility = "private", + Prototype = "void (*GetStringRegion)(JNIEnv*, jstring, jsize, jsize, jchar*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jstring", "str"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo ("jchar*", "buf")}, + }, + new JniFunction { + DeclaringType = StringOperationsCategory, + Name = "GetStringUTFRegion", + Visibility = "private", + Prototype = "void (*GetStringUTFRegion)(JNIEnv*, jstring, jsize, jsize, char*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jstring", "str"), new ParamInfo ("jsize", "start"), new ParamInfo ("jsize", "len"), new ParamInfo ("char*", "buf")}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "GetPrimitiveArrayCritical", + Visibility = "private", + Prototype = "void* (*GetPrimitiveArrayCritical)(JNIEnv*, jarray, jboolean*);", + ReturnType = new TypeInfo ("void*"), + Parameters = new ParamInfo [] {new ParamInfo ("jarray", "array"), new ParamInfo ("jboolean*", "isCopy", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ArrayOperationsCategory, + Name = "ReleasePrimitiveArrayCritical", + Visibility = "private", + Prototype = "void (*ReleasePrimitiveArrayCritical)(JNIEnv*, jarray, void*, jint);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jarray", "array"), new ParamInfo ("void*", "carray"), new ParamInfo ("jint", "mode")}, + }, + new JniFunction { + DeclaringType = StringOperationsCategory, + Name = "GetStringCritical", + Visibility = "private", + Prototype = "const jchar* (*GetStringCritical)(JNIEnv*, jstring, jboolean*);", + ReturnType = new TypeInfo ("const jchar*"), + Parameters = new ParamInfo [] {new ParamInfo ("jstring", "@string"), new ParamInfo ("jboolean*", "isCopy", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = StringOperationsCategory, + Name = "ReleaseStringCritical", + Visibility = "private", + Prototype = "void (*ReleaseStringCritical)(JNIEnv*, jstring, const jchar*);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jstring", "@string"), new ParamInfo ("const jchar*", "carray")}, + }, + new JniFunction { + DeclaringType = ReferencesCatgeory, + Name = "NewWeakGlobalRef", + CustomWrapper = true, + Visibility = "internal", + Prototype = "jweak (*NewWeakGlobalRef)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("jweak"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "obj", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ReferencesCatgeory, + Name = "DeleteWeakGlobalRef", + CustomWrapper = true, + Visibility = "public", + Prototype = "void (*DeleteWeakGlobalRef)(JNIEnv*, jweak);", + ReturnType = new TypeInfo ("void"), + Parameters = new ParamInfo [] {new ParamInfo ("jweak", "jobject", Modifier.CanBeNull)}, + }, + new JniFunction { + DeclaringType = ExceptionsCategory, + Name = "ExceptionCheck", + Visibility = "private", + Prototype = "jboolean (*ExceptionCheck)(JNIEnv*);", + ReturnType = new TypeInfo ("jboolean"), + Parameters = new ParamInfo [] {}, + }, + new JniFunction { + DeclaringType = NIOSupportCategory, + Name = "NewDirectByteBuffer", + Visibility = "public", + Throws = true, + Prototype = "jobject (*NewDirectByteBuffer)(JNIEnv*, void*, jlong);", + ReturnType = new TypeInfo ("jobject"), + Parameters = new ParamInfo [] {new ParamInfo ("void*", "address"), new ParamInfo ("jlong", "capacity")}, + }, + new JniFunction { + DeclaringType = NIOSupportCategory, + Name = "GetDirectBufferAddress", + Visibility = "public", + Prototype = "void* (*GetDirectBufferAddress)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("void*"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "buf")}, + }, + new JniFunction { + DeclaringType = NIOSupportCategory, + Name = "GetDirectBufferCapacity", + Visibility = "public", + Prototype = "jlong (*GetDirectBufferCapacity)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("jlong"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "buf")}, + }, + new JniFunction { + DeclaringType = ReferencesCatgeory, + Name = "GetObjectRefType", + CustomWrapper = true, + Visibility = "internal", + Prototype = "jobjectRefType (*GetObjectRefType)(JNIEnv*, jobject);", + ReturnType = new TypeInfo ("jobjectRefType"), + Parameters = new ParamInfo [] {new ParamInfo ("jobject", "jobject")}, + }, + }; + } +} diff --git a/build-tools/jnienv-gen/Mono.Options-PCL.cs b/build-tools/jnienv-gen/Mono.Options-PCL.cs new file mode 100644 index 00000000000..33c1588cf51 --- /dev/null +++ b/build-tools/jnienv-gen/Mono.Options-PCL.cs @@ -0,0 +1,1414 @@ +// +// Options.cs +// +// Authors: +// Jonathan Pryor +// Federico Di Gregorio +// Rolf Bjarne Kvinge +// +// Copyright (C) 2008 Novell (http://www.novell.com) +// Copyright (C) 2009 Federico Di Gregorio. +// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com) +// Copyright (C) 2015 Tobias Schulz (https://github.com/tobiasschulz) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +// Compile With: +// gmcs -debug+ -r:System.Core Options.cs -o:NDesk.Options.dll +// gmcs -debug+ -d:LINQ -r:System.Core Options.cs -o:NDesk.Options.dll +// +// The LINQ version just changes the implementation of +// OptionSet.Parse(IEnumerable), and confers no semantic changes. + +// +// A Getopt::Long-inspired option parsing library for C#. +// +// NDesk.Options.OptionSet is built upon a key/value table, where the +// key is a option format string and the value is a delegate that is +// invoked when the format string is matched. +// +// Option format strings: +// Regex-like BNF Grammar: +// name: .+ +// type: [=:] +// sep: ( [^{}]+ | '{' .+ '}' )? +// aliases: ( name type sep ) ( '|' name type sep )* +// +// Each '|'-delimited name is an alias for the associated action. If the +// format string ends in a '=', it has a required value. If the format +// string ends in a ':', it has an optional value. If neither '=' or ':' +// is present, no value is supported. `=' or `:' need only be defined on one +// alias, but if they are provided on more than one they must be consistent. +// +// Each alias portion may also end with a "key/value separator", which is used +// to split option values if the option accepts > 1 value. If not specified, +// it defaults to '=' and ':'. If specified, it can be any character except +// '{' and '}' OR the *string* between '{' and '}'. If no separator should be +// used (i.e. the separate values should be distinct arguments), then "{}" +// should be used as the separator. +// +// Options are extracted either from the current option by looking for +// the option name followed by an '=' or ':', or is taken from the +// following option IFF: +// - The current option does not contain a '=' or a ':' +// - The current option requires a value (i.e. not a Option type of ':') +// +// The `name' used in the option format string does NOT include any leading +// option indicator, such as '-', '--', or '/'. All three of these are +// permitted/required on any named option. +// +// Option bundling is permitted so long as: +// - '-' is used to start the option group +// - all of the bundled options are a single character +// - at most one of the bundled options accepts a value, and the value +// provided starts from the next character to the end of the string. +// +// This allows specifying '-a -b -c' as '-abc', and specifying '-D name=value' +// as '-Dname=value'. +// +// Option processing is disabled by specifying "--". All options after "--" +// are returned by OptionSet.Parse() unchanged and unprocessed. +// +// Unprocessed options are returned from OptionSet.Parse(). +// +// Examples: +// int verbose = 0; +// OptionSet p = new OptionSet () +// .Add ("v", v => ++verbose) +// .Add ("name=|value=", v => Console.WriteLine (v)); +// p.Parse (new string[]{"-v", "--v", "/v", "-name=A", "/name", "B", "extra"}); +// +// The above would parse the argument string array, and would invoke the +// lambda expression three times, setting `verbose' to 3 when complete. +// It would also print out "A" and "B" to standard output. +// The returned array would contain the string "extra". +// +// C# 3.0 collection initializers are supported and encouraged: +// var p = new OptionSet () { +// { "h|?|help", v => ShowHelp () }, +// }; +// +// System.ComponentModel.TypeConverter is also supported, allowing the use of +// custom data types in the callback type; TypeConverter.ConvertFromString() +// is used to convert the value option to an instance of the specified +// type: +// +// var p = new OptionSet () { +// { "foo=", (Foo f) => Console.WriteLine (f.ToString ()) }, +// }; +// +// Random other tidbits: +// - Boolean options (those w/o '=' or ':' in the option format string) +// are explicitly enabled if they are followed with '+', and explicitly +// disabled if they are followed with '-': +// string a = null; +// var p = new OptionSet () { +// { "a", s => a = s }, +// }; +// p.Parse (new string[]{"-a"}); // sets v != null +// p.Parse (new string[]{"-a+"}); // sets v != null +// p.Parse (new string[]{"-a-"}); // sets v == null +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using System.Linq; +using System.Reflection; + +namespace Mono.Options +{ + static class StringCoda + { + public static IEnumerable WrappedLines (string self, params int[] widths) + { + IEnumerable w = widths; + return WrappedLines (self, w); + } + + public static IEnumerable WrappedLines (string self, IEnumerable widths) + { + if (widths == null) + throw new ArgumentNullException ("widths"); + return CreateWrappedLinesIterator (self, widths); + } + + private static IEnumerable CreateWrappedLinesIterator (string self, IEnumerable widths) + { + if (string.IsNullOrEmpty (self)) { + yield return string.Empty; + yield break; + } + using (IEnumerator ewidths = widths.GetEnumerator ()) { + bool? hw = null; + int width = GetNextWidth (ewidths, int.MaxValue, ref hw); + int start = 0, end; + do { + end = GetLineEnd (start, width, self); + char c = self [end - 1]; + if (char.IsWhiteSpace (c)) + --end; + bool needContinuation = end != self.Length && !IsEolChar (c); + string continuation = ""; + if (needContinuation) { + --end; + continuation = "-"; + } + string line = self.Substring (start, end - start) + continuation; + yield return line; + start = end; + if (char.IsWhiteSpace (c)) + ++start; + width = GetNextWidth (ewidths, width, ref hw); + } while (start < self.Length); + } + } + + private static int GetNextWidth (IEnumerator ewidths, int curWidth, ref bool? eValid) + { + if (!eValid.HasValue || (eValid.HasValue && eValid.Value)) { + curWidth = (eValid = ewidths.MoveNext ()).Value ? ewidths.Current : curWidth; + // '.' is any character, - is for a continuation + const string minWidth = ".-"; + if (curWidth < minWidth.Length) + throw new ArgumentOutOfRangeException ("widths", + string.Format ("Element must be >= {0}, was {1}.", minWidth.Length, curWidth)); + return curWidth; + } + // no more elements, use the last element. + return curWidth; + } + + private static bool IsEolChar (char c) + { + return !char.IsLetterOrDigit (c); + } + + private static int GetLineEnd (int start, int length, string description) + { + int end = System.Math.Min (start + length, description.Length); + int sep = -1; + for (int i = start; i < end; ++i) { + if (description [i] == '\n') + return i + 1; + if (IsEolChar (description [i])) + sep = i + 1; + } + if (sep == -1 || end == description.Length) + return end; + return sep; + } + } + + public class OptionValueCollection : IList, IList + { + + List values = new List (); + OptionContext c; + + internal OptionValueCollection (OptionContext c) + { + this.c = c; + } + + #region ICollection + + void ICollection.CopyTo (Array array, int index) + { + (values as ICollection).CopyTo (array, index); + } + + bool ICollection.IsSynchronized { get { return (values as ICollection).IsSynchronized; } } + + object ICollection.SyncRoot { get { return (values as ICollection).SyncRoot; } } + + #endregion + + #region ICollection + + public void Add (string item) + { + values.Add (item); + } + + public void Clear () + { + values.Clear (); + } + + public bool Contains (string item) + { + return values.Contains (item); + } + + public void CopyTo (string[] array, int arrayIndex) + { + values.CopyTo (array, arrayIndex); + } + + public bool Remove (string item) + { + return values.Remove (item); + } + + public int Count { get { return values.Count; } } + + public bool IsReadOnly { get { return false; } } + + #endregion + + #region IEnumerable + + IEnumerator IEnumerable.GetEnumerator () + { + return values.GetEnumerator (); + } + + #endregion + + #region IEnumerable + + public IEnumerator GetEnumerator () + { + return values.GetEnumerator (); + } + + #endregion + + #region IList + + int IList.Add (object value) + { + return (values as IList).Add (value); + } + + bool IList.Contains (object value) + { + return (values as IList).Contains (value); + } + + int IList.IndexOf (object value) + { + return (values as IList).IndexOf (value); + } + + void IList.Insert (int index, object value) + { + (values as IList).Insert (index, value); + } + + void IList.Remove (object value) + { + (values as IList).Remove (value); + } + + void IList.RemoveAt (int index) + { + (values as IList).RemoveAt (index); + } + + bool IList.IsFixedSize { get { return false; } } + + object IList.this [int index] { get { return this [index]; } set { (values as IList) [index] = value; } } + + #endregion + + #region IList + + public int IndexOf (string item) + { + return values.IndexOf (item); + } + + public void Insert (int index, string item) + { + values.Insert (index, item); + } + + public void RemoveAt (int index) + { + values.RemoveAt (index); + } + + private void AssertValid (int index) + { + if (c.Option == null) + throw new InvalidOperationException ("OptionContext.Option is null."); + if (index >= c.Option.MaxValueCount) + throw new ArgumentOutOfRangeException ("index"); + if (c.Option.OptionValueType == OptionValueType.Required && + index >= values.Count) + throw new OptionException (string.Format ( + c.OptionSet.MessageLocalizer ("Missing required value for option '{0}'."), c.OptionName), + c.OptionName); + } + + public string this [int index] { + get { + AssertValid (index); + return index >= values.Count ? null : values [index]; + } + set { + values [index] = value; + } + } + + #endregion + + public List ToList () + { + return new List (values); + } + + public string[] ToArray () + { + return values.ToArray (); + } + + public override string ToString () + { + return string.Join (", ", values.ToArray ()); + } + } + + public class OptionContext + { + private Option option; + private string name; + private int index; + private OptionSet set; + private OptionValueCollection c; + + public OptionContext (OptionSet set) + { + this.set = set; + this.c = new OptionValueCollection (this); + } + + public Option Option { + get { return option; } + set { option = value; } + } + + public string OptionName { + get { return name; } + set { name = value; } + } + + public int OptionIndex { + get { return index; } + set { index = value; } + } + + public OptionSet OptionSet { + get { return set; } + } + + public OptionValueCollection OptionValues { + get { return c; } + } + } + + public enum OptionValueType + { + None, + Optional, + Required, + } + + public abstract class Option + { + string prototype, description; + string[] names; + OptionValueType type; + int count; + string[] separators; + bool hidden; + + protected Option (string prototype, string description) + : this (prototype, description, 1, false) + { + } + + protected Option (string prototype, string description, int maxValueCount) + : this (prototype, description, maxValueCount, false) + { + } + + protected Option (string prototype, string description, int maxValueCount, bool hidden) + { + if (prototype == null) + throw new ArgumentNullException ("prototype"); + if (prototype.Length == 0) + throw new ArgumentException ("Cannot be the empty string.", "prototype"); + if (maxValueCount < 0) + throw new ArgumentOutOfRangeException ("maxValueCount"); + + this.prototype = prototype; + this.description = description; + this.count = maxValueCount; + this.names = (this is OptionSet.Category) + // append GetHashCode() so that "duplicate" categories have distinct + // names, e.g. adding multiple "" categories should be valid. + ? new[]{ prototype + this.GetHashCode () } + : prototype.Split ('|'); + + if (this is OptionSet.Category) + return; + + this.type = ParsePrototype (); + this.hidden = hidden; + + if (this.count == 0 && type != OptionValueType.None) + throw new ArgumentException ( + "Cannot provide maxValueCount of 0 for OptionValueType.Required or " + + "OptionValueType.Optional.", + "maxValueCount"); + if (this.type == OptionValueType.None && maxValueCount > 1) + throw new ArgumentException ( + string.Format ("Cannot provide maxValueCount of {0} for OptionValueType.None.", maxValueCount), + "maxValueCount"); + if (Array.IndexOf (names, "<>") >= 0 && + ((names.Length == 1 && this.type != OptionValueType.None) || + (names.Length > 1 && this.MaxValueCount > 1))) + throw new ArgumentException ( + "The default option handler '<>' cannot require values.", + "prototype"); + } + + public string Prototype { get { return prototype; } } + + public string Description { get { return description; } } + + public OptionValueType OptionValueType { get { return type; } } + + public int MaxValueCount { get { return count; } } + + public bool Hidden { get { return hidden; } } + + public string[] GetNames () + { + return (string[])names.Clone (); + } + + public string[] GetValueSeparators () + { + if (separators == null) + return new string [0]; + return (string[])separators.Clone (); + } + + protected static T Parse (string value, OptionContext c) + { + Type tt = typeof(T); + TypeInfo ti = tt.GetTypeInfo (); + bool nullable = ti.IsValueType && ti.IsGenericType && + !ti.IsGenericTypeDefinition && + tt.GetGenericTypeDefinition () == typeof(Nullable<>); + Type targetType = nullable ? tt.GetTypeInfo ().GenericTypeParameters [0] : typeof(T); + //TypeConverter conv = TypeDescriptor.GetConverter (targetType); + T t = default (T); + try { + if (value != null) { + throw new ArgumentException (); + //t = (T)conv.ConvertFromString (value); + } + } catch (Exception e) { + throw new OptionException ( + string.Format ( + c.OptionSet.MessageLocalizer ($"Could not convert string `{value}' to type {targetType.Name} for option `{c.OptionName}'.")), + c.OptionName, e); + } + return t; + } + + internal string[] Names { get { return names; } } + + internal string[] ValueSeparators { get { return separators; } } + + static readonly char[] NameTerminator = new char[]{ '=', ':' }; + + private OptionValueType ParsePrototype () + { + char type = '\0'; + List seps = new List (); + for (int i = 0; i < names.Length; ++i) { + string name = names [i]; + if (name.Length == 0) + throw new ArgumentException ("Empty option names are not supported.", "prototype"); + + int end = name.IndexOfAny (NameTerminator); + if (end == -1) + continue; + names [i] = name.Substring (0, end); + if (type == '\0' || type == name [end]) + type = name [end]; + else + throw new ArgumentException ( + string.Format ("Conflicting option types: '{0}' vs. '{1}'.", type, name [end]), + "prototype"); + AddSeparators (name, end, seps); + } + + if (type == '\0') + return OptionValueType.None; + + if (count <= 1 && seps.Count != 0) + throw new ArgumentException ( + string.Format ("Cannot provide key/value separators for Options taking {0} value(s).", count), + "prototype"); + if (count > 1) { + if (seps.Count == 0) + this.separators = new string[]{ ":", "=" }; + else if (seps.Count == 1 && seps [0].Length == 0) + this.separators = null; + else + this.separators = seps.ToArray (); + } + + return type == '=' ? OptionValueType.Required : OptionValueType.Optional; + } + + private static void AddSeparators (string name, int end, ICollection seps) + { + int start = -1; + for (int i = end + 1; i < name.Length; ++i) { + switch (name [i]) { + case '{': + if (start != -1) + throw new ArgumentException ( + string.Format ("Ill-formed name/value separator found in \"{0}\".", name), + "prototype"); + start = i + 1; + break; + case '}': + if (start == -1) + throw new ArgumentException ( + string.Format ("Ill-formed name/value separator found in \"{0}\".", name), + "prototype"); + seps.Add (name.Substring (start, i - start)); + start = -1; + break; + default: + if (start == -1) + seps.Add (name [i].ToString ()); + break; + } + } + if (start != -1) + throw new ArgumentException ( + string.Format ("Ill-formed name/value separator found in \"{0}\".", name), + "prototype"); + } + + public void Invoke (OptionContext c) + { + OnParseComplete (c); + c.OptionName = null; + c.Option = null; + c.OptionValues.Clear (); + } + + protected abstract void OnParseComplete (OptionContext c); + + public override string ToString () + { + return Prototype; + } + } + + public abstract class ArgumentSource + { + + protected ArgumentSource () + { + } + + public abstract string[] GetNames (); + + public abstract string Description { get; } + + public abstract bool GetArguments (string value, out IEnumerable replacement); + + public static IEnumerable GetArguments (TextReader reader) + { + return GetArguments (reader, false); + } + + // Cribbed from mcs/driver.cs:LoadArgs(string) + static IEnumerable GetArguments (TextReader reader, bool close) + { + try { + StringBuilder arg = new StringBuilder (); + + string line; + while ((line = reader.ReadLine ()) != null) { + int t = line.Length; + + for (int i = 0; i < t; i++) { + char c = line [i]; + + if (c == '"' || c == '\'') { + char end = c; + + for (i++; i < t; i++) { + c = line [i]; + + if (c == end) + break; + arg.Append (c); + } + } else if (c == ' ') { + if (arg.Length > 0) { + yield return arg.ToString (); + arg.Length = 0; + } + } else + arg.Append (c); + } + if (arg.Length > 0) { + yield return arg.ToString (); + arg.Length = 0; + } + } + } finally { + if (close) + reader.Dispose (); + } + } + } + + public class OptionException : Exception + { + private string option; + + public OptionException () + { + } + + public OptionException (string message, string optionName) + : base (message) + { + this.option = optionName; + } + + public OptionException (string message, string optionName, Exception innerException) + : base (message, innerException) + { + this.option = optionName; + } + + public string OptionName { + get { return this.option; } + } + } + + public delegate void OptionAction (TKey key, TValue value); + + public class OptionSet : KeyedCollection + { + public OptionSet () + : this ((string f) => f) + { + } + + public OptionSet (Func localizer) + { + this.localizer = localizer; + this.roSources = new ReadOnlyCollection (sources); + } + + Func localizer; + + public Func MessageLocalizer { + get { return localizer; } + } + + List sources = new List (); + ReadOnlyCollection roSources; + + public ReadOnlyCollection ArgumentSources { + get { return roSources; } + } + + + protected override string GetKeyForItem (Option item) + { + if (item == null) + throw new ArgumentNullException ("option"); + if (item.Names != null && item.Names.Length > 0) + return item.Names [0]; + // This should never happen, as it's invalid for Option to be + // constructed w/o any names. + throw new InvalidOperationException ("Option has no names!"); + } + + [Obsolete ("Use KeyedCollection.this[string]")] + protected Option GetOptionForName (string option) + { + if (option == null) + throw new ArgumentNullException ("option"); + try { + return base [option]; + } catch (KeyNotFoundException) { + return null; + } + } + + protected override void InsertItem (int index, Option item) + { + base.InsertItem (index, item); + AddImpl (item); + } + + protected override void RemoveItem (int index) + { + Option p = Items [index]; + base.RemoveItem (index); + // KeyedCollection.RemoveItem() handles the 0th item + for (int i = 1; i < p.Names.Length; ++i) { + Dictionary.Remove (p.Names [i]); + } + } + + protected override void SetItem (int index, Option item) + { + base.SetItem (index, item); + AddImpl (item); + } + + private void AddImpl (Option option) + { + if (option == null) + throw new ArgumentNullException ("option"); + List added = new List (option.Names.Length); + try { + // KeyedCollection.InsertItem/SetItem handle the 0th name. + for (int i = 1; i < option.Names.Length; ++i) { + Dictionary.Add (option.Names [i], option); + added.Add (option.Names [i]); + } + } catch (Exception) { + foreach (string name in added) + Dictionary.Remove (name); + throw; + } + } + + public OptionSet Add (string header) + { + if (header == null) + throw new ArgumentNullException ("header"); + Add (new Category (header)); + return this; + } + + internal sealed class Category : Option + { + + // Prototype starts with '=' because this is an invalid prototype + // (see Option.ParsePrototype(), and thus it'll prevent Category + // instances from being accidentally used as normal options. + public Category (string description) + : base ("=:Category:= " + description, description) + { + } + + protected override void OnParseComplete (OptionContext c) + { + throw new NotSupportedException ("Category.OnParseComplete should not be invoked."); + } + } + + + public new OptionSet Add (Option option) + { + base.Add (option); + return this; + } + + sealed class ActionOption : Option + { + Action action; + + public ActionOption (string prototype, string description, int count, Action action) + : this (prototype, description, count, action, false) + { + } + + public ActionOption (string prototype, string description, int count, Action action, bool hidden) + : base (prototype, description, count, hidden) + { + if (action == null) + throw new ArgumentNullException ("action"); + this.action = action; + } + + protected override void OnParseComplete (OptionContext c) + { + action (c.OptionValues); + } + } + + public OptionSet Add (string prototype, Action action) + { + return Add (prototype, null, action); + } + + public OptionSet Add (string prototype, string description, Action action) + { + return Add (prototype, description, action, false); + } + + public OptionSet Add (string prototype, string description, Action action, bool hidden) + { + if (action == null) + throw new ArgumentNullException ("action"); + Option p = new ActionOption (prototype, description, 1, + delegate (OptionValueCollection v) { + action (v [0]); + }, hidden); + base.Add (p); + return this; + } + + public OptionSet Add (string prototype, OptionAction action) + { + return Add (prototype, null, action); + } + + public OptionSet Add (string prototype, string description, OptionAction action) + { + return Add (prototype, description, action, false); + } + + public OptionSet Add (string prototype, string description, OptionAction action, bool hidden) + { + if (action == null) + throw new ArgumentNullException ("action"); + Option p = new ActionOption (prototype, description, 2, + delegate (OptionValueCollection v) { + action (v [0], v [1]); + }, hidden); + base.Add (p); + return this; + } + + sealed class ActionOption : Option + { + Action action; + + public ActionOption (string prototype, string description, Action action) + : base (prototype, description, 1) + { + if (action == null) + throw new ArgumentNullException ("action"); + this.action = action; + } + + protected override void OnParseComplete (OptionContext c) + { + action (Parse (c.OptionValues [0], c)); + } + } + + sealed class ActionOption : Option + { + OptionAction action; + + public ActionOption (string prototype, string description, OptionAction action) + : base (prototype, description, 2) + { + if (action == null) + throw new ArgumentNullException ("action"); + this.action = action; + } + + protected override void OnParseComplete (OptionContext c) + { + action ( + Parse (c.OptionValues [0], c), + Parse (c.OptionValues [1], c)); + } + } + + public OptionSet Add (string prototype, Action action) + { + return Add (prototype, null, action); + } + + public OptionSet Add (string prototype, string description, Action action) + { + return Add (new ActionOption (prototype, description, action)); + } + + public OptionSet Add (string prototype, OptionAction action) + { + return Add (prototype, null, action); + } + + public OptionSet Add (string prototype, string description, OptionAction action) + { + return Add (new ActionOption (prototype, description, action)); + } + + public OptionSet Add (ArgumentSource source) + { + if (source == null) + throw new ArgumentNullException ("source"); + sources.Add (source); + return this; + } + + protected virtual OptionContext CreateOptionContext () + { + return new OptionContext (this); + } + + public List Parse (IEnumerable arguments) + { + if (arguments == null) + throw new ArgumentNullException ("arguments"); + OptionContext c = CreateOptionContext (); + c.OptionIndex = -1; + bool process = true; + List unprocessed = new List (); + Option def = Contains ("<>") ? this ["<>"] : null; + ArgumentEnumerator ae = new ArgumentEnumerator (arguments); + foreach (string argument in ae) { + ++c.OptionIndex; + if (argument == "--") { + process = false; + continue; + } + if (!process) { + Unprocessed (unprocessed, def, c, argument); + continue; + } + if (AddSource (ae, argument)) + continue; + if (!Parse (argument, c)) + Unprocessed (unprocessed, def, c, argument); + } + if (c.Option != null) + c.Option.Invoke (c); + return unprocessed; + } + + class ArgumentEnumerator : IEnumerable + { + List> sources = new List> (); + + public ArgumentEnumerator (IEnumerable arguments) + { + sources.Add (arguments.GetEnumerator ()); + } + + public void Add (IEnumerable arguments) + { + sources.Add (arguments.GetEnumerator ()); + } + + public IEnumerator GetEnumerator () + { + do { + IEnumerator c = sources [sources.Count - 1]; + if (c.MoveNext ()) + yield return c.Current; + else { + c.Dispose (); + sources.RemoveAt (sources.Count - 1); + } + } while (sources.Count > 0); + } + + IEnumerator IEnumerable.GetEnumerator () + { + return GetEnumerator (); + } + } + + bool AddSource (ArgumentEnumerator ae, string argument) + { + foreach (ArgumentSource source in sources) { + IEnumerable replacement; + if (!source.GetArguments (argument, out replacement)) + continue; + ae.Add (replacement); + return true; + } + return false; + } + + private static bool Unprocessed (ICollection extra, Option def, OptionContext c, string argument) + { + if (def == null) { + extra.Add (argument); + return false; + } + c.OptionValues.Add (argument); + c.Option = def; + c.Option.Invoke (c); + return false; + } + + private readonly Regex ValueOption = new Regex ( + @"^(?--|-|/)(?[^:=]+)((?[:=])(?.*))?$"); + + protected bool GetOptionParts (string argument, out string flag, out string name, out string sep, out string value) + { + if (argument == null) + throw new ArgumentNullException ("argument"); + + flag = name = sep = value = null; + Match m = ValueOption.Match (argument); + if (!m.Success) { + return false; + } + flag = m.Groups ["flag"].Value; + name = m.Groups ["name"].Value; + if (m.Groups ["sep"].Success && m.Groups ["value"].Success) { + sep = m.Groups ["sep"].Value; + value = m.Groups ["value"].Value; + } + return true; + } + + protected virtual bool Parse (string argument, OptionContext c) + { + if (c.Option != null) { + ParseValue (argument, c); + return true; + } + + string f, n, s, v; + if (!GetOptionParts (argument, out f, out n, out s, out v)) + return false; + + Option p; + if (Contains (n)) { + p = this [n]; + c.OptionName = f + n; + c.Option = p; + switch (p.OptionValueType) { + case OptionValueType.None: + c.OptionValues.Add (n); + c.Option.Invoke (c); + break; + case OptionValueType.Optional: + case OptionValueType.Required: + ParseValue (v, c); + break; + } + return true; + } + // no match; is it a bool option? + if (ParseBool (argument, n, c)) + return true; + // is it a bundled option? + if (ParseBundledValue (f, string.Concat (n + s + v), c)) + return true; + + return false; + } + + private void ParseValue (string option, OptionContext c) + { + if (option != null) + foreach (string o in c.Option.ValueSeparators != null + ? option.Split (c.Option.ValueSeparators, c.Option.MaxValueCount - c.OptionValues.Count, StringSplitOptions.None) + : new string[]{option}) { + c.OptionValues.Add (o); + } + if (c.OptionValues.Count == c.Option.MaxValueCount || + c.Option.OptionValueType == OptionValueType.Optional) + c.Option.Invoke (c); + else if (c.OptionValues.Count > c.Option.MaxValueCount) { + throw new OptionException (localizer (string.Format ( + "Error: Found {0} option values when expecting {1}.", + c.OptionValues.Count, c.Option.MaxValueCount)), + c.OptionName); + } + } + + private bool ParseBool (string option, string n, OptionContext c) + { + Option p; + string rn; + if (n.Length >= 1 && (n [n.Length - 1] == '+' || n [n.Length - 1] == '-') && + Contains ((rn = n.Substring (0, n.Length - 1)))) { + p = this [rn]; + string v = n [n.Length - 1] == '+' ? option : null; + c.OptionName = option; + c.Option = p; + c.OptionValues.Add (v); + p.Invoke (c); + return true; + } + return false; + } + + private bool ParseBundledValue (string f, string n, OptionContext c) + { + if (f != "-") + return false; + for (int i = 0; i < n.Length; ++i) { + Option p; + string opt = f + n [i].ToString (); + string rn = n [i].ToString (); + if (!Contains (rn)) { + if (i == 0) + return false; + throw new OptionException (string.Format (localizer ( + "Cannot bundle unregistered option '{0}'."), opt), opt); + } + p = this [rn]; + switch (p.OptionValueType) { + case OptionValueType.None: + Invoke (c, opt, n, p); + break; + case OptionValueType.Optional: + case OptionValueType.Required: + { + string v = n.Substring (i + 1); + c.Option = p; + c.OptionName = opt; + ParseValue (v.Length != 0 ? v : null, c); + return true; + } + default: + throw new InvalidOperationException ("Unknown OptionValueType: " + p.OptionValueType); + } + } + return true; + } + + private static void Invoke (OptionContext c, string name, string value, Option option) + { + c.OptionName = name; + c.Option = option; + c.OptionValues.Add (value); + option.Invoke (c); + } + + private const int OptionWidth = 29; + private const int Description_FirstWidth = 80 - OptionWidth; + private const int Description_RemWidth = 80 - OptionWidth - 2; + + public void WriteOptionDescriptions (TextWriter o) + { + foreach (Option p in this) { + int written = 0; + + if (p.Hidden) + continue; + + Category c = p as Category; + if (c != null) { + WriteDescription (o, p.Description, "", 80, 80); + continue; + } + + if (!WriteOptionPrototype (o, p, ref written)) + continue; + + if (written < OptionWidth) + o.Write (new string (' ', OptionWidth - written)); + else { + o.WriteLine (); + o.Write (new string (' ', OptionWidth)); + } + + WriteDescription (o, p.Description, new string (' ', OptionWidth + 2), + Description_FirstWidth, Description_RemWidth); + } + + foreach (ArgumentSource s in sources) { + string[] names = s.GetNames (); + if (names == null || names.Length == 0) + continue; + + int written = 0; + + Write (o, ref written, " "); + Write (o, ref written, names [0]); + for (int i = 1; i < names.Length; ++i) { + Write (o, ref written, ", "); + Write (o, ref written, names [i]); + } + + if (written < OptionWidth) + o.Write (new string (' ', OptionWidth - written)); + else { + o.WriteLine (); + o.Write (new string (' ', OptionWidth)); + } + + WriteDescription (o, s.Description, new string (' ', OptionWidth + 2), + Description_FirstWidth, Description_RemWidth); + } + } + + void WriteDescription (TextWriter o, string value, string prefix, int firstWidth, int remWidth) + { + bool indent = false; + foreach (string line in GetLines (localizer (GetDescription (value)), firstWidth, remWidth)) { + if (indent) + o.Write (prefix); + o.WriteLine (line); + indent = true; + } + } + + bool WriteOptionPrototype (TextWriter o, Option p, ref int written) + { + string[] names = p.Names; + + int i = GetNextOptionIndex (names, 0); + if (i == names.Length) + return false; + + if (names [i].Length == 1) { + Write (o, ref written, " -"); + Write (o, ref written, names [0]); + } else { + Write (o, ref written, " --"); + Write (o, ref written, names [0]); + } + + for (i = GetNextOptionIndex (names, i + 1); + i < names.Length; i = GetNextOptionIndex (names, i + 1)) { + Write (o, ref written, ", "); + Write (o, ref written, names [i].Length == 1 ? "-" : "--"); + Write (o, ref written, names [i]); + } + + if (p.OptionValueType == OptionValueType.Optional || + p.OptionValueType == OptionValueType.Required) { + if (p.OptionValueType == OptionValueType.Optional) { + Write (o, ref written, localizer ("[")); + } + Write (o, ref written, localizer ("=" + GetArgumentName (0, p.MaxValueCount, p.Description))); + string sep = p.ValueSeparators != null && p.ValueSeparators.Length > 0 + ? p.ValueSeparators [0] + : " "; + for (int c = 1; c < p.MaxValueCount; ++c) { + Write (o, ref written, localizer (sep + GetArgumentName (c, p.MaxValueCount, p.Description))); + } + if (p.OptionValueType == OptionValueType.Optional) { + Write (o, ref written, localizer ("]")); + } + } + return true; + } + + static int GetNextOptionIndex (string[] names, int i) + { + while (i < names.Length && names [i] == "<>") { + ++i; + } + return i; + } + + static void Write (TextWriter o, ref int n, string s) + { + n += s.Length; + o.Write (s); + } + + private static string GetArgumentName (int index, int maxIndex, string description) + { + if (description == null) + return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1); + string[] nameStart; + if (maxIndex == 1) + nameStart = new string[]{ "{0:", "{" }; + else + nameStart = new string[]{ "{" + index + ":" }; + for (int i = 0; i < nameStart.Length; ++i) { + int start, j = 0; + do { + start = description.IndexOf (nameStart [i], j); + } while (start >= 0 && j != 0 ? description [j++ - 1] == '{' : false); + if (start == -1) + continue; + int end = description.IndexOf ("}", start); + if (end == -1) + continue; + return description.Substring (start + nameStart [i].Length, end - start - nameStart [i].Length); + } + return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1); + } + + private static string GetDescription (string description) + { + if (description == null) + return string.Empty; + StringBuilder sb = new StringBuilder (description.Length); + int start = -1; + for (int i = 0; i < description.Length; ++i) { + switch (description [i]) { + case '{': + if (i == start) { + sb.Append ('{'); + start = -1; + } else if (start < 0) + start = i + 1; + break; + case '}': + if (start < 0) { + if ((i + 1) == description.Length || description [i + 1] != '}') + throw new InvalidOperationException ("Invalid option description: " + description); + ++i; + sb.Append ("}"); + } else { + sb.Append (description.Substring (start, i - start)); + start = -1; + } + break; + case ':': + if (start < 0) + goto default; + start = i + 1; + break; + default: + if (start < 0) + sb.Append (description [i]); + break; + } + } + return sb.ToString (); + } + + private static IEnumerable GetLines (string description, int firstWidth, int remWidth) + { + return StringCoda.WrappedLines (description, firstWidth, remWidth); + } + } +} + diff --git a/build-tools/jnienv-gen/Properties/AssemblyInfo.cs b/build-tools/jnienv-gen/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..75e1408f527 --- /dev/null +++ b/build-tools/jnienv-gen/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle ("jnienv-gen")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("Xamarin Inc.")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("Xamarin Inc.")] +[assembly: AssemblyTrademark ("Xamarin")] +[assembly: AssemblyCulture ("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion ("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/build-tools/jnienv-gen/jnienv-gen.csproj b/build-tools/jnienv-gen/jnienv-gen.csproj new file mode 100644 index 00000000000..cedeffd1ee9 --- /dev/null +++ b/build-tools/jnienv-gen/jnienv-gen.csproj @@ -0,0 +1,44 @@ + + + + Debug + AnyCPU + {AFB8F6D1-6EA9-42C3-950B-98F34C669AD2} + Exe + Xamarin.Android.JniEnv + jnienv-gen + v4.5 + + + true + full + false + ..\..\bin\BuildDebug + DEBUG; + prompt + 4 + true + obj\AnyCPU\Debug + + + true + ..\..\bin\BuildRelease + prompt + 4 + true + obj\AnyCPU\Release + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build-tools/jnienv-gen/packages.config b/build-tools/jnienv-gen/packages.config new file mode 100644 index 00000000000..f862aa233dc --- /dev/null +++ b/build-tools/jnienv-gen/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file