## 'tools' is not normally built
DIST_SUBDIRS = libgc mono ikvm-native support docs data runtime scripts man samples web tools msvc
-EXTRA_DIST= mono.pc.in mint.pc.in mono-uninstalled.pc.in dotnet.pc.in mono-cairo.pc.in LICENSE
+EXTRA_DIST= mono-uninstalled.pc.in LICENSE
DISTCHECK_CONFIGURE_FLAGS = EXTERNAL_MCS=false EXTERNAL_RUNTIME=false
d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) PROFILE=default distdir=$$d dist-recursive
pkgconfigdir = $(libdir)/pkgconfig
-if JIT_SUPPORTED
-if INTERP_SUPPORTED
-pkgconfig_DATA= mono.pc mint.pc dotnet.pc mono-cairo.pc
-else
-pkgconfig_DATA= mono.pc dotnet.pc mono-cairo.pc
-endif
-else
-pkgconfig_DATA= mint.pc mono-cairo.pc
-endif
noinst_DATA = mono-uninstalled.pc
-DISTCLEANFILES= mono.pc mint.pc mono-uninstalled.pc dotnet.pc mono-cairo.pc
+DISTCLEANFILES= mono-uninstalled.pc
.PHONY: get-monolite-latest mcs-do-compiler-tests compiler-tests bootstrap-world
AC_OUTPUT([
Makefile
-mint.pc
-mono.pc
-mono-cairo.pc
-dotnet.pc
mono-uninstalled.pc
scripts/mono-nunit.pc
scripts/mono-find-provides
data/Makefile
data/net_1_1/Makefile
data/net_2_0/Makefile
+data/mint.pc
+data/mono.pc
+data/mono-cairo.pc
+data/dotnet.pc
+data/cecil.pc
samples/Makefile
support/Makefile
data/config
monodir = $(sysconfdir)/mono
-EXTRA_DIST = config.in \
- browscap.ini mono.supp README
+EXTRA_DIST = \
+ config.in \
+ browscap.ini mono.supp README \
+ mono.pc.in mint.pc.in dotnet.pc.in mono-cairo.pc.in cecil.pc.in
+
+pkgconfigdir = $(libdir)/pkgconfig
+
+if JIT_SUPPORTED
+if INTERP_SUPPORTED
+pkgconfig_DATA= mono.pc mint.pc dotnet.pc mono-cairo.pc cecil.pc
+else
+pkgconfig_DATA= mono.pc dotnet.pc mono-cairo.pc cecil.pc
+endif
+else
+pkgconfig_DATA= mint.pc mono-cairo.pc cecil.pc
+endif
+
+DISTCLEANFILES= mono.pc mint.pc dotnet.pc mono-cairo.pc cecil.pc
mono_DATA = config \
browscap.ini
--- /dev/null
+assemblies_dir=@prefix@/lib/mono
+Libraries=${assemblies_dir}/gac/Mono.Cecil/0.5.0.1__0738eb9f132ed756/Mono.Cecil.dll
+
+Name: Mono Internal -- Do not use.
+Description: Mono Internal Libraries -- Do not use
+Version: @VERSION@
+Libs: -r:Mono.Cecil.dll
--- /dev/null
+
+Name: Standard libraries in a .NET setup
+Description: References all the standard .NET libraries for compilation
+Version: @VERSION@
+Libs: -r:Accessibility.dll -r:cscompmgd.dll -r:Microsoft.JScript.dll -r:Microsoft.VisualC.dll -r:Microsoft.Vsa.dll -r:System.Configuration.Install.dll -r:System.Data.dll -r:System.Data.OracleClient.dll -r:System.Design.dll -r:System.DirectoryServices.dll -r:System.dll -r:System.Drawing.Design.dll -r:System.Drawing.dll -r:System.EnterpriseServices.dll -r:System.Management.dll -r:System.Messaging.dll -r:System.Runtime.Remoting.dll -r:System.Runtime.Serialization.Formatters.Soap.dll -r:System.Security.dll -r:System.ServiceProcess.dll -r:System.Web.dll -r:System.Web.Services.dll -r:System.Windows.Forms.dll -r:System.Xml.dll
--- /dev/null
+prefix=${pcfiledir}/../..
+exec_prefix=${pcfiledir}/../..
+libdir=${prefix}/lib
+includedir=${prefix}/include/mono-@API_VER@
+
+
+Name: Mono Interpreter
+Description: Mono Interpreter Runtime
+Version: @VERSION@
+Requires: glib-2.0 gthread-2.0
+Libs: -L${libdir} @export_ldflags@ -lmint @libmono_ldflags@
+Cflags: -I${includedir} @libmono_cflags@
--- /dev/null
+prefix=${pcfiledir}/../..
+exec_prefix=${pcfiledir}/../..
+libdir=${prefix}/@reloc_libdir@
+includedir=${prefix}/include
+
+Name: Mono.Cairo
+Description: Cairo bindings for Mono
+Version: @VERSION@
+Libs: -r:${prefix}/lib/mono/1.0/Mono.Cairo.dll
--- /dev/null
+prefix=${pcfiledir}/../..
+exec_prefix=${pcfiledir}/../..
+libdir=${prefix}/@reloc_libdir@
+includedir=${prefix}/include/mono-@API_VER@
+
+Name: Mono
+Description: Mono Runtime
+Version: @VERSION@
+Requires: glib-2.0 gthread-2.0
+Libs: -L${libdir} @export_ldflags@ -lmono @libmono_ldflags@
+Cflags: -I${includedir} @libmono_cflags@
+++ /dev/null
-
-Name: Standard libraries in a .NET setup
-Description: References all the standard .NET libraries for compilation
-Version: @VERSION@
-Libs: -r:Accessibility.dll -r:cscompmgd.dll -r:Microsoft.JScript.dll -r:Microsoft.VisualC.dll -r:Microsoft.Vsa.dll -r:System.Configuration.Install.dll -r:System.Data.dll -r:System.Data.OracleClient.dll -r:System.Design.dll -r:System.DirectoryServices.dll -r:System.dll -r:System.Drawing.Design.dll -r:System.Drawing.dll -r:System.EnterpriseServices.dll -r:System.Management.dll -r:System.Messaging.dll -r:System.Runtime.Remoting.dll -r:System.Runtime.Serialization.Formatters.Soap.dll -r:System.Security.dll -r:System.ServiceProcess.dll -r:System.Web.dll -r:System.Web.Services.dll -r:System.Windows.Forms.dll -r:System.Xml.dll
+2007-08-05 Vladimir Krasnov <vladimirk@mainsoft.com>\r
+\r
+ * ServletWorkerRequest.jvm.cs: fixed _OutputStream in\r
+ ServletWorkerRequest ctor\r
+\r
2007-06-28 Vladimir Krasnov <vladimirk@mainsoft.com>\r
\r
* BaseHttpServlet.cs: fixed service(), it does not creates output\r
_HttpServletResponse = resp;
if (alwaysUsePrintWriter)
- _OutputStream = new OutputStreamWrapper (resp.getWriter ());
+ _OutputStream = CreateOutputStream (false);
string contextPath = req.getContextPath();
string servletPath = req.getServletPath ();
+2007-08-02 Jonathan Pobst <monkey@jpobst.com>
+
+ * System.Windows.Forms.dll.sources: Add MdiControlStrip.cs.
+
2007-07-31 Rolf Bjarne Kvinge <RKvinge@novell.com>
* build-csproj2k5-tests: Add ONLY_1_1, __MONO_CS__ and DEBUG where
System.Windows.Forms/MaskInputRejectedEventHandler.cs
System.Windows.Forms/MaskedTextBox.cs
System.Windows.Forms/MdiClient.cs
+System.Windows.Forms/MdiControlStrip.cs
System.Windows.Forms/MdiLayout.cs
System.Windows.Forms/MdiWindowManager.cs
System.Windows.Forms/MeasureItemEventArgs.cs
+2007-08-02 Jonathan Pobst <monkey@jpobst.com>
+
+ * MdiClient.cs, MdiWindowManager.cs: Support 2.0 Mdi MenuStrip
+ folding.
+ * MdiControlStrip.cs: Added. These are the menu items used in mdi
+ folding.
+ * ToolStrip.cs: Add a null check to mnemonics.
+ * ToolStripDropDownMenu.cs: When using a SystemMenuItem, there is
+ no ConnectedArea.
+ [Fixes most of bug #81689]
+
2007-08-02 Rolf Bjarne Kvinge <RKvinge@novell.com>
* PropertyGrid.cs: Add a null-check. Fixes #82289/SVGPad.
if (c is MenuStrip)
child_menu = (MenuStrip)c;
+ RemoveControlMenuItems (wm);
+
+ if (form.WindowState == FormWindowState.Maximized) {
+ parent_menu.Items.Insert (0, new MdiControlStrip.SystemMenuItem (form));
+ parent_menu.Items.Add (new MdiControlStrip.ControlBoxMenuItem (form, MdiControlStrip.ControlBoxType.Close));
+ parent_menu.Items.Add (new MdiControlStrip.ControlBoxMenuItem (form, MdiControlStrip.ControlBoxType.Max));
+ parent_menu.Items.Add (new MdiControlStrip.ControlBoxMenuItem (form, MdiControlStrip.ControlBoxType.Min));
+ }
+
if (child_menu != null)
ToolStripManager.Merge (child_menu, parent_menu);
}
return maximize_this;
}
+#if NET_2_0
+ internal void RemoveControlMenuItems (MdiWindowManager wm)
+ {
+ Form form = wm.form;
+ MenuStrip parent_menu = form.MdiParent.MainMenuStrip;
+
+ for (int i = parent_menu.Items.Count - 1; i >= 0; i--)
+ if (parent_menu.Items[i] is MdiControlStrip.SystemMenuItem || parent_menu.Items[i] is MdiControlStrip.ControlBoxMenuItem)
+ parent_menu.Items.RemoveAt (i);
+ }
+#endif
+
internal void SetWindowState (Form form, FormWindowState old_window_state, FormWindowState new_window_state, bool is_activating_child)
{
bool mdiclient_layout;
--- /dev/null
+//\r
+// MdiControlStrip.cs\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+// Copyright (c) 2006 Novell, Inc.\r
+//\r
+// Authors:\r
+// Jonathan Pobst (monkey@jpobst.com)\r
+//\r
+\r
+#if NET_2_0\r
+using System;\r
+using System.Runtime.InteropServices;\r
+using System.ComponentModel;\r
+using System.Drawing;\r
+using System.Windows.Forms.Layout;\r
+using System.Collections.Generic;\r
+using System.ComponentModel.Design.Serialization;\r
+\r
+namespace System.Windows.Forms\r
+{\r
+ internal class MdiControlStrip\r
+ {\r
+ public class SystemMenuItem : ToolStripMenuItem\r
+ {\r
+ private Form form;\r
+ \r
+ public SystemMenuItem (Form ownerForm)\r
+ {\r
+ form = ownerForm;\r
+ \r
+ base.AutoSize = false;\r
+ base.Size = new Size (20, 20);\r
+ base.Image = ownerForm.Icon.ToBitmap ();\r
+ base.MergeIndex = int.MinValue;\r
+ base.DisplayStyle = ToolStripItemDisplayStyle.Image;\r
+\r
+ DropDownItems.Add ("&Restore", null, RestoreItemHandler);\r
+ ToolStripMenuItem tsiMove = (ToolStripMenuItem)DropDownItems.Add ("&Move");\r
+ tsiMove.Enabled = false;\r
+ ToolStripMenuItem tsiSize = (ToolStripMenuItem)DropDownItems.Add ("&Size");\r
+ tsiSize.Enabled = false;\r
+ DropDownItems.Add ("Mi&nimize", null, MinimizeItemHandler);\r
+ ToolStripMenuItem tsiMaximize = (ToolStripMenuItem)DropDownItems.Add ("Ma&ximize");\r
+ tsiMaximize.Enabled = false;\r
+ DropDownItems.Add ("-");\r
+ ToolStripMenuItem tsiClose = (ToolStripMenuItem)DropDownItems.Add ("&Close", null, CloseItemHandler);\r
+ tsiClose.ShortcutKeys = Keys.Control | Keys.F4;\r
+ DropDownItems.Add ("-");\r
+ ToolStripMenuItem tsiNext = (ToolStripMenuItem)DropDownItems.Add ("Nex&t", null, NextItemHandler);\r
+ tsiNext.ShortcutKeys = Keys.Control | Keys.F6;\r
+ }\r
+\r
+ protected override void OnPaint (PaintEventArgs e)\r
+ {\r
+ // Can't render without an owner\r
+ if (this.Owner == null)\r
+ return;\r
+\r
+ // If DropDown.ShowImageMargin is false, we don't display the image\r
+ Image draw_image = this.Image;\r
+\r
+ // Figure out where our text and image go\r
+ Rectangle text_layout_rect;\r
+ Rectangle image_layout_rect;\r
+\r
+ this.CalculateTextAndImageRectangles (out text_layout_rect, out image_layout_rect);\r
+\r
+ if (image_layout_rect != Rectangle.Empty)\r
+ this.Owner.Renderer.DrawItemImage (new ToolStripItemImageRenderEventArgs (e.Graphics, this, draw_image, image_layout_rect));\r
+\r
+ return;\r
+ }\r
+\r
+ private void RestoreItemHandler (object sender, EventArgs e)\r
+ {\r
+ form.WindowState = FormWindowState.Normal;\r
+ }\r
+\r
+ private void MinimizeItemHandler (object sender, EventArgs e)\r
+ {\r
+ form.WindowState = FormWindowState.Minimized;\r
+ }\r
+\r
+ private void CloseItemHandler (object sender, EventArgs e)\r
+ {\r
+ form.Close ();\r
+ }\r
+\r
+ private void NextItemHandler (object sender, EventArgs e)\r
+ {\r
+ form.MdiParent.MdiContainer.ActivateNextChild ();\r
+ }\r
+ }\r
+ \r
+ public class ControlBoxMenuItem : ToolStripMenuItem\r
+ {\r
+ private Form form;\r
+ private ControlBoxType type;\r
+ \r
+ public ControlBoxMenuItem (Form ownerForm, ControlBoxType type)\r
+ {\r
+ form = ownerForm;\r
+ this.type = type;\r
+ \r
+ base.AutoSize = false;\r
+ base.Alignment = ToolStripItemAlignment.Right;\r
+ base.Size = new Size (20, 20);\r
+ base.MergeIndex = int.MaxValue;\r
+ base.DisplayStyle = ToolStripItemDisplayStyle.None;\r
+\r
+ switch (type) {\r
+ case ControlBoxType.Close:\r
+ this.Click += new EventHandler(CloseItemHandler);\r
+ break;\r
+ case ControlBoxType.Min:\r
+ this.Click += new EventHandler (MinimizeItemHandler);\r
+ break;\r
+ case ControlBoxType.Max:\r
+ this.Click += new EventHandler (RestoreItemHandler);\r
+ break;\r
+ }\r
+ }\r
+\r
+ protected override void OnPaint (PaintEventArgs e)\r
+ {\r
+ base.OnPaint (e);\r
+ Graphics g = e.Graphics;\r
+ \r
+ switch (type) {\r
+ case ControlBoxType.Close:\r
+ g.FillRectangle (Brushes.Black, 8, 8, 4, 4);\r
+ g.FillRectangle (Brushes.Black, 6, 6, 2, 2);\r
+ g.FillRectangle (Brushes.Black, 6, 12, 2, 2);\r
+ g.FillRectangle (Brushes.Black, 12, 6, 2, 2);\r
+ g.FillRectangle (Brushes.Black, 12, 12, 2, 2);\r
+ g.DrawLine (Pens.Black, 8, 7, 8, 12);\r
+ g.DrawLine (Pens.Black, 7, 8, 12, 8);\r
+ g.DrawLine (Pens.Black, 11, 7, 11, 12);\r
+ g.DrawLine (Pens.Black, 7, 11, 12, 11);\r
+ break;\r
+ case ControlBoxType.Min:\r
+ g.DrawLine (Pens.Black, 6, 12, 11, 12);\r
+ g.DrawLine (Pens.Black, 6, 13, 11, 13);\r
+ break;\r
+ case ControlBoxType.Max:\r
+ g.DrawLines (Pens.Black, new Point[] {new Point (7, 8), new Point (7, 5), new Point (13, 5), new Point (13, 10), new Point (11, 10)});\r
+ g.DrawLine (Pens.Black, 7, 6, 12, 6);\r
+ \r
+ g.DrawRectangle (Pens.Black, new Rectangle (5, 8, 6, 5));\r
+ g.DrawLine (Pens.Black, 5, 9, 11, 9);\r
+ \r
+ break;\r
+ }\r
+ }\r
+\r
+ private void RestoreItemHandler (object sender, EventArgs e)\r
+ {\r
+ form.WindowState = FormWindowState.Normal;\r
+ }\r
+\r
+ private void MinimizeItemHandler (object sender, EventArgs e)\r
+ {\r
+ form.WindowState = FormWindowState.Minimized;\r
+ }\r
+\r
+ private void CloseItemHandler (object sender, EventArgs e)\r
+ {\r
+ form.Close ();\r
+ }\r
+ }\r
+ \r
+ public enum ControlBoxType\r
+ {\r
+ Close,\r
+ Min,\r
+ Max\r
+ }\r
+ }\r
+}\r
+#endif
\ No newline at end of file
#if NET_2_0
if (form.MdiParent.MainMenuStrip != null)
form.MdiParent.MainMenuStrip.RefreshMdiItems ();
+
+ mdi_container.RemoveControlMenuItems (this);
#endif
}
{
// If any item has an explicit mnemonic, it gets the message
foreach (ToolStripItem tsi in this.Items)
- if (tsi.Enabled && tsi.Visible && Control.IsMnemonic (charCode, tsi.Text))
+ if (tsi.Enabled && tsi.Visible && !string.IsNullOrEmpty (tsi.Text) && Control.IsMnemonic (charCode, tsi.Text))
return tsi.ProcessMnemonic (charCode);
string code = Char.ToUpper (charCode).ToString ();
#region Internal Methods
internal override Rectangle CalculateConnectedArea ()
{
- if (this.OwnerItem != null && !this.OwnerItem.IsOnDropDown)
+ if (this.OwnerItem != null && !this.OwnerItem.IsOnDropDown && !(this.OwnerItem is MdiControlStrip.SystemMenuItem))
return new Rectangle (1, 0, this.OwnerItem.Width - 2, 2);
return base.CalculateConnectedArea ();
end
protected
+ def getter
+""" get { return (m_attributes & #{mask_full_name()}) == #{full_name()}; }
+"""
+ end
+
def setter
""" set {
#{type} masked = (#{mask_full_name()} & #{full_name()});
#region FieldAttributes
public bool IsCompilerControlled {
- get { return (m_attributes & FieldAttributes.Compilercontrolled) != 0; }
+ get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Compilercontrolled; }
set {
FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.Compilercontrolled);
if (value)
}
public bool IsPrivate {
- get { return (m_attributes & FieldAttributes.Private) != 0; }
+ get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Private; }
set {
FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.Private);
if (value)
}
public bool IsFamilyAndAssembly {
- get { return (m_attributes & FieldAttributes.FamANDAssem) != 0; }
+ get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamANDAssem; }
set {
FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.FamANDAssem);
if (value)
}
public bool IsAssembly {
- get { return (m_attributes & FieldAttributes.Assembly) != 0; }
+ get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Assembly; }
set {
FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.Assembly);
if (value)
}
public bool IsFamily {
- get { return (m_attributes & FieldAttributes.Family) != 0; }
+ get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family; }
set {
FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.Family);
if (value)
}
public bool IsFamilyOrAssembly {
- get { return (m_attributes & FieldAttributes.FamORAssem) != 0; }
+ get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamORAssem; }
set {
FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.FamORAssem);
if (value)
}
public bool IsPublic {
- get { return (m_attributes & FieldAttributes.Public) != 0; }
+ get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public; }
set {
FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.Public);
if (value)
#region GenericParameterAttributes
public bool IsNonVariant {
- get { return (m_attributes & GenericParameterAttributes.NonVariant) != 0; }
+ get { return (m_attributes & GenericParameterAttributes.VarianceMask) == GenericParameterAttributes.NonVariant; }
set {
GenericParameterAttributes masked = (GenericParameterAttributes.VarianceMask & GenericParameterAttributes.NonVariant);
if (value)
}
public bool IsCovariant {
- get { return (m_attributes & GenericParameterAttributes.Covariant) != 0; }
+ get { return (m_attributes & GenericParameterAttributes.VarianceMask) == GenericParameterAttributes.Covariant; }
set {
GenericParameterAttributes masked = (GenericParameterAttributes.VarianceMask & GenericParameterAttributes.Covariant);
if (value)
}
public bool IsContravariant {
- get { return (m_attributes & GenericParameterAttributes.Contravariant) != 0; }
+ get { return (m_attributes & GenericParameterAttributes.VarianceMask) == GenericParameterAttributes.Contravariant; }
set {
GenericParameterAttributes masked = (GenericParameterAttributes.VarianceMask & GenericParameterAttributes.Contravariant);
if (value)
}
public bool HasReferenceTypeConstraint {
- get { return (m_attributes & GenericParameterAttributes.ReferenceTypeConstraint) != 0; }
+ get { return (m_attributes & GenericParameterAttributes.SpecialConstraintMask) == GenericParameterAttributes.ReferenceTypeConstraint; }
set {
GenericParameterAttributes masked = (GenericParameterAttributes.SpecialConstraintMask & GenericParameterAttributes.ReferenceTypeConstraint);
if (value)
}
public bool HasNotNullableValueTypeConstraint {
- get { return (m_attributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; }
+ get { return (m_attributes & GenericParameterAttributes.SpecialConstraintMask) == GenericParameterAttributes.NotNullableValueTypeConstraint; }
set {
GenericParameterAttributes masked = (GenericParameterAttributes.SpecialConstraintMask & GenericParameterAttributes.NotNullableValueTypeConstraint);
if (value)
}
public bool HasDefaultConstructorConstraint {
- get { return (m_attributes & GenericParameterAttributes.DefaultConstructorConstraint) != 0; }
+ get { return (m_attributes & GenericParameterAttributes.SpecialConstraintMask) == GenericParameterAttributes.DefaultConstructorConstraint; }
set {
GenericParameterAttributes masked = (GenericParameterAttributes.SpecialConstraintMask & GenericParameterAttributes.DefaultConstructorConstraint);
if (value)
#region MethodAttributes
public bool IsCompilerControlled {
- get { return (m_attributes & MethodAttributes.Compilercontrolled) != 0; }
+ get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Compilercontrolled; }
set {
MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.Compilercontrolled);
if (value)
}
public bool IsPrivate {
- get { return (m_attributes & MethodAttributes.Private) != 0; }
+ get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Private; }
set {
MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.Private);
if (value)
}
public bool IsFamilyAndAssembly {
- get { return (m_attributes & MethodAttributes.FamANDAssem) != 0; }
+ get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamANDAssem; }
set {
MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.FamANDAssem);
if (value)
}
public bool IsAssembly {
- get { return (m_attributes & MethodAttributes.Assem) != 0; }
+ get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Assem; }
set {
MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.Assem);
if (value)
}
public bool IsFamily {
- get { return (m_attributes & MethodAttributes.Family) != 0; }
+ get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Family; }
set {
MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.Family);
if (value)
}
public bool IsFamilyOrAssembly {
- get { return (m_attributes & MethodAttributes.FamORAssem) != 0; }
+ get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamORAssem; }
set {
MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.FamORAssem);
if (value)
}
public bool IsPublic {
- get { return (m_attributes & MethodAttributes.Public) != 0; }
+ get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public; }
set {
MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.Public);
if (value)
}
public bool IsReuseSlot {
- get { return (m_attributes & MethodAttributes.ReuseSlot) != 0; }
+ get { return (m_attributes & MethodAttributes.VtableLayoutMask) == MethodAttributes.ReuseSlot; }
set {
MethodAttributes masked = (MethodAttributes.VtableLayoutMask & MethodAttributes.ReuseSlot);
if (value)
}
public bool IsNewSlot {
- get { return (m_attributes & MethodAttributes.NewSlot) != 0; }
+ get { return (m_attributes & MethodAttributes.VtableLayoutMask) == MethodAttributes.NewSlot; }
set {
MethodAttributes masked = (MethodAttributes.VtableLayoutMask & MethodAttributes.NewSlot);
if (value)
}
public bool IsCharSetNotSpec {
- get { return (m_attributes & PInvokeAttributes.CharSetNotSpec) != 0; }
+ get { return (m_attributes & PInvokeAttributes.CharSetMask) == PInvokeAttributes.CharSetNotSpec; }
set {
PInvokeAttributes masked = (PInvokeAttributes.CharSetMask & PInvokeAttributes.CharSetNotSpec);
if (value)
}
public bool IsCharSetAnsi {
- get { return (m_attributes & PInvokeAttributes.CharSetAnsi) != 0; }
+ get { return (m_attributes & PInvokeAttributes.CharSetMask) == PInvokeAttributes.CharSetAnsi; }
set {
PInvokeAttributes masked = (PInvokeAttributes.CharSetMask & PInvokeAttributes.CharSetAnsi);
if (value)
}
public bool IsCharSetUnicode {
- get { return (m_attributes & PInvokeAttributes.CharSetUnicode) != 0; }
+ get { return (m_attributes & PInvokeAttributes.CharSetMask) == PInvokeAttributes.CharSetUnicode; }
set {
PInvokeAttributes masked = (PInvokeAttributes.CharSetMask & PInvokeAttributes.CharSetUnicode);
if (value)
}
public bool IsCharSetAuto {
- get { return (m_attributes & PInvokeAttributes.CharSetAuto) != 0; }
+ get { return (m_attributes & PInvokeAttributes.CharSetMask) == PInvokeAttributes.CharSetAuto; }
set {
PInvokeAttributes masked = (PInvokeAttributes.CharSetMask & PInvokeAttributes.CharSetAuto);
if (value)
}
public bool SupportsLastError {
- get { return (m_attributes & PInvokeAttributes.SupportsLastError) != 0; }
+ get { return (m_attributes & PInvokeAttributes.CharSetMask) == PInvokeAttributes.SupportsLastError; }
set {
PInvokeAttributes masked = (PInvokeAttributes.CharSetMask & PInvokeAttributes.SupportsLastError);
if (value)
}
public bool IsCallConvWinapi {
- get { return (m_attributes & PInvokeAttributes.CallConvWinapi) != 0; }
+ get { return (m_attributes & PInvokeAttributes.CallConvMask) == PInvokeAttributes.CallConvWinapi; }
set {
PInvokeAttributes masked = (PInvokeAttributes.CallConvMask & PInvokeAttributes.CallConvWinapi);
if (value)
}
public bool IsCallConvCdecl {
- get { return (m_attributes & PInvokeAttributes.CallConvCdecl) != 0; }
+ get { return (m_attributes & PInvokeAttributes.CallConvMask) == PInvokeAttributes.CallConvCdecl; }
set {
PInvokeAttributes masked = (PInvokeAttributes.CallConvMask & PInvokeAttributes.CallConvCdecl);
if (value)
}
public bool IsCallConvStdCall {
- get { return (m_attributes & PInvokeAttributes.CallConvStdCall) != 0; }
+ get { return (m_attributes & PInvokeAttributes.CallConvMask) == PInvokeAttributes.CallConvStdCall; }
set {
PInvokeAttributes masked = (PInvokeAttributes.CallConvMask & PInvokeAttributes.CallConvStdCall);
if (value)
}
public bool IsCallConvThiscall {
- get { return (m_attributes & PInvokeAttributes.CallConvThiscall) != 0; }
+ get { return (m_attributes & PInvokeAttributes.CallConvMask) == PInvokeAttributes.CallConvThiscall; }
set {
PInvokeAttributes masked = (PInvokeAttributes.CallConvMask & PInvokeAttributes.CallConvThiscall);
if (value)
}
public bool IsCallConvFastcall {
- get { return (m_attributes & PInvokeAttributes.CallConvFastcall) != 0; }
+ get { return (m_attributes & PInvokeAttributes.CallConvMask) == PInvokeAttributes.CallConvFastcall; }
set {
PInvokeAttributes masked = (PInvokeAttributes.CallConvMask & PInvokeAttributes.CallConvFastcall);
if (value)
#region ManifestResourceAttributes
public bool IsPublic {
- get { return (m_attributes & ManifestResourceAttributes.Public) != 0; }
+ get { return (m_attributes & ManifestResourceAttributes.VisibilityMask) == ManifestResourceAttributes.Public; }
set {
ManifestResourceAttributes masked = (ManifestResourceAttributes.VisibilityMask & ManifestResourceAttributes.Public);
if (value)
}
public bool IsPrivate {
- get { return (m_attributes & ManifestResourceAttributes.Private) != 0; }
+ get { return (m_attributes & ManifestResourceAttributes.VisibilityMask) == ManifestResourceAttributes.Private; }
set {
ManifestResourceAttributes masked = (ManifestResourceAttributes.VisibilityMask & ManifestResourceAttributes.Private);
if (value)
#region TypeAttributes
public bool IsNotPublic {
- get { return (m_attributes & TypeAttributes.NotPublic) != 0; }
+ get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NotPublic; }
set {
TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NotPublic);
if (value)
}
public bool IsPublic {
- get { return (m_attributes & TypeAttributes.Public) != 0; }
+ get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.Public; }
set {
TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.Public);
if (value)
}
public bool IsNestedPublic {
- get { return (m_attributes & TypeAttributes.NestedPublic) != 0; }
+ get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPublic; }
set {
TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NestedPublic);
if (value)
}
public bool IsNestedPrivate {
- get { return (m_attributes & TypeAttributes.NestedPrivate) != 0; }
+ get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate; }
set {
TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NestedPrivate);
if (value)
}
public bool IsNestedFamily {
- get { return (m_attributes & TypeAttributes.NestedFamily) != 0; }
+ get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamily; }
set {
TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NestedFamily);
if (value)
}
public bool IsNestedAssembly {
- get { return (m_attributes & TypeAttributes.NestedAssembly) != 0; }
+ get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedAssembly; }
set {
TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NestedAssembly);
if (value)
}
public bool IsNestedFamilyAndAssembly {
- get { return (m_attributes & TypeAttributes.NestedFamANDAssem) != 0; }
+ get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamANDAssem; }
set {
TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NestedFamANDAssem);
if (value)
}
public bool IsNestedFamilyOrAssembly {
- get { return (m_attributes & TypeAttributes.NestedFamORAssem) != 0; }
+ get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamORAssem; }
set {
TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NestedFamORAssem);
if (value)
}
public bool IsAutoLayout {
- get { return (m_attributes & TypeAttributes.AutoLayout) != 0; }
+ get { return (m_attributes & TypeAttributes.LayoutMask) == TypeAttributes.AutoLayout; }
set {
TypeAttributes masked = (TypeAttributes.LayoutMask & TypeAttributes.AutoLayout);
if (value)
}
public bool IsSequentialLayout {
- get { return (m_attributes & TypeAttributes.SequentialLayout) != 0; }
+ get { return (m_attributes & TypeAttributes.LayoutMask) == TypeAttributes.SequentialLayout; }
set {
TypeAttributes masked = (TypeAttributes.LayoutMask & TypeAttributes.SequentialLayout);
if (value)
}
public bool IsExplicitLayout {
- get { return (m_attributes & TypeAttributes.ExplicitLayout) != 0; }
+ get { return (m_attributes & TypeAttributes.LayoutMask) == TypeAttributes.ExplicitLayout; }
set {
TypeAttributes masked = (TypeAttributes.LayoutMask & TypeAttributes.ExplicitLayout);
if (value)
}
public bool IsClass {
- get { return (m_attributes & TypeAttributes.Class) != 0; }
+ get { return (m_attributes & TypeAttributes.ClassSemanticMask) == TypeAttributes.Class; }
set {
TypeAttributes masked = (TypeAttributes.ClassSemanticMask & TypeAttributes.Class);
if (value)
}
public bool IsInterface {
- get { return (m_attributes & TypeAttributes.Interface) != 0; }
+ get { return (m_attributes & TypeAttributes.ClassSemanticMask) == TypeAttributes.Interface; }
set {
TypeAttributes masked = (TypeAttributes.ClassSemanticMask & TypeAttributes.Interface);
if (value)
}
public bool IsAnsiClass {
- get { return (m_attributes & TypeAttributes.AnsiClass) != 0; }
+ get { return (m_attributes & TypeAttributes.StringFormatMask) == TypeAttributes.AnsiClass; }
set {
TypeAttributes masked = (TypeAttributes.StringFormatMask & TypeAttributes.AnsiClass);
if (value)
}
public bool IsUnicodeClass {
- get { return (m_attributes & TypeAttributes.UnicodeClass) != 0; }
+ get { return (m_attributes & TypeAttributes.StringFormatMask) == TypeAttributes.UnicodeClass; }
set {
TypeAttributes masked = (TypeAttributes.StringFormatMask & TypeAttributes.UnicodeClass);
if (value)
}
public bool IsAutoClass {
- get { return (m_attributes & TypeAttributes.AutoClass) != 0; }
+ get { return (m_attributes & TypeAttributes.StringFormatMask) == TypeAttributes.AutoClass; }
set {
TypeAttributes masked = (TypeAttributes.StringFormatMask & TypeAttributes.AutoClass);
if (value)
+2007-08-05 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+ * HtmlHead.cs: refactoring, used AddAttribute overload without encoding
+ on known attribute values
+
2007-07-31 Vladimir Krasnov <vladimirk@mainsoft.com>
* HtmlControl.cs: fixed PreProcessRelativeReference, should be used
public void Render (HtmlTextWriter writer)
{
- writer.AddAttribute ("type", "text/css");
+ writer.AddAttribute ("type", "text/css", false);
writer.RenderBeginTag (HtmlTextWriterTag.Style);
foreach (StyleEntry entry in entries) {
w.AddAttribute (HtmlTextWriterAttribute.Src, ResolveAdUrl (e.ImageUrl));
w.AddAttribute (HtmlTextWriterAttribute.Alt, e.AlternateText == null ? "" : e.AlternateText);
- w.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+ w.AddAttribute (HtmlTextWriterAttribute.Border, "0", false);
w.RenderBeginTag (HtmlTextWriterTag.Img);
w.RenderEndTag (); // img
w.RenderEndTag (); // a
Page.ClientScript.RegisterExpandoAttribute (ClientID, "focusOnError", "t");
#endif
if (!Enabled)
- writer.AddAttribute ("enabled", "false");
+ writer.AddAttribute ("enabled", "false", false);
#if NET_2_0
if (Enabled && !IsValid) {
#else
if (!IsValid) {
#endif
- writer.AddAttribute ("isvalid", "false");
+ writer.AddAttribute ("isvalid", "false", false);
}
else {
if (Display == ValidatorDisplay.Static)
switch (DisplayMode) {
case BulletedListDisplayMode.Text:
if (!item.Enabled) {
- writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+ writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
writer.RenderBeginTag (HtmlTextWriterTag.Span);
}
}
else
- writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+ writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
writer.RenderBeginTag (HtmlTextWriterTag.A);
writer.Write (item.Text);
if (Enabled && item.Enabled)
writer.AddAttribute (HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackEventReference (GetPostBackOptions (index.ToString (CultureInfo.InvariantCulture))));
else
- writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+ writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
writer.RenderBeginTag (HtmlTextWriterTag.A);
writer.Write (item.Text);
writer.RenderEndTag ();
Page.VerifyRenderingInServerForm (this);
#if NET_2_0
- writer.AddAttribute (HtmlTextWriterAttribute.Type, UseSubmitBehavior ? "submit" : "button");
+ writer.AddAttribute (HtmlTextWriterAttribute.Type, UseSubmitBehavior ? "submit" : "button", false);
writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
writer.AddAttribute (HtmlTextWriterAttribute.Value, Text);
#if NET_2_0
if (UseAccessibleHeader) {
writer.AddAttribute (HtmlTextWriterAttribute.Abbr, dayName);
- writer.AddAttribute (HtmlTextWriterAttribute.Scope, "col");
+ writer.AddAttribute (HtmlTextWriterAttribute.Scope, "col", false);
cell = new TableHeaderCell();
}
else
+2007-08-05 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+ * Button.cs,
+ DataControlFieldHeaderCell.cs, FileUpload.cs, Table.cs,
+ RegularExpressionValidator.cs, CheckBox.cs, HiddenField.cs,
+ TableStyle.cs, Image.cs, BulletedList.cs, RangeValidator.cs,
+ BaseValidator.cs, CustomValidator.cs, RepeatInfo.cs, TextBox.cs,
+ RequiredFieldValidator.cs, AdRotator.cs, TableHeaderCell.cs,
+ ImageMap.cs, Panel.cs, CompareValidator.cs, Calendar.cs, ListBox.cs,
+ TableCell.cs, WebControl.cs, ImageButton.cs, TableItemStyle.cs:
+ refactoring, used AddAttribute overload without encoding on known attribute
+ values
+
2007-08-01 Igor Zelmanovich <igorz@mainsoft.com>
* DropDownList.cs: fixed onchange attibute.
}
if (!Enabled) {
- w.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+ w.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
need_span = true;
}
inputAttributes.AddAttributes (w);
#endif
if (Checked)
- w.AddAttribute (HtmlTextWriterAttribute.Checked, "checked");
+ w.AddAttribute (HtmlTextWriterAttribute.Checked, "checked", false);
if (AutoPostBack) {
#if NET_2_0
w.AddAttribute (HtmlTextWriterAttribute.Onclick,
Page.ClientScript.GetPostBackEventReference (this, String.Empty));
#endif
- w.AddAttribute ("language", "javascript");
+ w.AddAttribute ("language", "javascript", false);
}
if (AccessKey.Length > 0)
internal virtual void InternalAddAttributesToRender (HtmlTextWriter w)
{
if (!Enabled)
- w.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+ w.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
}
}
}
if (ValueToCompare != "")
w.AddAttribute ("valuetocompare", ValueToCompare);
w.AddAttribute ("operator", Operator.ToString());
- w.AddAttribute("evaluationfunction", "CompareValidatorEvaluateIsValid");
+ w.AddAttribute ("evaluationfunction", "CompareValidatorEvaluateIsValid", false);
}
base.AddAttributesToRender (w);
if (base.RenderUplevel) {
string s;
- writer.AddAttribute("evaluationfunction", "CustomValidatorEvaluateIsValid");
+ writer.AddAttribute ("evaluationfunction", "CustomValidatorEvaluateIsValid", false);
s = ClientValidationFunction;
if (s != string.Empty) {
base.AddAttributesToRender (writer);
switch (scope) {
case TableHeaderScope.Column:
- writer.AddAttribute (HtmlTextWriterAttribute.Scope, "col");
+ writer.AddAttribute (HtmlTextWriterAttribute.Scope, "col", false);
break;
case TableHeaderScope.Row:
- writer.AddAttribute (HtmlTextWriterAttribute.Scope, "row");
+ writer.AddAttribute (HtmlTextWriterAttribute.Scope, "row", false);
break;
}
if (AbbreviatedText.Length > 0)
protected override void AddAttributesToRender (HtmlTextWriter writer)
{
- writer.AddAttribute (HtmlTextWriterAttribute.Type, "file");
+ writer.AddAttribute (HtmlTextWriterAttribute.Type, "file", false);
if (!string.IsNullOrEmpty (UniqueID))
writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
base.AddAttributesToRender (writer);
protected internal override void Render (HtmlTextWriter writer)
{
- writer.AddAttribute (HtmlTextWriterAttribute.Type, "hidden");
+ writer.AddAttribute (HtmlTextWriterAttribute.Type, "hidden", false);
if (!String.IsNullOrEmpty (ClientID))
writer.AddAttribute (HtmlTextWriterAttribute.Id, ClientID);
writer.AddAttribute ("longdesc", s);
#endif
if (!enabled)
- writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+ writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
// avoid reflection
switch (ImageAlign) {
case ImageAlign.Left:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "left");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "left", false);
break;
case ImageAlign.Right:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "right");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "right", false);
break;
case ImageAlign.Baseline:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "baseline");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "baseline", false);
break;
case ImageAlign.Top:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "top");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "top", false);
break;
case ImageAlign.Middle:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "middle");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "middle", false);
break;
case ImageAlign.Bottom:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "bottom");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "bottom", false);
break;
case ImageAlign.AbsBottom:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "absbottom");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "absbottom", false);
break;
case ImageAlign.AbsMiddle:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "absmiddle");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "absmiddle", false);
break;
case ImageAlign.TextTop:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "texttop");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "texttop", false);
break;
}
#if NET_2_0
if (Page != null)
Page.VerifyRenderingInServerForm (this);
- writer.AddAttribute (HtmlTextWriterAttribute.Type, "image");
+ writer.AddAttribute (HtmlTextWriterAttribute.Type, "image", false);
writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
#if NET_2_0
string onclick = OnClientClick;
HotSpotMode mode = spot.HotSpotMode != HotSpotMode.NotSet ? spot.HotSpotMode : HotSpotMode;
switch (mode) {
case HotSpotMode.Inactive:
- writer.AddAttribute ("nohref", "true");
+ writer.AddAttribute ("nohref", "true", false);
break;
case HotSpotMode.Navigate:
string target = spot.Target.Length > 0 ? spot.Target : Target;
if (!String.IsNullOrEmpty (target))
writer.AddAttribute (HtmlTextWriterAttribute.Target, target);
-#if TARGET_J2EE\r
+#if TARGET_J2EE
string navUrl = ResolveClientUrl (spot.NavigateUrl, String.Compare (target, "_blank", StringComparison.InvariantCultureIgnoreCase) != 0);
#else
string navUrl = ResolveClientUrl (spot.NavigateUrl);
if (SelectionMode == ListSelectionMode.Multiple)
writer.AddAttribute (HtmlTextWriterAttribute.Multiple,
- "multiple");
+ "multiple", false);
writer.AddAttribute (HtmlTextWriterAttribute.Size,
Rows.ToString (CultureInfo.InvariantCulture));
}
}
if (Direction != ContentDirection.NotSet) {
- w.AddAttribute (HtmlTextWriterAttribute.Dir, Direction == ContentDirection.RightToLeft ? "rtl" : "ltr");
+ w.AddAttribute (HtmlTextWriterAttribute.Dir, Direction == ContentDirection.RightToLeft ? "rtl" : "ltr", false);
}
switch (ScrollBars) {
base.AddAttributesToRender (writer);
if (RenderUplevel) {
- writer.AddAttribute("evaluationfunction", "RangeValidatorEvaluateIsValid"); // FIXME - we need to define this in client code
+ writer.AddAttribute("evaluationfunction", "RangeValidatorEvaluateIsValid", false); // FIXME - we need to define this in client code
writer.AddAttribute("minimumValue", MinimumValue.ToString(CultureInfo.InvariantCulture));
writer.AddAttribute("maximumValue", MaximumValue.ToString(CultureInfo.InvariantCulture));
}
protected override void AddAttributesToRender (HtmlTextWriter w)
{
if (RenderUplevel) {
- w.AddAttribute ("evaluationfunction", "RegularExpressionValidatorEvaluateIsValid");
+ w.AddAttribute ("evaluationfunction", "RegularExpressionValidatorEvaluateIsValid", false);
if (ValidationExpression != "")
w.AddAttribute ("validationexpression", ValidationExpression);
}
// columns per item if we are using separators, otherwise
// one per item.
if (hdr_span != 1)
- w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+ w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString (), false);
if (UseAccessibleHeader)
w.AddAttribute ("scope", "col", false);
else if (table) {
w.RenderBeginTag (HtmlTextWriterTag.Tr);
if (hdr_span != 1)
- w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+ w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString (), false);
Style s = user.GetItemStyle (ListItemType.Footer, -1);
if (s != null)
// columns per item if we are using separators, otherwise
// one per item.
if (hdr_span != 1)
- w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+ w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString (), false);
if (UseAccessibleHeader)
w.AddAttribute ("scope", "col", false);
if (table) {
w.RenderBeginTag (HtmlTextWriterTag.Tr);
if (hdr_span != 1)
- w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+ w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString (), false);
Style s = user.GetItemStyle (ListItemType.Footer, -1);
if (s != null)
protected override void AddAttributesToRender (HtmlTextWriter w)
{
if (RenderUplevel) {
- w.AddAttribute ("evaluationfunction", "RequiredFieldValidatorEvaluateIsValid");
+ w.AddAttribute ("evaluationfunction", "RequiredFieldValidatorEvaluateIsValid", false);
w.AddAttribute ("initialvalue", InitialValue);
}
if (!ControlStyleCreated || TableStyle.IsEmpty) {
// for some reason border=X seems to be always present
// and isn't rendered as a style attribute
- writer.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "0", false);
}
}
int i = ColumnSpan;
if (i > 0)
- writer.AddAttribute (HtmlTextWriterAttribute.Colspan, i.ToString (CultureInfo.InvariantCulture));
+ writer.AddAttribute (HtmlTextWriterAttribute.Colspan, i.ToString (CultureInfo.InvariantCulture), false);
i = RowSpan;
if (i > 0)
- writer.AddAttribute (HtmlTextWriterAttribute.Rowspan, i.ToString (CultureInfo.InvariantCulture));
+ writer.AddAttribute (HtmlTextWriterAttribute.Rowspan, i.ToString (CultureInfo.InvariantCulture), false);
#if NET_2_0
string[] ahci = AssociatedHeaderCellID;
if (ahci.Length > 1) {
switch (Scope) {
case TableHeaderScope.Column:
- writer.AddAttribute (HtmlTextWriterAttribute.Scope, "column");
+ writer.AddAttribute (HtmlTextWriterAttribute.Scope, "column", false);
break;
case TableHeaderScope.Row:
- writer.AddAttribute (HtmlTextWriterAttribute.Scope, "row");
+ writer.AddAttribute (HtmlTextWriterAttribute.Scope, "row", false);
break;
}
// note: avoid ToString on the enum
switch (HorizontalAlign) {
case HorizontalAlign.Left:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "left");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "left", false);
break;
case HorizontalAlign.Center:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "center");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "center", false);
break;
case HorizontalAlign.Right:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "right");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "right", false);
break;
case HorizontalAlign.Justify:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "justify");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "justify", false);
break;
}
// note: avoid ToString on the enum
switch (VerticalAlign) {
case VerticalAlign.Top:
- writer.AddAttribute (HtmlTextWriterAttribute.Valign, "top");
+ writer.AddAttribute (HtmlTextWriterAttribute.Valign, "top", false);
break;
case VerticalAlign.Middle:
- writer.AddAttribute (HtmlTextWriterAttribute.Valign, "middle");
+ writer.AddAttribute (HtmlTextWriterAttribute.Valign, "middle", false);
break;
case VerticalAlign.Bottom:
- writer.AddAttribute (HtmlTextWriterAttribute.Valign, "bottom");
+ writer.AddAttribute (HtmlTextWriterAttribute.Valign, "bottom", false);
break;
}
// note: avoid calling properties multiple times
int i = CellPadding;
if (i != -1)
- writer.AddAttribute (HtmlTextWriterAttribute.Cellpadding, i.ToString (CultureInfo.InvariantCulture));
+ writer.AddAttribute (HtmlTextWriterAttribute.Cellpadding, i.ToString (CultureInfo.InvariantCulture), false);
i = CellSpacing;
if (i != -1) {
- writer.AddAttribute (HtmlTextWriterAttribute.Cellspacing, i.ToString (CultureInfo.InvariantCulture));
+ writer.AddAttribute (HtmlTextWriterAttribute.Cellspacing, i.ToString (CultureInfo.InvariantCulture), false);
if (i == 0) {
writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
}
GridLines g = GridLines;
switch (g) {
case GridLines.Horizontal:
- writer.AddAttribute (HtmlTextWriterAttribute.Rules, "rows");
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "rows", false);
break;
case GridLines.Vertical:
- writer.AddAttribute (HtmlTextWriterAttribute.Rules, "cols");
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "cols", false);
break;
case GridLines.Both:
- writer.AddAttribute (HtmlTextWriterAttribute.Rules, "all");
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "all", false);
break;
}
// note: avoid ToString on the enum
switch (HorizontalAlign) {
case HorizontalAlign.Left:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "Left");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "Left", false);
break;
case HorizontalAlign.Center:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "Center");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "Center", false);
break;
case HorizontalAlign.Right:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "Right");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "Right", false);
break;
case HorizontalAlign.Justify:
- writer.AddAttribute (HtmlTextWriterAttribute.Align, "Justify");
+ writer.AddAttribute (HtmlTextWriterAttribute.Align, "Justify", false);
break;
}
// border (=0) is always present (and base class doesn't seems to add it)
// but border is "promoted" to 1 if gridlines are present (with BorderWidth == 0)
if (g == GridLines.None) {
- writer.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "0", false);
} else if (BorderWidth.IsEmpty) {
- writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1", false);
} else {
writer.AddAttribute (HtmlTextWriterAttribute.Border, BorderWidth.Value.ToString (CultureInfo.InvariantCulture));
}
switch (TextMode) {
case TextBoxMode.MultiLine:
if (Columns != 0)
- w.AddAttribute (HtmlTextWriterAttribute.Cols, Columns.ToString ());
+ w.AddAttribute (HtmlTextWriterAttribute.Cols, Columns.ToString (), false);
#if NET_2_0
else
- w.AddAttribute (HtmlTextWriterAttribute.Cols, "20");
+ w.AddAttribute (HtmlTextWriterAttribute.Cols, "20", false);
#endif
if (Rows != 0)
- w.AddAttribute (HtmlTextWriterAttribute.Rows, Rows.ToString ());
+ w.AddAttribute (HtmlTextWriterAttribute.Rows, Rows.ToString (), false);
#if NET_2_0
else
- w.AddAttribute (HtmlTextWriterAttribute.Rows, "2");
+ w.AddAttribute (HtmlTextWriterAttribute.Rows, "2", false);
#endif
if (!Wrap)
- w.AddAttribute (HtmlTextWriterAttribute.Wrap, "off");
+ w.AddAttribute (HtmlTextWriterAttribute.Wrap, "off", false);
break;
case TextBoxMode.Password:
if (TextMode == TextBoxMode.Password)
- w.AddAttribute (HtmlTextWriterAttribute.Type, "password");
+ w.AddAttribute (HtmlTextWriterAttribute.Type, "password", false);
else {
- w.AddAttribute (HtmlTextWriterAttribute.Type, "text");
+ w.AddAttribute (HtmlTextWriterAttribute.Type, "text", false);
if (Text.Length > 0)
w.AddAttribute (HtmlTextWriterAttribute.Value, Text);
}
if (Columns != 0)
- w.AddAttribute (HtmlTextWriterAttribute.Size, Columns.ToString ());
+ w.AddAttribute (HtmlTextWriterAttribute.Size, Columns.ToString (), false);
if (MaxLength != 0)
- w.AddAttribute (HtmlTextWriterAttribute.Maxlength, MaxLength.ToString ());
+ w.AddAttribute (HtmlTextWriterAttribute.Maxlength, MaxLength.ToString (), false);
#if NET_2_0
if (AutoCompleteType != AutoCompleteType.None && TextMode == TextBoxMode.SingleLine)
if (AutoCompleteType != AutoCompleteType.Disabled)
w.AddAttribute (HtmlTextWriterAttribute.VCardName, VCardValues [(int) AutoCompleteType]);
else
- w.AddAttribute (HtmlTextWriterAttribute.AutoComplete, "off");
+ w.AddAttribute (HtmlTextWriterAttribute.AutoComplete, "off", false);
#endif
break;
}
#if NET_2_0
if (AutoPostBack) {
- w.AddAttribute ("onkeypress", "if (WebForm_TextBoxKeyHandler(event) == false) return false;");
+ w.AddAttribute ("onkeypress", "if (WebForm_TextBoxKeyHandler(event) == false) return false;", false);
w.AddAttribute (HtmlTextWriterAttribute.Onchange, Page.ClientScript.GetPostBackEventReference (GetPostBackOptions (), true));
}
#else
#endif
if (ReadOnly)
- w.AddAttribute (HtmlTextWriterAttribute.ReadOnly, "ReadOnly");
+ w.AddAttribute (HtmlTextWriterAttribute.ReadOnly, "ReadOnly", false);
w.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
}
writer.AddAttribute (HtmlTextWriterAttribute.Accesskey, AccessKey);
if (!enabled)
- writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+ writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
if (ToolTip != string.Empty)
writer.AddAttribute (HtmlTextWriterAttribute.Title, ToolTip);
+2007-08-05 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+ * HtmlTextWriter.cs: performance refactoring, optimized AddAttribute
+ overloads, used StringComparer for tag, styles and attrs hashtables
+ fixed AddAttribute, id attr should not be encoded by default
+
2007-07-31 Vladimir Krasnov <vladimirk@mainsoft.com>
* Control.cs: fixed AppRelativeTemplateSourceDirectory that should
static HtmlTextWriter ()
{
+#if NET_2_0
+ _tagTable = new Hashtable (tags.Length, StringComparer.OrdinalIgnoreCase);
+ _attributeTable = new Hashtable (htmlattrs.Length, StringComparer.OrdinalIgnoreCase);
+ _styleTable = new Hashtable (htmlstyles.Length, StringComparer.OrdinalIgnoreCase);
+#else
_tagTable = new Hashtable (tags.Length,
CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
_styleTable = new Hashtable (htmlstyles.Length,
CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
-
+#endif
foreach (HtmlTag tag in tags)
_tagTable.Add (tag.name, tag);
public virtual void AddAttribute (HtmlTextWriterAttribute key, string value, bool fEncode)
{
if (fEncode)
- value = EncodeAttributeValue (key, value);
+ value = HttpUtility.HtmlAttributeEncode (value);
+
AddAttribute (GetAttributeName (key), value, key);
}
public virtual void AddAttribute (HtmlTextWriterAttribute key, string value)
{
- bool fEncode = key != HtmlTextWriterAttribute.Name;
- AddAttribute (key, value, fEncode);
+ if ((key != HtmlTextWriterAttribute.Name) && (key != HtmlTextWriterAttribute.Id))
+ value = HttpUtility.HtmlAttributeEncode (value);
+
+ AddAttribute (GetAttributeName (key), value, key);
}
public virtual void AddAttribute (string name, string value)
{
- bool fEncode = String.Compare ("name", name, true, CultureInfo.InvariantCulture) != 0;
- AddAttribute (name, value, fEncode);
+ HtmlTextWriterAttribute key = GetAttributeKey (name);
+
+ if ((key != HtmlTextWriterAttribute.Name) && (key != HtmlTextWriterAttribute.Id))
+ value = HttpUtility.HtmlAttributeEncode (value);
+
+ AddAttribute (name, value, key);
}
protected virtual void AddAttribute (string name, string value, HtmlTextWriterAttribute key)
+2007-08-05 Vladimir Krasnov <vladimirk@mainsoft.com>
+
+ * HttpUtility.cs: performance refactoring, optimized UrlEncode
+
+2007-08-05 Igor Zelmanovich <igorz@mainsoft.com>
+
+ * SiteMapNode.cs: refactoring + typo fix:
+ variable is declared in scope where is used.
+
2007-07-31 Vladimir Krasnov <vladimirk@mainsoft.com>
* VirtualPathUtility.cs: refactored GetDirectory, ToAbsolute, added
if (s == "")
return "";
- byte [] bytes = Enc.GetBytes (s);
- return Encoding.ASCII.GetString (UrlEncodeToBytes (bytes, 0, bytes.Length));
+ bool needEncode = false;
+ int len = s.Length;
+ for (int i = 0; i < len; i++) {
+ char c = s [i];
+ if ((c < '0') || (c < 'A' && c > '9') || (c > 'Z' && c < 'a') || (c > 'z')) {
+ if (NotEncoded (c))
+ continue;
+
+ needEncode = true;
+ break;
+ }
+ }
+
+ if (!needEncode)
+ return s;
+
+ // avoided GetByteCount call
+ byte [] bytes = new byte[Enc.GetMaxByteCount(s.Length)];
+ int realLen = Enc.GetBytes (s, 0, s.Length, bytes, 0);
+ return Encoding.ASCII.GetString (UrlEncodeToBytes (bytes, 0, realLen));
}
public static string UrlEncode (byte [] bytes)
}
static char [] hexChars = "0123456789abcdef".ToCharArray ();
- const string notEncoded = "!'()*-._";
+
+ static bool NotEncoded (char c)
+ {
+ return (c == '!' || c == '\'' || c == '(' || c == ')' || c == '*' || c == '-' || c == '.' || c == '_');
+ }
static void UrlEncodeChar (char c, Stream result, bool isUnicode) {
if (c > 255) {
return;
}
- if (c>' ' && notEncoded.IndexOf (c)!=-1) {
+ if (c > ' ' && NotEncoded (c)) {
result.WriteByte ((byte)c);
return;
}
public virtual string this [string key]
{
get {
- string val = null;
if (provider.EnableLocalization) {
- val = GetImplicitResourceString (key);
+ string val = GetImplicitResourceString (key);
if (val == null)
val = GetExplicitResourceString (key, null, true);
+ if (val != null)
+ return val;
}
- if (val != null) return null;
if (attributes != null) return attributes [key];
return null;
}
+2007-08-04 Jb Evain <jbevain@novell.com>
+
+ * XmlUrlResolver.cs: remove code duplication in 2.1.
+
+2007-08-04 Jb Evain <jbevain@novell.com>
+
+ * XmlTextReader.cs, XmlConvert.cs, XmlReaderBinarySupport.cs:
+ Use the available constructor for the 2.1 profile.
+
+2007-08-03 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DTDObjectModel.cs : in 2.0 and especially 2.1 profiles, use
+ our own DictionaryBase-like generic type. It is to reduce
+ dependency on DictionaryBase which does not exist in 2.1 mscorlib.
+ (included in 2.0 as well so that we do not skip NUnit tests so far)
+
2007-08-03 Atsushi Enomoto <atsushi@ximian.com>
* XmlResolver.cs, XmlUrlResolver.cs, XmlSecureResolver.cs :
using System.Text;
using System.Xml;
using System.Xml.Schema;
+#if NET_2_0
+using System.Collections.Generic;
+#endif
#if NET_2_1
using XmlSchemaException = System.Xml.XmlException;
#else
}
}
+#if NET_2_0
+ class DictionaryBase : List<KeyValuePair<string,DTDNode>>
+ {
+ public IEnumerable<DTDNode> Values {
+ get {
+ foreach (KeyValuePair<string,DTDNode> p in this)
+ yield return p.Value;
+ }
+ }
+ }
+#endif
internal class DTDCollectionBase : DictionaryBase
{
DTDObjectModel root;
get { return root; }
}
+#if NET_2_0
+ public DictionaryBase InnerHashtable {
+ get { return this; }
+ }
+
+ protected void BaseAdd (string name, DTDNode value)
+ {
+ base.Add (new KeyValuePair<string,DTDNode> (name, value));
+ }
+
+ public bool Contains (string key)
+ {
+ foreach (KeyValuePair<string,DTDNode> p in this)
+ if (p.Key == key)
+ return true;
+ return false;
+ }
+
+ protected object BaseGet (string name)
+ {
+ foreach (KeyValuePair<string,DTDNode> p in this)
+ if (p.Key == name)
+ return p.Value;
+ return null;
+ }
+#else
public ICollection Keys {
get { return InnerHashtable.Keys; }
}
public ICollection Values {
get { return InnerHashtable.Values; }
}
+
+ protected void BaseAdd (string name, object value)
+ {
+ InnerHashtable.Add (name, value);
+ }
+
+ public bool Contains (string key)
+ {
+ return InnerHashtable.Contains (key);
+ }
+
+ protected object BaseGet (string name)
+ {
+ return InnerHashtable [name];
+ }
+#endif
}
internal class DTDElementDeclarationCollection : DTDCollectionBase
public DTDElementDeclaration Get (string name)
{
- return InnerHashtable [name] as DTDElementDeclaration;
+ return BaseGet (name) as DTDElementDeclaration;
}
public void Add (string name, DTDElementDeclaration decl)
{
- if (InnerHashtable.Contains (name)) {
+ if (Contains (name)) {
Root.AddError (new XmlSchemaException (String.Format (
"Element declaration for {0} was already added.",
name), null));
return;
}
decl.SetRoot (Root);
- InnerHashtable.Add (name, decl);
+ BaseAdd (name, decl);
}
}
public DTDAttListDeclarationCollection (DTDObjectModel root) : base (root) {}
public DTDAttListDeclaration this [string name] {
- get { return InnerHashtable [name] as DTDAttListDeclaration; }
+ get { return BaseGet (name) as DTDAttListDeclaration; }
}
public void Add (string name, DTDAttListDeclaration decl)
existing.Add (def);
} else {
decl.SetRoot (Root);
- InnerHashtable.Add (name, decl);
+ BaseAdd (name, decl);
}
}
}
public DTDEntityDeclarationCollection (DTDObjectModel root) : base (root) {}
public DTDEntityDeclaration this [string name] {
- get { return InnerHashtable [name] as DTDEntityDeclaration; }
+ get { return BaseGet (name) as DTDEntityDeclaration; }
}
public void Add (string name, DTDEntityDeclaration decl)
{
- if (InnerHashtable [name] != null)
+ if (Contains (name))
throw new InvalidOperationException (String.Format (
"Entity declaration for {0} was already added.",
name));
decl.SetRoot (Root);
- InnerHashtable.Add (name, decl);
+ BaseAdd (name, decl);
}
}
public DTDNotationDeclarationCollection (DTDObjectModel root) : base (root) {}
public DTDNotationDeclaration this [string name] {
- get { return InnerHashtable [name] as DTDNotationDeclaration; }
+ get { return BaseGet (name) as DTDNotationDeclaration; }
}
public void Add (string name, DTDNotationDeclaration decl)
{
- if (InnerHashtable [name] != null)
+ if (Contains (name))
throw new InvalidOperationException (String.Format (
"Notation declaration for {0} was already added.",
name));
decl.SetRoot (Root);
- InnerHashtable.Add (name, decl);
+ BaseAdd (name, decl);
}
}
{
if (buffer == null)
throw new ArgumentNullException ("buffer");
- if (index < 0)
- throw new ArgumentOutOfRangeException ("index", index, "index must be non negative integer.");
- if (count < 0)
- throw new ArgumentOutOfRangeException ("count", count, "count must be non negative integer.");
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException (
+#if !NET_2_1
+ "index", index,
+#endif
+ "index must be non negative integer.");
+ }
+ if (count < 0) {
+ throw new ArgumentOutOfRangeException (
+#if !NET_2_1
+ "count", count,
+#endif
+ "count must be non negative integer.");
+ }
if (buffer.Length < index + count)
throw new ArgumentOutOfRangeException ("index and count must be smaller than the length of the buffer.");
public int ReadBase64 (byte [] buffer, int offset, int length)
{
if (offset < 0)
- throw new ArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
+ throw CreateArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
else if (length < 0)
- throw new ArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
+ throw CreateArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
else if (buffer.Length < offset + length)
throw new ArgumentOutOfRangeException ("buffer length is smaller than the sum of offset and length.");
return i;
}
+ static Exception CreateArgumentOutOfRangeException (string name, object value, string message)
+ {
+ return new ArgumentOutOfRangeException (
+#if !NET_2_1
+ name, value,
+#endif
+ message);
+ }
+
public int ReadBinHex (byte [] buffer, int offset, int length)
{
if (offset < 0)
- throw new ArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
+ throw CreateArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
else if (length < 0)
- throw new ArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
+ throw CreateArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
else if (buffer.Length < offset + length)
throw new ArgumentOutOfRangeException ("buffer length is smaller than the sum of offset and length.");
CheckState (false, CommandState.None);
if (offset < 0)
- throw new ArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
+ throw CreateArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
else if (length < 0)
- throw new ArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
+ throw CreateArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
else if (buffer.Length < offset + length)
throw new ArgumentOutOfRangeException ("buffer length is smaller than the sum of offset and length.");
public int ReadChars (char [] buffer, int offset, int length)
{
- if (offset < 0)
- throw new ArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
- else if (length < 0)
- throw new ArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
- else if (buffer.Length < offset + length)
+ if (offset < 0) {
+ throw new ArgumentOutOfRangeException (
+#if !NET_2_1
+ "offset", offset,
+#endif
+ "Offset must be non-negative integer.");
+
+ } else if (length < 0) {
+ throw new ArgumentOutOfRangeException (
+#if !NET_2_1
+ "length", length,
+#endif
+ "Length must be non-negative integer.");
+
+ } else if (buffer.Length < offset + length)
throw new ArgumentOutOfRangeException ("buffer length is smaller than the sum of offset and length.");
if (IsEmptyElement) {
}
#if NET_2_1
- // there is no WebRequest in 2.1 System.dll.
- if (absoluteUri.IsFile)
- return File.OpenRead (absoluteUri.LocalPath);
- else
- // So, what can I do here? HttpWebRequest cannot be instantiated within System.dll
- throw new NotImplementedException ();
+ // So, what can I do here? HttpWebRequest cannot be instantiated within System.dll
+ throw new NotImplementedException ();
#else
// (MS documentation says) parameter role isn't used yet.
WebRequest req = WebRequest.Create (absoluteUri);
+2007-08-03 Jb Evain <jbevain@novell.com>
+
+ * ComponentCollection.cs: use our own collection base
+ for the 2.1 profile, as ReadOnlyCollectionBase does not exist
+ in 2.1, and they are internalized by the linker.
+
2007-08-01 Atsushi Enomoto <atsushi@ximian.com>
* BackgroundWorker.cs : remove extra MonoTODOs.
using System.Reflection;
namespace System.ComponentModel {
- [ComVisible (true)]
- public class ComponentCollection : ReadOnlyCollectionBase {
+#if NET_2_1
+ public class ComponentCollectionBase : System.Collections.Generic.List<IComponent>
+ {
+ protected ComponentCollectionBase InnerList {
+ get { return this; }
+ }
+ }
+#endif
+
+ [ComVisible (true)]
+ public class ComponentCollection :
+#if !NET_2_1
+ ReadOnlyCollectionBase
+#else
+ ComponentCollectionBase
+#endif
+ {
#region Constructors
public ComponentCollection (IComponent[] components)
+2007-08-03 Jb Evain <jbevain@novell.com>
+
+ * FileVersionInfo.cs: force the use of the params
+ AppendFormat method of StringBuilder as it is the only
+ one accessible in 2.1 and in the previous versions.
+
+2007-08-03 Jb Evain <jbevain@novell.com>
+
+ * FileVersionInfo.cs: remove CAS checks for 2.1.
+
+2007-08-03 Jb Evain <jbevain@novell.com>
+
+ * Process.cs: disable StartExistCallbackIfNeeded in 2.1.
+
+2007-08-03 Jb Evain <jbevain@novell.com>
+
+ * ProcessThreadCollection.cs
+ ProcessModuleCollection.cs: use our own collection base
+ for the 2.1 profile, as ReadOnlyCollectionBase does not exist
+ in 2.1, and they are internalized by the linker.
+
2007-08-02 Atsushi Enomoto <atsushi@ximian.com>
* EventLogTraceListener.cs : fixed wrong 2.0 dependency in 1.x.
public string FileName {
get {
+#if !NET_2_1
if (SecurityManager.SecurityEnabled) {
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, filename).Demand ();
}
+#endif
return filename;
}
}
public static FileVersionInfo GetVersionInfo (string fileName)
{
+#if !NET_2_1
if (SecurityManager.SecurityEnabled) {
new FileIOPermission (FileIOPermissionAccess.Read, fileName).Demand ();
}
-
+#endif
FileVersionInfo fvi = new FileVersionInfo ();
fvi.GetVersionInfo_internal (fileName);
return fvi;
}
-
+
+ // use our own AppendFormat because NET_2_1 have only this overload
+ static void AppendFormat (StringBuilder sb, string format, params object [] args)
+ {
+ sb.AppendFormat (format, args);
+ }
+
public override string ToString ()
{
StringBuilder sb = new StringBuilder ();
// we use the FileName property so we don't skip the security check
- sb.AppendFormat ("File: {0}{1}", FileName, Environment.NewLine);
+ AppendFormat (sb, "File: {0}{1}", FileName, Environment.NewLine);
// the other informations aren't protected so we can use the members directly
- sb.AppendFormat ("InternalName: {0}{1}", internalname, Environment.NewLine);
- sb.AppendFormat ("OriginalFilename: {0}{1}", originalfilename, Environment.NewLine);
- sb.AppendFormat ("FileVersion: {0}{1}", fileversion, Environment.NewLine);
- sb.AppendFormat ("FileDescription: {0}{1}", filedescription, Environment.NewLine);
- sb.AppendFormat ("Product: {0}{1}", productname, Environment.NewLine);
- sb.AppendFormat ("ProductVersion: {0}{1}", productversion, Environment.NewLine);
- sb.AppendFormat ("Debug: {0}{1}", isdebug, Environment.NewLine);
- sb.AppendFormat ("Patched: {0}{1}", ispatched, Environment.NewLine);
- sb.AppendFormat ("PreRelease: {0}{1}", isprerelease, Environment.NewLine);
- sb.AppendFormat ("PrivateBuild: {0}{1}", isprivatebuild, Environment.NewLine);
- sb.AppendFormat ("SpecialBuild: {0}{1}", isspecialbuild, Environment.NewLine);
- sb.AppendFormat ("Language {0}{1}", language, Environment.NewLine);
+ AppendFormat (sb, "InternalName: {0}{1}", internalname, Environment.NewLine);
+ AppendFormat (sb, "OriginalFilename: {0}{1}", originalfilename, Environment.NewLine);
+ AppendFormat (sb, "FileVersion: {0}{1}", fileversion, Environment.NewLine);
+ AppendFormat (sb, "FileDescription: {0}{1}", filedescription, Environment.NewLine);
+ AppendFormat (sb, "Product: {0}{1}", productname, Environment.NewLine);
+ AppendFormat (sb, "ProductVersion: {0}{1}", productversion, Environment.NewLine);
+ AppendFormat (sb, "Debug: {0}{1}", isdebug, Environment.NewLine);
+ AppendFormat (sb, "Patched: {0}{1}", ispatched, Environment.NewLine);
+ AppendFormat (sb, "PreRelease: {0}{1}", isprerelease, Environment.NewLine);
+ AppendFormat (sb, "PrivateBuild: {0}{1}", isprivatebuild, Environment.NewLine);
+ AppendFormat (sb, "SpecialBuild: {0}{1}", isspecialbuild, Environment.NewLine);
+ AppendFormat (sb, "Language {0}{1}", language, Environment.NewLine);
return sb.ToString ();
}
void StartExitCallbackIfNeeded ()
{
+#if !NET_2_1
bool start = (!already_waiting && enableRaisingEvents && exited_event != null);
if (start && process_handle != IntPtr.Zero && !HasExited) {
WaitOrTimerCallback cb = new WaitOrTimerCallback (CBOnExit);
ThreadPool.RegisterWaitForSingleObject (h, cb, this, -1, true);
already_waiting = true;
}
+#endif
}
[DefaultValue (false), Browsable (false)]
namespace System.Diagnostics
{
- public class ProcessModuleCollection : ReadOnlyCollectionBase
+#if NET_2_1
+ public class ProcessModuleCollectionBase : System.Collections.Generic.List<ProcessModule>
+ {
+ protected ProcessModuleCollectionBase InnerList {
+ get { return this; }
+ }
+ }
+#endif
+
+ public class ProcessModuleCollection :
+#if !NET_2_1
+ ReadOnlyCollectionBase
+#else
+ ProcessModuleCollectionBase
+#endif
{
-
protected ProcessModuleCollection()
{
}
namespace System.Diagnostics
{
- public class ProcessThreadCollection : ReadOnlyCollectionBase
+#if NET_2_1
+ public class ProcessThreadCollectionBase : System.Collections.Generic.List<ProcessThread>
+ {
+ protected ProcessThreadCollectionBase InnerList {
+ get { return this; }
+ }
+
+ public new int Add (ProcessThread thread)
+ {
+ base.Add (thread);
+ return Count - 1;
+ }
+ }
+#endif
+
+ public class ProcessThreadCollection :
+#if !NET_2_1
+ ReadOnlyCollectionBase
+#else
+ ProcessThreadCollectionBase
+#endif
{
protected ProcessThreadCollection()
{
+2007-08-03 Jb Evain <jbevain@novell.com>
+
+ * Dns.cs: remove async methods for the 2.1 profile.
+
2007-07-17 Rodrigo Kumpera <rkumpera@novell.com>
* HttpListenerRequest.cs: Support for Cookie decoding.
System.Net.Sockets.Socket.CheckProtocolSupport();
}
+#if !NET_2_1 // global remove of async methods
+
private delegate IPHostEntry GetHostByNameCallback (string hostName);
private delegate IPHostEntry ResolveCallback (string hostName);
#if NET_2_0
return cb.EndInvoke(asyncResult);
}
#endif
+
+#endif // !NET_2_1: global remove of async methods
#if !TARGET_JVM
[MethodImplAttribute(MethodImplOptions.InternalCall)]
+2007-08-03 Zoltan Varga <vargaz@gmail.com>
+
+ * MethodInfoTest.cs: Add another test.
+
+ * MethodInfoTest.cs: Add test for Invoking methods with a nullable type receiver.
+
2007-07-20 Gert Driesen <drieseng@users.sourceforge.net>
* MethodInfoTest.cs: Added GetMethodFromHandle test for generic type.
MethodInfo mi = typeof (MethodInfoTest).GetMethod ("pass_nullable");
Assert.AreEqual (102, mi.Invoke (null, new object [] { 102 }), "#1");
Assert.AreEqual (null, mi.Invoke (null, new object [] { null }), "#2");
+
+ // Test conversion of vtype to a nullable type for the this argument
+ PropertyInfo pi = typeof (Nullable <int>).GetProperty ("HasValue");
+ Assert.AreEqual (true, pi.GetGetMethod ().Invoke (10, null));
+ PropertyInfo pi2 = typeof (Nullable <int>).GetProperty ("Value");
+ Assert.AreEqual (10, pi2.GetGetMethod ().Invoke (10, null));
}
public static void foo_generic<T> ()
{
private AppDomain ad;
private ArrayList files = new ArrayList ();
- private string tempDir = Path.Combine (Path.GetTempPath (), "MonoTests.System.AppDomainTest");
+ private string tempDir;
[SetUp]
public void SetUp ()
{
+ tempDir = Path.Combine (Path.GetTempPath (), Environment.UserName);
+ tempDir = Path.Combine (tempDir, "MonoTests.System.AppDomainTest");
if (!Directory.Exists (tempDir)) {
Directory.CreateDirectory (tempDir);
}
+2007-08-04 William Holmes <billholmes54@gmail.com>
+
+ * AppDomainTest.cs: Adding username to tempDir to avoid file access
+ permissions.
+
+2007-08-04 William Holmes <billholmes54@gmail.com>
+
+ * TypeTest.cs: Removing generic method for net_1_1 profile.
+
+2007-08-03 Zoltan Varga <vargaz@gmail.com>
+
+ * TypeTest.cs: Add test for IsAssignableFrom and generic parameters.
+
2007-07-31 Gert Driesen <drieseng@users.sourceforge.net>
* TypeTest.cs: Added test for bug #82211.
private void ByrefMethod (ref int i, ref Derived1 j, ref Base1 k) {
}
-
+#if NET_2_0
+ private void GenericMethod<Q> (Q q) {
+ }
+#endif
[Test]
public void TestIsAssignableFrom () {
// Simple tests for inheritance
MethodInfo mi = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic);
Assert.IsTrue (mi.GetParameters ()[2].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
Assert.IsTrue (mi.GetParameters ()[1].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
+
+ // Tests for type parameters
+#if NET_2_0
+ mi = typeof (TypeTest).GetMethod ("GenericMethod", BindingFlags.Instance|BindingFlags.NonPublic);
+ Assert.IsTrue (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (mi.GetParameters ()[0].ParameterType));
+ Assert.IsFalse (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (typeof (int)));
+#endif
}
[Test]
+2007-08-03 Marek Safar <marek.safar@gmail.com>
+
+ A fix for bug #81979
+ * expression.cs (TypeOf.GetAttributableValue): Check for type arguments
+ only.
+
+2007-08-03 Marek Safar <marek.safar@gmail.com>
+
+ A fix for bug #82300
+
+ * anonymous.cs (AnonymousContainer.Define): Don't define anything when
+ we are in probing scope.
+
2007-08-03 Marek Safar <marek.safar@gmail.com>
A fix for bug #82301
if (aec == null && !Compatible (ec))
return false;
+ // Don't define anything when we are in probing scope (nested anonymous methods)
+ if (ec.IsInProbingMode)
+ return true;
+
method = DoCreateMethodHost (ec);
if (Scope != null)
public override bool GetAttributableValue (Type valueType, out object value)
{
- if (TypeManager.ContainsGenericParameters (typearg)) {
- Report.SymbolRelatedToPreviousError(typearg);
- Report.Error(416, loc, "`{0}': an attribute argument cannot use type parameters",
- TypeManager.CSharpName(typearg));
+ if (TypeManager.ContainsGenericParameters (typearg) &&
+ !TypeManager.IsGenericTypeDefinition (typearg)) {
+ Report.SymbolRelatedToPreviousError (typearg);
+ Report.Error (416, loc, "`{0}': an attribute argument cannot use type parameters",
+ TypeManager.CSharpName (typearg));
value = null;
return false;
}
--- /dev/null
+using System;
+
+public class TestAttribute : Attribute
+{
+ object type;
+ public object Type
+ {
+ get { return type; }
+ set { type = value; }
+ }
+ public TestAttribute() { }
+ public TestAttribute(Type type)
+ {
+ this.type = type;
+ }
+}
+
+namespace N
+{
+ class C<T>
+ {
+ [Test(Type = typeof(C<>))] //this shouldn't fail
+ public void Bar() { }
+
+ [Test(typeof(C<>))] // this shouldn't fail
+ public void Bar2() { }
+
+ [Test(typeof(C<int>))] // this shouldn't fail
+ public void Bar3() { }
+
+ [Test(typeof(C<CC>))] // this shouldn't fail
+ public void Bar4() { }
+ }
+
+ class CC
+ {
+ public static void Main()
+ {
+ }
+ }
+}
\ No newline at end of file
+2007-08-05 Jb Evain <jbevain@novell.com>
+
+ * Mono.Linker.Steps/ResolveFromXmlStep.cs:
+ Now the resolver deals only with assembly names
+ instead of fullnames.
+
2007-07-25 Jb Evain <jbevain@novell.com>
* Mono.Linker.Steps/ResolveFromAssemblyStep.cs:
<type fullname="System.Nullable`1" />
<type fullname="System.Object" preserve="fields" />
<type fullname="System.OutOfMemoryException" />
- <type fullname="System.Reflection.Assembly" preserve="fields" />
+ <type fullname="System.Reflection.Assembly" preserve="all" />
<type fullname="System.Reflection.AssemblyName" preserve="fields" />
<type fullname="System.Reflection.ConstructorInfo" preserve="fields" />
<type fullname="System.Reflection.CustomAttributeData" preserve="fields" />
<type fullname="System.Reflection.Emit.GenericTypeParameterBuilder" preserve="fields" />
<type fullname="System.Reflection.Emit.ILExceptionBlock" preserve="fields" />
<type fullname="System.Reflection.Emit.ILExceptionInfo" preserve="fields" />
- <type fullname="System.Reflection.Emit.ILGenerator" preserve="fields" />
- <type fullname="System.Reflection.Emit.LocalBuilder" preserve="fields" />
+ <type fullname="System.Reflection.Emit.ILGenerator" preserve="all" />
+ <type fullname="System.Reflection.Emit.LocalBuilder" preserve="all" />
<type fullname="System.Reflection.Emit.MethodBuilder" preserve="fields" />
- <type fullname="System.Reflection.Emit.ModuleBuilder" preserve="fields" />
+ <type fullname="System.Reflection.Emit.ModuleBuilder" preserve="all" />
<type fullname="System.Reflection.Emit.MonoResource" preserve="fields" />
<type fullname="System.Reflection.Emit.MonoWin32Resource" preserve="fields" />
<type fullname="System.Reflection.Emit.ParameterBuilder" preserve="fields" />
<type fullname="System.Reflection.MethodBase" preserve="fields" />
<type fullname="System.Reflection.MethodBody" preserve="fields" />
<type fullname="System.Reflection.MethodInfo" preserve="fields" />
- <type fullname="System.Reflection.Module" preserve="fields" />
+ <type fullname="System.Reflection.Module" preserve="all" />
<type fullname="System.Reflection.MonoArrayMethod" preserve="fields" />
<type fullname="System.Reflection.MonoCMethod" preserve="fields" />
<type fullname="System.Reflection.MonoEvent" preserve="fields" />
AssemblyNameReference reference = AssemblyNameReference.Parse (assemblyName);
AssemblyDefinition assembly;
- if (IsSimpleName (assemblyName)) {
- assembly = SearchAssemblyInContext (context, assemblyName);
- if (assembly != null)
- return assembly;
- }
-
assembly = context.Resolve (reference);
- if (IsSimpleName (assemblyName))
- UpdateReferenceInCache (context, reference, assembly);
-
ProcessReferences (assembly, context);
return assembly;
}
- static void UpdateReferenceInCache (LinkContext context, AssemblyNameReference reference, AssemblyDefinition assembly)
- {
- context.Resolver.AssemblyCache.Remove (reference.FullName);
- context.Resolver.AssemblyCache.Add (assembly.Name.FullName, assembly);
- }
-
- static AssemblyDefinition SearchAssemblyInContext (LinkContext context, string name)
- {
- foreach (AssemblyDefinition assembly in context.GetAssemblies ())
- if (assembly.Name.Name == name)
- return assembly;
-
- return null;
- }
-
static void ProcessReferences (AssemblyDefinition assembly, LinkContext context)
{
foreach (AssemblyNameReference name in assembly.MainModule.AssemblyReferences)
context.Resolve (name);
}
- static bool IsSimpleName (string assemblyName)
- {
- return assemblyName.IndexOf (",") == -1;
- }
-
static bool IsRequired (XPathNavigator nav)
{
string attribute = GetAttribute (nav, _required);
+2007-08-05 Jb Evain <jbevain@novell.com>
+
+ * Descriptors/smcs.xml, Makefile: add a descriptor
+ to protect some classes in smcs.
+
2007-08-03 Atsushi Enomoto <atsushi@ximian.com>
* Makefile : a bit win32 friendly fix.
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<linker>
+ <assembly fullname="smcs">
+ <type fullname="Mono.CompilerServices.SymbolWriter.MonoDebuggerSupport" />
+ </assembly>
+</linker>
Mono.Tuner/CheckVisibility.dll \
# Mono.Tuner/InjectAttributes.dll \
+LINKER_DESCS = \
+ Descriptors/smcs.xml \
+
LOCAL_MCS_FLAGS = -r:$(LINKER) -r:Mono.Cecil.dll
LINKER_SOURCES = $(LINKER_PLUGINS:.dll=.cs)
-DISTFILES = README $(LINKER_SOURCES)
+DISTFILES = README $(LINKER_SOURCES) $(LINKER_DESCS)
ifneq (net_2_1, $(PROFILE))
all-local: $(LINKER_PLUGINS)
Mono.Tuner.CheckVisibility,CheckVisibility \
tune: masterinfos/silverlight.infos
- MONO_PATH="Mono.Tuner$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(LINKER) $(LINKER_FLAGS) $(LINKER_STEPS:%=-s %) $(MCS_MASTER_INFOS:%=-i %)
+ MONO_PATH="Mono.Tuner$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(LINKER) $(LINKER_FLAGS) $(LINKER_DESCS:%=-x %) $(LINKER_STEPS:%=-s %) $(MCS_MASTER_INFOS:%=-i %)
%.dll: %.cs
$(CSCOMPILE) /t:library $^
--- /dev/null
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{E97429BA-279A-4C1D-AE8A-8BD878C661D1}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Mono.Tuner</RootNamespace>
+ <AssemblyName>Mono.Tuner</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Mono.Tuner\CheckVisibility.cs" />
+ <Compile Include="Mono.Tuner\PrintStatus.cs" />
+ <Compile Include="Mono.Tuner\RemoveSerialization.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\class\Mono.Cecil\Mono.Cecil.csproj">
+ <Project>{D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}</Project>
+ <Name>Mono.Cecil</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\linker\Mono.Linker.csproj">
+ <Project>{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}</Project>
+ <Name>Mono.Linker</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Properties\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
static bool IsPublic (TypeDefinition type)
{
- return (type.DeclaringType == null && (type.Attributes & TypeAttributes.Public) != 0) || (type.Attributes & TypeAttributes.NestedPublic) != 0;
- }
-
- static bool IsPublic (FieldDefinition field)
- {
- return (field.Attributes & FieldAttributes.Public) != 0;
- }
-
- static bool IsAssembly (FieldDefinition field)
- {
- return (field.Attributes & FieldAttributes.Assembly) != 0;
- }
-
- static bool IsPublic (MethodDefinition meth)
- {
- return (meth.Attributes & MethodAttributes.Public) != 0;
- }
-
- static bool IsAssembly (MethodDefinition meth)
- {
- return (meth.Attributes & MethodAttributes.Assem) != 0;
+ return (type.DeclaringType == null && type.IsPublic) || type.IsNestedPublic;
}
static bool AreInDifferentAssemblies (TypeDefinition lhs, TypeDefinition rhs)
if (reference is GenericParameter || reference.GetOriginalType () is GenericParameter)
return true;
-
+
TypeDefinition other = Context.Resolver.Resolve (reference);
if (other == null)
return true;
if (IsPublic (other))
return true;
-
+
return false;
}
MethodDefinition meth = null;
try {
meth = Context.Resolver.Resolve (reference);
- } catch {}
+ } catch (ResolutionException) {}
if (meth == null)
return true;
if (!IsVisibleFrom (type, dec))
return false;
- if (IsPublic (meth))
+ if (meth.IsPublic)
+ return true;
+
+ if (type == dec || type.DeclaringType == dec)
+ return true;
+
+ if (meth.IsFamily && InHierarchy (type, dec))
return true;
- if (!AreInDifferentAssemblies (type, dec) && IsAssembly (meth))
+ if (!AreInDifferentAssemblies (type, dec) && meth.IsAssembly)
return true;
return false;
FieldDefinition field = null;
try {
field = Context.Resolver.Resolve (reference);
- } catch {}
+ } catch (ResolutionException) {}
if (field == null)
return true;
if (!IsVisibleFrom (type, dec))
return false;
- if (IsPublic (field))
+ if (field.IsPublic)
+ return true;
+
+ if (type == dec || type.DeclaringType == dec)
+ return true;
+
+ if (field.IsFamily && InHierarchy (type, dec))
return true;
- if (!AreInDifferentAssemblies (type, dec) && IsAssembly (field))
+ if (!AreInDifferentAssemblies (type, dec) && field.IsAssembly)
return true;
return false;
}
- void Report (string pattern, params object [] parameters)
+ bool InHierarchy (TypeDefinition type, TypeDefinition other)
+ {
+ if (type.BaseType == null)
+ return false;
+
+ TypeDefinition baseType = Context.Resolver.Resolve (type.BaseType);
+
+ if (baseType == other)
+ return true;
+
+ return InHierarchy (baseType, other);
+ }
+
+ static void Report (string pattern, params object [] parameters)
{
Console.WriteLine ("[check] " + pattern, parameters);
}
using Mono.Cecil;
namespace Mono.Tuner {
-
+
public class PrintStatus : BaseStep {
protected override void ProcessAssembly (AssemblyDefinition assembly)
using Mono.Cecil;
namespace Mono.Tuner {
-
+
public class RemoveSerialization : BaseStep {
static readonly string _Serialization = "System.Runtime.Serialization";
static void RemoveSerializableFlag (TypeDefinition type)
{
- type.Attributes &= ~TypeAttributes.Serializable;
+ type.Attributes &= ~TypeAttributes.Serializable;
}
static void ProcessType (TypeDefinition type)
+++ /dev/null
-prefix=${pcfiledir}/../..
-exec_prefix=${pcfiledir}/../..
-libdir=${prefix}/lib
-includedir=${prefix}/include/mono-@API_VER@
-
-
-Name: Mono Interpreter
-Description: Mono Interpreter Runtime
-Version: @VERSION@
-Requires: glib-2.0 gthread-2.0
-Libs: -L${libdir} @export_ldflags@ -lmint @libmono_ldflags@
-Cflags: -I${includedir} @libmono_cflags@
+++ /dev/null
-prefix=${pcfiledir}/../..
-exec_prefix=${pcfiledir}/../..
-libdir=${prefix}/@reloc_libdir@
-includedir=${prefix}/include
-
-Name: Mono.Cairo
-Description: Cairo bindings for Mono
-Version: @VERSION@
-Libs: -r:${prefix}/lib/mono/1.0/Mono.Cairo.dll
+++ /dev/null
-prefix=${pcfiledir}/../..
-exec_prefix=${pcfiledir}/../..
-libdir=${prefix}/@reloc_libdir@
-includedir=${prefix}/include/mono-@API_VER@
-
-Name: Mono
-Description: Mono Runtime
-Version: @VERSION@
-Requires: glib-2.0 gthread-2.0
-Libs: -L${libdir} @export_ldflags@ -lmono @libmono_ldflags@
-Cflags: -I${includedir} @libmono_cflags@
+2007-08-03 Zoltan Varga <vargaz@gmail.com>
+
+ * image.c (mono_image_close): Fix a leak.
+
+ * object.c (mono_runtime_invoke_array): Avoid using alloca.
+
+ * icall.c (ves_icall_FieldInfo_SetValueInternal): Ditto.
+
+Fri Aug 3 19:54:23 CEST 2007 Paolo Molaro <lupus@ximian.com>
+
+ * domain.c, threads.c, threads-types.h: fix memory retention issue
+ with thread static variables not being cleared on domain unload.
+ Reuse thread static slots after domain unload.
+
+2007-08-03 Zoltan Varga <vargaz@gmail.com>
+
+ * object.c (mono_runtime_invoke_array): Handle the case when the receiver is a
+ nullable type.
+
+ * marshal.c (mono_marshal_get_runtime_invoke): Revert the previous change, it is
+ now done in mono_runtime_invoke_array.
+
+ * marshal.c (mono_marshal_get_runtime_invoke): Handle the case when the
+ receiver is a nullable type.
+
+ * class.c (mono_class_is_assignable_from): Handle the case when klass is a
+ generic parameter.
2007-07-03 Jonathan Chambers <joncham@gmail.com>
if (!oklass->inited)
mono_class_init (oklass);
+ if ((klass->byval_arg.type == MONO_TYPE_VAR) || (klass->byval_arg.type == MONO_TYPE_MVAR))
+ return klass == oklass;
+
if (MONO_CLASS_IS_INTERFACE (klass)) {
if ((oklass->byval_arg.type == MONO_TYPE_VAR) || (oklass->byval_arg.type == MONO_TYPE_MVAR))
return FALSE;
domain->null_reference_ex = NULL;
domain->stack_overflow_ex = NULL;
domain->entry_assembly = NULL;
+ /* must do this early as it accesses fields and types */
+ if (domain->special_static_fields) {
+ mono_alloc_special_static_data_free (domain->special_static_fields);
+ g_hash_table_destroy (domain->special_static_fields);
+ domain->special_static_fields = NULL;
+ }
for (tmp = domain->domain_assemblies; tmp; tmp = tmp->next) {
MonoAssembly *ass = tmp->data;
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Unloading domain %s %p, assembly %s %p, refcount=%d\n", domain->friendly_name, domain, ass->aname.name, ass, ass->ref_count);
g_hash_table_destroy (domain->delegate_invoke_impl_no_target_hash);
domain->delegate_invoke_impl_no_target_hash = NULL;
}
- if (domain->special_static_fields) {
- g_hash_table_destroy (domain->special_static_fields);
- domain->special_static_fields = NULL;
- }
DeleteCriticalSection (&domain->assemblies_lock);
DeleteCriticalSection (&domain->lock);
domain->setup = NULL;
ICALL(TYPEB_7, "setup_internal_class", mono_reflection_setup_internal_class)
ICALL_TYPE(FIELDI, "System.Reflection.FieldInfo", FILEDI_1)
-ICALL(FILEDI_1, "GetUnmanagedMarshal", ves_icall_System_Reflection_FieldInfo_GetUnmanagedMarshal)
-ICALL(FILEDI_2, "internal_from_handle", ves_icall_System_Reflection_FieldInfo_internal_from_handle)
-ICALL(FILEDI_3, "internal_from_handle_type", ves_icall_System_Reflection_FieldInfo_internal_from_handle_type)
+ICALL(FILEDI_1, "GetTypeModifiers", ves_icall_System_Reflection_FieldInfo_GetTypeModifiers)
+ICALL(FILEDI_2, "GetUnmanagedMarshal", ves_icall_System_Reflection_FieldInfo_GetUnmanagedMarshal)
+ICALL(FILEDI_3, "internal_from_handle", ves_icall_System_Reflection_FieldInfo_internal_from_handle)
+ICALL(FILEDI_4, "internal_from_handle_type", ves_icall_System_Reflection_FieldInfo_internal_from_handle_type)
ICALL_TYPE(MEMBERI, "System.Reflection.MemberInfo", MEMBERI_1)
ICALL(MEMBERI_1, "get_MetadataToken", mono_reflection_get_token)
ICALL(MODULE_7, "ResolveFieldToken", ves_icall_System_Reflection_Module_ResolveFieldToken)
ICALL(MODULE_8, "ResolveMemberToken", ves_icall_System_Reflection_Module_ResolveMemberToken)
ICALL(MODULE_9, "ResolveMethodToken", ves_icall_System_Reflection_Module_ResolveMethodToken)
-ICALL(MODULE_10, "ResolveStringToken", ves_icall_System_Reflection_Module_ResolveStringToken)
-ICALL(MODULE_11, "ResolveTypeToken", ves_icall_System_Reflection_Module_ResolveTypeToken)
-ICALL(MODULE_12, "get_MetadataToken", mono_reflection_get_token)
+ICALL(MODULE_10, "ResolveSignature", ves_icall_System_Reflection_Module_ResolveSignature)
+ICALL(MODULE_11, "ResolveStringToken", ves_icall_System_Reflection_Module_ResolveStringToken)
+ICALL(MODULE_12, "ResolveTypeToken", ves_icall_System_Reflection_Module_ResolveTypeToken)
+ICALL(MODULE_13, "get_MetadataToken", mono_reflection_get_token)
ICALL_TYPE(MCMETH, "System.Reflection.MonoCMethod", MCMETH_1)
ICALL(MCMETH_1, "GetGenericMethodDefinition_impl", ves_icall_MonoMethod_GetGenericMethodDefinition)
if (mono_class_is_nullable (mono_class_from_mono_type (cf->type))) {
MonoClass *nklass = mono_class_from_mono_type (cf->type);
- guint8 *buf;
+ MonoObject *nullable;
/*
* Convert the boxed vtype into a Nullable structure.
* This is complicated by the fact that Nullables have
* a variable structure.
*/
- /* Allocate using alloca so it gets GC tracking */
- buf = alloca (nklass->instance_size);
+ nullable = mono_object_new (mono_domain_get (), nklass);
- mono_nullable_init (buf, value, nklass);
+ mono_nullable_init (mono_object_unbox (nullable), value, nklass);
- v = (gchar*)buf;
+ v = mono_object_unbox (nullable);
}
else
if (gclass->container_class->valuetype && (v != NULL))
}
if (image->modules)
g_free (image->modules);
+ if (image->modules_loaded)
+ g_free (image->modules_loaded);
if (image->references)
g_free (image->references);
/*g_print ("destroy image %p (dynamic: %d)\n", image, image->dynamic);*/
mono_runtime_invoke (method, o, pa, exc);
return obj;
} else {
+ if (mono_class_is_nullable (method->klass)) {
+ MonoObject *nullable;
+
+ /* Convert the unboxed vtype into a Nullable structure */
+ nullable = mono_object_new (mono_domain_get (), method->klass);
+
+ mono_nullable_init (mono_object_unbox (nullable), mono_value_box (mono_domain_get (), method->klass->cast_class, obj), method->klass);
+ obj = mono_object_unbox (nullable);
+ }
+
/* obj must be already unboxed if needed */
return mono_runtime_invoke (method, obj, pa, exc);
}
extern void ves_icall_System_Threading_Thread_Interrupt_internal (MonoThread *this_obj) MONO_INTERNAL;
extern void ves_icall_System_Threading_Thread_SpinWait_internal (gint32) MONO_INTERNAL;
+void mono_alloc_special_static_data_free (GHashTable *special_static_fields) MONO_INTERNAL;
void mono_thread_free_local_slot_values (int slot, MonoBoolean thread_local) MONO_INTERNAL;
extern void mono_thread_current_check_pending_interrupt (void) MONO_INTERNAL;
gdouble fval;
} LongDoubleUnion;
+typedef struct _MonoThreadDomainTls MonoThreadDomainTls;
+struct _MonoThreadDomainTls {
+ MonoThreadDomainTls *next;
+ guint32 offset;
+ guint32 size;
+};
+
typedef struct {
int idx;
int offset;
+ MonoThreadDomainTls *freelist;
} StaticDataInfo;
typedef struct {
{
static_data->idx = 0;
static_data->offset = 0;
+ static_data->freelist = NULL;
}
/*
if (static_data->offset + size >= static_data_size [static_data->idx]) {
static_data->idx ++;
g_assert (size <= static_data_size [static_data->idx]);
- /*
- * massive unloading and reloading of domains with thread-static
- * data may eventually exceed the allocated storage...
- * Need to check what the MS runtime does in that case.
- * Note that for each appdomain, we need to allocate a separate
- * thread data slot for security reasons. We could keep track
- * of the slots per-domain and when the domain is unloaded
- * out the slots on a sort of free list.
- */
g_assert (static_data->idx < NUM_STATIC_DATA_IDX);
static_data->offset = 0;
}
mono_alloc_static_data (&(thread->static_data), offset);
}
+static MonoThreadDomainTls*
+search_tls_slot_in_freelist (StaticDataInfo *static_data, guint32 size, guint32 align)
+{
+ MonoThreadDomainTls* prev = NULL;
+ MonoThreadDomainTls* tmp = static_data->freelist;
+ while (tmp) {
+ if (tmp->size == size) {
+ if (prev)
+ prev->next = tmp->next;
+ else
+ static_data->freelist = tmp->next;
+ return tmp;
+ }
+ tmp = tmp->next;
+ }
+ return NULL;
+}
+
/*
* The offset for a special static variable is composed of three parts:
* a bit that indicates the type of static data (0:thread, 1:context),
guint32 offset;
if (static_type == SPECIAL_STATIC_THREAD)
{
+ MonoThreadDomainTls *item;
mono_threads_lock ();
- offset = mono_alloc_static_data_slot (&thread_static_info, size, align);
+ item = search_tls_slot_in_freelist (&thread_static_info, size, align);
+ /*g_print ("TLS alloc: %d in domain %p (total: %d), cached: %p\n", size, mono_domain_get (), thread_static_info.offset, item);*/
+ if (item) {
+ offset = item->offset;
+ g_free (item);
+ } else {
+ offset = mono_alloc_static_data_slot (&thread_static_info, size, align);
+ }
/* This can be called during startup */
if (threads != NULL)
mono_g_hash_table_foreach (threads, alloc_thread_static_data_helper, GUINT_TO_POINTER (offset));
}
}
+typedef struct {
+ guint32 offset;
+ guint32 size;
+} TlsOffsetSize;
+
+static void
+free_thread_static_data_helper (gpointer key, gpointer value, gpointer user)
+{
+ MonoThread *thread = value;
+ TlsOffsetSize *data = user;
+ int idx = (data->offset >> 24) - 1;
+ char *ptr;
+
+ if (!thread->static_data [idx])
+ return;
+ ptr = ((char*) thread->static_data [idx]) + (data->offset & 0xffffff);
+ memset (ptr, 0, data->size);
+}
+
+static void
+do_free_special (gpointer key, gpointer value, gpointer data)
+{
+ MonoClassField *field = key;
+ guint32 offset = GPOINTER_TO_UINT (value);
+ guint32 static_type = (offset & 0x80000000);
+ gint32 align;
+ guint32 size;
+ size = mono_type_size (field->type, &align);
+ /*g_print ("free %s , size: %d, offset: %x\n", field->name, size, offset);*/
+ if (static_type == 0) {
+ TlsOffsetSize data;
+ MonoThreadDomainTls *item = g_new0 (MonoThreadDomainTls, 1);
+ data.offset = offset & 0x7fffffff;
+ data.size = size;
+ if (threads != NULL)
+ mono_g_hash_table_foreach (threads, free_thread_static_data_helper, &data);
+ item->offset = offset;
+ item->size = size;
+ item->next = thread_static_info.freelist;
+ thread_static_info.freelist = item;
+ } else {
+ /* FIXME: free context static data as well */
+ }
+}
+
+void
+mono_alloc_special_static_data_free (GHashTable *special_static_fields)
+{
+ mono_threads_lock ();
+ g_hash_table_foreach (special_static_fields, do_free_special, NULL);
+ mono_threads_unlock ();
+}
+
static MonoClassField *local_slots = NULL;
typedef struct {
+2007-08-03 Neale Ferguson <neale@sinenomine.net>
+
+ * mini-s390.c (add_general): Adjust offset calculation to take into account of rounding up
+ due to alignment.
Thu Aug 2 17:36:22 CEST 2007 Paolo Molaro <lupus@ximian.com>
static void inline
add_general (guint *gr, size_data *sz, ArgInfo *ainfo, gboolean simple)
{
+ int disp;
+
if (simple) {
if (*gr > S390_LAST_ARG_REG) {
sz->stack_size = S390_ALIGN(sz->stack_size, sizeof(long));
}
} else {
if (*gr > S390_LAST_ARG_REG - 1) {
+ disp = sz->stack_size;
sz->stack_size = S390_ALIGN(sz->stack_size, S390_STACK_ALIGNMENT);
+ disp = sz->stack_size - disp;
ainfo->offset = sz->stack_size;
ainfo->reg = STK_BASE;
ainfo->regtype = RegTypeBase;
sz->stack_size += sizeof(long long);
- sz->local_size += sizeof(long long);
- sz->offStruct += sizeof(long long);
+ sz->local_size += (sizeof(long long) + disp);
+ sz->offStruct += (sizeof(long long) + disp);
sz->code_size += 10;
} else {
ainfo->reg = *gr;
cinfo->args[nParm].size = sizeof(long long);
cinfo->args[nParm].regtype = RegTypeStructByVal;
nParm++;
- sz->local_size += sizeof(long);
+ sz->local_size += sizeof(long long);
break;
default:
add_stackParm(&gr, sz, cinfo->args+nParm, size);
cinfo->args[nParm].size = sizeof(long long);
cinfo->args[nParm].regtype = RegTypeStructByVal;
nParm++;
- sz->local_size += sizeof(long);
+ sz->local_size += sizeof(long long);
break;
default:
add_stackParm(&gr, sz, cinfo->args+nParm, size);