Produttore : HP
File Size : 484.06 kb
File Nome :
|
da questo dispositivo ha anche altre istruzioni :
Facilità d'uso
Calling Other Languages
Comparing HP C and HP FORTRAN 77
3. HP FORTRAN 77 passes strings as parameters using string descriptors corresponding
to the following HP C declarations:
char *char_string;
/* points to string */
int len;
/* length of string */
4. HP C stores arrays in row-major order, whereas HP FORTRAN 77 stores arrays in
column-major order. The lower bound for HP C is always zero; for HP FORTRAN 77,
the default lower bound is 1.
5. HP C terminates character strings with a null byte, while HP FORTRAN 77 does not.
6. The size is equal to the size of all members plus any padding needed for the alignment.
(See Chapter 2 for details on alignment.) The alignment is that of the member with the
strictest alignment requirement.
7. HP C and HP FORTRAN 77 do not share a common definition of true or false. In HP
FORTRAN 77, logical values are determined by the low-order bit of the high-order byte.
If this bit is 1, the logical value is .TRUE., and if the bit is zero, the logical value is
.FALSE.. HP C interprets nonzero value as true and interprets zero as false.
Mixing C and FORTRAN File I/O
A FORTRAN unit cannot be passed to a C routine to perform I/O on the associated file. Nor
can a C file pointer be used by a FORTRAN routine. However, a file created by a program
written in either language can be used by a program of the other language if the file is
declared and opened within the latter program. C accesses the file using I/O subroutines
and intrinsics. This method of file access can also be used from FORTRAN instead of
FORTRAN I/O.
Be aware that HP FORTRAN 77 on HP 9000 Series 700/800 computers using HP-UX uses
the unbuffered I/O system calls read and write (described in the HP-UX Reference
manual) for all terminal I/O, magnetic tape I/O, and direct access I/O. It uses the system
calls fread and fwrite for all other I/O. This can cause problems in programs that mix C
and FORTRAN I/O. In particular, C programs that use stdio(3S) output procedures such
as printf and fwrite and FORTRAN output statements must flush stdio buffers (by
calling the libc function fflush) if they are in use before returning to FORTRAN output
or the I/O may be asynchronous (if the library is using write).
Mixing FORTRAN direct, terminal, or tape READ statements with stdio
fread input results in the FORTRAN READ commencing from the beginning of the next
block after the contents of the buffer, not from the current position of the input cursor in
the fread buffer. The same situation in reverse may occur by mixing read with a
FORTRAN sequential disc read. You can avoid these problems by using only the read and
write calls in the C program that the FORTRAN I/O library uses.
Passing Parameters Between HP C and HP FORTRAN 77
All parameters in HP FORTRAN 77 are passed by reference. This means that all
arguments in an HP C call to an HP FORTRAN 77 routine must be pointers. In addition,
all parameters in an HP C routine called from HP FORTRAN 77 must be pointers, unless
the HP FORTRAN 77 code uses the $ALIAS directive to define the parameters as value
parameters. Refer to the example called "HP FORTRAN 77 Nested Structure" later in this
56
Chapter 3
... Questo manuale è adatto anche per i modelli :
Software - MPE/iX 6.5 Operating System (484.06 kb)
Software - MPE/iX 7.0 Operating System (484.06 kb)
Software - MPE/iX 7.5 Operating System (484.06 kb)