Menu

StringTables (chr indexed)

ToniG
2021-03-10
2021-03-21
<< < 1 2 (Page 2 of 2)
  • Anobium

    Anobium - 2021-03-18

    And, an analysis of the table created.....

    The first value is 16, which is the low byte of the table length. If you look at the code then the table length is 272 = 0x110, where the low byte is is 0x10-16. :-)

    The second value is 34, Escape value for DQuote.

    The next 26values are the string.

    Then, value 34 Escape value for DQuote.

    Then, value 0 Escape value for \&000 which is our end of string marker. :-)

    TABLEMNUTXT1
        retlw   16
        retlw   34
        retlw   84
        retlw   104
        retlw   105
        retlw   115
        retlw   32
        retlw   105
        retlw   115
        retlw   32
        retlw   77
        retlw   97
        retlw   115
        retlw   116
        retlw   101
        retlw   114
        retlw   32
        retlw   77
        retlw   101
        retlw   110
        retlw   117
        retlw   32
        retlw   73
        retlw   116
        retlw   101
        retlw   109
        retlw   32
        retlw   49
        retlw   34
        retlw   0
        etc
        etc
    
     
  • Anobium

    Anobium - 2021-03-18

    And, I have just run all the static tests using the updated preprocessor.bi

    The new method threw up some syntax issues with a library that is easily fixed. The issue was a Dquote that was not terminated correcty. So, the new method is catching a latent bug.

    Apart from the issue above. Passed.

     
  • Anobium

    Anobium - 2021-03-18

    And, continuing the testing. This works - a mixed TABLE of strings and 'old' numbers.

    Table  MnuTxt1  ' Sub1 Menu
       'These are csv string lINES (use with modified Preprocessor.bi (Sub TableString))
       "Menu Item \"1\"\&000", "Menu Item 2\&000", "Menu Item 3\&000", "Menu Item 4\&000", "Menu Item DropDown 5\&000"  ' SUB1
       "Config1 Item 1\&000", "Config1 Item 2\&000", "Config1 Item 3\&000", "Config1 Item 4\&000"         ' SUB2
       "DataLog Item 1\&000", "DataLog Item 2\&000", "DataLog Item 3\&000"                          ' SUB3
       "Diag Item 1\&000", "Diag Item 2\&000", "Diag Item 3\&000", "Diag Item 4\&000"                      ' SUB4
       "Help Item 1\&000", "Help Item 2\&000", "Help Item 3\&000"   'SUB5
    
    'Last menu item....
    72
    101
    108
    112
    32
    73
    116
    101
    109
    32
    52
    0
    End Table
    

    Shows this using the /&000 terminated strings. Which is correct. :-)

    ...
    17)Help Item 1
    18)Help Item 2
    19)Help Item 3
    20)Help Item 4
    
    ----------------
    
     
  • Anobium

    Anobium - 2021-03-18

    Added \0 - totally make sense. See attachment ( will attached after post)

    Latest now supports \0

    "Diag Item 1\0", "Diag Item 2\0", "Diag Item 3\0", "Diag Item 4\0"  
    

    A null was a follows. The new is a lot simpler. Note: \ &000 is still valid.

    "Diag Item 1\&000", "Diag Item 2\ &000", "Diag Item 3\ &000", "Diag Item 4\ &000" 
    

    Test table

        '==========  TABLES ===============
    
        Table  MnuTxt1  ' Sub1 Menu
           'These are csv string lINES (use with modified Preprocessor.bi (Sub TableString))
           "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"   'SUB5
    
    72
    101
    108
    112
    32
    73
    116
    101
    109
    32
    52
    0
        End Table
    
     

    Last edit: Anobium 2021-03-18
  • Anobium

    Anobium - 2021-03-18

    An indexed version of the menu system using \0 as the end of string. Loads the pointers into an array - this is created during the init. Then, the menu is displayed using the pointers.

    Used more RAM but could be faster. If the speed is critical then this may the way to go....

    Enjoy

     
  • Anobium

    Anobium - 2021-03-18

    Another method to index. This time to index into Progmem. This code creates the indexes ( tble location and length of each table string) in Progmem.

    The script calcs the top end of memory to put the indexes. And the using PROGMEMWRITE and PROGRAMREAD you can place the indexes in Progmem.

    I had to use a 16F18855 but this will work on many, ,manay 18F e3tc.

    Code is the same for other posted but the location of progmem has to calculated. Less memory as not an array!

    The picture shows the terminal with the menu strings, plus the PICKitPlus software having read the Progrmem - its shows the indexes.

    :-)

     

    Last edit: Anobium 2021-03-19
  • stan cartwright

    stan cartwright - 2021-03-18

    Wow! this has got complicated.
    I just thought a table of bytes to represent ascii chrs and a unused end or string value.
    just jump from unused chr to next to find indexed string data in table.
    Why I'd want string 13 dunno but it's all got complicated.
    the idea a table or eprom is not limited ram makes sense.

     
  • ToniG

    ToniG - 2021-03-18

    Stan, it will work with simple strings, & easy to index.
    If there only a few strings its easy to code a pointer table or index fixed length(if strings are same len) . & also yes a separator character can be part of the string.
    I have a tool that user can paste in a string table & it spits out a pointer table to paste back in GCB code.

    Will make some examples soon to demonstrate ...

    For simple strings the only caveat would be not to have the esc pattern in your string ?

     

    Last edit: ToniG 2021-03-18
  • Anobium

    Anobium - 2021-03-19

    @ToniG

    In the GCB source - I see./* '< Comment block works but does not show in GCB(SynWrite) editor

    What is the issue?

     
  • ToniG

    ToniG - 2021-03-21

    The commented block does not show up as green in the editor, even though it is seen as commented by the compiler. (Like commenting a block in FBedit)

     
    • Anobium

      Anobium - 2021-03-21

      Please try RC43. You may be using an old version of the lexer file (part of the IDE). The lexer file was updated to support block comments.

       
<< < 1 2 (Page 2 of 2)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.