Page 2 of 24 FirstFirst 123412 ... LastLast
Results 11 to 20 of 236

Thread: thinBasic 1.11.x.x

  1. #11
    Member
    Join Date
    Jan 2017
    Location
    changsha China
    Age
    32
    Posts
    80
    Rep Power
    16
    Quote Originally Posted by mike lobanovsky View Post
    This is not correct. All thinBasic arrays are always 1-based. So, UBound will always return 5 for a 5-element array.

    What I'd recommend would be reading the manual more thoroughly before giving recommendations.
    The point you are paying attention to is wrong.

    What I want to say is that the array operation of ThinBasic can be written more beautifully.

    Not where the index is.

    I have written some programs with ThinBasic, of course I will use arrays, but I know if the array index starts from 1 or 0 is not my question.

    Dim a = Array(1, 2, 3, 4, 5)
    
    Dim arr(5) As Long
    Array Assign arr() = 1, 2, 3, 4, 5
    
    Which of these two methods is intuitive and easy to understand, it is clear at a glance.

    So what I am saying is to let ThinBasic embrace better writing and focus on language standardization.

    This is what any programming language that stands out from the crowd is doing.

  2. #12
    #Compiled
      sub SayHelloFromFreeBasic cdecl alias "SayHelloFromFreeBasic" (byref sMessage as zstring) export
        print "Hi there. I'm FreeBASIC sub SayHelloFromFreeBasic"
        print "called from DLL:", sMessage
      end sub
    #EndCompiled
    uses "Console"
    SayHelloFromFreeBasic(Compiled_DLL_FileName)
    printl "Press a key to end"
    waitKey
    
    @Eros, this is very nice approach to use freebasic fully from within thinbasic.
    i also see the commands inside #Compiled ... #EndCompiled block is colored like thinbasic and this is very important for a pleasing coding experience.
    can we access freebasic graphics capabilities and libraries in this way from thinbasic ??.
    @Petr, is it possible to call TBGL from within freebasic Block inside thinbasic something like oxygen calling TBGL but easier ?
    Thanks for all your efforts
    Last edited by ErosOlmi; 13-08-2019 at 18:18.

  3. #13
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Quote Originally Posted by primo View Post
    [CODE]
    can we access freebasic graphics capabilities and libraries in this way from thinbasic ??.
    You will have full FreeBASIC arsenal as far as I can see so far

    I'm changing #FBCode / #EndFCode block into #Compiled / #EndCompiled in order to be more general and possibly be used to compile source code not only using FreeBASIC but also using other compilers.
    Imagine something like that:
    #Compiled language = xxxx
    ....
    #EndCompiled
    
    where xxx can be the name of the language like C++ or rust ...

    I think end of next week I will be able to release initial FreeBasic version.
    Than we will see
    Last edited by ErosOlmi; 13-08-2019 at 18:19.
    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

  4. #14
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Quote Originally Posted by xLeaves View Post
    The point you are paying attention to is wrong.

    What I want to say is that the array operation of ThinBasic can be written more beautifully.

    Not where the index is.

    I have written some programs with ThinBasic, of course I will use arrays, but I know if the array index starts from 1 or 0 is not my question.

    Dim a = Array(1, 2, 3, 4, 5)
    
    Dim arr(5) As Long
    Array Assign arr() = 1, 2, 3, 4, 5
    
    Which of these two methods is intuitive and easy to understand, it is clear at a glance.

    So what I am saying is to let ThinBasic embrace better writing and focus on language standardization.

    This is what any programming language that stands out from the crowd is doing.
    Actually you can do the following:
    dim MyLongArray(5) as long = 1,2,3,4,5
    
    Maybe I can implement something like the following where initialization will be done by direct assignment.
    dim MyLongArray() as long = 1,2,3,4,5
    
    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. #15
    #Compiled language = xxxx
    ....
    #EndCompiled
    
    yes this is nice and more appropriate. i know of one basic called ParactBasic which have 2 versions one as an interpreter developed by Borland Delphi compiler v7.x Named as "Decimal Basic" https://hp.vector.co.jp/authors/VA008683/english/ and one as a compiler https://osdn.net/projects/decimalbasic/releases/p15417
    the compiler convert basic to pascal and request the Lazarus to compile the source code as exe in folder C:\ParactBASIC\output with default name NoName.exe. this folder contains all the mediated files including the BASICunit.pas wiich is the conversion file from basic syntax to pascal so Lazarus can compile it.
    of course Lazarus with its very big size should be installed previously as a standalone product.
    ParactBasic.png

  6. #16
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Quote Originally Posted by primo View Post
    #Compiled language = xxxx
    ....
    #EndCompiled
    
    yes this is nice and more appropriate. i know of one basic called ParactBasic which have 2 versions one as an interpreter developed by Borland Delphi compiler v7.x Named as "Decimal Basic" https://hp.vector.co.jp/authors/VA008683/english/ and one as a compiler https://osdn.net/projects/decimalbasic/releases/p15417
    the compiler convert basic to pascal and request the Lazarus to compile the source code as exe in folder C:\ParactBASIC\output with default name NoName.exe. this folder contains all the mediated files including the BASICunit.pas wiich is the conversion file from basic syntax to pascal so Lazarus can compile it.
    of course Lazarus with its very big size should be installed previously as a standalone product.
    ParactBasic.png

    In our case it will be a cooperation between compiled code and thinBasic script code.


    Code inside
    #Compiled
    ....
    #EndCompiled
    
    will be compiled into a DLL whose name is the same name of the script. So if your script name is MyScript.tbasic your dll will be MyScript.dll

    I'm changing thinBasic parser in order to be compatible with FreeBasic sub/function declaration at least for number and strings both scalar and arrays.
    In this way ... exported functions present into the DLL will be automatically detected and declared by thinBasic so you will not need to do anything in your script other than using your compiled functions as native script command.

    It will also be possible to create thinBasic compiled modules directly form thinBasic.
    I will release a FreeBasic example. Quite easy once you get the idea behind thinBasic engine parser.
    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

  7. #17
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi xLeaves,

    thanks for your interest in TBGL. TBGL as-is, relies heavily on the parsing of arguments for functions on ThinCore, which makes it difficult to use from other languages.

    But I think you can use native OpenGL from #compiled / #endcompiled blocks, which integrates with TBGL very nicely.

    Eros is incredible, the switch from #fbCode to #compiled opens a lot of new possibilities.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  8. #18
    dim MyLongArray() as long = 1,2,3,4,5
    it is approximately available: (mixing strings with numbers, the awareness of numbers inside strings)
    Uses "console"
    Dim NumberMatrix() As long
    dim myNumbers
    dim i, a as long
    myNumbers = "   12  ,  345         ,           6789  "
    Parse(myNumbers, NumberMatrix, ",")
    
    For i=1 To UBound(NumberMatrix)
     a = NumberMatrix(i)+2
     Printl a
     Next
    
    waitkey
    
    i have tried to make it is hard for thinbasic but it escape the test successfully

  9. #19
    i have downloaded the experimental thinBasic_1.10.8.0.zip yesterday. and it is very nice and a new technology.
    i have tried the examples of passing variables and arrays between thinbasic and freebasic. if there is an example about UDT or array of UDT will be great. thanks

  10. #20
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Quote Originally Posted by primo View Post
    i have downloaded the experimental thinBasic_1.10.8.0.zip yesterday. and it is very nice and a new technology.
    i have tried the examples of passing variables and arrays between thinbasic and freebasic. if there is an example about UDT or array of UDT will be great. thanks



    There will be ...
    Passing UDT is just a matter of passing a pointer but the UDT must be declared in both languages: thinBasic and FreeBasic. Maybe in future I will be able to automagically keep an UDt declare from one language and declare into the other automatically. Will see.

    I'm working on strings and for this I'm creating a FreeBasic class called thinString that mimic thinBasic string (ole32 BSTR strings) allowing in/out between interpreted and compiled code.
    Also working on string arrays.
    Last edited by ErosOlmi; 12-08-2019 at 10:38.
    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 2 of 24 FirstFirst 123412 ... LastLast

Members who have read this thread: 2

Posting Permissions

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