X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=man%2Fcsharp.1;h=2f6497d2e90474e334264bcca4b53b5460f0f465;hb=eae326c71c117db0c492fef7d18a221d6644f44e;hp=bc28b03b1f441a576f4d639ac1e1c7ef40312307;hpb=2d38c973945f47676fe4bf65ad53ee74ac42e486;p=mono.git diff --git a/man/csharp.1 b/man/csharp.1 index bc28b03b1f4..2f6497d2e90 100644 --- a/man/csharp.1 +++ b/man/csharp.1 @@ -4,22 +4,44 @@ .. .TH csharp 1 "4 September 2008" .SH NAME -csharp \- Interactive C# Shell +csharp, gsharp \- Interactive C# Shell .SH SYNOPSIS -.B csharp +.B csharp [--attach PID] [file1 [file2]] [options] +.P +.B gsharp [file1 [file2]] .SH DESCRIPTION The .I csharp is an interactive C# shell that allows the user to enter and evaluate -C# statements and expressions from the command line. -.PP -This command is a shortcut to invoke the -.I gmcs -command with the -.I \-\- shell -command line option. All of the regular compiler options available -to gmcs are available in the interactive shell. +C# statements and expressions from the command line. The regular +.I mcs +command line options can be used in this version of the compiler. +.PP +The +.I gsharp +command is a GUI version of the C# interpreter that uses Gtk# and +provides an area to attach widgets as well. This version can be +attached to other Gtk# applications in a safe way as it injects itself +into the main loop of a Gtk# application, avoiding any problems +arising from the multi-threaded nature of injecting itself into a +target process. +.PP +Files specified in the command line will be loaded and executed as +scripts. +.SH OPTIONS +.TP +.I "\-\-attach" +This is an advanced option and should only be used if you have a deep +understanding of multi-threading. This option is availble on the +.I csharp +command and allows the compiler to be injected into other processes. +This is done by injecting the C# shell in a separate thread that runs +concurrently with your application. This means that you must take +special measures to avoid crashing the target application while using +it. For example, you might have to take the proper locks before +issuing any commands that might affect the target process state, or +sending commands through a method dispatcher. .SH OPERATION Once you launch the csharp command, you will be greeted with the interactive prompt: @@ -179,7 +201,8 @@ csharp> .SH INTERACTIVE EDITING The C# interactive shell contains a line-editor that provides a more advanced command line editing functionality than the operating system -provides. +provides. These are available in the command line version, the GUI +versions uses the standard Gtk# key bindings. .PP The command set is similar to many other applications (cursor keys) and incorporates some of the Emacs commands for editing as well as a @@ -249,6 +272,10 @@ statements and expressions are executed are static, they can be invoked directly from the shell. These are the available properties and methods: .TP +.I void LoadAssembly(string assembly) +Loads the given assembly. This is equivalent to passing the compiler +the -r: flag with the specified string. +.TP .I void LoadPackage(string package) Imports the package specified. This is equivalent to invoking the compiler with the -pkg: flag with the specified string. @@ -266,13 +293,40 @@ previous variable declarations, this is different than C# when compiled. .I void ShowUsing() Displays all the using statements in effect. +.I TimeSpan Time (Action a) +Handy routine to time the time that some code takes to execute. The +parameter is an Action delegate, and the return value is a TimeSpan. +For example: +.PP +.nf +csharp> Time (() => { for (int i = 0; i < 5; i++) Console.WriteLine (i);}); +0 +1 +2 +3 +4 +00:00:00.0043230 +csharp> +.fi +.PP +The return value is a TimeSpan, that you can store in a variable for +benchmarking purposes. +.SH GUI METHODS AND PROPERTIES +In addition to the methods and properties available in the console +version there are a handful of extra properties available on the GUI +version. For example a "PaneContainer" Gtk.Container is exposed that +you can use to host Gtk# widgets while prototyping or the "MainWindow" +property that gives you access to the current toplevel window. .SH STARTUP FILES -The C# shell will load all the C# script files and Mono assemblies -located in the ~/.config/csharp directory on Unix. C# script files -are files that have the extension .cs and they should only contain -statements and expressions, they can not contain full class -definitions (at least not as of Mono 2.0). Full class definitions -should be compiled into dlls and stored in that directory. +The C# shell will load all the Mono assemblies and C# script files +located in the ~/.config/csharp directory on Unix. The assemblies are +loaded before the source files are loaded. +.PP +C# script files are files +that have the extension .cs and they should only contain statements +and expressions, they can not contain full class definitions (at least +not as of Mono 2.0). Full class definitions should be compiled into +dlls and stored in that directory. .SH AUTHORS The Mono C# Compiler was written by Miguel de Icaza, Ravi Pratap, Martin Baulig, Marek Safar and Raja Harinath. The development was