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

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #30 on: January 23, 2020, 10:07:21 pm »
...Would make for a nice QB64 photo viewer.

Thanks guys,

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline doppler

  • Forum Regular
  • Posts: 241
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #31 on: January 23, 2020, 10:10:23 pm »
Just a thought.  Inflating/compression is all fine and dandy.  Is there someway to encrypt the data too?  Encrypt/decrypt pairing with inflate/compression to secure data being written.  PGP would be a good candidate.  I have not used it in a long time.  I think there is a DLL that can be exploited to handle all the niceties.

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #32 on: January 25, 2020, 09:45:24 am »
So far so good. I've removed all underscores from my present project with no issues.

I really like the bit operators. They allowed me to eliminate a bunch of wasteful DIM SHARED bytes that I've been using as true/false display toggles, and put all toggles into a single DIM SHARED unsigned integer and just flip, set, reset and read the bits of that integer variable. It eliminated 9 additional toggle definitions and still allowed 6 more bit slots for future expansion. If I need more than that, I can just go to a long. Easy Peasy and helps clean up the main module some.

I could then set an initial state (for example from my project):
togs = &B0000000110001101

...and go from there. It took me a couple tries to figure out the little endian/big endian scheme of it, which was probably why trying the bitwise math operations were not working well for me. I really must learn to read from right to left better. This has been a cool addition for a slow learner like me, and works well in my application.

and just a parting thought for version 1.5...

Would it be feasible to do something like a multiple bit setter that handles the endian issue? Calling it _MULTIBIT or _XBITS or some such...

e.g.  result = _MULTIBIT(numericalVariable, bit0 thru bit{n})

which would, for the preceding example, be something like:

togs = _MULTIBIT(togs, 101100011) ' then leave any excess bits as reset

don't know if that would be useful enough to bother with, just a thought from a really lazy coder... ;)

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #33 on: January 25, 2020, 05:40:08 pm »
I like to blink the leds!  However, this doesn't blink the status lights.  I did download 1.4 and installed
it to a fresh folder.  Says it's 1.4 under Help too.   Using _TOGGLE instead of ON or OFF didn't work either.

I'm using Windows XP on a 64 bit machine, with 32 bit versions of QB64. 

Code: QB64: [Select]
  1. oldcap%% = _CAPSLOCK '                      save current state for restoration on exit
  2. oldnum%% = _NUMLOCK
  3. oldscroll%% = _SCROLLLOCK
  4.  
  5. _CAPSLOCK OFF '                             turn all off
  6.  
  7. _SCREENHIDE '                               nothing to see here people, move along!
  8.  
  9. DO: _LIMIT 10 '                             blink each led
  10.     FOR i = 1 TO 3
  11.         SELECT CASE i
  12.             CASE i = 1: _CAPSLOCK _on
  13.             CASE i = 2: _NUMLOCK ON
  14.             CASE i = 3: _SCROLLLOCK ON
  15.         END SELECT
  16.         _DELAY .1
  17.         SELECT CASE i
  18.             CASE i = 1: _CAPSLOCK OFF
  19.             CASE i = 2: _NUMLOCK OFF
  20.             CASE i = 3: _SCROLLLOCK OFF
  21.         END SELECT
  22.     NEXT i
  23. LOOP UNTIL LEN(INKEY$) '                    key pressed, done
  24.  
  25. IF oldcap%% THEN _CAPSLOCK ON ELSE _CAPSLOCK OFF '          restore entry settings
  26.  
  27.  
It works better if you plug it in.

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #34 on: January 25, 2020, 06:33:15 pm »
I like to blink the leds!  However, this doesn't blink the status lights.  I did download 1.4 and installed
it to a fresh folder.  Says it's 1.4 under Help too.   Using _TOGGLE instead of ON or OFF didn't work either.

I'm using Windows XP on a 64 bit machine, with 32 bit versions of QB64. 

I couldn't get it to work until I made the changes to the CASE statements, then the lights blinked just fine.

Now for the funny part.... I couldn't get the INKEY stop to work unless I maximized the "output" screen, which was all white. However, when I did that, the IDE behind it started doing the funny left margin blinking that I posted about earlier.

Code: QB64: [Select]
  1. oldcap%% = _CAPSLOCK '                      save current state for restoration on exit
  2. oldnum%% = _NUMLOCK
  3. oldscroll%% = _SCROLLLOCK
  4.  
  5. _CAPSLOCK OFF '                             turn all off
  6.  
  7. _SCREENHIDE '                               nothing to see here people, move along!
  8.  
  9. DO: _LIMIT 10 '                             blink each led
  10.     FOR i = 1 TO 3
  11.         SELECT CASE i
  12.             CASE IS = 1: _CAPSLOCK ON
  13.             CASE IS = 2: _NUMLOCK ON
  14.             CASE IS = 3: _SCROLLLOCK ON
  15.         END SELECT
  16.         _DELAY .1
  17.         SELECT CASE i
  18.             CASE IS = 1: _CAPSLOCK OFF
  19.             CASE IS = 2: _NUMLOCK OFF
  20.             CASE IS = 3: _SCROLLLOCK OFF
  21.         END SELECT
  22.     NEXT i
  23. LOOP UNTIL LEN(INKEY$) '                    key pressed, done
  24.  
  25. IF oldcap%% THEN _CAPSLOCK ON ELSE _CAPSLOCK OFF '          restore entry settings
  26.  

EDIT: When running Richard's code, I can pretty reliably get the number line margin to flash apparently randomly. I then maximize the screen from his code and hit a key to stop it. After which, I don't touch any mouse button, but rather roll the mouse wheel and the margin will flash while doing so. If I click on a line to set a highlight, the flashing stops.
« Last Edit: January 25, 2020, 06:47:46 pm by OldMoses »

Offline euklides

  • Forum Regular
  • Posts: 128
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #35 on: January 26, 2020, 05:08:41 am »
_Deflate$ et _inflate$ work fine !!!

Il took a text from a long batch file (text from a ebook, 3823 lines) et wrote this little program:
'reading
OPEN "c:\temp\myfile.txt" FOR INPUT AS 1: WHILE NOT EOF(1): LINE INPUT #1, a$
TX$ = TX$ + a$ + CHR$(13) + CHR$(10): WEND: CLOSE
PRINT "Len of tx$ is " + STR$(LEN(TX$)) 'here I had 812804

'deflating
TXD$ = _DEFLATE$(TX$)
PRINT "Len of TXD$ is " + STR$(LEN(TXD$)) 'here I had 309067

'puting the deflated text in a binary
OPEN "c:\temp\TEST.BIN" FOR BINARY AS #1
PUT #1, , TXD$: CLOSE 1

'reading the deflated text
OPEN "c:\temp\TEST.BIN" FOR BINARY AS #1
TXE$ = SPACE$(LOF(1)):GET #1, , TXE$: CLOSE #1
'inflating
TX1$ = _INFLATE$(TXE$)
'testing
IF TX1$ = TX$ THEN PRINT "ok" ELSE PRINT " error"  'YES: ok !!!

SLEEP

'and of course you can create a clone of your batch file
CLOSE: OPEN"C:\temp\myfile_COPY.txt" FOR OUTPUT AS 1
PRINT #1, TX1$: CLOSE 1



« Last Edit: January 26, 2020, 05:42:44 am by euklides »
Why not yes ?

Offline euklides

  • Forum Regular
  • Posts: 128
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #36 on: January 26, 2020, 06:56:46 am »
$COLOR:0
COLOR BrightWhite, Red
PRINT "Bright white on red."

Where can I found the list of the constants colors, like here "Red" ou "Brightwhite" ?
Why not yes ?

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: QB64 v1.4 Release Candidate up for testing
« Reply #37 on: January 26, 2020, 07:30:26 am »
$COLOR:0
COLOR BrightWhite, Red
PRINT "Bright white on red."

Where can I found the list of the constants colors, like here "Red" ou "Brightwhite" ?

From the wiki:
$COLOR:0 adds constants for colors 0-15. The actual constant names can be found in the file source/utilities/color0.bi.
$COLOR:32 adds constants for 32-bit colors, similar to HTML color names. The actual constant names can be found in the file source/utilities/color32.bi.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline euklides

  • Forum Regular
  • Posts: 128
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #38 on: January 26, 2020, 10:10:03 am »
Thank's for colors answer...


Encrypting deflated text (just an idea) (Doppler suggestion)


Imagine you have a deflated text with a length  of 1,000,000 characters.

You split the deflated text in this way: (for instance here in four blocks, but it can be more..)

block A  from 1 au 125000     
block B frorm 125001 to 256777
block C from 256778 to  514435
block D from 514436 to 1000000

Now create a new block, for instance NEWBLOCk =Bloc C + Bloc D + Bloc A + Bloc B

To inflate NEWBLOCK, if you don't know how to group it back in the right order (before inflating), you will have some problem...
Why not yes ?

Offline euklides

  • Forum Regular
  • Posts: 128
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #39 on: January 26, 2020, 11:01:01 am »
_READBIT a little test...


FOR w = 0 TO 255 STEP 1
    A~%% = w
    K$ = "": FOR X = 7 TO 0 STEP -1:
        IF _READBIT(A~%%, X) = -1 THEN K$ = K$ + "1" ELSE K$ = K$ + "0"
    NEXT X
    LOCATE , 1: PRINT w;: LOCATE , 6: PRINT K$;: LOCATE , 15: COLOR 7, 0: IF w > 254 THEN COLOR 0, 7
    PRINT " press a key";
    SLEEP: LOCATE , 15: PRINT SPACE$(15)

NEXT w


Nice.
--------------------------------------
$ASSERTS:CONSOLE (my opinion)
The given example gives for ' a = 0 '
'Line 11 (in main module)
'_Assert failed (check console for description)
'
So you must read the program in the line 11 to find ""Value cannot be zero"
Well...
I think it would be more interesting, when the program breaks, to have the possibility to read the current value of  ' a ' for understanding what is the problem (??) (This is possible in Visual Basic Excel)...





« Last Edit: January 26, 2020, 11:26:36 am by euklides »
Why not yes ?

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #40 on: January 26, 2020, 02:36:13 pm »
Thank you, Old Moses.   Works for me now.  Three cheers for the _CAPSLOCK, _NUMLOCK, and _SCROLLLOCK.

I have a use for blinking the leds.  How embarassing that I so rarely use CASE that I messed it up.
Maybe the IDE should have flagged that as an error, or at least warned me.   But this is the best
way to learn, as long as it doesn't crash a plane!
It works better if you plug it in.

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #41 on: January 26, 2020, 04:03:58 pm »
Maybe the IDE should have flagged that as an error, or at least warned me. 

It's funny that it didn't, as that's the only reason that I caught it.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: QB64 v1.4 Release Candidate up for testing
« Reply #42 on: January 26, 2020, 04:43:54 pm »
It's funny that it didn't, as that's the only reason that I caught it.

Except it’s not an error.

CASE 1 + 2  <— You wouldn’t consider this an error, would you?  It’s a simple math formula which adds together to become 3.  (Though normally you’d see it more with CONST values, rather than numbers themselves, such as CASE Key_A + Uppercase to represent the uppercase “A”.)

CASE i = 1 is just another simple math formula.  If i is 1, it evaluates to a CASE -1; otherwise it evaluates to a CASE 0.

Take the following example and study it:

SELECT CASE x
     CASE i = 1

With the above, if X = 0 and i <> 1, we’d execute whatever is in that CASE block, while at the same time, if x = -1 and i = 1, we’d execute whatever is in that CASE block.  Otherwise we skip it. 



It’s not really a syntax error for the IDE to catch, any more than CASE 1 + 2 would be an error for the IDE to catch when the user meant CASE 1, 2.

It’s valid syntax; it’s just not the syntax you really wanted in this case.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Make71

  • Newbie
  • Posts: 12
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #43 on: January 27, 2020, 10:37:15 am »
There has been such a bug since version 1.3: When I run a program and when it stops, it doesn't always go back to the IDE. There will be a black screen. It is only when I move the mouse cursor down and click on it that the IDE opens.
My OS is Windows 7.

ps. Version 1.2 works fine.

Offline Make71

  • Newbie
  • Posts: 12
    • View Profile
Re: QB64 v1.4 Release Candidate up for testing
« Reply #44 on: January 27, 2020, 01:56:51 pm »
Of course, you can work around this by typing:

_FULLSCREEN _OFF: END
or
_FULLSCREEN _OFF: SYSTEM

But you didn't have to do it before! ;-)