History

moved g_shell out of chuck_shell.cpp

Ge Wang committed 9 years ago

Commit 4ff85261 parent e1c0b212 files · +241 −37Browse files

Unified · Split

2 files
  1. src/core/chuck_shell.cpp +208 −37
  2. src/host/chuck_main.cpp +33 −0
src/core/chuck_shell.cpp+208−37
@@ -47,9 +47,8 @@ · 46 unmodified lines
47 47
48using namespace std;48using namespace std;
49 49
50// REFACTOR-2017: TODO Ge: where should this live? not in chuck_main if it's in core!50
51// global shell pointer (lives in chuck_main)51
52extern Chuck_Shell * g_shell;
53 52
54//-----------------------------------------------------------------------------53//-----------------------------------------------------------------------------
55// name: tokenize_string54// name: tokenize_string
@@ -189,36 +188,6 @@ int win32_tmpnam(char *file_path) · 133 unmodified lines
189#endif188#endif
190 189
191 190
192//-----------------------------------------------------------------------------
193// name: shell_cb
194// desc: thread routine
195//-----------------------------------------------------------------------------
196void * shell_cb( void * p )
197{
198 Chuck_Shell * shell;
199 // log
200 EM_log( CK_LOG_INFO, "starting thread routine for shell..." );
201
202 // assuming this is absolutely necessary, an assert may be better
203 assert( p != NULL );
204
205 shell = ( Chuck_Shell * ) p;
206
207 //atexit( wait_for_shell );
208
209 // run the shell
210 shell->run();
211
212 // delete and set to NULL
213 SAFE_DELETE( g_shell );
214 // perhaps let shell destructor clean up mode and ui?
215
216 EM_log( CK_LOG_INFO, "exiting thread routine for shell..." );
217
218 return NULL;
219}
220
221
222 191
223 192
224//-----------------------------------------------------------------------------193//-----------------------------------------------------------------------------
@@ -235,6 +204,9 @@ Chuck_Shell::Chuck_Shell() · 10 unmodified lines
235 code_entry_active = FALSE;204 code_entry_active = FALSE;
236}205}
237 206
207
208
209
238//-----------------------------------------------------------------------------210//-----------------------------------------------------------------------------
239// name: ~Chuck_Shell()211// name: ~Chuck_Shell()
240// desc: ...212// desc: ...
@@ -254,6 +226,9 @@ Chuck_Shell::~Chuck_Shell() · 13 unmodified lines
254 initialized = FALSE;226 initialized = FALSE;
255}227}
256 228
229
230
231
257//-----------------------------------------------------------------------------232//-----------------------------------------------------------------------------
258// name: init()233// name: init()
259// desc: ...234// desc: ...
@@ -409,6 +384,9 @@ t_CKBOOL Chuck_Shell::init( Chuck_VM * vm, Chuck_Shell_UI * ui ) · 149 unmodified lines
409 return TRUE;384 return TRUE;
410}385}
411 386
387
388
389
412//-----------------------------------------------------------------------------390//-----------------------------------------------------------------------------
413// name: run()391// name: run()
414// desc: ...392// desc: ...
@@ -460,6 +438,9 @@ void Chuck_Shell::run() · 45 unmodified lines
460 EM_log( CK_LOG_SYSTEM, "exiting chuck shell..." );438 EM_log( CK_LOG_SYSTEM, "exiting chuck shell..." );
461}439}
462 440
441
442
443
463//-----------------------------------------------------------------------------444//-----------------------------------------------------------------------------
464// name: execute445// name: execute
465// desc: ...446// desc: ...
@@ -551,6 +532,9 @@ t_CKBOOL Chuck_Shell::execute( string & in, string & out ) · 85 unmodified lines
551 return TRUE;532 return TRUE;
552}533}
553 534
535
536
537
554//-----------------------------------------------------------------------------538//-----------------------------------------------------------------------------
555// name: start_code()539// name: start_code()
556// desc: ...540// desc: ...
@@ -562,6 +546,9 @@ void Chuck_Shell::start_code() · 5 unmodified lines
562 scope = 0;546 scope = 0;
563}547}
564 548
549
550
551
565//-----------------------------------------------------------------------------552//-----------------------------------------------------------------------------
566// name: continue_code()553// name: continue_code()
567// desc: ...554// desc: ...
@@ -602,6 +589,9 @@ void Chuck_Shell::continue_code( string & in ) · 34 unmodified lines
602 code_entry_active = FALSE;589 code_entry_active = FALSE;
603}590}
604 591
592
593
594
605//-----------------------------------------------------------------------------595//-----------------------------------------------------------------------------
606// name: do_code()596// name: do_code()
607// desc: ...597// desc: ...
@@ -676,6 +666,9 @@ void Chuck_Shell::do_code( string & code, string & out, string command ) · 68 unmodified lines
676 prompt = variables["COMMAND_PROMPT"];666 prompt = variables["COMMAND_PROMPT"];
677}667}
678 668
669
670
671
679//-----------------------------------------------------------------------------672//-----------------------------------------------------------------------------
680// name: do_context()673// name: do_context()
681// desc: ...674// desc: ...
@@ -685,6 +678,9 @@ void Chuck_Shell::do_code_context( string & ) · 3 unmodified lines
685 678
686}679}
687 680
681
682
683
688//-----------------------------------------------------------------------------684//-----------------------------------------------------------------------------
689// name: close()685// name: close()
690// desc: ...686// desc: ...
@@ -695,6 +691,9 @@ void Chuck_Shell::close() · 4 unmodified lines
695 // 691 //
696}692}
697 693
694
695
696
698//-----------------------------------------------------------------------------697//-----------------------------------------------------------------------------
699// name: kill()698// name: kill()
700// desc: ...699// desc: ...
@@ -711,6 +710,9 @@ void Chuck_Shell::exit() · 10 unmodified lines
711*/710*/
712}711}
713 712
713
714
715
714//-----------------------------------------------------------------------------716//-----------------------------------------------------------------------------
715// name: init()717// name: init()
716// desc: ...718// desc: ...
@@ -722,6 +724,9 @@ t_CKBOOL Chuck_Shell_Network_VM::init( const string & hostname, t_CKINT port ) · 5 unmodified lines
722 return TRUE;724 return TRUE;
723}725}
724 726
727
728
729
725//-----------------------------------------------------------------------------730//-----------------------------------------------------------------------------
726// name: copy()731// name: copy()
727// desc: ...732// desc: ...
@@ -733,6 +738,9 @@ Chuck_Shell_VM * Chuck_Shell_Network_VM::copy() · 5 unmodified lines
733 return net_vm;738 return net_vm;
734}739}
735 740
741
742
743
736//-----------------------------------------------------------------------------744//-----------------------------------------------------------------------------
737// name: add_shred()745// name: add_shred()
738// desc: ...746// desc: ...
@@ -781,6 +789,9 @@ t_CKBOOL Chuck_Shell_Network_VM::add_shred( const vector< string > & files, · 42 unmodified lines
781 return return_val;789 return return_val;
782}790}
783 791
792
793
794
784//-----------------------------------------------------------------------------795//-----------------------------------------------------------------------------
785// name: remove_shred()796// name: remove_shred()
786// desc: ...797// desc: ...
@@ -829,6 +840,9 @@ t_CKBOOL Chuck_Shell_Network_VM::remove_shred( const vector< string > & ids, · 42 unmodified lines
829 return return_val;840 return return_val;
830}841}
831 842
843
844
845
832//-----------------------------------------------------------------------------846//-----------------------------------------------------------------------------
833// name: remove_all()847// name: remove_all()
834// desc: ...848// desc: ...
@@ -847,6 +861,9 @@ t_CKBOOL Chuck_Shell_Network_VM::remove_all( string & out ) · 12 unmodified lines
847 return return_val;861 return return_val;
848}862}
849 863
864
865
866
850//-----------------------------------------------------------------------------867//-----------------------------------------------------------------------------
851// name: remove_last()868// name: remove_last()
852// desc: ...869// desc: ...
@@ -865,6 +882,9 @@ t_CKBOOL Chuck_Shell_Network_VM::remove_last( string & out ) · 12 unmodified lines
865 return return_val;882 return return_val;
866}883}
867 884
885
886
887
868//-----------------------------------------------------------------------------888//-----------------------------------------------------------------------------
869// name: replace_shred()889// name: replace_shred()
870// desc: ...890// desc: ...
@@ -924,6 +944,9 @@ t_CKBOOL Chuck_Shell_Network_VM::replace_shred( const vector< string > &vec, · 53 unmodified lines
924 return return_val;944 return return_val;
925}945}
926 946
947
948
949
927//-----------------------------------------------------------------------------950//-----------------------------------------------------------------------------
928// name: status()951// name: status()
929// desc: ...952// desc: ...
@@ -945,6 +968,9 @@ t_CKBOOL Chuck_Shell_Network_VM::status( string & out ) · 15 unmodified lines
945 return return_val;968 return return_val;
946}969}
947 970
971
972
973
948//-----------------------------------------------------------------------------974//-----------------------------------------------------------------------------
949// name: kill()975// name: kill()
950// desc: ...976// desc: ...
@@ -967,6 +993,9 @@ t_CKBOOL Chuck_Shell_Network_VM::kill( string & out ) · 16 unmodified lines
967 return return_val;993 return return_val;
968}994}
969 995
996
997
998
970//-----------------------------------------------------------------------------999//-----------------------------------------------------------------------------
971// name: fullname()1000// name: fullname()
972// desc: returns a somewhat descriptive full name for this VM1001// desc: returns a somewhat descriptive full name for this VM
@@ -979,6 +1008,9 @@ string Chuck_Shell_Network_VM::fullname() · 6 unmodified lines
979 return hostname + buf;1008 return hostname + buf;
980}1009}
981 1010
1011
1012
1013
982//-----------------------------------------------------------------------------1014//-----------------------------------------------------------------------------
983// name: init()1015// name: init()
984// desc: ...1016// desc: ...
@@ -988,6 +1020,9 @@ t_CKBOOL Chuck_Shell_UI::init() · 3 unmodified lines
988 return TRUE;1020 return TRUE;
989}1021}
990 1022
1023
1024
1025
991//-----------------------------------------------------------------------------1026//-----------------------------------------------------------------------------
992// name: init()1027// name: init()
993// desc: ...1028// desc: ...
@@ -998,6 +1033,9 @@ t_CKBOOL Chuck_Shell::Command::init( Chuck_Shell * caller ) · 4 unmodified lines
998 return TRUE;1033 return TRUE;
999}1034}
1000 1035
1036
1037
1038
1001//-----------------------------------------------------------------------------1039//-----------------------------------------------------------------------------
1002// name: usage()1040// name: usage()
1003// desc: ...1041// desc: ...
@@ -1007,6 +1045,9 @@ string Chuck_Shell::Command::usage() · 3 unmodified lines
1007 return "no usage specified";1045 return "no usage specified";
1008}1046}
1009 1047
1048
1049
1050
1010//-----------------------------------------------------------------------------1051//-----------------------------------------------------------------------------
1011// name: long_usage()1052// name: long_usage()
1012// desc: ...1053// desc: ...
@@ -1016,6 +1057,9 @@ string Chuck_Shell::Command::long_usage() · 3 unmodified lines
1016 return "no usage specified";1057 return "no usage specified";
1017}1058}
1018 1059
1060
1061
1062
1019//-----------------------------------------------------------------------------1063//-----------------------------------------------------------------------------
1020// name: execute()1064// name: execute()
1021// desc: ...1065// desc: ...
@@ -1045,6 +1089,9 @@ t_CKINT Chuck_Shell::Command_Add::execute( vector< string > & argv, · 23 unmodified lines
1045 return result;1089 return result;
1046}1090}
1047 1091
1092
1093
1094
1048//-----------------------------------------------------------------------------1095//-----------------------------------------------------------------------------
1049// name: usage()1096// name: usage()
1050// desc: ...1097// desc: ...
@@ -1053,7 +1100,10 @@ string Chuck_Shell::Command_Add::usage() · 2 unmodified lines
1053{1100{
1054 return "add file ...";1101 return "add file ...";
1055}1102}
1056 1103
1104
1105
1106
1057//-----------------------------------------------------------------------------1107//-----------------------------------------------------------------------------
1058// name: execute()1108// name: execute()
1059// desc: ...1109// desc: ...
@@ -1081,6 +1131,9 @@ t_CKINT Chuck_Shell::Command_Remove::execute( vector< string > & argv, · 21 unmodified lines
1081 return result;1131 return result;
1082}1132}
1083 1133
1134
1135
1136
1084//-----------------------------------------------------------------------------1137//-----------------------------------------------------------------------------
1085// name: usage()1138// name: usage()
1086// desc: ...1139// desc: ...
@@ -1090,6 +1143,9 @@ string Chuck_Shell::Command_Remove::usage() · 3 unmodified lines
1090 return "remove shred_number ...";1143 return "remove shred_number ...";
1091}1144}
1092 1145
1146
1147
1148
1093//-----------------------------------------------------------------------------1149//-----------------------------------------------------------------------------
1094// name: execute()1150// name: execute()
1095// desc: ...1151// desc: ...
@@ -1117,6 +1173,9 @@ t_CKINT Chuck_Shell::Command_Removeall::execute( vector< string > & argv, · 21 unmodified lines
1117 return result;1173 return result;
1118}1174}
1119 1175
1176
1177
1178
1120//-----------------------------------------------------------------------------1179//-----------------------------------------------------------------------------
1121// name: usage()1180// name: usage()
1122// desc: ...1181// desc: ...
@@ -1126,6 +1185,9 @@ string Chuck_Shell::Command_Removeall::usage() · 3 unmodified lines
1126 return "removeall";1185 return "removeall";
1127}1186}
1128 1187
1188
1189
1190
1129//-----------------------------------------------------------------------------1191//-----------------------------------------------------------------------------
1130// name: execute()1192// name: execute()
1131// desc: ...1193// desc: ...
@@ -1146,6 +1208,9 @@ t_CKINT Chuck_Shell::Command_Removelast::execute( vector< string > & argv, · 14 unmodified lines
1146 return result;1208 return result;
1147}1209}
1148 1210
1211
1212
1213
1149//-----------------------------------------------------------------------------1214//-----------------------------------------------------------------------------
1150// name: usage()1215// name: usage()
1151// desc: ...1216// desc: ...
@@ -1155,6 +1220,9 @@ string Chuck_Shell::Command_Removelast::usage() · 3 unmodified lines
1155 return "removelast";1220 return "removelast";
1156}1221}
1157 1222
1223
1224
1225
1158//-----------------------------------------------------------------------------1226//-----------------------------------------------------------------------------
1159// name: execute()1227// name: execute()
1160// desc: ...1228// desc: ...
@@ -1173,6 +1241,9 @@ t_CKINT Chuck_Shell::Command_Replace::execute( vector< string > & argv, · 12 unmodified lines
1173 return 0;1241 return 0;
1174}1242}
1175 1243
1244
1245
1246
1176//-----------------------------------------------------------------------------1247//-----------------------------------------------------------------------------
1177// name: usage()1248// name: usage()
1178// desc: ...1249// desc: ...
@@ -1182,6 +1253,9 @@ string Chuck_Shell::Command_Replace::usage() · 3 unmodified lines
1182 return "replace shred_id file ...";1253 return "replace shred_id file ...";
1183}1254}
1184 1255
1256
1257
1258
1185//-----------------------------------------------------------------------------1259//-----------------------------------------------------------------------------
1186// name: execute()1260// name: execute()
1187// desc: ...1261// desc: ...
@@ -1209,6 +1283,9 @@ t_CKINT Chuck_Shell::Command_Status::execute( vector< string > & argv, · 21 unmodified lines
1209 return result;1283 return result;
1210}1284}
1211 1285
1286
1287
1288
1212//-----------------------------------------------------------------------------1289//-----------------------------------------------------------------------------
1213// name: usage()1290// name: usage()
1214// desc: ...1291// desc: ...
@@ -1218,6 +1295,9 @@ string Chuck_Shell::Command_Status::usage() · 3 unmodified lines
1218 return "status";1295 return "status";
1219}1296}
1220 1297
1298
1299
1300
1221//-----------------------------------------------------------------------------1301//-----------------------------------------------------------------------------
1222// name: execute()1302// name: execute()
1223// desc: ...1303// desc: ...
@@ -1232,6 +1312,9 @@ t_CKINT Chuck_Shell::Command_Kill::execute( vector< string > & argv, · 8 unmodified lines
1232 return 0;1312 return 0;
1233}1313}
1234 1314
1315
1316
1317
1235//-----------------------------------------------------------------------------1318//-----------------------------------------------------------------------------
1236// name: execute()1319// name: execute()
1237// desc: ...1320// desc: ...
@@ -1243,8 +1326,9 @@ t_CKINT Chuck_Shell::Command_Close::execute( vector< string > & argv, · 5 unmodified lines
1243 1326
1244 out += "closing chuck shell... bye!\n";1327 out += "closing chuck shell... bye!\n";
1245 1328
1246 if( g_shell != NULL )1329 // REFACTOR-2017: removed: this needs to be done outside
1247 out += "(note: in-process VM still running, hit ctrl-c to exit)\n";1330 // if( g_shell != NULL )
1331 // out += "(note: in-process VM still running, hit ctrl-c to exit)\n";
1248 1332
1249 if( argv.size() > 0 )1333 if( argv.size() > 0 )
1250 out += "close: warning: ignoring excess arguments...\n";1334 out += "close: warning: ignoring excess arguments...\n";
@@ -1252,6 +1336,9 @@ t_CKINT Chuck_Shell::Command_Close::execute( vector< string > & argv, · 1 unmodified line
1252 return 0;1336 return 0;
1253}1337}
1254 1338
1339
1340
1341
1255//-----------------------------------------------------------------------------1342//-----------------------------------------------------------------------------
1256// name: execute()1343// name: execute()
1257// desc: ...1344// desc: ...
@@ -1266,6 +1353,9 @@ t_CKINT Chuck_Shell::Command_Exit::execute( vector< string > & argv, · 8 unmodified lines
1266 return 0;1353 return 0;
1267}1354}
1268 1355
1356
1357
1358
1269//-----------------------------------------------------------------------------1359//-----------------------------------------------------------------------------
1270// name: execute()1360// name: execute()
1271// desc: ...1361// desc: ...
@@ -1393,6 +1483,9 @@ t_CKINT Chuck_Shell::Command_Ls::execute( vector< string > & argv, · 121 unmodified lines
1393 return 0;1483 return 0;
1394}1484}
1395 1485
1486
1487
1488
1396//-----------------------------------------------------------------------------1489//-----------------------------------------------------------------------------
1397// name: execute()1490// name: execute()
1398// desc: ...1491// desc: ...
@@ -1427,6 +1520,9 @@ t_CKINT Chuck_Shell::Command_Cd::execute( vector< string > & argv, · 28 unmodified lines
1427 return 0;1520 return 0;
1428}1521}
1429 1522
1523
1524
1525
1430//-----------------------------------------------------------------------------1526//-----------------------------------------------------------------------------
1431// name: execute()1527// name: execute()
1432// desc: ...1528// desc: ...
@@ -1461,6 +1557,9 @@ t_CKINT Chuck_Shell::Command_Pwd::execute( vector< string > & argv, · 28 unmodified lines
1461 return 0;1557 return 0;
1462}1558}
1463 1559
1560
1561
1562
1464//-----------------------------------------------------------------------------1563//-----------------------------------------------------------------------------
1465// name: execute()1564// name: execute()
1466// desc: ...1565// desc: ...
@@ -1507,6 +1606,9 @@ t_CKINT Chuck_Shell::Command_Alias::execute( vector< string > & argv, · 40 unmodified lines
1507 return 0;1606 return 0;
1508}1607}
1509 1608
1609
1610
1611
1510//-----------------------------------------------------------------------------1612//-----------------------------------------------------------------------------
1511// name: execute()1613// name: execute()
1512// desc: ...1614// desc: ...
@@ -1528,6 +1630,9 @@ t_CKINT Chuck_Shell::Command_Unalias::execute( vector< string > & argv, · 15 unmodified lines
1528 return 0;1630 return 0;
1529}1631}
1530 1632
1633
1634
1635
1531//-----------------------------------------------------------------------------1636//-----------------------------------------------------------------------------
1532// name: execute()1637// name: execute()
1533// desc: ...1638// desc: ...
@@ -1560,6 +1665,9 @@ t_CKINT Chuck_Shell::Command_Source::execute( vector< string > & argv, · 26 unmodified lines
1560 return 0;1665 return 0;
1561}1666}
1562 1667
1668
1669
1670
1563//-----------------------------------------------------------------------------1671//-----------------------------------------------------------------------------
1564// name: execute()1672// name: execute()
1565// desc: ...1673// desc: ...
@@ -1571,6 +1679,9 @@ t_CKINT Chuck_Shell::Command_Help::execute( vector< string > & argv, · 5 unmodified lines
1571 return 0;1679 return 0;
1572}1680}
1573 1681
1682
1683
1684
1574//-----------------------------------------------------------------------------1685//-----------------------------------------------------------------------------
1575// name: init()1686// name: init()
1576// desc: ...1687// desc: ...
@@ -1619,6 +1730,9 @@ t_CKBOOL Chuck_Shell::Command_VM::init( Chuck_Shell * caller ) · 42 unmodified lines
1619 return TRUE;1730 return TRUE;
1620}1731}
1621 1732
1733
1734
1735
1622//-----------------------------------------------------------------------------1736//-----------------------------------------------------------------------------
1623// name: ~Command_VM()1737// name: ~Command_VM()
1624// desc: ...1738// desc: ...
@@ -1632,6 +1746,9 @@ Chuck_Shell::Command_VM::~Command_VM() · 7 unmodified lines
1632 SAFE_DELETE( allocated_commands[i] );1746 SAFE_DELETE( allocated_commands[i] );
1633}1747}
1634 1748
1749
1750
1751
1635//-----------------------------------------------------------------------------1752//-----------------------------------------------------------------------------
1636// name: execute()1753// name: execute()
1637// desc: ...1754// desc: ...
@@ -1657,6 +1774,9 @@ t_CKINT Chuck_Shell::Command_VM::execute( vector< string > & argv, · 19 unmodified lines
1657 return 0;1774 return 0;
1658}1775}
1659 1776
1777
1778
1779
1660//-----------------------------------------------------------------------------1780//-----------------------------------------------------------------------------
1661// name: usage()1781// name: usage()
1662// desc: ...1782// desc: ...
@@ -1666,6 +1786,9 @@ string Chuck_Shell::Command_VM::usage() · 3 unmodified lines
1666 return "vm [command] [args] ...";1786 return "vm [command] [args] ...";
1667}1787}
1668 1788
1789
1790
1791
1669//-----------------------------------------------------------------------------1792//-----------------------------------------------------------------------------
1670// name: execute()1793// name: execute()
1671// desc: ...1794// desc: ...
@@ -1741,6 +1864,9 @@ t_CKINT Chuck_Shell::Command_VMAttach::execute( vector < string > & argv, · 69 unmodified lines
1741 return result;1864 return result;
1742}1865}
1743 1866
1867
1868
1869
1744//-----------------------------------------------------------------------------1870//-----------------------------------------------------------------------------
1745// name: execute()1871// name: execute()
1746// desc: ...1872// desc: ...
@@ -1772,6 +1898,9 @@ t_CKINT Chuck_Shell::Command_VMAdd::execute( vector< string > & argv, · 25 unmodified lines
1772 return 0;1898 return 0;
1773}1899}
1774 1900
1901
1902
1903
1775//-----------------------------------------------------------------------------1904//-----------------------------------------------------------------------------
1776// name: execute()1905// name: execute()
1777// desc: ...1906// desc: ...
@@ -1798,6 +1927,9 @@ t_CKINT Chuck_Shell::Command_VMRemove::execute( vector< string > & argv, · 20 unmodified lines
1798 return 0;1927 return 0;
1799}1928}
1800 1929
1930
1931
1932
1801//-----------------------------------------------------------------------------1933//-----------------------------------------------------------------------------
1802// name: execute()1934// name: execute()
1803// desc: ...1935// desc: ...
@@ -1830,6 +1962,9 @@ t_CKINT Chuck_Shell::Command_VMSwap::execute( vector< string > & argv, · 26 unmodified lines
1830 return 0;1962 return 0;
1831}1963}
1832 1964
1965
1966
1967
1833//-----------------------------------------------------------------------------1968//-----------------------------------------------------------------------------
1834// name: execute()1969// name: execute()
1835// desc: ...1970// desc: ...
@@ -1863,6 +1998,9 @@ t_CKINT Chuck_Shell::Command_VMList::execute( vector< string > & argv, · 27 unmodified lines
1863 return 0;1998 return 0;
1864}1999}
1865 2000
2001
2002
2003
1866//-----------------------------------------------------------------------------2004//-----------------------------------------------------------------------------
1867// name: execute()2005// name: execute()
1868// desc: ...2006// desc: ...
@@ -1889,6 +2027,9 @@ t_CKINT Chuck_Shell::Command_VMAttachAdd::execute( vector< string > & argv, · 20 unmodified lines
1889 return result;2027 return result;
1890}2028}
1891 2029
2030
2031
2032
1892//-----------------------------------------------------------------------------2033//-----------------------------------------------------------------------------
1893// name: init()2034// name: init()
1894// desc: ...2035// desc: ...
@@ -1938,6 +2079,9 @@ t_CKBOOL Chuck_Shell::Command_Code::init( Chuck_Shell * caller ) · 43 unmodified lines
1938 return TRUE;2079 return TRUE;
1939}2080}
1940 2081
2082
2083
2084
1941//-----------------------------------------------------------------------------2085//-----------------------------------------------------------------------------
1942// name: ~Command_Code()2086// name: ~Command_Code()
1943// desc: ...2087// desc: ...
@@ -1951,6 +2095,9 @@ Chuck_Shell::Command_Code::~Command_Code() · 7 unmodified lines
1951 SAFE_DELETE( allocated_commands[i] );2095 SAFE_DELETE( allocated_commands[i] );
1952}2096}
1953 2097
2098
2099
2100
1954//-----------------------------------------------------------------------------2101//-----------------------------------------------------------------------------
1955// name: execute()2102// name: execute()
1956// desc: ...2103// desc: ...
@@ -1976,6 +2123,9 @@ t_CKINT Chuck_Shell::Command_Code::execute( vector< string > & argv, · 19 unmodified lines
1976 return 0;2123 return 0;
1977}2124}
1978 2125
2126
2127
2128
1979//-----------------------------------------------------------------------------2129//-----------------------------------------------------------------------------
1980// name: usage()2130// name: usage()
1981// desc: ...2131// desc: ...
@@ -1985,6 +2135,9 @@ string Chuck_Shell::Command_Code::usage() · 3 unmodified lines
1985 return "code [command] [args] ...";2135 return "code [command] [args] ...";
1986}2136}
1987 2137
2138
2139
2140
1988//-----------------------------------------------------------------------------2141//-----------------------------------------------------------------------------
1989// name: execute()2142// name: execute()
1990// desc: ...2143// desc: ...
@@ -2011,6 +2164,9 @@ t_CKINT Chuck_Shell::Command_CodeSave::execute( vector < string > & argv, · 20 unmodified lines
2011 return 0;2164 return 0;
2012}2165}
2013 2166
2167
2168
2169
2014//-----------------------------------------------------------------------------2170//-----------------------------------------------------------------------------
2015// name: execute()2171// name: execute()
2016// desc: ...2172// desc: ...
@@ -2029,6 +2185,9 @@ t_CKINT Chuck_Shell::Command_CodeList::execute( vector < string > & argv, · 12 unmodified lines
2029 return 0;2185 return 0;
2030}2186}
2031 2187
2188
2189
2190
2032//-----------------------------------------------------------------------------2191//-----------------------------------------------------------------------------
2033// name: execute()2192// name: execute()
2034// desc: ...2193// desc: ...
@@ -2063,6 +2222,9 @@ t_CKINT Chuck_Shell::Command_CodeAdd::execute( vector < string > & argv, · 28 unmodified lines
2063 return 0;2222 return 0;
2064}2223}
2065 2224
2225
2226
2227
2066//-----------------------------------------------------------------------------2228//-----------------------------------------------------------------------------
2067// name: execute()2229// name: execute()
2068// desc: ...2230// desc: ...
@@ -2101,6 +2263,9 @@ t_CKINT Chuck_Shell::Command_CodePrint::execute( vector < string > & argv, · 32 unmodified lines
2101 return 0;2263 return 0;
2102} 2264}
2103 2265
2266
2267
2268
2104//-----------------------------------------------------------------------------2269//-----------------------------------------------------------------------------
2105// name: execute()2270// name: execute()
2106// desc: ...2271// desc: ...
@@ -2131,6 +2296,9 @@ t_CKINT Chuck_Shell::Command_CodeDelete::execute( vector < string > & argv, · 24 unmodified lines
2131 return 0;2296 return 0;
2132} 2297}
2133 2298
2299
2300
2301
2134//-----------------------------------------------------------------------------2302//-----------------------------------------------------------------------------
2135// name: execute()2303// name: execute()
2136// desc: ...2304// desc: ...
@@ -2188,7 +2356,10 @@ t_CKINT Chuck_Shell::Command_CodeWrite::execute( vector < string > & argv, · 51 unmodified lines
2188 out += "warning: ignoring excess arguments...\n";2356 out += "warning: ignoring excess arguments...\n";
2189 2357
2190 return 0;2358 return 0;
2191} 2359}
2360
2361
2362
2192 2363
2193//-----------------------------------------------------------------------------2364//-----------------------------------------------------------------------------
2194// name: execute()2365// name: execute()
src/host/chuck_main.cpp+33−0
@@ -42,6 +42,7 @@ · 41 unmodified lines
42// function prototypes42// function prototypes
43//-----------------------------------------------------------------------------43//-----------------------------------------------------------------------------
44t_CKBOOL init_shell( Chuck_Shell * shell, Chuck_Shell_UI * ui, Chuck_VM * vm );44t_CKBOOL init_shell( Chuck_Shell * shell, Chuck_Shell_UI * ui, Chuck_VM * vm );
45void * shell_cb( void * p );
45bool go( int argc, const char ** argv );46bool go( int argc, const char ** argv );
46void global_cleanup();47void global_cleanup();
47void all_stop();48void all_stop();
@@ -340,6 +341,38 @@ t_CKBOOL init_shell( Chuck_Shell * shell, Chuck_Shell_UI * ui, Chuck_VM * vm ) · 292 unmodified lines
340 341
341 342
342 343
344//-----------------------------------------------------------------------------
345// name: shell_cb
346// desc: thread routine
347//-----------------------------------------------------------------------------
348void * shell_cb( void * p )
349{
350 Chuck_Shell * shell;
351 // log
352 EM_log( CK_LOG_INFO, "starting thread routine for shell..." );
353
354 // assuming this is absolutely necessary, an assert may be better
355 assert( p != NULL );
356
357 shell = ( Chuck_Shell * ) p;
358
359 //atexit( wait_for_shell );
360
361 // run the shell
362 shell->run();
363
364 // delete and set to NULL
365 SAFE_DELETE( g_shell );
366 // perhaps let shell destructor clean up mode and ui?
367
368 EM_log( CK_LOG_INFO, "exiting thread routine for shell..." );
369
370 return NULL;
371}
372
373
374
375
343//-----------------------------------------------------------------------------376//-----------------------------------------------------------------------------
344// name: go()377// name: go()
345// desc: parse args, init stuff, run!378// desc: parse args, init stuff, run!

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