mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 11:21:08 -10:00
Compare commits
34
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acb9e21b28 | ||
|
|
d764721904 | ||
|
|
6f195124e0 | ||
|
|
b1167b2c4d | ||
|
|
dcb35ea7fa | ||
|
|
46e0d061a4 | ||
|
|
ebe88df06a | ||
|
|
3d4ab6f901 | ||
|
|
2bdf5b4c75 | ||
|
|
ae2ce582e5 | ||
|
|
487f8d095f | ||
|
|
9023962aca | ||
|
|
ea864e7b3b | ||
|
|
13d09f78dc | ||
|
|
e8439e4919 | ||
|
|
027788dae7 | ||
|
|
42ade7110c | ||
|
|
69af966957 | ||
|
|
20f05b8036 | ||
|
|
1edef9e84e | ||
|
|
dd14989995 | ||
|
|
65b506ffd1 | ||
|
|
685c076e4f | ||
|
|
103cdf337c | ||
|
|
ccf0a456c6 | ||
|
|
9452b3247b | ||
|
|
58ea189289 | ||
|
|
d05e4a0a83 | ||
|
|
0b6c229af9 | ||
|
|
7a8b040b72 | ||
|
|
d81c400952 | ||
|
|
e772fcc2f2 | ||
|
|
dfbd326f1a | ||
|
|
306cee132e |
No files matched your search
@@ -62,3 +62,222 @@ Global Register Allocation
|
||||
==========================
|
||||
|
||||
TODO.
|
||||
|
||||
Local Register Allocation
|
||||
=========================
|
||||
|
||||
This section describes the cross-platform local register allocator which is
|
||||
in the file mini-codegen.c.
|
||||
|
||||
The input to the allocator is a basic block which contains linear IL, ie.
|
||||
instructions of the form:
|
||||
|
||||
DEST <- SRC1 OP SRC2
|
||||
|
||||
where DEST, SRC1, and SRC2 are virtual registers (vregs). The job of the
|
||||
allocator is to assign hard or physical registers (hregs) to each virtual
|
||||
registers so the vreg references in the instructions can be replaced with their
|
||||
assigned hreg, allowing machine code to be generated later.
|
||||
|
||||
The allocator needs information about the number and types of arguments of
|
||||
instructions. It takes this information from the machine description files. It
|
||||
also needs arch specific information, like the number and type of the hard
|
||||
registers. It gets this information from arch-specific macros.
|
||||
|
||||
Currently, the vregs and hregs are partitioned into two classes: integer and
|
||||
floating point.
|
||||
|
||||
The allocator consists of two phases: In the first phase, a forward pass is
|
||||
made over the instructions, collecting liveness information for vregs. In the
|
||||
second phase, a backward pass is made over the instructions, assigning
|
||||
registers. This backward mode of operation makes understanding the allocator
|
||||
somewhat difficult to understand, but leads to better code in most cases.
|
||||
|
||||
Allocator state
|
||||
===============
|
||||
|
||||
The state of the allocator is stored in two arrays: iassign and isymbolic.
|
||||
iassign maps vregs to hregs, while isymbolic is the opposite.
|
||||
For a vreg, iassign [vreg] can contain the following values:
|
||||
|
||||
* -1 vreg has no assigned hreg
|
||||
|
||||
* hreg index (>= 0) vreg is assigned to the given hreg. This means
|
||||
later instructions (which we have already
|
||||
processed due to the backward direction) expect
|
||||
the value of vreg to be found in hreg.
|
||||
|
||||
* spill slot index (< -1) vreg is spilled to the given spill slot. This
|
||||
means later instructions expect the value of
|
||||
vreg to be found on the stack in the given
|
||||
spill slot.
|
||||
|
||||
Also, the allocator keeps track of which hregs are free and which are used.
|
||||
This information is stored in a bitmask called ifree_mask.
|
||||
|
||||
There is a similar set of data structures for floating point registers.
|
||||
|
||||
Spilling
|
||||
========
|
||||
|
||||
When an allocator needs a free hreg, but all of them are assigned, it needs to
|
||||
free up one of them. It does this by spilling the contents of the vreg which
|
||||
is currently assigned to the selected hreg. Since later instructions expect
|
||||
the vreg to be found in the selected hreg, the allocator emits a spill-load
|
||||
instruction to load the value from the spill slot into the hreg after the
|
||||
currently processed instruction. When the vreg which is spilled is a
|
||||
destination in an instruction, the allocator will emit a spill-store to store
|
||||
the value into the spill slot.
|
||||
|
||||
Fixed registers
|
||||
===============
|
||||
|
||||
Some architectures, notably x86/amd64 require that the arguments/results of
|
||||
some instructions be assigned to specific hregs. An example is the shift
|
||||
opcodes on x86, where the second argument must be in ECX. The allocator
|
||||
has support for this. It tries to allocate the vreg to the required hreg. If
|
||||
thats not possible, then it will emit compensation code which moves values to
|
||||
the correct registers before/after the instruction.
|
||||
|
||||
Fixed registers are mainly used on x86, but they are useful on more regular
|
||||
architectures on well, for example to model that after a call instruction, the
|
||||
return of the call is in a specific register.
|
||||
|
||||
A special case of fixed registers is two address architectures, like the x86,
|
||||
where the instructions place their results into their first argument. This is
|
||||
modelled in the allocator by allocating SRC1 and DEST to the same hreg.
|
||||
|
||||
Global registers
|
||||
================
|
||||
|
||||
Some variables might already be allocated to hardware registers during the
|
||||
global allocation phase. In this case, SRC1, SRC2 and DEST might already be
|
||||
a hardware register. The allocator needs to do nothing in this case, except
|
||||
when the architecture uses fixed registers, in which case it needs to emit
|
||||
compensation code.
|
||||
|
||||
Register pairs
|
||||
==============
|
||||
|
||||
64 bit arithmetic on 32 bit machines requires instructions whose arguments are
|
||||
not registers, but register pairs. The allocator has support for this, both
|
||||
for freely allocatable register pairs, and for register pairs which are
|
||||
constrained to specific hregs (EDX:EAX on x86).
|
||||
|
||||
Floating point stack
|
||||
====================
|
||||
|
||||
The x86 architecture uses a floating point register stack instead of a set of
|
||||
fp registers. The allocator supports this by keeping track of the height of the
|
||||
fp stack, and spilling/loading values from the stack as neccesary.
|
||||
|
||||
Calls
|
||||
=====
|
||||
|
||||
Calls need special handling for two reasons: first, they will clobber all
|
||||
caller-save registers, meaning their contents will need to be spilled. Also,
|
||||
some architectures pass arguments in registers. The registers used for
|
||||
passing arguments are usually the same as the ones used for local allocation,
|
||||
so the allocator needs to handle them specially. This is done as follows:
|
||||
the MonoInst for the call instruction contains a map mapping vregs which
|
||||
contain the argument values to hregs where the argument needs to be placed,
|
||||
like this (on amd64):
|
||||
|
||||
R33 -> RDI
|
||||
R34 -> RSI
|
||||
...
|
||||
|
||||
When the allocator processes the call instruction, it allocates the vregs
|
||||
in the map to their associated hregs. So the call instruction is processed as
|
||||
if having a variable number of arguments which fixed register assignments.
|
||||
|
||||
An example:
|
||||
|
||||
R33 <- 1
|
||||
R34 <- 2
|
||||
call
|
||||
|
||||
When the call instruction is processed, R33 is assigned to RDI, and R34 is
|
||||
assigned to RSI. Later, when the two assignment instructions are processed,
|
||||
R33 and R34 are already assigned to a hreg, so they are replaced with the
|
||||
associated hreg leading to the following final code:
|
||||
|
||||
RDI <- 1
|
||||
RSI <- 1
|
||||
call
|
||||
|
||||
Machine description files
|
||||
=========================
|
||||
|
||||
A typical entry in the machine description files looks like this:
|
||||
|
||||
shl: dest:i src1:i src2:s clob:1 len:2
|
||||
|
||||
The allocator is only interested in the dest,src1,src2 and clob fields.
|
||||
It understands the following values for the dest, src1, src2 fields:
|
||||
|
||||
i - integer register
|
||||
f - fp register
|
||||
b - base register (same as i, but the instruction does not modify the reg)
|
||||
m - fp register, even if an fp stack is used (no fp stack tracking)
|
||||
|
||||
It understands the following values for the clob field:
|
||||
|
||||
1 - sreg1 needs to be the same as dreg
|
||||
c - instruction clobbers the caller-save registers
|
||||
|
||||
Beside these values, an architecture can define additional values (like the 's'
|
||||
in the example). The allocator depends on a set of arch-specific macros to
|
||||
convert these values to information it needs during allocation.
|
||||
|
||||
Arch specific macros
|
||||
====================
|
||||
|
||||
These macros usually receive a value from the machine description file (like
|
||||
the 's' in the example). The examples below are for x86.
|
||||
|
||||
/*
|
||||
* A bitmask selecting the caller-save registers (these are used for local
|
||||
* allocation).
|
||||
*/
|
||||
#define MONO_ARCH_CALLEE_REGS X86_CALLEE_REGS
|
||||
|
||||
/*
|
||||
* A bitmask selecting the callee-saved registers (these are usually used for
|
||||
* global allocation).
|
||||
*/
|
||||
#define MONO_ARCH_CALLEE_SAVED_REGS X86_CALLER_REGS
|
||||
|
||||
/* Same for the floating point registers */
|
||||
#define MONO_ARCH_CALLEE_FREGS 0
|
||||
#define MONO_ARCH_CALLEE_SAVED_FREGS 0
|
||||
|
||||
/* Whenever the target uses a floating point stack */
|
||||
#define MONO_ARCH_USE_FPSTACK TRUE
|
||||
|
||||
/* The size of the floating point stack */
|
||||
#define MONO_ARCH_FPSTACK_SIZE 6
|
||||
|
||||
/*
|
||||
* Given a descriptor value from the machine description file, return the fixed
|
||||
* hard reg corresponding to that value.
|
||||
*/
|
||||
#define MONO_ARCH_INST_FIXED_REG(desc) ((desc == 's') ? X86_ECX : ((desc == 'a') ? X86_EAX : ((desc == 'd') ? X86_EDX : ((desc == 'y') ? X86_EAX : ((desc == 'l') ? X86_EAX : -1)))))
|
||||
|
||||
/*
|
||||
* A bitmask selecting the hregs which can be used for allocating sreg2 for
|
||||
* a given instruction.
|
||||
*/
|
||||
#define MONO_ARCH_INST_SREG2_MASK(ins) (((ins [MONO_INST_CLOB] == 'a') || (ins [MONO_INST_CLOB] == 'd')) ? (1 << X86_EDX) : 0)
|
||||
|
||||
/*
|
||||
* Given a descriptor value, return whenever it denotes a register pair.
|
||||
*/
|
||||
#define MONO_ARCH_INST_IS_REGPAIR(desc) (desc == 'l' || desc == 'L')
|
||||
|
||||
/*
|
||||
* Given a descriptor value, and the first register of a regpair, return a
|
||||
* bitmask selecting the hregs which can be used for allocating the second
|
||||
* register of the regpair.
|
||||
*/
|
||||
#define MONO_ARCH_INST_REGPAIR_REG2(desc,hreg1) (desc == 'l' ? X86_EDX : -1)
|
||||
@@ -1,18 +1,3 @@
|
||||
2005-04-25 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile (centum_tests): Add Mono.Security and
|
||||
System.Runtime.Remoting.
|
||||
* */Makefile: Replace $(RUNTIME) with $(RUNTIME) $(RUNTIME_FLAGS).
|
||||
|
||||
2005-04-21 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile (net_1_1_bootstrap_SUBDIRS): Add ilasm.
|
||||
|
||||
2005-03-14 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile (_boot_): New. Used to generalize the bootstrap to
|
||||
clean and install too.
|
||||
|
||||
2005-02-25 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile (centum_tests): New list of test subdirs that should
|
||||
|
||||
+7
-8
@@ -4,7 +4,7 @@ SUBDIRS := build jay mcs tools/resgen class mbas nunit20 ilasm tools tests error
|
||||
DIST_ONLY_SUBDIRS := gmcs
|
||||
|
||||
basic_SUBDIRS := jay mcs class
|
||||
net_1_1_bootstrap_SUBDIRS := jay mcs class ilasm tools
|
||||
net_1_1_bootstrap_SUBDIRS := jay mcs class tools
|
||||
net_2_0_bootstrap_SUBDIRS := class
|
||||
net_2_0_SUBDIRS := jay gmcs class nunit20 tests errors tools
|
||||
|
||||
@@ -14,9 +14,7 @@ centum_tests := \
|
||||
class/Cscompmgd \
|
||||
class/Microsoft.JScript \
|
||||
class/Mono.Posix \
|
||||
class/Mono.Security \
|
||||
class/System.Configuration.Install \
|
||||
class/System.Runtime.Remoting \
|
||||
class/System.Runtime.Serialization.Formatters.Soap \
|
||||
class/System.Web.Services \
|
||||
tests \
|
||||
@@ -25,6 +23,8 @@ centum_tests := \
|
||||
|
||||
default_centum_tests := \
|
||||
class/corlib \
|
||||
class/Mono.Security \
|
||||
class/System.Runtime.Remoting \
|
||||
$(centum_tests)
|
||||
|
||||
net_2_0_centum_tests := $(centum_tests)
|
||||
@@ -65,12 +65,11 @@ profiles-do--run-test:
|
||||
ret=:; $(foreach p,$(PROFILES), { $(MAKE) PROFILE=$(p) run-test || ret=false; }; ) $$ret
|
||||
|
||||
# Orchestrate the bootstrap here.
|
||||
_boot_ = all clean install
|
||||
$(_boot_:%=profile-do--net_2_0--%): profile-do--net_2_0--%: profile-do--net_2_0_bootstrap--%
|
||||
$(_boot_:%=profile-do--net_2_0_bootstrap--%): profile-do--net_2_0_bootstrap--%: profile-do--default--%
|
||||
$(_boot_:%=profile-do--default--%): profile-do--default--%: profile-do--net_1_1_bootstrap--%
|
||||
profile-do--net_2_0--all: profile-do--net_2_0_bootstrap--all
|
||||
profile-do--net_2_0_bootstrap--all: profile-do--default--all
|
||||
profile-do--default--all: profile-do--net_1_1_bootstrap--all
|
||||
ifeq (linux, $(PLATFORM))
|
||||
$(_boot_:%=profile-do--net_1_1_bootstrap--%): profile-do--net_1_1_bootstrap--%: profile-do--basic--%
|
||||
profile-do--net_1_1_bootstrap--all: profile-do--basic--all
|
||||
endif
|
||||
|
||||
testcorlib:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: AssemblyVersion("0.1")]
|
||||
[assembly: AssemblyVersion("1.1.3")]
|
||||
[assembly: AssemblyTitle ("Mono VB.NET Compiler")]
|
||||
[assembly: AssemblyDescription ("Mono VB.NET Compiler with Generics")]
|
||||
[assembly: AssemblyCopyright ("2001, 2002, 2003 Ximian, Inc.")]
|
||||
|
||||
@@ -1,435 +1,3 @@
|
||||
2005-04-10 Jambunathan K <[email protected]>
|
||||
|
||||
* First cut changes for suporting Binary Operators. All changes
|
||||
need to be refined and reviewed.
|
||||
|
||||
* expression.cs (Error_OperatorCannotBeAppliedToObjectOperands):
|
||||
(ResolveOperator): Commented out. The method is retained for later
|
||||
reference.
|
||||
|
||||
(ResolveVisualBasicOperator): New method that replaces
|
||||
ResolveOperator. The method takes care of VB.NET semantics for
|
||||
Operator Resolution.
|
||||
|
||||
(DoResolve): Replaced call to ResolveOperator with
|
||||
ResolveVisualBasicOperator.
|
||||
|
||||
(Emit, CheckShiftArguments): Updated to reflect VB.NET semantics
|
||||
|
||||
(HandleObjectOperands, CheckArguments, IsOperatorDefinedForType,
|
||||
ConvertOperatorToDefinedType, GetWiderOfTypes,
|
||||
DoOperandPromotions, IsArithmeticExpression,
|
||||
IsRelationalExpression, IsShiftExpression,
|
||||
IsShortCircuitedLogicalExpression, HelperMethod): New helper
|
||||
routines to support binary operator resolution.
|
||||
|
||||
* mb-parser.jay: Added support for exponentiation operator.
|
||||
|
||||
* typemanager.cs (relative_type_order): Added.
|
||||
(InitCoreTypes, InitCodeHelpers, InitVisualBasicHelperTypes,
|
||||
InitVisualBasicCodeHelpers): Added more helper methods to method
|
||||
cache.
|
||||
|
||||
|
||||
2005-04-09 Jambunathan K <[email protected]>
|
||||
|
||||
* convert.cs (ObjectTypeToPrimitiveTypes): Added. Converts an
|
||||
'Object' to a 'Primitive Type'.
|
||||
|
||||
(WideningAndNarrowingConversion): Inserted call to
|
||||
'ObjectTypeToPrimitiveTypes' to convert from 'Object' to a
|
||||
'Primitive Type'.
|
||||
|
||||
* typemanager.cs (InitVisualBasicCodeHelpers): Added helper
|
||||
methods that handles above conversions to the TypeManager's method
|
||||
cache.
|
||||
|
||||
2005-04-02 Jambunathan K <[email protected]>
|
||||
|
||||
* Makefile: Added '/r:Microsoft.VisualBasic.dll' to the compile
|
||||
command line.
|
||||
|
||||
* driver.cs (UnixParseOption, CSCParseOption): Added
|
||||
'/optioncompare:[text|binary]' command line option.
|
||||
|
||||
* rootcontext.cs (StringComparisonMode): Added. Keeps track of the
|
||||
'/optioncompare:' command line option.
|
||||
|
||||
* typemanager.cs (InitVisualBasicHelperTypes,
|
||||
InitVisualBasicCodeHelpers): New routines that preload frequently
|
||||
used types and helper methods available in
|
||||
Microsoft.Visualbasic.dll.
|
||||
|
||||
(IsFixedNumericType, IsFloatingNumericType,IsNumericType): New
|
||||
VB.NET specific helper routines. Added in anticipation of a future
|
||||
use.
|
||||
|
||||
* ecore.cs (HelperMethodInvocation): Added. Implements the same
|
||||
functionality as the earlier vaguely named class
|
||||
'ImplicitInvocation'. This class uses the 'type cache' of
|
||||
Microsoft.VisualBasic helper methods now available in the
|
||||
TypeManager.
|
||||
|
||||
* convert.cs (WideningConstantConversions): Reimplemented. The
|
||||
earlier implementation was completely topsy-turvy. Propagated the
|
||||
changes relating to the introduction of 'HelperMethodInvocation'.
|
||||
|
||||
* mb-parser.jay: Added rule and action for 'Like' expression.
|
||||
|
||||
* mb-tokenizer.cs (keywords): Cleaned up the extra space in the
|
||||
'let', 'lib' and 'like' entries.
|
||||
|
||||
2005-03-26 Jambunathan K <[email protected]>
|
||||
|
||||
* constant.cs: Added conversions between various constants
|
||||
* literal.cs: Added conversions from Nothing to various primitive constants
|
||||
|
||||
* convert.cs (NothingToPrimitiveConstants, WideningConstantconversions): Added
|
||||
|
||||
(TryWideningIntConversion): Removed C# specific constant
|
||||
conversions. This functionality is now taken care of by
|
||||
WideningConstantConversions.
|
||||
|
||||
(WideningReferenceConversion): Added support for conversions from Nothing to ValueTypes
|
||||
(WideningNumericConversion): Call WideningConstantConversions
|
||||
|
||||
* ecore.cs (NullCast.Emit): Conversion from Nothing to ValueType
|
||||
|
||||
|
||||
2005-03-26 Jambunathan K <[email protected]>
|
||||
|
||||
* ecore.cs (ImplicitInvocation): Set eclass and type to that of the child
|
||||
|
||||
* convert.cs (ImplicitVBConversion, ImplicitVBConversionRequired,
|
||||
ExplicitVBConversion): Added
|
||||
(WideningNumericConversion): Added support for converting an enum to
|
||||
it's underlying numeric type or any type that it's underlyinmg
|
||||
type has widening conversion to.
|
||||
|
||||
* assign.cs (DoAssign): Plugged in ImplicitVBConversionRequired.
|
||||
|
||||
2005-03-26 Jambunathan K <[email protected]>
|
||||
|
||||
* expression.cs (Binary.Operator): Added Exponentiation,
|
||||
Concatenation, Like, Is and IntegerDivision opeartors
|
||||
|
||||
* mb-parser.jay: Changes relating to the above changes.
|
||||
|
||||
2005-03-26 Jambunathan K <[email protected]>
|
||||
|
||||
* expression.cs (Binary.Operator): Renamed LogicalAnd/LogicalOr to
|
||||
LogicalAndAlso and LogicalOrElse.
|
||||
|
||||
* cfold.cs, gen-treedump.cs, generic.cs, mb-parser.jay: Changes
|
||||
related to the above renaming.
|
||||
|
||||
2005-03-25 Jambunathan K <[email protected]>
|
||||
|
||||
* constant.cs (DateConstant): Added (Borrowed from mbas)
|
||||
* literal.cs (DateLiteral): Added (Borrowed from mbas)
|
||||
* mb-parser.jay: Added support for Date type. (Borrowed from mbas)
|
||||
* typemanager.cs (void_datetime_ctor_ticks_arg): Added (Borrowed from mbas)
|
||||
* mb-tokenizer.cs (ParseDateLiteral, GobbleWhitespaces): Added afresh
|
||||
|
||||
2005-03-25 Jambunathan K <[email protected]>
|
||||
|
||||
* AssemblyInfo.cs: Set assembly version to 0.1
|
||||
|
||||
* literal.cs (NotDefinedAsPrimitiveType): New class. Unlike C#,
|
||||
VB.NET doesn't understand "signed byte", "unsigned short",
|
||||
"unsigned int" and "unsigned long" as primitive types. This class
|
||||
has been introduced just to "accomodate" this fact. Now we can
|
||||
retain most of the existing gmcs code that test against these
|
||||
types for doing language defined conversions.
|
||||
|
||||
* typemanager.cs (sbyte_type, short_type, uint32_type,uint64_type):
|
||||
Converted as static properties that return typeof(NotDefinedAsPrimitiveType).
|
||||
|
||||
The existing sbyte_type, short_type, uint32_type, uint64_type are
|
||||
renamed as _sbyte_type, _short_type, _uint32_type,
|
||||
_uint64_type. Their accessibility type is now private.
|
||||
|
||||
* convert.cs (NarrowingNumericConversion, WideningNumericConversion):
|
||||
Reverted original gmcs code that handle byte type and unsigned
|
||||
numeric types. Remember that all this code is a "nop" because
|
||||
of the introduction of NotDefinedAsPrimitiveType class.
|
||||
|
||||
|
||||
2005-03-23 Jambunathan K <[email protected]>
|
||||
* Merged with GMCS trunk 42056
|
||||
|
||||
2005-02-08 Raja R Harinath <[email protected]>
|
||||
|
||||
Fix #72015.
|
||||
* delegate.cs (Delegate.DefineType): When bootstrapping corlib, if
|
||||
TypeManager.multicast_delegate_type is null, resolve it by looking
|
||||
up "System.MulticastDelegate".
|
||||
* rootcontext.cs (RootContext.ResolveCore): Simplify.
|
||||
|
||||
2005-02-07 Abin Thomas (NOSIP) <[email protected]>
|
||||
Anoob V.E (NOSIP) <[email protected]>
|
||||
Harilal P.R (NOSIP) <[email protected]>
|
||||
|
||||
Fix cs0164.cs.
|
||||
* statement.cs (LabeledStatement.Resolve): Don't set 'referenced'.
|
||||
(LabeledStatement.AddReference): New. Set 'referenced'.
|
||||
(Goto.Resolve): Use it.
|
||||
|
||||
2005-02-05 John Luke <[email protected]>
|
||||
|
||||
* driver.cs: remove duplicate -doc line in Usage ()
|
||||
|
||||
2005-02-04 Raja R Harinath <[email protected]>
|
||||
|
||||
* location.cs (Location.AddFile): Fix CS2002 error report.
|
||||
|
||||
2005-02-02 Martin Baulig <[email protected]>
|
||||
|
||||
* delegate.cs (Delegate.DefineType): Report an internal error if
|
||||
TypeManager.multicast_delegate_type is null. See bug #72015 for
|
||||
details.
|
||||
|
||||
2005-02-02 Raja R Harinath <[email protected]>
|
||||
|
||||
Fix a crasher in a variant of #31984.
|
||||
* const.cs (Constant.CheckBase): New override that defers the
|
||||
new-or-override check in case the base type hasn't been populated
|
||||
yet.
|
||||
(Constant.Define): Ensure the new-or-override check is performed.
|
||||
|
||||
2005-02-01 Duncan Mak <[email protected]>
|
||||
|
||||
* const.cs (LookupConstantValue): Check that `ce' is not null
|
||||
before calling GetValue ().
|
||||
|
||||
2005-02-01 Raja R Harinath <[email protected]>
|
||||
|
||||
Fix test-334.cs (#69519).
|
||||
* cs-parser.jay (using_alias_directive): Pass in an expression to
|
||||
NamespaceEntry.UsingAlias.
|
||||
(using_namespace_directive): Pass in an expression to
|
||||
NamespaceEntry.Using.
|
||||
(namespace_name): Don't flatten to a string.
|
||||
* namespace.cs (NamespaceEntry.AliasEntry): Store an expression.
|
||||
(NamespaceEntry.AliasEntry.Resolve): Lookup using
|
||||
ResolveAsTypeStep.
|
||||
(NamespaceEntry.UsingEntry): Likewise.
|
||||
(NamespaceEntry.Using,NamespaceEntry.UsingAlias): Update to
|
||||
changes.
|
||||
(NamespaceEntry.LookupForUsing): Remove.
|
||||
(NamespaceEntry.LookupNamespaceOrType): Add support for dotted
|
||||
names.
|
||||
(NamespaceEntry.Lookup): Remove support for dotted names.
|
||||
|
||||
2005-02-01 Raja R Harinath <[email protected]>
|
||||
|
||||
* namespace.cs (NamespaceEntry.NamespaceEntry): Simplify, and
|
||||
split into two.
|
||||
(NamespaceEntry.ImplicitParent): Compute on demand.
|
||||
(NamespaceEntry.Doppelganger): New implicit namespace-entry that
|
||||
parallels the current.
|
||||
(NamespaceEntry.LookupForUsing): Use it.
|
||||
(NamespaceEntry.Lookup): If the current namespace-entry is
|
||||
implicit, don't search aliases and using tables.
|
||||
|
||||
2005-02-01 Raja R Harinath <[email protected]>
|
||||
|
||||
Fix #31984.
|
||||
* class.cs (TypeContainer.DoDefineMembers): Don't initialize
|
||||
BaseCache here.
|
||||
(TypeContainer.BaseCache): Compute on demand.
|
||||
(TypeContainer.FindMembers): Define constants and types if they're
|
||||
not already created.
|
||||
(FieldMember.Define): Move resetting of ec.InUnsafe before error
|
||||
check.
|
||||
* const.cs (Constant.Define): Make idempotent.
|
||||
|
||||
2005-01-29 Miguel de Icaza <[email protected]>
|
||||
|
||||
* pending.cs: Produce better code (no nops produced by using Ldarg
|
||||
+ value).
|
||||
|
||||
* pending.cs (PendingImplementation.DefineProxy): It was not `arg
|
||||
i - 1' it should be arg + 1.
|
||||
|
||||
Fixes bug #71819.
|
||||
|
||||
2005-01-28 Raja R Harinath <[email protected]>
|
||||
|
||||
* attribute.cs (Attribute.CheckAttributeType): Make private
|
||||
non-virtual.
|
||||
(Attribute.ResolveType): Make virtual.
|
||||
(GlobalAttribute.ResolveType,GlobalAttribute.Resolve): Simplify
|
||||
handling of RootContext.Tree.Types.
|
||||
|
||||
2005-01-27 Raja R Harinath <[email protected]>
|
||||
|
||||
Update attribute-handling to use the SimpleName/MemberAccess
|
||||
mechanisms.
|
||||
* cs-parser.jay (attribute): Pass in an expression to the
|
||||
constructors of Attribute and GlobalAttribute.
|
||||
* attribute.cs (Attribute): Take an expression for the name.
|
||||
(Attribute.ResolvePossibleAttributeTypes): New. Resolves the
|
||||
passed in attribute name expression.
|
||||
(Attribute.CheckAttributeType): Use it.
|
||||
* ecore.cs (FullNamedExpression.ResolveAsTypeStep): New.
|
||||
* expression.cs (MemberAccess.ResolveAsTypeStep): Move body to ...
|
||||
(MemberAccess.ResolveNamespaceOrType): ... here. Add 'silent'
|
||||
argument to prevent error messages if the lookup fails.
|
||||
|
||||
2005-01-27 Marek Safar <[email protected]>
|
||||
|
||||
* expression.cs (Indirection): Implemented IVariable interface
|
||||
to support indirection in AddressOf operator.
|
||||
(PointerArithmetic.Emit): Add optimalization for case where
|
||||
result can be precomputed.
|
||||
|
||||
2005-01-26 Martin Baulig <[email protected]>
|
||||
|
||||
* class.cs (TypeContainer.AttributeTargets): Return the correct
|
||||
AttributeTargets depending on our `Kind' instead of throwing an
|
||||
exception; fixes #71632.
|
||||
|
||||
2005-01-26 Marek Safar <[email protected]>
|
||||
|
||||
Fix #71257
|
||||
* expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
|
||||
constant members.
|
||||
|
||||
2005-03-17 Martin Baulig <[email protected]>
|
||||
|
||||
* anonymous.cs (AnonymousMethod.method_modifiers): Change default
|
||||
from `Modifiers.INTERNAL' to `Modifiers.PRIVATE'. Fixes #73260.
|
||||
|
||||
2005-03-17 Martin Baulig <[email protected]>
|
||||
|
||||
* anonymous.cs (AnonymousMethod.EmitMethod): Changed return type
|
||||
to bool so we can return an error condition.
|
||||
(AnonymousDelegate.Emit): Check whether AnonymousMethod.EmitMethod()
|
||||
returned an error.
|
||||
|
||||
2005-03-17 Martin Baulig <[email protected]>
|
||||
|
||||
* generic.cs (TypeMananager.IsIEnumerable): New public method.
|
||||
|
||||
* convert.cs (Convert.ImplicitReferenceConversion(Exists)): Allow
|
||||
converting from an array-type of T to `IEnumerable<T>'.
|
||||
|
||||
2005-03-16 Martin Baulig <[email protected]>
|
||||
|
||||
* generic.cs (Nullable.Unwrap): Implement IAssignMethod.
|
||||
(Nullable.LiftedUnaryMutator): New public class.
|
||||
|
||||
* expression.cs (UnaryMutator.DoResolve): Added support for
|
||||
Nullable Types.
|
||||
|
||||
2005-03-14 Martin Baulig <[email protected]>
|
||||
|
||||
* generic.cs (Nullable.NullCoalescingOperator): Implemented.
|
||||
|
||||
2005-03-14 Martin Baulig <[email protected]>
|
||||
|
||||
* generic.cs (Nullable.LiftedBinaryOperator): Added support for
|
||||
the comparision operators `<', `>', `<=' and `>='.
|
||||
|
||||
2005-03-13 Martin Baulig <[email protected]>
|
||||
|
||||
* generic.cs
|
||||
(Nullable.NullLiteral): Renamed to `Nullable.NullableLiteral' to
|
||||
avoid confusion with the `NullLiteral'.
|
||||
(Nullable.LiftedBinaryOperator): Correctly implement `==' and '!='.
|
||||
|
||||
2005-03-13 Martin Baulig <[email protected]>
|
||||
|
||||
* expression.cs (Binary.ResolveOperator): For `==' and `!=', allow
|
||||
comparing arbitrary types with the null literal.
|
||||
|
||||
2005-03-13 Martin Baulig <[email protected]>
|
||||
|
||||
* generic.cs (Nullable.LiftedBinaryOperator): Add support for the
|
||||
boolean operators '&&', '||', '&' and '|'.
|
||||
(Nullable.OperatorTrueOrFalse): New public class.
|
||||
|
||||
* ecore.cs (Expression.GetOperatorTrue/False): Return an `Expression'
|
||||
instead of a `StaticCallExpr'; added support for nullables.
|
||||
|
||||
2005-03-10 Martin Baulig <[email protected]>
|
||||
|
||||
* expression.cs
|
||||
(ArrayAccess.EmitDynamicInitializers): Use `etype.IsValueType'
|
||||
rather than `etype.IsSubclassOf (TypeManager.value_type)'.
|
||||
|
||||
2005-03-07 Martin Baulig <[email protected]>
|
||||
|
||||
* generic.cs (Nullable.Unwrap): Implement IMemoryLocation and make
|
||||
it work if `expr' is not an IMemoryLocation.
|
||||
(Nullable.Lifted): Implement IMemoryLocation.
|
||||
(Nullable.LiftedConversion.ResolveUnderlying): Use the correct
|
||||
target type.
|
||||
|
||||
2005-03-05 Martin Baulig <[email protected]>
|
||||
|
||||
* generic.cs (Nullable.Unwrap, Wrap): New protected classes.
|
||||
(Nullable.Lifted): New abstract class; rewrote the lifted conversions.
|
||||
(Nullable): Added support for lifted unary and binary operators.
|
||||
|
||||
* expression.cs (Unary.DoResolve): Added support for nullable types.
|
||||
(Binary.DoResolve): Likewise.
|
||||
(Conditional.DoResolve): Likewise.
|
||||
|
||||
2005-03-02 Martin Baulig <[email protected]>
|
||||
|
||||
* decl.cs (DeclSpace.SetParameterInfo): Make this virtual.
|
||||
|
||||
* class.cs (ClassPart.SetParameterInfo): Override this.
|
||||
(PartialContainer.SetParameterInfo): Override this.
|
||||
(TypeContainer.CheckConstraints): New protected method.
|
||||
(PartialContainer.CheckConstraints): Override this and check
|
||||
whether the same contraints were specified in all parts of a
|
||||
partial generic type definition.
|
||||
(PartialContainer.UpdateConstraints): New public method.
|
||||
|
||||
* generic.cs (TypeParameter.UpdateConstraints): New public method.
|
||||
|
||||
2005-03-02 Martin Baulig <[email protected]>
|
||||
|
||||
Committing a patch from Carlos Alberto Cortez to fix #72887.
|
||||
|
||||
* convert.cs (Convert.ExplicitReferenceConversionExists): Allow
|
||||
casts from `T []' to `int []'.
|
||||
|
||||
2005-03-02 Martin Baulig <[email protected]>
|
||||
|
||||
* generic.cs (TypeManager.IsEqual): Make this symmetric.
|
||||
|
||||
* expression.cs (Binary.ResolveOperator): When resolving a
|
||||
BinaryDelegate, use `TypeManager.IsEqual (l, r)' rather than just
|
||||
`=='. Fixes #71866. See gen-127.cs.
|
||||
|
||||
2005-03-02 Martin Baulig <[email protected]>
|
||||
|
||||
* class.cs (TypeContainer.DoDefineMembers): We also need a default
|
||||
static constructor in static classes.
|
||||
|
||||
2005-03-02 Martin Baulig <[email protected]>
|
||||
|
||||
* generic.cs
|
||||
(NullableType.Name, NullableType.FullName): Add a "?" to the name.
|
||||
(Nullable.LiftedConversion): Added support for user-defined
|
||||
conversions.
|
||||
|
||||
* cs-tokenizer.cs (Tokenizer.PutbackCloseParens): New public method.
|
||||
|
||||
* cs-parser.jay: Use ComposedCast everywhere instead of
|
||||
NullableType, so we don't need to check for NullableType
|
||||
everywhere.
|
||||
(conditional_expression): Added `INTERR CLOSE_PARENS' rule for the
|
||||
case where we'll be resolved into a `parenthesized_expression_0'
|
||||
afterwards.
|
||||
|
||||
* convert.cs
|
||||
(Convert.UserDefinedConversion): Added nullable conversions.
|
||||
|
||||
2005-02-28 Martin Baulig <[email protected]>
|
||||
|
||||
* generic.cs (TypeManager.IsNullableType): New static method.
|
||||
|
||||
+11
-4
@@ -10,7 +10,7 @@ include ../build/rules.make
|
||||
#uncomment to enable some debug stuff
|
||||
#DEBUG_FLAGS=/define:MCS_DEBUG
|
||||
|
||||
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/net_2_0_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/net_2_0_bootstrap/mcs.exe $(DEBUG_FLAGS)
|
||||
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/net_2_0_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(topdir)/class/lib/net_2_0_bootstrap/mcs.exe $(DEBUG_FLAGS)
|
||||
|
||||
BUILT_SOURCES = mb-parser.cs
|
||||
|
||||
@@ -28,10 +28,17 @@ mb-parser.cs: mb-parser.jay $(topdir)/jay/skeleton.cs
|
||||
include ../build/executable.make
|
||||
|
||||
bmcs.exe: mb-parser.cs
|
||||
gmcs -d:NET_1_1 -d:ONLY_1_1 -debug /target:exe /out:bmcs.exe /r:Microsoft.VisualBasic.dll mb-parser.cs @bmcs.exe.sources -nowarn:219 -nowarn:162
|
||||
gmcs -d:NET_1_1 -d:ONLY_1_1 -debug /target:exe /out:bmcs.exe mb-parser.cs @bmcs.exe.sources -nowarn:219 -nowarn:162
|
||||
|
||||
install-as-mbas: all
|
||||
cp ../class/lib/default/bmcs.exe $(prefix)/lib/mono/1.0/mbas.exe
|
||||
|
||||
winstall: all
|
||||
cp bmcs.exe $(prefix)/lib/mono/2.0/
|
||||
cp ../class/lib/default/bmcs.exe /cygdrive/c/WINDOWS/Microsoft.NET/Framework/v1.1.4322/
|
||||
|
||||
winstall-as-mbas: all
|
||||
cp ../class/lib/default/bmcs.exe /cygdrive/c/WINDOWS/Microsoft.NET/Framework/v1.1.4322/
|
||||
cp ../class/lib/default/bmcs.exe /cygdrive/c/WINDOWS/Microsoft.NET/Framework/v1.1.4322/mbas.exe
|
||||
|
||||
diffus:
|
||||
diff --exclude='.svn' --exclude='*-parser.*' --exclude='*-tokenizer.cs' -ruN ../gmcs ../bmcs
|
||||
diff --exclude='.svn' --exclude='*-parser.*' --exclude='*-tokenizer.cs' -ruN ../gmcs ../bmcs
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
* This is BMCS
|
||||
|
||||
Last merge to GMCS: 42056
|
||||
Last merge to GMCS: 41320
|
||||
|
||||
BMCS is a new fork of the generics compiler from revision
|
||||
38733 (11th of January 2005).
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Mono.CSharp {
|
||||
//
|
||||
// The modifiers applied to the method, we aggregate them
|
||||
//
|
||||
int method_modifiers = Modifiers.PRIVATE;
|
||||
int method_modifiers = Modifiers.INTERNAL;
|
||||
|
||||
//
|
||||
// During the resolve stage of the anonymous method body,
|
||||
@@ -293,10 +293,10 @@ namespace Mono.CSharp {
|
||||
return method.MethodData.MethodBuilder;
|
||||
}
|
||||
|
||||
public bool EmitMethod (EmitContext ec)
|
||||
public void EmitMethod (EmitContext ec)
|
||||
{
|
||||
if (!CreateMethodHost (ec, invoke_mb.ReturnType))
|
||||
return false;
|
||||
return;
|
||||
|
||||
MethodBuilder builder = GetMethodBuilder ();
|
||||
ILGenerator ig = builder.GetILGenerator ();
|
||||
@@ -313,7 +313,6 @@ namespace Mono.CSharp {
|
||||
|
||||
aec.EmitMeta (Block, amp);
|
||||
aec.EmitResolvedTopBlock (Block, unreachable);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void Error_AddressOfCapturedVar (string name, Location loc)
|
||||
@@ -339,14 +338,12 @@ namespace Mono.CSharp {
|
||||
public override Expression DoResolve (EmitContext ec)
|
||||
{
|
||||
eclass = ExprClass.Value;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
if (!am.EmitMethod (ec))
|
||||
return;
|
||||
am.EmitMethod (ec);
|
||||
|
||||
//
|
||||
// Now emit the delegate creation.
|
||||
|
||||
+1
-1
@@ -475,7 +475,7 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
source = Convert.ImplicitVBConversionRequired (ec, source, target_type, loc);
|
||||
source = Convert.WideningConversionRequired (ec, source, target_type, loc);
|
||||
if (source == null)
|
||||
return null;
|
||||
|
||||
|
||||
+45
-67
@@ -72,9 +72,6 @@ namespace Mono.CSharp {
|
||||
public AttributeTargets Target;
|
||||
|
||||
public readonly string Name;
|
||||
public readonly Expression LeftExpr;
|
||||
public readonly string Identifier;
|
||||
|
||||
public readonly ArrayList Arguments;
|
||||
|
||||
public readonly Location Location;
|
||||
@@ -105,11 +102,9 @@ namespace Mono.CSharp {
|
||||
|
||||
static PtrHashtable usage_attr_cache = new PtrHashtable ();
|
||||
|
||||
public Attribute (string target, Expression left_expr, string identifier, ArrayList args, Location loc)
|
||||
public Attribute (string target, string name, ArrayList args, Location loc)
|
||||
{
|
||||
LeftExpr = left_expr;
|
||||
Identifier = identifier;
|
||||
Name = LeftExpr == null ? identifier : LeftExpr + "." + identifier;
|
||||
Name = name;
|
||||
Arguments = args;
|
||||
Location = loc;
|
||||
ExplicitTarget = target;
|
||||
@@ -119,7 +114,7 @@ namespace Mono.CSharp {
|
||||
{
|
||||
Report.Error (617, Location, "Invalid attribute argument: '{0}'. Argument must be fields " +
|
||||
"fields which are not readonly, static or const; or read-write instance properties.",
|
||||
name);
|
||||
Name);
|
||||
}
|
||||
|
||||
static void Error_AttributeArgumentNotValid (string extra, Location loc)
|
||||
@@ -160,49 +155,26 @@ namespace Mono.CSharp {
|
||||
"Could not find a constructor for this argument list.");
|
||||
}
|
||||
|
||||
void ResolvePossibleAttributeTypes (EmitContext ec, out Type t1, out Type t2)
|
||||
{
|
||||
t1 = null;
|
||||
t2 = null;
|
||||
|
||||
FullNamedExpression n1 = null;
|
||||
FullNamedExpression n2 = null;
|
||||
string IdentifierAttribute = Identifier + "Attribute";
|
||||
if (LeftExpr == null) {
|
||||
n1 = new SimpleName (Identifier, Location).ResolveAsTypeStep (ec);
|
||||
|
||||
// FIXME: Shouldn't do this for quoted attributes: [@A]
|
||||
n2 = new SimpleName (IdentifierAttribute, Location).ResolveAsTypeStep (ec);
|
||||
} else {
|
||||
FullNamedExpression l = LeftExpr.ResolveAsTypeStep (ec);
|
||||
if (l == null) {
|
||||
Report.Error (246, Location, "Couldn't find namespace or type '{0}'", LeftExpr);
|
||||
return;
|
||||
}
|
||||
n1 = new MemberAccess (l, Identifier, Location).ResolveNamespaceOrType (ec, true);
|
||||
|
||||
// FIXME: Shouldn't do this for quoted attributes: [X.@A]
|
||||
n2 = new MemberAccess (l, IdentifierAttribute, Location).ResolveNamespaceOrType (ec, true);
|
||||
}
|
||||
|
||||
TypeExpr te1 = n1 == null ? null : n1 as TypeExpr;
|
||||
TypeExpr te2 = n2 == null ? null : n2 as TypeExpr;
|
||||
|
||||
if (te1 != null)
|
||||
t1 = te1.ResolveType (ec);
|
||||
if (te2 != null)
|
||||
t2 = te2.ResolveType (ec);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to resolve the type of the attribute. Flags an error if it can't, and complain is true.
|
||||
/// </summary>
|
||||
Type CheckAttributeType (EmitContext ec)
|
||||
protected virtual Type CheckAttributeType (EmitContext ec)
|
||||
{
|
||||
Type t1, t2;
|
||||
ResolvePossibleAttributeTypes (ec, out t1, out t2);
|
||||
|
||||
string NameAttribute = Name + "Attribute";
|
||||
FullNamedExpression n1 = ec.ResolvingTypeTree
|
||||
? ec.DeclSpace.FindType (Location, Name)
|
||||
: ec.DeclSpace.LookupType (Name, true, Location);
|
||||
|
||||
// FIXME: Shouldn't do this for quoted attributes: [@A]
|
||||
FullNamedExpression n2 = ec.ResolvingTypeTree
|
||||
? ec.DeclSpace.FindType (Location, NameAttribute)
|
||||
: ec.DeclSpace.LookupType (NameAttribute, true, Location);
|
||||
|
||||
TypeExpr e1 = n1 == null ? null : n1 as TypeExpr;
|
||||
TypeExpr e2 = n2 == null ? null : n2 as TypeExpr;
|
||||
|
||||
Type t1 = e1 == null ? null : e1.ResolveType (ec);
|
||||
Type t2 = e2 == null ? null : e2.ResolveType (ec);
|
||||
|
||||
String err0616 = null;
|
||||
if (t1 != null && ! t1.IsSubclassOf (TypeManager.attribute_type)) {
|
||||
@@ -238,7 +210,7 @@ namespace Mono.CSharp {
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual Type ResolveType (EmitContext ec)
|
||||
public Type ResolveType (EmitContext ec)
|
||||
{
|
||||
if (Type == null)
|
||||
Type = CheckAttributeType (ec);
|
||||
@@ -1231,46 +1203,52 @@ namespace Mono.CSharp {
|
||||
{
|
||||
public readonly NamespaceEntry ns;
|
||||
|
||||
public GlobalAttribute (TypeContainer container, string target,
|
||||
Expression left_expr, string identifier, ArrayList args, Location loc):
|
||||
base (target, left_expr, identifier, args, loc)
|
||||
public GlobalAttribute (TypeContainer container, string target, string name, ArrayList args, Location loc):
|
||||
base (target, name, args, loc)
|
||||
{
|
||||
ns = container.NamespaceEntry;
|
||||
}
|
||||
|
||||
void Enter ()
|
||||
protected override Type CheckAttributeType (EmitContext ec)
|
||||
{
|
||||
// RootContext.Tree.Types has a single NamespaceEntry which gets overwritten
|
||||
// each time a new file is parsed. However, we need to use the NamespaceEntry
|
||||
// in effect where the attribute was used. Since code elsewhere cannot assume
|
||||
// that the NamespaceEntry is right, just overwrite it.
|
||||
//
|
||||
// Precondition: RootContext.Tree.Types == null
|
||||
// Precondition: RootContext.Tree.Types == null || RootContext.Tree.Types == ns.
|
||||
// The second case happens when we are recursively invoked from inside Emit.
|
||||
|
||||
if (RootContext.Tree.Types.NamespaceEntry != null)
|
||||
throw new InternalErrorException (Location + " non-null NamespaceEntry");
|
||||
NamespaceEntry old = null;
|
||||
if (ec.DeclSpace == RootContext.Tree.Types) {
|
||||
old = ec.DeclSpace.NamespaceEntry;
|
||||
ec.DeclSpace.NamespaceEntry = ns;
|
||||
if (old != null && old != ns)
|
||||
throw new InternalErrorException (Location + " non-null NamespaceEntry " + old);
|
||||
}
|
||||
|
||||
RootContext.Tree.Types.NamespaceEntry = ns;
|
||||
}
|
||||
Type retval = base.CheckAttributeType (ec);
|
||||
|
||||
void Leave ()
|
||||
{
|
||||
RootContext.Tree.Types.NamespaceEntry = null;
|
||||
}
|
||||
if (ec.DeclSpace == RootContext.Tree.Types)
|
||||
ec.DeclSpace.NamespaceEntry = old;
|
||||
|
||||
public override Type ResolveType (EmitContext ec)
|
||||
{
|
||||
Enter ();
|
||||
Type retval = base.ResolveType (ec);
|
||||
Leave ();
|
||||
return retval;
|
||||
}
|
||||
|
||||
public override CustomAttributeBuilder Resolve (EmitContext ec)
|
||||
{
|
||||
Enter ();
|
||||
if (ec.DeclSpace == RootContext.Tree.Types) {
|
||||
NamespaceEntry old = ec.DeclSpace.NamespaceEntry;
|
||||
ec.DeclSpace.NamespaceEntry = ns;
|
||||
if (old != null)
|
||||
throw new InternalErrorException (Location + " non-null NamespaceEntry " + old);
|
||||
}
|
||||
|
||||
CustomAttributeBuilder retval = base.Resolve (ec);
|
||||
Leave ();
|
||||
|
||||
if (ec.DeclSpace == RootContext.Tree.Types)
|
||||
ec.DeclSpace.NamespaceEntry = null;
|
||||
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -999,7 +999,7 @@ namespace Mono.CSharp {
|
||||
Binary.Error_OperatorCannotBeApplied (loc, ">>", lt, rt);
|
||||
break;
|
||||
|
||||
case Binary.Operator.LogicalAndAlso:
|
||||
case Binary.Operator.LogicalAnd:
|
||||
if (left is BoolConstant && right is BoolConstant){
|
||||
return new BoolConstant (
|
||||
((BoolConstant) left).Value &&
|
||||
@@ -1007,7 +1007,7 @@ namespace Mono.CSharp {
|
||||
}
|
||||
break;
|
||||
|
||||
case Binary.Operator.LogicalOrElse:
|
||||
case Binary.Operator.LogicalOr:
|
||||
if (left is BoolConstant && right is BoolConstant){
|
||||
return new BoolConstant (
|
||||
((BoolConstant) left).Value ||
|
||||
|
||||
+18
-134
@@ -1254,18 +1254,14 @@ namespace Mono.CSharp {
|
||||
CurrentTypeParameters [i - offset].DefineConstraints ();
|
||||
|
||||
current_type = new ConstructedType (Name, TypeParameters, Location);
|
||||
}
|
||||
|
||||
foreach (TypeParameter type_param in TypeParameters) {
|
||||
if (IsGeneric) {
|
||||
foreach (TypeParameter type_param in TypeParameters)
|
||||
if (!type_param.DefineType (ec)) {
|
||||
error = true;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!CheckConstraints (ec)) {
|
||||
error = true;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if ((Kind == Kind.Struct) && TypeManager.value_type == null)
|
||||
@@ -1381,11 +1377,6 @@ namespace Mono.CSharp {
|
||||
return TypeBuilder;
|
||||
}
|
||||
|
||||
protected virtual bool CheckConstraints (EmitContext ec)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual bool DefineNestedTypes ()
|
||||
{
|
||||
if (Interfaces != null) {
|
||||
@@ -1470,6 +1461,15 @@ namespace Mono.CSharp {
|
||||
|
||||
protected virtual bool DoDefineMembers ()
|
||||
{
|
||||
//
|
||||
// We need to be able to use the member cache while we are checking/defining
|
||||
//
|
||||
if (TypeBuilder.BaseType != null)
|
||||
base_cache = TypeManager.LookupMemberCache (TypeBuilder.BaseType);
|
||||
|
||||
if (TypeBuilder.IsInterface)
|
||||
base_cache = TypeManager.LookupBaseInterfacesCache (TypeBuilder);
|
||||
|
||||
if (IsTopLevel) {
|
||||
if ((ModFlags & Modifiers.NEW) != 0)
|
||||
Error_KeywordNotAllowed (Location);
|
||||
@@ -1497,7 +1497,7 @@ namespace Mono.CSharp {
|
||||
DefineContainerMembers (constants);
|
||||
DefineContainerMembers (fields);
|
||||
|
||||
if ((Kind == Kind.Class) && !(this is ClassPart)){
|
||||
if ((Kind == Kind.Class) && !(this is ClassPart) && !(this is StaticClass)){
|
||||
if ((instance_constructors == null) &&
|
||||
!(this is StaticClass)) {
|
||||
if (default_constructor == null)
|
||||
@@ -1790,10 +1790,6 @@ namespace Mono.CSharp {
|
||||
continue;
|
||||
|
||||
FieldBuilder fb = con.FieldBuilder;
|
||||
if (fb == null) {
|
||||
if (con.Define ())
|
||||
fb = con.FieldBuilder;
|
||||
}
|
||||
if (fb != null && filter (fb, criteria) == true) {
|
||||
if (members == null)
|
||||
members = new ArrayList ();
|
||||
@@ -1981,9 +1977,6 @@ namespace Mono.CSharp {
|
||||
continue;
|
||||
|
||||
TypeBuilder tb = t.TypeBuilder;
|
||||
if (tb == null)
|
||||
tb = t.DefineType ();
|
||||
|
||||
if (tb != null && (filter (tb, criteria) == true)) {
|
||||
if (members == null)
|
||||
members = new ArrayList ();
|
||||
@@ -2586,12 +2579,6 @@ namespace Mono.CSharp {
|
||||
|
||||
public virtual MemberCache BaseCache {
|
||||
get {
|
||||
if (base_cache != null)
|
||||
return base_cache;
|
||||
if (TypeBuilder.BaseType != null)
|
||||
base_cache = TypeManager.LookupMemberCache (TypeBuilder.BaseType);
|
||||
if (TypeBuilder.IsInterface)
|
||||
base_cache = TypeManager.LookupBaseInterfacesCache (TypeBuilder);
|
||||
return base_cache;
|
||||
}
|
||||
}
|
||||
@@ -2642,30 +2629,6 @@ namespace Mono.CSharp {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (pc.IsGeneric) {
|
||||
if (pc.CountTypeParameters != member_name.CountTypeArguments) {
|
||||
Report.Error (
|
||||
264, loc, "Partial declarations of `{0}' " +
|
||||
"must have the same type parameter names in " +
|
||||
"the same order", member_name.GetTypeName ());
|
||||
return null;
|
||||
}
|
||||
|
||||
string[] pc_names = pc.MemberName.TypeArguments.GetDeclarations ();
|
||||
string[] names = member_name.TypeArguments.GetDeclarations ();
|
||||
|
||||
for (int i = 0; i < pc.CountTypeParameters; i++) {
|
||||
if (pc_names [i] == names [i])
|
||||
continue;
|
||||
|
||||
Report.Error (
|
||||
264, loc, "Partial declarations of `{0}' " +
|
||||
"must have the same type parameter names in " +
|
||||
"the same order", member_name.GetTypeName ());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return pc;
|
||||
}
|
||||
|
||||
@@ -2673,8 +2636,6 @@ namespace Mono.CSharp {
|
||||
RootContext.Tree.RecordDecl (full_name, pc);
|
||||
parent.AddType (pc);
|
||||
pc.Register ();
|
||||
// This is needed to define our type parameters; we define the constraints later.
|
||||
pc.SetParameterInfo (null);
|
||||
return pc;
|
||||
}
|
||||
|
||||
@@ -2745,78 +2706,6 @@ namespace Mono.CSharp {
|
||||
return PendingImplementation.GetPendingImplementations (this);
|
||||
}
|
||||
|
||||
ArrayList constraints_lists;
|
||||
|
||||
public void UpdateConstraints (ArrayList constraints_list)
|
||||
{
|
||||
//
|
||||
// This is called for each ClassPart in a partial generic type declaration.
|
||||
//
|
||||
// If no constraints were specified for the part, just return.
|
||||
// Otherwise, if we're called with constraints for the first time, they become
|
||||
// the type's constraint. If we're called with constraints again, we just
|
||||
// store them somewhere so we can later check whether there are no conflicts.
|
||||
//
|
||||
if (constraints_list == null)
|
||||
return;
|
||||
|
||||
if (constraints_lists != null) {
|
||||
constraints_lists.Add (constraints_list);
|
||||
return;
|
||||
}
|
||||
|
||||
DoUpdateConstraints (null, constraints_list, false);
|
||||
|
||||
constraints_lists = new ArrayList ();
|
||||
}
|
||||
|
||||
protected bool DoUpdateConstraints (EmitContext ec, ArrayList constraints_list, bool check)
|
||||
{
|
||||
for (int i = 0; i < TypeParameters.Length; i++) {
|
||||
string name = TypeParameters [i].Name;
|
||||
|
||||
Constraints constraints = null;
|
||||
if (constraints_list != null) {
|
||||
foreach (Constraints constraint in constraints_list) {
|
||||
if (constraint.TypeParameter == name) {
|
||||
constraints = constraint;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!TypeParameters [i].UpdateConstraints (ec, constraints, check)) {
|
||||
Report.Error (265, Location, "Partial declarations of `{0}' have " +
|
||||
"inconsistent constraints for type parameter `{1}'.",
|
||||
MemberName.GetTypeName (), name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool CheckConstraints (EmitContext ec)
|
||||
{
|
||||
if (constraints_lists == null)
|
||||
return true;
|
||||
|
||||
//
|
||||
// If constraints were specified in more than one part of a
|
||||
// partial generic type definition, they must be identical.
|
||||
//
|
||||
// Note that we must resolve them and then compute the fully
|
||||
// resolved types since different parts may have different
|
||||
// `using' aliases. See gen-129.cs for an example.
|
||||
|
||||
foreach (ArrayList constraints_list in constraints_lists) {
|
||||
if (!DoUpdateConstraints (ec, constraints_list, true))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public ClassPart AddPart (NamespaceEntry ns, int mod, Attributes attrs,
|
||||
Location l)
|
||||
{
|
||||
@@ -2869,11 +2758,6 @@ namespace Mono.CSharp {
|
||||
interface_type, full, name, loc);
|
||||
}
|
||||
|
||||
public override void SetParameterInfo (ArrayList constraints_list)
|
||||
{
|
||||
PartialContainer.UpdateConstraints (constraints_list);
|
||||
}
|
||||
|
||||
public override MemberCache BaseCache {
|
||||
get {
|
||||
return PartialContainer.BaseCache;
|
||||
@@ -5665,9 +5549,9 @@ namespace Mono.CSharp {
|
||||
}
|
||||
|
||||
if ((ModFlags & (Modifiers.NEW | Modifiers.OVERRIDE)) == 0) {
|
||||
Report.SymbolRelatedToPreviousError (conflict_symbol);
|
||||
Report.Warning (108, Location, "The keyword new is required on '{0}' because it hides inherited member", GetSignatureForError (Parent));
|
||||
}
|
||||
Report.SymbolRelatedToPreviousError (conflict_symbol);
|
||||
Report.Warning (108, Location, "The keyword new is required on '{0}' because it hides inherited member", GetSignatureForError (Parent));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -5766,13 +5650,13 @@ namespace Mono.CSharp {
|
||||
|
||||
MemberType = texpr.Type;
|
||||
|
||||
ec.InUnsafe = old_unsafe;
|
||||
|
||||
if (MemberType == TypeManager.void_type) {
|
||||
Report.Error (1547, Location, "Keyword 'void' cannot be used in this context");
|
||||
return false;
|
||||
}
|
||||
|
||||
ec.InUnsafe = old_unsafe;
|
||||
|
||||
if (!CheckBase ())
|
||||
return false;
|
||||
|
||||
|
||||
+1
-17
@@ -62,25 +62,11 @@ namespace Mono.CSharp {
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override bool CheckBase ()
|
||||
{
|
||||
// Constant.Define can be called when the parent type hasn't yet been populated
|
||||
// and it's base types need not have been populated. So, we defer this check
|
||||
// to the second time Define () is called on this member.
|
||||
if (Parent.BaseCache == null)
|
||||
return true;
|
||||
return base.CheckBase ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the constant in the @parent
|
||||
/// </summary>
|
||||
public override bool Define ()
|
||||
{
|
||||
// Make Define () idempotent, but ensure that the error check happens.
|
||||
if (FieldBuilder != null)
|
||||
return base.CheckBase ();
|
||||
|
||||
if (!base.Define ())
|
||||
return false;
|
||||
|
||||
@@ -262,9 +248,7 @@ namespace Mono.CSharp {
|
||||
}
|
||||
Expr = ce;
|
||||
}
|
||||
|
||||
if (ce != null)
|
||||
ConstantValue = ce.GetValue ();
|
||||
ConstantValue = ce.GetValue ();
|
||||
|
||||
if (MemberType.IsEnum){
|
||||
//
|
||||
|
||||
+56
-454
@@ -127,66 +127,6 @@ namespace Mono.CSharp {
|
||||
return c;
|
||||
}
|
||||
|
||||
public ShortConstant ToShort (Location loc)
|
||||
{
|
||||
ShortConstant c = ConvertToShort ();
|
||||
|
||||
if (c == null)
|
||||
Convert.Error_CannotConvertType (loc, Type, TypeManager.short_type);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
public ByteConstant ToByte (Location loc)
|
||||
{
|
||||
ByteConstant c = ConvertToByte ();
|
||||
|
||||
if (c == null)
|
||||
Convert.Error_CannotConvertType (loc, Type, TypeManager.byte_type);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
public BoolConstant ToBoolean (Location loc)
|
||||
{
|
||||
BoolConstant c = ConvertToBoolean ();
|
||||
|
||||
if (c == null)
|
||||
Convert.Error_CannotConvertType (loc, Type, TypeManager.bool_type);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
public CharConstant ToChar (Location loc)
|
||||
{
|
||||
CharConstant c = ConvertToChar ();
|
||||
|
||||
if (c == null)
|
||||
Convert.Error_CannotConvertType (loc, Type, TypeManager.char_type);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
public virtual CharConstant ConvertToChar ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual BoolConstant ConvertToBoolean ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual ByteConstant ConvertToByte ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual ShortConstant ConvertToShort ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual DecimalConstant ConvertToDecimal ()
|
||||
{
|
||||
return null;
|
||||
@@ -264,46 +204,6 @@ namespace Mono.CSharp {
|
||||
else
|
||||
ec.ig.Emit (OpCodes.Ldc_I4_0);
|
||||
}
|
||||
|
||||
public override DecimalConstant ConvertToDecimal ()
|
||||
{
|
||||
return Value ? new DecimalConstant (0) : new DecimalConstant (-1);
|
||||
}
|
||||
|
||||
public override DoubleConstant ConvertToDouble ()
|
||||
{
|
||||
return Value ? new DoubleConstant (0) : new DoubleConstant (-1);
|
||||
}
|
||||
|
||||
public override FloatConstant ConvertToFloat ()
|
||||
{
|
||||
return Value ? new FloatConstant (0) : new FloatConstant (-1);
|
||||
}
|
||||
|
||||
public override LongConstant ConvertToLong ()
|
||||
{
|
||||
return Value ? new LongConstant (0) : new LongConstant (-1);
|
||||
}
|
||||
|
||||
public override IntConstant ConvertToInt ()
|
||||
{
|
||||
return Value ? new IntConstant (0) : new IntConstant (-1);
|
||||
}
|
||||
|
||||
public override ShortConstant ConvertToShort ()
|
||||
{
|
||||
return Value ? new ShortConstant (0) : new ShortConstant (-1);
|
||||
}
|
||||
|
||||
public override ByteConstant ConvertToByte ()
|
||||
{
|
||||
return Value ? new ByteConstant (0) : new ByteConstant (255);
|
||||
}
|
||||
|
||||
public override BoolConstant ConvertToBoolean ()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public override bool IsNegative {
|
||||
get {
|
||||
@@ -351,35 +251,25 @@ namespace Mono.CSharp {
|
||||
return new FloatConstant (Value);
|
||||
}
|
||||
|
||||
public override ULongConstant ConvertToULong ()
|
||||
{
|
||||
return new ULongConstant (Value);
|
||||
}
|
||||
|
||||
public override LongConstant ConvertToLong ()
|
||||
{
|
||||
return new LongConstant (Value);
|
||||
}
|
||||
|
||||
public override ShortConstant ConvertToShort ()
|
||||
public override UIntConstant ConvertToUInt ()
|
||||
{
|
||||
return new ShortConstant (Value);
|
||||
}
|
||||
|
||||
public override ByteConstant ConvertToByte ()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public override DecimalConstant ConvertToDecimal ()
|
||||
{
|
||||
return new DecimalConstant (Value);
|
||||
return new UIntConstant (Value);
|
||||
}
|
||||
|
||||
public override IntConstant ConvertToInt ()
|
||||
{
|
||||
return new IntConstant (Value);
|
||||
}
|
||||
|
||||
public override BoolConstant ConvertToBoolean ()
|
||||
{
|
||||
return new BoolConstant (Value != 0);
|
||||
}
|
||||
|
||||
public override bool IsNegative {
|
||||
get {
|
||||
@@ -591,43 +481,25 @@ namespace Mono.CSharp {
|
||||
return new FloatConstant (Value);
|
||||
}
|
||||
|
||||
public override ULongConstant ConvertToULong ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override LongConstant ConvertToLong ()
|
||||
{
|
||||
return new LongConstant (Value);
|
||||
}
|
||||
|
||||
public override ShortConstant ConvertToShort ()
|
||||
public override UIntConstant ConvertToUInt ()
|
||||
{
|
||||
return this;
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IntConstant ConvertToInt ()
|
||||
{
|
||||
return new IntConstant (Value);
|
||||
}
|
||||
|
||||
public override DecimalConstant ConvertToDecimal ()
|
||||
{
|
||||
return new DecimalConstant (Value);
|
||||
}
|
||||
|
||||
public override ByteConstant ConvertToByte ()
|
||||
{
|
||||
byte val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToByte (Value);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ByteConstant (val);
|
||||
}
|
||||
|
||||
public override BoolConstant ConvertToBoolean ()
|
||||
{
|
||||
return new BoolConstant (Value != 0);
|
||||
}
|
||||
|
||||
public override bool IsZeroInteger {
|
||||
get { return Value == 0; }
|
||||
@@ -798,46 +670,31 @@ namespace Mono.CSharp {
|
||||
return new FloatConstant (Value);
|
||||
}
|
||||
|
||||
public override ULongConstant ConvertToULong ()
|
||||
{
|
||||
if (Value < 0)
|
||||
return null;
|
||||
|
||||
return new ULongConstant ((ulong) Value);
|
||||
}
|
||||
|
||||
public override LongConstant ConvertToLong ()
|
||||
{
|
||||
return new LongConstant (Value);
|
||||
}
|
||||
|
||||
public override UIntConstant ConvertToUInt ()
|
||||
{
|
||||
if (Value < 0)
|
||||
return null;
|
||||
|
||||
return new UIntConstant ((uint) Value);
|
||||
}
|
||||
|
||||
public override IntConstant ConvertToInt ()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public override ShortConstant ConvertToShort ()
|
||||
{
|
||||
short val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToInt16 (Value);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ShortConstant (val);
|
||||
}
|
||||
|
||||
public override ByteConstant ConvertToByte ()
|
||||
{
|
||||
byte val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToByte (Value);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ByteConstant (val);
|
||||
}
|
||||
|
||||
public override BoolConstant ConvertToBoolean ()
|
||||
{
|
||||
return new BoolConstant (Value != 0);
|
||||
}
|
||||
|
||||
public override bool IsNegative {
|
||||
get {
|
||||
@@ -963,9 +820,12 @@ namespace Mono.CSharp {
|
||||
return new FloatConstant (Value);
|
||||
}
|
||||
|
||||
public override DecimalConstant ConvertToDecimal()
|
||||
public override ULongConstant ConvertToULong ()
|
||||
{
|
||||
return new DecimalConstant (Value);
|
||||
if (Value < 0)
|
||||
return null;
|
||||
|
||||
return new ULongConstant ((ulong) Value);
|
||||
}
|
||||
|
||||
public override LongConstant ConvertToLong ()
|
||||
@@ -973,48 +833,14 @@ namespace Mono.CSharp {
|
||||
return this;
|
||||
}
|
||||
|
||||
public override UIntConstant ConvertToUInt ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IntConstant ConvertToInt ()
|
||||
{
|
||||
int val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToInt32 (Value);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new IntConstant (val);
|
||||
}
|
||||
|
||||
public override ShortConstant ConvertToShort ()
|
||||
{
|
||||
short val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToInt16 (Value);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ShortConstant (val);
|
||||
}
|
||||
|
||||
public override ByteConstant ConvertToByte ()
|
||||
{
|
||||
byte val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToByte (Value);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ByteConstant (val);
|
||||
}
|
||||
|
||||
public override BoolConstant ConvertToBoolean ()
|
||||
{
|
||||
return new BoolConstant (Value != 0);
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool IsNegative {
|
||||
@@ -1131,67 +957,19 @@ namespace Mono.CSharp {
|
||||
return this;
|
||||
}
|
||||
|
||||
public override DecimalConstant ConvertToDecimal ()
|
||||
{
|
||||
return new DecimalConstant (new System.Decimal (Value));
|
||||
}
|
||||
|
||||
public override LongConstant ConvertToLong ()
|
||||
{
|
||||
long val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToInt64 (System.Math.Round (Value));
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return new LongConstant (val);
|
||||
|
||||
public override UIntConstant ConvertToUInt ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IntConstant ConvertToInt ()
|
||||
{
|
||||
int val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToInt32 (System.Math.Round (Value));
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new IntConstant (val);
|
||||
}
|
||||
|
||||
public override ShortConstant ConvertToShort ()
|
||||
{
|
||||
short val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToInt16 (System.Math.Round (Value));
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ShortConstant (val);
|
||||
}
|
||||
|
||||
public override ByteConstant ConvertToByte ()
|
||||
{
|
||||
byte val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToByte (System.Math.Round (Value));
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ByteConstant (val);
|
||||
}
|
||||
|
||||
public override BoolConstant ConvertToBoolean ()
|
||||
{
|
||||
return new BoolConstant (Value != 0);
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool IsNegative {
|
||||
@@ -1233,78 +1011,27 @@ namespace Mono.CSharp {
|
||||
|
||||
public override FloatConstant ConvertToFloat ()
|
||||
{
|
||||
float val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToSingle (Value);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new FloatConstant (val);
|
||||
return null;
|
||||
}
|
||||
|
||||
public override DecimalConstant ConvertToDecimal ()
|
||||
public override ULongConstant ConvertToULong ()
|
||||
{
|
||||
return new DecimalConstant (new System.Decimal (Value));
|
||||
return null;
|
||||
}
|
||||
|
||||
public override LongConstant ConvertToLong ()
|
||||
{
|
||||
long val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToInt64 (System.Math.Round (Value));
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return new LongConstant (val);
|
||||
|
||||
public override UIntConstant ConvertToUInt ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IntConstant ConvertToInt ()
|
||||
{
|
||||
int val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToInt32 (System.Math.Round (Value));
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new IntConstant (val);
|
||||
}
|
||||
|
||||
public override ShortConstant ConvertToShort ()
|
||||
{
|
||||
short val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToInt16 (System.Math.Round (Value));
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ShortConstant (val);
|
||||
}
|
||||
|
||||
public override ByteConstant ConvertToByte ()
|
||||
{
|
||||
byte val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToByte (System.Math.Round (Value));
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ByteConstant (val);
|
||||
}
|
||||
|
||||
public override BoolConstant ConvertToBoolean ()
|
||||
{
|
||||
return new BoolConstant (Value != 0);
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool IsNegative {
|
||||
@@ -1367,94 +1094,6 @@ namespace Mono.CSharp {
|
||||
ig.Emit (OpCodes.Newobj, TypeManager.void_decimal_ctor_five_args);
|
||||
}
|
||||
|
||||
public override DoubleConstant ConvertToDouble ()
|
||||
{
|
||||
double val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToDouble (Value);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new DoubleConstant (val);
|
||||
}
|
||||
|
||||
public override FloatConstant ConvertToFloat ()
|
||||
{
|
||||
float val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToSingle (Value);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new FloatConstant (val);
|
||||
}
|
||||
|
||||
public override DecimalConstant ConvertToDecimal ()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public override LongConstant ConvertToLong ()
|
||||
{
|
||||
long val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToInt64 (Value);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new LongConstant (val);
|
||||
}
|
||||
|
||||
public override IntConstant ConvertToInt ()
|
||||
{
|
||||
int val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToInt32 (Value);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new IntConstant (val);
|
||||
}
|
||||
|
||||
public override ShortConstant ConvertToShort ()
|
||||
{
|
||||
short val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToInt16 (Value);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ShortConstant (val);
|
||||
}
|
||||
|
||||
public override ByteConstant ConvertToByte ()
|
||||
{
|
||||
byte val;
|
||||
|
||||
try {
|
||||
val = System.Convert.ToByte (Value);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ByteConstant (val);
|
||||
}
|
||||
|
||||
public override BoolConstant ConvertToBoolean ()
|
||||
{
|
||||
return new BoolConstant (Value != 0);
|
||||
}
|
||||
|
||||
public override bool IsNegative {
|
||||
get {
|
||||
return Value < 0;
|
||||
@@ -1498,43 +1137,6 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// VB.NET specific
|
||||
//
|
||||
public class DateConstant : Constant {
|
||||
public readonly DateTime Value;
|
||||
|
||||
public DateConstant (DateTime s)
|
||||
{
|
||||
type = TypeManager.date_type;
|
||||
eclass = ExprClass.Value;
|
||||
Value = s;
|
||||
}
|
||||
|
||||
override public string AsString ()
|
||||
{
|
||||
return "#" + Value.ToString() + "#";
|
||||
}
|
||||
|
||||
public override object GetValue ()
|
||||
{
|
||||
return Value;
|
||||
}
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
ec.ig.Emit (OpCodes.Ldc_I8, Value.Ticks);
|
||||
ec.ig.Emit (OpCodes.Newobj, TypeManager.void_datetime_ctor_ticks_arg);
|
||||
}
|
||||
|
||||
// FIXME:
|
||||
public override bool IsNegative {
|
||||
get {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+90
-487
@@ -205,14 +205,6 @@ namespace Mono.CSharp {
|
||||
|
||||
if (!target_type.IsValueType)
|
||||
return new NullCast (expr, target_type);
|
||||
|
||||
// VB.NET specific: Convert Nothing to value types
|
||||
|
||||
Expression e = NothingToPrimitiveConstants (expr, target_type);
|
||||
if (e != null)
|
||||
return e;
|
||||
|
||||
return new NullCast (expr, target_type);
|
||||
}
|
||||
|
||||
// from any class-type S to any interface-type T.
|
||||
@@ -242,7 +234,7 @@ namespace Mono.CSharp {
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// from an array-type S to an array-type of type T
|
||||
if (expr_type.IsArray && target_type.IsArray) {
|
||||
if (expr_type.GetArrayRank () == target_type.GetArrayRank ()) {
|
||||
@@ -265,11 +257,7 @@ namespace Mono.CSharp {
|
||||
// from an array-type to System.Array
|
||||
if (expr_type.IsArray && target_type == TypeManager.array_type)
|
||||
return new EmptyCast (expr, target_type);
|
||||
|
||||
// from an array-type of type T to IEnumerable<T>
|
||||
if (expr_type.IsArray && TypeManager.IsIEnumerable (expr_type, target_type))
|
||||
return new EmptyCast (expr, target_type);
|
||||
|
||||
|
||||
// from any delegate type to System.Delegate
|
||||
if ((expr_type == TypeManager.delegate_type || TypeManager.IsDelegateType (expr_type)) &&
|
||||
target_type == TypeManager.delegate_type)
|
||||
@@ -358,11 +346,7 @@ namespace Mono.CSharp {
|
||||
// from an array-type to System.Array
|
||||
if (expr_type.IsArray && (target_type == TypeManager.array_type))
|
||||
return true;
|
||||
|
||||
// from an array-type of type T to IEnumerable<T>
|
||||
if (expr_type.IsArray && TypeManager.IsIEnumerable (expr_type, target_type))
|
||||
return true;
|
||||
|
||||
|
||||
// from any delegate type to System.Delegate
|
||||
if ((expr_type == TypeManager.delegate_type || TypeManager.IsDelegateType (expr_type)) &&
|
||||
target_type == TypeManager.delegate_type)
|
||||
@@ -397,6 +381,7 @@ namespace Mono.CSharp {
|
||||
/// expr is the expression to convert, returns a new expression of type
|
||||
/// target_type or null if an implicit conversion is not possible.
|
||||
/// </summary>
|
||||
|
||||
static public Expression WideningNumericConversion (EmitContext ec, Expression expr,
|
||||
Type target_type, Location loc)
|
||||
{
|
||||
@@ -406,76 +391,35 @@ namespace Mono.CSharp {
|
||||
// Attempt to do the implicit constant expression conversions
|
||||
|
||||
if (expr is Constant){
|
||||
Expression e;
|
||||
|
||||
e = WideningConstantConversions (target_type, (Constant) expr);
|
||||
if (e != null)
|
||||
return e;
|
||||
|
||||
if (expr is IntConstant){
|
||||
Expression e;
|
||||
|
||||
e = TryWideningIntConversion (target_type, (IntConstant) expr);
|
||||
|
||||
if (e != null)
|
||||
return e;
|
||||
} else if (expr is LongConstant && target_type == TypeManager.uint64_type){
|
||||
//
|
||||
// Try the implicit constant expression conversion
|
||||
// from long to ulong, instead of a nice routine,
|
||||
// we just inline it
|
||||
//
|
||||
long v = ((LongConstant) expr).Value;
|
||||
if (v >= 0)
|
||||
return new ULongConstant ((ulong) v);
|
||||
}
|
||||
}
|
||||
|
||||
Type real_target_type = target_type;
|
||||
|
||||
// VB.NET specific: Convert an enum to it's
|
||||
// underlying numeric type or any type that
|
||||
// it's underlyinmg type has widening
|
||||
// conversion to.
|
||||
|
||||
if (expr_type.IsSubclassOf (TypeManager.enum_type)){
|
||||
if (target_type == TypeManager.enum_type ||
|
||||
target_type == TypeManager.object_type) {
|
||||
if (expr is EnumConstant)
|
||||
expr = ((EnumConstant) expr).Child;
|
||||
// We really need all these casts here .... :-(
|
||||
expr = new BoxedCast (new EmptyCast (expr, expr_type));
|
||||
return new EmptyCast (expr, target_type);
|
||||
}
|
||||
|
||||
//
|
||||
// Notice that we have kept the expr_type unmodified, which is only
|
||||
// used later on to
|
||||
if (expr is EnumConstant)
|
||||
expr = ((EnumConstant) expr).Child;
|
||||
else
|
||||
expr = new EmptyCast (expr, TypeManager.EnumToUnderlying (expr_type));
|
||||
expr_type = expr.Type;
|
||||
|
||||
if (expr_type == target_type)
|
||||
return expr;
|
||||
}
|
||||
|
||||
if (expr_type == TypeManager.sbyte_type){
|
||||
//
|
||||
// From sbyte to short, int, long, float, double.
|
||||
//
|
||||
if (real_target_type == TypeManager.int32_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_I4);
|
||||
if (real_target_type == TypeManager.int64_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_I8);
|
||||
if (real_target_type == TypeManager.double_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_R8);
|
||||
if (real_target_type == TypeManager.float_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
|
||||
if (real_target_type == TypeManager.short_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_I2);
|
||||
} else if (expr_type == TypeManager.byte_type){
|
||||
if (expr_type == TypeManager.byte_type){
|
||||
//
|
||||
// From byte to short, ushort, int, uint, long, ulong, float, double
|
||||
//
|
||||
if ((real_target_type == TypeManager.short_type) ||
|
||||
(real_target_type == TypeManager.ushort_type) ||
|
||||
(real_target_type == TypeManager.int32_type) ||
|
||||
(real_target_type == TypeManager.uint32_type))
|
||||
(real_target_type == TypeManager.int32_type))
|
||||
return new EmptyCast (expr, target_type);
|
||||
|
||||
if (real_target_type == TypeManager.uint64_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_U8);
|
||||
if (real_target_type == TypeManager.int64_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_I8);
|
||||
if (real_target_type == TypeManager.float_type)
|
||||
@@ -498,23 +442,6 @@ namespace Mono.CSharp {
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
|
||||
if (real_target_type == TypeManager.decimal_type)
|
||||
return new ImplicitNew (ec, "System", "Decimal", loc, expr);
|
||||
} else if (expr_type == TypeManager.ushort_type){
|
||||
//
|
||||
// From ushort to int, uint, long, ulong, float, double
|
||||
//
|
||||
if (real_target_type == TypeManager.uint32_type)
|
||||
return new EmptyCast (expr, target_type);
|
||||
|
||||
if (real_target_type == TypeManager.uint64_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_U8);
|
||||
if (real_target_type == TypeManager.int32_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_I4);
|
||||
if (real_target_type == TypeManager.int64_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_I8);
|
||||
if (real_target_type == TypeManager.double_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_R8);
|
||||
if (real_target_type == TypeManager.float_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
|
||||
} else if (expr_type == TypeManager.int32_type){
|
||||
//
|
||||
// From int to long, float, double
|
||||
@@ -527,30 +454,6 @@ namespace Mono.CSharp {
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
|
||||
if (real_target_type == TypeManager.decimal_type)
|
||||
return new ImplicitNew (ec, "System", "Decimal", loc, expr);
|
||||
} else if (expr_type == TypeManager.uint32_type){
|
||||
//
|
||||
// From uint to long, ulong, float, double
|
||||
//
|
||||
if (real_target_type == TypeManager.int64_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_U8);
|
||||
if (real_target_type == TypeManager.uint64_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_U8);
|
||||
if (real_target_type == TypeManager.double_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_R_Un,
|
||||
OpCodes.Conv_R8);
|
||||
if (real_target_type == TypeManager.float_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_R_Un,
|
||||
OpCodes.Conv_R4);
|
||||
} else if (expr_type == TypeManager.uint64_type){
|
||||
//
|
||||
// From ulong to float, double
|
||||
//
|
||||
if (real_target_type == TypeManager.double_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_R_Un,
|
||||
OpCodes.Conv_R8);
|
||||
if (real_target_type == TypeManager.float_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_R_Un,
|
||||
OpCodes.Conv_R4);
|
||||
} else if (expr_type == TypeManager.int64_type){
|
||||
//
|
||||
// From long/ulong to float, double
|
||||
@@ -561,20 +464,20 @@ namespace Mono.CSharp {
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
|
||||
if (real_target_type == TypeManager.decimal_type)
|
||||
return new ImplicitNew (ec, "System", "Decimal", loc, expr);
|
||||
} else if (expr_type == TypeManager.decimal_type){
|
||||
//
|
||||
// From decimal to float, double
|
||||
//
|
||||
if (real_target_type == TypeManager.double_type)
|
||||
return new ImplicitInvocation (ec, "System", "Convert", "ToDouble", loc, expr);
|
||||
if (real_target_type == TypeManager.float_type)
|
||||
return new ImplicitInvocation (ec, "System", "Convert" ,"ToSingle", loc, expr);
|
||||
} else if (expr_type == TypeManager.float_type){
|
||||
//
|
||||
// float to double
|
||||
//
|
||||
if (real_target_type == TypeManager.double_type)
|
||||
return new OpcodeCast (expr, target_type, OpCodes.Conv_R8);
|
||||
} else if (expr_type == TypeManager.decimal_type){
|
||||
//
|
||||
// From decimal to float, double
|
||||
//
|
||||
if (real_target_type == TypeManager.double_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.double_type, TypeManager.convert_to_double_decimal, expr);
|
||||
if (real_target_type == TypeManager.float_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.float_type, TypeManager.convert_to_single_decimal, expr);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -1189,10 +1092,6 @@ namespace Mono.CSharp {
|
||||
Type source_type = source.Type;
|
||||
MethodBase method = null;
|
||||
|
||||
if (TypeManager.IsNullableType (source_type) && TypeManager.IsNullableType (target))
|
||||
return new Nullable.LiftedConversion (
|
||||
source, target, true, look_for_explicit, loc).Resolve (ec);
|
||||
|
||||
union = GetConversionOperators (ec, source_type, target, loc, look_for_explicit);
|
||||
if (union == null)
|
||||
return null;
|
||||
@@ -1301,12 +1200,11 @@ namespace Mono.CSharp {
|
||||
return TypeParameter_to_Null (expr, target_type, loc);
|
||||
|
||||
if (TypeManager.IsNullableType (target_type))
|
||||
return new Nullable.NullableLiteral (target_type, loc);
|
||||
return new Nullable.NullLiteral (target_type, loc);
|
||||
}
|
||||
|
||||
if (TypeManager.IsNullableType (expr_type) && TypeManager.IsNullableType (target_type))
|
||||
return new Nullable.LiftedConversion (
|
||||
expr, target_type, false, false, loc).Resolve (ec);
|
||||
return Nullable.LiftedConversion.Create (ec, expr, target_type, false, loc);
|
||||
|
||||
if (expr.eclass == ExprClass.MethodGroup){
|
||||
if (!TypeManager.IsDelegateType (target_type)){
|
||||
@@ -1412,6 +1310,34 @@ namespace Mono.CSharp {
|
||||
{
|
||||
int value = ic.Value;
|
||||
|
||||
if (target_type == TypeManager.sbyte_type){
|
||||
if (value >= SByte.MinValue && value <= SByte.MaxValue)
|
||||
return new SByteConstant ((sbyte) value);
|
||||
} else if (target_type == TypeManager.byte_type){
|
||||
if (value >= Byte.MinValue && value <= Byte.MaxValue)
|
||||
return new ByteConstant ((byte) value);
|
||||
} else if (target_type == TypeManager.short_type){
|
||||
if (value >= Int16.MinValue && value <= Int16.MaxValue)
|
||||
return new ShortConstant ((short) value);
|
||||
} else if (target_type == TypeManager.ushort_type){
|
||||
if (value >= UInt16.MinValue && value <= UInt16.MaxValue)
|
||||
return new UShortConstant ((ushort) value);
|
||||
} else if (target_type == TypeManager.uint32_type){
|
||||
if (value >= 0)
|
||||
return new UIntConstant ((uint) value);
|
||||
} else if (target_type == TypeManager.uint64_type){
|
||||
//
|
||||
// we can optimize this case: a positive int32
|
||||
// always fits on a uint64. But we need an opcode
|
||||
// to do it.
|
||||
//
|
||||
if (value >= 0)
|
||||
return new ULongConstant ((ulong) value);
|
||||
} else if (target_type == TypeManager.double_type)
|
||||
return new DoubleConstant ((double) value);
|
||||
else if (target_type == TypeManager.float_type)
|
||||
return new FloatConstant ((float) value);
|
||||
|
||||
if (value == 0 && ic is IntLiteral && TypeManager.IsEnumType (target_type)){
|
||||
Type underlying = TypeManager.EnumToUnderlying (target_type);
|
||||
Constant e = (Constant) ic;
|
||||
@@ -1438,84 +1364,6 @@ namespace Mono.CSharp {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to perform an implicit constant conversion of the IntConstant
|
||||
/// into a different data type using casts (See Implicit Constant
|
||||
/// Expression Conversions)
|
||||
/// </summary>
|
||||
static public Expression WideningConstantConversions (Type target_type, Constant const_expr)
|
||||
{
|
||||
Constant ret_expr;
|
||||
|
||||
Type const_expr_type = const_expr.Type;
|
||||
Location loc = const_expr.Location;
|
||||
|
||||
if (target_type == TypeManager.byte_type){
|
||||
if (const_expr_type == TypeManager.short_type ||
|
||||
const_expr_type == TypeManager.int32_type ||
|
||||
const_expr_type == TypeManager.int64_type)
|
||||
return const_expr.ToByte (loc);
|
||||
}
|
||||
|
||||
if (target_type == TypeManager.short_type){
|
||||
if (const_expr_type == TypeManager.int32_type ||
|
||||
const_expr_type == TypeManager.int64_type)
|
||||
return const_expr.ToShort (loc);
|
||||
}
|
||||
|
||||
if (target_type == TypeManager.int32_type){
|
||||
if (const_expr_type == TypeManager.int64_type)
|
||||
return const_expr.ToInt (loc);
|
||||
}
|
||||
|
||||
if (target_type == TypeManager.float_type) {
|
||||
if (const_expr_type == TypeManager.double_type)
|
||||
return const_expr.ToDouble (loc);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static public Constant NothingToPrimitiveConstants (Expression expr, Type target_type)
|
||||
{
|
||||
NullLiteral null_literal = (NullLiteral) expr;
|
||||
Location loc = null_literal.Location;
|
||||
Type real_target_type = target_type ;
|
||||
Constant retval = null;
|
||||
|
||||
if (null_literal == null)
|
||||
throw new Exception ("FIXME: I was expecting that I would always get only NullLiterals");
|
||||
|
||||
if (target_type.IsSubclassOf(TypeManager.enum_type))
|
||||
real_target_type = TypeManager.EnumToUnderlying (target_type);
|
||||
|
||||
if (real_target_type == TypeManager.bool_type)
|
||||
retval = null_literal.ToBoolean (loc);
|
||||
else if (real_target_type == TypeManager.byte_type)
|
||||
retval = null_literal.ToByte (loc);
|
||||
else if (real_target_type == TypeManager.short_type)
|
||||
retval = null_literal.ToShort (loc);
|
||||
else if (real_target_type == TypeManager.int32_type)
|
||||
retval = null_literal.ToInt (loc);
|
||||
else if (real_target_type == TypeManager.int64_type)
|
||||
null_literal.ToLong (loc);
|
||||
else if (real_target_type == TypeManager.decimal_type)
|
||||
retval = null_literal.ToDecimal (loc);
|
||||
else if (real_target_type == TypeManager.float_type)
|
||||
retval = null_literal.ToLong (loc);
|
||||
else if (real_target_type == TypeManager.double_type)
|
||||
retval = null_literal.ToDouble (loc);
|
||||
else if (real_target_type == TypeManager.char_type)
|
||||
retval = null_literal.ToChar (loc);
|
||||
else if (real_target_type == TypeManager.string_type)
|
||||
retval = new StringConstant (null);
|
||||
|
||||
if (real_target_type != target_type && retval != null)
|
||||
retval = new EnumConstant (retval, target_type);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static public void Error_CannotWideningConversion (Location loc, Type source, Type target)
|
||||
{
|
||||
if (source.Name == target.Name){
|
||||
@@ -1606,181 +1454,72 @@ namespace Mono.CSharp {
|
||||
return ce;
|
||||
}
|
||||
|
||||
if (expr_type == TypeManager.sbyte_type){
|
||||
//
|
||||
// From sbyte to byte, ushort, uint, ulong, char
|
||||
//
|
||||
if (real_target_type == TypeManager.byte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I1_U1);
|
||||
if (real_target_type == TypeManager.ushort_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I1_U2);
|
||||
if (real_target_type == TypeManager.uint32_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I1_U4);
|
||||
if (real_target_type == TypeManager.uint64_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I1_U8);
|
||||
if (real_target_type == TypeManager.char_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I1_CH);
|
||||
} else if (expr_type == TypeManager.byte_type){
|
||||
//
|
||||
// From byte to sbyte and char
|
||||
//
|
||||
if (real_target_type == TypeManager.sbyte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U1_I1);
|
||||
} else if (expr_type == TypeManager.short_type){
|
||||
if (expr_type == TypeManager.short_type){
|
||||
//
|
||||
// From short to byte
|
||||
//
|
||||
if (real_target_type == TypeManager.sbyte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I2_I1);
|
||||
if (real_target_type == TypeManager.byte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I2_U1);
|
||||
if (real_target_type == TypeManager.ushort_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I2_U2);
|
||||
if (real_target_type == TypeManager.uint32_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I2_U4);
|
||||
if (real_target_type == TypeManager.uint64_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I2_U8);
|
||||
} else if (expr_type == TypeManager.ushort_type){
|
||||
//
|
||||
// From ushort to sbyte, byte, short, char
|
||||
//
|
||||
if (real_target_type == TypeManager.sbyte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U2_I1);
|
||||
if (real_target_type == TypeManager.byte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U2_U1);
|
||||
if (real_target_type == TypeManager.short_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U2_I2);
|
||||
if (real_target_type == TypeManager.char_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U2_CH);
|
||||
} else if (expr_type == TypeManager.int32_type){
|
||||
//
|
||||
// From int to byte, short
|
||||
//
|
||||
if (real_target_type == TypeManager.sbyte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_I1);
|
||||
if (real_target_type == TypeManager.byte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_U1);
|
||||
if (real_target_type == TypeManager.short_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_I2);
|
||||
if (real_target_type == TypeManager.ushort_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_U2);
|
||||
if (real_target_type == TypeManager.uint32_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_U4);
|
||||
if (real_target_type == TypeManager.uint64_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_U8);
|
||||
} else if (expr_type == TypeManager.uint32_type){
|
||||
//
|
||||
// From uint to sbyte, byte, short, ushort, int, char
|
||||
//
|
||||
if (real_target_type == TypeManager.sbyte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_I1);
|
||||
if (real_target_type == TypeManager.byte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_U1);
|
||||
if (real_target_type == TypeManager.short_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_I2);
|
||||
if (real_target_type == TypeManager.ushort_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_U2);
|
||||
if (real_target_type == TypeManager.int32_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_I4);
|
||||
if (real_target_type == TypeManager.char_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_CH);
|
||||
} else if (expr_type == TypeManager.int64_type){
|
||||
//
|
||||
// From long to byte, short, int
|
||||
//
|
||||
if (real_target_type == TypeManager.sbyte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_I1);
|
||||
if (real_target_type == TypeManager.byte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_U1);
|
||||
if (real_target_type == TypeManager.short_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_I2);
|
||||
if (real_target_type == TypeManager.ushort_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_U2);
|
||||
if (real_target_type == TypeManager.int32_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_I4);
|
||||
if (real_target_type == TypeManager.uint32_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_U4);
|
||||
if (real_target_type == TypeManager.uint64_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_U8);
|
||||
} else if (expr_type == TypeManager.uint64_type){
|
||||
} else if (expr_type == TypeManager.decimal_type){
|
||||
//
|
||||
// From ulong to sbyte, byte, short, ushort, int, uint, long, char
|
||||
// From decimal to byte, short, int, long
|
||||
//
|
||||
if (real_target_type == TypeManager.sbyte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_I1);
|
||||
if (real_target_type == TypeManager.byte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_U1);
|
||||
return new ImplicitInvocation (ec, "System", "Convert" , "ToByte", loc, expr);
|
||||
if (real_target_type == TypeManager.short_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_I2);
|
||||
if (real_target_type == TypeManager.ushort_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_U2);
|
||||
return new ImplicitInvocation (ec, "System", "Convert", "ToInt16", loc, expr);
|
||||
if (real_target_type == TypeManager.int32_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_I4);
|
||||
if (real_target_type == TypeManager.uint32_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_U4);
|
||||
return new ImplicitInvocation (ec, "System", "Convert", "ToInt32", loc, expr);
|
||||
if (real_target_type == TypeManager.int64_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_I8);
|
||||
if (real_target_type == TypeManager.char_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_CH);
|
||||
return new ImplicitInvocation (ec, "System", "Convert", "ToInt64", loc, expr);
|
||||
} else if (expr_type == TypeManager.float_type){
|
||||
//
|
||||
// From float to byte, short, int, long, decimal
|
||||
//
|
||||
if (real_target_type == TypeManager.sbyte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_I1);
|
||||
if (real_target_type == TypeManager.byte_type)
|
||||
return new FloatingToFixedCast (ec, expr, target_type, ConvCast.Mode.R8_U1);
|
||||
if (real_target_type == TypeManager.short_type)
|
||||
return new FloatingToFixedCast (ec, expr, target_type, ConvCast.Mode.R8_I2);
|
||||
if (real_target_type == TypeManager.ushort_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_U2);
|
||||
if (real_target_type == TypeManager.int32_type)
|
||||
return new FloatingToFixedCast (ec, expr, target_type, ConvCast.Mode.R8_I4);
|
||||
if (real_target_type == TypeManager.uint32_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_U4);
|
||||
if (real_target_type == TypeManager.int64_type)
|
||||
return new FloatingToFixedCast (ec, expr, target_type, ConvCast.Mode.R8_I8);
|
||||
if (real_target_type == TypeManager.uint64_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_U8);
|
||||
if (real_target_type == TypeManager.decimal_type)
|
||||
return new ImplicitNew (ec, "System", "Decimal", loc, expr);
|
||||
} else if (expr_type == TypeManager.double_type){
|
||||
//
|
||||
// From double to byte, short, int, long, float, decimal
|
||||
//
|
||||
if (real_target_type == TypeManager.sbyte_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_I1);
|
||||
if (real_target_type == TypeManager.byte_type)
|
||||
return new FloatingToFixedCast (ec, expr, target_type, ConvCast.Mode.R8_U1);
|
||||
if (real_target_type == TypeManager.short_type)
|
||||
return new FloatingToFixedCast (ec, expr, target_type, ConvCast.Mode.R8_I2);
|
||||
if (real_target_type == TypeManager.ushort_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_U2);
|
||||
if (real_target_type == TypeManager.int32_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_I4);
|
||||
if (real_target_type == TypeManager.uint32_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_U4);
|
||||
if (real_target_type == TypeManager.int64_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_I8);
|
||||
if (real_target_type == TypeManager.uint64_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_U8);
|
||||
|
||||
if (real_target_type == TypeManager.float_type)
|
||||
return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_R4);
|
||||
if (real_target_type == TypeManager.decimal_type)
|
||||
return new ImplicitNew (ec, "System", "Decimal", loc, expr);
|
||||
} else if (expr_type == TypeManager.decimal_type){
|
||||
//
|
||||
// From decimal to byte, short, int, long
|
||||
//
|
||||
if (real_target_type == TypeManager.byte_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.byte_type, TypeManager.convert_to_byte_decimal, expr);
|
||||
if (real_target_type == TypeManager.short_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.short_type, TypeManager.convert_to_int16_decimal, expr);
|
||||
if (real_target_type == TypeManager.int32_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.int32_type, TypeManager.convert_to_int32_decimal, expr);
|
||||
if (real_target_type == TypeManager.int64_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.int64_type, TypeManager.convert_to_int64_decimal, expr);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -1816,7 +1555,7 @@ namespace Mono.CSharp {
|
||||
if (real_target_type == TypeManager.double_type)
|
||||
return new BooleanToNumericCast (expr, target_type, OpCodes.Conv_R8);
|
||||
if (real_target_type == TypeManager.decimal_type) {
|
||||
return new HelperMethodInvocation (ec, expr.Location, TypeManager.decimal_type, TypeManager.msvbcs_decimaltype_from_boolean, expr);
|
||||
return new ImplicitInvocation (ec, "DecimalType", "FromBoolean", loc, expr);
|
||||
}
|
||||
} if (real_target_type == TypeManager.bool_type) {
|
||||
|
||||
@@ -1833,7 +1572,7 @@ namespace Mono.CSharp {
|
||||
expr_type == TypeManager.double_type)
|
||||
return new NumericToBooleanCast (expr, expr_type);
|
||||
if (expr_type == TypeManager.decimal_type) {
|
||||
return new HelperMethodInvocation (ec, expr.Location, TypeManager.bool_type, TypeManager.convert_to_boolean_decimal, expr);
|
||||
return new ImplicitInvocation (ec, "System", "Convert", "ToBoolean", loc, expr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1856,7 +1595,7 @@ namespace Mono.CSharp {
|
||||
// From char to string
|
||||
//
|
||||
if (expr_type == TypeManager.char_type)
|
||||
return new HelperMethodInvocation (ec, expr.Location, TypeManager.string_type, TypeManager.msvbcs_stringtype_from_char, expr);
|
||||
return new ImplicitInvocation (ec, "StringType", "FromChar", loc, expr);
|
||||
}
|
||||
|
||||
if(expr_type.IsArray && (expr_type.GetElementType() == TypeManager.char_type)) {
|
||||
@@ -1889,28 +1628,28 @@ namespace Mono.CSharp {
|
||||
// float, double, decimal and date
|
||||
//
|
||||
|
||||
// if (real_target_type.IsArray && (real_target_type.GetElementType() == TypeManager.char_type))
|
||||
// return new HelperMethodInvocation (ec, loc, TypeManager.char_array_type, TypeManager.msvbcs_char_array_type_from_string, loc, expr);
|
||||
if (real_target_type.IsArray && (real_target_type.GetElementType() == TypeManager.char_type))
|
||||
return new ImplicitInvocation (ec, "CharArrayType", "FromString", loc, expr);
|
||||
if (real_target_type == TypeManager.bool_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.bool_type, TypeManager.msvbcs_booleantype_from_string, expr);
|
||||
return new ImplicitInvocation (ec, "BooleanType", "FromString", loc, expr);
|
||||
if (real_target_type == TypeManager.byte_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.byte_type, TypeManager.msvbcs_bytetype_from_string, expr);
|
||||
return new ImplicitInvocation (ec, "ByteType", "FromString", loc, expr);
|
||||
if (real_target_type == TypeManager.short_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.short_type, TypeManager.msvbcs_shorttype_from_string, expr);
|
||||
return new ImplicitInvocation (ec, "ShortType", "FromString", loc, expr);
|
||||
if (real_target_type == TypeManager.char_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.char_type, TypeManager.msvbcs_chartype_from_string, expr);
|
||||
return new ImplicitInvocation (ec, "CharType", "FromString", loc, expr);
|
||||
if (real_target_type == TypeManager.int32_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.int32_type, TypeManager.msvbcs_integertype_from_string, expr);
|
||||
return new ImplicitInvocation (ec, "IntegerType", "FromString", loc, expr);
|
||||
if (real_target_type == TypeManager.int64_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.int64_type, TypeManager.msvbcs_longtype_from_string, expr);
|
||||
return new ImplicitInvocation (ec, "LongType", "FromString", loc, expr);
|
||||
if (real_target_type == TypeManager.float_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.float_type, TypeManager.msvbcs_singletype_from_string, expr);
|
||||
return new ImplicitInvocation (ec, "SingleType", "FromString", loc, expr);
|
||||
if (real_target_type == TypeManager.double_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.double_type, TypeManager.msvbcs_doubletype_from_string, expr);
|
||||
return new ImplicitInvocation (ec, "DoubleType", "FromString", loc, expr);
|
||||
if (real_target_type == TypeManager.decimal_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.decimal_type, TypeManager.msvbcs_decimaltype_from_string, expr);
|
||||
return new ImplicitInvocation (ec, "DecimalType", "FromString", loc, expr);
|
||||
if (real_target_type == TypeManager.date_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.date_type, TypeManager.msvbcs_datetype_from_string, expr);
|
||||
return new ImplicitInvocation (ec, "DateType", "FromString", loc, expr);
|
||||
} if (real_target_type == TypeManager.string_type) {
|
||||
|
||||
//
|
||||
@@ -1920,83 +1659,28 @@ namespace Mono.CSharp {
|
||||
//
|
||||
|
||||
if (expr_type == TypeManager.bool_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.string_type, TypeManager.msvbcs_stringtype_from_boolean, expr);
|
||||
return new ImplicitInvocation (ec, "StringType", "FromBoolean", loc, expr);
|
||||
if (expr_type == TypeManager.byte_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.string_type, TypeManager.msvbcs_stringtype_from_byte, expr);
|
||||
return new ImplicitInvocation (ec, "StringType", "FromByte", loc, expr);
|
||||
if (expr_type == TypeManager.short_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.string_type, TypeManager.msvbcs_stringtype_from_short, expr);
|
||||
return new ImplicitInvocation (ec, "StringType", "FromShort", loc, expr);
|
||||
if (expr_type == TypeManager.int32_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.string_type, TypeManager.msvbcs_stringtype_from_integer, expr);
|
||||
return new ImplicitInvocation (ec, "StringType", "FromInteger", loc, expr);
|
||||
if (expr_type == TypeManager.int64_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.string_type, TypeManager.msvbcs_stringtype_from_long, expr);
|
||||
return new ImplicitInvocation (ec, "StringType", "FromLong", loc, expr);
|
||||
if (expr_type == TypeManager.float_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.string_type, TypeManager.msvbcs_stringtype_from_single, expr);
|
||||
return new ImplicitInvocation (ec, "StringType", "FromSingle", loc, expr);
|
||||
if (expr_type == TypeManager.double_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.string_type, TypeManager.msvbcs_stringtype_from_double, expr);
|
||||
return new ImplicitInvocation (ec, "StringType", "FromDouble", loc, expr);
|
||||
if (expr_type == TypeManager.decimal_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.string_type, TypeManager.msvbcs_stringtype_from_decimal, expr);
|
||||
return new ImplicitInvocation (ec, "StringType", "FromDecimal", loc, expr);
|
||||
if (expr_type == TypeManager.date_type)
|
||||
return new HelperMethodInvocation (ec, loc, TypeManager.string_type, TypeManager.msvbcs_stringtype_from_date, expr);
|
||||
return new ImplicitInvocation (ec, "StringType", "FromDate", loc, expr);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// VB.NET specific: Conversions from Object to Primitive Types
|
||||
/// </summary>
|
||||
|
||||
static public Expression ObjectTypeToPrimitiveTypes (EmitContext ec, Expression expr,
|
||||
Type target_type, Location loc)
|
||||
{
|
||||
Type expr_type = expr.Type;
|
||||
Type real_target_type = target_type;
|
||||
MethodInfo helper_method = null;
|
||||
Expression retexpr;
|
||||
|
||||
if (expr_type != TypeManager.object_type)
|
||||
return null;
|
||||
|
||||
if (target_type.IsSubclassOf (TypeManager.enum_type))
|
||||
real_target_type = TypeManager.EnumToUnderlying (target_type);
|
||||
|
||||
|
||||
if (real_target_type == TypeManager.bool_type)
|
||||
helper_method = TypeManager.msvbcs_booleantype_fromobject_object;
|
||||
if (real_target_type == TypeManager.byte_type)
|
||||
helper_method = TypeManager.msvbcs_bytetype_fromobject_object;
|
||||
if (real_target_type == TypeManager.short_type)
|
||||
helper_method = TypeManager.msvbcs_shorttype_fromobject_object;
|
||||
if (real_target_type == TypeManager.char_type)
|
||||
helper_method = TypeManager.msvbcs_chartype_fromobject_object;
|
||||
if (real_target_type == TypeManager.int32_type)
|
||||
helper_method = TypeManager.msvbcs_integertype_fromobject_object;
|
||||
if (real_target_type == TypeManager.int64_type)
|
||||
helper_method = TypeManager.msvbcs_longtype_fromobject_object;
|
||||
if (real_target_type == TypeManager.float_type)
|
||||
helper_method = TypeManager.msvbcs_singletype_fromobject_object;
|
||||
if (real_target_type == TypeManager.double_type)
|
||||
helper_method = TypeManager.msvbcs_doubletype_fromobject_object;
|
||||
if (real_target_type == TypeManager.decimal_type)
|
||||
helper_method = TypeManager.msvbcs_decimaltype_fromobject_object;
|
||||
if (real_target_type == TypeManager.date_type)
|
||||
helper_method = TypeManager.msvbcs_datetype_fromobject_object;
|
||||
if (real_target_type == TypeManager.string_type)
|
||||
helper_method = TypeManager.msvbcs_stringtype_fromobject_object;
|
||||
|
||||
if (helper_method != null) {
|
||||
retexpr = new HelperMethodInvocation (ec, loc, real_target_type, helper_method, expr);
|
||||
if (target_type != real_target_type)
|
||||
retexpr = new EmptyCast (retexpr, target_type);
|
||||
|
||||
return retexpr;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether an explicit reference conversion can be performed
|
||||
/// from source_type to target_type
|
||||
@@ -2008,12 +1692,6 @@ namespace Mono.CSharp {
|
||||
|
||||
if (source_type == target_type)
|
||||
return true;
|
||||
|
||||
//
|
||||
// From generic parameter to any type
|
||||
//
|
||||
if (source_type.IsGenericParameter)
|
||||
return true;
|
||||
|
||||
//
|
||||
// From object to a generic parameter
|
||||
@@ -2070,9 +1748,8 @@ namespace Mono.CSharp {
|
||||
|
||||
Type source_element_type = TypeManager.GetElementType (source_type);
|
||||
Type target_element_type = TypeManager.GetElementType (target_type);
|
||||
|
||||
if (source_element_type.IsGenericParameter ||
|
||||
(!source_element_type.IsValueType && !target_element_type.IsValueType))
|
||||
|
||||
if (!source_element_type.IsValueType && !target_element_type.IsValueType)
|
||||
if (NarrowingReferenceConversionExists (source_element_type,
|
||||
target_element_type))
|
||||
return true;
|
||||
@@ -2262,8 +1939,7 @@ namespace Mono.CSharp {
|
||||
return ne;
|
||||
|
||||
if (TypeManager.IsNullableType (expr.Type) && TypeManager.IsNullableType (target_type))
|
||||
return new Nullable.LiftedConversion (
|
||||
expr, target_type, false, true, loc).Resolve (ec);
|
||||
return Nullable.LiftedConversion.Create (ec, expr, target_type, true, loc);
|
||||
|
||||
ne = NarrowingNumericConversion (ec, expr, target_type, loc);
|
||||
if (ne != null)
|
||||
@@ -2272,17 +1948,6 @@ namespace Mono.CSharp {
|
||||
//
|
||||
// Unboxing conversion.
|
||||
//
|
||||
|
||||
//
|
||||
// VB.NET treats conversions from object to
|
||||
// the primitive types using the helper
|
||||
// routines in Microsoft.VisualBasic.dll
|
||||
//
|
||||
|
||||
ne = ObjectTypeToPrimitiveTypes(ec, expr, target_type, loc);
|
||||
if (ne != null)
|
||||
return ne;
|
||||
|
||||
if (expr_type == TypeManager.object_type && target_type.IsValueType)
|
||||
return new UnboxCast (expr, target_type);
|
||||
|
||||
@@ -2401,8 +2066,7 @@ namespace Mono.CSharp {
|
||||
return ne;
|
||||
|
||||
if (TypeManager.IsNullableType (expr.Type) && TypeManager.IsNullableType (target_type))
|
||||
return new Nullable.LiftedConversion (
|
||||
expr, target_type, false, true, l).Resolve (ec);
|
||||
return Nullable.LiftedConversion.Create (ec, expr, target_type, true, l);
|
||||
|
||||
ne = NarrowingNumericConversion (ec, expr, target_type, l);
|
||||
if (ne != null)
|
||||
@@ -2415,66 +2079,5 @@ namespace Mono.CSharp {
|
||||
Error_CannotConvertType (l, expr.Type, target_type);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry point for VB.NET specific implicit conversions
|
||||
/// </summary>
|
||||
static public Expression ImplicitVBConversion (EmitContext ec, Expression expr,
|
||||
Type target_type, Location loc)
|
||||
{
|
||||
if (RootContext.StricterTypeChecking)
|
||||
return WideningConversion (ec, expr, target_type, loc);
|
||||
else
|
||||
return WideningAndNarrowingConversion(ec, expr, target_type, loc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mandates VB.NET specific implicit conversions
|
||||
/// </summary>
|
||||
static public Expression ImplicitVBConversionRequired (EmitContext ec, Expression source,
|
||||
Type target_type, Location loc)
|
||||
{
|
||||
Expression e;
|
||||
|
||||
|
||||
int errors = Report.Errors;
|
||||
e = ImplicitVBConversion (ec, source, target_type, loc);
|
||||
if (Report.Errors > errors)
|
||||
return null;
|
||||
if (e != null)
|
||||
return e;
|
||||
|
||||
if (source is DoubleLiteral) {
|
||||
if (target_type == TypeManager.float_type) {
|
||||
Error_664 (loc, "float", "f");
|
||||
return null;
|
||||
}
|
||||
if (target_type == TypeManager.decimal_type) {
|
||||
Error_664 (loc, "decimal", "m");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (source is Constant){
|
||||
Constant c = (Constant) source;
|
||||
|
||||
Expression.Error_ConstantValueCannotBeConverted (loc, c.AsString (), target_type);
|
||||
return null;
|
||||
}
|
||||
|
||||
Error_CannotWideningConversion (loc, source.Type, target_type);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry point for VB.NET specific explicit conversions
|
||||
/// </summary>
|
||||
static public Expression ExplicitVBConversion (EmitContext ec, Expression expr,
|
||||
Type target_type, Location loc)
|
||||
{
|
||||
return WideningAndNarrowingConversion(ec, expr, target_type, loc);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1413,7 +1413,7 @@ namespace Mono.CSharp {
|
||||
return type_param_list;
|
||||
}
|
||||
|
||||
public virtual void SetParameterInfo (ArrayList constraints_list)
|
||||
public void SetParameterInfo (ArrayList constraints_list)
|
||||
{
|
||||
if (!is_generic) {
|
||||
if (constraints_list != null) {
|
||||
|
||||
@@ -90,11 +90,6 @@ namespace Mono.CSharp {
|
||||
TypeAttributes attr = Modifiers.TypeAttr (ModFlags, IsTopLevel) |
|
||||
TypeAttributes.Class | TypeAttributes.Sealed;
|
||||
|
||||
if (TypeManager.multicast_delegate_type == null && !RootContext.StdLib) {
|
||||
TypeExpr expr = new TypeLookupExpression ("System.MulticastDelegate");
|
||||
TypeManager.multicast_delegate_type = expr.ResolveType (ec);
|
||||
}
|
||||
|
||||
if (TypeManager.multicast_delegate_type == null)
|
||||
Report.Error (-100, Location, "Internal error: delegate used before " +
|
||||
"System.MulticastDelegate is resolved. This can only " +
|
||||
@@ -159,15 +154,13 @@ namespace Mono.CSharp {
|
||||
{
|
||||
MethodAttributes mattr;
|
||||
int i;
|
||||
ec = new EmitContext (this, this, Location, null, null, ModFlags, false);
|
||||
|
||||
if (IsGeneric) {
|
||||
foreach (TypeParameter type_param in TypeParameters)
|
||||
type_param.DefineType (ec);
|
||||
}
|
||||
|
||||
if (ec == null)
|
||||
throw new InternalErrorException ("Define called before DefineType?");
|
||||
|
||||
// FIXME: POSSIBLY make this static, as it is always constant
|
||||
//
|
||||
Type [] const_arg_types = new Type [2];
|
||||
|
||||
+3
-34
@@ -20,7 +20,6 @@ namespace Mono.CSharp
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
using System.Xml;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
public enum Target {
|
||||
Library, Exe, Module, WinExe
|
||||
@@ -222,6 +221,7 @@ namespace Mono.CSharp
|
||||
" -nostdlib[+|-] Does not load core libraries\n" +
|
||||
" -nowarn:W1[,W2] Disables one or more warnings\n" +
|
||||
" -out:FNAME Specifies output file\n" +
|
||||
" -doc:XMLFILE Generates xml documentation into specified file\n" +
|
||||
" -pkg:P1[,Pn] References packages P1..Pn\n" +
|
||||
" --expect-error X Expect that error X will be encountered\n" +
|
||||
" -recurse:SPEC Recursively compiles the files in SPEC ([dir]/file)\n" +
|
||||
@@ -238,7 +238,6 @@ namespace Mono.CSharp
|
||||
//
|
||||
" -removeintchecks[+|-] Set default context to unchecked\n" +
|
||||
" -optionstrict[+|-] Enables stricter type checking\n" +
|
||||
" -optioncompare:[text|binary] Specifies the default mode for character comparisons\n" +
|
||||
|
||||
"\n" +
|
||||
"Resources:\n" +
|
||||
@@ -733,6 +732,7 @@ namespace Mono.CSharp
|
||||
case "--checked":
|
||||
RootContext.Checked = true;
|
||||
return true;
|
||||
|
||||
|
||||
case "--stacktrace":
|
||||
Report.Stacktrace = true;
|
||||
@@ -907,23 +907,6 @@ namespace Mono.CSharp
|
||||
case "--optionstrict":
|
||||
RootContext.StricterTypeChecking= true;
|
||||
return true;
|
||||
|
||||
case "--optioncompare":
|
||||
if ((i + 1) >= args.Length){
|
||||
Usage ();
|
||||
Environment.Exit (1);
|
||||
}
|
||||
|
||||
if (args [++i].Equals ("text"))
|
||||
RootContext.StringComparisonMode = CompareMethod.Text;
|
||||
else if (args[++i].Equals ("binary"))
|
||||
RootContext.StringComparisonMode = CompareMethod.Binary;
|
||||
else {
|
||||
Report.Error (5, "Invalid argument to --optioncompare");
|
||||
Environment.Exit (1);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -1179,6 +1162,7 @@ namespace Mono.CSharp
|
||||
RootContext.Checked = false;
|
||||
return true;
|
||||
|
||||
|
||||
case "/clscheck":
|
||||
case "/clscheck+":
|
||||
return true;
|
||||
@@ -1364,21 +1348,6 @@ namespace Mono.CSharp
|
||||
RootContext.StricterTypeChecking = false;
|
||||
return true;
|
||||
|
||||
case "/optioncompare":
|
||||
if (value == ""){
|
||||
Report.Error (5, arg + " requires an argument");
|
||||
Environment.Exit (1);
|
||||
}
|
||||
if (value.Equals ("text"))
|
||||
RootContext.StringComparisonMode = CompareMethod.Text;
|
||||
else if (value.Equals ("binary"))
|
||||
RootContext.StringComparisonMode = CompareMethod.Binary;
|
||||
else {
|
||||
Report.Error (5, "Invalid argument to /optioncompare");
|
||||
Environment.Exit (1);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
//Report.Error (2007, String.Format ("Unrecognized command-line option: '{0}'", option));
|
||||
//Environment.Exit (1);
|
||||
|
||||
+22
-39
@@ -815,7 +815,7 @@ namespace Mono.CSharp {
|
||||
/// Returns an expression that can be used to invoke operator true
|
||||
/// on the expression if it exists.
|
||||
/// </summary>
|
||||
static public Expression GetOperatorTrue (EmitContext ec, Expression e, Location loc)
|
||||
static public StaticCallExpr GetOperatorTrue (EmitContext ec, Expression e, Location loc)
|
||||
{
|
||||
return GetOperatorTrueOrFalse (ec, e, true, loc);
|
||||
}
|
||||
@@ -824,19 +824,16 @@ namespace Mono.CSharp {
|
||||
/// Returns an expression that can be used to invoke operator false
|
||||
/// on the expression if it exists.
|
||||
/// </summary>
|
||||
static public Expression GetOperatorFalse (EmitContext ec, Expression e, Location loc)
|
||||
static public StaticCallExpr GetOperatorFalse (EmitContext ec, Expression e, Location loc)
|
||||
{
|
||||
return GetOperatorTrueOrFalse (ec, e, false, loc);
|
||||
}
|
||||
|
||||
static Expression GetOperatorTrueOrFalse (EmitContext ec, Expression e, bool is_true, Location loc)
|
||||
static StaticCallExpr GetOperatorTrueOrFalse (EmitContext ec, Expression e, bool is_true, Location loc)
|
||||
{
|
||||
MethodBase method;
|
||||
Expression operator_group;
|
||||
|
||||
if (TypeManager.IsNullableType (e.Type))
|
||||
return new Nullable.OperatorTrueOrFalse (e, is_true, loc).Resolve (ec);
|
||||
|
||||
operator_group = MethodLookup (ec, e.Type, is_true ? "op_True" : "op_False", loc);
|
||||
if (operator_group == null)
|
||||
return null;
|
||||
@@ -944,7 +941,7 @@ namespace Mono.CSharp {
|
||||
sb.Append (valid [i]);
|
||||
}
|
||||
|
||||
Report.Error (119, loc, "Expression denotes a `" + ExprClassName () + "' where " +
|
||||
Error (119, "Expression denotes a `" + ExprClassName () + "' where " +
|
||||
"a `" + sb.ToString () + "' was expected");
|
||||
}
|
||||
|
||||
@@ -1500,27 +1497,31 @@ namespace Mono.CSharp {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// HelperMethodInvocation of methods or delegates. Used by the
|
||||
/// ImplicitInvocation of methods or delegates. Used by the
|
||||
/// VB.NET compiler specifically to emit calls to the
|
||||
/// Microsoft.VisualBasic.CompilerServices helper routines
|
||||
/// </summary>
|
||||
|
||||
public class HelperMethodInvocation : Expression
|
||||
public class ImplicitInvocation : Expression
|
||||
{
|
||||
ArrayList args;
|
||||
MethodInfo method;
|
||||
const string DEFAULT_NS_PREFIX = "Microsoft.VisualBasic.CompilerServices";
|
||||
|
||||
Expression child;
|
||||
|
||||
public HelperMethodInvocation (EmitContext ec, Location l, Type return_type, MethodInfo method, params Expression [] exprs)
|
||||
public ImplicitInvocation (EmitContext ec, string klass, string method, Location l, params Expression [] exprs)
|
||||
: this (ec, DEFAULT_NS_PREFIX, klass, method, l, exprs)
|
||||
{
|
||||
args = new ArrayList ();
|
||||
}
|
||||
|
||||
public ImplicitInvocation (EmitContext ec, string ns, string klass, string method, Location l, params Expression [] exprs)
|
||||
{
|
||||
ArrayList args = new ArrayList ();
|
||||
string name = ns + "." + klass + "." + method;
|
||||
|
||||
foreach (Expression expr in exprs)
|
||||
args.Add (new Argument (expr, Argument.AType.Expression));
|
||||
|
||||
|
||||
this.loc = l;
|
||||
this.method = method;
|
||||
type = return_type;
|
||||
eclass = ExprClass.Value;
|
||||
child = new Invocation (StringToExpression (name, l), args, l).Resolve (ec);
|
||||
}
|
||||
|
||||
public override Expression DoResolve (EmitContext ec)
|
||||
@@ -1530,8 +1531,7 @@ namespace Mono.CSharp {
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
Invocation.EmitArguments (ec, method, args, false, null);
|
||||
ec.ig.Emit (OpCodes.Call, method);
|
||||
child.Emit (ec);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1604,19 +1604,7 @@ namespace Mono.CSharp {
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
if (!type.IsValueType)
|
||||
child.Emit (ec);
|
||||
else {
|
||||
// VB.NET allows Nothing to be converted to any value type
|
||||
|
||||
ILGenerator ig = ec.ig;
|
||||
|
||||
ig.Emit (OpCodes.Ldtoken, type);
|
||||
ig.Emit (OpCodes.Call, TypeManager.system_type_get_type_from_handle);
|
||||
ig.Emit (OpCodes.Call, TypeManager.activator_create_instance);
|
||||
ig.Emit (OpCodes.Unbox, type);
|
||||
ig.Emit (OpCodes.Ldobj, type);
|
||||
}
|
||||
child.Emit (ec);
|
||||
}
|
||||
|
||||
public override bool IsNegative {
|
||||
@@ -2209,7 +2197,7 @@ namespace Mono.CSharp {
|
||||
//
|
||||
public class FloatingToFixedCast : ConvCast {
|
||||
public FloatingToFixedCast (EmitContext ec, Expression child, Type return_type, Mode mode)
|
||||
: base (ec, new HelperMethodInvocation (ec, child.Location, TypeManager.double_type, TypeManager.math_round_double,
|
||||
: base (ec, new ImplicitInvocation (ec, "System", "Math", "Round", child.Location,
|
||||
(child.Type == TypeManager.float_type) ?
|
||||
new OpcodeCast (child, TypeManager.double_type, OpCodes.Conv_R8) : child),
|
||||
return_type, mode)
|
||||
@@ -2494,11 +2482,6 @@ namespace Mono.CSharp {
|
||||
/// section 10.8.1 (Fully Qualified Names).
|
||||
/// </summary>
|
||||
public abstract class FullNamedExpression : Expression {
|
||||
public override FullNamedExpression ResolveAsTypeStep (EmitContext ec)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public abstract string FullName {
|
||||
get;
|
||||
}
|
||||
|
||||
+126
-798
File diff suppressed because it is too large.
Load diff
@@ -214,13 +214,13 @@ namespace Generator {
|
||||
prec = 2;
|
||||
op = "|"; break;
|
||||
|
||||
case Binary.Operator.LogicalAndAlso:
|
||||
case Binary.Operator.LogicalAnd:
|
||||
prec = 1;
|
||||
op = "AndAlso"; break;
|
||||
op = "&&"; break;
|
||||
|
||||
case Binary.Operator.LogicalOrElse:
|
||||
case Binary.Operator.LogicalOr:
|
||||
prec = 0;
|
||||
op = "OrElse"; break;
|
||||
op = "||"; break;
|
||||
|
||||
case Binary.Operator.ExclusiveOr:
|
||||
prec = 3;
|
||||
|
||||
+74
-776
@@ -655,38 +655,6 @@ namespace Mono.CSharp {
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool UpdateConstraints (EmitContext ec, Constraints new_constraints, bool check)
|
||||
{
|
||||
//
|
||||
// We're used in partial generic type definitions.
|
||||
// If `check' is false, we just encountered the first ClassPart which has
|
||||
// constraints - they become our "real" constraints.
|
||||
// Otherwise we're called after the type parameters have already been defined
|
||||
// and check whether the constraints are the same in all parts.
|
||||
//
|
||||
if (!check) {
|
||||
if (type != null)
|
||||
throw new InvalidOperationException ();
|
||||
constraints = new_constraints;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type == null)
|
||||
throw new InvalidOperationException ();
|
||||
|
||||
if (constraints == null)
|
||||
return new_constraints == null;
|
||||
else if (new_constraints == null)
|
||||
return false;
|
||||
|
||||
if (!new_constraints.Resolve (ec))
|
||||
return false;
|
||||
if (!new_constraints.ResolveTypes (ec))
|
||||
return false;
|
||||
|
||||
return constraints.CheckInterfaceMethod (ec, new_constraints);
|
||||
}
|
||||
|
||||
public override string DocCommentHeader {
|
||||
get {
|
||||
throw new InvalidOperationException (
|
||||
@@ -1598,16 +1566,12 @@ namespace Mono.CSharp {
|
||||
eclass = ExprClass.Type;
|
||||
}
|
||||
|
||||
public NullableType (Type type, Location loc)
|
||||
: this (new TypeExpression (type, loc), loc)
|
||||
{ }
|
||||
|
||||
public override string Name {
|
||||
get { return underlying.ToString () + "?"; }
|
||||
get { return underlying.ToString (); }
|
||||
}
|
||||
|
||||
public override string FullName {
|
||||
get { return underlying.ToString () + "?"; }
|
||||
get { return underlying.ToString (); }
|
||||
}
|
||||
|
||||
protected override TypeExpr DoResolveAsTypeStep (EmitContext ec)
|
||||
@@ -1756,22 +1720,6 @@ namespace Mono.CSharp {
|
||||
return t.GetGenericArguments ();
|
||||
}
|
||||
|
||||
//
|
||||
// Whether `array' is an array of T and `enumerator' is `IEnumerable<T>'.
|
||||
// For instance "string[]" -> "IEnumerable<string>".
|
||||
//
|
||||
public static bool IsIEnumerable (Type array, Type enumerator)
|
||||
{
|
||||
if (!array.IsArray || !enumerator.IsGenericInstance)
|
||||
return false;
|
||||
|
||||
if (enumerator.GetGenericTypeDefinition () != generic_ienumerable_type)
|
||||
return false;
|
||||
|
||||
Type[] args = GetTypeArguments (enumerator);
|
||||
return args [0] == GetElementType (array);
|
||||
}
|
||||
|
||||
public static bool IsEqual (Type a, Type b)
|
||||
{
|
||||
if (a.Equals (b))
|
||||
@@ -1811,9 +1759,6 @@ namespace Mono.CSharp {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((b is TypeBuilder) && b.IsGenericTypeDefinition && a.IsGenericInstance)
|
||||
return IsEqual (b, a);
|
||||
|
||||
if (a.IsGenericParameter && b.IsGenericParameter) {
|
||||
if ((a.DeclaringMethod == null) || (b.DeclaringMethod == null))
|
||||
return false;
|
||||
@@ -2283,6 +2228,29 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
public class NullCoalescingOperator : Expression
|
||||
{
|
||||
Expression left;
|
||||
Expression right;
|
||||
|
||||
public NullCoalescingOperator (Expression left, Expression right, Location loc)
|
||||
{
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
public override Expression DoResolve (EmitContext ec)
|
||||
{
|
||||
Error (-1, "The ?? operator is not yet implemented.");
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class Nullable
|
||||
{
|
||||
protected sealed class NullableInfo
|
||||
@@ -2307,129 +2275,8 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
protected class Unwrap : Expression, IMemoryLocation, IAssignMethod
|
||||
{
|
||||
Expression expr;
|
||||
NullableInfo info;
|
||||
|
||||
LocalTemporary temp;
|
||||
bool has_temp;
|
||||
|
||||
public Unwrap (Expression expr, Location loc)
|
||||
{
|
||||
this.expr = expr;
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
public override Expression DoResolve (EmitContext ec)
|
||||
{
|
||||
expr = expr.Resolve (ec);
|
||||
if (expr == null)
|
||||
return null;
|
||||
|
||||
if (!(expr is IMemoryLocation))
|
||||
temp = new LocalTemporary (ec, expr.Type);
|
||||
|
||||
info = new NullableInfo (expr.Type);
|
||||
type = info.UnderlyingType;
|
||||
eclass = expr.eclass;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
AddressOf (ec, AddressOp.LoadStore);
|
||||
ec.ig.EmitCall (OpCodes.Call, info.Value, null);
|
||||
}
|
||||
|
||||
public void EmitCheck (EmitContext ec)
|
||||
{
|
||||
AddressOf (ec, AddressOp.LoadStore);
|
||||
ec.ig.EmitCall (OpCodes.Call, info.HasValue, null);
|
||||
}
|
||||
|
||||
void create_temp (EmitContext ec)
|
||||
{
|
||||
if ((temp != null) && !has_temp) {
|
||||
expr.Emit (ec);
|
||||
temp.Store (ec);
|
||||
has_temp = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddressOf (EmitContext ec, AddressOp mode)
|
||||
{
|
||||
create_temp (ec);
|
||||
if (temp != null)
|
||||
temp.AddressOf (ec, AddressOp.LoadStore);
|
||||
else
|
||||
((IMemoryLocation) expr).AddressOf (ec, AddressOp.LoadStore);
|
||||
}
|
||||
|
||||
public void Emit (EmitContext ec, bool leave_copy)
|
||||
{
|
||||
create_temp (ec);
|
||||
if (leave_copy) {
|
||||
if (temp != null)
|
||||
temp.Emit (ec);
|
||||
else
|
||||
expr.Emit (ec);
|
||||
}
|
||||
|
||||
Emit (ec);
|
||||
}
|
||||
|
||||
public void EmitAssign (EmitContext ec, Expression source,
|
||||
bool leave_copy, bool prepare_for_load)
|
||||
{
|
||||
source.Emit (ec);
|
||||
ec.ig.Emit (OpCodes.Newobj, info.Constructor);
|
||||
|
||||
if (leave_copy)
|
||||
ec.ig.Emit (OpCodes.Dup);
|
||||
|
||||
Expression empty = new EmptyExpression (expr.Type);
|
||||
((IAssignMethod) expr).EmitAssign (ec, empty, false, prepare_for_load);
|
||||
}
|
||||
}
|
||||
|
||||
protected class Wrap : Expression
|
||||
{
|
||||
Expression expr;
|
||||
NullableInfo info;
|
||||
|
||||
public Wrap (Expression expr, Location loc)
|
||||
{
|
||||
this.expr = expr;
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
public override Expression DoResolve (EmitContext ec)
|
||||
{
|
||||
expr = expr.Resolve (ec);
|
||||
if (expr == null)
|
||||
return null;
|
||||
|
||||
TypeExpr target_type = new NullableType (expr.Type, loc);
|
||||
target_type = target_type.ResolveAsTypeTerminal (ec);
|
||||
if (target_type == null)
|
||||
return null;
|
||||
|
||||
type = target_type.Type;
|
||||
info = new NullableInfo (type);
|
||||
eclass = ExprClass.Value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
expr.Emit (ec);
|
||||
ec.ig.Emit (OpCodes.Newobj, info.Constructor);
|
||||
}
|
||||
}
|
||||
|
||||
public class NullableLiteral : Expression, IMemoryLocation {
|
||||
public NullableLiteral (Type target_type, Location loc)
|
||||
public class NullLiteral : Expression, IMemoryLocation {
|
||||
public NullLiteral (Type target_type, Location loc)
|
||||
{
|
||||
this.type = target_type;
|
||||
this.loc = loc;
|
||||
@@ -2461,630 +2308,81 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class Lifted : Expression, IMemoryLocation
|
||||
public class LiftedConversion : Expression
|
||||
{
|
||||
Expression expr, underlying, wrap, null_value;
|
||||
Unwrap unwrap;
|
||||
Expression source;
|
||||
bool is_explicit;
|
||||
NullableInfo source_info, target_info;
|
||||
Expression conversion;
|
||||
|
||||
protected Lifted (Expression expr, Location loc)
|
||||
protected LiftedConversion (Expression source, Type target_type, bool is_explicit,
|
||||
Location loc)
|
||||
{
|
||||
this.expr = expr;
|
||||
this.source = source;
|
||||
this.type = target_type;
|
||||
this.is_explicit = is_explicit;
|
||||
this.loc = loc;
|
||||
|
||||
eclass = source.eclass;
|
||||
}
|
||||
|
||||
public static Expression Create (EmitContext ec, Expression source, Type target_type,
|
||||
bool is_explicit, Location loc)
|
||||
{
|
||||
Expression expr = new LiftedConversion (source, target_type, is_explicit, loc);
|
||||
return expr.Resolve (ec);
|
||||
}
|
||||
|
||||
public override Expression DoResolve (EmitContext ec)
|
||||
{
|
||||
expr = expr.Resolve (ec);
|
||||
if (expr == null)
|
||||
source_info = new NullableInfo (source.Type);
|
||||
target_info = new NullableInfo (type);
|
||||
|
||||
source = source.Resolve (ec);
|
||||
if (source == null)
|
||||
return null;
|
||||
|
||||
unwrap = (Unwrap) new Unwrap (expr, loc).Resolve (ec);
|
||||
if (unwrap == null)
|
||||
return null;
|
||||
|
||||
underlying = ResolveUnderlying (unwrap, ec);
|
||||
if (underlying == null)
|
||||
return null;
|
||||
|
||||
wrap = new Wrap (underlying, loc).Resolve (ec);
|
||||
if (wrap == null)
|
||||
return null;
|
||||
|
||||
null_value = new NullableLiteral (wrap.Type, loc).Resolve (ec);
|
||||
if (null_value == null)
|
||||
return null;
|
||||
|
||||
type = wrap.Type;
|
||||
eclass = ExprClass.Value;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected abstract Expression ResolveUnderlying (Expression unwrap, EmitContext ec);
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
Label is_null_label = ig.DefineLabel ();
|
||||
Label end_label = ig.DefineLabel ();
|
||||
|
||||
unwrap.EmitCheck (ec);
|
||||
ig.Emit (OpCodes.Brfalse, is_null_label);
|
||||
|
||||
wrap.Emit (ec);
|
||||
ig.Emit (OpCodes.Br, end_label);
|
||||
|
||||
ig.MarkLabel (is_null_label);
|
||||
null_value.Emit (ec);
|
||||
|
||||
ig.MarkLabel (end_label);
|
||||
}
|
||||
|
||||
public void AddressOf (EmitContext ec, AddressOp mode)
|
||||
{
|
||||
unwrap.AddressOf (ec, mode);
|
||||
}
|
||||
}
|
||||
|
||||
public class LiftedConversion : Lifted
|
||||
{
|
||||
public readonly bool IsUser;
|
||||
public readonly bool IsExplicit;
|
||||
public readonly Type TargetType;
|
||||
|
||||
public LiftedConversion (Expression expr, Type target_type, bool is_user,
|
||||
bool is_explicit, Location loc)
|
||||
: base (expr, loc)
|
||||
{
|
||||
this.IsUser = is_user;
|
||||
this.IsExplicit = is_explicit;
|
||||
this.TargetType = target_type;
|
||||
}
|
||||
|
||||
protected override Expression ResolveUnderlying (Expression unwrap, EmitContext ec)
|
||||
{
|
||||
Type type = TypeManager.GetTypeArguments (TargetType) [0];
|
||||
|
||||
if (IsUser) {
|
||||
return Convert.UserDefinedConversion (ec, unwrap, type, loc, IsExplicit);
|
||||
} else {
|
||||
if (IsExplicit)
|
||||
return Convert.WideningAndNarrowingConversion (ec, unwrap, type, loc);
|
||||
else
|
||||
return Convert.WideningConversion (ec, unwrap, type, loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class LiftedUnaryOperator : Lifted
|
||||
{
|
||||
public readonly Unary.Operator Oper;
|
||||
|
||||
public LiftedUnaryOperator (Unary.Operator op, Expression expr, Location loc)
|
||||
: base (expr, loc)
|
||||
{
|
||||
this.Oper = op;
|
||||
}
|
||||
|
||||
protected override Expression ResolveUnderlying (Expression unwrap, EmitContext ec)
|
||||
{
|
||||
return new Unary (Oper, unwrap, loc);
|
||||
}
|
||||
}
|
||||
|
||||
public class LiftedConditional : Lifted
|
||||
{
|
||||
Expression expr, true_expr, false_expr;
|
||||
Unwrap unwrap;
|
||||
|
||||
public LiftedConditional (Expression expr, Expression true_expr, Expression false_expr,
|
||||
Location loc)
|
||||
: base (expr, loc)
|
||||
{
|
||||
this.true_expr = true_expr;
|
||||
this.false_expr = false_expr;
|
||||
}
|
||||
|
||||
protected override Expression ResolveUnderlying (Expression unwrap, EmitContext ec)
|
||||
{
|
||||
return new Conditional (unwrap, true_expr, false_expr, loc);
|
||||
}
|
||||
}
|
||||
|
||||
public class LiftedBinaryOperator : Expression
|
||||
{
|
||||
public readonly Binary.Operator Oper;
|
||||
|
||||
Expression left, right, underlying, null_value, bool_wrap;
|
||||
Unwrap left_unwrap, right_unwrap;
|
||||
bool is_equality, is_comparision, is_boolean;
|
||||
|
||||
public LiftedBinaryOperator (Binary.Operator op, Expression left, Expression right,
|
||||
Location loc)
|
||||
{
|
||||
this.Oper = op;
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
public override Expression DoResolve (EmitContext ec)
|
||||
{
|
||||
if (TypeManager.IsNullableType (left.Type)) {
|
||||
left_unwrap = new Unwrap (left, loc);
|
||||
left = left_unwrap.Resolve (ec);
|
||||
if (left == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
if (TypeManager.IsNullableType (right.Type)) {
|
||||
right_unwrap = new Unwrap (right, loc);
|
||||
right = right_unwrap.Resolve (ec);
|
||||
if (right == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
if (((Oper == Binary.Operator.BitwiseAnd) || (Oper == Binary.Operator.BitwiseOr) ||
|
||||
(Oper == Binary.Operator.LogicalAndAlso) || (Oper == Binary.Operator.LogicalOrElse)) &&
|
||||
((left.Type == TypeManager.bool_type) && (right.Type == TypeManager.bool_type))) {
|
||||
Expression empty = new EmptyExpression (TypeManager.bool_type);
|
||||
bool_wrap = new Wrap (empty, loc).Resolve (ec);
|
||||
null_value = new NullableLiteral (bool_wrap.Type, loc).Resolve (ec);
|
||||
|
||||
type = bool_wrap.Type;
|
||||
is_boolean = true;
|
||||
} else if ((Oper == Binary.Operator.Equality) || (Oper == Binary.Operator.Inequality)) {
|
||||
if (!(left is NullLiteral) && !(right is NullLiteral)) {
|
||||
underlying = new Binary (Oper, left, right, loc).Resolve (ec);
|
||||
if (underlying == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
type = TypeManager.bool_type;
|
||||
is_equality = true;
|
||||
} else if ((Oper == Binary.Operator.LessThan) ||
|
||||
(Oper == Binary.Operator.GreaterThan) ||
|
||||
(Oper == Binary.Operator.LessThanOrEqual) ||
|
||||
(Oper == Binary.Operator.GreaterThanOrEqual)) {
|
||||
underlying = new Binary (Oper, left, right, loc).Resolve (ec);
|
||||
if (underlying == null)
|
||||
return null;
|
||||
|
||||
type = TypeManager.bool_type;
|
||||
is_comparision = true;
|
||||
} else {
|
||||
underlying = new Binary (Oper, left, right, loc).Resolve (ec);
|
||||
if (underlying == null)
|
||||
return null;
|
||||
|
||||
underlying = new Wrap (underlying, loc).Resolve (ec);
|
||||
if (underlying == null)
|
||||
return null;
|
||||
|
||||
type = underlying.Type;
|
||||
null_value = new NullableLiteral (type, loc).Resolve (ec);
|
||||
}
|
||||
|
||||
eclass = ExprClass.Value;
|
||||
return this;
|
||||
}
|
||||
|
||||
void EmitBoolean (EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
|
||||
Label left_is_null_label = ig.DefineLabel ();
|
||||
Label right_is_null_label = ig.DefineLabel ();
|
||||
Label is_null_label = ig.DefineLabel ();
|
||||
Label wrap_label = ig.DefineLabel ();
|
||||
Label end_label = ig.DefineLabel ();
|
||||
|
||||
if (left_unwrap != null) {
|
||||
left_unwrap.EmitCheck (ec);
|
||||
ig.Emit (OpCodes.Brfalse, left_is_null_label);
|
||||
}
|
||||
|
||||
left.Emit (ec);
|
||||
ig.Emit (OpCodes.Dup);
|
||||
if ((Oper == Binary.Operator.BitwiseOr) || (Oper == Binary.Operator.LogicalOrElse))
|
||||
ig.Emit (OpCodes.Brtrue, wrap_label);
|
||||
if (is_explicit)
|
||||
conversion = Convert.WideningAndNarrowingConversionStandard (
|
||||
ec, new EmptyExpression (source_info.UnderlyingType),
|
||||
target_info.UnderlyingType, loc);
|
||||
else
|
||||
ig.Emit (OpCodes.Brfalse, wrap_label);
|
||||
conversion = Convert.WideningConversionStandard (
|
||||
ec, new EmptyExpression (source_info.UnderlyingType),
|
||||
target_info.UnderlyingType, loc);
|
||||
|
||||
if (right_unwrap != null) {
|
||||
right_unwrap.EmitCheck (ec);
|
||||
ig.Emit (OpCodes.Brfalse, right_is_null_label);
|
||||
}
|
||||
|
||||
if ((Oper == Binary.Operator.LogicalAndAlso) || (Oper == Binary.Operator.LogicalOrElse))
|
||||
ig.Emit (OpCodes.Pop);
|
||||
|
||||
right.Emit (ec);
|
||||
if (Oper == Binary.Operator.BitwiseOr)
|
||||
ig.Emit (OpCodes.Or);
|
||||
else if (Oper == Binary.Operator.BitwiseAnd)
|
||||
ig.Emit (OpCodes.And);
|
||||
ig.Emit (OpCodes.Br, wrap_label);
|
||||
|
||||
ig.MarkLabel (left_is_null_label);
|
||||
if (right_unwrap != null) {
|
||||
right_unwrap.EmitCheck (ec);
|
||||
ig.Emit (OpCodes.Brfalse, is_null_label);
|
||||
}
|
||||
|
||||
right.Emit (ec);
|
||||
ig.Emit (OpCodes.Dup);
|
||||
if ((Oper == Binary.Operator.BitwiseOr) || (Oper == Binary.Operator.LogicalOrElse))
|
||||
ig.Emit (OpCodes.Brtrue, wrap_label);
|
||||
else
|
||||
ig.Emit (OpCodes.Brfalse, wrap_label);
|
||||
|
||||
ig.MarkLabel (right_is_null_label);
|
||||
ig.Emit (OpCodes.Pop);
|
||||
ig.MarkLabel (is_null_label);
|
||||
null_value.Emit (ec);
|
||||
ig.Emit (OpCodes.Br, end_label);
|
||||
|
||||
ig.MarkLabel (wrap_label);
|
||||
ig.Emit (OpCodes.Nop);
|
||||
bool_wrap.Emit (ec);
|
||||
ig.Emit (OpCodes.Nop);
|
||||
|
||||
ig.MarkLabel (end_label);
|
||||
}
|
||||
|
||||
void EmitEquality (EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
|
||||
Label left_not_null_label = ig.DefineLabel ();
|
||||
Label false_label = ig.DefineLabel ();
|
||||
Label true_label = ig.DefineLabel ();
|
||||
Label end_label = ig.DefineLabel ();
|
||||
|
||||
if (left_unwrap != null) {
|
||||
left_unwrap.EmitCheck (ec);
|
||||
if (right is NullLiteral) {
|
||||
if (Oper == Binary.Operator.Equality)
|
||||
ig.Emit (OpCodes.Brfalse, true_label);
|
||||
else
|
||||
ig.Emit (OpCodes.Brfalse, false_label);
|
||||
} else if (right_unwrap != null) {
|
||||
ig.Emit (OpCodes.Dup);
|
||||
ig.Emit (OpCodes.Brtrue, left_not_null_label);
|
||||
right_unwrap.EmitCheck (ec);
|
||||
ig.Emit (OpCodes.Ceq);
|
||||
if (Oper == Binary.Operator.Inequality) {
|
||||
ig.Emit (OpCodes.Ldc_I4_0);
|
||||
ig.Emit (OpCodes.Ceq);
|
||||
}
|
||||
ig.Emit (OpCodes.Br, end_label);
|
||||
|
||||
ig.MarkLabel (left_not_null_label);
|
||||
ig.Emit (OpCodes.Pop);
|
||||
} else {
|
||||
if (Oper == Binary.Operator.Equality)
|
||||
ig.Emit (OpCodes.Brfalse, false_label);
|
||||
else
|
||||
ig.Emit (OpCodes.Brfalse, true_label);
|
||||
}
|
||||
}
|
||||
|
||||
if (right_unwrap != null) {
|
||||
right_unwrap.EmitCheck (ec);
|
||||
if (left is NullLiteral) {
|
||||
if (Oper == Binary.Operator.Equality)
|
||||
ig.Emit (OpCodes.Brfalse, true_label);
|
||||
else
|
||||
ig.Emit (OpCodes.Brfalse, false_label);
|
||||
} else {
|
||||
if (Oper == Binary.Operator.Equality)
|
||||
ig.Emit (OpCodes.Brfalse, false_label);
|
||||
else
|
||||
ig.Emit (OpCodes.Brfalse, true_label);
|
||||
}
|
||||
}
|
||||
|
||||
bool left_is_null = left is NullLiteral;
|
||||
bool right_is_null = right is NullLiteral;
|
||||
if (left_is_null || right_is_null) {
|
||||
if (((Oper == Binary.Operator.Equality) && (left_is_null == right_is_null)) ||
|
||||
((Oper == Binary.Operator.Inequality) && (left_is_null != right_is_null)))
|
||||
ig.Emit (OpCodes.Br, true_label);
|
||||
else
|
||||
ig.Emit (OpCodes.Br, false_label);
|
||||
} else {
|
||||
underlying.Emit (ec);
|
||||
ig.Emit (OpCodes.Br, end_label);
|
||||
}
|
||||
|
||||
ig.MarkLabel (false_label);
|
||||
ig.Emit (OpCodes.Ldc_I4_0);
|
||||
ig.Emit (OpCodes.Br, end_label);
|
||||
|
||||
ig.MarkLabel (true_label);
|
||||
ig.Emit (OpCodes.Ldc_I4_1);
|
||||
|
||||
ig.MarkLabel (end_label);
|
||||
}
|
||||
|
||||
void EmitComparision (EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
|
||||
Label is_null_label = ig.DefineLabel ();
|
||||
Label end_label = ig.DefineLabel ();
|
||||
|
||||
if (left_unwrap != null) {
|
||||
left_unwrap.EmitCheck (ec);
|
||||
ig.Emit (OpCodes.Brfalse, is_null_label);
|
||||
}
|
||||
|
||||
if (right_unwrap != null) {
|
||||
right_unwrap.EmitCheck (ec);
|
||||
ig.Emit (OpCodes.Brfalse, is_null_label);
|
||||
}
|
||||
|
||||
underlying.Emit (ec);
|
||||
ig.Emit (OpCodes.Br, end_label);
|
||||
|
||||
ig.MarkLabel (is_null_label);
|
||||
ig.Emit (OpCodes.Ldc_I4_0);
|
||||
|
||||
ig.MarkLabel (end_label);
|
||||
}
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
if (is_boolean) {
|
||||
EmitBoolean (ec);
|
||||
return;
|
||||
} else if (is_equality) {
|
||||
EmitEquality (ec);
|
||||
return;
|
||||
} else if (is_comparision) {
|
||||
EmitComparision (ec);
|
||||
return;
|
||||
}
|
||||
|
||||
ILGenerator ig = ec.ig;
|
||||
|
||||
Label is_null_label = ig.DefineLabel ();
|
||||
Label end_label = ig.DefineLabel ();
|
||||
|
||||
if (left_unwrap != null) {
|
||||
left_unwrap.EmitCheck (ec);
|
||||
ig.Emit (OpCodes.Brfalse, is_null_label);
|
||||
}
|
||||
|
||||
if (right_unwrap != null) {
|
||||
right_unwrap.EmitCheck (ec);
|
||||
ig.Emit (OpCodes.Brfalse, is_null_label);
|
||||
}
|
||||
|
||||
underlying.Emit (ec);
|
||||
ig.Emit (OpCodes.Br, end_label);
|
||||
|
||||
ig.MarkLabel (is_null_label);
|
||||
null_value.Emit (ec);
|
||||
|
||||
ig.MarkLabel (end_label);
|
||||
}
|
||||
}
|
||||
|
||||
public class OperatorTrueOrFalse : Expression
|
||||
{
|
||||
public readonly bool IsTrue;
|
||||
|
||||
Expression expr;
|
||||
Unwrap unwrap;
|
||||
|
||||
public OperatorTrueOrFalse (Expression expr, bool is_true, Location loc)
|
||||
{
|
||||
this.IsTrue = is_true;
|
||||
this.expr = expr;
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
public override Expression DoResolve (EmitContext ec)
|
||||
{
|
||||
unwrap = new Unwrap (expr, loc);
|
||||
expr = unwrap.Resolve (ec);
|
||||
if (expr == null)
|
||||
if (conversion == null)
|
||||
return null;
|
||||
|
||||
if (unwrap.Type != TypeManager.bool_type)
|
||||
return null;
|
||||
|
||||
type = TypeManager.bool_type;
|
||||
eclass = ExprClass.Value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
|
||||
Label is_null_label = ig.DefineLabel ();
|
||||
Label has_value_label = ig.DefineLabel ();
|
||||
Label end_label = ig.DefineLabel ();
|
||||
|
||||
unwrap.EmitCheck (ec);
|
||||
ig.Emit (OpCodes.Brfalse, is_null_label);
|
||||
((IMemoryLocation) source).AddressOf (ec, AddressOp.LoadStore);
|
||||
ig.EmitCall (OpCodes.Call, source_info.HasValue, null);
|
||||
ig.Emit (OpCodes.Brtrue, has_value_label);
|
||||
|
||||
unwrap.Emit (ec);
|
||||
if (!IsTrue) {
|
||||
ig.Emit (OpCodes.Ldc_I4_0);
|
||||
ig.Emit (OpCodes.Ceq);
|
||||
}
|
||||
LocalTemporary value_target = new LocalTemporary (ec, type);
|
||||
value_target.AddressOf (ec, AddressOp.Store);
|
||||
ig.Emit (OpCodes.Initobj, type);
|
||||
value_target.Emit (ec);
|
||||
value_target.Release (ec);
|
||||
ig.Emit (OpCodes.Br, end_label);
|
||||
|
||||
ig.MarkLabel (is_null_label);
|
||||
ig.Emit (OpCodes.Ldc_I4_0);
|
||||
ig.MarkLabel (has_value_label);
|
||||
|
||||
((IMemoryLocation) source).AddressOf (ec, AddressOp.LoadStore);
|
||||
ig.EmitCall (OpCodes.Call, source_info.Value, null);
|
||||
conversion.Emit (ec);
|
||||
ig.Emit (OpCodes.Newobj, target_info.Constructor);
|
||||
|
||||
ig.MarkLabel (end_label);
|
||||
}
|
||||
}
|
||||
|
||||
public class NullCoalescingOperator : Expression
|
||||
{
|
||||
Expression left, right;
|
||||
Expression expr;
|
||||
Unwrap unwrap;
|
||||
|
||||
public NullCoalescingOperator (Expression left, Expression right, Location loc)
|
||||
{
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.loc = loc;
|
||||
|
||||
eclass = ExprClass.Value;
|
||||
}
|
||||
|
||||
public override Expression DoResolve (EmitContext ec)
|
||||
{
|
||||
if (type != null)
|
||||
return this;
|
||||
|
||||
left = left.Resolve (ec);
|
||||
if (left == null)
|
||||
return null;
|
||||
|
||||
right = right.Resolve (ec);
|
||||
if (right == null)
|
||||
return null;
|
||||
|
||||
Type ltype = left.Type, rtype = right.Type;
|
||||
|
||||
if (!TypeManager.IsNullableType (ltype) && ltype.IsValueType) {
|
||||
Binary.Error_OperatorCannotBeApplied (loc, "??", ltype, rtype);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (TypeManager.IsNullableType (ltype)) {
|
||||
NullableInfo info = new NullableInfo (ltype);
|
||||
|
||||
unwrap = (Unwrap) new Unwrap (left, loc).Resolve (ec);
|
||||
if (unwrap == null)
|
||||
return null;
|
||||
|
||||
expr = Convert.WideningConversion (ec, right, info.UnderlyingType, loc);
|
||||
if (expr != null) {
|
||||
left = unwrap;
|
||||
type = expr.Type;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
expr = Convert.WideningConversion (ec, right, ltype, loc);
|
||||
if (expr != null) {
|
||||
type = expr.Type;
|
||||
return this;
|
||||
}
|
||||
|
||||
if (unwrap != null) {
|
||||
expr = Convert.WideningConversion (ec, unwrap, rtype, loc);
|
||||
if (expr != null) {
|
||||
left = expr;
|
||||
expr = right;
|
||||
type = expr.Type;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Binary.Error_OperatorCannotBeApplied (loc, "??", ltype, rtype);
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
|
||||
Label is_null_label = ig.DefineLabel ();
|
||||
Label end_label = ig.DefineLabel ();
|
||||
|
||||
if (unwrap != null) {
|
||||
unwrap.EmitCheck (ec);
|
||||
ig.Emit (OpCodes.Brfalse, is_null_label);
|
||||
}
|
||||
|
||||
left.Emit (ec);
|
||||
ig.Emit (OpCodes.Br, end_label);
|
||||
|
||||
ig.MarkLabel (is_null_label);
|
||||
expr.Emit (ec);
|
||||
|
||||
ig.MarkLabel (end_label);
|
||||
}
|
||||
}
|
||||
|
||||
public class LiftedUnaryMutator : ExpressionStatement
|
||||
{
|
||||
public readonly UnaryMutator.Mode Mode;
|
||||
Expression expr, null_value;
|
||||
UnaryMutator underlying;
|
||||
Unwrap unwrap;
|
||||
|
||||
public LiftedUnaryMutator (UnaryMutator.Mode mode, Expression expr, Location loc)
|
||||
{
|
||||
this.expr = expr;
|
||||
this.Mode = mode;
|
||||
this.loc = loc;
|
||||
|
||||
eclass = ExprClass.Value;
|
||||
}
|
||||
|
||||
public override Expression DoResolve (EmitContext ec)
|
||||
{
|
||||
expr = expr.Resolve (ec);
|
||||
if (expr == null)
|
||||
return null;
|
||||
|
||||
unwrap = (Unwrap) new Unwrap (expr, loc).Resolve (ec);
|
||||
if (unwrap == null)
|
||||
return null;
|
||||
|
||||
underlying = (UnaryMutator) new UnaryMutator (Mode, unwrap, loc).Resolve (ec);
|
||||
if (underlying == null)
|
||||
return null;
|
||||
|
||||
null_value = new NullableLiteral (expr.Type, loc).Resolve (ec);
|
||||
if (null_value == null)
|
||||
return null;
|
||||
|
||||
type = expr.Type;
|
||||
return this;
|
||||
}
|
||||
|
||||
void DoEmit (EmitContext ec, bool is_expr)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
Label is_null_label = ig.DefineLabel ();
|
||||
Label end_label = ig.DefineLabel ();
|
||||
|
||||
unwrap.EmitCheck (ec);
|
||||
ig.Emit (OpCodes.Brfalse, is_null_label);
|
||||
|
||||
if (is_expr)
|
||||
underlying.Emit (ec);
|
||||
else
|
||||
underlying.EmitStatement (ec);
|
||||
ig.Emit (OpCodes.Br, end_label);
|
||||
|
||||
ig.MarkLabel (is_null_label);
|
||||
if (is_expr)
|
||||
null_value.Emit (ec);
|
||||
|
||||
ig.MarkLabel (end_label);
|
||||
}
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
DoEmit (ec, true);
|
||||
}
|
||||
|
||||
public override void EmitStatement (EmitContext ec)
|
||||
{
|
||||
DoEmit (ec, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,15 +36,6 @@ namespace System {
|
||||
|
||||
namespace Mono.CSharp {
|
||||
|
||||
//
|
||||
// Unlike C#, VB.NET doesn't understand "signed byte",
|
||||
// "unsigned short", "unsigned int" and "unsigned long" as
|
||||
// primitive types. The NotDefinedAsPrimitiveType just exists
|
||||
// to accomodate this fact.
|
||||
//
|
||||
public class NotDefinedAsPrimitiveType {
|
||||
}
|
||||
|
||||
//
|
||||
// The NullType just exists to compare type equality, and for
|
||||
// expressions that might have the `null type'
|
||||
@@ -88,51 +79,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
ec.ig.Emit (OpCodes.Ldnull);
|
||||
}
|
||||
|
||||
public override CharConstant ConvertToChar ()
|
||||
{
|
||||
return new CharConstant ((char) 0);
|
||||
}
|
||||
|
||||
public override BoolConstant ConvertToBoolean ()
|
||||
{
|
||||
return new BoolConstant (false);
|
||||
}
|
||||
|
||||
public override ByteConstant ConvertToByte ()
|
||||
{
|
||||
return new ByteConstant ((byte) 0);
|
||||
}
|
||||
|
||||
public override ShortConstant ConvertToShort ()
|
||||
{
|
||||
return new ShortConstant ((short) 0);
|
||||
}
|
||||
|
||||
public override DecimalConstant ConvertToDecimal ()
|
||||
{
|
||||
return new DecimalConstant ((decimal) 0);
|
||||
}
|
||||
|
||||
public override DoubleConstant ConvertToDouble ()
|
||||
{
|
||||
return new DoubleConstant ((double) 0);
|
||||
}
|
||||
|
||||
public override FloatConstant ConvertToFloat ()
|
||||
{
|
||||
return new FloatConstant ((float) 0);
|
||||
}
|
||||
|
||||
public override LongConstant ConvertToLong ()
|
||||
{
|
||||
return new LongConstant ((long) 0);
|
||||
}
|
||||
|
||||
public override IntConstant ConvertToInt ()
|
||||
{
|
||||
return new IntConstant (0);
|
||||
}
|
||||
|
||||
public override bool IsNegative {
|
||||
get {
|
||||
@@ -301,20 +247,4 @@ namespace Mono.CSharp {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// VB.NET specific
|
||||
//
|
||||
public class DateLiteral : DateConstant {
|
||||
public DateLiteral (DateTime s) : base (s)
|
||||
{
|
||||
}
|
||||
|
||||
public override Expression DoResolve (EmitContext ec)
|
||||
{
|
||||
type = TypeManager.date_type;
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,12 +84,7 @@ namespace Mono.CSharp {
|
||||
string path = Path.GetFullPath (name);
|
||||
|
||||
if (source_files.Contains (path)){
|
||||
int id = (int) source_files [path];
|
||||
string other_name = ((SourceFile) source_list [id - 1]).Name;
|
||||
if (name.Equals (other_name))
|
||||
Report.Warning (2002, "Source file '{0}' specified multiple times", name);
|
||||
else
|
||||
Report.Warning (2002, "Source filenames '{0}' and '{1}' both refer to the same file: {2}", name, other_name, path);
|
||||
Report.Warning (2002, name, "Source file '{0}' specified multiple times", path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+36
-45
@@ -946,13 +946,12 @@ imports_terms
|
||||
imports_term
|
||||
: namespace_or_type_name
|
||||
{
|
||||
MemberName ns_name = (MemberName) $1;
|
||||
current_namespace.Using (ns_name.GetTypeExpression (lexer.Location), lexer.Location);
|
||||
string name = ((MemberName) $1).GetName ();
|
||||
current_namespace.Using (name, lexer.Location);
|
||||
}
|
||||
| identifier ASSIGN namespace_or_type_name
|
||||
{
|
||||
MemberName name = (MemberName) $3;
|
||||
current_namespace.UsingAlias ((string) $1, name.GetTypeExpression (lexer.Location), lexer.Location);
|
||||
current_namespace.UsingAlias ((string) $1, (MemberName) $3, lexer.Location);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -1103,13 +1102,10 @@ attribute
|
||||
else {
|
||||
expecting_local_attribs = true;
|
||||
MemberName mname = (MemberName) $1;
|
||||
string name = mname.GetName ();
|
||||
|
||||
MemberName left = mname.Left;
|
||||
string identifier = mname.Name;
|
||||
|
||||
Expression left_expr = left == null ? null : left.GetTypeExpression ((Location)$2);
|
||||
|
||||
$$ = new Attribute (null, left_expr, identifier, (ArrayList) $3, (Location)$2);
|
||||
$$ = new Attribute (null, name, (ArrayList) $3,
|
||||
(Location) $2);
|
||||
}
|
||||
}
|
||||
| attribute_target_specifier
|
||||
@@ -1143,12 +1139,9 @@ attribute
|
||||
expecting_global_attribs = true;
|
||||
|
||||
MemberName mname = (MemberName) $4;
|
||||
MemberName left = mname.Left;
|
||||
string identifier = mname.Name;
|
||||
string aname = mname.GetName ();
|
||||
|
||||
Expression left_expr = left == null ? null : left.GetTypeExpression ((Location) $5);
|
||||
|
||||
$$ = new GlobalAttribute (current_container, attribute_target, left_expr, identifier, (ArrayList) $6, (Location) $5);
|
||||
$$ = new Attribute (attribute_target, aname, (ArrayList) $6, (Location) $5);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -4212,10 +4205,10 @@ literal
|
||||
: boolean_literal
|
||||
| integer_literal
|
||||
| real_literal
|
||||
| LITERAL_DATE { $$ = new DateLiteral ((DateTime)lexer.Value); }
|
||||
// | LITERAL_DATE { $$ = new DateLiteral ((DateTime)lexer.Value); }
|
||||
| LITERAL_CHARACTER { $$ = new CharLiteral ((char) lexer.Value); }
|
||||
| LITERAL_STRING { $$ = new StringLiteral ((string) lexer.Value); }
|
||||
| NOTHING { $$ = NullLiteral.Null; }
|
||||
| NOTHING { $$ = NullLiteral.Null; }
|
||||
;
|
||||
|
||||
real_literal
|
||||
@@ -4432,7 +4425,7 @@ cast_operator
|
||||
: CBOOL { $$ = TypeManager.system_boolean_expr; }
|
||||
| CBYTE { $$ = TypeManager.system_byte_expr; }
|
||||
| CCHAR { $$ = TypeManager.system_char_expr; }
|
||||
| CDATE { $$ = TypeManager.system_date_expr; }
|
||||
// | CDATE { $$ = TypeManager.system_date_expr; }
|
||||
| CDBL { $$ = TypeManager.system_double_expr; }
|
||||
| CDEC { $$ = TypeManager.system_decimal_expr; }
|
||||
| CINT { $$ = TypeManager.system_int32_expr; }
|
||||
@@ -4454,8 +4447,7 @@ exponentiation_expression
|
||||
: primary_expression
|
||||
| exponentiation_expression OP_EXP primary_expression
|
||||
{
|
||||
$$ = new Binary (Binary.Operator.Exponentiation,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
//TODO
|
||||
}
|
||||
;
|
||||
|
||||
@@ -4491,7 +4483,8 @@ integer_division_expression
|
||||
: multiplicative_expression
|
||||
| integer_division_expression OP_IDIV multiplicative_expression
|
||||
{
|
||||
$$ = new Binary (Binary.Operator.IntegerDivision,
|
||||
//FIXME: Is this right ?
|
||||
$$ = new Binary (Binary.Operator.Division,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
}
|
||||
;
|
||||
@@ -4509,13 +4502,13 @@ additive_expression
|
||||
: mod_expression
|
||||
| additive_expression PLUS mod_expression
|
||||
{
|
||||
$$ = new Binary (Binary.Operator.Addition,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
$$ = new Binary (Binary.Operator.Addition,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
}
|
||||
| additive_expression MINUS mod_expression
|
||||
{
|
||||
$$ = new Binary (Binary.Operator.Subtraction,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
$$ = new Binary (Binary.Operator.Subtraction,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -4523,7 +4516,9 @@ concat_expression
|
||||
: additive_expression
|
||||
| concat_expression OP_CONCAT additive_expression
|
||||
{
|
||||
$$ = new Binary (Binary.Operator.Concatenation,
|
||||
// FIXME: This should only work for String expressions
|
||||
// We probably need to use something from the runtime
|
||||
$$ = new Binary (Binary.Operator.Addition,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
}
|
||||
;
|
||||
@@ -4532,13 +4527,11 @@ shift_expression
|
||||
: concat_expression
|
||||
| shift_expression OP_SHIFT_LEFT concat_expression
|
||||
{
|
||||
$$ = new Binary (Binary.Operator.LeftShift,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
// TODO
|
||||
}
|
||||
| shift_expression OP_SHIFT_RIGHT concat_expression
|
||||
{
|
||||
$$ = new Binary (Binary.Operator.RightShift,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
//TODO
|
||||
}
|
||||
;
|
||||
|
||||
@@ -4576,17 +4569,14 @@ relational_expression
|
||||
}
|
||||
| relational_expression IS shift_expression
|
||||
{
|
||||
$$ = new Binary (Binary.Operator.Is,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
}
|
||||
| relational_expression LIKE shift_expression
|
||||
{
|
||||
$$ = new Binary (Binary.Operator.Like,
|
||||
//FIXME: Should be a different op for reference equality but allows tests to use Is
|
||||
$$ = new Binary (Binary.Operator.Equality,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
}
|
||||
| TYPEOF shift_expression IS type
|
||||
{
|
||||
$$ = new Is ((Expression) $2, (Expression) $4, lexer.Location);
|
||||
//FIXME: Is this rule correctly defined ?
|
||||
$$ = new Is ((Expression) $2, (Expression) $4, lexer.Location);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -4594,7 +4584,8 @@ negation_expression
|
||||
: relational_expression
|
||||
| NOT negation_expression
|
||||
{
|
||||
$$ = new Unary (Unary.Operator.OnesComplement, (Expression) $2, lexer.Location);
|
||||
//FIXME: Is this rule correctly defined ?
|
||||
$$ = new Unary (Unary.Operator.LogicalNot, (Expression) $2, lexer.Location);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -4602,12 +4593,12 @@ conditional_and_expression
|
||||
: negation_expression
|
||||
| conditional_and_expression AND negation_expression
|
||||
{
|
||||
$$ = new Binary (Binary.Operator.BitwiseAnd,
|
||||
$$ = new Binary (Binary.Operator.LogicalAnd,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
}
|
||||
| conditional_and_expression ANDALSO negation_expression
|
||||
{
|
||||
$$ = new Binary (Binary.Operator.LogicalAndAlso,
|
||||
{ // FIXME: this is likely to be broken
|
||||
$$ = new Binary (Binary.Operator.LogicalAnd,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
}
|
||||
;
|
||||
@@ -4616,12 +4607,12 @@ conditional_or_expression
|
||||
: conditional_and_expression
|
||||
| conditional_or_expression OR conditional_and_expression
|
||||
{
|
||||
$$ = new Binary (Binary.Operator.BitwiseOr,
|
||||
$$ = new Binary (Binary.Operator.LogicalOr,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
}
|
||||
| conditional_or_expression ORELSE conditional_and_expression
|
||||
{
|
||||
$$ = new Binary (Binary.Operator.LogicalOrElse,
|
||||
{ // FIXME: this is likely to be broken
|
||||
$$ = new Binary (Binary.Operator.LogicalOr,
|
||||
(Expression) $1, (Expression) $3, lexer.Location);
|
||||
}
|
||||
;
|
||||
@@ -4755,7 +4746,7 @@ builtin_types
|
||||
primitive_type
|
||||
: numeric_type
|
||||
| BOOLEAN { $$ = TypeManager.system_boolean_expr; }
|
||||
| DATE { $$ = TypeManager.system_date_expr; }
|
||||
// | DATE { $$ = TypeManager.system_date_expr; }
|
||||
| CHAR { $$ = TypeManager.system_char_expr; }
|
||||
| STRING { $$ = TypeManager.system_string_expr; }
|
||||
;
|
||||
|
||||
+37
-165
@@ -207,9 +207,9 @@ namespace Mono.CSharp
|
||||
keywords.Add ("integer", Token.INTEGER);
|
||||
keywords.Add ("interface", Token.INTERFACE);
|
||||
keywords.Add ("is", Token.IS);
|
||||
keywords.Add ("let", Token.LET ); // An unused VB.NET keyword
|
||||
keywords.Add ("lib", Token.LIB );
|
||||
keywords.Add ("like", Token.LIKE );
|
||||
keywords.Add ("let ", Token.LET ); // An unused VB.NET keyword
|
||||
keywords.Add ("lib ", Token.LIB );
|
||||
keywords.Add ("like ", Token.LIKE );
|
||||
keywords.Add ("long", Token.LONG);
|
||||
keywords.Add ("loop", Token.LOOP);
|
||||
keywords.Add ("me", Token.ME);
|
||||
@@ -417,7 +417,7 @@ namespace Mono.CSharp
|
||||
if(tokens_seen)
|
||||
{
|
||||
if (cant_have_a_type_character)
|
||||
return ParseDateLiteral();
|
||||
return ExtractDateTimeLiteral();
|
||||
else
|
||||
return Token.NUMBER_SIGN;
|
||||
}
|
||||
@@ -863,16 +863,6 @@ namespace Mono.CSharp
|
||||
{
|
||||
return (c == ' ' || c == '\t' || c == '\v' || c == '\r' || c == 0xa0);
|
||||
}
|
||||
|
||||
private void GobbleWhiteSpaces ()
|
||||
{
|
||||
int d = peekChar ();
|
||||
while (is_whitespace (d)) {
|
||||
getChar ();
|
||||
d = peekChar ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private bool tokens_seen = false;
|
||||
|
||||
@@ -996,144 +986,25 @@ namespace Mono.CSharp
|
||||
return Token.EOF;
|
||||
}
|
||||
|
||||
private int ParseDateLiteral ()
|
||||
private int ExtractDateTimeLiteral()
|
||||
{
|
||||
int c, d;
|
||||
object temp;
|
||||
int month = 1, day = 1, year = 1, hours = 0, minutes = 0, seconds = 0, date_separator;
|
||||
bool minutes_specified = false, seconds_specified = false;
|
||||
bool am_specified = false, pm_specified = false;
|
||||
int c;
|
||||
|
||||
|
||||
GobbleWhiteSpaces ();
|
||||
d = peekChar ();
|
||||
if (d == '#')
|
||||
goto parse_error;
|
||||
|
||||
temp = ParseIntLiteral ();
|
||||
if (temp == null)
|
||||
goto parse_error;
|
||||
|
||||
d = peekChar ();
|
||||
if (d == '/' || d == '-') {
|
||||
c = getChar ();
|
||||
date_separator = c;
|
||||
|
||||
month = (int) temp;
|
||||
// Console.WriteLine ("Month: " + month);
|
||||
|
||||
temp = ParseIntLiteral ();
|
||||
if (temp == null)
|
||||
goto parse_error;
|
||||
day = (int) temp;
|
||||
// Console.WriteLine ("Day: " + day);
|
||||
|
||||
c = getChar ();
|
||||
if (c != date_separator)
|
||||
goto parse_error;
|
||||
|
||||
temp = ParseIntLiteral ();
|
||||
if (temp == null)
|
||||
goto parse_error;
|
||||
year = (int) temp;
|
||||
// Console.WriteLine ("Year: " + year);
|
||||
|
||||
GobbleWhiteSpaces ();
|
||||
d = peekChar ();
|
||||
if (d == '#') {
|
||||
c = getChar ();
|
||||
goto parse_done;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (;(c = getChar ()) != -1; col++)
|
||||
{
|
||||
if (c == '#') {
|
||||
val = ParseDateLiteral(sb);
|
||||
return Token.LITERAL_DATE;
|
||||
}
|
||||
|
||||
temp = ParseIntLiteral ();
|
||||
if (temp == null)
|
||||
goto parse_error;
|
||||
d = peekChar ();
|
||||
}
|
||||
|
||||
hours = (int) temp;
|
||||
// Console.WriteLine ("Hours: " + hours);
|
||||
|
||||
if (d == ':') {
|
||||
c = getChar ();
|
||||
|
||||
temp = ParseIntLiteral ();
|
||||
if (temp == null)
|
||||
goto parse_error;
|
||||
minutes = (int) temp;
|
||||
// Console.WriteLine ("Minutes: " + minutes);
|
||||
minutes_specified = true;
|
||||
|
||||
d = peekChar ();
|
||||
if (d == ':') {
|
||||
c = getChar ();
|
||||
|
||||
temp = ParseIntLiteral ();
|
||||
if (temp == null)
|
||||
goto parse_error;
|
||||
seconds = (int) temp;
|
||||
// Console.WriteLine ("Seconds: " + seconds);
|
||||
seconds_specified = true;
|
||||
if (IsEOL(c)) {
|
||||
break;
|
||||
}
|
||||
if (c == '-')
|
||||
c = '/';
|
||||
sb.Append((char)c);
|
||||
}
|
||||
|
||||
|
||||
GobbleWhiteSpaces ();
|
||||
d = peekChar ();
|
||||
if (d == 'A' ) {
|
||||
c = getChar ();
|
||||
|
||||
d = peekChar ();
|
||||
if (d != 'M')
|
||||
goto parse_error;
|
||||
|
||||
c = getChar ();
|
||||
// Console.WriteLine ("AM");
|
||||
am_specified = true;
|
||||
} else if (d == 'P' ) {
|
||||
c = getChar ();
|
||||
|
||||
d = peekChar ();
|
||||
if (d != 'M')
|
||||
goto parse_error;
|
||||
|
||||
c = getChar ();
|
||||
// Console.WriteLine ("PM");
|
||||
pm_specified = true;
|
||||
}
|
||||
|
||||
GobbleWhiteSpaces ();
|
||||
|
||||
d = peekChar ();
|
||||
if (d == '#') {
|
||||
c = getChar ();
|
||||
if (!minutes_specified && !seconds_specified && !am_specified && ! pm_specified)
|
||||
goto parse_error;
|
||||
|
||||
if ((am_specified || pm_specified) && hours > 12)
|
||||
goto parse_error;
|
||||
|
||||
if (pm_specified)
|
||||
hours += 12;
|
||||
|
||||
goto parse_done;
|
||||
}
|
||||
|
||||
parse_error:
|
||||
// Console.WriteLine ("Parse Error");
|
||||
return Token.ERROR;
|
||||
|
||||
parse_done:
|
||||
try {
|
||||
temp = new DateTime (year, month, day, hours, minutes, seconds);
|
||||
} catch (Exception ex) {
|
||||
// Console.WriteLine (ex);
|
||||
return Token.ERROR;
|
||||
}
|
||||
|
||||
// Console.WriteLine ("Success");
|
||||
val =temp;
|
||||
return Token.LITERAL_DATE;
|
||||
}
|
||||
|
||||
private int ExtractStringOrCharLiteral(int c)
|
||||
@@ -1174,26 +1045,27 @@ namespace Mono.CSharp
|
||||
return Token.ERROR;
|
||||
}
|
||||
|
||||
private object ParseIntLiteral ()
|
||||
static IFormatProvider enUSculture = new CultureInfo("en-US", true);
|
||||
|
||||
private DateTime ParseDateLiteral(StringBuilder value)
|
||||
{
|
||||
object retval;
|
||||
|
||||
int d = peekChar ();
|
||||
|
||||
if (!Char.IsDigit ((char) d))
|
||||
return null;
|
||||
|
||||
int c = getChar ();
|
||||
number = new StringBuilder ();
|
||||
decimal_digits (c);
|
||||
|
||||
try {
|
||||
retval = System.Int32.Parse (number.ToString ());
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return retval;
|
||||
try
|
||||
{
|
||||
return DateTime.Parse(value.ToString(),
|
||||
enUSculture,
|
||||
DateTimeStyles.NoCurrentDateDefault | DateTimeStyles.AllowWhiteSpaces);
|
||||
}
|
||||
catch (FormatException ex)
|
||||
{
|
||||
//TODO: What is the correct error number and message?
|
||||
Report.Error (1, Location, string.Format("Invalid date literal '{0}'", value.ToString())
|
||||
+ Environment.NewLine + ex.ToString());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Report.Error (1, Location, "Error parsing date literal"); //TODO: What is the correct error number and message?
|
||||
}
|
||||
return new DateTime();
|
||||
}
|
||||
|
||||
public void PositionCursorAtNextPreProcessorDirective()
|
||||
|
||||
+16
-10
@@ -17,6 +17,21 @@ using Mono.CSharp ;
|
||||
|
||||
namespace Mono.CSharp
|
||||
{
|
||||
public class Utils
|
||||
{
|
||||
public static void AddSpecializedAttribute(ref Attributes attrs, string attributeName, ArrayList args, Location loc)
|
||||
{
|
||||
Mono.CSharp.Attribute specialAttr = new Mono.CSharp.Attribute(null, attributeName, args, loc); // Sudha : passed null for target
|
||||
ArrayList al = new ArrayList();
|
||||
al.Add(specialAttr);
|
||||
if (attrs == null) {
|
||||
attrs = new Attributes(al);
|
||||
} else {
|
||||
attrs.AddAttributes(al);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class VBModule : Class
|
||||
{
|
||||
public new const int AllowedModifiers = Modifiers.PUBLIC |Modifiers.INTERNAL;
|
||||
@@ -34,16 +49,7 @@ namespace Mono.CSharp
|
||||
this.ModFlags = Modifiers.Check (AllowedModifiers, mod, Modifiers.INTERNAL, l);
|
||||
|
||||
// add specialized attribute
|
||||
|
||||
Mono.CSharp.Attribute standardModuleAttribute = new Mono.CSharp.Attribute(null, Expression.StringToExpression ("Microsoft.VisualBasic.CompilerServices", l), "StandardModuleAttribute", null, l);
|
||||
|
||||
ArrayList al = new ArrayList();
|
||||
al.Add(standardModuleAttribute);
|
||||
if (attributes == null) {
|
||||
attributes = new Attributes(al);
|
||||
} else {
|
||||
attributes.AddAttributes(al);
|
||||
}
|
||||
Utils.AddSpecializedAttribute(ref attributes, "Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute", null, l);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+119
-93
@@ -229,40 +229,37 @@ namespace Mono.CSharp {
|
||||
// exist.
|
||||
//
|
||||
public class UsingEntry {
|
||||
public Expression Name;
|
||||
public readonly string Name;
|
||||
public readonly NamespaceEntry NamespaceEntry;
|
||||
public readonly Location Location;
|
||||
|
||||
public UsingEntry (NamespaceEntry entry, Expression name, Location loc)
|
||||
public UsingEntry (NamespaceEntry entry, string name, Location loc)
|
||||
{
|
||||
Name = name;
|
||||
NamespaceEntry = entry;
|
||||
Location = loc;
|
||||
}
|
||||
|
||||
internal FullNamedExpression resolved;
|
||||
Namespace resolved_ns;
|
||||
|
||||
public Namespace Resolve ()
|
||||
{
|
||||
if (resolved != null)
|
||||
return resolved as Namespace;
|
||||
if (resolved_ns != null)
|
||||
return resolved_ns;
|
||||
|
||||
DeclSpace root = RootContext.Tree.Types;
|
||||
root.NamespaceEntry = NamespaceEntry;
|
||||
resolved = Name.ResolveAsTypeStep (root.EmitContext);
|
||||
root.NamespaceEntry = null;
|
||||
|
||||
return resolved as Namespace;
|
||||
FullNamedExpression resolved = NamespaceEntry.LookupForUsing (Name, Location);
|
||||
resolved_ns = resolved as Namespace;
|
||||
return resolved_ns;
|
||||
}
|
||||
}
|
||||
|
||||
public class AliasEntry {
|
||||
public readonly string Name;
|
||||
public readonly Expression Alias;
|
||||
public readonly MemberName Alias;
|
||||
public readonly NamespaceEntry NamespaceEntry;
|
||||
public readonly Location Location;
|
||||
|
||||
public AliasEntry (NamespaceEntry entry, string name, Expression alias, Location loc)
|
||||
public AliasEntry (NamespaceEntry entry, string name, MemberName alias, Location loc)
|
||||
{
|
||||
Name = name;
|
||||
Alias = alias;
|
||||
@@ -277,62 +274,55 @@ namespace Mono.CSharp {
|
||||
if (resolved != null)
|
||||
return resolved;
|
||||
|
||||
DeclSpace root = RootContext.Tree.Types;
|
||||
root.NamespaceEntry = NamespaceEntry;
|
||||
resolved = Alias.ResolveAsTypeStep (root.EmitContext);
|
||||
root.NamespaceEntry = null;
|
||||
//
|
||||
// GENERICS: Cope with the expression and not with the string
|
||||
// this will fail with `using A = Stack<int>'
|
||||
//
|
||||
|
||||
string alias = Alias.GetTypeName ();
|
||||
|
||||
resolved = NamespaceEntry.LookupForUsing (alias, Location);
|
||||
if (resolved == null)
|
||||
return null;
|
||||
|
||||
if (Alias.TypeArguments == null)
|
||||
return resolved;
|
||||
|
||||
EmitContext ec = RootContext.Tree.Types.EmitContext;
|
||||
resolved = new TypeAliasExpression (resolved, Alias.TypeArguments, Location);
|
||||
resolved = resolved.ResolveAsTypeStep (ec);
|
||||
|
||||
return resolved;
|
||||
}
|
||||
}
|
||||
|
||||
public NamespaceEntry (NamespaceEntry parent, SourceFile file, string name, Location loc)
|
||||
: this (parent, file, name, false, loc)
|
||||
{ }
|
||||
|
||||
protected NamespaceEntry (NamespaceEntry parent, SourceFile file, string name, bool is_implicit, Location loc)
|
||||
{
|
||||
this.parent = parent;
|
||||
this.file = file;
|
||||
this.IsImplicit = false;
|
||||
this.IsImplicit = is_implicit;
|
||||
this.ID = ++next_id;
|
||||
|
||||
if (parent != null)
|
||||
if (!is_implicit && (parent != null))
|
||||
ns = parent.NS.GetNamespace (name, true);
|
||||
else if (name != null)
|
||||
ns = Namespace.LookupNamespace (name, true);
|
||||
else
|
||||
ns = Namespace.Root;
|
||||
ns.AddNamespaceEntry (this);
|
||||
|
||||
if ((parent != null) && (parent.NS != ns.Parent))
|
||||
implicit_parent = new NamespaceEntry (parent, file, ns.Parent.Name, true, loc);
|
||||
else
|
||||
implicit_parent = parent;
|
||||
|
||||
this.FullName = ns.Name;
|
||||
}
|
||||
|
||||
|
||||
private NamespaceEntry (NamespaceEntry parent, SourceFile file, Namespace ns)
|
||||
{
|
||||
this.parent = parent;
|
||||
this.file = file;
|
||||
this.IsImplicit = true;
|
||||
this.ID = ++next_id;
|
||||
this.ns = ns;
|
||||
this.FullName = ns.Name;
|
||||
}
|
||||
|
||||
//
|
||||
// According to section 16.3.1 (using-alias-directive), the namespace-or-type-name is
|
||||
// resolved as if the immediately containing namespace body has no using-directives.
|
||||
//
|
||||
// Section 16.3.2 says that the same rule is applied when resolving the namespace-name
|
||||
// in the using-namespace-directive.
|
||||
//
|
||||
// To implement these rules, the expressions in the using directives are resolved using
|
||||
// the "doppelganger" (ghostly bodiless duplicate).
|
||||
//
|
||||
NamespaceEntry doppelganger;
|
||||
NamespaceEntry Doppelganger {
|
||||
get {
|
||||
if (!IsImplicit && doppelganger == null)
|
||||
doppelganger = new NamespaceEntry (ImplicitParent, file, ns);
|
||||
return doppelganger;
|
||||
}
|
||||
}
|
||||
|
||||
static int next_id = 0;
|
||||
public readonly string FullName;
|
||||
public readonly int ID;
|
||||
@@ -352,13 +342,6 @@ namespace Mono.CSharp {
|
||||
|
||||
public NamespaceEntry ImplicitParent {
|
||||
get {
|
||||
if (parent == null)
|
||||
return null;
|
||||
if (implicit_parent == null) {
|
||||
implicit_parent = (parent.NS == ns.Parent)
|
||||
? parent
|
||||
: new NamespaceEntry (parent, file, ns.Parent);
|
||||
}
|
||||
return implicit_parent;
|
||||
}
|
||||
}
|
||||
@@ -371,34 +354,32 @@ namespace Mono.CSharp {
|
||||
/// <summary>
|
||||
/// Records a new namespace for resolving name references
|
||||
/// </summary>
|
||||
public void Using (Expression ns, Location loc)
|
||||
public void Using (string ns, Location loc)
|
||||
{
|
||||
string name = ns.ToString ();
|
||||
if (DeclarationFound){
|
||||
Report.Error (1529, loc, "A using clause must precede all other namespace elements");
|
||||
return;
|
||||
}
|
||||
|
||||
if (name == FullName)
|
||||
if (ns == FullName)
|
||||
return;
|
||||
|
||||
if (using_clauses == null)
|
||||
using_clauses = new ArrayList ();
|
||||
|
||||
foreach (UsingEntry old_entry in using_clauses) {
|
||||
if (old_entry.Name.ToString () == name) {
|
||||
if (old_entry.Name == ns) {
|
||||
if (RootContext.WarningLevel >= 3)
|
||||
Report.Warning (105, loc, "The using directive for '{0}' appeared previously in this namespace", name);
|
||||
Report.Warning (105, loc, "The using directive for '{0}' appeared previously in this namespace", ns);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
UsingEntry ue = new UsingEntry (Doppelganger, ns, loc);
|
||||
|
||||
UsingEntry ue = new UsingEntry (this, ns, loc);
|
||||
using_clauses.Add (ue);
|
||||
}
|
||||
|
||||
public void UsingAlias (string name, Expression alias, Location loc)
|
||||
public void UsingAlias (string name, MemberName alias, Location loc)
|
||||
{
|
||||
if (DeclarationFound){
|
||||
Report.Error (1529, loc, "A using clause must precede all other namespace elements");
|
||||
@@ -414,7 +395,7 @@ namespace Mono.CSharp {
|
||||
return;
|
||||
}
|
||||
|
||||
aliases [name] = new AliasEntry (Doppelganger, name, alias, loc);
|
||||
aliases [name] = new AliasEntry (this, name, alias, loc);
|
||||
}
|
||||
|
||||
public FullNamedExpression LookupAlias (string alias)
|
||||
@@ -426,51 +407,93 @@ namespace Mono.CSharp {
|
||||
return entry == null ? null : entry.Resolve ();
|
||||
}
|
||||
|
||||
public FullNamedExpression LookupNamespaceOrType (DeclSpace ds, string name, Location loc)
|
||||
//
|
||||
// According to section 16.3.1 (using-alias-directive), the namespace-or-type-name is
|
||||
// resolved as if the immediately containing namespace body has no using-directives.
|
||||
//
|
||||
// Section 16.3.2 says that the same rule is applied when resolving the namespace-name
|
||||
// in the using-namespace-directive.
|
||||
//
|
||||
public FullNamedExpression LookupForUsing (string dotted_name, Location loc)
|
||||
{
|
||||
FullNamedExpression resolved = null;
|
||||
int pos = dotted_name.IndexOf ('.');
|
||||
string simple_name = dotted_name;
|
||||
string rest = null;
|
||||
|
||||
// If name is of the form `N.I', first lookup `N', then search a member `I' in it.
|
||||
int pos = name.IndexOf ('.');
|
||||
if (pos >= 0) {
|
||||
rest = name.Substring (pos + 1);
|
||||
name = name.Substring (0, pos);
|
||||
simple_name = dotted_name.Substring (0, pos);
|
||||
rest = dotted_name.Substring (pos + 1);
|
||||
}
|
||||
|
||||
for (NamespaceEntry curr_ns = this; curr_ns != null; curr_ns = curr_ns.ImplicitParent) {
|
||||
if ((resolved = curr_ns.Lookup (ds, name, loc)) != null)
|
||||
break;
|
||||
}
|
||||
FullNamedExpression o = NS.Lookup (null, simple_name, loc);
|
||||
if (o == null && ImplicitParent != null)
|
||||
o = ImplicitParent.LookupNamespaceOrType (null, simple_name, loc);
|
||||
|
||||
if (resolved == null || rest == null)
|
||||
return resolved;
|
||||
if (o == null || rest == null)
|
||||
return o;
|
||||
|
||||
Namespace ns = resolved as Namespace;
|
||||
Namespace ns = o as Namespace;
|
||||
if (ns != null)
|
||||
return ns.Lookup (ds, rest, loc);
|
||||
|
||||
Type nested = TypeManager.LookupType (resolved.FullName + "." + rest);
|
||||
if ((nested == null) || ((ds != null) && !ds.CheckAccessLevel (nested)))
|
||||
return ns.Lookup (null, rest, loc);
|
||||
|
||||
Type nested = TypeManager.LookupType (o.FullName + "." + rest);
|
||||
if (nested == null)
|
||||
return null;
|
||||
|
||||
return new TypeExpression (nested, Location.Null);
|
||||
}
|
||||
|
||||
public FullNamedExpression LookupNamespaceOrType (DeclSpace ds, string name, Location loc)
|
||||
{
|
||||
FullNamedExpression resolved = null;
|
||||
for (NamespaceEntry curr_ns = this; curr_ns != null; curr_ns = curr_ns.ImplicitParent) {
|
||||
if ((resolved = curr_ns.Lookup (ds, name, loc)) != null)
|
||||
break;
|
||||
}
|
||||
return resolved;
|
||||
}
|
||||
|
||||
private FullNamedExpression Lookup (DeclSpace ds, string name, Location loc)
|
||||
{
|
||||
// Precondition: Only simple names (no dots) will be looked up with this function.
|
||||
FullNamedExpression o;
|
||||
Namespace ns;
|
||||
|
||||
//
|
||||
// If name is of the form `N.I', first lookup `N', then search a member `I' in it.
|
||||
//
|
||||
// FIXME: Remove this block. Only simple names should come here.
|
||||
// The bug: The loop in LookupNamespaceOrType continues if
|
||||
// the lookup for N succeeds but the nested lookup for I fails.
|
||||
// This is one part of #52697.
|
||||
//
|
||||
int pos = name.IndexOf ('.');
|
||||
if (pos >= 0) {
|
||||
string first = name.Substring (0, pos);
|
||||
string last = name.Substring (pos + 1);
|
||||
|
||||
o = Lookup (ds, first, loc);
|
||||
if (o == null)
|
||||
return null;
|
||||
|
||||
ns = o as Namespace;
|
||||
if (ns != null) {
|
||||
o = ns.Lookup (ds, last, loc);
|
||||
return o;
|
||||
}
|
||||
|
||||
Type nested = TypeManager.LookupType (o.FullName + "." + last);
|
||||
if ((nested == null) || ((ds != null) && !ds.CheckAccessLevel (nested)))
|
||||
return null;
|
||||
|
||||
return new TypeExpression (nested, Location.Null);
|
||||
}
|
||||
|
||||
//
|
||||
// Check whether it's in the namespace.
|
||||
//
|
||||
FullNamedExpression o = NS.Lookup (ds, name, loc);
|
||||
o = NS.Lookup (ds, name, loc);
|
||||
if (o != null)
|
||||
return o;
|
||||
|
||||
if (IsImplicit)
|
||||
return null;
|
||||
|
||||
//
|
||||
// Check aliases.
|
||||
//
|
||||
@@ -478,6 +501,9 @@ namespace Mono.CSharp {
|
||||
if (o != null)
|
||||
return o;
|
||||
|
||||
if (name.IndexOf ('.') > 0)
|
||||
return null;
|
||||
|
||||
//
|
||||
// Check using entries.
|
||||
//
|
||||
@@ -535,7 +561,7 @@ namespace Mono.CSharp {
|
||||
if (using_clauses != null) {
|
||||
using_list = new string [using_clauses.Count];
|
||||
for (int i = 0; i < using_clauses.Count; i++)
|
||||
using_list [i] = ((UsingEntry) using_clauses [i]).Name.ToString ();
|
||||
using_list [i] = ((UsingEntry) using_clauses [i]).Name;
|
||||
} else {
|
||||
using_list = new string [0];
|
||||
}
|
||||
@@ -603,8 +629,8 @@ namespace Mono.CSharp {
|
||||
if (ue.Resolve () != null)
|
||||
continue;
|
||||
|
||||
if (ue.resolved == null)
|
||||
error246 (ue.Location, ue.Name.ToString ());
|
||||
if (LookupForUsing (ue.Name, ue.Location) == null)
|
||||
error246 (ue.Location, ue.Name);
|
||||
else
|
||||
Report.Error (138, ue.Location, "The using keyword only lets you specify a namespace, " +
|
||||
"`" + ue.Name + "' is a class not a namespace.");
|
||||
@@ -619,7 +645,7 @@ namespace Mono.CSharp {
|
||||
if (alias.Resolve () != null)
|
||||
continue;
|
||||
|
||||
error246 (alias.Location, alias.Alias.ToString ());
|
||||
error246 (alias.Location, alias.Alias.GetTypeName ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-16
@@ -15,7 +15,6 @@ using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Diagnostics;
|
||||
using System.Xml;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
namespace Mono.CSharp {
|
||||
|
||||
@@ -142,12 +141,6 @@ namespace Mono.CSharp {
|
||||
// The default type checking state
|
||||
//
|
||||
static public bool StricterTypeChecking = false;
|
||||
|
||||
//
|
||||
// The default character comparison mode
|
||||
//
|
||||
|
||||
static public CompareMethod StringComparisonMode = CompareMethod.Binary;
|
||||
|
||||
static string MakeFQN (string nsn, string name)
|
||||
{
|
||||
@@ -381,9 +374,6 @@ namespace Mono.CSharp {
|
||||
// These are classes that depends on the core interfaces
|
||||
//
|
||||
string [] classes_second_stage = {
|
||||
"System.Enum",
|
||||
"System.String",
|
||||
"System.Array",
|
||||
"System.Reflection.MemberInfo",
|
||||
"System.Type",
|
||||
"System.Exception",
|
||||
@@ -420,18 +410,19 @@ namespace Mono.CSharp {
|
||||
"System.Security.CodeAccessPermission"
|
||||
};
|
||||
|
||||
// We must store them here before calling BootstrapCorlib_ResolveDelegate.
|
||||
TypeManager.string_type = BootstrapCorlib_ResolveClass (root, "System.String");
|
||||
TypeManager.enum_type = BootstrapCorlib_ResolveClass (root, "System.Enum");
|
||||
TypeManager.array_type = BootstrapCorlib_ResolveClass (root, "System.Array");
|
||||
TypeManager.multicast_delegate_type = BootstrapCorlib_ResolveClass (root, "System.MulticastDelegate");
|
||||
TypeManager.delegate_type = BootstrapCorlib_ResolveClass (root, "System.Delegate");
|
||||
|
||||
foreach (string cname in classes_second_stage)
|
||||
BootstrapCorlib_ResolveClass (root, cname);
|
||||
|
||||
BootstrapCorlib_ResolveStruct (root, "System.Nullable`1");
|
||||
|
||||
BootstrapCorlib_ResolveDelegate (root, "System.AsyncCallback");
|
||||
|
||||
// These will be defined indirectly during the previous ResolveDelegate.
|
||||
// However make sure the rest of the checks happen.
|
||||
string [] delegate_types = { "System.Delegate", "System.MulticastDelegate" };
|
||||
foreach (string cname in delegate_types)
|
||||
BootstrapCorlib_ResolveClass (root, cname);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
|
||||
@@ -646,7 +646,6 @@ namespace Mono.CSharp {
|
||||
label.AddUsageVector (ec.CurrentBranching.CurrentUsageVector);
|
||||
|
||||
ec.CurrentBranching.CurrentUsageVector.Goto ();
|
||||
label.AddReference ();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -719,6 +718,8 @@ namespace Mono.CSharp {
|
||||
{
|
||||
ec.CurrentBranching.Label (vectors);
|
||||
|
||||
referenced = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -731,11 +732,6 @@ namespace Mono.CSharp {
|
||||
LabelTarget (ec);
|
||||
ec.ig.MarkLabel (label);
|
||||
}
|
||||
|
||||
public void AddReference ()
|
||||
{
|
||||
referenced = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+31
-435
@@ -38,9 +38,9 @@ public partial class TypeManager {
|
||||
static public Type value_type;
|
||||
static public Type string_type;
|
||||
static public Type int32_type;
|
||||
static Type _uint32_type;
|
||||
static public Type uint32_type;
|
||||
static public Type int64_type;
|
||||
static Type _uint64_type;
|
||||
static public Type uint64_type;
|
||||
static public Type float_type;
|
||||
static public Type double_type;
|
||||
static public Type char_type;
|
||||
@@ -48,9 +48,9 @@ public partial class TypeManager {
|
||||
static public Type short_type;
|
||||
static public Type decimal_type;
|
||||
static public Type bool_type;
|
||||
static public Type _sbyte_type;
|
||||
static public Type sbyte_type;
|
||||
static public Type byte_type;
|
||||
static public Type _ushort_type;
|
||||
static public Type ushort_type;
|
||||
static public Type enum_type;
|
||||
static public Type delegate_type;
|
||||
static public Type multicast_delegate_type;
|
||||
@@ -100,67 +100,6 @@ public partial class TypeManager {
|
||||
static public Type security_attr_type;
|
||||
static public Type date_type;
|
||||
|
||||
//
|
||||
// Used with VB.NET
|
||||
//
|
||||
static public Type convert_type;
|
||||
static public Type math_type;
|
||||
|
||||
//
|
||||
// Type cache of helper classes in Microsoft.VisualBasic.dll
|
||||
//
|
||||
static public Type msvbcs_object_type;
|
||||
static public Type msvbcs_boolean_type;
|
||||
static public Type msvbcs_byte_type;
|
||||
static public Type msvbcs_short_type;
|
||||
static public Type msvbcs_integer_type;
|
||||
static public Type msvbcs_long_type;
|
||||
static public Type msvbcs_decimal_type;
|
||||
static public Type msvbcs_single_type;
|
||||
static public Type msvbcs_double_type;
|
||||
static public Type msvbcs_string_type;
|
||||
static public Type msvbcs_char_type;
|
||||
static public Type msvbcs_chararray_type;
|
||||
static public Type msvbcs_date_type;
|
||||
|
||||
static public Type msvbcs_comparemethod_type;
|
||||
|
||||
//
|
||||
// Unlike C#, VB.NET doesn't understand "signed byte",
|
||||
// "unsigned short" and "unsigned int" as primitive types. The
|
||||
// NotDefinedAsPrimitiveType just exists to accomodate this fact.
|
||||
//
|
||||
|
||||
static Type not_defined_as_primitive_type = typeof (NotDefinedAsPrimitiveType);
|
||||
|
||||
public static Type sbyte_type {
|
||||
get {
|
||||
return not_defined_as_primitive_type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Type ushort_type {
|
||||
get {
|
||||
return not_defined_as_primitive_type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Type uint32_type {
|
||||
get {
|
||||
return not_defined_as_primitive_type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Type uint64_type {
|
||||
get {
|
||||
return not_defined_as_primitive_type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// An empty array of types
|
||||
//
|
||||
@@ -254,86 +193,6 @@ public partial class TypeManager {
|
||||
static public ConstructorInfo invalid_operation_ctor;
|
||||
static public ConstructorInfo default_member_ctor;
|
||||
static public ConstructorInfo decimal_constant_attribute_ctor;
|
||||
|
||||
//
|
||||
// Type cache of helper methods in Microsoft.VisualBasic.dll
|
||||
//
|
||||
static public MethodInfo convert_to_byte_decimal;
|
||||
static public MethodInfo convert_to_int16_decimal;
|
||||
static public MethodInfo convert_to_int32_decimal;
|
||||
static public MethodInfo convert_to_int64_decimal;
|
||||
static public MethodInfo convert_to_single_decimal;
|
||||
static public MethodInfo convert_to_double_decimal;
|
||||
static public MethodInfo convert_to_boolean_decimal;
|
||||
|
||||
static public MethodInfo decimal_compare_decimal_decimal;
|
||||
static public MethodInfo datetime_compare_datetime_datetime;
|
||||
static public MethodInfo math_round_double;
|
||||
|
||||
static public MethodInfo msvbcs_booleantype_from_string;
|
||||
static public MethodInfo msvbcs_bytetype_from_string;
|
||||
static public MethodInfo msvbcs_shorttype_from_string;
|
||||
static public MethodInfo msvbcs_integertype_from_string;
|
||||
static public MethodInfo msvbcs_longtype_from_string;
|
||||
static public MethodInfo msvbcs_decimaltype_from_string;
|
||||
static public MethodInfo msvbcs_singletype_from_string;
|
||||
static public MethodInfo msvbcs_doubletype_from_string;
|
||||
static public MethodInfo msvbcs_chartype_from_string;
|
||||
static public MethodInfo msvbcs_datetype_from_string;
|
||||
|
||||
static public MethodInfo msvbcs_stringtype_from_boolean;
|
||||
static public MethodInfo msvbcs_stringtype_from_byte;
|
||||
static public MethodInfo msvbcs_stringtype_from_short;
|
||||
static public MethodInfo msvbcs_stringtype_from_integer;
|
||||
static public MethodInfo msvbcs_stringtype_from_long;
|
||||
static public MethodInfo msvbcs_stringtype_from_decimal;
|
||||
static public MethodInfo msvbcs_stringtype_from_single;
|
||||
static public MethodInfo msvbcs_stringtype_from_double;
|
||||
static public MethodInfo msvbcs_stringtype_from_date;
|
||||
static public MethodInfo msvbcs_stringtype_from_char;
|
||||
|
||||
static public MethodInfo msvbcs_decimaltype_from_boolean;
|
||||
|
||||
static public MethodInfo msvbcs_stringtype_strcmp_string_string_boolean;
|
||||
static public MethodInfo msvbcs_stringtype_strlike_string_string_comparemethod;
|
||||
|
||||
static public MethodInfo msvbcs_booleantype_fromobject_object;
|
||||
static public MethodInfo msvbcs_bytetype_fromobject_object;
|
||||
static public MethodInfo msvbcs_shorttype_fromobject_object;
|
||||
static public MethodInfo msvbcs_integertype_fromobject_object;
|
||||
static public MethodInfo msvbcs_longtype_fromobject_object;
|
||||
static public MethodInfo msvbcs_singletype_fromobject_object;
|
||||
static public MethodInfo msvbcs_doubletype_fromobject_object;
|
||||
static public MethodInfo msvbcs_decimaltype_fromobject_object;
|
||||
static public MethodInfo msvbcs_chartype_fromobject_object;
|
||||
static public MethodInfo msvbcs_datetype_fromobject_object;
|
||||
static public MethodInfo msvbcs_stringtype_fromobject_object;
|
||||
|
||||
static public MethodInfo msvbcs_objecttype_mulobj_object_object;
|
||||
static public MethodInfo msvbcs_objecttype_divobj_object_object;
|
||||
static public MethodInfo msvbcs_objecttype_idivobj_object_object;
|
||||
static public MethodInfo msvbcs_objecttype_modobj_object_object;
|
||||
static public MethodInfo msvbcs_objecttype_addobj_object_object;
|
||||
static public MethodInfo msvbcs_objecttype_subobj_object_object;
|
||||
static public MethodInfo msvbcs_objecttype_objtst_object_object_boolean;
|
||||
static public MethodInfo msvbcs_objecttype_bitandobj_object_object;
|
||||
static public MethodInfo msvbcs_objecttype_bitorobj_object_object;
|
||||
static public MethodInfo msvbcs_objecttype_bitxorobj_object_object;
|
||||
static public MethodInfo msvbcs_objecttype_likeobj_object_object_comparemethod;
|
||||
static public MethodInfo msvbcs_objecttype_strcatobj_object_object;
|
||||
static public MethodInfo msvbcs_objecttype_powobj_object_object;
|
||||
static public MethodInfo msvbcs_objecttype_shiftleftobj_object_int32;
|
||||
static public MethodInfo msvbcs_objecttype_shiftrightobj_object_int32;
|
||||
|
||||
static public MethodInfo math_pow_double_double;
|
||||
|
||||
static public MethodInfo decimal_add_decimal_decimal;
|
||||
static public MethodInfo decimal_subtract_decimal_decimal;
|
||||
static public MethodInfo decimal_multiply_decimal_decimal;
|
||||
static public MethodInfo decimal_divide_decimal_decimal;
|
||||
static public MethodInfo decimal_remainder_decimal_decimal;
|
||||
|
||||
static public ConstructorInfo void_datetime_ctor_ticks_arg;
|
||||
|
||||
// <remarks>
|
||||
// Holds the Array of Assemblies that have been loaded
|
||||
@@ -1231,15 +1090,13 @@ public partial class TypeManager {
|
||||
|
||||
int32_type = CoreLookupType ("System.Int32");
|
||||
int64_type = CoreLookupType ("System.Int64");
|
||||
_uint32_type = CoreLookupType ("System.UInt32");
|
||||
_uint64_type = CoreLookupType ("System.UInt64");
|
||||
uint32_type = CoreLookupType ("System.UInt32");
|
||||
uint64_type = CoreLookupType ("System.UInt64");
|
||||
byte_type = CoreLookupType ("System.Byte");
|
||||
_sbyte_type = CoreLookupType ("System.SByte");
|
||||
sbyte_type = CoreLookupType ("System.SByte");
|
||||
short_type = CoreLookupType ("System.Int16");
|
||||
_ushort_type = CoreLookupType ("System.UInt16");
|
||||
ushort_type = CoreLookupType ("System.UInt16");
|
||||
}
|
||||
|
||||
public static Hashtable relative_type_order;
|
||||
|
||||
/// <remarks>
|
||||
/// The types have to be initialized after the initial
|
||||
@@ -1265,9 +1122,7 @@ public partial class TypeManager {
|
||||
//
|
||||
// VB.NET Specific
|
||||
//
|
||||
convert_type = CoreLookupType ("System.Convert");
|
||||
date_type = CoreLookupType ("System.DateTime");
|
||||
math_type = CoreLookupType ("System.Math");
|
||||
|
||||
multicast_delegate_type = CoreLookupType ("System.MulticastDelegate");
|
||||
delegate_type = CoreLookupType ("System.Delegate");
|
||||
@@ -1404,14 +1259,14 @@ public partial class TypeManager {
|
||||
system_decimal_expr.Type = decimal_type;
|
||||
system_single_expr.Type = float_type;
|
||||
system_double_expr.Type = double_type;
|
||||
system_sbyte_expr.Type = _sbyte_type;
|
||||
system_sbyte_expr.Type = sbyte_type;
|
||||
system_byte_expr.Type = byte_type;
|
||||
system_int16_expr.Type = short_type;
|
||||
system_uint16_expr.Type = _ushort_type;
|
||||
system_uint16_expr.Type = ushort_type;
|
||||
system_int32_expr.Type = int32_type;
|
||||
system_uint32_expr.Type = _uint32_type;
|
||||
system_uint32_expr.Type = uint32_type;
|
||||
system_int64_expr.Type = int64_type;
|
||||
system_uint64_expr.Type = _uint64_type;
|
||||
system_uint64_expr.Type = uint64_type;
|
||||
system_char_expr.Type = char_type;
|
||||
system_void_expr.Type = void_type;
|
||||
system_asynccallback_expr.Type = asynccallback_type;
|
||||
@@ -1424,47 +1279,11 @@ public partial class TypeManager {
|
||||
//
|
||||
system_date_expr.Type = date_type;
|
||||
|
||||
relative_type_order = new Hashtable ();
|
||||
relative_type_order[TypeManager.bool_type] = 1;
|
||||
relative_type_order[TypeManager.byte_type] = 1;
|
||||
relative_type_order[TypeManager.short_type] = 2;
|
||||
relative_type_order[TypeManager.int32_type] = 3;
|
||||
relative_type_order[TypeManager.int64_type] = 4;
|
||||
relative_type_order[TypeManager.decimal_type] = 5;
|
||||
relative_type_order[TypeManager.float_type] = 6;
|
||||
relative_type_order[TypeManager.double_type] = 7;
|
||||
relative_type_order[TypeManager.string_type] = 8;
|
||||
|
||||
//
|
||||
// These are only used for compare purposes
|
||||
//
|
||||
anonymous_method_type = typeof (AnonymousMethod);
|
||||
null_type = typeof (NullType);
|
||||
|
||||
InitVisualBasicHelperTypes ();
|
||||
}
|
||||
|
||||
//
|
||||
// This method preloads helper types in Microsoft.VisualBasic.dll for later use
|
||||
//
|
||||
public static void InitVisualBasicHelperTypes ()
|
||||
{
|
||||
msvbcs_object_type = CoreLookupType ("Microsoft.VisualBasic.CompilerServices.ObjectType");
|
||||
msvbcs_boolean_type = CoreLookupType ("Microsoft.VisualBasic.CompilerServices.BooleanType");
|
||||
msvbcs_byte_type = CoreLookupType ("Microsoft.VisualBasic.CompilerServices.ByteType");
|
||||
msvbcs_short_type = CoreLookupType ("Microsoft.VisualBasic.CompilerServices.ShortType");
|
||||
msvbcs_integer_type = CoreLookupType ("Microsoft.VisualBasic.CompilerServices.IntegerType");
|
||||
msvbcs_long_type = CoreLookupType ("Microsoft.VisualBasic.CompilerServices.LongType");
|
||||
msvbcs_decimal_type = CoreLookupType ("Microsoft.VisualBasic.CompilerServices.DecimalType");
|
||||
msvbcs_single_type = CoreLookupType ("Microsoft.VisualBasic.CompilerServices.SingleType");
|
||||
msvbcs_double_type = CoreLookupType ("Microsoft.VisualBasic.CompilerServices.DoubleType");
|
||||
|
||||
msvbcs_char_type = CoreLookupType ("Microsoft.VisualBasic.CompilerServices.CharType");
|
||||
msvbcs_chararray_type = CoreLookupType ("Microsoft.VisualBasic.CompilerServices.CharArrayType");
|
||||
msvbcs_date_type = CoreLookupType ("Microsoft.VisualBasic.CompilerServices.DateType");
|
||||
msvbcs_string_type = CoreLookupType ("Microsoft.VisualBasic.CompilerServices.StringType");
|
||||
|
||||
msvbcs_comparemethod_type = CoreLookupType ("Microsoft.VisualBasic.CompareMethod");
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1513,55 +1332,6 @@ public partial class TypeManager {
|
||||
delegate_remove_delegate_delegate = GetMethod (
|
||||
delegate_type, "Remove", delegate_delegate);
|
||||
|
||||
//
|
||||
// VB.NET specific
|
||||
//
|
||||
|
||||
Type [] decimal_arg = { decimal_type };
|
||||
convert_to_byte_decimal = GetMethod (
|
||||
convert_type, "ToByte", decimal_arg);
|
||||
convert_to_int16_decimal = GetMethod (
|
||||
convert_type, "ToInt16", decimal_arg);
|
||||
convert_to_int32_decimal = GetMethod (
|
||||
convert_type, "ToInt32", decimal_arg);
|
||||
convert_to_int64_decimal = GetMethod (
|
||||
convert_type, "ToInt64", decimal_arg);
|
||||
convert_to_single_decimal = GetMethod (
|
||||
convert_type, "ToSingle", decimal_arg);
|
||||
convert_to_double_decimal = GetMethod (
|
||||
convert_type, "ToDouble", decimal_arg);
|
||||
convert_to_boolean_decimal = GetMethod (
|
||||
convert_type, "ToBoolean", decimal_arg);
|
||||
|
||||
Type [] decimal_decimal = { decimal_type, decimal_type };
|
||||
decimal_compare_decimal_decimal = GetMethod (
|
||||
decimal_type, "Compare", decimal_decimal);
|
||||
|
||||
Type [] datetime_datetime = { date_type, date_type };
|
||||
datetime_compare_datetime_datetime = GetMethod (
|
||||
date_type, "Compare", datetime_datetime);
|
||||
|
||||
Type [] double_arg = { double_type };
|
||||
math_round_double = GetMethod (
|
||||
math_type, "Round", double_arg);
|
||||
|
||||
Type [] double_double_arg = { double_type, double_type };
|
||||
math_pow_double_double = GetMethod (
|
||||
math_type, "Pow", double_double_arg);
|
||||
|
||||
Type [] decimal_decimal_arg = { decimal_type, decimal_type };
|
||||
decimal_add_decimal_decimal = GetMethod (
|
||||
decimal_type, "Add", decimal_decimal_arg);
|
||||
decimal_subtract_decimal_decimal = GetMethod (
|
||||
decimal_type, "Subtract", decimal_decimal_arg);
|
||||
decimal_multiply_decimal_decimal = GetMethod (
|
||||
decimal_type, "Multiply", decimal_decimal_arg);
|
||||
decimal_divide_decimal_decimal = GetMethod (
|
||||
decimal_type, "Divide", decimal_decimal_arg);
|
||||
decimal_remainder_decimal_decimal = GetMethod (
|
||||
decimal_type, "Remainder", decimal_decimal_arg);
|
||||
|
||||
|
||||
//
|
||||
// Void arguments
|
||||
//
|
||||
@@ -1632,12 +1402,6 @@ public partial class TypeManager {
|
||||
|
||||
void_decimal_ctor_int_arg = GetConstructor (decimal_type, int_arg);
|
||||
|
||||
//
|
||||
// VB.NET specific: DateTime constructor
|
||||
//
|
||||
Type [] ticks_arg = { int64_type };
|
||||
void_datetime_ctor_ticks_arg = GetConstructor ( date_type, ticks_arg);
|
||||
|
||||
//
|
||||
// Attributes
|
||||
//
|
||||
@@ -1648,7 +1412,7 @@ public partial class TypeManager {
|
||||
unverifiable_code_type, void_arg);
|
||||
|
||||
decimal_constant_attribute_ctor = GetConstructor (decimal_constant_attribute_type, new Type []
|
||||
{ byte_type, byte_type, _uint32_type, _uint32_type, _uint32_type } );
|
||||
{ byte_type, byte_type, uint32_type, uint32_type, uint32_type } );
|
||||
|
||||
default_member_ctor = GetConstructor (default_member_type, string_);
|
||||
|
||||
@@ -1663,144 +1427,6 @@ public partial class TypeManager {
|
||||
object_ctor = GetConstructor (object_type, void_arg);
|
||||
|
||||
InitGenericCodeHelpers ();
|
||||
InitVisualBasicCodeHelpers ();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// This method preloads helper methods that are used by the VB.NET compiler
|
||||
//
|
||||
public static void InitVisualBasicCodeHelpers ()
|
||||
{
|
||||
Type [] object_arg = { object_type };
|
||||
Type [] boolean_arg = { bool_type };
|
||||
Type [] byte_arg = { byte_type };
|
||||
Type [] short_arg = { short_type };
|
||||
Type [] integer_arg = { int32_type };
|
||||
Type [] long_arg = { int64_type };
|
||||
Type [] decimal_arg = { decimal_type };
|
||||
Type [] single_arg = { float_type };
|
||||
Type [] double_arg = { double_type };
|
||||
Type [] char_arg = { char_type };
|
||||
Type [] string_arg = { string_type };
|
||||
Type [] date_arg = { date_type };
|
||||
|
||||
msvbcs_booleantype_from_string = GetMethod (
|
||||
msvbcs_boolean_type, "FromString", string_arg);
|
||||
msvbcs_bytetype_from_string = GetMethod (
|
||||
msvbcs_byte_type, "FromString", string_arg);
|
||||
msvbcs_shorttype_from_string = GetMethod (
|
||||
msvbcs_short_type, "FromString", string_arg);
|
||||
msvbcs_integertype_from_string = GetMethod (
|
||||
msvbcs_integer_type, "FromString", string_arg);
|
||||
msvbcs_longtype_from_string = GetMethod (
|
||||
msvbcs_long_type, "FromString", string_arg);
|
||||
msvbcs_decimaltype_from_string = GetMethod (
|
||||
msvbcs_decimal_type, "FromString", string_arg);
|
||||
msvbcs_singletype_from_string = GetMethod (
|
||||
msvbcs_single_type, "FromString", string_arg);
|
||||
msvbcs_doubletype_from_string = GetMethod (
|
||||
msvbcs_double_type, "FromString", string_arg);
|
||||
msvbcs_chartype_from_string = GetMethod (
|
||||
msvbcs_char_type, "FromString", string_arg);
|
||||
msvbcs_datetype_from_string = GetMethod (
|
||||
msvbcs_date_type, "FromString", string_arg);
|
||||
|
||||
msvbcs_stringtype_from_boolean = GetMethod (
|
||||
msvbcs_string_type, "FromBoolean", boolean_arg);
|
||||
msvbcs_stringtype_from_byte = GetMethod (
|
||||
msvbcs_string_type, "FromByte", byte_arg);
|
||||
msvbcs_stringtype_from_short = GetMethod (
|
||||
msvbcs_string_type, "FromShort", short_arg);
|
||||
msvbcs_stringtype_from_integer = GetMethod (
|
||||
msvbcs_string_type, "FromInteger", integer_arg);
|
||||
msvbcs_stringtype_from_long = GetMethod (
|
||||
msvbcs_string_type, "FromLong", long_arg);
|
||||
msvbcs_stringtype_from_decimal = GetMethod (
|
||||
msvbcs_string_type, "FromDecimal", decimal_arg);
|
||||
msvbcs_stringtype_from_single = GetMethod (
|
||||
msvbcs_string_type, "FromSingle", single_arg);
|
||||
msvbcs_stringtype_from_double = GetMethod (
|
||||
msvbcs_string_type, "FromDouble", double_arg);
|
||||
msvbcs_stringtype_from_date = GetMethod (
|
||||
msvbcs_string_type, "FromDate", date_arg);
|
||||
msvbcs_stringtype_from_char = GetMethod (
|
||||
msvbcs_string_type, "FromChar", char_arg);
|
||||
|
||||
msvbcs_decimaltype_from_boolean = GetMethod (
|
||||
msvbcs_decimal_type, "FromBoolean", boolean_arg);
|
||||
|
||||
Type [] string_string_boolean_arg = { string_type, string_type, bool_type };
|
||||
msvbcs_stringtype_strcmp_string_string_boolean = GetMethod (
|
||||
msvbcs_string_type, "StrCmp", string_string_boolean_arg);
|
||||
|
||||
Type [] string_string_comparemethod_arg = { string_type, string_type, msvbcs_comparemethod_type };
|
||||
msvbcs_stringtype_strlike_string_string_comparemethod = GetMethod (
|
||||
msvbcs_string_type, "StrLike", string_string_comparemethod_arg);
|
||||
|
||||
msvbcs_booleantype_fromobject_object = GetMethod (
|
||||
msvbcs_boolean_type, "FromObject", object_arg);
|
||||
msvbcs_bytetype_fromobject_object = GetMethod (
|
||||
msvbcs_byte_type, "FromObject", object_arg);
|
||||
msvbcs_shorttype_fromobject_object = GetMethod (
|
||||
msvbcs_short_type, "FromObject", object_arg);
|
||||
msvbcs_integertype_fromobject_object = GetMethod (
|
||||
msvbcs_integer_type, "FromObject", object_arg);
|
||||
msvbcs_longtype_fromobject_object = GetMethod (
|
||||
msvbcs_long_type, "FromObject", object_arg);
|
||||
msvbcs_singletype_fromobject_object = GetMethod (
|
||||
msvbcs_single_type, "FromObject", object_arg);
|
||||
msvbcs_doubletype_fromobject_object = GetMethod (
|
||||
msvbcs_double_type, "FromObject", object_arg);
|
||||
msvbcs_decimaltype_fromobject_object = GetMethod (
|
||||
msvbcs_decimal_type, "FromObject", object_arg);
|
||||
msvbcs_chartype_fromobject_object = GetMethod (
|
||||
msvbcs_char_type, "FromObject", object_arg);
|
||||
msvbcs_datetype_fromobject_object = GetMethod (
|
||||
msvbcs_date_type, "FromObject", object_arg);
|
||||
msvbcs_stringtype_fromobject_object = GetMethod (
|
||||
msvbcs_string_type, "FromObject", object_arg);
|
||||
|
||||
Type [] object_object_arg = { object_type, object_type };
|
||||
msvbcs_objecttype_mulobj_object_object = GetMethod (
|
||||
msvbcs_object_type, "MulObj", object_object_arg);
|
||||
msvbcs_objecttype_divobj_object_object = GetMethod (
|
||||
msvbcs_object_type, "DivObj", object_object_arg);
|
||||
msvbcs_objecttype_idivobj_object_object = GetMethod (
|
||||
msvbcs_object_type, "IDivObj", object_object_arg);
|
||||
msvbcs_objecttype_modobj_object_object = GetMethod (
|
||||
msvbcs_object_type, "ModObj", object_object_arg);
|
||||
msvbcs_objecttype_addobj_object_object = GetMethod (
|
||||
msvbcs_object_type, "AddObj", object_object_arg);
|
||||
msvbcs_objecttype_subobj_object_object = GetMethod (
|
||||
msvbcs_object_type, "SubObj", object_object_arg);
|
||||
msvbcs_objecttype_bitandobj_object_object = GetMethod (
|
||||
msvbcs_object_type, "BitAndObj", object_object_arg);
|
||||
msvbcs_objecttype_bitorobj_object_object = GetMethod (
|
||||
msvbcs_object_type, "BitOrObj", object_object_arg);
|
||||
msvbcs_objecttype_bitxorobj_object_object = GetMethod (
|
||||
msvbcs_object_type, "BitXorObj", object_object_arg);
|
||||
msvbcs_objecttype_strcatobj_object_object = GetMethod (
|
||||
msvbcs_object_type, "StrCatObj", object_object_arg);
|
||||
msvbcs_objecttype_powobj_object_object = GetMethod (
|
||||
msvbcs_object_type, "PowObj", object_object_arg);
|
||||
|
||||
|
||||
Type [] object_object_boolean_arg = { object_type, object_type, bool_type };
|
||||
msvbcs_objecttype_objtst_object_object_boolean = GetMethod (
|
||||
msvbcs_object_type, "ObjTst", object_object_boolean_arg);
|
||||
|
||||
|
||||
Type [] object_object_comparemethod_arg = { object_type, object_type, msvbcs_comparemethod_type };
|
||||
msvbcs_objecttype_likeobj_object_object_comparemethod = GetMethod (
|
||||
msvbcs_object_type, "LikeObj", object_object_comparemethod_arg);
|
||||
|
||||
Type [] object_int32_arg = { object_type, int32_type };
|
||||
msvbcs_objecttype_shiftleftobj_object_int32 = GetMethod (
|
||||
msvbcs_object_type, "ShiftLeftObj", object_int32_arg);
|
||||
msvbcs_objecttype_shiftrightobj_object_int32 = GetMethod (
|
||||
msvbcs_object_type, "ShiftRightObj", object_int32_arg);
|
||||
|
||||
}
|
||||
|
||||
const BindingFlags instance_and_static = BindingFlags.Static | BindingFlags.Instance;
|
||||
@@ -1958,10 +1584,10 @@ public partial class TypeManager {
|
||||
|
||||
public static bool IsBuiltinType (Type t)
|
||||
{
|
||||
if (t == object_type || t == string_type || t == int32_type || t == _uint32_type ||
|
||||
t == int64_type || t == _uint64_type || t == float_type || t == double_type ||
|
||||
if (t == object_type || t == string_type || t == int32_type || t == uint32_type ||
|
||||
t == int64_type || t == uint64_type || t == float_type || t == double_type ||
|
||||
t == char_type || t == short_type || t == decimal_type || t == bool_type ||
|
||||
t == _sbyte_type || t == byte_type || t == _ushort_type || t == void_type)
|
||||
t == sbyte_type || t == byte_type || t == ushort_type || t == void_type)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
@@ -1978,45 +1604,15 @@ public partial class TypeManager {
|
||||
//
|
||||
public static bool IsCLRType (Type t)
|
||||
{
|
||||
if (t == object_type || t == int32_type || t == _uint32_type ||
|
||||
t == int64_type || t == _uint64_type || t == float_type || t == double_type ||
|
||||
if (t == object_type || t == int32_type || t == uint32_type ||
|
||||
t == int64_type || t == uint64_type || t == float_type || t == double_type ||
|
||||
t == char_type || t == short_type || t == bool_type ||
|
||||
t == _sbyte_type || t == byte_type || t == _ushort_type)
|
||||
t == sbyte_type || t == byte_type || t == ushort_type)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// The following three methods are used by the VB.NET compiler
|
||||
//
|
||||
|
||||
public static bool IsFixedNumericType (Type type)
|
||||
{
|
||||
if (type == byte_type || type == short_type ||
|
||||
type == int32_type || type == int64_type)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsFloatingNumericType (Type type)
|
||||
{
|
||||
if (type == decimal_type ||
|
||||
type == float_type || type == double_type)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsNumericType (Type type)
|
||||
{
|
||||
if (IsFixedNumericType (type) || IsFloatingNumericType(type))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsDelegateType (Type t)
|
||||
{
|
||||
if (t.IsGenericInstance)
|
||||
@@ -2751,14 +2347,14 @@ public partial class TypeManager {
|
||||
// slow path needed to compile corlib
|
||||
if (t == TypeManager.bool_type ||
|
||||
t == TypeManager.byte_type ||
|
||||
t == TypeManager._sbyte_type ||
|
||||
t == TypeManager.sbyte_type ||
|
||||
t == TypeManager.char_type ||
|
||||
t == TypeManager.short_type ||
|
||||
t == TypeManager._ushort_type ||
|
||||
t == TypeManager.ushort_type ||
|
||||
t == TypeManager.int32_type ||
|
||||
t == TypeManager._uint32_type ||
|
||||
t == TypeManager.uint32_type ||
|
||||
t == TypeManager.int64_type ||
|
||||
t == TypeManager._uint64_type)
|
||||
t == TypeManager.uint64_type)
|
||||
return t;
|
||||
throw new Exception ("Unhandled typecode in enum " + " from " + t.AssemblyQualifiedName);
|
||||
}
|
||||
@@ -2770,21 +2366,21 @@ public partial class TypeManager {
|
||||
case TypeCode.Byte:
|
||||
return TypeManager.byte_type;
|
||||
case TypeCode.SByte:
|
||||
return TypeManager._sbyte_type;
|
||||
return TypeManager.sbyte_type;
|
||||
case TypeCode.Char:
|
||||
return TypeManager.char_type;
|
||||
case TypeCode.Int16:
|
||||
return TypeManager.short_type;
|
||||
case TypeCode.UInt16:
|
||||
return TypeManager._ushort_type;
|
||||
return TypeManager.ushort_type;
|
||||
case TypeCode.Int32:
|
||||
return TypeManager.int32_type;
|
||||
case TypeCode.UInt32:
|
||||
return TypeManager._uint32_type;
|
||||
return TypeManager.uint32_type;
|
||||
case TypeCode.Int64:
|
||||
return TypeManager.int64_type;
|
||||
case TypeCode.UInt64:
|
||||
return TypeManager._uint64_type;
|
||||
return TypeManager.uint64_type;
|
||||
}
|
||||
throw new Exception ("Unhandled typecode in enum " + tc + " from " + t.AssemblyQualifiedName);
|
||||
}
|
||||
@@ -2806,21 +2402,21 @@ public partial class TypeManager {
|
||||
case TypeCode.Byte:
|
||||
return TypeManager.byte_type;
|
||||
case TypeCode.SByte:
|
||||
return TypeManager._sbyte_type;
|
||||
return TypeManager.sbyte_type;
|
||||
case TypeCode.Char:
|
||||
return TypeManager.char_type;
|
||||
case TypeCode.Int16:
|
||||
return TypeManager.short_type;
|
||||
case TypeCode.UInt16:
|
||||
return TypeManager._ushort_type;
|
||||
return TypeManager.ushort_type;
|
||||
case TypeCode.Int32:
|
||||
return TypeManager.int32_type;
|
||||
case TypeCode.UInt32:
|
||||
return TypeManager._uint32_type;
|
||||
return TypeManager.uint32_type;
|
||||
case TypeCode.Int64:
|
||||
return TypeManager.int64_type;
|
||||
case TypeCode.UInt64:
|
||||
return TypeManager._uint64_type;
|
||||
return TypeManager.uint64_type;
|
||||
case TypeCode.Single:
|
||||
return TypeManager.float_type;
|
||||
case TypeCode.Double:
|
||||
|
||||
@@ -1,59 +1,3 @@
|
||||
2005-05-04 Zoltan Varga <[email protected]>
|
||||
|
||||
* rules.make config-default.make: Use the install-sh script from the mono
|
||||
directory by default.
|
||||
|
||||
2005-04-29 Ben Maurer <[email protected]>
|
||||
|
||||
* profiles/basic.make: The test for mcs was broken on jails where
|
||||
we got a warning due to /proc not being mounted. Remove hackish wc
|
||||
usage.
|
||||
|
||||
2005-04-25 Raja R Harinath <[email protected]>
|
||||
|
||||
* config-default.make (RUNTIME): Set to 'false'.
|
||||
Reported by Ben Maurer.
|
||||
* profiles/basic.make (MCS): Revert changes below.
|
||||
* platforms/linux.make (ILDISASM): Define.
|
||||
* platforms/win32.make (ILDIsASM): Likewise.
|
||||
|
||||
2005-04-23 Ben Maurer <[email protected]>
|
||||
|
||||
* profiles/basic.make: Ensure that make dist works even if you
|
||||
only have an old mono rpm installed. Essential for the new build
|
||||
system.
|
||||
|
||||
2005-04-21 Raja R Harinath <[email protected]>
|
||||
|
||||
* rules.make (INTERNAL_ILASM): Update.
|
||||
|
||||
2005-04-14 Raja R Harinath <[email protected]>
|
||||
|
||||
* library.make (dist-local): Include all ChangeLogs in the tarball.
|
||||
|
||||
2005-04-08 Raja R Harinath <[email protected]>
|
||||
|
||||
* profiles/basic.make (do-profile-check): Handle some possible
|
||||
timestamp problems. Hopefully fix #74280.
|
||||
|
||||
2005-03-30 Zoltan Varga <[email protected]>
|
||||
|
||||
* rules.make (INSTALL_DATA): Pass -c to install.
|
||||
|
||||
2005-03-18 Raja R Harinath <[email protected]>
|
||||
|
||||
* library.make (TEST_FILES, $(test_response), $(btest_response)):
|
||||
Be more robust to empty lines in test sources file.
|
||||
|
||||
2005-03-14 Raja R Harinath <[email protected]>
|
||||
|
||||
* executable.make (install-local): Depend on all-local even when
|
||||
NO_INSTALL is defined.
|
||||
* library.make: Minor cleanups to match executable.make.
|
||||
(gacutil): Use net_1_1_bootstrap/gacutil.exe.
|
||||
* profiles/basic.make (no-install): Remove.
|
||||
* profiles/net_1_1_bootstrap.make (no-install): Likewise.
|
||||
|
||||
2005-02-22 Raja R Harinath <[email protected]>
|
||||
|
||||
* library.make (BUILT_SOURCES_cmdline): Don't define if
|
||||
|
||||
@@ -12,11 +12,11 @@ MCS_FLAGS = $(PLATFORM_DEBUG_FLAGS)
|
||||
MBAS_FLAGS = $(PLATFORM_DEBUG_FLAGS)
|
||||
LIBRARY_FLAGS = /noconfig
|
||||
CFLAGS = -g -O2
|
||||
INSTALL = /usr/bin/install
|
||||
prefix = /usr/local
|
||||
exec_prefix = $(prefix)
|
||||
mono_libdir = $(exec_prefix)/lib
|
||||
#RUNTIME = mono
|
||||
RUNTIME = false
|
||||
libdir = $(exec_prefix)/lib
|
||||
RUNTIME = mono $(RUNTIME_FLAGS)
|
||||
TEST_RUNTIME = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug
|
||||
|
||||
# In case you want to add MCS_FLAGS, this lets you not have to
|
||||
|
||||
@@ -25,17 +25,13 @@ executable_CLEAN_FILES += $(makefrag) $(pdb) $(mdb)
|
||||
|
||||
all-local: $(PROGRAM) $(PROGRAM_config)
|
||||
|
||||
install-local: all-local
|
||||
test-local: all-local
|
||||
uninstall-local:
|
||||
|
||||
ifdef NO_INSTALL
|
||||
install-local uninstall-local:
|
||||
@:
|
||||
else
|
||||
|
||||
ifndef PROGRAM_INSTALL_DIR
|
||||
PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
|
||||
PROGRAM_INSTALL_DIR = $(libdir)/mono/$(FRAMEWORK_VERSION)
|
||||
endif
|
||||
|
||||
install-local: $(PROGRAM) $(PROGRAM_config)
|
||||
@@ -53,7 +49,7 @@ endif
|
||||
clean-local:
|
||||
-rm -f $(executable_CLEAN_FILES) $(CLEAN_FILES)
|
||||
|
||||
test-local:
|
||||
test-local: $(PROGRAM)
|
||||
@:
|
||||
run-test-local:
|
||||
@:
|
||||
|
||||
+15
-30
@@ -76,35 +76,27 @@ endif
|
||||
|
||||
endif
|
||||
|
||||
ifdef NO_INSTALL
|
||||
GACUTIL = :
|
||||
else
|
||||
gacutil = $(topdir)/class/lib/net_1_1_bootstrap/gacutil.exe
|
||||
GACUTIL = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(gacutil)
|
||||
endif
|
||||
gacutil = $(topdir)/tools/gacutil/gacutil.exe
|
||||
GACUTIL = MONO_PATH="$(topdir)/class/lib/default$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(gacutil)
|
||||
|
||||
ifdef NO_SIGN_ASSEMBLY
|
||||
SN = :
|
||||
else
|
||||
sn = $(topdir)/class/lib/net_1_1_bootstrap/sn.exe
|
||||
SN = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(sn)
|
||||
SN = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap/$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(sn)
|
||||
SNFLAGS = -q -R
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), win32)
|
||||
GACDIR = `cygpath -w $(mono_libdir)`
|
||||
GACROOT = `cygpath -w $(DESTDIR)$(mono_libdir)`
|
||||
GACDIR = `cygpath -w $(libdir)`
|
||||
GACROOT = `cygpath -w $(DESTDIR)$(libdir)`
|
||||
test_flags += -d:WINDOWS
|
||||
else
|
||||
GACDIR = $(mono_libdir)
|
||||
GACROOT = $(DESTDIR)$(mono_libdir)
|
||||
GACDIR = $(libdir)
|
||||
GACROOT = $(DESTDIR)$(libdir)
|
||||
endif
|
||||
|
||||
all-local: $(the_lib)
|
||||
|
||||
install-local: all-local
|
||||
test-local: all-local
|
||||
uninstall-local:
|
||||
all-local install-local test-local: $(the_lib)
|
||||
|
||||
ifdef NO_INSTALL
|
||||
install-local uninstall-local:
|
||||
@@ -194,25 +186,20 @@ DISTFILES = $(sourcefile) $(EXTRA_DISTFILES)
|
||||
TEST_FILES =
|
||||
|
||||
ifdef HAVE_CS_TESTS
|
||||
TEST_FILES += `sed -e '/^$$/d' -e 's,^,Test/,' $(test_sourcefile)`
|
||||
TEST_FILES += `sed 's,^,Test/,' $(test_sourcefile)`
|
||||
DISTFILES += $(test_sourcefile)
|
||||
endif
|
||||
ifdef HAVE_VB_TESTS
|
||||
TEST_FILES += `sed -e '/^$$/d' -e 's,^,Test/,' $(btest_sourcefile)`
|
||||
TEST_FILES += `sed 's,^,Test/,' $(btest_sourcefile)`
|
||||
DISTFILES += $(btest_sourcefile)
|
||||
endif
|
||||
|
||||
dist-local: dist-default
|
||||
subs=' ' ; \
|
||||
for f in `cat $(sourcefile)` $(TEST_FILES) ; do \
|
||||
case $$f in \
|
||||
../*) : ;; \
|
||||
*) dest=`dirname $$f` ; \
|
||||
case $$subs in *" $$dest "*) : ;; *) subs=" $$dest$$subs" ; $(MKINSTALLDIRS) $(distdir)/$$dest ;; esac ; \
|
||||
cp -p $$f $(distdir)/$$dest || exit 1 ;; \
|
||||
esac ; done ; \
|
||||
for d in . $$subs ; do \
|
||||
case $$d in .) : ;; *) test ! -f $$d/ChangeLog || cp -p $$d/ChangeLog $(distdir)/$$d ;; esac ; done
|
||||
*) dest=`dirname $(distdir)/$$f` ; $(MKINSTALLDIRS) $$dest && cp -p $$f $$dest || exit 1 ;; \
|
||||
esac ; done
|
||||
|
||||
ifndef LIBRARY_COMPILE
|
||||
LIBRARY_COMPILE = $(CSCOMPILE)
|
||||
@@ -230,10 +217,8 @@ ifndef LIBRARY_SNK
|
||||
LIBRARY_SNK = $(topdir)/class/mono.snk
|
||||
endif
|
||||
|
||||
ifdef gacutil
|
||||
$(gacutil):
|
||||
cd $(topdir) && $(MAKE) PROFILE=net_1_1_bootstrap
|
||||
endif
|
||||
cd $(topdir)/tools/gacutil && $(MAKE) PROFILE=default
|
||||
|
||||
ifdef sn
|
||||
$(sn):
|
||||
@@ -283,7 +268,7 @@ $(test_lib): $(test_dep) $(test_response) $(test_nunit_dep)
|
||||
|
||||
$(test_response): $(test_sourcefile)
|
||||
@echo Creating $@ ...
|
||||
@sed -e '/^$$/d' -e 's,^,Test/,' $(test_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
|
||||
@sed 's,^,Test/,' $(test_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
|
||||
|
||||
$(test_makefrag): $(test_response)
|
||||
@echo Creating $@ ...
|
||||
@@ -300,7 +285,7 @@ $(btest_lib): $(test_dep) $(btest_response) $(test_nunit_dep)
|
||||
|
||||
$(btest_response): $(btest_sourcefile)
|
||||
@echo Creating $@ ...
|
||||
@sed -e '/^$$/d' -e 's,^,Test/,' $(btest_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
|
||||
@sed 's,^,Test/,' $(btest_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
|
||||
|
||||
$(btest_makefrag): $(btest_response)
|
||||
@echo Creating $@ ...
|
||||
|
||||
@@ -12,8 +12,6 @@ EXTERNAL_MCS = mcs
|
||||
EXTERNAL_MBAS = mbas
|
||||
EXTERNAL_RUNTIME = mono
|
||||
RESGEN = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_RESGEN)
|
||||
#ILDISASM = monodis
|
||||
ILDISASM = false
|
||||
|
||||
PLATFORM_PATH_SEPARATOR = :
|
||||
|
||||
|
||||
@@ -11,16 +11,8 @@ PLATFORM_CORLIB = mscorlib.dll
|
||||
EXTERNAL_MCS = csc.exe
|
||||
EXTERNAL_MBAS = vbc.exe
|
||||
EXTERNAL_RUNTIME =
|
||||
|
||||
# Disabled since it needs the SDK
|
||||
#RESGEN = resgen.exe
|
||||
#ILDISASM = ildasm.exe /test
|
||||
RESGEN = $(topdir)/tools/resgen/resgen.exe
|
||||
|
||||
#ILDISASM = monodis.bat
|
||||
## Gross hack
|
||||
ILDISASM = $(topdir)/../mono/mono/dis/monodis
|
||||
|
||||
PLATFORM_MAKE_CORLIB_CMP = yes
|
||||
PLATFORM_CHANGE_SEPARATOR_CMD=tr '/' '\\\\'
|
||||
PLATFORM_PATH_SEPARATOR = ;
|
||||
|
||||
@@ -20,6 +20,10 @@ endif
|
||||
clean-profile:
|
||||
-rm -f $(PROFILE_CS) $(PROFILE_EXE) $(PROFILE_OUT)
|
||||
|
||||
install-local: no-install
|
||||
no-install:
|
||||
exit 1
|
||||
|
||||
PROFILE_CS = $(topdir)/build/deps/basic-profile-check.cs
|
||||
PROFILE_EXE = $(PROFILE_CS:.cs=.exe)
|
||||
PROFILE_OUT = $(PROFILE_CS:.cs=.out)
|
||||
@@ -33,24 +37,21 @@ do-profile-check:
|
||||
echo "*** The compiler '$(EXTERNAL_MCS)' doesn't appear to be usable." 1>&2 ; \
|
||||
if test -f $(topdir)/class/lib/monolite/mcs.exe; then \
|
||||
echo "*** Falling back to using pre-compiled binaries. Be warned, this may not work." 1>&2 ; \
|
||||
( cd $(topdir)/jay && $(MAKE) ); \
|
||||
( cd $(topdir)/mcs && $(MAKE) PROFILE=basic cs-parser.cs ); \
|
||||
( cd $(topdir)/class/lib/monolite/ && cp *.exe *.dll ../basic ); \
|
||||
case `ls -1t $(topdir)/class/lib/basic/mcs.exe $(topdir)/mcs/cs-parser.cs | sed 1q` in \
|
||||
$(topdir)/class/lib/basic/mcs.exe) : ;; \
|
||||
*) sleep 5; cp $(topdir)/class/lib/monolite/mcs.exe $(topdir)/class/lib/basic ;; \
|
||||
esac; \
|
||||
( cd $(topdir)/jay && $(MAKE) ); ( cd $(topdir)/mcs && $(MAKE) PROFILE=basic cs-parser.cs ); \
|
||||
touch $(topdir)/class/lib/basic/*; \
|
||||
else \
|
||||
echo "*** You need a C# compiler installed to build MCS. (make sure mcs works from the command line)" 1>&2 ; \
|
||||
echo "*** Read INSTALL.txt for information on how to bootstrap a Mono installation." 1>&2 ; \
|
||||
exit 1; fi; fi
|
||||
|
||||
$(PROFILE_CS): $(topdir)/build/profiles/basic.make
|
||||
echo 'class X { static int Main () { return 0; } }' > $@
|
||||
echo 'public class X { public static void Main () { System.Console.WriteLine ("OK"); } }' > $@
|
||||
|
||||
$(PROFILE_EXE): $(PROFILE_CS)
|
||||
$(EXTERNAL_MCS) /out:$@ $<
|
||||
|
||||
$(PROFILE_OUT): $(PROFILE_EXE)
|
||||
$(EXTERNAL_RUNTIME) $< > $@ 2>&1
|
||||
|
||||
set x `wc -l $@`; case $$2 in 1) :;; *) exit 1;; esac
|
||||
grep '^OK$$' $@ > /dev/null
|
||||
@@ -14,7 +14,7 @@
|
||||
# run the compiler; /r: flags are by default loaded from whatever's
|
||||
# in the MONO_PATH too).
|
||||
|
||||
MCS = MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) --debug $(topdir)/mcs/mcs.exe
|
||||
MCS = MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(RUNTIME) --debug $(topdir)/mcs/mcs.exe
|
||||
BOOTSTRAP_MCS = $(MCS)
|
||||
|
||||
# nuttzing!
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# in the MONO_PATH too).
|
||||
|
||||
ifdef PLATFORM_MONO_NATIVE
|
||||
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/net_1_1_bootstrap/mcs.exe
|
||||
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(topdir)/class/lib/net_1_1_bootstrap/mcs.exe
|
||||
MCS = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_MCS)
|
||||
MBAS = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_MBAS)
|
||||
else
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- makefile -*-
|
||||
|
||||
ifdef PLATFORM_MONO_NATIVE
|
||||
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/basic:$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/basic/mcs.exe
|
||||
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/basic:$$MONO_PATH" $(RUNTIME) $(topdir)/class/lib/basic/mcs.exe
|
||||
MCS = MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(INTERNAL_MCS)
|
||||
MBAS = MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(INTERNAL_MBAS)
|
||||
else
|
||||
@@ -19,3 +19,7 @@ profile-check:
|
||||
|
||||
PROFILE_MCS_FLAGS = -d:NET_1_1 -d:ONLY_1_1
|
||||
PROFILE_MBAS_FLAGS = -d:NET_1_1 -d:ONLY_1_1
|
||||
|
||||
install-local: no-install
|
||||
no-install:
|
||||
exit 1
|
||||
@@ -4,7 +4,7 @@
|
||||
# Note that we're using the .NET 1.1 MCS but MONO_PATH points to the net_2_0_bootstrap directory.
|
||||
# We do it this way to get assembly version references right.
|
||||
#
|
||||
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/default$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/default/mcs.exe
|
||||
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/default$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(topdir)/class/lib/default/mcs.exe
|
||||
MCS = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_MCS)
|
||||
|
||||
profile-check:
|
||||
|
||||
@@ -22,16 +22,15 @@ CSCOMPILE = $(MCS) $(USE_MCS_FLAGS)
|
||||
BASCOMPILE = $(MBAS) $(USE_MBAS_FLAGS)
|
||||
CCOMPILE = $(CC) $(USE_CFLAGS)
|
||||
BOOT_COMPILE = $(BOOTSTRAP_MCS) $(USE_MCS_FLAGS)
|
||||
INSTALL = $(SHELL) $(topdir)/../mono/install-sh
|
||||
INSTALL_DATA = $(INSTALL) -c -m 644
|
||||
INSTALL_BIN = $(INSTALL) -c -m 755
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
INSTALL_BIN = $(INSTALL) -m 755
|
||||
INSTALL_LIB = $(INSTALL_BIN)
|
||||
MKINSTALLDIRS = $(SHELL) $(topdir)/mkinstalldirs
|
||||
INTERNAL_MCS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/mcs.exe
|
||||
INTERNAL_MBAS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/mbas/mbas.exe
|
||||
INTERNAL_GMCS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/gmcs/gmcs.exe
|
||||
INTERNAL_ILASM = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/ilasm.exe
|
||||
INTERNAL_RESGEN = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/tools/resgen/resgen.exe
|
||||
INTERNAL_MCS = $(RUNTIME) $(topdir)/class/lib/$(PROFILE)/mcs.exe
|
||||
INTERNAL_MBAS = $(RUNTIME) $(topdir)/mbas/mbas.exe
|
||||
INTERNAL_GMCS = $(RUNTIME) $(topdir)/gmcs/gmcs.exe
|
||||
INTERNAL_ILASM = $(RUNTIME) $(topdir)/ilasm/ilasm.exe
|
||||
INTERNAL_RESGEN = $(RUNTIME) $(topdir)/tools/resgen/resgen.exe
|
||||
corlib = mscorlib.dll
|
||||
|
||||
depsdir = $(topdir)/build/deps
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
2005-04-21 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile (net_1_1_bootstrap_SUBDIRS): Add PEAPI.
|
||||
|
||||
2005-04-07 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile ($(basic_files:%=lib/basic/%)): Build the "basic"
|
||||
profile if needed. This is used when 'make dist' is invoked on a
|
||||
clean tree. Reported by Ben Maurer.
|
||||
|
||||
2005-01-24 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile (bootstrap_dirs): Add Mono.Security and System.Security
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
2005-03-28 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* Commons.Xml.Relaxnf.dll.sources : added XmlChar.cs
|
||||
|
||||
2005-03-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* README :
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
2005-04-11 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* NvdlRelaxngSupport.cs : added PlanAtt validation support.
|
||||
|
||||
2005-04-06 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* NvdlValidator.cs : fixed warning.
|
||||
|
||||
2005-03-07 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* NvdlFilteredXmlReader.cs, NvdlStructures.cs, NvdlSimplified.cs :
|
||||
|
||||
@@ -46,14 +46,14 @@ namespace Commons.Xml.Nvdl
|
||||
|
||||
internal class NvdlRelaxngValidatorGenerator : NvdlValidatorGenerator
|
||||
{
|
||||
RelaxngPattern pattern;
|
||||
RelaxngPattern attributePattern;
|
||||
RelaxngPattern compiledPattern;
|
||||
|
||||
public NvdlRelaxngValidatorGenerator (RelaxngPattern p,
|
||||
NvdlConfig config)
|
||||
{
|
||||
// FIXME: use XmlResolver
|
||||
pattern = p;
|
||||
p.Compile ();
|
||||
compiledPattern = p;
|
||||
}
|
||||
|
||||
public override XmlReader CreateValidator (XmlReader reader,
|
||||
@@ -62,24 +62,7 @@ namespace Commons.Xml.Nvdl
|
||||
// XmlResolver is never used.
|
||||
RelaxngValidatingReader rvr =
|
||||
new RelaxngValidatingReader (
|
||||
reader, pattern);
|
||||
rvr.ReportDetails = true;
|
||||
return rvr;
|
||||
}
|
||||
|
||||
public override XmlReader CreateAttributeValidator (
|
||||
XmlReader reader,
|
||||
XmlResolver resolver)
|
||||
{
|
||||
if (attributePattern == null) {
|
||||
RelaxngElement el = new RelaxngElement ();
|
||||
el.NameClass = new RelaxngAnyName ();
|
||||
el.Patterns.Add (pattern);
|
||||
}
|
||||
// XmlResolver is never used.
|
||||
RelaxngValidatingReader rvr =
|
||||
new RelaxngValidatingReader (
|
||||
reader, attributePattern);
|
||||
reader, compiledPattern);
|
||||
rvr.ReportDetails = true;
|
||||
return rvr;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ NvdlDebug.Writer.WriteLine ("------- corresponding PlanElem already exists.");
|
||||
int elemStep = elementNameStack.Count - 1;
|
||||
for (int i = path.Steps.Length; i >= 0 && elemStep >= 0;) {
|
||||
SimplePathStep ps = path.Steps [i];
|
||||
if (ps.Name != elementNameStack [elemStep] as string) {
|
||||
if (ps.Name != elementNameStack [elemStep]) {
|
||||
if (!ps.Descendants)
|
||||
return false;
|
||||
if (--elemStep < 0)
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
2005-04-11 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* Util.cs : tiny debug string fix.
|
||||
|
||||
2005-03-01 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RdpPattern.cs : In "textDeriv(group p1 p2) s", "nullable p1" is
|
||||
|
||||
@@ -52,9 +52,6 @@ namespace Commons.Xml.Relaxng.Derivative
|
||||
+ nm.LocalName + "</name>\n";
|
||||
case RdpNameClassType.NsName:
|
||||
return "<nsName ns='" + ((RdpNsName)n).NamespaceURI + "'/>\n";
|
||||
case RdpNameClassType.NameClassChoice:
|
||||
RdpNameClassChoice nc = (RdpNameClassChoice) n;
|
||||
return "<choice>" + DebugNameClass (nc.LValue) + DebugNameClass (nc.RValue) + "</choice>";
|
||||
default:
|
||||
return "<" + n.NameClassType.ToString () + "/>\n";
|
||||
}
|
||||
|
||||
@@ -1,35 +1,3 @@
|
||||
2005-03-28 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RncTokenizer.cs : check names strictly.
|
||||
* RncParser.jay : quick workaround that "datatype" is rejected as
|
||||
top level content. We should fix the problem that annotation
|
||||
elements are not accepted instead of datatype later.
|
||||
|
||||
2005-03-28 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* XmlChar.cs : copied from system.xml.
|
||||
* RncTokenizer.cs : check character validity.
|
||||
Handle \-prefixed keyword name more strictly.
|
||||
Simplify CName tokenization.
|
||||
Move location after successful advance().
|
||||
* RncParser.jay : now there is no NCNameButKeyword.
|
||||
|
||||
2005-03-28 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RncTokenizer.cs : oops, so stupid hex computation.
|
||||
|
||||
2005-03-28 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RncTokenizer.cs :
|
||||
Handle hexadecimal escaping (\x{...}) and triple-quot/apos literals.
|
||||
Quote literal didn't handle '...' as expected.
|
||||
|
||||
2005-03-23 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RncParser.jay : fixed some cast error. Supply type name for "data".
|
||||
* RncTokenizer.cs : don't reject '-' for NCName.
|
||||
Don't regard documentation token as a valid token for parser.
|
||||
|
||||
2005-02-05 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RncParser.jay : handle default namespace.
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
%token TwoGreaters ">>"
|
||||
|
||||
%token LiteralSegment
|
||||
%token NCName
|
||||
%token NCNameButKeyword
|
||||
|
||||
%token Documentation
|
||||
|
||||
@@ -667,11 +667,14 @@ AnnotatedPrimary /* returns RelaxngPattern */
|
||||
}
|
||||
;
|
||||
|
||||
AnnotatedDataExcept /* returns RelaxngPattern */
|
||||
AnnotatedDataExcept /* returns RelaxngPatternList */
|
||||
: LeadAnnotatedDataExcept FollowAnnotations
|
||||
{
|
||||
// FIXME: handle followAnnotations
|
||||
$$ = $1;
|
||||
RelaxngData p = (RelaxngData) $1;
|
||||
RelaxngPatternList l = new RelaxngPatternList ();
|
||||
l.Add (p);
|
||||
$$ = l;
|
||||
}
|
||||
;
|
||||
|
||||
@@ -805,14 +808,12 @@ Primary /* returns RelaxngPattern */
|
||||
DataExcept /* returns RelaxngData */
|
||||
: DatatypeName OptParams Minus LeadAnnotatedPrimary
|
||||
{
|
||||
XmlQualifiedName type = (XmlQualifiedName) $1;
|
||||
RelaxngData data = new RelaxngData ();
|
||||
data.Type = type.Name;
|
||||
data.DatatypeLibrary = type.Namespace;
|
||||
foreach (RelaxngParam p in (RelaxngParamList) $2)
|
||||
foreach (RelaxngParam p in (IList) $2)
|
||||
data.ParamList.Add (p);
|
||||
data.Except = new RelaxngExcept ();
|
||||
data.Except.Patterns.Add ((RelaxngPattern) $4);
|
||||
foreach (RelaxngPattern p in (RelaxngPatternList) $4)
|
||||
data.Except.Patterns.Add (p);
|
||||
$$ = data;
|
||||
}
|
||||
;
|
||||
@@ -1089,24 +1090,21 @@ AnnotationElementNotKeyword /* returns null */
|
||||
: ForeignElementNameNotKeyword AnnotationAttributesContent
|
||||
{
|
||||
// do nothing
|
||||
$$ = $1;
|
||||
// $$ = Element ($1, $2);
|
||||
}
|
||||
;
|
||||
|
||||
ForeignElementNameNotKeyword /* returns XmlQualifiedName */
|
||||
/* FIXME: unprefixed Identifier causes conflict */
|
||||
/* LAMESPEC: unprefixed Identifier causes conflict */
|
||||
: /*Identifier
|
||||
{
|
||||
$$ = new XmlQualifiedName ((string) $1, String.Empty);
|
||||
}
|
||||
*/
|
||||
/* FIXME: prefixed name causes conflict */
|
||||
| /*PrefixedName
|
||||
|*/ PrefixedName
|
||||
{
|
||||
// Constraint: RELAX NG namespace URI
|
||||
$$ = (XmlQualifiedName) $1;
|
||||
}
|
||||
*/
|
||||
;
|
||||
|
||||
AnnotationAttributesContent /* returns null */
|
||||
@@ -1243,11 +1241,16 @@ Literal /* returns string */
|
||||
;
|
||||
|
||||
Identifier /* returns string */
|
||||
: NCName
|
||||
: NCNameButKeyword
|
||||
{
|
||||
$$ = (string) $1;
|
||||
}
|
||||
| BackSlash NCName
|
||||
| BackSlash NCNameButKeyword
|
||||
{
|
||||
$$ = (string) $2;
|
||||
}
|
||||
/* extended */
|
||||
| BackSlash Keyword
|
||||
{
|
||||
$$ = (string) $2;
|
||||
}
|
||||
|
||||
@@ -44,15 +44,13 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
int currentToken;
|
||||
object tokenValue;
|
||||
int peekChar;
|
||||
string peekString;
|
||||
bool isElement;
|
||||
bool isLiteralNsUri;
|
||||
|
||||
int line = 1;
|
||||
int column;
|
||||
int savedLineNumber = 1;
|
||||
int savedLinePosition;
|
||||
bool nextIncrementLine;
|
||||
string prefixName;
|
||||
|
||||
public RncTokenizer (TextReader source)
|
||||
{
|
||||
@@ -64,11 +62,11 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
}
|
||||
|
||||
public int Line {
|
||||
get { return savedLineNumber; }
|
||||
get { return line; }
|
||||
}
|
||||
|
||||
public int Column {
|
||||
get { return savedLinePosition; }
|
||||
get { return column; }
|
||||
}
|
||||
|
||||
// jay interface implementation
|
||||
@@ -80,10 +78,10 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
|
||||
public bool advance ()
|
||||
{
|
||||
if (prefixName != null)
|
||||
throw new RelaxngException ("Invalid prefix was found.");
|
||||
tokenValue = null;
|
||||
currentToken = ParseToken (false);
|
||||
savedLineNumber = line;
|
||||
savedLinePosition = column;
|
||||
currentToken = ParseToken ();
|
||||
return currentToken != Token.EOF;
|
||||
}
|
||||
|
||||
@@ -94,85 +92,10 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
|
||||
// private methods
|
||||
|
||||
private int ReadEscapedHexNumber (int current)
|
||||
{
|
||||
int i = source.Read ();
|
||||
switch (i) {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
current = current * 16 + (i - '0');
|
||||
return ReadEscapedHexNumber (current);
|
||||
case 'A':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'E':
|
||||
case 'F':
|
||||
current = current * 16 + (i - 'A') + 10;
|
||||
return ReadEscapedHexNumber (current);
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 'e':
|
||||
case 'f':
|
||||
current = current * 16 + (i - 'a' + 10);
|
||||
return ReadEscapedHexNumber (current);
|
||||
}
|
||||
peekChar = i;
|
||||
return current;
|
||||
}
|
||||
|
||||
private int ReadFromStream ()
|
||||
{
|
||||
int ret = source.Read ();
|
||||
if (ret != '\\')
|
||||
return ret;
|
||||
ret = source.Read ();
|
||||
switch (ret) {
|
||||
case 'x':
|
||||
int tmp;
|
||||
int xcount = 0;
|
||||
do {
|
||||
xcount++;
|
||||
tmp = source.Read ();
|
||||
} while (tmp == 'x');
|
||||
if (tmp != '{') {
|
||||
peekString = new string ('x', xcount);
|
||||
if (tmp >= 0)
|
||||
peekString += (char) tmp;
|
||||
return '\\';
|
||||
}
|
||||
ret = ReadEscapedHexNumber (0);
|
||||
if (peekChar != '}')
|
||||
break;
|
||||
peekChar = 0;
|
||||
return ret;
|
||||
}
|
||||
peekString = new string ((char) ret, 1);
|
||||
return '\\';
|
||||
}
|
||||
|
||||
private int PeekChar ()
|
||||
{
|
||||
if (peekChar == 0) {
|
||||
if (peekString != null) {
|
||||
peekChar = peekString [0];
|
||||
peekString = peekString.Length == 1 ?
|
||||
null : peekString.Substring (1);
|
||||
}
|
||||
else
|
||||
peekChar = ReadFromStream ();
|
||||
}
|
||||
|
||||
if (peekChar == 0)
|
||||
peekChar = source.Read ();
|
||||
return peekChar;
|
||||
}
|
||||
|
||||
@@ -183,13 +106,8 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
ret = peekChar;
|
||||
peekChar = 0;
|
||||
}
|
||||
else if (peekString != null) {
|
||||
ret = peekString [0];
|
||||
peekString = peekString.Length == 1 ?
|
||||
null : peekString.Substring (1);
|
||||
}
|
||||
else
|
||||
ret = ReadFromStream ();
|
||||
ret = source.Read ();
|
||||
|
||||
if (nextIncrementLine) {
|
||||
line++;
|
||||
@@ -228,44 +146,8 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
|
||||
char [] nameBuffer = new char [30];
|
||||
|
||||
// TODO: parse three quoted
|
||||
private string ReadQuoted (char quoteChar)
|
||||
{
|
||||
int index = 0;
|
||||
bool loop = true;
|
||||
while (loop) {
|
||||
int c = ReadChar ();
|
||||
switch (c) {
|
||||
case -1:
|
||||
case '\'':
|
||||
case '\"':
|
||||
if (quoteChar != c)
|
||||
goto default;
|
||||
loop = false;
|
||||
break;
|
||||
default:
|
||||
if (c < 0)
|
||||
throw new RelaxngException ("Unterminated quoted literal.");
|
||||
if (XmlChar.IsInvalid (c))
|
||||
throw new RelaxngException ("Invalid character in literal.");
|
||||
AppendNameChar (c, ref index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new string (nameBuffer, 0, index);
|
||||
}
|
||||
|
||||
private void AppendNameChar (int c, ref int index)
|
||||
{
|
||||
if (nameBuffer.Length == index) {
|
||||
char [] arr = new char [index * 2];
|
||||
Array.Copy (nameBuffer, arr, index);
|
||||
nameBuffer = arr;
|
||||
}
|
||||
nameBuffer [index++] = (char) c;
|
||||
}
|
||||
|
||||
private string ReadTripleQuoted (char quoteChar)
|
||||
{
|
||||
int index = 0;
|
||||
bool loop = true;
|
||||
@@ -273,32 +155,16 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
int c = ReadChar ();
|
||||
switch (c) {
|
||||
case -1:
|
||||
case '\'':
|
||||
case '\"':
|
||||
// 1
|
||||
if (quoteChar != c)
|
||||
goto default;
|
||||
// 2
|
||||
if ((c = PeekChar ()) != quoteChar) {
|
||||
AppendNameChar (quoteChar, ref index);
|
||||
goto default;
|
||||
}
|
||||
ReadChar ();
|
||||
// 3
|
||||
if ((c = PeekChar ()) == quoteChar) {
|
||||
ReadChar ();
|
||||
loop = false;
|
||||
break;
|
||||
}
|
||||
AppendNameChar (quoteChar, ref index);
|
||||
AppendNameChar (quoteChar, ref index);
|
||||
loop = false;
|
||||
break;
|
||||
default:
|
||||
if (c < 0)
|
||||
throw new RelaxngException ("Unterminated triple-quoted literal.");
|
||||
if (XmlChar.IsInvalid (c))
|
||||
throw new RelaxngException ("Invalid character in literal.");
|
||||
AppendNameChar (c, ref index);
|
||||
if (nameBuffer.Length == index) {
|
||||
char [] arr = new char [index * 2];
|
||||
Array.Copy (nameBuffer, arr, index);
|
||||
nameBuffer = arr;
|
||||
}
|
||||
nameBuffer [index++] = (char) c;
|
||||
break;
|
||||
}
|
||||
} while (loop);
|
||||
@@ -306,15 +172,12 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
return new string (nameBuffer, 0, index);
|
||||
}
|
||||
|
||||
private string ReadOneName ()
|
||||
private string ReadOneToken ()
|
||||
{
|
||||
int index = 0;
|
||||
bool loop = true;
|
||||
int c = PeekChar ();
|
||||
if (!XmlChar.IsFirstNameChar (c) || !XmlChar.IsNCNameChar (c))
|
||||
throw new RelaxngException (String.Format ("Invalid NCName start character: {0}", c));
|
||||
do {
|
||||
c = PeekChar ();
|
||||
int c = PeekChar ();
|
||||
switch (c) {
|
||||
case -1:
|
||||
case ' ':
|
||||
@@ -325,7 +188,12 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
loop = false;
|
||||
break;
|
||||
default:
|
||||
if (!XmlChar.IsNCNameChar (c)) {
|
||||
if (!IsTokenContinuable (c)) {
|
||||
if (c == ':') {
|
||||
if (prefixName != null)
|
||||
throw new RelaxngException ("Invalid colon was found.");
|
||||
prefixName = new string (nameBuffer, 0, index);
|
||||
}
|
||||
loop = false;
|
||||
break;
|
||||
}
|
||||
@@ -352,7 +220,35 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
return s;
|
||||
}
|
||||
|
||||
private int ParseToken (bool backslashed)
|
||||
private bool IsTokenContinuable (int c)
|
||||
{
|
||||
switch (c) {
|
||||
case '=':
|
||||
case ':':
|
||||
case ',':
|
||||
case '{':
|
||||
case '}':
|
||||
case '(':
|
||||
case ')':
|
||||
case '[':
|
||||
case ']':
|
||||
case '&':
|
||||
case '|':
|
||||
case '?':
|
||||
case '*':
|
||||
case '\\':
|
||||
case '+':
|
||||
case '-':
|
||||
case '>':
|
||||
case '#':
|
||||
case '\'':
|
||||
case '\"':
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private int ParseToken ()
|
||||
{
|
||||
SkipWhitespaces ();
|
||||
int c = ReadChar ();
|
||||
@@ -362,6 +258,19 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
return Token.EOF;
|
||||
case '=':
|
||||
return Token.Equal;
|
||||
case ':':
|
||||
// return CName
|
||||
if (prefixName == null)
|
||||
throw new RelaxngException ("Invalid character ':' was found.");
|
||||
if (PeekChar () == '*') {
|
||||
ReadChar ();
|
||||
tokenValue = prefixName;
|
||||
prefixName = null;
|
||||
return Token.NsName;
|
||||
}
|
||||
tokenValue = prefixName + ":" + ReadOneToken ();
|
||||
prefixName = null;
|
||||
return Token.CName;
|
||||
case '~':
|
||||
return Token.Tilde;
|
||||
case ',':
|
||||
@@ -394,9 +303,7 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
// See also ':' for NsName
|
||||
return Token.Asterisk;
|
||||
case '\\':
|
||||
if (backslashed)
|
||||
return Token.BackSlash;
|
||||
return ParseToken (true);
|
||||
return Token.BackSlash;
|
||||
case '+':
|
||||
return Token.Plus;
|
||||
case '-':
|
||||
@@ -413,41 +320,18 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
// if (ReadChar () != '#')
|
||||
// throw new RelaxngException ("Invalid character after '#'.");
|
||||
tokenValue = ReadLine ();
|
||||
// return Token.Documentation;
|
||||
return ParseToken (false);
|
||||
return Token.Documentation;
|
||||
case '\'':
|
||||
case '\"':
|
||||
if (PeekChar () != c)
|
||||
name = ReadQuoted ((char) c);
|
||||
else {
|
||||
ReadChar ();
|
||||
if (PeekChar () == c) {
|
||||
ReadChar ();
|
||||
name = ReadTripleQuoted ((char) c);
|
||||
} // else '' or ""
|
||||
name = String.Empty;
|
||||
}
|
||||
name = ReadQuoted ((char) c);
|
||||
tokenValue = name;
|
||||
return Token.LiteralSegment;
|
||||
default:
|
||||
if (!XmlChar.IsNCNameChar (c))
|
||||
throw new RelaxngException ("Invalid NCName character.");
|
||||
peekChar = c;
|
||||
name = ReadOneName ();
|
||||
if (PeekChar () == ':') {
|
||||
ReadChar ();
|
||||
if (PeekChar () == '*') {
|
||||
ReadChar ();
|
||||
tokenValue = name;
|
||||
return Token.NsName;
|
||||
}
|
||||
tokenValue = name + ":" + ReadOneName ();
|
||||
return Token.CName;
|
||||
|
||||
}
|
||||
name = ReadOneToken ();
|
||||
if (prefixName != null)
|
||||
return ParseToken ();
|
||||
tokenValue = name;
|
||||
if (backslashed)
|
||||
return Token.NCName;
|
||||
switch (name) {
|
||||
case "attribute":
|
||||
isElement = false;
|
||||
@@ -490,7 +374,7 @@ namespace Commons.Xml.Relaxng.Rnc
|
||||
case "token":
|
||||
return Token.KeywordToken;
|
||||
default:
|
||||
return Token.NCName;
|
||||
return Token.NCNameButKeyword;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,379 +0,0 @@
|
||||
// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
||||
//
|
||||
// System.Xml.XmlChar.cs
|
||||
//
|
||||
// Author:
|
||||
// Jason Diamond ([email protected])
|
||||
//
|
||||
// (C) 2001 Jason Diamond http://injektilo.org/
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
namespace System.Xml
|
||||
{
|
||||
// Now, "XmlChar" and "XmlConstructs" are made as equivalent, so
|
||||
// I dicided to rename XmlConstruts class as "XmlChar" and use it
|
||||
// for default build.
|
||||
// However, this class will be used for the future compact framework
|
||||
// (XmlConstruts class uses not a little memory).
|
||||
internal class XmlChar
|
||||
{
|
||||
public static readonly char [] WhitespaceChars = new char [] {' ', '\n', '\t', '\r'};
|
||||
|
||||
public static bool IsWhitespace (int ch)
|
||||
{
|
||||
return ch == 0x20 || ch == 0x9 || ch == 0xD || ch == 0xA;
|
||||
}
|
||||
|
||||
public static bool IsWhitespace (string str)
|
||||
{
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
if (!IsWhitespace (str [i])) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsFirstNameChar (int ch)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (ch >= 0 && ch <= 0xFFFF)
|
||||
{
|
||||
result = (nameBitmap[(firstNamePages[ch >> 8] << 3) + ((ch & 0xFF) >> 5)] & (1 << (ch & 0x1F))) != 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool IsValid (int ch)
|
||||
{
|
||||
return !IsInvalid (ch);
|
||||
}
|
||||
|
||||
public static bool IsInvalid (int ch)
|
||||
{
|
||||
switch (ch) {
|
||||
case 9:
|
||||
case 10:
|
||||
case 13:
|
||||
return false;
|
||||
}
|
||||
if (ch < 32)
|
||||
return true;
|
||||
if (ch < 0xD800)
|
||||
return false;
|
||||
if (ch < 0xE000)
|
||||
return true;
|
||||
if (ch < 0xFFFE)
|
||||
return false;
|
||||
if (ch < 0x10000)
|
||||
return true;
|
||||
if (ch < 0x110000)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsNameChar (int ch)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (ch >= 0 && ch <= 0xFFFF)
|
||||
{
|
||||
result = (nameBitmap[(namePages[ch >> 8] << 3) + ((ch & 0xFF) >> 5)] & (1 << (ch & 0x1F))) != 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool IsNCNameChar (int ch)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (ch >= 0 && ch <= 0xFFFF && ch != ':')
|
||||
{
|
||||
result = (nameBitmap[(namePages[ch >> 8] << 3) + ((ch & 0xFF) >> 5)] & (1 << (ch & 0x1F))) != 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool IsName (string str)
|
||||
{
|
||||
if (str.Length == 0)
|
||||
return false;
|
||||
if (!IsFirstNameChar (str [0]))
|
||||
return false;
|
||||
for (int i = 1; i < str.Length; i++)
|
||||
if (!IsNameChar (str [i]))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsNCName (string str)
|
||||
{
|
||||
if (str.Length == 0)
|
||||
return false;
|
||||
if (!IsFirstNameChar (str [0]))
|
||||
return false;
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
if (!IsNCNameChar (str [i]))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsNmToken (string str)
|
||||
{
|
||||
if (str.Length == 0)
|
||||
return false;
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
if (!IsNameChar (str [i]))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsPubidChar (int ch)
|
||||
{
|
||||
return (IsWhitespace(ch) && ch != '\t') | ('a' <= ch && ch <= 'z') | ('A' <= ch && ch <= 'Z') | ('0' <= ch && ch <= '9') | "-'()+,./:=?;!*#@$_%".IndexOf((char)ch) >= 0;
|
||||
}
|
||||
|
||||
public static bool IsPubid (string str)
|
||||
{
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
if (!IsPubidChar (str [i]))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// encodings (copied from XmlConstructs.cs)
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the encoding name is a valid IANA encoding.
|
||||
/// This method does not verify that there is a decoder available
|
||||
/// for this encoding, only that the characters are valid for an
|
||||
/// IANA encoding name.
|
||||
/// </summary>
|
||||
/// <param name="ianaEncoding">The encoding to check.</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsValidIANAEncoding (String ianaEncoding)
|
||||
{
|
||||
if (ianaEncoding != null)
|
||||
{
|
||||
int length = ianaEncoding.Length;
|
||||
if (length > 0)
|
||||
{
|
||||
char c = ianaEncoding[0];
|
||||
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))
|
||||
{
|
||||
for (int i = 1; i < length; i++)
|
||||
{
|
||||
c = ianaEncoding[i];
|
||||
if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') &&
|
||||
(c < '0' || c > '9') && c != '.' && c != '_' &&
|
||||
c != '-')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int GetPredefinedEntity (string name)
|
||||
{
|
||||
switch (name) {
|
||||
case "amp":
|
||||
return '&';
|
||||
case "lt":
|
||||
return '<';
|
||||
case "gt":
|
||||
return '>';
|
||||
case "quot":
|
||||
return '"';
|
||||
case "apos":
|
||||
return '\'';
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static readonly byte [] firstNamePages =
|
||||
{
|
||||
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,
|
||||
0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
|
||||
0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
static readonly byte [] namePages =
|
||||
{
|
||||
0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00,
|
||||
0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
|
||||
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
|
||||
0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
static readonly uint [] nameBitmap =
|
||||
{
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,
|
||||
0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
|
||||
0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF,
|
||||
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
|
||||
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
|
||||
0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
|
||||
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
|
||||
0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF,
|
||||
0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,
|
||||
0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
|
||||
0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,
|
||||
0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,
|
||||
0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
|
||||
0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,
|
||||
0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,
|
||||
0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
|
||||
0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,
|
||||
0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,
|
||||
0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,
|
||||
0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
|
||||
0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,
|
||||
0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB,
|
||||
0x40000000, 0xF580C900, 0x00000007, 0x02010800,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,
|
||||
0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
|
||||
0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
|
||||
0x00000000, 0x00004C40, 0x00000000, 0x00000000,
|
||||
0x00000007, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,
|
||||
0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,
|
||||
0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
|
||||
0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF,
|
||||
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,
|
||||
0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
|
||||
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
|
||||
0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
|
||||
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
|
||||
0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
|
||||
0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
|
||||
0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
|
||||
0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
|
||||
0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
|
||||
0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
|
||||
0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
|
||||
0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
|
||||
0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
|
||||
0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
|
||||
0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
|
||||
0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
|
||||
0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,
|
||||
0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
|
||||
0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
|
||||
0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
|
||||
0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@ Commons.Xml.Relaxng.Derivative/Util.cs
|
||||
Commons.Xml.Relaxng.Inference/RelaxngInference.cs
|
||||
Commons.Xml.Relaxng.Rnc/RncTokenizer.cs
|
||||
Commons.Xml.Relaxng.Rnc/RncWriter.cs
|
||||
Commons.Xml.Relaxng.Rnc/XmlChar.cs
|
||||
Commons.Xml.Nvdl/NvdlBuiltInValidationProvider.cs
|
||||
Commons.Xml.Nvdl/NvdlCompileContext.cs
|
||||
Commons.Xml.Nvdl/NvdlConfig.cs
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
2005-04-06 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RelaxngPattern.cs : fixed incorrect use of virtual.
|
||||
|
||||
2005-03-18 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* XsdDatatypeProvider.cs : quick hack to workaround not to be rejected
|
||||
under MS.NET because of NOTATION type (thus, NOTATION type is not
|
||||
available in this provider).
|
||||
|
||||
2005-03-01 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RelaxngReader.cs : there was two public namespace constant. One
|
||||
|
||||
@@ -1074,7 +1074,7 @@ namespace Commons.Xml.Relaxng
|
||||
TargetGrammar.MarkReacheableDefine (this.name);
|
||||
}
|
||||
|
||||
internal override RdpPattern ReduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
|
||||
internal virtual RdpPattern ReduceEmptyAndNotAllowed (ref bool result, Hashtable visited)
|
||||
{
|
||||
referencedPattern =
|
||||
referencedPattern.ReduceEmptyAndNotAllowed (
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Commons.Xml.Relaxng.XmlSchema
|
||||
"NMTOKEN", "NMTOKENS",
|
||||
"Name", "NCName",
|
||||
"ID", "IDREF", "IDREFS",
|
||||
"ENTITY", "ENTITIES", //"NOTATION",
|
||||
"ENTITY", "ENTITIES", "NOTATION",
|
||||
"decimal",
|
||||
"integer", "long", "int", "short", "byte",
|
||||
"nonPositiveInteger", "negativeInteger",
|
||||
|
||||
@@ -9,7 +9,7 @@ OTHER_RES = $(RESOURCE_FILES)
|
||||
LIBRARY = Commons.Xml.Relaxng.dll
|
||||
LIB_MCS_FLAGS = /r:$(corlib) /r:System.dll /r:System.Xml.dll \
|
||||
$(foreach r, $(OTHER_RES), /resource:$(r),$(notdir $(r)))
|
||||
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169
|
||||
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
|
||||
EXTRA_DISTFILES = \
|
||||
Commons.Xml.Relaxng.Rnc/RncParser.jay \
|
||||
Test/ChangeLog \
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
2005-04-11 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* anglia-test-runner.cs : added some options.
|
||||
* Makefile : clean is inconsistent.
|
||||
|
||||
2004-06-17 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* relaxngtest.cs : Now we can test all cases (though resulting in
|
||||
|
||||
@@ -34,12 +34,11 @@ relax-ng:
|
||||
mkdir relax-ng
|
||||
|
||||
test : relaxngtest.exe
|
||||
$(RUNTIME) $(RUNTIME_FLAGS) relaxngtest.exe
|
||||
$(RUNTIME) relaxngtest.exe
|
||||
|
||||
anglia-test : anglia-test-runner.exe
|
||||
$(RUNTIME) $(RUNTIME_FLAGS) anglia-test-runner.exe
|
||||
$(RUNTIME) anglia-test-runner.exe
|
||||
|
||||
# be careful to use it. This removes ALL files in xml-test-suite!
|
||||
clean :
|
||||
# clean:
|
||||
# rm -rf xml-test-suite
|
||||
rm relaxngtest.exe anglia-test-runner.exe
|
||||
@@ -6,25 +6,8 @@ using Commons.Xml.Relaxng.Rnc;
|
||||
|
||||
public class Driver
|
||||
{
|
||||
public static void Main (string [] args)
|
||||
public static void Main ()
|
||||
{
|
||||
bool outAll = false;
|
||||
bool details = false;
|
||||
bool stopOnError = false;
|
||||
string filter = null;
|
||||
foreach (string arg in args) {
|
||||
switch (arg) {
|
||||
case "--outall":
|
||||
outAll = true; break;
|
||||
case "--details":
|
||||
details = true; break;
|
||||
case "--stoponerror":
|
||||
stopOnError = true; break;
|
||||
default:
|
||||
filter = arg; break;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.Load ("test/RNCTest.xml");
|
||||
@@ -32,10 +15,6 @@ public class Driver
|
||||
int failure = 0;
|
||||
foreach (XmlElement el in doc.SelectNodes ("/RNCTestCases/TestCase")) {
|
||||
string id = el.GetAttribute ("id");
|
||||
if (filter != null && id.IndexOf (filter) < 0)
|
||||
continue;
|
||||
if (outAll)
|
||||
Console.WriteLine ("testing " + id);
|
||||
bool isValid = el.GetAttribute ("legal") == "true";
|
||||
RncParser p = new RncParser (new NameTable ());
|
||||
try {
|
||||
@@ -50,10 +29,8 @@ public class Driver
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
if (isValid) {
|
||||
if (stopOnError)
|
||||
throw;
|
||||
failure++;
|
||||
Console.Error.WriteLine ("INCORRECTLY INVALID " + id + " --> " + (details ? ex.ToString () : ex.Message));
|
||||
Console.Error.WriteLine ("INCORRECTLY INVALID " + id + " --> " + ex.Message);
|
||||
} else {
|
||||
success++;
|
||||
// Console.Error.WriteLine ("invalid " + id);
|
||||
|
||||
@@ -4,7 +4,6 @@ include ../../build/rules.make
|
||||
|
||||
LIBRARY = Cscompmgd.dll
|
||||
LIB_MCS_FLAGS = /r:$(corlib) /r:System.dll
|
||||
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169
|
||||
LIBRARY_NAME = cscompmgd.dll
|
||||
|
||||
include ../../build/library.make
|
||||
@@ -1,8 +1,3 @@
|
||||
2005-04-20 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* Compiler.cs: redirect standard error. Patch by Toby Miller that fixes
|
||||
bug #74067.
|
||||
|
||||
2004-12-14 Jackson Harper <[email protected]>
|
||||
|
||||
* Compiler.cs: mcs writes to stderr now. Also read stdout so we do
|
||||
|
||||
@@ -100,7 +100,6 @@ namespace Microsoft.CSharp {
|
||||
mcs.StartInfo.CreateNoWindow = true;
|
||||
mcs.StartInfo.UseShellExecute = false;
|
||||
mcs.StartInfo.RedirectStandardOutput = true;
|
||||
mcs.StartInfo.RedirectStandardError = true;
|
||||
|
||||
try {
|
||||
mcs.Start ();
|
||||
|
||||
@@ -253,44 +253,32 @@ public class CP51932 : Encoding
|
||||
// Determine the total length of the converted string.
|
||||
int length = 0;
|
||||
int byteval;
|
||||
int last = 0;
|
||||
|
||||
while (count > 0) {
|
||||
byteval = bytes [index++];
|
||||
--count;
|
||||
++length;
|
||||
|
||||
if (last == 0) {
|
||||
if (byteval == 0x8F) {
|
||||
if (byteval != 0) {
|
||||
// Invalid second byte of a 3-byte character
|
||||
// FIXME: What should we do?
|
||||
last = 0;
|
||||
}
|
||||
// First byte in a triple-byte sequence
|
||||
else
|
||||
last = byteval;
|
||||
} else if (byteval <= 0x7F) {
|
||||
// Ordinary ASCII/Latin1/Control character.
|
||||
++length;
|
||||
} else if (byteval >= 0xA1 && byteval <= 0xFE) {
|
||||
// First byte in a double-byte sequence.
|
||||
last = byteval;
|
||||
} else if (byteval == 0x87) {
|
||||
// First byte in half-width katakana
|
||||
} else {
|
||||
// Invalid first byte. Let '?'
|
||||
++length;
|
||||
}
|
||||
} else if (last == 0x8F) {
|
||||
// 3-byte character
|
||||
// FIXME: currently not supported yet
|
||||
lastByte = 0;
|
||||
++length;
|
||||
} else {
|
||||
// Second byte in a double-byte sequence.
|
||||
lastByte = 0;
|
||||
++length;
|
||||
if (byteval < 0x80) {
|
||||
// Ordinary ASCII/Latin1 character, or the
|
||||
// single-byte Yen or overline signs.
|
||||
continue;
|
||||
}
|
||||
else if (byteval == 0xFF) {
|
||||
if (count >= 2) {
|
||||
count -= 2;
|
||||
++length;
|
||||
} else {
|
||||
count--;
|
||||
++length; // "??" for invalid 3-byte character
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(count == 0) {
|
||||
// Missing second byte.
|
||||
continue;
|
||||
}
|
||||
++index;
|
||||
--count;
|
||||
}
|
||||
|
||||
// Return the total length.
|
||||
@@ -355,9 +343,6 @@ public class CP51932 : Encoding
|
||||
} else if (byteval <= 0x7F) {
|
||||
// Ordinary ASCII/Latin1/Control character.
|
||||
chars [posn++] = (char) byteval;
|
||||
} else if (byteval == 0x8E) {
|
||||
// First byte of half-width Katakana
|
||||
last = byteval;
|
||||
} else if (byteval >= 0xA1 && byteval <= 0xFE) {
|
||||
// First byte in a double-byte sequence.
|
||||
last = byteval;
|
||||
@@ -366,17 +351,6 @@ public class CP51932 : Encoding
|
||||
chars [posn++] = '?';
|
||||
}
|
||||
}
|
||||
else if (last == 0x8E) {
|
||||
if (byteval >= 0xA1 && byteval <= 0xDF) {
|
||||
value = ((byteval - 0x40) |
|
||||
(last + 0x71) << 8);
|
||||
chars [posn++] = (char) value;
|
||||
} else {
|
||||
// Invalid second byte.
|
||||
chars [posn++] = '?';
|
||||
}
|
||||
last =0;
|
||||
}
|
||||
else if (last == 0x8F) {
|
||||
// 3-byte character
|
||||
// FIXME: currently not supported yet
|
||||
|
||||
@@ -286,13 +286,13 @@ public unsafe class CP932 : Encoding
|
||||
value = ((int)(cjkToJis[value])) |
|
||||
(((int)(cjkToJis[value + 1])) << 8);
|
||||
}
|
||||
else if(ch >= 0xFF01 && ch <= 0xFF60)
|
||||
else if(ch >= 0xFF01 && ch <= 0xFFEF)
|
||||
{
|
||||
value = ch - 0xFF00 + 0x20;
|
||||
}
|
||||
else if(ch >= 0xFF60 && ch <= 0xFFA0)
|
||||
{
|
||||
value = ch - 0xFF60 + 0xA0;
|
||||
// This range contains extra characters,
|
||||
// including half-width katakana.
|
||||
value = (ch - 0xFF01) * 2;
|
||||
value = ((int)(extraToJis[value])) |
|
||||
(((int)(extraToJis[value + 1])) << 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@ SUBDIRS =
|
||||
include ../../../build/rules.make
|
||||
|
||||
LIBRARY = I18N.CJK.dll
|
||||
LIBRARY_USE_INTERMEDIATE_FILE = yes
|
||||
LOCAL_MCS_FLAGS = /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /r:$(corlib) /r:I18N.dll
|
||||
NO_TEST = yes
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ SUBDIRS =
|
||||
include ../../../build/rules.make
|
||||
|
||||
LIBRARY = I18N.dll
|
||||
LIBRARY_USE_INTERMEDIATE_FILE = yes
|
||||
LOCAL_MCS_FLAGS = /r:$(corlib)
|
||||
NO_TEST = yes
|
||||
|
||||
|
||||
@@ -39,24 +39,17 @@ public sealed class Strings
|
||||
|
||||
// Helper for obtaining string resources for this assembly.
|
||||
public static String GetString(String tag)
|
||||
{
|
||||
switch (tag) {
|
||||
case "ArgRange_Array":
|
||||
return "Argument index is out of array range.";
|
||||
case "Arg_InsufficientSpace":
|
||||
return "Insufficient space in the argument array.";
|
||||
case "ArgRange_NonNegative":
|
||||
return "Non-negative value is expected.";
|
||||
case "NotSupp_MissingCodeTable":
|
||||
return "This encoding is not supported. Code table is missing.";
|
||||
case "ArgRange_StringIndex":
|
||||
return "String index is out of range.";
|
||||
case "ArgRange_StringRange":
|
||||
return "String length is out of range.";
|
||||
default:
|
||||
throw new ArgumentException (String.Format ("Unexpected error tag name: {0}", tag));
|
||||
}
|
||||
}
|
||||
{
|
||||
lock(typeof(Strings))
|
||||
{
|
||||
if(resources == null)
|
||||
{
|
||||
resources = new ResourceManager
|
||||
("I18N", Assembly.GetExecutingAssembly());
|
||||
}
|
||||
return resources.GetString(tag, null);
|
||||
}
|
||||
}
|
||||
|
||||
}; // class Strings
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ SUBDIRS =
|
||||
include ../../../build/rules.make
|
||||
|
||||
LIBRARY = I18N.MidEast.dll
|
||||
LIBRARY_USE_INTERMEDIATE_FILE = yes
|
||||
LOCAL_MCS_FLAGS = /r:$(corlib) /r:I18N.dll
|
||||
NO_TEST = yes
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ SUBDIRS =
|
||||
include ../../../build/rules.make
|
||||
|
||||
LIBRARY = I18N.Other.dll
|
||||
LIBRARY_USE_INTERMEDIATE_FILE = yes
|
||||
LOCAL_MCS_FLAGS = /r:$(corlib) /r:I18N.dll
|
||||
NO_TEST = yes
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ SUBDIRS =
|
||||
include ../../../build/rules.make
|
||||
|
||||
LIBRARY = I18N.Rare.dll
|
||||
LIBRARY_USE_INTERMEDIATE_FILE = yes
|
||||
LOCAL_MCS_FLAGS = /r:$(corlib) /r:I18N.dll
|
||||
NO_TEST = yes
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ SUBDIRS =
|
||||
include ../../../build/rules.make
|
||||
|
||||
LIBRARY = I18N.West.dll
|
||||
LIBRARY_USE_INTERMEDIATE_FILE = yes
|
||||
LOCAL_MCS_FLAGS = /r:$(corlib) /r:I18N.dll
|
||||
NO_TEST = yes
|
||||
|
||||
|
||||
+1
-4
@@ -16,7 +16,7 @@ bootstrap_dirs := \
|
||||
# We may have to add those if 'mcs' starts using them.
|
||||
basic_SUBDIRS := corlib System System.XML System
|
||||
|
||||
net_1_1_bootstrap_SUBDIRS := $(bootstrap_dirs) PEAPI
|
||||
net_1_1_bootstrap_SUBDIRS := $(bootstrap_dirs)
|
||||
net_2_0_bootstrap_SUBDIRS := $(bootstrap_dirs)
|
||||
|
||||
include ../build/rules.make
|
||||
@@ -116,9 +116,6 @@ lib/monolite:
|
||||
$(monolite_files): lib/monolite/%: lib/basic/% lib/monolite
|
||||
cp -p $< $@
|
||||
|
||||
$(basic_files:%=lib/basic/%):
|
||||
cd $(topdir) && $(MAKE) profile-do--basic--all
|
||||
|
||||
dist-default: $(monolite_files)
|
||||
dist-local: dist-default
|
||||
-$(MKINSTALLDIRS) $(DIST_PROFILE_DIRS:%=$(distdir)/lib/%)
|
||||
@@ -1,32 +1,3 @@
|
||||
2005-05-02 Ritvik Mayank <[email protected]>
|
||||
|
||||
* System.Windows.Forms_test.dll.sources : Added ControlTest.cs for Label Test
|
||||
|
||||
2005-04-26 Ritvik Mayank <[email protected]>
|
||||
|
||||
* System.Windows.Forms_test.dll.sources : Added LabelPropertyTest.cs for Label Test
|
||||
|
||||
2005-04-25 Jackson Harper <[email protected]>
|
||||
|
||||
* System.Windows.Forms.dll.sources: Add CursorConvert.cs to the
|
||||
build
|
||||
|
||||
2005-04-09 Peter Bartok <[email protected]>
|
||||
|
||||
* System.Windows.Forms.dll.sources: Added FolderBrowserDialog.cs
|
||||
|
||||
2005-03-11 Peter Bartok <[email protected]>
|
||||
|
||||
* System.Windows.Forms.dll.sources: Added MdiClient.cs
|
||||
|
||||
2005-03-10 Peter Bartok <[email protected]>
|
||||
|
||||
* System.Windows.Forms.dll.sources: Added SaveFileDialog.cs
|
||||
|
||||
2005-03-09 Peter Bartok <[email protected]>
|
||||
|
||||
* System.Windows.Forms.dll.sources: Added MdiClient.cs
|
||||
|
||||
2005-02-24 Peter Bartok <[email protected]>
|
||||
|
||||
* System.Windows.Forms.dll.sources: Removed HandleData.cs
|
||||
|
||||
@@ -5,7 +5,7 @@ LIBRARY = System.Windows.Forms.dll
|
||||
LIB_MCS_FLAGS = /unsafe \
|
||||
/r:$(corlib) /r:System.dll /r:System.Xml.dll \
|
||||
/r:System.Drawing.dll /r:Accessibility.dll \
|
||||
/r:System.Data.dll /r:Mono.Posix.dll \
|
||||
/r:Mono.Posix.dll \
|
||||
@System.Windows.Forms.dll.resources \
|
||||
/nowarn:649 /nowarn:169 /nowarn:67 /nowarn:108 /nowarn:114
|
||||
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
2005-04-14 Jackson Harper <[email protected]>
|
||||
|
||||
* ResXResourceReader.cs: Use serialization on values that have a
|
||||
mime type set but no type.
|
||||
|
||||
2005-02-16 Peter Bartok <[email protected]>
|
||||
|
||||
* ResXResourceReader.cs, ResXResourceWriter.cs: Removed sealed
|
||||
|
||||
@@ -33,7 +33,6 @@ using System.IO;
|
||||
using System.Xml;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
|
||||
namespace System.Resources
|
||||
{
|
||||
@@ -173,13 +172,7 @@ namespace System.Resources
|
||||
} else if (tt != null) {
|
||||
TypeConverter c = TypeDescriptor.GetConverter (tt);
|
||||
v = c.ConvertFromString (val);
|
||||
} else if (mt != null) {
|
||||
byte [] data = Convert.FromBase64String (val);
|
||||
BinaryFormatter f = new BinaryFormatter ();
|
||||
using (MemoryStream s = new MemoryStream (data)) {
|
||||
v = f.Deserialize (s);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
v = val;
|
||||
}
|
||||
hasht [n] = v;
|
||||
|
||||
@@ -42,7 +42,6 @@ System.Windows.Forms/ButtonBase.cs
|
||||
System.Windows.Forms/ButtonBorderStyle.cs
|
||||
System.Windows.Forms/ButtonState.cs
|
||||
System.Windows.Forms/CaptionButton.cs
|
||||
System.Windows.Forms/CategoryGridEntry.cs
|
||||
System.Windows.Forms/CharacterCasing.cs
|
||||
System.Windows.Forms/CheckBox.cs
|
||||
System.Windows.Forms/CheckedListBox.cs
|
||||
@@ -72,17 +71,11 @@ System.Windows.Forms/ConvertEventHandler.cs
|
||||
System.Windows.Forms/CreateParams.cs
|
||||
System.Windows.Forms/CurrencyManager.cs
|
||||
System.Windows.Forms/Cursor.cs
|
||||
System.Windows.Forms/CursorConverter.cs
|
||||
System.Windows.Forms/Cursors.cs
|
||||
System.Windows.Forms/DataGrid.cs
|
||||
System.Windows.Forms/DataGridBoolColumn.cs
|
||||
System.Windows.Forms/DataGridCell.cs
|
||||
System.Windows.Forms/DataGridColumnStyle.cs
|
||||
System.Windows.Forms/DataGridLineStyle.cs
|
||||
System.Windows.Forms/DataGridParentRowsLabelStyle.cs
|
||||
System.Windows.Forms/DataGridTableStyle.cs
|
||||
System.Windows.Forms/DataGridTextBox.cs
|
||||
System.Windows.Forms/DataGridTextBoxColumn.cs
|
||||
System.Windows.Forms/DateBoldEventArgs.cs
|
||||
System.Windows.Forms/DateBoldEventHandler.cs
|
||||
System.Windows.Forms/DateRangeEventArgs.cs
|
||||
@@ -107,7 +100,6 @@ System.Windows.Forms/FeatureSupport.cs
|
||||
System.Windows.Forms/FlatStyle.cs
|
||||
System.Windows.Forms/FontDialog.cs
|
||||
System.Windows.Forms/FileDialog.cs
|
||||
System.Windows.Forms/FolderBrowserDialog.cs
|
||||
System.Windows.Forms/Form.cs
|
||||
System.Windows.Forms/FormBorderStyle.cs
|
||||
System.Windows.Forms/FormStartPosition.cs
|
||||
@@ -116,7 +108,6 @@ System.Windows.Forms/FrameStyle.cs
|
||||
System.Windows.Forms/GiveFeedbackEventArgs.cs
|
||||
System.Windows.Forms/GiveFeedbackEventHandler.cs
|
||||
System.Windows.Forms/GridColumnStylesCollection.cs
|
||||
System.Windows.Forms/GridTablesFactory.cs
|
||||
System.Windows.Forms/GridTableStylesCollection.cs
|
||||
System.Windows.Forms/GridEntry.cs
|
||||
System.Windows.Forms/GridItem.cs
|
||||
@@ -188,7 +179,6 @@ System.Windows.Forms/ListViewAlignment.cs
|
||||
System.Windows.Forms/ListViewItem.cs
|
||||
System.Windows.Forms/ListViewItemConverter.cs
|
||||
System.Windows.Forms/MainMenu.cs
|
||||
System.Windows.Forms/MdiClient.cs
|
||||
System.Windows.Forms/MdiLayout.cs
|
||||
System.Windows.Forms/MeasureItemEventHandler.cs
|
||||
System.Windows.Forms/MeasureItemEventArgs.cs
|
||||
@@ -229,8 +219,6 @@ System.Windows.Forms/PictureBox.cs
|
||||
System.Windows.Forms/PictureBoxSizeMode.cs
|
||||
System.Windows.Forms/ProgressBar.cs
|
||||
System.Windows.Forms/PropertyGrid.cs
|
||||
System.Windows.Forms/PropertyGridEntry.cs
|
||||
System.Windows.Forms/PropertyGridTextBox.cs
|
||||
System.Windows.Forms/PropertyGridView.cs
|
||||
System.Windows.Forms/PropertyManager.cs
|
||||
System.Windows.Forms/PropertySort.cs
|
||||
@@ -244,7 +232,6 @@ System.Windows.Forms/QueryContinueDragEventArgs.cs
|
||||
System.Windows.Forms/QueryContinueDragEventHandler.cs
|
||||
System.Windows.Forms/RadioButton.cs
|
||||
System.Windows.Forms/RightToLeft.cs
|
||||
System.Windows.Forms/SaveFileDialog.cs
|
||||
System.Windows.Forms/ScrollableControl.cs
|
||||
System.Windows.Forms/ScrollBar.cs
|
||||
System.Windows.Forms/ScrollBars.cs
|
||||
|
||||
@@ -146,13 +146,21 @@ namespace System.Windows.Forms {
|
||||
|
||||
public static string CompanyName {
|
||||
get {
|
||||
AssemblyCompanyAttribute[] attrs = (AssemblyCompanyAttribute[]) Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), true);
|
||||
|
||||
if ((attrs != null) && attrs.Length>0) {
|
||||
return attrs[0].Company;
|
||||
StackTrace st;
|
||||
|
||||
if (Environment.OSVersion.Platform != (PlatformID)128) {
|
||||
RegistryKey key;
|
||||
String ret;
|
||||
|
||||
key=Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion", false);
|
||||
ret=(String)key.GetValue("RegisteredOrganization");
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
return Assembly.GetEntryAssembly().GetName().Name;
|
||||
st=new StackTrace();
|
||||
return st.GetFrame(st.FrameCount-1).GetMethod().DeclaringType.Namespace;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +193,7 @@ namespace System.Windows.Forms {
|
||||
|
||||
public static string LocalUserAppDataPath {
|
||||
get {
|
||||
return Path.Combine(Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), CompanyName), ProductName), ProductVersion);
|
||||
return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +246,7 @@ namespace System.Windows.Forms {
|
||||
|
||||
public static string UserAppDataPath {
|
||||
get {
|
||||
return Path.Combine(Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), CompanyName), ProductName), ProductVersion);
|
||||
return Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,12 +274,6 @@ namespace System.Windows.Forms {
|
||||
XplatUI.EnableThemes();
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public static void EnableRTLMirroring ()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
public static void Exit() {
|
||||
XplatUI.Exit();
|
||||
}
|
||||
|
||||
@@ -85,13 +85,10 @@ namespace System.Windows.Forms {
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public bool IsBinding {
|
||||
get {
|
||||
if (control == null || !control.Created)
|
||||
return false;
|
||||
if (manager == null || manager.IsSuspended)
|
||||
return false;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,14 +165,9 @@ namespace System.Windows.Forms {
|
||||
}
|
||||
}
|
||||
|
||||
if (data_member != null) {
|
||||
PropertyDescriptor pd = TypeDescriptor.GetProperties (manager.Current).Find (data_member, true);
|
||||
object pulled = pd.GetValue (manager.Current);
|
||||
data = ParseData (pulled, pd.PropertyType);
|
||||
} else {
|
||||
object pulled = manager.Current;
|
||||
data = ParseData (pulled, pulled.GetType ());
|
||||
}
|
||||
PropertyDescriptor pd = TypeDescriptor.GetProperties (manager.Current).Find (data_member, true);
|
||||
object pulled = pd.GetValue (manager.Current);
|
||||
data = ParseData (pulled, pd.PropertyType);
|
||||
|
||||
data = FormatData (data);
|
||||
SetControlValue (data);
|
||||
@@ -233,7 +225,7 @@ namespace System.Windows.Forms {
|
||||
ConvertEventArgs e = new ConvertEventArgs (data, data_type);
|
||||
|
||||
OnParse (e);
|
||||
if (data_type.IsAssignableFrom (e.Value.GetType ()))
|
||||
if (e.Value.GetType ().IsAssignableFrom (data_type))
|
||||
return e.Value;
|
||||
if (e.Value == Convert.DBNull)
|
||||
return e.Value;
|
||||
@@ -249,7 +241,7 @@ namespace System.Windows.Forms {
|
||||
ConvertEventArgs e = new ConvertEventArgs (data, data_type);
|
||||
|
||||
OnFormat (e);
|
||||
if (data_type.IsAssignableFrom (e.Value.GetType ()))
|
||||
if (e.Value.GetType ().IsAssignableFrom (data_type))
|
||||
return e.Value;
|
||||
|
||||
return ConvertData (data, data_type);
|
||||
@@ -263,7 +255,7 @@ namespace System.Windows.Forms {
|
||||
|
||||
if (data is IConvertible) {
|
||||
object res = Convert.ChangeType (data, data_type);
|
||||
if (data_type.IsAssignableFrom (res.GetType ()))
|
||||
if (res.GetType ().IsAssignableFrom (data_type))
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace System.Windows.Forms {
|
||||
private class ManagerEntry {
|
||||
|
||||
private object source;
|
||||
private WeakReference member_ref;
|
||||
|
||||
private string member;
|
||||
|
||||
private int member_hash;
|
||||
|
||||
public ManagerEntry (object source, string member)
|
||||
@@ -48,18 +48,19 @@ namespace System.Windows.Forms {
|
||||
this.source = source;
|
||||
if (member == null)
|
||||
member = String.Empty;
|
||||
this.member = member.ToLower (CultureInfo.InvariantCulture);
|
||||
|
||||
|
||||
member_hash = member.ToLower (CultureInfo.InvariantCulture).GetHashCode ();
|
||||
member_hash = this.member.GetHashCode ();
|
||||
if (member_hash == 0)
|
||||
member_hash = 1;
|
||||
member_ref = new WeakReference (member, false);
|
||||
}
|
||||
|
||||
public override bool Equals (object b)
|
||||
{
|
||||
ManagerEntry o = (ManagerEntry) b;
|
||||
|
||||
return (o.source == source && o.member_ref.Target == member_ref.Target);
|
||||
return (o.source == source && o.member_hash == member_hash);
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
@@ -69,7 +70,7 @@ namespace System.Windows.Forms {
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return source.ToString () + " + " + (member_ref.Target == null ? " -- null --" : member_ref.Target.ToString ());
|
||||
return source.ToString () + " + " + member.ToString ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,11 +94,11 @@ namespace System.Windows.Forms {
|
||||
public BindingManagerBase this [object data_source, string data_member] {
|
||||
get {
|
||||
ManagerEntry e = CreateEntry (data_source, data_member);
|
||||
WeakReference wref = managers [e] as WeakReference;
|
||||
BindingManagerBase res = managers [e] as BindingManagerBase;
|
||||
|
||||
if (wref != null && wref.Target != null)
|
||||
return wref.Target as BindingManagerBase;
|
||||
BindingManagerBase res = AddManager (data_source, data_member);
|
||||
if (res != null)
|
||||
return res;
|
||||
res = AddManager (data_source, data_member);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -105,7 +106,8 @@ namespace System.Windows.Forms {
|
||||
private BindingManagerBase AddManager (object data_source, string data_member)
|
||||
{
|
||||
BindingManagerBase res = CreateBindingManager (data_source, data_member);
|
||||
managers [CreateEntry (data_source, data_member)] = new WeakReference (res);
|
||||
managers.Add (CreateEntry (data_source, data_member), res);
|
||||
managers.Add (CreateEntry (data_source, String.Empty), res);
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -151,7 +153,7 @@ namespace System.Windows.Forms {
|
||||
throw new ArgumentNullException ("dataSource");
|
||||
if (listManager == null)
|
||||
throw new ArgumentNullException ("listManager");
|
||||
managers.Add (CreateEntry (dataSource, String.Empty), new WeakReference (listManager));
|
||||
managers.Add (CreateEntry (dataSource, String.Empty), listManager);
|
||||
}
|
||||
|
||||
protected internal void Clear ()
|
||||
|
||||
@@ -87,10 +87,6 @@ namespace System.Windows.Forms {
|
||||
public abstract void SuspendBinding();
|
||||
#endregion // Public Instance Methods
|
||||
|
||||
internal abstract bool IsSuspended {
|
||||
get;
|
||||
}
|
||||
|
||||
#region Protected Instance Methods
|
||||
[MonoTODO]
|
||||
protected internal virtual PropertyDescriptorCollection GetItemProperties(System.Collections.ArrayList dataSources, System.Collections.ArrayList listAccessors) {
|
||||
@@ -138,16 +134,16 @@ namespace System.Windows.Forms {
|
||||
Bindings.Add (binding);
|
||||
}
|
||||
|
||||
internal void UpdateBindings ()
|
||||
{
|
||||
// TODO: Maybe I should do foreach (binding) pull; push
|
||||
PullData ();
|
||||
PushData ();
|
||||
}
|
||||
|
||||
#region Events
|
||||
public event EventHandler CurrentChanged {
|
||||
add { onCurrentChangedHandler += value; }
|
||||
remove { onCurrentChangedHandler -= value; }
|
||||
}
|
||||
|
||||
public event EventHandler PositionChanged {
|
||||
add { onPositionChangedHandler += value; }
|
||||
remove { onPositionChangedHandler -= value; }
|
||||
}
|
||||
public event EventHandler CurrentChanged;
|
||||
public event EventHandler PositionChanged;
|
||||
#endregion // Events
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ namespace System.Windows.Forms {
|
||||
private bool is_default;
|
||||
internal bool is_pressed;
|
||||
internal bool enter_state;
|
||||
internal bool redraw;
|
||||
internal StringFormat text_format;
|
||||
#endregion // Local Variables
|
||||
|
||||
@@ -77,13 +78,17 @@ namespace System.Windows.Forms {
|
||||
|
||||
[MonoTODO("Make the FillRectangle use a global brush instead of creating one every time")]
|
||||
internal void Redraw() {
|
||||
redraw = true;
|
||||
Refresh ();
|
||||
}
|
||||
|
||||
// Derived classes should override Draw method and we dont want
|
||||
// to break the control signature, hence this approach.
|
||||
internal virtual void Draw (PaintEventArgs pevent) {
|
||||
ThemeEngine.Current.DrawButtonBase (pevent.Graphics, pevent.ClipRectangle, this);
|
||||
if (redraw) {
|
||||
ThemeEngine.Current.DrawButtonBase(this.DeviceContext, pevent.ClipRectangle, this);
|
||||
redraw = false;
|
||||
}
|
||||
}
|
||||
|
||||
internal virtual void HaveDoubleClick() {
|
||||
@@ -109,6 +114,7 @@ namespace System.Windows.Forms {
|
||||
is_entered = false;
|
||||
is_pressed = false;
|
||||
has_focus = false;
|
||||
redraw = true;
|
||||
text_format = new StringFormat();
|
||||
text_format.Alignment = StringAlignment.Center;
|
||||
text_format.LineAlignment = StringAlignment.Center;
|
||||
@@ -457,8 +463,9 @@ namespace System.Windows.Forms {
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pevent) {
|
||||
base.OnPaint (pevent);
|
||||
Draw (pevent);
|
||||
pevent.Graphics.DrawImage(this.ImageBuffer, pevent.ClipRectangle, pevent.ClipRectangle, GraphicsUnit.Pixel);
|
||||
base.OnPaint (pevent);
|
||||
}
|
||||
|
||||
protected override void OnParentChanged(EventArgs e) {
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace System.Windows.Forms.PropertyGridInternal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for CategoryGridEntry.
|
||||
/// </summary>
|
||||
internal class CategoryGridEntry : GridEntry
|
||||
{
|
||||
private string label;
|
||||
public CategoryGridEntry(string category)
|
||||
{
|
||||
label = category;
|
||||
}
|
||||
|
||||
public override GridItemType GridItemType {
|
||||
get {
|
||||
return GridItemType.Category;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override string Label {
|
||||
get {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -105,7 +105,10 @@ namespace System.Windows.Forms {
|
||||
|
||||
#region Internal Methods
|
||||
internal override void Draw (PaintEventArgs pe) {
|
||||
ThemeEngine.Current.DrawCheckBox (pe.Graphics, this.ClientRectangle, this);
|
||||
if (redraw) {
|
||||
ThemeEngine.Current.DrawCheckBox (this.DeviceContext, this.ClientRectangle, this);
|
||||
redraw = false;
|
||||
}
|
||||
}
|
||||
|
||||
internal override void HaveDoubleClick() {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
//
|
||||
//
|
||||
|
||||
// COMPLETE
|
||||
// NOT COMPLETE
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
@@ -107,14 +107,14 @@ namespace System.Windows.Forms
|
||||
[Browsable (false)]
|
||||
public new object DataSource {
|
||||
get { return base.DataSource; }
|
||||
set { base.DataSource = value; }
|
||||
set { DataSource = value; }
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Browsable (false)]
|
||||
public new string DisplayMember {
|
||||
get { return base.DisplayMember; }
|
||||
set { base.DisplayMember = value; }
|
||||
get { throw new NotImplementedException (); }
|
||||
set { throw new NotImplementedException (); }
|
||||
}
|
||||
|
||||
[Browsable (false)]
|
||||
@@ -175,7 +175,7 @@ namespace System.Windows.Forms
|
||||
|
||||
protected override AccessibleObject CreateAccessibilityInstance ()
|
||||
{
|
||||
return base.CreateAccessibilityInstance ();
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
protected override ListBox.ObjectCollection CreateItemCollection ()
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -61,7 +61,7 @@ namespace System.Windows.Forms
|
||||
private ComboListBox listbox_ctrl;
|
||||
private TextBox textbox_ctrl;
|
||||
private bool process_textchanged_event;
|
||||
private bool has_focus;
|
||||
private bool has_focus;
|
||||
|
||||
internal class ComboBoxInfo
|
||||
{
|
||||
@@ -71,7 +71,7 @@ namespace System.Windows.Forms
|
||||
internal Rectangle button_rect;
|
||||
internal bool show_button; /* Is the DropDown button shown? */
|
||||
internal ButtonState button_status; /* Drop button status */
|
||||
internal int original_height; /* Control's height is recalculated for not Simple Styles */
|
||||
internal Size listbox_size;
|
||||
internal Rectangle listbox_area; /* ListBox area in Simple combox, not used in the rest */
|
||||
internal bool droppeddown; /* Is the associated ListBox dropped down? */
|
||||
|
||||
@@ -81,7 +81,6 @@ namespace System.Windows.Forms
|
||||
show_button = false;
|
||||
item_height = 0;
|
||||
droppeddown = false;
|
||||
original_height = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,11 +231,7 @@ namespace System.Windows.Forms
|
||||
dropdown_style = value;
|
||||
|
||||
if (dropdown_style == ComboBoxStyle.Simple) {
|
||||
CBoxInfo.show_button = false;
|
||||
|
||||
if (combobox_info.original_height != -1)
|
||||
Height = combobox_info.original_height;
|
||||
|
||||
CBoxInfo.show_button = false;
|
||||
CreateComboListBox ();
|
||||
|
||||
if (IsHandleCreated == true) {
|
||||
@@ -251,7 +246,6 @@ namespace System.Windows.Forms
|
||||
if (dropdown_style != ComboBoxStyle.DropDownList && textbox_ctrl == null) {
|
||||
textbox_ctrl = new TextBox ();
|
||||
textbox_ctrl.TextChanged += new EventHandler (OnTextChangedEdit);
|
||||
textbox_ctrl.KeyPress += new KeyPressEventHandler(textbox_ctrl_KeyPress);
|
||||
|
||||
if (IsHandleCreated == true) {
|
||||
Controls.Add (textbox_ctrl);
|
||||
@@ -411,11 +405,10 @@ namespace System.Windows.Forms
|
||||
selected_index = value;
|
||||
|
||||
if (dropdown_style != ComboBoxStyle.DropDownList) {
|
||||
SetControlText (GetItemText (Items[selected_index]));
|
||||
SetControlText (Items[selected_index].ToString ());
|
||||
}
|
||||
|
||||
OnSelectedIndexChanged (new EventArgs ());
|
||||
OnSelectedValueChanged (new EventArgs ());
|
||||
Refresh ();
|
||||
}
|
||||
}
|
||||
@@ -442,7 +435,7 @@ namespace System.Windows.Forms
|
||||
selected_index = index;
|
||||
|
||||
if (dropdown_style != ComboBoxStyle.DropDownList) {
|
||||
SetControlText (GetItemText (Items[selected_index]));
|
||||
SetControlText (Items[selected_index].ToString ());
|
||||
}
|
||||
|
||||
OnSelectedItemChanged (new EventArgs ());
|
||||
@@ -457,13 +450,15 @@ namespace System.Windows.Forms
|
||||
if (dropdown_style == ComboBoxStyle.DropDownList)
|
||||
return "";
|
||||
|
||||
return textbox_ctrl.SelectedText;
|
||||
return textbox_ctrl.Text;
|
||||
}
|
||||
set {
|
||||
if (dropdown_style == ComboBoxStyle.DropDownList) {
|
||||
if (dropdown_style == ComboBoxStyle.DropDownList)
|
||||
return;
|
||||
}
|
||||
|
||||
if (textbox_ctrl.Text == value)
|
||||
return;
|
||||
|
||||
textbox_ctrl.SelectedText = value;
|
||||
}
|
||||
}
|
||||
@@ -523,16 +518,9 @@ namespace System.Windows.Forms
|
||||
[Bindable (true)]
|
||||
[Localizable (true)]
|
||||
public override string Text {
|
||||
get {
|
||||
if (dropdown_style != ComboBoxStyle.DropDownList) {
|
||||
if (textbox_ctrl != null) {
|
||||
return textbox_ctrl.Text;
|
||||
}
|
||||
}
|
||||
|
||||
if (SelectedItem != null) {
|
||||
return GetItemText (SelectedItem);
|
||||
}
|
||||
get {
|
||||
if (SelectedItem != null)
|
||||
return SelectedItem.ToString ();
|
||||
|
||||
return base.Text;
|
||||
}
|
||||
@@ -550,7 +538,7 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
if (dropdown_style != ComboBoxStyle.DropDownList) {
|
||||
textbox_ctrl.Text = GetItemText (value);
|
||||
textbox_ctrl.Text = value.ToString ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -608,7 +596,7 @@ namespace System.Windows.Forms
|
||||
public int FindString (string s, int startIndex)
|
||||
{
|
||||
for (int i = startIndex; i < Items.Count; i++) {
|
||||
if ((GetItemText (Items[i])).StartsWith (s))
|
||||
if ((Items[i].ToString ()).StartsWith (s))
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -623,7 +611,7 @@ namespace System.Windows.Forms
|
||||
public int FindStringExact (string s, int startIndex)
|
||||
{
|
||||
for (int i = startIndex; i < Items.Count; i++) {
|
||||
if ((GetItemText (Items[i])).Equals (s))
|
||||
if ((Items[i].ToString ()).Equals (s))
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -672,25 +660,11 @@ namespace System.Windows.Forms
|
||||
protected override void OnDataSourceChanged (EventArgs e)
|
||||
{
|
||||
base.OnDataSourceChanged (e);
|
||||
BindDataItems (items);
|
||||
|
||||
if (DataSource == null || DataManager == null) {
|
||||
SelectedIndex = -1;
|
||||
}
|
||||
else {
|
||||
SelectedIndex = DataManager.Position;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDisplayMemberChanged (EventArgs e)
|
||||
{
|
||||
base.OnDisplayMemberChanged (e);
|
||||
|
||||
if (DataManager == null || !IsHandleCreated)
|
||||
return;
|
||||
|
||||
BindDataItems (items);
|
||||
SelectedIndex = DataManager.Position;
|
||||
}
|
||||
|
||||
protected virtual void OnDrawItem (DrawItemEventArgs e)
|
||||
@@ -770,8 +744,7 @@ namespace System.Windows.Forms
|
||||
|
||||
protected override void OnResize (EventArgs e)
|
||||
{
|
||||
base.OnResize (e);
|
||||
AdjustHeightForDropDown ();
|
||||
base.OnResize (e);
|
||||
CalcTextArea ();
|
||||
}
|
||||
|
||||
@@ -884,26 +857,6 @@ namespace System.Windows.Forms
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void AdjustHeightForDropDown ()
|
||||
{
|
||||
if (dropdown_style == ComboBoxStyle.Simple)
|
||||
return;
|
||||
|
||||
int new_height = combobox_info.item_height + ThemeEngine.Current.DrawComboBoxEditDecorationTop () +
|
||||
ThemeEngine.Current.DrawComboBoxEditDecorationBottom () + 2;
|
||||
|
||||
if (Height == new_height)
|
||||
return;
|
||||
|
||||
combobox_info.original_height = Height;
|
||||
Height = new_height;
|
||||
}
|
||||
|
||||
private void textbox_ctrl_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
OnKeyPress (e);
|
||||
}
|
||||
|
||||
// Calcs the text area size
|
||||
internal void CalcTextArea ()
|
||||
{
|
||||
@@ -957,7 +910,7 @@ namespace System.Windows.Forms
|
||||
listbox_ctrl = new ComboListBox (this);
|
||||
}
|
||||
|
||||
internal void Draw (Rectangle clip, Graphics dc)
|
||||
internal void Draw (Rectangle clip)
|
||||
{
|
||||
// No edit control, we paint the edit ourselfs
|
||||
if (dropdown_style == ComboBoxStyle.DropDownList) {
|
||||
@@ -970,24 +923,24 @@ namespace System.Windows.Forms
|
||||
state |= DrawItemState.Focus;
|
||||
}
|
||||
|
||||
OnDrawItem (new DrawItemEventArgs (dc, Font, item_rect,
|
||||
OnDrawItem (new DrawItemEventArgs (DeviceContext, Font, item_rect,
|
||||
selected_index, state, ForeColor, BackColor));
|
||||
}
|
||||
|
||||
if (clip.IntersectsWith (combobox_info.listbox_area) == true) {
|
||||
dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (Parent.BackColor),
|
||||
DeviceContext.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (Parent.BackColor),
|
||||
combobox_info.listbox_area);
|
||||
}
|
||||
|
||||
if (CBoxInfo.show_button) {
|
||||
dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ThemeEngine.Current.ColorButtonFace),
|
||||
DeviceContext.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (ThemeEngine.Current.ColorButtonFace),
|
||||
combobox_info.button_rect);
|
||||
|
||||
ThemeEngine.Current.CPDrawComboButton (dc,
|
||||
ThemeEngine.Current.CPDrawComboButton (DeviceContext,
|
||||
combobox_info.button_rect, combobox_info.button_status);
|
||||
}
|
||||
|
||||
ThemeEngine.Current.DrawComboBoxEditDecorations (dc, this, combobox_info.textarea);
|
||||
ThemeEngine.Current.DrawComboBoxEditDecorations (DeviceContext, this, combobox_info.textarea);
|
||||
}
|
||||
|
||||
internal void DropDownListBox ()
|
||||
@@ -1027,7 +980,7 @@ namespace System.Windows.Forms
|
||||
{
|
||||
for (int i = 0; i < Items.Count; i++)
|
||||
{
|
||||
if (String.Compare (GetItemText (Items[i]), 0, search, 0, search.Length, true) == 0)
|
||||
if (String.Compare (Items[i].ToString (), 0, search, 0, search.Length, true) == 0)
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -1093,7 +1046,8 @@ namespace System.Windows.Forms
|
||||
return;
|
||||
|
||||
/* Copies memory drawing buffer to screen*/
|
||||
Draw (ClientRectangle, pevent.Graphics);
|
||||
Draw (ClientRectangle);
|
||||
pevent.Graphics.DrawImage (ImageBuffer, ClientRectangle, ClientRectangle, GraphicsUnit.Pixel);
|
||||
|
||||
if (Paint != null)
|
||||
Paint (this, pevent);
|
||||
@@ -1428,7 +1382,13 @@ namespace System.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
#region Private Methods
|
||||
#region Private Methods
|
||||
|
||||
protected override void CreateHandle ()
|
||||
{
|
||||
base.CreateHandle ();
|
||||
}
|
||||
|
||||
// Calcs the listbox area
|
||||
internal void CalcListBoxArea ()
|
||||
{
|
||||
@@ -1522,10 +1482,10 @@ namespace System.Windows.Forms
|
||||
page_size = textarea_drawable.Height / (item_height - 2);
|
||||
}
|
||||
|
||||
private void Draw (Rectangle clip, Graphics dc)
|
||||
private void Draw (Rectangle clip)
|
||||
{
|
||||
dc.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush
|
||||
(owner.BackColor), clip);
|
||||
DeviceContext.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush
|
||||
(owner.BackColor), ClientRectangle);
|
||||
|
||||
if (owner.Items.Count > 0) {
|
||||
Rectangle item_rect;
|
||||
@@ -1548,12 +1508,12 @@ namespace System.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
owner.OnDrawItem (new DrawItemEventArgs (dc, owner.Font, item_rect,
|
||||
owner.OnDrawItem (new DrawItemEventArgs (DeviceContext, owner.Font, item_rect,
|
||||
i, state, owner.ForeColor, owner.BackColor));
|
||||
}
|
||||
}
|
||||
|
||||
ThemeEngine.Current.DrawComboListBoxDecorations (dc, owner, ClientRectangle);
|
||||
ThemeEngine.Current.DrawComboListBoxDecorations (DeviceContext, owner, ClientRectangle);
|
||||
}
|
||||
|
||||
public int GetHighLightedIndex ()
|
||||
@@ -1699,7 +1659,7 @@ namespace System.Windows.Forms
|
||||
owner.OnSelectionChangeCommitted (new EventArgs ());
|
||||
|
||||
if (owner.DropDownStyle == ComboBoxStyle.Simple) {
|
||||
owner.SetControlText (owner.GetItemText (owner.Items[item]));
|
||||
owner.SetControlText (owner.Items[item].ToString ());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1860,7 +1820,11 @@ namespace System.Windows.Forms
|
||||
|
||||
private void OnPaintPUW (Object o, PaintEventArgs pevent)
|
||||
{
|
||||
Draw (pevent.ClipRectangle,pevent.Graphics);
|
||||
if (Width <= 0 || Height <= 0 || Visible == false)
|
||||
return;
|
||||
|
||||
Draw (pevent.ClipRectangle);
|
||||
pevent.Graphics.DrawImage (ImageBuffer, pevent.ClipRectangle, pevent.ClipRectangle, GraphicsUnit.Pixel);
|
||||
}
|
||||
|
||||
public bool ShowWindow ()
|
||||
@@ -1901,7 +1865,7 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ namespace System.Windows.Forms
|
||||
internal string name; // for object naming
|
||||
|
||||
// State
|
||||
private bool create_handled; // true if OnCreateControl has been sent
|
||||
internal bool has_focus; // true if control has focus
|
||||
internal bool is_visible; // true if control is visible
|
||||
internal bool is_entered; // is the mouse inside the control?
|
||||
@@ -107,11 +106,11 @@ namespace System.Windows.Forms
|
||||
internal BindingContext binding_context; // TODO
|
||||
internal RightToLeft right_to_left; // drawing direction for control
|
||||
internal int layout_suspended;
|
||||
internal bool double_buffering;
|
||||
internal ContextMenu context_menu; // Context menu associated with the control
|
||||
|
||||
private Graphics dc_mem; // Graphics context for double buffering
|
||||
private Bitmap bmp_mem; // Bitmap for double buffering control
|
||||
private bool needs_redraw = true;
|
||||
|
||||
private ControlBindingsCollection data_bindings;
|
||||
|
||||
@@ -528,7 +527,6 @@ namespace System.Windows.Forms
|
||||
prev_size = Size.Empty;
|
||||
anchor_style = AnchorStyles.Top | AnchorStyles.Left;
|
||||
|
||||
create_handled = false;
|
||||
is_visible = true;
|
||||
is_captured = false;
|
||||
is_disposed = false;
|
||||
@@ -539,6 +537,7 @@ namespace System.Windows.Forms
|
||||
causes_validation = true;
|
||||
has_focus = false;
|
||||
layout_suspended = 0;
|
||||
double_buffering = true;
|
||||
mouse_clicks = 1;
|
||||
tab_index = -1;
|
||||
cursor = null;
|
||||
@@ -644,7 +643,7 @@ namespace System.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private Bitmap ImageBuffer {
|
||||
internal Bitmap ImageBuffer {
|
||||
get {
|
||||
if (bmp_mem==null) {
|
||||
CreateBuffers(this.Width, this.Height);
|
||||
@@ -654,6 +653,9 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
internal void CreateBuffers (int width, int height) {
|
||||
if (double_buffering == false)
|
||||
return;
|
||||
|
||||
if (dc_mem != null) {
|
||||
dc_mem.Dispose ();
|
||||
}
|
||||
@@ -670,11 +672,13 @@ namespace System.Windows.Forms
|
||||
|
||||
bmp_mem = new Bitmap (width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
dc_mem = Graphics.FromImage (bmp_mem);
|
||||
needs_redraw = true;
|
||||
}
|
||||
|
||||
internal void InvalidateBuffers ()
|
||||
{
|
||||
if (double_buffering == false)
|
||||
return;
|
||||
|
||||
if (dc_mem != null) {
|
||||
dc_mem.Dispose ();
|
||||
}
|
||||
@@ -683,7 +687,6 @@ namespace System.Windows.Forms
|
||||
|
||||
dc_mem = null;
|
||||
bmp_mem = null;
|
||||
needs_redraw = true;
|
||||
}
|
||||
|
||||
internal static void SetChildColor(Control parent) {
|
||||
@@ -1010,9 +1013,7 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
set {
|
||||
#if later
|
||||
XplatUI.State.DropTarget=value;
|
||||
#endif
|
||||
XplatUI.State.DropTarget=value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1138,7 +1139,7 @@ namespace System.Windows.Forms
|
||||
|
||||
parent = this.parent;
|
||||
while (parent != null) {
|
||||
if (!parent.is_visible || !parent.is_enabled) {
|
||||
if (!parent.Visible || !parent.is_enabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1412,7 +1413,7 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
set {
|
||||
if (font != null && font.Equals (value)) {
|
||||
if (font == value) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2031,23 +2032,18 @@ namespace System.Windows.Forms
|
||||
|
||||
public void CreateControl() {
|
||||
|
||||
if (!IsHandleCreated) {
|
||||
if (!IsHandleCreated)
|
||||
CreateHandle();
|
||||
}
|
||||
|
||||
if (!create_handled) {
|
||||
create_handled = true;
|
||||
OnCreateControl();
|
||||
}
|
||||
|
||||
for (int i=0; i<child_controls.Count; i++) {
|
||||
child_controls[i].CreateControl();
|
||||
}
|
||||
OnCreateControl();
|
||||
}
|
||||
|
||||
public Graphics CreateGraphics() {
|
||||
if (!IsHandleCreated) {
|
||||
this.CreateControl();
|
||||
this.CreateHandle();
|
||||
}
|
||||
return Graphics.FromHwnd(this.window.Handle);
|
||||
}
|
||||
@@ -2078,9 +2074,9 @@ namespace System.Windows.Forms
|
||||
|
||||
public bool Focus() {
|
||||
if (IsHandleCreated && !has_focus) {
|
||||
has_focus = true;
|
||||
XplatUI.SetFocus(window.Handle);
|
||||
}
|
||||
has_focus = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2151,7 +2147,7 @@ namespace System.Windows.Forms
|
||||
|
||||
NotifyInvalidate(rc);
|
||||
|
||||
XplatUI.Invalidate(Handle, rc, false);
|
||||
XplatUI.Invalidate(Handle, rc, !GetStyle (ControlStyles.AllPaintingInWmPaint));
|
||||
|
||||
if (invalidateChildren) {
|
||||
for (int i=0; i<child_controls.Count; i++) child_controls[i].Invalidate();
|
||||
@@ -2510,7 +2506,7 @@ namespace System.Windows.Forms
|
||||
|
||||
public void Show() {
|
||||
if (!IsHandleCreated) {
|
||||
this.CreateControl();
|
||||
this.CreateHandle();
|
||||
}
|
||||
|
||||
this.Visible=true;
|
||||
@@ -2521,7 +2517,6 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
public void Update() {
|
||||
needs_redraw = true;
|
||||
XplatUI.UpdateWindow(window.Handle);
|
||||
}
|
||||
#endregion // Public Instance Methods
|
||||
@@ -2772,7 +2767,7 @@ namespace System.Windows.Forms
|
||||
((Control)child.Current).RecreateHandle();
|
||||
}
|
||||
} else {
|
||||
CreateControl();
|
||||
CreateHandle();
|
||||
}
|
||||
|
||||
is_recreating = false;
|
||||
@@ -2980,7 +2975,6 @@ namespace System.Windows.Forms
|
||||
} else {
|
||||
control_style &= ~flag;
|
||||
}
|
||||
OnStyleChanged(EventArgs.Empty);
|
||||
}
|
||||
|
||||
protected void SetTopLevel(bool value) {
|
||||
@@ -3025,8 +3019,6 @@ namespace System.Windows.Forms
|
||||
}
|
||||
} else {
|
||||
this.CreateBuffers(bounds.Width, bounds.Height);
|
||||
|
||||
CreateControl();
|
||||
}
|
||||
|
||||
if (value == false && parent != null) {
|
||||
@@ -3171,32 +3163,12 @@ namespace System.Windows.Forms
|
||||
|
||||
paint_event = XplatUI.PaintEventStart(Handle);
|
||||
|
||||
if (!needs_redraw) {
|
||||
// Just blit the previous image
|
||||
paint_event.Graphics.DrawImage (ImageBuffer, paint_event.ClipRectangle, paint_event.ClipRectangle, GraphicsUnit.Pixel);
|
||||
XplatUI.PaintEventEnd(Handle);
|
||||
return;
|
||||
}
|
||||
|
||||
Graphics dc = null;
|
||||
if ((control_style & ControlStyles.DoubleBuffer) != 0) {
|
||||
dc = paint_event.SetGraphics (DeviceContext);
|
||||
}
|
||||
|
||||
if ((control_style & (ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint)) == (ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint)) {
|
||||
if (GetStyle(ControlStyles.AllPaintingInWmPaint)) {
|
||||
OnPaintBackground(paint_event);
|
||||
}
|
||||
|
||||
OnPaint(paint_event);
|
||||
|
||||
if ((control_style & ControlStyles.DoubleBuffer) != 0) {
|
||||
dc.DrawImage (ImageBuffer, paint_event.ClipRectangle, paint_event.ClipRectangle, GraphicsUnit.Pixel);
|
||||
paint_event.SetGraphics (dc);
|
||||
needs_redraw = false;
|
||||
}
|
||||
|
||||
XplatUI.PaintEventEnd(Handle);
|
||||
|
||||
|
||||
if (!GetStyle(ControlStyles.UserPaint)) {
|
||||
DefWndProc(ref m);
|
||||
}
|
||||
@@ -3211,11 +3183,12 @@ namespace System.Windows.Forms
|
||||
Graphics.FromHdc (m.WParam), new Rectangle (new Point (0,0),Size));
|
||||
OnPaintBackground (eraseEventArgs);
|
||||
}
|
||||
m.Result = (IntPtr)1;
|
||||
} else {
|
||||
XplatUI.EraseWindowBackground(m.HWnd, m.WParam);
|
||||
}
|
||||
// The DefWndProc will never have to handle this, we don't ever set hbr on the window
|
||||
m.Result = (IntPtr)1;
|
||||
m.Result = IntPtr.Zero;
|
||||
DefWndProc (ref m);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3280,10 +3253,6 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
case Msg.WM_RBUTTONUP: {
|
||||
if (context_menu != null) {
|
||||
context_menu.Show(this, new Point(LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ())));
|
||||
}
|
||||
|
||||
HandleClick(mouse_clicks);
|
||||
OnMouseUp (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Right,
|
||||
mouse_clicks,
|
||||
@@ -3587,7 +3556,6 @@ namespace System.Windows.Forms
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Advanced)]
|
||||
protected virtual void OnInvalidated(InvalidateEventArgs e) {
|
||||
needs_redraw = true;
|
||||
if (Invalidated!=null) Invalidated(this, e);
|
||||
}
|
||||
|
||||
@@ -3832,7 +3800,7 @@ namespace System.Windows.Forms
|
||||
} else {
|
||||
if (!is_disposed) {
|
||||
if (!this.IsHandleCreated) {
|
||||
this.CreateControl();
|
||||
this.CreateHandle();
|
||||
}
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
@@ -369,33 +369,18 @@ namespace System.Windows.Forms {
|
||||
}
|
||||
|
||||
[MonoTODO("Figure out a good System.Drawing way for XOR drawing")]
|
||||
private static bool DRFNotImpl = false;
|
||||
public static void DrawReversibleFrame(Rectangle rectangle, Color backColor, FrameStyle style) {
|
||||
if (!DRFNotImpl) {
|
||||
DRFNotImpl = true;
|
||||
Console.WriteLine("NOT IMPLEMENTED: FillReversibleRectangle(Rectangle rectangle, Color backColor)");
|
||||
}
|
||||
//throw new NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[MonoTODO("Figure out a good System.Drawing way for XOR drawing")]
|
||||
private static bool DRLNotImpl = false;
|
||||
public static void DrawReversibleLine(Point start, Point end, Color backColor) {
|
||||
if (!DRLNotImpl) {
|
||||
DRLNotImpl = true;
|
||||
Console.WriteLine("NOT IMPLEMENTED: FillReversibleRectangle(Rectangle rectangle, Color backColor)");
|
||||
}
|
||||
//throw new NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[MonoTODO("Figure out a good System.Drawing way for XOR drawing")]
|
||||
private static bool FRRNotImpl = false;
|
||||
public static void FillReversibleRectangle(Rectangle rectangle, Color backColor) {
|
||||
if (!FRRNotImpl) {
|
||||
FRRNotImpl = true;
|
||||
Console.WriteLine("NOT IMPLEMENTED: FillReversibleRectangle(Rectangle rectangle, Color backColor)");
|
||||
}
|
||||
//throw new NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
@@ -408,13 +393,8 @@ namespace System.Windows.Forms {
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
private static bool DSFNotImpl = false;
|
||||
public static void DrawSelectionFrame(Graphics graphics, bool active, Rectangle outsideRect, Rectangle insideRect, Color backColor) {
|
||||
if (!DSFNotImpl) {
|
||||
DSFNotImpl = true;
|
||||
Console.WriteLine("NOT IMPLEMENTED: DrawSelectionFrame(Graphics graphics, bool active, Rectangle outsideRect, Rectangle insideRect, Color backColor)");
|
||||
}
|
||||
//throw new NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void DrawSizeGrip (Graphics graphics, Color backColor, Rectangle bounds)
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
|
||||
@@ -51,16 +50,6 @@ namespace System.Windows.Forms {
|
||||
throw new Exception ("Attempted to create currency manager " +
|
||||
"from invalid type: " + data_source.GetType ());
|
||||
}
|
||||
|
||||
if (data_source as ArrayList != null) {
|
||||
finalType = ((ArrayList)data_source).GetType ();
|
||||
} else {
|
||||
if (data_source as Array != null) {
|
||||
finalType = ((Array) data_source).GetType ();
|
||||
} else {
|
||||
finalType = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IList List {
|
||||
@@ -98,30 +87,9 @@ namespace System.Windows.Forms {
|
||||
{
|
||||
ITypedList typed = list as ITypedList;
|
||||
|
||||
if (list is Array) {
|
||||
Type element = list.GetType ().GetElementType ();
|
||||
return TypeDescriptor.GetProperties (element);
|
||||
}
|
||||
|
||||
if (typed != null) {
|
||||
return typed.GetItemProperties (null);
|
||||
}
|
||||
|
||||
PropertyInfo [] props = finalType.GetProperties ();
|
||||
for (int i = 0; i < props.Length; i++) {
|
||||
if (props [i].Name == "Item") {
|
||||
Type t = props [i].PropertyType;
|
||||
if (t == typeof (object))
|
||||
continue;
|
||||
return GetBrowsableProperties (t);
|
||||
}
|
||||
}
|
||||
|
||||
if (list.Count > 0) {
|
||||
return GetBrowsableProperties (list [0].GetType ());
|
||||
}
|
||||
|
||||
return new PropertyDescriptorCollection (null);
|
||||
if (typed == null)
|
||||
return null;
|
||||
return typed.GetItemProperties (null);
|
||||
}
|
||||
|
||||
public override void RemoveAt (int index)
|
||||
@@ -139,10 +107,6 @@ namespace System.Windows.Forms {
|
||||
binding_suspended = false;
|
||||
}
|
||||
|
||||
internal override bool IsSuspended {
|
||||
get { return binding_suspended; }
|
||||
}
|
||||
|
||||
public override void AddNew ()
|
||||
{
|
||||
if (binding_list == null)
|
||||
@@ -218,18 +182,6 @@ namespace System.Windows.Forms {
|
||||
// Probably should be validating or something here
|
||||
EndCurrentEdit ();
|
||||
}
|
||||
|
||||
internal object GetItem (int index)
|
||||
{
|
||||
return list [index];
|
||||
}
|
||||
|
||||
private PropertyDescriptorCollection GetBrowsableProperties (Type t)
|
||||
{
|
||||
Attribute [] att = new System.Attribute [1];
|
||||
att [0] = new BrowsableAttribute (true);
|
||||
return TypeDescriptor.GetProperties (t, att);
|
||||
}
|
||||
|
||||
public event ItemChangedEventHandler ItemChanged;
|
||||
}
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc.
|
||||
//
|
||||
// Authors:
|
||||
// Jackson Harper ([email protected])
|
||||
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
|
||||
namespace System.Windows.Forms {
|
||||
|
||||
public class CursorConverter : TypeConverter {
|
||||
|
||||
public CursorConverter ()
|
||||
{
|
||||
}
|
||||
|
||||
public override bool CanConvertFrom (ITypeDescriptorContext context, Type source_type)
|
||||
{
|
||||
if (source_type == typeof (byte []))
|
||||
return true;
|
||||
return base.CanConvertFrom (context, source_type);
|
||||
}
|
||||
|
||||
public override bool CanConvertTo (ITypeDescriptorContext context, Type dest_type)
|
||||
{
|
||||
if (dest_type == typeof (byte []))
|
||||
return true;
|
||||
return base.CanConvertTo (context, dest_type);
|
||||
}
|
||||
|
||||
[MonoTODO ("Waiting on Cursor::.ctor (Stream)")]
|
||||
public override object ConvertFrom (ITypeDescriptorContext context,
|
||||
CultureInfo culture, object value)
|
||||
{
|
||||
byte [] val = value as byte [];
|
||||
if (val == null)
|
||||
return base.ConvertFrom (context, culture, value);
|
||||
|
||||
using (MemoryStream s = new MemoryStream (val)) {
|
||||
return new Cursor (s);
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO ("Waiting on Cursor::Draw")]
|
||||
public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture,
|
||||
object value, Type dest_type)
|
||||
{
|
||||
if (dest_type == null)
|
||||
throw new ArgumentNullException ("destinationType");
|
||||
|
||||
if (dest_type == typeof (byte [])) {
|
||||
|
||||
if (value == null)
|
||||
return new byte [0];
|
||||
|
||||
using (MemoryStream s = new MemoryStream ()) {
|
||||
Cursor val = value as Cursor;
|
||||
|
||||
Bitmap b = new Bitmap (val.Size.Width, val.Size.Height);
|
||||
using (Graphics g = Graphics.FromImage (b)) {
|
||||
// This isn't implemented in Cursor yet
|
||||
|
||||
// Rectangle r = new Rectangle (0, 0,
|
||||
// val.Size.Width, val.Size.Height);
|
||||
// val.Draw (g, r);
|
||||
}
|
||||
b.Save (s, ImageFormat.Bmp);
|
||||
return s.ToArray ();
|
||||
}
|
||||
}
|
||||
return base.ConvertTo (context, culture, value, dest_type);
|
||||
}
|
||||
|
||||
public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
|
||||
{
|
||||
PropertyDescriptorCollection props = TypeDescriptor.GetProperties (typeof (Cursors));
|
||||
ArrayList vals = new ArrayList ();
|
||||
|
||||
for (int i = 0; i < props.Count; i++)
|
||||
vals.Add (props [i].GetValue (null));
|
||||
return new StandardValuesCollection (vals);
|
||||
}
|
||||
|
||||
public override bool GetStandardValuesSupported (ITypeDescriptorContext context)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,222 +0,0 @@
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// Author:
|
||||
// Jordi Mas i Hernandez <[email protected]>
|
||||
//
|
||||
//
|
||||
|
||||
// NOT COMPLETE
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace System.Windows.Forms
|
||||
{
|
||||
public class DataGridBoolColumn : DataGridColumnStyle
|
||||
{
|
||||
#region Local Variables
|
||||
private bool allownull;
|
||||
private object falsevalue;
|
||||
private object nullvalue;
|
||||
private object truevalue;
|
||||
#endregion // Local Variables
|
||||
|
||||
#region Constructors
|
||||
public DataGridBoolColumn () : base ()
|
||||
{
|
||||
CommonConstructor ();
|
||||
}
|
||||
|
||||
public DataGridBoolColumn (PropertyDescriptor prop) : base (prop)
|
||||
{
|
||||
CommonConstructor ();
|
||||
}
|
||||
|
||||
public DataGridBoolColumn (PropertyDescriptor prop, bool isDefault) : base (prop)
|
||||
{
|
||||
CommonConstructor ();
|
||||
}
|
||||
|
||||
private void CommonConstructor ()
|
||||
{
|
||||
allownull = true;
|
||||
falsevalue = false;
|
||||
nullvalue = null;
|
||||
truevalue = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Instance Properties
|
||||
public bool AllowNull {
|
||||
get {
|
||||
return allownull;
|
||||
}
|
||||
set {
|
||||
if (value != allownull) {
|
||||
allownull = value;
|
||||
|
||||
if (AllowNullChanged != null) {
|
||||
AllowNullChanged (this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public object FalseValue {
|
||||
get {
|
||||
return falsevalue;
|
||||
}
|
||||
set {
|
||||
if (value != falsevalue) {
|
||||
falsevalue = value;
|
||||
|
||||
if (FalseValueChanged != null) {
|
||||
FalseValueChanged (this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public object NullValue {
|
||||
get {
|
||||
return nullvalue;
|
||||
}
|
||||
set {
|
||||
if (value != nullvalue) {
|
||||
nullvalue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public object TrueValue {
|
||||
get {
|
||||
return truevalue;
|
||||
}
|
||||
set {
|
||||
if (value != truevalue) {
|
||||
truevalue = value;
|
||||
|
||||
if (TrueValueChanged != null) {
|
||||
TrueValueChanged (this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion // Public Instance Properties
|
||||
|
||||
#region Public Instance Methods
|
||||
[MonoTODO]
|
||||
protected internal override void Abort (int rowNum)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal override bool Commit (CurrencyManager dataSource, int rowNum)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal override void ConcedeFocus ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal override void Edit (CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal override void EnterNullValue ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal override object GetColumnValueAtRow (CurrencyManager lm, int row)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal override int GetMinimumHeight ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal override int GetPreferredHeight (Graphics g, object value)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal override Size GetPreferredSize (Graphics g, object value)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal override void Paint (Graphics g, Rectangle bounds, CurrencyManager source, int rowNum)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, bool alignToRight)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal override void SetColumnValueAtRow (CurrencyManager lm, int row, object value)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion // Public Instance Methods
|
||||
|
||||
#region Private Instance Methods
|
||||
internal static bool CanRenderType (Type type)
|
||||
{
|
||||
return (type == typeof (Boolean));
|
||||
}
|
||||
#endregion Private Instance Methods
|
||||
|
||||
#region Events
|
||||
public event EventHandler AllowNullChanged;
|
||||
public event EventHandler FalseValueChanged;
|
||||
public event EventHandler TrueValueChanged;
|
||||
#endregion // Events
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// Author:
|
||||
// Jordi Mas i Hernandez <[email protected]>
|
||||
//
|
||||
//
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace System.Windows.Forms
|
||||
{
|
||||
public struct DataGridCell
|
||||
{
|
||||
#region Local Variables
|
||||
private int row;
|
||||
private int column;
|
||||
#endregion // Local Variables
|
||||
|
||||
#region Constructors
|
||||
public DataGridCell (int r, int c)
|
||||
{
|
||||
row = r;
|
||||
column = c;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Instance Properties
|
||||
public int ColumnNumber {
|
||||
get { return column; }
|
||||
set { column = value; }
|
||||
}
|
||||
|
||||
public int RowNumber {
|
||||
get { return row; }
|
||||
set { row = value; }
|
||||
}
|
||||
#endregion // Public Instance Properties
|
||||
|
||||
#region Public Instance Methods
|
||||
public override bool Equals (object o)
|
||||
{
|
||||
if (!(o is DataGridCell))
|
||||
return false;
|
||||
|
||||
DataGridCell obj = (DataGridCell) o;
|
||||
return (obj.ColumnNumber == column && obj.RowNumber == row);
|
||||
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return row ^ column;
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return base.ToString () + "{RowNumber = " + row +", ColumnNumber = " + column + "}";
|
||||
}
|
||||
|
||||
#endregion // Public Instance Methods
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,428 +0,0 @@
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
|
||||
//
|
||||
// Author:
|
||||
// Jordi Mas i Hernandez <[email protected]>
|
||||
//
|
||||
//
|
||||
|
||||
// NOT COMPLETE
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace System.Windows.Forms
|
||||
{
|
||||
public abstract class DataGridColumnStyle : Component, IDataGridColumnStyleEditingNotificationService
|
||||
{
|
||||
[ComVisible(true)]
|
||||
protected class DataGridColumnHeaderAccessibleObject : AccessibleObject
|
||||
{
|
||||
#region Local Variables
|
||||
private DataGridColumnStyle owner;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public DataGridColumnHeaderAccessibleObject (DataGridColumnStyle columnstyle)
|
||||
{
|
||||
owner = columnstyle;
|
||||
}
|
||||
#endregion //Constructors
|
||||
|
||||
#region Public Instance Properties
|
||||
[MonoTODO]
|
||||
public override Rectangle Bounds {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
protected DataGridColumnStyle Owner {
|
||||
get { return owner; }
|
||||
}
|
||||
|
||||
public override AccessibleObject Parent {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public override AccessibleRole Role {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Instance Methods
|
||||
[MonoTODO]
|
||||
public override AccessibleObject Navigate (AccessibleNavigation navdir)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#endregion Public Instance Methods
|
||||
}
|
||||
|
||||
protected class CompModSwitches
|
||||
{
|
||||
public CompModSwitches ()
|
||||
{
|
||||
}
|
||||
|
||||
#region Public Instance Methods
|
||||
[MonoTODO]
|
||||
public static TraceSwitch DGEditColumnEditing {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
#endregion Public Instance Methods
|
||||
}
|
||||
|
||||
#region Local Variables
|
||||
private HorizontalAlignment alignment;
|
||||
private int fontheight;
|
||||
private DataGridTableStyle table_style;
|
||||
private string header_text;
|
||||
private string mapping_name;
|
||||
private string null_text;
|
||||
private PropertyDescriptor property_descriptor;
|
||||
private bool read_only;
|
||||
private int width;
|
||||
private DataGridColumnHeaderAccessibleObject accesible_object;
|
||||
#endregion // Local Variables
|
||||
|
||||
#region Constructors
|
||||
public DataGridColumnStyle ()
|
||||
{
|
||||
CommmonConstructor ();
|
||||
property_descriptor = null;
|
||||
}
|
||||
|
||||
public DataGridColumnStyle (PropertyDescriptor prop)
|
||||
{
|
||||
CommmonConstructor ();
|
||||
property_descriptor = prop;
|
||||
}
|
||||
|
||||
private void CommmonConstructor ()
|
||||
{
|
||||
fontheight = -1;
|
||||
table_style = null;
|
||||
header_text = string.Empty;
|
||||
mapping_name = "(null)";
|
||||
null_text = string.Empty;
|
||||
accesible_object = new DataGridColumnHeaderAccessibleObject (this);
|
||||
read_only = false;
|
||||
width = -1;
|
||||
alignment = HorizontalAlignment.Left;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Instance Properties
|
||||
public virtual HorizontalAlignment Alignment {
|
||||
get {
|
||||
return alignment;
|
||||
}
|
||||
set {
|
||||
if (value != alignment) {
|
||||
alignment = value;
|
||||
|
||||
if (AlignmentChanged != null) {
|
||||
AlignmentChanged (this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual DataGridTableStyle DataGridTableStyle {
|
||||
get {
|
||||
return table_style;
|
||||
}
|
||||
}
|
||||
|
||||
protected int FontHeight {
|
||||
get {
|
||||
if (fontheight != -1) {
|
||||
return fontheight;
|
||||
}
|
||||
|
||||
if (table_style != null) {
|
||||
//return table_style.DataGrid.FontHeight
|
||||
return -1;
|
||||
}
|
||||
|
||||
// TODO: Default Datagrid font height
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public AccessibleObject HeaderAccessibleObject {
|
||||
get {
|
||||
return accesible_object;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string HeaderText {
|
||||
get {
|
||||
return header_text;
|
||||
}
|
||||
set {
|
||||
if (value != header_text) {
|
||||
header_text = value;
|
||||
|
||||
if (HeaderTextChanged != null) {
|
||||
HeaderTextChanged (this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string MappingName {
|
||||
get {
|
||||
return mapping_name;
|
||||
}
|
||||
set {
|
||||
if (value != mapping_name) {
|
||||
mapping_name = value;
|
||||
|
||||
if (MappingNameChanged != null) {
|
||||
MappingNameChanged (this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string NullText {
|
||||
get {
|
||||
return null_text;
|
||||
}
|
||||
set {
|
||||
if (value != null_text) {
|
||||
null_text = value;
|
||||
|
||||
if (NullTextChanged != null) {
|
||||
NullTextChanged (this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual PropertyDescriptor PropertyDescriptor {
|
||||
get {
|
||||
return property_descriptor;
|
||||
}
|
||||
set {
|
||||
if (value != property_descriptor) {
|
||||
property_descriptor = value;
|
||||
|
||||
if (PropertyDescriptorChanged != null) {
|
||||
PropertyDescriptorChanged (this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool ReadOnly {
|
||||
get {
|
||||
return read_only;
|
||||
}
|
||||
set {
|
||||
if (value != read_only) {
|
||||
read_only = value;
|
||||
|
||||
if (ReadOnlyChanged != null) {
|
||||
ReadOnlyChanged (this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual int Width {
|
||||
get {
|
||||
return width;
|
||||
}
|
||||
set {
|
||||
if (value != width) {
|
||||
width = value;
|
||||
|
||||
if (WidthChanged != null) {
|
||||
WidthChanged (this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Public Instance Properties
|
||||
|
||||
#region Private Instance Properties
|
||||
internal DataGridTableStyle TableStyle {
|
||||
set { table_style = value; }
|
||||
}
|
||||
#endregion Private Instance Properties
|
||||
|
||||
#region Public Instance Methods
|
||||
protected internal abstract void Abort (int rowNum);
|
||||
|
||||
[MonoTODO]
|
||||
protected void BeginUpdate ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected void CheckValidDataSource (CurrencyManager value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal virtual void ColumnStartedEditing (Control editingControl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected internal abstract bool Commit (CurrencyManager dataSource, int rowNum);
|
||||
|
||||
|
||||
protected internal virtual void ConcedeFocus ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected virtual AccessibleObject CreateHeaderAccessibleObject ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
|
||||
protected internal virtual void Edit (CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal virtual void Edit (CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected internal abstract void Edit (CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible);
|
||||
|
||||
|
||||
[MonoTODO]
|
||||
protected void EndUpdate ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected internal virtual void EnterNullValue ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected internal virtual object GetColumnValueAtRow (CurrencyManager source, int rowNum)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
protected internal abstract int GetMinimumHeight ();
|
||||
|
||||
protected internal abstract int GetPreferredHeight (Graphics g, object value);
|
||||
|
||||
protected internal abstract Size GetPreferredSize (Graphics g, object value);
|
||||
|
||||
void IDataGridColumnStyleEditingNotificationService.ColumnStartedEditing (Control editingControl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected virtual void Invalidate ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected internal abstract void Paint (Graphics g, Rectangle bounds, CurrencyManager source, int rowNum);
|
||||
protected internal abstract void Paint (Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, bool alignToRight);
|
||||
|
||||
[MonoTODO]
|
||||
protected internal virtual void Paint (Graphics g, Rectangle bounds, CurrencyManager source, int rowNum,
|
||||
Brush backBrush, Brush foreBrush, bool alignToRight)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected internal virtual void ReleaseHostedControl ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ResetHeaderText ()
|
||||
{
|
||||
HeaderText = string.Empty;
|
||||
}
|
||||
|
||||
protected internal virtual void SetColumnValueAtRow (CurrencyManager source, int rowNum, object value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected virtual void SetDataGrid (DataGrid value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected virtual void SetDataGridInColumn (DataGrid value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected internal virtual void UpdateUI (CurrencyManager source, int rowNum, string instantText)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion // Public Instance Methods
|
||||
|
||||
|
||||
#region Events
|
||||
public event EventHandler AlignmentChanged;
|
||||
public event EventHandler FontChanged;
|
||||
public event EventHandler HeaderTextChanged;
|
||||
public event EventHandler MappingNameChanged;
|
||||
public event EventHandler NullTextChanged;
|
||||
public event EventHandler PropertyDescriptorChanged;
|
||||
public event EventHandler ReadOnlyChanged;
|
||||
public event EventHandler WidthChanged;
|
||||
#endregion // Events
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
@@ -17,117 +17,40 @@
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// Copyright (c) 2004-2005 Novell, Inc.
|
||||
// Copyright (c) 2004 Novell, Inc.
|
||||
//
|
||||
// Authors:
|
||||
//
|
||||
// Peter Bartok <[email protected]>
|
||||
// Jordi Mas i Hernandez <[email protected]>
|
||||
// Peter Bartok [email protected]
|
||||
//
|
||||
//
|
||||
// NOT COMPLETE
|
||||
//
|
||||
|
||||
|
||||
// NOT COMPLETE - Empty (and some functions minimally stubbed for dependencies) until DataGrid is implemented
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Data;
|
||||
using System.Xml;
|
||||
|
||||
namespace System.Windows.Forms
|
||||
{
|
||||
public class DataGridTableStyle : Component
|
||||
{
|
||||
public static DataGridTableStyle DefaultTableStyle = new DataGridTableStyle (true);
|
||||
|
||||
namespace System.Windows.Forms {
|
||||
public class DataGridTableStyle : Component {
|
||||
#region Local Variables
|
||||
private static readonly Color def_alternating_backcolor = SystemColors.Window;
|
||||
private static readonly Color def_backcolor = SystemColors.Window;
|
||||
private static readonly Color def_forecolor = SystemColors.WindowText;
|
||||
private static readonly Color def_gridline_color = SystemColors.Control;
|
||||
private static readonly Color def_header_backcolor = SystemColors.Control;
|
||||
private static readonly Font def_header_font = null;
|
||||
private static readonly Color def_header_forecolor = SystemColors.ControlText;
|
||||
private static readonly Color def_link_color = SystemColors.HotTrack;
|
||||
private static readonly Color def_link_hovercolor = SystemColors.HotTrack;
|
||||
private static readonly Color def_selection_backcolor = SystemColors.ActiveCaption;
|
||||
private static readonly Color def_selection_forecolor = SystemColors.ActiveCaptionText;
|
||||
|
||||
private bool allow_sorting;
|
||||
private DataGrid datagrid;
|
||||
private Color header_forecolor;
|
||||
private string mapping_name;
|
||||
private Color alternating_backcolor;
|
||||
private bool columnheaders_visible;
|
||||
private GridColumnStylesCollection column_styles;
|
||||
private Color gridline_color;
|
||||
private DataGridLineStyle gridline_style;
|
||||
private Color header_backcolor;
|
||||
private Font header_font;
|
||||
private Color link_color;
|
||||
private Color link_hovercolor;
|
||||
private int preferredcolumn_width;
|
||||
private int preferredrow_height;
|
||||
private bool _readonly;
|
||||
private bool rowheaders_visible;
|
||||
private Color selection_backcolor;
|
||||
private Color selection_forecolor;
|
||||
private int rowheaders_width;
|
||||
private Color backcolor;
|
||||
private Color forecolor;
|
||||
private bool is_default;
|
||||
CurrencyManager manager;
|
||||
internal bool allow_sorting;
|
||||
internal DataGrid datagrid;
|
||||
internal Color header_forecolor;
|
||||
internal string mapping_name;
|
||||
#endregion // Local Variables
|
||||
|
||||
#region Constructors
|
||||
public DataGridTableStyle ()
|
||||
{
|
||||
CommonConstructor ();
|
||||
is_default = false;
|
||||
}
|
||||
|
||||
public DataGridTableStyle (bool isDefaultTableStyle)
|
||||
{
|
||||
CommonConstructor ();
|
||||
is_default = isDefaultTableStyle;
|
||||
}
|
||||
|
||||
// TODO: What to do with the CurrencyManager
|
||||
public DataGridTableStyle (CurrencyManager listManager)
|
||||
{
|
||||
CommonConstructor ();
|
||||
is_default = false;
|
||||
manager = listManager;
|
||||
}
|
||||
|
||||
private void CommonConstructor ()
|
||||
{
|
||||
allow_sorting = true;
|
||||
datagrid = null;
|
||||
header_forecolor = def_header_forecolor;
|
||||
public DataGridTableStyle() {
|
||||
allow_sorting = false;
|
||||
datagrid = new DataGrid();
|
||||
header_forecolor = Color.Black;
|
||||
mapping_name = string.Empty;
|
||||
column_styles = new GridColumnStylesCollection (this);
|
||||
|
||||
alternating_backcolor = def_alternating_backcolor;
|
||||
columnheaders_visible = true;
|
||||
gridline_color = def_gridline_color;
|
||||
gridline_style = DataGridLineStyle.Solid;
|
||||
header_backcolor = def_header_backcolor;
|
||||
header_font = def_header_font;
|
||||
link_color = def_link_color;
|
||||
link_hovercolor = def_link_hovercolor;
|
||||
preferredcolumn_width = 75;
|
||||
preferredrow_height = ThemeEngine.Current.DefaultFont.Height + 3;
|
||||
_readonly = false;
|
||||
rowheaders_visible = true;
|
||||
selection_backcolor = def_selection_backcolor;
|
||||
selection_forecolor = def_selection_forecolor;
|
||||
rowheaders_width = 35;
|
||||
backcolor = def_backcolor;
|
||||
forecolor = def_forecolor;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Static Fields
|
||||
#endregion // Public Static Fields
|
||||
|
||||
#region Public Instance Properties
|
||||
public bool AllowSorting {
|
||||
get {
|
||||
@@ -137,46 +60,8 @@ namespace System.Windows.Forms
|
||||
set {
|
||||
if (allow_sorting != value) {
|
||||
allow_sorting = value;
|
||||
OnAllowSortingChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Color AlternatingBackColor {
|
||||
get {
|
||||
return alternating_backcolor;
|
||||
}
|
||||
|
||||
set {
|
||||
if (alternating_backcolor != value) {
|
||||
alternating_backcolor = value;
|
||||
OnAlternatingBackColorChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Color BackColor {
|
||||
get {
|
||||
return backcolor;
|
||||
}
|
||||
|
||||
set {
|
||||
if (backcolor != value) {
|
||||
backcolor = value;
|
||||
OnBackColorChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ColumnHeadersVisible {
|
||||
get {
|
||||
return columnheaders_visible;
|
||||
}
|
||||
|
||||
set {
|
||||
if (columnheaders_visible != value) {
|
||||
columnheaders_visible = value;
|
||||
OnColumnHeadersVisibleChanged (EventArgs.Empty);
|
||||
OnAllowSortingChanged(EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,118 +78,14 @@ namespace System.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public Color ForeColor {
|
||||
get {
|
||||
return forecolor;
|
||||
}
|
||||
|
||||
set {
|
||||
if (forecolor != value) {
|
||||
forecolor = value;
|
||||
OnForeColorChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual GridColumnStylesCollection GridColumnStyles {
|
||||
get { return column_styles; }
|
||||
}
|
||||
|
||||
public Color GridLineColor {
|
||||
get {
|
||||
return gridline_color;
|
||||
}
|
||||
|
||||
set {
|
||||
if (gridline_color != value) {
|
||||
gridline_color = value;
|
||||
OnGridLineColorChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DataGridLineStyle GridLineStyle {
|
||||
get {
|
||||
return gridline_style;
|
||||
}
|
||||
|
||||
set {
|
||||
if (gridline_style != value) {
|
||||
gridline_style = value;
|
||||
OnGridLineStyleChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Color HeaderBackColor {
|
||||
get {
|
||||
return header_backcolor;
|
||||
}
|
||||
|
||||
set {
|
||||
if (header_backcolor != value) {
|
||||
header_backcolor = value;
|
||||
OnHeaderBackColorChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Font HeaderFont {
|
||||
get {
|
||||
if (header_font != null)
|
||||
return header_font;
|
||||
|
||||
if (datagrid != null)
|
||||
return datagrid.Font;
|
||||
|
||||
return ThemeEngine.Current.DefaultFont;
|
||||
}
|
||||
|
||||
set {
|
||||
if (header_font != value) {
|
||||
header_font = value;
|
||||
OnHeaderFontChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Color HeaderForeColor {
|
||||
get {
|
||||
return header_forecolor;
|
||||
}
|
||||
|
||||
set {
|
||||
|
||||
if (header_forecolor != value) {
|
||||
header_forecolor = value;
|
||||
OnHeaderForeColorChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Color LinkColor {
|
||||
get {
|
||||
return link_color;
|
||||
}
|
||||
|
||||
set {
|
||||
if (link_color != value) {
|
||||
link_color = value;
|
||||
OnLinkColorChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[ComVisible(false)]
|
||||
public Color LinkHoverColor {
|
||||
get {
|
||||
return link_hovercolor;
|
||||
}
|
||||
|
||||
set {
|
||||
if (link_hovercolor != value) {
|
||||
link_hovercolor = value;
|
||||
OnLinkHoverColorChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -317,454 +98,33 @@ namespace System.Windows.Forms
|
||||
set {
|
||||
if (mapping_name != value) {
|
||||
mapping_name = value;
|
||||
OnMappingNameChanged (EventArgs.Empty);
|
||||
|
||||
OnMappingNameChanged(EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int PreferredColumnWidth {
|
||||
get {
|
||||
return preferredcolumn_width;
|
||||
}
|
||||
|
||||
set {
|
||||
if (preferredcolumn_width != value) {
|
||||
preferredcolumn_width = value;
|
||||
OnPreferredColumnWidthChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int PreferredRowHeight {
|
||||
get {
|
||||
return preferredrow_height;
|
||||
}
|
||||
|
||||
set {
|
||||
if (preferredrow_height != value) {
|
||||
preferredrow_height = value;
|
||||
OnPreferredRowHeightChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReadOnly {
|
||||
get {
|
||||
return _readonly;
|
||||
}
|
||||
|
||||
set {
|
||||
if (_readonly != value) {
|
||||
_readonly = value;
|
||||
OnReadOnlyChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool RowHeadersVisible {
|
||||
get {
|
||||
return rowheaders_visible;
|
||||
}
|
||||
|
||||
set {
|
||||
if (rowheaders_visible != value) {
|
||||
rowheaders_visible = value;
|
||||
OnRowHeadersVisibleChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int RowHeaderWidth {
|
||||
get {
|
||||
return rowheaders_width;
|
||||
}
|
||||
|
||||
set {
|
||||
if (rowheaders_width != value) {
|
||||
rowheaders_width = value;
|
||||
OnRowHeaderWidthChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Color SelectionBackColor {
|
||||
get {
|
||||
return selection_backcolor;
|
||||
}
|
||||
|
||||
set {
|
||||
if (selection_backcolor != value) {
|
||||
selection_backcolor = value;
|
||||
OnSelectionBackColorChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Color SelectionForeColor {
|
||||
get {
|
||||
return selection_forecolor;
|
||||
}
|
||||
|
||||
set {
|
||||
if (selection_forecolor != value) {
|
||||
selection_forecolor = value;
|
||||
OnSelectionForeColorChanged (EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Public Instance Properties
|
||||
|
||||
#region Public Instance Methods
|
||||
#endregion // Public Instance Methods
|
||||
|
||||
[MonoTODO]
|
||||
public virtual bool BeginEdit (DataGridColumnStyle gridColumn, int rowNumber)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
protected internal virtual DataGridColumnStyle CreateGridColumn (PropertyDescriptor prop)
|
||||
{
|
||||
return CreateGridColumn (prop, false);
|
||||
}
|
||||
|
||||
protected internal virtual DataGridColumnStyle CreateGridColumn (PropertyDescriptor prop, bool isDefault)
|
||||
{
|
||||
if (DataGridBoolColumn.CanRenderType (prop.PropertyType)) {
|
||||
return new DataGridBoolColumn (prop, isDefault);
|
||||
}
|
||||
|
||||
if (DataGridTextBoxColumn.CanRenderType (prop.PropertyType)) {
|
||||
return new DataGridTextBoxColumn (prop, isDefault);
|
||||
}
|
||||
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
base.Dispose (disposing);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public virtual bool EndEdit ( DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
protected virtual void OnAllowSortingChanged (EventArgs e)
|
||||
{
|
||||
if (AllowSortingChanged != null) {
|
||||
AllowSortingChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnAlternatingBackColorChanged (EventArgs e)
|
||||
{
|
||||
if (AlternatingBackColorChanged != null) {
|
||||
AlternatingBackColorChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnBackColorChanged (EventArgs e)
|
||||
{
|
||||
if (BackColorChanged != null) {
|
||||
BackColorChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnColumnHeadersVisibleChanged (EventArgs e)
|
||||
{
|
||||
if (ColumnHeadersVisibleChanged != null) {
|
||||
ColumnHeadersVisibleChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnForeColorChanged (EventArgs e)
|
||||
{
|
||||
if (ForeColorChanged != null) {
|
||||
ForeColorChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnGridLineColorChanged (EventArgs e)
|
||||
{
|
||||
if (GridLineColorChanged != null) {
|
||||
GridLineColorChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnGridLineStyleChanged (EventArgs e)
|
||||
{
|
||||
if (GridLineStyleChanged != null) {
|
||||
GridLineStyleChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnHeaderBackColorChanged (EventArgs e)
|
||||
{
|
||||
if (HeaderBackColorChanged != null) {
|
||||
HeaderBackColorChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnHeaderFontChanged (EventArgs e)
|
||||
{
|
||||
if (HeaderFontChanged != null) {
|
||||
HeaderFontChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnHeaderForeColorChanged (EventArgs e)
|
||||
{
|
||||
if (HeaderForeColorChanged != null) {
|
||||
HeaderForeColorChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnLinkColorChanged (EventArgs e)
|
||||
{
|
||||
if (LinkColorChanged != null) {
|
||||
LinkColorChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnLinkHoverColorChanged (EventArgs e)
|
||||
{
|
||||
if (LinkHoverColorChanged != null) {
|
||||
LinkHoverColorChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnMappingNameChanged (EventArgs e)
|
||||
{
|
||||
#region Protected Instance Methods
|
||||
protected virtual void OnMappingNameChanged(EventArgs e) {
|
||||
if (MappingNameChanged != null) {
|
||||
MappingNameChanged(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnPreferredColumnWidthChanged (EventArgs e)
|
||||
{
|
||||
if (PreferredColumnWidthChanged != null) {
|
||||
PreferredColumnWidthChanged (this, e);
|
||||
protected virtual void OnAllowSortingChanged(EventArgs e) {
|
||||
if (AllowSortingChanged != null) {
|
||||
AllowSortingChanged(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnPreferredRowHeightChanged (EventArgs e)
|
||||
{
|
||||
if (PreferredRowHeightChanged != null) {
|
||||
PreferredRowHeightChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnReadOnlyChanged (EventArgs e)
|
||||
{
|
||||
if (ReadOnlyChanged != null) {
|
||||
ReadOnlyChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnRowHeadersVisibleChanged (EventArgs e)
|
||||
{
|
||||
if (RowHeadersVisibleChanged != null) {
|
||||
RowHeadersVisibleChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnRowHeaderWidthChanged (EventArgs e)
|
||||
{
|
||||
if (RowHeaderWidthChanged != null) {
|
||||
RowHeaderWidthChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnSelectionBackColorChanged (EventArgs e)
|
||||
{
|
||||
if (SelectionBackColorChanged != null) {
|
||||
SelectionBackColorChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnSelectionForeColorChanged (EventArgs e)
|
||||
{
|
||||
if (SelectionForeColorChanged != null) {
|
||||
SelectionForeColorChanged (this, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetAlternatingBackColor ()
|
||||
{
|
||||
AlternatingBackColor = def_alternating_backcolor;
|
||||
}
|
||||
|
||||
public void ResetBackColor ()
|
||||
{
|
||||
BackColor = def_backcolor;
|
||||
}
|
||||
|
||||
public void ResetForeColor ()
|
||||
{
|
||||
ForeColor = def_forecolor;
|
||||
}
|
||||
|
||||
public void ResetGridLineColor ()
|
||||
{
|
||||
GridLineColor = def_gridline_color;
|
||||
}
|
||||
|
||||
public void ResetHeaderBackColor ()
|
||||
{
|
||||
HeaderBackColor = def_header_backcolor;
|
||||
}
|
||||
|
||||
public void ResetHeaderFont ()
|
||||
{
|
||||
HeaderFont = def_header_font;
|
||||
}
|
||||
|
||||
public void ResetHeaderForeColor ()
|
||||
{
|
||||
HeaderForeColor = def_header_forecolor;
|
||||
}
|
||||
|
||||
public void ResetLinkColor ()
|
||||
{
|
||||
LinkColor = def_link_color;
|
||||
}
|
||||
|
||||
public void ResetLinkHoverColor ()
|
||||
{
|
||||
LinkHoverColor = def_link_hovercolor;
|
||||
}
|
||||
|
||||
public void ResetSelectionBackColor ()
|
||||
{
|
||||
SelectionBackColor = def_selection_backcolor;
|
||||
}
|
||||
|
||||
public void ResetSelectionForeColor ()
|
||||
{
|
||||
SelectionForeColor = def_selection_forecolor;
|
||||
}
|
||||
|
||||
protected virtual bool ShouldSerializeAlternatingBackColor ()
|
||||
{
|
||||
return (alternating_backcolor != def_alternating_backcolor);
|
||||
}
|
||||
|
||||
protected bool ShouldSerializeBackColor ()
|
||||
{
|
||||
return (backcolor != def_backcolor);
|
||||
}
|
||||
|
||||
protected bool ShouldSerializeForeColor ()
|
||||
{
|
||||
return (forecolor != def_forecolor);
|
||||
}
|
||||
|
||||
protected virtual bool ShouldSerializeGridLineColor ()
|
||||
{
|
||||
return (gridline_color != def_gridline_color);
|
||||
}
|
||||
|
||||
protected virtual bool ShouldSerializeHeaderBackColor ()
|
||||
{
|
||||
return (header_backcolor != def_header_backcolor);
|
||||
}
|
||||
|
||||
protected virtual bool ShouldSerializeHeaderForeColor ()
|
||||
{
|
||||
return (header_forecolor != def_header_forecolor);
|
||||
}
|
||||
|
||||
protected virtual bool ShouldSerializeLinkColor ()
|
||||
{
|
||||
return (link_color != def_link_color);
|
||||
}
|
||||
|
||||
protected virtual bool ShouldSerializeLinkHoverColor ()
|
||||
{
|
||||
return (link_hovercolor != def_link_hovercolor);
|
||||
}
|
||||
|
||||
protected bool ShouldSerializePreferredRowHeight ()
|
||||
{
|
||||
return (preferredrow_height != ThemeEngine.Current.DefaultFont.Height + 3);
|
||||
}
|
||||
|
||||
protected bool ShouldSerializeSelectionBackColor ()
|
||||
{
|
||||
return (selection_backcolor != def_selection_backcolor);
|
||||
}
|
||||
|
||||
protected virtual bool ShouldSerializeSelectionForeColor ()
|
||||
{
|
||||
return (selection_forecolor != def_selection_forecolor);
|
||||
}
|
||||
#endregion // Protected Instance Methods
|
||||
|
||||
#region Private Instance Properties
|
||||
|
||||
// Create column styles for this TableStyle
|
||||
internal void CreateColumnsForTable ()
|
||||
{
|
||||
CurrencyManager mgr = null;
|
||||
|
||||
if (manager != null) {
|
||||
mgr = manager;
|
||||
} else {
|
||||
if (datagrid != null) {
|
||||
mgr = datagrid.ListManager;
|
||||
}
|
||||
}
|
||||
|
||||
if (mgr == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
column_styles.Clear ();
|
||||
PropertyDescriptorCollection propcol = mgr.GetItemProperties ();
|
||||
|
||||
for (int i = 0; i < propcol.Count; i++)
|
||||
{
|
||||
if (propcol[i].ComponentType.ToString () == "System.Data.DataRowView") {
|
||||
DataGridColumnStyle st = CreateGridColumn (propcol[i], true);
|
||||
st.MappingName = propcol[i].Name;
|
||||
column_styles.Add (st);
|
||||
}
|
||||
|
||||
// TODO: What to do with relations?
|
||||
if (propcol[i].ComponentType.ToString () == "System.Data.DataTablePropertyDescriptor") {
|
||||
Console.WriteLine ("CreateColumnsForTable::System.Data.DataTablePropertyDescriptor");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion Private Instance Properties
|
||||
|
||||
#region Events
|
||||
public event EventHandler AllowSortingChanged;
|
||||
public event EventHandler AlternatingBackColorChanged;
|
||||
public event EventHandler BackColorChanged;
|
||||
public event EventHandler ColumnHeadersVisibleChanged;
|
||||
public event EventHandler ForeColorChanged;
|
||||
public event EventHandler GridLineColorChanged;
|
||||
public event EventHandler GridLineStyleChanged;
|
||||
public event EventHandler HeaderBackColorChanged;
|
||||
public event EventHandler HeaderFontChanged;
|
||||
public event EventHandler HeaderForeColorChanged;
|
||||
public event EventHandler LinkColorChanged;
|
||||
public event EventHandler LinkHoverColorChanged;
|
||||
public event EventHandler MappingNameChanged;
|
||||
public event EventHandler PreferredColumnWidthChanged;
|
||||
public event EventHandler PreferredRowHeightChanged;
|
||||
public event EventHandler ReadOnlyChanged;
|
||||
public event EventHandler RowHeadersVisibleChanged;
|
||||
public event EventHandler RowHeaderWidthChanged;
|
||||
public event EventHandler SelectionBackColorChanged;
|
||||
public event EventHandler SelectionForeColorChanged;
|
||||
#endregion // Events
|
||||
}
|
||||
}
|
||||
|
||||
Loaded 100 of 3231 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user