📄 f2c.ps
字号:
%!PS%%Version: 3.3%%DocumentFonts: (atend)%%Pages: (atend)%%EndComments%% Version 3.3 prologue for troff files.%/#copies 1 store/aspectratio 1 def/formsperpage 1 def/landscape false def/linewidth .3 def/magnification 1 def/margin 0 def/orientation 0 def/resolution 720 def/rotation 1 def/xoffset 0 def/yoffset 0 def/roundpage true def/useclippath true def/pagebbox [0 0 612 792] def/R /Times-Roman def/I /Times-Italic def/B /Times-Bold def/BI /Times-BoldItalic def/H /Helvetica def/HI /Helvetica-Oblique def/HB /Helvetica-Bold def/HX /Helvetica-BoldOblique def/CW /Courier def/CO /Courier def/CI /Courier-Oblique def/CB /Courier-Bold def/CX /Courier-BoldOblique def/PA /Palatino-Roman def/PI /Palatino-Italic def/PB /Palatino-Bold def/PX /Palatino-BoldItalic def/Hr /Helvetica-Narrow def/Hi /Helvetica-Narrow-Oblique def/Hb /Helvetica-Narrow-Bold def/Hx /Helvetica-Narrow-BoldOblique def/KR /Bookman-Light def/KI /Bookman-LightItalic def/KB /Bookman-Demi def/KX /Bookman-DemiItalic def/AR /AvantGarde-Book def/AI /AvantGarde-BookOblique def/AB /AvantGarde-Demi def/AX /AvantGarde-DemiOblique def/NR /NewCenturySchlbk-Roman def/NI /NewCenturySchlbk-Italic def/NB /NewCenturySchlbk-Bold def/NX /NewCenturySchlbk-BoldItalic def/ZD /ZapfDingbats def/ZI /ZapfChancery-MediumItalic def/S /S def/S1 /S1 def/GR /Symbol def/inch {72 mul} bind def/min {2 copy gt {exch} if pop} bind def/setup { counttomark 2 idiv {def} repeat pop landscape {/orientation 90 orientation add def} if /scaling 72 resolution div def linewidth setlinewidth 1 setlinecap pagedimensions xcenter ycenter translate orientation rotation mul rotate width 2 div neg height 2 div translate xoffset inch yoffset inch neg translate margin 2 div dup neg translate magnification dup aspectratio mul scale scaling scaling scale /Symbol /S Sdefs cf /Times-Roman /S1 S1defs cf 0 0 moveto} def/pagedimensions { useclippath userdict /gotpagebbox known not and { /pagebbox [clippath pathbbox newpath] def roundpage currentdict /roundpagebbox known and {roundpagebbox} if } if pagebbox aload pop 4 -1 roll exch 4 1 roll 4 copy landscape {4 2 roll} if sub /width exch def sub /height exch def add 2 div /xcenter exch def add 2 div /ycenter exch def userdict /gotpagebbox true put} def/pagesetup { /page exch def currentdict /pagedict known currentdict page known and { page load pagedict exch get cvx exec } if} def/decodingdefs [ {counttomark 2 idiv {y moveto show} repeat} {neg /y exch def counttomark 2 idiv {y moveto show} repeat} {neg moveto {2 index stringwidth pop sub exch div 0 32 4 -1 roll widthshow} repeat} {neg moveto {spacewidth sub 0.0 32 4 -1 roll widthshow} repeat} {counttomark 2 idiv {y moveto show} repeat} {neg setfunnytext}] def/setdecoding {/t decodingdefs 3 -1 roll get bind def} bind def/w {neg moveto show} bind def/m {neg dup /y exch def moveto} bind def/done {/lastpage where {pop lastpage} if} def/f { dup /font exch def findfont exch dup /ptsize exch def scaling div dup /size exch def scalefont setfont linewidth ptsize mul scaling 10 mul div setlinewidth /spacewidth ( ) stringwidth pop def} bind def/changefont { /fontheight exch def /fontslant exch def currentfont [ 1 0 fontheight ptsize div fontslant sin mul fontslant cos div fontheight ptsize div 0 0 ] makefont setfont} bind def/sf {f} bind def/cf { dup length 2 idiv /entries exch def /chtab exch def /newfont exch def findfont dup length 1 add dict /newdict exch def {1 index /FID ne {newdict 3 1 roll put} {pop pop} ifelse} forall newdict /Metrics entries dict put newdict /Metrics get begin chtab aload pop 1 1 entries {pop def} for newfont newdict definefont pop end} bind def%% A few arrays used to adjust reference points and character widths in some% of the printer resident fonts. If square roots are too high try changing% the lines describing /radical and /radicalex to,%% /radical [0 -75 550 0]% /radicalex [-50 -75 500 0]%% Move braceleftbt a bit - default PostScript character is off a bit.%/Sdefs [ /bracketlefttp [201 500] /bracketleftbt [201 500] /bracketrighttp [-81 380] /bracketrightbt [-83 380] /braceleftbt [203 490] /bracketrightex [220 -125 500 0] /radical [0 0 550 0] /radicalex [-50 0 500 0] /parenleftex [-20 -170 0 0] /integral [100 -50 500 0] /infinity [10 -75 730 0]] def/S1defs [ /underscore [0 80 500 0] /endash [7 90 650 0]] def%% Tries to round clipping path dimensions, as stored in array pagebbox, so they% match one of the known sizes in the papersizes array. Lower left coordinates% are always set to 0.%/roundpagebbox { 7 dict begin /papersizes [8.5 inch 11 inch 14 inch 17 inch] def /mappapersize { /val exch def /slop .5 inch def /diff slop def /j 0 def 0 1 papersizes length 1 sub { /i exch def papersizes i get val sub abs dup diff le {/diff exch def /j i def} {pop} ifelse } for diff slop lt {papersizes j get} {val} ifelse } def pagebbox 0 0 put pagebbox 1 0 put pagebbox dup 2 get mappapersize 2 exch put pagebbox dup 3 get mappapersize 3 exch put end} bind def%%EndProlog%%BeginSetupmark/xoffset 0 def/yoffset 0 def/#copies 1 store/magnification 1 def%%FormsPerPage: 1/formsperpage 1 def/landscape false def/resolution 720 defsetup2 setdecoding%%EndSetup%%Page: 1 1/saveobj save defmark1 pagesetup10 R f(AT&T Bell Laboratories)2 993 1 2203 1560 t(Murray Hill, NJ 07974)3 916 1 2242 1680 t(Computing Science Technical Report No. 149)5 1848 1 1776 2853 t12 B f(A Fortran-to-C Converter)2 1343 1 2028 3147 t10 I f(S. I. Feldman)2 538 1 2406 3411 t10 S f(*)2944 3361 w10 I f(David M. Gay)2 568 1 2416 3531 t(Mark W. Maimone)2 751 1 2299 3651 t(\262)3050 3601 w(N. L. Schryer)2 533 1 2433 3771 t10 R f(Last updated October 15, 1991.)4 1259 1 2070 6231 t(Originally issued May 16, 1990.)4 1294 1 2053 6351 t10 S f(*)1440 6831 w10 R f(Bell Communications Research, Morristown, NJ 07960)5 2224 1 1490 6881 t(\262)1440 7011 w(Carnegie-Mellon University, Pittsburgh, PA 15213)4 2044 1 1490 7061 tcleartomarkshowpagesaveobj restore%%EndPage: 1 1%%Page: 1 2/saveobj save defmark2 pagesetup12 B f(A Fortran to C Converter)4 1323 1 2218 1220 t10 R f(S. I. Feldman)2 539 1 2610 1416 t10 I f(Bellcore)2711 1574 w(Morristown, NJ 07960)2 909 1 2425 1694 t10 R f(David M. Gay)2 574 1 2593 1890 t10 I f(AT&T Bell Laboratories)2 985 1 2387 2048 t(Murray Hill, New Jersey 07974)4 1268 1 2246 2168 t10 R f(Mark W. Maimone)2 768 1 2496 2364 t10 I f(Carnegie-Mellon University)1 1129 1 2315 2522 t(Pittsburgh, PA 15213)2 870 1 2445 2642 t10 R f(N. L. Schryer)2 543 1 2608 2838 t10 I f(AT&T Bell Laboratories)2 985 1 2387 2996 t(Murray Hill, New Jersey 07974)4 1268 1 2246 3116 t10 R f(ABSTRACT)2618 3389 w(We describe)1 500 1 1080 3623 t10 I f(f 2c)1 138 1 1610 3623 t10 R f( 77 into C or C++.)5 765(, a program that translates Fortran)5 1378 2 1748 3623 t10 I f(F 2c)1 163 1 3947 3623 t10 R f(lets one port-)2 539 1 4141 3623 t(ably mix C and Fortran and makes a large body of well-tested Fortran source code avail-)15 3600 1 1080 3743 t(able to C environments.)3 955 1 1080 3863 t10 B f(1. INTRODUCTION)1 900 1 720 4136 t10 R f( it is)2 177( Sometimes)1 497( desirable for several reasons.)4 1190( is)1 93( 11])1 149(Automatic conversion of Fortran 77 [1] to C [10,)8 1964 6 970 4302 t( At)1 150(useful to run a well-tested Fortran program on a machine that has a C compiler but no Fortran compiler.)18 4170 2 720 4422 t( things are impossible to express in Fortran 77 or)9 2002( Some)1 283( and Fortran.)2 523(other times, it is convenient to mix C)7 1512 4 720 4542 t( storage management, some character operations, arrays of)7 2396(are harder to express in Fortran than in C \(e.g.)9 1924 2 720 4662 t( pro-)1 206(functions, heterogeneous data structures, and calls that depend on the operating system\), and some)13 4114 2 720 4782 t( for carrying)2 502( is a large body of well tested Fortran source code)10 2020( There)1 285(grammers simply prefer C to Fortran.)5 1513 4 720 4902 t( desirable to exploit some of this Fortran)7 1743(out a wide variety of useful calculations, and it is sometimes)10 2577 2 720 5022 t( but the details vary)4 796( vendors provide some way of mixing C and Fortran,)9 2147( Many)1 286(source in a C environment.)4 1091 4 720 5142 t( a)1 87( Fortran to C conversion lets one create)7 1691( Automatic)1 489(from system to system.)3 979 4 720 5262 t10 I f(portable)4009 5262 w10 R f(C program that)2 641 1 4399 5262 t(exploits Fortran source code.)3 1159 1 720 5382 t10 R f( to C conversion is that it allows such tools as)10 1908(A side bene\256t of automatic Fortran 77)6 1568 2 970 5548 t10 I f(cyntax)4479 5548 w10 R f(\(1\) and)1 293 1 4747 5548 t10 I f(lint)720 5668 w10 R f( and portability checks that the)5 1289( to provide Fortran 77 programs with some of the consistency)10 2594(\(1\) [4])1 295 3 862 5668 t( consistency checks detect errors in calling)6 1851( The)1 228(Pfort Veri\256er [13] provided to Fortran 66 programs.)7 2241 3 720 5788 t(sequences and are thus a boon to debugging.)7 1780 1 720 5908 t10 R f(This paper describes)2 828 1 970 6074 t10 I f(f 2c)1 138 1 1828 6074 t10 R f(, a Fortran 77 to C converter based on Feldman's original)10 2344 1 1966 6074 t10 I f(f)4340 6074 w10 R f(77 compiler [6].)2 656 1 4384 6074 t(We have used)2 571 1 720 6194 t10 I f(f 2c)1 138 1 1322 6194 t10 R f( large programs and subroutine libraries to C automatically \(i.e., with)10 2816(to convert various)2 733 2 1491 6194 t(no manual intervention\); these include the)5 1714 1 720 6314 t8 R f(PORT3)2465 6314 w10 R f(subroutine library \()2 783 1 2742 6314 t8 R f(PORT1)3525 6314 w10 R f( MINOS)1 353( 8]\),)1 157(is described in [7,)3 728 3 3802 6314 t( \257oating-point test is of particular interest, as it relies heav-)10 2381( The)1 207([12], and Schryer's \257oating-point test [14].)5 1732 3 720 6434 t(ily on correct evaluation of parenthesized expressions and is bit-level self-testing.)10 3258 1 720 6554 t10 R f( compiled from the C produced)5 1256(As a debugging aid, we sought bit-level compatibility between objects)9 2814 2 970 6720 t(by)720 6840 w10 I f(f 2c)1 138 1 849 6840 t10 R f(and objects produced by our local)5 1370 1 1016 6840 t10 I f(f)2415 6840 w10 R f( we developed)2 582( is, on the VAX where)5 918( That)1 237(77 compiler.)1 509 4 2459 6840 t10 I f(f 2c)1 138 1 4733 6840 t10 R f(, we)1 169 1 4871 6840 t( been)1 222(sought to make it impossible to tell by running a Fortran program whether some of its modules had)17 4098 2 720 6960 t(compiled by)1 500 1 720 7080 t10 I f(f 2c)1 138 1 1248 7080 t10 R f(or all had been compiled by)5 1122 1 1413 7080 t10 I f(f)2562 7080 w10 R f( meant that)2 448(77. This)1 355 2 2606 7080 t10 I f(f 2c)1 138 1 3436 7080 t10 R f(should follow the same calling con-)5 1439 1 3601 7080 t(ventions as)1 447 1 720 7200 t10 I f(f)1192 7200 w10 R f(77 [6] and should use)4 860 1 1236 7200 t10 I f(f)2121 7200 w10 R f(77's support libraries,)2 874 1 2165 7200 t10 I f(libF77)3064 7200 w10 R f(and)3356 7200 w10 I f(libI77)3525 7200 w10 R f(.)3764 7200 w10 R f(October 8, 1991)2 646 1 2544 7560 tcleartomarkshowpagesaveobj restore%%EndPage: 1 2%%Page: 2 3/saveobj save defmark3 pagesetup10 R f(- 2 -)2 166 1 2797 480 t( to make)2 370(Although we have tried)3 976 2 970 840 t10 I f(f 2c)1 138 1 2354 840 t10 R f('s output reasonably readable, our goal of strict compatibility)8 2548 1 2492 840 t(with)720 960 w10 I f(f)942 960 w10 R f( statements, in particular, generally get)5 1645( Input/output)1 564(77 implies some nasty looking conversions.)5 1845 3 986 960 t( of calls on routines in)5 951(expanded into a series)3 917 2 720 1080 t10 I f(libI77)2625 1080 w10 R f(,)2864 1080 w10 I f(f)2926 1080 w10 R f( the C output of)4 676( Thus)1 262(77's I/O library.)2 670 3 2970 1080 t10 I f(f 2c)1 138 1 4615 1080 t10 R f(would)4790 1080 w( to maintain as C; it would be much more sensible to maintain the)13 2747(probably be something of a nightmare)5 1573 2 720 1200 t( commercial vendors, e.g., those listed in)6 1685( Some)1 286( it changed.)2 479(original Fortran, translating it anew each time)6 1870 4 720 1320 t( perform translations yielding C that one might reasonably maintain directly; these)11 3454(Appendix A, seek to)3 866 2 720 1440 t(translations generally require some manual intervention.)5 2252 1 720 1560 t10 R f( conventions used)2 718( 2 describes the interlanguage)4 1186( Section)1 350(The rest of this paper is organized as follows.)8 1816 4 970 1743 t(by)720 1863 w10 I f(f 2c)1 138 1 848 1863 t10 R f(\(and)1014 1863 w10 I f(f)1219 1863 w10 R f( summarizes some extensions to Fortran 77 that)7 1928(77\). \2473)1 311 2 1263 1863 t10 I f(f 2c)1 138 1 3529 1863 t10 R f( invocations)1 488(recognizes. Example)1 858 2 3694 1863 t(of)720 1983 w10 I f(f 2c)1 138 1 833 1983 t10 R f( illustrates various details of)4 1147( \2475)1 155(appear in \2474.)2 528 3 1001 1983 t10 I f(f 2c)1 138 1 2861 1983 t10 R f( issues.)1 295('s translations, and \2476 considers portability)5 1746 2 2999 1983 t(\2477 discusses the generation and use of)6 1555 1 720 2103 t10 I f(prototypes)2305 2103 w10 R f( and ANSI C compilers)4 954(, which can be used both by C++)7 1351 2 2735 2103 t(and by)1 279 1 720 2223 t10 I f(f 2c)1 138 1 1034 2223 t10 R f( describes our experience with an experimental)6 1938( \2478)1 160(to check consistency of calling sequences.)5 1735 3 1207 2223 t10 I f(f 2c)1 138 1 720 2343 t10 R f(service provided by)2 805 1 892 2343 t10 I f(netlib)1731 2343 w10 R f( A lists some vendors)4 893( Appendix)1 452([5], and \2479 considers possible extensions.)5 1702 3 1993 2343 t( B contains a)3 546( Appendix)1 427( Finally,)1 367(who offer conversion of Fortran to C that one might maintain as C.)12 2774 4 720 2463 t10 I f
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -