Changeset 7146 for src/Main.hs

Show
Ignore:
Timestamp:
09/26/05 17:21:49 (3 years ago)
Author:
iblech
Message:

* PIL2JS: jspugs.pl: Accept same commandline-options as runjs.pl does (most

importantly --pugs=/path/to/pugs).

* Main: Give --pugs=$*EXECUTABLE_NAME to runjs.pl so

/path/to/my/other/pugs/version -BJS doesn't call some other pugs in $PATH.

* Main: Also repaired pugs -BJS, which should start jspugs.pl.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Main.hs

    r7139 r7146  
    7979run ("-c":file:_)               = readFile file >>= doCheck file 
    8080 
    81 run ("-C":backend:args) | map toUpper backend == "JS" = 
    82     doHelperRun "JS" ("--compile-only":args) 
     81-- -CPerl5 outputs PIL formatted as Perl 5, PIL-Run is not involved. 
     82-- Should we rename -CPerl5, -CJSON etc. to -CPIL.Perl5, -CPIL.JSON etc.? 
     83run ("-C":backend:args) | map toUpper backend == "JS" = do 
     84    exec <- getArg0 
     85    doHelperRun "JS" ("--compile-only":("--pugs="++exec):args) 
    8386run ("-C":backend:"-e":prog:_)           = doCompileDump backend "-e" prog 
    8487run ("-C":backend:file:_)                = slurpFile file >>= doCompileDump backend file 
    8588 
    86 run ("-B":backend:_) | (== map toLower backend) `any` ["js","perl5"] = 
    87     doHelperRun backend =<< getArgs 
     89run ("-B":backend:_) | (== map toLower backend) `any` ["js","perl5"] = do 
     90    exec <- getArg0 
     91    args <- getArgs 
     92    doHelperRun backend (("--pugs="++exec):args) 
    8893run ("-B":backend:"-e":prog:_)           = doCompileRun backend "-e" prog 
    8994run ("-B":backend:file:_)                = slurpFile file >>= doCompileRun backend file 
     
    215220doHelperRun backend args = 
    216221    case map toLower backend of 
    217         "js"    -> if (args == []) 
     222        "js"    -> if (args' == []) 
    218223                   then (doExecuteHelper [ "perl5", "PIL2JS",  "jspugs.pl"  ] []) 
    219224                   else (doExecuteHelper [ "perl5", "PIL2JS",  "runjs.pl"   ] args) 
    220225        "perl5" ->       doExecuteHelper [ "perl5", "PIL-Run", "pugs-p5.pl" ] args 
    221226        _       ->       fail ("unknown backend: " ++ backend) 
     227    where 
     228    args' = f args 
     229    f [] = [] 
     230    f (bjs:rest)      | map toUpper bjs == "-BJS"       = f rest 
     231    f ("-B":js:rest)  | map toUpper  js == "JS"         = f rest 
     232    f (pugspath:rest) | "--pugs=" `isPrefixOf` pugspath = f rest 
     233    f (x:xs) = x:f xs 
    222234 
    223235doExecuteHelper :: [FilePath] -> [String] -> IO ()