Preprocessing Callback for Script Builder [PATCH]

Started by
4 comments, last by gjl 7 years, 8 months ago

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).

Advertisement

Thanks. I'll check out what you've done and if I like it, incorporate it into the library.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

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.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

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).

Thanks for the clarification.

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

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Thanks! :)

This topic is closed to new replies.

Advertisement