Author Topic: QB64 v1.4 Release Candidate up for testing  (Read 18818 times)

0 Members and 1 Guest are viewing this topic.

Offline odin

  • Administrator
  • Newbie
  • Posts: 92
  • I am.
    • View Profile
QB64 v1.4 Release Candidate up for testing
« on: January 19, 2020, 11:18:54 am »
First things first, we have moved development to a new GitHub repository. Follow us at https://github.com/QB64Team/qb64.

Although we don't follow a strict schedule regarding updates to QB64, every once in a while a feature that's been requested gets implemented or a new bug is found and then fixed, and eventually we have enough for a new release.

We have named the upcoming release QB64 v1.4, and it's already available in the development channel (accessible at http://www.qb64.org/devbuilds.php). Although you can follow development by checking out our repository on GitHub (https://github.com/QB64Team/qb64/commits/development), the time for us to compile a more concise changelog has finally come.

One big change worth mentioning first, since it affects QB64 code from now on in a big way, is the new $NOPREFIX metacommand.

QB64-specific keywords, those that expand on the original set of keywords from QBasic/QuickBASIC 4.5, which we aim to replicate, are those that start with an underscore. It has been designed that way so that, in the event that you want to load an older program you wrote back in the day that had variables or procedures with identical names, they would not collide with the new keywords, making it possible to use QB64 entirely as you did with QBasic but also add the new functionality without breaking anything.

However, we have over the years been following our userbase create more and more programs that have no dependency whatsoever on older code, which means these aren't just QBasic programs with benefits, but actually QB64-native programs, written from scratch with QB64 in mind.

All that said, the new $NOPREFIX metacommand allows you, for the first time ever, to write QB64 programs without having to add the leading underscore to use the modern keywords.

That will allow code like this:

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 600, 32)
  2. COLOR _RGB32(255), _RGB32(255, 0, 255)
  3. m$ = "Hello, world!"
  4.  
  5.     _DISPLAY
  6.     _LIMIT 30
To be written as:

Code: QB64: [Select]
  1. SCREEN NEWIMAGE(800, 600, 32)
  2. COLOR RGB32(255), RGB32(255, 0, 255)
  3. m$ = "Hello, world!"
  4. PRINTSTRING ((WIDTH - PRINTWIDTH(m$)) \ 2, (HEIGHT - FONTHEIGHT) \ 2), m$
  5.  
  6.     DISPLAY
  7.     LIMIT 30
  8. LOOP UNTIL KEYHIT
With the new metacommand in use, a program can both use _DISPLAY and DISPLAY, for example. User variables and procedures still cannot start with a single underscore (double underscores are accepted).

Here's the complete changelog, for now. We invite you to try the development build and help us test (and try to break) the new features, so that we can polish everything for release as soon as possible:

https://www.qb64.org/portal/changelog-of-v1-4/
« Last Edit: February 06, 2020, 10:06:04 am by odin »

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #1 on: January 19, 2020, 02:18:19 pm »
Example of _DEFLATE$ and _INFLATE$ to compress/decompress a string:

Code: QB64: [Select]
  1.  
  2. a$ = "The quick brown fox jumps over the lazy dog. "
  3. PRINT "Original string (a$): ";
  4. COLOR 15: PRINT a$: COLOR 7
  5. FOR i = 1 TO 15
  6.     a$ = a$ + a$
  7.  
  8. PRINT "After concatenating it into itself several times, LEN(a$) =";
  9. COLOR 12: PRINT LEN(a$): COLOR 7
  10.  
  11. PRINT "Hit any key..."
  12. i$ = INPUT$(1)
  13.  
  14. b$ = _DEFLATE$(a$)
  15. PRINT "After using _DEFLATE$ to compress it, LEN =";
  16. COLOR 10: PRINT LEN(b$): COLOR 7
  17.  
  18. PRINT "Hit any key..."
  19. i$ = INPUT$(1)
  20.  
  21. c$ = _INFLATE$(b$)
  22. PRINT "After using _INFLATE$ to decompress it, LEN =";
  23. COLOR 12: PRINT LEN(c$): COLOR 7
  24.  
  25. PRINT "Hit any key to display the decompressed string..."
  26. i$ = INPUT$(1)
  27.  
  28.  
« Last Edit: January 19, 2020, 02:19:51 pm by FellippeHeitor »

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #2 on: January 19, 2020, 02:37:12 pm »
The $ASSERTS metacommand enables the _ASSERT macro, which can be used to perform tests in code that's in development, for debugging purposes. After the code is considered error-free, you can disable error checking by removing the $ASSERTS metacommand from the top of your program, and then all tests will be ignored.

IF $ASSERTS:CONSOLE is used instead, an optional error message is output to the console window, to help with debugging.

When the condition specified in the _ASSERTS statement isn't met, execution is interrupted and an error message with "_ASSERT failed on line #" is displayed.

Sample usage:

Code: QB64: [Select]
  1. $ASSERTS:CONSOLE
  2.  
  3.     a = INT(RND * 10)
  4.     b$ = myFunc$(a)
  5.     PRINT a, , b$
  6.     _LIMIT 3
  7.  
  8. FUNCTION myFunc$ (value AS SINGLE)
  9.     _ASSERT value > 0, "Value cannot be zero"
  10.     _ASSERT value <= 10, "Value cannot exceed 10"
  11.  
  12.     IF value > 1 THEN plural$ = "s"
  13.     myFunc$ = STRING$(value, "*") + STR$(value) + " star" + plural$ + " :-)"

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #3 on: January 19, 2020, 02:52:35 pm »
_PUTIMAGE would generate an error if the source and destination images were the same. In the upcoming version, QB64 generates a copy of the source image in memory first, so that source and destination can be the same in a copy operation.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1000, 250, 32)
  2.  
  3. FOR i = 1 TO 100
  4.     CIRCLE (250, 125), i, _RGB32(RND * 255, RND * 255, RND * 255)
  5.  
  6. _PRINTSTRING (500, 0), "Press a key to copy that circle..."
  7. a$ = INPUT$(1)
  8.  
  9. _PUTIMAGE (500, 0), , , (0, 0)-(500, 250)
  10.  

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #4 on: January 19, 2020, 03:00:13 pm »
$COLOR:0 or $COLOR:32 add named color constants to your programs:

Code: QB64: [Select]
  1. COLOR BrightWhite, Red
  2. PRINT "Bright white on red."
  3.  

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(640, 400, 32)
  2. COLOR CrayolaGold, DarkCyan
  3. PRINT "CrayolaGold on DarkCyan."
  4.  

Color references: color0.bi and color32.bi

These are not compatible with $NOPREFIX, as there are QB64 functions with color names (_RED, _GREEN, _BLUE), so the metacommands have exclusive usage over each other.
« Last Edit: January 19, 2020, 03:01:40 pm by FellippeHeitor »

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #5 on: January 19, 2020, 03:13:57 pm »
Steve demoed the new $CONSOLE functionality for Windows:
Code: QB64: [Select]
  1.  
  2. PRINT "Welcome to a demostration of the Windows Console System for QB64,"
  3. PRINT "as overhauled by Steve!"
  4. PRINT "First, allow me to illustrate two newly implemented commands: SLEEP and CLS"
  5. Pause
  6. PRINT "And now, I'll illustrate how to change colors in the console:"
  7. FOR i = 0 TO 15
  8.     COLOR i, 15 - i
  9.     PRINT "COLORS:"; i; "ON"; 15 - i
  10. Pause
  11. PRINT "And now, we're going to have fun with the console size."
  12. PRINT "Our original screen should be set at 80x25 for default."
  13. PRINT "Press <ANY KEY> when ready to change modes."
  14. Pause
  15. WIDTH 120, 50
  16. PRINT "Here we're set at 120x50."
  17. Pause
  18. WIDTH 120, 50, 120, 50
  19. PRINT "And here we no longer have a scroll buffer; it's also 120x50."
  20. PRINT "Notice the vertical scroll bar is gone?"
  21. Pause
  22. WIDTH 100, 33, 300, 150
  23. PRINT "And here we now have both a vertical and a hortizontal scroll bar."
  24. FOR i = 1 TO 50
  25.     PRINT "See? ";
  26.     _LIMIT 10
  27. PRINT "Be certain to scroll the bar so you can 'See' all the text."
  28. Pause
  29. PRINT "And, of course, I can now work with LOCATE..."
  30. LOCATE 10, 10: PRINT "LOCATE 10,10"
  31. LOCATE 20: PRINT "LOCATE 20"
  32. LOCATE , 20: PRINT "LOCATE ,20"
  33. Pause
  34. PRINT "And, of course, I can now get back single character returns..."
  35. PRINT "Press any key, and I'll give you the scan code for it.  <ESC> quits the demo."
  36.     x = _CONSOLEINPUT
  37.     IF x = 1 THEN 'don't update for mouse input
  38.         c = _CINP
  39.         PRINT c;
  40.     END IF
  41. LOOP UNTIL c = 1
  42.  
  43. SUB Pause
  44.     PRINT
  45.     PRINT "Press <ANY KEY> to continue."
  46.     SLEEP
  47.  

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #6 on: January 19, 2020, 03:24:09 pm »
Use _NUMLOCK, _CAPSLOCK and _SCROLLLOCK to read these keys' states.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 300, 32)
  2.  
  3. PRINT "Try toggling your caps, num and scroll lock keys..."
  4. PRINT "ESC to quit"
  5.  
  6.         LINE (10, 150)-STEP(80, 50), _RGB32(255), B
  7.         LINE (20, 160)-STEP(5, 5), _RGB32(255, 200, 0), BF
  8.     ELSE
  9.         LINE (10, 150)-STEP(80, 50), _RGB32(120), B
  10.         LINE (20, 160)-STEP(5, 5), _RGB32(120), BF
  11.     END IF
  12.  
  13.         LINE (600, 10)-STEP(50, 50), _RGB32(255), B
  14.         LINE (610, 20)-STEP(5, 5), _RGB32(255, 200, 0), BF
  15.     ELSE
  16.         LINE (600, 10)-STEP(50, 50), _RGB32(120), B
  17.         LINE (610, 20)-STEP(5, 5), _RGB32(120), BF
  18.     END IF
  19.  
  20.         LINE (700, 60)-STEP(50, 50), _RGB32(255), B
  21.         LINE (710, 70)-STEP(5, 5), _RGB32(255, 200, 0), BF
  22.     ELSE
  23.         LINE (700, 60)-STEP(50, 50), _RGB32(120), B
  24.         LINE (710, 70)-STEP(5, 5), _RGB32(120), BF
  25.     END IF
  26.  
  27.     _DISPLAY
  28.     _LIMIT 30

You can use _CAPSLOCK ON/OFF/_TOGGLE, _NUMLOCK ON/OFF/_TOGGLE or _SCROLLLOCK ON/OFF/_TOGGLE, although it is advisable to avoid changing these keys' states without your users' request.
« Last Edit: January 19, 2020, 03:25:29 pm by FellippeHeitor »

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #7 on: January 19, 2020, 03:45:07 pm »
BIT functions and examples provided by Cobalt:

_TOGGLEBIT:
Code: QB64: [Select]
  1. A~%% = 0 '_UNSIGNED _BYTE
  2. PRINT A~%%
  3. A~%% = _TOGGLEBIT(A~%%,4) 'toggle the fourth bit of A~%%
  4. PRINT A~%%
  5. A~%% = _TOGGLEBIT(A~%%,4) 'toggle the fourth bit of A~%%
  6. PRINT A~%%

_RESETBIT:
Code: QB64: [Select]
  1. A~%% = 0 '_UNSIGNED _BYTE
  2. PRINT A~%%
  3. A~%% = _SETBIT(A~%%,6) 'set the seventh bit of A~%%
  4. PRINT A~%%
  5. A~%% = _RESETBIT(A~%%,6) 'Reset the seventh bit of A~%%
  6. PRINT A~%%

_READBIT:
Code: QB64: [Select]
  1. A~%% = _SETBIT(A~%%,4)
  2. PRINT "Bit 4 is currently ";
  3. IF _READBIT(A~%%,4) = -1 THEN PRINT "ON" ELSE PRINT "OFF"
  4. PRINT "And bit 2 is currently ";
  5. IF _READBIT(A~%%,2) = -1 THEN PRINT "ON" ELSE PRINT "OFF"

_SETBIT:
Code: QB64: [Select]
  1. A~%% = 0 '_UNSIGNED _BYTE
  2. PRINT A~%%
  3. A~%% = _SETBIT(A~%%,6) 'set the seventh bit of A~%%
  4. PRINT A~%%

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #8 on: January 19, 2020, 06:26:05 pm »
Thank you! I just put all the files on top of v. 1.3 and just to check it it works fine so far with the $NOPREFIX which is the first thing I checked. But I clicked Help and About and it still says v. 1.3. I wonder if it's because I overlapped the older files? I did it this way so I won't have to try and move all the programs I've made.
Also, for some reason it won't let me click About more than once when the window is maximized. I have to minimize it first to click it again. This is the 64 bit Windows version.
« Last Edit: January 19, 2020, 06:28:34 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #9 on: January 19, 2020, 06:37:06 pm »
Thank you! I just put all the files on top of v. 1.3 and just to check it it works fine so far with the $NOPREFIX which is the first thing I checked. But I clicked Help and About and it still says v. 1.3. I wonder if it's because I overlapped the older files? I did it this way so I won't have to try and move all the programs I've made.
Also, for some reason it won't let me click About more than once when the window is maximized. I have to minimize it first to click it again. This is the 64 bit Windows version.

Yeah I have v 1.3 too and files not overlapped so I guess they haven't changed version number.

I notice and not just with this version when the window is maximized the screen is half a line off and all mouse clicks have to be done on the top half of every line.

Let me guess in full screen mode you have a black crack along the top like this:

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #10 on: January 19, 2020, 06:59:56 pm »
Yeah, version number hadn't been updated yet, only functionality. I just changed it on the server now.

Although you guys got lucky, it's never a good idea to unpack a new version of QB64 on top of an older one, keep that in mind if things go awry at some point. Since you guys are willing to help us test it, unpacking it to a clean folder is highly recommended, as we won't know if any issue that may arise only happened because of old files getting in the way.

About not being able to click the menu bar, it is indeed an old render issue that's in OpenGL's hands; it occurs with the IDE because it runs in text mode (SCREEN 0) and when the Window size isn't a multiple of 16 you'll get the black bars. I advise not using the maximize button if your screen resolution gives you that type of issue. Just stretch the window manually to fill the screen and it should resize properly.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #11 on: January 19, 2020, 11:56:28 pm »
Thanks B+ and Felippe. Oh well, if something bad happens I'll put the old version back where it was. lol

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #12 on: January 20, 2020, 05:20:28 am »
By the time that all the skilled guys have beta-tested the latest version, you may be able to fully release on Feb 14th - the 14 and v1.4 correspond.  So why not (in the manner of the Ghastly Product Names dept. of Microsoft) name the new version QB64 Valentine?
I only say this because it happens to be my birthday, so please arrange delivery of suitably romantic gifts.  I thank you!

« Last Edit: January 26, 2020, 07:44:32 am by Qwerkey »

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #13 on: January 22, 2020, 03:47:59 am »
Question for the IDE-Gurus,

would it be easily possible to add at least the proper indention to code which uses line continuation?
I understand it's tricky to properly format all the tokens, as there may also user intended formatting to align lines. What I mean is just to add the proper indention (according to the current block scope) in front of each line, but leave the rest of the lines as is, hence make this
Code: QB64: [Select]
  1. a$="Hello "+_
  2.    "World "+_
  3.    "!!"
  4.  

into this
Code: QB64: [Select]
  1.     a$="Hello "+_
  2.        "World "+_
  3.        "!!"
  4.  

it would already be a great enhencement for readability of those multiline statements, as they no longer completely disrupt the block formatting.
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

FellippeHeitor

  • Guest
Re: QB64 v1.4 Release Candidate up for testing
« Reply #14 on: January 22, 2020, 05:54:48 am »
I'll have a look into it, no promises for 1.4 though.