home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / magazine / aeo / aeopj_01 / aeopj1.txt
Text File  |  1993-08-19  |  153KB  |  3,534 lines

  1. /***********************************************************************
  2.     Title:          AEOPJ1.TXT
  3.  
  4.     Last Modified:  August 19, 1993
  5.  
  6.     Purpose:        First installment of AEO Programmers' Journal
  7.  
  8.     Editor:         Albert Dayes
  9.  
  10.     Legal Notes:    Copyright © 1993 Subspace Publishers
  11.  
  12. ***********************************************************************/
  13.  
  14. Publisher = Michael Lindsay                               [GE: EXPLORER]
  15. Managing Editor = Travis Guy                               [GE: AEO.MAG]
  16. Editor = Albert Dayes                      [GE: AEO.1] [CIS: 70007,3615]
  17. Technical Editor = Carl Barron           [GE: CBARRON] [CIS: 75066,3204]
  18. GFA BASIC columnist = Eric Goodman                           [GE: AEO.6]
  19. OBJECT::ATARI columnist = Warwick Allison      [In: warwick@cs.uq.oz.au]
  20.  
  21. Contributing:
  22. Ed Krimen [AEO.5]
  23. J.J. Lehett
  24. Ron Robinson [EXPLORER.1]
  25.  
  26.  
  27. /***********************************************************************/
  28.  
  29. Table of Contents:
  30.  
  31. * Editorial & Welcome
  32. * Meet the Authors -- short biographical notes on the authors
  33. * BASIC Column -- Eric Goodman introduces GEM programming with GFA BASIC
  34. * C Column -- First steps to learning C programming
  35. * Advanced Computing -- Carl Barron takes a look a FLEX
  36. * Hard Core -- Interview with Greg Comeau, developer of Comeau C++
  37. * Bad Example -- Do you really want to do that?
  38. * Practical DSP -- Ron Robinson discusses Digital Signal Processing
  39. * LIB [ new file(s) ] -- A first look at the C Users Group CD-ROM disc
  40. * Periodicals -- A magazine just for C programmers
  41. * OBJECT::ATARI -- J.J Lehett & Warwick Allison examine OOP ideas
  42. * Language Watch  -- Current versions of developer tools
  43. * On the Networks -- Interactive programming on-line
  44. * Network Sign-up Information
  45. * User View -- Ed Krimen discusses computing from a user's point of view
  46. * Brain Stem rotator -- A true programming challenge?
  47. * Glossary of Terms
  48. * ATARI DEVELOPER INFORMATION -- Where to get the official Atari Docs
  49. * Sources of Information -- References for this issue
  50. * Post Increment -- What is coming up in the next issue
  51. * LEGAL NOTES
  52.  
  53.  
  54.  
  55. /***********************************************************************/
  56.            Editorial:  "Thank Atari for ST-BASIC"
  57.                      By: Albert Dayes
  58. /***********************************************************************/
  59.  
  60. When the Atari ST was first released many Atari 8-bit BASIC
  61. programmers waited to use ST-BASIC on their new machines with bated
  62. breath.  All were greatly disappointed with its look, feel and lack of
  63. features.  They then turned their sights on other languages like C and
  64. Assembly (and GFA BASIC) and started the tradition of programming the
  65. Atari ST.
  66.  
  67. As the Atari market changed in many ways the development tools still
  68. continued to get better all the time.  Not only did they get better,
  69. but a greater variety of development tools continues to increase.
  70. Many programmers are finding very useful tools in source code form on
  71. other platforms and porting them to the Atari at a tremendous rate.
  72. This is a good sign and I hope this trend continues on at a faster
  73. pace.
  74.  
  75. Welcome to Atari Explorer Online - Programmers' Journal.  This
  76. supplement is dedicated to programmers of all types from the hobbyist
  77. to commercial and specifically for Atari ST/STe/TT/FALCON030
  78. programmers.
  79.  
  80. There are several goals to AEO-PJ:
  81.  
  82. A)  One of them is in the spirit of David Small ... share code.  This
  83.     does not mean trade secrets but just useful code that everyone can
  84.     benefit from.  There are many aspects of GEM that can benefit from
  85.     this idea.
  86.  
  87. B)  Have a large on-line database (maybe even on CD-ROM) of working
  88.     code to help programmers get GEM applications up and running much
  89.     more quickly.  Have modules that one can link in or merge in
  90.     source code form to perform some of the necessary parts of GEM
  91.     without having to rewrite it every time.  This is even more of an
  92.     issue when a developer comes from a different platform.  Also this
  93.     is not limited to GEM and can be easily extended to other
  94.     programming areas.
  95.  
  96. C)  Provide references for other periodicals that provide more in
  97.     depth information on a particular subject.  There are many good
  98.     programming magazines out there and sometimes they cover a certain
  99.     programming problem in much more detail.  This list includes C
  100.     Users Journal, Dr. Dobb's Journal, Computer Language, etc.  Also
  101.     there are many good books that can be reviewed or referred to as
  102.     well.
  103.  
  104. D)  Remind us of what users are looking for as features in the
  105.     software products they purchase.
  106.  
  107. E)  Make programming what it always should be ... FUN!!!
  108.  
  109. F)  A Trillion lines of new code per day!
  110.  
  111. Special thanks to the Atari Explorer Online and Atari Explorer staff for
  112. their input and "debate e-mail" for making this all possible.  Also to all
  113. who have not been mentioned and should have been.
  114.  
  115.  
  116.  
  117. /**********************************************************************/
  118.                       Meet the Authors
  119. /**********************************************************************/
  120.  
  121. //// Warwick Allison:
  122.  
  123.     Warwick has a BSc with first class honours in computer science.
  124.     He has owned Atari computers since 1982, and has been programming
  125.     in C++ since the beginning of 1992.  He is currently involved in
  126.     research into language-based editors at the University of
  127.     Queensland in Australia.
  128.  
  129. //// Carl Barron:
  130.  
  131.     I started programming in FORTRAN II back in 1965, while getting a
  132.     degree in Mathematics, from SUNY at Buffalo.  I did write parts
  133.     of the arithmetic library code for "student" FORTRAN compiler for
  134.     an IBM 360, various code on an IBM 7044 and CDC 6400, (all
  135.     obsolete and less powerful than an ST with a 9-track tape unit or
  136.     two, but required strict climate control).  I no longer write code
  137.     for a living (too many ulcers for me <grin>).  I write code for
  138.     fun these days, and this ATARI platform is a joy to use for that.
  139.     My main interests are mathematical and scientific.  I hate
  140.     reinventing wheels.
  141.  
  142.     Telecomunicating two hours+ a day is the real major use, of this
  143.     system.  I am on GEnie and Compuserve daily in a multiple number
  144.     of places therein, mostly lurking, but sometimes "vocal."
  145.  
  146.     I'm also the editor of a newsletter, disk librarian, an a director
  147.     of a user's group.  Between these duties and programming for fun
  148.     and making a "few $" for living, writing for AEO-PJ (seems to be a
  149.     natural thing to do).  I have little time for games but have lots
  150.     of fun programming.  It is very gratifying to get a solution to a
  151.     problem!
  152.  
  153.  
  154. //// Albert Dayes:
  155.  
  156.         Albert has a BSc in Computer/Science and has been enjoying
  157.         Atari products since 1978.  His current areas of interest
  158.         include filesystems, CD-ROM, PostScript and Scuba Diving.
  159.  
  160. //// Eric Goodman
  161.  
  162.     1981 My first computer was a Commodore Vic 20.  I learned the CBM
  163.          BASIC programming language built into the computer.
  164.  
  165.     1982 Purchased my first Atari Computer, the Atari 400.  I
  166.          continued programming in BASIC for over 4 years developing
  167.          experience.
  168.  
  169.     1984 Purchased Atari 800XL.  Specialized in programs for the
  170.          8-bit Ataris in 8-bit BASIC.  Started advanced programs with
  171.          800XL.  Worked with a Macintosh 512KE and IBM computers.
  172.  
  173.     1987 Purchased 520ST.  Programmed very little in ST BASIC.
  174.  
  175.     1989 Started programming in GFA BASIC.  Attended classes for
  176.          Multimedia and Computers using NewTek Video Toaster,
  177.          Macintosh Computer Systems, and Time Code Video Editing
  178.          Systems.
  179.  
  180.     1991 Started developing professional applications in GFA.
  181.          Working with Still Video Cameras/Digitizers.
  182.  
  183.  1992-93 Learning C and 68K Assembly along with 56001 DSP Assembly.
  184.          Still developing heavily in GFA BASIC.  Extensive experience
  185.          with Amiga Video Toaster 2000.  Began working with Roland
  186.          JD800 MIDI Keyboard/Synthesizer.  Presently Developing Time
  187.          Code Editing System for NEC PC VCR Systems.  Consulting for
  188.          Multimedia Systems and Tutoring Programmers and Application
  189.          Tutoring.  System setup and configuration for new IBM
  190.          Multimedia Hardware.  Developing and publishing applications
  191.          and utilities created in GFA BASIC.
  192.  
  193.     Other:
  194.  
  195.         Following new developments in Virtual Reality Technology.
  196.         Staying informed on latest developments of Multimedia
  197.         Hardware for Home/Small Businesses.
  198.  
  199.         Demonstrating Atari Computers to Educational Institutions and
  200.         Professional Organizations.
  201.  
  202.         Follow new developments of Compilable BASICs for ALL
  203.         platforms.
  204.  
  205.         Vice President of Phoenix ST User's Group.
  206.  
  207.         Promoting Falcon030 for Multimedia Applications.
  208.  
  209.  
  210. //// Ed Krimen
  211.  
  212.     Ed Krimen has been using Atari ST computers since 1987, but has
  213.     been tracking them since their debut in 1985.  He enjoys his
  214.     position as a technical support specialist for Macromedia, Inc., a
  215.     multimedia software company in San Francisco.  He spends most of
  216.     his free-time on GEnie and the Internet, and loves to play
  217.     basketball.
  218.  
  219. //// J.J. Lehett
  220.  
  221.     J.J. Lehett was strongly in favor of starting the Object Atari
  222.     column but job constraints did not allow him to continue the
  223.     column.  On a good note he pointed us to Warwick Allison who wrote
  224.     the GEM++ library who gladly agreed to continue with the column.
  225.     J.J. will be missed.
  226.  
  227. //// Ron Robinson
  228.  
  229.     Ron Robinson has been involved in home computering since the mid-
  230.     1970's when he built an Altair 8800B with a whopping 1K of memory
  231.     and toggle switch/LED front panel user interface.  He has owned
  232.     Atari computers starting from the Atari 400 days.  His first ST
  233.     came in a 260ST box and he has managed to collect one of each
  234.     Atari computer including several Falcon030s.
  235.  
  236.     He started writing about the Atari computer through the local
  237.     users groups in 1986.  Since 1988, over 80 of his articles and
  238.     reviews have been published in Atari magazines, including ST
  239.     Informer, Atari Advantage and Atari Explorer Magazine.  He has
  240.     served as a GEnie on-line representative for these magazines over
  241.     much of the same period.
  242.  
  243.     To support his computer habit, Ron is a project manager for a
  244.     major international biotechnology instrumentation company
  245.     specializing in immunodiagnostics and infectious disease testing.
  246.     He holds a BSc degree in Engineering and a MSc degree in Computer
  247.     Science.  In his spare time, he teaches courses in engineering and
  248.     computer technology at a local university, plays tennis and
  249.     teaches Pattie the Wonder Dog how to fetch the morning paper.
  250.  
  251.  
  252.  
  253. /**********************************************************************/
  254.                  BASIC Programming Column
  255.                     By: Eric Goodman
  256. /**********************************************************************/
  257.  
  258. //// INTRODUCTION
  259.  
  260. Ever since the first computer programmers, man (and woman) have
  261. dreamed of developing computer software in a quick, easy, and
  262. efficient environment.  They wanted speed and compatibility but they
  263. also wanted power. They did not want to spend an eternity learning a
  264. new machine language.  They wanted clean, clear, and easy to read
  265. code. They wanted all of this in one simple language. And they got it
  266. (well they almost got it). The language was BASIC.
  267.  
  268. Many different BASICs have come and gone. These BASICs were not
  269. powerful, they were not fast, and they certainly were not very
  270. efficient, they didn't even compile.  They required some type of
  271. interpreter to execute.  For obvious reasons, this was unacceptable,
  272. so a new type of BASIC was invented. These new BASIC programs could be
  273. compiled into stand-alone applications.  Applications that did not
  274. require an interpreter to execute. This new BASIC was a COMPILABLE
  275. BASIC. GFA BASIC has, recently, evolved into a compilable BASIC.
  276. However, there are many things that set GFA BASIC apart from your
  277. _typical_ compilable BASIC.
  278.  
  279. For example, your typical BASIC language uses line numbers. GFA BASIC
  280. does not. There are many advantages in not using line numbers. One
  281. advantage would be the management of subroutines. Subroutines, in GFA
  282. BASIC, are called by name, much like a lower level language (such as
  283. C). The advantages to this should be clear. Line numbers, simply put,
  284. "aren't programming" anymore. Another example that sets GFA apart
  285. would be its Editor. GFA BASIC's Editor uses a "forced" structuring
  286. system in which the editor automatically indents the code while in a
  287. loop or an if/then statement. It also indents while in a PROCEDURE.
  288. This allows for clear, straight-forward, source code. And, with the
  289. Editor's automatic syntax checking, it will not allow a loop or an
  290. if/then statement to remain open. Thus, eliminating a number of
  291. potential bugs, almost immediately.
  292.  
  293. Finally GFA BASIC offers power. It offers the power of a low level
  294. language yet in a BASIC language environment. With a command such as
  295. INLINE, and easy access to GEM, GFA's power and flexibility become
  296. apparent. With the INLINE command a programmer can use assembly
  297. routines that may not be quick or efficient enough to be written in
  298. BASIC. The INLINE command may also be used to store resources,
  299. pictures, compressed data, _anything_ a programmer wants embedded into
  300. the program. This offers many new possibilities within GFA programs,
  301. as opposed to other BASICs.
  302.  
  303. Which brings us to GEM. I didn't say "_easy_ access to GEM" in that
  304. last paragraph did I? _EASY_ access? Yes I did, and I meant it. At
  305. first GFA's GEM access may look confusing and too much of a pain to
  306. worry about. The typical response is, "...no problem, I'll just use
  307. GFA's version of the GEM commands." For those of you who don't know
  308. what I am referring to, some of these commands are, for example: ON
  309. MENU, MENU KILL, MENU OFF, OPENW, CLOSEW, CLEARW, FULLW, INFOW.
  310. "...But those commands are easier to use, Besides... they work." Well,
  311. little do most GFA'ers know, those commands are highly incompatible,
  312. they are buggy, and they, certainly, are not reliable.  But most of
  313. all... They are not Atari legal! Yes, ladies and gentlemen, boys and
  314. girls, you _are_ breaking "The Law."
  315.  
  316. This is why _I_ am here.... To keep all of those outlaws, renegades,
  317. and misfits, out there, in line. GEM is the Final Frontier, it is the
  318. last unexplored region of the GFA Galaxy. This article will be the
  319. first in a series that will guide GFA BASIC Programmers, beginner and
  320. advanced alike, through the mysterious workings of this awe inspiring,
  321. yet powerful Graphical User Interface.
  322.  
  323. Throughout the series you will be aided by well commented, sample GFA
  324. BASIC source code along with tips and techniques for improving your
  325. GFA Programming skills. You may leave me GE Mail at AEO.6 regarding
  326. any questions, suggestions, and GFA programming mishaps. 
  327.  
  328. //// GEM Events
  329.  
  330. The first item on our "GEM Agenda" will be GEM Events. An Event is
  331. what GEM uses to communicate with our programs. An Event Message is a
  332. detailed description of what event has occurred within the GEM
  333. Environment.  For example, if you select a menu item GEM will pass a
  334. number indicating an event has occurred.  In this case a selected menu
  335. item passes event number '10'. Different GEM Events are assigned a
  336. different number (Refer to your GFA BASIC manual or Atari Developer's
  337. Documentation for a complete list of GEM Events and their
  338. corresponding numbers). Next, you must find out what menu item was
  339. selected. When a GEM Event occurs not only is the event _number_
  340. passed but also the detailed information about the event. This
  341. information is stored in an Event Message Buffer which you must
  342. define.
  343.  
  344. You will be learning how to define a Message Buffer for GEM Events and
  345. read them as fields of data. EVENT_MULTI() will place the event
  346. number and any information about the event in the Message Buffer. The
  347. _pointer_ to the Message Buffer is one of the parameters passed in
  348. EVENT_MULTI(). Other parameters passed in this function will determine
  349. what specific GEM Events are returned and _when_ they are returned
  350. (Refer to your GFA BASIC manual for the function and parameter
  351. definition).
  352.  
  353. If you downloaded the Programmer's Journal Source Code Archive refer
  354. to the file 'GFA_GEM1.LST'. This file contains the following source
  355. code:
  356.  
  357.  
  358. '        ** AEO Programmer's Journal Source Code File GFA_GEM1.LST **
  359. ' ==========================================================================
  360. ' EVNT_MULTI() - Message Buffer Allocation & GEM Event Test
  361. '
  362. ' DESCRIPTION: This GFA BASIC source code will allocate a GEM Event Message
  363. '              Buffer and open a GEM Window. If an Event occurs it will check
  364. '              the appropriate Message Field for information and adjust the
  365. '              window accordingly. The drag and close functions are the only
  366. '              working window functions. By using the existing code and what
  367. '              you will learn from its comments you must add your own code to
  368. '              enable the window to respond to the SIZE event.  You may also
  369. '              refer to your GFA Manual.
  370. '
  371. ' NOTE: The window creation code will not be commented in this example. GEM
  372. '       Windows will be explained, in detail, in the another article.
  373. ' ==========================================================================
  374. '
  375. ' -- Event Message Buffer and Field Definition -----------------------------
  376. '
  377. DIM evnt_msg_buf%(3)           ! Allocate 32 bytes for the Buffer
  378. msg_buf%=V:evnt_msg_buf%(0)    ! Set a pointer to the start of the buffer
  379. '
  380. ABSOLUTE evnt1&,msg_buf%       ! GEM Event Message Field Definition:
  381. ABSOLUTE evnt2&,msg_buf%+2     ! Use the ABSOLUTE command to set the pointer
  382. ABSOLUTE evnt3&,msg_buf%+4     ! of a variable.  These variable names are
  383. ABSOLUTE evnt4&,msg_buf%+6     ! set corresponding to the GEM Message Fields.
  384. ABSOLUTE evnt5&,msg_buf%+8     ! The different characteristics of an event
  385. ABSOLUTE evnt6&,msg_buf%+10    ! can be found in a given field. Each data
  386. ABSOLUTE evnt7&,msg_buf%+12    ! field is of word length (2 bytes).
  387. ABSOLUTE evnt8&,msg_buf%+14
  388. ABSOLUTE evnt9&,msg_buf%+16    ! (Refer to the GFA Manual or Atari Dev. Docs
  389. ABSOLUTE evnt10&,msg_buf%+18   ! for information on the Event Message Data.
  390. ABSOLUTE evnt11&,msg_buf%+20   ! And the GFA Manual for the ABSOLUTE
  391. ABSOLUTE evnt12&,msg_buf%+22   ! command definition.)
  392. ABSOLUTE evnt13&,msg_buf%+24
  393. ABSOLUTE evnt14&,msg_buf%+26
  394. ABSOLUTE evnt15&,msg_buf%+28
  395. ABSOLUTE evnt16&,msg_buf%+30
  396. '
  397. ' --------------------------------------------------------------------------
  398. '
  399. ' -- Open Window -----------------------------------------------------------
  400. ' --This window is opened only for demonstration purposes.
  401. ' --Windows will be explained in another issue.
  402. '
  403. window&=WIND_CREATE(&X11111101111,15,25,250,150)
  404. wind_name$="AEO-PJ Test"
  405. adr_name%=V:wind_name$
  406. ~WIND_SET(window&,2,CARD(SWAP(adr_name%)),CARD(adr_name%),0,0)
  407. ~WIND_OPEN(window&,15,25,250,150)
  408. '
  409. ' --------------------------------------------------------------------------
  410. '
  411. ' -- Main Event Loop -------------------------------------------------------
  412. '
  413. DO                                ! Always put EVNT_MULTI() in the MAIN LOOP
  414.   event|=EVNT_MULTI(&X111111,1,1,1,0,0,0,0,0,0,0,0,0,0,msg_buf%,0)
  415.   SELECT evnt1&                   ! The Event number is stored in evnt1&
  416.   CASE 28                         ! Event 28 means a window has been dragged
  417.     ~WIND_SET(evnt4&,5,evnt5&,evnt6&,evnt7&,evnt8&) ! Change window position
  418.   ENDSELECT                       ! Use Msg Buffer Fields for information on
  419. LOOP UNTIL evnt1&=22              ! the dragged Window. Notice the Desktop
  420. '                                 ! Updates. (automatic when using GEM)
  421. ' You must now determine which Event number indicates a WINDOW SIZE CHANGE.
  422. ' Then obtain the correct information for adjusting its size.  Use the
  423. ' ~WIND_SET() GEM function to set the window's size. GEM windows will be
  424. ' covered in another issue of AEO Programmer's Journal. However, there is
  425. ' plenty of information above to complete the task. Once you have achieved
  426. ' this, try enabling the WINDOW FULL function.
  427. ' ------------------------------------------------------------------------
  428. '
  429. ' -- Close Window --------------------------------------------------------
  430. '
  431. ~WIND_CLOSE(window&)
  432. ~WIND_DELETE(window&)
  433. '
  434. ' ------------------------------------------------------------------------
  435. END
  436.  
  437.   In the next issue of AEO Programmers' Journal we will be covering GEM Menu
  438. bars using the EVNT_MULTI() function. Using what you have learned in this
  439. article, try creating a GEM Menu and reading its Events using the same
  440. method as the Window Events.
  441.  
  442.  
  443.  
  444. /***********************************************************************/
  445.                     C Programming Column
  446.                       By: Albert Dayes
  447. /***********************************************************************/
  448.  
  449. Defined in a few words, programming is problem solving.  As in real
  450. life, it is a love and hate relationship.  When learning to program
  451. there are a few things one needs to know.  The first is knowing what
  452. the problem is.  If one does not understand the problem one cannot
  453. solve something one does not understand.  The syntax and semantics is
  454. the other part to programming.  Syntax is basically rules that govern
  455. the language you are programming in.  Some syntax errors are spelling
  456. errors and just like in normal writing these can cause problems.
  457. There is more to syntax errors than that but is just a method to think
  458. about them.  The next part is semantics which is the meaning of the
  459. word, expression or symbols.  It also deals with the relationship
  460. between words, expressions and symbols.
  461.  
  462. Another important aspect to programming is being consistent.  Having
  463. a uniform structure throughout the program makes very good sense.  Be
  464. generous with spacing and make it easy to read is the final important
  465. issue.
  466.  
  467. In C we have a compiler which changes the words written in a text
  468. editor into tokens and finally into a runable program.  On the Atari
  469. we have several choices for compilers.  There are a few
  470. freeware/shareware compilers like Heat & Serve, GCC and SOBOZON and
  471. commercial compilers like Pure C and Lattice C.  The C compiler used
  472. in this column will be the Pure C compiler.
  473.  
  474. There standard used by the commercial C compilers is the ANSI C
  475. standard which is the most current standard available for C.  This
  476. column will stick to this standard as much as possible.  If
  477. significant differences between K&R (the pre-ANSI format) to ANSI this
  478. column will do its best to point them out.  The book that defines the
  479. ANSI standard is "The C Programming Language" (2nd edition).  Make
  480. sure that its the second edition since there are older versions of the
  481. book still available.
  482.  
  483. Type in the following into your text editor, compile, link and finally
  484. run the program.  You may have to refer to your compiler documentation
  485. for more information on compiling or linking.  Also make sure you save
  486. the file in ascii format.  Make sure you use lower case when typing in
  487. the text.
  488.  
  489. Next time we will discuss macros, variables, functions and much more.
  490.  
  491. NOTE:  If your compiler supports ANSI C use the first one and if not then
  492.        your C compiler is a K&R (pre-ANSI) compiler.
  493.  
  494.  
  495. <=== cut here ANSI code begins ===>
  496.  
  497. #include <stdio.h>
  498.  
  499.  
  500. main(void)
  501.   {
  502.  
  503.    printf("hello atari world\n");
  504.  
  505.    return 0;
  506.  
  507.   }
  508. <=== end === >
  509.  
  510. <=== cut here K&R or (non ANSI) code begins here === >
  511.  
  512.  
  513. #include <stdio.h>
  514.  
  515. main()
  516.   {
  517.  
  518.    printf("hello atari world\n");
  519.  
  520.   }
  521.  
  522.  <=== end ===>
  523.  
  524.  
  525.  
  526. /***********************************************************************/
  527.                 Advanced Computing
  528.                  By: Carl Barron
  529. /************************************************************************/
  530.  
  531. An introduction to FLEX
  532.  
  533. (c)1993   Carl Barron.
  534.  
  535. This article can be reprinted in its entirety for non-commercial
  536. purposes.  Commercial usage is reserved.
  537.  
  538. This is the first in hopefully a long series of articles describing
  539. FREE programming tools available on the ATARI m680x0 platform, for
  540. C programmers. If you have any questions, ideas, etc. please send
  541. email to the addresses above.  I will attempt to answer the
  542. questions in future articles if they are general, specifics I may
  543. or may not answer in email.
  544.  
  545. I use Lattice C5 at this time and all code I write in these articles
  546. will be LATTICE C5 compatible.  I will not specifically write old
  547. style C but for what little C code there will be, it will be left to
  548. the reader to get it to compile on your old C compiler.  Flex237 is
  549. NOT COMPATIBLE with MWC 3.x and if that is your compiler sorry, but
  550. Mark Williams blew it with respect to __STDC__.   Flex will produce
  551. old style C, ANSI C or C++ compatible C for its output.  So just about
  552. any C compiler will do.  A C compiler is required to use many of the
  553. tools to be discussed.  I will assume you are familiar with a C
  554. compiler and how to execute an external tool in your Compiler's
  555. environment.
  556.  
  557. Flex is a descendent of lex a UNIX(tm) tool to generate pattern
  558. scanners. Flex is pd and is distributed under the GNU agreement,
  559. which essentially  states that the source code to flex must be
  560. freely available.  You can do what ever you want with the result
  561. file (lexyy.c), since there is no copyleft.
  562.  
  563. A pattern scanner is a subprogram that reads input data and breaks
  564. it into smaller pieces based on what it finds.  Flex reads input
  565. data and attempts to match it to regular expressions. When it finds
  566. at least one  that matches it chooses the longest and first rule
  567. that matches.  That is, it finds the longest match, if there is
  568. more than one longest match it chooses the first pattern from its
  569. source file, so that order of regular expressions in the flex
  570. source file can be very important.
  571.  
  572. A flex program consists of ascii text, any text editor or word
  573. processor capable of saving in 100% 7-bit ascii and no word processor
  574. control codes is fine.  Flex will read files ending in '\n' or
  575. '\r\n' just fine. So that UNIX(tm) source can be used directly if
  576. desired.
  577.  
  578. The basic format of a flex program is:
  579.      declarations
  580.      %%
  581.      rules
  582.      %%
  583.      additional code
  584.  
  585. Declarations are flex macro redefinitions, global variable
  586. declarations, function prototype/declarations and other initial C
  587. code that needs to appear near the beginning of the file.  The
  588. declarations can also define pattern names, and start sections (more
  589. on as we go along).  The C code must be indented or contained in
  590. %{,%} blocks.
  591.  
  592. The rules are the form
  593.      pattern  spaces_tabs action
  594.  
  595. The action is C code to execute if the scanner generated recognizes
  596. the pattern.  If it is all on the same line no {}'s are required,
  597. if it  extends beyond a line it must be enclosed in {,}'s  or
  598. %{,%}'s. If it the latter is used no account to the balance of
  599. {,}'s will be taken into account.  Otherwise it will end the action
  600. code where the {,}'s balance. This is to allow conditional
  601. compilation, or what have you have code that looks at this stage as
  602. if the brackets are unbalanced.
  603.  
  604. The pattern is a regular expression.  These are recognized in order
  605. of precedence highest to lowest:
  606.  
  607.      x                   match character x.
  608.      .                   match any character
  609.      [xyz]               character class match any character
  610.                          in the class.
  611.      [abj-oZ]            matches an a,b,letters j through o and
  612.                          capital Z.
  613.      [-a]                matches a '-' or 'a'
  614.      [^xyz]              negated character class matches any
  615.                          character not in the class.
  616.      r*                  zero or more occurrences of regular
  617.                          expression r.
  618.      r+                  one or more occurrences of regular
  619.                          expression r.
  620.      r?                  zero or one occurrence of regular
  621.                          expression r.
  622.      r{2,5}              2 to 5 (inclusive) occurrences of r.
  623.      r{2,}               2 or more occurrences of r.
  624.      r{4}                exactly 4 occurrences of r.
  625.      {name}              name from the definition section
  626.                          expanded and enclosed in ()'s.
  627.      "abc"               literal string abc, quotes inside a
  628.                          string need to be written as \". 
  629.                          "\"hello\"" is "hello".
  630.       \X                  where X is in [abfnrtv]  the ANSI C '\X'
  631.                          char.
  632.      \123                octal value 123.
  633.      \x2a                hex value 2a
  634.      (r)                 parenthesis used to override precedence.
  635.      rs                  regular expression r followed by regular
  636.                          expression s.
  637.      r|s                 Either regular expression r or s.
  638.      r/s                 r, but only if followed by an s. (r,s
  639.                          are regular expressions).
  640.      ^r                  regular expression r at the beginning of
  641.                          a line.
  642.      r$                  regular expression r at the end of a
  643.                          line.
  644.      <sc>r               an r, but only if scanner is in start
  645.                          state sc.
  646.      <sc1,sc2>r          an r, but only if scanner is in start
  647.                          state sc1 or start state sc3. (can be
  648.                          any number of comma separated start
  649.                          states if desired).
  650.      <<EOF>>             an end of file.
  651.      <sc1,sc2><<EOF>>    an end of file when in start state sc1
  652.                          or sc2.
  653.  
  654. Declarations can name common occurring subexpressions. the format is:
  655.  
  656. <C style name><whitespace><regular expression>.
  657.  
  658. Additional code is copied verbatim by flex to the output file lexyy.c.
  659.  
  660. This stuff out of the way, lets get down to basics!  What can I do
  661. with flex?  The general answer is just about anything that searches
  662. for patterns in a file, or keyboard input.
  663.  
  664. I will start off with a simple word counter, wc.l which except for
  665. the lack of options is very similar to the UNIX(tm) tool.
  666.  
  667. /* start of wc.l */
  668. %{
  669. long wcount,lcount,ccount;/* declare our counters */
  670. %}
  671. %%
  672. [^ \t\n]+      {++wcount;ccount+=yyleng; /* got a word count it*/ }
  673. [ \t]+         {ccount += yyleng;  /* spaces or tabs count them */ }
  674. [\n]+          {lcount += yyleng;ccount += 2*yyleng;
  675.                   /* newlines count them, take into account ST
  676.                     'newlines' are two characters. */ }
  677. %%
  678. int main(int ac,char **av)
  679. {
  680.      int newfile=0;      /* flag for file changes */
  681.  
  682.      while(--ac)         /* for each argument on cmd line */
  683.      {
  684.           if(!newfile)   /* if first file just open the file */
  685.           {              /* yyin, yylex()'s input FILE * */
  686.                newfile=1;
  687.                yyin =fopen(*++av,"r");
  688.           }
  689.           else
  690.           {
  691.                yyin=freopen(*++av,"r",yyin); /* otherwise reopen yyin */
  692.                if(yyin!=NULL) yyrestart(yyin);    /* reconfigure yylex() for
  693.                                                      starting again */
  694.           }
  695.           if(yyin==NULL)      /* if we don't do this */
  696.           {                   /* yylex will set yyin to */
  697.                fprintf(stderr,"Can't open %s\n",*av);
  698.                                /* stdin and we don't want that */
  699.  
  700.                continue;      /* no error message written */
  701.           }
  702.           wcount=lcount=ccount=0;  /* reset our counters */
  703.           yylex();                 /* count and display results below */
  704.  
  705.           fprintf(yyout,"%s\t%ld\t%ld\t%ld\n", *av, wcount,
  706.                lcount ,ccount);
  707.      }
  708.      return 0;                          /* return success */
  709. }
  710. /* end of wc.l */
  711.  
  712. Note that all the 'gibberish' about determining what our input is,
  713. is hidden.  Note how simple the code is.  A word is non spaces
  714. or tabs or newlines. If you want to include form feeds, vertical
  715. tabs, the  extension is fairly easy. You just enlarge the character
  716. classes [ \t], and [^ \t\n] to include them.  The action code would
  717. not be changed unless you wanted to count more things like pages.
  718. I'll leave it as  an exercise to page count.  Don't forget about
  719. files with no line feeds!
  720.  
  721. Next I will change all C++ // type comments to /* */ style it will
  722. nest any /* */ comments in the // comment however,
  723.  
  724.      /*   ccpcmnt.l */
  725.      /*  convert // comments to regular C comments */
  726.      /*  the following start starts are used for quotes and both
  727.           comment types so we do not translate //'s in C comments
  728.           strings, or character constants. */
  729. %x   squote dquote ccomment sscomment
  730. %%
  731. \"        ECHO;BEGIN(dquote);                /* a double quote */
  732. \'        ECHO;BEGIN(squote);                /* a single quote */
  733. \\.       ECHO;                                   /* escaped char.
  734. */
  735. "/*" ECHO;BEGIN(ccomment);              /* C comment begin */
  736. "//" fputs("/*",yyout);BEGIN(sscomment); /* C++ comment begin */
  737. .|\n ECHO;                                   /* anything else */
  738. <dquote>\"     ECHO;BEGIN(INITIAL);/* done with quoted string */
  739. <dquote>.|\n   ECHO;               /* else continue string */
  740. <squote>\'     ECHO;BEGIN(INITIAL);/* done with single quotes */
  741. <squote>.|\n   ECHO;               /* else continue scan */
  742. <sscomment>.+  ECHO;               /* echo to end of line */
  743. <sscomment>\n  {fputs("*/\n",yyout);BEGIN(INITIAL); /* end the
  744. comment */}
  745. <ccomment>"*/" ECHO;BEGIN(INITIAL);     /* end of C comment */
  746. <ccomment>.|\n ECHO;                    /* else continue*/
  747. %%
  748. void main(int ac,char *av[])
  749. {
  750.      /* I will skip the usual error checking for brevity! */
  751.      yyin = fopen(av[1],"r");
  752.      yyout = fopen(av[2],"w");
  753.      yylex();
  754. }
  755. /* end of cppcmnt.l */
  756.  
  757. INITIAL is the default start state, the one the scanner is in
  758. unless another is specified.  yyout is the FILE * for ECHO which
  759. writes the matched string to yyout.  What could be simpler to do
  760. this no headaches about setting flags and special conditions all
  761. straight forward.  The start states are used to handle the
  762. subproblems of strings and multiple character constants like '//'
  763. if they are in the source code.
  764.  
  765. I will leave with an exercise for the reader write a flex program
  766. to convert all assignment operators of the for =+ to +=, delete all
  767. C and C++ comments. (you can assume regular C comments are not
  768. nested if you desire, its easier), check curly bracket matching,
  769. (watch out for strings and char constants)!  It should be about four
  770. screens or less in size. I have not yet written such, but it is a
  771. combination of what we have been doing and combining them is no big
  772. problem with flex.
  773.  
  774. I will go into more interesting things like converting a Compuserve
  775. library listing to a flash (1 or 2) do file.  Its source is a flex
  776. file.  It will show you how to get just some information from a file
  777. and ignore anything that is not correct.  It will not change forums
  778. or libs if the listings are sorted by library as lib:all does and the
  779. file is in the same library and forum as the previous file to download.
  780. It is a little more involved than these but still not beyond straight
  781. flex code.  I think it works, I have not run the do files through flash,
  782. but the information gathering works, more next time.
  783.  
  784. As noted at the beginning, if something in these articles is not
  785. clear,  please ask, via email at addresses above.
  786.  
  787. Flex237 is on GEnie as flex237.zoo.  It's docs, a short
  788. installation program to change the drive containing \lib\flex.ske,
  789. and some notes to get flex.ske to work with lattice 5, will be in
  790. a separate file, for GEnie if you have flex237.zoo and the works
  791. will be in an lzh file on CIS and GEnie someday soon.
  792.  
  793.  
  794.  
  795. /***********************************************************************/
  796.             HARD CORE
  797.           By: Albert Dayes
  798. /***********************************************************************/
  799.  
  800. An interview with Greg Comeau of Comeau Computing about his new C++
  801. compiler for the Atari.
  802.  
  803. AD:  What is your new product for the Atari?
  804.  
  805. GC:
  806. Comeau C++ 3.0 With Templates.  This is not just an "out-of-the blue"
  807. product.  Point in fact is that Comeau C++ has been the most
  808. diversely ported commercial C++ anywhere for over 4 years.  Further,
  809. Comeau C++ is stable, up-to-date, reasonably priced, and in sync with
  810. the implementation and specification that every other vendor shoots
  811. for: cfront 3.0 (we literally are cfront 3.0 as we are source code
  812. licensees of AT&T USL C++ Language System).
  813.  
  814. AD:  What C compiler(s) is/are supported?
  815.  
  816. GC:
  817. One must realize that Comeau C++ generates C as its object code (it is
  818. NOT a preprocessor though as it does syntax checking, semantic
  819. processing, error reporting, etc, in full ... a C compiler is used
  820. only to produce native object code and is not expected to perform any
  821. activities like error checking and reporting).  With that in mind, the
  822. initial release of Comeau C++ 3.0 With Templates for the Atari will
  823. have "official" support for Lattice C only.  A number of upgrades are
  824. already being planned, and additional back ends will include as many C
  825. compilers as possible.  For instance, PureC and gcc.
  826.  
  827. AD:  What are the minimum computer requirements to run Comeau C++?
  828.      (hardware and software)
  829.  
  830. GC:
  831. The software requirements are that you have a C compiler as per the
  832. conversation above.  The hardware requirements are that you have 2M of
  833. RAM and disk space available.  (NOTE: The product is still in beta but
  834. I do not expect this numbers to change).
  835.  
  836. AD:  How long has Comeau C++ been in development for the Atari?
  837.  
  838. GC:
  839. For over a year.  It became an on-again/off-again situation.
  840. Similarly a love/hate relationship.  It involved a number of different
  841. issues ranging from technical to philosophical.  Like the post office,
  842. we got through it all and now have a solid and stable conforming
  843. compiler.  Being able to do such "foreign" ports such as this and past
  844. ports (MS-DOS, AmigaDOS, Data General AOS, etc) continues to reinforce
  845. and strengthen our porting leadership and savvy.
  846.  
  847. AD:  Is the code generated portable between other platforms that use
  848.      Comeau C++?
  849.  
  850. GC:
  851. That's a multi-part question whether you know it or not.  Let me
  852. address each part one at a time:
  853.  
  854. 1) As Comeau C++ is the most diversely ported commercial C++, we
  855. guarantee source code compatibility.  Hence, users don't need to port
  856. their code, they merely need to recompile it ("system" header files
  857. and intrinsic OS differences aside of course).
  858.  
  859. 2) Although we provide "official" support for various C backends, many
  860. customers use unofficial backends.  This is especially true of folks
  861. who do embedded systems programming.  One has to realize that although
  862. the style, customers using unofficial backends may not have access to
  863. our run-time library as many C compilers have incompatible
  864. object/modules/linkers/etc.
  865.  
  866.  
  867. AD:  What makes your product different from GNU G++?
  868. GC:
  869.  
  870. Actually some of your questions above are spelling this out:
  871.  
  872. * based on cfront, the de facto target of every vendor
  873. * up-to-date
  874. * robust
  875. * diversely ported
  876. * free tech support
  877. * free 2nd day air shipping and handling
  878. * excellent reviews and customer feedback
  879. * almost always the first to release a new version
  880.  
  881. Whereas the C part of GCC is a top notch compiler, the g++ still has a
  882. few bumpy roads to get over.  The authors of g++ will not say what
  883. version of C++ conforms to, though recently they did state that they
  884. are making efforts to be able to shoot at the ARM.  Also, our customer
  885. base and knowledge of g++ uncontestably indicates that it is not as
  886. free as it first appears.
  887.  
  888. AD:  What is the estimated cost of Comeau C++ for the Atari?
  889.  
  890. GC:
  891. The cost will be $US250.
  892.  
  893. AD:  What type of support does one get when they purchase Comeau C++?
  894.      a) Is the support on-line?  b) Telephone? c) BBS?
  895.  
  896. GC:
  897. Like our port list, this covers a plethora of areas.  For starters,
  898. technical support is free.  It overwhelmingly takes place involving
  899. telephony.  That includes: voice, fax, and electronic forums.  We
  900. prefer electronic forums for a number of reasons and such forums
  901. include: Usenet e-mail and newsgroups, BIX, Compuserve, WELL, Prodigy,
  902. GEnie, and PANIX.  The electronic forums not only allow customers the
  903. ability to send us exact examples of what they may be taking about,
  904. etc, but on some like BIX, where we have a vendor support conference,
  905. customers can also communicate with each other in both private and
  906. public areas.  We can also have general conversations about the
  907. product in its current form and about enhancements they are interested
  908. in seeing.  Although our official tech support hours are Mon-Fri, 9-5,
  909. that is really a voice limitation.  It is common for staff to be
  910. answering a tech support question at say midnight on Saturday.  These
  911. forums are effectively monitored 24 hours/7 days a week.  This is
  912. unheralded IMO.
  913.  
  914. AD: Is there an estimated time frame of when it will be available?
  915.  
  916. GC:
  917. We hope to begin taking orders in July 1993, and either ship in July
  918. or August 1993.
  919.  
  920. AD: What are three major benefits of using C++ for development in your
  921.     opinion?
  922.  
  923. GC:
  924. 1) The C heritage.  Although C is a terse language with a number of
  925.    confusing issues (like declaration syntax, or pointer use beyond
  926.    char *), it also has a number of pluses.  The vast thought and
  927.    wisdom and artistry that Stroustrup put upon C++ as a C superset
  928.    cannot be disputed.
  929.  
  930. 2) The ability to express programs more naturally.
  931.  
  932. 3) Whether a given problem is complicated or not, the solution
  933.    domain(s) of applications differ because each apps needs differ.
  934.    C++ is able to span a broader spectrum of solution domains in order
  935.    to meet these differing needs.
  936.  
  937. I think one has to think about these answers.  That is, note that I
  938. have NOT said:
  939.  
  940. 1) More productivity
  941. 2) Code reuse
  942. 3) Object-oriented
  943.  
  944. Although these issues do indeed come into play for the C++ programmer/
  945. designer/application/etc, they are in some ways to me misguided.  For
  946. instance, I consider it more important to say "C++ is a superset of C
  947. supporting multiple paradigms of programming one of which is OO" than
  948. the not quite right statement of "C++ is an OOL."
  949.  
  950. AD: In your opinion how long on average does it take to get up to speed
  951.     on C++ for an experienced C programmer?
  952.  
  953. GC:
  954. This is often a misinterpretated question and answer.  The question
  955. often takes on the form of "what is the "cost" of learning C++" or
  956. "how much time is lost" and as in some of my above comments, these are
  957. misguided questions.  The straight answer is that is takes 6-9 months.
  958. Anybody walking away, or letting somebody walk away, with just this
  959. information is committing fraud IMO.  That's only part of the answer
  960. and it does need to be put into perspective.  For instance, to the
  961. misguided questions, valid answers do include that there is no cost or
  962. lost time (even for the person not well versed in C).
  963.  
  964. As mentioned, our research has seen that it takes the average C++
  965. programmer from 6-9 months to be reasonably proficient in C++.  The
  966. perspective is that we have also seen it take 5ish-8ish months for a
  967. programmer in other languages to become reasonably proficient.  By
  968. reasonably proficient I mean knowing enough nooks and crannies of
  969. syntax, idioms, paradigms, etc.
  970.  
  971. So what we end up with is *maybe* 25%+ more time to learn C++, but not
  972. in every case.  For instance, given those leeways, it might take one
  973. person 6 months to learn C++, and somebody else 7 months to learn
  974. another language.  Of course, when one really thinks about it, what do
  975. these number mean?  Even if I could show C++ always took less time, I
  976. really think we need a fully described context to see what the impact
  977. of less time really is.  For instance, certainly new issues in design,
  978. thought, approach, etc, is part of the "expense" of C++.  IOW, the
  979. additional time does not so much involve issues like learning new
  980. syntax, but is really more of the nature of issues like the impact of
  981. truly using and understanding OOT.
  982.  
  983. In the specific case of C -> C++, where many things such as syntax are
  984. already familiar, a double edged sword presents itself.  The syntax is
  985. the same, yet the additions add unfamiliar complexity onto it.
  986. Depending upon the individual in the C->C++ case, that 6-9 can be
  987. brought down a few months shorter as the syntax is really a bogus
  988. obstacle and the other things that are important are where the pain
  989. and gain reveals itself.
  990.  
  991. This curve does have many reverse benefits too.  For instance, many
  992. C++ programmers mention it made them better C programmer as not only
  993. do they look at problem in different lights now, but it has helped
  994. them to understand the syntax and semantics of C better.
  995.  
  996. One approach to this learning process is to take it one step at a
  997. time.
  998.  
  999. 1) Just get some C programs to compile under C++ to get familiar with
  1000. it.
  1001.  
  1002. 2) After being comfortable with that, selectively use some of the
  1003.    "better C" features of C++ such as inline function, references,
  1004.    const, function overloading, etc.
  1005.  
  1006. 3) After being comfortable with that, consider collecting some of your
  1007.    "random" data structures and the apparent functions that use them
  1008.    into a class.  You have now created an abstraction and these user
  1009.    defined types should become something whose importance should be
  1010.    clear shortly.
  1011.  
  1012. 4) After being comfortable with that, consider that you don't want
  1013.    global variables, and that you don't want public access to anything
  1014.    and everything.  So you put a level of encapsulation on your data
  1015.    and functions.  At this point you should have a good familiarity
  1016.    with constructors and some other special class related issues.
  1017.  
  1018. 5) After being comfortable with that, using your encapsulated
  1019.    abstractions, you will find the need to make specializations here
  1020.    and there.  Well, if appropriate, you may have just realized what
  1021.    inheritance is about and will want to toy around with that for a
  1022.    while.
  1023.  
  1024. 6) After being comfortable with that, you may see still further
  1025.    commonalities in relationship both "up and down" an inheritance
  1026.    tree or across a set.  This is where OO and templates,
  1027.    respectively, come into play.
  1028.  
  1029. 7) At this point, the programmer should have a good idea of how C++
  1030.    can help them more naturally express their algorithms.  The last
  1031.    piece of the transition involves know what to use where.  It also
  1032.    involves not being lazy and re/learning how to think.
  1033.  
  1034. Note that this is meant as one path to learning C++.  The intent of
  1035. the above is NOT for you to C++'ize all your C programs.  It is an
  1036. approach to bite sized progression though the various facets of the
  1037. language.  During this process, issues like re-evaluation of life
  1038. cycle phases and re-orchestration and redistribution of modules, data
  1039. and functions become more a part of the up front issues instead of
  1040. afterthoughts.
  1041.  
  1042. The concerns of learning C++ are real and indeed important.  Hence,
  1043. I've elaborated my answer to this question with a flavoring of some of
  1044. the issues involved.
  1045.  
  1046. AD: What books do you recommend for programmers who want to have a
  1047.     head start before your product is released?
  1048.  
  1049. GC:
  1050. The C++ community has a number of top-notch books these days.  A good
  1051. overview is Al Stevens' "Teach Yourself C++" 3rd edition.  The two
  1052. current "authoritive" texts are Bjarne Stroustrup's "The C++
  1053. Programming Language" 2nd edition and Stanley Lippman's "C++ Primer"
  1054. 2nd edition.  As a reference, one should not be without Peggy Ellis
  1055. and Bjarne Stroustrup's "The Annotated C++ Reference Manual" (a.k.a.,
  1056. ``ARM'').  Re OO specific books, the industry seems to agree that the
  1057. most flexible and practical is Grady Booch's "Object Oriented Design
  1058. With Applications".
  1059.  
  1060. There are other books that are also good.  Ditto for magazines.  We
  1061. produce a document entitled "The C and C++ Survival Guide" that
  1062. contains a more complete list.
  1063.  
  1064. AD: Thank you.
  1065.  
  1066. [ Editor's NOTE:
  1067.  
  1068. Greg is VERY accessible via the on-line services and welcomes contact from
  1069. the readership via one of the electronic (not voice) mechanisms listed
  1070. below. ]
  1071.  
  1072. Comeau Computing
  1073. 91-34 120th Street
  1074. Richmond Hill, NY, 11418-3214
  1075.              Producers of Comeau C++ 3.0/3.0.1 With Templates
  1076.  
  1077. Here:attmail.com!csanta!comeau
  1078. BIX:comeau or comeau@bix.com 
  1079. CIS:72331,3421
  1080. Voice:718-945-0009
  1081. Fax:718-441-2310
  1082. Prodigy: tshp50a
  1083. WELL:comeau
  1084.  
  1085.  
  1086.  
  1087. /************************************************************************/
  1088.                 BAD EXAMPLE
  1089.      By: Albert Dayes and Carl Barron
  1090. /************************************************************************/
  1091.  
  1092. bad example                                good example
  1093. ========================================================================
  1094.  
  1095. #include <stdio.h>                   #include <stdio.h>
  1096.  
  1097.  
  1098. main()                               main()
  1099.   {                                    {
  1100.    double a, a2, a3;                    double total, sales, tax;
  1101.  
  1102.    a2 = 77.00;                          sales = 77.00;
  1103.    a3 = 0.054;                          tax = 0.054;    /* 5.4 percent */
  1104.    
  1105.    a = a2 + (a2*a3);                    total = sales + (sales * tax);
  1106.  
  1107.    printf("%f", a );                    printf( "total cost = $%-10.2f\n",
  1108.                                                 total);
  1109.   
  1110.   }                                    }
  1111.  
  1112. What are some of the major differences between the bad example and the 
  1113. good example?
  1114.  
  1115. a) Variable names
  1116. b) Output
  1117.  
  1118. The variable names in the bad example are a problem.  Since one can not
  1119. just look at them to figure out what they are looking at.  The good 
  1120. example shows how much easier the program is to read when MEANINGFUL
  1121. variable names are used.
  1122.  
  1123. The output is as follows:
  1124.  
  1125.  81.1508              <----- for the bad example
  1126.  
  1127.  total cost = $81.15  <----- for the good example
  1128.  
  1129. The problem with the bad example is that is just prints a number but does
  1130. not tell you what the number is for.  The good example gives the word 
  1131. total so one can tell what it is used for right away.  The other issue is
  1132. how the number is formatted.  In the bad example the numeric value is not
  1133. formatted, but rather just printed raw.  For most of use paying an amount
  1134. of 81.1508 does not make any sense at all (assuming US currency).  The
  1135. good example demonstrates how currency should be formatted with two
  1136. decimal places.
  1137.  
  1138.  
  1139.  
  1140. /**********************************************************************/
  1141.            Practical DSP
  1142.          By: Ron Robinson
  1143. /**********************************************************************/
  1144.  
  1145. Tools for use on the Motorola 56001 DSP.
  1146.  
  1147. //// Much of the following first appeared in the June/July issue of
  1148. //// Atari Advantage Magazine and is reproduced here with the
  1149. //// permission of the author.  Permission is NOT granted for
  1150. //// reproduction in any form other than this issue of AEO-PJ.
  1151.  
  1152.  
  1153. Telling people what DSP is and can do shares many of the problems
  1154. Alexander Graham Bell faced when first describing the telephone.  "You
  1155. talk into this end and it does what???"  One could suspect many of the
  1156. best applications for this breakthrough technology haven't even been
  1157. dreamed of yet.  DSP provides capabilities previously not possible in
  1158. electronic systems.  The development of DSP is estimated to have a
  1159. technological impact similar to the effect the microprocessor had on
  1160. computing.
  1161.  
  1162. Sophisticated music systems, automated voice mail, speech synthesis,
  1163. translating machines and seeing aids for the blind are becoming
  1164. possible.  The AT&T DSP phone answering system and DSP based toys such
  1165. as the Texas Instruments "Speak and Spell" are common place.  Or
  1166. keyboards such as the Yamaha DX 7 digital keyboard incorporates custom
  1167. DSP chips for music synthesis.
  1168.  
  1169. Digital Signal Processing (DSP) has recently become feasible with a
  1170. new series of specialized microprocessors that are designed to carry
  1171. out digital signal processing algorithms.  From the engineering side,
  1172. this is characterized by multiply/accumulate computational sequences
  1173. used to perform digital filtering and spectral analysis of signals.
  1174.  
  1175. For the rest of us side, DSP is "heavy duty" math -- the process of
  1176. evaluating signals and then processing that information to generate
  1177. some kind of useful output.  The processor to do this must be good,
  1178. very good, at high speed math operations on large groupings of data.
  1179. The Atari Falcon030 uses a Motorola DSP known as the DSP 56001.
  1180.  
  1181.   Motorola DSP 56001 Digital Signal Processor (DSP) Specs
  1182.  
  1183.    The DSP56001 Digital Signal Processor used in the Falcon offers
  1184.    many high performance advanced processor features.  A few key
  1185.    points from the Motorola data sheets follow:
  1186.  
  1187.    ∙ Speed - 32 MHz operation, yields 16 MIPS.
  1188.  
  1189.    ∙ Precision - 24 bit internal and external data paths, yielding 144
  1190.      dB dynamic range.  56 bit accumulators can range over 336 dB.
  1191.  
  1192.    ∙ Parallelism - Programming model is three execution units operating
  1193.      in parallel.
  1194.  
  1195.    ∙ Instruction Set - 62 instructions.  The following operations can
  1196.      be executed in parallel in one instruction cycle:
  1197.         24 x 24 bit multiply
  1198.         56bit addition
  1199.         Two data moves
  1200.         Two address pointer updates
  1201.         Instruction prefetch
  1202.  
  1203.    ∙ Integration - six on-chip memory arrays, three communication
  1204.      channels, and seven buses.  512 x 24 bits of on chip ROM used for
  1205.      Mu-Law, A-Law and four quadrant Sine wave table data.
  1206.  
  1207.   Probably the best way to gain an appreciation for what DSP is all
  1208. about is to take a look at a wide range of real world examples.
  1209.  
  1210. //// DSP APPLICATIONS EXAMPLES:
  1211.  
  1212.  Digital Audio and Music Processing
  1213.    Analysis of musical instrument sounds
  1214.    Music synthesizers
  1215.    Digital recording studio and digital home reproduction
  1216.    Voice mail
  1217.    Phone answering machines (AT&T)
  1218.    Educational toys (TI Speak & Spell)
  1219.    Hi-Fi compression; error correction; dynamic noise reduction
  1220.    Reverb and ambience enhancement; pitch transposers
  1221.    Noise cancellation
  1222.  
  1223.  Communications
  1224.    High-speed modems
  1225.    Adaptive equalizers; digital repeaters of analog signals
  1226.    Video phone
  1227.    PCM companding: u/A law conversion
  1228.    Modulation/demodulation:  amplitude, frequency, phase
  1229.    Data encryption and scrambling
  1230.    Linear-phase filtering; echo cancellation
  1231.    Spread-spectrum communication
  1232.  
  1233.  Signal Analysis
  1234.    Pulsed-echo acoustic hologram (bat sonar)
  1235.    Radar and sonar processing; electronic countermeasures
  1236.  
  1237.  Speech Processing
  1238.    Speech analysis
  1239.    Speech synthesis; vocoders...; speech compression
  1240.    Speech recognition/speaker authentication
  1241.    Voice store and forward
  1242.    Language translation
  1243.    Speech enhancement, noise cancellation
  1244.  
  1245.  Image Processing
  1246.    Image enhancement, pattern recognition; computer vision
  1247.    Reconstruction:  CAT, PET, MRI tomography
  1248.    Radar and sonar image processing
  1249.    Digital TV-video DSP processors
  1250.    Satellite images; earth resource survey
  1251.    Graphic Image Generation
  1252.    Image management:  Shapes, sizes, contours, shading, highlights
  1253.    Vector manipulation; graphics "engines"
  1254.    CAD/CAM workstations; 3-D image generators
  1255.    Flight (and other transportation) simulators; arts and film
  1256.    sequences
  1257.  
  1258.  Real-time Measurement Instrumentation
  1259.    Digital filters; fixed and adaptive
  1260.    Spectrum analyzers and estimators
  1261.    Phase-locked loops; coherent detectors; correlators
  1262.    Transient digitizers and analyzers
  1263.    Signal averagers, exponential smoothers
  1264.    Time domain reflectometry and pulse analysis
  1265.    Signal generation
  1266.    Chemical instrumentation: mass spectrometers, chromatograhs, etc.
  1267.    Observational astronomy: multiple-mirror telescope
  1268.    Search for extra-terrestrial intelligence (SETI)
  1269.    Thermography:  IR imaging of temperature maps
  1270.    High-Speed Control
  1271.    Servo links; position and rate control; guidance: missiles, etc.
  1272.    Robotics; remote sensing and feedback
  1273.    "Skid-eliminator" adaptive and context-sensitive control
  1274.    Disk-drive head positioners
  1275.    Engine control-iterated with smart sensors
  1276.    Wheel balancing
  1277.  
  1278.  Number-Crunching
  1279.    Array processors for mainframes
  1280.    Floating-point accelerators for microcomputers
  1281.    Vector and matrix processors for supercomputers
  1282.    Sparse matrix algorithm processors
  1283.    Transcendental functions, iterative-solution architectures
  1284.    Artificial intelligence:  Lisp machines, parallel processors
  1285.    Seismic earth and sonar sea-floor mapping
  1286.    Weather prediction and atmospheric modelling
  1287.  
  1288.  Real-World Interface Applications
  1289.    Transducer linerization; dynamically linearized loudspeakers
  1290.    "Smart sensors:" Intelligent transducers
  1291.    Solid-state camera with DSP enhancement or preprocess
  1292.    Flat panel display with local pixel-region processing
  1293.  
  1294.  Medical and Biotechnology
  1295.    Ultrasonic Imaging; digital x-ray:
  1296.      enhanced image allows lower dose.
  1297.    Patient monitoring (intensive care, EKG...)
  1298.    Prosthetic IC Implants (Artificial ear...)
  1299.    CAT, PET, MRI tomography (see under image processing)
  1300.    Fourier-transform IR spectrometer
  1301.    Integrative Applications
  1302.    Antibiotic susceptibility
  1303.    Pulse fluorescence analysis
  1304.    Time domain reflectometry
  1305.    DNA sequencing analysis
  1306.  
  1307.  Other
  1308.    Printed-text-to-voice converter for the blind
  1309.    Multilingual translating telephone
  1310.    The intelligent pilot's assistant (DARPA thrust area)
  1311.    Unmanned mobile watchdog or armored weapon ("Think-Tank")
  1312.  
  1313.  ___________________
  1314.  References:
  1315.   "Digital Signal Processing", R.J.Higgins, Prentice Hall
  1316.   "DSP56001 Reference Manual", Motorola
  1317.   "Digital Signal Processing", McQuilken and LeBlanc, Motorola
  1318.  
  1319.  
  1320.  [ Editor's note:
  1321.   Atari FALCON030 software/hardware examples:
  1322.  
  1323.   MPEG - MPEG de-coder (video) by BrainStorm
  1324.   DIAMOND BACK III - DSP data compression for backups by Oregon Research
  1325.   DAME - Direct to Disk recorder with DSP effects (audio)
  1326.   BLACKMAIL - Voice Mail system
  1327.   WINREC - Direct to Disk recorder (audio)
  1328.   D2D - Direct to Disk recorder (audio) by D2D
  1329.   MUSICOM - Digital Audio, DSP effects (audio) by Compo
  1330.   DIGITAPE - Direct to Disk recorder (audio) by Codehead Technology
  1331.   AUDIO FUN MACHINE (audio) by SDS
  1332.  
  1333.   and many others ...
  1334.  
  1335.   In the next issue we hope to have some sample code for programming the
  1336.   DSP. ]
  1337.  
  1338.  
  1339.  
  1340. /***********************************************************************/
  1341.               THE LIBRARY
  1342.             By: Albert Dayes
  1343. /***********************************************************************/
  1344.  
  1345. Library focus: C Users Group Library CD-ROM (October 1992 release)
  1346.  
  1347. [ Editor's Note: For those who want to know more about CD-ROM
  1348.   technology read AEO volume 2 number 1 and contact ICD for
  1349.   information on their ICD SCSI Pro software. ]
  1350.  
  1351. For those who enjoy the C Users Journal (CUJ) magazine there are
  1352. approximately 360 disks in the library filled with C source code.
  1353. This does not include the source code in each issue of the magazine
  1354. however.  To purchase each disk at $8.00 (US funds) per disk would be
  1355. very expensive.
  1356.  
  1357.    360 disks * $8 = $2880
  1358.  
  1359. Then if you wanted the source code for each issue for the last five
  1360. years as well.  That is $10 per disk times (5 * 12 = 60) disks.
  1361.  
  1362.   60 disks * $10 = $600
  1363.  
  1364. So your total cost would be approximately $3500.  One could buy
  1365. several new computers at that price.  But what if you could get all of
  1366. it for $50?  You would have more than enough money left over to
  1367. purchase a new multi-session, Photo CD compatible, SCSI CD-ROM drive
  1368. as well.  The Toshiba 3401 CD-ROM drive has been known to sell for
  1369. $399 bare via mail order for example.
  1370.  
  1371. Thanks to Walnut Creek you can get all of those disks for $49.95.
  1372. They are included on one CD-ROM in both archived format and unarchived
  1373. format.  The archive format used is ZIP so Atarians can easily access
  1374. them using ST-ZIP v2.x.
  1375.  
  1376. Here is a partial list of some of the files and/or type of C source
  1377. code available:
  1378.  
  1379. Zmodem, MNP, MicroEmacs, 68000 C compiler, curve fitting, 6502 cross
  1380. assembler, Flex, Bison, YACC, Highly Portable Utilities, Little
  1381. Smalltalk, 68000 floating point library, Othello, Traveling Salesman,
  1382. 3D medical images, Linear Cellular Automata, Curses, 3-D
  1383. transformations, make, Group3 image processing, spelling checkers,
  1384. image processing, TVAL trees, C-windows, PCX graphics library, text
  1385. editors (STevie and Elvis), GNU C/C++, backgammon, BBSes, games,
  1386. compilers, text formatters, co-routines, linkers ... and much more.
  1387.  
  1388.  
  1389. The root directory of the CD-ROM:
  1390.  
  1391. BBS          <DIR>     10-27-92   4:08p
  1392. CAPSULE  TXT    854484 10-27-92  11:51a
  1393. CAPSULE  ZIP    254612 10-27-92   1:43p
  1394. CAP_V100 TXT    357846 10-27-92  11:51a
  1395. CAP_V200 TXT    496638 10-27-92  11:51a
  1396. CATALOG  TXT      6395 10-27-92  11:51a
  1397. CAT_V100 TXT      2348 10-27-92  11:51a
  1398. CAT_V200 TXT      2661 10-27-92  11:51a
  1399. CAT_V300 TXT      1386 10-27-92  11:51a
  1400. CUG_INFO TXT      5447 10-27-92  11:51a
  1401. GO       BAT        17 10-27-92  11:54a
  1402. LISTINGS     <DIR>     10-27-92   4:08p
  1403. README   TXT       996 10-27-92   1:09p
  1404. VOL_100      <DIR>     10-27-92   4:08p
  1405. VOL_200      <DIR>     10-27-92   4:08p
  1406. VOL_300      <DIR>     10-27-92   4:08p
  1407. ZIPPED       <DIR>     10-27-92   4:08p
  1408.  
  1409. One of the nice features is an index file that lists all of the disks
  1410. on the CD-ROM.  To search the index file (which is in ascii format)
  1411. effectively a grep-like utility can be used.  The second index file
  1412. includes much longer descriptions and is called capsule.txt on this
  1413. disc.
  1414.  
  1415. You can load this into an editor like Clear Thinking's Edhak v3.01 or
  1416. the editor of choice to see what is available.  A short example of a
  1417. single entry from the file CAPSULE.TXT.
  1418.  
  1419. CUG274 -
  1420. -----------
  1421.  
  1422. Arrays for C
  1423. By James P. Cruse. [share] 1 disk. Arrays for C is a shareware
  1424. package that facilitates the handling of arrays in C. The package
  1425. includes a wide variety of routines: filling, adding, subtracting,
  1426. calling functions on each element, scaling by constants, etc. All are
  1427. implemented as code macros (#defines), and use a uniform naming
  1428. convention. The routines are very portable and have been tested with
  1429. several compilers including Microsoft C v5.0, Turbo C v1.5 and Aztec
  1430. v3.40b.
  1431.  
  1432. The disk contains source code, documentation, and sample programs. For
  1433. more details see the narrative description of this package in Section 2.
  1434.  
  1435. CUG274.01-ARRAY.ART doc
  1436. Article on Arrays for C. Introduction, overview, usage, and quick
  1437. summary of "Arrays for C" functions. Also describes example routines
  1438. and customization options provided. => ARRAY.H.
  1439.  
  1440. CUG274.02-ARRAY.DOC doc
  1441. Background, registration information, planned development, breakdown
  1442. and description of functions in Arrays for C. ARRAY.H.
  1443.  
  1444. CUG274.03-ARRAY.H header
  1445. Includes details on compiler dependent options, customization as well
  1446. as header defines for such. => A_INFO.H, A_BINOP.H, A_FILL.H,
  1447. A_UNOP.H, A_TESTAL.C, A_TESTF.C, A_TESTI.C. [MS-DOS: MSC5, TC1.5]
  1448.  
  1449. CUG274.04-ARRAY.SUM doc
  1450. Summary of Arrays for C. General description of array handling
  1451. package. => ARRAY.H.
  1452.  
  1453. CUG274.05-A_BINOP.H header
  1454. Declares all binary operations. => ARRAY.H.
  1455.  
  1456. CUG274.06-A_FILL. H header
  1457. Declares all the various fill operations. ARRAY.H.
  1458.  
  1459. CUG274.07-A_INFO. H header
  1460. Declares all information operations: sum, product, minimum, maximum,
  1461. and minimax. => ARRAY.H.
  1462.  
  1463. CUG274.08-A_TESTAL.C source
  1464. Tests all array functions. => ARRAY.H. [MS-DOS: MSC5, TC1.5]
  1465.  
  1466. CUG274.09-A_TESTF.C source
  1467. Tests using floating point operations. ARRAY.H. [MS-DOS: MSC5, TC1.5]
  1468.  
  1469. CUG274.10-A_TESTI.C source
  1470. Tests using integer operations. => ARRAY.H. [MS-DOS: MSC5, TC1.5]
  1471.  
  1472. CUG274.11-A_UNOP.H header
  1473. Declares all unary operations. => ARRAY.H.
  1474.  
  1475.  
  1476. As one can see it gives a complete description of the overall package
  1477. and then goes into single line summaries of the individual files.  It
  1478. is simply amazing how much information is available.  Here is another
  1479. entry for a spelling checker ...
  1480.  
  1481. Spell and Dictionary Part I
  1482. By Kenji Hino, Bob Denny. [public] 1 disk. Contains a spelling checker
  1483. and half the dictionary on CUG217. The rest of the dictionary is on
  1484. CUG218. Kenji Hino rewrote the package from a Software Tools version.
  1485. The disk contains three executable versions developed under Microsoft
  1486. C. SPELLC is quite portable and should compile under most compilers.
  1487. SPELLS is compiled with the small model option, SPELLC with compact
  1488. model, and SPELLH with hugh model. The nine dictionary data files will
  1489. require at least 500 Kb when concatenated. Spell copies named files to
  1490. standard output while looking up each word in a dictionary. Misspelled
  1491. words are displayed with asterisks beneath.
  1492.  
  1493. CUG217.01-HEADER.CUG doc
  1494. File headers. => SPELL.DOC, HY.C.
  1495.  
  1496. CUG217.02-HY.C source
  1497. By Bob Denny. Hyphenates words from standard input. => HY.EXE.
  1498. [MS-DOS: MSC]
  1499.  
  1500. CUG217.03-HY.EXE executable
  1501. By Bob Denny. => HY.C. [MS-DOS: MSC]
  1502.  
  1503. CUG217.04-SPELL.C source
  1504. By Kenji Hino. Spelling Checker. SPELL.DOC, CUG218. [MS-DOS: MSC]
  1505.  
  1506. CUG217.05-SPELL.DOC doc
  1507. By Kenji Hino. User and program documentation. => SPELL.C, SPELLS.EXE,
  1508. SPELLH.EXE, SPELLC.EXE.
  1509.  
  1510. CUG217.06-SPELLO.DAT data
  1511. Dictionary Part O (A - Bright). SPELL*.DAT.
  1512.  
  1513. CUG217.07-SPELL1.DAT data
  1514. Dictionary Part 1 (Brighten - Deduce). SPELL*.DAT.
  1515.  
  1516. CUG217.08-SPELL2.DAT data
  1517. Dictionary Part 2 (Deduced - Floss). => SPELL*.DAT.
  1518.  
  1519. CUG217.09-SPELLC.EXE executable
  1520. By Kenji Hino. Spell with Compact Model. SPELL.C, SPELL.DOC. [MS-DOS:
  1521. MSC]
  1522.  
  1523. CUG217.10-SPELLH.EXE executable
  1524. By Kenji Hino. Spell with Huge Model. SPELL.C, SPELL.DOC. [MS-DOS:
  1525. MSC]
  1526.  
  1527. CUG217.11-SPELLS.EXE executable
  1528. By Kenji Hino. Spell with Small Model. SPELL.C, SPELL.DOC. [MS-DOS:
  1529. MSC]
  1530.  
  1531. For those who prefer a single line descriptions of each disk that is
  1532. available, the catalog index is extremely useful.  Here is just a small
  1533. sample from the file catalog.txt.
  1534.  
  1535. 320 Convolution Image Process
  1536. 321 Mouse Trap Library
  1537. 322 Doctor's Tools
  1538. 323 Fireworks and Adventure
  1539. 324 WGCONIO
  1540. 325 VGA Graphics Library
  1541. 326 SoftC Database Library
  1542. 327 Panels for C
  1543. 328 WTWG
  1544. 329 Unix Tools for PC
  1545. 330 CTask
  1546. 331 SE Editor
  1547. 332 PC Curses
  1548. 333 GAWK
  1549. 334 GNUPLOT
  1550. 335 Frankenstein Cross Assembler
  1551. 336 EGAPAL/EDIPAL
  1552. 337 Designing Screen Interfaces in C
  1553. 338 68000 C Compiler and Assembler
  1554. 339 CTRLCLIB
  1555. 340 C-Window
  1556. 341 Orbit Propagation
  1557. 342 I8255 Interface Library
  1558. 343 C Image Processing System
  1559. 344 C Grab-Bag #1
  1560. 345 TLC/TLP
  1561. 346 ASxxxx Cross Assembler, Part 2
  1562. 347 TAVL Tree
  1563. 348 8048 Disassembler/Z80 Asm
  1564. 349 Simulation Subroutine Set
  1565. 350 PCX Graphics Library
  1566. 351 UltraWin
  1567. 352 String and Vlist
  1568. 353 Withdrawn from the CUG Library
  1569. 354 CES Mouse Tools Library
  1570. 355 Sherlock for MSDOS
  1571. 356 Withdrawn from the CUG Library
  1572. 357 CSTAR
  1573. 358 cbase
  1574. 359 GNU C/C++ for 386
  1575. 360 uspell
  1576. 361 Gadgets and Term
  1577. 362 RMAXTask
  1578. 363 68020 Cross Assembler
  1579. 364 C-Across
  1580.  
  1581.  
  1582. This small listing of disks above would cost far more ( 44 disks * $8
  1583. per disk = $352 versus $50 ) than the a single CD-ROM disc.
  1584.  
  1585. This is just the library files and not even including the monthly
  1586. source code disks.  For $50 it is an excellent deal.  For more
  1587. information about other source code CD-ROMs, a catalog or information
  1588. on making your own CD-ROM discs contact:
  1589.  
  1590. Walnut Creek CDROM
  1591. 1547 Palos Verdes Mall, Suite 260
  1592. Walnut Creek, CA 94596
  1593. USA
  1594. (800) 786-9907 (voice)
  1595. (510) 947-5996 (voice)
  1596.  
  1597. source code CD-ROM discs (SCSI CD-ROM drive required)
  1598.  
  1599.  
  1600.  
  1601. /**********************************************************************/
  1602.                     PERIODICALS
  1603.                   By Albert Dayes
  1604. /**********************************************************************/
  1605.  
  1606. Magazine focus: C Users Journal
  1607.  
  1608. One of the longest running language specific magazines in the C Users
  1609. Journal magazine.  Its been around since for almost a decade and it
  1610. has approximately 45,000 subscribers.  This magazine is dedicated to
  1611. one only one subject and that subject is C.
  1612.  
  1613. This magazine is for programmers by programmers and it covers a large
  1614. variety of subjects.  Each issue has a particular theme, such a
  1615. Graphic User Interfaces, for example.  The magazine believes in
  1616. solving practical problems with real world solutions and not
  1617. theoretical ones.
  1618.  
  1619. For those that have access to internet [Editor's note: See back
  1620. issues of AEO for more information on accessing internet] there is a
  1621. column that discusses many of the new releases and updates that are
  1622. available.  One can find many interesting programs and many come
  1623. complete with source code.  [Editor's note: many of these files are
  1624. also available on CD-ROM].
  1625.  
  1626. In addition they have columns on the C standard itself and recently
  1627. added a monthly C++ column.  Then there are articles related to the
  1628. theme of that particular issue itself.  The areas that are always very
  1629. enjoyable are the Questions and Answers section and the letters to the
  1630. Editor.  These provide many useful issues to think about as well as
  1631. solutions.  One can always learn something from these columns.  One of
  1632. the best features of the article is contact information is supplied.
  1633. This is usually an internet or Compuserve address so its very easy to
  1634. talk to the author of the article.  The source code for each issue is
  1635. also available on BBSes, Compuserve, internet and also on disk.  These
  1636. monthly archives many times include much more source code than is
  1637. listed in the magazine which is very useful.
  1638.  
  1639. There are book reviews are something very familiar as are user
  1640. reports.  User Reports get into the details of a particular software
  1641. product whether it be a library for PostScript or a database library.
  1642. Also the ads have some very exciting libraries with C source code
  1643. available too.  The prices are not that bad either.
  1644.  
  1645. Also a library of source code which exceeds 380 disks currently and
  1646. are full of C source code.  This is separate from the monthly source
  1647. code disks for each issue, by the way.  The disk format used is MS-DOS
  1648. format; so they work immediately on the Atari platform without any
  1649. conversion problems.
  1650.  
  1651. But even with all of this information the bottom line its USEFUL!
  1652. Most of the time the C code is operating system and platform
  1653. independent as well.  The large variety of subjects gives a C/C++
  1654. programmer the exposure and insight to help solve real-world problems
  1655. today.
  1656.  
  1657. The C Users Journal
  1658. 1601 West 23rd Street, Suite 200
  1659. Lawrence, KS, 66046-2743
  1660. USA
  1661. (913) 841-1631 (voice)
  1662. (913) 841-2624 (fax)
  1663.  
  1664. Available in good bookstores
  1665. Published 12 times per year.
  1666.  
  1667. Call or Write for a FREE 16-page catalog of C language related books
  1668. and publications.
  1669.  
  1670. Source code (published and some unpublished) is availabe on Compuserve
  1671. (GO CLMFORUM) in LIB #7; GEnie in the IBMPC RT at page 1335 (keyword
  1672. IBMPC); and via anaonymous FTP ftp.uu.net for every issue.  Also there
  1673. is a 720K 3.5 inch disk option for a nonimal fee.
  1674.  
  1675.  
  1676.  
  1677. /***********************************************************************/
  1678.                    OBJECT::ATARI
  1679.                   By: J.J. Lehett
  1680. /***********************************************************************/
  1681.  
  1682.      Part 1 : Object Oriented != A Ball Sent Eastward
  1683.  
  1684. Here ... take my hand.  Together we'll begin our journey into one of
  1685. the hotbeds of the programming industry; a whole new dimension in
  1686. developing software for the Atari: Object Oriented Programming (OOP).
  1687. Before we begin our explorations in this new and exciting realm, we
  1688. should become acquainted with some of the terms and ideas behind
  1689. 'Object-Oriented'-ness in general.  This initial column will attempt
  1690. to give you an overall view of OOP, while focussing on Atari specific
  1691. implementations when appropriate.  Future columns will be largely
  1692. influenced by reader response.  Possible topics include: Installing
  1693. and Using Gnu C++, Installing and Using Smalltalk, GEM Programming and
  1694. OOP, and a series on designing Atari class libraries for maximal code
  1695. reuse.  Please feel free to write to me, with you comments,
  1696. criticisms, and ideas.  I look forward to hearing from you!
  1697.  
  1698. In the first sentence of this column, I asked for your hand.  The
  1699. reasoning was bilateral; in many instances of our explorations of the
  1700. Object Oriented paradigm, the discoveries we make will be new to both
  1701. of us.  Therefore, I am going to ask for your understanding in the
  1702. inevitable errors, or subjective or controversial statements that may
  1703. appear in this column.  Any problems along these lines will be
  1704. corrected, amended, or retracted as soon as possible.
  1705.  
  1706. //// What does Object Oriented mean?
  1707.  
  1708. To begin our journey, it seems wise to dispel any pre-conceived ideas
  1709. or myths that one has about Object Oriented Programming.  It is not a
  1710. database technology, although many databases today use OOP.  It is
  1711. also not a graphical user interface technology, nor does it contain
  1712. any implicit 'visual' components.  Most of these misconceptions stem
  1713. from the fact that many of these type applications use OOP, and
  1714. plaster the words 'Object Oriented' over the packaging, however, it
  1715. (OOP) is simply the method by which the application was written.
  1716.  
  1717. So, what is Object Oriented Programming?  It is a new way to think
  1718. about programs, a new way to conceptualize their structure, and a new
  1719. way to proceed to write those programs.  Most texts would agree that
  1720. to be considered a true Object Oriented Programming Language, the
  1721. language must have the following four components:
  1722.  
  1723.      (1) Encapsulation a.k.a. Data Hiding
  1724.  
  1725. Encapsulation means that the data associated with a certain 'object'
  1726. can only be accessed and manipulated by the methods (functions) given
  1727. to that object.  An example in pseudo-code should clarify the meaning
  1728. of this.
  1729.  
  1730.     class Ball                         // this is the object's name
  1731.          integer weight                // possible 'data' about Ball
  1732.  
  1733.          method change_weight(integer new_weight)
  1734.          {
  1735.               weight = new_weight
  1736.          }
  1737.  
  1738. (note: the pseudo-code in this column is not C++ or Smalltalk, it is
  1739. simply an attempt to help present concepts.)
  1740.  
  1741. What we have now is anywhere in our program that we create a Ball,
  1742. (we'll call this ball we create OurBall), it automatically has a
  1743. 'weight' associated with it, and a method by which to change this
  1744. weight.  In OOP terminology you would send a 'message' to the Ball if
  1745. you wanted to change its weight, ie.  OurBall.change_weight(15).
  1746. Non-OOP programmers may begin to think of this as simply a function or
  1747. sub-routine call, however since it is directly associated with the
  1748. OurBall object, it would make no sense to call this method for
  1749. anything but a Ball-type object.
  1750.  
  1751. OK, but what advantage does this give us?  By hiding this data from
  1752. other parts of the program, and defining a method to change this
  1753. data, one increases the ease of program maintenance and debugging.  In
  1754. this small example it may be hard to see, but imagine if you at first
  1755. assumed that the weight given to change_weight() was in pounds,
  1756. however, the user of the class deals in kilograms, one way to solve
  1757. the problem would be to change the following (1) line of code:
  1758.  
  1759.      weight = new_weight ---> weight = new_weight * 2.2
  1760.  
  1761. With this one simple change, the program using Ball can now send
  1762. weight changes in kilograms instead of pounds.  Ball, however, now
  1763. knows to change the weight to pounds before changing it's internal
  1764. weight data.  Thus, any other methods of Ball that worked on pounds
  1765. still work.
  1766.  
  1767.      (2) Inheritance
  1768.  
  1769. Inheritance is the ability to define new objects in terms of already
  1770. defined objects.  Another example is in order here.
  1771.  
  1772.     class ColoredBall : derived from Ball
  1773.          int color
  1774.  
  1775.          method change_color(int new_color)
  1776.          {
  1777.               color = new_color
  1778.          }
  1779.  
  1780. Our new class ColoredBall is said to inherit all the characteristics
  1781. of the Ball it is derived from, plus any new data and methods added
  1782. to the new class.  Thus, a ColoredBall has both a weight AND a color,
  1783. as well as methods for changing each of these pieces of data.
  1784.  
  1785. This is one of the fundamental points of Object Oriented Programming;
  1786. the ability to start with simple 'objects' and then proceed to define
  1787. new objects that have all the characteristics of old objects.  The
  1788. programmer does not have to re-invent the wheel so to speak, the code
  1789. is completely reusable (and even replaceable as we shall soon see).
  1790.  
  1791.      (3) Polymorphism
  1792.  
  1793. Polymorphism basically means 'multiple forms.' Due to differences in
  1794. Object Oriented Programming Languages the term can pertain to a
  1795. couple of different usages.  First is the case of multiple instances
  1796. of method names in classes.  In our Ball class, we had a change_weight
  1797. method (function).  Now if we wanted to define a Block class, it is
  1798. logical we would want another change_weight method.  Polymorphism
  1799. allows different classes to have method names that are the same, but
  1800. are 'local' to a particular object; there will not be any naming
  1801. conflicts.
  1802.  
  1803. Another usage of polymorphism is that derived objects can be used as
  1804. objects of the parent type.  For example, suppose we created a
  1805. function called MoveBall() that takes as its parameter a Ball object.
  1806. Polymorphism allows us to use a ColoredBall as a parameter to
  1807. MoveBall(), since ColoredBall is derived from a Ball.  MoveBall()
  1808. would also work without further refinements on any future derivatives
  1809. of Ball.  Suppose that next week we create a RubberBall class derived
  1810. from Ball.  MoveBall() is capable of working on RubberBall even before
  1811. we compiled RubberBall!
  1812.  
  1813.      (4) Single Type
  1814.  
  1815. This last component is also the least accepted component.  Essentially
  1816. it means that any variable can hold anything.  Depending on the
  1817. language you choose, this may or may not be true.  C++ does not adhere
  1818. to this feature, as a char variable cannot hold an int.  As a result
  1819. there is much discussion over the question of 'Is C++ a true Object
  1820. Oriented Programming Language?'.  Smalltalk does have this feature and
  1821. a variable in Smalltalk has no idea what it is holding until a message
  1822. is sent to it.
  1823.  
  1824. //// What Object Oriented programming could mean to you.
  1825.  
  1826. So what advantages do these features of Object Oriented Programming
  1827. bring to the Atari programmer?  Perhaps the most obvious is code
  1828. reuse.  Imagine having only one SORT function that can operate on all
  1829. datatypes.  To the non-Object Oriented programmer, this would normally
  1830. require a different sort function for each data type (int, float,
  1831. char, etc.).  The Object Oriented programmer simply writes one SORT
  1832. function that is capable of working on all data types, including data
  1833. types (classes) that may be written in the future!
  1834.  
  1835. A more Atari specific application of code reuse would appear in the
  1836. area of GEM applications.  Most GEM apps revolve around one main loop
  1837. that watches for GEM events.  The OO programmer would never have to
  1838. write that loop again.  By using the code from one's GEM library, and
  1839. installing only those GEM events which one will be watching for, the
  1840. amount of code that has to be (re)written is greatly reduced.
  1841.  
  1842. Another advantage is language extensibility.  Because of the
  1843. polymorphism of the language, most object oriented programming
  1844. languages grant the programmer the ability to extend the language.
  1845. Operator overloading is one such way.  This allows the programmer to
  1846. redefine operators of the language (+, -, [], etc) to do various
  1847. things depending on the data given to them.  For example, we all know
  1848. that if A and B are integers, then in most languages, A + B is a valid
  1849. expression.  However, in OOP, suppose we have two ComplexNumber
  1850. objects, C and D.  Operator overloading allows us to redefine the
  1851. action of the + operator when used with 2 objects of this type, and C
  1852. + D would result in a valid operation that adds two ComplexNumber
  1853. objects.
  1854.  
  1855. Because of data hiding, code maintenance is eased.  Since an object's
  1856. data is only allowed to be directly manipulated by the methods of the
  1857. object, the data is isolated from other code, and changes and bugs are
  1858. localized to one particular area.
  1859.  
  1860. //// What's available on the Atari platform
  1861.  
  1862. Probably the most widely used (although calling any OOP language on
  1863. the Atari platform 'widely used' is probably a misnomer) object
  1864. oriented language on the Atari platform is the GNU GCC C++ compiler.
  1865. There are positive and negative aspects to this compiler.  First, if
  1866. you have anything less than about 2.5 megabytes RAM, there is no way
  1867. to use it.  The binaries alone for parts of the compiler are around
  1868. 1.5 megabytes in length.  Secondly, with all the libraries and the
  1869. above mentioned size, a hard disk is mandatory.  If you meet these
  1870. criteria, the next thing to consider is speed.  The compiler is not a
  1871. speed demon at compiling source code, but the code that it does
  1872. generate are normally high quality binary files, especially if one
  1873. turns on the optimization feature of the compiler.  Other advantages
  1874. include: its price, free, as with all GNU software, it is freely
  1875. distributable; it is updated quite often; and due to its cross
  1876. platform availability, porting of code between different OS's is often
  1877. greatly simplified.
  1878.  
  1879. Also available (or soon to be available) are Smalltalk, Simula, and
  1880. Comeau C++ for the Atari platform.  We look forward to covering each
  1881. application in future issues.  If you know of any further applications
  1882. having to do with object oriented programming, please drop me a line.
  1883.  
  1884. //// From C to C++
  1885.  
  1886. Since most of my experience in the OOP world revolves around C++, many
  1887. of this columns future subjects will deal specifically with C++.  For
  1888. those of you lucky enough to know C already, and want to make the
  1889. transition, you'll have a head start in that C++ is actually a
  1890. superset of the C language.  Therefor, much of the structure and
  1891. syntax of the language remain the same.  You won't have to start from
  1892. a blank page when it comes to most keywords and such in the language.
  1893.  
  1894. It may however, be wise to start with a blank page when it comes to
  1895. designing and programming in C++.  Since most C++ compilers will also
  1896. compile normal C code, it is very tempting for the C programmer to
  1897. continue using the same logic in one's coding.  The true benefits of
  1898. C++ will only become apparent if you begin thinking with a OO mindset.
  1899. Many instructors of Object Oriented Programming Languages believe it
  1900. normally takes at least a month to fully comprehend the change in
  1901. design paradigms.  Be prepared to start small and slow, as with
  1902. starting any new language, and the rewards will soon follow.
  1903.  
  1904. //// So what do I do now?
  1905.  
  1906. We have only scratched the surface of the ideas and concepts behind
  1907. object oriented programming.  Hopefully your appetite has been
  1908. whetted, and you are eager to start exploring the world of OOP on your
  1909. Atari computer.  What should your next step be?  Get a book on OOP in
  1910. general or specific to a particular language.  My recommendation would
  1911. be to buy a book on generic C++, not one revolving around a specific
  1912. company's implementation of the language.  Start reading whatever you
  1913. can get your hands on dealing with OO technology.
  1914.  
  1915. Much of this column has focused on theory and generalities.  To
  1916. attempt much more would simply not be in the scope of anything less
  1917. than a text book.  Next month, we will present a tutorial on setting
  1918. up GNU C(++) compiler, and begin to get into the nitty gritty details
  1919. of actual programming examples.  Be sure to send in any ideas for
  1920. things you might like to see in future columns.  We look forward to
  1921. hearing from you.
  1922.  
  1923.  
  1924. //// References
  1925.  
  1926.     - C++ Report
  1927.          pub. SIGS Publications
  1928.  
  1929.     - The Waite Group's C++ Programming
  1930.          auth. John Thomas Berry
  1931.          pub.  Prentice Hall
  1932.  
  1933.     - Concepts in Object-Oriented Programming
  1934.          auth. David N. Smith
  1935.          pub.  McGraw-Hill
  1936.  
  1937.  
  1938.  
  1939. /***********************************************************************/
  1940.                  OBJECT::ATARI
  1941.               By: Warwick Allison
  1942. /***********************************************************************/
  1943.  
  1944.      Part 2 : Setting up G++ - the GNU C++ compiler.
  1945.  
  1946.  
  1947. This article describes the process for setting up the GNU C++ compiler
  1948. on an Atari ST, STe, TT030 or Falcon030.
  1949.  
  1950. First, there isn't much point continuing if your system is not up to
  1951. the task.  In order to use the GNU C++ compiler, you will need:
  1952.  
  1953.     4 Megabytes of RAM
  1954.     5 Megabytes of free hard disk space
  1955.  
  1956. Next of course, you need to be able to get hold of the relevant files.
  1957. This may mean downloading them from a bulletin board, GEnie, Delphi, or
  1958. other on-line service, or FTPing them from an Internet archive site.
  1959.  
  1960. I can't help you much with finding a source, but the one I use is the
  1961. FTP site:
  1962.  
  1963.         atari.archive.umich.edu
  1964.  
  1965. "cd" to the directory:
  1966.  
  1967.         /atari/Gnustuff/Tos
  1968.  
  1969.  
  1970. Under there, you will find various subdirectories containing the files
  1971. you will need.  In general, these same filenames will appear on other
  1972. on-line sources.
  1973.  
  1974. When getting files, make sure you get the most recent versions.  The
  1975. simplest way to do this is to look at the datestamp on the file.
  1976.  
  1977. The files you need are:
  1978.  
  1979.     Executables
  1980.     -----------
  1981.        The current version of the compiler is 2.3.3, but you also
  1982.        need a number of auxiliary programs.  You need:
  1983.  
  1984.        ("#" = some digit)
  1985.  
  1986.         Tool     |   File     |    Possible archive names |   Comment
  1987.  ----------------|------------|---------------------------|------------
  1988.  compiler driver |gcc.ttp     | gcc233b.zoo gcc233b#a.zoo | Also has C compiler
  1989.  compiler        |gcc-cc1p.ttp| gcc233b#b.zoo             | Avoid:g++233.zoo
  1990.  assembler       |gcc-as.ttp  | gcc233b.zoo gcc233b#a.zoo | (with the driver)
  1991.  preprocessor    |gcc-cpp.ttp | gcc233b.zoo gcc233b#a.zoo | (with the driver)
  1992.  linker          |gcc-ld.ttp  | utlbin33.zoo utlbin##.zoo | Keep all  utils!
  1993.  
  1994.       other useful utils:
  1995.             cnm.ttp, fixstk.ttp, gcc-ar.ttp, gcc-nm.ttp, gcc-size.ttp,
  1996.             printstk.ttp, size68.ttp, sym-ld.ttp, toglclr.ttp,
  1997.             xstrip.ttp
  1998.  
  1999.       look in directories like:
  2000.  
  2001.            Gnustuff/Tos/Gcc
  2002.            Gnustuff/Tos/G++
  2003.            Gnustuff/Tos/Utils
  2004.  
  2005.     Libraries
  2006.     ---------
  2007.        The compiler will be no use to you without the libraries.
  2008.        GNU C/C++ library files have a ".olb" extension.
  2009.  
  2010.    Library       |   File     |    Possible archive names |   Comment
  2011.  ----------------|------------|---------------------------|------------
  2012.  C++ library     |g++.olb     | gplibo15.zoo gplibo17.zoo | MATCH with headers
  2013.  C, sys library  |gnu.olb     | libolb87.zoo              | You need this too.
  2014.  Runtime library |crt0.o      | libolb87.zoo              | You need this too.
  2015.  Math library    |pml.olb     | pmlolb21.zoo              | Maybe this too.
  2016.  
  2017.       look in directories like:
  2018.  
  2019.            Gnustuff/Tos/Gnulib
  2020.            Gnustuff/Tos/G++
  2021.            Gnustuff/Tos/Pmathlib
  2022.  
  2023.       other useful libraries include termcap.olb and curses.olb
  2024.  
  2025.     Headers
  2026.     -------
  2027.        The libraries are impossible (practically) to use without the
  2028.  
  2029.        *corresponding* header files.
  2030.  
  2031.    Header        |   Files    |    Possible archive names |   Comment
  2032.  ----------------|------------|---------------------------|------------
  2033.  C++ headers     |*.h         | gplibo15.zoo gplibo17.zoo | MATCH with library
  2034.  C, sys headers  |*.h         | gcc233b#b.zoo             | Needed.
  2035.  
  2036.  
  2037.     Shell
  2038.     -----
  2039.        It is very difficult to use GNU C++ without a CLI (command line
  2040.        interpreter).  Fortunately, plenty of shells are available - you
  2041.        probably already have one, otherwise, try:
  2042.  
  2043.    Shell         |   Files    |    Possible archive names |   Comment
  2044.  ----------------|------------|---------------------------|------------
  2045.  gulam           |gulam.prg   |                           |
  2046.  mupfel          |mupfel.prg  | gemini.zoo                |
  2047.  
  2048. Now, you've got a whole pile of files ... now you have to put them
  2049. together in the right way.
  2050.  
  2051.     Directories
  2052.     -----------
  2053.        Place the files in directories (folders) as follows:
  2054.  
  2055.            /gnu/bin          All the .ttp files
  2056.            /gnu/lib          All the .olb files, and crt0.o
  2057.            /gnu/include/gcc  All the .h files from the C packages
  2058.            /gnu/include/g++  All the .h files from the C++ header package
  2059.            /tmp              Nothing - but GNU C++ will use this directory
  2060.  
  2061.     Environment
  2062.     -----------
  2063.        In order for the GNU C++ compiler to work, you must tell it
  2064.        certain information about your set-up.  This is done by using
  2065.        "environment variables".  The relevant ones for G++ are:
  2066.  
  2067.               PATH - A comma-separated list of directories were
  2068.                     executable programs are found.  Your shell will
  2069.                     already have one set up.
  2070.  
  2071.               GNULIB - A comma-separated list of directories were
  2072.                     libraries are found (olb files).  Also, the first
  2073.                     directory in the list must also contain the crt0.o
  2074.                     file (runtime code).
  2075.  
  2076.               GNUINC - A comma-separated list of directories were
  2077.                     include files for GNU C and GNU C++ are found.
  2078.  
  2079.               GXXINC - A comma-separated list of directories were
  2080.                     include files for GNU C++ are found. G++ looks on
  2081.                     this path first for include files, then looks on
  2082.                     GNUINC.
  2083.  
  2084.               TMP - A directory where G++ can store temporary files.
  2085.                     It is also a good idea to set TMPDIR and TEMP to
  2086.                     this directory too, as some programs use those
  2087.                     names.
  2088.  
  2089.        Environment variables like PATH are set by typing:
  2090.  
  2091.               export PATH=.,/gnu/bin,/bin
  2092.  
  2093.            or perhaps:
  2094.               PATH=.,/gnu/bin,/bin
  2095.               export PATH
  2096.  
  2097.            or perhaps:
  2098.               setenv PATH .,/gnu/bin,/bin
  2099.  
  2100.            or perhaps:
  2101.               setenv PATH=.,/gnu/bin,/bin
  2102.  
  2103.        You will just have to see what convention your shell uses.
  2104.        Assuming the first, and assuming you have the directories
  2105.        set-up as above, type:
  2106.  
  2107.               export PATH=.,/gnu/bin,/bin
  2108.               export GNULIB=/gnu/lib,/usr/lib
  2109.               export GNUINC=/gnu/include/gcc
  2110.               export GXXINC=/gnu/include/g++
  2111.               export TMP=/tmp
  2112.  
  2113.        Of course, you don't want to have to type those in every time
  2114.        you turn your computer on.  Therefore, you should put the lines
  2115.        into the automatically read start-up file for your shell.  For
  2116.        example:
  2117.  
  2118.               gulam.prg reads gulam.g at start-up
  2119.               mupfel.prg reads mupfel.mup at start-up
  2120.  
  2121. Finally, it's time to test it.
  2122.  
  2123. Using a text editor such as elvis (vi clone), emacs, microemacs,
  2124. tempus, etc. or even a wordprocessor that can output PLAIN ASCII,
  2125. create a file called "hello.cc", containing:
  2126.  
  2127. ///////////////////////////////////////////////////////
  2128.  
  2129. #include <iostream.h>
  2130. main()
  2131. {
  2132.            cout << "Hello there++" << endl;
  2133. }
  2134.  
  2135. ///////////////////////////////////////////////////////
  2136.  
  2137. (The "//" bits are just comments)
  2138.  
  2139. Then, at your command line, type:
  2140.  
  2141.            gcc hello.cc -o hello.tos -lg++
  2142.  
  2143. This should produce a file called "hello.tos" which when run prints:
  2144.  
  2145. Hello there++
  2146.  
  2147. And you have succeeded in installing the GNU C++ compiler.
  2148.  
  2149.     Trouble Shooting
  2150.     ----------------
  2151.        Of course, things never work first time.
  2152.  
  2153.        First, make sure everything is located as described above.
  2154.        Your shell should tell you if it cannot find "gcc", in which
  2155.        case, your PATH variable is not set correctly.
  2156.  
  2157.        If gcc is being found, type:
  2158.  
  2159.           gcc -v hello.cc -o hello.tos -lg++
  2160.  
  2161.        This makes additional information appear.  Something like this:
  2162.  
  2163. gcc version 2.3.3
  2164.   /gnu/bin/gcc-cpp.ttp -lang-c++ -v -D__cplusplus hello.cc /tmp/1234.i
  2165.     GNU CPP version 2.3.3 (Atari ST)
  2166.   /gnu/bin/gcc-cc1p.ttp /tmp/1234.i -dumpbase hello.cc -o /tmp/1234.s
  2167.     GNU C++ version 2.3.3 (Atari ST) compiled by GNU C version 2.3.3.
  2168.   /gnu/bin/gcc-as.ttp -o /tmp/1234.o /tmp/1234.s
  2169.   /gnu/bin/gcc-ld.ttp -o hello.tos /gnu/lib/crt0.o /tmp/1234.o -lg++ -lgcc
  2170.  
  2171.        (actually, it will print heaps more than that)
  2172.  
  2173.        In the example above, we see that gcc.ttp runs, and it then
  2174.        runs gcc-cpp.ttp (the preprocessor) on hello.cc to produce
  2175.        1234.i (in the temporary directory).  Then, it runs
  2176.        gcc-cc1p.ttp (the compiler itself) on 1234.i to produce 1234.s
  2177.        (assembler code for your program).  Next, it runs gcc-as.ttp
  2178.        (the assembler) on 1234.s to produce 1234.o (binary object
  2179.        file).  Finally, it runs gcc-ld.ttp (the link editor/loader or
  2180.        "linker") on 1234.o along with crt0.o (the runtime support),
  2181.        gnu.olb (the system library and g++.olb (the C++ library) which
  2182.        links the necessary parts of each of them together, to produce
  2183.        hello.tos, which you can run.
  2184.  
  2185.        The important thing is that each program is run correctly.
  2186.  
  2187.        The "1234" is just some random number.
  2188.  
  2189.        Also, the compiler (actually, the linker) may produce a file
  2190.        called "compiler.err" in the directory you ran gcc from.  look
  2191.        at this ASCII file for additional information.
  2192.  
  2193.        One of the most common mistakes is if the filename of your
  2194.        compiler does not match the one gcc.ttp is looking for.  For
  2195.        example, if your compiler is named "gcc-cc1+.ttp" instead of
  2196.        "gcc-cc1p.ttp", the compiler will not find it.
  2197.  
  2198.        If the compiler reports that it cannot find a library (or crt0.o),
  2199.        your GNULIB variable is incorrect.
  2200.  
  2201.        If the compiler reports that it cannot find "iostream.h", check
  2202.        that GXXINC indicates a directory containing iostream.h.
  2203.  
  2204.  
  2205. Notes about the GNU C++ compiler
  2206. --------------------------------
  2207.    The program generated by the "hello" code above might seem very
  2208.    large (over 100K), but this is because it must link in many
  2209.    libraries in order for iostreams to work.  If you don't like large
  2210.    executables, there are some simple things you can do:
  2211.  
  2212.       1. strip the debugging data out of them, by typing:
  2213.  
  2214.              xstrip hello.ttp
  2215.  
  2216.       2. use the C Input/Output libraries rather than the C++
  2217.           libraries (eg. use printf("hello world\n") rather than the
  2218.           cout << ...) in fact, this also makes things faster too,
  2219.           since the iostream header files are quite large and take
  2220.           time to read in.  Of course, you are sliding back into C
  2221.           code then.
  2222.  
  2223.    The GNU C++ compiler (and the other GNU compilers) have DOZENS of
  2224.    optional features, from Optimization (add -O2 on command line when
  2225.    compiling) to support for the 68030 and 68882 special features
  2226.    (-m68020 and -m68881 respectively).  You can make it assume "int"
  2227.    is just a 16-bit value (rather than the default 32) with -mshort.
  2228.  
  2229. That is about as much help as I can give for setting up the GNU C++
  2230. compiler.  It may seem like a long process, but it is not really very
  2231. difficult - I have just tried to cover as many possibilities as I
  2232. could think of.  So go get those file, set it up, and you will be
  2233. ready for the next articles in this column, where you will see actual
  2234. programming examples!
  2235.  
  2236.  
  2237.                                       Until my next visit to the Space Bar,
  2238.                                       Ciao,
  2239.                                       Warwick. (warwick@cs.uq.oz.au)
  2240.  
  2241. =========================================================================
  2242.  
  2243.  
  2244. /***********************************************************************/
  2245.      Language Watch -- Current versions of developer tools
  2246. /***********************************************************************/
  2247.  
  2248. DEV| version & date   | product
  2249. ==========================================================================
  2250. A  | 1.1 Nov 24, 1992 | Pure C (with ASM/C source level debugger) (German)
  2251. A  |     Sept 4, 1992 | Pure Pascal (German) (Turbo pascal 7.x compatible)
  2252. A  | 2.x              | Interface, (resource file editor, with 3D icons)
  2253. B  | 3.00             | Devpac 3 (assembler)
  2254. B  | 5.52             | Lattice C
  2255. B  | 2.02             | HiSoft BASIC 2 (includes compiler)
  2256. B  | 2.03.02          | HiSoft C (C interpreter)
  2257. B  | 1.6              | HiSpeed Pascal (Turbo pascal compatible)
  2258. B  | 1.21             | FTL Modula-2
  2259. B  | 1.24             | WERCS (resource file editor)
  2260. C  | 2.05             | Personal Pascal
  2261. D  |      Aug 3, 1988 | Assempro (assembler)
  2262. E  | 2.1  1989        | Laser C
  2263. E  | 1.1  1989        | Laser DB (assembly & C source level debugger)
  2264. F  | 3.7  1991        | GFA BASIC (includes compiler)
  2265. G  | 1.14, 1989       | Prospero C
  2266. G  | 2.15, 1989       | Prospero Pascal for GEM
  2267. G  | 2.15, 1989       | Prospero Fortran for GEM
  2268. G  | 1.11, 1989       | Prospero Developer's Toolkit
  2269. H  | 3.6d Oct 1, 1988 | Aztec C
  2270. H  | 3.6e Dec 6, 1988 | Aztec SDB (C source level debugger)
  2271. I  | 3.0.9, 1988      | Mark Williams C
  2272. I  | 1.0, 1988        | CSD (C Source level Debugger)
  2273. J  | ***              | GNU tools, compilers and assembler
  2274.  
  2275. A = Gribnif Software/Applications Systems Heidelberg
  2276. B = Oregon Research Associates and/or HiSoft
  2277. C = ICD/OSS
  2278. D = Abacus Software
  2279. E = Megamax
  2280. F = GFA
  2281. G = Prospero
  2282. H = Manx
  2283. I = Mark Williams Company
  2284. J = Free Software Foundation
  2285.  
  2286. *** see Warwick's OBJECT::ATARI part 2 for specifics
  2287.  
  2288. [ Editor's NOTE:
  2289.  
  2290.   Producers of development tools are strongly encouraged to send press
  2291.   releases and upgrade announcements to the Editor ]
  2292.  
  2293. /***********************************************************************/
  2294.                           On The Networks
  2295.            comments and messages from the on-line community
  2296. /***********************************************************************/
  2297.  
  2298.     These messages reprinted courtesy of the GEnie ST RoundTable
  2299.  
  2300. Category 33,  Topic 6
  2301. HISOFT
  2302.  
  2303.  > ------------
  2304.  >Category 3,  Topic 14
  2305.  >Message 25        Fri Oct 23, 1992
  2306.  >FIFTHCRUSADE                 at 20:59 EDT
  2307.  >
  2308.  > HISOFT,
  2309.  >
  2310.  > Is there some way I can get Lattice C 5.51 to flag an error in the
  2311.  > following situation:
  2312.  >
  2313.  > /* Header file a.h */
  2314.  > struct a *c_a(void);
  2315.  > void d_a(struct a *);
  2316.  > /* end header */
  2317.  > ---------------------
  2318.  > #include "a.h";
  2319.  > struct b *c_b(void);
  2320.  >
  2321.  > void main(void)
  2322.  > {
  2323.  >    struct b *ptr = c_b();
  2324.  >    d_a(ptr);  /* ERROR */
  2325.  > }
  2326.  > ---------------------
  2327.  > Right now Lattice compiles the error line without any warnings or
  2328.  > anything. This is causing me problems. I was really hoping it would
  2329.  > see that the struct tags are different and at least warn me about
  2330.  > this.
  2331.  >
  2332.  > I'm writing an encapsulated, object oriented GEM library, and I'm
  2333.  > using pointers to undefined structures as a means of information
  2334.  > hiding. It works fine except there's no type-checking on the
  2335.  > struct pointer parameters. Can I enable a warning for this? If not,
  2336.  > is there a work-around?
  2337.  >
  2338.  > I can't use typedefs because then I'll have order-dependant headers,
  2339.  > or nested headers. The former are a pain, and the latter screw up
  2340.  > make dependencies.
  2341.  >
  2342.  > Ben White
  2343.  > 5th Crusade Software
  2344.  > ------------
  2345.  
  2346. For some reason (I know not why) the code in the compiler which would
  2347. have caused this to give a warning was commented out... I've
  2348. reinstated  it for the upcoming 5.53. Also if you want it to warn you
  2349. now, run in  ANSI mode, but disable message 148 (-ca -j148i) which
  2350. ANSI mode  incorrectly enables.
  2351.  
  2352. Alex Kiernan, HiSoft.
  2353.  
  2354. --------------
  2355. Category 33,  Topic 6   Message  16       
  2356. D.LIVINGST11 [ErnestBovine]  (Forwarded)
  2357.  
  2358.  > explain why a program compiled on my Mega STE is
  2359.  > half the size of the same program on an IBM clone.
  2360.  > It's just a simple program
  2361.  
  2362.     The linker adds lots of things (library routines, program
  2363. initialization code, etc, and possibly debugging symbols) to your
  2364. code, to create the executable program.
  2365.  
  2366.     In the case of a very small program, this stuff would usually be
  2367. much larger than the actual code produced when the  compiler compiles
  2368. your .C source.  For example, printf() is a very large function, and
  2369. even if your source code is nothing but printf("Hi"); the linker must
  2370. still get the printf function from the library, and put it into the
  2371. executable.  Since printf() calls lots of other functions from the
  2372. library, these have to be linked in as well.
  2373.     This "extra" is evidently much more stuff on the IBM than on the
  2374. Atari.  If you use Microsoft Windows, there would be a TON of it!
  2375.     Anytime you #include <stdio.h>, a LOT of stuff gets added.  If
  2376. you don't need redirection or printf() etc, you can make your programs
  2377. a lot smaller.
  2378.  
  2379.  -------------
  2380. Category 33,  Topic 6   Message 98 
  2381. EXPLORER.1 [ Ron ]          
  2382.  
  2383. The Stephan Kochan book is very good.  If you get stuck on pointers
  2384. and structures try backing off and taking an assembly language course
  2385. or reading Clayton Walnum's assembler book.  Knowing how the computer
  2386. works helps a lot with the indirection concepts.
  2387.  
  2388. "Atari ST Applications Programming" by L. Pollack and E. Weber,
  2389. Bantam Books, ISBN 0-553-34397-1 is a very good ST specific text.
  2390. Examples from the book are in the libraries, do a search on "Bantam".
  2391. I doubt the book is still in print but would still be worth looking
  2392. for on special order or ask if someone has a copy they want to sell.
  2393.  
  2394. The Compute ST Programming series are worth getting if you can find
  2395. them, keep an eye open in the for sale topics for used books.
  2396.  
  2397.                   Ron @ Atari Explorer
  2398.  
  2399.  
  2400.  ------------
  2401. Category 33,  Topic 6    Message 99
  2402. J.TRAUTSCHOL [jtrautschold]
  2403.  
  2404. Wayne...
  2405.  
  2406. You may also want to download the Tim Oren tutorials on GEM
  2407. programming in C.  I believe they exist in one of the library's here
  2408. on GEnie, although I don't know exactly where.
  2409.  
  2410. Tim Oren was one of the original programmers of Digitial Research's
  2411. GEM PC, which was later ported to the ST.  His tutorials are quite
  2412. good and are loaded with some fine (although sometimes confusing)
  2413. examples.  I continue to reference his stuff to this day.
  2414.  
  2415. The suggestions by others to get as many books on C as you can is
  2416. also a good one.  The C-Manship books are good, but also consider the
  2417. C-programmers bible, "The C Programming Language" by Kernighan and
  2418. Ritchie.  You should look for edition 2, which covers the ANSI-updated
  2419. C language.  Work through the examples in that book - they'll compile
  2420. just fine of the ST is TOS mode and will give you a feeling for how
  2421. the C commands and libraries work.
  2422.  
  2423.                                                 John T.
  2424.  ------------
  2425. Category 3,  Topic 4    Message 96
  2426. J.ZORZIN [Joe]
  2427.  
  2428. So here's a dumb question from an amateur programmer.
  2429.  
  2430. In "C" lets say you have a long variable, x=123456789.
  2431.  
  2432. Now, you want to print that to screen with commas.  As I understand
  2433. there is no standard way to do this.  I ended up writing a routine
  2434. that converts the long to a string then added the commas.  I'm very
  2435. proud of myself that I pulled it off!  But does everyone have to write
  2436. their own routines for commas?  Or did I miss the boat?
  2437.  
  2438.  ------------
  2439. Category 3,  Topic 4    Message 97
  2440. STARFALL [Alan]
  2441.  
  2442.         Pretty much, Joe.  There are some public domain code floating
  2443. around for printing formatted numbers, and some C compilers throw it
  2444. in, but it's not part of the standard C library.
  2445.  
  2446.  ------------
  2447. Category 3,  Topic 4    Message 98
  2448. CBARRON
  2449.  
  2450.   In standard C. The characters are defined in a locale. Dr Plauger
  2451. in his book the standard C library provides a routine. It is reprinted
  2452. in a recent edition (late 91-early 92) of C user's journal.  MWC came
  2453. with source code to picture() that sort of emulates a COBOL PICTURE
  2454. clause. Sadly no locale_printf() family was in the standard, that I
  2455. can recall.
  2456.  
  2457.  ------------
  2458. Category 3,  Topic 4    Message 100
  2459. S.YELVINGTO2 [Steve]
  2460.  
  2461. Here's a handy bit of code for putting commas into a numeric string.
  2462.  
  2463.  From: siebeck@infoac.rmi.de (Wolfgang Siebeck )
  2464.  Newsgroups: comp.lang.c
  2465.  Subject: Re: Putting commas into a numeric string
  2466.  Message-ID: <1992Mar6.124215.1339@infoac.rmi.de>
  2467.  Date: 6 Mar 92 12:42:15 GMT
  2468.  Organization: RMI Net INFO.box Systems * Aachen * Hamburg * Flensburg
  2469.  
  2470.  Marc_North@mindlink.bc.ca (Marc North) writes:
  2471.  
  2472.  >I have written an application that requires I put commas into a string
  2473.  >representing a numeric value.
  2474.  
  2475.  Give this one a try. No error checking is done, so your target should be
  2476.  big enough to hold the string including the commas. For "German" numbers,
  2477.  I call it like
  2478.  
  2479.   commas(numberstring, '.');
  2480.  
  2481.  you might prefer
  2482.  
  2483.   commas(numberstring, ',');
  2484.  
  2485.  --- cut here ---
  2486.  #include <stdio.h>
  2487.  #include <string.h>
  2488.  #include <stdlib.h>
  2489.  
  2490.  /*
  2491.  **     If you need strdup(), here it is:
  2492.  */
  2493.  
  2494.  char *strdup(char *s)
  2495.  {
  2496.         char *t;
  2497.         if (t = malloc(strlen(s)+1))
  2498.                 strcpy(t, s);
  2499.         return t;
  2500.  }
  2501.  
  2502.  
  2503.  void commas(char *dest, char komma)
  2504.  {
  2505.         char *src, *core;       /* Place holder for malloc */
  2506.         unsigned cc;            /* The comma counter */
  2507.         unsigned len;
  2508.  
  2509.         len = strlen(dest);
  2510.         /* Make a copy, so we can muck around */
  2511.         if( (core = src = strdup(dest)) == NULL)
  2512.                 return;
  2513.  
  2514.         cc = (len-1)%3 + 1;     /* Tells us when to insert a comma */
  2515.  
  2516.         while(*src != '\0'){
  2517.                 *dest++ = *src++;
  2518.                 if( ((--cc) == 0) && *src ){
  2519.                         *dest++ = komma; cc = 3;
  2520.                 }
  2521.         }
  2522.         free(core);
  2523.         *dest = '\0';
  2524.  }
  2525.  
  2526.  /*
  2527.  **
  2528.  */
  2529.  #ifdef TES
  2530.  
  2531.  main()
  2532.  {
  2533.         char in[80];
  2534.  
  2535.         do {
  2536.                 gets(in);
  2537.                 if (in[0]) {
  2538.                         printf ("%s --> ", in);
  2539.                         commas(in,'.');
  2540.                         printf ("%s\n", in);
  2541.                 }
  2542.         } while (in[0]);
  2543.  }
  2544.  #endif
  2545.  --- cut here ---
  2546.  
  2547.  Wolfgang
  2548.  --
  2549.  siebeck@infoac.rmi.de (Wolfgang Siebeck)
  2550.  
  2551.  ------------
  2552. Category 33,  Topic 6    Message 125
  2553. R.WATSON15 [Wayne Watson]
  2554.  
  2555. Ok, I have a question. WHAT IS A PROTOTYPE? I keep seeing this word
  2556. and haven't been able to find out what it is. I get this error, 'No
  2557. prototype at definition of public function'. What does it mean? It
  2558. might help if I knew what a prototype was. Is there a file or
  2559. something somewhere that explains the C terminology? Thanks.
  2560.  
  2561.  ------------
  2562. Category 33,  Topic 6    Message 126
  2563. D.CHARTER
  2564.  
  2565. Wayne,
  2566.  
  2567.  Finally something I can answer (sort of).  A prototype is just where
  2568. you tell the compiler how your functions are called...what parameters
  2569. you are sending, and what you expect back.  An example is the function
  2570. main().  You can use it like:
  2571.  
  2572.     main()
  2573.     {
  2574.  
  2575.  This will work fine, but you will get the error you received.  To
  2576.  solve this problem, tell the compiler if you are sending anything,
  2577.  and if you expect it to give you something back. Like:
  2578.  
  2579.    void main(void)  <==void means I am sending/receiving nothing
  2580.    {
  2581.  
  2582.  An example of how to declare a prototype would be:
  2583.  /************  THESE ARE PROTOTYPES *********************/
  2584.  void main(void);       <==I am not sending the function
  2585.                           anything..I am expecting nothing
  2586.                           to be returned.
  2587.  
  2588.  char get_answer();     <==I am going to receive a character
  2589.                           back, but am sending nothing
  2590.  
  2591.  /****************** THIS IS THE PROGRAM *****************/
  2592.  void main(void)
  2593.  {
  2594.  char answer;
  2595.  
  2596.  answer=get_answer();   <==Here we call the function, sending
  2597.                            nothing in the function call..we
  2598.                            expect to receive a char.
  2599.  
  2600. The use of prototyping is helpful for programming, and it allows the
  2601. compiler to assist by making sure you send and receive what you
  2602. expect.  You are receiving a 'No prototype at definition of public
  2603. function' because main is a public function.  If you do not declare
  2604. what you expect by using prototypes, the compiler defaults to
  2605. expecting the return of an INT.
  2606.  
  2607. Duane
  2608.  
  2609.  ------------
  2610. Category 33,  Topic 6    Message 127
  2611. J.TRAUTSCHOL [jtrautschold]
  2612.  
  2613. Wayne...
  2614.  
  2615. A prototype is a way of defining for the compiler, what is to appear
  2616. in a function.  This permits the compiler to easily cross check all of
  2617. your calls to that function for the proper type of return value, and
  2618. the proper types of variables being passed to the function.
  2619.  
  2620. For instance, let's say you write a function that passes 2 character
  2621. strings, a pointer to an integer, and a long value.  The function
  2622. returns an integer.  You would write the prototype like this:
  2623.  
  2624.         int function(char *, char *, int *, long);
  2625.  
  2626. Now, let's say that, within the body of your program, you call this
  2627. function twice.  The first time you call it as follows:
  2628.  
  2629.         int reply;
  2630.         char string1[] = "ABC",
  2631.              string2[] = "DEF";
  2632.         int *value;
  2633.         long lvalue;
  2634.  
  2635.         reply = function(string1, string2, value, lvalue);
  2636.  
  2637. and the next time you call it, you do it as follows:
  2638.  
  2639.         reply = function(string1, string2, *value, lvalue);
  2640.  
  2641. The first attempt at calling the function would pass just fine.  The
  2642. prototype tells the compiler to expect pointers for the first two
  2643. character strings as well as for the integer, and just the value of
  2644. the long lvalue.  That's exactly what you are doing the first time.
  2645. the second call would produce a warning, however, because you are
  2646. dereferencing the integer value which no longer makes it a point to
  2647. where that value resides in memory.  The compiler will warn you of a
  2648. prototype mismatch and save you the possibility of hours of debugging
  2649. later on.
  2650.  
  2651.                                                 John T.
  2652.  -------------
  2653. Category 33,  Topic 6    Message 124
  2654. D.WHITEHEAD3 [Mega ST Man]
  2655.  
  2656. I'm pretty green when it comes to most of the discussions here. Could
  2657. someone enlighten me as to what standard C startup is?  Also, I've
  2658. been wondering if the references I've seen to variables that start
  2659. with a _ are some kind of system variable?  If so, where can I find
  2660. out about them and how to use them.
  2661.  
  2662. Another question I have concerns sound output.  I have C-Manship and
  2663. it doesn't refer once to sound.  The Lattice manuals lists a couple of
  2664. functions but I have not been able to figure it out.
  2665.  
  2666. Thanks,
  2667.  
  2668. Drew Whitehead The Novice Programmer
  2669.  
  2670.  -------------
  2671. Category 33,  Topic 6    Message 131
  2672. HISOFT
  2673.  
  2674. >... enlighten me as to what standard C startup is?
  2675.  
  2676. Someone else has probably done this, but just in case... the C
  2677. startup is the glue between the OS program entry point and the  main()
  2678. function in your program. Its responsible for looking after  OS type
  2679. things and ensuring that standard file handles (stdin,  stdout etc.)
  2680. are set up, and a bunch of other things.
  2681.  
  2682. Alex Kiernan, HiSoft.
  2683.  
  2684.  -------------
  2685. Category 33,  Topic 8    Message 5
  2686. HISOFT
  2687.  
  2688. I think Wayne is referring to the old WERCS+ product that we  have.
  2689. This was basically the standard WERCS package together  with GDOS and
  2690. a leaflet describing some of the programming side  of the original
  2691. GDOS. As such its a bit out of date. This isn't  included in HiSoft
  2692. BASIC 2 - you get a version of WERCS just for  use with HiSoft BASIC.
  2693.  
  2694. When SpeedoGDOS comes out we intend add library calls for this  to
  2695. the HiSoft BASIC 2  package. The existing package already has  the
  2696. core routines you need to use the original GDOS (detecting  that its
  2697. there, opening a physical workstation, loading fonts -  that sort of
  2698. thing).
  2699.  
  2700. Dave Nutkins, HiSoft.
  2701.  
  2702.  
  2703.  
  2704.  
  2705. /************************************************************************/
  2706.                         NETWORK SIGN-UP INFORMATION
  2707. /************************************************************************/
  2708. ---------------------------------------------------------------------------
  2709. --       --==--==--       GEnie Sign-Up Information      --==--==--      --
  2710. --                                                                       --
  2711. --   1. Set your communications software for half duplex (local echo)    --
  2712. --   at 300, 1200, or 2400 baud.                                         --
  2713. --                                                                       --
  2714. --   2.  Dial toll free: 1-800-638-8369 (or in Canada, 1-800-387-8330).  -- 
  2715. --   Upon connection, enter HHH.                                         --
  2716. --                                                                       --
  2717. --   3.  At the U# prompt, enter XTX99436,GENIE then press <Return>.     --
  2718. --                                                                       --
  2719. --   4.  Have a major credit card ready.  In the U.S., you may also use  --
  2720. --   your checking account number.                                       --
  2721. --                                                                       --
  2722. --   For more information in the United States or Canada, call 1-800-    --
  2723. --   638-9636 or write: GEnie, c/o GE Information Services, P.O. Box     --
  2724. --   6403, Rockville, MD 20850-1785.                                     --
  2725. --                                                                       --
  2726. --       --==--==--  Atari's Official Online Resource!   --==--==--      --
  2727. ---------------------------------------------------------------------------
  2728. ---------------------------------------------------------------------------
  2729. --       --==--==--    CompuServe Sign-Up Information    --==--==--      --
  2730. --                                                                       --
  2731. -- To sign up for CompuServe service, call (voice call) (800) 848-8199.  --
  2732. -- Ask for operator #198. You will be sent a $15.00 value CIS membership --
  2733. -- kit for free.                                                         --
  2734. --                                                                       --
  2735. --       --==--==--    CompuServe Sign-Up Information    --==--==--      --
  2736. ---------------------------------------------------------------------------
  2737. --------------------------------------------------------------------------
  2738. --       --==--==--      Delphi Sign-Up Information      --==--==--      --
  2739. --                                                                       --
  2740. --  To enroll as a Delphi subscriber, modem call 1-800-365-4636. Press   --
  2741. --  [Return] once or twice, and type IP26 [Return] at Password:          --
  2742. --                                                                       --
  2743. --  Answer all of the questions, and you'll be cleared for Delphi        --
  2744. --  access in a few days. If you have questions about Delphi services,   --
  2745. --  give a voice call to Delphi Member Services at 1-800-544-4005.       --
  2746. --                                                                       --
  2747. --       --==--==--      Delphi Sign-Up Information      --==--==--      --
  2748. ---------------------------------------------------------------------------
  2749.  
  2750.  
  2751.  
  2752. /***********************************************************************/
  2753.                          USER VIEW
  2754.                        By: Ed Krimen
  2755. /***********************************************************************/
  2756.  
  2757. Apple's popularization of the graphical user interface has
  2758. demonstrated that the interface is often an application's most
  2759. important feature.  Unfortunately, many programmers, including ST
  2760. programmers, don't put much thought into the interface.  They simply
  2761. create an interface -- they don't design one.  They don't put thought
  2762. into how the user is going to interact with the application.
  2763. Programmers know the interface should have some drop-down menus,
  2764. multiple windows, maybe some buttons, and dialog boxes, but they don't
  2765. think about how the positioning and implementation of these features
  2766. will work with the user.
  2767.  
  2768. After programming the main features of the application, most
  2769. programmers abhor doing the interface.  They know how much thought and
  2770. design should go into it, but they don't want to muster the effort.
  2771. Some programmers even leave useful features out because they don't
  2772. want to bother to fool with the interface.
  2773.  
  2774. On the ST platform, it's fairly easy to tell which programmers put
  2775. effort into interfaces, while others seem to put program commands and
  2776. functions anywhere they see fit, without regard to user tendencies.
  2777. I'm not singling out freeware/shareware programmers from commercial
  2778. programmers, either; I've seen strange stuff on both sides of the
  2779. fence.  Some freeware programs have much better interfaces than some
  2780. commercial stuff.
  2781.  
  2782. //// LOOK PROFESSIONAL
  2783.  
  2784. One of my favorite programs is the Interactive Installation demo that
  2785. CyberCube Research of Canada has recently uploaded to GEnie.  There's
  2786. not much of an interface, and the program has very limited uses, but
  2787. it's the whole presentation of it that is impressive.  It looks like
  2788. they spent as much time creating the "look" of the program as they did
  2789. programming it.  It has beautifully-designed title screens and helpful
  2790. diagrams of their graphics card that provide details when you select
  2791. certain parts of them.  The program looks magnificent, especially in
  2792. TT-medium resolution.
  2793.  
  2794. A representation of their VME board has each of its parts labeled.
  2795. When you click on "Monitor Port," for instance, a short description is
  2796. placed in a dialog box.  This is similar to what one would see in
  2797. Hypercard on that "other" platform.  Their "Info" screen displays a
  2798. professionally-illustrated logo in glorious 16-colors.  It doesn't
  2799. reek of "hurry-up this is the last part that we have to do before we
  2800. finish the program", but it represents pride and care with a
  2801. professional look that very few ST programs possess.
  2802.  
  2803. This entire Interactive Installation program was done just to show you
  2804. how easy it is to install their VME board.  You run it before you do
  2805. the installation to get a brief, interactive overview.  What's so
  2806. appealing is that the program has an exceptionally professional look
  2807. to it, unlike many other programs I've seen on the ST.  Great care has
  2808. been made in designing its appearance.
  2809.  
  2810. //// SIMPLE, EFFECTIVE, AND A LITTLE BIT O' COLOR
  2811.  
  2812. Other programs, such as Codehead's MultiDesk Deluxe, Warp 9, Bill
  2813. Aycock's Calendar, and Charles F. Johnson's ARC Shell, use colors and
  2814. simple, effective, and clean interface designs to maintain the
  2815. usefulness of their feature-packed programs without overcoming the
  2816. user.  Sure, they're not required to make their programs look good,
  2817. but they do it anyway because it improves the programs' selling
  2818. potential.  I suppose some programmers don't realize that it's the
  2819. little things that make a program impressive.  For example, when Warp
  2820. 9 boots from the AUTO folder, you don't see boring old ASCII
  2821. characters scroll up the screen, but instead you see a nicely-crafted
  2822. graphic box containing the Warp 9 logo, followed by the program's
  2823. credits.  This is the only program that displays this type of graphic,
  2824. and it's unfortunate that other programs don't have this
  2825. professional-looking "feature."
  2826.  
  2827. MultiDesk Deluxe and Calendar allow you to change the name that will
  2828. be displayed in the desk accessory slot.  Very few desk accessories do
  2829. this.  No, I personally don't have a use for this option, but there
  2830. are people who want to have more than one copy of MultiDesk and
  2831. Calendar installed, so the ability to change the desk accessory's name
  2832. is useful.
  2833.  
  2834. Another handy function is in ARC Shell's Configuration screen.  Here,
  2835. you can click the mouse pointer on any pathname and an item selector
  2836. will appear, enabling you to easily select a path; there's no need for
  2837. manually typing in pathnames.  On the ST, there's absolutely no reason
  2838. why programs shouldn't implement this feature.  Look for details on
  2839. programming these kinds of features in future issues of AEO-PJ.
  2840.  
  2841. //// WINDOWS ON THE ST
  2842.  
  2843. TOS 2.0x and 3.0x give us the ability to have up to seven windows open
  2844. at once, which is an increase from previous TOS versions which only
  2845. allowed four; MultiTOS allows you to open as many windows as memory
  2846. will allow.  With the four-window restriction lifted, programmers can
  2847. take advantage of this and use the windows for other things.
  2848.  
  2849. Papyrus, an excellent, feature-packed graphical word processor from
  2850. Germany, uses very few dialog boxes.  Everything from selecting fonts
  2851. to selecting patterns and colors are done in windows.  If the font
  2852. window is open, for example, it will display the font type, sizes, and
  2853. other font details that are currently being used where the cursor is.
  2854. Everything is done with windows in Papyrus, which means that they can
  2855. be topped and moved, making things very flexible for the user,
  2856. especially if he has a large screen monitor.
  2857.  
  2858. //// "HI THERE."
  2859.  
  2860. I will never forget viewing the Lotus Improv demo for the NeXT.  The
  2861. one feature that fascinated me was that the program spoke.  It used
  2862. digitized voices to introduce the user to the program and describe its
  2863. features.  But there's no reason why this can't be done on the ST.
  2864.  
  2865. And finally, it has.  No, the application is not some wiz-bang
  2866. productivity program that costs a couple hundred dollars.  It's a
  2867. freeware program that converts standard sound files into GEM Sound
  2868. format.  It's one of Mike Allen's first attempts at GEM programming
  2869. and he did it in assembly language.  Mike used his own broadcast voice
  2870. to produce the sounds, which are used in various dialog boxes.  For
  2871. example, in one dialog box with three buttons labeled ".SPL," ".SAM,"
  2872. and "Done," the voice that says, "Dot S-P-L" comes out of the left
  2873. speaker, the voice that says, "Dot S-A-M" comes out of both speakers
  2874. (so it's centered), and "Done" comes out of the right speaker.  The
  2875. voices are very well done and sound professional.
  2876.  
  2877. It's great that someone has finally broken the ice.  We need more
  2878. interfaces done like this one, and with Atari's System Audio Manager
  2879. debuting soon, I'm sure they will be; apparently, one feature in SAM
  2880. allows programmers to attach specific sounds to certain program
  2881. functions.
  2882.  
  2883. //// SCROLL BAR REMOVAL
  2884.  
  2885. Those with large-screen monitors don't have worry about this problem,
  2886. but if you have a standard-size screen, and most of us do, the scroll
  2887. bars on windows often get in the way.  They don't enable us to see a
  2888. full 80 columns or a full 24 lines.  STalker 3.0, a GEM terminal
  2889. program, first presented us with the option to remove the vertical and
  2890. horizontal scroll bars, and I think other programs should allow this
  2891. as well.  Even though the scroll bars may be removed, STalker still
  2892. allows the user to resize the window and scroll through an on-line
  2893. session.
  2894.  
  2895. Even when window gadgets and scroll bars are present, the user can
  2896. move STalker's window by holding down the right and left mouse buttons
  2897. anywhere in the window.  SHIFT-arrow keys will also scroll through the
  2898. window.  When no window gadgets and scroll bars are present, holding
  2899. down the right and left mouse buttons in the lower right-hand corner
  2900. of the window will resize it.
  2901.  
  2902. All scroll and title bar toggle operations are done via drop-down menu
  2903. selections or hotkeys.  Toggling the window's title bar is done with
  2904. ALT-SHIFT-` (ALT-~).  You can toggle the window's vertical scroll bar
  2905. with ALT-SHIFT-\ (ALT-|).  Finally, toggling the horizontal scroll bar
  2906. is done with ALT-SHIFT-- (ALT-_).
  2907.  
  2908. //// HELP MESSAGES FOR ICONS
  2909.  
  2910. Everyone knows what an icon is.  It's an image that represents an
  2911. object, a function, or a command.  But how many times have you been
  2912. overcome with a myriad of icons in an application, only to look at one
  2913. and wonder, "What does THAT one do?!"
  2914.  
  2915. Calamus SL is one of those applications that present the user with an
  2916. enormous number of icons.  SL does so many things, that it would be
  2917. impossible to have each function listed in drop-down menus; you'd need
  2918. a large-screen monitor just to display them.  But then how do you tell
  2919. the difference between some of the icons in the Page Module's Page
  2920. Layout Command Group and those icons in the Frame Module's Text Frame
  2921. Special Functions Group?  Many of them look very similar.
  2922.  
  2923. The brains at DMC have implemented a system that displays a "Help
  2924. Message" in the upper-right hand corner of the screen.  When you pass
  2925. over the Insert Empty Pages icon, you know that's different from the
  2926. Piping from Frame to Frame icon because a short Help Message tells you
  2927. so.  As you move from icon to icon, the Help Message changes,
  2928. displaying the name of the icon.  Calamus SL and the new NeoDesk
  2929. Control Panel are the only programs I've seen that use this feature,
  2930. and I think other programs would serve their users better by doing so.
  2931.  
  2932. //// CONFIGURABLE HOTKEYS
  2933.  
  2934. Many programs provide hotkeys, which are keystrokes that quickly
  2935. perform menu operations without using the mouse.  For example, an
  2936. ALT-Q or a CTRL-X keypress will usually quit or exit a program,
  2937. instead of requiring the user to go up to the File menu and select
  2938. Quit or Exit.
  2939.  
  2940. However, most programs don't follow the same hotkey conventions.  Some
  2941. programs ask for ALT-Q, for example, while others ask for CTRL-X, and
  2942. this dissimilarity confuses users.  I'd like to see programs allow for
  2943. custom configurations of hotkeys.  The user can use the default
  2944. settings, or he can create his own.  Atari's own NewDesk is an
  2945. excellent example of enabling the user to configure his own hotkeys.
  2946.  
  2947. //// MULTIPLE WINDOW MENU SELECTION
  2948.  
  2949. The best programs allow the user to load more than one file at a time.
  2950. Whether it's a word processor, desktop publishing program, or paint
  2951. program, the ability to load multiple files is always convenient.
  2952.  
  2953. However, what's inconvenient is that some programs don't make it easy
  2954. for the user to switch between windows.  They offer no way to switch,
  2955. other than selecting the windows themselves.  Even if you have only
  2956. two documents loaded, you may find that selecting the one on the
  2957. bottom can be a bothersome task, because you must first move the
  2958. topmost window if it's expanded to the full-screen.
  2959.  
  2960. Programs should have a drop-down menu whose only function is to list
  2961. the various windows that are open.  Then, when a user wants to top a
  2962. window, he can just select it from the menu.
  2963.  
  2964. //// INVISION ELITE ANIMATION SEQUENCE
  2965.  
  2966. Finally, like the CyberCube Interactive Installation demo, or Warp 9's
  2967. loader display, or Mike Allen's sound converter, there are some things
  2968. that aren't necessarily useful to a program, but instead, they give it
  2969. its "cool" factor.
  2970.  
  2971. One program with a very high "cool" factor is INVISION Elite.  Not
  2972. only is INVISION Elite an excellent monochrome raster graphics program
  2973. with an easy-to-use, icon-based interface with Help Messages, but it
  2974. also has a magnificent introduction and exiting animation sequence.
  2975. If you haven't seen this thing, you should.  It contains a collage of
  2976. spectacular black-and-white images that dissolve, zoom, and spin,
  2977. making it an attractive, eye-catching presentation.  There's a demo on
  2978. several of the networks, but if you need a raster graphics program,
  2979. this one really looks great.
  2980.  
  2981. //// CLOSE DOCUMENT
  2982.  
  2983. Users love programs that are easy to use and fun to work with, and
  2984. programmers need to pay attention to users' preferences if they want
  2985. to create successful products.  While some of the suggestions I
  2986. mentioned are really extraordinary, others are essential.
  2987.  
  2988. Just like intuitive and attractive interfaces, it's the little things
  2989. that make a program impressive.  But interfaces don't need to be
  2990. noticed to be effective.  Usually, a good interface is one that isn't
  2991. noticed and doesn't get in the way.
  2992.  
  2993. If there's a program that you especially enjoy using, take a look at
  2994. it a little closer.  Try to figure out what you like about it.  When
  2995. you find it, you can strive to include those features in your own
  2996. programs.
  2997.  
  2998.  
  2999.  
  3000. /************************************************************************/
  3001.                  Brain Stem Rotator
  3002.                 By: Warwick Allison
  3003. /************************************************************************/
  3004.  
  3005.  A world class, nightmare problem that may not have a solution.
  3006.  You have one minute to solve! <grin>
  3007.  
  3008.  My favourite is the Knight Problem.
  3009.  
  3010.         Starting anywhere you like on a chessboard, move a Knight
  3011.         so as to jump on every square one and only once.
  3012.  
  3013.         A chessboard is 8 x 8 and Knights move in an L shape:
  3014.  
  3015.                 ........
  3016.                 ........    k = knight
  3017.                 ..o.o...    o = legal moves from k
  3018.                 .o...o..
  3019.                 ...k....
  3020.                 .o...o..
  3021.                 ..o.o...
  3022.                 ........
  3023.  
  3024.         Try to write a program to do it.  Try it for larger (and smaller)
  3025.         chessboards.  How many solutions can you find?
  3026.  
  3027.  
  3028.  
  3029. /*************************************************************************/
  3030.                             Glossary of Terms
  3031. /*************************************************************************/
  3032.  
  3033. AES = Application Environment System
  3034. BTW = By the way
  3035. FSF = Free Software Foundation
  3036. GEM = Graphics Environment Manager
  3037. IMO = In My Opinion
  3038. LEX = Lexical Analyzer
  3039. OO  = Object Oriented
  3040. OOL = Object Oriented Language
  3041. OOP = Object Oriented Programming
  3042. USL = Unix System Laboratories
  3043. VDI = Virtual Device Interface
  3044. YACC = Yet Another Compiler Compiler
  3045.  
  3046.  
  3047.  
  3048. /*************************************************************************/
  3049.                       ATARI DEVELOPER INFORMATION
  3050. /*************************************************************************/
  3051.  
  3052.    What you can buy from Atari in terms of developer documentation and
  3053.    support.  Contact Atari for the specific details.
  3054.  
  3055.    Atari Corp
  3056.    1196 Borregas Ave
  3057.    Sunnyvale, CA 94089
  3058.    USA
  3059.    (408)-745-2000 (voice)
  3060.  
  3061.    Some of the benefits:
  3062.  
  3063.    + Several disks and approximately two thousand pages of programming
  3064.      documentation
  3065.    + Atari Developer newsletter: ATARI.RSC
  3066.    + Atari Developer RoundTable support on GEnie (private)
  3067.  
  3068.    Call or write for details.
  3069.  
  3070. -----------------------------------------------------------------------
  3071.  
  3072.  From: Mike Fulton, Atari Developer Support
  3073.  
  3074.    To: Atari Developer Community & Atari Programmers everywhere
  3075.  
  3076.  
  3077.  
  3078.  Atari Developer CDROM
  3079.  ---------------------
  3080.  
  3081.  Atari is currently in the production stages of creating a Developer
  3082.  CDROM disc that will be offered to both new and existing developers.
  3083.  
  3084.  The initial release is slated for the developer conference that is going
  3085.  to be held on Friday, September 17, 1993 in Glendale, California, the
  3086.  day before "Atari Computer Faire, Version 7.0" starts (AKA "The Glendale
  3087.  Show").
  3088.  
  3089.  Once the initial version of the disc has been released, we expect to
  3090.  have updates a couple of times a year with new material and any
  3091.  necessary corrections.  Once you've purchased the disc, you'll be able
  3092.  to get the upgrade discs at reduced cost.  (Exact pricing information
  3093.  for the disc and/or updates is not available at this time, but it
  3094.  should be pretty reasonable.)
  3095.  
  3096.  Since not all developers will already be using a CDROM drive with their
  3097.  system, we plan to include a floppy disk that will have the necessary
  3098.  CDROM driver software to allow them to access the disc once they have
  3099.  connected a CDROM drive to their computer.
  3100.  
  3101.  ===========================================================================
  3102.  
  3103.  Here's a preliminary outline of what we hope to include on the disc:
  3104.  (This is still preliminary subject to change without notice, of course!)
  3105.  
  3106.  ===========================================================================
  3107.  
  3108.  *   All of the current versions of all of the programs and files in the
  3109.      Atari developer's kit, plus additional related items not included in
  3110.      the regular kit.
  3111.  
  3112.  
  3113.  *   Atari Falcon030-specific developer's tools such as the DSP
  3114.      Assembler, Linker, and Debugger
  3115.  
  3116.  
  3117.  *   Current release of SpeedoGDOS outline font scaler
  3118.  
  3119.  
  3120.  *   Current release of MultiTOS multitasking operating system
  3121.  
  3122.  
  3123.  *   Atari Works -- integrated word processor, spreadsheet, database
  3124.  
  3125.  
  3126.  *   Programs that currently ship with Atari computers such as the
  3127.      Falcon030 (but which work with older machines) that not everybody
  3128.      may have, such as:
  3129.  
  3130.        CalAppt -- Calendar/Appointment Book/Address Book
  3131.  
  3132.        Procalc -- Calculator Accessory (with number-base conversions)
  3133.  
  3134.        Talking Clock -- STE/TT/Falcon030 Talking Clock Program/accessory
  3135.  
  3136.        Accessory Games -- Breakout, Landmine
  3137.  
  3138.        Audio Fun Machine -- Assign sounds to keystrokes & system events on
  3139.                             STE/TT/Falcon030
  3140.  
  3141.  
  3142.  *   Online Documentation -- The disc contents will be described in an
  3143.      online hypertext format.  Additionally, at least some of the regular
  3144.      developer's documentation will also be available in hypertext
  3145.      format. (With more to come on future updates.)
  3146.  
  3147.         Imagine being able to look at a function reference of all the
  3148.         functions described in the GEMDOS manual.   You click on
  3149.         "Fsfirst()" and get a description of that function.  While you're
  3150.         looking at that, you start to wonder what the rules for legal
  3151.         filenames are, so you click on "Filename" and see a description
  3152.         of what constitutes a legal filename.
  3153.  
  3154.  
  3155.  *   Demo programs -- graphics demos, sound demos, etc.  For all
  3156.      machines, especially the new Atari Falcon030.
  3157.  
  3158.  
  3159.  *   Sample source code -- for new TOS features, from past developer
  3160.      newsletters, and so on.
  3161.  
  3162.  ===========================================================================
  3163.  
  3164.  Aside from all of the above, there are three additional categories of 
  3165.  files that we would like to include.  These categories all depend to a
  3166.  large degree on submissions from the Atari Developer community.
  3167.  
  3168.  ===========================================================================
  3169.  
  3170.  *   Public-domain & shareware development tools, utilities, & source
  3171.      code.
  3172.  
  3173.         We would like to include as much public domain and shareware
  3174.         stuff as we can.  We want development tools, utilties, sample
  3175.         source code, and anything else that is programming-related.  For
  3176.         example, we would like to include things like the GNU GCC
  3177.         compiler (C & C++) and other GNU tools, and possibly other PD or
  3178.         shareware compilers as well.
  3179.  
  3180.         We would like to include just about any kind of developer
  3181.         oriented program, but we do have a few basic guidelines about the
  3182.         submissions that we would like to follow:
  3183.  
  3184.             1) The software should be compatible with both SpeedoGDOS and
  3185.                MultiTOS.  By 'compatible' I mean it doesn't crash or
  3186.                mess up the display in some fashion.  Taking advantage of
  3187.                either SpeedoGDOS or MultiTOS is not required, although it
  3188.                is certainly welcome.
  3189.  
  3190.                If you have something that you might like to submit, and
  3191.                you aren't sure how it behaves with SpeedoGDOS or
  3192.                MultiTOS, please just go ahead and submit it.  We will be
  3193.                testing submissions as much as possible before including
  3194.                them.  Include information for any compatibility problems
  3195.                you already know about.
  3196.  
  3197.                If you know for a fact that your submission doesn't work
  3198.                with SpeedoGDOS and/or MultiTOS, but feel that other
  3199.                developers will still find it quite useful, then let us
  3200.                know about it and perhaps we'll make an exception here and
  3201.                there (pun absolutely intended! ;^).
  3202.  
  3203.                In most cases, incompatibility problems with SpeedoGDOS
  3204.                and MultiTOS are easy to fix, because they are usally
  3205.                caused by one of a small handfull of programming errors.
  3206.                If you make your submission, it may be the case that we
  3207.                can point out what's wrong and you will be able to fix it
  3208.                without too much trouble.
  3209.  
  3210.                One problem that some programs have regarding MultiTOS is
  3211.                that they don't do their console & screen I/O in a
  3212.                consistent manner.  They mix up BIOS, GEMDOS and GEM calls
  3213.                all together.  For example, they might use Bconin() to
  3214.                get keyboard input and then they'll use v_gtext() to
  3215.                output information to the screen.  Or they'll use
  3216.                evnt_keybd() or evnt_multi() to get their input, and then
  3217.                use Bconout() or Cconws() or some other such BIOS or
  3218.                GEMDOS call to do their screen I/O.
  3219.  
  3220.                This doesn't work too well with MultiTOS where programs
  3221.                generally don't own the whole system and have to share
  3222.                the keyboard and display screen with other programs.
  3223.  
  3224.                If you're going to do be a GEM program, then you should do
  3225.                all of your screen & console I/O through GEM.  If you're
  3226.                not a GEM program, then you should do all of your console
  3227.                & screen I/O through the BIOS and GEMDOS.  Pick one or the
  3228.                other and stick with it.
  3229.  
  3230.             2) The submission should have at least minimal documentation,
  3231.                preferably in English.  If complete documentation is only
  3232.                available in another language, then we'll have to judge
  3233.                how difficult the program is to figure out and use
  3234.                without documentation.
  3235.  
  3236.  
  3237.             Submission Guidelines
  3238.             ---------------------
  3239.  
  3240.             * If something is clearly marked as being public domain, you
  3241.               do not have to be the author to submit it.
  3242.  
  3243.             * On files marked "Public Domain", if there is a notice about
  3244.               distibution restrictions of some kind, then the author may
  3245.               have misunderstood what "public domain" means and we'll try
  3246.               to contact them to straighten things out and make sure they
  3247.               don't have a problem with us including their stuff on the
  3248.               CDROM.
  3249.  
  3250.               (Legally speaking, once something has been released into
  3251.               the public domain, the author has given up the rights to
  3252.               put any restrictions on it of any kind.  Free Software and
  3253.               Public Domain Software aren't the same thing.)
  3254.  
  3255.             * If something is marked as being shareware, you do not have
  3256.               to be the author to submit it, but you must include all of
  3257.               the appropriate files including the information on how to
  3258.               contact the copyright holder so that we can contact them to
  3259.               obtain permission if necessary.
  3260.  
  3261.             * If something has a copyright notice, but is marked as being
  3262.               freely distributable, you do not have to be the author to
  3263.               submit it, but you must include all of the appropriate
  3264.               files.
  3265.  
  3266.             * If something has a copyright notice, and is not marked as
  3267.               being shareware or as being freely distributable, before
  3268.               submitting it, please send email with whatever information
  3269.               is available for the program, but not the program itself.
  3270.  
  3271.  
  3272.  ===========================================================================
  3273.  
  3274.  *  Demo versions of commercially available software
  3275.  
  3276.         We would like to include disabled demo versions of commercially
  3277.         available software.  For example, if we weren't including a fully
  3278.         working version of Atari Works, we might instead include a demo
  3279.         version that would let you load and edit files, but not let you
  3280.         save or print (or would print with a special "DEMO VERSION" box
  3281.         on top of the regular text).
  3282.  
  3283.         We would like to concentrate on developer-oriented & power-user
  3284.         software such as programming languages and utilities, program
  3285.         shells, disk utilities, and so forth.  However, if space
  3286.         permits, we may be able to include a few more end-user oriented
  3287.         demos.  If you would like to make such a submission, let us know
  3288.         and we'll try to get it on the disc if possible.  A CDROM holds
  3289.         about 600mb and while that may sound like a lot (and is!) it can
  3290.         still get filled up very quickly.
  3291.  
  3292.         It is strongly recommended that demo versions have their disabled
  3293.         sections completely removed, not simply disabled.  If your demo
  3294.         version isn't supposed to be able to print, then take the printing
  3295.         code out completely rather than simply jumping past it.  If you
  3296.         don't take such steps, then somebody may figure out how to
  3297.         re-enable the disabled sections of the program.
  3298.  
  3299.  ===========================================================================
  3300.  
  3301.  * Locked (password encrypted) versions of shareware and commercially
  3302.    available software
  3303.  
  3304.         To go along with the demo versions mentioned above, it would be
  3305.         great if we could include actual working versions of some of
  3306.         these products.  Let's use Hisoft's Lattice C as an example:
  3307.  
  3308.             Suppose that there was a demo version on the disc that would
  3309.             let you create source code files up to 5K long and compile
  3310.             them.  But you couldn't save the files, and you could only
  3311.             have 1 object module, and the resulting program would say
  3312.             "COMPILED WITH DEMO VERSION OF LATTICE C" several times
  3313.             whenever you ran it, and only work right if the Lattice C
  3314.             integrated environment had passed it a special code on the
  3315.             commandline when it ran.
  3316.  
  3317.             Such a demo version would give the user a reasonable chance
  3318.             to see the program and decide if they like it or not, but
  3319.             without making the demo version useful in its own right.
  3320.  
  3321.             So now a user sees the demo version and says "Wow, this looks
  3322.             pretty cool, and I'd like to buy the real thing." So they
  3323.             call up the publisher, which would be Oregon Research here in
  3324.             North America, or HISOFT in the U.K. and Europe, and they say
  3325.             "I have the Atari Developer CDROM and I want to purchase
  3326.             Lattice C".
  3327.  
  3328.             At this point, the publisher would take down the user's
  3329.             credit card number, and say "What's the serial number for
  3330.             your CDROM?" and the user would tell them, and then they
  3331.             would be given a special password that can be used to install
  3332.             a fully working version of the program onto their hard disk
  3333.             from the CDROM.  Some documentation would be included online,
  3334.             and the user would get a regular set of manuals in the mail a
  3335.             few days later.
  3336.  
  3337.             This is good for the user:  he gets to try out the software
  3338.             before he buys it.
  3339.  
  3340.             This is good for the publisher:  you save some money because
  3341.             you don't have to pay for fancy packaging, floppy disks, or
  3342.             even for manuals if you can manage to get it all in online
  3343.             form.  You can sell the password at a discount compared with
  3344.             the regular price, and still make more per package than you
  3345.             normally do (since there is no distributor or dealer discount
  3346.             involved).
  3347.  
  3348.             This is good for the user:  he gets to save a little money
  3349.             and gets to install the software from CDROM instead of having
  3350.             to do it from floppy disks.
  3351.  
  3352.             This is good for the publisher: You've got direct advertising
  3353.             of the most effective kind aimed at the users who are going to
  3354.             be most interested in this kind of product.
  3355.  
  3356.  
  3357.      How does it work?  Will it be secure?
  3358.  
  3359.             Each CDROM will come with a floppy disk that is serialized.
  3360.             Included on this disk will be an installation program shell
  3361.             that will be used to install the locked software after a user
  3362.             has purchased the password.  This will be something that
  3363.             Atari will put together that works as follows:
  3364.  
  3365.             The user will run the shell, and their serial number will be
  3366.             displayed on screen.  They'll give this number to the
  3367.             publisher, and the publisher will use a special program or
  3368.             spreadsheet or otherwise figure out what the password needs
  3369.             to be, and give the user this password.
  3370.  
  3371.             Now the user can tell the installation shell what they want
  3372.             to install.  They'll point at the desired item and then the
  3373.             shell will execute an installation program that the publisher
  3374.             will create.  The CDROM serial number will be given to this
  3375.             installation program.  Then the publisher's install program
  3376.             will get the password from the user and combine it with the
  3377.             CDROM serial number to generate a decryption code.  Then the
  3378.             install program will use this code to decode and install the
  3379.             program.
  3380.  
  3381.             There's more detail here than I'm giving, but I'd rather
  3382.             discuss it only with those developers who are making a
  3383.             submission.  I think the basic idea that's important to get
  3384.             across is that it will be at least as secure as your basic
  3385.             floppy disk release.  Plus, the resulting installed programs
  3386.             can be marked in such a way that you'd be able to figure out
  3387.             the serial number from the CDROM they were installed from.
  3388.  
  3389.             Time permitting, there will probably be an Atari supplied
  3390.             installation program that is capable of working in this
  3391.             fashion, and it will be made available to those developers
  3392.             who are interested.
  3393.  
  3394.  ===========================================================================
  3395.  
  3396.  For the most part, we would like to avoid the use of file-compression
  3397.  utilities such as ARC, LHARC, ZOO, or ZIP.  We would prefer to have
  3398.  files on the CDROM in an uncompressed format that is ready to use.
  3399.  (The encrypted fully working versions of commercial software would be
  3400.  an exception here.)
  3401.  
  3402.  However, if we have so many submissions that we run out of room, some
  3403.  material may be placed onto the disc in an archived format.  We plan to
  3404.  include the various file compression utilities on the disc, however, so
  3405.  the user will be able to decompress anything on the disc without needing
  3406.  to get anything like a decompression program from some other source.
  3407.  
  3408.  ===========================================================================
  3409.  
  3410.  Please keep in mind that this is a developer-oriented CDROM, not aimed
  3411.  at the average end-user.  There will probably be some sharp edges
  3412.  to watch out for, although we'll try to make everything as easy to
  3413.  figure out and use as possible.
  3414.  
  3415.  If you want to submit an encrypted version of your software, please
  3416.  contact me AS SOON AS POSSIBLE so that we can get things worked out as
  3417.  early as possible.
  3418.  
  3419.  In order to be included on the initial release of the disc, submissions
  3420.  must be received before the deadlines given below.  Submissions made
  3421.  after the deadlines will be included if possible, but will most likely
  3422.  be held over for the next update of the disc.
  3423.  
  3424.  The deadline for all submissions except encrypted versions of commercial
  3425.  programs is August 7.  The deadline for encrypted versions of working
  3426.  programs is August 21.  The CDROM will be going to production
  3427.  approximately the first week of September.
  3428.  
  3429.  If there is some special reason you cannot make either deadline, please
  3430.  contact me as soon as possible so that we can make special arrangements
  3431.  if possible.
  3432.  
  3433.  Your Submissions Are Welcome!
  3434.  
  3435.  Send submissions, questions, comments, etc. to Mike Fulton at:
  3436.  
  3437.  
  3438.  Mailing Address:                EMAIL:
  3439.  
  3440.  Atari Corp.                     GEnie = MIKE-FULTON
  3441.  Attn: Mike Fulton               Delphi = ATARITECH
  3442.  1196 Borregas Ave.              Compuserve = 75300,1141
  3443.  Sunnyvale, CA  94089            Internet = 75300.1141@compuserve.com
  3444.  
  3445.                                  Atari BBS (408) 745-2196 (Log on with
  3446.                                  name of "Atari Dev1" and use "DEVONE"
  3447.                                  for password, send email to "Mike
  3448.                                  Fulton".  You won't be able to read
  3449.                                  messages or download files with this
  3450.                                  account, but you can upload and send me
  3451.                                  email.)
  3452.  
  3453.  
  3454. /************************************************************************/
  3455.                    Sources of Information (References)
  3456.  
  3457.                  Books, Magazines and Company Information
  3458. /************************************************************************/
  3459.  
  3460. book: C-manship Complete
  3461.       by Clayton Walnum
  3462.  
  3463. Taylor Ridge Books
  3464. PO BOX 48
  3465. Manchester, Connecticut 06040
  3466. USA
  3467. (203)-643-9673 (voice)
  3468.  
  3469.  
  3470. book: The C Programming Language (2nd edition, ANSI C)
  3471.       by Brian Kernighan and Dennis Ritche
  3472.       ISBN 0-13-110362-8
  3473.  
  3474. book: The Standard C Library
  3475.       by P.J. Plauger
  3476.       ISBN 0-13-131509-9
  3477.  
  3478. Prentice Hall
  3479. Englewood Cliffs, New Jersey 07632
  3480. USA
  3481.  
  3482.  
  3483.  
  3484. /***********************************************************************/
  3485.                              POST INCREMENT
  3486.               (what is coming up in the next installment)
  3487. /***********************************************************************/
  3488.  
  3489. We are always looking for new articles, tricks, questions, tips and
  3490. suggestions related to programming on the Atari.  We are also looking for
  3491. problems/solutions for/to the Brain Stem Rotator.
  3492.  
  3493. * More on Advanced Computing using FLEX
  3494. * Object Oriented Programming
  3495. * Brain Stem Rotator
  3496. * Developer Tool updates
  3497.  
  3498. The type of articles we are looking for are anything programming related.
  3499. STOS, dBMAN, C, Assembly, BASIC, Pascal, Lex, YACC, etc, etc.  This is of
  3500. course a small list.
  3501.  
  3502. Letters and comments are always welcome!  And if you have a better
  3503. technique for solving a problem we want to hear from you.  If one has
  3504. a suggestion on a particular topic that he/she would like covered please
  3505. send it to the editor.
  3506.  
  3507. Developers [Worldwide] send press releases about your products as well.
  3508. We want everyone to know about the newest developer tools available.
  3509.  
  3510.  
  3511.  
  3512. /************************************************************************/
  3513.                               LEGAL NOTES
  3514. /************************************************************************/
  3515.  
  3516. Articles and letters in Atari Explorer Online Programmers' Journal
  3517. (AEO-PJ) represent the views of the authors and do not necessarily
  3518. reflect those of the publisher.
  3519.  
  3520. Note all code and listings in Atari Explorer Online Programmers' Journal
  3521. (AEO-PJ) appear "as is," and AEO-PJ makes no guarantee or warranty of
  3522. their quality, performance, accuracy, or suitability for any particular
  3523. purpose.  AEO-PJ assumes no responsibility or liability to any person or
  3524. entity with respect to any damage caused or alleged to be caused by their
  3525. use.
  3526.  
  3527. Material published in this issue may be reprinted under the following
  3528. terms only: articles must remain unedited and include the issue number
  3529. and author at the top of each article reprinted. Reprint permission is
  3530. granted, unless otherwise noted at the beginning of the article, to
  3531. registered Atari user groups and not for profit publications.
  3532.  
  3533. /************************************************************************/
  3534.