Make your own free website on Tripod.com
This file explains, usually via sample code, some bugs that exist in
this release of Regina. The smaller this file the better!
Outstanding bugs are first; fixed ones at the end of this file.

/*--------------------------------------------------------------------
 * INTERPRET "return" does not work correctly. If a value is returned
 * it does work correctly.
 * Reported by: Paul G. Barnett
 * Fixed by:
 * Fixed in:
 */
Interpret "Return"
Say "should not get here!"
Return 1

/*--------------------------------------------------------------------
 * LINES() BIF on transient streams return 1 when really at EOF
 * Run program below as:
 * regina test.rex BUGS
 * and as
 * cat BUGS | regina test.rex
 * Reported by: Mark Hessling
 * Fixed by:
 * Fixed in:
 */
/* test.rex */
Parse Arg fn
numlines = 0
Do While(Lines(fn) > 0)
   line = Linein(fn)
   numlines = numlines + 1
End
Say numlines 'in file'

/*--------------------------------------------------------------------
 * Need to fix API call RexxVariablePool() to handle RXSHV_FETCH, RXSHV_SET
 * and RXSHV_DROPV correctly.  They currently behave the same way as
 * RXSHV_SYFET, RXSHV_SYSET and RXSHV_SYDRO respectively. ie the variables
 * are treated symbolically rather than explicitly.
 * Reported by: Mark Hessling
 * Fixed by:
 * Fixed in:
 */

/*--------------------------------------------------------------------
 * Calling external programs with parameters fails with syntax error.
 * Reported by: ???
 * Fixed by:
 * Fixed in:
 */
myargs = 'arg1 arg2'
Call "myprog" myargs /* syntax error */
Call "myprog"myargs  /* works */

/*--------------------------------------------------------------------
 * Regina appears to read complete data files into memory in some 
 * operations.  More details to be specified.
 * Reported by: ???
 * Fixed by:
 * Fixed in:
 */

/*--------------------------------------------------------------------
 * Call fred'1234' doesn't call the subroutine fred1234
 * Reported by: Dennis Bareis
 * Fixed by:
 * Fixed in:
 */

Call fred'1234'
Return

fred1234:
Return

/*--------------------------------------------------------------------
 * Clauses in the Interpret command are not traced correctly.
 * Reported by: Dennis Bareis
 * Fixed by:
 * Fixed in:
 */

======================================================================
============================= FIXED ==================================
======================================================================

/*--------------------------------------------------------------------
 * Subroutines cannot have leading numerics in their name.
 * Reported by: Frank M. Ramaekers Jr.
 * Fixed by:    Mark Hessling
 * Fixed in:    0.08e
 */
Say 'starting...'
rc = 1000_my_proc( "value" )
Return

1000_my_proc: Procedure
Parse Arg parm .
Say parm
Return 0

/*--------------------------------------------------------------------
 * Calling CHAROUT with the newline character, '0a'x, would result in
 * a CR and LF being output. This only happens under DOS, OS/2 and 
 * Win32 platforms.
 * Reported by: Dennis Bareis
 * Fixed by:    Mark Hessling
 * Fixed in:    0.08e
 */
newl = '0a'x
Call charout "myfile", "Line 1" || newl
Return

/*--------------------------------------------------------------------
 * Line continuation character; ',' followed by CRLF in source file
 * would give syntax error.
 * Reported by: Florian Grosse-Coosmann
 * Fixed by:    Mark Hessling
 * Fixed in:    0.08e
 */
Say 'Hello', /* line ends in CRLF pair */
    'world'
Return

/*--------------------------------------------------------------------
 * The value of the last token parsed with PARSE contains incorrect
 * leading space(s).
 * Reported by: Dennis Bareis
 * Fixed by:    Florian Grosse-Coosmann
 * Fixed in:    0.08f
 */
a = 'one  two  three'
Parse Var a one two three
Say '<' || three || '>'

/*--------------------------------------------------------------------
 * The value returned by CHARS BIF was incorrect especially after a
 * LINEIN call.  The result is the example following would never end.
 * Reported by: Yuri Shemanin
 * Fixed by:    Yuri Shemanin
 * Fixed in:    0.08f
 */
f = 'junk'
Do While Chars(f) <> 0
  l = Linein(f)
End

/*--------------------------------------------------------------------
 * On some platforms, if operating system command redirection was
 * done using >FIFO, and the current directory was not writeable by
 * the user, the command would fail. The cause is that the tmpnam()
 * C library function is broken on several compilers.
 * Added workaround to use environment variables, TMP, TEMP or TMPDIR.
 * Reported by: ???
 * Fixed by:    Mark Hessling
 * Fixed in:    0.08f
 */

/*--------------------------------------------------------------------
 * On platforms that did not have a C library function, alloca()
 * Regina would leak memory.  This has now been fixed by inclusion
 * of our own alloca() function if one doesn't exist.
 * Reported by: Mark Hessling
 * Fixed by:    Mark Hessling
 * Fixed in:    0.08f
 */

/*--------------------------------------------------------------------
 * A bug in the Win95/98 command processor results in any call to
 * an operating system command ALWAYS return 0, even though the
 * command fails.
 * This change attempts to circumvent this bug, but it can't in all
 * circumstances.  If the operating system command called is an
 * executable file, and there is no output/input redirection, then
 * the return code from the executable program will be returned. Any
 * internal COMMAND.COM command, such as COPY, will ALWAYS return 0;
 * there is no way around this until M$ fix there COMMAND.COM.
 * If you use JP Software's 4DOS for NT, then you will have no problems
 * as it correctly returns the error from the internal command.
 * Reported by: Michael Sundermann
 * Fixed by:    Michael Sundermann
 * Fixed in:    0.08f
 */

/*--------------------------------------------------------------------
 * The result of the expression (0 = zero) should be 1, but Regina
 * returns 0
 * Reported by: Dan Hofferth
 * Fixed by: Florian Grosse-Coosman
 * Fixed in: 0.08f
 */
zero = 0.000
say ( 0 = zero )  /* should say 1, but 0 */

/*--------------------------------------------------------------------
 * A numeric variable "exposed" by a procedure and subsequently used
 * in a loop within the procedure that exposed it, gets an erroneous
 * value.
 * Reported by: rick@emma.panam.wimsey.com
 * Fixed by:    Florian Grosse-Coosmann
 * Fixed in:    0.08f
 */
num = 0
Call my_proc
Say 'num = ' num ';should be 6'
Return

my_proc: Procedure Expose num
Say 'num = ' num ';should be 0'
Do 3
   num = num + 1
End
Say 'num = ' num ';should be 3'
num = num + 3
Say 'num = ' num ';should be 6'
Return

/*--------------------------------------------------------------------
 * An error with dropping variables...
 * Reported by: Dennis Bareis
 * Fixed by:    Mark Hessling
 * Fixed in:    0.08f
 */
call SaveInfo  "Fred", "FredsValue";
call SaveInfo  "Fred", "FredsValue2";
call HandleUndefCommand "Fred";
call SaveInfo  "Fred", "FredsValue3";
say 'Passed!!!';
exit(0);

HandleUndefCommand:
   SavedAs = "Define." || arg(1);
   say '';
   say '0.DROPPING "' || SavedAs || '"';
   if  symbol(SavedAs) = 'VAR' then
       drop(SavedAs)
   return;
SaveInfo:
   /*--- Check if variable previously existed ------------------------*/
   say '';
   say '0.SETTING - ' || arg(1) || ' to "' || arg(2) || '"';
   SavedAs = "Define." || arg(1);
   if  symbol(SavedAs) = 'VAR' then
       say '1.Already Existed';
   else
       say '1.New info';

   /*--- Save info ---------------------------------------------------*/
   ExecutingCmd = SavedAs || ' = arg(2)'
   say '2.Executing: "' || ExecutingCmd || '"'
   interpret ExecutingCmd;

   /*--- Check variable again! ---------------------------------------*/
   if  symbol(SavedAs) = 'VAR' then
   do
       interpret 'ItsValue = ' || SavedAs;
       say '3.Variable exists, value = "' || ItsValue || '"'
   end
   else
   do
       say '3.JUST SET VAR YET - Variable does not exist - WRONG!';
       exit(1);
   end;
   return;

               ******************** 
OUTPUT (note Define.FRED seems to exist TWICE in multiple cases):

0.SETTING - Fred to "FredsValue"
1.New info
2.Executing: "Define.Fred = arg(2)"
3.Variable exists, value = "FredsValue"

0.SETTING - Fred to "FredsValue2"
1.Already Existed
2.Executing: "Define.Fred = arg(2)"
3.Variable exists, value = "FredsValue2"

0.DROPPING "Define.Fred"

0.SETTING - Fred to "FredsValue3"
1.New info
2.Executing: "Define.Fred = arg(2)"
3.JUST SET VAR YET - Variable does not exist - WRONG!

               ^^^^^^^^^^^^^^^^^^^^
Dumping variables to 
   Variables from bin no 0
   >>> Variable: EXECUTINGCMD Value: [Define.Fred = arg(2)]
   Variables from bin no 107
   >>> Stem    : Define. Default: []  Values:
      Sub-bin no 161
      >>> Tail: FRED Value: []
   >>> Stem    : DEFINE. Default: []  Values:
      Sub-bin no 161
      >>> Tail: FRED Value: [FredsValue3]
   Variables from bin no 109
   >>> Variable: ITSVALUE Value: [FredsValue2]
   Variables from bin no 175
   >>> Variable: SIGL Value: [8]
   Variables from bin no 231
   >>> Variable: SAVEDAS Value: [Define.Fred]

               ^^^^^^^^^^^^^^^^^^^^

/*--------------------------------------------------------------------
 * Allow "stderr" to be used to refer to stderr in STREAM BIF.
 * Reported by: Dennis Bareis
 * Fixed by:    Mark Hessling
 * Fixed in:    0.08f
 */
rc = Stream('stderr', 'C', 'QUERY EXISTS')

/*--------------------------------------------------------------------
 * The internal variable SIGL gets updated prematurely.
 * Reported by: Dennis Bareis
 * Fixed by:    Florian Grosse-Coosmann
 * Fixed in:    0.08f
 */

Call Alabel
Return

ALabel:
Call AnotherLabel SIGL
Return

AnotherLabel:
Parse Arg lineo
Say lineno
Return

/*--------------------------------------------------------------------
 * A syntax error in a Rexx script passed to the RexxStart() API via
 * the "instore" option, will exit the program, rather than return an
 * error.
 * Reported by: Mark Hessling
 * Fixed by:    Florian Grosse-Coosmann
 * Fixed in:    0.08f
 */

/*--------------------------------------------------------------------
 * The VALUE() BIF would not set values of compound variables correctly
 * if the variable is specified in lower case.
 * Reported by: Jeff Parlant and Dennis Bareis
 * Fixed by:    Mark Hessling
 * Fixed in:    0.08g
 */

stemname = 'foo.'
foo.0 = 1
foo.1 = 'something'
call func
say foo.0
say foo.1
exit 0
    
func: procedure expose stemname (stemname)
/* trace ?i */
do i = 1 to value(stemname||0)
   r = value(stemname||i,'something else')    
end
return 0

/*--------------------------------------------------------------------
 * The value of the last argument to a procedure when using the ARG() BIF
 * has an incorrect trailing space.
 * Reported by: Mark Hessling
 * Fixed by: Mark Hessling
 * Fixed in: 0.08g
 */

Call proc '123', '456'
Return

proc:
Say '<' || arg(1) || '>' /* displays <123>  */
Say '<' || arg(2) || '>' /* displays <456 > */
Return

/*--------------------------------------------------------------------
 * INTERPRET "return Func()" does not work correctly.
 * Reported by: Paul G. Barnett
 * Fixed by: Mark Hessling
 * Fixed in: 0.08g
 */
Interpret "Return F1()"
Say "should not get here!"
Return
F1: Procedure
Say "in F1"
Return 0

/*--------------------------------------------------------------------
 * File names in Regina are always case sensitive, even on non-Unix
 * platforms.  This can result in incorrect read/write pointers when
 * referencing a file by name with different case.
 * Reported by: Jackie Cooper
 * Fixed by: Mark Hessling
 * Fixed in: 0.08g
 */
myfile = 'abc'
myupperfile = 'ABC'
Call Lineout, myfile, 'Line1'
Call Lineout, myupperfile, 'Line2'
Call Lineout, myfile
numlines = 0
Do While(Lines(myfile)>0)
   numlines = numlines + 1
End
Say 'Should be 2 lines, but got only' numlines
Return