New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add preprocessor #commands to pause and resume preprocessing. #2078
Comments
That would be a single-file (at least WML-wise) add-on then? The preprocessor also handles file inclusions. |
Yes. I have implemented it as single file of addon wml, plus _main.cfg which loads it if preprocessed version exists (made to valid unprocessed wml with some regex). |
Hmm, I see two main options here, either some sort of pragma to disable preprocessing for (the rest of) the file, or a different extension for already-preprocessed WML (C and C++ compilers can do this, for similar reasons). We could add a switch to wesnoth to generate such a file. A different question though, is how much more efficient this is. Have you profiled or tested things? |
With SSD there was no notable difference, but on HDD it saves about a minute. https://forums.wesnoth.org/viewtopic.php?p=616920#p616920 https://www.wesnoth.org/irclogs/2017/06/%23wesnoth-dev.2017-06-03.log starting with
|
Actually, preprocessing is something that can already be done. There is a --preprocess option which outputs a regular cfg file with only #textdomain directives remaining. (which are required to make translations function) Of course, the preprocessor will still run on this file, but that's not really a problem, is it? |
Yes, I generate that file with wesnoth -p. So far I have noticed that it breaks some units.w.o faction names, resulting in name like "AE - #textdomain wesnoth-Ageless_Era". Problem of running preprocessor again is that the generated cfg file is not immediately valid - at least if Lua is used. It drops <<>>, so they need to be swapped in again. |
I suppose the values are because of stuff like this?
As for the lua stuff, I suppose we need to check if things need to be escaped before printing, and use different quotation based on that. |
I'm unsure why you need a preprocessed addon in the first place. isn't that exactly why we have our wml cache? That is to make the proprocessign only happen once and the read from the cached prorocerssed file |
The WML cache is only used until wesnoth exits, then it is regenerated. Might be different for 1.13 though. |
Actually, it's stored in a cache directory and will be reloaded from there unless files have changed. |
I see that with v1.13.9+dev (3786827-Modified) it indeed makes use of that. That is enough for my case. Nevertheless, the requested feature might be useful for someone. |
That said, i think the wml cache shudl be improved
|
However, considering wmlunits timeout, I still need to create preprocessed version for 1.13 too - that has timeout of 20sec. |
No longer needed since wmlunits timeout was increased to 100sec. |
Currently, there is << >> syntax, which works for value of single key, but needs additional work to protect longer code.
Use case would be releasing already preprocessed addon, in order to reduce loading time for players.
The text was updated successfully, but these errors were encountered: