OpenWatcom

Watfor is adequate for the class, but those doing research will probably want to use the full power of their computer.  Watcom developed much better code before its bankruptcy.  This was picked up and developed as open source code by SciTech Software, Inc.  It is available from
http://www.openwatcom.org

            Installation is relatively easy, click on the downloaded exe file and answer the questions.  One can run with the command line option, by simply copying the watcom directory to other machines with no installation needed.

            The IDE is worthwhile if you will be doing a lot of programming, but it is counter-intuitive for many of us and somewhat complex.

            I have only been able to make “Dos” graphics work so far ../gplot/WELCOME.htm - watcplot 

Helps

            These are in \watcom\binnt.  Click on fbooks.hlp to get a complete index of the fortran directions.  Click on cbooks.hlp to get a complete index of the C directions.  It is possible to mix C code with Fortran.  The directions are in “Programmers Guide help book”.  This is one of the easier ways to access “legacy” code in either language.  I recommend starting with

Open Watcom FORTRAN 77 User’ Guide – the second of the books. 

Watcom command line

To run in command mode, click on your “dos” or “command prompt”, then enter

            /watcom/setvars

If you have a lot of commercial programs, this could generate an “out of environment space”.  If it does, close the window.  Do properties on the prompt.  You will find that the initial environment space can be increased.  I recommend going to the maximum to see that it works and then going back to where there is just enough.  The setvars.bat command is the same as setvars.txt with a different extension.  This enables the command lines below to produce windows executables which run with a dos like screen for screen input and output.  The setdos.bat - setdos.txt – produces dos executables which when graphics are called for switch to full screen mode.  Use <alt> <enter> to get back to normal looking screens.  See WATCPLOT.htm for details about this.

WFL386

            This is the compiler and linker.  It produces an executable (filename1.exe) from a group of fortran (.for) files.  The command is

WFL386 [d:][path]filename1[.ext] [d:][path]filename2[.ext] … [options]

            WFL386  is the name of the 32-bit Open Watcom F77 compiler/linker

            If the .for on a filename is omitted, it is assumed.

Useful options

 

/DEB  --  generates some of the debugging that makes Watfor so useful – runtime traceback on array boundary errors –

/tr /d1  -- traces the errors and gives the linenumber at which execution errors occur

/FE=<fn>    name executable file (default is first filename)

 

/OH --  optimize the codes runtime at the expense of compile time

/OL+ -- optimize the do loops

/XFL --- extended floating point.  This does not give more accuracy to calculations.  What it does is to extend numbers in data statement to double precision accuracy even when the D0 is not present.

WFC386

            WFC386 is the Watcom 32 bit compiler.  It is called by WFL386 or directly as shown.  It treats only one fortran (.for) file at a time. If the .for on a filename is omitted, it is assumed.  It produces an object file with extension obj and a very useful error (.err) file.

WFC386 [d:][path]filename1[.ext] [options]

 

     Poly.for is one of my Unkfit files.  The command

WFC386 ..\..\fortran\POLY.FOR produces POLY.ERR[1]

..\..\fortran\POLY.FOR: *WRN* VA-05 in AUPKS, NAEFF is an unreferenced symbol[2]

..\..\fortran\POLY.FOR: *WRN* VA-05 in AUPKS, NAISOL is an unreferenced symbol

..\..\fortran\POLY.FOR: *WRN* SA-02 in AUPKS, COMMON block ABSFL must be saved in every subprogram in which it appears[3]

..\..\fortran\POLY.FOR: *WRN* VA-05 in POLYIS, NAEFF is an unreferenced symbol

..\..\fortran\POLY.FOR: *WRN* VA-05 in POLYIS, NAISOL is an unreferenced symbol

IDE

Setup

            The watcom ide icon is a picture of a hammer.  This is appropriate for an ex-builder.  If you have let watcom alter your system, go to the program list, left click on ide and make a shortcut on the desktop.

            I was reluctant to do this.   A direct shortcut to the ide will not work without this owing to the fact that paths and environmental variables have not been set. The file runide.bat - runide.txt [Runide.htm] is in my watcom directory.  This sets the appropriate paths and variables.  I have a shortcut to it on my desktop.  To get the proper icon, right click on the shortcut.  Request properties, then change icon.  Browse for the new one.  Go to \watcom\binnt\ide.exe.  The icon is in the executable, clicking on it puts it into the shortcut. 

            After setting up watcom, if the *.wpj files do not quite work, go to my computer, tools/folder options/file types.  Then find the extension wpj.  If this does not have

Watcom Ide “%1”  

Change it so that it does.  On my setup the “%1” was missing.  On an old windows 2000, I found that the added part needed to be “$1”, then on the newest windows xp professional it needed to be %1 without the quotes.  One warning the software needs to be fairly close to the top, in c:\systems and documents\my name\my documents\another name\cpp

I could not make the ide open to the correct file by clicking on it.  The problem is the “ “ in the file names.  Watcom uses these as delimiters and does not accept the “name name” as a single name.  The quote is not stripped out by watcom.

Usage

            The ide uses a name.wpj file to make a target.  When you start a new project the wpj name is requested, followed by the target name and the type.  Many of the types do not appear to work, but character-mode executable does.  A name.mk1 file is constructed from this which is essentially a makefile.  See - make.htm.  The sources that are entered appear as a list.  The file command allows a text editor to be set.  You can specify your favorite.  The default on windows is

\watcom\binnt\viw.exe

            By highlighting a source in the ide list, the editor is opened.  The line and column are at the bottom of the page.



[1] Your computer may not open this file type.  In windows, go to the file and click on it.  When the system asks set the open with file to notepad and click on the always open with square.  After that this will show properly.

[2] Unreferenced symbols are common in many codes.  They usually involve arguments that are not presently being used.  This warning is mostly harmless.

[3] This is an extremely important warning.  Newer computers use dynamic subroutines, in which all variables are re-set on each entry into the routine.  Older compilers and computers saved these variables so that they were always as the routine left them.  This is a potential source of error.  static_variables