Changeset 3252 for src/pge

Show
Ignore:
Timestamp:
05/15/05 13:22:17 (4 years ago)
Author:
autrijus
svk:copy_cache_prev:
4802
Message:

* allow taking args from cmd line.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/pge/run_pge.pir

    r3236 r3252  
    11.sub _main 
    2     .local int spi, spc, utf8, pos, size1, size2 
     2    .local int argc, pos, size1, size2 
    33    .local pmc args, match, add_rule 
    4     .local string name, rule, input, result, cmd, sizeStr, arg1, arg2 
     4    .local string input, result, cmd, sizeStr, arg1, arg2 
    55    .local pmc stdin 
     6    .include "iglobals.pasm" 
    67 
    78    load_bytecode "PGE/Hs.pir" 
    89    match = find_global "PGE::Hs", "match" 
     10 
     11    getinterp args 
     12    set args, args[.IGLOBALS_ARGV_LIST] 
     13    argc = elements args 
     14    if argc == 3 goto do_args 
    915 
    1016  loop: 
     
    5258    goto loop 
    5359 
     60  do_args: 
     61    arg1 = args[1] 
     62    arg2 = args[2] 
     63    result = match(arg1, arg2) 
     64    print result 
     65 
    5466  end: 
    5567.end