CM FORTRAN LIBRARIES REFERENCE MANUAL Version 2.1, January 1994 Copyright (c) 1994 Thinking Machines Corporation. CHAPTER 9: CMF77 LIBRARY ************************* The library libcmf77.a provides an interface to OS system calls, comparable to Sun Microsystems' library libF77.a. The library requires no special header (include) file or explicit linking. The CM Fortran library contains: ACCESS GETENV LOC ALARM GETFD LSTAT CHDIR GETGID LTIME CHMOD GETLOG PERROR CTIME GETPID QSORT DRAND GETUID RAND DTIME GMTIME RENAME ETIME HOSTNM RINDEX EXIT IARGC SIGNAL FDATE IDATE SLEEP FFREE IERRNO STAT FLUSH IRAND SYMLNK FMALLOC ITIME SYSTEM FORK KILL TIME GERROR LINK UNLINK GETARG LNBLNK WAIT GETCWD All these procedures have on-line man pages. To avoid name conflicts with the Sun man pages, specify the name in uppercase to the man or cmman command. 9.1 COMPARISON WITH SUN'S F77 LIBRARY -------------------------------------- There are a few differences between the contents of libcmf77.a and Sun's libF77.a. o Sun's library includes the functions INDEX and LEN. These are intrinsic functions in CM Fortran (not library functions in libcmf77.a). They are described in the CM Fortran Language Reference Manual, and their man pages are available on-line. o The CM Fortran library libcmf77.a does include RINDEX and LNBLNK, and CM Fortran provides separate man pages for them. 9.2 MANAGING FRONT-END STORAGE ------------------------------- The subroutines FMALLOC and FFREE in libcmf77.a provide an interface from CM Fortran to the standard malloc and free functionality for managing front-end storage. SUBROUTINE FMALLOC( NB, POINTER ) INTEGER NB, POINTER SUBROUTINE FFREE( POINTER ) FMALLOC allocates a block of front-end memory of at least NB bytes, suitably aligned for the storage of any data type. It returns the address of the start of that area in POINTER. If the allocation is not successful, it returns zero in POINTER. The subroutine FFREE releases a block of memory previously allocated by FMALLOC. The value returned in POINTER by FMALLOC is used with the %VAL operator to pass the argument by value to a subprogram. The %VAL operator is a predefined argument-list function: it indicates that the argument following it is a pointer that is to be passed by value. The pointer must be a scalar value of type INTEGER, LOGICAL, or REAL. The following example shows the use of FMALLOC with %VAL to allocate front-end storage and treat it as an array: PROGRAM MALLOC_ME PARAMETER (M=3,NB=M*4) INTEGER POINTER CALL FMALLOC (NB, POINTER) PRINT *,POINTER CALL DO_IT(%VAL(POINTER), M) CALL FFREE (POINTER) END SUBROUTINE DO_IT(ARRAY,M) REAL ARRAY(M) ARRAY(2) = 14.333 PRINT *,ARRAY(2) END 9.3 USE OF FLUSH ----------------- As of Version 2.1, calls to FLUSH are unnecessary. Support for FLUSH will be removed in a future release. We recommend that users remove calls to FLUSH from their CM Fortran codes. ***************************************************************** The information in this document is subject to change without notice and should not be construed as a commitment by Think- ing Machines Corporation. Thinking Machines reserves the right to make changes to any product described herein. Although the information in this document has been reviewed and is believed to be reliable, Thinking Machines Corporation assumes no liability for errors in this document. Thinking Machines does not assume any liability arising from the application or use of any information or product described herein. ***************************************************************** Connection Machine (r) is a registered trademark of Thinking Machines Corporation. CM, CM-2, CM-200, CM-5, CM-5 Scale 3, and DataVault are trademarks of Thinking Machines Corporation. CMOST, CMAX, and Prism are trademarks of Thinking Machines Corporation. C* (r) is a registered trademark of Thinking Machines Corporation. Paris and CM Fortran are trademarks of Thinking Machines Corporation. CMMD, CMSSL, and CMX11 are trademarks of Thinking Machines Corporation. CMview is a trademark of Thinking Machines Corporation. Scalable Computing (SC) is a trademark of Thinking Machines Corporation. Scalable Disk Array (SDA) is a trademark of Thinking Machines Corporation. Thinking Machines (r) is a registered trademark of Thinking Machines Corporation. SPARC and SPARCstation are trademarks of SPARC International, Inc. Sun, Sun-4, and Sun Workstation are trademarks of Sun Microsystems, Inc. UNIX is a trademark of UNIX System Laboratories, Inc. Copyright (c) 1994 by Thinking Machines Corporation. All rights reserved. This file contains documentation produced by Thinking Machines Corporation. Unauthorized duplication of this documentation is prohibited. Thinking Machines Corporation 245 First Street Cambridge, Massachusetts 02142-1264 (617) 234-1000