views:

308

answers:

2

I am interested in contributing something to mono whether it is a documentation or what ever. As a first step, I downloaded the source tree for going through the code. However, I thought if some one would've spend enough time to understand the project structure that would help everyone here. Any one point me out where the project structure is well explained?

NOTE: This is not a duplicate of question http://stackoverflow.com/questions/1655090/mono-source-code-walkthrough-tutorial, the answer to this question doesn't suffice my expectation.

+15  A: 

You should have checked out (subversion checkout URLs here):

  • trunk/libgdiplus

    This is a library used by System.Drawing.

  • trunk/mono

    This is what we call the Mono runtime. Contains mainly C source code. Under this directory you can find:

    • data/: a few configuration files for different version (1.x, 2.x,...).
    • msvc*/: Visual Studio solution files to build the Mono runtime.
    • libgc/: the Boehm Garbage Collector sources.
    • mono/: Mono runtime sources.
      • mini/: JIT source code
      • metadata/: these are almost all the functions used by the Mono runtime (marshaling, thread pool, socket I/O, file I/O, console I/O, application domains, GC, performance counters,...). It's more or less one C file each.
      • util: miscellaneous functions.
      • io-layer/: Win32 I/O emulation functions.
  • trunk/mcs

    This is where the C# compiler, the class libraries, class libraries tests and other tools are.

    • class/ : One folder per assembly. Each of them contains the source code for each assembly split in directories with the namespace name (ie, System/System.Configuration and so on) and usually a Test directory too. The only naming exception is mscorlib whose corresponding folder is called corlib.

      For example, if you want to see the source code for System.Net.HttpWebRequest, which is in the System.dll assembly, you go to trunk/mcs/class/System/System.Net and there shoould be a file named HttpWebRequest.cs containing the code you're looking for.

    • mcs/: the sources for the C# compilers (mcs, gmcs, smcs, dmcs...)

    • tools/: these are a bunch of tools used for development (sn, wsdl,...), documentation (monodoc), etc. Most of the tools names match the MS ones.

There are a lot more directories around, but those are where you should look for the C and C# code. Also, I suggested trunk for the checkout, since you will get the most up-to-date sources that way.

Gonzalo
+4  A: 

Gonzalo provided a good overview of the different modules.

Since you also mentioned wanting to contribute to documentation, you'll want a few more pieces of information.

First, Documentation is stored in XML files within mcs/class/[assembly]/Documentation/, e.g. mcs/class/corlib/Documentation. The intent is to support multiple human languages (though only English is currently being worked on), so within Documentation is a language directory, usually en. Within en there are ns-*.xml files, e.g. mcs/class/corlib/Documentation/en/ns-System.xml contains documentation for the System namespace. Also within en are "dotted namespace" directories, and within those are XML files, one per type, for example mcs/class/corlib/Documentation/en/System.Collections.Generic/IEnumerable`1.xml.

This is also outlined within the mdoc(5) documentation, in the FILE/DIRECTORY STRUCTURE section.

Once you've found the documentation, you need to know the XML format, which is also described in the mdoc(5) documentation, in the NamespaceName/TypeName.xml File Format section. The XML dialect used is a variant of the ECMA 335 XML documentation, changed to have one file per type (instead of all types within a single monolithic file). This is also a superset of C# XML documentation (see Annex E. Documentation Comments, page 487).

Finally, there's the question of adding new types/members to the mcs/class/[assembly]/Documentation directory. If you have Mono built, you can use the doc-update Makefile target. This will run the appropriate assembly through mdoc(1) and update the appropriate files within the Documentation directory.

If you have any other documentation questions, don't hesitate to ask on the mono-docs-list mailing list.

jonp