[futurebasic] More XREF Questions

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1998 : Group Archive : Group : All Groups

From: CaverDave@...
Date: Sat, 21 Nov 1998 23:31:59 EST
   A few more questions about how XREF's actually work... To see if I can find
the source of the problem I'm having with my program.  Can I use an XREF'ed
array to hold Handle Addresses for other XREF'ed Arrays?

   Specifically, can I do this in FB and expect it to work?  Every time?

(some code missing)
(Got Address For Another Handle/Array)
(Use This Address As Another Array)

   I am XREF'ing a Handle (at gCLSLIST&) to get the array CLSLIST&(), which
holds the addresses of other Handles which can then be XREF'ed.  In the case
above, I get element LOOP% of the 1st array.  This is the address of a Handle,
which I then XREF to get a 2nd Array called STATLIST%().
   The reason I ask is that, although the code seems to work, the debugger
does not see the arrays properly.  If I use the debugger to show the contents
of the 2nd array, it shows only bogus (and unchanging) values.  Tracking local
vars in the code, however, shows that the correct values are being extracted
from (and also entered into) the array.  The overall problem might be a lot
easier to locate if the debugger would display the correct values for my
XREF'ed arrays.
   I thought that since the debugger doesn't see the arrays properly, perhaps
the compiler also has some trouble from time to time?  The code seems to work
(in many different LOCAL FN's), but maybe the compiler glitches its
interpretation of my XREF'ed arrays from time to time as well?

   I also assume that XREF@ can do multi-dimensional arrays?  This particular
XREF-ed array is also spread throughout various routines in my program.


   The idea is that each array element N% can have 8 values (#0-#7).  The
constant _CPMAX is large and is never exceeded by the actual size of the data,
nor does the size of the data exceed the size of the Handle allocated to the
array.  The array appears to work properly, but perhaps the compiler gets
confused with it under some circumstances and reads/writes data to the wrong
location?  This array OFTEN gets partially trashed (partially means every or
every other LINKNUM%=1 element gets a bogus value).  There appears to be a lot
of structure to the data corruption, at least to this array anyway).  Even so,
corruption of this data array sometimes appears to occur during routines that
neither read or write anything to the array.  I put in data in the array in
one routine, then another routine checks the data in the array (and it's
fine), then I do something that does not involve the array at all, then I
check the array again (with the same routine as before) and some of the data
has been corrupted.  It's strange... very strange.  Like the compiler (or
programmer?) is getting very very confused about what's going on.

   I have tried a lot of things to get my program running smoothly.  I may be
grasping at straws here, trying to find problems with either FB or my
implimentation of it.  Even so, I've poured over the code for days now and
there's nothing left to grasp at but straws like these.  It could still be a
typo or logic error on my part, but if so, I sure can't find it.

David Herron