Page 16 of 19 FirstFirst ... 61415161718 ... LastLast
Results 151 to 160 of 188

Thread: Learning Oxygen and discussion of ideas for projects

  1. #151
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    Re: Learning Oxygen and discussion of ideas for projects

    hi charles, hi all other oxygen friends

    simple but heavy questions about your "tomdk" I have checked this morning, how can I use it for my own purposes ???
    - it's necessary to compile the tomdk every time new, when I am making changes ???
    - How can I know what's possible with this "T" file??? confuse me a little... sorry, it's quite new stuff for me... so I can compile a thinbasic module with this script and do everything with it I wish ???

    [code=thinbasic]' TOMDK test
    ' thinBasic Oxygen Module Development Kit
    ' compiles thinBasic modules, my first test
    Uses "File"
    Uses "T"
    USES "Console"
    '=================================================
    'test line:


    msgbox 0,t_len, "", "Oxy"
    msgbox 0,t_view("my new input")
    msgbox 0,t_error
    msgbox 0,t_Act
    msgbox 0,t_Buf
    printl t_Buf
    dim a, b, c, 2, 6 as long

    a=2
    b=6
    c=a*b
    printl c

    msgbox 0, t_exec
    waitkey

    '=================================================[/code]

    ciao, have all a nice and sunny day, Lionheart
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  2. #152
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: Learning Oxygen and discussion of ideas for projects

    Hi Frank,

    it's necessary to compile the tomdk every time new, when I am making changes ???
    Yes. You are compiling DLL, so to make changes visible you must create new machine code soup after each change
    As you are compiling with Oxygen magic, you could, in theory, let part of the file source external, so Oxy would compile it from string at the time of calling module ( thats wild, but possible ).

    How can I know what's possible with this "T" file
    ThinBasic modules work on simple and ellegant principle. They are like normal DLLs + the following:
    • In compiler of your choice (this time Oxygen) you create custom functions
    • In those custom functions, you use ThinBasic SDK functions to take control over parsing parameters
    • You "register" the custom functions by "thinBasic_LoadSymbol" in LoadLocalSymbols


    Of course, it does not have to be named T, just change fdll string in your TOMDK to something else, like "thinBasic_LionHeartMegaModule.DLL". So the module can do really anything you manage to compile

    Try to browse samples from SDK directory in TB installation to get the general idea.


    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

  3. #153
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    Re: my own first DLL script ! :D

    hi petr! thank you for important infos... and I am surprised... I have really got my first own DLL ! WOW! ... must laugh and I am feeling a little bit exciting...
    thanks also for thinbasic, tbgl, ui, console and oxygen...

    Of course, it does not have to be named T, just change fdll string in your TOMDK to something else, like "thinBasic_LionHeartMegaModule.DLL". So the module can do really anything you manage to compile Smile

    Try to browse samples from SDK directory in TB installation to get the general idea.
    thanks petr, very good to know that... this may helps a lot... if it's really so simple I will see it with the next example... I may ask a lot, I am sure...

    thinBasic_LoadSymbol `t_Color`,thinBasic_ReturnString, pColor, thinBasic_ForceOverWrite
    -> qt 1) see above line: that's simply possible??? (charles, petr, anybody else..)
    I need for this only the TOMDK script to change??? I am not sure about this...

    -> qt 2) I have nearly understood how to do implement new Symbols in theory !

    if you like, now you can use a new module... for testing... new functions and inputs I will check... as soon as possible... and more to come that's for sure...

    [code=thinbasic]' Lionhearts TOMDK test, 12.may.2009
    ' thinBasic Oxygen Module Development Kit
    ' compiles thinBasic modules

    Uses "File", "UI"
    Uses "lionhearts_megamodule"
    Uses "Console", "Oxygen"

    dim res as long = 30*12*45
    dim u as string = " ...are my sunny days on this planet earth "
    dim v as ext = 3.14159265
    randomize timer
    dim ButtonClicked as long = rnd(1, 3)
    dim FunctionToCall as string
    dim src as string

    '---- first part oxygen -------------------------------
    src = "

    o2h
    dim i,j=1 as long
    dim s,t as string

    s=space 500

    for i=1 to 24
    t=str(i)+chr(13)+chr(10)
    #view
    mid (s,j)=t
    j+=len t
    #endv
    next
    dec j
    print left s,j
    print `hello you are welcome to the thinbasic & lionhearts_megamodule script ` + j
    terminate
    "
    file_save ("tb_lionmodule.txt", o2_prep src)
    msgbox 0, o2_len+$cr+o2_view "o2h "+src
    o2_basic src
    o2_exec

    dim q, calc as string
    'do
    calc=inputbox$ "Enter here an math. Expression: ","OXYGEN CALCULATOR",calc
    if calc="" then exit do
    o2_basic " print str "+calc+" : terminate"
    if len(o2_error) then msgbox 0,o2_error
    o2_exec
    'loop

    '---- second part lionhearts_megamodule -------------------------------
    printl

    msgbox 0, res + u, "", "lionhearts_megamodule"
    res = Msgbox(0, "pi: " & str$(v) )
    printl ("-- next step, please go on... -- ")
    printl
    msgbox 0,t_len, "", "Oxygen & thinbasic friendly like "
    msgbox 0,t_view(" => this is my new TB Lionhearts_Megamodule script example ")
    msgbox 0,t_error
    msgbox 0,t_Act
    msgbox 0,t_Buf
    printl t_Buf
    dim a, b, c, d, 2, 6 as long

    a=2
    b=6
    c=a*b
    d=a*b/2
    printl c
    print d
    printl

    msgbox 0, t_exec
    printl " -- push me to continue the script --"
    waitkey

    printl

    '---- third part thinbasic -------------------------------

    IF ButtonClicked > 0 THEN
    FunctionToCall = "Test" & ButtonClicked '---Compose the name as preferred

    '---Check if function name exists. If yes, call it, otherwise error.
    if function_exists(FunctionToCall) then
    CALL FunctionToCall(timer)
    else
    msgbox 0, FunctionToCall & " does not exists."
    end if
    end if

    SUB Test1(optional byval LionsParam as ext)
    msgbox 0, "Test 1" & $crlf & "NewParam equal to: " & LionsParam
    END SUB

    printl "Hey, that's really funny with thinbasic modules !"
    waitkey

    SUB Test2(optional byval NewParam as long)
    dim a, b, c as long
    a= 5
    b=26
    c=240
    newparam = a*b*c
    msgbox 0, "Test 2" & $crlf & "NewParam equal to: " & NewParam
    END SUB

    printl
    printl "-- Everything is ok with thinbasic ! Push any key to EXIT the script -- "
    waitkey

    SUB Test3(optional byval MyParam as long)
    msgbox 0, "Test 3 is also good: " & MyParam
    end sub
    [/code]


    this is my own *.dll script based upon "tomdk" oxygen script... it's the first test for me... and now I have to check the sdk... to find a way for my new ideas... perhaps for my early idea of a "inka 3d" modeller script... uargh :P no, no... just a joke...

    -> test my script.. I have added all into the zip file... script and dll

    -> the script includes three parts... examine and have fun with it...

    ciao, Lionheart
    ps: thank you charles... for oxygen... some weeks ago I wanted to build a completely new DLL, but didn't know how to manage it... thanks for TOMDK !!!

    edit new: updated
    the script, today at 20:31 pm
    Attached Images Attached Images
    Attached Files Attached Files
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  4. #154
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    Re: Learning Oxygen and discussion of ideas for projects

    hi all oxygen friends
    hi charles, petr, good morning...

    In this way I have grasp to manage all for two new dummy functions with "t_lion" and "t_color"... to understand the method of compiling such a nice script ... must be a lot of damned work to create a big DLL with fully functionality... respect to all they are building such great modules!

    msgbox 0,t_len, "", "Oxygen & thinbasic friendly like "
    msgbox 0,t_view(" => this is my new TB Lionhearts_Megamodule script example ")
    msgbox 0,t_error
    msgbox 0,t_Act
    msgbox 0,t_Buf
    msgbox 0, t_Lion
    msgbox 0, t_Color
    It was a good test for me, learn new things and how to handle with such an exciting script like oxygen's TOMDK ! to build perhaps sometimes a completely new thinbasic module ... I am now on the right way I can feel and see it (step one from hundred!) ... but it's a very time spending work to create such a big script like thinair, thincore or tbgl , I can imagine... but there is a lot of fun, satisfaction, pleasure to do these exciting things, isn't it ???

    I add at least the little update with script and dll and stop now working with this idea for this moment ! for me it was very exciting to see how heavy and hard it is to program and compile such a new module... (eros, petr, michael, charles, roberto and all people I don't know yet) ...

    ciao, cheerio, have all a nice day, Lionheart
    - must go back at work again...

    Attached Images Attached Images
    Attached Files Attached Files
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  5. #155
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: Learning Oxygen and discussion of ideas for projects

    Frank congratulations on your first dll. I love your excitement and it is an exciting step in programming. All your study efforts are helping the rest of us and will be a nice footprint to follow to learn in the future or to refresh our understandings.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  6. #156

    Re: Learning Oxygen and discussion of ideas for projects


    Hi Frank,

    Yes that was courageous of you to dig into this code. - TOMDK really needs revising to take advantage of the newer o2h syntax. Parts of it are heavily dependent on macros, and the low level runtime was very limited.

    Once I have a run-time library without FreeBasic dependencies, I can make this much more user-friendly. There are only a few functions I have to do - file i/o for example.

    Charles

  7. #157
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    Re: Learning Oxygen and discussion of ideas for projects

    you are welcome charles... and kent for your knowing such "feelings" and sharing it, good to hear that !
    ... so I will wait some days for the next TOMDK Update

    dear oxygen friends...

    - it's possible for you (if you have time...?)... or somebody else... to check my bible-test-speed script with my lionheart_megamodule dll ??? I have played around with it and combined it with oxygen too don't see it too serious... or too close at the script...it was just an experiment for me... but it works fine... and fast, the first script even around one second faster...

    and the results are good for this thinbasic/oxygen/lionheart_megamodul script !

    [code=thinbasic] '-- speed textanalyse script for bible example by lionheart, 13.-14. may 2009

    uses "Console", "File", "Oxygen", "Lionhearts_Megamodul"
    #DEFAULT BOUNDCHECK OFF

    dim src as string

    ' -- Prepare Oxygen script
    src = "
    o2h
    function Calculate_asm(c as long) as long
    local ic, jc as double, i as long
    '
    dim a=&c
    mov eax,a
    mov edx,[eax]
    fld1
    fld1
    (
    fmul st(0),st(0)
    fstp qword ic
    fld1
    faddp st(1),st(0)
    fld st(0),st(0)
    dec edx
    jg repeat
    )
    fcomp st(0),st(0)
    '
    end function


    sub finish() at #p0
    'print `running.. testing the bible text`
    terminate
    end sub
    "
    o2_basic " print `Hello and Ciao dear Bible Tester` : terminate "

    Console_WriteLine
    Console_SetTitle("-- TextSpeedAnalyse Script with bible.txt by lionheart --")

    dim inString as string = app_sourcepath & "bible.txt"
    dim outString(1024) as string = inString & "lion_mysorted_bible.txt"
    dim t1, t2 as quad
    dim i as long

    doevents(off)
    hiResTimer_Init
    t1 = hiResTimer_Get

    printl "Reading bible text file: ", inString
    dim inStringBuffer as string = file_load(inString)

    printl "Input file size:", len(inStringBuffer), "all my bytes"

    '---Change all delimiters to $SPC chars
    dim stringSearch as string = chr$(1 to 64)+"0123456789:-|(){}&#91;]';,.?!/\^!@#$%^&*_<>=+"+$DQ+chr$(i-1)
    dim stringReplace as string = string$(len(stringSearch), $spc)
    inStringBuffer = ucase$(Replace$( inStringBuffer, any stringSearch, stringReplace))

    '---Remove all double $SPC to single $SPC in order to have all words separated by a single $SPC
    printl "Removing double spaces from buffer ..."
    inStringBuffer = trimFull$(inStringBuffer)

    '---Parse the buffer into an array
    Dim Words() As string '---All words uncounted
    Dim cWords() As string '---All words counted
    Dim nWords As Long '---Original number of words
    Dim nWordsOk As Long
    dim cWord as long
    dim Counter as long

    printl "Parsing every word into an array ..."
    nWords = PARSE(inStringBuffer, Words, $spc)

    '---Sort ASC
    printl "Sorting array asc ..."
    array sort Words

    '---Scann all words and count
    printl "Counting bible words ..."
    redim cWords(nWords)
    for Counter = 1 to nWords - 1
    cWord += 1
    if Words(Counter) <> Words(Counter + 1) then
    nWordsOk += 1
    cWords(nWordsOk) = Words(Counter) & " (" & cWord & ")"
    cWord = 0
    end if
    next

    '---Last compare to check if last item is equal to previous of is different alone
    if cWord = 0 then
    cWord += 1
    nWordsOk += 1
    cWords(nWordsOk) = Words(Counter) & " (" & cWord & ")"
    else
    cWord += 1
    cWords(nWordsOk) = Words(Counter) & " (" & cWord & ")"
    end if

    '---Redim to the last found word
    printl "Saving output results to: ", outString(1024)
    redim preserve cWords(nWordsOk)
    file_save(outString(1024), join$(cWords, $crlf))

    dim Characters(256) as long
    dim stringLen as long = len(inString)

    for i = 1 to stringLen
    Characters( asc(inString, i)+1 ) += 1
    next

    for i = 1 to 256
    if Characters(i) > 0 then outString(i) = Characters(i)+$TAB+iif$( i<4, PARSE$( inString,",F",i), chr$(i-1))
    next

    array sort outString(i), descend
    T2 = hiResTimer_Get
    printl
    printl "------ all work is done ------"
    printl
    printl "Number of all words found ....... : ", nWords
    printl "Number of unique words counted: ", nWordsOK
    printl "lionhearts total time:" & format$(t2 - t1, "#,"), "milliseconds complete "

    o2_exec
    waitkey
    [/code]

    So far as I have seen it's a little bit faster than conventional thinbasic (pur) scripts...
    ciao, best regards, good ideas for further development, see you, Lionheart

    ps: have done all in one zip folder... two scripts for testing, two dll's
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  8. #158

    Re: Learning Oxygen and discussion of ideas for projects

    LionHeart:

    Here are the results running you'r "faster" test program on my laptop--

    TOTAL TIME = 5,532.283 milliseconds

    Don
    XPS 1710

  9. #159
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    Re: Learning Oxygen and discussion of ideas for projects

    Hi don!

    very good! thank you for testing... may I ask you what script you have tested???
    as I have included in zip file two scripts... for bible text testing... I can imagine you have tested the second one..., isn't it ?

    a) Frankos_TextSpeedAnalyse_Bible_Try2_oxy.tbasic
    (after my test behaviour with notebook this script is over one second faster ! )

    or

    b) Frankos_TextSpeedAnalyse_Bible_Try_Faster_Lionmodule.tbasic
    (this script needs extra the lionheart_megamodul dll and it's running not so fast as
    my first script.. that's my experience with script speed testing for today...)

    and my mistake... must call 5.532.283 seconds, not milliseconds... I will change it...

    would be nice to hear what script you have checked...?

    good evening, by the way: what are your experiences with oxygen / thinair module ???

    ciao, Lionheart
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  10. #160

    Re: Learning Oxygen and discussion of ideas for projects

    Lionheart:

    Using TRY2_OXY, result is 5.526.163 SEC.

    Using TRY_FASTER_LIONMODULE, result is 5.726.216 SEC

    I am afraid I have not done very much with O2 so far; I am still trying to figure out how to use it with thinBasic. Some user documentation would sure be helpful.

    Don
    XPS 1710

Page 16 of 19 FirstFirst ... 61415161718 ... LastLast

Similar Threads

  1. Asimo's Learning Capabilities
    By Charles Pegge in forum Shout Box Area
    Replies: 12
    Last Post: 28-04-2010, 18:22

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
  •