Changeset 499
- Timestamp:
- 12/05/07 03:12:00 (10 months ago)
- Location:
- trunk/thune
- Files:
-
- 10 modified
-
doc/UserManual (modified) (1 diff)
-
eval.c (modified) (1 diff)
-
gl/audio.c (modified) (6 diffs)
-
gl/boot.c (modified) (1 diff)
-
gl/gx.t (modified) (1 diff)
-
scripts/c_string.t (modified) (2 diffs)
-
thread.c (modified) (3 diffs)
-
thune.c (modified) (4 diffs)
-
urlan.c (modified) (4 diffs)
-
urlan.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/thune/doc/UserManual
r498 r499 333 333 ---------- 334 334 335 ======= ================= ================= 336 Word Stack Usage Function 337 ======= ================= ================= 338 . (val -- ) Remove value on top of stack and print it. 339 .s () Show values on stack. 340 dup (a -- a a) Duplicate value on top of stack. 341 dup2 (a b -- a b a b) Duplicate top 2 values. 342 drop (a -- ) Remove value on top of stack. 343 swap (a b -- b a) Switch the two values on the top of stack. 344 over (a b -- a b a) Copy second item on stack to the top of the stack. 345 nip (a b -- b) Remove second value on stack. 346 tuck (a b -- b a b) Copy top value under second value. 347 rot (a b c -- b c a) Rotate third value to top. 348 rot.r (a b c -- c a b) Rotate top of stack to third position. 349 ======= ================= ================= 335 =========== ================= ============================ 336 Word Stack Usage Function 337 =========== ================= ============================ 338 . (val -- ) Remove value on top of stack and print it. 339 .s () Show values on stack. 340 dup (a -- a a) Duplicate value on top of stack. 341 dup2 (a b -- a b a b) Duplicate top 2 values. 342 drop (a -- ) Remove value on top of stack. 343 swap (a b -- b a) Switch the two values on the top of stack. 344 over (a b -- a b a) Copy second item on stack to the top. 345 nip (a b -- b) Remove second value on stack. 346 tuck (a b -- b a b) Copy top value under second value. 347 rot (a b c -- b c a) Rotate third value to top. 348 rot.r (a b c -- c a b) Rotate top of stack to third position. 349 stack.level ( -- level) Returns depth of data stack. 350 =========== ================= ============================ 350 351 351 352 -
trunk/thune/eval.c
r495 r499 936 936 937 937 938 // ( -- n) 938 939 UR_CALL( uc_stack_level ) 939 940 { -
trunk/thune/gl/audio.c
r458 r499 55 55 56 56 static int _audioUp = 0; 57 #if 0 57 //#define OPEN_DEVICE 1 58 #ifdef OPEN_DEVICE 58 59 static ALCdevice* _adevice = 0; 59 60 static ALCcontext* _acontext = 0; … … 62 63 63 64 64 #define MUSIC_BUFFERS 265 #define MUSIC_BUFFERS 3 65 66 static ALuint _musicSource = 0; 66 67 static ALfloat _musicGain = 1.0f; … … 76 77 #define OGG_BIG_ENDIAN 1 77 78 #endif 78 #define OGG_BUFFER_SIZE (4096 * 4) 79 80 /* 81 OGG_BUFFER_SIZE is set to hold one second of data in each music buffer. 82 If aud_update() is not called before all buffers are played then OpenAL 83 will stop the sound source. 84 */ 85 #define OGG_BUFFER_SIZE (44100 * 2) 79 86 static char _oggPCM[ OGG_BUFFER_SIZE ]; 80 87 … … 141 148 int aud_startup() 142 149 { 143 #if 0150 #ifdef OPEN_DEVICE 144 151 _adevice = alcOpenDevice( 0 ); 145 152 if( ! _adevice ) … … 150 157 alutInitWithoutContext( 0, 0 ); 151 158 #else 152 alutInit( 0, 0 ); 159 if( alutInit( 0, 0 ) == AL_FALSE ) 160 return 0; 153 161 #endif 154 162 … … 175 183 alDeleteBuffers( MUSIC_BUFFERS, _musicBuffers ); 176 184 177 #if 0185 #ifdef OPEN_DEVICE 178 186 // Could not use alutExit() on my box (FC3/Shuttle XPC) since 179 187 // alcMakeContextCurrent(0) -> _alLockMixerPause() will hangup. 180 188 alcDestroyContext( _acontext ); 181 189 alcCloseDevice( _adevice ); 182 #e ndif190 #else 183 191 alutExit(); 192 #endif 184 193 } 185 194 } -
trunk/thune/gl/boot.c
r484 r499 156 156 " [display.area :wid/area]\n" 157 157 " either\n" 158 " wid/resize ift (wid/area wid/resize do )\n"158 " wid/resize ift (wid/area wid/resize do drop)\n" 159 159 " wid\n" 160 160 "]\n" -
trunk/thune/gl/gx.t
r484 r499 233 233 either 234 234 235 wid/resize ift (wid/area wid/resize do )235 wid/resize ift (wid/area wid/resize do drop) 236 236 237 237 wid -
trunk/thune/scripts/c_string.t
r397 r499 3 3 [str | a b] 4 4 [ 5 str copy dup . {"} {\"} replace.all head 6 /* 5 7 str copy 6 8 [some [ … … 8 10 ]] 9 11 parse head 12 */ 10 13 ] 11 14 func :replace-quotes ; (str -- str) -
trunk/thune/thread.c
r461 r499 55 55 if( env->threads ) 56 56 { 57 #if 058 57 UThread* link = env->threads; 59 58 ut->nextThread = link->nextThread; 60 59 link->nextThread = ut; 61 #endif62 60 } 63 61 else … … 91 89 92 90 /* 93 void ur_threadUnlink( UThread* th ) 91 Free memory used by UThread. 92 93 This does NOT remove the thread from the environemnt thread list. 94 ur_threadDestroy() must be used for that. 95 */ 96 void ur_threadFree( UThread* ut ) 97 { 98 _freeResources( ut->env, &ut->resources.arr ); 99 100 _freeArrayOfArray( &ut->blocks.arr ); 101 _freeArrayOfArray( &ut->bin.arr ); 102 103 memFree( ut ); 104 } 105 106 107 /** 108 Remove UThread from environment thread list and free memory. 109 */ 110 void ur_threadDestroy( UThread* ut ) 94 111 { 95 112 UThread* it; 96 it = ((UrlanEnv*) th->env)->threads; 97 if( it == th ) 98 ((UrlanEnv*) th->env)->threads = (UThread*) th->nextTask; 99 while( it->nextTask != th ) 100 it = it->nextTask; 101 it->nextTask = th->nextTask; 102 } 103 */ 113 UrlanEnv* env = ut->env; 114 115 LOCK_GLOBAL 116 117 it = env->threads; 118 if( it == ut ) 119 { 120 if( ut == ut->nextThread ) 121 { 122 env->threads = 0; 123 goto done; 124 } 125 env->threads = (UThread*) ut->nextThread; 126 } 127 while( it->nextThread != ut ) 128 it = it->nextThread; 129 it->nextThread = ut->nextThread; 130 131 done: 132 UNLOCK_GLOBAL 133 134 ur_threadFree( ut ); 135 } 136 137 138 /* 139 Return UThread to initial state with empty stacks. 140 */ 141 void ur_threadReset( UThread* th ) 142 { 143 /* 144 Data Stack [BOS --> TOS eos [2 reserved]] 145 Control Stack [BOC --> TOC [<-- Local Frames]] 146 */ 147 148 th->state = UR_TASK_READY; 149 th->callOp = 0; 150 th->tos = th->dstack; 151 // Eos reserves 2 cells for temporary call use & select! evaluation. 152 th->eos = th->dstack + UR_DSTACK_SIZE - 2; 153 th->toc = th->cstack; 154 th->localFT = (LocalFrame*) th->cstack + UR_CSTACK_SIZE; 155 ur_initType( th->tos, UT_UNSET ); 156 157 //th->localWordBlk = 0; 158 //th->localPos = 0; 159 } 104 160 105 161 … … 155 211 156 212 157 void ur_threadFree( UThread* ut )158 {159 _freeResources( ut->env, &ut->resources.arr );160 161 _freeArrayOfArray( &ut->blocks.arr );162 _freeArrayOfArray( &ut->bin.arr );163 164 memFree( ut );165 }166 167 168 void ur_threadReset( UThread* th )169 {170 /*171 Data Stack [BOS --> TOS eos [2 reserved]]172 Control Stack [BOC --> TOC [<-- Local Frames]]173 */174 175 th->state = UR_TASK_READY;176 th->callOp = 0;177 th->tos = th->dstack;178 // Eos reserves 2 cells for temporary call use & select! evaluation.179 th->eos = th->dstack + UR_DSTACK_SIZE - 2;180 th->toc = th->cstack;181 th->localFT = (LocalFrame*) th->cstack + UR_CSTACK_SIZE;182 ur_initType( th->tos, UT_UNSET );183 184 //th->localWordBlk = 0;185 //th->localPos = 0;186 }187 188 189 213 void ur_pushContext( UThread* ut, UContext* ctx ) 190 214 { -
trunk/thune/thune.c
r498 r499 172 172 UThread* ut = (UThread*) arg; 173 173 ur_eval( ut, ut->tos[1].series.n, 0 ); 174 ur_thread Free( ut );174 ur_threadDestroy( ut ); 175 175 return 0; 176 176 } … … 203 203 UR_CALL( uc_thread ) 204 204 { 205 if( ur_is(tos, UT_BLOCK) ||ur_is(tos, UT_STRING) )205 if( /*ur_is(tos, UT_BLOCK) ||*/ ur_is(tos, UT_STRING) ) 206 206 { 207 207 UThread* thr = ur_threadMake( ut->env, 64, 128 ); … … 217 217 char* cpA; 218 218 char* cpB; 219 ur_seriesMem( ut, tos, &cpA, &cpB ); 220 thr->tos[1].series.n = ur_tokenize( thr, cpA, cpB ); 219 UIndex blkN; 220 221 ur_binaryMem( ut, tos, &cpA, &cpB ); 222 blkN = ur_tokenize( thr, cpA, cpB ); 223 if( ! blkN ) 224 return; 225 ur_infuseOpcodes( thr, blkN ); 226 thr->tos[1].series.n = blkN; 221 227 } 222 228 … … 232 238 } 233 239 234 #if 1240 #if 0 235 241 { 236 242 void* status; -
trunk/thune/urlan.c
r474 r499 696 696 697 697 698 void _freeResources( UrlanEnv* env, UArray* arr )698 void _freeResources( const UrlanEnv* env, UArray* arr ) 699 699 { 700 700 if( arr->used ) … … 738 738 739 739 740 extern void ur_threadFree( UThread* ); 741 740 742 /** 741 743 Release all resources used by env. … … 749 751 return; 750 752 751 if( (thr = env->threads) ) 752 { 753 if( env->threads ) 754 { 755 mutexLock( env->mutex ); // LOCK_GLOBAL 756 757 thr = env->threads; 753 758 do 754 759 { … … 759 764 while( thr != env->threads ); 760 765 766 mutexUnlock( env->mutex ); // UNLOCK_GLOBAL 761 767 mutexFree( env->mutex ); 762 768 } -
trunk/thune/urlan.h
r490 r499 520 520 UThread* ur_thread( UrlanEnv* ); 521 521 UThread* ur_threadMake( UrlanEnv*, int binCount, int blkCount ); 522 void ur_thread Free( UThread* );522 void ur_threadDestroy( UThread* ); 523 523 void ur_threadReset( UThread* ); 524 524 UBinary* ur_threadTmp( UThread* );
