home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / fortran / 4920 < prev    next >
Encoding:
Text File  |  1993-01-06  |  4.6 KB  |  93 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!usc!cs.utexas.edu!sun-barr!ames!news.dfrf.nasa.gov!altair.dfrf.nasa.gov!maine
  3. From: maine@altair.dfrf.nasa.gov (Richard Maine)
  4. Subject: Re: A VMS Fortran I/O question
  5. In-Reply-To: michael@chpc.utexas.edu's message of Tue, 5 Jan 93 06:19:34 GMT
  6. Message-ID: <MAINE.93Jan5095028@altair.dfrf.nasa.gov>
  7. Sender: news@news.dfrf.nasa.gov (Usenet news)
  8. Organization: NASA Dryden, Edwards, Cal.
  9. References: <MARBY.93Jan2161438@laura.harvard.edu> <1993Jan3.040453.20688@chpc.utexas.edu>
  10.     <C0CGGB.1tE@news.cso.uiuc.edu> <1993Jan5.061934.15535@chpc.utexas.edu>
  11. Date: Tue, 5 Jan 1993 17:50:34 GMT
  12. Lines: 79
  13.  
  14. On Tue, 5 Jan 93 06:19:34 GMT, michael@chpc.utexas.edu (Michael Lemke) said:
  15.  
  16.          [... about carriage control interpretation...]
  17.  
  18. Michael> In either case you get a file which does not print propoerly
  19. Michael> without further action.  I am still waiting for an
  20. Michael> explanation if this Unix behavior is standard conform or not
  21. Michael> (sorry, I don't have a copy of the standard to check myself).
  22.  
  23. ISO/IEC 1551:1991 (aka Fortran 90):
  24.  
  25.   9.4.5 Printing of Formatted Records.  The transfer of information in a
  26.   formatted record to certain devices determined by the processor is called
  27.   printing.  If a formatted record is printed, the first character of the
  28.   record is not printed. ....
  29.  
  30.   The PRINT statement does not imply that printing will occur and the
  31.   WRITE statement does not imply that printing will not occur.
  32.  
  33. The same identical words appear in the f77 standard, section 12.9.5.2.3.
  34.  
  35. As with most issues relating to specific hardware (in this case a
  36. "printer"), the language standard avoids any attempt to define hardware
  37. characteristics.  This leaves the processor with quite a bit of
  38. latitude in determining what devices are "printers" and how the
  39. "transfer of information" to these devices is accomplished.  It would
  40. be perfectly valid for a processor to say that it has no "printers";
  41. indeed there are plenty of processors that don't have anything I'd
  42. call a printer.  It would also be valid for a processor to consider
  43. an interactive display screen to be a printer.  Also, it is valid for
  44. the "transfer of information" to the printer to involve running
  45. asa, nroff, whatever.  The Fortran standard certainly doesn't address
  46. such operating-system-dependent issues as whether you print a file by
  47. using the lpr command or whether you use a rodent to drag a file icon
  48. onto a printer icon.  Compared to this kind of difference, the distinction
  49. between using the lpr or asa commands is pretty trivial.
  50.  
  51. No I'm not particularly pleased with the resulting portability problems.
  52. But the standard is pretty explicit and is generally given more weight
  53. than my personal preferences. :-)  I'd have preferred some way of specifying
  54. in the open statement whether the file was to have carriage control
  55. interpretation.  Some systems have something like that, but the standard
  56. doesn't.
  57.  
  58. In my personal coding, I long ago gave up using any carriage control
  59. characters except for blank.  If I want to skip a line, I just print
  60. a blank line.  Overprinting doesn't work on too many devices anyway
  61. (notably terminal screens, which are sometimes considered "printers").
  62. I regretfully avoid top-of-page actions in most places, and when I
  63. do need it I make a small system-dependent subroutine for it so that
  64. I can change it as needed (sometimes writing a control-L, or whatever).
  65.  
  66. I put the blank carriage control on all files destined for human
  67. consumption (i.e. printing or displaying on a screen).  That way, if
  68. the carriage control does get interpreted, I'm fine.  If the
  69. carriage control just gets displayed, the only effect is that everything
  70. is shifted over one character to the right, which is seldom a big deal.
  71. On formatted files meant for data transfer to another program, I can't
  72. be quite so cavalier about whether the file is or isn't shifted over
  73. a character.  However, I haven't generally noticed systems trying
  74. to interpret carriage control characters on formatted files opened with
  75. standard default characteristics that aren't sent to some "device".
  76.  
  77. Michael> I don't know right now how you can affect `channel *' or PRINTs.
  78.  
  79. You can't in any portable way.  That's why I don't use them in
  80. substantial programs.  I will admit to using writes to unit "*" for
  81. "quickies" and for temporary diagnostics because it is so easy, but
  82. for big programs, I always use a unit number.  Even though the right
  83. number may be system dependent and may require a special open, that's
  84. a simple, easily isolated system dependency (of course, you use a
  85. parameter or variable instead of hardwiring a unit number in every
  86. write statement).
  87.  
  88. --
  89. --
  90. Richard Maine
  91. maine@altair.dfrf.nasa.gov
  92.  
  93.