Imported Upstream version 6.12.0.86

Former-commit-id: 7a84ce7d08c42c458ac8e74b27186ca863315d79
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-07-10 08:44:59 +00:00
parent 92747312ea
commit 0b380204a4
812 changed files with 26901 additions and 9053 deletions

View File

@@ -52,8 +52,6 @@ namespace Mono.CompilerServices.SymbolWriter
#if !CECIL && !MOBILE
ModuleBuilder mb;
delegate Guid GetGuidFunc (ModuleBuilder mb);
GetGuidFunc get_guid_func;
public SymbolWriterImpl (ModuleBuilder mb)
{
@@ -62,16 +60,7 @@ namespace Mono.CompilerServices.SymbolWriter
public void Close ()
{
MethodInfo mi = typeof (ModuleBuilder).GetMethod (
"Mono_GetGuid",
BindingFlags.Static | BindingFlags.NonPublic);
if (mi == null)
return;
get_guid_func = (GetGuidFunc) System.Delegate.CreateDelegate (
typeof (GetGuidFunc), mi);
msw.WriteSymbolFile (get_guid_func (mb));
msw.WriteSymbolFile (mb.ModuleVersionId);
}
#else
Guid guid;

View File

@@ -409,6 +409,9 @@ namespace Mono.Debugger.Soft
public ErrorCode ErrorCode {
get; set;
}
public string ErrorMessage {
get; set;
}
}
/*
@@ -436,7 +439,7 @@ namespace Mono.Debugger.Soft
* with newer runtimes, and vice versa.
*/
internal const int MAJOR_VERSION = 2;
internal const int MINOR_VERSION = 54;
internal const int MINOR_VERSION = 57;
enum WPSuspendPolicy {
NONE = 0,
@@ -792,10 +795,12 @@ namespace Mono.Debugger.Soft
// For reply packets
offset = 0;
ReadInt (); // length
var len = ReadInt (); // length
ReadInt (); // id
ReadByte (); // flags
ErrorCode = ReadShort ();
if (ErrorCode == (int)Mono.Debugger.Soft.ErrorCode.INVALID_ARGUMENT && connection.Version.AtLeast (2, 56) && len > offset)
ErrorMsg = ReadString ();
}
public CommandSet CommandSet {
@@ -810,6 +815,10 @@ namespace Mono.Debugger.Soft
get; set;
}
public string ErrorMsg {
get; internal set;
}
public int Offset {
get {
return offset;
@@ -1792,7 +1801,7 @@ namespace Mono.Debugger.Soft
LogPacket (packetId, encoded_packet, reply, command_set, command, watch);
if (r.ErrorCode != 0) {
if (ErrorHandler != null)
ErrorHandler (this, new ErrorHandlerEventArgs () { ErrorCode = (ErrorCode)r.ErrorCode });
ErrorHandler (this, new ErrorHandlerEventArgs () { ErrorCode = (ErrorCode)r.ErrorCode, ErrorMessage = r.ErrorMsg});
throw new NotImplementedException ("No error handler set.");
} else {
return r;

View File

@@ -34,6 +34,11 @@ namespace Mono.Debugger.Soft
}
}
public int GetId()
{
return id;
}
public EventType EventType {
get {
return etype;

View File

@@ -51,10 +51,19 @@ namespace Mono.Debugger.Soft
// Since protocol version 2.46
public Value Value {
get {
ValueImpl value;
if (Address == 0)
return null;
return vm.DecodeValue (vm.conn.Pointer_GetValue (Address, Type));
try {
value = vm.conn.Pointer_GetValue (Address, Type);
}
catch (CommandException ex) {
if (ex.ErrorCode == ErrorCode.INVALID_ARGUMENT)
throw new ArgumentException ("Invalid pointer address.");
else
throw;
}
return vm.DecodeValue (value);
}
}

View File

@@ -371,7 +371,7 @@ namespace Mono.Debugger.Soft
case ErrorCode.NO_SEQ_POINT_AT_IL_OFFSET:
throw new ArgumentException ("Cannot set breakpoint on the specified IL offset.");
default:
throw new CommandException (args.ErrorCode);
throw new CommandException (args.ErrorCode, args.ErrorMessage);
}
}
@@ -657,7 +657,9 @@ namespace Mono.Debugger.Soft
internal EventRequest GetRequest (int id) {
lock (requests_lock) {
return requests [id];
EventRequest obj;
requests.TryGetValue (id, out obj);
return obj;
}
}
@@ -885,13 +887,18 @@ namespace Mono.Debugger.Soft
public class CommandException : Exception {
internal CommandException (ErrorCode error_code) : base ("Debuggee returned error code " + error_code + ".") {
internal CommandException (ErrorCode error_code, string error_message) : base ("Debuggee returned error code " + error_code + (error_message == null || error_message.Length == 0 ? "." : " - " + error_message + ".")) {
ErrorCode = error_code;
ErrorMessage = error_message;
}
public ErrorCode ErrorCode {
get; set;
}
public string ErrorMessage {
get; internal set;
}
}
public class VMNotSuspendedException : InvalidOperationException

View File

@@ -609,6 +609,15 @@ public class Tests : TestsBase, ITest2
fixed_size_array();
test_new_exception_filter();
test_async_debug_generics();
if (args.Length >0 && args [0] == "pointer_arguments2") {
pointers2 ();
return 0;
}
if (args.Length >0 && args [0] == "ss_multi_thread") {
ss_multi_thread ();
return 0;
}
test_invalid_argument_assembly_get_type ();
return 3;
}
@@ -637,6 +646,10 @@ public class Tests : TestsBase, ITest2
LocalReflectClass.RunMe ();
}
public static void test_invalid_argument_assembly_get_type () {
}
public static void breakpoints () {
/* Call these early so it is JITted by the time a breakpoint is placed on it */
bp3 ();
@@ -857,6 +870,24 @@ public class Tests : TestsBase, ITest2
n.Buffer2 = new char4('a', 'b', 'c', 'd');
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void ss_multi_thread () {
for (int i = 0; i < 5; i++)
{
var t = new Thread(mt_ss);
t.Name = "Thread_" + i;
t.Start();
}
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
static void mt_ss()
{
int a = 12;
int b = 13;
int c = 13;
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void test_new_exception_filter () {
test_new_exception_filter1();
@@ -2232,6 +2263,17 @@ public class Tests : TestsBase, ITest2
rtMethod.Invoke(rtObject, new object[] { });
}
public static unsafe void pointer_arguments2 (int* a) {
*a = 0;
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static unsafe void pointers2 () {
int[] a = new [] {1,2,3};
fixed (int* pa = a)
pointer_arguments2 (pa);
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void new_thread_hybrid_exception() {
try

View File

@@ -1 +1 @@
c385aeecb4b21151e7780126a63be6607f140237
8c953f6fe3d5737ec602dd307992ac2919c00ccc

View File

@@ -311,8 +311,8 @@ public class UnixEncoding : Encoding
public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
{
if (bytes == null || chars == null)
throw new ArgumentNullException (bytes == null ? "bytes" : "chars");
if ((bytes == null && byteCount != 0) || (chars == null && charCount != 0))
throw new ArgumentNullException ((bytes == null && byteCount != 0) ? "bytes" : "chars");
if (charCount < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException (charCount < 0 ? "charCount" : "byteCount");

View File

@@ -995,6 +995,23 @@ namespace MonoTests.Mono.Unix {
);
}
[Test]
public void TestEmptyString ()
{
byte[] data = new byte [] {};
Encoding enc = new UnixEncoding ();
string s = enc.GetString (data);
Assert.AreEqual (s, "", "#1");
char[] chars = enc.GetChars (data);
Assert.AreEqual (chars.Length, 0, "#2");
byte[] b1 = enc.GetBytes ("");
Assert.AreEqual (b1.Length, 0, "#3");
byte[] b2 = enc.GetBytes (new char[] {});
Assert.AreEqual (b2.Length, 0, "#3");
}
private void Compare (string prefix, string start, byte[] end)
{
byte[] bytes = unix.GetBytes (start);

View File

@@ -21,7 +21,7 @@
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>XML Web services discovery involves discovering the available Web Services given an URL. The URL usually points to a discovery document, which typically has a.disco file name extension. Within a discovery document are references to information about the existance of XML Web services. These references can refer to service descriptions, XML Schema Definition language (XSD) schemas or other discovery documents. This class represents a reference to a Service Description.</para>
<para>XML Web services discovery involves discovering the available Web Services given an URL. The URL usually points to a discovery document, which typically has a.disco file name extension. Within a discovery document are references to information about the existence of XML Web services. These references can refer to service descriptions, XML Schema Definition language (XSD) schemas or other discovery documents. This class represents a reference to a Service Description.</para>
<para>Within a discovery document, a reference to a Service Description is contained within a contractRef XML element. The contractRef XML element has two attributes: ref and docRef. The contractRef element must have an XML namespace matching the <see cref="F:System.Web.Services.Discovery.ContractReference.Namespace" /> constant, whereas the ref and docRef attributes are placed in the <see cref="P:System.Web.Services.Discovery.ContractReference.Ref" /> and <see cref="P:System.Web.Services.Discovery.ContractReference.DocRef" /> properties.</para>
</remarks>
<summary>

View File

@@ -21,7 +21,7 @@
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>XML Web services discovery involves discovering the available XML Web services, given an URL. The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document, which is an XML document, contains references to information about the existance of XML Web services, such as a service description, XML Schema Definition (XSD) language schema, or another discovery document. This class represents the contents of the discovery document; where the <see cref="P:System.Web.Services.Discovery.DiscoveryDocument.References" /> property contains a list of the references contained within the discovery document.</para>
<para>XML Web services discovery involves discovering the available XML Web services, given an URL. The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document, which is an XML document, contains references to information about the existence of XML Web services, such as a service description, XML Schema Definition (XSD) language schema, or another discovery document. This class represents the contents of the discovery document; where the <see cref="P:System.Web.Services.Discovery.DiscoveryDocument.References" /> property contains a list of the references contained within the discovery document.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />

View File

@@ -21,7 +21,7 @@
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>XML Web services discovery involves discovering the available XML Web services given an URL. The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existance of XML Web services, such as Service Descriptions, XML Schema Definition language (XSD) schemas, or other discovery documents. This class represents a reference to a discovery document.</para>
<para>XML Web services discovery involves discovering the available XML Web services given an URL. The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existence of XML Web services, such as Service Descriptions, XML Schema Definition language (XSD) schemas, or other discovery documents. This class represents a reference to a discovery document.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />

View File

@@ -21,7 +21,7 @@
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>XML Web services discovery involves discovering the available XML Web services given, a URL. A The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existance of XML Web services. These references can refer to service descriptions, XSD schemas, or other discovery documents. This class represents a reference to an XSD schema.</para>
<para>XML Web services discovery involves discovering the available XML Web services given, a URL. A The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existence of XML Web services. These references can refer to service descriptions, XSD schemas, or other discovery documents. This class represents a reference to an XSD schema.</para>
<para>Within a discovery document, a reference to an XSD schema is contained within a schemaRef XML element. The schemaRef XML element has an XML namespace and a ref attribute. The value of the XML namespace must match the <see cref="F:System.Web.Services.Discovery.SchemaReference.Namespace" /> constant. The value of the ref attribute is placed in the <see cref="P:System.Web.Services.Discovery.SchemaReference.Ref" /> property.</para>
</remarks>
<summary>

View File

@@ -1,413 +0,0 @@
// 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.
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Peter Bartok (pbartok@novell.com)
//
//
// COMPLETE
using System.Collections;
namespace System.Windows.Forms.RTF {
internal class Charcode {
#region Local Variables
private StandardCharCode[] codes;
private Hashtable reverse;
private int size;
#endregion // Local Variables
#region Cached Values
static Charcode ansi_generic;
#endregion
#region Public Constructors
public Charcode() : this(256) {
}
private Charcode(int size) {
this.size = size;
this.codes = new StandardCharCode[size];
this.reverse = new Hashtable(size);
// No need to reinitialize array to its default value
//for (int i = 0; i < size; i++) {
// codes[i] = StandardCharCode.nothing;
//}
}
#endregion // Public Constructors
#region Public Instance Properties
public int this[StandardCharCode c] {
get {
object obj;
obj = reverse[c];
if (obj != null) {
return (int)obj;
}
for (int i = 0; i < size; i++) {
if (codes[i] == c) {
return i;
}
}
return -1;
}
}
public StandardCharCode this[int c] {
get {
if (c < 0 || c >= size) {
return StandardCharCode.nothing;
}
return codes[c];
}
private set {
if (c < 0 || c >= size) {
return;
}
codes[c] = value;
reverse[value] = c;
}
}
#endregion // Public Instance Properties
#region Public Instance Methods
#endregion // Public Instance Methods
#region Public Static Methods
public static Charcode AnsiGeneric {
get {
if (ansi_generic != null)
return ansi_generic;
ansi_generic = new Charcode(256);
ansi_generic[0x06] = StandardCharCode.formula;
ansi_generic[0x1e] = StandardCharCode.nobrkhyphen;
ansi_generic[0x1f] = StandardCharCode.opthyphen;
ansi_generic[' '] = StandardCharCode.space;
ansi_generic['!'] = StandardCharCode.exclam;
ansi_generic['"'] = StandardCharCode.quotedbl;
ansi_generic['#'] = StandardCharCode.numbersign;
ansi_generic['$'] = StandardCharCode.dollar;
ansi_generic['%'] = StandardCharCode.percent;
ansi_generic['&'] = StandardCharCode.ampersand;
ansi_generic['\\'] = StandardCharCode.quoteright;
ansi_generic['('] = StandardCharCode.parenleft;
ansi_generic[')'] = StandardCharCode.parenright;
ansi_generic['*'] = StandardCharCode.asterisk;
ansi_generic['+'] = StandardCharCode.plus;
ansi_generic[','] = StandardCharCode.comma;
ansi_generic['-'] = StandardCharCode.hyphen;
ansi_generic['.'] = StandardCharCode.period;
ansi_generic['/'] = StandardCharCode.slash;
ansi_generic['0'] = StandardCharCode.zero;
ansi_generic['1'] = StandardCharCode.one;
ansi_generic['2'] = StandardCharCode.two;
ansi_generic['3'] = StandardCharCode.three;
ansi_generic['4'] = StandardCharCode.four;
ansi_generic['5'] = StandardCharCode.five;
ansi_generic['6'] = StandardCharCode.six;
ansi_generic['7'] = StandardCharCode.seven;
ansi_generic['8'] = StandardCharCode.eight;
ansi_generic['9'] = StandardCharCode.nine;
ansi_generic[':'] = StandardCharCode.colon;
ansi_generic[';'] = StandardCharCode.semicolon;
ansi_generic['<'] = StandardCharCode.less;
ansi_generic['='] = StandardCharCode.equal;
ansi_generic['>'] = StandardCharCode.greater;
ansi_generic['?'] = StandardCharCode.question;
ansi_generic['@'] = StandardCharCode.at;
ansi_generic['A'] = StandardCharCode.A;
ansi_generic['B'] = StandardCharCode.B;
ansi_generic['C'] = StandardCharCode.C;
ansi_generic['D'] = StandardCharCode.D;
ansi_generic['E'] = StandardCharCode.E;
ansi_generic['F'] = StandardCharCode.F;
ansi_generic['G'] = StandardCharCode.G;
ansi_generic['H'] = StandardCharCode.H;
ansi_generic['I'] = StandardCharCode.I;
ansi_generic['J'] = StandardCharCode.J;
ansi_generic['K'] = StandardCharCode.K;
ansi_generic['L'] = StandardCharCode.L;
ansi_generic['M'] = StandardCharCode.M;
ansi_generic['N'] = StandardCharCode.N;
ansi_generic['O'] = StandardCharCode.O;
ansi_generic['P'] = StandardCharCode.P;
ansi_generic['Q'] = StandardCharCode.Q;
ansi_generic['R'] = StandardCharCode.R;
ansi_generic['S'] = StandardCharCode.S;
ansi_generic['T'] = StandardCharCode.T;
ansi_generic['U'] = StandardCharCode.U;
ansi_generic['V'] = StandardCharCode.V;
ansi_generic['W'] = StandardCharCode.W;
ansi_generic['X'] = StandardCharCode.X;
ansi_generic['Y'] = StandardCharCode.Y;
ansi_generic['Z'] = StandardCharCode.Z;
ansi_generic['['] = StandardCharCode.bracketleft;
ansi_generic['\\'] = StandardCharCode.backslash;
ansi_generic[']'] = StandardCharCode.bracketright;
ansi_generic['^'] = StandardCharCode.asciicircum;
ansi_generic['_'] = StandardCharCode.underscore;
ansi_generic['`'] = StandardCharCode.quoteleft;
ansi_generic['a'] = StandardCharCode.a;
ansi_generic['b'] = StandardCharCode.b;
ansi_generic['c'] = StandardCharCode.c;
ansi_generic['d'] = StandardCharCode.d;
ansi_generic['e'] = StandardCharCode.e;
ansi_generic['f'] = StandardCharCode.f;
ansi_generic['g'] = StandardCharCode.g;
ansi_generic['h'] = StandardCharCode.h;
ansi_generic['i'] = StandardCharCode.i;
ansi_generic['j'] = StandardCharCode.j;
ansi_generic['k'] = StandardCharCode.k;
ansi_generic['l'] = StandardCharCode.l;
ansi_generic['m'] = StandardCharCode.m;
ansi_generic['n'] = StandardCharCode.n;
ansi_generic['o'] = StandardCharCode.o;
ansi_generic['p'] = StandardCharCode.p;
ansi_generic['q'] = StandardCharCode.q;
ansi_generic['r'] = StandardCharCode.r;
ansi_generic['s'] = StandardCharCode.s;
ansi_generic['t'] = StandardCharCode.t;
ansi_generic['u'] = StandardCharCode.u;
ansi_generic['v'] = StandardCharCode.v;
ansi_generic['w'] = StandardCharCode.w;
ansi_generic['x'] = StandardCharCode.x;
ansi_generic['y'] = StandardCharCode.y;
ansi_generic['z'] = StandardCharCode.z;
ansi_generic['{'] = StandardCharCode.braceleft;
ansi_generic['|'] = StandardCharCode.bar;
ansi_generic['}'] = StandardCharCode.braceright;
ansi_generic['~'] = StandardCharCode.asciitilde;
ansi_generic[0xa0] = StandardCharCode.nobrkspace;
ansi_generic[0xa1] = StandardCharCode.exclamdown;
ansi_generic[0xa2] = StandardCharCode.cent;
ansi_generic[0xa3] = StandardCharCode.sterling;
ansi_generic[0xa4] = StandardCharCode.currency;
ansi_generic[0xa5] = StandardCharCode.yen;
ansi_generic[0xa6] = StandardCharCode.brokenbar;
ansi_generic[0xa7] = StandardCharCode.section;
ansi_generic[0xa8] = StandardCharCode.dieresis;
ansi_generic[0xa9] = StandardCharCode.copyright;
ansi_generic[0xaa] = StandardCharCode.ordfeminine;
ansi_generic[0xab] = StandardCharCode.guillemotleft;
ansi_generic[0xac] = StandardCharCode.logicalnot;
ansi_generic[0xad] = StandardCharCode.opthyphen;
ansi_generic[0xae] = StandardCharCode.registered;
ansi_generic[0xaf] = StandardCharCode.macron;
ansi_generic[0xb0] = StandardCharCode.degree;
ansi_generic[0xb1] = StandardCharCode.plusminus;
ansi_generic[0xb2] = StandardCharCode.twosuperior;
ansi_generic[0xb3] = StandardCharCode.threesuperior;
ansi_generic[0xb4] = StandardCharCode.acute;
ansi_generic[0xb5] = StandardCharCode.mu;
ansi_generic[0xb6] = StandardCharCode.paragraph;
ansi_generic[0xb7] = StandardCharCode.periodcentered;
ansi_generic[0xb8] = StandardCharCode.cedilla;
ansi_generic[0xb9] = StandardCharCode.onesuperior;
ansi_generic[0xba] = StandardCharCode.ordmasculine;
ansi_generic[0xbb] = StandardCharCode.guillemotright;
ansi_generic[0xbc] = StandardCharCode.onequarter;
ansi_generic[0xbd] = StandardCharCode.onehalf;
ansi_generic[0xbe] = StandardCharCode.threequarters;
ansi_generic[0xbf] = StandardCharCode.questiondown;
ansi_generic[0xc0] = StandardCharCode.Agrave;
ansi_generic[0xc1] = StandardCharCode.Aacute;
ansi_generic[0xc2] = StandardCharCode.Acircumflex;
ansi_generic[0xc3] = StandardCharCode.Atilde;
ansi_generic[0xc4] = StandardCharCode.Adieresis;
ansi_generic[0xc5] = StandardCharCode.Aring;
ansi_generic[0xc6] = StandardCharCode.AE;
ansi_generic[0xc7] = StandardCharCode.Ccedilla;
ansi_generic[0xc8] = StandardCharCode.Egrave;
ansi_generic[0xc9] = StandardCharCode.Eacute;
ansi_generic[0xca] = StandardCharCode.Ecircumflex;
ansi_generic[0xcb] = StandardCharCode.Edieresis;
ansi_generic[0xcc] = StandardCharCode.Igrave;
ansi_generic[0xcd] = StandardCharCode.Iacute;
ansi_generic[0xce] = StandardCharCode.Icircumflex;
ansi_generic[0xcf] = StandardCharCode.Idieresis;
ansi_generic[0xd0] = StandardCharCode.Eth;
ansi_generic[0xd1] = StandardCharCode.Ntilde;
ansi_generic[0xd2] = StandardCharCode.Ograve;
ansi_generic[0xd3] = StandardCharCode.Oacute;
ansi_generic[0xd4] = StandardCharCode.Ocircumflex;
ansi_generic[0xd5] = StandardCharCode.Otilde;
ansi_generic[0xd6] = StandardCharCode.Odieresis;
ansi_generic[0xd7] = StandardCharCode.multiply;
ansi_generic[0xd8] = StandardCharCode.Oslash;
ansi_generic[0xd9] = StandardCharCode.Ugrave;
ansi_generic[0xda] = StandardCharCode.Uacute;
ansi_generic[0xdb] = StandardCharCode.Ucircumflex;
ansi_generic[0xdc] = StandardCharCode.Udieresis;
ansi_generic[0xdd] = StandardCharCode.Yacute;
ansi_generic[0xde] = StandardCharCode.Thorn;
ansi_generic[0xdf] = StandardCharCode.germandbls;
ansi_generic[0xe0] = StandardCharCode.agrave;
ansi_generic[0xe1] = StandardCharCode.aacute;
ansi_generic[0xe2] = StandardCharCode.acircumflex;
ansi_generic[0xe3] = StandardCharCode.atilde;
ansi_generic[0xe4] = StandardCharCode.adieresis;
ansi_generic[0xe5] = StandardCharCode.aring;
ansi_generic[0xe6] = StandardCharCode.ae;
ansi_generic[0xe7] = StandardCharCode.ccedilla;
ansi_generic[0xe8] = StandardCharCode.egrave;
ansi_generic[0xe9] = StandardCharCode.eacute;
ansi_generic[0xea] = StandardCharCode.ecircumflex;
ansi_generic[0xeb] = StandardCharCode.edieresis;
ansi_generic[0xec] = StandardCharCode.igrave;
ansi_generic[0xed] = StandardCharCode.iacute;
ansi_generic[0xee] = StandardCharCode.icircumflex;
ansi_generic[0xef] = StandardCharCode.idieresis;
ansi_generic[0xf0] = StandardCharCode.eth;
ansi_generic[0xf1] = StandardCharCode.ntilde;
ansi_generic[0xf2] = StandardCharCode.ograve;
ansi_generic[0xf3] = StandardCharCode.oacute;
ansi_generic[0xf4] = StandardCharCode.ocircumflex;
ansi_generic[0xf5] = StandardCharCode.otilde;
ansi_generic[0xf6] = StandardCharCode.odieresis;
ansi_generic[0xf7] = StandardCharCode.divide;
ansi_generic[0xf8] = StandardCharCode.oslash;
ansi_generic[0xf9] = StandardCharCode.ugrave;
ansi_generic[0xfa] = StandardCharCode.uacute;
ansi_generic[0xfb] = StandardCharCode.ucircumflex;
ansi_generic[0xfc] = StandardCharCode.udieresis;
ansi_generic[0xfd] = StandardCharCode.yacute;
ansi_generic[0xfe] = StandardCharCode.thorn;
ansi_generic[0xff] = StandardCharCode.ydieresis;
return ansi_generic;
}
}
public static Charcode AnsiSymbol {
get {
Charcode code = new Charcode(256);
code[0x06] = StandardCharCode.formula;
code[0x1e] = StandardCharCode.nobrkhyphen;
code[0x1f] = StandardCharCode.opthyphen;
code[' '] = StandardCharCode.space;
code['!'] = StandardCharCode.exclam;
code['"'] = StandardCharCode.universal;
code['#'] = StandardCharCode.mathnumbersign;
code['$'] = StandardCharCode.existential;
code['%'] = StandardCharCode.percent;
code['&'] = StandardCharCode.ampersand;
code['\\'] = StandardCharCode.suchthat;
code['('] = StandardCharCode.parenleft;
code[')'] = StandardCharCode.parenright;
code['*'] = StandardCharCode.mathasterisk;
code['+'] = StandardCharCode.mathplus;
code[','] = StandardCharCode.comma;
code['-'] = StandardCharCode.mathminus;
code['.'] = StandardCharCode.period;
code['/'] = StandardCharCode.slash;
code['0'] = StandardCharCode.zero;
code['1'] = StandardCharCode.one;
code['2'] = StandardCharCode.two;
code['3'] = StandardCharCode.three;
code['4'] = StandardCharCode.four;
code['5'] = StandardCharCode.five;
code['6'] = StandardCharCode.six;
code['7'] = StandardCharCode.seven;
code['8'] = StandardCharCode.eight;
code['9'] = StandardCharCode.nine;
code[':'] = StandardCharCode.colon;
code[';'] = StandardCharCode.semicolon;
code['<'] = StandardCharCode.less;
code['='] = StandardCharCode.mathequal;
code['>'] = StandardCharCode.greater;
code['?'] = StandardCharCode.question;
code['@'] = StandardCharCode.congruent;
code['A'] = StandardCharCode.Alpha;
code['B'] = StandardCharCode.Beta;
code['C'] = StandardCharCode.Chi;
code['D'] = StandardCharCode.Delta;
code['E'] = StandardCharCode.Epsilon;
code['F'] = StandardCharCode.Phi;
code['G'] = StandardCharCode.Gamma;
code['H'] = StandardCharCode.Eta;
code['I'] = StandardCharCode.Iota;
code['K'] = StandardCharCode.Kappa;
code['L'] = StandardCharCode.Lambda;
code['M'] = StandardCharCode.Mu;
code['N'] = StandardCharCode.Nu;
code['O'] = StandardCharCode.Omicron;
code['P'] = StandardCharCode.Pi;
code['Q'] = StandardCharCode.Theta;
code['R'] = StandardCharCode.Rho;
code['S'] = StandardCharCode.Sigma;
code['T'] = StandardCharCode.Tau;
code['U'] = StandardCharCode.Upsilon;
code['V'] = StandardCharCode.varsigma;
code['W'] = StandardCharCode.Omega;
code['X'] = StandardCharCode.Xi;
code['Y'] = StandardCharCode.Psi;
code['Z'] = StandardCharCode.Zeta;
code['['] = StandardCharCode.bracketleft;
code['\\'] = StandardCharCode.backslash;
code[']'] = StandardCharCode.bracketright;
code['^'] = StandardCharCode.asciicircum;
code['_'] = StandardCharCode.underscore;
code['`'] = StandardCharCode.quoteleft;
code['a'] = StandardCharCode.alpha;
code['b'] = StandardCharCode.beta;
code['c'] = StandardCharCode.chi;
code['d'] = StandardCharCode.delta;
code['e'] = StandardCharCode.epsilon;
code['f'] = StandardCharCode.phi;
code['g'] = StandardCharCode.gamma;
code['h'] = StandardCharCode.eta;
code['i'] = StandardCharCode.iota;
code['k'] = StandardCharCode.kappa;
code['l'] = StandardCharCode.lambda;
code['m'] = StandardCharCode.mu;
code['n'] = StandardCharCode.nu;
code['o'] = StandardCharCode.omicron;
code['p'] = StandardCharCode.pi;
code['q'] = StandardCharCode.theta;
code['r'] = StandardCharCode.rho;
code['s'] = StandardCharCode.sigma;
code['t'] = StandardCharCode.tau;
code['u'] = StandardCharCode.upsilon;
code['w'] = StandardCharCode.omega;
code['x'] = StandardCharCode.xi;
code['y'] = StandardCharCode.psi;
code['z'] = StandardCharCode.zeta;
code['{'] = StandardCharCode.braceleft;
code['|'] = StandardCharCode.bar;
code['}'] = StandardCharCode.braceright;
code['~'] = StandardCharCode.mathtilde;
return code;
}
}
#endregion // Public Static Methods
}
}

View File

@@ -1,157 +0,0 @@
// 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.
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Peter Bartok (pbartok@novell.com)
//
//
using System;
// COMPLETE
namespace System.Windows.Forms.RTF {
#if RTF_LIB
public
#else
internal
#endif
class Charset {
#region Local Variables
private CharsetType id;
private CharsetFlags flags;
private Charcode code;
private string file;
#endregion // Local Variables
#region Public Constructors
public Charset() {
flags = CharsetFlags.Read | CharsetFlags.Switch;
id = CharsetType.General;
file = string.Empty;
this.ReadMap();
}
#endregion // Public Constructors
#region Public Instance Properties
public Charcode Code {
get {
return code;
}
set {
code = value;
}
}
public CharsetFlags Flags {
get {
return flags;
}
set {
flags = value;
}
}
public CharsetType ID {
get {
return id;
}
set {
switch(value) {
case CharsetType.Symbol: {
id = CharsetType.Symbol;
return;
}
default:
case CharsetType.General: {
id = CharsetType.General;
return;
}
}
}
}
public string File {
get {
return file;
}
set {
if (file != value) {
file = value;
}
}
}
public StandardCharCode this[int c] {
get {
return code[c];
}
}
#endregion // Public Instance Properties
#region Public Instance Methods
public bool ReadMap() {
switch (id) {
case CharsetType.General: {
if (file == string.Empty) {
code = Charcode.AnsiGeneric;
return true;
}
// FIXME - implement reading charmap from file...
return true;
}
case CharsetType.Symbol: {
if (file == string.Empty) {
code = Charcode.AnsiSymbol;
return true;
}
// FIXME - implement reading charmap from file...
return true;
}
default: {
return false;
}
}
}
public char StdCharCode(string name) {
// FIXME - finish this
return ' ';
}
public string StdCharName(char code) {
// FIXME - finish this
return String.Empty;
}
#endregion // Public Instance Methods
}
}

View File

@@ -1,41 +0,0 @@
// 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.
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Peter Bartok (pbartok@novell.com)
//
//
// COMPLETE
namespace System.Windows.Forms.RTF {
[Flags]
#if RTF_LIB
public
#else
internal
#endif
enum CharsetFlags {
None = 0x00,
Read = 0x01,
Switch = 0x02
}
}

View File

@@ -0,0 +1,79 @@
// 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.
//
// Copyright (c) 2020 Karl Scowen
//
// Authors:
// Karl Scowen <contact@scowencomputers.co.nz>
//
//
namespace System.Windows.Forms.RTF {
internal static class CharsetToCodepage {
public static int Translate(CharsetType charset)
{
switch (charset) {
case CharsetType.General:
case CharsetType.Arabic_Traditional:
case CharsetType.Arabic_user:
case CharsetType.Hebrew_user:
case CharsetType.Mac: // Technically wrong, because "mac" should actually be quite a few with their own code pages...
default:
return System.Text.Encoding.Default.CodePage;
case CharsetType.ANSI:
return 1252;
case CharsetType.Symbol:
return 42;
case CharsetType.Shift_Jis:
return 932;
case CharsetType.Hangul:
return 949;
case CharsetType.Johab:
return 1361;
case CharsetType.GB2312:
return 936;
case CharsetType.Big5:
return 950;
case CharsetType.Greek:
return 1253;
case CharsetType.Turkish:
return 1254;
case CharsetType.Vietnamese:
return 1258;
case CharsetType.Hebrew:
return 1255;
case CharsetType.Arabic:
return 1256;
case CharsetType.Baltic:
return 1257;
case CharsetType.Russian:
return 1251;
case CharsetType.Thai:
return 874;
case CharsetType.Eastern_European:
return 1250;
case CharsetType.PC_437:
return 437;
case CharsetType.OEM:
return 850;
}
}
}
}

View File

@@ -21,6 +21,7 @@
//
// Authors:
// Peter Bartok (pbartok@novell.com)
// Karl Scowen (contact@scowencomputers.co.nz)
//
//
@@ -33,8 +34,29 @@ namespace System.Windows.Forms.RTF {
#else
internal
#endif
enum CharsetType {
General = 0,
Symbol = 1,
enum CharsetType : byte {
ANSI = 0,
General = 1,
Symbol = 2,
Mac = 77,
Shift_Jis = 128,
Hangul = 129,
Johab = 130,
GB2312 = 134,
Big5 = 136,
Greek = 161,
Turkish = 162,
Vietnamese = 163,
Hebrew = 177,
Arabic = 178,
Arabic_Traditional = 179,
Arabic_user = 180,
Hebrew_user = 181,
Baltic = 186,
Russian = 204,
Thai = 222,
Eastern_European = 238,
PC_437 = 254,
OEM = 255
}
}

View File

@@ -366,10 +366,12 @@ namespace System.Windows.Forms.RTF {
new KeyStruct(Major.StyleAttr, Minor.Next, "snext"),
new KeyStruct(Major.PictAttr, Minor.MacQD, "macpict"),
new KeyStruct(Major.PictAttr, Minor.PMMetafile, "pmmetafile"),
new KeyStruct(Major.PictAttr, Minor.EnhancedMetafile, "emfblip"),
new KeyStruct(Major.PictAttr, Minor.WinMetafile, "wmetafile"),
new KeyStruct(Major.PictAttr, Minor.DevIndBitmap, "dibitmap"),
new KeyStruct(Major.PictAttr, Minor.WinBitmap, "wbitmap"),
new KeyStruct(Major.PictAttr, Minor.PngBlip, "pngblip"),
new KeyStruct(Major.PictAttr, Minor.JpegBlip, "jpgblip"),
new KeyStruct(Major.PictAttr, Minor.PixelBits, "wbmbitspixel"),
new KeyStruct(Major.PictAttr, Minor.BitmapPlanes, "wbmplanes"),
new KeyStruct(Major.PictAttr, Minor.BitmapWid, "wbmwidthbytes"),
@@ -393,6 +395,7 @@ namespace System.Windows.Forms.RTF {
new KeyStruct(Major.NeXTGrAttr, Minor.NeXTGHeight, "height"),
new KeyStruct(Major.Destination, Minor.OptDest, "*"),
new KeyStruct(Major.Destination, Minor.FontTbl, "fonttbl"),
new KeyStruct(Major.Destination, Minor.FontName, "fname"),
new KeyStruct(Major.Destination, Minor.FontAltName, "falt"),
new KeyStruct(Major.Destination, Minor.EmbeddedFont, "fonteb"),
new KeyStruct(Major.Destination, Minor.FontFile, "fontfile"),

View File

@@ -41,6 +41,7 @@ namespace System.Windows.Forms.RTF {
// Major.Destinan
FontTbl,
FontName,
FontAltName,
EmbeddedFont,
FontFile,
@@ -520,10 +521,12 @@ namespace System.Windows.Forms.RTF {
// Major.PictAttr
MacQD,
PMMetafile,
EnhancedMetafile,
WinMetafile,
DevIndBitmap,
WinBitmap,
PngBlip,
JpegBlip,
PixelBits,
BitmapPlanes,
BitmapWid,

Some files were not shown because too many files have changed in this diff Show More