Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - luke

Pages: 1 ... 20 21 [22]
316
QB64 Discussion / Re: Why Internal and Source Folders?
« on: February 28, 2018, 04:19:43 am »
And you mention C code, is this C code or C++ code? Or C++ code written like C?
Sorry, that's me being slack. Technically it's all C++ as we're using a C++ compiler, but it's written in a very C-like style.

Your summary sounds correct. What to modify depends on what you're looking to change. If you want to change the IDE or the part that does the BASIC -> C++ translation, that's in source/qb64.bas (and $included files). If you want to edit the runtime, that's the stuff in internal/c/. internal/source/ is updated automatically by external build processes and you should never need to edit it.

317
QB64 Discussion / Re: Why Internal and Source Folders?
« on: February 27, 2018, 08:26:57 pm »
source/ is the code for qb64.exe
internal/c/ is the runtime that's compiled into programs
internal/temp/ is where the compiler keeps generated C code for the program it is compiling to pass to gcc
internal/source/ is the intermediate C form of qb64.exe, generated from source/qb64.bas. This is used by the install script to build a qb64, otherwise you'd need a qb64 binary to produce a qb64 binary...

Windows users have the luxury of not normally needing to run the install script since there is a precompiled binary.

318
QB64 Discussion / Re: QB64 1.2 Audio Files Major Bug
« on: February 27, 2018, 08:45:44 am »
Please provide an audio file that causes the issue.

319
QB64 Discussion / Re: Eliminating Some Code Redundancies in QB64?
« on: February 27, 2018, 07:15:42 am »
In the specific case of return followed by break, I wouldn't bother. The possible benefit is quite small but like any code changes there's the chance of introducing bugs.

However, if you want to take a crack at making some changes, I draw your attention to libqb.cpp and the functions contained therein. Many of them declare random temporary variables as static, which has the same effect as in BASIC - the value is preserved between calls to that function. However, the vast majority of these don't need to be static at all.

Having all these static variables means that a) none of these functions are able to be called recursively, b) they are not thread safe (qb64 uses a few threads of execution) and c) waste memory, because all static variables in a program must be allocated all the time (non-static variables are just allocated on the stack when the function is called them thrown away.

So, one thing you might consider taking a crack at is going through all these statics and removing them. If you do decide to take this on you're free to do as much or as little work as you like. Basically it would involve looking at each case and ensuring the static behaviour isn't being used, then just removing the keyword. If a variable is always assigned to in a function before it's ever read, that's a guarantee it doesn't need to be static. If it's read before it's set, that's a sure sign it does need to be static (or it's a bug!).

As a nice side effect, this'd take you on a nice tour through the source.

320
QB64 Discussion / Re: Starting with QB64 Development
« on: February 27, 2018, 07:01:41 am »
I tend to use vim + gdb when I need to trace execution/watch variables. I've never used visual studio, but it would seem it's (erroneously) trying to run cmake over the code.  Anything in a 'download' folder isn't actually used at all and is only there for"reference", apparently, so you can safely delete it (that sounds like a good idea actually).

I have no idea why the endings are .txt either. Most of the C stuff was written in notepad, so I guess convenience of windows file associations might have something to do with it?

As you may have discovered, libqb.cpp contains the bulk of the runtime. As a general rule QB subs and functions are mapped to a similarly named C function with a sub_ or func_ prefix (though the string manipulation ones tend to begin qbs_ and a few graphics ones have qbg_ iirc – consistency is not the name of the game here).

I'm not really sure where to start explaining things, but feel free to ask as many questions as you want. If you want rapid fire answers come talk with me on irc sometime.

Finally, don't be too concerned if you're not too sharp with C++. All of the code is just written as if it were C, and here's a dirty secret: C is just BASIC with pointers and punctuation instead of the english-like words.

321
I should mention that nowadays the windows version of QB64 from qb64.org comes precompiled, so there's no need to run the setup script anymore.

322
The bug relating to multiple sounds not playing properly should now be fixed. I'll look into the_SNDRAW matters soon, but I can't promise anything there - the code behind sndraw is sufficiently messy that I don't fully understand what it's doing yet.

As for C++ compilation errors, we're looking at adding some logging to make it more practical to investigate such matters. Hopefully this should be ready in time, but there seems to be some issues with it on windows XP.

323
QB64 Discussion / Re: Enhanced Features For QB64
« on: July 22, 2017, 12:04:10 am »
I see no reason to complicate things for the sake of a little syntactic sugar.

324
QB64 Discussion / Re: Try to Recreate a Small Interpreter/Compiler
« on: July 18, 2017, 09:34:18 pm »
I wouldn't even call that a language; it's a data encoding at best.

It does, however, remind me of Brainfuck, which *is* Turing complete: https://en.m.wikipedia.org/wiki/Brainfuck

Pages: 1 ... 20 21 [22]