HEARTEDC@UORHBV.BITNET (05/26/88)
I have a problem with the way VMS C reads and writes fortran carriage control files, and hope that someone can help me out. VMS C attempts to translate the carriage control information into C equivalents (a "1" in column 1 into a \f, etc.). I think it does a lousy job - but aside from that, I'd like it to skip the translation, so that I can worry about the details myself. Can anyone HELP???? Any ideas on how to have it skip the translation would be greatly appreciated. Thanks very much. Eric Carleen University of Rochester Medical Center Bitnet: HEARTEDC@UORHBV
LEICHTER@VENUS.YCC.YALE.EDU ("Jerry Leichter ", LEICHTER-JERRY@CS.YALE.EDU) (05/27/88)
I have a problem with the way VMS C reads and writes fortran carriage control files, and hope that someone can help me out. VMS C attempts to translate the carriage control information into C equivalents (a "1" in column 1 into a \f, etc.). I think it does a lousy job - but aside from that, I'd like it to skip the translation, so that I can worry about the details myself. Try fopen(file,mode,"ctx=nocvt"). (Described in Table 4-1 of the VAX C Run-Time Library Reference Manual.) -- Jerry
HEARTEDC%UORHBV.BITNET%CORNELLC.CCS.CORNELL.EDU%KL.SRI.COM%lbl%sfsu1.hepnet@LBL.GOV (05/28/88)
Received: from KL.SRI.COM by LBL.Gov with INTERNET ; Fri, 27 May 88 02:46:49 PDT Received: from CORNELLC.CCS.CORNELL.EDU by KL.SRI.COM with TCP; Wed 25 May 88 12:17:08-PDT Received: from UORHBV.BITNET by CORNELLC.CCS.CORNELL.EDU ; Wed, 25 May 88 15:16:50 EDT Date: Wed, 25 May 88 13:20 EST From: <HEARTEDC%UORHBV.BITNET@CORNELLC.CCS.CORNELL.EDU> Subject: VMS C reading fortran files To: info-vax@kl.sri.com X-Original-To: info-vax@kl.sri.com, HEARTEDC I have a problem with the way VMS C reads and writes fortran carriage control files, and hope that someone can help me out. VMS C attempts to translate the carriage control information into C equivalents (a "1" in column 1 into a \f, etc.). I think it does a lousy job - but aside from that, I'd like it to skip the translation, so that I can worry about the details myself. Can anyone HELP???? Any ideas on how to have it skip the translation would be greatly appreciated. Thanks very much. Eric Carleen University of Rochester Medical Center Bitnet: HEARTEDC@UORHBV
scjones@sdrc.UUCP (Larry Jones) (05/28/88)
In article <8805271004.AA15064@ucbvax.Berkeley.EDU>, HEARTEDC@UORHBV.BITNET writes: > > I have a problem with the way VMS C reads and writes fortran carriage > control files, and hope that someone can help me out. > > VMS C attempts to translate the carriage control information into C > equivalents (a "1" in column 1 into a \f, etc.). I think it does a > lousy job - but aside from that, I'd like it to skip the translation, > so that I can worry about the details myself. Well, firstly I have to disagree with you - VAX C does a fantastic job of converting FORTRAN carriage control into instream controls. (Or at least is has since V2.0 when they fixed the problems V1.0 had. I don't recall whether they ever fixed the documentation or not, though.) In any event, if you insist on doing the translations yourself, there are some options you can use when you open the file. If you use a mode of "rb" instead of "r" the library will not do any carriage control mappings at all. This may still be a problem since there aren't any newlines to mark record boundaries, but some of the library functions (fgets?) won't read more than a single record so you can use them to get a record at a time and then do your own translations. There are also additional arguments that can be specified on the open to set various RMS parameters and control the library behaviour - check the documentation for "open". ---- Larry Jones UUCP: ...!sdrc!scjones SDRC AT&T: (513) 576-2070 2000 Eastman Dr. BIX: ltl Milford, OH 45150 "When all else fails, read the directions."
sloane@UKANVAX.BITNET (Bob Sloane) (06/06/88)
I agree that C under VMS has problems with fortran carriage control files. First, if the first line of the file starts with a blank, C will return a newline immediatly. This is not how this sequence is supposed to be interpreted. Also, every line in a file will have a Carriage return appended to the end of it. I beleive this is contrary to the way C handles files and records in general. I think that reading a fortran carriage control file should return EXACTLY the same steam of characters as reading a file that was CONVERTed to a variable length, carriage return carriage control file. This is not the way C does it. Bob Sloane University of Kansas Computer Center (913) 864-0444 SLOANE@UKANVAX.BITNET SLOANE@KUHUB.CC.UKANS.EDU
SIT.BUSH@CU20B.CC.COLUMBIA.EDU (Nick Bush) (06/08/88)
>I agree that C under VMS has problems with fortran carriage control >files. First, if the first line of the file starts with a blank, C >will return a newline immediatly. This is not how this sequence is >supposed to be interpreted. Also, every line in a file will have a >Carriage return appended to the end of it. I beleive this is contrary >to the way C handles files and records in general. I think that >reading a fortran carriage control file should return EXACTLY the >same steam of characters as reading a file that was CONVERTed to >a variable length, carriage return carriage control file. This is >not the way C does it. It sounds like VAX C is converting the carriage control exactly as it should to match the definition of FORTRAN carriage control. Note that it is not necessarily the conversion most people expect. We ran into this when implementing FORTRAN carriage control conversion for VMS Kermit. The definition of FORTRAN carriage control given in the VAX RMS Reference Manual on page 5-23 indicates that a blank in the carriage control column indicates that when printed the record should be *preceded* by a line feed and followed by a carriage return. This is not what most people expect, but it is the only definition of FORTRAN carriage control I know of that allows it to actually match the characteristics implied by the FORTRAN '77 standard. - Nick Bush Sterling-Winthrop Research Institute Rensselaer, NY 12144 SIT.BUSH@CU20B.CC.COLUMBIA.EDU (Internet) SIT.BUSH@CU20B (BITNET) -------
SIT.BUSH@CU20B.CC.COLUMBIA.EDU (Nick Bush) (06/13/88)
>While I don't have a copy of the FORTRAN 77 standard at hand, I doubt that >it specifies that a program that writes output to a printer with blanks >in column 1 should skip the first line on the first page. If it does, >then CONVERT, TYPE and several other utilities on VMS interpret FORTRAN >Carriage Control incorrectly. One of the problems with FORTRAN carriage control is that most definitions of it do not talk about the two boundary conditions: the first and last records of the file. Certinaly the FORTRAN 77 standard does not require that a blank in the first column of the first record means that the output should be preceded by a blank line. However, given that the carriage control character does specify the carriage control to be used before and after the record makes it "reasonable" to interpret the standard this way. Note that as far as I know, every VAX/VMS application that has attempted to interpret FORTRAN carriage control to require the initial blank line has gotten lots of complaints and has ended up putting in the special case for the first line. So, certainly an SPR on VAX C is reasonable to get it to agree with other interpreters of FORTRAN carriage control. - Nick Bush -------
sloane@UKANVAX.BITNET (Bob Sloane) (06/14/88)
>>I agree that C under VMS has problems with fortran carriage control >>files. First, if the first line of the file starts with a blank, C >>will return a newline immediatly. ... >It sounds like VAX C is converting the carriage control exactly as it should >to match the definition of FORTRAN carriage control. Note that it is not >necessarily the conversion most people expect. We ran into this when >implementing FORTRAN carriage control conversion for VMS Kermit. The >definition of FORTRAN carriage control given in the VAX RMS Reference Manual >on page 5-23 indicates that a blank in the carriage control column indicates >that when printed the record should be *preceded* by a line feed and >followed by a carriage return. This is not what most people expect, but it >is the only definition of FORTRAN carriage control I know of that allows it >to actually match the characteristics implied by the FORTRAN '77 standard. >- Nick Bush Interesting. I looked up the manual reference and Nick is correct. On page 5-22 it also gives the definition of Carriage Return Carriage Control, which says the same thing as single space Carriage Control in FORTRAN. Unfortunately, Carriage Return Carriage Control is not interpreted according to the manual. Suppose I do the following: $ ver='f$verify(1)' $ create testfort.c ! write a short test program #include <stdio.h> /* get the standard defs */ main() /* start of main routine */ { char str[80]; /* buffer to read string */ while ( fgets( str, sizeof(str)-1, stdin ) != NULL ) /* copy stdin */ fputs( str, stdout ); /* to stdout */ } $ cc testfort ! compile test program $ link testfort,sys$library:vaxcrtl/lib ! link test program $ convert/fdl=sys$input testfort.c forttest.c ! make a FORTRAN CC file RECORD CARRIAGE_CONTROL fortran $ define/user sys$input testfort.c ! use CR CC file as stdin $ run testfort $ define/user sys$input forttest.c ! use FORTRAN CC file $ run testfort $ ver='v$verify(ver)' I would expect the output of the 2 runs of the program to be identical, since the ONLY difference between the input files is the CARRIAGE_CONTROL attribute. They are NOT the same. There is a blank line at the start of the FORTRAN Carriage Control file. Since this file was created by CONVERT, it seems obvious that CONVERT and C are treating Carriage Control differently. While I don't have a copy of the FORTRAN 77 standard at hand, I doubt that it specifies that a program that writes output to a printer with blanks in column 1 should skip the first line on the first page. If it does, then CONVERT, TYPE and several other utilities on VMS interpret FORTRAN Carriage Control incorrectly. Bob Sloane University of Kansas Computer Center (913) 864-0444 SLOANE@UKANVAX.BITNET SLOANE@KUHUB.CC.UKANS.EDU