[futurebasic] RE: [FB] [FB5] Runtime Error mesages to include filename?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2009 : Group Archive : Group : All Groups

From: "Edwards, Waverly" <Waverly.Edwards@...>
Date: Mon, 22 Jun 2009 09:43:33 -0500
One thing that may be a stumbling block is not just knowing where a
stop occurred but how it got there.  Programs I've written in the past
would have a central location for an alert which would leave me without
a means of knowing specifically which function called the stop *unless*
I encoded it in the calling function.  Instead of having STOP messages
sprinkled throughout my program, I would have one stop that could be 
called from anywhere within my program.  If you do this, you will need
to know who called the stop not just where the stop occurred.

Just food for thought.


W.


local fn raiseAnAlert( alertType as long, msg as string, callerInfo as string )

  select alertType 
       case _informational
          ...
       case _warning
          ...
       case _fatal
           stop msg + " @ " + callerInfo
  end select

end fn


local fn someFunction
  fn raiseAnAlert( _fatal, "something fatal occurred", callerInfoKnownByCompiler )
end fn


-----Original Message-----
From: Robert Purves [mailto:listrp@...] 
Sent: Sunday, June 21, 2009 7:50 PM
To: futurebasic@...
Subject: Re: [FB] [FB5] Runtime Error mesages to include filename?


andy@... wrote:

>> array(101) = 0 // array_A[ChkBounds( 101, 100, 3 )] = 0;
>>

>> I agree it would be helpful to have the source filename shown, and   
>> will investigate whether ChkBounds() can be extended to include  
>> this information without unacceptable code bloat or slowdown.
>
>  If you can add the filename (and array checking is a switch on/off  
> function, then I think it would be good for the target community (as  
> well as me!)

The Array Bounds Error alert in the next release of FBtoC will show  
the source file, for example:
   At line 3 of MyTestFile.bas

The new translation of an array reference with bounds checking turned  
on in FBtoC preferences looks like this:
array(101) = 0 // array_A[ChkBounds( 101, 100, 3,  
"\pMyTestFile.bas" )] = 0;


> I appreciate that the old FB debugger "had to go" - are you reusing  
> the old TRON/TROFF statements for anything?

tron/troff etc are ignored by FBtoC.

Robert P.

--
To unsubscribe, send ANY message to: futurebasic-unsubscribe@...