Home / Index | www.icosaedro.it | ![]() |
Last updated: 2007-09-24
These screen shots are from an installation of M2 under Microsoft Windows 98 on a Celeron 400 MHz PC with 64 MB of RAM. You will need to download these packages:
www.cygwin.com
.
Select the link "Install Cygwin now": this will download the installer.
www.hpl.hp.com/personal/Hans_Boehm/gc/
.
www.icosaedro.it/m2/download.html
.
M2 and the GC both needs a development system, including a C compiler, the "make" command, a text editor and a shell intepreter. All these tools are provided by Cygwin.
Start the setup program and choose a directory where to install,
like C:\cygwin
. Next, select the installation
from the network, and choose the packages you want. Ensure that
gcc-core and make be included. If you
forgot something, run the setup once more and add the missing packages.
If you need more help, here is the user guide of Cygwin: cygwin.com/cygwin-ug-net/cygwin-ug-net.html
.
Now copy the files of GC and M2 inside the home directory of the user
admin
, located in C:\cygwin\home\admin
.
Now you are ready to start Cygwin: double click on the icon Cygwin
created on the desktop by the setup program. Ensure all the files
of GC and M2 are there giving the command ls -l
:
If you choose to install the GC, give these commands inside the terminal of Cygwin:
$ tar xvzf gc* $ cd gc6.6 $ ./configure $ make $ make install
The GC can be installed also later if required. In this case the script "configure" of M2 (see below) must be re-run.
Give these commands inside the terminal of Cygwin:
$ cd $ tar xvzf m2* $ mv m2-1.1-20050315 m2 $ cd m2 $ ./configure $ make
It's very convenient the command m2
be available from
whatever directory you are in. This may be accomplished adding the path
of the script m2
to the variable PATH
in the
file .bash_profile
. Moreover, we need to define were the
M2 system is installed defining the envar M2_BASE
. To this
aim, give these commands inside the terminal:
$ cd $ echo 'export PATH=$PATH:$HOME/m2/bin' >> .bash_profile $ echo 'export M2_BASE=$HOME/m2' >> .bash_profile
Now close the terminal giving the command exit
and start a new one. We are ready to progam in M2.
Use whatever text editor you prefer. Mine is vim
,
but you can use Notepad or other more advanced text editors. Here
is the source of your first program:
Save this text into the file
C:\cygwin\home\admin\hello.mod
.
Please note that the name extension of the file is "mod", not "txt".
Return to the terminal to
compile and execute the program with the command:
$ m2 hello.mod -r
Here is what will appear into the screen:
(The strange .tar.tar
extension that appears in the figure above
is an artifact produced by Internet Explorer for some obscure reason while
saving the .tar.gz
package just downloaded. You can rename the
file if you want, anyhow that do not cares to the tar
command.)
Note that hello.mod
is the source, and
hello.exe
is the executable file. You may
run the program as many times you want giving the command
./hello.exe
.
To lear more about the Cygwin, read the user guide:
cygwin.com/cygwin-ug-net/cygwin-ug-net.html
.
Now you are ready to write more interesting programs. See the Reference of the language for a complete survey of its capabilities. This WEB site provide also a gallery of symple applications. Happy programming with M2!
Umberto Salsi | Comments | Contact | Site map | Home / Index |
Still no comments to this page. Use the Comments link above to add your contribute.