Changeset 483
- Timestamp:
- 10/05/07 04:54:10 (12 months ago)
- Location:
- trunk/thune
- Files:
-
- 5 modified
-
files.c (modified) (2 diffs)
-
gl/gx_atoms.h (modified) (2 diffs)
-
gl/project.r (modified) (4 diffs)
-
thune.c (modified) (1 diff)
-
urlan.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/thune/files.c
r478 r483 696 696 697 697 698 /** 699 Decompress data into intialized array. 700 701 \return Non-zero if successful. 702 */ 703 int 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 698 747 // (binary -- string) 699 748 UR_CALL( uc_decompress ) 700 749 { 701 #define BUF_LOW 32702 int ok;703 int len;704 bz_stream strm;705 750 UIndex strN; 706 751 UString* str; … … 708 753 char* cpB; 709 754 710 711 755 if( ! ur_binarySlice( ut, tos, &cpA, &cpB ) || (cpA == 0) ) 712 756 return; 713 757 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 } 753 768 } 754 769 #endif -
trunk/thune/gl/gx_atoms.h
r458 r483 1 1 // This file is automatically generated - do not edit. 2 2 3 #define UR_ATOM_DRAW_LIST_OPCODES 32 14 #define UR_ATOM_WIDTH 32 25 #define UR_ATOM_HEIGHT 32 36 #define UR_ATOM_AREA 32 47 #define UR_ATOM_RECT 32 58 #define UR_ATOM_RASTER 32 69 #define UR_ATOM_TEXTURE 32 710 #define UR_ATOM_ELEM 32 811 #define UR_ATOM_CLOSE 18 012 #define UR_ATOM_FOCUS 3 2913 #define UR_ATOM_RESIZE 33 014 #define UR_ATOM_KEY_DOWN 33 115 #define UR_ATOM_KEY_UP 33 216 #define UR_ATOM_MOUSE_MOVE 33 317 #define UR_ATOM_MOUSE_UP 33 418 #define UR_ATOM_MOUSE_DOWN 33 519 #define UR_ATOM_MOUSE_WHEEL 33 620 #define UR_ATOM_AMBIENT 33 721 #define UR_ATOM_DIFFUSE 33 822 #define UR_ATOM_SPECULAR 3 3923 #define UR_ATOM_POS 34 024 #define UR_ATOM_SHADER 34 125 #define UR_ATOM_VERTEX 34 226 #define UR_ATOM_FRAGMENT 34 327 #define UR_ATOM_DEFAULT 34 428 #define UR_ATOM_WAIT 3453 #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 29 29 #define UR_ATOM_RGB 346 30 30 #define UR_ATOM_RGBA 347 … … 40 40 #define UR_ATOM_RGB 346 41 41 #define UR_ATOM_RGBA 347 42 #define UR_ATOM_ON 26 043 #define UR_ATOM_OFF 26 244 #define UR_ATOM_ADD 19942 #define UR_ATOM_ON 261 43 #define UR_ATOM_OFF 263 44 #define UR_ATOM_ADD 200 45 45 #define UR_ATOM_BURN 357 46 46 #define UR_ATOM_COLOR 358 -
trunk/thune/gl/project.r
r458 r483 1 1 REBOL [] 2 2 3 exe %gx[3 default [ 4 4 warn 5 5 debug 6 ;release6 ; release 7 7 objdir %obj 8 opengl 8 ] 9 9 10 lib %thuneGL [ 10 11 include_from %. 11 12 include_from %.. 12 ;include_from %hit13 ;include_from %../util14 13 libs_from %.. %thune0 15 cflags {-DLANG_THUNE -DTHUNE_GL}14 cflags {-DLANG_THUNE} 16 15 cflags {-DUR_CONFIG_DT_CODE} 17 16 cflags {-DNO_AUDIO} 18 17 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 ] 19 28 macx [ 20 cflags {-DOR_BIG_ENDIAN}21 22 29 include_from %../unix 23 30 include_from %glv/mac 24 31 sources [%glv/mac/glv.c] 25 26 ;include_from %../../../osrc/zlib27 ;libs_from %../../../osrc/zlib [%z]28 29 ;include_from %/Users/karl/osrc/libpng-1.2.1230 ;libs_from %/Users/karl/osrc/libpng-1.2.12 [%png]31 32 32 33 include_from %/usr/local/include/freetype2 … … 37 38 lflags {-framework AGL} 38 39 lflags {-framework Carbon} 39 40 libs [%freetype %bz2 %png]41 libs [%vorbis %vorbisfile]42 ]43 linux [44 cflags {-DUSE_XF86VMODE}45 include_from %../unix46 include_from %glv/unix47 sources [48 %glv/unix/glv.c49 %joystick.c50 ]51 libs_from %/usr/X11R6/lib64 [%X11 %Xxf86vm]52 ;libs_from %/usr/X11R6/lib [%X11 %Xxf86vm]53 54 include_from %/usr/include/freetype255 56 libs [%freetype %bz2 %png]57 libs [%openal %alut %vorbis %vorbisfile]58 40 ] 59 41 win32 [ … … 80 62 81 63 sources [ 82 %../console.c83 64 %gx.c 84 65 %gx_dt.c … … 101 82 ] 102 83 ] 84 85 exe %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 963 963 } 964 964 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; 969 969 970 970 case UT_SETSELECT: -
trunk/thune/urlan.h
r469 r483 573 573 void ur_toStrNatural( UThread*, const UCell*, UString* out, int depth ); 574 574 void ur_strCat( UString*, const char* cp, int len ); 575 int ur_decompress( const void* data, int len, UArray* ); 575 576 576 577 void ur_setDatatypeMask( UCell* cell, int type );
