Recent Posts

Pages: [1] 2 3 ... 10
1
QB64 Discussion / Re: Follow the development of QB64
« Last post by FellippeHeitor on Today at 12:56:04 PM »
New dev build available today (from git 06bc7c6) contains:

Enhancements
(as discussed here):
    - New Ctrl+T to toggle comment marker (') on the current line or selection (also available via Edit menu and by right-clicking the code)
    - Quick Navigation (back arrow) can now be disabled in the Search menu.

Fixes:
    - Tab in included files won't generate an error anymore. (as discussed here)
    - A bug that would cause an include line to be duplicated when resizing the IDE was fixed. (as discussed here)
2
You did try hitting F1 though, right? Also right clicking a keyword?
3
I’m not arguing against the IDE changes, but there are many more issues to resolve than just that. Better, more complete, documentation for one. More complete F1 command help. Maybe, when you mouse over commands it could pop up sample syntax to give you a quick look at the command. For example, you type the command mid$(), then mouse over it and get the suggested syntax pop up:
Quote
mid$(str$, start byte, bytes)

Documentation that reveals the basic syntax goes a long way with BASIC dialects to make it even more accessible to beginners and professionals alike. I mean, we don’t have trouble with BASIC’s syntax, obviously, but that would speed up the process even for us. We’ve all been here:

“Ok. I just need to get the middle of that string, and... Oh, wait. What’s the syntax for mid$, again? Wiki break!”
4
QB64 Discussion / Re: Division by zero question
« Last post by codeguy on Today at 12:19:04 PM »
I have found mod when using large numbers and small divisors to be problematic.
For a large number mod 2, it's been more than disappointing. So I use constructions like

v&=n& \ 10000
r&= (n& - 10000* v&) mod 2

Which then correctly gives the remainder after division. Not sure if this problem has been solved in newer releases, but v1.2 seems to require this workaround.
5
Also, Terry, C FOR loops can be indefinite ;;, or use pre/post increment. ++i != i++. Not too difficult to understand but definitely different in their characteristics.
6
One feature not yet mentioned but wouldn't involve breaking away from the IDE or compatibility is culling unused subs/functions/line labels from the source, both intrinsic and via $include. This would be an easy and efficient process following either import or during precompilation. I'd suggest during precompilation especially as alterations to code while editing may require code that would otherwise require them. Code not the object of call, goto, gosub or dead code not used or a dependency is definitely ripe for this type of processing. This will not affect compatibility with the original qbxx IDEs, only add a feature that's useful for reduction in compilation time and generated executable size. Simple analysis following OpenInclude() would be on the order of 15000+ lines/GHzS., Quite acceptable.
7
QB64 Discussion / Re: Division by zero question
« Last post by TerryRitchie on Today at 11:49:54 AM »
Quote
IF LOF(5) = LOF(6) AND LOF(5) > 0 THEN

Try reworking this line a few ways. I have had unexpected results when using boolean in this type of manner. Try adding parenthesis around areas and test the results:

IF LOF(5) = (LOF(6) AND LOF(5)) > 0 THEN

IF LOF(5) = LOF(6) AND (LOF(5) > 0) THEN

etc..

Just a thought that may help.
8
QB64 Discussion / Re: Division by zero question
« Last post by Cobalt on Today at 11:43:36 AM »
ON ERROR wont catch it, critical errors and kills the program, thing is the file isn't even 0 bytes it 8 as you can see in the image.

but I isolated the line its not a division in the direct visual sense, its actually cause by a MOD. I was thinking strictly '/' or '\' and was looking just for those, easy to forget MOD is a division under the hood.

IF (LOC(5) MOD modd&) = 0 THEN LOCATE 17, 1: PRINT LOC(5)

that causes the error cause the file isn't 0 its 8 bytes and 8/10 is .8 and QB64 turns INT(.8) to 0 will be adding a +1 to the end of that.
Code: [Select]
    CASE IS <= 250000
     PRINT "<= 250000 small run"
     modd& = INT(LOF(5) / 10)  '<--- thee offending 0 is produced here.
     DO
      GET #5, , temp1~%
      GET #6, , temp2~%
      IF temp1~% = temp2~% THEN match~& = match~& + 2 ELSE nomatch~& = nomatch~& + 2
      IF (LOC(5) MOD modd&) = 0 THEN LOCATE 17, 1: PRINT LOC(5)  '<--- causing this innocent line to error out.
     LOOP UNTIL EOF(5) OR EOF(6)

so apparently MOD is treated like an integer division '\' and doesn't get the 1.#INF treatment.

Would there be anyway to change that? cause ON ERROR doesn't seem to catch before the program gets killed by the CRITICAL ERROR msg from the OS(windows anyway).
9
Python IDEs: https://realpython.com/python-ides-code-editors-guide/

C++ IDEs: https://www.tecmint.com/best-linux-ide-editors-source-code-editors/

Java IDEs: https://www.lifewire.com/best-free-ideas-for-java-developers-2373185

ASM IDE: http://www.visualmasm.com/

These are the things I see "modern" IDEs have that the QB64 IDE does not:

- Push buttons that equate to menu entries already there
- Tabbed coding (kinda cool actually, like tabbed browsing)
- A hierarchical tree representation of code (QB64 F2)
- A console window

But at the heart of all of them they are just fancy text editors. Sublime Text, one of the most popular editors for a number of languages, strips the IDE down to even less than what the QB64 IDE offers. The only big difference is as you say, they are all graphics based, but graphic windows displaying text.

Quote
it will NEVER be accepted by the masses without one

How do you know this? As I stated before, I've programmed many languages with many different style IDEs over the past 35 years, and the only reason I ever gave up on a language was because of its syntax and ease of use, not because of its IDE (although VB's IDE gave me headaches).

If you want a windows based IDE then look into configurable IDEs (like Sublime Text) and create a QB64 identity file for it. Configure the compiler option to point to QB64. RhoSigma did this with Notepad++ for those wanting a different IDE experience.
10
QB64 Discussion / Re: Videos
« Last post by Dav on Today at 10:45:04 AM »
Here a video player I made years ago using MCI commands, which means it's for Windows.  This is a VERY basic use of MCI, you can expand it by declaring types of files when opening the file, and add pause, resume, etc.  Lookup opening types of files with MCI for more info.  I'm not 100% sure I'm using MCI correctly here, but the video played for me at the time so I didn't mess with it anymore.

- Dav
 
Code: [Select]
'=============
'QB64VIDEO.BAS
'=============
'Plays a video file in QB64 via MCI commands (WINDOWS ONLY)
'Coded by Dav, forgot what year...

'NOTE: This demo plays a sample video name davpiano.wmv.

DECLARE DYNAMIC LIBRARY "WINMM"
    FUNCTION mciSendStringA% (lpstrCommand AS STRING, lpstrReturnString AS STRING, BYVAL uReturnLength AS INTEGER, BYVAL hwndCallback AS INTEGER)
    ' mciSendStringA function plays media files and returns the following:
    ' 0 = command sucessful
    ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ' lpstrCommand is the MCI command string (and optional flags) to send.
    ' lpstrReturnString is a string that holds any return information.
    ' uReturnLength is the length of the lpstrReturnString string passed.
    ' NOTE: If lpstrCommand given doesn't retun a value then lpstrReturnString
    '       can be empty and uReturnLength can be set to 0.
    ' hwndCallback contains a callback window handle (only if the Notify flag used in lpstrCommand)
    '====================================================================
    FUNCTION mciGetErrorStringA% (BYVAL dwError AS INTEGER, lpstrBuffer AS STRING, BYVAL uLength AS INTEGER)
    ' mciGetErrorStringA returns error info if the mciSendStringA failed.
    ' dwError is the return value from the mciSendString function.
    ' lpstrBuffer string holds the error information returned by the function.
    ' uLength is the length of the lpstrBuffer string buffer.
    '====================================================================
END DECLARE

DECLARE CUSTOMTYPE LIBRARY
    FUNCTION FindWindow& (BYVAL ClassName AS _OFFSET, WindowName$)
END DECLARE


filename$ = "davpiano.wmv" '<========== My video file to play

IF NOT _FILEEXISTS(filename$) THEN
    PRINT filename$ + " " + "not found."
    END
END IF

handle& = _NEWIMAGE(320, 240, 32) '<===== The x/y size of my video
SCREEN handle&

DO UNTIL _SCREENEXISTS: _LIMIT 30: LOOP 'be sure screen exists before using in this way

title$ = "QB64 Video Player - " + filename$
_TITLE title$

hwnd& = FindWindow(0, title$ + CHR$(0))

ReturnString$ = SPACE$(255): ErrorString$ = SPACE$(255)
a% = mciSendStringA%("open " + filename$ + " style popup", ReturnString$, LEN(ReturnString$), 0)

IF a% THEN
    x% = mciGetErrorStringA%(a%, ErrorString$, LEN(ErrorString$))
    PRINT ErrorString$
    END
ELSE
    a2% = mciSendStringA%("window " + filename$ + " handle " + STR$(hwnd&), ReturnString$, LEN(ReturnString$), 0)
    b% = mciSendStringA%("play " + filename$, "", 0, 0)

    '=== Play video...
    DO
        _LIMIT 30

        'you can add pause/resume routine here if you want...

    LOOP UNTIL INKEY$ <> ""

    x% = mciSendStringA%("stop " + filename$, "", 0, 0)
    x% = mciSendStringA%("close " + filename$, "", 0, 0)
END IF
Pages: [1] 2 3 ... 10