Results 1 to 9 of 9

Thread: need way more documentation and examples

  1. #1
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    55
    Posts
    1,554
    Rep Power
    174

    need way more documentation and examples

    to make use of the sdk there is too much left in the dark, unknown and i would ike to know if no documentation except for the - with big warnings-
    Do NOT USE! -
    deprecated legacy sdk maybe some incomplete modules that were work in progress long time ago but have been forgotten to be finished and that will show more than just how to parse a comma optional like how can i go two or three tokens back or forth without to load the script-source code which will not work for obfuscated code. Or how can i dimension from module a virtual local variable in the current thinbasic-function or how can i add an udt that will not just work in theory when i define it in the load local symbols-procedure ( than i could rather save it as tbasic-code and inject it to the script ) but i try to add new subelements in runtime that will not flood the memory with hundreds of extended types but keep only selected stages when just a local variable was created from it and that procedure where it was created is still alive (piled on function-stack).

    Are there any less than 10 to 15 year old modules that may be unfinished or just "not beautiful enough" but at least working and making use of many different sdk-functions where we may discover some of the rules how to use all these functions. I think its less time consuming if one has at least a clue what a function can do.

    Else- with the knowledge about how to use a handful of the functions is like having a Ferrari in the garage but it has the gear-shift like a Fiat 125, the wooden steering wheel of some ancient truck, the drivers seat of an vespa ape and we have the keys of an Alfa of the 1970s with it and a set of new, unused tires that only will fit if we made it to park the bambino on top of the ape while its circulating on 2 wheels around the garage
    I think there are missing some Forum-sections as beta-testing and support

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10
    Ciao Renč,

    you are right! There is so much power in thinBasic SDK but is not at all documented.
    So far only Petr and me are aware of it because no public documentarian or very very little.

    I think this can be a great theme for autumn and winter time.

    In the meantime I will think how to create such documentation.
    Maybe some online system open to anyone willing to participate con be the right way, a wiki like system.

    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    55
    Posts
    1,554
    Rep Power
    174

    Post ok i try specific questions -seems no one has any unfinished abandoned module-code

    ok i try specific questions -seems no one has any unfinished abandoned module-code laying around somewhere ...

    Can I alias a thnbasic keyword through a module, likewise i create a word as sunday that should act as keyword Dim for example, or i make another one and name it Monday and it should do what any other keyword, maybe "Return" or "Type" does. So i could completely create a different context for some existing behavior - it looks as a familiar structure to the user since keywords and parameters are in same place but the words say something completely different.

    Can i use an existing keyword as "Begin" force to go into my module , where i only will check if its not const or controlid that will follow -but if so is there a way to let thincore take over to deal with const or controlID? can i switch the override-mode off therfor?
    Like
    Begin "App_MainWindow" As Window
        Style %WS_Overlapped
        Size 0.5,0.5
        Title "Hello World"
        Begin "toolbox_top" As CommCtl( "toolbarWindow32") 
            Align Top
            Fill Horizontal
            Assoc "il_toolbox" As ImageList_Load(App_scriptpath "\icons\toolbox1\")
            Begin "btn_fileOpen" As CommCtl( "tbbutton")
                  Caption "&Open"
                  Image "foldrOpen2.ico"
                   
             End 
             Begin "btn_fileExit" As CommCtl("tbbutton") 
                  Caption "&Exit"
                  Image "door.ico"
             End    
        End  
    End
    
    As long as i do not return control to thinbasic and i parse all tokens away what could happen?

    And bug-bug-bug ... i just remember : in thinbasic using names as _o____Hello____o_ (especially ending with underscore leads to bug out error - something with line continuation. I thought other delimiters as open parens or comma can do without - but isn't there a space previous to the underscore mandatory? That would prevent from this bug and i thought it were this way.

    Any hints how can i , when creating a class and add the codeptr to some function on creation line so my function is alway executed when the class followed by a dot and some arbitrary symbols follow. as in loadlocalsymbols

    pClass_NewClass = thinBasic_Class_Add("Roboclass", CodePtr(Robo_proc) )

    the roboproc gets called when a variable XX as New Roboclass was defined and XX.something or XX.any other thing appears in script thats like a sub with byval input only. Can i make if XX.newWord is passed some use of NewWord? I would like to let it become a variable or something or to associate it with a pointer

    Any idea? even the tiniest little spot?
    Last edited by ReneMiner; 25-08-2023 at 10:47.
    I think there are missing some Forum-sections as beta-testing and support

  4. #4
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    55
    Posts
    1,554
    Rep Power
    174
    i can't get any step forward
    why can't tell anyone?

    Simplest things as thinBasic_DeclareFunction
    What does it do ?

    Will it declare some API-function call from module to be present in thinBasic?
    Or will it declare a module function as i have in PB
    function EnsureFolderExists alias "EnsureFolderExists" (byval sDir as string, optional byref sSubDir as string, optional byref HideError as long) Export as string
    
    and i try to make it accessible - without any parsing - within LoadLocalSymbols
     thinbasic_DeclareFunction("EnsureFolderExists (byval sDir as string, optional byref sSubDir as string, optional byref HideError as long) as string", codeptr(EnsureFolderExists))
    
    or do i have to use another way? (i do i think because it does not work)

    how can i create a local variable to the current scriptfunction upon a hash-ptr when i do not want to exploit the hash-table itself to keep the other content private?

    how to return results from pb when there is no way to predefine a result-type as here:
    p_Props = thinBasic_Class_Add("cProperty", Codeptr(tbProps_Exec))
    
    do i have to force it by naming it to tbProps_Exec$ ?
    Ain't there any resultbuffer that i can use to put the result onto, place the datatype next to it so thincore will pass the value back as defined type to the calling script-statement (-function/-subelement)
    e.g. the script calls something dimensioned as
    cProperty.whatever( here tbProps_Exec will parse)
    
    i parse the dot + a string token, open parens, parameters...
    string token allows me to detect what user wants - maybe defines datatype of a new property and i just want to return ok, done as
    Local iResult as Integer
    iResult = -1
    
    but i can not simply write

     
    Function = iResult
    
    since tbProps_Exec is not defined to return a 16-bit integer nor boolean .
    If thincore had a function

    thinBasic_ReturnValue(byval pData as Dword, byval lLenData as Long, byval Maintype as Word, byval SubType as Word)

    or just simple

    thinBasic_ReturnResult_String(byval sData as String)
    thinBasic_ReturnResult_Int16(byval iData as Integer)
    thinBasic_ReturnResult_Byte( byval bData as Byte)

    so in case my new class-symbol
     
    x = cproperty<.followed by unknown that i will parse>
    
     ' or 
    y = anyfunc( 1, 2, cproperty<.whatever>, 4)
    
    is encountered and invokes to call on tbProps_Exec ( as class-default-function if no matching method is defined )
    i can tell thincore what value and type to use to replace the token "cProperty" until the end of what i parsed

    I mean it works currently already like that - i don't know if it is meant to work this way at all - except the return-value - i dont know how to
    swap the token so thincore "thinks" it's a variable of a certain datatype that i could fill a value into
    I think there are missing some Forum-sections as beta-testing and support

  5. #5
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    55
    Posts
    1,554
    Rep Power
    174

    oh come on please...

    is there nothing not the smallest source of information to it? Any documentation? any knowledge about how to use this when thincore has control and encounters a variable of my class the next token that i get is a dot. How could i go one more step before the dot so i can parse the actually class variable and check its condition /content. do i really need to shell an additional thinbasic-script out of LoadLocalSymbols and let it tokenize the script-source that currently uses my module in all details? remove all comments line by line, store the information to a giant table: token position, token size, so i can load it from powerbasic into my module to search the position of my classvariable. Is there any clue to find the current codelines number so that i do not have to repeatedly scan all possible tokens. And what will i do if the code is obfuscated and i can not parse nor scan the source code?
    '----------------------------------------------------------------------------
      'thinBasic_Class_Add
      '----------------------------------------------------------------------------
      ' Add a new class to thinBasic Core Engine
      '----------------------------------------------------------------------------
        DECLARE FUNCTION thinBasic_Class_Add                                _
                                LIB   "thinCore.dll"                        _
                                ALIAS "thinBasic_Class_Add"                 _
                                ( back to thinbasic BYVAL sClassName            AS STRING , _     '---Name of the Class to be created
    '                                                 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
    ' = = = = = = = = = = = = = > > >        how can i set a returnvalue for that pClassFunc /Codeptr( myClass_subitemType ) 
    
    
                                    BYVAL pClassFunc            AS LONG     _     '---Pointer to a class function that will handle calls to methods
                                ) AS LONG                                               ' - -- HOW CAN I transfer the result from a called method back to 
                                                                                              ' --- a thinbasic-script when 
      '----------------------------------------------------------------------------
       
    '----------------------------------------------------------------------------
      'thinBasic_ParseClass
      '----------------------------------------------------------------------------
      ' Return pointer to a class. Use it to map your internal module class - but how?
      '----------------------------------------------------------------------------
        DECLARE FUNCTION thinBasic_ParseClass                               _
                                LIB   "thinCore.dll"                        _
                                ALIAS "thinBasic_ParseClass"                _
                                (                                           _
                                ) AS LONG
      '----------------------------------------------------------------------------
    
    
      %Class_Action_None          = 0?
      %Class_Action_Get           = 1?
      %Class_Action_Set           = 2?
    
    
      %Class_Action_Constructor   = 100?
      %Class_Action_Destructor    = 110?
     
    '----------------------------------------------------------------------------
      'thinBasic_DeclareFunction
      '----------------------------------------------------------------------------
      ' Add a new function using DECLARE statement and function pointer 
    ' what can it declare? A module function? A function of another dll?  And what must be content of the string? 
      '----------------------------------------------------------------------------
      DECLARE FUNCTION thinBasic_DeclareFunction                      _
                              LIB "thinCore.DLL"                      _
                              ALIAS "thinBasic_DeclareFunction"       _
                              (                                       _
                                BYVAL sDeclare AS STRING    ,         _
                                BYVAL pFun AS DWORD                   _
                              ) AS LONG
      
    
    '----------------------------------------------------------------------------
      'thinBasic_AddVariable
      '----------------------------------------------------------------------------
      ' Add a new variable to current stack level
      '----------------------------------------------------------------------------
      DECLARE FUNCTION  thinBasic_AddVariable                         _
                              LIB "thinCore.DLL"                      _
                              ALIAS "thinBasic_AddVariable"           _
                              (                                       _
                                BYVAL vName       AS STRING,          _
                                BYVAL lValString  AS STRING,          _         ' can be only one of
                                BYVAL lValNumber  AS EXT   ,          _        ' the both? 
                                BYVAL ForceType   AS LONG  ,          _
                       OPTIONAL BYVAL VarMemPtr   AS LONG  ,          _  ' is that the DIM-AT-Way?
                                BYVAL Reserved1   AS LONG  ,          _     ? is any of
                                BYVAL Reserved2   AS LONG  ,          _    ? these responsible 
                                BYVAL Reserved3   AS LONG  ,          _    ? when my variable 
                                BYVAL Reserved4   AS LONG             _   ?  does not appear 
                              ) AS LONG                                            in current function?  can it be a global variable too?
    
    Many questions, i know. I hope for at least some information that i can continue doing things with thinbasic. It were sad and a long time required
    from J.Klutho's Smallbasic-Interpreter to reach a state as thinbasic has now. Doable yes, but why? It's all in there already. But without to know how things work the success on random try and error is bearly more than zero, especially if misleading names on parameters or functions create confusion, happiness about any success getting more and more rare, inside it's a very sad and bad feeling to give up on something that was long time fun - but i also don't like to stick on an abandoned ship that soon will drown.
    Keeping it alive is up to us, people that fill it with life through embedding ideas and using new ways
    I think there are missing some Forum-sections as beta-testing and support

  6. #6
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    55
    Posts
    1,554
    Rep Power
    174

    How can i...?

    How to declare a module function using thinbasic_DeclareFunction?

    I am missing something here, i guess.

    I think its correct to have a function headline as
    Function ApproveValidCount Alias "ApproveValidCount" (Byref hTable as Dword, Byval pKeys As Dword) Export As Long
    
    now i want to provide the function without the need to parse the call on it token by token and i think thinbasic_DeclareFunction is, what i have to use,
    probably invoked with a bunch of other things by a call that comes out of LoadLocalSymbols.
    So far...

    But i dont get it working.

    How do i have to setup the string? is it required to repeat "Declare Functtion" as
    String sDeclare ="Declare Function ApproveValidCount Import ""moduleTest.dll""( Byref hTable as DWord, byval pKeys as Dword)  As Long"
    thinbasic_DeclareFunction( sDeclare )
    
    Last edited by ReneMiner; 02-02-2024 at 18:16.
    I think there are missing some Forum-sections as beta-testing and support

  7. #7
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10
    Will give you details and an example tomorrow with a new thinBasic update.

    thinbasic_DeclareFunction was developed more than 10 years ago and never updated with successive thinBasic Core changes.
    I should have fixed and will give you details.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  8. #8
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10
    Please download latest thinBasic version 1.12 just updated.
    Then use the following attacked module example on how to use
    thinBasic_DeclareFunction
    
    compared to classic
    thinBasic_LoadSymbol
    
    Main difference is that using thinBasic_LoadSymbol programmer is responsible of fine parsing expression/tokens while using thinBasic_DeclareFunction programmer ask thinBasic Core engine to take care of parsing expressions/tokens.
    Declare statement MUST exactly adhere with internal function calling otherwise application will crash

    Hope this will help you

    Ciao
    Eros
    Attached Files Attached Files
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  9. #9
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    55
    Posts
    1,554
    Rep Power
    174
    oh yes, thank you, classified as helpful.

    i have sumtin cooking on the stove.
    I think there are missing some Forum-sections as beta-testing and support

Similar Threads

  1. calendar examples
    By lydia_sp in forum Modules specific issues
    Replies: 12
    Last Post: 15-11-2011, 22:25
  2. Big integers more examples
    By zak in forum BigInt module. Big Integer handling by Johannes
    Replies: 2
    Last Post: 04-03-2011, 21:21
  3. OpenCL: Documentation
    By Petr Schreiber in forum OpenCL
    Replies: 0
    Last Post: 01-12-2009, 10:05
  4. MOVED: liongfx-syntax documentation part one, pdf :)
    By Petr Schreiber in forum User tools
    Replies: 0
    Last Post: 01-08-2009, 11:00
  5. liongfx-syntax documentation part one, pdf :)
    By Lionheart008 in forum Experimental modules or library interface
    Replies: 5
    Last Post: 08-07-2009, 06:39

Members who have read this thread: 1

Posting Permissions

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