Changeset 162 for trunk/thune/console.c

Show
Ignore:
Timestamp:
05/27/06 21:22:22 (3 years ago)
Author:
krobillard
Message:

Thune -

Opcode selector is now preserved by infuse & ur_toStr().
Added ur_makeBinaryFrom() & ur_encodingCharSize[].
Command line arguments now passed to script in 'args.
Switched order of 'iter arguments.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/console.c

    r118 r162  
    9292    UrlanEnv env; 
    9393    char cmd[ 512 ]; 
    94     char* file = 0; 
     94    int fileN = 0; 
    9595    int ret = 0; 
    9696 
     
    121121            else 
    122122            { 
    123                 file = argv[i]; 
     123                fileN = i; 
    124124                break; 
    125125            } 
     
    127127    } 
    128128 
    129     if( file ) 
     129    if( fileN ) 
    130130    { 
    131131        char* pos; 
    132         if( argc > 2 ) 
     132 
     133        pos = cmd; 
     134 
     135        if( (argc - fileN) > 1 ) 
    133136        { 
    134137            int i; 
    135             pos = strCopy( cmd, "do/args %" ); 
    136             pos = strCopy( pos, argv[1] ); 
    137             *pos++ = ' '; 
    138138            *pos++ = '['; 
    139             for( i = 2; i < argc; ++i ) 
     139            for( i = fileN + 1; i < argc; ++i ) 
    140140            { 
    141141                if( i > 2 ) 
     
    145145                *pos++ = '"'; 
    146146            } 
    147             *pos++ = ']'; 
     147            pos = strCopy( pos, "] :args " ); 
    148148        } 
    149149        else 
    150150        { 
    151             /* 
    152             pos = strCopy( cmd, "do %" ); 
    153             pos = strCopy( pos, argv[1] ); 
    154             */ 
    155  
    156             pos = cmd; 
    157             *pos++ = '"'; 
    158             pos = strCopy( pos, argv[1] ); 
    159             *pos++ = '"'; 
    160             pos = strCopy( pos, " load do" ); 
    161  
    162             //pos = strCopy( cmd, argv[1] ); 
    163         } 
     151            pos = strCopy( pos, "none :args " ); 
     152        } 
     153 
     154        *pos++ = '"'; 
     155        pos = strCopy( pos, argv[fileN] ); 
     156        *pos++ = '"'; 
     157        pos = strCopy( pos, " load do" ); 
    164158 
    165159        switch( ur_evalCStr( &env.mainThread, cmd, pos - cmd ) )