|
Post by MUEH on Sept 17, 2016 13:49:06 GMT -5
SPFLite has encountered an execution exception (C0000005)
Last Interactions were:
KB Primitive: ENTER
Line Cmnd:
Primary Cmnd: res
Module Back Trace:
05 | XREBUILD
04 | DISPSCREEN
03 | PCMDMACRO
02 | CMDASSIGN
01 | POSTKEYBOARD
00 | MAINDKEYPROCESS
Note: A copy of this message is in: C:\Users\MUEH\Documents\SPFLi84\SPFLiteCrash.2016091720205879.txt
following macro is ued to excute SPF_CMD ' MUSUB1.MACRO
dim lptr as number value 0
dim lcmd as string
lptr = Get_Csr_Lptr
if "scmd:" = mid$(Get_Line$(lptr),1,5) then
lcmd = mid$(Get_Line$(lptr),6,len(Get_Line$(lptr))-5)
SPF_CMD(lcmd)
Set_Msg(lcmd,len(lcmd))
SET_CSR(lptr+1,1,0)
endif
Here the data to step through the cmd's starting at line 17 with pfk assignet to above macro ' MUNUM.macro 00100000
/* Sequence Numbers are set at tocol for NX Lines 00200000
Syntax: MUNUM tocol [startnr][incr][length]
Example: MUNUM 80 nr is set at col 80 and before
MUNUM 73 100 100 8 seq nr set with leading zeroes from col 73 with length 8
MUNUM 73 -1 10 8 seq nr set in blank area startnr taken from previous NX line (zero if not numeric)
MUNUM XS 73 eXclude Smaler line than 73 (needed to select Line for Numbering)
scmd:res;munum 73 -1 100 8;x all;show '0' 80 all;munum 80;res cut and Ctrl+V to cmd line (unpredictable result if clipboard > 83 bytes)
res; works
res; fails
Ctrl-HOME <Exec_Cmd>(SaveCursor)(LineNO)[C](Home)[CUT](Enter)(PASTE)(Enter)(RestoreCursor)
define above KEY to exec following cmd (if no leading ; first command ignored. Use res ignored to keep X Lines)
;res;munum XS 73;x "0" 80 all;x " " 73 all;flip all
res;munum 73 -1 100 8;x all;show '0' 80 all;munum 80;res
;x all;show '0' 80 all;show C' ' 73 all
sleep 0 looploop for use with MUSUB macro
scmd:res
scmd:x .30 .40
scmd:res
scmd:x .24 .ZL
scmd:show '0' 80 all
scmd:res;x all;show '0' 80 all
goto:looploop
scmd:can
scmd:res;x all;show '0' 80 all SPF_CMD doesn't exec macros (recursive ThinBasic call) and multiple cmd's crash
Author: Johann Muehlhofer 00300000
*/
dim i, ip, GA1, GA2, GA3, GA4 as number value 0
dim lid as string
if Get_Arg_count > 4 then halt(fail, "Arg Count > 4")
if Get_Arg_count < 1 then halt(fail, "Arg Count < 1")
'--------------------------------------------------------------------------------------------------XS
if Get_Arg$(1) = "XS" then
GA2 = Get_Arg$(2)
for i = 1 to Get_Last_LPtr
if len(Get_Line$(Get_LPtr(i))) < GA2 then
SPF_Cmd("X ."+ltrim$(str$(i)))
Set_Msg(0,i,ip,Get_Last_LPtr,str$(Get_LPtr(i)),"X ."+str$(i))
incr ip
endif
next
else
'--------------------------------------------------------------------------------------------------XS End
GA1 = Get_Arg$(1)
if GA1 < 1 then halt(fail, "tocol < 1")
if Get_Arg_count > 1 then
GA2 = Get_Arg$(2)
else
GA2 = 1
endif
if Get_Arg_count > 2 then
GA3 = Get_Arg$(3)
else
GA3 = GA2
endif
if Get_Arg_count > 3 then GA4 = Get_Arg$(4)
'--------------------------------------------------------------------------------------------------StNr Prev
IF GA2 = -1 then
for i = 2 to Get_Last_LPtr
IF Is_Data(i) and not Is_XLine(i) then
if len(Get_Line$(i)) < GA1+GA4-1 or mid$(Get_Line$(i),GA1,GA4) = string$(GA4," ") then
for ip = 1 to i ' 00400000
IF Is_Data(i-ip) and not Is_XLine(i-ip) then
GA2 = val(mid$(Get_Line$(i-ip),GA1,GA4))
exit for
ENDIF
next
lid = format$(GA2+GA3,string$(GA4,"0"))
SPF_REP(i,GA1,lid)
endif
ENDIF
next
'--------------------------------------------------------------------------------------------------StNr Parm
ELSE
for i = 1 to Get_Last_LPtr
IF Is_Data(i) and not Is_XLine(i) then
if Get_Arg_Count = 4 then
lid = format$(GA2,string$(GA4,"0"))
SPF_REP(i,GA1,lid)
else
SPF_REP(i,GA1+1-len(GA2),GA2)
endif
GA2 = GA2+GA3
ENDIF
next
ENDIF
endif
Problem is nearly Permanent Reproducable . If not restart SPFLite again . MUNUM macro might be usable for RENUM request . Thanks
|
|
|
Post by MUEH on Sept 18, 2016 6:35:47 GMT -5
Problem occures in latest 8.2 8.3 8.4 Release but i can't reproduce it in 8.1.5002 . Replace Set_Msg in MUSUB1 Macro with Set_Msg(0,Get_Msg$,Get_RC,lcmd,len(lcmd)) to get better msg's . no Problem if cmd's executed in command line .
|
|
|
Post by George on Sept 18, 2016 10:48:03 GMT -5
MUEH:
Could you perhaps edit your post and re-insert the sample code using the code bracketing formatter so we don't lose the indenting, it's very hard to follow unindented code. Use the Icon that looks like a square with a C in the middle.
I'll look at it again then, but right now it appears you are using a macro to use SPF_CMD to execute another macro. And since I don't see any checking following SPF_CMD to see if it worked/failed, whatever you do following is probably dependent on that command and will now probably fail as well.
Basically macros cannot invoke other macros. Sorry. If they try, SPF_CMD returns an appropriate Error code and message.
George
|
|
|
Post by MUEH on Sept 18, 2016 11:29:01 GMT -5
Here the MUSUB1 macro ' MUSUB1.MACRO dim lptr as number value 0 dim lcmd as string lptr = Get_Csr_Lptr if "scmd:" = mid$(Get_Line$(lptr),1,5) then lcmd = mid$(Get_Line$(lptr),6,len(Get_Line$(lptr))-5) SPF_CMD(lcmd) Set_Msg(0,Get_Msg$,Get_RC,lcmd,len(lcmd)) SET_CSR(lptr+1,1,0) endif
Execute MUSUB1 macro with cursor on line 17 then again at 18 and 19 to the following data file which created the crash ' MUNUM.macro 00100000 /* Sequence Numbers are set at tocol for NX Lines 00200000 Syntax: MUNUM tocol [startnr][incr][length] Example: MUNUM 80 nr is set at col 80 and before MUNUM 73 100 100 8 seq nr set with leading zeroes from col 73 with length 8 MUNUM 73 -1 10 8 seq nr set in blank area startnr taken from previous NX line (zero if not numeric) MUNUM XS 73 eXclude Smaler line than 73 (needed to select Line for Numbering) scmd:res;munum 73 -1 100 8;x all;show '0' 80 all;munum 80;res cut and Ctrl+V to cmd line (unpredictable result if clipboard > 83 bytes) res; works res; fails Ctrl-HOME <Exec_Cmd>(SaveCursor)(LineNO)[C](Home)[CUT](Enter)(PASTE)(Enter)(RestoreCursor) define above KEY to exec following cmd (if no leading ; first command ignored. Use res ignored to keep X Lines) Note:clipboard name can't be used because (PASTE) is needed ;res;munum XS 73;x "0" 80 all;x " " 73 all;flip all res;munum 73 -1 100 8;x all;show '0' 80 all;munum 80;res ;x all;show '0' 80 all;show C' ' 73 all sleep 0 looploop for use with MUSUB macro scmd:res scmd:x .40 .50 scmd:res scmd:x .29 .ZL scmd:show '0' 80 all scmd:;res;x all;show '0' 80 all goto:looploop scmd:MUNUM XS 73 scmd:can scmd:res;x all;show '0' 80 all SPF_CMD doesn't exec macros (recursive ThinBasic call) and multiple cmd's don't work Get_Msg$ shows Already in macro mode, no nesting of macros supported Unknown command: xxxxxx for multi cmd's Author: Johann Muehlhofer 00300000 */ dim i, ip, GA1, GA2, GA3, GA4 as number value 0 dim lid as string if Get_Arg_count > 4 then halt(fail, "Arg Count > 4") if Get_Arg_count < 1 then halt(fail, "Arg Count < 1") '--------------------------------------------------------------------------------------------------XS if Get_Arg$(1) = "XS" then GA2 = Get_Arg$(2) for i = 1 to Get_Last_LPtr if len(Get_Line$(Get_LPtr(i))) < GA2 then SPF_Cmd("X ."+ltrim$(str$(i))) Set_Msg(0,i,ip,Get_Last_LPtr,str$(Get_LPtr(i)),"X ."+str$(i)) incr ip endif next else '--------------------------------------------------------------------------------------------------XS End GA1 = Get_Arg$(1) if GA1 < 1 then halt(fail, "tocol < 1") if Get_Arg_count > 1 then GA2 = Get_Arg$(2) else GA2 = 1 endif if Get_Arg_count > 2 then GA3 = Get_Arg$(3) else GA3 = GA2 endif if Get_Arg_count > 3 then GA4 = Get_Arg$(4) '--------------------------------------------------------------------------------------------------StNr Prev IF GA2 = -1 then for i = 2 to Get_Last_LPtr IF Is_Data(i) and not Is_XLine(i) then if len(Get_Line$(i)) < GA1+GA4-1 or mid$(Get_Line$(i),GA1,GA4) = string$(GA4," ") then for ip = 1 to i ' 00400000 IF Is_Data(i-ip) and not Is_XLine(i-ip) then GA2 = val(mid$(Get_Line$(i-ip),GA1,GA4)) exit for ENDIF next lid = format$(GA2+GA3,string$(GA4,"0")) SPF_REP(i,GA1,lid) endif ENDIF next '--------------------------------------------------------------------------------------------------StNr Parm ELSE for i = 1 to Get_Last_LPtr IF Is_Data(i) and not Is_XLine(i) then if Get_Arg_Count = 4 then lid = format$(GA2,string$(GA4,"0")) SPF_REP(i,GA1,lid) else SPF_REP(i,GA1+1-len(GA2),GA2) endif GA2 = GA2+GA3 ENDIF next ENDIF endif
Thanks !
|
|
|
Post by George on Sept 18, 2016 11:53:56 GMT -5
MUEH: Still no indenting ?? Did you use the [C] Icon? Or do you not use indentation (hard to believe)
Don't use Quick reply itself, you won't see the formatting options. Use the REPLY button on the right of the quick reply box.
It should look like
Code line Code line Code line end end end
George
|
|
|
Post by MUEH on Sept 18, 2016 12:24:16 GMT -5
' MUNUM.macro 00100000
/* Sequence Numbers are set at tocol for NX Lines 00200000
Syntax: MUNUM tocol [startnr][incr][length]
Example: MUNUM 80 nr is set at col 80 and before
MUNUM 73 100 100 8 seq nr set with leading zeroes from col 73 with length 8
MUNUM 73 -1 10 8 seq nr set in blank area startnr taken from previous NX line (zero if not numeric)
MUNUM XS 73 eXclude Smaler line than 73 (needed to select Line for Numbering)
scmd:res;munum 73 -1 100 8;x all;show '0' 80 all;munum 80;res cut and Ctrl+V to cmd line (unpredictable result if clipboard > 83 bytes)
res; works
res; fails
Ctrl-HOME <Exec_Cmd>(SaveCursor)(LineNO)[C](Home)[CUT](Enter)(PASTE)(Enter)(RestoreCursor)
define above KEY to exec following cmd (if no leading ; first command ignored. Use res ignored to keep X Lines) Note:clipboard name can't be used because (PASTE) is needed
;res;munum XS 73;x "0" 80 all;x " " 73 all;flip all
res;munum 73 -1 100 8;x all;show '0' 80 all;munum 80;res
;x all;show '0' 80 all;show C' ' 73 all
sleep 0 looploop for use with MUSUB macro
scmd:res
scmd:x .40 .50
scmd:res
scmd:x .29 .ZL
scmd:show '0' 80 all
scmd:;res;x all;show '0' 80 all
goto:looploop
scmd:MUNUM XS 73
scmd:can
scmd:res;x all;show '0' 80 all SPF_CMD doesn't exec macros (recursive ThinBasic call) and multiple cmd's don't work
Get_Msg$ shows Already in macro mode, no nesting of macros supported Unknown command: xxxxxx for multi cmd's
Author: Johann Muehlhofer 00300000
*/
dim i, ip, GA1, GA2, GA3, GA4 as number value 0
dim lid as string
if Get_Arg_count > 4 then halt(fail, "Arg Count > 4")
if Get_Arg_count < 1 then halt(fail, "Arg Count < 1")
'--------------------------------------------------------------------------------------------------XS
if Get_Arg$(1) = "XS" then
GA2 = Get_Arg$(2)
for i = 1 to Get_Last_LPtr
if len(Get_Line$(Get_LPtr(i))) < GA2 then
SPF_Cmd("X ."+ltrim$(str$(i)))
Set_Msg(0,i,ip,Get_Last_LPtr,str$(Get_LPtr(i)),"X ."+str$(i))
incr ip
endif
next
else
'--------------------------------------------------------------------------------------------------XS End
GA1 = Get_Arg$(1)
if GA1 < 1 then halt(fail, "tocol < 1")
if Get_Arg_count > 1 then
GA2 = Get_Arg$(2)
else
GA2 = 1
endif
if Get_Arg_count > 2 then
GA3 = Get_Arg$(3)
else
GA3 = GA2
endif
if Get_Arg_count > 3 then GA4 = Get_Arg$(4)
'--------------------------------------------------------------------------------------------------StNr Prev
IF GA2 = -1 then
for i = 2 to Get_Last_LPtr
IF Is_Data(i) and not Is_XLine(i) then
if len(Get_Line$(i)) < GA1+GA4-1 or mid$(Get_Line$(i),GA1,GA4) = string$(GA4," ") then
for ip = 1 to i ' 00400000
IF Is_Data(i-ip) and not Is_XLine(i-ip) then
GA2 = val(mid$(Get_Line$(i-ip),GA1,GA4))
exit for
ENDIF
next
lid = format$(GA2+GA3,string$(GA4,"0"))
SPF_REP(i,GA1,lid)
endif
ENDIF
next
'--------------------------------------------------------------------------------------------------StNr Parm
ELSE
for i = 1 to Get_Last_LPtr
IF Is_Data(i) and not Is_XLine(i) then
if Get_Arg_Count = 4 then
lid = format$(GA2,string$(GA4,"0"))
SPF_REP(i,GA1,lid)
else
SPF_REP(i,GA1+1-len(GA2),GA2)
endif
GA2 = GA2+GA3
ENDIF
next
ENDIF
endif
here the MUSUB1 macro to execute with cursor on line 17 to 19 of abaove data .
' MUSUB1.MACRO
dim lptr as number value 0
dim lcmd as string
lptr = Get_Csr_Lptr
if "scmd:" = mid$(Get_Line$(lptr),1,5) then
lcmd = mid$(Get_Line$(lptr),6,len(Get_Line$(lptr))-5)
SPF_CMD(lcmd)
Set_Msg(0,Get_Msg$,Get_RC,lcmd,len(lcmd))
SET_CSR(lptr+1,1,0)
endif
Hope it's now in correct format . Thanks
|
|
|
Post by George on Sept 18, 2016 14:13:46 GMT -5
MUEH: Much more readable, many thanks. Anytime code is provided using [C] makes everyone else's review of it a lot easier.
But you've run into two main problems.
SPF_CMD is NOT simply the normal command line, it executes ONE Primary command at a time. (Think of the problem returning multiple Return Code / Messages for each command in a multi command string)
Second, you cannot nest macros, so your technique of using scmd: to invoke commands and macros also will not work. (Nice try though!)
Robert and I are currently working on providing proper NUMBER/RENUM support, so you may want to consider hanging in a bit to see what we come up with.
George
|
|
|
Post by MUEH on Sept 19, 2016 2:24:39 GMT -5
I'm not concerned about the 2 Main Problem's you mention . They are solved by defining above Ctrl-Home key . What bothers me is the crash on RES after X when issued by SPF_Cmd . Occures also if f.e FIND on X lines is between .
|
|
|
Post by MUEH on Sept 19, 2016 8:39:08 GMT -5
Thinking about Ctrl-HOME <Exec_Cmd>(SaveCursor)(LineNO)[C](Home)[CUT](Enter)(PASTE)(Enter)(RestoreCursor) Ctrl-Home Limits: Destroys windows clipboard (PASTE) is needed. Cursor can't be positioned to next line scmd solution pros: Automatic step through can be done with goto: gsub: . X lines can be ignored by MSUB macro scmd Limits: no Macros and Multiple Cmd's can be executed . CAN UNDO KEYS RC OPEN EDIT VIEW f.e. not allowed Prefered Solution: SCMD with SPF_Cmd or Set_Line(-1,data-str) in Macro allow placing data to Command Line. Enter can then be done on keyboard In addition of fixing crash Would it be possible to make SET_Line Enhancement to place data-str into Command Line ?
|
|
|
Post by George on Sept 19, 2016 11:33:40 GMT -5
MUEH: I tried youe Ctrl-Home KB macro. Seems to work fine. Or is the fact it uses the Windows clipboard the problem? If so change it to
<Exec_Cmd>(SaveCursor)(LineNO)[C](Home)[CUT TEMP](Enter)(PASTE/TEMP)(Enter)(RestoreCursor)
to use a private clipboard rather than the windows clipboard.
For the next release, I've altered Set_Line() so a line number of 0 will specify the command line, but I'm not sure how useful it will be. I tested it and the string gets to the command line properly, but if you intend to leave the data on the command line on macro exit, that won't work. The normal command processing clears the command line after a macro completion to remove the macro command itself.
The RESET from a macro does have some kind of problem. I'll chase it down.
George
[UPDATE] RESET bug found. Corrected in the next release.
|
|
|
Post by MUEH on Sept 21, 2016 14:04:42 GMT -5
Thanks George for hint how clipboard name can be used . Just for your information how i solved Cursor positioning to next line .
Ctrl-HOME <Exec_Cmd>(SaveCursor)(LineNO)[C](Home)(EraseEOL)[CUT TEMP](Enter)(Enter)(PASTE/TEMP)(RestoreCursor)(Enter)
this allows to excute following concatenated commands and macros just by pressing Ctrl-Home
<span style="font-family: "courier new"; font-size: 10pt;">;MC CS;munum XS 73;x "0" 80 all;x " " 76 all;flip all;MC CR
;MC CS;munum 73 -1 100 8;x all;show '0' 80 all;munum 80;res;MC CR
;MC CS;undo;MC CR
;MC CS;x all;show '7' 80 all;show C' ' 73 all;MC CR
</span> The MC (previously named MUSUB1) macro saves cursor and restores it back .
' MC.MACRO
dim lptr as number value 0
dim lcmd as string
lptr = Get_Csr_Lptr
if Get_Arg_count = 1 then
IF Get_Arg$(1) = "CS" then
lptr = Get_LNum(lptr)
Set_Gbl_Num("MUSUCSR",lptr)
Set_Msg(0,"MUSUCSR=",Get_Gbl_Num("MUSUCSR"))
ENDIF
IF Get_Arg$(1) = "CR" then
SET_CSR(Get_LPtr(Get_Gbl_Num("MUSUCSR"))+1,1,0)
Set_Msg(0,"MUSUCSR=",Get_Gbl_Num("MUSUCSR"))
ENDIF
else
lptr = Get_Csr_Lptr
if "scmd:" = mid$(Get_Line$(lptr),1,5) or ";" = mid$(Get_Line$(lptr),1,1) then
IF "scmd:" = mid$(Get_Line$(lptr),1,5) then
lcmd = mid$(Get_Line$(lptr),6,len(Get_Line$(lptr))-5)
SPF_CMD(lcmd)
Set_Msg(0,Get_Msg$,Get_RC,lcmd,len(lcmd))
ELSE
if instr(-1,Get_Line$(lptr),";") = 1 then
lcmd = mid$(Get_Line$(lptr),2,len(Get_Line$(lptr))-1)
SPF_CMD(lcmd)
Set_Msg(0,Get_Msg$,Get_RC,lcmd,len(lcmd))
else
Set_Msg(4,"Stopped due to ;Multi Cmd Use Ctrl+Home",lcmd,len(lcmd))
lptr = lptr-1
endif
ENDIF
endif
SET_CSR(lptr+1,1,0)
endif
I'm now hapy as it works . Just for info if you want to fix another problem . lcmd = Request_Label$(lptr)
results in Macro LOOP Intercept if lptr has no Label assigned . Thanks
|
|
|
Post by George on Sept 21, 2016 14:25:49 GMT -5
MUEH: The error in Request_Label$() has been corrected. (next release).
Don't forget that Request_Label$() will return a label whether or not an existing label exists. If there is no existing label, a temporary label of the format ._XXXX will be created and returned.
George
|
|