Changeset 390
- Timestamp:
- 05/17/07 18:27:45 (17 months ago)
- Location:
- branches/thune/thread_safe
- Files:
-
- 18 modified
-
gl/audio.c (modified) (1 diff)
-
gl/boot.c (modified) (1 diff)
-
gl/draw_list.c (modified) (24 diffs)
-
gl/gx.c (modified) (11 diffs)
-
gl/gx.h (modified) (2 diffs)
-
gl/gx.t (modified) (1 diff)
-
gl/gx_atoms.h (modified) (1 diff)
-
gl/gx_dt.c (modified) (19 diffs)
-
gl/joystick.c (modified) (3 diffs)
-
gl/png_load.c (modified) (4 diffs)
-
gl/png_save.c (modified) (2 diffs)
-
gl/rfont.c (modified) (3 diffs)
-
gl/shader.c (modified) (9 diffs)
-
gl/shader.h (modified) (1 diff)
-
print.c (modified) (2 diffs)
-
tokenize.c (modified) (1 diff)
-
urlan.c (modified) (9 diffs)
-
urlan.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/thune/thread_safe/gl/audio.c
r362 r390 166 166 } 167 167 168 file = ur_cstring( tos );168 file = ur_cstring( ut, tos ); 169 169 if( file ) 170 170 { -
branches/thune/thread_safe/gl/boot.c
r383 r390 37 37 "[wid | handler]\n" 38 38 "[\n" 39 " display.events [\n"39 " [] display.events [\n" 40 40 " dup first wid get dup :handler\n" 41 41 " ift (second handler do) drop\n" -
branches/thune/thread_safe/gl/draw_list.c
r383 r390 283 283 The pen is moved to the end of text. 284 284 */ 285 void gr_drawText( const char* it, const char* end )285 void gr_drawText( UThread* ut, const char* it, const char* end ) 286 286 { 287 287 GLfloat x, y; … … 328 328 329 329 330 void gr_drawTextCell( UThread* u r_thread, UCell* cell )330 void gr_drawTextCell( UThread* ut, UCell* cell ) 331 331 { 332 332 char* cpA; 333 333 char* cpB; 334 334 335 if( ur_stringSlice( cell, &cpA, &cpB ) )336 { 337 gr_drawText( cpA, cpB );335 if( ur_stringSlice( ut, cell, &cpA, &cpB ) ) 336 { 337 gr_drawText( ut, cpA, cpB ); 338 338 } 339 339 else 340 340 { 341 UString* str; 342 str = ur_binPtr( ur_thread->callTempBinN ); 341 UString* str = ur_threadTmp( ut ); 343 342 str->used = 0; 344 343 ur_toStr( cell, str, 0 ); 345 gr_drawText( str->ptr.c, str->ptr.c + str->used );344 gr_drawText( ut, str->ptr.c, str->ptr.c + str->used ); 346 345 } 347 346 } … … 375 374 376 375 377 static void dop_camera( U Cell* ctx )376 static void dop_camera( UThread* ut, UCell* ctx ) 378 377 { 379 378 double w, h; … … 466 465 467 466 468 static void dop_light( UThread* u r_thread, UCell* val, int light )467 static void dop_light( UThread* ut, UCell* val, int light ) 469 468 { 470 469 if( ur_is(val, UT_LOGIC) ) … … 497 496 498 497 default: 499 val = ur_wordCell( u r_thread, it );498 val = ur_wordCell( ut, it ); 500 499 if( val ) 501 500 { … … 532 531 Camera must be set up for light before calling shadow-begin. 533 532 */ 534 static void dop_shadow_begin( /*UThread* u r_thread,*/ UCell* fbCell )533 static void dop_shadow_begin( /*UThread* ut,*/ UCell* fbCell ) 535 534 { 536 535 // Save matrices for shadow-end. … … 604 603 Returns pc at last argument or zero if arguments are bad. 605 604 */ 606 static UCell* dop_attrib( UThread* u r_thread, UCell* pc )605 static UCell* dop_attrib( UThread* ut, UCell* pc ) 607 606 { 608 607 GrVertexAttribute* attr; … … 614 613 if( ur_is(pc, UT_SELECT) ) 615 614 { 616 UCell* val = ur_wordCell( u r_thread, pc );615 UCell* val = ur_wordCell( ut, pc ); 617 616 if( ! val ) 618 617 return 0; … … 673 672 icell is an int array! 674 673 */ 675 static void _drawPrims( U Cell* icell, const char* key )674 static void _drawPrims( UThread* ut, UCell* icell, const char* key ) 676 675 { 677 676 //GLdouble vec[3]; … … 771 770 #define VAL_WORD_OR_PC \ 772 771 if( ur_is(pc, UT_WORD) ) { \ 773 val = ur_wordCell( u r_thread, pc ); \772 val = ur_wordCell( ut, pc ); \ 774 773 if( ! val ) return 0; \ 775 774 } \ … … 779 778 Returns zero if an error occurred. 780 779 */ 781 static int _runDrawList( UThread* u r_thread, UCell* val )780 static int _runDrawList( UThread* ut, UCell* val ) 782 781 { 783 782 UBlock* blk = ur_blockPtr( val->series.n ); … … 811 810 glCallList( ur_dlGL(val) ); 812 811 } 813 else if( ! _runDrawList( u r_thread, val ) )812 else if( ! _runDrawList( ut, val ) ) 814 813 return 0; 815 814 } … … 867 866 VAL_WORD_OR_PC 868 867 if( ur_is(val, UT_CONTEXT) ) 869 dop_camera( val );868 dop_camera( ut, val ); 870 869 } 871 870 break; … … 877 876 ++pc; 878 877 VAL_WORD_OR_PC 879 dop_light( u r_thread, val, GL_LIGHT0 + light );878 dop_light( ut, val, GL_LIGHT0 + light ); 880 879 } 881 880 break; … … 946 945 947 946 case DOP_ATTRIB: 948 pc = dop_attrib( u r_thread, pc );947 pc = dop_attrib( ut, pc ); 949 948 if( ! pc ) 950 949 return 0; … … 965 964 { 966 965 glBegin( _primBegin[ ur_opcode(pc-2) - DOP_POINTS ] ); 967 _drawPrims( pc, ur_atomCStr( ur_atom(pc-1), 0 ) );966 _drawPrims( ut, pc, ur_atomCStr( ur_atom(pc-1), 0 ) ); 968 967 glEnd(); 969 968 } … … 1047 1046 VAL_WORD_OR_PC 1048 1047 } 1049 gr_drawTextCell( u r_thread, val );1048 gr_drawTextCell( ut, val ); 1050 1049 break; 1051 1050 … … 1053 1052 ++pc; 1054 1053 VAL_WORD_OR_PC 1055 loadShader( val );1054 loadShader( ut, val ); 1056 1055 break; 1057 1056 … … 1069 1068 VAL_WORD_OR_PC 1070 1069 if( ur_is(val, UT_FBO) ) 1071 dop_shadow_begin( /*u r_thread,*/ val );1070 dop_shadow_begin( /*ut,*/ val ); 1072 1071 break; 1073 1072 … … 1097 1096 UCell* res = ur_s_prev(tos); 1098 1097 1099 ops = ur_resolve ArgPath( UT_WORD, UR_ATOM_DRAW_LIST_OPCODES, UT_NONE );1098 ops = ur_resolvePath( ut, UR_ATOM_DRAW_LIST_OPCODES, UT_NONE ); 1100 1099 if( ! ops ) 1101 1100 { … … 1106 1105 if( ur_is(tos, UT_BLOCK) ) 1107 1106 { 1108 ur_infuse( u r_thread, ur_block(tos), ops );1107 ur_infuse( ut, ur_block(tos), ops ); 1109 1108 1110 1109 ur_initType(res, UT_DRAWLIST); … … 1117 1116 int pool; 1118 1117 1119 ur_infuse( u r_thread, ur_block(tos), ops );1118 ur_infuse( ut, ur_block(tos), ops ); 1120 1119 1121 1120 ur_initType(res, UT_DRAWLIST); … … 1130 1129 glNewList( ur_dlGL(res), GL_COMPILE ); 1131 1130 1132 if( ! _runDrawList( u r_thread, tos ) )1131 if( ! _runDrawList( ut, tos ) ) 1133 1132 { 1134 1133 ur_throwErr( UR_ERR_SCRIPT, "runDrawList failed" ); … … 1160 1159 glCallList( ur_dlGL(tos) ); 1161 1160 else 1162 _runDrawList( u r_thread, tos );1161 _runDrawList( ut, tos ); 1163 1162 } 1164 1163 UR_S_DROP; -
branches/thune/thread_safe/gl/gx.c
r382 r390 26 26 #include <string.h> 27 27 #include <glv_keys.h> 28 #include " os.h"28 #include "env.h" 29 29 #include "glh.h" 30 30 #include "gx.h" … … 571 571 UCell* res = ur_s_prev( tos ); 572 572 573 if( ur_stringSlice( tos, &cpA, &cpB ) )573 if( ur_stringSlice( ut, tos, &cpA, &cpB ) ) 574 574 { 575 575 if( ur_is( res, UT_FONT ) ) … … 589 589 590 590 591 // ( -- blk)591 // (blk -- blk) 592 592 UR_CALL( uc_display_events ) 593 593 { 594 UIndex blkN; 595 596 UR_CALL_UNUSED_TOS 597 598 blkN = ur_holdIndex( ur_thread->env, gxEnv.eventBlkHold ); 599 gxEnv.eventBlk = ur_blockPtr( blkN ); 594 if( ! ur_is(tos, UT_BLOCK) ) 595 { 596 ur_throwErr( UR_ERR_DATATYPE, "display.events expected block!" ); 597 return; 598 } 599 600 gxEnv.eventBlk = ur_block( tos ); 600 601 gxEnv.eventBlk->used = 0; 601 602 602 603 glv_handleEvents( gView ); 603 604 UR_S_GROW;605 606 ur_initType(UR_TOS, UT_BLOCK);607 ur_setSeries(UR_TOS, blkN, 0);608 604 } 609 605 … … 670 666 glGetIntegerv( GL_VIEWPORT, vp ); 671 667 672 ur_makeRaster( u r_s_next(tos), UR_RAST_RGB, vp[2], vp[3], &bin );668 ur_makeRaster( ut, ur_s_next(tos), UR_RAST_RGB, vp[2], vp[3], &bin ); 673 669 UR_S_GROW; 674 670 … … 1429 1425 #if MAKE_ATOM_HEADER 1430 1426 #define FIXED_ATOM(str,len,def) \ 1431 printf( "#define %s\t\t%d\n", #def, ur_intern( env,str,len) );1427 printf( "#define %s\t\t%d\n", #def, ur_intern(str,len) ); 1432 1428 #else 1433 1429 #ifdef DEBUG 1434 #define FIXED_ATOM(str,len,def) assert( ur_intern( env,str,len) == def );1430 #define FIXED_ATOM(str,len,def) assert( ur_intern(str,len) == def ); 1435 1431 #else 1436 #define FIXED_ATOM(str,len,def) ur_intern( env,str,len);1432 #define FIXED_ATOM(str,len,def) ur_intern(str,len); 1437 1433 #endif 1438 1434 #endif 1439 1435 1440 1436 // Intern commonly used atoms. 1441 static void _createFixedAtoms( U rlanEnv* env)1437 static void _createFixedAtoms( UThread* ut ) 1442 1438 { 1443 1439 #if MAKE_ATOM_HEADER … … 1501 1497 { 1502 1498 const GLubyte* gstr; 1499 UThread* ut = env->threads; 1503 1500 1504 1501 #if 0 … … 1511 1508 gxEnv.prevMouseY = MOUSE_UNSET; 1512 1509 1513 _createFixedAtoms( env);1510 _createFixedAtoms( ut ); 1514 1511 1515 1512 gxEnv.eventBlk = 0; 1516 gxEnv.eventBlkHold = ur_hold( env, UT_BLOCK, ur_makeBlock( 32 ) ); 1517 1518 1519 ur_makeCalls( env, _gxCalls, sizeof(_gxCalls) / sizeof(UCallDef) ); 1520 1521 { 1522 int ok = ur_evalCStr( env->threads, _gxBoot, sizeof(_gxBoot) ); 1513 1514 1515 ur_makeCalls( ut, _gxCalls, sizeof(_gxCalls) / sizeof(UCallDef) ); 1516 1517 { 1518 int ok = ur_evalCStr( ut, _gxBoot, sizeof(_gxBoot) ); 1523 1519 if( ok != UR_EVAL_OK ) 1524 1520 return ok; … … 1537 1533 if( ! gView ) 1538 1534 { 1539 ur_throwErr( env->threads, UR_EX_INTERNAL, "glv_create() failed" );1535 ur_throwErr( ut, UR_EX_INTERNAL, "glv_create() failed" ); 1540 1536 return UR_EVAL_ERROR; 1541 1537 } … … 1546 1542 glv_destroy( gView ); 1547 1543 gView = 0; 1548 ur_throwErr( env->threads, UR_EX_INTERNAL, "OpenGL 2.0 required" );1544 ur_throwErr( ut, UR_EX_INTERNAL, "OpenGL 2.0 required" ); 1549 1545 return UR_EVAL_ERROR; 1550 1546 } … … 1565 1561 void gx_shutdown( UrlanEnv* env ) 1566 1562 { 1563 (void) env; 1567 1564 #if 0 1568 1565 resd_free( &gEnv.resd ); … … 1574 1571 1575 1572 glv_destroy( gView ); 1576 1577 ur_release( env, gxEnv.eventBlkHold );1578 1573 } 1579 1574 -
branches/thune/thread_safe/gl/gx.h
r383 r390 157 157 int prevMouseY; 158 158 159 UIndex eventBlkHold;160 159 UBlock* eventBlk; 161 160 … … 205 204 206 205 207 UIndex ur_makeRaster( U Cell*, int format, int w, int h, UBinary** );206 UIndex ur_makeRaster( UThread*, UCell*, int format, int w, int h, UBinary** ); 208 207 209 208 #define ur_dlGL(c) ((UCellDrawList*) (c))->glListId -
branches/thune/thread_safe/gl/gx.t
r383 r390 82 82 [wid | handler] 83 83 [ 84 display.events [84 [] display.events [ 85 85 /* 86 86 ;Had problem with keeping stack level here: -
branches/thune/thread_safe/gl/gx_atoms.h
r382 r390 1 1 // This file is automatically generated - do not edit. 2 2 3 #define UR_ATOM_DRAW_LIST_OPCODES 31 34 #define UR_ATOM_WIDTH 31 45 #define UR_ATOM_HEIGHT 31 56 #define UR_ATOM_AREA 31 67 #define UR_ATOM_RECT 31 78 #define UR_ATOM_RASTER 31 89 #define UR_ATOM_TEXTURE 31 910 #define UR_ATOM_ELEM 3 2011 #define UR_ATOM_CLOSE 17 512 #define UR_ATOM_FOCUS 32 113 #define UR_ATOM_RESIZE 32 214 #define UR_ATOM_KEY_DOWN 32 315 #define UR_ATOM_KEY_UP 32 416 #define UR_ATOM_MOUSE_MOVE 32 517 #define UR_ATOM_MOUSE_UP 32 618 #define UR_ATOM_MOUSE_DOWN 32 719 #define UR_ATOM_MOUSE_WHEEL 32 820 #define UR_ATOM_AMBIENT 32 921 #define UR_ATOM_DIFFUSE 3 3022 #define UR_ATOM_SPECULAR 33 123 #define UR_ATOM_POS 33 224 #define UR_ATOM_SHADER 33 325 #define UR_ATOM_VERTEX 33 426 #define UR_ATOM_FRAGMENT 33 527 #define UR_ATOM_DEFAULT 33 628 #define UR_ATOM_RGB 33 729 #define UR_ATOM_RGBA 33 830 #define UR_ATOM_DEPTH 33 931 #define UR_ATOM_CLAMP 3 4032 #define UR_ATOM_REPEAT 34 133 #define UR_ATOM_NEAREST 34 234 #define UR_ATOM_LINEAR 34 335 #define UR_ATOM_MIN 34 436 #define UR_ATOM_MAG 34 537 #define UR_ATOM_MIPMAP 34 638 #define UR_ATOM_ON 25 339 #define UR_ATOM_OFF 25 540 #define UR_ATOM_ADD 19 441 #define UR_ATOM_BURN 34 742 #define UR_ATOM_COLOR 34 843 #define UR_ATOM_TRANS 34 93 #define UR_ATOM_DRAW_LIST_OPCODES 312 4 #define UR_ATOM_WIDTH 313 5 #define UR_ATOM_HEIGHT 314 6 #define UR_ATOM_AREA 315 7 #define UR_ATOM_RECT 316 8 #define UR_ATOM_RASTER 317 9 #define UR_ATOM_TEXTURE 318 10 #define UR_ATOM_ELEM 319 11 #define UR_ATOM_CLOSE 174 12 #define UR_ATOM_FOCUS 320 13 #define UR_ATOM_RESIZE 321 14 #define UR_ATOM_KEY_DOWN 322 15 #define UR_ATOM_KEY_UP 323 16 #define UR_ATOM_MOUSE_MOVE 324 17 #define UR_ATOM_MOUSE_UP 325 18 #define UR_ATOM_MOUSE_DOWN 326 19 #define UR_ATOM_MOUSE_WHEEL 327 20 #define UR_ATOM_AMBIENT 328 21 #define UR_ATOM_DIFFUSE 329 22 #define UR_ATOM_SPECULAR 330 23 #define UR_ATOM_POS 331 24 #define UR_ATOM_SHADER 332 25 #define UR_ATOM_VERTEX 333 26 #define UR_ATOM_FRAGMENT 334 27 #define UR_ATOM_DEFAULT 335 28 #define UR_ATOM_RGB 336 29 #define UR_ATOM_RGBA 337 30 #define UR_ATOM_DEPTH 338 31 #define UR_ATOM_CLAMP 339 32 #define UR_ATOM_REPEAT 340 33 #define UR_ATOM_NEAREST 341 34 #define UR_ATOM_LINEAR 342 35 #define UR_ATOM_MIN 343 36 #define UR_ATOM_MAG 344 37 #define UR_ATOM_MIPMAP 345 38 #define UR_ATOM_ON 252 39 #define UR_ATOM_OFF 254 40 #define UR_ATOM_ADD 193 41 #define UR_ATOM_BURN 346 42 #define UR_ATOM_COLOR 347 43 #define UR_ATOM_TRANS 348 -
branches/thune/thread_safe/gl/gx_dt.c
r360 r390 38 38 39 39 40 static void toStr_dlist( const UCell* cell, UString* out, int depth ) 41 { 40 static void toStr_dlist( UThread* ut, const UCell* cell, UString* out, 41 int depth ) 42 { 43 (void) ut; 42 44 (void) cell; 43 45 (void) depth; … … 73 75 \return Binary index and initialied res. If binp is non-zero, it is set. 74 76 */ 75 UIndex ur_makeRaster( UCell* res, int format, int w, int h, UBinary** binp ) 77 UIndex ur_makeRaster( UThread* ut, UCell* res, 78 int format, int w, int h, UBinary** binp ) 76 79 { 77 80 UIndex binN; … … 122 125 } 123 126 124 ur_makeRaster( res, format,127 ur_makeRaster( ut, res, format, 125 128 tos->coord.elem[0], tos->coord.elem[1], 0 ); 126 129 … … 148 151 149 152 150 static void toStr_raster( const UCell* cell, UString* out, int depth ) 153 static void toStr_raster( UThread* ut, const UCell* cell, UString* out, 154 int depth ) 151 155 { 152 156 int uformat; … … 178 182 179 183 180 static int select_raster( UThread* u r_thread, UCell* val, const UCell* sel,184 static int select_raster( UThread* ut, UCell* val, const UCell* sel, 181 185 UCell* res ) 182 186 { … … 350 354 { 351 355 case UT_WORD: 352 val = ur_wordCell( u r_thread, it );356 val = ur_wordCell( ut, it ); 353 357 if( ! val ) 354 358 return; … … 461 465 462 466 463 static void toStr_texture( const UCell* cell, UString* out, int depth ) 464 { 467 static void toStr_texture( UThread* ut, const UCell* cell, UString* out, 468 int depth ) 469 { 470 (void) ut; 465 471 (void) cell; 466 472 (void) depth; … … 469 475 470 476 471 static int select_texture( UThread* u r_thread, UCell* val, const UCell* sel,477 static int select_texture( UThread* ut, UCell* val, const UCell* sel, 472 478 UCell* res ) 473 479 { … … 488 494 } 489 495 if( ri ) 490 return select_raster( u r_thread, val, sel, res );496 return select_raster( ut, val, sel, res ); 491 497 return 0; 492 498 } … … 549 555 case UT_SLICE: 550 556 if( cfg.fontFile ) 551 cfg.glyphs = ur_cstring( it );557 cfg.glyphs = ur_cstring( ut, it ); 552 558 else 553 cfg.fontFile = ur_cstring( it );559 cfg.fontFile = ur_cstring( ut, it ); 554 560 break; 555 561 … … 572 578 } 573 579 574 if( ! ur_makeRFont( u r_thread, res, &cfg ) )580 if( ! ur_makeRFont( ut, res, &cfg ) ) 575 581 return; 576 582 … … 583 589 584 590 585 static void toStr_rfont( const UCell* cell, UString* out, int depth ) 586 { 591 static void toStr_rfont( UThread* ut, const UCell* cell, UString* out, 592 int depth ) 593 { 594 (void) ut; 587 595 (void) cell; 588 596 (void) depth; … …
