Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 500
» Latest member: protocog
» Forum threads: 2,855
» Forum posts: 26,741

Full Statistics

Latest Threads
Curious if I am thinking ...
Forum: Help Me!
Last Post: SMcNeill
4 minutes ago
» Replies: 13
» Views: 76
ADPCM compression
Forum: Petr
Last Post: Petr
2 hours ago
» Replies: 0
» Views: 16
Who wants to PLAY?
Forum: QBJS, BAM, and Other BASICs
Last Post: dbox
2 hours ago
» Replies: 15
» Views: 208
Trojan infection !
Forum: Help Me!
Last Post: SMcNeill
4 hours ago
» Replies: 1
» Views: 30
Glow Bug
Forum: Programs
Last Post: PhilOfPerth
7 hours ago
» Replies: 6
» Views: 100
BAM Sample Programs
Forum: QBJS, BAM, and Other BASICs
Last Post: CharlieJV
Today, 02:50 AM
» Replies: 36
» Views: 1,969
Audio storage, stereo swi...
Forum: Programs
Last Post: Petr
Yesterday, 09:03 PM
» Replies: 8
» Views: 363
_CONSOLEINPUT is blocking
Forum: General Discussion
Last Post: mdijkens
Yesterday, 12:24 PM
» Replies: 7
» Views: 129
Most efficient way to bui...
Forum: General Discussion
Last Post: ahenry3068
01-17-2025, 11:36 PM
» Replies: 9
» Views: 137
QBJS - ANSI Draw
Forum: QBJS, BAM, and Other BASICs
Last Post: madscijr
01-17-2025, 11:24 PM
» Replies: 4
» Views: 135

 
  using libpari
Posted by: Jack - 06-10-2022, 04:03 AM - Forum: Programs - Replies (4)

here's small demo on how you can use libpari http://pari.math.u-bordeaux.fr/
this demo show but a tiny bit of what you can do with the lib
note, some functions will only work on a real console window hence my use of $Console:Only and _Dest _Console
attached below is the libpari dll if you don't want to install Pari/gp

Code: (Select All)
_Title "libpari-demo"
$Console:Only
_Dest _Console

Declare Dynamic Library "libpari"
    Sub pari_init (ByVal parisize~&&, Byval maxprime~&&)
    Sub pari_close()
    Sub pari_print_version ()
    Function setdefault~&& (s As String, v As String, Byval flag&&)
    Function strtoGENstr~&& (s As String)
    Function setrealprecision&& (ByVal n&&, prec&&)
    Function GENtostr$ (ByVal x~&&)
    Function geval~&& (ByVal x~&&)
    Sub outmat (ByVal x~&&)
    Function gp_input~&& ()
    Function stoi~&& (ByVal x&&)
    Function abscmpiu& (ByVal x~&&, Byval y As _Unsigned _Integer64)
    Function abscmpui& (ByVal x As _Unsigned _Integer64, Byval y~&&)
    Function absequaliu& (ByVal x~&&, Byval y As _Unsigned _Integer64)
    Function gequal& (ByVal x~&&, Byval y~&&)
    Function gcmp& (ByVal x~&&, Byval y~&&)
End Declare

Dim As _Unsigned _Integer64 a, b, c, d, e, f
Dim As String s1, s2, s3
Dim As _Integer64 flag, prec

pari_init 80000000, 500000
pari_print_version
Print
prec = setrealprecision(50, prec)
s1 = "seriesprecision" + Chr$(0): s2 = "12" + Chr$(0)
f = setdefault(s1, s2, flag)
s1 = "fibonacci(300)" + Chr$(0)
a = strtoGENstr(s1) 'convert to GEN string
b = geval(a) 'eval the string in a
'outmat b
s3 = GENtostr(b) 'convert GEN to string
Print "fibonacci(300) = "; s3

s1 = "50!" + Chr$(0)
a = strtoGENstr(s1) 'convert to GEN string
b = geval(a) 'eval the string in a
'outmat b
s3 = GENtostr(b) 'convert GEN to string
Print "50! = "; s3

s1 = "sin(x)" + Chr$(0)
a = strtoGENstr(s1) 'convert to GEN string
b = geval(a) 'eval the string in a
'outmat b
s3 = GENtostr(b)
Print "sin(x) = "; s3

Print "evaluate a tiny program: for(i=2, 10, print(sqrt(i)))"
s1 = "for(i=2, 10, print(sqrt(i)))" + Chr$(0)
a = strtoGENstr(s1)
c = geval(a)
Print
Print "enter an expression or simply press return to exit the loop"

s1 = " "
While s1 <> ""
    Input "enter an expression ", s1
    s2 = s1 + Chr$(0)
    c = strtoGENstr(s2)
    a = geval(c)
    outmat a
Wend

'Print "enter an A ";: a = gp_input
'Print "enter an B ";: b = gp_input
'Print gequal(a, b)
'Print gcmp(a, b)
'Print abscmpiu(a, 0)
'Print abscmpui(0, a)
'Print absequaliu(a, 0)

s1 = "plot(x=-Pi,Pi,sin(x))" + Chr$(0)
a = strtoGENstr(s1) 'convert to GEN string
Print "sin(x) = ";
b = geval(a) 'eval the string in a

pari_close
output
Code: (Select All)
                                      GP/PARI CALCULATOR Version 2.13.4 (released)
                              amd64 running mingw (x86-64/GMP-6.1.2 kernel) 64-bit version
                              compiled: Mar 25 2022, gcc version 8.3-posix 20190406 (GCC)
                                                threading engine: single
                                    (readline v8.0 disabled, extended help enabled)

fibonacci(300) = 222232244629420445529739893461909967206666939096499764990979600
50! = 30414093201713378043612608166064768844377641568960512000000000000
sin(x) = x - 1/6*x^3 + 1/120*x^5 - 1/5040*x^7 + 1/362880*x^9 - 1/39916800*x^11 + O(x^13)
evaluate a tiny program: for(i=2, 10, print(sqrt(i)))
1.4142135623730950488016887242096980785696718753769
1.7320508075688772935274463415058723669428052538104
2.0000000000000000000000000000000000000000000000000
2.2360679774997896964091736687312762354406183596115
2.4494897427831780981972840747058913919659474806567
2.6457513110645905905016157536392604257102591830825
2.8284271247461900976033774484193961571393437507539
3.0000000000000000000000000000000000000000000000000
3.1622776601683793319988935444327185337195551393252
[edit] the plot looked real bad in the post



Attached Files
.zip   libpari.zip (Size: 4.33 MB / Downloads: 69)
Print this item

  Well this was fun. Wndows hotkeys...
Posted by: Pete - 06-09-2022, 10:34 PM - Forum: General Discussion - No Replies

I expanded a bit on one of Dav's old programs, that used Shift + A to restore an automatically minimized window.

This demo uses the F3 key. It has (3) effects. The usual min and restore effect, which shows a shadow effect as the window changes to minimized and restored, a method that eliminates that effect, and one that merely hides the window and restores it. Use TAB to select which effect to use.

Obviously, this works on Windows platforms, only....

Code: (Select All)
REM Based on the "Cheapo Windows Hotkey" program coded by Dav.

DECLARE DYNAMIC LIBRARY "user32"
    REM FUNCTION FindWindowA%& (BYVAL ClassName AS _OFFSET, WindowName$) 'find process handle by title
    FUNCTION GetKeyState% (BYVAL nVirtKey AS LONG) 'Windows virtual key presses
    FUNCTION ShowWindow& (BYVAL hwnd AS _OFFSET, BYVAL nCmdShow AS LONG) 'maximize process
    FUNCTION GetForegroundWindow%& 'find currently focused process handle
    FUNCTION SetForegroundWindow& (BYVAL hwnd AS _OFFSET) 'set foreground window process(focus)
END DECLARE

title$ = "Minimize-Restore Windows Demo" 'title of program window
_TITLE title$

DO
    i = i + 1
    _LIMIT 10
    REM hwnd%& = FindWindowA(0, title$ + CHR$(0)) 'find this program's process handle
    hwnd%& = _WINDOWHANDLE
    IF i > 100000 THEN PRINT "Cannot obtain window handle.": END
LOOP UNTIL hwnd%&

keyact = 114
status = 0 ' Regular window.
DO
    _LIMIT 30

    SELECT CASE status

        CASE 0

            IF msg = 0 THEN
                CLS
                PRINT "Press F3 to toggle minimize / restore window.": PRINT
                msg = 1
                y% = CSRLIN
                GOSUB menu
            END IF

            IF GetKeyState(9) < 0 THEN
                LOCATE y%, 1: PRINT SPACE$(_WIDTH);: LOCATE y%, 1
                demo = demo + 1: IF demo > 2 THEN demo = 0
                GOSUB menu
                DO: _LIMIT 30: LOOP UNTIL GetKeyState(9) >= 0
            END IF

            IF GetKeyState(keyact) < 0 THEN '<==== F3

                SELECT CASE demo
                    CASE 0 ' Minimize with effect.
                        x& = ShowWindow&(hwnd%&, 2)
                    CASE 1 ' Minimize without effect.
                        x& = ShowWindow&(hwnd%&, 0)
                        _DELAY .33
                        x& = ShowWindow&(hwnd%&, 2)
                        x& = ShowWindow&(hwnd%&, 5)
                    CASE 2 ' Hide window only.
                        y& = ShowWindow&(hwnd%&, 0)
                END SELECT

                DO: _LIMIT 30: LOOP UNTIL GetKeyState(keyact) >= 0

                status = 1

            END IF

        CASE 1
            IF GetKeyState(keyact) < 0 THEN '<==== F3
                FGwin%& = GetForegroundWindow%& 'get current process in focus

                LOCATE _HEIGHT - 2, 1
                PRINT SPACE$(_WIDTH);
                LOCATE _HEIGHT - 2, 1
                PRINT "Program Handle:"; hwnd%&; "Focus handle:"; FGwin%&;

                SELECT CASE demo
                    CASE 0 ' Restore with effect.
                        y& = ShowWindow&(hwnd%&, 9) ' Restore to original state.
                    CASE 1 ' Restore without effect.
                        y& = ShowWindow&(hwnd%&, 0)
                        _DELAY .3
                        y& = ShowWindow&(hwnd%&, 9)
                        y& = ShowWindow&(hwnd%&, 5)
                    CASE 2 ' Show window only.
                        DO
                            y& = ShowWindow&(hwnd%&, 5)
                        LOOP UNTIL y&
                END SELECT

                IF FGwin%& <> hwnd%& THEN z& = SetForegroundWindow&(hwnd%&) 'set focus when necessary

                LOCATE _HEIGHT, 1
                PRINT "Return Values:"; " Was/Is Minimized/Hidden"; x&; " Was/Is Restored"; y&; " Reactivated"; z&;

                DO: _LIMIT 30: LOOP UNTIL GetKeyState(keyact) >= 0

                status = 0
            END IF

    END SELECT

LOOP UNTIL INKEY$ = CHR$(27) AND status = 0
SYSTEM

menu:
SELECT CASE demo
    CASE 0
        PRINT "Tab Menu: Show screen on transition and minimize.": PRINT
    CASE 1
        PRINT "Tab Menu: Hide screen on transition and minimize.": PRINT
    CASE 2
        PRINT "Tab Menu: Hide window on transition.": PRINT
END SELECT
RETURN

REM ============================== VALUES ===================================

$IF  THEN
        SW_HIDE
        0           Hides the window and activates another window.
        ---------------------------------------------------------------------------------------------
        SW_SHOWNORMAL
        SW_NORMAL
        1           Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position.            An application should specify this flag when displaying the window for the first time.
        ---------------------------------------------------------------------------------------------
        SW_SHOWMINIMIZED
        2           Activates the window and displays it as a minimized window.
        ---------------------------------------------------------------------------------------------
        SW_SHOWMAXIMIZED
        SW_MAXIMIZE
        3           Activates the window and displays it as a maximized window.
        ---------------------------------------------------------------------------------------------
        SW_SHOWNOACTIVATE
        4           Displays a window in its most recent size and position. This value is similar to SW_SHOWNORMAL, except that the window is not activated.
        ---------------------------------------------------------------------------------------------
        SW_SHOW
        5           Activates the window and displays it in its current size and position.
        ---------------------------------------------------------------------------------------------
        SW_MINIMIZE
        6           Minimizes the specified window and activates the next top-level window in the Z order.
        ---------------------------------------------------------------------------------------------
        SW_SHOWMINNOACTIVE
        7           Displays the window as a minimized window. This value is similar to SW_SHOWMINIMIZED, except the window is not activated.
        ---------------------------------------------------------------------------------------------
        SW_SHOWNA
        8           Displays the window in its current size and position. This value is similar to SW_SHOW, except that the window is not activated.
        ---------------------------------------------------------------------------------------------
        SW_RESTORE
        9           Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
        ---------------------------------------------------------------------------------------------
        SW_SHOWDEFAULT
        10          Sets the show state based on the SW_ value specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.
        ---------------------------------------------------------------------------------------------
        SW_FORCEMINIMIZE
        11          Minimizes a window, even if the thread that owns the window is not responding. This flag should only be used when minimizing windows from a different thread.
        ---------------------------------------------------------------------------------------------
$END IF

Pete

Print this item

  Could someone explain these references I keep seeing to compiling with "-O2"?
Posted by: hanness - 06-09-2022, 08:50 PM - Forum: General Discussion - Replies (4)

I'm not clear what these optimizations do. Could someone give me a basic explanation of what this is?

If I want to try this in 0.8.0, do I simply plug that into Options > C++ Compiler Settings > C++ Compiler Flags?

Are there any negatives to using this flag that I should be aware of?

Print this item

  0.71 Info on compilation error
Posted by: krovit - 06-07-2022, 12:02 PM - Forum: Help Me! - Replies (7)

I attach the report of the failed compilation that I obtained.

With version 0.6, however, there were no errors.

Thank You



Attached Files
.txt   compilelog.txt (Size: 848 bytes / Downloads: 59)
Print this item

  idea - a "Rosetta Code" of classic games?
Posted by: madscijr - 06-07-2022, 11:25 AM - Forum: General Discussion - No Replies

What could be interesting and cool would be a sub-wiki or thread dedicated to simply compiling links (+source code) to versions of every classic game done in QB64 (or a link to source code for any done in another language). This might help beginning programmers looking to recreate a certain game or learn.

Print this item

  the apocalypse!
Posted by: krovit - 06-06-2022, 08:45 PM - Forum: General Discussion - Replies (20)

Hi!!

We all worried when there was the change at the top of QB64 and the reassurances were not enough to dispel the doubts...

I'm definitely off topic but try to understand me... I don't know anything about what happened and I can't orient myself... it's gone (almost) everything... and qb64 looks dead (for sure he is dying).

QB64 Phoenix is a fork of QB64... ?

In addition to all this there is also the fact of the language (I do not speak English) which makes everything more difficult

Years of development in QB64 destined to die... is it possible that this is destiny?

Tell me something please and inform me about the situation...

Thank you!

------
I read the presentation of SMcNeill but you know and give for obvious a bunch of things that I do not know.
And if qb64 phonex is a "clone" of qb64 as compatible with the original?

Print this item

  Old forum threads on Ping usuage
Posted by: doppler - 06-06-2022, 01:06 PM - Forum: Help Me! - Replies (3)

Someone has access to the old forum threads ?  In need to monitor some raspberry pi's on my home network using ping.  I know the old forum had some before it all got nuked.  Some very good examples and code.  I should have saved a couple (my bad).

If someone saved the old forum (pre-nuking) please provide a URL.

Print this item

  DavsIDE - Alternative IDE for the QB64 compiler
Posted by: Dav - 06-06-2022, 02:07 AM - Forum: Dav - Replies (24)

DavsIDE is an alternative IDE to use with QB64.  I started this back in 2010, when QB64's IDE was still very slow to use.   However, the QB64 IDE today is FAR better than back in 2010 , making my IDE almost useless now.  Although DavsIDE is no longer being actively developed, I will update it from time to time to correct bugs and to thank the people that have supported it over the years.  It has a read me file (DavsIDE.txt) so read that for more information on how to use the IDE. 

- Dav

NOTE: This is for Windows only, and is in .EXE format only, no source included.

Latest version:  

.zip   davside-v131.zip (Size: 467.75 KB / Downloads: 400) (Uses the newer font, with more selectable font sizes,  8pt to 18pt)

Older version:

.zip   davside-v130.zip (Size: 452.31 KB / Downloads: 153)   (Uses the older font, selectable sizes 12pt, 14pt, 16pt)

   

Print this item

  BUG? Compile errors with filenames that contain $ in them.
Posted by: Dav - 06-05-2022, 04:09 PM - Forum: General Discussion - Replies (3)

Working with an error in my QB64 IDE, with the help of RNBW, (posted about here) it was discovered the latest version of QB64 won't compile correctly when the .BAS filename has an $ in it.  Previous QB64 versions did compile them, but not v0.6 and newer.

Example, save a file with $ in it, like Money$.bas, it will have a compile error.  Without the $ it will compile.

- Dav

Print this item

  Reading a single value from Registry (Win)
Posted by: euklides - 06-05-2022, 03:51 PM - Forum: General Discussion - Replies (1)

I'm looking for a way to read a single value from the registry (Win).



This exemple lists recents files opened in CorelDRAW Home & Student

Program written in VBA Excel.

Is it possible to have something same in QB64 ???

Thank's for help.



'---VBA EXCEL PROG---

a$ = "HKEY_CURRENT_USER\Software\Corel\CorelDRAW Home & Student\18.0\PPHome\Application Preferences\Framework\RecentFiles"

MsgBox RegKeyRead(a$)

stop

'---

Function RegKeyRead(i_RegKey As String) As String

Dim myWS As Object

  On Error Resume Next

    Set myWS = CreateObject("WScript.Shell")

    RegKeyRead = myWS.RegRead(i_RegKey)

End Function



'---

Print this item