Salford FTN77 User Guide
Total Page:16
File Type:pdf, Size:1020Kb
)71 User’s Guide IMPORTANT NOTICE Salford Software Ltd. gives no warranty that all errors have been eliminated from this manual or from the software or programs to which it relates and neither the Company nor any of its employees, contractors or agents nor the authors of this manual give any warranty or representation as to the fitness of such software or any such program for any particular purpose or use or shall be liable for direct, indirect or consequential losses, damages, costs, expenses, claims or fee of any nature or kind resulting from any deficiency defect or error in this manual or such software or programs. Further, the user of such software and this manual is expected to satisfy himself/herself that he/she is familiar with and has mastered each step described in this manual before the user progresses further. The information in this document is subject to change without notice. May 1998 © Salford Software Ltd 1998 All copyright and rights of reproduction are reserved. No part of this document may be reproduced or used in any form or by any means including photocopying, recording, taping or in any storage or retrieval system, nor by graphic, mechanical or electronic means without the prior written consent of the Salford Software Ltd. ii Preface This user’s guide describes the facilities available in version 3.55 and later of FTN77(DOS/Win16), the Salford Software Fortran 77 compiler for 80386-, 80486- and Pentium-based Personal Computers running MS-DOS revision 5 and later. This compiler and the applications generated from it can be run under DOS or in a DOS box under Windows 3.1(1) or Windows 95. When used with Salford’s ClearWin+, it can also be used to create Win16 applications for Windows 3.1(1) or Windows 95. This guide also describes the facilities available in version 3.62 and later of FTN77(Win32), the Salford Fortran 77 compiler for 80486 and Pentium based Personal Computers. This edition of the compiler is suitable for the Windows NT Operating System and for Windows 95. It can also be used with ClearWin+ in order to generate Win32 applications for Windows 3.1(1) (using Win32S), Windows 95 and Windows NT. The guide concentrates on compiler-specific features and those areas of the Fortran language where the ANSI Standard1 needs amplification. The guide is not intended to be used as a Fortran language reference manual although chapter 10 does contain a detailed guide to the features of input/output and chapter 12 is a comprehensive guide to character handling. For further information about Fortran 77 the reader is referred to one of the many published texts such as Effective Fortran 77 by Michael Metcalf (Clarendon Press ISBN 0-19-853709-3). FTN77 provides a large number of useful subroutines and functions in addition to those specified in the ANSI Standard. Some of the functions that have been provided are defined as intrinsic functions and are described in chapter 11. The remaining functions and all of the subroutines are outlined in chapter 29 and described in the on- line Help systems (one for DOS and one for Windows) and also in a companion volume called the FTN77 Library Reference manual. On the next page you will find a list of chapter headings in this guide. A full table of contents appears after the acknowledgements. 1ANSI X3.9-1978 iii FTN77 User’s Guide Chapter headings in this guide: page 1. Introduction ............................................................................. 1 2. Installation guide and getting started (DOS/Win16)................. 5 3. Installation guide and getting started (Win32) ....................... 15 4. Compiling with FTN77 ........................................................... 21 5. Using /LGO and /LINK........................................................... 39 6. Compiler options ................................................................... 43 7. Using SDBG.......................................................................... 51 8. Program development ........................................................... 75 9. Optimisation and efficient use of Fortran............................... 85 10. Fortran input/output ............................................................. 95 11. Intrinsic functions............................................................... 139 12. Fortran 77 character handling facilities.............................. 157 13. Language extensions......................................................... 177 14. The in-line assembler ........................................................ 193 15. The in-line assembler and DBOS....................................... 201 16. Mixed language programming........................................... 209 17. The COMGEN utility.......................................................... 217 18. Calling the Windows API (Win32) ...................................... 223 19. Using LINK77, RUN77 and Libraries (DOS/Win16) ........... 229 20. SLINK (Win32) .................................................................. 241 21. Using MK and MK32.......................................................... 265 22. Using Plato........................................................................ 277 23. DBOS (DOS)..................................................................... 289 24. Running DBOS applications under Windows (Win16) ........ 307 25. Plotter Interfacing (DOS) ................................................... 313 26. Calling real mode libraries and programs (DOS) ................ 315 27. Execution errors and IOSTAT values................................ 325 28. Error and exception handling (Win32)............................... 333 29. Overview of the FTN77 run-time library ............................ 335 Some chapters relate only to one version of the compiler (either DOS/Win16 or Win32). These are distinguished in the even page header. In chapters that are largely common to both versions, sections that relate only to one version are presented with a shaded background. iv Acknowledgements * * * FTN77 is a registered trademarks of Salford Software Ltd. DBOS, Salford C++, SLINK and ClearWin+ are trademarks of Salford Software Ltd. FTN90 is a joint trademark of Salford Software Ltd and the Numerical Algorithms Group Ltd. MS-DOS, Windows, Windows 95 and Windows NT are trademarks of Microsoft Corporation. BRIEF is a trademark of Borland International Inc. Intel is a registered trademark of Intel Corporation. AUTOMAKE is a trademark of Polyhedron Software Ltd. v FTN77 User’s Guide vi Table of Contents 1. Introduction ............................................................................................................ 1 The compiler....................................................................................................................................... 1 High compilation speed....................................................................................................................... 1 Object code ......................................................................................................................................... 1 Compile-time diagnostics .................................................................................................................... 2 Run-time diagnostics........................................................................................................................... 2 Source level debugger ......................................................................................................................... 2 In-line assembler................................................................................................................................. 2 Other language extensions................................................................................................................... 3 Portability aids.................................................................................................................................... 3 Mixed language programming and libraries......................................................................................... 3 ClearWin+ .......................................................................................................................................... 3 2. Installation guide and getting started (DOS/Win16) ............................................ 5 Hardware requirements ....................................................................................................................... 5 Installing FTN77................................................................................................................................. 5 A simple example ............................................................................................................................... 8 Getting started .................................................................................................................................... 9 HELP!............................................................................................................................................... 13 The HELP77 utility........................................................................................................................... 13 3. Installation guide and getting started (Win32)................................................... 15 Hardware requirements ..................................................................................................................... 15 Installing FTN77..............................................................................................................................