用 plusFORT 進行 Fortran分析和重構
來自Polyhedron Solutions的 plusFORT 是用於分析和改進Fortran程式的多功能工具套件。它在一個強大的程式包中將重組和重新格式化與全局靜態分析，動態分析和許多其他功能結合在一起。plusFORT是使用Fortran源代碼的程式設計師，專案經理和軟體測試工程師的一站式解決方案。
- SPAG – Re-engineering Fortran source code
- Quality Assurance using plusFORT
- GXCHK – Global Static Analysis
- Dynamic Analysis
- Coverage Analysis
- AUTOMAKE – automated make for Fortran and C
- QMERGE – Version Selection
- HyperKWIC – Hyperlinked KeyWord In Context
SPAG, the plusFORT restructuring tool, can unscramble spaghetti Fortran 66 or Fortran 77 code, and convert it to modern structured Fortran 95. It also converts back and forth between standard Fortran 77, and code with Fortran 95 extensions such as DO WHILE, ENDDO, CYCLE, EXIT and SELECT CASE.
SPAG does not change the meaning of a program, or even the order in which statements are executed; it does change the way the program logic is written down, making it much easier to understand and maintain. Blocks of code are reordered so that logically related sections are physically close, and jumps in control flow are minimised. SPAG may also replicate small code fragments where this improves the re-structured code. SPAG computes complexity metrics before and after restructuring.
RE-STRUCTURING AND RE-FORMATTING
SPAG contains a powerful code beautifier, with dozens of options controlling spacing, case, labels, indentation, use of CONTINUE etc. You can use SPAG to switch back and forth between the F77 and F95 source forms. But SPAG goes much further:
- SPAG identifies, and optionally removes dead code (statements which could never be executed) and clutter (variables or PARAMETERs which are declared but never used).
- SPAG can rewrite your declarations from scratch using either Fortran 77 or Fortran 95 notation.
- SPAG provides a simple and safe method for systematically changing the names of symbols within a program.
- SPAG allows you to specify how upper and lower case should be used to distinguish different types of symbol. For example, local variables may be lower case, PARAMETERs upper case, dummy arguments capitalised etc. (e.g. local , PARAM , Dummyarg, COMmonvar).
- SPAG generates symbol table files which are used by GXCHK, and may be used by user-written applications. For example it would be a simple matter to write a program to check conformance to local variable naming conventions. A detailed description of the symbol table format is supplied.
There are over 100 configuration options which allow you to customise SPAG output to local conventions and requirements.
SWITCH TO EXPLICIT TYPING
SPAG allows you to switch programs to explicit typing by adding declarations for implicitly defined variables. Explicit typing, which in Fortran is normally enforced using IMPLICIT NONE, allows your compiler to detect errors which might otherwise remain undetected for years.
SWITCH TO FORTRAN 95 AND LATER
SPAG allows you to migrate your code to current Fortran standards. It can convert source form, control constructs, declaration style, relational operators, and can convert COMMON blocks to MODULEs. SPAG can detect the appropriate and insert the INTENT value for dummy arguments. In conjunction with GXCHK, the plusFORT static analysis tool, it can help you to migrate your legacy Fortran 66 or 77 code to modern modular code, which could have been written today.
PLUSFORT QUALITY ASSURANCE
Many people know plusFORT mainly for SPAG, the restructuring tool which unscrambles spaghetti code. However, the plusFORT quality assurance facilities are arguably of even greater importance to most users.
plusFORT Version 7 is unique among QA tools in offering three distinct and complementary approaches to the problem of software quality assurance. Working together these three approaches have far more impact than any one could by itself.
QA Method 1- Global Static Analysis
GXCHK is the plusFORT global static analysis tool. GXCHK views data usage from a global perspective, and detects errors and anomalies that compilers and other tools miss. Examples are:
- Subprogram argument mismatch or misuse (e.g. constant actual argument is illegally modified by subprogram).
- COMMON and/or MODULE variables assigned a value but never used, or used but never assigned a value.
- Globally unused COMMON or MODULE variables, COMMON blocks, PARAMETERs, & INCLUDE files.
- Inconsistent COMMON block definitions.
- COMMON or MODULE variable name appears in other contexts (e.g. as a local variable, or in a different COMMON).
Version 7 of plusFORT introduces greatly improved HTML static analysis reports, with comprehensive cross- reference links. These reports are designed to act as a constant companion to coders, providing instant answers to questions like “where is this variable set” and “where is this routine called from”. A new “modularization report” shows how a traditional Fortran 77 program can be reorganised using modules and/or internal subprograms to take full advantage of the modular programming features of Fortran 95 and Fortran 2003.
An unusual feature of GXCHK is its ability to analyse local and global data together. For example, if a local variable in subprogram A has the same name as a COMMON variable in subprogram B, it could be that the programmer has omitted the relevant COMMON statement from subprogram A. GXCHK, unlike other static analysers spots this problem. GXCHK also produces a call tree, and concise but comprehensive charts showing where and how each symbol is used. Handy aggregated reports are produced for COMMON blocks and INCLUDE files.
Interface specifications for every subprogram, showing calls in and out, dummy arguments, PARAMETERs, COMMON and MODULE variables usage etc., can also be produced, and, optionally, embedded as comments back into the original source code.
GXCHK operates in a “compile & link” style which allows reports to be updated with minimal source code analysis. AUTOMAKE can be used to automate the process.
A big advantage of static analysis is that it can check all your code without regard to whether or not it is actually executed in a particular run. On the other hand, static analysis cannot take account of subtleties in program control flow, or the varying nature on input data. Neither can it cannot monitor the status of individual array elements. Arrays are treated as amorphous blobs of data.
QA Method 2 – Dynamic Analysis
If a bug is defined as “an incorrect value in a storage location” then there is a large subset (perhaps 30%) which can be defined as “an undefined value in a storage location”, and many of the remainder may cause that condition as a knock-on effect.
The Dynamic Analysis option of plusFORT is a tool for diagnosing these errors at run-time. A test version of your program is created, which detects any use of an undefined variable or array element, and logs it to a file. In other respects, the test program behaves exactly like the original. This is done by inserting calls to probe routines in the source code before any operation which depends on the value of a data item. The program is compiled and linked in the normal way, and the executable code appears to the user to operate in exactly the same way as the original. However, if a probe detects an undefined data item, it writes details to a log-file for later analysis. Source code for the probe routines is supplied.
|Feature||Static Analysis||Dynamic Analysis|
|Checks code whether or not it executes||Yes||No|
|Checks for unsafe/questionable source code||Yes||No|
|Identifies used before set error||Sometimes||Yes|
|Checks status of individual array elements||No||Yes|
|Handles dependence on external data||No||Yes|
|Effective with dummy args, EQUIVALENCE||Poor||Yes|
Dynamic analysis excels at detecting bugs which depend on external data, or on the use of arrays. These characteristics defeat conventional analysers.
QA Method 3 – Test Coverage and Hot-Spot Analysis.
A reasonable goal for a software test suite is to ensure that every line of source code is executed at least once. The plusFORT coverage analysis facility allows users to monitor progress against this goal, as well as identifying “hot-spots” – the sections of code which are executed most frequently, and which have most effect on program execution time.
The plusFORT coverage analysis facility places probes into Fortran source code which allow users to monitor the effectiveness of testing. At the end of each run, the probes update the coverage statistics for each source file. This data may be analysed at any time using the CVRANAL tool. CVRANAL identifies untested code blocks, and execution hot-spots.
In addition, CVRANAL can annotate your source code as shown below. The annotations are comments and do not affect the validity of the source code.
SOFTWARE DOCUMENTATION USING HYPERKWIC
HyperKWIC generates software documentation that combines the instant connectivity of hypertext with the analytical strengths of KeyWord In Context. It produces HTML documents that provide a fully interactive alternative to traditional documentation.
HyperKWIC is a part of the plusFORT toolkit.
- Meet requirements for accurate and complete software documentation with the aid of HyperKWIC reports which are generated automatically and quickly.
- Update as often as required, and publish to your team and to other stakeholders. HyperKWIC reports may be stored locally or published on an internal or external website.
- Impact Analysis: Even small changes to an established code base can have consequences that propagate through the entire program. With HyperKWIC you can quickly assess possible changes and produce a plan to minimize coding effort.
- Keep HyperKWIC software documentation open in your web browser for an instant answer to those constant questions:-
- where is that defined?
- which routine set that value?
- what else uses that?
- is that redundant?
- HyperKWIC is aware of programming language syntax, including comments and reserved words. Syntax rules for several common languages are defined in an external file, which may be customized as required.
- R-click to open a separate tab for reports you will need again later.
Linux, MacOSX, Multi-Platform, Windows
single user, departmental, site
Check out our new video tutorials which explore some of the many capabilities of plusFORT, and showcase PFFE, the plusFORT front end which offers a genuinely intuitive graphical interface for the plusFORT tools.
ForDBC – Fortran Database Connectivity
ACCESS DATABASES AND SPREADSHEETS UNDER WINDOWS USING FORTRAN
With ForDBC the Fortran programmer can read and write tables of any database for which an ODBC driver is supplied.
Most databases, such as Oracle, Microsoft Access , Microsoft SQL, MySQL, IBM Db2 and Sybase SQL Anywhere, are equipped with an ODBC driver (ODBC = Open Database Connectivity). This is also true for some spreadsheets: Excel and Lotus.
Under Windows an ODBC interface is available. However the ODBC functions are not easy to access by a Fortran programmer because the documentation and the tools supplied by Microsoft are designed for C/C++ or VB programmers. ForDBC offers help! The Fortran interface provided by ForDBC is almost complete with respect to the ODBC v3.5 specification. This means that with ForDBC you can call all of these ODBC functions as if they were programmed in Fortran. Furthermore hundreds of ODBC and SQL specific constants are supplied. Simply include in your Fortran program the source line
Intel® VTune™ Profiler
Without the right data, you’re guessing about how to improve software performance and are unlikely to make the most effective improvements. Intel® VTune™ Profiler collects key profiling data and presents it with a powerful interface that simplifies its analysis and interpretation. Optimize software for:
- High-performance computing (HPC) in weather forecasting, finite element analysis, and bioinformatics
- Embedded applications for IoT, transportation, and manufacturing
- Media software for video transcoding and image processing
- Cloud applications or Java* services in containers
- Device drivers
- Game engines
- Storage that includes Storage Performance Development Kit (SPDK) and Data Plane Development Kit (DPDK) polled software
Lahey/Fujitsu Fortran Express v7.3 Windows 32-bit
LF95 Express includes the powerful Lahey/Fujitsu Fortran 95 optimizing command-line compiler, linker, command-line debugger, librarian, support for creating DLLs and calling the Windows APIs, online documentation, and free e-mail support.
- LF Fortran 95 Optimizations.
- Statically Link Fujitsu C and Borland C++ Object Files.
- DLL Interfaces to Visual Basic, VC++, Borland C++, and Delphi.
- Win32 API Access.
- Legacy Fortran Support.
- ANSI/ISO-Compliant Fortran 95.
- Free Email Support.
Silverfrost FTN95 for .NET & Windows 32 & 64-bit
With Silverfrost FTN95: Fortran for Windows you can create console based, conventional Windows® and Microsoft .NET applications. Silverfrost FTN95 is the only compiler that can produce Microsoft .NET applications that can use the full Fortran 95 language. Silverfrost FTN95 also boasts its world leading CHECKMATE run-time checking technology that finds bugs fast!
- Full Fortran 95 language compatibility
- Comprehensive integration with Microsoft Visual Studio .NET
- Standalone editor – Plato3
- The world’s best runtime checking
- Very fast compilation speed
- Excellent compile-time diagnostics
- Full souce level debugging
- Builds console, Windows® and Microsoft .NET 1.1 and 2.0 applications
Absoft Pro Fortran
Pro Fortran 2020 combines performance and features not available from any other Fortran vendor.
- Industry-leading performance
- Robust, parallel, scalable code
- Easy-to-use, Fortran/C IDE or command prompt, speeds development
- AWE Fortran application framework, HPC, Data Access and Math Libraries
- 2D/3D Graphics
- Windows, OS X, and Linux have the same look, feel and functionality
- Dynamic, mixed floating licenses available
- Industry’s best tech support includes live phone technicians
- Optional IMSL numerical library bundles available