Skip to content

Commit

Permalink
mk/jam: Make static plugins support handle 'special' chars in plugin …
Browse files Browse the repository at this point in the history
…name
  • Loading branch information
res2002 committed Jun 25, 2014
1 parent 3ef8f87 commit 389235b
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions mk/jam/static.jam
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@
#============================================================================
# all private

# Remove all characters invalid in an identifier from the given string
rule FilterInvalidIdentifierChars
{
local name = $(1) ;
local filtered = "" ;
while "$(name)" != ""
{
local char = "_" ;
switch $(name)
{
case [A-Za-z0-9]* : char = [ MATCH "(.)" : $(name) ] ;
}
filtered = "$(filtered)$(char:J=)" ;
name = [ MATCH ".(.*)" : $(name) ] ;
}
return $(filtered) ;
}

rule GenerateStaticPluginBoilerplate
{
local tag = $(>) ;
Expand Down Expand Up @@ -46,9 +64,14 @@ rule GenerateStaticPluginBoilerplate

rule GenerateStaticPluginInstantiation
{
local idents ;
for plugin in $(>)
{
idents += [ FilterInvalidIdentifierChars $(plugin:B) ] ;
}
local tag = $(3) ;
GenerateStaticPluginBoilerplate $(<) : $(tag) ;
ResponseFile $(<) : "SCF_USE_STATIC_PLUGIN($(>:B))" : notfile ;
ResponseFile $(<) : "SCF_USE_STATIC_PLUGIN($(idents))" : notfile ;
}

rule GenerateStaticPluginRegistration
Expand All @@ -64,7 +87,7 @@ rule GenerateStaticPluginRegistration
{
grist = $(grist_base)_$(meta) ;
target = $(<:G=$(grist)) ;
local ident = $(meta:B) ;
local ident = [ FilterInvalidIdentifierChars $(meta:B) ] ;
NotFile $(ident) ;
IDENTIFIER on $(target) = $(ident) ;
GenerateStaticPluginRegistration1 $(target) : $(meta) ;
Expand Down

0 comments on commit 389235b

Please sign in to comment.