History

some work on the xcode proj

Jack Atherton committed 9 years ago

Commit 45052b11 parent d38351c3 files · +180 −212Browse files

Showing the changes to src/host/chuck_main.cpp (1 of 3 files). Show all

Unified · Split

src/host/chuck_main.cpp+24−54
@@ -39,7 +39,9 @@ · 38 unmodified lines
39 39
40// function prototypes40// function prototypes
41t_CKBOOL init_shell( Chuck_Shell * shell, Chuck_Shell_UI * ui, Chuck_VM * vm );41t_CKBOOL init_shell( Chuck_Shell * shell, Chuck_Shell_UI * ui, Chuck_VM * vm );
42bool go( int argc, const char ** argv );
42void global_cleanup();43void global_cleanup();
44void all_stop();
43void usage();45void usage();
44void uh();46void uh();
45t_CKBOOL get_count( const char * arg, t_CKUINT * out );47t_CKBOOL get_count( const char * arg, t_CKUINT * out );
@@ -73,8 +75,6 @@ t_CKUINT g_watchdog_countermeasure_priority = 0; · 27 unmodified lines
73#endif75#endif
74// watchdog timeout76// watchdog timeout
75t_CKFLOAT g_watchdog_timeout = 0.5;77t_CKFLOAT g_watchdog_timeout = 0.5;
76// thread id for whatever
77CHUCK_THREAD g_tid_whatever = 0;
78// flag for Std.system( string )78// flag for Std.system( string )
79t_CKBOOL g_enable_system_cmd = FALSE;79t_CKBOOL g_enable_system_cmd = FALSE;
80// flag for enabling shell, ge: 1.3.5.380// flag for enabling shell, ge: 1.3.5.3
@@ -170,7 +170,7 @@ static void version() · 89 unmodified lines
170// name: usage()170// name: usage()
171// desc: ...171// desc: ...
172//-----------------------------------------------------------------------------172//-----------------------------------------------------------------------------
173static void usage()173void usage()
174{174{
175 // (note: optional colon added 1.3.0.0)175 // (note: optional colon added 1.3.0.0)
176 CK_FPRINTF_STDERR( "usage: chuck --[options|commands] [+-=^] file1 file2 file3 ...\n" );176 CK_FPRINTF_STDERR( "usage: chuck --[options|commands] [+-=^] file1 file2 file3 ...\n" );
@@ -192,7 +192,7 @@ static void usage() · 15 unmodified lines
192// name: get_count()192// name: get_count()
193// desc: get the thing after -- or - as number193// desc: get the thing after -- or - as number
194//-----------------------------------------------------------------------------194//-----------------------------------------------------------------------------
195static t_CKBOOL get_count( const char * arg, t_CKUINT * out )195t_CKBOOL get_count( const char * arg, t_CKUINT * out )
196{196{
197 // no comment197 // no comment
198 if( !strncmp( arg, "--", 2 ) ) arg += 2;198 if( !strncmp( arg, "--", 2 ) ) arg += 2;
@@ -236,41 +236,15 @@ extern "C" void signal_int( int sig_num ) · 37 unmodified lines
236//-----------------------------------------------------------------------------236//-----------------------------------------------------------------------------
237void global_cleanup()237void global_cleanup()
238{238{
239 // if any Chuck_Systems are left, delete them239 SAFE_DELETE( the_chuck );
240 while( !g_systems.empty() )
241 {
242 Chuck_System * next_chuck = g_systems.front();
243 // delete Chuck_System causes a g_systems.remove which modifies the list
244 // and thus g_systems.front() will be different next time
245 delete next_chuck;
246 }
247 240
248 // request bbq shutdown241 // request bbq shutdown
242 // REFACTOR-2017 TODO: Shut down audio system
249 all_stop();243 all_stop();
250 244
251 // request MIDI, etc. files open be closed245 // request MIDI, etc. files open be closed
252 all_detach();246 all_detach();
253 247
254 // shutdown audio
255 if( g_enable_realtime_audio )
256 {
257 // log
258 EM_log( CK_LOG_SYSTEM, "shutting down real-time audio..." );
259
260 g_bbq->digi_out()->cleanup();
261 g_bbq->digi_in()->cleanup();
262 g_bbq->shutdown();
263 // m_audio = FALSE;
264 }
265 // log
266 EM_log( CK_LOG_SYSTEM, "freeing bbq subsystem..." );
267 // clean up
268 SAFE_DELETE( g_bbq );
269
270 if( g_main_thread_quit )
271 g_main_thread_quit( g_main_thread_bindle );
272 clear_main_thread_hook();
273
274 // wait for the shell, if it is running248 // wait for the shell, if it is running
275 // does the VM reset its priority to normal before exiting?249 // does the VM reset its priority to normal before exiting?
276 if( g_enable_shell )250 if( g_enable_shell )
@@ -279,30 +253,37 @@ void global_cleanup() · 2 unmodified lines
279 253
280 // things don't work so good on windows...254 // things don't work so good on windows...
281#if !defined(__PLATFORM_WIN32__) || defined(__WINDOWS_PTHREAD__)255#if !defined(__PLATFORM_WIN32__) || defined(__WINDOWS_PTHREAD__)
282 // pthread_kill( g_tid_otf, 2 );256 // REFACTOR-2017 TODO: Cancel otf, le_cb threads? Does this happen in ~ChucK()?
283 if( g_tid_otf ) pthread_cancel( g_tid_otf );257// if( g_tid_otf ) pthread_cancel( g_tid_otf );
284 if( g_tid_whatever ) pthread_cancel( g_tid_whatever );258// if( g_tid_whatever ) pthread_cancel( g_tid_whatever );
285 // if( g_tid_otf ) usleep( 50000 );
286#else259#else
287 // close handle260 // close handle
288 if( g_tid_otf ) CloseHandle( g_tid_otf );261 if( g_tid_otf ) CloseHandle( g_tid_otf );
289#endif262#endif
290
291 // ck_close( g_sock );
292
293#if !defined(__PLATFORM_WIN32__) || defined(__WINDOWS_PTHREAD__)
294 // pthread_join( g_tid_otf, NULL );
295#endif
296}263}
297 264
298 265
299 266
300 267
268
269//-----------------------------------------------------------------------------
270// name: all_stop()
271// desc: ...
272//-----------------------------------------------------------------------------
273void all_stop()
274{
275 // TODO:
276}
277
278
279
280
281
301//-----------------------------------------------------------------------------282//-----------------------------------------------------------------------------
302// name: init_shell()283// name: init_shell()
303// desc: ...284// desc: ...
304//-----------------------------------------------------------------------------285//-----------------------------------------------------------------------------
305static t_CKBOOL init_shell( Chuck_Shell * shell, Chuck_Shell_UI * ui, Chuck_VM * vm )286t_CKBOOL init_shell( Chuck_Shell * shell, Chuck_Shell_UI * ui, Chuck_VM * vm )
306{287{
307 // initialize shell UI288 // initialize shell UI
308 if( !ui->init() )289 if( !ui->init() )
@@ -428,17 +409,6 @@ bool go( int argc, const char ** argv ) · 119 unmodified lines
428 enable_server = FALSE;409 enable_server = FALSE;
429 else if( !strcmp(argv[i], "--callback") )410 else if( !strcmp(argv[i], "--callback") )
430 block = FALSE;411 block = FALSE;
431 else if( !strcmp( argv[i], "--external-callback" ) )
432 {
433 // caller will call the Chuck_System->run itself
434 m_initOnly = TRUE;
435 // --external-callback implies --loop: wait for incoming shreds
436 // (don't enable server, which waits on TCP8888)
437 vm_halt = FALSE;
438 enable_server = FALSE;
439 // --external-callback implies --silent: don't engage the main thread hook
440 g_enable_realtime_audio = FALSE;
441 }
442 // blocking removed, ge: 1.3.5.3412 // blocking removed, ge: 1.3.5.3
443 // else if( !strcmp(argv[i], "--blocking") )413 // else if( !strcmp(argv[i], "--blocking") )
444 // block = TRUE;414 // block = TRUE;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t