QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: davidshq on February 27, 2018, 07:59:00 pm

Title: Why Internal and Source Folders?
Post by: davidshq on February 27, 2018, 07:59:00 pm
I'm just trying to wrap my head around the source code for QB64. There are two main folders - internal and source. The internal seems to contain all C++ code while the source contains all QB64 code. A cursory glance would indicate that they both contain an implementation of QB64, one in C++, the other in QB64. Is this correct? If not, what is the source folder there for?

Thanks!
Dave
Title: Re: Why Internal and Source Folders?
Post by: luke 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.
Title: Re: Why Internal and Source Folders?
Post by: davidshq on February 28, 2018, 12:19:55 am
Hi Luke,

If I'm understanding your last post correctly:


Is that correct? If so, do I want to make edits to the qb64.bas code and not to the C code?

And you mention C code, is this C code or C++ code? Or C++ code written like C?

Thanks!
Title: Re: Why Internal and Source Folders?
Post by: luke 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.
Title: Re: Why Internal and Source Folders?
Post by: davidshq on February 28, 2018, 07:58:43 pm
Thanks!