- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've inherited an old F77 program that relied heavily on ANSI.SYS to perform all kinds of console screen magic. Older executables work fine, but now that I'm porting to Visual Fortran, I'm getting nowhere. The old F77 code has all kinds of bizarre escape sequences for cursor positioning, etc. and apparently they are only understood by ansi.sys. How do I get a new Visual Fortran program to work with ansi.sys? Do I have to include it somehow or add it to my project? I already tried simply adding ansi.sys to my project files and I get the same problems. By the way, everything compiles fine, but when it runs the console window is full of weird characters and the program halts without error/warning. Thanks.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had the same problem converting my old F77 code to F90. There are two solutions. One is to use a .com ansi screen driver such as dgansi.com that came with an old multitasking system called desqview. The .com form of the screen driver can be run from a DOS prompt prior to execution of your program. The escape sequences will then be interpreted correctly.
The second, and better (IMHO), is to rewrite the code using CVF output routines and then recompiling the code as a quickwin application. I have included some of my code below:
The second, and better (IMHO), is to rewrite the code using CVF output routines and then recompiling the code as a quickwin application. I have included some of my code below:
RECURSIVE SUBROUTINE SCREEN USE DFLIB; USE GEOMC; USE GLOBAL; USE GDAYC; USE SCREENC; USE SURFHE; USE TVDC; USE LOGICC; USE NAMESC ! Compaq Visual FORTRAN TYPE (WINDOWCONFIG) MyScreen(NWB) TYPE (RCCOORD) CurPos LOGICAL StatusMode ! Type declarations INTEGER :: STAT, ROWA, COLA, ROW !SW 10/15/00 INTEGER(I2) :: STATUS, XWIDTH, YHEIGHT INTEGER(I2), SAVE :: ZERO=0, ONE=1, TWO=2 INTEGER, SAVE :: NLINES=24 LOGICAL, SAVE :: DISTRIBUTED_TRIBS CHARACTER(10) :: CTIME CHARACTER(12) :: CDATE CHARACTER(64) :: TEXT RETURN ENTRY SCREEN_OPEN STAT = AboutBoxQQ ('CE-QUAL-W2 V3.1 - Developed by Tom Cole, WES and Scott Wells, PSU'C) !TC 3/9/01 WRITE (TEXT(1:49),'(A47,I2)') 'CE-QUAL-W2 V3.1 - Run parameters for waterbody ',JW OPEN (JW,FILE='user',TITLE=TEXT(1:49)) StatusMode = GetWindowConfig (MyScreen(JW)) ! Distributed tributaries DISTRIBUTED_TRIBS = .FALSE. DO JB=1,NBR IF (DIST_TRIBS(JB)) DISTRIBUTED_TRIBS = .TRUE. END DO ! initialize window CALL CLEAR_SCREEN CALL DATE_AND_TIME (CDATE,CTIME) XWIDTH = MyScreen(JW).NumXPixels YHEIGHT = MyScreen(JW).numYPixels STATUS = Rectangle ($GBORDER,ZERO,ZERO,XWIDTH,YHEIGHT) STATUS = FloodFill (XWIDTH/TWO,YHEIGHT/TWO,ONE) I = SetBkColorRGB (#FFFFFF) I = SetTextColor (ONE) ! Time related variables CALL XYLOC (2,1) CALL OUTTEXT ('Time Parameters') CALL XYLOC (2,3) CALL OUTTEXT ('[GDAY] = ,') CALL XYLOC (2,4) CALL OUTTEXT ('[JDAY] = ') CALL XYLOC (2,5)
and here is the xyloc routine:
ENTRY XYLOC (COLA,ROWA) CALL SetTextPosition (INT2(ROWA),INT2(COLA),CurPos) END SUBROUTINE SCREEN
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your old F77 program was a 16-bit DOS executable. Windows NT/2000 doesn't support ANSI.SYS for 32-bit executables - Visual Fortran has nothing to do with it.
We have come up with a library of "screen I/O" routines that may be useful to you. Unpack screenio.zip into your project folder and add the two files to your project. Add USE SCREENIO to the top of routines that want to call the screen routines - read the .f90 file for routine descriptions.
Steve
We have come up with a library of "screen I/O" routines that may be useful to you. Unpack screenio.zip into your project folder and add the two files to your project. Add USE SCREENIO to the top of routines that want to call the screen routines - read the .f90 file for routine descriptions.
Steve
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page