GithubHelp home page GithubHelp logo

qb64team / qb64 Goto Github PK

View Code? Open in Web Editor NEW
655.0 31.0 94.0 420.84 MB

BASIC for the modern era.

Home Page: https://www.qb64.org

License: Other

Batchfile 0.01% Shell 0.25% C++ 21.62% Objective-C++ 0.01% C 64.70% Fortran 0.11% Python 10.84% Tcl 1.52% Makefile 0.27% Perl 0.03% CMake 0.02% Roff 0.23% M4 0.01% HTML 0.18% VBA 0.05% Gnuplot 0.01% CSS 0.01% SWIG 0.01% PowerShell 0.01% Assembly 0.17%
quickbasic qbasic qb45 cpp opengl

qb64's Introduction

QB64

githubstrip

QB64 is a modern extended BASIC+OpenGL language that retains QB4.5/QBasic compatibility and compiles native binaries for Windows (XP and up), Linux and macOS. contributions welcome

Table of Contents

  1. Installation

    1. Windows
    2. macOS
    3. Linux
  2. Usage

  3. Additional Info

Installation

Download the appropriate package for your operating system over at https://github.com/QB64Team/qb64/releases.

Windows

Make sure to extract the package contents to a folder with full write permissions (failing to do so may result in IDE or compilation errors).

  • It is advisable to to whitelist the QB64 folder in your antivirus/antimalware software *

macOS

Before using QB64 make sure to install the Xcode command line tools with:

xcode-select --install

Run ./setup_osx.command to compile QB64 for your OS version.

Linux

Compile QB64 with ./setup_lnx.sh.

Dependencies should be automatically installed. Required packages include OpenGL, ALSA and the GNU C++ Compiler.

Usage

Run the QB64 executable to launch the IDE, which you can use to edit your .BAS files. From there, hit F5 to compile and run your code.

To generate a binary without running it, hit F11.

Additionally, if you do not wish to use the integrated IDE and to only compile your program, you can use the following command-line calls:

qb64 -c yourfile.bas

qb64 -c yourfile.bas -o outputname.exe

Replacing -c with -x will compile without opening a separate compiler window.

Additional Information

More about QB64 at our wiki: https://wiki.qb64.org

We have a community forum at: https://forum.qb64.org

We tweet from @QB64Team

Find us on Discord: https://discord.qb64.org

qb64's People

Contributors

alexmyczko avatar aouwt avatar ashishkingdom avatar bartman081523 avatar dkearns avatar ebourg avatar familygw avatar fellippeheitor avatar flukiluke avatar galleondragon avatar johnkharvey avatar juhagman avatar kobolticus avatar logenkain avatar lstricklan avatar memreflect avatar mkilgore avatar pirachy avatar qb64cobalt avatar realkindone avatar rhosigma-qb64 avatar spriggsyspriggs avatar stevemcneill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qb64's Issues

Allow definable keyword prefix

Issue by youreperfect
Monday Jun 24, 2019 at 22:18 GMT
Originally opened as Galleondragon/qb64#97


This is a feature request, the current version is 1.3

I would like to have a keyword slash magic variable similar to:
QB_KEYWORD_PREFIX

setting this magic variable to a string would change the way the new keywords added in QB64 are named.

So currently you have:
PRINT _AXIS(a)

With this feature you could have:

QB_KEYWORD_PREFIX = ""
PRINT AXIS(a)

or

QB_KEYWORD_PREFIX = "QB64_"
PRINT QB64_AXIS(a)

The first example could be a way for people who don't like the underscores to remove them.
The second example could be used by larger projects that may use leading underscore naming in their own code (ie for pseudo-private functions and variables) or large projects where keeping track where a function or variable is defined is useful.

I presume the convention would be to define this at the top of the script (though I'm not sure if that sould be compiler-enforced).

_NEWIMAGE color mode additions

I've noticed a lack of _NEWIMAGE color modes outside 256 and 32-bit. I'd love to see 16/4/2 color support added for custom-res modes that are color-compatible with even more modes.

Not sure how to use INKEY$ with _DEST _CONSOLE

According to the context help in QB64:
"Use _DEST _CONSOLE before reading INKEY$ to receive input from a console window."
I've tried everything I can think of and I can't get the console to even recognize keypresses other than actual text entry. It seems to ignore INKEY$. Am I missing something? How am I supposed to structure the statement to "receive input from a console window" using INKEY$?

Extend to UHD and 5K test for Mac computers.

Is your feature request related to a problem? Please describe.
Hi, when I tried to run QB64 on MacOS with a display setting different than the default one (for example, not scaled to fit to 1080p) or if I use a macMini/Pro with external monitor which isn't a Retina one, the scale factor doesn't work.

Describe the solution you'd like
As per suggested by you through twitter, I suggest to modify the line 535 of the file './internal/c/libqb/gui.cpp' from:
if (system("system_profiler SPDisplaysDataType | grep Retina")==0) scale_factor=2;
to:
if (system("system_profiler SPDisplaysDataType | grep Retina")==0 || system("system_profiler SPDisplaysDataType | grep 5K")==0) scale_factor=2;

Describe alternatives you've considered
N/A

Additional context
N/A

Compilation for macOS devices with Retina displays needs attention

QB64 and any programs compiled with it will be displayed at 1/4 the window size in Retina displays. The fix involves doubling the texture by changing line 541 in internal/c/libqb/gui.cpp, which currently reads:

glViewport(0,0,dst_w,dst_h);
to:
glViewport(0,0,dst_w * 2,dst_h * 2);

The change should be enough to compile the IDE and new programs using the correct resolution.

The only problem is that I couldn't find a way to find out if a program is running in a Retina-enabled device at runtime, which would be ideal.

A temporary solution would be using a command-line tool to find out if the current device is Retina-enabled during setup:

system_profiler SPDisplaysDataType | grep Resolution

The word "Retina" will be appended to the current screen resolution in cases the texture doubling should be enabled.

Ability to remove asynchronous.

Is your feature request related to a problem? Please describe.
My feature request is not related to a problem but it is just feature idea that might be useful to some people.
Adding the ability to add anti-asynchronous to QB64 would be very useful in some scenarios. For example, it would be able to boost up some applications created with QB64.

Describe the solution you'd like
I'm pretty sure the C++ can be anti-async. I'm pretty sure it would be possibly to change some lines of code which remove some of the await/async code during compilation.
On the .bas code, there should be a "$ANTIASYNC" or something like that.

Describe alternatives you've considered
I don't know any other ways anti-asynchronous is possible using QB64 besides opening multiple programs at once.

Additional context
Even though this is BASICS, QB64 does have some modern features. Only having force asynchronous wouldn't always be good because it can slowly some huge programs. This feature might possibly be able to make the QB64 compiler itself be faster as the compiler is made with QB64 itself.

Length of SUBs / FUNCTIONs in F2 view

Would be nice to see the amount of lines each SUB / FUNCTION has, could be useful to get a better idea of what part of the code takes up how much (sometimes you have 700+ lines for one SUB and don't notice it'd be easier to $INCLUDE it.

OPTION EXPLICIT: with parameters

As Steve suggested here:

"OPTION EXPLICIT: VARIABLES, SHARED would check everything but arrays.
OPTION EXPLICIT: ARRAYS would only check arrays
OPTION EXPLICIT: VARIABLES, ARRAYS checks all but the SHARED"

I would love to see that! :D

$VERSIONINFO missing product version

$VERSIONINFO appears to still be missing product version. I'm running QB64 32bit V1.4 on a 64 bit Windows 10 build 1909 machine.
It looks like most of the other values work. I can open the EXE in Resource Tuner and see the rest of them. The only blank one is Product Version both in File Explorer and Resource Tuner.
image

Tui library

Is your feature request related to a problem? Please describe.
I have been having a hard time finding a usable text user interface (tui) library. I have several programs That need a nice TUI.

Describe the solution you'd like
Is it possible to separate the TUI part of the ide to a Library? That way I could write program interfaces that have the same look and feel of the ide.

Describe alternatives you've considered
I have looked at using C libraries such as D-Flat++ Ncurses. D-Flat++ is only for dos and has no interface for qb46. Ncurses has a FreeBASIC interface but is to low level.

Mac: $PATH issue when converting QB4.5 files in another directory

Describe the bug
Hello! Whenever I try to convert a QB45 .bas file, it fails because it can no longer find the 'internal' folder.

QB64 info (please complete the following information):

  • Version 1.4
  • OS: MAC (Mojave)
  • Is the bug present in the latest dev build too? I'm not sure

To Reproduce
Steps to reproduce the behavior:

  1. Download the mac tarball
  2. Un-tar it
  3. cd qb64
  4. Run ./qb64 (note that the internal folder is here)
  5. The tool will start fine (all is well so far)
  6. File->Open (Open your .bas file. Mine was at ../bas/file.bas)
  7. "QuickBASIC 4.5 binary format detected. Convert to plain text?" (Yes)
  8. "QB64 cannot locate the 'internal' folder"

It's almost like the tool forgot its pathing when I was searching for the .bas file in a different sub-directory tree.

Expected behavior
I would expect the conversion to start instead of a $PATH failure

Screenshots
If necessary, I can attach these, but it's a pretty straightforward procedure to reproduce with a clean error message.

Additional context
I'm happy to test things however you need. I feel like as a workaround ,I could potentially put the qb45 binary and the 'internal' folder in /usr/local/bin so that they're both always on the path, but it's a little weird to put a non-binary folder in /usr/local/bin. Or, I could potentially add a bunch of things to my $PATH. If that happens to be the answer, my request would be to update the README.md installation instructions for mac, since they imply that the running the qb64 binary where it installs is sufficient, but that appears to be untrue.

I hope this is helpful!

Code-collapsing/expanding

Ability to collapse and expand loops, if-statements and select case, basically everything that automatically indents. Especially useful for code that is finished and only takes up space when scrolling past :D

Update Wiki Page for SHELL (function)

Using return_code = SHELL(DOScommand$) doesn't just work with QB64 programs with END exitCode or SYSTEM exitCode

This also works well with PowerShell if the command is designed to return a value using an exit code
For example:
try
{
$File = $args[0]
$ftp = "ftp://someftpurl" + $args[1]
"ftp url: $ftp"
$webclient = New-Object System.Net.WebClient
$uri = New-Object System.Uri($ftp)
"Uploading $File..."
$webclient.UploadFile($uri, $File)
exit 1
}
catch
{
exit 2
}

I've been able to do this several times and it seems to work quite well for verifying that shelling a command has returned a desired value/result.

The Wiki page for this topic should be updated to reflect that PowerShell (at the least, could be more than that) will be compatible with the SHELL (function).

Cannot see full TUI, weird scaling

I can only see the bottom part of the interface when starting the program, and trying to scale the window has sort of the opposite effect to what I would expect.

Building from 6cf15e6 on macOS Mojave.

I have attached a small screen capture that illustrates the problem:
qb64-scaling.mkv.zip

qb64-scaling

Improve resolution of paths for DECLARE LIBRARY

Issue by flukiluke
Monday Oct 29, 2018 at 13:58 GMT
Originally opened as Galleondragon/qb64#71


The current logic used is very sucky:

  • Code includes must use a .h extension
  • Dynamic libraries must begin with lib on Linux
  • The appropriate places aren't searched for dynamic libraries, causing machine-specific constants needing to be hard coded in
  • Probably other problems

Popup showing available elements in a TYPE declaration

If it is possible, it would be really cool if there was a way to pop up suggestions of elements contained in a TYPE when you are using dotted variables. It could be like a drop down list that appears at the insertion point in the IDE and lists the elements contained in that TYPE declaration. That might make it easier if you are writing code down at the end of a file and the declaration is at the top and you cannot remember all the variable names. If it isn't something feasible then I understand.

Clarify situation about Microsoft copyright on example programs

Some of the example programs have Microsoft copyright messages, e.g. programs/samples/misc/nib64.bas says "Copyright (C) Microsoft Corporation 1990". Since that copyright does not expire until 2085, we should either remove affected example programs or else add some text to explain on what basis we are allowed to redistribute them.

(If there is a good reason why it's allowed, it would be nice to explain this, because some coders who grew up in the DOS era will have made private enhancements to the example programs—I for example once upon a time got slightly carried away expanding Nibbles by adding computer players, moving collectables, transporters, music, auto-commentary, scrolling levels and an editor, but I assumed it could never be published because I had used the copyrighted Microsoft code as a starting point.)

binary F##/CHR font format support for text modes

Ive always wanted to use fonts in my program, but TTF is only supported, That is not good for textmode for me. because "REAL" textmode requires fixed letters with fixed fonts such as F## where ## is the height of the font, or CHR files which are the same file format depending on the program (i.e. mostly 8x14).

The solution is to support CHR/F## fonts for QB64 in text modes at least, Fontraption (https://github.com/viler-int10h/Fontraption) supports them, They are a 1-bit per pixel format

alternatives include adding in both FON and FNT support, but they are a pest to implement!!!

No additional context...

Make a CLIPBOARD$() array since Windows 10 has Clipboard History

If it is possible it would be cool to access the full clipboard since the new feature in Windows 10 is clipboard history where you can copy several items and access them by pressing Windows+V. You can even pin items. If we could access that clipboard history as an array it would be very awesome.
For instance, if I wanted the last item I just copied I could use clip$ = CLIPBOARD$(1) and vice-versa if I wanted to copy something to the clipboard.

Clipboard contents my lead to QB64 to crash at startup on MacOS

Describe the bug
By running qb64, the program crashes with a SIGFAULT if the clipboard has a specific pattern of data.

QB64 info (please complete the following information):

  • Version 1.4
  • OS: MacOS 10.14.6 (Mojave)
  • Is the bug present in the latest dev build too? Untested

To Reproduce
Steps to reproduce the behavior:

  1. Using Midnight Commander, view some file as binary data and copy some data to the clipboard
    1. Use ALT+LeftClick, select some lines, Command+C
  2. Try to open QB64
  3. The program will crash, withe the Reporting Window from the OS showing you the stackdump and telling you about the Signal 11 (SIGSEGV - Segmentation Fault)

Expected behavior
A running program.

Additional context
While checking the stack dump of the thread 3 (the one that suffered the crash), I noticed the symbol "clipboard", what hinted me that perhaps something on the clipboard would be causing a buffer overrun. So I stupidly copied some chars from a text editor (what fixed the issue) without checking the previous clipboard contents first.

So I lost the pattern that triggers the problem.

Shoving binary data on the clipboard didn't triggered the problem (cat qb64 | pbcopy). I remember I had copied some binary data from the terminal while visualising a file using Midnight Commander, but I'm still trying to confirm this.

ADDENDUM

I just reproduced the issue! The problem is with image files on clipboard, as it appears!

Open any image with the Preview, copy it to the clipboard, then run qb64.

Images on the clipboard triggers the crash apparently. The image I used to crash it attached to this post, for the sake of completude. But until the moment, different images with different sizes caused the crash.

Screen Shot 2020-02-14 at 08 56 49

Compile with -O2 by default

Issue by flukiluke
Wednesday Oct 31, 2018 at 12:32 GMT
Originally opened as Galleondragon/qb64#74


This flag is already used for most of the precompiled content but not the compilation of qbx.cpp. It has the potential to give a decent speedup (which god knows QB64 programs need).

PAINT's tiling pattern string

Would be nice if this feature became supported by QB64.
I see some related code in sub_paint (with qbs*fillstr param), but it doesn't seem to work.

ALL Sound not working on OSX/macOS

Describe the bug
Basic code with BEEP, SOUND or any other command involving sound does not compile

QB64 info:

  • Version 1.4
  • OS: MacOS Catalina

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Basic File
  2. Use BEEP (or Sound e.g. SOUND 500, 20)
  3. Save
  4. Compile

compilelog.txt
ld: file too small (length=8) file 'parts/audio/out/os/osx/src.a' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Script not found error

Hi, I keep getting the "Cannot locate source file" error. I am just trying to compile the existing samples. Attached is the screenshot, You can see that I have even tried to give the absolute paths to the sample file.
script-not-found

`_STDOUT`, `_STDERR` methods?

Issue by Kroc
Sunday Jul 15, 2018 at 10:51 GMT
Originally opened as Galleondragon/qb64#53


Thank you for adding _ECHO but I've realised that it doesn't entirely solve the problems of dealing with a command-line driven app that may also have a GUI.

I'm writing PortaDOOM, a Doom launcher; it's replacing a 1500+ line batch script that manages all the parameters and calls the appropriate doom-engine.

The launcher needs to operate in a mix of two modes: if passed command-line parameters it'll need to validate those and call the desired doom-engine without having to bring up a UI. Output will need to be produced on stdout and stderr for interaction with regular batch scripts.

If provided without parameters (such as simply double-clicking the EXE file), or certain parameters, a UI needs to be presented.

Unfortunately $CONSOLE: _CONSOLE OFF always causes a console window to appear momentarily when the executable is launched even when this is not needed. I'd prefer if this didn't happen.

A simple fix would be to specify a way to not show the console until _CONSOLE ON is used, rather than show it by default and await a _CONSOLE OFF command. NB: I can't use $CONSOLE:OFF as I still need to output to console if the app is called from command-line.

An alternative solution is to allow direct writing to stdout / stderr, bypassing any state of QB64's own console (including $CONSOLE:OFF). This would be my preferred solution as, in this instance, I want to output directly to the OS and not work though QB64's console(s). I may want to capture stderr output separate from stdout in a batch file so as to not display any output from my app under batch control, unless an error occurs.

QB64 Linux Mint Debian Edition

Although Qb64 works on many distros of Linux, there seems to be an issue running on Linux Mint Debian Edition where it likes to act as if the control key or alt key is being held down. I have tested this in multiple ways and it seems to be universal. Also I have had a report from another user that they don't remember having that specific issue, but they also had issues running in Mint Debian.

Modifying an array element in a SUB

(Not sure if a feature request or a bug report; kind of, a bug-in-the-original-QB report and possibly a feature request for legacy behavior support, but I doubt that anyone really needs it. Therefore it's just an interesting fact FYI, can be useful to debug old QB programs that work in QB4.5 but don't work in QB64.)

Here's an interesting bug I've found messing with my old QuickBASIC programs.
Google doesn't seem to know anything about this :)

Please read the following code carefully and guess what it will print:

DIM SHARED a(2)
a(1) = 10
PRINT "before the call:"; a(1)
f a(1)
PRINT "after the call:"; a(1)

SUB f (v)
PRINT "in the sub before modifying:"; a(1)
v = 2
PRINT "in the sub after modifying:"; a(1)
END SUB

Then, run it in any ORIGINAL DOS QuickBASIC (QBasic/QB4.5/PDS/VBDOS) and be shocked with the "correct" answer (10 10 10 2).

This code works as expected in QB64 btw (10 10 2 2).

Alternate TUI layout

It would be fantastic to have a dual-mode QB/VBDOS TUI as an optional alternative for main UI.

E.g.,
image

We could have a project UI view, similarly to VB for Windows, if you desired, that wouldn't be all that different from the PDS layout; it would just require a compositing Text WM, difficult- but not impossible, per-se

References

Allow sound data to be accessible (_MEMSOUND?)

_LOADIMAGE decodes an image and makes the raw pixel data to be accessible via _MEMIMAGE. The same should be allowed after _SNDOPEN decodes a sound file.

Maybe a new _MEMSOUND() command to return a _MEM block pointing to the raw data.

It would probably need an extra parameter to specify which channel to point to, like:

sound = _SNDOPEN("song.mp3")
IF sound = 0 THEN PRINT "Load failed.": SYSTEM 1
left_channel = _MEMSOUND(sound, 1)
right_channel = _MEMSOUND(sound, 2)
'process raw data

Improvements to print unicode content

Is your feature request related to a problem? Please describe.

  1. PRINT without _MAPUNICODE is currently coercing Unicode character > 255 into ASCII;
SCREEN 12
f = _LOADFONT("cyberbit.ttf", 32, "MONOSPACE,UNICODE")
_FONT f
S$ = STRING$(16, 0)
ASC(S$, 5) = 65
ASC(S$, 9) = 78
ASC(S$, 13) = 67

_MAPUNICODE 78 * 256 + 78 TO 128
ASC(S$, 1) = 128
PRINT S$

_FONT 16

Output "乎ANC";

SCREEN 12
f = _LOADFONT("cyberbit.ttf", 32, "MONOSPACE,UNICODE")
_FONT f
S$ = STRING$(16, 0)
ASC(S$, 5) = 65
ASC(S$, 9) = 78
ASC(S$, 13) = 67

ASC(S$, 1) = 78
ASC(S$, 2) = 78
PRINT S$

_FONT 16

Output "NANC";

  1. _PRINTWIDTH with "MONOSPACE,UNICODE" font is 4 times large than the correct value;
    ASCII string is 1 byte per character;
    Unicode string is UTF-32LE, UTF-32LE is 4 bytes per character;

  2. internal/c/libqb.cpp is not well formatted;

Describe the solution you'd like

--- internal/c/libqb.cpp.original	2020-02-13 23:09:47.000000000 +0800
+++ internal/c/libqb.cpp	2020-02-13 23:09:47.000000000 +0800
@@ -10303,6 +10303,10 @@ void printchr(int32 character){
             static int32 rt_w,rt_h,rt_pre_x,rt_post_x;
             //int32 FontRenderTextASCII(int32 i,uint8*codepoint,int32 codepoints,int32 options,
             //                          uint8**out_data,int32*out_x,int32 *out_y,int32*out_x_pre_increment,int32*out_x_post_increment){
+            if (fontflags[f]&32)
+            ok=FontRenderTextUTF32(font[f],(uint32*)&character,1,1,
+            &rt_data,&rt_w,&rt_h,&rt_pre_x,&rt_post_x);
+            else
             ok=FontRenderTextASCII(font[f],(uint8*)&character,1,1,
             &rt_data,&rt_w,&rt_h,&rt_pre_x,&rt_post_x);
             if (!ok) return;
@@ -10349,6 +10353,10 @@ void printchr(int32 character){
         static int32 rt_w,rt_h,rt_pre_x,rt_post_x;
         //int32 FontRenderTextASCII(int32 i,uint8*codepoint,int32 codepoints,int32 options,
         //                          uint8**out_data,int32*out_x,int32 *out_y,int32*out_x_pre_increment,int32*out_x_post_increment){
+        if (fontflags[f]&32)
+        ok=FontRenderTextUTF32(font[f],(uint32*)&character,1,0,
+        &rt_data,&rt_w,&rt_h,&rt_pre_x,&rt_post_x);
+        else
         ok=FontRenderTextASCII(font[f],(uint8*)&character,1,0,
         &rt_data,&rt_w,&rt_h,&rt_pre_x,&rt_post_x);
         if (!ok) return;
@@ -19271,7 +19279,7 @@ void sub_put2(int32 i,int64 offset,void
             if (text->len == 0) return 0; //No point calculating an empty string
             int32 fonthandle = img[screenhandle].font; //Get the font used in screenhandle
             int32 fwidth = func__fontwidth(fonthandle, 1); //Try and get the font width
-            if (fwidth != 0) return fwidth*(text->len); //if it's not a variable width font, return the width * the letter count
+            if (fwidth != 0) return fwidth*(text->len)/(fontflags[fonthandle]&32 ? 4 : 1); //if it's not a variable width font, return the width * the letter count
             int32 fheight = func__fontheight(fonthandle, 1); //Height of the font used in screenhandle
             int32 tempscreen = func__newimage(65535, fheight, 32, 1); //Just like calling _NEWIMAGE
             int32 oldwritepage = func__dest();
  1. Add call to FontRenderTextUTF32 in printchr;
  2. Divide by 4 with monospace Unicode font in func__printwidth;
  3. Maybe GNU indent with "indent --k-and-r-style --no-tabs --ignore-newlines --break-after-boolean-operator --line-length256" is good enough;

Describe alternatives you've considered
Not found.

Additional context
No Additional context.

TYPE within a TYPE changing string to numerical

QB64 info:

  • Version 1.4 32bit
  • OS: Windows 10 1903

I declared a variable within a type as a string. I then declared the type as a variable within another type. When I went to test out using the type within a type the string gave an error saying "Illegal string-number conversion on current line". If I change the value to numerical rather than string it says "OK" even though it is declared as a string. I can even print it to the screen with no issue so the value is being assigned correctly, just not as a string as it was declared. What's causing this?

ok weird
something wrong

Pure TUI mode

Is your feature request related to a problem? Please describe.
When I try to run QB64 on my Linux machine via SSH from another computer, I get some kind of weird freeglut prompt. My intuition is that this is because it's trying to establish an OpenGL context to create the IDE TUI, and as my terminal session is not connected to any graphics/video service, it's unable to do so.

Describe the solution you'd like
A command-line option to launch the program with a pure text-mode TUI (like Aptitude or PDMenu use) would enable me to use QB64 remotely, or locally without first logging into a desktop environment.

Describe alternatives you've considered
I could go downstairs and sit at my actual Linux computer, press ctrl+alt+F7 and log into the desktop environment, then start QB64, but that's a lot of (literal) steps, the chair down there is uncomfortable, and I prefer to use that computer in its real VGA (80×25, 9×16-pixel cells) text mode whenever possible.

ACCEPTFILEDROP not working when elevated (run as administrator)

Describe the bug
When I run a program in an elevated state (run as administrator), the program can't use the ACCEPTFILEDROP function as it appears to not work at all when running the compiled program like this. When I run it regularly (simply double-clicking) it works. I don't see anything in the help to suggest that it doesn't work when running a QB64 compiled program as administrator.

QB64 info (please complete the following information):

  • Version 1.4
  • OS: Windows 10 64 and 32 bit

To Reproduce
Steps to reproduce the behavior:

  1. Run QB64 compiled program without elevation. ACCEPTFILEDROP works correctly
  2. Run QB64 compiled program with elevation. ACCEPTFILEDROP does not work

Expected behavior
ACCEPTFILEDROP should work in both regular and elevated running.

WPF Message Boxes in QB64!

I am currently working on a function system that will allow someone to make WPF based message boxes in QB64. The WPF boxes are made using a PowerShell script that I got from https://smsagent.blog/2017/08/24/a-customisable-wpf-messagebox-for-powershell/
My function will obviously be a SHELL to the PowerShell script that automatically fills in the $args[] array for PowerShell and builds the WPF message. The PowerShell script also sends back the exit code that I set up for each button so the person using the function can find out what was pressed!
See below for a test! I'm super excited to try using this for my own programs right now since the script is highly customizable! The WPF message box can even be used as a video player!
image
image
image
image
My function so far!:

`FUNCTION` WPFMessageBox
    SHELL$ = "PowerShell -Command " + CHR$(34) + "New-WPFMessageBox.ps1"
    IF Params.Content <> "" THEN
        Params.Content = "\" + CHR$(34) + Params.Content + "\" + CHR$(34) '$args[0]
        SHELL$ = SHELL$ + " " + Params.Content
    ELSE
        Params.Content = "null"
        Params.Content = "\" + CHR$(34) + Params.Content + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.Content
    END IF

    IF Params.Title <> "" THEN
        Params.Title = "\" + CHR$(34) + Params.Title + "\" + CHR$(34) '$args[1]
        SHELL$ = SHELL$ + " " + Params.Title
    ELSE
        Params.Title = "null"
        Params.Title = "\" + CHR$(34) + Params.Title + "\" + CHR$(34) '$args[1]
        SHELL$ = SHELL$ + " " + Params.Title
    END IF
    IF Params.ButtonType <> "" THEN
        IF Params.ButtonType <> "OK" AND Params.ButtonType <> "OK-Cancel" AND Params.ButtonType <> "Abort-Retry-Ignore" AND Params.ButtonType <> "Yes-No-Cancel" AND Params.ButtonType <> "Yes-No" AND Params.ButtonType <> "Retry-Cancel" AND Params.ButtonType <> "Cancel-TryAgain-Continue" AND Params.ButtonType <> "None" THEN
            Params.ButtonType = "OK"
            Params.ButtonType = "\" + CHR$(34) + Params.ButtonType + "\" + CHR$(34)
            SHELL$ = SHELL$ + " " + Params.ButtonType
        ELSE
            Params.ButtonType = "\" + CHR$(34) + Params.ButtonType + "\" + CHR$(34) '$args[2]
            SHELL$ = SHELL$ + " " + Params.ButtonType
        END IF
    ELSE
        Params.ButtonType = "OK"
        Params.ButtonType = "\" + CHR$(34) + Params.ButtonType + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.ButtonType
    END IF
    IF Params.ContentFontSize <> "" THEN
        Params.ContentFontSize = "\" + CHR$(34) + Params.ContentFontSize + "\" + CHR$(34) '$args[3]
        SHELL$ = SHELL$ + " " + Params.ContentFontSize
    ELSE
        Params.ContentFontSize = "14"
        Params.ContentFontSize = "\" + CHR$(34) + Params.ContentFontSize + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.ContentFontSize
    END IF
    IF Params.TitleFontSize <> "" THEN
        Params.TitleFontSize = "\" + CHR$(34) + Params.TitleFontSize + "\" + CHR$(34) '$args[4]
        SHELL$ = SHELL$ + " " + Params.TitleFontSize
    ELSE
        Params.TitleFontSize = "14"
        Params.TitleFontSize = "\" + CHR$(34) + Params.TitleFontSize + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.TitleFontSize
    END IF
    IF Params.BorderThickness <> "" THEN
        Params.BorderThickness = "\" + CHR$(34) + Params.BorderThickness + "\" + CHR$(34) '$args[5]
        SHELL$ = SHELL$ + " " + Params.BorderThickness
    ELSE
        Params.BorderThickness = "0"
        Params.BorderThickness = "\" + CHR$(34) + Params.BorderThickness + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.BorderThickness
    END IF
    IF Params.CornerRadius <> "" THEN
        Params.CornerRadius = "\" + CHR$(34) + Params.CornerRadius + "\" + CHR$(34) '$args[6]
        SHELL$ = SHELL$ + " " + Params.CornerRadius
    ELSE
        Params.CornerRadius = "0"
        Params.CornerRadius = "\" + CHR$(34) + Params.CornerRadius + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.CornerRadius
    END IF
    IF Params.ShadowDepth <> "" THEN
        Params.ShadowDepth = "\" + CHR$(34) + Params.ShadowDepth + "\" + CHR$(34) '$args[7]
        SHELL$ = SHELL$ + " " + Params.ShadowDepth
    ELSE
        Params.ShadowDepth = "3"
        Params.ShadowDepth = "\" + CHR$(34) + Params.ShadowDepth + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.ShadowDepth
    END IF
    IF Params.BlurRadius <> "" THEN
        Params.BlurRadius = "\" + CHR$(34) + Params.BlurRadius + "\" + CHR$(34) '$args[8]
        SHELL$ = SHELL$ + " " + Params.BlurRadius
    ELSE
        Params.BlurRadius = "20"
        Params.BlurRadius = "\" + CHR$(34) + Params.BlurRadius + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.BlurRadius
    END IF
    IF Params.Timeout <> "" THEN
        Params.Timeout = "\" + CHR$(34) + Params.Timeout + "\" + CHR$(34) '$args[9]
        SHELL$ = SHELL$ + " " + Params.Timeout
    ELSE
        Params.Timeout = "999"
        Params.Timeout = "\" + CHR$(34) + Params.Timeout + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.Timeout
    END IF
    IF Params.ContentBackground <> "" THEN
        Params.ContentBackground = "\" + CHR$(34) + Params.ContentBackground + "\" + CHR$(34) '$args[10]
        SHELL$ = SHELL$ + " " + Params.ContentBackground
    ELSE
        Params.ContentBackground = "White"
        Params.ContentBackground = "\" + CHR$(34) + Params.ContentBackground + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.ContentBackground
    END IF
    IF Params.FontFamily <> "" THEN
        Params.FontFamily = "\" + CHR$(34) + Params.FontFamily + "\" + CHR$(34) '$args[11]
        SHELL$ = SHELL$ + " " + Params.FontFamily
    ELSE
        Params.FontFamily = "Segoe UI"
        Params.FontFamily = "\" + CHR$(34) + Params.FontFamily + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.FontFamily
    END IF
    IF Params.TitleFontWeight <> "" THEN
        Params.TitleFontWeight = "\" + CHR$(34) + Params.TitleFontWeight + "\" + CHR$(34) '$args[12]
        SHELL$ = SHELL$ + " " + Params.TitleFontWeight
    ELSE
        Params.TitleFontWeight = "Normal"
        Params.TitleFontWeight = "\" + CHR$(34) + Params.TitleFontWeight + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.TitleFontWeight
    END IF
    IF Params.ContentFontWeight <> "" THEN
        Params.ContentFontWeight = "\" + CHR$(34) + Params.ContentFontWeight + "\" + CHR$(34) '$args[13]
        SHELL$ = SHELL$ + " " + Params.ContentFontWeight
    ELSE
        Params.ContentFontWeight = "Normal"
        Params.ContentFontWeight = "\" + CHR$(34) + Params.ContentFontWeight + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.ContentFontWeight
    END IF
    IF Params.TitleTextForeground <> "" THEN
        Params.TitleTextForeground = "\" + CHR$(34) + Params.TitleTextForeground + "\" + CHR$(34) '$args[14]
        SHELL$ = SHELL$ + " " + Params.TitleTextForeground
    ELSE
        Params.TitleTextForeground = "Black"
        Params.TitleTextForeground = "\" + CHR$(34) + Params.TitleTextForeground + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.TitleTextForeground
    END IF
    IF Params.ContentTextForeground <> "" THEN
        Params.ContentTextForeground = "\" + CHR$(34) + Params.ContentTextForeground + "\" + CHR$(34) '$args[15]
        SHELL$ = SHELL$ + " " + Params.ContentTextForeground
    ELSE
        Params.ContentTextForeground = "Black"
        Params.ContentTextForeground = "\" + CHR$(34) + Params.ContentTextForeground + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.ContentTextForeground
    END IF
    IF Params.BorderBrush <> "" THEN
        Params.BorderBrush = "\" + CHR$(34) + Params.BorderBrush + "\" + CHR$(34) '$args[16]
        SHELL$ = SHELL$ + " " + Params.BorderBrush
    ELSE
        Params.BorderBrush = "Black"
        Params.BorderBrush = "\" + CHR$(34) + Params.BorderBrush + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.BorderBrush
    END IF
    IF Params.TitleBackground <> "" THEN
        Params.TitleBackground = "\" + CHR$(34) + Params.TitleBackground + "\" + CHR$(34) '$args[17]
        SHELL$ = SHELL$ + " " + Params.TitleBackground
    ELSE
        Params.TitleBackground = "White"
        Params.TitleBackground = "\" + CHR$(34) + Params.TitleBackground + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.TitleBackground
    END IF
    IF Params.ButtonTextForeground <> "" THEN
        Params.ButtonTextForeground = "\" + CHR$(34) + Params.ButtonTextForeground + "\" + CHR$(34) '$args[18]
        SHELL$ = SHELL$ + " " + Params.ButtonTextForeground
    ELSE
        Params.ButtonTextForeground = "Black"
        Params.ButtonTextForeground = "\" + CHR$(34) + Params.ButtonTextForeground + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.ButtonTextForeground
    END IF
    IF Params.Sound <> "" THEN
        Params.Sound = "\" + CHR$(34) + Params.Sound + "\" + CHR$(34) '$args[19]
        SHELL$ = SHELL$ + " " + Params.Sound
    ELSE
        Params.Sound = "Windows Notify System Generic"
        Params.Sound = "\" + CHR$(34) + Params.Sound + "\" + CHR$(34)
        SHELL$ = SHELL$ + " " + Params.Sound
    END IF
    IF Params.CustomButton1 <> "" THEN
        Params.CustomButton1 = "\" + CHR$(34) + Params.CustomButton1 + "\" + CHR$(34) '$args[20]
        SHELL$ = SHELL$ + " " + Params.CustomButton1
    END IF
    IF Params.CustomButton2 <> "" THEN
        Params.CustomButton2 = "\" + CHR$(34) + Params.CustomButton2 + "\" + CHR$(34) '$args[21]
        SHELL$ = SHELL$ + " " + Params.CustomButton2
    END IF
    IF Params.CustomButton3 <> "" THEN
        Params.CustomButton3 = "\" + CHR$(34) + Params.CustomButton3 + "\" + CHR$(34) '$args[22]
        SHELL$ = SHELL$ + " " + Params.CustomButton3
    END IF
    SHELL$ = SHELL$ + ";exit $LASTEXITCODE" + CHR$(34) 'adding return code command
    a = SHELL(SHELL$)
    PRINT SHELL$
    WPFMessageBox = a 'return code from the PowerShell script showing which button was pressed
END FUNCTION`

EXIT-Code

It may be nice to return an exit code in console-only mode

using END 0 ... END 255 could be a methode

SHELL command requiring cmd /c in some scenarios

Issue by FellippeHeitor
Wednesday Feb 06, 2019 at 16:57 GMT
Originally opened as Galleondragon/qb64#89


This feedback was received via email from Robert Frost:

The documentation for the SHELL command says that CMD /c is not necessary.
I believe it is, sometimes.

The below line does not create or overwrite the output file:
SHELL "PING -n 1 -w 250 www.google.ca >temp.txt"

The below line works:
SHELL "CMD /c PING -n 1 -w 250 www.google.ca >temp.txt"

It confused me that the below line, a different command, works.
SHELL "DIR >temp.txt"

I thank the development team for a wonderful (and free!) product.

`REDIM _PRESERVE` multi-dimensional array shifts data

Issue by Kroc
Monday Jan 22, 2018 at 21:49 GMT
Originally opened as Galleondragon/qb64#27


Though the unpredictability of changing the sizes of non-last dimensions in a multi-dimension arrays is common knowledge in most forms of BASIC, the QB64 documentation does not specifically call this out. The documentation implies that it should work, and the compiler / run-time gives no warnings or error. Your data just magically gets messed up!

Test code:

PRINT "REDIM TEST"
REDIM TEST(1 TO 2, 1 TO 3) AS INTEGER
LET TEST(1, 1) = 100
LET TEST(1, 2) = 200
LET TEST(1, 3) = 300
PRINT TEST(1, 1); TEST(1, 2); TEST(1, 3)
REDIM _PRESERVE TEST(1 TO 3, 1 TO 3) AS INTEGER
PRINT TEST(1, 1); TEST(1, 2); TEST(1, 3)
END

Suggested solutions:

  • Changing the bounds of a non-last dimension in a multi-dimensional array should produce a run-time error
  • QB64 should ensure data integrity and move the data to the correct locations

I am building a two dimensional cross-check array, where the bounds are increasing as new data is read in. It would be difficult to store all the data (without knowing the final bounds until read) and dimension the array at the end.

*WIP* Make-based build system

Issue by ismaell
Sunday Nov 27, 2016 at 19:40 GMT
Originally opened as Galleondragon/qb64#16


A more traditional way to build it. Please comment.

The flags might be outdated, it has been over a year, but it still seems to build.

Something not included is a step to remove ../temp/ from the #include directives, as it didn't seem appropriate to do it there...

NOTE: Sadly I couldn't test the result this time as it's producing a segmentation fault.


ismaell included the following code: https://github.com/Galleondragon/qb64/pull/16/commits

Array in User Type

Issue by Kobolticus
Saturday Jul 14, 2018 at 16:02 GMT
Originally opened as Galleondragon/qb64#52


Requesting an enhancement for the User Types to have the ability to use an array inside the type
Type Userdata
Variables(50) AS INTEGER
. . .
end type

Dim MyType(20) as Userdata

MyType(1).Variables(15)=1024

Crash: abort with empty random access file with fields

Describe the bug
The program below aborts instead of works.

QB64 info (please complete the following information):

  • Version 1.4
  • OS: Linux (Ubuntu 18.04.4 LTS)
  • Is the bug present in the latest dev build too? Yes (qb64_2020-06-23-11-52-03_87510de_lnx.tar.gz)

To Reproduce

  1. Run this program on Linux:
OPEN "FOOBAR.XYZ" FOR RANDOM AS #1
FIELD #1, 20 AS Foo$
GET #1, 1
CLOSE
  1. Get this abort on Linux:
    corrupted size vs. prev_size
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff648b801 in __GI_abort () at abort.c:79
#2  0x00007ffff64d4897 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff6601b9a "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007ffff64db90a in malloc_printerr (str=str@entry=0x7ffff65ffc9d "corrupted size vs. prev_size") at malloc.c:5350
#4  0x00007ffff64e315f in _int_free (have_lock=0, p=<optimized out>, av=0x7fffec000020) at malloc.c:4295
#5  __GI___libc_free (mem=<optimized out>) at malloc.c:3124
#6  0x00007ffff6ee201e in std::basic_filebuf<char, std::char_traits<char> >::_M_destroy_internal_buffer() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff6ee5589 in std::basic_filebuf<char, std::char_traits<char> >::close() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x00007ffff6ee72cd in std::basic_fstream<char, std::char_traits<char> >::close() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9  0x000000000047b469 in gfs_close(int) ()
#10 0x0000000000460d93 in sub_close(int, int) ()
#11 0x00000000004089f1 in QBMAIN(void*) ()
#12 0x00000000004087ad in QBMAIN_LINUX(void*) ()
#13 0x00007ffff738a6db in start_thread (arg=0x7ffff3b4e700) at pthread_create.c:463
#14 0x00007ffff656c88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Expected behavior
Not crash :)

Maximize button not functioning as expected

Since v1.3 (at least, could have started earlier), I cannot use the maximize button in QB64 without shifting the graphics down several pixels which throws off the cursor selection. I feel like back in the 2010s I was able to use the maximize button with no issues. I've verified this on at least 5 computers. 2 of which running both 64 and 32 bit versions of v1.3 and v1.4
Can the maximize button be fixed? I can get an approximately maximized screen by doing a 240 by 63 screen on a 1920x1080 display but it would just be nice to just be able to click maximize instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.