UCC compiling error

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

UCC compiling error

Post by Donfrow »

Well, it's been awhile since I've run into an error but I must once again seek help. I've been plugging away at my little project for some time now and I've hit yet another roadblock. I created a new NPC and in my base usecode.uc added an include to the new NPC's file, as below:

#include "npc/rosendale/maggie.uc"

However now the compiler is tossing back an error when I try to compile it typing the below in the tools directory (where all the .uc files are).

ucc -s usecode usecode.uc -s

The compiler is tossing back this error:

usecode.uc:912: Can't open 'animals/chicken.uc'

This file is the 2nd last line I have in usecode.uc, the last line simply being a blank line.

I commented out #include "npc/rosendale/maggie.uc" and it compiled fine again. I then deleted maggie.uc and remade it thinking it was an issue there, however I received the same error. I ended up creating a second NPC, harris.uc, which has absolutely nothing in it and tried to compile. This time it moved "up" the list of the final files. This time it tossed out:

usecode.uc:911: Can't open 'animals/cow.uc'

cow.uc is the 3rd last line I have in usecode.uc. I added another #include and it is the same error except for line 910. If I comment out the 3 new ones it compiles without issue.

I'm thinking I someone reached a maximum number of functions or something that I can include? My auto numbering for functions is as follows:

#autonumber 0xA00

Which is the very first (uncommented) line I have in usecode.uc. I also have a large amount of functions that are called as

void whatever object#()()

So I do not know if that plays a part in it.

I am using the win32 10/20 tools snapshot.

In summary, it seems for a new file I include in usecode.uc, when compiled, an error message comes up indicating it cannot open the last file in usecode.uc. If I add 2 new files, the error will complain about the 2nd last file in usecode.uc, and so on.

Any help with this would be greatly appreciated.

Thanks
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: UCC compiling error

Post by Wizardry Dragon »

I know this is going to sound entirely daft, but these files DO exist, right?

Just adding files to the end of usecode.uc isnt going to change the existance of a troublesome file above them.

wizardry dragon
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

Re: UCC compiling error

Post by Donfrow »

Yes, they do exist.

The files it's complaining about are actually ones that compiled fine in the past and have not been touched in some time. The issue arises only when I include new unrelated files. At that point it complains about the last file, which is not even the new file(s).
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

Re: UCC compiling error

Post by Donfrow »

Would anyone happen to have any other ideas as to what could be causing this?

I don't think it's the actual contents of the files throwing back the error as if I comment out animals/chicken.uc and add the entire contents of that chicken.uc into npc/rosendale/maggie.uc there are no compiling issues.

Thanks
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: UCC compiling error

Post by agentorangeguy »

I think I had a problem similar to this one time when I was messing around with my usecode. *Most likely* this problem is caused by an error in one of your other usecode files. There was one time I either had one more or not enough brackets in on eof hte usecode files and then it would compile but it would seem to crap up another usecode file. It may seem mundane, but that may be the problem, I would check your usecode again to make sure there aren't any errors that wouldn't necessarily not compile but make things screwy.
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

Re: UCC compiling error

Post by Donfrow »

Thanks for the suggestion agenorangeguy. I went to the last 5 files I made before the error started and made the entire contents commented out. Unfortunately I'm still getting the same issue.

In your experience does something like that occur right after you save a file with an extra bracket or does it work for awhile as you add no files and then suddenly happen? In other words, in your experience could it be the 15th last file I made but only got screwy after I made 14 more fine files?
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: UCC compiling error

Post by agentorangeguy »

Well one thing I would notice is if I had an extra bracket or I was missing one, sometimes it would compile ok but if I went to that particular NPC it would either not say anything, or randomly start talking to me.

The only other suggestion I have (and I don't know if it will make much of a difference but it is worth a shot) is make npcs.uc and list all your npcs there, then in your usecode.uc file, you would #include the npcs.uc file. Try that and see if anything works?
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

Re: UCC compiling error

Post by Donfrow »

Hmm, well hopefully someone else can offer a suggestion as I would prefer not to have to do that as I have about 200 NPC's I would have to toss into that, each with their own functions within their NPC file.

I will try that but at first try and use the last 15 or so NPC's I made and hopefully the issue is there, maybe slowly adding on over the course of weeks. It's quite disheartening since if I remove one file and make a new one with all the newer functions everything works fine.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: UCC compiling error

Post by marzo »

Donfrow: can you zip the usecode files and send them to my e-mail? I can check out to see if I can find the error and then explain how it was done for future reference. I ask because trying to guess what might be the problem without access to the code in question is all but futile...
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

Re: UCC compiling error

Post by Donfrow »

Thanks, I will do that though after reading the thread about the eggs I will first correct all my eggs to have the object#()(). As I have quite a few eggs without that (I think all of them...) I will fix that first in the event that is the issue or contributing to it.

I want to make things as easy as I can as my usecode is very... unprofessionally done as I've started all this without much prior experience.
marzo
Site Admin
Posts: 1925
Joined: Thu May 14, 2020 1:34 pm

Re: UCC compiling error

Post by marzo »

I received your e-mail and looked into the problem. As I suspected, trying to debug it without the code was futile -- mainly because, with the code in hand, I could readily discover that the problem was not in it!

Allow me to explain: I first looked into it in my Ubuntu box, where the usecode compiled without any problems at all, even when changing what you said caused the compilation error; this observation immediately led me to the solution.

The real problem is that ucc was very sloppy about open files (with the stdio API): it never closes them, leaving the cleanup to the operating system. After enough files were opened for inclusion, ucc would not be able to open any more files. This is particularly glaring in Windows, especially pre-XP: in XP and later, the per-process limit of open files is 512, while it is 64 in earlier versions (compare to 1024 in my Ubuntu box). If you remove all non-comment non-include lines in usecode.uc, you will find that animals/cow.uc is the 509th line/include; in conjunction with the standard streams (stdout, stderr and stdin), that makes 512.

Anyway, the next version of UCC fixes this.
------
Marzo Sette Torres Junior
aka Geometrodynamic Dragon
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

Re: UCC compiling error

Post by Donfrow »

I've downloaded the new tools snapshot and it looks like it works.

Thanks a lot for figuring that out!
Locked