-
Notifications
You must be signed in to change notification settings - Fork 0
/
f2c.ps
5342 lines (5314 loc) · 140 KB
/
f2c.ps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%!PS
%%Version: 3.3.1
%%DocumentFonts: (atend)
%%Pages: (atend)
%%EndComments
%
% Version 3.3.1 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
addmetrics
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
/addmetrics {
/Symbol /S null Sdefs cf
/Times-Roman /S1 StandardEncoding dup length array copy S1defs cf
} 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
/newencoding 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
newencoding type /arraytype eq {newdict /Encoding newencoding put} if
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
%%BeginSetup
mark
/landscape false def
/resolution 720 def
setup
2 setdecoding
%%EndSetup
%%Page: 1 1
/saveobj save def
mark
1 pagesetup
10 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 t
12 B f
(A Fortran-to-C Converter)2 1343 1 2028 3147 t
10 I f
(S. I. Feldman)2 538 1 2406 3411 t
10 S f
(*)2944 3361 w
10 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 t
10 R f
(Last updated March 22, 1995.)4 1198 1 2101 6231 t
(Originally issued May 16, 1990.)4 1294 1 2053 6351 t
10 S f
(*)1440 6831 w
10 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 t
cleartomark
showpage
saveobj restore
%%EndPage: 1 1
%%Page: 1 2
/saveobj save def
mark
2 pagesetup
12 B f
(A Fortran to C Converter)4 1323 1 2218 1220 t
10 R f
(S. I. Feldman)2 539 1 2610 1416 t
10 I f
(Bellcore)2711 1574 w
(Morristown, NJ 07960)2 909 1 2425 1694 t
10 R f
(David M. Gay)2 574 1 2593 1890 t
10 I f
(AT&T Bell Laboratories)2 985 1 2387 2048 t
(Murray Hill, New Jersey 07974)4 1268 1 2246 2168 t
10 R f
(Mark W. Maimone)2 768 1 2496 2364 t
10 I f
(Carnegie-Mellon University)1 1129 1 2315 2522 t
(Pittsburgh, PA 15213)2 870 1 2445 2642 t
10 R f
(N. L. Schryer)2 543 1 2608 2838 t
10 I f
(AT&T Bell Laboratories)2 985 1 2387 2996 t
(Murray Hill, New Jersey 07974)4 1268 1 2246 3116 t
10 R f
(ABSTRACT)2618 3389 w
(We describe)1 500 1 1080 3623 t
10 I f
(f 2c)1 138 1 1610 3623 t
10 R f
( 77 into C or C++.)5 765(, a program that translates Fortran)5 1378 2 1748 3623 t
10 I f
(F 2c)1 163 1 3947 3623 t
10 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 t
10 B f
(1. INTRODUCTION)1 900 1 720 4136 t
10 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 t
10 I f
(portable)4009 5262 w
10 R f
(C program that)2 641 1 4399 5262 t
(exploits Fortran source code.)3 1159 1 720 5382 t
10 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 t
10 I f
(cyntax)4479 5548 w
10 R f
(\(1\) and)1 293 1 4747 5548 t
10 I f
(lint)720 5668 w
10 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 t
10 R f
(This paper describes)2 828 1 970 6074 t
10 I f
(f 2c)1 138 1 1828 6074 t
10 R f
(, a Fortran 77 to C converter based on Feldman's original)10 2344 1 1966 6074 t
10 I f
(f)4340 6074 w
10 R f
(77 compiler [6].)2 656 1 4384 6074 t
(We have used)2 571 1 720 6194 t
10 I f
(f 2c)1 138 1 1322 6194 t
10 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 t
8 R f
(PORT3)2465 6314 w
10 R f
(subroutine library \()2 783 1 2742 6314 t
8 R f
(PORT1)3525 6314 w
10 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 t
10 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 w
10 I f
(f 2c)1 138 1 849 6840 t
10 R f
(and objects produced by our local)5 1370 1 1016 6840 t
10 I f
(f)2415 6840 w
10 R f
( we developed)2 582( is, on the VAX where)5 918( That)1 237(77 compiler.)1 509 4 2459 6840 t
10 I f
(f 2c)1 138 1 4733 6840 t
10 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 t
10 I f
(f 2c)1 138 1 1248 7080 t
10 R f
(or all had been compiled by)5 1122 1 1413 7080 t
10 I f
(f)2562 7080 w
10 R f
( meant that)2 448(77. This)1 355 2 2606 7080 t
10 I f
(f 2c)1 138 1 3436 7080 t
10 R f
(should follow the same calling con-)5 1439 1 3601 7080 t
(ventions as)1 447 1 720 7200 t
10 I f
(f)1192 7200 w
10 R f
(77 [6] and should use)4 860 1 1236 7200 t
10 I f
(f)2121 7200 w
10 R f
(77's support libraries,)2 874 1 2165 7200 t
10 I f
(libF77)3064 7200 w
10 R f
(and)3356 7200 w
10 I f
(libI77)3525 7200 w
10 R f
(.)3764 7200 w
10 R f
(March 22, 1995)2 635 1 2550 7560 t
cleartomark
showpage
saveobj restore
%%EndPage: 1 2
%%Page: 2 3
/saveobj save def
mark
3 pagesetup
10 R f
(- 2 -)2 166 1 2797 480 t
( to make)2 370(Although we have tried)3 976 2 970 840 t
10 I f
(f 2c)1 138 1 2354 840 t
10 R f
('s output reasonably readable, our goal of strict compatibility)8 2548 1 2492 840 t
(with)720 960 w
10 I f
(f)942 960 w
10 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 t
10 I f
(libI77)2625 1080 w
10 R f
(,)2864 1080 w
10 I f
(f)2926 1080 w
10 R f
( the C output of)4 676( Thus)1 262(77's I/O library.)2 670 3 2970 1080 t
10 I f
(f 2c)1 138 1 4615 1080 t
10 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 t
10 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 w
10 I f
(f 2c)1 138 1 848 1863 t
10 R f
(\(and)1014 1863 w
10 I f
(f)1219 1863 w
10 R f
( summarizes some extensions to Fortran 77 that)7 1928(77\). \2473)1 311 2 1263 1863 t
10 I f
(f 2c)1 138 1 3529 1863 t
10 R f
( invocations)1 488(recognizes. Example)1 858 2 3694 1863 t
(of)720 1983 w
10 I f
(f 2c)1 138 1 833 1983 t
10 R f
( illustrates various details of)4 1147( \2475)1 155(appear in \2474.)2 528 3 1001 1983 t
10 I f
(f 2c)1 138 1 2861 1983 t
10 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 t
10 I f
(prototypes)2305 2103 w
10 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 t
10 I f
(f 2c)1 138 1 1034 2223 t
10 R f
( describes our experience with an experimental)6 1938( \2478)1 160(to check consistency of calling sequences.)5 1735 3 1207 2223 t
10 I f
(f 2c)1 138 1 720 2343 t
10 R f
(service provided by)2 805 1 892 2343 t
10 I f
(netlib)1731 2343 w
10 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 t
10 I f
(man)4868 2463 w
10 R f
(page telling how to use)4 927 1 720 2583 t
10 I f
(f 2c)1 138 1 1672 2583 t
10 R f
(.)1810 2583 w
10 B f
(2. INTERLANGUAGE CONVENTIONS)2 1765 1 720 2915 t
10 R f
(Much of the material in this section is taken from [6].)10 2139 1 970 3098 t
10 B f
(Names)720 3430 w
10 R f
(An)970 3613 w
10 I f
(f 2c)1 138 1 1122 3613 t
10 R f
( \(until recently called Fortran 8x [2]\) is that long names are)11 2431(extension inspired by Fortran 90)4 1319 2 1290 3613 t
(allowed \()1 380 1 720 3733 t
10 I f
(f 2c)1 138 1 1100 3733 t
10 R f
( To)1 166( 50 characters\), and names may contain underscores.)7 2137(truncates names that are longer than)5 1468 3 1269 3733 t
( and with names that)4 875(avoid con\257ict with the names of library routines)7 2000 2 720 3853 t
10 I f
(f 2c)1 138 1 3632 3853 t
10 R f
(generates, Fortran names may)3 1233 1 3807 3853 t
( lower case \(unless the)4 967( names are forced to)4 876( Fortran)1 361(have one or two underscores appended.)5 1658 4 720 3973 t
10 CW f
(-U)4623 3973 w
10 R f
(option)4784 3973 w
( names of Fortran procedures and common)6 1767(described in Appendix B is in effect\); external names, i.e., the)10 2553 2 720 4093 t
( contain any underscores and have a pair of under-)9 2031(blocks, have a single underscore appended if they do not)9 2289 2 720 4213 t
( named)1 316( Fortran subroutines)2 853( Thus)1 274(scores appended if they do contain underscores.)6 2053 4 720 4333 t
10 CW f
(ABC)4266 4333 w
10 R f
(,)4446 4333 w
10 CW f
(A_B_C)4521 4333 w
10 R f
(, and)1 219 1 4821 4333 t
10 CW f
(A_B_C_)720 4453 w
10 R f
(result in C functions named)4 1105 1 1105 4453 t
10 CW f
(abc_)2235 4453 w
10 R f
(,)2475 4453 w
10 CW f
(a_b_c_ _)1 444 1 2525 4453 t
10 R f
(, and)1 194 1 2969 4453 t
10 CW f
(a_b_c_ _ _)2 528 1 3188 4453 t
10 R f
(.)3716 4453 w
10 B f
(Types)720 4785 w
10 R f
( use types)2 442(The table below shows corresponding Fortran and C declarations; the C declarations)11 3628 2 970 4968 t
(de\256ned in)1 414 1 720 5088 t
10 CW f
(f2c.h)1176 5088 w
10 R f
(, a header \256le upon which)5 1116 1 1476 5088 t
10 I f
(f 2c)1 138 1 2634 5088 t
10 R f
( table also shows the C types)6 1251( The)1 221( rely.)1 221('s translations)1 575 4 2772 5088 t
(de\256ned in the standard version of)5 1334 1 720 5208 t
10 CW f
(f2c.h)2079 5208 w
10 R f
(.)2379 5208 w
10 S f
(_ _______________________________________________________)1 2789 1 1485 5334 t
10 R f
( standard)1 948(Fortran C)1 1059 2 1757 5454 t
10 CW f
(f2c.h)3789 5454 w
10 R f
(integer)1535 5634 w
10 S f
(*)1812 5634 w
10 R f
( int x;)2 234( short)1 660( x;)1 103( shortint)1 742(2 x)1 125 5 1862 5634 t
( int x;)2 234( long)1 667( x;)1 103( integer)1 813(integer x)1 352 5 1535 5754 t
( int x;)2 234( long)1 635( int x;)2 234( long)1 719(logical x)1 347 5 1535 5874 t
( x;)1 103( \257oat)1 795( x;)1 103( real)1 813(real x)1 224 5 1535 5994 t
( x;)1 103( double)1 617( x;)1 103( doublereal)1 571(double precision x)2 738 5 1535 6114 t
( { \257oat r, i; } x;)6 616( struct)1 644( x;)1 103( complex)1 813(complex x)1 419 5 1535 6234 t
( { double r, i; } x;)6 710( struct)1 372( x;)1 103( doublecomplex)1 788(double complex x)2 716 5 1535 6354 t
(character)1535 6474 w
10 S f
(*)1899 6474 w
10 R f
( x[6];)1 219( char)1 650( x[6];)1 219( char)1 520(6 x)1 125 5 1949 6474 t
10 S f
( \347)1 -2789(_ _______________________________________________________)1 2789 2 1485 6494 t
(\347)1485 6434 w
(\347)1485 6334 w
(\347)1485 6234 w
(\347)1485 6134 w
(\347)1485 6034 w
(\347)1485 5934 w
(\347)1485 5834 w
(\347)1485 5734 w
(\347)1485 5634 w
(\347)1485 5534 w
(\347)1485 5434 w
(\347)4274 6494 w
(\347)4274 6434 w
(\347)4274 6334 w
(\347)4274 6234 w
(\347)4274 6134 w
(\347)4274 6034 w
(\347)4274 5934 w
(\347)4274 5834 w
(\347)4274 5734 w
(\347)4274 5634 w
(\347)4274 5534 w
(\347)4274 5434 w
10 R f
(By the rules of Fortran,)4 951 1 720 6720 t
10 CW f
(integer, logical,)1 990 1 1700 6720 t
10 R f
(and)2720 6720 w
10 CW f
(real)2894 6720 w
10 R f
(data occupy the same amount of memory, and)7 1876 1 3164 6720 t
10 CW f
(double precision)1 965 1 720 6840 t
10 R f
(and)1715 6840 w
10 CW f
(complex)1889 6840 w
10 R f
(occupy twice this amount;)3 1064 1 2339 6840 t
10 I f
(f 2c)1 138 1 3432 6840 t
10 R f
(assumes that the types in the C col-)7 1441 1 3599 6840 t
( \(in)1 151(umn above are chosen)3 931 2 720 6960 t
10 CW f
(f2c.h)1842 6960 w
10 R f
( translations of the Fortran)4 1120( The)1 220(\) so that these assumptions are valid.)6 1558 3 2142 6960 t
10 CW f
(equivalence)720 7080 w
10 R f
(and)1408 7080 w
10 CW f
(data)1580 7080 w
10 R f
( some machines, one must modify)5 1376( On)1 174(statements depend on these assumptions.)4 1643 3 1847 7080 t
10 CW f
(f2c.h)720 7200 w
10 R f
( \2476 for examples and further discussion.)6 1600( See)1 194(to make these assumptions hold.)4 1297 3 1045 7200 t
10 R f
(March 22, 1995)2 635 1 2550 7560 t
cleartomark
showpage
saveobj restore
%%EndPage: 2 3
%%Page: 3 4
/saveobj save def
mark
4 pagesetup
10 R f
(- 3 -)2 166 1 2797 480 t
10 B f
(Return Values)1 619 1 720 840 t
10 R f
(A function of type)3 753 1 970 998 t
10 CW f
(integer)1754 998 w
10 R f
(,)2174 998 w
10 CW f
(logical)2230 998 w
10 R f
(, or)1 139 1 2650 998 t
10 CW f
(double precision)1 966 1 2820 998 t
10 R f
(must be declared as a C func-)6 1222 1 3818 998 t
( the)1 148( If)1 117(tion that returns the corresponding type.)5 1603 3 720 1118 t
10 CW f
(-R)2613 1118 w
10 R f
(option is in effect \(see Appendix B\), the same is true of a)12 2282 1 2758 1118 t
(function of type)2 694 1 720 1238 t
10 CW f
(real)1467 1238 w
10 R f
(; otherwise, a)2 591 1 1707 1238 t
10 CW f
(real)2351 1238 w
10 R f
( as a C function that returns)6 1278(function must be declared)3 1118 2 2644 1238 t
10 CW f
(doublereal)720 1358 w
10 R f
(; this hack facilitates our VAX regression testing, as it duplicates the behavior of our local)15 3720 1 1320 1358 t
(Fortran compiler \()2 738 1 720 1478 t
10 I f
(f)1458 1478 w
10 R f
(77\). A)1 283 1 1502 1478 t
10 CW f
(complex)1814 1478 w
10 R f
(or)2263 1478 w
10 CW f
(double complex)1 844 1 2375 1478 t
10 R f
(function is equivalent to a C routine with an)8 1792 1 3248 1478 t
( Thus,)1 275(additional initial argument that points to the place where the return value is to be stored.)15 3518 2 720 1598 t
9 CW f
(complex function f\( . . . \))6 1458 1 1008 1761 t
10 R f
(is equivalent to)2 611 1 720 1944 t
9 CW f
(void f_\(temp, . . .\))4 1080 1 1008 2107 t
(complex)1008 2207 w
9 S f
(*)1440 2207 w
9 CW f
(temp;)1485 2207 w
(. . .)2 270 1 1062 2307 t
10 R f
( equivalent to a C routine with two extra initial arguments: a data address and)14 3110(A character-valued function is)3 1210 2 720 2490 t
( Thus,)1 275(a length.)1 344 2 720 2610 t
9 CW f
(character)1008 2773 w
9 S f
(*)1494 2773 w
9 CW f
(15 function g\( . . . \))6 1188 1 1539 2773 t
10 R f
(is equivalent to)2 611 1 720 2956 t
9 CW f
(g_\(result, length, . . .\))4 1350 1 1008 3119 t
(char)1008 3219 w
9 S f
(*)1278 3219 w
9 CW f
(result;)1323 3219 w
(ftnlen length;)1 756 1 1008 3319 t
(. . .)2 270 1 1062 3419 t
10 R f
(and could be invoked in C by)6 1177 1 720 3602 t
9 CW f
(char chars[15];)1 810 1 1008 3765 t
(. . .)2 270 1 1062 3865 t
(g_\(chars, 15L, . . . \);)5 1242 1 1008 3965 t
10 R f
(Subroutines are invoked as if they were)6 1598 1 720 4148 t
10 CW f
(int)2346 4148 w
10 R f
(-valued functions whose value speci\256es which alternate return)7 2514 1 2526 4148 t
( an)1 125( return arguments \(statement labels\) are not passed to the function, but are used to do)15 3499( Alternate)1 428(to use.)1 268 4 720 4268 t
( entry points with alternate return argu-)6 1617( the subroutine has no)4 905( \(If)1 156(indexed branch in the calling procedure.)5 1642 4 720 4388 t
( statement)1 408( The)1 205(ments, the returned value is unde\256ned.\))5 1578 3 720 4508 t
9 CW f
(call nret\()1 540 1 1008 4671 t
9 S f
(*)1548 4671 w
9 CW f
(1,)1593 4671 w
9 S f
(*)1755 4671 w
9 CW f
(2,)1800 4671 w
9 S f
(*)1962 4671 w
9 CW f
(3\))2007 4671 w
10 R f
(is treated exactly as if it were the Fortran computed)9 2054 1 720 4854 t
10 CW f
(goto)2799 4854 w
9 CW f
( \))1 108( nret\()1 378(goto \(1, 2, 3\),)3 810 3 1008 5017 t
10 B f
(Argument Lists)1 669 1 720 5262 t
10 R f
( addition, for every non-function argument that is of)8 2115( In)1 137( address.)1 353(All Fortran arguments are passed by)5 1465 4 970 5420 t
( string lengths are)3 728( \(The)1 243( length of the value is passed.)6 1209(type character, an argument giving the)5 1565 4 720 5540 t
10 CW f
(ftnlen)4495 5540 w
10 R f
(val-)4885 5540 w
(ues, i.e.,)1 335 1 720 5660 t
10 CW f
(long int)1 485 1 1085 5660 t
10 R f
( of arguments is: extra arguments)5 1364( summary, the order)3 819( In)1 138(quantities passed by value\).)3 1119 4 1600 5660 t
( function, and a)3 621(for complex and character functions, an address for each datum or)10 2649 2 720 5780 t
10 CW f
(ftnlen)4015 5780 w
10 R f
(for each charac-)2 640 1 4400 5780 t
( the call in)3 419( Thus,)1 275(ter argument \(other than character-valued functions\).)5 2110 3 720 5900 t
9 CW f
(external f)1 540 1 1008 6063 t
(character)1008 6163 w
9 S f
(*)1494 6163 w
9 CW f
(7 s)1 162 1 1539 6163 t
(integer b\(3\))1 648 1 1008 6263 t
(. . .)2 270 1 1062 6363 t
(call sam\(f, b\(2\), s\))3 1080 1 1008 6463 t
10 R f
(is equivalent to that in)4 889 1 720 6646 t
9 CW f
(int f\(\);)1 432 1 1008 6809 t
(char s[7];)1 540 1 1008 6909 t
(long int b[3];)2 756 1 1008 7009 t
(. . .)2 270 1 1062 7109 t
(sam_\(f, &b[1], s, 7L\);)3 1188 1 1008 7209 t
10 R f
(March 22, 1995)2 635 1 2550 7560 t
cleartomark
showpage
saveobj restore
%%EndPage: 3 4
%%Page: 4 5
/saveobj save def
mark
5 pagesetup
10 R f
(- 4 -)2 166 1 2797 480 t
( arrays begin at 1 by default.)6 1175(Note that the \256rst element of a C array always has subscript zero, but Fortran)14 3145 2 720 840 t
( whereas C arrays are stored in row-major order,)8 1983(Because Fortran arrays are stored in column-major order,)7 2337 2 720 960 t
10 I f
(f 2c)1 138 1 720 1080 t
10 R f
( arrays into one-dimensional C arrays and issues appropriate sub-)9 2681(translates multi-dimensional Fortran)2 1469 2 890 1080 t
(scripting expressions.)1 866 1 720 1200 t
10 B f
(3. EXTENSIONS TO FORTRAN 77)4 1560 1 720 1460 t
10 R f
(Since it is derived from)4 938 1 970 1622 t
10 I f
(f)1933 1622 w
10 R f
(77,)1977 1622 w
10 I f
(f 2c)1 138 1 2127 1622 t
10 R f
(supports all of the)3 719 1 2290 1622 t
10 I f
(f)3035 1622 w
10 R f
(77 extensions described in [6].)4 1227 1 3079 1622 t
10 I f
(F 2c)1 163 1 4357 1622 t
10 R f
('s extensions)1 520 1 4520 1622 t
(include the following.)2 880 1 720 1742 t
10 S f
(\267)720 1922 w
10 R f
(Type)791 1922 w
10 CW f
(double complex)1 854 1 1035 1922 t
10 R f
(\(alias)1928 1922 w
10 CW f
(complex*16)2183 1922 w
10 R f
(\) is a double-precision version of)5 1387 1 2783 1922 t
10 CW f
(complex)4209 1922 w
10 R f
(. Speci\256c)1 411 1 4629 1922 t
( for)1 148(intrinsic functions)1 733 2 791 2042 t
10 CW f
(double complex)1 847 1 1704 2042 t
10 R f
(have names that start with)4 1071 1 2583 2042 t
10 CW f
(z)3686 2042 w
10 R f
(rather than)1 436 1 3778 2042 t
10 CW f
(c)4246 2042 w
10 R f
( exception to)2 530(. An)1 204 2 4306 2042 t
(this rule is)2 425 1 791 2162 t
10 CW f
(dimag)1245 2162 w
10 R f
( of a)2 187(, which returns the imaginary part)5 1373 2 1545 2162 t
10 CW f
(double complex)1 845 1 3135 2162 t
10 R f
(value;)4010 2162 w
10 CW f
(imag)4284 2162 w
10 R f
(is the corre-)2 486 1 4554 2162 t
( generic intrinsic function)3 1035( The)1 207(sponding generic intrinsic function.)3 1430 3 791 2282 t
10 CW f
(real)3490 2282 w
10 R f
(is extended so that it returns the)6 1283 1 3757 2282 t
(real part of a)3 509 1 791 2402 t
10 CW f
(double complex)1 841 1 1326 2402 t
10 R f
(value as a)2 395 1 2193 2402 t
10 CW f
(double precision)1 961 1 2614 2402 t
10 R f
(value;)3601 2402 w
10 CW f
(dble)3871 2402 w
10 R f
(is the speci\256c intrinsic)3 903 1 4137 2402 t
(function that does this job.)4 1064 1 791 2522 t
10 S f
(\267)720 2702 w
10 R f
(The ``types'' that may appear in an)6 1425 1 791 2702 t
10 CW f
(implicit)2244 2702 w
10 R f
(statement include)1 705 1 2752 2702 t
10 CW f
(undefined)3485 2702 w
10 R f
( vari-)1 217(, which implies that)3 798 2 4025 2702 t
(ables whose names begin with the associated letters must be explicitly declared in a type statement.)15 4032 1 791 2822 t
10 I f
(F 2c)1 163 1 4877 2822 t
10 R f
(also recognizes the Fortran 90 statement)5 1611 1 791 2942 t
9 CW f
(implicit none)1 702 1 1008 3112 t
10 R f
(as equivalent to)2 627 1 791 3302 t
9 CW f
(implicit undefined\(a-z\))1 1242 1 1008 3472 t
10 R f
(The command-line option)2 1038 1 791 3662 t
10 CW f
(-u)1854 3662 w
10 R f
(has the effect of inserting)4 1014 1 1999 3662 t
9 CW f
(implicit none)1 702 1 1008 3832 t
10 R f
(at the beginning of each Fortran procedure.)6 1726 1 791 4022 t
10 S f
(\267)720 4202 w
10 R f
( themselves recursively, i.e., may call themselves either directly or indirectly through)11 3436(Procedures may call)2 813 2 791 4202 t
(a chain of other calls.)4 856 1 791 4322 t
10 S f
(\267)720 4502 w
10 R f
(The keywords)1 579 1 791 4502 t
10 CW f
(static)1406 4502 w
10 R f
(and)1802 4502 w
10 CW f
(automatic)1982 4502 w
10 R f
(act as ``types'' in type and implicit statements; they specify)9 2482 1 2558 4502 t
( of each)2 325( is exactly one copy)4 817( There)1 288(storage classes.)1 621 4 791 4622 t
10 CW f
(static)2872 4622 w
10 R f
(variable, and such variables retain their val-)6 1778 1 3262 4622 t
( of a)2 189( the other hand, each invocation)5 1300( On)1 177(ues between invocations of the procedure in which they appear.)9 2583 4 791 4742 t
(procedure gets new copies of the procedure's)6 1877 1 791 4862 t
10 CW f
(automatic)2705 4862 w
10 R f
(variables.)3282 4862 w
10 CW f
(Automatic)3729 4862 w
10 R f
(variables may not)2 734 1 4306 4862 t
(appear in)1 392 1 791 4982 t
10 CW f
(equivalence)1232 4982 w
10 R f
(,)1892 4982 w
10 CW f
(data)1967 4982 w
10 R f