Page 4 of 4 FirstFirst ... 234
Results 31 to 36 of 36

Thread: Embedded - supported or not?

  1. #31
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    55
    Posts
    1,564
    Rep Power
    175
    Quote Originally Posted by ReneMiner View Post
    ...

    Probably merits a thread of its own.
    ...
    Probably not. Even we obtained our decimal system and the digits from arab roots and they have great mathematicians - the Ring lacks impermeableness, not really codetight and it feels a bit strange to use a verb as "see" as command to print.
    If "show" were used instead it would make sense. The arab phrase for "Look at that!" might be the same as "Let me show you this..." or "Do you see it?"
    Especially i see - when i watch my taskmanager -
    multithreading out of control -
    before actually a second thread is invoked 3 or 4 threads already yall'a-yall'a and nothing that could pull the brakes
    I think there are missing some Forum-sections as beta-testing and support

  2. #32
    Thank you ReneMiner for referring to Ring language. i am still testing it.
    we can use the classic "print" by loading first "stdlib.ring" this is like uses "console"

    load "stdlib.ring"
    print("hello worlds")
    
    or we can use "?" without loading stdlib.ring
    regrading the keywords : see,give,ok and so on we can use the function ChangeRingKeyword
    such as
    ChangeRingKeyword see throw
    will use throw for output
    and
    ChangeRingKeyword ok EndOfConditional
    will use EndOfConditional for end of condition
    some international users are using their own Unicode words instead of the original names

    the following example from
    https://www.codeproject.com/Articles...mming-Language
    ChangeRingKeyword see throw
    ChangeRingKeyword ok EndOfConditional
    
    
    for x = 1 to 10
            for y = 1 to 10
                    throw "x=" + x + " y=" + y + nl
                    if x = 3 and y = 5
                            exit 2     # exit from 2 loops
                    EndOfConditional
            next
    next
    
    but its first index is 1 (like thinbasic arrays)
    Last edited by primo; 08-12-2022 at 19:16.

  3. #33

    Embedded script engine

    This interest me a lot.

    If one embeds ThinBasic (core) into an application would this be allowed for a commercial app ?

    I am working on a development tool for a company which manufactures a Motor controller module. The Motor controller supports its own internal Basic like scripting language. It also sports an external ASCII command set which can be sent to it via USB. I created a secondary external min-scripting engine for quickly writing scripts which use that ASCI command set.

    Now there are two ways which I could use ThinBasic.

    (1) Write a module for ThinBasic which can use this scripting engine to talk to the motor controller.

    (2) Embed ThinBasic into my development app and add commands to ThinBasic to use my scripting language so one could write code using ThinBasic language and have special commands which can send ASCII commands to the motor controller directly or send a prewritten script (program) to my mini-script engine.

    My mini-script engine has a callback system so I can monitor the execution of ASCII commands to the motor control in realtime. My mini-script engine automatically opens the connection to the motor control (via USB or RS-485 serial) and sends the ASCII commands one at a time, tracks fail states and when it finishes a script disconnects the motor controller.

    Would any of the above be doable with ThinBasic ?

    Would it be permitted (based on your license) ?

  4. #34
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    58
    Posts
    8,849
    Rep Power
    10
    Ciao Chris,

    you are free to embed thinBasic Core engine (thinCore.dll) into any number of commercial program you want without any limitation.
    You can also use any thinBasic module as well as far as it is not a module wrapper of a commercial library. In this case you need to purchase a valid license from the commercial library manufacturer.

    For example thinBasic_LibXL.dll is a not yet documented wrapper of some few functions of LIBXL library https://www.libxl.com/
    I developed this wrapper module for thinBasic to be used in the company I work for, and my company purchased the library license.
    Then you need to call LibXL_book_SetKey(hBook, "{name}", "{key}") module function to pass license data from script to library in order to remove LIBXL limitations.

    That said, I think the most efficient way to have a scripting language is to embed thinBasic Core engine into you program and execute scripts inside you application.
    You will be able to wrap your internal functions to new keyword to be used in your script.
    Only limitation is that you will be able to execute just one script at a time. thinBasic Core engine is not multi-threading script engine.

    If you need help, please open a new post and I will be happy to show some PowerBasic examples on how to embed thinBasic Core engine and add new keywords.

    Ciao
    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

  5. #35
    Junior Member
    Join Date
    Jan 2013
    Age
    82
    Posts
    25
    Rep Power
    15

    Passing a UDT

    I'm using thinBasic as the macro engine for my app (SPFLite) and it works just fine. But I'm trying to pass a UDT from the macro code to a function in SPFLite. Both the macro and SPFLite code are using compatible TYPE definitions. But I can't seem to establish a pointer in the SPFLite code to the UDT area in the thinBasic macro.
    Here's the thinBasic macro:
    ' Try.macro
    SPF_Trace(Off)
    SPF_CMD("CLS")
    type ENVType
       ID  as string * 2
       Num as long
       Txt as asciiz * 100
    end type
    dim ENV as ENVType
    ENV.ID = "XY"
    ENV.Num = 789
    ENV.Txt = "AAAAA"
    SPF_Try(ENV)
    spf_Debug(ENV.Num)
    spf_Debug(ENV.Txt)
    Halt (OK)
    
    And here's my attempt at the function:
    FUNCTION SPF_Try() AS LONG                                        '
    '--------------------------------------------------------------------------------------------------+
    '- Try stuff                                                                                       |
    '--------------------------------------------------------------------------------------------------+
    LOCAL UDTName, lTxt() AS STRING                                   '
    LOCAL i, pVar, lMainType, lSubType, lIsArray, pDirect, ArrayElements, ArrayPtr, lSize, lCounter AS LONG   '
    LOCAL aText AS WSTRING
    #ALIGN 4
    LOCAL pENV AS ENVType PTR                                         ' Map the passed area
    LOCAL pRaw AS BYTE PTR                                            ' Temp for step over
       IF thinBasic_CheckOpenParens(%True, %True) THEN                ' An Open (
          UDTName = thinBasic_GetTokenName                            ' Get next token name as a string
          IF thinBasic_CheckCloseParens THEN                          ' Closed properly?
             pVar = thinBasic_VariableGetInfo(UDTName, lMainType, lSubType, lIsArray) ' Get a ptr to a variable (name is ArrayName)
             IF pVar <> %Null THEN                                    ' If we get pointer then variable exists
                pRaw = thinBasic_VariablePtrToDirectPtr(pVar)         ' We need to convert ptr inside parser to pointer inside thinBasic Core
    '            pRaw += 4
                pENV = pRaw
                IF @pENV.ID <> "XY" THEN                              ' Is eyeball correct
                   '
                END IF
                @pENV.Num = 123                                       ' Stuff in some test values
                @pENV.Txt = "Hello Sailor"                            '
             ELSE                                                     '
                thinBasic_RunTimeError(%ERR__VARIABLE_NOT_DEFINED)    '
             END IF                                                   ' End IF pVar
          END IF                                                      ' End Close )
       END IF                                                         ' End Open (
    
       FUNCTION = 0: TP.ErrMsgReset                                   '
    END FUNCTION                                                      '
    
    Looking for suggestions

    George

  6. #36
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    58
    Posts
    8,849
    Rep Power
    10
    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

Page 4 of 4 FirstFirst ... 234

Similar Threads

  1. OpenCL: Supported hardware
    By Petr Schreiber in forum OpenCL
    Replies: 6
    Last Post: 13-02-2010, 10:36
  2. Type pointer var not supported by WITH?
    By Michael Hartlef in forum thinBasic General
    Replies: 9
    Last Post: 24-09-2008, 15:42
  3. glcreateshader not supported !
    By sandyrepope in forum TBGL Bonus Pack
    Replies: 3
    Last Post: 31-10-2007, 13:51
  4. New supported post tag: [youtube]
    By ErosOlmi in forum General
    Replies: 1
    Last Post: 03-02-2007, 10:23

Members who have read this thread: 10

Posting Permissions

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