Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QB_Universal - Dynamic Memory System
#5
Yes, that's what I call a hit. This is exactly what we need. This is a huge step forward. This is absolutely great. I stopped my project so I could study this properly. Using nested arrays is absolutely great for both audio and video. I like the way Word creates menus. The only thing I don't know is - I couldn't find any information about _Preserve. If a nested array needs to be enlarged or reduced without losing data. Is that done automatically? No. Or is it? So we use _Preserve on the QB64PE side. But then - how does the memory overwrite on the C side happen? Do we have to destroy the entire structure first and reload it?

So here's how I see it:
Forget about TYPE with this method. You don't need it anymore.
and now I'll untangle a bit of the second program:

Code: (Select All)

Do
    Read n$
    If n$ = "END" Then Exit Do
    Read spd&, z60#, pwr&, cyl&, cc&, rar&, value& '                  how write this using TYPE  (not possible, just for orientation)
    Dim c As _Offset: c = Var_New '                                    Type C
  Var_SetString c, n$ '                                              n As String                            Type CAR
  Var_Push c, Var_New: Var_SetInt Var_At(c, 0), spd& ' mph            C() as CAR  here is nested field C()    spd As Long
  Var_Push c, Var_New: Var_SetDouble Var_At(c, 1), z60# ' 0-60        End Type                                z60 As Integer  but why  Var_SetDouble???
  Var_Push c, Var_New: Var_SetInt Var_At(c, 2), pwr& ' bhp                                                    pwr As Long
  Var_Push c, Var_New: Var_SetInt Var_At(c, 3), cyl& ' cylinders                                              cyl As Long
  Var_Push c, Var_New: Var_SetInt Var_At(c, 4), cc& ' engine cc                                              cc As Long
  Var_Push c, Var_New: Var_SetInt Var_At(c, 5), rar& ' rarity                                                rar as Long
  Var_Push c, Var_New: Var_SetInt Var_At(c, 6), value& ' value                                                value as Long
  Var_Push MainDeck, c '                                                                                      End Type                Dim MainDeck As C
LOOP

Another question, besides Preserve. Can an array with multiple elements be used as a nested array? (two, three dimensional)? Can you write example for this? 

Definitely this is really very useful. Thank you for sharing.


Reply


Messages In This Thread
RE: QB_Universal - Dynamic Memory Sytem - by Petr - 01-17-2026, 12:19 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)