Page 7 of 7 FirstFirst ... 567
Results 61 to 67 of 67

Thread: Release the beast: Get$/Set$/GetPtr

  1. #61
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    52
    Posts
    1,482
    Blog Entries
    2
    Rep Power
    164
    Sorry- I had some bug inside - - forgot to exchange some old functions name (HEAP_ArrayFreeAt) inside Function HEAP_DimAt - I had it in there more than once so my spellchecker did not detect it and this only gets called if allocation fails due some lack of memory - so never happened yet...

    #MinVersion 1.9.7.0 - Get it here
    FileVersion 0.5 19-08-2013
    Attached Files Attached Files
    Last edited by ReneMiner; 19-08-2013 at 15:02.


  2. #62
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    55
    Posts
    8,661
    Blog Entries
    2
    Rep Power
    10
    RenÚ,

    I'm stealing some of your HEAP_* great functions to add them as native thinCore functions.
    Hope you will not ask me for royalties

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  3. #63
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    52
    Posts
    1,482
    Blog Entries
    2
    Rep Power
    164
    Quote Originally Posted by ErosOlmi View Post
    RenÚ,

    I'm stealing some of your HEAP_* great functions to add them as native thinCore functions.
    Hope you will not ask me for royalties

    Ciao
    Eros
    Are you kidding me? I feel highly honored
    The "Ideas-forum" was a good idea.

    PS. this Support-Thread can be marked as "Done" then
    Last edited by ReneMiner; 19-08-2013 at 14:36.


  4. #64
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    52
    Posts
    1,482
    Blog Entries
    2
    Rep Power
    164
    Eros, one question to this:

    Is there a formula/ a FAST (!!!) way to retrieve the position where HEAP_Size is stored? Would be interesting to access heap from oxygen without have always to pass the size but just the pointer - If one had to search through a directory-alike list it would be certainly too slow.
    Last edited by ReneMiner; 19-08-2013 at 17:42.


  5. #65
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    55
    Posts
    8,661
    Blog Entries
    2
    Rep Power
    10
    Quote Originally Posted by ReneMiner View Post
    Eros, one question to this:

    Is there a formula/ a FAST (!!!) way to retrieve the position where HEAP_Size is stored? Would be interesting to access heap from oxygen without have always to pass the size but just the pointer - If one had to search through a directory-alike list it would be certainly too slow.
    ReneÚ,

    Heap memory is handled directly by the operating system using some KERNEL functions.
    More info at: http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx

    The first thing to do before handling Heap memory blocks is to create a heap handle using HeapCreate or GetProcessHeap functions.
    Once you have that handle, you can use HeapAlloc, HeapFree, HeapReAlloc, HeapSize functions.
    thinBasic hide all the complexity (at the end it is not so complex) of those functions giving a more comfortable syntax.
    I've never used other Heap functions.

    But if you read Heap documentation you will see that there are some other functions that can be used to walk though Heap memory blocks: HeapValidate and HeapWalk. More info at:
    http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
    http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
    http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx

    That is all I know.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  6. #66
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    52
    Posts
    1,482
    Blog Entries
    2
    Rep Power
    164
    I just read there, Heap_Size may contain bogous data? I always assumed if heap x does not exist HEAP_Size(x) would return 0...
    I hope at least in tB it works that way...
    Do HEAP_Alloc/HEAP_ReAlloc/HEAP_AllocByStr allocate continous data as I thought? Else the overlay stuff is kind'a screwed...

    John, it's "Open-to-contribute"

    FIX: to insert into function HEAP_DimAt - after
    Dword hPtr At vPtr
    ' --------
    ' begin insert
    
    If Heap_Size(hPtr) Then Return 0   ' memory already allocated!
    
    ' end insert
    ' -------
    Local i As DWord
    
    Last edited by ReneMiner; 19-08-2013 at 20:15.


  7. #67
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    52
    Posts
    1,482
    Blog Entries
    2
    Rep Power
    164
    I'm up since 6 in the morning already and playing with samples shipped with tB. I've found one that lists equates of all modules. Now I changed it a little making use of some Variables-functions. Now it lists not just equates names but also their values... Found a few that don't get bold.
    '---Load all modules in order to get all equates
    
    Uses "ADO"  '<<< have not found this in help-file
    
    Uses "BIFF", "BUNDLE"
    Uses "CGI", "COM", "COMM", "Console", "Crypto"
    Uses "Dictionary", "DT"
    Uses "Eval", "EXE"
    Uses "File", "FileLine", "FTP"
    Uses "GDIp"
    Uses "iComplex", "INet", "INI"
    Uses "LAN", "LL"
    Uses "MATH", "WinMM"
    Uses "OnlineScores", "OS", "Oxygen"
    uses "PC"
    Uses "RAS", "Registry"  ' have not found "RAS" in help neither
    Uses "SAPI", "SMTP", "Stat"
    Uses "TBAI", "TBASS", "TBDI", "TBEM", "TBGL", "TCPUDP", "TImage", "Tokenizer"', "Trace"?
    Uses "UI", "UIAdv"
    Uses "VBRegExp"
    Uses "WMI"
    Uses "XPRINT"
    Uses "ZLib"
    
    #INCLUDE "LazyFun.tBasicU" ' watch it: these equates also listed
    
    Dim sKeys          As String
    Dim aKeys()        As String
    Dim nKeys, lVal    As Long
    Dim Count, i, char As Long
    Dim sOut           As String
    Dim sLine          As String
    Dim sLastPrefix    As String
    
    '---Get a string with equates separated by $TAB
    sKeys = APP_ListEquates
    
    '---Parse string into an array
    PARSE sKeys, aKeys, $TAB
    
    '---Creates output buffer
    nKeys = UBOUND(aKeys(1))
    For Count = 1 To nKeys 
      sLine = aKeys(Count)
      
      If StrLen(sLine) Then 
        If Peek(StrPtr(sLine)) = 37 Then  ' % - prefixed  
          If char <> Peek(StrPtr(sLine)+1 ) Then
            ' new char
            char = Peek(StrPtr(sLine)+1 )
            sOut = sOut + "'[] " + Chr$(char) + $CRLF
          EndIf    
          
          For i = 1 To StrLen(sLine) - 1
            If Peek(i + StrPtr(sLine)) = 95 Then ' "_" (underscore) 
              If StrLen(sLastPrefix) < i Then
                sLastPrefix = Memory_Get(StrPtr(sLine), i )
                sOut = sOut + "' " + Repeat$(50,"-") + $CRLF
              Else
                If Memory_Differs(StrPtr(sLine), StrPtr(sLastPrefix), i ) Then
                  sLastPrefix = Memory_Get(StrPtr(sLine), i )
                  sOut = sOut + "' " + Repeat$(50,"-") + $CRLF
                EndIf    
              EndIf      
              Exit For
            EndIf
          Next
       
          If i >= StrLen(sLine) Then 
            If StrLen(sLastPrefix) Then 
              sOut = sOut + "' " + Repeat$(50,"-") + $CRLF
              sLastPrefix = ""
            EndIf
          EndIf
          
          lVal = Peek(Long, VARIABLE_GetPtr(sLine) )
          sLine = sLine + Repeat$(50 - StrLen(sLine), " ") + " = &H" + Hex$(lVal, 8) 
        EndIf     
      EndIf
      
      PrintL sLine
      sOut  = sOut & sLine & $CRLF
    NEXT
    
    '---Save buffer into .INC file
    FILE_Save(APP_SourcePath & "EquatesList.inc", sOut)
    
    PrintL $CRLF + "Done. Any key to end."
    WaitKey
    
    After running succesful you'll find some .inc-file in program folder.
    Last edited by ReneMiner; 20-08-2013 at 09:02.


Page 7 of 7 FirstFirst ... 567

Similar Threads

  1. Release of Aung San Suu Kyi
    By Charles Pegge in forum Shout Box Area
    Replies: 0
    Last Post: 13-11-2010, 14:23
  2. TAB Alpha Release 35
    By catventure in forum T.A.B. (ThinBasic Adventure Builder)
    Replies: 4
    Last Post: 08-07-2008, 18:34
  3. TAB Alpha Release 24
    By catventure in forum T.A.B. (ThinBasic Adventure Builder)
    Replies: 2
    Last Post: 22-03-2007, 00:37
  4. TAB Alpha Release 23
    By catventure in forum T.A.B. (ThinBasic Adventure Builder)
    Replies: 46
    Last Post: 21-03-2007, 19:02
  5. TAB Alpha Release 22
    By catventure in forum T.A.B. (ThinBasic Adventure Builder)
    Replies: 24
    Last Post: 08-03-2007, 13:58

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •