Welcome, Guest. Please login or register.

Author Topic: Do i have more logic than my compiler?  (Read 1020 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show only replies by iamaboringperson
Do i have more logic than my compiler?
« on: July 19, 2003, 05:56:04 PM »
...or am i not reading the manual correctly?

ive been mucking around, setting up BOOPSI gadgets
i adjusted a program that worked fine, to make it a bit more efficient, and the new one would cause Intuition to freeze, or the gadgets would take a long time to render, and some would not render at all - i thought my code was fine

then i compared my code to the old code and noticed that basically the only difference between them was that the GA_Previous was pointing to the gadget currently being made using NewObject() !  this should not be, at least i think, strangly it works, and pointing it to the previous gadget only crashes the machine

basically i have an array of gadget pointers:
struct Gadget *mygads[32];

then i basically do this kind of thing:

mygads[0]=(struct Gadget *)NewObject(NULL,"buttongclass",,GA_Previous,mygads[0],TAG_DONE);
mygads[1]=(struct Gadget *)NewObject(NULL,"buttongclass",,GA_Previous,mygads[1],TAG_DONE);

that works! :-o

but [1] should point to
  • IMO!


is the compiler right? or should i be getting some more sleep :-?
 

Offline Kronos

  • Resident blue troll
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4017
    • Show only replies by Kronos
    • http://www.SteamDraw.de
Re: Do i have more logic than my compiler?
« Reply #1 on: July 19, 2003, 06:28:23 PM »
Hmmm
what happens if you leave out GA_Previous in the 1st call (there is no previous gadget,
so specifing one sounds a bit wrong) and make it
  • in the 2nd call ?


I just checked my own project, and this is what I did:

1. CreateContext() needed if you have GadTools-gadgets. This will create an empty/invisible gadget.

2. CreateGadget() with a pointer the one creted by CreateContext.

3. CreateGadget() with a pointer the one creted by in 2.

and so on.

Finally ad call AddGlist() with the one created in 2.

Should be the same with NewObject instead CreateGadget.
1. Make an announcment.
2. Wait a while.
3. Check if it can actually be done.
4. Wait for someone else to do it.
5. Start working on it while giving out hillarious progress-reports.
6. Deny that you have ever announced it
7. Blame someone else
 

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show only replies by iamaboringperson
Re: Do i have more logic than my compiler?
« Reply #2 on: July 19, 2003, 06:31:40 PM »
Quote
what happens if you leave out GA_Previous in the 1st call
sorry, yeah, i did leave it out in the first call, so the above example is not right
but in the many gadgets that i have created... they all point to themselves and that is the only way the program will work !
 

Offline Thomas

Re: Do i have more logic than my compiler?
« Reply #3 on: July 20, 2003, 09:11:48 AM »

In such a situation you should:

1. insert some prints between the NewObjects to check the pointers.

2. create and look at the assembler output.

The code with [1] = NewObject([0]) ist right. But your assumption that [1] should point to
  • is not. The GA_Previous tag inserts the new pointer into the NextGadget field of the given Gadget structure., so that after the call
  • points to [1] (it should at least).


Bye,
Thomas