Jump to content
IGNORED

IntyBASIC "include" module limit??


DZ-Jay

Recommended Posts

I was not aware that there was a limit to the number of modules you could include in your IntyBASIC program.  I just got this error:

Error: more than 50 INCLUDE used in line 331

 

So, apparently, you cannot include more than 50 modules.  This is distressing. 😬  I am going to have to figure out how to merge my modules to resolve this issue and avoid it in the future.  I wasn't planning on that, and I'm not done with the project. :(

 

Personally, I do not think there should be a limit; but if there must be one due to practical considerations, it should be rather high.  50 is much too small for anything other than a trivial program.  For easier maintenance and troubleshooting, I tend to break out my codes into many modules -- organized in contextual and logical groupings.  It's sort of a pain to have to wade through hundreds of lines of codes among dozens of subroutines in order to find the line you want.  (Christmas Carol, for example, consisted of over 200 modules, including code, data tables, bitmaps, animations, etc.)

 

I just thought it was weird, and the error took me by surprise.  The limit is not mentioned in the manual, nor had I heard it mentioned before.  Am I really the only weirdo that has ever broken his program into more than 50 files?

 

Anyway, I wish this limitation is raised in a future version of the compiler.  I also wish for the compiler to support nested "include" directives.  Oh, and as long as we are making wishes, I want a pony for Christmas. :)

 

     -dZ.

Link to comment
Share on other sites

3 minutes ago, carlsson said:

Perhaps you can use a Makefile, that instead of including multiple source files, paste them together on the fly and feed the compiler?


Sure, that's one possible work-around; but it's just something I wasn't planning to deal with.  It will also make troubleshooting with the source-level debugger more painful, because my line numbers won't match.

 

I'm just surprised nobody has ever come across this. 🙁

 

    dZ.

Link to comment
Share on other sites

7 minutes ago, carlsson said:

Perhaps it is a limitation of the C++ compiler to generate the IntyBASIC compiler, if it can't handle more than 50 input files at once?


That would be fine, and I would live with it, of course.  I just wish I knew.  At the very least, there should be a note about it on the manual. ;)

 

I have now 50 files, and they are mostly constants, macros, and core engine-related modules -- I have not even started creating graphics, animations, sounds, etc., which will surely take more files to house extensive data tables.  So, I have to figure out how to re-organize them in a way that gives me some headroom for what is to come, and does not make troubleshooting or perusing the code too cumbersome and burdensome.

 

It is probably not a problem for most people. But my little brain cannot deal with large files and hundreds of lines at once -- I get overwhelmed easily and my brain loses focus. ;(


Don't get me wrong, as far as limitations go, this one is one of the least bothersome.  It is just yet another one, so I am just a bit frustrated at the moment; but I will get over it.  *shrug*

 

    dZ.

  • Like 1
Link to comment
Share on other sites

From the source code on GitHub:

 

class compiler {
private:
    ifstream input;
    ifstream included;
    ifstream included2;

[..]
    ifstream include[50];

 

The number 50 is hard coded into multiple places of the compiler source code. I wonder if the C++ compiler puts those input streams on the heap or something, and nanochess found out that 50 is a sweet number to not max out the heap. If you have a suitable environment, you could get the sources, change the number to a higher one, recompile the IntyBASIC compiler and see if you get segmentation fault or if it behaves properly.

Link to comment
Share on other sites

2 minutes ago, carlsson said:

From the source code on GitHub:

 

class compiler {
private:
    ifstream input;
    ifstream included;
    ifstream included2;

[..]
    ifstream include[50];

 

The number 50 is hard coded into multiple places of the compiler source code. I wonder if the C++ compiler puts those input streams on the heap or something, and nanochess found out that 50 is a sweet number to not max out the heap. If you have a suitable environment, you could get the sources, change the number to a higher one, recompile the IntyBASIC compiler and see if you get segmentation fault or if it behaves properly.


Thanks, but I think I'm not smart enough to be able to re-compile the compiler from source.  I haven't touched development tools other than simple editors and the scripting languages for several years now.  I'll leave that to the real programmers. :dunce:
 

I'll just sit in my little corner, "shout at the clouds" for a few minutes, and then just ... re-organize my code and deal with it.  :)


Grampa Simpson Meme GIF by MOODMAN

 

    dZ.

Link to comment
Share on other sites

7 minutes ago, DZ-Jay said:

I'm not smart enough to be able to re-compile the compiler from source.

Are you Team Windows, Team Mac OSX or Team Something Else? On Windows, I have the MinGW environment + msys shell. Except for the last step, to strip away debug strings from the final binary, the Makefile included with the code works right out of the box. If you run 64-bit Windows, I can supply you with an IntyBASIC compiler binary to try.

Link to comment
Share on other sites

1 minute ago, carlsson said:

Are you Team Windows, Team Mac OSX or Team Something Else? On Windows, I have the MinGW environment + msys shell. Except for the last step, to strip away debug strings from the final binary, the Makefile included with the code works right out of the box. If you run 64-bit Windows, I can supply you with an IntyBASIC compiler binary to try.


I'm on ... (checks the historical fossil record ...) team OS X 10.8.5 ... Intel chipset ... from way back in the ancient days of yore, when operating systems were named after large cats.

 

Do not worry too much about it.  I would like to release my source at some point, and it should be possible for anybody to build it with the stock compiler.  I do appreciate the offer very much. 👍🏻

 

    dZ.

Link to comment
Share on other sites

Hey I'm still trying to get my Sears controllers to work on the emulator both nostalgia and Joe's

 

I got the emulator up I still can't get the Sears pads hooked up to where I can use the keypad and have it recognize the second player.

 

Anybody has to hack file for Intellivision 2 controllers please send it my way thank you.

Link to comment
Share on other sites

Ok, I moved 50 to a constant and changed it to 100. The g++ compiler doesn't seem to bother, and the resulting IntyBASIC compiler also doesn't crash out.

 

Of course my test program is the most plain you can imagine, consisting of 80 constants defined in one file each and the main program is an endless GOTO loop, so it might not be a realistic example of any limits you might encounter.

many-include.tar.bz2

  • Like 1
Link to comment
Share on other sites

2 minutes ago, nanochess said:

I forgot completely why I put that silly limitation in the first place 🤔

 

No worries.  I just re-grouped my modules for the moment, so I am now way below 50.  :)

 

It would be nice if that limitation goes away in the future, or at least is increased significantly.

 

      -dZ.

  • Like 1
Link to comment
Share on other sites

I still wonder if it could be due to the C++ compiler used, or perhaps the computer running the IntyBASIC compiler, how it allocates memory. I tried with 80 files which were below 20 bytes each. I imagine if each file was 20 kB or more, the situation might be different, though even then we're talking a few megabytes of RAM to allocate for input files which a computer from the 21th century shouldn't have any major issues with.

Link to comment
Share on other sites

3 minutes ago, carlsson said:

I still wonder if it could be due to the C++ compiler used, or perhaps the computer running the IntyBASIC compiler, how it allocates memory. I tried with 80 files which were below 20 bytes each. I imagine if each file was 20 kB or more, the situation might be different, though even then we're talking a few megabytes of RAM to allocate for input files which a computer from the 21th century shouldn't have any major issues with.

 

Or maybe nanochess just thought that 50 files ought to be enough for anybody ...

 

It's still debated if he ever said this about PC memory. Still this is ...

 

😄

  • Haha 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...