Tcl/Tk Cookbook - Tcl/Tk and FORTRAN


Purpose

This chapter shows how to communicate and interact with a FORTRAN application via a Tk based user interface.

You will need

For this example you will require a F77 compiler. As before, Tcl/Tk scripts described elesewhere in the previous chapters are not elaborated again.

Dish to Serve Up

Create a simple fortran application to solve a quadratic equation. The coefficients are input via the Tk interface.

Recipe

Tk script for this example is ~cookbook/code/ch7/quads.tcl. The Corresponding FORTRAN code is ~cookbook/code/ch7/quads.f

  1. create the FORTRAN application for solving a quadratic equation
  2. create a simple Tk front-end for the application
  3. Set the communication channel between the application and its front-end

NAG F77 numerical library

A Tcl/Tk interface to the collection of example programs supplied with Numerical Algorithm Group's FORTRAN 77 library is under ~cookbook/code/NAG. This Tk application filters the NAG example routines according to the manual chapters, copies the example code into and the input data files to user's local directory. It allows the examples to be compiled and run and displays the results. Built-in interface supports browsing, editing, recompiling and reruning the example.

If you have access to NAG numerical library, you can download the compressed tar file nagex77.tar.Z. The NAG library is not included in the distribution, only its Tk interface. You will have to license that product separately if you do not already have access to it.