f2c.1t 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. . \" Definitions of F, L and LR for the benefit of systems
  2. . \" whose -man lacks them...
  3. .de F
  4. .nh
  5. .if n \%\&\\$1
  6. .if t \%\&\f(CW\\$1\fR
  7. .hy 14
  8. ..
  9. .de L
  10. .nh
  11. .if n \%`\\$1'
  12. .if t \%\&\f(CW\\$1\fR
  13. .hy 14
  14. ..
  15. .de LR
  16. .nh
  17. .if n \%`\\$1'\\$2
  18. .if t \%\&\f(CW\\$1\fR\\$2
  19. .hy 14
  20. ..
  21. .TH F2C 1
  22. .CT 1 prog_other
  23. .SH NAME
  24. f\^2c \(mi Convert Fortran 77 to C or C++
  25. .SH SYNOPSIS
  26. .B f\^2c
  27. [
  28. .I option ...
  29. ]
  30. .I file ...
  31. .SH DESCRIPTION
  32. .I F2c
  33. converts Fortran 77 source code in
  34. .I files
  35. with names ending in
  36. .L .f
  37. or
  38. .L .F
  39. to C (or C++) source files in the
  40. current directory, with
  41. .L .c
  42. substituted
  43. for the final
  44. .L .f
  45. or
  46. .LR .F .
  47. If no Fortran files are named,
  48. .I f\^2c
  49. reads Fortran from standard input and
  50. writes C on standard output.
  51. .I File
  52. names that end with
  53. .L .p
  54. or
  55. .L .P
  56. are taken to be prototype
  57. files, as produced by option
  58. .LR -P ,
  59. and are read first.
  60. .PP
  61. The following options have the same meaning as in
  62. .IR f\^77 (1).
  63. .TP
  64. .B -C
  65. Compile code to check that subscripts are within declared array bounds.
  66. .TP
  67. .B -I2
  68. Render INTEGER and LOGICAL as short,
  69. INTEGER\(**4 as long int. Assume the default \fIlibF77\fR
  70. and \fIlibI77\fR: allow only INTEGER\(**4 (and no LOGICAL)
  71. variables in INQUIREs. Option
  72. .L -I4
  73. confirms the default rendering of INTEGER as long int.
  74. .TP
  75. .B -onetrip
  76. Compile DO loops that are performed at least once if reached.
  77. (Fortran 77 DO loops are not performed at all if the upper limit is smaller than the lower limit.)
  78. .TP
  79. .B -U
  80. Honor the case of variable and external names. Fortran keywords must be in
  81. .I
  82. lower
  83. case.
  84. .TP
  85. .B -u
  86. Make the default type of a variable `undefined' rather than using the default Fortran rules.
  87. .TP
  88. .B -w
  89. Suppress all warning messages.
  90. If the option is
  91. .LR -w66 ,
  92. only Fortran 66 compatibility warnings are suppressed.
  93. .PP
  94. The following options are peculiar to
  95. .IR f\^2c .
  96. .TP
  97. .B -A
  98. Produce
  99. .SM ANSI
  100. C.
  101. Default is old-style C.
  102. .TP
  103. .B -a
  104. Make local variables automatic rather than static
  105. unless they appear in a
  106. .SM "DATA, EQUIVALENCE, NAMELIST,"
  107. or
  108. .SM SAVE
  109. statement.
  110. .TP
  111. .B -C++
  112. Output C++ code.
  113. .TP
  114. .B -c
  115. Include original Fortran source as comments.
  116. .TP
  117. .B -E
  118. Declare uninitialized
  119. .SM COMMON
  120. to be
  121. .B Extern
  122. (overridably defined in
  123. .F f2c.h
  124. as
  125. .B extern).
  126. .TP
  127. .B -ec
  128. Place uninitialized
  129. .SM COMMON
  130. blocks in separate files:
  131. .B COMMON /ABC/
  132. appears in file
  133. .BR abc_com.c .
  134. Option
  135. .LR -e1c
  136. bundles the separate files
  137. into the output file, with comments that give an unbundling
  138. .IR sed (1)
  139. script.
  140. .TP
  141. .B -ext
  142. Complain about
  143. .IR f\^77 (1)
  144. extensions.
  145. .TP
  146. .B -g
  147. Include original Fortran line numbers as comments.
  148. .TP
  149. .B -h
  150. Try to align character strings on word (or, if the option is
  151. .LR -hd ,
  152. on double-word) boundaries.
  153. .TP
  154. .B -i2
  155. Similar to
  156. .BR -I2 ,
  157. but assume a modified
  158. .I libF77
  159. and
  160. .I libI77
  161. (compiled with
  162. .BR -Df\^2c_i2 ),
  163. so
  164. .SM INTEGER
  165. and
  166. .SM LOGICAL
  167. variables may be assigned by
  168. .SM INQUIRE
  169. and array lengths are stored in short ints.
  170. .TP
  171. .B -kr
  172. Use temporary values to enforce Fortran expression evaluation
  173. where K&R (first edition) parenthesization rules allow rearrangement.
  174. If the option is
  175. .LR -krd ,
  176. use double precision temporaries even for single-precision operands.
  177. .TP
  178. .B -P
  179. Write a
  180. .IB file .P
  181. of ANSI (or C++) prototypes
  182. for procedures defined in each input
  183. .IB file .f
  184. or
  185. .IB file .F .
  186. When reading Fortran from standard input, write prototypes
  187. at the beginning of standard output.
  188. Implies
  189. .B -A
  190. unless option
  191. .L -C++
  192. is present. Option
  193. .B -Ps
  194. implies
  195. .B -P ,
  196. and gives exit status 4 if rerunning
  197. .I f\^2c
  198. may change prototypes or declarations.
  199. .TP
  200. .B -p
  201. Supply preprocessor definitions to make common-block members
  202. look like local variables.
  203. .TP
  204. .B -R
  205. Do not promote
  206. .SM REAL
  207. functions and operations to
  208. .SM DOUBLE PRECISION.
  209. Option
  210. .L -!R
  211. confirms the default, which imitates
  212. .IR f\^77 .
  213. .TP
  214. .B -r
  215. Cast values of REAL functions (including intrinsics) to REAL.
  216. .TP
  217. .B -r8
  218. Promote
  219. .SM REAL
  220. to
  221. .SM DOUBLE PRECISION, COMPLEX
  222. to
  223. .SM DOUBLE COMPLEX.
  224. .TP
  225. .BI -T dir
  226. Put temporary files in directory
  227. .I dir.
  228. .TP
  229. .B -w8
  230. Suppress warnings when
  231. .SM COMMON
  232. or
  233. .SM EQUIVALENCE
  234. forces odd-word alignment of doubles.
  235. .TP
  236. .BI -W n
  237. Assume
  238. .I n
  239. characters/word (default 4)
  240. when initializing numeric variables with character data.
  241. .TP
  242. .B -z
  243. Do not implicitly recognize
  244. .SM DOUBLE COMPLEX.
  245. .TP
  246. .B -!bs
  247. Do not recognize \fIb\fRack\fIs\fRlash escapes
  248. (\e", \e', \e0, \e\e, \eb, \ef, \en, \er, \et, \ev) in character strings.
  249. .TP
  250. .B -!c
  251. Inhibit C output, but produce
  252. .B -P
  253. output.
  254. .TP
  255. .B -!I
  256. Reject
  257. .B include
  258. statements.
  259. .TP
  260. .B -!it
  261. Don't infer types of untyped
  262. .SM EXTERNAL
  263. procedures from use as parameters to previously defined or prototyped
  264. procedures.
  265. .TP
  266. .B -!P
  267. Do not attempt to infer
  268. .SM ANSI
  269. or C++
  270. prototypes from usage.
  271. .PP
  272. The resulting C invokes the support routines of
  273. .IR f\^77 ;
  274. object code should be loaded by
  275. .I f\^77
  276. or with
  277. .IR ld (1)
  278. or
  279. .IR cc (1)
  280. options
  281. .BR "-lF77 -lI77 -lm" .
  282. Calling conventions
  283. are those of
  284. .IR f\&77 :
  285. see the reference below.
  286. .br
  287. .SH FILES
  288. .TP
  289. .IB file .[fF]
  290. input file
  291. .TP
  292. .B *.c
  293. output file
  294. .TP
  295. .F /usr/include/f2c.h
  296. header file
  297. .TP
  298. .F /usr/lib/libF77.a
  299. intrinsic function library
  300. .TP
  301. .F /usr/lib/libI77.a
  302. Fortran I/O library
  303. .TP
  304. .F /lib/libc.a
  305. C library, see section 3
  306. .SH "SEE ALSO"
  307. S. I. Feldman and
  308. P. J. Weinberger,
  309. `A Portable Fortran 77 Compiler',
  310. \fIUNIX Time Sharing System Programmer's Manual\fR,
  311. Tenth Edition, Volume 2, AT&T Bell Laboratories, 1990.
  312. .SH DIAGNOSTICS
  313. The diagnostics produced by
  314. .I f\^2c
  315. are intended to be
  316. self-explanatory.
  317. .SH BUGS
  318. Floating-point constant expressions are simplified in
  319. the floating-point arithmetic of the machine running
  320. .IR f\^2c ,
  321. so they are typically accurate to at most 16 or 17 decimal places.
  322. .br
  323. Untypable
  324. .SM EXTERNAL
  325. functions are declared
  326. .BR int .