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

RESOLVED FIXED

Status

SeaMonkey
Build Config
RESOLVED FIXED
14 years ago
13 years ago

People

(Reporter: Benjamin Smedberg, Assigned: Benjamin Smedberg)

Tracking

({fixed-aviary1.0})

Trunk
fixed-aviary1.0

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

14 years ago
For localization stuff, I want to apply filters to the path given in #include
directives:

#include @VAR@/path

Patch forthwith.
(Assignee)

Comment 1

14 years ago
Created attachment 159723 [details] [diff] [review]
preprocess #include directive param
(Assignee)

Comment 2

14 years ago
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)
(Assignee)

Updated

14 years ago
Blocks: 260705
Do we really want it to work like that?
(Assignee)

Comment 4

14 years ago
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?
(Assignee)

Comment 7

14 years ago
Created attachment 160230 [details] [diff] [review]
add an #includesubst filter
Attachment #159723 - Attachment is obsolete: true
(Assignee)

Comment 8

14 years ago
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.
(Assignee)

Comment 10

14 years ago
Fix checked in on trunk and branch, with changes specified by Ian.
Status: NEW → RESOLVED
Last Resolved: 14 years ago
Keywords: fixed-aviary1.0
Resolution: --- → FIXED

Updated

14 years ago
Attachment #159723 - Flags: review?(bryner)
Product: Browser → Seamonkey
(Assignee)

Updated

13 years ago
Attachment #160230 - Flags: review?(ian)
You need to log in before you can comment on or make changes to this bug.