Jump to content
  • Advertisement
Sign in to follow this  
gjl

Preprocessing Callback for Script Builder [PATCH]

This topic is 714 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I needed a way to preprocess the script files before they were compiled, but after all the preprocessor directives have been processed in the script builder addon, so I have added a new callback for this purpose. I also use it to produce a preprocessed version of a script that includes many files, so that it can be distributed as a single file.

 

Please find attached the patch for the add-on. It would be nice if the modification could be added to the main branch - if you find it useful. I have tried to keep the semantics of the include callback (that replaces the default behavior). 

Share this post


Link to post
Share on other sites
Advertisement

Hi gjl,

 

I only got the time to look into this now. 

 

Let me try to understand better what the purpose of this preprocessor callback is. 

 

From the code changes in the patch I gather that you are using it to collect all the script files before they are sent to the script compiler, so that instead of compiling the script you do something else with it. But you're otherwise not using it to modify the processing in the builder.

 

It doesn't really look like something that would be best solved with a callback. Wouldn't it be better to just have a flag in the builder to tell it to store the script content rather than compile it, so that the application can then get this content after the preprocessing has finished through some get calls? I can see that being useful for debugging the preprocessing step, or in your case, to store the preprocessed files as a single file.

Share this post


Link to post
Share on other sites

Thanks for taking the time to check it out. My initial idea was indeed to preprocess with the callback before actually processing the files, but I tried to stick to the same semantics as the include callback, that actually replaces the include logic. So it's the same here, it replaces the processing logic, so that you can do your preprocessing and then call the compiler from there (it can be interesting to proceed this way if pre-processing is rather complex and requires that you compile several sections for example).

Share this post


Link to post
Share on other sites

Thanks for the clarification.

 

I'll give this some more thought before deciding how to move ahead with it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!