EXECUTE / ON_ERROR problem, please try this test program. [message #2427] |
Fri, 01 July 1994 02:35 |
robijn
Messages: 18 Registered: June 1994
|
Junior Member |
|
|
Hello,
Recently I stumbled upon a problem with IDL's EXECUTE routine
in combination with ON_ERROR. I asked our CreaSo (who sold us the
IDL license) what was happening, but it turned out to be a very
difficult problem to crack. Now RSI is involved as well. Apparently
the exact behaviour depends strongly on the IDL version and platform;
the people at RSI get different results from us. If you have a brief
moment, please run the program at the end of this message. I've already
got the results for IDL 3.5.1 on IBM AIX, Sun Sparc and MS Windows 3.1
machines.
The problem is that the EXECUTE routine does not properly handle
an 'undefined variable' error. The routine should return zero because
an error has occured, but instead returns -16657 on AIX and 1 on Sun
Sparc and MS Windows platforms. Even worse, when you tell IDL that
it should continue after the error, it does so until it is back in the
WIDGET_EVENT routine and then stops, i.e., displays the prompt.
Something weird is going on...
Frank
---
_____ ____
/ / / Frank Robijn Internet: Robijn@Strw.LeidenUniv.NL
/___ /___/ Sterrewacht Leiden Bitnet: Robijn@HLERUL51
/ / \ Phone (31) 71 275841 Local: Robijn@HL628
/ / \ Fax : (31) 71 275819 Snail: P.O.Box 9513, 2300 RA Leiden,
The Netherlands
Here is the test program:
---- snip ---- snip ---- snip ---- snip ---- snip ---- snip ---- snip ----
;-----------------------------------------------------------
;
; Test program to show bug in IDL's EXECUTE
;
;-----------------------------------------------------------
;-----------------------------------------------------------
; XProc_Event is the event handling procedure for XProc
;
PRO XProc_Event, Event
WIDGET_CONTROL, Event.ID, GET_VALUE=Val
if (Val EQ "Exit") then WIDGET_CONTROL, Event.Top, /DESTROY
; The only events that arrive here are caused by pressing the
; 'Press Me' button. Now generate an error...
On_Error, 3 ; Continue when an error occurs.
; Don't worry, it won't happen.
print, 'Here is IDL complaining about an undefined variable:'
print
x = 0
Status = EXECUTE ('x=UndefinedVariable')
; This is what we want to know:
print
print,'Please mail the following information to Robijn@Strw.LeidenUniv.NL:'
print
print, 'IDL Version ' + !Version.Release + ' (' + !Version.Arch + ' ' + $
!Version.OS + ')'
print, 'Status = ', Status
print, 'Also tell me whether the IDL prompt appears now.'
print, '(You can remove the window by typing WIDGET_CONTROL, /RESET)'
print, 'Thank you!'
print
END
;-----------------------------------------------------------
; XProc is a procedure that sets up a simple widget
; application with a single button
;
PRO Xproc
top = WIDGET_BASE (/COLUMN) ; The base for the application
btn = WIDGET_BUTTON (top, VALUE='Press Me') ; The button
btn = WIDGET_BUTTON (top, VALUE='Exit') ; The Exit button
WIDGET_CONTROL, top, /REAL ; Realize the widgets
XMANAGER, 'XProc', top ; Start XMANAGER to manage the widgets.
END
|
|
|