- Aug
- 2,059
- 83
I thought I would try to create my own Gosub command, via a PureBasic created plugin.
Ref: How to? - Name of current running gosub routine?
Here's the PureBasic code for the Gosub replacement;
This works as it should,
that is,
it creates an internal variable,
_gosub,
to indicate the name of the subroutine.
The problem is,
if I change the name of the procedure to Gosub,
PureBasic will not let me compile the plugin,
as one cannot have a procedure with the same name as a PureBasic keyword.
Gosub is a PureBasic keyword.
Thus,
I am posting this mainly for my future reference,
but other plugin developers using PureBasic may find it of interest also.
Joe
Ref: How to? - Name of current running gosub routine?
Here's the PureBasic code for the Gosub replacement;
Code:
ProcedureDLL.i MyGosub(*lpszString)
Static theArg.s
theArg = PeekS(*lpszString)
theArg = Trim(theArg)
If Len(theArg) = 0
Command_("echo USAGE: Gosub label",0)
ProcedureReturn #Null
Else
Command_("set _gosub=" + theArg,0)
Command_("Gosub " + theArg,0)
EndIf
ProcedureReturn #Null
EndProcedure
This works as it should,
that is,
it creates an internal variable,
_gosub,
to indicate the name of the subroutine.
The problem is,
if I change the name of the procedure to Gosub,
PureBasic will not let me compile the plugin,
as one cannot have a procedure with the same name as a PureBasic keyword.
Gosub is a PureBasic keyword.
Thus,
I am posting this mainly for my future reference,
but other plugin developers using PureBasic may find it of interest also.
Joe