Преглед на файлове

Add a way to set a breakpoint when debugging SquiLu code

mingodad преди 9 години
родител
ревизия
ceb43fbfea
променени са 2 файла, в които са добавени 29 реда и са изтрити 7 реда
  1. 11 6
      SquiLu-editor/editor.cbp
  2. 18 1
      SquiLu-editor/editor.cxx

+ 11 - 6
SquiLu-editor/editor.cbp

@@ -106,6 +106,7 @@
 					<Add option="-DCONFIG_64=1" />
 					<Add option="-DCONFIG_64=1" />
 					<Add directory="/usr/include/postgresql" />
 					<Add directory="/usr/include/postgresql" />
 					<Add directory="/usr/include/mysql" />
 					<Add directory="/usr/include/mysql" />
+					<Add directory="../minizip" />
 				</Compiler>
 				</Compiler>
 				<Linker>
 				<Linker>
 					<Add option="-s" />
 					<Add option="-s" />
@@ -119,6 +120,8 @@
 					<Add library="mpdecimal" />
 					<Add library="mpdecimal" />
 					<Add library="discount" />
 					<Add library="discount" />
 					<Add library="rt" />
 					<Add library="rt" />
+					<Add library="fontconfig" />
+					<Add library="dl" />
 				</Linker>
 				</Linker>
 			</Target>
 			</Target>
 		</Build>
 		</Build>
@@ -127,6 +130,8 @@
 			<Add option="-fexceptions" />
 			<Add option="-fexceptions" />
 			<Add option="-DWITH_DAD_EXTRAS=1" />
 			<Add option="-DWITH_DAD_EXTRAS=1" />
 			<Add option="-DWITH_FLTK=1" />
 			<Add option="-DWITH_FLTK=1" />
+			<Add option="-DWITH_MYSQL=1" />
+			<Add option="-DWITH_POSTGRESQL=1" />
 			<Add option="-DSQ_SUBLATIN=1" />
 			<Add option="-DSQ_SUBLATIN=1" />
 			<Add option="-DNEED_SUBLATIN_C2=1" />
 			<Add option="-DNEED_SUBLATIN_C2=1" />
 			<Add option="-DSQUSEDOUBLE=1" />
 			<Add option="-DSQUSEDOUBLE=1" />
@@ -177,6 +182,7 @@
 			<Add library="fltk" />
 			<Add library="fltk" />
 			<Add library="m" />
 			<Add library="m" />
 			<Add library="hpdfs" />
 			<Add library="hpdfs" />
+			<Add library="../minizip/libminizip.a" />
 			<Add directory="../fltk/lib" />
 			<Add directory="../fltk/lib" />
 			<Add directory="../mpdecimal" />
 			<Add directory="../mpdecimal" />
 			<Add directory="../myaxtls" />
 			<Add directory="../myaxtls" />
@@ -185,11 +191,6 @@
 			<Add directory="../libharu/src" />
 			<Add directory="../libharu/src" />
 			<Add directory="../discount" />
 			<Add directory="../discount" />
 		</Linker>
 		</Linker>
-		<Unit filename="dadbiz.rc">
-			<Option compilerVar="WINDRES" />
-			<Option target="Release win32" />
-		</Unit>
-		<Unit filename="editor.cxx" />
 		<Unit filename="../SquiLu-ext/code_mix_prep.c">
 		<Unit filename="../SquiLu-ext/code_mix_prep.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
 		</Unit>
 		</Unit>
@@ -228,7 +229,6 @@
 		<Unit filename="../SquiLu-ext/sq_sqlite3.cpp" />
 		<Unit filename="../SquiLu-ext/sq_sqlite3.cpp" />
 		<Unit filename="../SquiLu-ext/sq_tinyxml2.cpp" />
 		<Unit filename="../SquiLu-ext/sq_tinyxml2.cpp" />
 		<Unit filename="../SquiLu-ext/sq_zlib.cpp" />
 		<Unit filename="../SquiLu-ext/sq_zlib.cpp" />
-		<Unit filename="../SquiLu-ext/sq_zmq3.cpp" />
 		<Unit filename="../SquiLu-ext/sqfs.h" />
 		<Unit filename="../SquiLu-ext/sqfs.h" />
 		<Unit filename="../SquiLu-ext/sqlite3.c">
 		<Unit filename="../SquiLu-ext/sqlite3.c">
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
@@ -285,6 +285,11 @@
 			<Option compilerVar="CC" />
 			<Option compilerVar="CC" />
 		</Unit>
 		</Unit>
 		<Unit filename="../SquiLu/squirrel/sublatin.h" />
 		<Unit filename="../SquiLu/squirrel/sublatin.h" />
+		<Unit filename="dadbiz.rc">
+			<Option compilerVar="WINDRES" />
+			<Option target="Release win32" />
+		</Unit>
+		<Unit filename="editor.cxx" />
 		<Extensions>
 		<Extensions>
 			<envvars />
 			<envvars />
 			<code_completion />
 			<code_completion />

+ 18 - 1
SquiLu-editor/editor.cxx

@@ -52,6 +52,7 @@ static HSQUIRRELVM v;
 
 
 static bool _debug_wait = false;
 static bool _debug_wait = false;
 static bool _stop_debug = false;
 static bool _stop_debug = false;
+static int _debug_breakpoint_line = -1;
 static int _debug_pos = 0;
 static int _debug_pos = 0;
 static void sq_debug_hook(HSQUIRRELVM v, SQInteger type, const SQChar *sourcename, SQInteger line, const SQChar *funcname);
 static void sq_debug_hook(HSQUIRRELVM v, SQInteger type, const SQChar *sourcename, SQInteger line, const SQChar *funcname);
 
 
@@ -786,6 +787,13 @@ void run_cb(Fl_Widget*, void* ew) {
 
 
 #define DBG_EDITOR_WINDOW_KEY "DebugEditorWindow"
 #define DBG_EDITOR_WINDOW_KEY "DebugEditorWindow"
 
 
+void breakpoint_cb(Fl_Widget*, void* ew)
+{
+    EditorWindow* w = (EditorWindow*)ew;
+    _debug_breakpoint_line = w->editor->count_lines(0, w->editor->insert_position(), true);
+    printf("Breakpoint at line %d\n", _debug_breakpoint_line);
+}
+
 void debug_cb(Fl_Widget*, void* ew) {
 void debug_cb(Fl_Widget*, void* ew) {
   if(_debug_wait){
   if(_debug_wait){
       _debug_wait = false;
       _debug_wait = false;
@@ -850,6 +858,7 @@ Fl_Menu_Item menuitems[] = {
 
 
   { "Run F5", FL_F+5, (Fl_Callback *)run_cb },
   { "Run F5", FL_F+5, (Fl_Callback *)run_cb },
   { "Debug F8", FL_F+8, debug_cb },
   { "Debug F8", FL_F+8, debug_cb },
+  { "&Breakpoint", FL_COMMAND + FL_SHIFT + 'b', breakpoint_cb },
   { "Stop Debug", 0, stop_debug_cb },
   { "Stop Debug", 0, stop_debug_cb },
   { 0 }
   { 0 }
 };
 };
@@ -931,6 +940,14 @@ char** sq_main_argv = 0;
 
 
 static void sq_debug_hook(HSQUIRRELVM v, SQInteger ev_type, const SQChar *sourcename, SQInteger line, const SQChar *funcname){
 static void sq_debug_hook(HSQUIRRELVM v, SQInteger ev_type, const SQChar *sourcename, SQInteger line, const SQChar *funcname){
     if(_stop_debug) return;
     if(_stop_debug) return;
+    if(_debug_breakpoint_line > 0)
+    {
+        if(ev_type == 'l' && line == _debug_breakpoint_line)
+        {
+            _debug_breakpoint_line = -1; //only once right now
+        }
+        else return;
+    }
     const SQChar *fname = funcname ? funcname : "unknown";
     const SQChar *fname = funcname ? funcname : "unknown";
     printf("evt %d %c\n", ev_type, ev_type);
     printf("evt %d %c\n", ev_type, ev_type);
     switch(ev_type){
     switch(ev_type){
@@ -1003,7 +1020,7 @@ int main(int argc, char **argv) {
 	sqext_register_sq_slave_vm(v);
 	sqext_register_sq_slave_vm(v);
 	//sqext_register_ThreadObjects(v);
 	//sqext_register_ThreadObjects(v);
 
 
-	sqext_register_sq_zmq3(v);
+	//sqext_register_sq_zmq3(v);
 	//sqext_register_Java(v);
 	//sqext_register_Java(v);
 
 
 	sqext_register_rs232(v);
 	sqext_register_rs232(v);