fortran77

Strict fortran77 compiler? (or gfortran compiler flag)

你。 提交于 2019-12-01 22:01:03
问题 Is there any way to get gfortran to reject the f95 additions to Fortran 77? If not, is there another f77-only compiler available for unix systems? I've tried using the -std=legacy flag but that only seems to remove depreciation warnings from f77 programs; the f95 enhancements still work fine. 回答1: You can set fixed format with gfortran -ffixed-form -ffixed-line-length-none [sourcefiles] And this can actually make a difference (I have a program here where this changes the output!). I’m pretty

Strict fortran77 compiler? (or gfortran compiler flag)

走远了吗. 提交于 2019-12-01 20:03:24
Is there any way to get gfortran to reject the f95 additions to Fortran 77? If not, is there another f77-only compiler available for unix systems? I've tried using the -std=legacy flag but that only seems to remove depreciation warnings from f77 programs; the f95 enhancements still work fine. You can set fixed format with gfortran -ffixed-form -ffixed-line-length-none [sourcefiles] And this can actually make a difference (I have a program here where this changes the output!). I’m pretty sure that there are options, which disable at least most of the f95 features. 来源: https://stackoverflow.com

Invalid character in name at (1) with fixed-form source

房东的猫 提交于 2019-12-01 14:28:39
I am getting an eror "Invalid character in name at (1)" in my Fortran 77 program. Why is this? It is in my read statement 100 READ(S,*,END=200) LINE but I am not sure why Code: PROGRAM Exercise C C PARAMETERS C INTEGER UNUM PARAMETER (UNUM=15) C C LOCAL VARIABLES C REAL LINES C C FUNCTION DECLARATIONS C REAL NUMLIN C C COMMON VARIABLES C C C DATA STATEMENTS C C MAIN PROGRAM MODULE C OPEN(UNIT=UNUM, FILE = 'line.txt', STATUS='OLD') LINES=NUNMLIN(UNUM) C C Rewinding to the top of the file because the pointer is at the end C of the file C REWIND(UNUM) CLOSE(UNUM) CALL PROCES(UNUM,LINES) STOP END

Invalid character in name at (1) with fixed-form source

我与影子孤独终老i 提交于 2019-12-01 13:08:52
问题 I am getting an eror "Invalid character in name at (1)" in my Fortran 77 program. Why is this? It is in my read statement 100 READ(S,*,END=200) LINE but I am not sure why Code: PROGRAM Exercise C C PARAMETERS C INTEGER UNUM PARAMETER (UNUM=15) C C LOCAL VARIABLES C REAL LINES C C FUNCTION DECLARATIONS C REAL NUMLIN C C COMMON VARIABLES C C C DATA STATEMENTS C C MAIN PROGRAM MODULE C OPEN(UNIT=UNUM, FILE = 'line.txt', STATUS='OLD') LINES=NUNMLIN(UNUM) C C Rewinding to the top of the file

Include both .f and .F90 file in Fortran main file header

旧时模样 提交于 2019-11-29 16:24:13
I am using some F77 fixed format code with my F90 program. I am trying to include both kinds of code in my main program. Here's how I have arranged my code: Header files: File Name:include.inc include 'module_variables.F90' include 'message.F90' include 'module_common_functions.f90' include 'module_input_gdf.F90' ... Relavant LAPACK files File Name: lapack.inc include 'xerbla.f' include 'strsm.f' include 'slaswp.f' include 'sgetrs.f' include 'sgetrf.f' ... Now my main program looks like: include 'lapack.inc' include 'include.inc' program MDL_HydroD use module_variables use module_write_files

Opening a file on unit 5 or 6

夙愿已清 提交于 2019-11-29 12:11:31
I have a read/write operation going on in the Fortran code snippet as follows OPEN(5,FILE='WKDAT.dat', STATUS='OLD') OPEN(6,FILE='WKLST.dat', STATUS='UNKNOWN') I know that by default the unit number 5 is used for input from the keyboard and unit number 6 is used to display on the screen. Also I can use * . But in the above-mentioned Fortran code unit number is 5 and a file name "WKDAT.dat" is given. So this means that the data is being read from "WKDAT.dat" file. Also there is code unit number 6 and a file name "WKLST.dat" is given. So this means that the data is being written to "WKLST.dat"

pass fortran 77 function to C/C++

核能气质少年 提交于 2019-11-28 13:54:29
Is it possible to pass fortran 77 function as a callback function pointer to C/C++? if so, how? information I found on the web relates to fortran 90 and above, but my legacy code base is in 77. many thanks If it can be done in FORTRAN 77, it will be compiler and platform specific. The new ISO C Binding of Fortran 2003 provides a standard way of mixing Fortran and C, and any language that follows or can follow the calling conventions of C, such as C++. While formally a part of Fortran 2003, and while there are extremely few Fortran compilers that fully support the entirety of Fortran 2003, the

Fortran codes won't compile on Mac with gfortran

三世轮回 提交于 2019-11-28 12:14:48
问题 I recently moved from the SGI, Sun workstation environment to a Mac. SGI and Sun came with Fortran compilers so I have maybe 100 small f77 codes I wrote over the years for post-processing and analysis of simulated data. I was hoping to get these codes running on my iMac with gfortran. Most of these are very simple codes but I can't get them to compile and execute. I tried starting with the basics and wrote the Hello World code from a gfortran help page. My code, fortran.f is: program

Asterisks in Fortran: Syntax error in argument list at (1)

回眸只為那壹抹淺笑 提交于 2019-11-28 11:33:00
问题 In the following fortran77 code, there is this subroutine definition SUBROUTINE MSIRNS ( D , NOBST , N , X , R , RR , SURFT , , INOBSI , ISUR , IDELTS , IRELPS , , RNOBSI , RSUR , RDELTS , RRELPS , , OBSD , * , * ) what is the meaning of the two last arguments, asterisks? and how can I therefore call the function? I tried all these variants RES = CALL MSIRNS (D, NOBST, N, X, R, RR, SURFT, INOBSI, ISUR, IDELTS, IRELPS, RNOBSI, RSUR, RDELTS, RRELPS, OBSD, *, *) CALL MSIRNS (D, NOBST, N, X, R,

binary search efficiency vs. linear search efficiency in fortran

荒凉一梦 提交于 2019-11-28 10:11:12
This question is about the efficiency of a linear search vs. the efficiency of a binary search for a pre-sorted array in contiguous storage... I have an application written in fortran (77!). One frequent operation for my part of the code is to find the index in an array such that gx(i) <= xin < gx(i+1) . I've currently implemented this as a binary search -- sorry for the statement labels and goto -- I've commented what the equivalent statments would be using fortran 90... i=1 ih=nx/2 201 continue !do while (.true.) if((xin.le.gx(i)).and.(xin.gt.gx(i+1)))then !found what we want ilow=i+1; ihigh