[comp.sys.amiga] Programmers Guide To The Amiga, Errata

rap@dana.UUCP (04/13/87)

Errata for Programmers' Guide To The Amiga, by Rob Peck, first printing
=======================================================================

Listing 2.6, mycdir.c 

	This is a do-nothing program that somehow got munged with
	portions of a program I posted to Usenet called fastdir.c.
	To make mycdir.c do "what it says it does" in the book, 
	simply delete the following lines:

	  extern struct FileHandle *Open();
	
	  struct FileHandle *myfile;

	  /* close the file */
	  Close(myfile);

	And delete ALL lines between:	
		/* open a file and thereby...
	and the line that says:		
		/* file via the handle */

	Change the last comment to read:

	/* and cleanup by unlocking any lock obtained from Lock().
	   Note: do NOT UnLock any lock obtained from CurrentDir.
		 This can make AmigaDOS forget that the disk exists
		 in the system.  Only locks obtained from Lock()
		 or DupLock() should be UnLock()'ed.
	*/
	
-----------------------
Listing 2.8, opta.c

	The book says "lists the CURRENT directory, just like 'dir opt a'"

	Replace the section:

		 main(argc,argv)
		 {
			(ALL of this part)
		 }

	with:
		main()
		{
			struct FileLock *oldlock;
			oldlock = Lock("",ACCESS_READ);
			if(oldlock != 0)
			{
				followthread(oldlock,0);
			}
			else
			{
				printf("cannot lock CURRENT dir\n");
			}
			printf("\n");
		}

	On page 35, listing 2.8, the line:

			printf(&m->fib_FileName[0]);

	should really be:

			printf("%ls", &m->fib_FileName[0]);

	But it works as originally written, though, because printf
	is looking at the filename area as though it is a format
	string.  So the absence of the %ls does not matter anyway.
	For a cleaner look with fewer questions, you might want
	to change it as shown here.
-------------------------
Listing 2.9

	is missing an underscore in the second to last line on the 
	bottom of page 35:

		printf("%ls",myinfo->fib_FileName[0]);
					^
					|_____ this is what got missed.

-------------------------
Listing 2.10

	I misinterpreted Mr.Rokiki's first name.  It is Tom, not Thomas.

	Also, when compiling with Aztec C, certain type declarations
	and casts must 	be made.  In Showdate, add the declaration lines:

		long n;
		int m,d,y;

	and the line that says: n -= 1461 * y/4;
	should read:            n -= 1461 * (long)y/4;

	This fix, instead of breaking in the year 2006, is good till 2100.
	Thanks, Tom, for the fixes.
-------------------------
Page 60, mid-page:  Setting a Signal Bit Directly.

	There are three references in this paragraph to SetSignal.
	ALL THREE should be changed to "Signal" rather than SetSignal.
	(Thanks to Carl Sassenrath, the creator of "Exec", for bringing
	 this to my attention)

------------------------
Page 295:  The audio program

	The final two sentences preceding listing 8.7 should be deleted.
	This example does NOT go directly to the hardware.

Page 296:  Listing 8.7

	An accidental duplication of three lines, and one of the
	duplicates is terribly munged.  If you simply remove
	the offending lines, that fixes the example.  The lines are:

	the FIRST time this
	line appears --->/* Create ports for replies from the device */

			 auReplyPort = CreatePort(0,0);
			 auLockPort  = CreatePoequest.io_Device;
						^
						|
						OUCH! what a mess.

---------------------------

There are a couple of instances where there are false leads
such as:

page 20... a reference to chapter 6 for more information
about the printer control codes (change the reference to 
"The Amiga ROM Kernel Manual ... has more information about
accessing the printer device directly.)

page 93 ... shows how to draw lines, circles, and boxes.  Delete
the reference to circles.  Most of the book was done with V1.1
and circles were not accessible in that earlier system code.

------------------------------
This set of errata is all I am aware of as of 4/12/87.  If you notice
anything more, please let me know.  

My address is DATAPATH, P.O. Box 1828, Los Gatos, Ca. 95031.

Thanks to all of you who have offered suggestions and corrections.


Rob Peck.		...hplabs!dana!rap