Petr Schreiber
16-02-2010, 12:15
Hi guys,
I have one mad idea, which could solve 2 problems at the same time:
* problem #1, some errors at run time occur, because functions have wrong number of parameters, but currently thinBasic engine has no chance to detect it
* problem #2, where to take description for code tips?
The possible solution -> adding one more (optional) parameter to the thinBasic_LoadSymbol function, which would be string, specifying some kind of mask for the parameters function can use.
Simple example:
thinBasic_LoadSymbol "TBGL_Vertex", _
%thinBasic_ReturnNone, _
CODEPTR( Exec_TBGL_Vertex ), _
%thinBasic_ForceOverWrite, _
"(x,y,z)"
The last parameter as a whole can directly serve as help for code tips.
For checking, you can easily recognize the parameters should start with (, then 2 commas, then ).
In case of optional parameters, they would be indicated like in help file:
thinBasic_LoadSymbol "SomeFunction", _
%thinBasic_ReturnNone, _
CODEPTR( Exec_SomeFunction ), _
%thinBasic_ForceOverWrite, _
"(x,y[,z])"
This can again be used both by code tips and for syntax check at the time before parsing.
This is just idea for future, I don't need it currently, but wanted to let you know about it, and possibly discuss the problems of this solution.
Regarding the parameter description, instead of just "x" in above example, some special characters could be added to add more info for use with code tips:
thinBasic_LoadSymbol "SomeFunction", _
%thinBasic_ReturnNone, _
CODEPTR( Exec_SomeFunction ), _
%thinBasic_ForceOverWrite, _
"(x?X coordinate,y?Y coordinate[,z?Z coordinate])"
or to not bloat module, just command TB to seek for more info in help files automatically:
thinBasic_LoadSymbol "SomeFunction", _
%thinBasic_ReturnNone, _
CODEPTR( Exec_SomeFunction ), _
%thinBasic_ForceOverWrite, _
"(x,y[,z])@HELPFILE:thinbasic_tbgl.chm@"
Petr
I have one mad idea, which could solve 2 problems at the same time:
* problem #1, some errors at run time occur, because functions have wrong number of parameters, but currently thinBasic engine has no chance to detect it
* problem #2, where to take description for code tips?
The possible solution -> adding one more (optional) parameter to the thinBasic_LoadSymbol function, which would be string, specifying some kind of mask for the parameters function can use.
Simple example:
thinBasic_LoadSymbol "TBGL_Vertex", _
%thinBasic_ReturnNone, _
CODEPTR( Exec_TBGL_Vertex ), _
%thinBasic_ForceOverWrite, _
"(x,y,z)"
The last parameter as a whole can directly serve as help for code tips.
For checking, you can easily recognize the parameters should start with (, then 2 commas, then ).
In case of optional parameters, they would be indicated like in help file:
thinBasic_LoadSymbol "SomeFunction", _
%thinBasic_ReturnNone, _
CODEPTR( Exec_SomeFunction ), _
%thinBasic_ForceOverWrite, _
"(x,y[,z])"
This can again be used both by code tips and for syntax check at the time before parsing.
This is just idea for future, I don't need it currently, but wanted to let you know about it, and possibly discuss the problems of this solution.
Regarding the parameter description, instead of just "x" in above example, some special characters could be added to add more info for use with code tips:
thinBasic_LoadSymbol "SomeFunction", _
%thinBasic_ReturnNone, _
CODEPTR( Exec_SomeFunction ), _
%thinBasic_ForceOverWrite, _
"(x?X coordinate,y?Y coordinate[,z?Z coordinate])"
or to not bloat module, just command TB to seek for more info in help files automatically:
thinBasic_LoadSymbol "SomeFunction", _
%thinBasic_ReturnNone, _
CODEPTR( Exec_SomeFunction ), _
%thinBasic_ForceOverWrite, _
"(x,y[,z])@HELPFILE:thinbasic_tbgl.chm@"
Petr