Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site caip.RUTGERS.EDU Path: utzoo!watmath!clyde!cbosgd!ihnp4!houxm!whuxl!whuxlm!akgua!gatech!ut-sally!im4u!caip!cosell From: cosell@BBN-PROPHET.ARPA Newsgroups: net.micro.amiga Subject: Trouble with new Mandelbrot program & and Bug in Lattice C 3.02 Message-ID: <964@caip.RUTGERS.EDU> Date: Sun, 12-Jan-86 16:39:10 EST Article-I.D.: caip.964 Posted: Sun Jan 12 16:39:10 1986 Date-Received: Tue, 14-Jan-86 05:28:33 EST Sender: daemon@caip.RUTGERS.EDU Organization: Rutgers Univ., New Brunswick, N.J. Lines: 64 From: Bernie Cosell I got the new, more-fancy-than-you-can-believe version of 'mand' up and running last night. There were a couple of things you should look out for: a) It sets up a library as an "IconBase *". That structure isn't defined anywhere, but if you just ignore the warning all is well. b) As promised in the official bug list, enumerated data types don't work and so the enum in workbench/workbench.h makes the compiler belly up and die. I edited the enum (WBObject, I think) to be a typedef to an int, and the #define'd all of the enum values. You then have to go through the rest of that file and change all of the "enum WBObject"s to be just "WBObject". c) Although I didn't see any bug reported that bit fields don't work, I kept getting diatnostics on (again) workbench/workbench.h about illegal fields. So I just commented out all of the UWORD ...:1;'s and put in a single "UBYTE WB_JUNK" to try to keep the size of the struct and the field alignment OK. Seemed to work. With those changes, the whole thing compiled up and seems to run fine. I did notice, though, that the presets didn't work: If I just typed "G" when the program started, I got an all-black screen. Some poking revealed the problem. In SetPresets (in mand.c), the code reads (correctly): start_r.f = -2.85; end_r.f = 2.85; start_i.f = -2.05; end_i.f = 2.05; Well ***THE C COMPILER MISCOMPILES THIS SEQUENCE OF STATEMENTS!!!*** All four variables end up getting set to -2.85!!! I tried a very simple test program: main () { float f; f = 1.5; printf ("%f (%f)\n", f, 1.5); f = 2.5; printf ("%f (%f)\n", f, 2.5); } The output is, unbelievably enough, 1.5 (1.5) 1.5 (2.5) I tried and tried and couldn't get the compiler to do the successive floating assignments correctly. I fixed this eventually by adding a function to mand.c: fl_assign (var, val) float *var, val; { *var = val; } and then I changed every assignment in SetPresets from things like start_i.f = -0.169450; to be fl_assign (&start_i.f, -0.169450) If you do this, the assignments work correctly and your presets will work. If anyone knows more about what this bug really is or if there is a less brutish way to finesse it, I'd be interested to hear about it. /Bernie ps, Thanks RJ!!!!! In addition to being a very neat program, it is, as you said, a veritable GOLD MINE of examples of how to do very fancy things with Intuition. There is a lot of studying and learning to be done!! /b pps, Why *are* the colors ordered GRB instead of RGB?? /b