Article Type: News
C#（ECMA－334）和CLI（ECMA－335）都是 Microsoft .net framework多语言支持策略的核心和关键技术。C#作为C及C++家族中一个改进型的面向组件的编程语言而CLI则是.NET Framework的一个优良子集，主要提供一个运行时环境和开发和分发XML Web Services的基本类库。Redmond这次发表的Shared Source CLI Beta包括了这两部分甚至更多。
不过值得注意的是，Microsoft非常强调其Shared Source性质而不是Open Source，这符合这家公司一贯对于GPL(gnu General Public License )的理解，老实说他们不相信GPL能够保证自己对自己代码和权力的控制，也不愿意跟GPL产生任何关系，特别是自己核心的产品。不过Microsoft自己有产品是遵循或支持GPL的， Andy Patrizio曾吃惊的发现Microsoft至少有一个这样的产品：Interix。Microsoft对于这个产品有些工具是在 GNU GPL下 Released非常的讨厌，但处于对以前license的尊重，Microsoft不得不继续在GPL下Release以后版本的代码。Microsoft不是一家小公司，所以他不会轻易的接近GPL,以免只要有一样接触到GPL，那么所有的产品都可能会变成GPL的 （Don Box说GPL是一种“Viral licences”）如果说为研究学习和进步的需要公开源代码，Microsoft一般会选择Shared Source。Window CE.NET和这一次Shared Source CLI等等，甚至windows 2000/XP/.NET Server都是这样。尽管Microsoft被他的对手认为是极其无赖的，但本质上他符合美国商业最基本的一条规则：你可以选择不玩这个游戏，但只要你进入，那么你必须遵守这个游戏中的所有规则。
好了，先不管为什么不是“Open Source”的原因和可能的争论， 看看这个11M的软件包中有些什么，能干什么吧。(不喜欢翻译所以不翻译了,见谅)
The Shared Source CLI archive contains the following technologies in source code form:
l Compilers that work with the Shared Source CLI for C# (ECMA-334) and jscript
l Build environment tools (nmake, build, and others)
l Documentation for the implementation
l Test suites used to verify the implementation
There is a wealth of programming language technology in the Shared Source CLI. It is likely to be of interest to a wide audience, including:
l Developers interested in the internal workings of the .NET Framework can explore this implementation of the CLI to see how garbage collection works, JIT compilation and verification is handled, security protocols implemented, and the organization of frameworks and virtual object systems.
l Teachers and researchers doing work with advanced compiler technology. Research projects into language extensions, JIT optimizations, and modern garbage collection all have a basis in the Shared Source CLI. Modern compiler courses can be based on the C# or JScript languages implemented on the CLI.
l People developing their own CLI implementations will find the Shared Source CLI an indispensable guide and adjunct to the ECMA standards.
On Windows XP you will need:
l Visual Studio .NET
l perl 5.6 (available from http://www.perl.org)
l Archiving utility of choice – winzip or other
You will need FreeBSD 4.5 if you work with the Shared Source CLI on FreeBSD.
l 官方申明目前还不支持 Windows 2000 但已经有人尝试并运行成功：
I just built it on win2000 and ran the test suite (cd tests; rrun.pl).
Here are the results:
RRUN: Run time - 0h 36m 49s
RRUN: Processed - 1574
RRUN: Passed - 1574
RRUN: Failed - 0
l Shared Source CLI的代码名叫“Rotor”，你到新闻组和一些内部网站上可能会碰见它。
Points of interest in this directory:
· license.txt, licensed_file_list.txt, and license_banner_for_sources.txt
· env.bat, env.sh, and env.csh
· buildall and buildall.cmd
To build the Shared Source CLI, you must be running within a sh- or csh-flavored shell on FreeBSD, or a command window in Windows. The build procedure is detailed in this document, but to summarize, you first set up your environment by running one of the flavors of the env script, followed by running buildall. Note that through some filename and file peRmissions trickery, typing "buildall" on Windows will cause buildall.cmd to run, while typing it into a FreeBSD shell will cause the shell script named buildall to be run. The env scripts aren't quite as automagic -- on FreeBSD, depending on the shell that you favor, you will have to "source" either env.sh or env.csh; on Windows, you may just type env into a command window.
But wait! Before you go and build the CLI, first you should take a look at the license! The file named license.txt contains the Microsoft Shared Source CLI/JScript/C# License, which applies to this entire distribution. The file named licensed_file_list.txt contains the "bill of materials" for the distribution, and the file named license_banner_for_sources.txt is the copyright banner that is injected into most of the files found in this distribution. There are a few files in this distribution that are licensed under other licenses, and we have preserved the copyright and license notices for these.
This document resides in this directory, as well as a very useful index of all of the doc that is part of the distribution.
Within the pal subdirectory, we find two subdirectories, unix and win32. The "unix" directory contains the implementation of the FreeBSD pal (don't ask why it isn't named FreeBSD...) and, logically enough, the "win32" directory contains the Windows PAL. There is also an important header file, named rotor_pal.h, which declares all of the apis that a developer building a new PAL would have to implement. See the PAL Specification for more details on this topic.
The Win32 PAL is primarily an exercise in calling through to the underlying Win32 API after logging the call and sanity-checking parameter values in some cases, but the code for doing portable exception handling might be of interest.
The FreeBSD PAL, on the other hand, is a substantial piece of work. Mapping Win32 semantics onto BSD semantics is non-trivial, and a number of interesting (and possibly controversial :) design decisions lie within this directory. From Unicode support to exception handling to memory-mapped files to debugger support to sockets and file I/O, there is a lot to look at here.
In order to make life simpler for developers who wish to build new PAL implementations, some of the more generic or reusable implementation details have been broken into a separate library, called the PAL runtime. If you're not implementing a PAL, this directory still might be interesting -- it contains a number of odds and ends, including:
· Implementation of the com APIs used in Rotor
· Crypto code used to support stroNGNames and the runtime
· C runtime functions
· Math and decimal math routines
· Support for streaming over memory
· String, url, and pathname parsing and manipulation
· Configuration and resource loading
· Code used when calling from platform-native code to managed code
The PAL runtime is used by the FreeBSD PAL. Note the set of "cut down" windows header files in sscli/palrt/inc directory; these are included in order to pull in these API helpers. If you wish to implement a new PAL, you will probably want to use the same technique.
Once a PAL has been created, using the native tool chain for whatever platform is being built, a set of portable build tools are then built against the PAL. This is the bootstrap that enables the bulk of the build process; these tools use the PAL APIs to accomplish their work. Documentation for all of these tools can be found in the sscli/docs/buildtools directory; see in particular build.exe, binplace.exe, and nmake.exe.
Points of interest include these sub-directories:
· vm -- This directory has the bulk of the execution engine, including the garbage collector, the class loader, the type system, error reporting, Appdomains, Assemblies, delegate support, reflection, security, and the code manager. There are numerous interesting files to examine here. (For those curious about the build process, note that vm has a "dirs" file, but the "sources" file can be found in the vm/wks subdirectory.)
· utilcode -- This directory contains core routines used throughout the runtime, the tools, and the C# compiler. It includes code for path handling and parsing, array and hashtable management, C runtime routines, character case support, library and assembly loading, debugging and logging instrumentation, synchronization, as well as utility code for many miscellaneous tasks such as formatting, guid creation, error handling, and registry and config access.
· md -- This directory contains a metadata reader and writer.
· fjit -- The Rotor JIT compiler and its verifier can be found here.
· fusion -- Code that implements binding to assemblies, policy checking for the binding process, and the Global Assembly Cache can be found in the fusion directory.
· bcl -- C# code for the ECMA Base Class Libraries can be found in this directory. Most of the interesting code is in SSLi/sscli/clr/src/bcl/system">system and its sub-directories.
· debug -- This directory contains the source code for the managed code debugger (cordbg.exe).
· ilasm -- An assembler for the Common Intermediate Langauge.
· ildasm -- A very useful disassembler.
· tools -- This directory contains sources for the PEVerify utility, a managed code launch utility (clix.exe), a metadata dump utility (metainfo.exe), a reader/writer for managed debugger symbols, and numerous other utilities and tools.
· dlls -- This directory contains sub-directories for all of the native shared libraries that are linked as a part of the build process. Anyone wishing to build tools against these shared libraries may find the information in these directories useful.
Several sub-directories contain implementations of major namespaces, such as regular expression support, XML support, and networking. There is also some code for miscellaneous features in these directories.
These frameworks are not part of the BCL, but will be useful.
This JScript compiler is completely written in C#, so it is interesting both as an example of a large C# project and as an example of how to compile against the CLI intermediate language. The compiler uses the System.Reflection classes extensively in producing its managed executable output. JScript is also a very "dynamic" language, and as such, demonstrates many interesting compiler techniques for generating IL and runtime structures on the fly.
It contains a number of important things at this point, including the executables and shared libraries themselves, as well as your debugging symbols and the directory used as the Global Assembly Cache. (Note that some executables can be found in both the root directory, while others are in sdk/bin.)
Each target that you build (checked, fast-checked, or free) will have its own set of build subdirectories.
The tests directory contains a large number of small tests that can be used, once you have built the sources, to avoid regressions while modifying the code. The file rrun.pl is a perl driver (with useful comments embedded within it) that can be used to run the tests for the runtime itself, while the palsuite sub-directory contains tests for the FreeBSD PAL implementation.
(上面英文文章来自Rotor的 map.html, Microsoft版权所有 )
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/10752019/viewspace-977730/，如需转载，请注明出处，否则将追究法律责任。