Anobium - 2021-04-05

This release candidate is NOT a normal few tweaks or changes.

This has the completion of two major changes

  1. A rewrite of the For-Next-Step handler.
  2. Revised Table with String support to improve handling.

Download Folder

https://sourceforge.net/projects/gcbasic/files/Release%20Candidates/

Please replace all previous RC releases asap and test your programs.


FOR-NEXT handler

The FOR-NEXT handler is a major improvement from the original code. However, in some case this will lead to code size increase and use of more temp variables.

When the code can use the old method - it will.

The use cases tested are extensive but we can never test enough. :-(

Test case example table (show below) - this is just one set of test cases for the use of constants.

Loop Variable Type Start Value End Value Step Value
Byte constant A byte constant A byte constant None specified - implies a byte value of 1
Word constant A byte constant A byte constant None specified - implies a byte value of 1
Long constant A byte constant A byte constant None specified - implies a byte value of 1
Byte constant A word constant A byte constant None specified - implies a byte value of 1
Word constant A long constant A byte constant None specified - implies a byte value of 1
Long constant A byte constant A byte constant None specified - implies a byte value of 1
Long constant A word constant A byte constant None specified - implies a byte value of 1
Long constant A long constant A byte constant None specified - implies a byte value of 1
Byte constant A byte constant A byte constant Byte Constant = 1
Word constant A byte constant A byte constant Byte Constant = 1
Long constant A byte constant A byte constant Byte Constant = 1
Byte constant A word constant A byte constant Byte Constant = 1
Word constant A long constant A byte constant Byte Constant = 1
Long constant A byte constant A byte constant Byte Constant = 1
Long constant A word constant A byte constant Byte Constant = 1
Long constant A long constant A byte constant Byte Constant = 1
Byte constant A byte constant A byte constant Byte Constant > 1
Word constant A byte constant A byte constant Byte Constant > 1
Long constant A byte constant A byte constant Byte Constant > 1
Byte constant A word constant A byte constant Byte Constant > 1
Word constant A long constant A byte constant Byte Constant > 1
Long constant A byte constant A byte constant Byte Constant > 1
Long constant A word constant A byte constant Byte Constant > 1
Long constant A long constant A byte constant Byte Constant > 1
Byte constant A byte constant A byte constant Byte Constant > 1
Word constant A byte constant A byte constant Byte Constant > 1
Long constant A byte constant A byte constant Byte Constant > 1
Byte constant A word constant A byte constant Byte Constant > 1
Word constant A long constant A byte constant Byte Constant > 1
Long constant A byte constant A byte constant Byte Constant > 1
Long constant A word constant A byte constant Byte Constant > 1
Long constant A long constant A byte constant Byte Constant > 1

There are many, many more test cases for loop variables for Start and End Values (where each of these variables can be Byte, Word, Integer and Long) and where the step value is as Byte, Word, Integer (positive and negative) and Long. And, of all these cases the Start Value > End Value or the Start Value < End Value. And, where the Step value is Zero (0).

I cannot test every case. This would require a mega test suite. So, you need to test.


Table Text#

The is new capability has been developed by ToniG. Thank you!

He has used the following program segment for testing - he will post more later but this program gives you an insight into the new Table Text capability.

'========== Test  TABLES ===============
' Disclaimer: This code segment may not include all possible case.

Table  Test1  ' String Table Chr delimited 
   "+ Menu Item 1    + Menu Item 2    + Menu Item 3    + Menu Item 4    + Menu Item 5" ' SUB1
   "+ Config1 Itm 1  + Config1 Itm 2  + Config1 Itm 3  + Config1 Itm 4  "  ' SUB2
   "+ Config2 Itm 1  + Config2 Itm 2  + Config2 Itm 3  + Config2 Itm 4  "  ' SUB3
   "+ DataLog Itm 1  + DataLog Itm 2  + DataLog Itm 3  "                   ' SUB4
   "+ Diag Itm 1     + Diag Itm 2     + Diag Itm 3     + Diag Itm 4     "  ' SUB5
   "+ Help Itm 1     + Help Itm 2     + Help Itm 3     + Help Itm 4     "  ' SUB6
End Table

Table  Test2  '  csv string lINES
   "Menu Item 1", "Menu Item 2", "Menu Item 3", "Menu Item 4", "Menu Item 5"' SUB1
   "Config1 Itm 1", "Config1 Itm 2", "Config1 Itm 3", "Config1 Itm 4"       ' SUB2
   "Config2 Itm 1", "Config2 Itm 2", "Config2 Itm 3", "Config2 Itm 4"       ' SUB3
   "DataLog Itm 1", "DataLog Itm 2", "DataLog Itm 3"                        ' SUB4
   "Diag Itm 1", "Diag Itm 2", "Diag Itm 3", "Diag Itm 4"                   ' SUB5
   "Help Itm 1", "Help Itm 2", "Help Itm 3", "Help Itm 4"                   ' SUB6
End Table

Table  Test3  '  Long String
"Menu Item 1Menu Item 2Menu Item 3Menu Item 4Menu Item 5Config1 Itm 1Config1 Itm 2Config1 Itm 3Config1 Itm 4Config2 Itm 1Config2 Itm 2Config2 Itm 3Config2 Itm 4DataLog Itm 1DataLog Itm 2DataLog Itm 3Diag Itm 1Diag Itm 2Diag Itm 3Diag Itm 4Help Itm 1Help Itm 2Help Itm 3Help Itm 4    enu Item 1Menu Item 2Menu Item 3Menu Item 4Menu Item 5Config1 Itm 1Config1 Itm 2Config1 Itm 3Config1 Itm 4Config2 Itm 1Config2 Itm 2Config2 Itm 3Config2 Itm 4DataLog Itm 1DataLog Itm 2DataLog Itm 3Diag Itm 1Diag Itm 2Diag Itm 3Diag Itm 4Help Itm 1Help Itm 2Help Itm 3Help Itm 4    Menu Item 1Menu Item 2Menu Item 3Menu Item 4Menu Item 5Config1 Itm 1Config1 Itm 2Config1 Itm 3Config1 Itm 4Config2 Itm 1Config2 Itm 2Config2 Itm 3Config2 Itm 4DataLog Itm 1DataLog Itm 2DataLog Itm 3Diag Itm 1Diag Itm 2Diag Itm 3Diag Itm 4Help Itm 1Help Itm 2Help Itm 3Help Itm 4    enu Item 1Menu Item 2Menu Item 3Menu Item 4Menu Item 5Config1 Itm 1Config1 Itm 2Config1 Itm 3Config1 Itm 4Config2 Itm 1Config2 Itm 2Config2 Itm 3Config2 Itm 4DataLog Itm 1DataLog Itm 2DataLog Itm 3Diag Itm 1Diag Itm 2Diag Itm 3Diag Itm 4Help Itm 1Help Itm 2Help Itm 3Help Itm 4    Menu Item 1Menu Item 2Menu Item 3Menu Item 4Menu Item 5Config1 Itm 1Config1 Itm 2Config1 Itm 3Config1 Itm 4Config2 Itm 1Config2 Itm 2Config2 Itm 3Config2 Itm 4DataLog Itm 1DataLog Itm 2DataLog Itm 3Diag Itm 1Diag Itm 2Diag Itm 3Diag Itm 4Help Itm 1Help Itm 2Help Itm 3Help Itm 4    enu Item 1Menu Item 2Menu Item 3Menu Item 4Menu Item 5Config1 Itm 1Config1 Itm 2Config1 Itm 3Config1 Itm 4Config2 Itm 1Config2 Itm 2Config2 Itm 3Config2 Itm 4DataLog Itm 1DataLog Itm 2DataLog Itm 3Diag Itm 1Diag Itm 2Diag Itm 3Diag Itm 4Help Itm 1Help Itm 2Help Itm 3Help Itm 4 Menu Item 1Menu Item 2Menu Item 3Menu Item 4Menu Item 5Config1 Itm 1Config1 Itm 2Config1 Itm 3Config1 Itm 4Config2 Itm 1Config2 Itm 2Config2 Itm 3Config2 Itm 4DataLog Itm 1DataLog Itm 2DataLog Itm 3Diag Itm 1Diag Itm 2Diag Itm 3Diag Itm 4Help Itm 1Help Itm 2Help Itm 3Help Itm 4    enu Item 1Menu Item 2Menu Item 3Menu Item 4Menu Item 5Config1 Itm 1Config1 Itm 2Config1 Itm 3Config1 Itm 4Config2 Itm 1Config2 Itm 2Config2 Itm 3Config2 Itm 4DataLog Itm 1DataLog Itm 2DataLog Itm 3Diag Itm 1Diag Itm 2Diag Itm 3Diag Itm 4Help Itm 1Help Itm 2Help Itm 3Help Itm 4    Menu Item 1Menu Item 2Menu Item 3Menu Item 4Menu Item 5Config1 Itm 1Config1 Itm 2Config1 Itm 3Config1 Itm 4Config2 Itm 1Config2 Itm 2Config2 Itm 3Config2 Itm 4DataLog Itm 1DataLog Itm 2DataLog Itm 3Diag Itm 1Diag Itm 2Diag Itm 3Diag Itm 4Help Itm 1Help Itm 2Help Itm 3Help Itm 4    enu Item 1Menu Item 2Menu Item 3Menu Item 4Menu Item 5Config1 Itm 1Config1 Itm 2Config1 Itm 3Config1 Itm 4Config2 Itm 1Config2 Itm 2Config2 Itm 3Config2 Itm 4DataLog Itm 1DataLog Itm 2DataLog Itm 3Diag Itm 1Diag Itm 2Diag Itm 3Diag Itm 4Help Itm 1Help Itm 2Help Itm 3Help Itm 4    Menu Item 1Menu Item 2Menu Item 3Menu Item 4Menu Item 5Config1 Itm 1Config1 Itm 2Config1 Itm 3Config1 Itm 4Config2 Itm 1Config2 Itm 2Config2 Itm 3Config2 Itm 4DataLog Itm 1DataLog Itm 2DataLog Itm 3Diag Itm 1Diag Itm 2Diag Itm 3Diag Itm 4Help Itm 1Help Itm 2Help Itm 3Help Itm 4    enu Item 1Menu Item 2Menu Item 3Menu Item 4Menu Item 5Config1 Itm 1Config1 Itm 2Config1 Itm 3Config1 Itm 4Config2 Itm 1Config2 Itm 2Config2 Itm 3Config2 Itm 4DataLog Itm 1DataLog Itm 2DataLog Itm 3Diag Itm 1Diag Itm 2Diag Itm 3Diag Itm 4Help Itm 1Help Itm 2Help Itm 3Help Itm 4  "
End Table

Table  Test4 Simple String list table
 "Menu Item1"
 "Menu Item2"
 "Menu Item3"
 "Menu Item4"
"Menu Item5"

End Table

Table  Test5 ' 1 simple string table
"ABCDEFG"

End Table


Table  Test6 '  DQuotes in string
"ABC""DEFG"
    "AB"CDE"FG"
""ABCDEFG""
End Table 


Table  Test7 ' Comma in string
"ABCD''EFG"
"ABC,DEF,G"
",ABCDEFG,"

End Table

Table  Test8 ' SQuotes in string
"ABC''DEFG"
"ABC'DEF'G"
"'ABCDEFG'"
End Table

Table  Test9 ' Chr(34) in comments
"ABCDEFG"  ' This is"quoted" 
End Table

Table  Test10

 "Item 1"
 "Item 2"
 "Item 3"
 "Item 4"
 "Item 5"
End Table

Table  Test11  '  Short csv string lINE
   "Menu1", "Menu2", "Menu3"  ' SUB1
End Table

Table  Test12 ' SQuote in single string
"ABC'DEF'G\0"

End Table

Table  Test13  '  Mixed 
   "ABCD1", "ABCD2", "ABCD3"  ' SUB1
   "AAAAA"
   "BBBBB"
    0
   1
   2
   3
   4
   5, 6, 7, 8, 9, 10
End Table

Table  Test14  '  Mixed CS
   "ABCD1","ABCD2" ,"ABCD3"      ,    "ABCD4" 
End Table

Table  Test15  ' Valid string lINE (one long string)
   "Menu1" "Menu2" "Menu3"  ' SUB1
End Table


'================= ESC Code Tables ===================

Table  Test2.1  ' Table with ESC codes
   'Comment line
   "Menu Item \"1\"\0"
   "Menu Item \"2\"\0"
   "Menu Item 3\0"
   "Menu Item 4\0"
   "Menu Item DropDown 5\0"  ' SUB1
   "Config1 Item 1\0", "Config1 Item 2\0", "Config1 Item 3\0", "Config1 Item 4\0"         ' SUB2
   "DataLog Item 1\0", "DataLog Item 2\0", "DataLog Item 3\0"                          ' SUB3
   "Diag Item 1\0", "Diag Item 2\0", "Diag Item 3\0", "Diag Item 4\0"                      ' SUB4
   "Help Item 1\0", "Help Item 2\0", "Help Item 3\0" , "Help Item 4\0"   'SUB5
End Table

Table  Test2.2 ' Direct escape code

"\&065\&066\&067\&068\&255"  ' ABCD

"\a\l\r\t \\  \" \'"   ' Bel, CR, LF, Tab, Space, BackSlash, Space Space, Dquote, Space, Squote

End Table


'============== Numeric  Tables ======================

Table  Test4.1 ' Item 1 2 3 4 5
73, 116, 101, 109, 32, 49
73, 116, 101, 109, 32, 50
73, 116, 101, 109, 32, 51
73, 116, 101, 109, 32, 52
73, 116, 101, 109, 32, 53
End Table

'Table String Pointers (error value)
Table Test4.2
1, 5, 7, 5, 13, 5, 19, 5, 25, 5, 31, -32
End Table

Table  Test4.3  ' Decimal CSV Data Table 
  67, 79, 78, 70, 73, 71

End Table


Table  Test4.4 ' Decimal list Table
1   ' Line1
2   ' Line2
3
4
5
End Table


'=============== Error Tables =====================
'   These should produce an error

Table  Test3.1 ' Incorrectly terminated comma
"ABCDEFG\0',", ; "123"  ' Err1
"ABCDE",- "FGHIJ"
End Table

' Table Format errors
Table Test3.2
"ABCDEFG\0',", ; "111"   '  Err2
"ABCDEFG\0',", ' "222"   ' Err3
"ABCDEFG\0',", k "333"   ' Err4
"ABCDEFG\0',", - "444"   ' Err5
"
End Table

Table Test3.3 ' Reserved code error (\&255)
"\&065\&066\&067\&068\&255"  ' Err6

End Table

Table  Test3.4 ' No Closing Quote
"ABC"DEFG"
"ABCDEFG"  ' inComment1 "quoted
"ABCDEFG"  ' inComment2 quoted"
"ABCDEFG"  ' inComment2 quot"ed
End Table

'------------------------------------
' Note: In test app, error catch does not halt processing.
'       All lines passed to output.
'------------------------------------

' The following should be outside the scope of 'Sub Tablestring' error catch ?

'  No Table name (no space after)
Table
"ABCDEFG"
End Table

Table '  No Table name (Sub Tablestring process normaly)
"ABCDEFG"
End Table

End Table   '< This is benign ?

Table Test3.4 ' No End Table
"ABCDEFG"

' END
 

Last edit: Anobium 2021-04-05