slang-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] err.line not set for try (err) on stack underflow


SANGOI DINO <SANGOID@xxxxxxxxxxxxxxxxx> wrote:
>While writing a script for SLang 2 using try/catch exception handling, I've
>found a small glitch: the exception object does not contains line
>information for some stack underflow errors.

Fortunately it is not a show-stopper and was easy to fix.  Thanks,
--John

--- slang-pre2-r8/src/slang.c	Mon Apr 18 14:03:23 2005
+++ slang.c	Mon Apr 18 18:11:10 2005
@@ -275,7 +275,7 @@
    (((t) < 256) ? Is_Arith_Type_Array[t] : 0)
 
 static void do_traceback (char *);
-static void do_function_traceback (Function_Header_Type *);
+static void do_function_traceback (Function_Header_Type *, unsigned int);
 
 static int init_interpreter (void);
 
@@ -3029,7 +3029,7 @@
 
    if (IS_SLANG_ERROR)
      {
-	do_function_traceback (header);
+	do_function_traceback (header, linenum);
 #if SLANG_HAS_BOSEOS && SLANG_HAS_DEBUGGER_SUPPORT
 	/* (void) _pSLcall_debug_hook (); */
 #endif
@@ -3070,7 +3070,7 @@
      _pSLerr_traceback_msg ("Traceback: %s\n", message);
 }
 
-static void do_function_traceback (Function_Header_Type *header)
+static void do_function_traceback (Function_Header_Type *header, unsigned int linenum)
 {
    unsigned int nlocals;
    char *s;
@@ -3082,7 +3082,7 @@
      return;
 
    /* Doing this will allow line number errors in recursive functions to be reported */
-   _pSLerr_set_line_info (header->file, -1, "");
+   _pSLerr_set_line_info (header->file, (int)linenum, "");
 
    if ((SLang_Traceback < 0)
        || (0 == (nlocals = header->nlocals))

_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]