'include foo.bas has design problems

Discussions related to the extensions to the language available in LBB
CryptoMen
Posts: 6
Joined: Tue Nov 04, 2025 11:39 am

'include foo.bas has design problems

Post by CryptoMen »

Hello Richard,

I hope you are doing fine with cooler British weather.

I noticed 'include directive is not working properly.

1) If you make any references to SUBs and FUNCTIONS implemented in the include files LBB compiler crashes because those functions or subroutines are not visible inside the main code body.

2) Another problem is this, if you edit and update any includes and if you have not touched anything on the the main source code page LBB does not recompile the code. I was working around this by creating a comment in main source code and add or remove a dot or dash in that comment to help LBB sense something has changed .

3) If something cause an error at runtime from something in an include file it just reports the line number of include directive. It should say something like "Error at Line NNNN of include file foo.bas" or at least what is causing the error after that include directive line.

Can I suggest a strategy like this:

Step 1: Make a first past and create a single file by including the files and while doing that add a comment at the end of each line like 'MAIN:CPM-PERT.BAS LINE NNNN / 'INCLUDE:READ-PROJECT.BAS LINE MMMM / 'INCLUDE:PRINT-GANTT.BAS LINE MMMM / etc.

Step 2:Check if this entire expanded file is different than previous version to make correct decision for a rebuild.

Step 3:If you detect a compile or runtime error use those comments clearly showing where the error occured.

And, ofcourse once the code is merged into one monolithic single code file there will be no problems about invisible subs and funcs.

Trusting that 'include works properly I have converted a big code into include files and I noticed a few includes working properly but most of them aren't working. So, had to go back and paste back all those include files back into the main source file.

* * *

It will be also nice to have automatic inclusion of LB45FUNCS.BAS whenever an error hit happens with those functions like UPTO$(), AFTER$(), etc and always make those function names intepreted caseless. Like if lowercased function name matches with one of the LB45FUNCS just change all that function references to lowercased versions. And, always add LB45funcs at the end of STEP1 temporary merged file. Code is already coming out very small simply always include it at Step 1 conversion stage.