For localization stuff, I want to apply filters to the path given in #include directives: #include @VAR@/path Patch forthwith.
Comment on attachment 159723 [details] [diff] [review] preprocess #include directive param Hixie, feel free to steal this review from bryner.
Do we really want it to work like that?
I do. See the dependent bug, I'm doing #include @AB_CD@/extra-jar.mn Simply allowing substitution in the #include directive would also suit my needs.
The problem I see is that it would be very unintuitive. For example, #include foo bar.inc ...might include foo\ \ bar.inc, or might include foo\ bar.inc, you can't tell from just looking at the line, you have to know what the arguments sent to the preprocessor were. I would rather we do something like this: #substinclude @FOO@/bar.inc ...or some such. (I don't like the name "#substinclude" though.)
maybe #include-with-variables or something like that?
Created attachment 160230 [details] [diff] [review] add an #includesubst filter
Attachment #159723 - Attachment is obsolete: true
Comment on attachment 160230 [details] [diff] [review] add an #includesubst filter I couldn't do #include-subst because that's not a legal perl identifier.
> (my $arg = shift) =~ s/@(\w+)@/$stack->get($1, 1)/gose;; > my $filename = File::Spec::_0_8::catpath(File::Spec::_0_8::splitpath($arg)); ...would be better as: my($filename) = @_; # substitute occurances of @var@ with the relevant variable $filename =~ s/@(\w+)@/$stack->get($1, 1)/gose; $filename = File::Spec::_0_8::catpath(File::Spec::_0_8::splitpath($filename)); Pity about the growing code duplication. I should go through the preprocessor and fix some of that (and make the code generally more readable) at some point.
Fix checked in on trunk and branch, with changes specified by Ian.
Status: NEW → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.