Author Topic: Why Internal and Source Folders?  (Read 2325 times)

0 Members and 1 Guest are viewing this topic.

Offline davidshq

  • Newbie
  • Posts: 55
Why Internal and Source Folders?
« 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

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
Re: Why Internal and Source Folders?
« Reply #1 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.

Offline davidshq

  • Newbie
  • Posts: 55
Re: Why Internal and Source Folders?
« Reply #2 on: February 28, 2018, 12:19:55 am »
Hi Luke,

If I'm understanding your last post correctly:

  • source/ - QB64 code that is compiled to create qb64.exe
  • internal/c/ - When one creates a program using QB64, this code is compiled into your program
  • internal/temp/ - QB64 generates C code that is then passed to gcc for actual compilation.
  • internal/source/ - QB64 used source/qb64.bas to generate C code of QB64. This will then be compiled by gcc into an executable.

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!

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
Re: Why Internal and Source Folders?
« Reply #3 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.

Offline davidshq

  • Newbie
  • Posts: 55
Re: Why Internal and Source Folders?
« Reply #4 on: February 28, 2018, 07:58:43 pm »
Thanks!