TweetFollow Us on Twitter

LS FORTRAN 3.0, Pt 2
Volume Number:8
Issue Number:2
Column Tag:Jörg's Folder

Language Systems FORTRAN 3.0

By Jörg Langowski, MacTutor Regular Contributing Author

[Due to a bug that showed itself in Quark XPress 3.1, portions of this article were not printed properly in the April/May issue. The relevant portions are reprinted here. Just goes to show, to err is human, but to really foul things up takes a computer. - Ed.]

Language Systems FORTRAN 3.0

FORTRAN 2.1 was already very robust, generated good, fast code, and all in all, allowed programs that ran on mainframes to be ported very quickly to the Macintosh. Also, subroutines could be assigned to menu items, and the runtime system would handle the menu selections automatically for you, files could be OPENed using the standard file dialogs, and many more goodies.

A Multi-dialect FORTRAN

When I opened the 3.0b2 version of the LS FORTRAN (LSF) compiler, amazingly enough I discovered that one could still make substantial improvements to this development system. First of all, Language Systems proved that one can actually make several existing FORTRAN dialects live happily together in one system. Although I have only VAX programs to test here, I believe their claim that Cray, Microsoft, Data General, and of course standard ANSI 77 FORTRAN programs mostly compile without modifications and produce the expected results. There is a whole section of the manual (20 pages, to be precise) devoted to describing the compatibility with other systems, and the changes that may still be necessary for porting the programs. The manual - or rather Karen Rall, who wrote it - “thinks for you”; the Mac user who has never before transferred a FORTRAN program from a mainframe will even get instructions about file-transfer protocols, Macintosh file attributes and VAX record types. There are -vax and -cray compiler switches for porting programs from those respective machines. Even the VAX pre-connected filenames SYS$INPUT, SYS$OUTPUT, SYS$PRINT and SYS$ERROR are supported. Also, all Microsoft compiler directives are recognized and respected, if possible

But porting programs is not the whole story. You’ll want to develop new programs, test out those bugs, and for that part LSF now adds new debugging options. Of course, the trace and dump options always existed which would trace subroutine entry and exit, and allow to dump variable values to the output screen. Now there is the new -debug compiler switch with four levels: debug=1 adds code that displays the file name and source line number where a runtime error occurred; and when you press the caps lock key during execution, a window pops up where the source line numbers that are being executed flash by. At debug=2, in addition, the heap is checked at the end of each subroutine, and at level 3, after each line of source code.

Of course, you can generate symbol tables for use with SADE, to have source code level debugging.

Toolbox Calling Conventions

The Mac toolbox interface has been improved even further. Now, when you declare functions as PEXTERNAL or CEXTERNAL, character constants passed as arguments are automatically converted to the Pascal (length byte followed by text) or C format (zero-terminated string). The names of PEXTERNAL routines are always passed to the linker in upper case, regardless of the case sensitivity of the FORTRAN compiler chosen (ignore case or case-sensitive), and CEXTERNAL names are always passed in case-sensitive format. These are the formats that the linker expects for C and Pascal. You can declare variables GLOBAL, which means they are application globals referenced from A5; again, to match the Pascal and C naming conventions, you can use the PGLOBAL and CGLOBAL declarations.

System 7

As promised, the new LS FORTRAN supports AppleEvents. The runtime library includes code that automatically recognizes the four required AppleEvents, ‘oapp’, ‘odoc’, ‘pdoc’, and ‘quit’ (see this column in V7#11). If you compile a FORTRAN program with the background processing option, it will react when another program sends it an AppleEvent. As an example, I have listed two programs provided on the LSF disks: the main program opens a second application, sends it some data via an intermediate file, and the second application transfers the processed data back to the main program and quits.

The inclusion of AppleEvents in LSF opens up a whole range of perspectives: for instance, one could imagine a ‘compute server’, a Quadra for example, sitting somewhere on the network with a math library, comprising lots of tiny applications, and programs on other Macintoshes that use this library. Or a way of distributed processing on the network, where a CPU-intensive program can ‘steal’ time from other machines when they are not being used. The routine F_OpenDocWaiting() is used to synchronize such parallel processes; it will continue only when the program has received an ‘odoc’ event. A very rudimentary but effective way of parallel processing.

Although (up to now) only the four required AppleEvents are recognized automatically by the FORTRAN runtime library, you can send any event you like, as shown in the third example. HyperCard 2.1 understands the event ‘dosc’ which will make it execute a HyperTalk script contained in the event’s data. The program sets up such a script and sends it to HyperCard; if you don’t have HyperCard opened, it will issue an error message. When you have HyperCard running and start the program, you’ll hear one beep and see the card window disappear and reappear. Very impressive.

The edition manager of System 7 is also supported in a way; you can publish a FORTRAN-created file by executing CLOSE(UNIT=iunit, STATUS=’PUBLISH’). ‘Subscribing’ to such a ‘published’ document from another program that supports the edition manager means that changes made by the publisher to the document are automatically reflected in the version of the document opened by the other program (I’ll give an introduction to the Edition manager in a later column, haven’t fully under-stood it myself yet).

The last System 7 feature that has been included into LSF 3.0 is alias support. If you open an alias to a file from within a FORTRAN program, the original file will be accessed, just as you would expect.

New Compiler Options

The compiler includes support for generating 68040-specific code, and the optimizer has been improved. As far as I could tell from some limited comparisons (comparing the assembly output generated for the Linpack and Matmult benchmarks, see V7#1), the code generated for the 68040 looks extremely similar to the 68030 code, except for some floating point FMOVE instructions, which are different. I’ll check whether there is a large speed difference on a 68040 between code compiled with the -mc68030 and the -mc68040 options as soon as I have access to a Quadra.

The quality of the code has improved from version 2.1. The Linpack and matrix multiplication benchmarks (V7#1) now run at the same speed as the Absoft MacFortranII compiled versions, although the Whetstone benchmark is still 20% slower. Note, however, that Absoft is much slower if you insist on full Pascal calling conventions, which is standard in LSF.

The most striking difference between the code created by the LSF and the Absoft compiler occurred when I ran a program called “Paranoia” which tests the accuracy and consistency of math operations. While LSF at opt=3 passed all the tests with no problems reported, Absoft’s code (with the basic optimizations) reported a lot of errors and got stuck halfway through. I include the two compiled versions on the source code disk so you can see for yourself.

At this moment, LSF seems to be superior to Absoft FORTRAN in almost all aspects, from the quality of the code to the Macintosh environment, to System 7 support; there may still be a slight disadvantage for integer-computation intensive programs (not for floating point). The new Absoft FORTRAN should be out by now, so we’ll soon see what that brings. From the information they gave in their ad, especially the 68040 support looks very interesting; however, the AppleEvents support is unique to LSF.

Other Features

There are many other improvements made in LSF 3.0 that you notice browsing through the manual, most often printed in boldface text because they are nonstandard extensions. The chapter about optimization was missing from my beta manual; it would have been interesting to see what they actually changed to get the better performance, but I’ll have to wait for the final version. There is a long appendix on how to use HyperCard as a front end to FORTRAN applications, which should be especially interesting under System 7, where both HyperCard and FORTRAN programs can pass AppleEvents to each other. Of course, you can still write XCMDs in FORTRAN, as was always possible. Also, 4th Dimension external commands are supported. All in all, there is almost no reason anymore why seasoned FORTRAN programmers should learn Pascal or C (although I do like C++).

For more information, contact:

Language Systems Corporation

441 Carlisle Drive, Herndon, VA 22070-4802

800-2-LANGSYS or 703-478-0181, 703-689-9593 (fax)

AppleLink: LANGSYS, America Online: LANGSYS

Retail Price: $595 w/MPW, $495 w/o MPW

FORTRAN Upgrades: $100, MPW Upgrades: $50

 
AAPL
$428.43
Apple Inc.
-3.34
MSFT
$34.95
Microsoft Corpora
-0.03
GOOG
$901.20
Google Inc.
+0.58

MacTech Search:
Community Search:

Software Updates via MacUpdate

Apple Java 2013-004 - For OS X 10.7 and...
Apple Java for OS X 2013-004 supersedes all previous versions of Java for OS X. This release updates the Apple-provided system Java SE 6 to version 1.6.0_51 and is for OS X versions 10.7 or later.... Read more
Google Chrome 27.0.1453.116 - Modern and...
Google Chrome is a Web browser by Google, created to be a modern platform for Web pages and applications. It utilizes very fast loading of Web pages and has a V8 engine, which is a custom built... Read more
EarthDesk 6.2 - Striking animated image...
EarthDesk replaces your static desktop picture with a rendered image of Earth showing correct sun, moon and city illumination. With an Internet connection, EarthDesk displays near real-time global... Read more
Apple Configurator 1.3 - Configure and d...
Apple Configurator makes it easy for anyone to mass configure and deploy iPhone, iPad, and iPod touch in a school, business, or institution. Three simple workflows let you prepare new iOS devices... Read more
Apple Java for Mac OS X 10.6 Update 16 -...
Apple Java for Mac OS X 10.6 Update 16 delivers improved security, reliability, and compatibility by updating Java SE 6 to 1.6.0_51.Version Update 16: See http://support.apple.com/kb/HT5744 for more... Read more
Neat 4.0.3 - Digital filing system for r...
Neat (formerly NeatWorks) is a powerful scanning and digital filing system that enables you to scan and organize receipts, business cards, and documents. Unlike other scanning software, NeatWorks... Read more
Adobe Muse CC 5.0 - Design and publish H...
Adobe Muse enables designers to create websites as easily as creating a layout for print. Design and publish original HTML pages using the latest Web standards, and without writing code. Now in beta... Read more
Adobe Creative Cloud 1.0 - Everything ne...
Adobe Creative Cloud costs $49.99/month (or less if you're a previous Creative Suite customer). Creative Suite 6 is still available for purchase (without a monthly plan) if you prefer. Introducing... Read more
Adobe Flash Professional CC 13.0.0.759 -...
Flash Professional CC is available as part of Adobe Creative Cloud for as little as $19.99/month (or $9.99/month if you're a previous Flash Professional customer). Flash Professional CS6 is still... Read more
Adobe InCopy CC 9.0 - Create streamlined...
InCopy CC is available as part of Adobe Creative Cloud for as little as $19.99/month (or $9.99/month if you're a previous InCopy customer). InCopy CS6 is still available for purchase (without a... Read more

Latest Forum Discussions

See All

Sheep Shack Review
Sheep Shack Review By David Rabinowitz on June 19th, 2013 Our Rating: :: COUNTING SHEEPUniversal App - Designed for iPhone and iPad Sheep Shack is an arcade game with a strange concept that blends Whack-A-Mole with elements from... | Read more »
World War Z Game Drops Its Price To A Bu...
World War Z Game Drops Its Price To A Buck For The Movie’s Release Posted by Andrew Stevens on June 18th, 2013 [ permalink ] | Read more »
Runaway: A Road Adventure Review
Runaway: A Road Adventure Review By Campbell Bird on June 18th, 2013 Our Rating: :: COMBINE ITEMS TO WINUniversal App - Designed for iPhone and iPad Runaway is a classic, old-school adventure experience, for better and for worse.   | Read more »
Pinball Rocks HD Review
Pinball Rocks HD Review By Blake Grundman on June 18th, 2013 Our Rating: :: QUARTER MUNCHERUniversal App - Designed for iPhone and iPad When players have the chance to buy free balls at the end of a game, that speaks volumes about... | Read more »
Minecraft Realms Server Slots Are Beginn...
Minecraft Realms Server Slots Are Beginning To Open, But Slowly Posted by Andrew Stevens on June 18th, 2013 [ permalink ] | Read more »
Videon Review
Videon Review By Jennifer Allen on June 18th, 2013 Our Rating: :: GREAT ALL-ROUNDERiPhone App - Designed for the iPhone, compatible with the iPad Offering mostly everything one could want from a video recording app, Videon is quite... | Read more »
The Portable Podcast, Episode 190
Flatter than ever! In This Episode: Carter and co-host Brett Nolan talk about the big announcements from WWDC, including iOS 7. Will it be a huge change to iOS? As well, the announcement of MFi gamepad support in iOS is discussed – will it herald... | Read more »
Apple Approved Game Controllers Only Mak...
I’m all for game controllers for iOS devices, for what it’s worth. I’ve got a few of them, and they are all gathering dust. The issue with controllers for mobile devices is that they never get used. Not even for the games that are better when played... | Read more »
CIA: Operation Ajax Gives Readers Free A...
CIA: Operation Ajax Gives Readers Free Access To The Interactive Comic Posted by Andrew Stevens on June 18th, 2013 [ permalink ] | Read more »
Youda Survivor Drops Its Price For A Mag...
Youda Survivor Drops Its Price For A Magical, Limited Time Only Posted by Andrew Stevens on June 18th, 2013 [ permalink ] iPad Only App - Designed for the iPad | Read more »

Price Scanner via MacPrices.net

Updated iPad Price Trackers
We’ve updated our iPad Price Tracker and our iPad mini Price Tracker with the latest information on prices and availability from Apple and other resellers. Read more
Apple refurbished iPod nanos available for $99
The Apple Store has Apple Certified Refurbished 16GB iPod nanos available for $99 including free shipping and Apple’s standard one-year warranty. That’s $50 off the cost of new nanos. All colors are... Read more
iFixIt Tears Down mid-2013 11.6-inch MacBook Air
iFixIt Chief Information Architect Miroslav Djuric says: The epic week of disassembly continues: Today, the MacBook Air 11″ found its way onto our teardown table and was soon just another Apple in... Read more
Mature Consumers Know When They Need a PC
Tech.Pinions’ Ben Bajarin sensibly observes that one of the fundamental characteristics of a mature market is mature consumers – mature in the sense that they know what they want and more importantly... Read more
Windows 8 Continues Ascension in User Popularity R...
Softpedia’s Bogdan Popa notes that Windows 8 is now the fourth most popular operating system in the world, and according to some new statistics, it continues to gain new users every day. Popa cites... Read more
Apple iOS and OS X Updates Put Bluetooth Smart Rea...
From its Worldwide Developers Conference last week, Apple announced unprecedented integration of Bluetooth technology into its operating systems – a move that sets the bar for Bluetooth integration... Read more
Buy a 13″ MacBook Pro, get AppleCare for as little...
Adorama has 13″ MacBook Pros bundled with 3-year AppleCare Protection Plans for as little as $40 extra (AppleCare has an MSRP of $249 for 13-inch MacBook Pros). Shipping is free, and Adorama charges... Read more
Updated MacBook Price Trackers
We’ve updated our MacBook Price Trackers with the latest information on prices, bundles, and availability on MacBook Airs, MacBook Pros, and the MacBook Pros with Retina Displays from Apple’s... Read more
Save $140 on the 15″ 2.3GHz MacBook Pro
B&H Photo has the 15″ 2.3GHz MacBook Pro on sale for $1659 including free shipping. Their price is $140 off MSRP. B&H will include free copies of Parallels Desktop, Bento Database, and LoJack... Read more
15-inch Retina MacBook Pros on sale for $200 off M...
 B&H Photo has 15″ Retina MacBook Pros on sale for $200 off MSRP including free shipping. B&H will also include free copies of Parallels Desktop, Bento Database, and LoJack for Laptops... Read more

Jobs Board

*Apple* At-Home Team Manager - Apple (U...
Changing the world is all in a day's work at Apple . If you love innovation, here's your chance to make a career of it. You'll work hard. But the job comes with more than Read more
*Apple* Retail - Manager - Apple (Unite...
Job SummaryKeeping an Apple Store thriving requires a diverse set of leadership skills, and as a Manager, youre a master of them all. In the stores fast-paced, dynamic Read more
*Apple* - Solution Architect - CompuCom...
Job Location: US-TX-Dallas Posted Date: 4/18/2013 Overview: The Apple Solution Architect (SA) will be responsible for supporting pre-sales and post-sales solutions in Read more
*Apple* Support Technician; Mid-level -...
A Kforce client in Washington, DC area is seeking an Apple Support Technician. This contractor will have the following types of responsibilities including, but not Read more
Systems Engineer - *Apple* TV - Apple...
Job Summary The Apple TV team is looking for an experienced engineer with a passion for delivering first in class home entertainment solutions. The individual must be Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.