Changeset 488 for trunk/thune/series.c

Show
Ignore:
Timestamp:
10/18/07 04:20:02 (13 months ago)
Author:
krobillard
Message:

Added push & pop.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/series.c

    r476 r488  
    12261226            ur_throwErr( UR_ERR_DATATYPE, 
    12271227                         "append expected series argument" ); 
     1228            return; 
    12281229        } 
    12291230    } 
     
    13821383            ur_throwErr( UR_ERR_DATATYPE, "remove expected series argument" ); 
    13831384    } 
     1385} 
     1386 
     1387 
     1388/* 
     1389  (series val -- ) 
     1390  Same as [append drop] 
     1391*/ 
     1392UR_CALL( uc_push ) 
     1393{ 
     1394    UCell* ser = ur_s_prev(tos); 
     1395    int len = ur_seriesEnd(ser); 
     1396    if( len > -1 ) 
     1397    { 
     1398        ser->series.it = len; 
     1399        uc_insert( ut, tos );           // Assuming uc_insert cannot fail. 
     1400        UR_S_DROP; 
     1401        return; 
     1402    } 
     1403    ur_throwErr( UR_ERR_DATATYPE, "push expected series argument" ); 
     1404} 
     1405 
     1406 
     1407/* 
     1408  (series -- ) 
     1409  Same as [tail prev remove drop] 
     1410*/ 
     1411UR_CALL( uc_pop ) 
     1412{ 
     1413    int len = ur_seriesEnd(tos); 
     1414    if( len > -1 ) 
     1415    { 
     1416        if( len > 0 ) 
     1417        { 
     1418            tos->series.it = len - 1; 
     1419            uc_remove( ut, tos );       // Assuming uc_remove cannot fail. 
     1420        } 
     1421        UR_S_DROP; 
     1422        return; 
     1423    } 
     1424    ur_throwErr( UR_ERR_DATATYPE, "pop expected series argument" ); 
    13841425} 
    13851426 
     
    34833524    { uc_append_cat,   "append.cat" }, 
    34843525    { uc_remove,       "remove" }, 
     3526    { uc_push,         "push" }, 
     3527    { uc_pop,          "pop" }, 
    34853528    { uc_fill,         "fill" }, 
    34863529    { uc_pick,         "pick" },