Call the TERMINAL routine to set up your workstation or terminal for using Penplot graphics. This routine supersedes the old VS100 and VT125 routines. From Fortran, the call is:
CALL TERMINAL()This will automatically produce a window on your screen if you are using an X workstation and your DISPLAY environment variable is properly set. If you are on a VT240 terminal, it will put the terminal into graphics mode.
On an X workstation, you may move the Penplot window by using the window manager, but you should not try to change the size of the window. Penplot expects the window to have a constant size. Resizing the window may cause your program to crash (and dump core) unexpectedly.
To flush output to the screen so that the picture will be visible, you should use the TSEND routine. Since output is buffered to the window, if you do not call TSEND, the window will remain empty until the buffer fills (at which point TSEND is called automatically). In Fortran, the call is:
CALL TSEND()If you call ENDPLT, the window will disappear. This may not be what you want, since the output will disappear before you have a chance to look at it. However, you must call ENDPLT at the end of your Penplot session to properly restore the terminal. The solution to this problem is to flush buffered output using TSEND and then execute a pause or a dummy read to force the machine to wait. After the wait, you can call ENDPLT to end the program. Here's an example:
CALL TSEND() READ*, VARIABLE CALL ENDPLT() STOP ENDWhen compiling your program, remember to link with the penplot and X libraries. The commands are:
attach X11 penplotNote that the X is a capital letter, and that the -lX11 option must be the last argument in the command. Here is a very simple Fortran program that uses Penplot to draw a circle on the screen:
f77 -c program.f
f77 program.o -lpenplot -lX11 -L/mit/penplot/`machtype`lib
C Sample Penplot program -- draws a circle C Set up Penplot for graphics CHARACTER*8 variable CALL terminal() CALL locate(5.0,95.0,5.0,95.0) CALL show(-200.,200.,-200.,200.) C Draw a 100 unit circle on the screen CALL pen(1) CALL move(100.0,0.0) DO 20 r = 0,6.5,.05 x= 100.0*cos(r) y= 100.0*sin(r) CALL draw(x,y) 20 CONTINUE C Flush buffered output CALL tsend() READ*, variable CALL ENDPLT() STOP END