1 i i H11 |i 1 {1' w i ^l| [j;5^ LANGUAGES Modular. Integrated. Now. Handle WrHer/Speir*' Word processing with integrated speliing correction and verification. Handle Calc^'* Spreadsheet with up to 32,000 rows and coiumns. Conditionai and iterative recalculation. The Handle Office-Airiomotion Series is a powerful set of modular, integrated software tools developed for today's multiuser office environment. Handle application modules can be used stand-alone or combined into a fully integrated system. The Handle Office-Automation Series modules offer; • Ease of Use and Learning • Insulation from UNIX • Data Sharing Between Multiple Users • Data Integration Between Modules • Data Sharing with Other Software Products • Sophisticated Document Security System Handle Technologies, Inc. Coiporote Office 6300 Richmond 3rd Fioor Houston, TX 77057 (713)266-1415 Sales and Product Information 850 North Lake Tahoe Blvd. P.O.Box 1913 Tahoe City, CA 95730 (916) 583-7283 TM-HANDLE. handle host, handle writer, handle spell handle writer/spell and HANDLE CALC ARE TRADEMARKS OF HANDLE TECHNOLOGIES, INC. TM-UNIX is a trademark of AT&T BELL LABORATORIES. Circle No. 287 on Inquiry Card How to go from UNIX to DOS without compromising your standards. It’s easy. Just get an industry standard file access method that works on both. C-ISAM“fromRDS. It’s been the UNIX'“ standard for years (used in more UNIX languages and programs than any other access method), and it’s fast becoming the standard for DOS. Why? Because of the way it works. Its B+ Tree indexing structure offers unlimited indexes. There’s also automatic or manual record locking and optional transaction audit trails. Plus index compression to save disk space and cut access times. © 1985, Relational DatalxLse Systems, Inc. UNIX is a trademark of AT&T Bell Laboratories. INFORMIX is a registered trademark and RDS, C-ISAM and File-lt! are trarlemarks of Itelational Database Systems, Inc. How can we be so sure C-ISAM works so well? We use it ourselves. It’s a part of INFORMIX: INFORMIX-SQL and File-iti: our best selling database management programs. For an information packet, call (415) 424-1300. Or write RDS, 2471 East Bayshore Road, Palo Alto, CA 94303. Youll see why anything less than C-ISAM is just a compromise. RELATIONAL DATABASE SYSTEMS, INC. Circle No. 290 on Inquiry Card How we iimroved Structured Query Language. Actually, we didn’t change a thing. We just combined it with the best relational database management system. Introducing INFORMIX-SQL. It runs on either UNIX™ or MS™-DOS operating systems. And now with IBM’s SQL grams with ours. File-itr our easy-to-use as part of the program, you can ask more of your database. Using the emerging industry- standard query language. To make your job easier, INFORMIX-SQL comes with the most complete set of application building tools. Including a full report writer and screen generator. Plus a family of companion products that all work together. Like our embedded SQLs for C and COBOL. So you can easUy link your pro- INFORMIX is a registered trademark and RDS, C-ISAM and File-it! are trademarks of Relational Database Systems, Inc. IBM, UNIX and MS are trademarks of IntemaUonal Business Machines CorporaUon, AT&T 1^11 Laboratories and Microsoft, respectively. O 1985, Relational Database Systems, Inc. file manager. And C-ISAMr the de facto standard ISAM for UNIX. It’s built into all our products, but you can buy it separately. And when you choose RDS, you’ll be in the company of some other good com¬ panies. Computer manufacturers including AT&T, Northern Telecom, Altos and over 60 others. And major corporations like Anheuser Busch, First National Bank of Chicago and Pacific Bell. Which makes sense. After all, only RDS offers a family of products that work so well together. As well as with so many industry standards. So call us for a demo, a manual and a copy of our Independent Software Vendor Catalog. Software vendors be sure to ask about our new “Hooks” software integration program. Our number: 415/424-1300. Or write RDS, 2471 East Bayshore Road, Palo Alto, CA 94303. And we’ll show you how we took a good idea and made it better. RELATIONAL DATABASE SYSTEMS, INC. UNIX REVIEW THE PU9LICATI0N FOR THE UNIX COMMUNITY Volume 3, Number 9 September 1985 DEPARTMENTS: FEATURES: 6 Viewpoint 8 The Monthiy Report By David Chandler 18 The Human Factor By Richard Morin 64 Industry Insider By Mark G. Sobell 68 C Advisor By Bill Tuthill 74 Ruies of the Game By Glenn Groenewold 80 Devii's Advocate By Stan Kelly-Bootle 82 Probiem Soiver By Bob Toxen 88 The UNiX Giossary By Steve Rosenthal 92 Recent Releases 100 Calendar 104 The Last Word 108 Advertiser's index Cover art by Stephen G. Luker 22 THE RIGHT LANGUAGE FOR THE JOB By Joel McCormack A survey of the principal languages available under UNIX. THE HOUSE OF MANY TONGUES By Steve Johnson In the UNIX environment, there is a language to every purpose. LANGUAGES 38 SOURCE CODE MAINTENANCE By Marc Rochkind Where the challenges lie and how sees can help. 42 INTERVIEW WITH STU FELDMAN By Dick Karpinski The author of f77, EFL, and make discusses the state of language technology. 50 TOWARDS ANSI C By Thomas Plum How the e standards efforts are shaping up. 51 LISP ON THE MOVE By Joel Hass What are the ties that bind UNIX and Lisp? UNIX REVIEW IISSN-0742-31 36) is published monthly by REVIEW Publications Co. It is a publication dedicated exclusively to the needs of the UNIX community Second class postage paid at Renton, WA 98055 and at additional mailing offices. POSTMASTER: Please send Form 3579 to UNIX REVIEW, 500 Howard Street San Francisco, CA 94105. Entire contents copyright 1985. All rights reserved and nothing may be reproduced in whole or in part without prior written permission from UNIX REVIEW Subscriptions to UNIX REVIEWare available at the following annual rates (1 2 issues); US$28 in the US; US$35 in Canada; US$48 in all other countries/surface mail; US$85 in all other countries/airmail. Correspondence regarding editorial (press releases, product announcements) and circulation (subscriptions, fulfillment, change of address) should be sent to 500 Howard Street. San Francisco. CA 94105. Telephone 41 5/397-1881. Correspondence regarding dealer sales should be sent to 901 South 3rd Street, Renton. WA 98055. Telephone 206/271-9605. Letters to UNIX REVIEW or its editors become the property of the magazine and are assumed intended for publication and may so be used. They should include the writer's full name, address and home telephone number. Letters may be edited for the purpose of clarity or space. Opinions expressed by the authors are not necessarily those of UNIX REVIEW. UNIX is a trademark of Bell Laboratories. Inc. UNIX REVIEW is not affiliated with Bell Laboratories. UNIX REVIEW SEPTEMBER 1985 5 PUBLISHER: Pamela J McKee ASSOCIATE PUBLISHERS: Ken Roberts, Scott Robin EDITORIAL DIRECTOR: Stephen J Schneiderman EDITOR: Mark Compton ASSOCIATE EDITOR: David Chandler EDITORIAL ADVISOR: Dr Stephen R Bourne. Consulting Software Engineer, Digital Equipment Corporation. EDITORIAL REVIEW BOARD: Dr. Greg Chesson, Chief Scientist, Silicon Graphics, Inc. Larry Crume, Director, AT&T UNIX Systems Far East Ted Dolotta, Senior Vice President of Technology, Interactive Systems Corporation Gene Dronek. Director of Software. Aim Technology Ian Johnstone, Project Manager, Operating Software, Sequent Computer Systems Bob Marsh. Chairman. Plexus Computers John Mashey, Manager, Operating Systems. MIPS Computer Systems Robert Mitze, Department Head, UNIX Computing System Development. AT&T Bell Labs Deborah Scherrer. Computer Scientist. Mt. Xinu Jeff Schriebman, President, UniSoft Systems Rob Warnock. Consultant Otis Wilson, Manager. Software Sales and Marketing. AT&T Information Systems HARDWARE REVIEW BOARD: Gene Dronek. Director of Software, Aim Technology Doug Merritt, Technical Staff, International Technical Seminars. Inc. Richard Morin, Consultant, Canta Forda Computer Laboratory Mark G. Sobell, Consultant SOFTWARE REVIEW BOARD: Ken Arnold, Consultant. UC Berkeley Jordan Mattson, Programmer. UC Santa Cruz Dr Kirk McKusick. Research Computer Scientist. UC Berkeley Doug Merritt. Technical Staff, International Technical Seminars, Inc. Mark G Sobell, Consultant CONTRIBUTING EDITOR: Ned Peirce, Systems Analyst. AT&T Information Systems PRODUCTION DIRECTOR: Nancy Jorgensen PRODUCTION STAFF: Cynthia Grant. Tamara V. Heimarck, Carrie Hunkapiller. Florence O'Brien, Barbara Perry, Denise Wertzler BUSINESS MANAGER: Ron King CIRCULATION DIRECTOR: Wini D Ragus CIRCULATION MANAGER: Jerry M. Okabe MARKETING MANAGER: Donald A Pazour OFFICE MANAGER: Tracey J. McKee TRAFFIC: James A O'Brien, Manager Tom Burrill. Dan McKee, Corey Nelson NATIONAL SALES OFFICES: 500 Howard St. San Francisco. CA 94105 (415) 397-I88I Regional Sales Manager. Colleen M Y Rodgers Sales/Marketing Assistant. Anmarie Achacoso 370 Lexington Ave. New York. NY 1001 7 (212) 683-9294 Regional Sales Manager: Katie A McGoldrick BPA membership applied for in March, 1985 VIEWPOINT The way, the truth, and the life I’ve often heard that tech¬ nology is the religion of our age. Two years in the UNIX com¬ munity have convinced me. Independent of whatever feel¬ ings people on the outside might have, a sense of righteousness runs strong among the believers. Dutifully, many of the faithful have gone forth into the world and multiplied. Alas, as with every religion, elders in this true Church seem ever to be embroiled in debate. Should services be conducted in C or Modula-2? Was not Lisp handed down on Mt. Sinai from the heavens? Answers do not come quickly. As Steve Johnson notes, unto every purpose there is a language in the UNIX environment. It is neither necessary nor desirable that these be distilled into a single tongue, but natural selec¬ tion nonetheless will take its course (a mixed metaphor if ever there was one). Which languages will ascend to the altar and which will fall by the wayside? Debates on this question seem like so much crying in the wilderness. Verily I say to you, all the preaching in the world cannot deter the mysterious ways in which inertia works. Once a lan¬ guage (or an operating system, for that matter) has become entrenched, momentum alone ensures that it will not easily be displaced. Would-be heirs must offer significant improvements to make inroads—particularly if investment in the incumbent has been substantial. Perhaps natu¬ ral selection is predestined after all. Make no mistake—C is the rock upon which UNIX is built. Although Joel McCormack makes a convincing argument in this month’s lead article for the adop¬ tion of Modula-2 as the language of choice for UNIX development, he acknowledges that his cause faces an uphill fight. As evidence, he comments on the other major languages under UNIX, telling of the advantages they offer and the reasons they have failed to sup¬ plant C in the inner sanctum. Modula-2 doubtless will grow in popularity, but C’s defenders will not stand by idly. Never mind that C is getting on in years—that its design, though well suited to limited environments, has failed to keep pace with technology. The stake in C is great. Vast numbers of programmers have grown com¬ fortable with it and the body of C software is substantial. The ques¬ tion, in any event, is strictly a religious matter. 6 UNIX REVIEW SEPTEMBER 1985 The First Name In Integrated Office Automation Software • Executive Mail • Telephone Directory Certified and Deiiverabie Since 1981 Menu Processor Word Processor Forms/Data Base Spreadsheet XED was the first independent software company to introduce a Unix WP package and achieved early success by selling to the government and international market (XED is the only Unix WP package to meet government specifications). Worldwide sales of XED rank Computer Methods first in both sales and units installed in 1984. INTEGRATED OFFICE SOFTWARE Box 3938 • Chatsworth, CA 91313 U.S.A. • (818) 884-2000 FAX (818) 884-3870 • Inti. TLX 292 662 XED UR XED is a registered trademark of CCL Datentechnik AG UNIX is a trademark of AT & T Bell Laboratories, Inc. Circle iMo. 279 on inquiry Card THE MONTHLY REPORT AT&T: Guns are the bread and butter by David Chandler Andrew Pollack of The New York Tin\es, commenting on a recent announcement made by AT&T, referred to what he called the company's “drowsy start in the computer business”. Some days previous. The Wall Street Journal had run a page-two story on the same announcement, re¬ lating it to AT&T’s “fledgling computer business”. [before loyalists to the telecom¬ munications giant start general¬ izing about the eastern establish¬ ment media, though, pause to consider the adjectives “drowsy” and “fledgling”. The terms them¬ selves don’t indicate failure, nor inability—“drowsy”, of course, describes non-energetic activity, and “fledgling” refers to a young bird just “fledged”, having just acquired the feathers necessary for flight. The point is that the potential for vigor and success is present but not yet exhibited. After all, learning to fly is a process, and AT&T only now is learning to flap its wings. rhe announcement to which the Times and Journal were referring called attention to a contract awarded to AT&T by the US Department of Defense (DoD) to |)rovide, install, and maintain System V-based, 3B Series com¬ puter systems. Should the DoD exercise all options, the con¬ tract's value would approach $946 million, the largest contract of its kind for AT&T. “This is a very large procure¬ ment which we worked very hard on for more than a year,” said Warren Corgan, Vice President of AT&T Federal Systems Division. Indeed, the DoD selected AT&T over many major vendors, includ¬ ing IBM, DEC, Honeywell, Sperry, and Gould. Neil Yelsey, an analyst with Solomon Brothers Inc., was quoted by the JournaL “This is a shot in the arm [this is, remem¬ ber, a defense contract] for both AT&T’s architecture and its (UNIX) operating system”. For all the work, money, and attention the contract brings, both AT&T and the government were very limited in their com¬ ments, declining to elaborate on a one-page press release “cleared througli proper channels”. On the one hand this is understand¬ able. Defense Department regula¬ tions being what they are. A source inside AT&T even ad¬ mitted that the Journal article was “not in keeping with DoD policy”. The contract is actually with the National Security Agen¬ cy, an intelligence organization within the DoD. On the other hand, there is ever-present speculation on how such deals as this one will afl'ect computer industry stan¬ dards. Billion-dollar contracts for machines running UNIX raise eyebrows, especially when one of the parties is the federal govern¬ ment. a strong voice in the setting of standards. For the time being, however, given the restrictions on government comment, the UNIX community is limited to specula¬ tion. Voices proclaiming UNIX success generally can olTer public knowledge, but when they enter the DoD cloister, they must take a \^ow of silence. The DoD project will be man¬ aged by AT&T’s Federal Systems Division based in Greensboro, NC. A field oflice will be set up in the Washington, DC, area to pro¬ vide on-site support. WE WILL SAY THIS A topic AT&T willingly ad¬ dresses is its June announce¬ ment of some 70 hardware and software products. Of signifi¬ cance among these are: 1) two new machines based on the WE32100 processor, the 3B2/ 400 and the 3B1 5: 2) communica¬ tion processors for connecting 8 UNIX REVIEW SEPTEMBER 1985 ''Our customers told us what they wanted in word processing: Compatibility Flexibility Ease of Learning Vendor Reliability Cost Effectiveness We listened. The Professional Writer’s Package is the result. ” Compatibility. A word processor for all machines, UNIX or MS-DOS^". l il/iKkcr, UNIX SiKiialist IVcIiiiology Flexibility. A word processor for every use, whether it’s writing complicated manuals or preparing simple letters. Ease of Learning. Time and money shouldn’t be wasted in training. On-line help, on-line tutorials with step-by-step instructions. Vendor Reliability. Extensive word processing experience, a large installed base, accessible technical support, and a liberal update policy. Cost Effectiveness. With these capabilities you can’t afford not to have the Professional Writer’s Package.^" K Call or write for information: EIIIE 1^711 1^7 4760 Walnut Street, Boulder, Colorado 80301 800/782-4896 303/447-9495 Circle No. 253 on Inquiry Card TECHNOLOGY UNIX is a trademark of Bell Laboratories. MS-DOS is a trademark of Microsoft Ca)rporation. Professional Writer’s Package is a trademark of Emerging Technology Consultants, Inc. I HE MONTHLY REPORT 3Bs to mainframes: and 3) Sys¬ tem V-VM. The 3B2/400 is a System V.2- based desktop computer for use in the 10-25 user range, with standard features including the 32100 processor (32/32-bit archi¬ tecture), 1 MB of RAM, a 10 MHz clock, a 720 KB floppy disk drive, one or two integral hard disk drives (each 30 MB or 72 MB), and an integral 23 MB cartridge tape backup unit. Options are empha¬ sized, including the ability to expand RAM to 4 MB, and a Math Accelerator Unit (MAU), also known as a 32106 co-processor. Four configurations are suggest¬ ed, ranging in price from $ 19,950 to $36,550. The 3B15 is an upgrade of the 3FT5, with the same architecture and CPU from the same family as for the smaller machine, but also ofTering a demand-paged man¬ agement system, 40 percent more CPU power, and mandatory file and record locking. The 3B15’s 32100 processor runs at 14 MHz under System V Release 2.1 (2.1 denoting the support of demand paging and a more powerful C compiler), with 2 MB of RAM, the 32106 MAU, and an 8 KB cache memory. Three suggested con¬ figurations for the 3B15 are priced from $54,500 to $64,500. While enhancements to the 3B series are welcome, a point not immediately clear is which spe¬ cific customer markets AT&T is targeting with these upgrades. Company representatives claim that, depending on the software, the 3B2/400 and 3B15 can be used either in scientific or of¬ fice automation applications. But these days it is asking a great deal of a machine to succeed in either of these environments, and to expect it to succeed in both is an excessively heavy burden. While AT&T mentions the needs of Fortune 2000 firms and the 3B enhancements that were made to meet these needs, the 400 and the 15 also have or will offer such things as the MAU and demand¬ paging—features usually associ¬ ated with scientific applications. The connection of the AT&T Communication Processor to For¬ tune 2000 applications is more readily apparent. A hardware in¬ terface “intended primarily to Voices proclaiming UNIX success generally can offer public knowledge, but when they enter the DoD cloister, they must take a vow of silence. serve the mainframe connectivity needs of users of networked 3B computers using AT&T 3BNET”, the processor is a node on a 3E5NET network that links 3Bs to IBM hosts. It runs on its own real¬ time operating system, and takes care of protocol conversions be¬ tween the 3BNETand SNA/SDLC standards, relieving the 3Bs and IBM host of that task. Contained in the processor’s control unit are its own processor, disk drive, memory, and special feature cards. There are two models, Model 1 emulating a channel or local connection to the IBM host; and Model 2, designed for remote applications, emulating a 3270- type cluster controller. Note that computers running earlier releases of System V must be upgraded to swapping versions of Release 2.0 in order to support a communication processor. Note also that the product is being introduced on a controlled basis only, and won't be generally avail¬ able until the first quarter of 1986. And one final note: if budgets are your concern, con¬ cerned you well may be—the communications processor sells for $27,000. With the objective of enabling System V functions to be support¬ ed on IBM and compatible main¬ frames, AT&T has released Sys¬ tem V-VM. The product is AT&T’s version of Amdahl Corp.’s UTS/V, and is a complete System/370 implementation of System V.2. Both Amdahl and AT&T had a key part in developing the product, working for about a year on upgrading UTS for this specific purpose. The companies will con¬ tinue working together to en¬ hance the system. System V-VM provides full screen usage of 3270 terminals, up to 16 MB of user address space, virtual I/O capa¬ bility, and other large system- oriented enhancements. General availability of System V-VM, in binary or source package, is set for October, but only on a year-by- year lease. Jay Peterson, AT&T Supervi¬ sor for UNIX planning and prod¬ uct management, and Vish Vish- wanath, UNIX Product Manager for System V-VM, were asked to compare V-VM with IBM’s VM- UNIX product, VM/IX. V-VM, they said, is based on System V Re¬ lease 2, and therefore offers a higher degree of compatibility with newer UNIX-related prod¬ ucts. Second, V-VM provides sup¬ port for full-duplex ASCII ter¬ minals and so can run interactive programs, something VM/IX can¬ not do. Also, V-VM contains Docu- menter’s Workbench and other software, including some F3erke- ley features, not found as part of VM/IX. David Buck, chairman of DL Buck and Associates, a company that supplies hardware manufac- 10 UNIX REVIEW SEPTEMBER 1985 IBM PC AT XENIX TAPE * 45/60 MEGABYTES * 90 IPS STREAMING * HIGH SPEED SOFTWARE * NOW ONLY $1095* SHIPPING TODAY The Bell XTC’" Xenix Streaming Tape System for the IBM PC AT and compatibles provides 45 or 60 Megabytes of high performance tape backup using ANSI standard 1/4” tape cartridges. 100% Xenix and IBM AT compatible. Production units are shipping today. PEACE OF MIND THROUGH IBM QUALITY STANDARDS The Wangtek 5000E unit at the heart of the Bell XTC system is the same high performance streaming tape drive used in the tape backup system sold by IBM. You get worldwide maintenance, economy of scale, and quality control driven by IBM standards, the highest in the industry. Don't settle for anything less. HIGHEST PERFORMANCE HARDWARE The XTC drive streams at 90 inches per second with data throughput up to 5 megabytes per minute. Bell’s XTC optomizes performance with on-drive microprocessor, full DMA data transfer, automatic read-while- write ECC and smart controller data buffering. UNIX SOFTWARE THAT MAKES DOS LOOK SLOW Our staff has written over 50 tape device drivers on all of the Unix releases and has ported the entire Unix system many times. In addition to standard IBM Xenix tar, dump, backup and restore, we provide Bell proprietary high speed utilities for lightning fast backup. DOS software available too. EASY TO INSTALL - INTERNAL OR EXTERNAL UNITS Procure the Bell XTC in the internal IBM PC AT version for quick and clean installation, or as an external unit complete with AT-matching cabinet. We provide all cables, software and everything else needed for installation in minutes. Bell Technologies Post Office Box 8323, Fremont, California 94537 Sales Office; (415) 792-3646 ‘One time introductory unit price valid for prepaid orders received during September and November 1985. Limit one per customer, internal mount units only. Regular price $1695, with volume pur¬ chase. OEM and reseller discounts available. Call Bell Technologies for best price and highest quality. Order your introductory unit today. Circle No. 233 on Inquiry Card Unix is a trademark of Bell Labs. Xenix is a trademark of Microsoft Corp. M( >NHUV RLPORT turers with UNIX applications and drivers to interface their systems with IBM systems, offers another perspective on V-VM. AT&T has been under pressure for some time to put out a virtual memory product. Buck said. Oth¬ ers already have gone ahead and done it under UNIX, but many nevertheless are pleased to see AT&T now bless the effort. Com¬ paring V-VM with IBM’s VM/IX, liowever, is a bit like comparing apples (no pun intended) and oranges. The products have simi¬ lar names but somewhat differ¬ ent purposes. “V-VM allows people to make good use of mi¬ croprocessors”, whereas “main¬ frame users (running VM/IX) are not precluded from doing UNIX”. The emphasis of AT&T’s clus¬ ter of recent product announce¬ ments is on communications, the company’s traditional strength; and, of course, the fact that it has now officially adopted links with IBM hardware is a welcome sight to fortune 2000 customers. Only time and customers will tell, though, how significant these products will prove to be in the greater scheme of computer com¬ pany jousting. The products may or may not determine if AT&T’s computer business is still consid¬ ered by some to be “fledgling”. WORK—BUT DON'T SMIRK- STATIONS 'Someday, girl, I don't know when, we're gonna get to that place we really want to go and we'll walk in the Sun, But till then, tramps like us, baby, we were born to run". Bruce Springsteen Doubtless Mr. Springsteen was not making an ambiguous refer¬ ence to Sun Microsystems in composing these lyrics. He none¬ theless conveys a sense of hope and desperation, and these feel¬ ings may well be growing at various workstation manufactur¬ er sites around the country. This summer has been witness to While enhancements to the 3B series are welcome, a point not Immediately clear is which specific customer markets AT&T Is targeting with these upgrades. many technologies making the all-important business transition from rumors on research to ma¬ chines coming off the line ready for sale. A primary example of this is the growing number of graphics workstations for engi¬ neering and scientific applica¬ tions now appearing or scheduled to appear soon in the micro marketplace. The competition is heating up, and customers will have to start squinting to see past the smoke to find the product that will suit them. Before deciding which work¬ station to buy, it’s helpful to have a general notion of what com¬ poses a workstation. As impres¬ sive as the new 68020 micro¬ processor is, simply putting one in an old-model microcomputer does not a workstation make. UNIX REVIEW has looked at work¬ stations before (January and July, 1985), and a working defini¬ tion was offered in those issues. Richard Morin, one of our colum¬ nists and author of the January article, “The Future of the UNIX Workstation”, points out the ba¬ sic components: a graphics termi¬ nal with high speed, high resolu¬ tion screen and communications; an added processor; added mem¬ ory; and added software. There are also certain traits or capaci¬ ties based on the “four Ms”: Mouse (or other pointing device). Megabyte (1 MB of RAM), Million Instructions Per Second (1 MIPS), and (1) Million pixels. Though helpful for listing workstation traits, current industry demands are such that the Ms should now be modified: for engineering and scientific applications, 2-4 MB of RAM are required; it’s also benefi¬ cial to run at a speed somewhat faster than 1 MIPS. (A 68020 runs at 1.5 MIPS or so.) Given this, consider the new offerings put forth by some sub¬ stantial players. In the good old days (that is, a matter of months ago), there was Sun, Apollo, Cad¬ mus, and Integrated Solutions. These four are still in the game (all are upgrading their products), but now there's also the DEC VAXstation II. the HP 9000 Series 300, the MassComp 500-Series upgrades, the Tektronix 6000 series and Tekstation AT, and even another Sun, the 2/130. Surely, there are more to come. DEC’S VAXstation II was as¬ sessed by Mark Sobell in his July column, so we proceed here to a description of the HP 9000 Series 300, currently available to OEMs and ISVs. Hewlett-Packard is tak¬ ing the modular approach with the series, offering a choice of CPUs, displays, systems soft¬ ware, and peripherals. This can make comparison difficult, but the variety allows the customer to tailor the system and plan for future upgrades. Glenda McCall, HP Product Marketing Engineer, tells of four pricing bundles prepared for what HP consid¬ ers two main markets—measure- 12 UNIX REVIEW SEPTEMBER 1985 Making UNIX Easier with TEN/PLUS Easier to Learn G et your users started on UNIX by teaching them the standard key¬ board commands and ten special com¬ mands. In the TEN/PLUS environment, that is enough to perform most common tasks and to invoke any application. As they gain experience, your users can em¬ ploy more powerful TEN/PLUS commands and all UNIX commands. Easier to Use The procedure for using TEN/PLUS is simple: point at data with a cursor and then use a TEN/PLUS command. If your users need some prompting, they can ask for a menu. If they are confused, they can ask for a HELP message. If they are processing several files, they can open a window on each file. Easier to Support The TEN/PLUS environment eliminates the errors your users make when different applications require different sets of com¬ mands. Designed around a full-screen editor, TEN/PLUS allows users to manipulate all data with the text editing commands that they use most often. This means that users can use already familiar techniques to pro¬ cess both text and data. In addition, the TEN/PLUS system provides self-explana¬ tory error messages. Here’s another way to reduce support costs: adopt TEN/PLUS as a standard user envi¬ ronment on a variety of computers—from personal computers to mainframes. Then provide TEN/PLUS to all kinds of users: clerks, managers, and engineers. A common user environment means your computer staff will have fewer products to support. Easier to Network We’re porting the TEN/PLUS environment to most versions of UNIX and to VMS. We’ll help you port it to other systems. To link systems runningour software, we’re offering electronic messaging (INmail) and a network manager (INnet) as TEN/PLUS options. These packages are already a part of IX/37(), the IBM mainframe UNIX sys¬ tem, and are available as an option on PC/IX, the IBM UNIX system for PCs. Thus, your TEN/PLUS system can readily participate in a network with IX/370 and PC/IX. Easier to Expand We’re also offering a set of development tools that helps expand the TEN/PLUS environment. One kit provides your pro¬ grammers with utilities and languages for defining and using screen forms, a user- friendly interface to the C compiler, and subroutine libraries. Another kit provides forms design and programming capabilities for your end users. Call today for more information about the TEN/PLUS environment: (213) 453-UNIX. Software Tools for System Builders. INTERACTIVE SYSTEMS CORPORATION 2401 Colorado Ave., 3rd Floor Santa Monica, CA 90404 TWX 910-343-6255; Telex 18-2030 Telephone (213) 453-UNIX THN/PLUS. INmail. INnet. and INtcnn arc trademarks of INTHRACTIVE SysiemN Corporation. UNIX is a trademark of AT&T Bell Laboratories. IBM is a registered trademark of International Business Machines Corporation. VM.S is a trademark of Digital Equipment Corporation Circle No. 300 on Inquiry Card U THE MONTHIY REPORT ment automation (requiring only low-end packages) and de¬ sign automation (where high-end specs are necessary). The least expensive bundle, selling for $5750, comes with a 68010 CPU, 1 MB of on-board RAM, a bit¬ mapped display interface, four slots, and HP-IB, RS-232-C, and HP-HIL (human-interface link) interfaces. The design automa¬ tion bundle, selling for $27,725, comes with a 68020 CPU, a 68881 floating point processor, 2 MB of RAM, high resolution color graphics screen (1024 x 768 pixel board), eight additional slots, and the same interfaces as with the 68010. The customer is also al¬ lowed to spend as much as $55,000 on the high-end of the components scale. HP-UX can be run on all models. It will be interesting to see how t he Scries 300 alters the composi- tion of the HP 9000 family. Con¬ sidered an upgrade of the Series 200, the 300 could become popu¬ lar and make some of the 200 models (except the 216 and 236, which are desktops) obsolete. The Scries 500 has multiprocessor capabilities, so one may consider software providing Network File Transfer service between the 300 and 500. Series 300 and 500 systems are also source-code compatible. HP is making it clear that it intends to offer competition in the workstation market. Last March it announced an agreement with Cericor, Inc., a small, CAE soft¬ ware tools developer based in Salt Lake City, to integrate Cericor’s CDA 5000 software packages into HP’s logic design products. Then, in July, HP acquired an 11 per¬ cent equity interest in Cericor. According to William G. Parzy- bok, HP vice president and gener¬ al manager of the Design Systems Group, “Cericor’s technology will be a strong element in HP’s overall CAE product strategies.” Two companies, MassComp and Tektronix, have come out with package upgrades, Mass- Comp for their own products and Tektronix for IBM. MassComp has two Performance Enhance¬ ment Packages (or PEPs—clever, no?) which serve as field up¬ grades for both the MC-500 and WorkStation-500 Series. PEP- 50 1 consists of a 16 MI Iz, 68020- based CPU, 68881 floating point co-processor, a 32-bit Memory Interconnect Bus, and 2 MB of memory incorporating 256 KB memory chips; this package sells for $7900. PEP-502 is PEP-501 plus a board-level floating point processor in place of the 68881, and sells for $12,900. Though officially announced, the PEPs won’t be available until “the first half of 1986”. The Tekstation AT, an IBM PC-AT with added hardware and software, is billed by Tektronix as a “low cost addition” to their 6000 Series of graphics work¬ stations. Released through Tektronix’s wholly-owned sub¬ sidiary, CAE Systems, Inc., the Tekstation AT incorporates a NS32016 co-processor, CAE 2000 design software, and like all machines in the 6000 Series, runs under UTek, a 4.2BSD-Sys- tem V.2 hybrid version of UNIX. This AT concurrently supports PC-DOS and can perform the standard tasks of a PC, but un¬ der UTek can function through networking software as a work- EQN examples lim (tanxH^* = 1 X —»ir/2 Great-looking TROFF output from low-cost laser printer! ■ TEXTWARE now offers DWB ■ For several years, Textware has been licensing TPLUSt software to process the output of TROFF and ditroff for a wide variety of phototypesetters, laser printers, etc. Now we are pleased to announce the availability of Documenter’s Workbench! with all our packages. All TPLUS users may now benefit from this current TROFF offering, with even greater power and flexibility. Many organizations are now getting maximum benefit from the HP LaserJet, using our TPLUS/LJ software. The low-cost LaserJet is a remarkable value on its own—8 page per minute output speed, 300 dot per inch resolution, and typesetter-quality fonts. TPLUS gives you access to all this and more from your own system. Wc support all the characters and accents needed by troff and eqn; in addition, special characters (©; logos too) can be sup¬ plied or generated to meet specific requirements. Our precise handling of rules and boxes allows you to take full advantage of tbl for forms, charts, etc. While even LaserJet output is not in the same class as the best phototype, it is certainly well suited to documentation and a broad range of other applications. When you do have a need for phototypeset images, TPLUS and the LaserJet will save you time and money. Preview mode lets you proof all aspects of your docu¬ ments conveniently, in-house, before sending out for phototypesetting (from our UNI*TEXT service). Cross-device proofing is a standard feature of TPLUS. The HP LaserJet printer is not only inexpensive—it is an exceptional value! Want proof? This entire ad was set in position using TPLUS on the LaserJet! t TPLUS is a trademark of Textware Inti. t Documenter’s Workbench is a trademark of AT&T Also available for* further information, please write or call. • AM 5810/6900 & 6400, APS 6 & /i6, CG 8400 & 8600, Mergenthaler 202 • Xerox 4045, 2700/3700 & 8700/9700 • BBN, Sun, 6620 & 'PC’ CRTs • Diablo, Qume & NEC LQPs • C Itoh & Epson dot-matrix Yea, TPLUS will support the new LJ. 01+0 sin(x) *>i □ TEXTWARE INTERNATIONAL POBoxU Harvard Square Telephone: Cambridge, MA 02238 (617) UNI-TEXT Circle No. 280 on Inquiry Card 14 UNIX REVIEW SEPTEMBER 1985 “CrystalWiten... was the best and most logical choice for us." Cari Laird Gray System Administration Healtfi Science Center University of Texas "Thank goodness we placed the order! We are all very impressed with the product. We were thrilled when we dis¬ covered how easy it was, yet it had all the functions we needed and didn’t insult our experienced word processor operators." fectly at home in the multi-user environ¬ ment In fact Syntactics’ newest product the Crystal'" Document Management System, is designed to integrate UNIX word processing into office automation sys¬ tems of tomorrow CrystalWriter word processing takes unsurpassed advantage of UNIX™ It’s faster and it’s easier to use, and it’s per- CrystalWriter is the next generation of UNIX word processing software. "The first software to go through AT&T’s certification testing in just one pass!” AT&T Information Systems Distributor and Publisher of CrystalWriter "A truly superior package." UNIX/WORLD Magazine When it comes to UNIX word processing software, make the same choice AT&T UNIX/WORLD Magazine, and the University of Texas made. For more information on CrystalWriter, call (408) 727-6400 (within California); (800) 626-6400 (outside California); or write: Syntactics Corporation 3333 Bowers Avenue, Suite 145 Santa Clara, CA 95054. See us at UNIX EXPO, New York, Booth #127 CrystalMiter _The Word Processor of Choice for UNIX ”' ^ SYNTACTICS* Circle No. 247 on Inouirv Card - UNIX is a trademark of AT & T Bell Laboratories. -CrystalWriter and SYNTACTICS are registered trademarks of SYNTACTICS Corporation. -Crystal is a trademark of SYNTACTICS Corporation. CrystalWriter is now available on the AT&T UNIX PC 7300,3B2,3B5,3B20; DEC VAX 750 & 780; NCR Tower; Plexus; Sun and many more. (The preceding are trademarked names.) U THE MONTHLY REPORT Station in team-engineering ef¬ forts. Such versatility comes with a price tag—Tekstation AT starts at $25,000. CAE Systems is an IBM value-added dealer, and can add a 10 MHz co-processor, graphics card (for 720 x 704 pixels resolution), color display, and increase disk storage to 280 MB and RAM to 4.5 MB. (CAE also produces a 12-inch Liquid Crystal Shutter (LCS) color display for the AT; due out in October, it will sell for $3700.) There is even a config¬ uration complete with file server for about $40,000. THE SUN ALSO RISES As a public relations statement will tell you, “Sun Microsystems designs, manufactures, and mar¬ kets high-performance, general- purpose workstations for tech¬ nical professionals". The work¬ station is Sun’s business, and Sun is making it its business to stay on top of the workstation market. For this purpose, this summer Sun has made notable changes in its marketing and product approach. The first of these was across- the-board price cuts on its sys¬ tems and memory. The 2 MB diskless Sun-2/50 now lists for $8900, down from $13,400; the Sun-2/160 Color SunStation with 2 MB of available memory was reduced from $36,400 to $27,900; and the 71 MB drive with 45 MB, 1/4-inch cartridge tape option available for the Sun- 2/120, 130, and 160 pedestals dropped from $10,900 to $7900. The price for 1 MB of memory, formerly $4100, is now $1500. John Hime, director of product marketing at Sun, points out two main reasons for the price reduc¬ tions. “Component costs are way down over the past year,” for one. For another, though, as Hime admits, “There is a general heat¬ ing up in the industry. Our com¬ petitors are continuing to offer discounts below their list price, and Sun needed to respond to this”. The second Sun move was to announce two new products; the Sun-2/130 SunStation, essential¬ ly a 2/160 without a color board and with monochrome monitor instead of color; as well as an optional mass storage subsystem for the Sun-2/50. UNIX SYSTEMS UTILITY SOFTWARE UBACKUP BACKUP, RESTORE, AND MEDIA MANAGEMENT USECURE SYSTEM SECURITY MANAGEMENT SPR PRINT SPOOLING AND BATCH JOB SCHEDULING -SO YOU CAN GET ON WITH SSL FULL-SCREEN APPLICATION DEVELOPMENT S-TELEX TELEX COMMUNICATIONS MANAGEMENT YOUR JOB. SSE FULL-SCREEN TEXT EDITOR For more information, call or write. (703)734-9844 These products are available for most UNIX or UNIX-derivative operating systems, including System V, 4.2 BSD. 4.1 BSD, Xenix, Version 7. System III. Uniplus, and others. UNIX is a trademark of AT&T Bell Laboratories. UNITECH SOFTWARE INC. 8330OLD Visit us at: UNIXEXPO Booth No. 264 FCC Booth No. 675 COURTHOUSE RD. SU1TE800 VIENNA, VIRGINIA 22180 16 UNIX REVIEW SEPTEMBER 1985 Circle No. 282 on Inquiry Card Third. Sun announced up¬ grades to the 68020 processor for its VME bus-based products, the 2/130 and the 2/160. This an¬ nouncement came in June, but the upgrades, available to new customers and past purchasers, will begin shipping at year’s end. There are two further points on the general development of workstations. The first concerns buses. With the emphasis on the 68020, a 32-bit processor, there is a tendency toward full 32-bit buses. The VME bus is gaining popularity, and for good reasons, according to Sun’s John Hime: it’s a full 32-bit bus, has a high bandwidth (20 MB/second trans¬ mission), and add-on board ven¬ dors are really going for it. The other trend in workstation development regards the Motor¬ ola 68020 processor. It’s been announced, it’s been touted, and customers are looking forward to using the two to threefold in¬ crease in power it can deliver. Availability to customers, though, is something that takes time. Motorola’s Jeflf Nutt, Technical Marketing Manager, and Jim Far¬ rell, Manager of Technical Com¬ munications, state that their company was starting sample quantities in June of 1984, is at high production output at this writing, and is projecting produc¬ tion of 50-70,000 of the pro¬ cessors this year. Workstation manufacturers then have the ball in their court: retesting software (though programs running under the 68010 should run as is under the 68020), reprinting manuals, and retraining salespeople. Far¬ rell also points out that many companies are taking the oppor¬ tunity to enhance their operating systems at the same time they upgrade to the 68020, and such enhancement can push the prod¬ uct shipping date back a bit further. There are machines in¬ corporating the processor that have completed these procedures or soon will. The Altos 3068 started shipping in July, and HP was offering six to eight weeks delivery ARO for the 9000 Series 300 as of August 1. The 68020s to be offered by many other manu¬ facturers should be in their hous¬ ings by Christmas. David Chandler is the Associate Editor of UNIX REVIEW. ■ Easier THAN 1 - 2 - 3 ... BUT DESIGNED FOR LARGER SYSTEMS RO. BOX 2669 KIRKLAND, WA 98033-0712 I EFFECTIVE SOFTWARE FOR BUSINESS ;j4 f Tr i ■ , , , H ' i !' i Vi i-' i ^1- V> ■!'• V. In'H jt .:Lr l.:*>; \ .\ 'i v L''V ‘--Vi i ' Ifs simple, C-CALC from DSD Corporation is more flexible, has more functions, and is easier to use than the best selling spreadsheet. We made it that way for a very simple reason, you'll get more work done and make better decisions in less time. Thafs what makes you successful whether you are planning for the future, fore¬ casting trends, or analyzing profits. The most popular spreadsheets require a great deal of time to get up and running. When we created C-CALC we kept in mind that time is your most important resource. Our On-Line Help facilities, prompts and menus allow even someone with minimal experience to see meaningful results in very little time. Our built- in training procedures let you pace your own learning with tutorial topics that range from basic to advanced. As you become more expe¬ rienced, C-CALC allows you to bypass prompts and menus to save even more time. So call DSD Corporation at (206) 822-2252. C-CALC is currently available for: UNIX, VMS, RSTS, RSX, IAS, P/OS, AOS, AOS/VS (Data General), IBM CSOS. C-CALC is a registered trademark of DSD Corporation. UNIX is a registered trademark of Bell Labs. P/OS, RSTS and RSX are registered trademarks of Digital Equipment Corporation. AOS and AOS/VS are registered trademarks of Data General Corporation. Circle No. 283 on Inquiry Card UNIX REVIEW SEPTEMBER 1985 17 THE HUMAN FACTO R= Alternative prototyping languages by Richard Morin When all you have is a hammer, everything begins to look like a nail. Unknown UNIX shells and utilities are very useful for fast prototyping. Previous columns (May and Au¬ gust , 1985) have touted them and given examples of their use. Part of their power lies in the fact that they are tuned to certain kinds of applications. The same tuning makes them less suitable for other tasks, but a well equipped workshop should maintain a vari¬ ety of tools. This column presents a smorgasbord of prototyping lan¬ guages, some of which may well belong in your toolbox. Prototyping languages should promote interactive development, i)oth by quick turnaround and by relatively loose structure. This means that, though they may have compilers, they should also have interpreters and/or in- (Tcmental compilers. The very strong type checking and formal spcH'ifications required by many modern languages make them too demanding for fluid program de- veloj)ment. Verbosity is also a bad thing in prototyping: a COBOL interpreter would not qualify. Fi¬ nally. though speeialization is often useful and even necessary, a j)rototyping system easily can become too finely tuned, turning into more of a parameterized utility than a true programming language. Nevertheless, there are a sur¬ prising number of languages meeting the preceding criteria. Kven restricting the search to those that run on my Sun, I have found implementations of APL, BASIC, P^ORTII, Lisp, MAGIC/L, Nial, and Prolog. This list, while most assuredly in¬ complete, spans a wide range ol jirogramming language phi¬ losophies. Each language has its own peculiar way of looking at data structure, syntax, and other jirogramming questions. This tends to suit certain lan¬ guages to certain applications, or at least to certain kinds of users. 'I'he loiases are not accidental, however, stemming directly from the way in which computer lan¬ guages are developed. Computer languages are in¬ vented mostly by individuals, sometimes by small groups, and occasionally by massive commit¬ tees. The number of people in¬ volved in the process has a direct effect on the resulting product. Languages invented by individ¬ uals lend to be very elegant, pure, and cohesive, reflecting the in¬ tense elfort expended in their creation. As larger groups enter the process, either in the design phase or as users, the language trades some of its purity for practical but inelegant additions. Massive committees seem to pro¬ duce massive languages such as Ada and PL/I. Prototyping lan¬ guages are no exception to this trend, as the following descrip¬ tions will show. BASIC BASIC (Beginner's All-purpose Symbolic Instruction Code) was invented in (he mid-’60s by Drs. John Kemeny and Thomas Kurtz of Dartmouth College. Designed as an instructional tool, it has a simple algebraic syntax much like Fortran. This simplicity, and the ease of implementing BASIC interpreters, have made the language extraordinarily popular with amateur programmers, and almost ubiquitous on small com¬ puter systems. Unfortunately, this same simplicity has necessi¬ tated a plethora of changes 18 UNIX REVIEW SEPTEMBER 1985 YOU CHOOSE: Terminal Emulation Mode MLINK CU UUCP Menu-driven Interface Yes Expert/brief Command Mode Yes Yes Extensive Help Facility Yes Directory-based Autodialing Yes Automatic Logon Yes Yes Programmable Function Keys Yes Multiple Modem Support Yes Yes File Transfer Mode Error Checking Protocol Yes Yes Wildcard File Transfers Yes Yes File Transfer Lists Yes Yes XMODEM Protocol Support Yes Compatible with Non-Unix Systems Yes Command Language Conditional Instructions Yes User Variables Yes Labels Yes Fast Interpreted Object Code Yes Program Run Yes Subroutines Yes Arithmetic and String Instructions Yes Debugger Yes Miscellaneous Electronic Mail Yes Yes Unattended Scheduling Yes Yes Expandable Interface Yes CP/M, MS/DOS Versions Available Yes MLINK The choice is easy. Our MLINK Data Communications System is the most powerful and flexible telecommunications software you can buy for your Unix^system. And it’s easy to use. MLINK comes complete with all of the features listed above, a clear and com¬ prehensive 275-page manual, and 21 applications scripts which show you how our unique script language satisfies the most demanding requirements. Unix System V BSD 4.2 MS-DOS Unix System III Xenix CP/M Unix Version 7 VM/CMS and more. choose the best. Choose MLINK. Altos Data General IBM Arrete DEC Onyx AT&T Kaypro Plexus Compac] Honeywell and more. MLINK is idocil for VARs tind applicalioo builders. Please call or write for information. Corporate Microsystems, Inc. P.O. Box 277, Etna. NH 03750 (603) 448-5193 Ml INK IS .I 1 1,idem.Ilk ol ( oi poi.ilc Mu i()s\ stems. Im Iniv is .1 ti.idem.ii k nl MM |{i‘ll I .iboi at ones. lUM is .1 legist err'd ti.idem.iik ot IHM C oip. MS-I)()S ,ind Xenix .iic ti.ideni.iiks ot Mi( losolt ( oip. C I* M is ,1 legisleied ti.idem.ii k ol I )igit.il Kese.in h. Circle IMo. 281 on Inquiry Card U THE HUMAN FACTOR to BASIC, with virtually no standardization. It lias also made BASIC an object of scorn for professional programmers, who ridicule its limited control and data struc¬ tures, lack of modularity, and unimpressive performance. For¬ tunately. many of these problems are being addressed. Compiled BASIC can be quite efficient: extensions allow for modern lan¬ guage features, and standardiza¬ tion eilorts are underway. In the meanwhile, [3ASIC devotees at least can gloat about the enor¬ mous quantities of public domain software available to them. APL AND NIAL AFL and Nial (“Nee-al”) are characterized by the use of arrays as their fundamental data struc¬ ture. While other languages have arrays, these languages use them, allowing them to be manip¬ ulated as easily as scalars. Both languages support nested, het¬ erogeneous arrays, allowing ele¬ ments to be of any type, including arrays. AFL and Nial have opera¬ tors that are roughly equivalent to the built-in functions found in C and F'ortran. Since the operators work on arrays as well as scalars, however, their power is much greater. AFL (A Frogramming Lan¬ guage) was invented by Dr. Kenneth E. Iverson of IBM in the early '60s. Often characterized as a “write-only" language, AFL makes C look verbose. The most famous features of the language, in fact, are its terseness and the plethora of special characters it uses. These are closely related— the special characters actually serve as operators in AFL. The AFL character set is thus a mix¬ ture of Roman. Greek, and math¬ ematical symbols mapped onto a standard keyboard. The growth of AFL has been severely hampered by the need for special display and printing devices. With the advent of bitmapped displays and intelligent printers, AFL may get a second chance for glory. Nial (Nested Interaetive Array Language) was developed in the The very strong type checking and formal specifications required by many modern languages make them too demanding for fluid program development. late ’70s by Dr. Michael A. Jen¬ kins of Queen's University and Dr. Trenchard More, Jr. of IBM. Based on array theory, as devel¬ oped by Dr. More in the late '60s, it has been implemented as a commercial product named Q'Nial. Nial uses operators much like AFL. but they are written as alphanumeric tokens. In addi¬ tion, Nial is able to embed its operators in data structures, of¬ fering Lisp-like capabilities. Nial advocates argue that it is a more complete language than AFL, and is therefore more pow¬ erful and eonsistent. This consis¬ tency. they say, allows Nial pro¬ grams to be transformed and analyzed formally in ways that are impossible for other lan¬ guages. The syntax, in any case, is a hybrid, looking a bit like a mixture of AFL and C. This is due to the fact that Nial operators can be "applied" to values, "com¬ posed" with other operators, and generalized by built-in "trans¬ formers”. This allows Nial opera¬ tors to function on the almost limitless variations of data struc¬ tures allowed by the nested het¬ erogeneous array format. Don’t expect blinding efficien¬ cy from either AFL or Nial, since they are typically (though not always) implemented as inter¬ preters. Instead, think of them when your problem has a strong mathematical or statistical fla¬ vor, and consider using Nial for AI applications. Most programming languages treat arrays as places to store things, and only allow work to be performed on the things themselves. If this part of Von Neumann’s legacy is cramp¬ ing your style, consider trying one of these more mathematically oriented languages. FORTH AND MAGIC/L FORTH and MAGIC/L (“mag¬ ical”) are similar in several re¬ spects. The principal difference is that MAGIC/L has dropped FORTH'S RFN (Reverse Folish Notation) syntax in favor of a more conventional algebraic style. Both languages are imple¬ mented as incremental compil¬ ers, giving them nearly the speed of conventional compiled code, and most of the convenience and flexibility of an interpreter. While both languages run well under UNIX, they can be used without it. and often are. Finally, the languages show similar facility for dealing interactively with hardware devices. FORTH was developed by Dr. Charles Moore in the early ’70s. Its principal data abstraction is the stack, but it supports almost anything else on a roll-your-own basis. The RFN syntax is the principal target of FORTH critics. They note that it requires one to remain aware of the state of the stack at all times, and that it makes reading F'ORTH code quite 20 UNIX REVIEW SEPTEMBER 1985 difficult. FORTH advocates argue that awareness of the stack en¬ courages efficient use of the ma¬ chine, and that the simplicity of the syntax allows it to be very general and powerful. In any case, FORTH is flexible enough to allow any determined user the chance to modify its appearance. MAGIC/L, invented by Arnold Fpstein and Jeffrey D. Morris of Loki Engineering, is a well devel¬ oped alternative solution, howev¬ er. It is incrementally compiled, handles machine dependencies beautifully, and looks surprising¬ ly normal, rather like simplified C or Pascal. Although MAGIC/L only supports singly-subscripted arrays, its “record" construct allows the definition of fairly arbitrary data structures. LISP AND PROLOG Lisp (List Processing) and Pro¬ log differ radically from each other, but they are both heavily used by the AI community. Their strongest similarity is perhaps their facility for symbol manipu¬ lation. This facility suits them for working with knowledge (facts, rules, relationships, and the like) as opposed to mere data. Since AI coding is done in a highly interac¬ tive and exploratory manner, both languages have a strong prototyping flavor. Additionally, both languages use lists as their basic data structure, though the details differ widely. Lisp was invented by Dr. John McCarthy and his associates in the late '50s, but it has under¬ gone drastic changes since that time. Although Lisp was strictly an interpretive language initially, implementations now generally compile or interpret as desired. Doth programs and data are stored by Lisp as binary trees, and recursion is the main vehicle for traversing the trees. This simple and consistent structure has proven to be remarkably flexible, allowing the grafting of a wide range of programming para¬ digms onto Lisp. Lisp programs can. for instance, contain “intel¬ ligent" data structures or gener¬ ate expressions that are then evaluated. AI programmers com¬ monly create problem-oriented dialects to assist them in their work, much as UNIX devotees create tools such as sed and make. Prolog was developed in the '70s by assorted computer scien¬ tists in Marseille (Battani, et al.), with help from Warsaw (Kluz- niak, et al.), Edinburgh (Pereira, et al.), and elsewhere. It differs from conventional programming languages in that its semantics are declarative rather than im¬ perative. One thus programs Pro- a set of facts and rules and asking it to prove a given assertion. Prolog scans its knowledge base, attempting to find a combination of facts and rules that will provide the re¬ quested proof. Part of the interest in Prolog stems from the possi¬ bility that hardware could be built to perform these searches in parallel, providing an opportun¬ ity for efFicient large scale multiprocessors. IN SUMMARY For every class of programming application, there is likely to be someone who will get fed up with the existing languages and build another. Alternatively, a lan¬ guage may be developed simply to experiment with ideas or to ex¬ press a philosophical point. Most of these fade into (often well deserved) obscurity, being too specific, insufficiently robust, or simply too similar to other avail¬ able tools. Occasionally, however, a group of followers will develop around a language. Software is produced, books and articles are written, and a subculture devel¬ ops. wSomc of the languages de¬ scribed above have withstood this kind of scrutiny: others arc still under the gun. All of them, how¬ ever, have attracted users and advocates, and hence deserve consideration by adventurous programmers. Mail for Mr. Morin can be setit (o Canta Forda Conipnter Lab. PO Box 1488. Pacifica. CA 94044. Richard Morin is an independent computer consultant specializing in I he design, development, and documentation of software for engi¬ neering, scientific, and operating systems applications. He operates Canta Forda Computer Lab in Paci¬ fica, CA. m m FRANZ THE FIRST NAME IN LISP ■ Franz LISP from Franz Inc. is currently available under UNIX and VIMS. Nom ' with Flavors and Com imon LISP compatibil- ity. Franz sets the stan- dard for LISP. Fran z Inc. 1141 Harbor Bay Parkway Alameda, California 94501 (4151 > 769-5656 UNIX is a irademark of Boll Labs VMS is a iradcmark of Digital Equipment Corporatioti ■ ■ ■ ■ ■ ■ Circle No. 278 on Inquiry Card UNIX REVIEW SEPTEMBER 1985 21 THE RIGHT LANGUAGE FOR THE JOB An overview of the potpourri of UNIX options by Joel McCormack UNIX and C arc intertwined symbionts that teed otl' one an- other's success. The fact that UNIX is written in C has made the system portable and extensible, which has helped make it popu¬ lar: the C software base generated by UNIX in turn has spawned C comj:)ilers for other operating systems. 1'hus, a discussion of program¬ ming languages available on UNIX must revolve around C. Why is C so dominant, and how have other languages filled nic hes not addressed by C? 'Phis article describes how C allowc'd UNIX to be written in the first place, and explains why C remains the UNIX programming language of choice. The evalua¬ tions of f'ortran, Pascal, Ada, and Lisj) (hat follow emphasize the advantages these languages have over C, and the weaknesses that prevent them from displacing C. 'fhc shell, which supplies the glue for sticking programs togeth- c'r. and make, which assists with tlu’ generation and maintenance ol systems of programs, are then briefly described. Finally, this paper delineates C's deficiencies, and proposes a possible replacement: Modula-2. Offering the power and efiiciency of C with none of the flaws, Modula-2 may ultimately emerge as the language to surpass C as a tool for writing and maintaining software systems. C fhough the original UNIX op¬ erating system was written in assembly language, its authors realized that further progress re- cjuired a more powerful notation, 'fheir experiences with the lan¬ guages BCPL and 13 led Dennis Ritchie to include multiple primi¬ tive types and a method of com- i:)Osing types in the successor language he called “C". C was intended only as a more convenient notation than assem¬ bly: efficiency and access to low- level facilities had priority over all else. Hence C does not allow the assignment of one array to an¬ other. and types are not included for compile-time checking, but merely allow the code generator to emit the proper instructions. The language succeeds as a step up from assembly program¬ ming. C can do nearly everything that assembly can, at a modest cost in efficiency. The Berkeley 4.2 release contains less than 1300 lines of assembly code in the kernel, while I estimate code written in C is no more than 40- 80 percent larger than hand¬ written assembly code. C also supports (he creation of libraries of routines. A program can be broken into pieces that are devel¬ oped and compiled independent¬ ly: general-purpose routines need not be incorporated textually into a program, but only linked to it. C has two unique advantages over all other languages in the UNIX environment: it was the first language implemented, and remains the only system pro¬ gramming language available on all versions of UNIX. As a result, programmers often modify exist¬ ing C programs rather than start Irom scratch in a language better suited to the task. And the bene¬ fits of a large software base now extend beyond UNIX: systems software companies, particularly in the microprocessor world, offer a variety of C compilers with ’UNIX-compatible" libraries. 22 UNIX REVIEW SEPTEMBER 1985 : A. -K. UNIX REVIEW SEPTEMBER 1985 23 LANGUAGE OVERVIEW Considering the importance of C to UNIX, the portable C compil¬ er is surprisingly mediocre. Its speed is not exceptional (1400 lines per minute on a VAX 11 /780). The compiler tends to be easily confused by errors, often making it easier to fix one mis¬ take at a time in preference to wading through a deluge of spur¬ ious complaints. The code the compiler generates also leaves much room for improvement. To compete successfully with C, other languages must offer something C does not. This strong suit may be anything from a large engineering software base (as with Fortran), to language fea¬ tures not found in C (as with the strong typing of Pascal and Mo¬ dula-2), to a view of a world alien to C (as with Lisp). The following sections describe some of these languages that have found a home in the UNIX environment. FORTRAN Fortran’s designers intended that the language would permit algorithms to be written in an algebraic manner, and that the housekeeping operations of array indexing, flow control, and input/output would be simplified. The most important goal, though, was efficiency; John Backus ex¬ pected Fortran programs to run at least half as fast as hand-coded assembly. The original compiler performed such impressive opti¬ mizations that it set the standard for Fortran compilers for years to come. Today, Fortran remains the primary language for scientific and engineering programming. Fortran benefited greatly from being the first popular high-level language: there are vast libraries of Fortran that can be ported between machines as easily as C programs can be ported to other operating systems. And even though Fortran’s only type struc- Modula-2 may ultimately emerge as the language to surpass C as a tool for writing and maintaining software systems. ture is the array and its control structures are anything but mod¬ ern, it offers better support for arrays and real number types than C. Arrays can have variable bounds, and support for both single and double-precision real and complex numbers is offered. Fortran is well integrated into Berkeley UNIX. It can call C routines (and vice-versa), the For¬ tran 77 standard is implemented, and two pre-processors, RATFOR and EFL, convert extended ver¬ sions of Fortran into standard Fortran. But the Fortran compiler is less error-free than the C compiler, and the code it gener¬ ates is unimpressive; two of the four persons who reviewed this article related stories of program¬ ming groups using VMS rather than UNIX just to gain access to the VMS Fortran compiler. Better Fortran compilers may appear as UNIX is implemented on the new generation of high-speed num¬ ber-crunching machines, but we must wait to see. PASCAL Niklaus Wirth created Pascal in order to teach the clear expres¬ sion of data composition and structured control flow. The type system of Pascal is based on the ideas of another professor, C. A.R. Hoare, who in turn found Pascal coherent enough to produce an axiomatic definition. The lan¬ guage has since spread well be¬ yond its academic roots. Types in Pascal correspond to familiar mathematic abstrac¬ tions, and are designed to help prevent common programming errors. Thus, pointers in Pascal refer to a specific type; the values that are assigned to scalars can be limited using subrange decla¬ rations; set operations are includ¬ ed; and arrays have declared lower and upper bounds. Most importantly, different types can¬ not be mixed freely. Pascal is a far safer language than C to teach to beginning students. In C, something as mundane as a copy of one array to another may destroy all of mem¬ ory if the loop terminating condi¬ tion is written incorrectly. In Pascal, the same action is written either as a single assignment statement, or as a loop in which indices into the source and desti¬ nation arrays are checked to ensure that they are within the bounds of the arrays. Many seasoned programmers also appreciate the safety afford¬ ed by the strict type-checking of Pascal. Compared with C, Pascal programs that compile are more likely to be bug-free; if something goes wrong at runtime, a Pascal program is more likely to com¬ plain nicely than to behave in a mysterious way. Range-checking, case-checking, variant-checking, and nil pointer-checking enable Pascal to report an error in the vicinity of its source, rather than in a spot of the program many instructions later. Designed for use by student programmers, the Berkeley Pas¬ cal compiler handles compile¬ time errors better than any other 24 UNIX REVIEW SEPTEMBER 1985 V compiler on UNIX. By using an extended version of the yacc parser generator, the Pascal com¬ piler gives extremely accurate messages, and rarely gets so con¬ fused that it cannot continue parsing. It also emits a variety of warnings, detecting when a vari¬ able is used but never assigned, or when a variable is declared but never used. Berkeley Pascal’s extension for separate compilation offers a sim¬ ple but effective version-checking scheme: the compiler computes a hash value for each .h file that’s included and stores this value in the resulting object file; when the compiler links several object files into an executable program, it ensures that all object files have the same hash value recorded for a given .h file. Berkeley Pascal offers a few other extensions that alleviate Pascal’s problems by blank-filling constant strings to the right size, and by providing I/O procedures for file opening, closing, and random-access. Like Fortran, Pascal can call C and vice-versa. For all that, Pascal is still a weak contender against C. The Berkeley compiler compiles at 950 lines-per-minute, and under 800 1pm if runtime checks are generated. What’s more, it gener¬ ates poor code. And finally, whereas “standard” C is general¬ ly useful, standard Pascal often is not. Pascal’s type-checking simply does not outweigh these disadvantages. ADA The Department of Defense, realizing that languages in use by the military were inadequate for reliably producing large software projects, commissioned four competing groups to design a language. This language was to support many advanced pro¬ gramming concepts, including type-checking, modularity, and high-level support for low-level tasks. Eventually, the Defense Department decided on one of the proposals: after many revisions it became the language Ada. The result is a powerful but frustrating language. Ada has two major problems; a "kitchen sink" feeling that stems from committee decisions about lan¬ guage constructs; and features that interact poorly and are hard to compile. Because implementa¬ tions of Ada were not developed concurrently with the language specification, there was little practical feedback about design decisions. As a result, Ada is not popular. It takes a while to learn to use it well, and compilers for Ada are large and slow. Ada on UNIX is used largely for education and to cross-compile programs for mili¬ tary computers. LISP Lisp has a view of the world quite unlike C’s. Originally devel¬ oped in the late 1950s and early ’60s, Lisp was designed for the manipulation of symbolic ex¬ pressions rather than numbers. Whereas Fortran is oriented toward a concrete realization of functions. Lisp is one step removed—it is often used to perform operations (like differ¬ entiation) on functions them¬ selves. All operations, including arithmetic, are written in a func¬ tional notation based on Alonzo Church’s lambda calculus. A fluke in Lisp’s design elimi¬ nates the boundary between data and code, allowing the language to execute the very lists it creates. Lisp is historically significant for another reason: it pioneered auto¬ matic garbage collection. These qualities have made the language the mainstay of the artificial intelligence community. Lisp’s longevity means that thousands of programs have svs FORTRAN The SVS FORTRAIVI-77 language is now available on an expanded family of CPUs. It fully supports; • Full Ansi Standard A/IC68000 • GSA Certifiable • Many Language Extensions derived from our large user community • Symbolic Debugger MS32000 • Optimizing Code Generation • High Speed Compilation • Very Large Applications • Integrated Hardware Floating Point Interfaces: MC68881, SKY, IMS3208I, and Custom MC68020 • Complete User Documentation • Available since 1981 SVS has been a major OEM supplier of compilers since 1979. For further information about these and other quality OEM compilers call 415/549-0535. Silicon Valley Software, Inc I00I1 N. Foothill Blvd., Suite 111 Cupertino, CA 95014 Circle No. 272 on Inquiry Card UNIX REVIEW SEPTEMBER 1985 25 of it, ULTRIX** Which now has led to the latest related advance. To the tool that makes ULTRIX software more use- ful than ever. EPIX. The microcomputer that’s SO handy it’s already becdming the tool of the trade. Like any good tool, EPIX makes jobs easier. Because it not only comes packed with all the ULTRIX soft¬ ware, but supports everything else in the world that’s QBUS compati¬ ble. Meaning there’s a raft of helpful hardware readily available too. And since programmers need to count on their tools, we’ve built EPIX with the most reliable indus¬ try-standard innards. From its UNIX time-sharing system to its J-11 super microprocessor. To make EPIX exceptionally use¬ ful, we’ve also made sure users won’t outgrow it. By giving it up to 369Mb of formatted high-speed Winchester capacity. And a main memory of up to 4Mb. So you can make it fit the job now, and it’ll still be able to grow as the work expands. What’s more, EPIX comes from a company that tries to be every bit as helpful as its products. A com¬ pany more interested in what you want than what it’s got. To test that statement, you can simply use another tool of the trade. The telephone. SUPERMICRO FROM THE WORLD OF DEC Call: 1-800-UNBOUND Toll Free In California 714-895-6205 TWX: 510 100 1075 Unbound Inc. 15239 Springdale St. Huntington Beach, CA 92649 Circle No. 254 on Inquiry C;ird •Trademark of Bell Laboratories Trademark of Digital Equipment Corp. TrT jT3 HiH MlSIlllIlffiR lillllfIM been written in it. Many of these are included in Berkeley UNIX’s Franz Lisp, along with some op¬ tions and support packages that make the porting of other Lisp software from various dialects feasible. Franz Lisp programs can be either interpreted or compiled, and can call C, Pascal, and For¬ tran routines. Franz Lisp also includes a nice debugger and a user-extensible editor. On the downside, P'ranz Lisp is oriented toward teletype interac¬ tions, and executes slowly. Lisp on UNIX is nice to have if you require UNIX for other things, but doesn’t quite satisfy the serious Lisp developer. Lisp may find more acceptance on UNIX as UNIX is ported to new, high-speed machines. THE SHELL Part of the UNIX philosophy is that programs should be small and single-minded: programmers can then hook them together (via pipes) to accomplish more com¬ plex tasks. The various shells provide a simple, flexible mecha¬ nism for wiring programs togeth¬ er. Two popular versions are the Bourne shell (sh) and the C shell (csh). Both sh and csh are inter¬ active. A single command line can pass string arguments to programs, redirect input or out¬ put to a file, pipe several pro¬ grams together with the output of one going to the input of the next, and expand wild-card filenames. Both shells are also used for programming more complex pat¬ terns of program invocation. If statements and loop statements test to see if a program or se¬ quence of programs have termi¬ nated normally, and the case statement tests string arguments and variables using the same pattern-matching conventions as filename expansion does. The output of a program can even be used as a statement of the shell program. The use of shell programs (or scripts) fall into two general classes: one is to customize exist¬ ing commands. Such scripts are but one or two lines, and add only a fixed set of arguments to those already provided, or pipe several programs together into one superprogram. The other use of scripts re¬ sembles conventional programs. Such scripts use variables and control constructs, and range from half a page to several pages. These programs typically inter¬ pret the arguments passed to them, invoke different programs based on the arguments, and/or perform some operation on each file in a directory. The use of scripts is transpar¬ ent to the user. A UNIX command is an executable object file gener¬ ated from C, Pascal, Fortran, Modula-2, or Lisp: or a script written in any of the shells. All are invoked and passed argu¬ ments in the same way. This uniformity and the easy access to pipes provides a meta-pro¬ gramming environment superior to nearly all other operating systems. THE MAKE PROGRAM Because of make, it is possible to maintain large programs on UNIX (including UNIX itselfj. The make program uses two kinds of rules. The first is a generic set of rules for deriving one type of file from another: for example, .o object files are created from .c source files by calling the C compiler cc. The second is a sjDecific set of rules stating depen¬ dencies between a group of files: for example, an object file de¬ pends on the main .c source file that is compiled to create it, as well as all .h header files that are included. A specific rule may include a derivation command svs Pascal The svs Pascal language is now available on an expanded family of CPUs. It fully supports: • Ansi Standard MC68000 • IEEE Floating Point, both Single and Double Precision • Full Featured with most UCSD Extensions • Interlinkable with SVS "C" and SVS FORTRAIM • Symbolic Debugger IMS32000 • Optimizing Code Generation • High Speed Compilation • System Programming and Very Large Applications • Modular Programming • Secure Separate Compilation MC68020 • Complete User Documentation • Available since 1980 SVS has been a major OEM supplier of compilers since 1979. For further Information about these and other quality OEM compile call ^;ffi^9-0535. Silicon Valley Software, Inc toon N. Foothill Blvd., Suite 111 Cupertino, CA 95014 Circle No. 272 on Inquiry Card UNIX REVIEW SEPTEMBER 1985 27 SI LANGUAGE OVERVIEW that overrides the generic rule. When told to ensure that a file is up-to-date, make looks at the dependency rule for the file. If the specified file was last created or modified more recently than all the files it depends on, make tells you all is well. Otherwise, make regenerates the file (after regener¬ ating any files the specified file depends on). The make program is merely convenient when used to specify the same set of compiler flags across all compilations; it is es¬ sential when the files depend on each other, since a change to one file may require recompilation of several others. The make program thus provides version¬ checking and automatic recompi¬ lation to languages that lack this capability. THE PROBLEMS WITH C UNIX is no longer a small operating system with a few text¬ processing utilities. I suggest that the very language that made UNIX possible is now slowing its further progress. Not all problems can be reduced to small programs connected via pipes, and C is an inferior programming language for large, multi-author software systems. First, the notation itself is not error-resistant. Frequent C pro¬ gramming mistakes involve one- character mishaps, like substi¬ tuting = for = = , & for &&, I for 11 ,or putting a semicolon after a for loop header. C programmers waste time tracking down sim¬ ple typographical mistakes that other languages detect at compile time. Second, the type composition rules of C are contorted for all but the most simple structures: decla¬ rations use both prefix and post¬ fix notation with an arbitrary precedence hierarchy. The C dec¬ laration for a variable that is a function for returning a pointer to I suggest that the very language that made UNIX possible Is now slowing Its further progress. an array of pointers to characters is: char ♦U(*f)())[MAXSTRIN6S]; Third, the lack of type-check¬ ing is, I hazard, the largest source of productivity loss for C program¬ mers. The portable C compiler generates warnings for many of the legal—but usually wrong— constructs that C allows, thereby encouraging the use of type casts, but many mistakes go unnoticed. The use of the type int to repre¬ sent integer, character, and bool¬ ean types often leads to programs that manage to compile, but com¬ pute the wrong result. The deficiency of type-check¬ ing extends to procedures as well. Parameter types are not part of the procedure header declaration but are only included in the actual procedure definition, so .h files do not contain type information. Worse yet, when a procedure accepts a variable number of parameters, the type of param¬ eters that are expected can be determined only by reading the code inside the procedure. Further, C’s parameter-pass¬ ing convention invites disaster. In languages like Pascal and Mo¬ dula-2, the method of passing a parameter—by value or by ad¬ dress—is specified once in the procedure heading, and the com¬ piler ensures that the correct code is generated thereafter. C forces the programmer to remember and specify the appropriate method at each call to the procedure. When these points are raised to staunch C defenders, their reply is “Well, you can always run lint to do all that do-gooder type¬ checking stuff.” This answer invariably comes from program¬ mers who don’t use lint them¬ selves: those who do know it is a weak substitute for type-check¬ ing at best, and an irritation at worst. On one hand, many common errors slip by lint with nary a peep...after all, it may be wrong, but it is valid C. For example, lint does not complain about either of the following statements [i and Junk are int): if (i = 0) |...| junk = scant("yod". i); On the other hand, lint often acts like the boy who cried “Wolf!” For example, since lint can only check to see that you are using a procedure consistently, it complains at every call to a procedure that takes a variable number of parameters. You can tell lint not to check certain constructs, but this defeats the very purpose of the program. Even so, the bug list for lint in the manual is a single sentence: “There are some things you just can’t get lint to shut up about.” Fourth, with no subranges and no type-checking, C is left with no way to perform runtime check¬ ing. Range-checking in particular is lacking: it is all too easy to index past the end of an array and destroy the variable(s) allocated immediately following the array. The behavior of a program subse¬ quent to such an event often leads the hapless programmer down many false paths before the source of an error is finally located. 28 UNIX REVIEW SEPTEMBER 1985 The lack of type- checking Is, I hazard, the largest source of productivity loss for C programmers. Fifth, C is not as portable as its proponents often maintain, sim¬ ply because it has not been pre¬ cisely defined. In their book C: A Reference Manual, Samuel Harbison and Guy Steele, Jr. write: “The second source of information on C is the C compil¬ ers themselves: you can write a C program and see if it compiles (and, if it does, what code is generated).” This diversity ex¬ tends even to UNIX: the C compil¬ ers on 4.2BSD and AT&T System V accept different languages. Finally, C has no support for modules in the modern sense of the word, include and make notwithstanding. True modular¬ ity provides version-checking, a non-global name space for ex¬ ported objects, true separation of specification from implementa¬ tion, and module initialization. MODULA-2 Just as C eliminated many of the errors endemic to assem¬ bly programming, new languages eliminate many of the trivial (but costly) errors endemic to C. One such language, Modula-2, com¬ bines a type-secure module struc¬ ture with the low-level program- ming capabilities of C and the type-checking facilities of Pascal. Moclula-2 IS the third in Nik- laus Wirth’s line of strongly typed languages. The first is Pascal, which succeeded far beyond its design goals. The second is Modula-l, a small, experimental language designed to investigate modularity and concurrent pro¬ gramming. Modula-2 is a systems programming language synthe¬ sized from Wirth’s experiences with both of his earlier languages and Mesa, a language developed at Xerox PARC. The most important structure in Modula-2 is, appropriately enough, the module. Modules have two separately compiled parts: a definition module, which contains declarations of constants, types, variables, and procedure headings accessible to client modules: and an imple¬ mentation module, which con¬ tains private declarations, code for the procedures declared in the definition module, and an initiali¬ zation section. In C, a change to a .h file may require that all clients be re¬ compiled—but the responsibility falls to the programmer, who is armed only with make: in Mo¬ dula-2, strict version-checking forces consistency. This checking can be implemented with simple time-stamps, which require re¬ compilation of client modules any time a definition module is changed, or the checking can be implemented with more complex schemes that require recompila¬ tion only when non-upward com¬ patible changes are made. Ver¬ sion control in Modula-2 does not depend on the careful (but possi¬ bly erroneous) construction and maintenance of dependency lists in a make file, but is automatic and failsafe. In C, if two different .h files declare the same identifier, a client program cannot include both files; in Modula-2, a client may import names from a module in either qualified or unqualified mode. References to qualified identifiers are prefixed by the svs BASIC-PLUS The SVS BASIC-PLUS language is now available on an expanded family of CPUs. It fully supports: • DEC BASIC-PLUS Dialect MC68000 • Integer, String and IEEE Double Precision Variables • Vector and Matrix Arithmetic • String Arithmetic • Extended I/O, Including Print Using, Get and Put • Multi-lined Functions • Renumber, Ti'ace, and Chain Commands IMS32000 • Very Fast Interpreter and Source Code Protection using quasi-compiled internal form • Interactive MC68020 • Complete User Documentation • Available since 1982 SVS has been a major OEM supplier of compilers since 1979. For further information about these and other quality OEM compilers call 415/549-OSS. Silicon Valley Software, Inc 10011 N. Foothill Blvd.. Suite III Cupertino, CA 95014 Circle No. 272 on Inquiry Card UNIX REVIEW SEPTEMBER 1985 29 Sorry, Counten, this is one computer vfhere you won't find VADS”! Although the VERDK Ada® Development System(VADS) won’t be rehosted on Charles Babbage’s Difference Engine, it is being hosted on and taigeted for a variety of computer systems and embedded system architectures. The Department of Defense (DoD) has now validated VADS for a growing number of computers and operating systems including the DEC/VAX™ series under UNIX™ 4.2 BSD and ULTRK™, and for the Sun-2™ Worksta¬ tion. Future product releases will include Host Develop¬ ment Systems for VAXA/MS™ and UNDC System V, and cross-taigeted systems for 4 major architectures... Motorola 68000 and Intel “86” families, the NS32032, and MIDSTD-1750A. VADS is the fastest and friendliest Ada development system available. It is specifically designed for large-scale Ada program development in a production environment. VADS features a complete run-time system, plus an interactive, screen-oriented, fully symbolic debugger that lets you easily pinpoint errors. Unexcelled diagnostics and Ada library utilities quickly manage, manipulate and display program library information, dramatically shorten¬ ing development times. VADS from VERDK. The finest, fastest and most cost-effective Ada Development System on the market to¬ day. The biggest breakthrough in programming since Ada herself. For full information, call James Zimpfer, Director of Sales and Marketing Support, Ada Products Division, at (703) 378-7600. VERDIK* 14130 Sullyfield Circle, Chantilly, VA 22021 Ada Ls a registered trademark of the U.S. Government. Ada Joint Pr()gram Office. VAX, VMS and ULTRIX are trademarks of the Digital Equipment Corporation UNIX is a trademark of Bell l^^ratories Circl0 No* 255 on Inquiry Cfird Sun-2 is a trademark of Sun Microsystems. Inc. VERDK and VADS are trademarks of Verdix Corporation name of the module in which they are declared (for example, ModuleName.obJectName), free¬ ing the module designer from futile attempts to provide objects with unique names. In C, changing the implemen¬ tation of one of the “modules” used by a main program may require changing and recompiling the program: in Modula-2, chang¬ ing an implementation module requires recompiling only that module. Further, Modula-2 defi¬ nition modules change less fre¬ quently than C .h files, due to Modula-2’s support for abstract data types. The structure of an abstract data type is not known outside of the module, and the only operations allowable on the type are those provided by the module. Unlike C, changing the structure of such a type does not require recompiling modules that use the type. In C, .h files that are otherwise irrelevant to a client program must be included by the client so that it can call the initialization procedure for each “module”; in Modula-2, initialization sections arc called automatically by the client, which ensures that lower- level modules are initialized be¬ fore the modules that depend on them. Modula-2 has all the advan¬ tages of strict typing, but it adds the flexibility of C’s type casting and pointer arithmetic. Modula-2 provides both a range-checked and an unchecked type conver¬ sion for those few occasions when you need to violate type rules. Modula-2 also provides the type ADDRESS, which can be used in arithmetic expressions and is compatible with any pointer type. Though Modula-2 is based on Pascal, it retains few of the flaws of its ancestor. The article “Modula-2 - a Solution to Pascal’s FVoblems” by Sumner and Cleaves in the September 1983 issue of SIGPLAN shows how Modula-2 systematically address¬ es the problems of Pascal as outlined by Brian Kernighan in the Bell Laboratories report, “Why Pascal Is Not My Favorite Language”. Unlike the Berkeley Pascal compiler, the DEC Modula-2 com¬ piler on UNIX generates excellent code. With no optimizations per¬ formed, it emits object code that runs as fast or faster than opti¬ mized code from the Berkeley C compiler: in some benchmarks, Modula-2 runs in 70 percent of the time of the equivalent C program. With optimization, Moclula-2 benchmarks run in 90 percent to as little as 33 percent of the time used by C. Even if all runtime checking is turned on, the optimized Modula-2 code is usually faster than C, which, of course, has no checking. The Modula-2 compiler is fast, too. An internal version compiles about 1500 1pm when not gener¬ ating runtime checks, and 1300 1pm when generating checks. Faster versions are expected as optimizations are applied to the compiler itself. (The compiler is compiled with runtime checks— the advantages of these checks outweigh the speed advantage gained by omitting them.) Admittedly, Modula-2 is not perfect. For starters, it lacks C’s structured initializers, Fortran’s dynamic arrays and complex and double-precision types, and Ada’s exception-handling mechanisms. Availability is limited: the DEC compiler is available to universi¬ ties on 4.2BSD and Ultrix, and can only be had by those commer¬ cial organizations using Ultrix. There are currently no text¬ books on Modula-2, so the lan¬ guage is not yet widely taught. The UNIX compiler is now used more for systems programming research at universities than it is for instruction. This situation SVS “C" The SVS "C" language Is now available on an expanded family of CPUs. It fully supports: • Common "C" dialects MC68000 • Ideal for Applications Development and Rehosting Programs for Improved Efficiency • Emphasis on Floating Point • Single Precision Option • Integrated Hardware Floating Point Interfaces: MC6888I, SKY. IMS32081 • Interlinkable with SVS Pascal and SVS FORTRAN • Symbolic Debugger NS32000 • Optimizing Code Generation • High Speed Compilation, No Assembler Passes • Free of AT&T Licensing MC68020 • Complete User Documentation • Available since 1982 SVS has been a major OEM supplier of compilers since 1979. For further information about these and other quality OEM compilers call 415/549-0535. Silicon Valley Software, Inc 10011 N. Foothill Blvd., Suite 111 Cupertino, CA 95014 Circle No. 272 on Inquiry Card UNIX REVIEW SEPTEMBER 1985 31 LANGUAGE OVERVIEW will change, though; I know of at least two textbooks to be pub¬ lished in the next year, and as the number of implementations on microcomputers grows, Mo¬ dula-2 should experience the same sort of popularity explosion that launched Pascal. In fact, many development and research organizations are al¬ ready using Modula-2. At DEC, all new code being written at the Western Research Laboratory and Western Software Laboratory is in Modula-2, and DEC’S Soft¬ ware Research Center is using an extended version of Modula-2. Other Modula-2 users include Bank of America, Bendix, Float¬ ing Point Systems, Ford, McDon- nell-Douglas CSC, Phillips, Signe- tics, and Tektronix. (Ironically, some of these companies chose Modula-2 over Ada on the recom¬ mendation of their defense-relat¬ ed subsidiaries.) For all that, Modula-2 faces an uphill battle in the UNIX commu¬ nity. C is well entrenched, and programmers tend to be a conser¬ vative lot, often shunning the new because it is unfamiliar. But unlike any of the other languages that have preceded it, Modula-2 is designed to compete with C on its own turf—systems software. Modula-2 is more readable than C, more maintainable than C, and enforces consistency during sys¬ tem integration. Better still, a compiler that runs faster and generates better code than cc is available. I hope we will one day see copies of Software Tools in Modala-2 by Kernighan and Plaugher on every UNIX program¬ mer’s bookshelf. Joel McCormack co-authored the Z80I8080 UCSD Pascal interpreter while attending UCSD, where he obtained a Masters of Science degree. He then designed and micro- coded a 16-bit bit-slice board to execute UCSD Pascal for NCR, for whom he also wrote the high-level microcode language compiler. Com¬ piling Pascal at 10,000 Ipm hope¬ lessly spoiled him. Later, at Volition Systems, Mr. McCormack co-auth¬ ored the Modula-2 compiler, and eventually found himself President. After stock battles shut down Voli¬ tion, dec's Western Software Labo¬ ratory lured him away from San Diego's beaches to work on Mike Powell's Modula-2 compiler. He now programs in C only under protest. ■ ACCESS METHODS INCORPORATED ATTENTION: UNIX SPECIALISTS We have the most challenging and sought after consulting assignments in the UNIX* industry: ■ Kernel Work ■ Distributed UNIX " ■ Networks (x.25 and LAN's) ■ Graphics ■ Real-Time Systems ■ Languages, Compilers, and Translators ■ Hardware and Microcoding ■ C Applications Programming See us at UNIX Expo, Booth 235 Drop your business card in our fishbowl for a chance at a free Video Recorder. ask for us AMI 590 Valley Rd. ■ Upper Montclair, NJ. 07043 (201)744-9126 ■ 314 West 56th St. ■ New York, N.Y 10019 (212) 245-8114 call collect •UNIX IS a trademark of AT&T Bell Laboratories jf Circle No. 277 on Inquiry Card Communications Software for Micros Minis _WANG Mainframes IBM_ .Data General^^^\^ XSBSDQSD_ _—-^MS-DOS_ _XuMIX_ Any computer with BLAST can talk to any other computer with BLAST, the universal file transfer software linking many different computers, operating systems, and networks. No add-on boards; use any asynchronous modems or direct-connect for fast, error-free data transfer, even via noisy phone lines, satellites. LANS, and packet networks. $250/micros $495-895/minis $2495 up/mainframes Communications Research Group 1-80024BLAST 8939 Jefferson Hwy Baton Rouge. LA 70809 504-923-0888 Circle No. 276 on Inquiry Card 32 UNIX REVIEW SEPTEMBER 1985 ...puts your IBM Series/I^ahead of the pack! SERIX is the high performance CMI version of AT&T’s UNIX^^ System V operating system with Berkeley 4.1 enhancements ported to the IBM Series/1 minicomputer. SERIX transforms your Series/1 into an even more powerful, flexible, and convenient processor for general data processing, office automation, communications, and process control. Its advantages are outstanding: Reduced software costs Long term growth path • Software is highly portable • Provides access to a large, growing software base More power from the Series/1 • Optimizing C compiler uses native code features • All code reentrant • Dynamic memory allocation without fixed partitions increased programmer productivity • Large set of utilities • Hierarchical file structure • Pipes, forks, semaphores, and shared data segments Other CMI Series/1 software • RM/COBOL^^ • UNIFY^^ database management system • ViewComp^^ spreadsheet • vi visual editor • EDX^^- to -SERIX^^ conversion kit CMI Corporation Is a Master Value-added Remarketer of IBM Serles/1 equipment. Leasing and other financial arrangements are available. Contact us for further information. Photoorapher - Michael Zagaris • UNIX is a trademark of Bell Laboratories • SERIX is a trademark of CMI Corporation • SERIX was developed exclusively for CMI by COSI. • IBM. Series/1. and EDX are trademarks of International Business Machines Corporation • UNIFY is a trademark of North American Technology. Inc. • RM/COBOL is a trademark of Ryan-McFarland Corporation • ViewComp is a trademark of Unicorp Software. Inc. CMI Q > Torchmark Company CMI Corporation SERIX Marketing 2600 Telegraph Bloomfield Hills, Ml 48303-2026 (313)456-0000 TWX: 810-232-1667 Telex: 499-4100 ANS: CMI CORR BDHS Member CDLA Member ASCD Circle No. 296 on Inquiry Card The Firebreathers continue on the cutting edge of high performance computers. The most powerful line of computer sys¬ tems made. Gould PowerModes™ and CONCEPT/32S* Any way you slice it they beat the VAX.™ Our main¬ frame PN9000 and CONCEPT 32/97 are up to twice as fast as the VAX 8600. And even though the mid-range PN6000 and CONCEPT 32/67 are 30-50% smaller than the VAX 11/780, they're still up to three times more powerful. More power for a slice of the price. Despite their superior power, our mid¬ range models cost 40% less than the VAX 11/780. Our mainframes cost about 30% less than the new VAX 8600, The bottom line is more power for less money. Operating environments that are a cut above the rest. There's also a choice of system soft¬ ware to consider, Gould’s unique UTX/32® is the first operating system to combine UNIX* System V with Berkeley BSD 4.2. So it allows you to access virtually any com¬ mand format you want whenever you want. And in real-time environments, Gould’s MPX/32'“ operating system offers perfor¬ mance that's unmatched in the industry, as well. Delivery that’s right on the mark. Unlike the VAX ^600. that has up to a 12 month wait fbr delivery, when you order either a Gould PowerNode or a CONCEPT/32 system, they’ll be shipped within 90 daysARO. You can also be sure with Gould you’re getting a computer that’s backed by years of experience - the kind of experience we used to develop the first 32-bit real-time computer. If you need more information or just have a few questions, give us a call at 1-800-327-9716. See for yourself why V/\X no longer cuts it. Go with a Gould computer and ax the VAX. CONCEPT/32 and UTX/32 are registered trademarks and PowerNode and MPX/32 are trademarks of Gould Inc. VAX is a trademark of Digital Equipment Corp. UNIX is a trademark of AT&T Bell Labs. ■> GOULD ll^ woi i Electronics Only Gould computers have a big enough edgeito ax the VIVX. Circle No. 297 on Inquiry Card Unto every purpose there is a language I by Steve Johnson I Rarely have an operating system and a language had such a symbiotic relationship as the one that ties the UNIX system to the C language. While C re¬ mains dominant, many other languages also have grown and flourished in the UNIX environment. Some of these are standard, but others are unique to the UNIX system. The “UNIX philosophy” of small, well crafted tools has encouraged mini-languages to be developed for every purpose. Also, some interest¬ ing tools have been popularized on the UNIX system that make the construction of new languages lUuslraLiim by 11 von Kim SEPTEMBER 1985 35 THE HOUSE OF MANY TONGUES LANGUAGE TOOLS The user brave enough to do text processing will quickly discover languages galore. somewhat easier than on other systems. This article will quickly tour some of the non- conventional languages found in daily use on UNIX systems, and then discuss the tools that have brought them into being. Finally, prospects for the future will be outlined. QUICK TOUR Taking an extreme and biased view, practically every program that interacts with a user has a command language. An experienced user of UNIX probably knows a large number of different lan¬ guages. Some of these are small, others large. Some are regular, allowing a few simple elements to be combined in a large number of useful ways. Others are idiomatic, revealing little rhyme or reason. Let's take a look at a few of the languages available to the UNIX guru. The shell. The text interpreted by the shell forms a language, with operators such as and “ I ”, grouping symbols such as ”(” and statements such as for and do, and expressions containing such symbols as and ”?”, as well as more conventional names. Although the shell has a reasonably regular syntax, its semantics are very irregular: arguments may look the same from command to command, but generally they have different meanings. While this terrifies many new users, some have argued that the shell's command language is in fact well suited to its purpose (Harris, Marion, “UNIX Command Language”, Proceedings of the 10th Anniversary Usenix Conference, June 1985, pp 343-348). Moreover, Jean Wood of DEC recently observed, tongue in cheek, that the com¬ mand language has served as a force for the internationalization of UNIX systems since UNIX commands clearly aren’t English. AT&T proposed a command syntax standard a couple of years ago {Proposed UNIX Command Language Syntax, UniForum Conference, January 1984) in an attempt to regularize the semantics, as well as the syntax of commands. Text Processing. The user brave enough to do text processing will quickly discover languages galore. The granddaddy of them' all is troff, with . roots reaching back to days far before UNIX, and a syntax and semantics that bespeak its original implementation in assembler. People usually pro¬ cess text using one or another macro package on top of troff, in effect defining other languages. Want equations, tables, pictures, graphs? Other special¬ ized languages are available to do what you need. The ed editor and friends. Text editors provide another rich source of input languages. The input language for ed allows for statements such as a, s, and q, and expressions such as: /a.*e.*i.*o.*u/ Moreover, ed has been extended to provide a language for editing text streams, sed, and for use as a visual editor, vi. Regular expressions from it even surface in programs such as grep. The awk language. The awk language can be used to handle character strings, pattern matches, and simple arithmetic. Recently, awk has been extended by allowing functions to be defined and invoked, making it look even more like a true programming language. Although it has been used for many years as a simple and powerful substitute for general database systems (especially for small applications), awk also is general enough that it has been used to write compilers (albeit slow ones!). The C language. Of course, C is commonly used on the UNIX system. Enough said. Conventional Languages. Various versions of UNIX offer one or more conventional languages in addition to C. On many UNIX systems, one can either find or buy Fortran, Pascal, Lisp, Modula, and several dialects of COBOL and BASIC. On some forward-looking systems, one can find Prolog, Ada, and C+ + . And don't forget that even simple languages like be also can be quite useful. TOOLS How might the development and support of these languages be made easy? Obviously, by using more languages! The UNIX system supports a number of language-building languages as well as several tools that facilitate work on large projects—like the production of a language. The earliest of these tools is yacc, one of the first application programs to run under UNIX (it’s even older than C!). The yacc facility takes a description of a language (more formally, a LALR(l) grammar) and builds a C program called a parser that reads and structures the language, and detects and recovers from input errors. As an example of how this might work, a language implementor might wish to restructure an 36 UNIX REVIEW SEPTEMBER 1985 input language to allow integer expressions wherev¬ er only simple integers had been legal previously. This might be done as simply as adding the yacc rule: integer : integer V integer I $$ = $1 + $3: I to the existing yacc file. The first line can be interpreted as saying: “Wherever it is legal to input an integer, it is also legal to input an integer, a plus sign, and another integer.” The second line, which looks a bit like a fragment of C code, says that the value of the integer on the left side ($$) is the sum of the values of the first and third components of the right side of the rule. Thus, users will be able to say ”2 + 2” where they only could have said “four” before. It is possible, though, that the plus operator is used in some way in the modified input language that conflicts with its use in integer expressions. The yacc facility will detect and flag those places where it is unable to decide which rule is to be ap¬ plied. The language implementor then can elimi¬ nate such ambiguities before releasing the language to users. The yacc facility will also detect rules that can never be reached and other error conditions. In addition to integers, yacc can handle more complicated values like pointers and structures. It is straightforward to generate parse trees or other data structures from input using yacc actions so that further processing can be done. In most uses, yacc is concerned with the complex structure of the program. Lower level details are usually handled by another program known as a lexical analyzer. Lexical analyzers are typically used to recognize comments, blanks, constants, identifiers, multi-character operators, and the like. The individual characters in the input are collected and processed, and the parser is told what they represent. Lexical analyzers also keep track of file and line numbers, so that error messages can describe the location of discovered mistakes. One tool, lex, can be used to build lexical analyzers. As with other UNIX tools, input to lex consists of patterns and actions. In this case, the patterns describe chunks of input text called tokens. As a token described by a pattern is recognized, input characters that match it are collected and the action specified by the user is performed. A sample lex line reads as follows: This could be used to recognize the reserved word while in a programming language. When the word is located, the action returns a value to the parser The JniX comniand language style was a reaction to the chatty nature of some other operating systems. indicating that the key A more complex lex lin [0-9]+ word has been encountered, e like: yylval = atoi jytext); return( INTEGER ): Inputs for yacc and might be used to recognize integer constants in a programming language The pattern matches one or more digits between 0 and 9 and specifies an action that is considerably more complex than the one in the first example. This action calls the library routine atoi on the arra y, yytext, where the integer has been collected. The resulting value is stored in a special variable, yylval, where yacc can pick it up if desired. The action then returns to the parser an in¬ dication that an integer has been seen. Beyond lex and yacc, language developers also enjoy many of the other advantages of the UNIX system. In particular, make and the shell are nearly essential to the production of high-quality lan¬ guages. When programs such as yacc and lex, which produce other urograms, are regularly in¬ voked, a tool like mak(^ is essential to ensure that changes are reflected accurately in the recompila¬ tion process. This is piarticularly important since languages are often us(^d by many users. Shell files that automatically do regression testing can help ensure high quality by checking to see that the latest version of a language has not broken any key applications. lex follow what is known as the pattern/action format, which is also used, with modifications, by awk guages have rules that pair tends to stand alon iJ lo reuse lire tend to reuse the yac= BUFSIZ) return(-2L): strncpy(buf. cmd. cmdlen): /♦ * Fortran strings blank-padded so insert NULL V buf[cmdlen] = NULL: if (system(buf) == 127) /* couldn't exec shell */ return(-IL): return(OL): Figure 2 — An example of how to execute a UNIX shell command from inside a Fortran program. The string is eight characters long. Note that C arrays are indexed beginning at zero, whereas Fortran arrays begin at one, so we must pass num(2) to the Fortran subroutine, but num[l] to the C function. Two-dimensional arrays can be a stum¬ bling block, because C arrays have row-major ordering, while Fortran arrays have column-major ordering. In other words, Fortran stores array elements with the first subscript varying most rapidly, while C stores them with the final subscript varying most rapidly. The Fortran I/O library is implemented on top of C s standard I/O library. Every open unit in a Fortran program has an associated FILE structure. The stdin, stdout, and stderr streams are easy to share because they don’t require explicit references, but other streams (units) opened from Fortran are difficult to share, although it can be done by writing a C routine such as getfdO to ascertain the file descriptor. Let’s suppose we want to execute a UNIX shell command from inside a Fortran program. There’s already a library routine, system(3f), for doing this. But for the sake of an example, let’s change the name and code the routine in C as shown in Figure 2. Note the underscore appended to the function name. To call this routine from Fortran, all we need is something like: call unixcmdCls -1’) We place the unixcm(L() routine in a file named unixcmd^.c, and compile the Fortran program and the C code as follows: 7o f77 prog.f unixcmcL .c % a.out UNIX REVIEW SEPTEMBER 1985 69 U C ADVISOR The Fortran compiler knows how to deal with C programs. We execute the program by typing a.out. Suppose we wanted to do the opposite—call a Fortran library routine from a C program. This would be a fine idea if we needed a mathematical function available only in some particular Fortran library. For the sake of simplicity, let’s use a Fortran function to compute the area of a circle, given the ra¬ dius. The function is coded like this: double precision function area(r) double precision r area = 3.1415926535897932 ♦ r**2 return end A hint: most C compilers don’t deal gracefully with single precision functions and parameters, so you’re better off using double precision Fortran library routines. From a C program, we could call the routine in this way: double r. area. area_(): r = radius: area = area_(&r); Again, note the appended underscore. We have to pass the address of the parameter, rather than its value, because Fortran employs call by reference. The Fortran function would need to be compiled, so that the C program can be compiled and loaded like this: % f77 -c area.f % cc prog.c area.o -1F77 -1177 -1U77 -Ic -Im % a.out The libraries are, in order: the Fortran intrinsic library, the Fortran I/O library, the Fortran UNIX interface library, the standard C library, and C's math library. Not all are required by our example, but the safe approach is to use all of them every time. As before, we execute the program by typing a.out. C AND PASCAL The Pascal interpreter pi and interpreter/exe- cuter pix were written mostly by Bill Joy, with help from Chuck Haley and Susan Graham. The inter¬ preter generates p-code rather than machine language, and thus is not compatible with the C compiler. Berkeley’s 4.1 release was the first to include the Pascal compiler pc. written by Kirk McKusick and Peter Kessler. To my knowledge, Pascal is not included on any release of System V from AT&T. Pascal C real double integer int -32768..32767 short boolean char char char record struct/union array array Figure 3 — The ways in which Pascal and C data types correspond. In Pascal, variables are passed by value, unless otherwise specified as var parameters. In a sense, this is true of C as well: all variables except arrays are passed by value, unless preceded by an ampersand, to indicate they are passed by refer¬ ence. Pascal and C routines, because they have similar parameter passing conventions, are not differentiated by name, as Fortran routines are distinguished from C by the appended underscore. To pass by reference, Pascal programs use var parameters, while C programs declare a pointer type. So the Pascal procedure: procedure incr(var n: integer); begin n = n + 1 end; corresponds to the C routine: incr(n) int *n: I ♦n += 1: I In fact, if the C routine above already existed somewhere, the Pascal routine could have been written like this: procedure incr(var n: integer): external: and Id would link the appropriate C routine. A table of the correspondences between Pascal and C data types is shown in Figure 3. Suppose we wanted to execute a UNIX shell command from inside a Pascal program. This is easier in Pascal than in Fortran, because we don’t need a wrapper routine precoded in C. A program that calls the C library routine, systemQ is shown in Figure 4. Not all Pascal implementations pad strings with 70 UNIX REVIEW SEPTEMBER 1985 ,2? CO’ CLEO Software a division of Phone 1. Inc 1639 North Alpine Road Rockford, IL 61107 TELEX 703639 IS vour SNAor BSC Gateway Connect your IBM. Apple. Tandy. Zenith. A.T.&T., Hewlett-Packard. Televideo, NCR, IMS, SUN. or other DOS or UNIX-based system to another micro or to your mainframe with CLEO Software. Now you can connect your PC LAN. too! For details call: 1(800) 233-CLEO In Illinois 1(815) 397-8110 CLEO and 3780PIus are registered trademarks of CLEO Software. Circle No. 298 on Inquiry Card IBM is a registered trademark of international Business Machines Corporation; Apple is a registered trademark of Apple Computer; UNIX is a registered trademark of A.T.ST. Tfechnologies. Inc. UC ADVISOR blanks; UCSD Pascal uses counted byte arrays instead. To make string manipulation easier, some Pascal compilers (such as Sun’s pc) have imple¬ mented the ISO standard for conformant arrays, with the extension that literal strings will be null- terminated when passed as conformant array value parameters. This makes the program easier to code, and more efficient, as demonstrated in Figure 5. Unlike the Fortran compiler, the Pascal compiler doesn’t know how to deal with C programs. In our example, this is no problem, because we don’t have to write a wrapper routine in C. But in programs with complex data formats, wrapper routines are often required. To compile and load such programs, you have to invoke the C compiler, then the Pascal compiler. Here’s how we would compile and run the Pa.scal program above: % pc list.p % a.out Pascal automatically includes all the standard C library routines. We execute the program simply by typing a.out. Suppose, on the other hand, we wanted to call a Pascal library routine from a C program. There aren’t nearly as many good Pascal libraries as Fortran libraries, but it’s possible that some companies have developed Pascal libraries that will someday need to be linked with C programs. Let’s use the same example as with Fortran: a function to compute the area of a circle, given the radius. Remember that Pascal doesn’t have an intrinsic power function, but with squares the work-around is easy: function area(r: real): real; begin area := 3.1415926535897932 * (r * r) end: From a C program, we could call this function as follows: double r. a. area(): r = radius: a = area(r): Note that we declare everything as double precision, because most Pascal compilers don’t have a data type for single precision. Here’s how to compile the Pascal function and the C program: % pc -c area.p % cc prog.c area.o -Ipc -Im % a.out program list(input. output): type string = packed array[1..512] of char: var S: string: procedure system(var cmd: string): external: begin | main | s := Ts -1’: I Pascal strings are blank padded | s[6] := chr(O): I so we put a NULL there, as in C ] system(s) end. Figure 4 — An example of how to execute a UNIX shell command from inside a Pascal program. program list(input. output): procedure system(cmd: packed array[lb..ub: integer] of char); external: begin system( Ts -T) end. Figure 5 — An example of how a UNIX shell command can be executed from inside a Pascal program using a Pascal compiler that has implemented the ISO standard for conformant arrays. We load the Pascal library, in case there are writelnQ statements or something of the sort, and we also load C’s math library. Our example requires neither, but it’s best to be on the safe side. As before, we execute the program by typing a.oat. CONCLUSION For ease of implementation and maintenance, both the Fortran and Pascal compilers use the same code generator, assembler, and loader as the C compiler. This has a beneficial side-eflfect: routines in the three languages are mutually callable. Although not discussed here, Fortran also can be called from Pascal, and vice-versa. This is an example of the UNIX tool philosophy at work—a few small tools that provide great flexibility and functionality. Bill Ihthill was a leading UNIX and C consultant at UC Berkeley for four years prior to becoming a member of the technical staff at Sun Microsystems. He enjoys a solid reputation in the UNIX community earned as part of the Berkeley team that enhanced Version 7 (4.0, ■LI, and 4.2BSD). ■ 72 UNIX REVIEW SEPTEMBER 1985 V A Complete Curriculum for; End Users • Management • Applications Staff • Technical Support DALLAS & COURSES LONDON BOSTON CHICAGO SAN FRANCISCO LOS ANGELES NEW YORK 6 SOMERSET TORONTO e ORLANDO WASHING¬ TON, D.C. TUITION SEQUENCE TUITION! UNIX Overview Oct 8 85 Dec 17 85 Mar 11 86 Oct 15 85 Mar 11 86 Oct 1 85it Jan 28 86 Oct 1 85 $225' Dec 3 85 Mar 18 86 Jan 28 86 Feb 4 86 Apr 29 86 Dec 1 85 Feb 11 86 Apr 29 86 Apr 15 86 Jan 14 86 Apr 15 86 Mar 11 86 > June 17 86 May 20 86 $860 UNIX Oct 9-11 85 Dec 18-20 85 Mar 12-14 86 Oct 16-18 85 Mar 12-14 86 Oct 2-4 85tt Jan 29-31 86 Oct 2-4 85 $735^ Fundamentals Dec 4-6 85 Mar 19-21 86 Jan 29-31 86 Feb 5-7 86 Apr 30-May 2 Dec 18-20 85 for Non- Programmers* Feb 12-14 86 Apr 16-1886 June 18-20 86 Apr 30-May 2 86 Apr 16-18 86 86 ^ Jan 15-17 86 Mar 12-14 86 May 21-23 86 UNIX Fundamentals for Programmers* Oct 14-16 85 Dec 9-11 85 Feb 17-19 86 Apr 21-23 86 June 23-25 86 Mar 31 -Apr 2 86 Mar 17-19 86 Oct 28-30 85 Feb 3-5 86 May 5-7 86 Mar 17-19 86 Oct 7-9 85tt Feb 10-12 86 Apr 21-23 86 Feb 3-5 86 May 5-7 86 Oct 7-9 85 Jan 20-22 86 Mar 17-19 86 Jun 2-4 86 $735' > $1125 Shell as a Command Language* Oct 17-1885 Dec 12-13 85 Feb 20-21 86 Apr 3-4 86 Mar 20-21 86 Oct 31 -Nov 1 85 Feb 6-7 86 Mar 20-21 86 Oct 10-11 85tt Feb 13-14 86 Feb 6-7 86 May 8-9 86 Oct lO-l 1 85 Jan 23-24 86 Mar 20-21 86 $490 > Apr 24-25 86 Jun 26-27 86 May 8-9 86 Apr 24-25 86 June 5-6 86 ‘C* Language Programming* Oct 21-25 85 Dec 16-20 85 Feb 24-28 86 Apr 28-May 2 86 Jun 30-July4 86 Apr 7-11 86 Sept 9-13 85 Mar 31 -Apr 4 86 Nov 11-15 85 Feb 10-14 86 Apr 12-16 86 Sep 9-1385 Mar 31 -Apr 4 86 Aug 4-8 86 Oct 21-25 85tt Feb 17-21 86 Apr 28-May 2 Feb 10-14 86 Apr 12-16 86 Oct 21-25 85 Jan 27-31 86 Mar 31-Apr 4 86 $1225 86 Jun 9-13 86 Shell Programming* Sep 2-3 85 Oct 28-29 85 Jan 6-7 86 Mar 3-4 86 May 12-13 86 Apr 14-15 86 Sep 16-17 85 Apr 7-8 86 Nov 18-19 85tt Feb 17-1886 May 19-20 86 Sep 16-17 85 Apr 7-8 86 Oct 28-29 85tt Feb 24-25 86 May 5-6 86 Feb 17-1886 May 19-20 86 Oct 28-29 85 Feb 3-4 86 Apr 31 -May 1 86 Jun 16-17 86 $490 >1 > $1125 Using Advanced UNIX Commands* Sep 4-6 85 Oct 30-Nov 1 85 Jan 8-10 86 Apr 16-18 86 Sep 18-20 85 Apr 9-11 86 Nov 20-22 85 Feb 19-21 86 May 21-23 86 Sep 18-20 85 Apr9-ll 86 Oct 31 -Nov 1 85tt Feb 26-28 86 Feb 19-21 86 May 21-23 86 Oct 30-Nov 1 85 Feb 5-7 86 $735 > Mar 5-7 86 May 7-9 86 Apr 2-4 86 May 14-16 86 Jun 18-20 86 UNIX Internals Sep 9-13 85 Nov 4-8 85 Jan 13-17 86 Mar 10-14 86 May 19-23 86 Apr 21-25 86 Sep 23-27 85 Apr 14-1886 Dec 2-6 85 Feb 24-28 86 Jun 2-6 86 Sep 23-27 85 Apr 14-1886 Nov 11-15 85tt Mar 3-7 86 May 12-16 86 Feb 24-28 86 Jun 2-6 86 Nov 11-15 85 Feb 10-14 86 Apr 14-18 86 Jun 23-27 86 $1375 UNIX Administration* Sep 18-20 85 Nov 11-13 85 Jan 22-24 86 Mar 19-21 86 May 28-30 86 Sep 10-12 85 Apr 29-May 1 86 Oct 1-3 85 Apr 22-24 86 Dec 10-12 85 Mar 4-6 86 Jun 9-11 86 Oct 1-3 85 Apr 22-24 86 Nov 19-21 85tt Mar 11-13 86 May 20-22 86 Mar 4-6 86 Jun 9-11 86 Nov 19-21 85 Feb 18-20 86 Apr 22-24 86 $735 Advanced *C’ Programming Workshop* Sep 23-24 85 Nov 18-19 85 Jan 27-28 86 Mar 24-25 86 Sep 16-1785 May 5-6 86 Oct 7-8 85 Apr 28-29 86 Dec 16-17 85 Mar 10-11 86 Jun 16-17 86 Oct 7-8 85 Apr 28-29 86 Dec 2-3 85 Mar 17-1886 Jun 2-3 86 Mar 10-11 86 Jun 16-17 86 Dec 2-3 85 Feb 24-25 86 Apr 28-29 86 $490 >1 ■ $1125 Jun 2-3 86 Advanced ‘C’ Programming UncferUNIX* Sep 25-27 85 Nov 20-22 85 Jan 29-31 86 Apr 2-4 86 Sep 18-20 85 May 7-9 86 Oct 9-11 85 Apr 30-May 2 86 Dec 18-20 85 Mar 12-13 86 Jun 18-20 86 Oct 9-11 85 Apr 30-May 2 86 Dec 4-6 85tt Mar 19-21 86 Jun 4-6 86 Mar 12-14 86 Jun 18-20 86 Dec 4-6 85 Feb 26-28 86 Apr 30-May 2 $735 > Jun 4-6 86 86 Berkeley Fundamentals and ‘csh’ Shell* 1 Sep 30-Oct 4 85 Nov 25-29 85 Feb 3-7 86 Apr 7-11 86 Sep 23-27 85 May 12-16 86 Oct 21-25 85 May 5-9 86 Jun 23-27 86 Oct 21-25 85 I Feb 3-7 86 May 5-9 86 3ec9-1385tt , Mar 31 -Apr 4 86 Jun 9-13 86 Jun 23-27 86 Dec 9-13 85 Mar 3-7 86 May 5-9 86 $1225 Jun 9-13 86 ttNewYork only •Including hands-on training workshops ” UNIX is a trademark of Bell Laboratories tSavings for consecutive seminar dates ^LL FOR DETAILS ON: ON-SITE SEMINARS • VIDEO-BASED TRAINING • INTERACTIVE VIDEODISC TRAINING lo reserve your seminar space now or for additional information, call: (800) 323-CJNlX or (312) 987-4084 Three factors make the Computer Technology Group the experts in UNIX and 'C language training: • Experience, through training thousan