Changeset 483

Show
Ignore:
Timestamp:
10/05/07 04:54:10 (12 months ago)
Author:
krobillard
Message:

select! evaluation now pushes all values other than function! & call!.
Added ur_decompress().
Now using GLV from the Outguard repository.
gl/project.r now builds thuneGL library.

Location:
trunk/thune
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/files.c

    r478 r483  
    696696 
    697697 
     698/** 
     699   Decompress data into intialized array. 
     700 
     701   \return  Non-zero if successful. 
     702*/ 
     703int ur_decompress( const void* data, int len, UArray* arr ) 
     704{ 
     705#define BUF_LOW     32 
     706    bz_stream strm; 
     707    int ok; 
     708 
     709    strm.bzalloc = 0; 
     710    strm.bzfree  = 0; 
     711    strm.opaque  = 0; 
     712 
     713    ok = BZ2_bzDecompressInit( &strm, 0, 0 ); 
     714    if( ok != BZ_OK ) 
     715    { 
     716        //fprintf( stderr, "BZ2_bzDecompressInit failure (%d)", ok ); 
     717        return 0; 
     718    } 
     719 
     720    strm.next_in  = (char*) data; 
     721    strm.avail_in = len; 
     722 
     723    ur_arrayReserve( arr, 1, (len < BUF_LOW) ? BUF_LOW : len ); 
     724    strm.next_out  = arr->ptr.c; 
     725    strm.avail_out = arr->avail; 
     726 
     727    do 
     728    { 
     729        if( strm.avail_out < BUF_LOW ) 
     730        { 
     731            ur_arrayReserve( arr, 1, arr->avail + (2 * BUF_LOW) ); 
     732            strm.next_out  = arr->ptr.c + strm.total_out_lo32; 
     733            strm.avail_out = arr->avail - strm.total_out_lo32; 
     734        } 
     735 
     736        ok = BZ2_bzDecompress( &strm ); 
     737        arr->used = strm.total_out_lo32; 
     738    } 
     739    while( ok == BZ_OK ); 
     740 
     741    BZ2_bzDecompressEnd( &strm ); 
     742 
     743    return (ok == BZ_STREAM_END) ? 1 : 0; 
     744} 
     745 
     746 
    698747// (binary -- string) 
    699748UR_CALL( uc_decompress ) 
    700749{ 
    701 #define BUF_LOW     32 
    702     int ok; 
    703     int len; 
    704     bz_stream strm; 
    705750    UIndex strN; 
    706751    UString* str; 
     
    708753    char* cpB; 
    709754 
    710  
    711755    if( ! ur_binarySlice( ut, tos, &cpA, &cpB ) || (cpA == 0) ) 
    712756        return; 
    713757 
    714     strm.bzalloc = 0; 
    715     strm.bzfree  = 0; 
    716     strm.opaque  = 0; 
    717  
    718     ok = BZ2_bzDecompressInit( &strm, 0, 0 ); 
    719     if( ok == BZ_OK ) 
    720     { 
    721         len = cpB - cpA; 
    722         strm.next_in   = cpA; 
    723         strm.avail_in  = len; 
    724  
    725         strN = ur_makeBinary( (len < BUF_LOW) ? BUF_LOW : len, &str ); 
    726         strm.next_out  = str->ptr.c; 
    727         strm.avail_out = str->avail; 
    728  
    729         while( ok == BZ_OK ) 
    730         { 
    731             if( strm.avail_out < BUF_LOW ) 
    732             { 
    733                 ur_arrayReserve( str, 1, str->avail + (2 * BUF_LOW) ); 
    734                 strm.next_out  = str->ptr.c + strm.total_out_lo32; 
    735                 strm.avail_out = str->avail - strm.total_out_lo32; 
    736             } 
    737  
    738             ok = BZ2_bzDecompress( &strm ); 
    739             str->used = strm.total_out_lo32; 
    740         } 
    741  
    742         BZ2_bzDecompressEnd( &strm ); 
    743  
    744         if( ok == BZ_STREAM_END ) 
    745         { 
    746             ur_initType( tos, UT_STRING ); 
    747             ur_setSeries( tos, strN, 0 ); 
    748             return; 
    749         } 
    750         ur_throwErr( UR_ERR_INTERNAL, "decompress failure (%d)", ok ); 
    751     } 
    752     ur_throwErr( UR_ERR_INTERNAL, "decompress init failure (%d)", ok ); 
     758    strN = ur_makeBinary( 0, &str ); 
     759 
     760    if( ur_decompress( cpA, cpB - cpA, str ) ) 
     761    { 
     762        ur_initString( tos, strN, 0 ); 
     763    } 
     764    else 
     765    { 
     766        ur_throwErr( UR_ERR_INTERNAL, "decompress failure" ); 
     767    } 
    753768} 
    754769#endif 
  • trunk/thune/gl/gx_atoms.h

    r458 r483  
    11// This file is automatically generated - do not edit. 
    22 
    3 #define UR_ATOM_DRAW_LIST_OPCODES               321 
    4 #define UR_ATOM_WIDTH           322 
    5 #define UR_ATOM_HEIGHT          323 
    6 #define UR_ATOM_AREA            324 
    7 #define UR_ATOM_RECT            325 
    8 #define UR_ATOM_RASTER          326 
    9 #define UR_ATOM_TEXTURE         327 
    10 #define UR_ATOM_ELEM            328 
    11 #define UR_ATOM_CLOSE           180 
    12 #define UR_ATOM_FOCUS           329 
    13 #define UR_ATOM_RESIZE          330 
    14 #define UR_ATOM_KEY_DOWN                331 
    15 #define UR_ATOM_KEY_UP          332 
    16 #define UR_ATOM_MOUSE_MOVE              333 
    17 #define UR_ATOM_MOUSE_UP                334 
    18 #define UR_ATOM_MOUSE_DOWN              335 
    19 #define UR_ATOM_MOUSE_WHEEL             336 
    20 #define UR_ATOM_AMBIENT         337 
    21 #define UR_ATOM_DIFFUSE         338 
    22 #define UR_ATOM_SPECULAR                339 
    23 #define UR_ATOM_POS             340 
    24 #define UR_ATOM_SHADER          341 
    25 #define UR_ATOM_VERTEX          342 
    26 #define UR_ATOM_FRAGMENT                343 
    27 #define UR_ATOM_DEFAULT         344 
    28 #define UR_ATOM_WAIT            345 
     3#define UR_ATOM_DRAW_LIST_OPCODES               322 
     4#define UR_ATOM_WIDTH           323 
     5#define UR_ATOM_HEIGHT          324 
     6#define UR_ATOM_AREA            325 
     7#define UR_ATOM_RECT            326 
     8#define UR_ATOM_RASTER          327 
     9#define UR_ATOM_TEXTURE         328 
     10#define UR_ATOM_ELEM            329 
     11#define UR_ATOM_CLOSE           181 
     12#define UR_ATOM_FOCUS           330 
     13#define UR_ATOM_RESIZE          331 
     14#define UR_ATOM_KEY_DOWN                332 
     15#define UR_ATOM_KEY_UP          333 
     16#define UR_ATOM_MOUSE_MOVE              334 
     17#define UR_ATOM_MOUSE_UP                335 
     18#define UR_ATOM_MOUSE_DOWN              336 
     19#define UR_ATOM_MOUSE_WHEEL             337 
     20#define UR_ATOM_AMBIENT         338 
     21#define UR_ATOM_DIFFUSE         339 
     22#define UR_ATOM_SPECULAR                340 
     23#define UR_ATOM_POS             341 
     24#define UR_ATOM_SHADER          342 
     25#define UR_ATOM_VERTEX          343 
     26#define UR_ATOM_FRAGMENT                344 
     27#define UR_ATOM_DEFAULT         345 
     28#define UR_ATOM_WAIT            135 
    2929#define UR_ATOM_RGB             346 
    3030#define UR_ATOM_RGBA            347 
     
    4040#define UR_ATOM_RGB             346 
    4141#define UR_ATOM_RGBA            347 
    42 #define UR_ATOM_ON              260 
    43 #define UR_ATOM_OFF             262 
    44 #define UR_ATOM_ADD             199 
     42#define UR_ATOM_ON              261 
     43#define UR_ATOM_OFF             263 
     44#define UR_ATOM_ADD             200 
    4545#define UR_ATOM_BURN            357 
    4646#define UR_ATOM_COLOR           358 
  • trunk/thune/gl/project.r

    r458 r483  
    11REBOL [] 
    22 
    3 exe %gx [ 
     3default [ 
    44    warn 
    55    debug 
    6     ;release 
     6;   release 
    77    objdir %obj 
    8     opengl 
     8] 
    99 
     10lib %thuneGL [ 
    1011    include_from %. 
    1112    include_from %.. 
    12     ;include_from %hit 
    13     ;include_from %../util 
    1413    libs_from %.. %thune0 
    15     cflags {-DLANG_THUNE -DTHUNE_GL} 
     14    cflags {-DLANG_THUNE} 
    1615    cflags {-DUR_CONFIG_DT_CODE} 
    1716    cflags {-DNO_AUDIO} 
    1817 
     18    linux [ 
     19        cflags {-DUSE_XF86VMODE} 
     20        include_from %../unix 
     21        include_from %glv/x11 
     22        sources [ 
     23            %glv/x11/glv.c 
     24            %joystick.c 
     25        ] 
     26        include_from %/usr/include/freetype2 
     27    ] 
    1928    macx [ 
    20         cflags {-DOR_BIG_ENDIAN} 
    21  
    2229        include_from %../unix 
    2330        include_from %glv/mac 
    2431        sources [%glv/mac/glv.c] 
    25  
    26         ;include_from %../../../osrc/zlib 
    27         ;libs_from %../../../osrc/zlib [%z] 
    28  
    29         ;include_from %/Users/karl/osrc/libpng-1.2.12 
    30         ;libs_from %/Users/karl/osrc/libpng-1.2.12 [%png] 
    3132 
    3233        include_from %/usr/local/include/freetype2 
     
    3738        lflags {-framework AGL} 
    3839        lflags {-framework Carbon} 
    39  
    40         libs [%freetype %bz2 %png] 
    41         libs [%vorbis %vorbisfile] 
    42     ] 
    43     linux [ 
    44         cflags {-DUSE_XF86VMODE} 
    45         include_from %../unix 
    46         include_from %glv/unix 
    47         sources [ 
    48             %glv/unix/glv.c 
    49             %joystick.c 
    50         ] 
    51         libs_from %/usr/X11R6/lib64 [%X11 %Xxf86vm] 
    52         ;libs_from %/usr/X11R6/lib [%X11 %Xxf86vm] 
    53  
    54         include_from %/usr/include/freetype2 
    55  
    56         libs [%freetype %bz2 %png] 
    57         libs [%openal %alut %vorbis %vorbisfile] 
    5840    ] 
    5941    win32 [ 
     
    8062 
    8163    sources [ 
    82         %../console.c 
    8364        %gx.c 
    8465        %gx_dt.c 
     
    10182    ] 
    10283] 
     84 
     85exe %gx [ 
     86    opengl 
     87    cflags {-DLANG_THUNE -DTHUNE_GL} 
     88    libs_from %. %thuneGL 
     89    linux [ 
     90        libs_from %/usr/X11R6/lib64 [%X11 %Xxf86vm] 
     91        ;libs_from %/usr/X11R6/lib [%X11 %Xxf86vm] 
     92        libs [%freetype %bz2 %png] 
     93        libs [%openal %alut %vorbis %vorbisfile] 
     94    ] 
     95    macx [ 
     96        libs [%freetype %bz2 %png] 
     97        libs [%vorbis %vorbisfile] 
     98    ] 
     99    sources [ 
     100        %../console.c 
     101    ] 
     102] 
  • trunk/thune/thune.c

    r468 r483  
    963963            } 
    964964            val = sval; 
    965             if( ur_is(sval, UT_SELECT) || ur_is(sval, UT_PAREN) ) 
    966                 goto push_val; 
    967         } 
    968             goto do_val; 
     965            if( ur_is(sval, UT_FUNCTION) || ur_is(sval, UT_CALL) ) 
     966                goto do_val; 
     967        } 
     968            goto push_val; 
    969969 
    970970        case UT_SETSELECT: 
  • trunk/thune/urlan.h

    r469 r483  
    573573void ur_toStrNatural( UThread*, const UCell*, UString* out, int depth ); 
    574574void ur_strCat( UString*, const char* cp, int len ); 
     575int  ur_decompress( const void* data, int len, UArray* ); 
    575576 
    576577void ur_setDatatypeMask( UCell* cell, int type );