Dear Brad
(Is that your name?)
I too am a refugee from F77 and DOS.
I have a very large structural engineering project that I have been developing over many years. 8000 lines of code.
Since discovering Simply Fortran ('SF') I have set myself the task of
(1) porting my project to SF
(2) creating a GUI
(3) carrying out further development.
I had a bit of learning to do to get hang of SF. Well worth doing. What Jeff done as a front end to GNU F90 and the 'Insight' debugger is exceedingly good.
I then accomplished (1) almost immediately. The source code was all F77 and SF uses F90, of which F77 works fully in its original form, as a subset with a all the F90 improvements available as if they were extensions to F77.
For (2) my GUI, I have alighted on DISLIN. It is given away free by the author's generosity, for non-commercial use, and it is totally superb.
To solve your problem with your program not finding your input files, you can use the DISLIN statements, USE DISLIN nad CALL DWGFIL, as shown below.
THis brings up a Win Doze dilename requester dialog, in which you can enter a pathname by mouse-clicking.
USE DISLIN ! At start of your code
:
:
CALL DWGFIL('INPUT file name', FiNAME, '*.IN*')
IF ( LEN_TRIM(FiNAME).GT.0 ) THEN
C User has entered an input file name
C So attempt to open it
OPEN(UNIT=LUI,
+ FILE=FiNAME,
+ STATUS='OLD',
+ ERR=50,
+ IOSTAT=IOCODE )
C No ERR, so say so and set file-opened return value of LUI
C CALL DISP(0,FiNAME//' opened.',LEN(FiNAME)+8,0)
WRITE(LUS,'('' Input file opened:''/'' '',A)') FiNAME
LUI=LUISET
GO TO 60
50 CONTINUE
C Input filename entered but file not found and/or not opened
C Return a request to open the same filename as an echo file
C Set return value of LUI to LUK because input file-not-opened
WRITE(LUS,'(' Error code [',I4,'].',$)') IOCODE
ELSE
C User has not entered an input filename
LUI=LUK
60 END IF
I give at the end of this post the source code for a program I wrote as a DISLIN learning exercise. It doesn't do anything hugely useful, but it was a grat help to me in learning how to use DISLIN with SF.
Lastly, for program development, if you are accustomed only to Fortran for DOS then you are in for a hell of a treat. SF can do SOURCE LEVEL DEBUGGING.
You see you source code and step through it, watching the program execute, line by line, and watching the values of all program variables as they change.
I'll sign off now with (below) the example code for learning how to use DISLIN,
----
John
PROGRAM Roots
C -------------
C Example showing how to use DISLIN to greate a Fortran GUI
C Jmw
C 30-03-2011
C The concept is to display a window, with buttons, menus,
C input (fields) and output panel(s), and simply wait for the user
C to do stuff. The user enters data in input fields
C then activates various parts of the program by clicking buttons
C or selecting actions from pull-down menus.
C Each part of the program is executed in a subroutine, which always
C returns control to the user in the main top window.
USE dislin
IMPLICIT NONE
CHARACTER*8 aValu
CHARACTER*5 Header
INTEGER ipMain,ipTopM,ipTopL,ipTopR,ipBtmM,idMActs,idSqre,idSqRt,
+ idIN, idOUT, CALL1,CALL2,CALL3,CALL4,CALL5,CALL6, i
COMMON aValu, idIN, idOUT
EXTERNAL Square, SqRoot, CuRoot
aValu=' '
C-----------------------------------------------------------------------
C DESIGN THE MAIN WINDOW LAYOUT
C Size, position and title
CALL SWGWTH(24)
CALL SWGSIZ(408,420)
CALL SWGPOS(425,225)
Header='ROOTS'
Print*, Header
CALL SWGTIT(Header)
C Define main window ipMain, stacked vertically
CALL WGINI('VERT',ipmain)
C Divide the top area of ipMain, ipTopM, horizontally
CALL WGBAS(ipMain,'HORI',ipTopM)
C Define the L and R vertical stacks in ipTopM
CALL WGBAS(ipTopM,'VERT',ipTopL)
CALL WGBAS(ipTopM,'VERT',ipTopR)
C Repeatedly redefine ipMain's bottom area until far enough down
DO i=1,12
CALL WGBAS(ipmain,'HORI',ipBtmM)
END DO
C-----------------------------------------------------------------------
C Menus
C New menu
CALL WGPOP(ipmain,'Actions',idMActs)
C Menu entries
CALL WGAPP(idMActs,'Square',CALL1)
CALL SWGCBK(CALL1, SQUARE)
CALL WGAPP(idMActs,'SqRoot',CALL2)
CALL SWGCBK(CALL2, SQROOT)
CALL WGAPP(idMActs,'CuRoot',CALL3)
CALL SWGCBK(CALL3, CUROOT)
C Help menu
CALL SWGHLP('Enter a numeric value then|'//
+ 'click an action button, or|'//
+ 'select a menu action.')
C-----------------------------------------------------------------------
C Prompt, messages and data entry field - in the top area, LH stack
CALL WGLAB(ipTopL,'Simple JMW Fortran GUI example',i)
CALL WGLTXT(ipTopL,'Enter a value',aValu,48,idIN)
C-----------------------------------------------------------------------
C Buttons - in the top area, RH stack
CALL WGPBUT(ipTopR,'SQUARE',CALL4)
CALL SWGCBK(CALL4, SQUARE)
CALL WGPBUT(ipTopR,'SQROOT',CALL5)
CALL SWGCBK(CALL5, SQROOT)
CALL WGPBUT(ipTopR,'CuROOT',CALL6)
CALL SWGCBK(CALL6, CUROOT)
C-----------------------------------------------------------------------
C Output panel - in the bottom area
CALL SWGWTH(52)
CALL WGSTXT(ipBtmM,14,999,idOUT)
C-----------------------------------------------------------------------
C Activate
CALL WGFIN
C-----------------------------------------------------------------------
STOP
END
C-----------------------------------------------------------------------
SUBROUTINE SQUARE
USE dislin
IMPLICIT NONE
CHARACTER*8 aValu
CHARACTER*20 StringR
INTEGER idIN, idOUT
REAL Value
COMMON aValu, idIN, idOUT
C Read the keyboard input value from idIN
CALL GWGTXT(idIN,aValu)
CALL GWGFLT(idIN,Value)
C Run this part of the program
C (It would normally contain a lot more than this)
CALL SWGTXT(idOUT,
+ TRIM(aVALU)//' (squared) = '//
+ STRINGR(Value**2,'(F8.3)'))
RETURN
END
C-----------------------------------------------------------------------
SUBROUTINE SQROOT
USE dislin
IMPLICIT NONE
CHARACTER*8 aValu
CHARACTER*20 StringR
INTEGER idIN, idOUT
REAL Value
COMMON aValu, idIN, idOUT
C Read the keyboard input value from idIN
CALL GWGTXT(idIN,aValu)
CALL GWGFLT(idIN,Value)
C Run this part of the program
C (It would normally contain a lot more than this)
CALL SWGTXT(idOUT,
+ 'Square root ('//TRIM(aVALU)//') = '//
+ STRINGR(SQRT(Value),'(F8.3)'))
RETURN
END
C-----------------------------------------------------------------------
SUBROUTINE CUROOT
USE dislin
IMPLICIT NONE
CHARACTER*8 aValu
CHARACTER*20 StringR
INTEGER idIN, idOUT
REAL Value
COMMON aValu, idIN, idOUT
C Read the keyboard input value from idIN
CALL GWGTXT(idIN,aValu)
CALL GWGFLT(idIN,Value)
C Run this part of the program
C (It would normally contain a lot more than this)
CALL SWGTXT(idOUT,
+ 'Cube root ('//TRIM(aVALU)//') = '//
+ STRINGR(10**(LOG10(Value)/3),'(F8.3)'))
RETURN
END
C-----------------------------------------------------------------------
FUNCTION STRINGR(RValu,F)
C Returns real RValu as a string
C F is the format specification, such as '(F8.3)'
Character STRINGR*20, F*80
REAL RValu
WRITE(STRINGR,F) RValu
RETURN
END
C-----------------------------------------------------------------------