Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: how to call a user script function from TB_Module?

  1. #11

    Re: how to call a user script function from TB_Module?


    This is the candidate thinCoreFB. It still has a few differences from the PB version as well as the additions but it is much easier to maintain than the previous one.

    I have included your EXT code directly.

    You are welcome to improve it, Joshy

    Charles

  2. #12

    Re: how to call a user script function from TB_Module?

    hi Charles
    do you have in your assembler "repertoire" a function that converts 10 byte floats to an ascii string ?

    I'm sure i can do it self but why if you have a working version.

    Joshy
    (Sorry about my bad English.)

  3. #13

    Re: how to call a user script function from TB_Module?

    Hi Joshy,

    Converting float to ascii is a dragon I have yet to conquer! It is one of those beasts which are a lot harder than they first appear, taking all the possible outputs into consideration. I think it will take me about 2 days, but if you can do it faster or find ready-made code then please go ahead

    Charles

  4. #14

    Re: how to call a user script function from TB_Module?

    Phew! That was hard work.

    I studied the MASM FPU code to get the correct power scaling code, and wrote it in Oxygen first before porting to FreeBasic, so it looks a bit unusual. It was much easier to do it this way with block structured programming.

    My code will support +0 -0 #INF #-INF #qNAN #sNAN. You can also control the decimal places and scientific notation etc.

    I have patched it into your EXT operator set, Joshy.

    Charles

    PS: See attachment further on


  5. #15

    Re: how to call a user script function from TB_Module?

    hi Charles

    "That was hard work." yes but a good job

    dim as ext a=1,b=3
    dim as ext c=a/b
    do you know why EXTended data type gives you only 16 decimal places ?

    this are the same places as you would use double 1.0/3.0

    Joshy
    (Sorry about my bad English.)

  6. #16

    Re: how to call a user script function from TB_Module?


    The final 2 digits are unreliable, and change as variable A is scaled 1 .. 1E+100 etc.

    But I think it might also be cumulative errors inherent in FBSTP

    you can see the last digits by setting num.dp to 17, which I have done below

    Charles

    PS: this Zip has been corrected (1 asm bug). I have withdrawn the previous one.
    Attached Files Attached Files

  7. #17

    Re: how to call a user script function from TB_Module?

    Charles far be it for me to give advice to master, but I wrote an FtoA function long ago and it reliably gives 18 digit output, one thing I got wrong was in checking for NaN's, I would post code but it's a mess and looking at the code I don't understand how some parts work (it's been a long time since i wrote it).
    one thought though, why not just output the maximum digits and use cast to double if you want less digits?
    I know it will only work as long as the extended is within the range of double, so it coud be a problem.

  8. #18

    Re: how to call a user script function from TB_Module?

    Hi Jack,

    Yes there is something strange going on. With the Oxygen version, I get an accurate 0.333333333333333. But with large powers, say 1e+200 / 3 the final 2 digits are out: 3.33333333333333320E+19.

    I'll keep on experimenting.

    Could you try running some big thirds and see what results you get with your code?

    Charles

  9. #19
    I lost all my old thinbasic module source codes and can't remember how I called a thinBasic script callback sub with one long param ?
    sub MyCallBack(byval StreamID as long)
      ' ...
    end sub
    
    Can anyone explain it again please.

    thank you

    Joshy

    USES FreeSound
    
    dim hStream as long = CreateNewMP3Stream("intro_music.mp3")
    MP3StreamSetEndCallback(hStream, "MyCallBack")
    StartMP3Stream(hStream)
    ' ...
    sub MyCallBack(byval StreamID as long) ' <--- how call it with one long param ?
         printl "end of MP3 stream !"  + str$(StreamID)
    end sub
    
    Last edited by D.J.Peters; 19-05-2013 at 14:53.
    (Sorry about my bad English.)

  10. #20
    I know how to parse the name of the callback sub
    and how i call it from module.
    But how I can set the long param before i made the call ?

    Would be really great if someone can give me the right hint.

    By the way exist source code from a module that use callbacks with params ?

    My curent work is interrupted without your help.

    Joshy
    Last edited by D.J.Peters; 20-05-2013 at 04:02.
    (Sorry about my bad English.)

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. CALL keyword with function name as string expression
    By ErosOlmi in forum Sources, Templates, Code Snippets, Tips and Tricks, Do you know ...
    Replies: 0
    Last Post: 07-09-2006, 16:16

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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