Closed Bug 260955 Opened 20 years ago Closed 20 years ago

XUL preprocessor should apply filters to #include @VAR@/somepath

Categories

(SeaMonkey :: Build Config, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: benjamin, Assigned: benjamin)

References

Details

(Keywords: fixed-aviary1.0)

Attachments

(1 file, 1 obsolete file)

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.
Attachment #159723 - Flags: review?(bryner)
Blocks: 260705
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?
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.
Attachment #160230 - Flags: review?(ian)
>  (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
Closed: 20 years ago
Keywords: fixed-aviary1.0
Resolution: --- → FIXED
Attachment #159723 - Flags: review?(bryner)
Product: Browser → Seamonkey
Attachment #160230 - Flags: review?(ian)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: