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.

/*--------------------------------------------------------------------
 * The result of the expression (0 = zero) should be 1, but Regina
 * returns 0
 * Reported by: Dan Hofferth
 * Fixed by:
 * Fixed in:
 */
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:
 * Fixed in:
 */
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

/*--------------------------------------------------------------------
 * 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:
 * Fixed in:
 */

/*--------------------------------------------------------------------
 * An error with dropping variables...
 * Reported by: Dennis Bareis
 * Fixed by:
 * Fixed in:
 */
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 <stdout>
   Variables from bin no 0
   >>> Variable: EXECUTINGCMD Value: [Define.Fred = arg(2)]
   Variables from bin no 107
   >>> Stem    : Define. Default: [<none>]  Values:
      Sub-bin no 161
      >>> Tail: FRED Value: []
   >>> Stem    : DEFINE. Default: [<none>]  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]

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

======================================================================
============================= 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
