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
3939
4040 // function prototypes
4141 t_CKBOOL init_shell( Chuck_Shell * shell, Chuck_Shell_UI * ui, Chuck_VM * vm );
42+bool go( int argc, const char ** argv );
4243 void global_cleanup();
44+void all_stop();
4345 void usage();
4446 void uh();
4547 t_CKBOOL get_count( const char * arg, t_CKUINT * out );
@@ -73,8 +75,6 @@ t_CKUINT g_watchdog_countermeasure_priority = 0; · 27 unmodified lines
7375 #endif
7476 // watchdog timeout
7577 t_CKFLOAT g_watchdog_timeout = 0.5;
76−// thread id for whatever
77−CHUCK_THREAD g_tid_whatever = 0;
7878 // flag for Std.system( string )
7979 t_CKBOOL g_enable_system_cmd = FALSE;
8080 // flag for enabling shell, ge: 1.3.5.3
@@ -170,7 +170,7 @@ static void version() · 89 unmodified lines
170170 // name: usage()
171171 // desc: ...
172172 //-----------------------------------------------------------------------------
173−static void usage()
173+void usage()
174174 {
175175 // (note: optional colon added 1.3.0.0)
176176 CK_FPRINTF_STDERR( "usage: chuck --[options|commands] [+-=^] file1 file2 file3 ...\n" );
@@ -192,7 +192,7 @@ static void usage() · 15 unmodified lines
192192 // name: get_count()
193193 // desc: get the thing after -- or - as number
194194 //-----------------------------------------------------------------------------
195−static t_CKBOOL get_count( const char * arg, t_CKUINT * out )
195+t_CKBOOL get_count( const char * arg, t_CKUINT * out )
196196 {
197197 // no comment
198198 if( !strncmp( arg, "--", 2 ) ) arg += 2;
@@ -236,41 +236,15 @@ extern "C" void signal_int( int sig_num ) · 37 unmodified lines
236236 //-----------------------------------------------------------------------------
237237 void global_cleanup()
238238 {
239− // if any Chuck_Systems are left, delete them
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− }
239+ SAFE_DELETE( the_chuck );
247240
248241 // request bbq shutdown
242+ // REFACTOR-2017 TODO: Shut down audio system
249243 all_stop();
250244
251245 // request MIDI, etc. files open be closed
252246 all_detach();
253247
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−
274248 // wait for the shell, if it is running
275249 // does the VM reset its priority to normal before exiting?
276250 if( g_enable_shell )
@@ -279,30 +253,37 @@ void global_cleanup() · 2 unmodified lines
279253
280254 // things don't work so good on windows...
281255 #if !defined(__PLATFORM_WIN32__) || defined(__WINDOWS_PTHREAD__)
282− // pthread_kill( g_tid_otf, 2 );
283− if( g_tid_otf ) pthread_cancel( g_tid_otf );
284− if( g_tid_whatever ) pthread_cancel( g_tid_whatever );
285− // if( g_tid_otf ) usleep( 50000 );
256+ // REFACTOR-2017 TODO: Cancel otf, le_cb threads? Does this happen in ~ChucK()?
257+// if( g_tid_otf ) pthread_cancel( g_tid_otf );
258+// if( g_tid_whatever ) pthread_cancel( g_tid_whatever );
286259 #else
287260 // close handle
288261 if( g_tid_otf ) CloseHandle( g_tid_otf );
289262 #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
296263 }
297264
298265
299266
300267
268+
269+//-----------------------------------------------------------------------------
270+// name: all_stop()
271+// desc: ...
272+//-----------------------------------------------------------------------------
273+void all_stop()
274+{
275+ // TODO:
276+}
277+
278+
279+
280+
281+
301282 //-----------------------------------------------------------------------------
302283 // name: init_shell()
303284 // desc: ...
304285 //-----------------------------------------------------------------------------
305−static t_CKBOOL init_shell( Chuck_Shell * shell, Chuck_Shell_UI * ui, Chuck_VM * vm )
286+t_CKBOOL init_shell( Chuck_Shell * shell, Chuck_Shell_UI * ui, Chuck_VM * vm )
306287 {
307288 // initialize shell UI
308289 if( !ui->init() )
@@ -428,17 +409,6 @@ bool go( int argc, const char ** argv ) · 119 unmodified lines
428409 enable_server = FALSE;
429410 else if( !strcmp(argv[i], "--callback") )
430411 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− }
442412 // blocking removed, ge: 1.3.5.3
443413 // else if( !strcmp(argv[i], "--blocking") )
444414 // 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