PDA

View Full Version : thinBasic_ParseString problem



Petr Schreiber
19-09-2005, 15:07
Hi,

the SDK for thinBASIC is great, but I have troubles with using thinBasic_ParseString statement. The DLL is compiled without problems, but it seems, that it captures null-lenght string...



FUNCTION Exec_DemoFnc() AS EXT
LOCAL dName AS STRING , ldName AS STRING

IF thinBasic_CheckOpenParens() THEN
thinBasic_ParseString dName
IF thinBasic_CheckCloseParens() THEN
dName = ldName
MSGBOX dname+ldName ' displays nothing
FUNCTION = 0
END IF
END IF


END FUNCTION


Any ideas?

ErosOlmi
19-09-2005, 15:28
The line "dName = ldName" will clear whatever string you parse because ldName is empty.

So you should blank "dName = ldName" line.
Also why are you declaring ldName variable if you do not use it?
Or maybe it is the other way round: ldName = dName



FUNCTION Exec_DemoFnc() AS EXT
LOCAL dName AS STRING , ldName AS STRING

IF thinBasic_CheckOpenParens() THEN
thinBasic_ParseString dName
IF thinBasic_CheckCloseParens() THEN
MSGBOX dname
FUNCTION = 0
END IF
END IF
END FUNCTION

Petr Schreiber
19-09-2005, 15:31
:oops: Such a silly bug

Sorry, I had mixed it all in my head :)

Thanks,
Psch

ErosOlmi
19-09-2005, 16:53
When you will have time, tell me how is going on.
I need to have some feedback on:
[list] is it too much complicated?
are features missing?
We already know about passing parameters BYREF, quite complicated in current development status. First we will have to add this feature in standard user defined functions.
any suggestion?[/list:u]
Thanks
Eros

Petr Schreiber
19-09-2005, 17:12
Hi,



is it too much complicated?


No, it isn't :) I like the concept. I was just thinking about simplification of IF/THEN/ENDIF nesting while testing params to something like:


IF thinbasic_paramsok("(VVSV)", var1, var2, string1, var3) THEN

<CODE IF PARAMS OK>

END IF


The first parameter is "mask" of parameters, where "()" means open/close parenthesis, "V" means value and "S" means string; the next parameters are variables, to which the params would be stored.

But I think that way would be too unpractical/unapplicable for functions with optional params :(

That's all for now :)

Psch

ErosOlmi
19-09-2005, 17:42
Well, can be an idea but the problem is the sequence of the variables.
I mean if the sequence is SSVV or VSVS or SV or VS how can I declare loacl internal variable or how can I call "thinbasic_paramsok" with all possible sequence of cases and types?

Maybe AS ANY passing pointers to something?

I will think about it.

Thanks
Eros

Petr Schreiber
19-09-2005, 18:19
Maybe it could be done with VARIANTs. But this is wrong way I think, the current style would be still better in terms of speed

Let it be :)

Thanks,
Psch

ErosOlmi
19-09-2005, 18:27
I would like to use VARIANTs too but in PB VARIANTs are only introduced to be managed by COM interfaces. If you use VARIANTs not for that purpose you will quite soon get troubles. At least this was my experience. I think PB has to improve VARIANTs type a bit more in order to be used as standard variable.

Anyway I will take into consideration that option :lol:
For the moment I will leave current SDK style.