mirror of
https://github.com/QB64Official/qb64.git
synced 2024-07-05 15:50:25 +00:00
First attempt at implementing Step.
This commit is contained in:
parent
d01f824a66
commit
7b853bf9f2
|
@ -291,7 +291,6 @@ extern "C" int QB64_Resizable(){
|
||||||
int32 sub_gl_called=0;
|
int32 sub_gl_called=0;
|
||||||
|
|
||||||
extern void evnt(uint32 linenumber, uint32 inclinenumber = 0, const char* incfilename = NULL);
|
extern void evnt(uint32 linenumber, uint32 inclinenumber = 0, const char* incfilename = NULL);
|
||||||
extern void vwatch(uint32 linenumber, uint32 inclinenumber = 0, const char* incfilename = NULL);
|
|
||||||
|
|
||||||
extern "C" int qb64_custom_event(int event,int v1,int v2,int v3,int v4,int v5,int v6,int v7,int v8,void *p1,void *p2);
|
extern "C" int qb64_custom_event(int event,int v1,int v2,int v3,int v4,int v5,int v6,int v7,int v8,void *p1,void *p2);
|
||||||
#ifdef QB64_WINDOWS
|
#ifdef QB64_WINDOWS
|
||||||
|
|
|
@ -2062,10 +2062,6 @@ void evnt(uint32 linenumber, uint32 inclinenumber = 0, const char* incfilename =
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VWATCH
|
|
||||||
#include "vwatch.cpp"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8 *redim_preserve_cmem_buffer=(uint8*)malloc(65536);//used for temporary storage only (move to libqbx?)
|
uint8 *redim_preserve_cmem_buffer=(uint8*)malloc(65536);//used for temporary storage only (move to libqbx?)
|
||||||
|
|
||||||
#include "myip.cpp"
|
#include "myip.cpp"
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
void vwatch(uint32 linenumber, uint32 inclinenumber = 0, const char* incfilename = NULL) {
|
|
||||||
if (console) {
|
|
||||||
std::cout << linenumber << std::endl;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
|
@ -121,7 +121,7 @@ DIM SHARED viFileDescription$, viFileVersion$, viInternalName$
|
||||||
DIM SHARED viLegalCopyright$, viLegalTrademarks$, viOriginalFilename$
|
DIM SHARED viLegalCopyright$, viLegalTrademarks$, viOriginalFilename$
|
||||||
DIM SHARED viProductName$, viProductVersion$, viComments$, viWeb$
|
DIM SHARED viProductName$, viProductVersion$, viComments$, viWeb$
|
||||||
|
|
||||||
DIM SHARED NoChecks, vWatch
|
DIM SHARED NoChecks, vWatch, addingvWatch
|
||||||
|
|
||||||
DIM SHARED Console
|
DIM SHARED Console
|
||||||
DIM SHARED ScreenHide
|
DIM SHARED ScreenHide
|
||||||
|
@ -1377,6 +1377,7 @@ layout = ""
|
||||||
layoutok = 0
|
layoutok = 0
|
||||||
NoChecks = 0
|
NoChecks = 0
|
||||||
vWatch = 0
|
vWatch = 0
|
||||||
|
addingvWatch = 0
|
||||||
inclevel = 0
|
inclevel = 0
|
||||||
errorLineInInclude = 0
|
errorLineInInclude = 0
|
||||||
addmetainclude$ = ""
|
addmetainclude$ = ""
|
||||||
|
@ -1592,10 +1593,24 @@ DO
|
||||||
ideprepass:
|
ideprepass:
|
||||||
prepassLastLine:
|
prepassLastLine:
|
||||||
|
|
||||||
|
IF lastLine <> 0 OR firstLine <> 0 THEN
|
||||||
|
lineBackup$ = wholeline$ 'backup the real line (will be blank when lastline is set)
|
||||||
|
IF vWatch THEN
|
||||||
|
addingvWatch = 1
|
||||||
|
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch.bm"
|
||||||
|
ELSE
|
||||||
|
'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\embed\header_stub.bas"
|
||||||
|
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch_stub.bm"
|
||||||
|
END IF
|
||||||
|
firstLine = 0: lastLine = 0
|
||||||
|
GOTO forceInclude_prepass
|
||||||
|
forceIncludeCompleted_prepass:
|
||||||
|
addingvWatch = 0
|
||||||
|
wholeline$ = lineBackup$
|
||||||
|
END IF
|
||||||
|
|
||||||
wholestv$ = wholeline$ '### STEVE EDIT FOR CONST EXPANSION 10/11/2013
|
wholestv$ = wholeline$ '### STEVE EDIT FOR CONST EXPANSION 10/11/2013
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
prepass = 1
|
prepass = 1
|
||||||
layout = ""
|
layout = ""
|
||||||
layoutok = 0
|
layoutok = 0
|
||||||
|
@ -2600,11 +2615,24 @@ DO
|
||||||
IF Debug THEN PRINT #9, "Pre-pass:INCLUDE$-ing file:'" + addmetainclude$ + "':On line"; linenumber
|
IF Debug THEN PRINT #9, "Pre-pass:INCLUDE$-ing file:'" + addmetainclude$ + "':On line"; linenumber
|
||||||
a$ = addmetainclude$: addmetainclude$ = "" 'read/clear message
|
a$ = addmetainclude$: addmetainclude$ = "" 'read/clear message
|
||||||
|
|
||||||
|
IF inclevel = 0 THEN
|
||||||
|
includingFromRoot = 0
|
||||||
|
forceIncludingFile = 0
|
||||||
|
forceInclude_prepass:
|
||||||
|
IF forceIncludeFromRoot$ <> "" THEN
|
||||||
|
a$ = forceIncludeFromRoot$
|
||||||
|
forceIncludeFromRoot$ = ""
|
||||||
|
forceIncludingFile = 1
|
||||||
|
includingFromRoot = 1
|
||||||
|
END IF
|
||||||
|
END IF
|
||||||
|
|
||||||
IF inclevel = 100 THEN a$ = "Too many indwelling INCLUDE files": GOTO errmes
|
IF inclevel = 100 THEN a$ = "Too many indwelling INCLUDE files": GOTO errmes
|
||||||
'1. Verify file exists (location is either (a)relative to source file or (b)absolute)
|
'1. Verify file exists (location is either (a)relative to source file or (b)absolute)
|
||||||
fh = 99 + inclevel + 1
|
fh = 99 + inclevel + 1
|
||||||
|
|
||||||
firstTryMethod = 1
|
firstTryMethod = 1
|
||||||
|
IF includingFromRoot <> 0 AND inclevel = 0 THEN firstTryMethod = 2
|
||||||
FOR try = firstTryMethod TO 2 'if including file from root, do not attempt including from relative location
|
FOR try = firstTryMethod TO 2 'if including file from root, do not attempt including from relative location
|
||||||
IF try = 1 THEN
|
IF try = 1 THEN
|
||||||
IF inclevel = 0 THEN
|
IF inclevel = 0 THEN
|
||||||
|
@ -2666,6 +2694,10 @@ DO
|
||||||
'3. Close & return control
|
'3. Close & return control
|
||||||
CLOSE #fh
|
CLOSE #fh
|
||||||
inclevel = inclevel - 1
|
inclevel = inclevel - 1
|
||||||
|
IF forceIncludingFile = 1 AND inclevel = 0 THEN
|
||||||
|
forceIncludingFile = 0
|
||||||
|
GOTO forceIncludeCompleted_prepass
|
||||||
|
END IF
|
||||||
LOOP
|
LOOP
|
||||||
'(end manager)
|
'(end manager)
|
||||||
|
|
||||||
|
@ -2781,6 +2813,22 @@ DO
|
||||||
includeline:
|
includeline:
|
||||||
mainpassLastLine:
|
mainpassLastLine:
|
||||||
|
|
||||||
|
IF lastLine <> 0 OR firstLine <> 0 THEN
|
||||||
|
lineBackup$ = a3$ 'backup the real first line (will be blank when lastline is set)
|
||||||
|
IF vWatch THEN
|
||||||
|
addingvWatch = 1
|
||||||
|
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch.bm"
|
||||||
|
ELSE
|
||||||
|
'IF firstLine <> 0 THEN forceIncludeFromRoot$ = "source\embed\header_stub.bas"
|
||||||
|
IF lastLine <> 0 THEN forceIncludeFromRoot$ = "source\utilities\vwatch_stub.bm"
|
||||||
|
END IF
|
||||||
|
firstLine = 0: lastLine = 0
|
||||||
|
GOTO forceInclude
|
||||||
|
forceIncludeCompleted:
|
||||||
|
addingvWatch = 0
|
||||||
|
a3$ = lineBackup$
|
||||||
|
END IF
|
||||||
|
|
||||||
prepass = 0
|
prepass = 0
|
||||||
|
|
||||||
stringprocessinghappened = 0
|
stringprocessinghappened = 0
|
||||||
|
@ -3041,7 +3089,7 @@ DO
|
||||||
|
|
||||||
IF a3u$ = "$CHECKING:OFF" THEN
|
IF a3u$ = "$CHECKING:OFF" THEN
|
||||||
layout$ = SCase$("$Checking:Off")
|
layout$ = SCase$("$Checking:Off")
|
||||||
IF vWatch THEN
|
IF vWatch = 1 AND addingvWatch = 0 THEN
|
||||||
addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "$DEBUG is disabled in $CHECKING:OFF blocks", ""
|
addWarning linenumber, inclevel, inclinenumber(inclevel), incname$(inclevel), "$DEBUG is disabled in $CHECKING:OFF blocks", ""
|
||||||
END IF
|
END IF
|
||||||
NoChecks = 1
|
NoChecks = 1
|
||||||
|
@ -5458,7 +5506,7 @@ DO
|
||||||
IF stringprocessinghappened THEN e$ = cleanupstringprocessingcall$ + e$ + ")"
|
IF stringprocessinghappened THEN e$ = cleanupstringprocessingcall$ + e$ + ")"
|
||||||
IF (typ AND ISSTRING) THEN a$ = "WHILE ERROR! Cannot accept a STRING type.": GOTO errmes
|
IF (typ AND ISSTRING) THEN a$ = "WHILE ERROR! Cannot accept a STRING type.": GOTO errmes
|
||||||
IF NoChecks = 0 AND vWatch = 1 THEN
|
IF NoChecks = 0 AND vWatch = 1 THEN
|
||||||
PRINT #12, "vwatch(" + str2$(linenumber) + inclinenump$ + ");"
|
PRINT #12, "vwatch(" + str2$(linenumber) + ");"
|
||||||
END IF
|
END IF
|
||||||
PRINT #12, "while((" + e$ + ")||new_error){"
|
PRINT #12, "while((" + e$ + ")||new_error){"
|
||||||
ELSE
|
ELSE
|
||||||
|
@ -5520,7 +5568,7 @@ DO
|
||||||
ELSE
|
ELSE
|
||||||
controltype(controllevel) = 3
|
controltype(controllevel) = 3
|
||||||
IF vWatch THEN
|
IF vWatch THEN
|
||||||
PRINT #12, "do{vwatch(" + str2$(linenumber) + inclinenump$ + ");"
|
PRINT #12, "do{vwatch(" + str2$(linenumber) + ");"
|
||||||
ELSE
|
ELSE
|
||||||
PRINT #12, "do{"
|
PRINT #12, "do{"
|
||||||
END IF
|
END IF
|
||||||
|
@ -5558,7 +5606,7 @@ DO
|
||||||
PRINT #12, "dl_continue_" + str2$(controlid(controllevel)) + ":;"
|
PRINT #12, "dl_continue_" + str2$(controlid(controllevel)) + ":;"
|
||||||
|
|
||||||
IF NoChecks = 0 AND vWatch = 1 THEN
|
IF NoChecks = 0 AND vWatch = 1 THEN
|
||||||
PRINT #12, "vwatch(" + str2$(linenumber) + inclinenump$ + ");"
|
PRINT #12, "vwatch(" + str2$(linenumber) + ");"
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF controltype(controllevel) = 4 THEN
|
IF controltype(controllevel) = 4 THEN
|
||||||
|
@ -5711,7 +5759,7 @@ DO
|
||||||
IF Error_Happened THEN GOTO errmes
|
IF Error_Happened THEN GOTO errmes
|
||||||
|
|
||||||
IF NoChecks = 0 AND vWatch = 1 THEN
|
IF NoChecks = 0 AND vWatch = 1 THEN
|
||||||
PRINT #12, "vwatch(" + str2$(linenumber) + inclinenump$ + ");"
|
PRINT #12, "vwatch(" + str2$(linenumber) + ");"
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
PRINT #12, "fornext_step" + u$ + "=" + e$ + ";"
|
PRINT #12, "fornext_step" + u$ + "=" + e$ + ";"
|
||||||
|
@ -6344,7 +6392,7 @@ DO
|
||||||
|
|
||||||
IF NoChecks = 0 THEN
|
IF NoChecks = 0 THEN
|
||||||
IF vWatch THEN
|
IF vWatch THEN
|
||||||
PRINT #12, "do{vwatch(" + str2$(linenumber) + inclinenump$ + ");"
|
PRINT #12, "do{vwatch(" + str2$(linenumber) + ");"
|
||||||
ELSE
|
ELSE
|
||||||
PRINT #12, "do{"
|
PRINT #12, "do{"
|
||||||
END IF
|
END IF
|
||||||
|
@ -10974,11 +11022,24 @@ DO
|
||||||
|
|
||||||
a$ = addmetainclude$: addmetainclude$ = "" 'read/clear message
|
a$ = addmetainclude$: addmetainclude$ = "" 'read/clear message
|
||||||
|
|
||||||
|
IF inclevel = 0 THEN
|
||||||
|
includingFromRoot = 0
|
||||||
|
forceIncludingFile = 0
|
||||||
|
forceInclude:
|
||||||
|
IF forceIncludeFromRoot$ <> "" THEN
|
||||||
|
a$ = forceIncludeFromRoot$
|
||||||
|
forceIncludeFromRoot$ = ""
|
||||||
|
forceIncludingFile = 1
|
||||||
|
includingFromRoot = 1
|
||||||
|
END IF
|
||||||
|
END IF
|
||||||
|
|
||||||
IF inclevel = 100 THEN a$ = "Too many indwelling INCLUDE files": GOTO errmes
|
IF inclevel = 100 THEN a$ = "Too many indwelling INCLUDE files": GOTO errmes
|
||||||
'1. Verify file exists (location is either (a)relative to source file or (b)absolute)
|
'1. Verify file exists (location is either (a)relative to source file or (b)absolute)
|
||||||
fh = 99 + inclevel + 1
|
fh = 99 + inclevel + 1
|
||||||
|
|
||||||
firstTryMethod = 1
|
firstTryMethod = 1
|
||||||
|
IF includingFromRoot <> 0 AND inclevel = 0 THEN firstTryMethod = 2
|
||||||
FOR try = firstTryMethod TO 2 'if including file from root, do not attempt including from relative location
|
FOR try = firstTryMethod TO 2 'if including file from root, do not attempt including from relative location
|
||||||
IF try = 1 THEN
|
IF try = 1 THEN
|
||||||
IF inclevel = 0 THEN
|
IF inclevel = 0 THEN
|
||||||
|
@ -11035,6 +11096,10 @@ DO
|
||||||
CLOSE #fh
|
CLOSE #fh
|
||||||
inclevel = inclevel - 1
|
inclevel = inclevel - 1
|
||||||
IF inclevel = 0 THEN
|
IF inclevel = 0 THEN
|
||||||
|
IF forceIncludingFile = 1 THEN
|
||||||
|
forceIncludingFile = 0
|
||||||
|
GOTO forceIncludeCompleted
|
||||||
|
END IF
|
||||||
'restore line formatting
|
'restore line formatting
|
||||||
layoutok = layoutok_backup
|
layoutok = layoutok_backup
|
||||||
layout$ = layout_backup$
|
layout$ = layout_backup$
|
||||||
|
@ -12236,9 +12301,9 @@ IF DEPENDENCY(DEPENDENCY_ZLIB) THEN
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF vWatch THEN
|
'IF vWatch THEN
|
||||||
defines$ = defines$ + defines_header$ + "VWATCH"
|
' defines$ = defines$ + defines_header$ + "VWATCH"
|
||||||
END IF
|
'END IF
|
||||||
|
|
||||||
'finalize libs$ and defines$ strings
|
'finalize libs$ and defines$ strings
|
||||||
IF LEN(libs$) THEN libs$ = libs$ + " "
|
IF LEN(libs$) THEN libs$ = libs$ + " "
|
||||||
|
@ -13015,7 +13080,11 @@ errmes: 'set a$ to message
|
||||||
IF Error_Happened THEN a$ = Error_Message: Error_Happened = 0
|
IF Error_Happened THEN a$ = Error_Message: Error_Happened = 0
|
||||||
layout$ = "": layoutok = 0 'invalidate layout
|
layout$ = "": layoutok = 0 'invalidate layout
|
||||||
|
|
||||||
IF inclevel > 0 THEN a$ = a$ + incerror$
|
IF forceIncludingFile THEN 'If we're to the point where we're adding the automatic QB64 includes, we don't need to report the $INCLUDE information
|
||||||
|
IF INSTR(a$, "END SUB/FUNCTION before") THEN a$ = "SUB without END SUB" 'Just a simple rewrite of the error message to be less confusing for SUB/FUNCTIONs
|
||||||
|
ELSE 'We want to let the user know which module the error occurred in
|
||||||
|
IF inclevel > 0 THEN a$ = a$ + incerror$
|
||||||
|
END IF
|
||||||
|
|
||||||
IF idemode THEN
|
IF idemode THEN
|
||||||
ideerrorline = linenumber
|
ideerrorline = linenumber
|
||||||
|
|
43
source/utilities/vwatch.bm
Normal file
43
source/utilities/vwatch.bm
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
$CHECKING:OFF
|
||||||
|
SUB vwatch (linenumber AS LONG)
|
||||||
|
STATIC AS LONG ide, bypass
|
||||||
|
|
||||||
|
IF bypass THEN EXIT SUB
|
||||||
|
|
||||||
|
endc$ = "<END>"
|
||||||
|
|
||||||
|
IF ide = 0 THEN
|
||||||
|
ide = _OPENCLIENT("TCP/IP:9000:localhost")
|
||||||
|
IF ide = 0 THEN bypass = -1: EXIT SUB
|
||||||
|
|
||||||
|
me$ = COMMAND$(0) + endc$
|
||||||
|
PUT #ide, , me$
|
||||||
|
|
||||||
|
DO
|
||||||
|
GET #ide, , temp$
|
||||||
|
buffer$ = buffer$ + temp$
|
||||||
|
LOOP UNTIL INSTR(buffer$, endc$) > 0
|
||||||
|
|
||||||
|
buffer$ = LEFT$(buffer$, INSTR(buffer$, endc$) - 1)
|
||||||
|
IF buffer$ <> "vwatch:ok" THEN
|
||||||
|
CLOSE #ide
|
||||||
|
bypass = -1
|
||||||
|
EXIT SUB
|
||||||
|
END IF
|
||||||
|
END IF
|
||||||
|
|
||||||
|
DO
|
||||||
|
temp$ = "line number:" + MKL$(linenumber) + endc$
|
||||||
|
PUT #ide, , temp$
|
||||||
|
buffer$ = ""
|
||||||
|
DO
|
||||||
|
GET #ide, , temp$
|
||||||
|
buffer$ = buffer$ + temp$
|
||||||
|
LOOP UNTIL INSTR(buffer$, endc$) > 0
|
||||||
|
|
||||||
|
buffer$ = LEFT$(buffer$, INSTR(buffer$, endc$) - 1)
|
||||||
|
IF buffer$ = "run" THEN
|
||||||
|
EXIT SUB
|
||||||
|
END IF
|
||||||
|
LOOP
|
||||||
|
END SUB
|
2
source/utilities/vwatch_stub.bm
Normal file
2
source/utilities/vwatch_stub.bm
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
SUB vwatch
|
||||||
|
END SUB
|
Loading…
Reference in a new issue