PDA

View Full Version : module maker test :)



Lionheart008
22-05-2010, 20:14
hi charles, some month ago I tested this module maker part with some problems, but now I have tried to use your oxygen module maker dll example again and it works. It was just an idea to proof it. thanks for your great work! :D

I've only add a lightspeed constant value. please see the curious result with odded nine numbers after the point ;)



'---------------------------
'thinBasic Modules in Oxygen
'===========================

'MODULE TESTING SCRIPT BY FRANK

Uses "x-men"
MsgBox 0,greet "2: welcome to all new mutants in our school :)", %MB_OK, "test OXYGEN x-men example"
MsgBox 0,"cube parameter result ^3: " + cubed 3, %MB_OK, "test OXYGEN x-men example"
MsgBox 0, "Light speed in a vacuum (m/sec): " + lightspeed, %MB_OK, "test OXYGEN x-men example"


all more in zip file.

best regards, frank

Charles Pegge
22-05-2010, 22:44
Hi Frank,
This should return LightSpeed correctly. Parameter e is parsed but is otherwise unused in the function.

Charles



'-----> frankos input--------------->
'Light_speed_in_a_vacuum_(m/sec) , "299792458"
'--------------------------------------------------
function lightspeed alias `lightspeed` () as ext external
'==================================================

dim As Long ParensPresent
ParensPresent = thinBasic_CheckOpenParens_Optional
dim as ext e,lightspeed
lightspeed = 299792458
thinBasic_parseNumber(e)
If ParensPresent Then thinBasic_CheckCloseParens_Mandatory
function = lightspeed
end function
'-----> frankos input--------------->

Lionheart008
25-05-2010, 19:57
hi charles, can you check my new example please ?



'---------------------------
'thinBasic Modules in Oxygen
'===========================

'MODULE TESTING SCRIPT BY FRANK

1) thinbasic test part

Uses "x-men"
MsgBox 0,greet "2: welcome to all new mutants in our school :)", %MB_OK, "test OXYGEN x-men example"
MsgBox 0,"cube parameter result ^3: " + cubed 3, %MB_OK, "test OXYGEN x-men example"
MsgBox 0, "Light speed in a vacuum (m/sec): " + lightspeed, %MB_OK, "test OXYGEN x-men example"
MsgBox 0, Str$(lightspeed)
MsgBox 0, lightspeed
'299792458.000010897
'299792458.00003
'299792458.000003815

2. module maker dll part:


'Light_speed_in_a_vacuum_(m/sec) , "299792458"
'--------------------------------------------------
function lightspeed alias `lightspeed` () as ext external
'==================================================

dim As Long ParensPresent
ParensPresent = thinBasic_CheckOpenParens_Optional
dim lightspeed as ext
lightspeed = 299792458
'thinBasic_parseNumber(e)
thinBasic_parseNumber(lightspeed)
If ParensPresent Then thinBasic_CheckCloseParens_Mandatory
function = lightspeed
end function
'-----> frankos input--------------->


my three results you can see above. something wrong with "ext" ?

all again in zip folder.

nice day, servus, frank

Charles Pegge
25-05-2010, 20:52
Sorry Frank, I do not understand what your code is trying to do. Why are you passing a parameter when calling the Lightspeed function?

Charles

Lionheart008
26-05-2010, 07:43
hello charles, the problem of parsing belongs to the numbers with the lines

"dim lightspeed, v as ext"


'Light_speed_in_a_vacuum_(m/sec) , "299792458"
'--------------------------------------------------
function lightspeed alias `lightspeed` () as ext external
'==================================================

dim As Long ParensPresent
ParensPresent = thinBasic_CheckOpenParens_Optional
dim lightspeed, v as ext
lightspeed = 299792458
thinBasic_parseNumber(lightspeed)
If ParensPresent Then thinBasic_CheckCloseParens_Mandatory
function = lightspeed
end function
'-----> frankos input--------------->


parsing part: If I only using one number (dim lightspeed as ext) the result for lightspeed is incorrect as you can see in my last post. If I am using two numbers (here: dim lightspeed, e as ext) the result for lightspeed is correct. that was the main reason for confusing me. perhaps something incorrect for parsing parameters with oxygen, don't know, it was only a test.

best regards, frank

Charles Pegge
26-05-2010, 08:57
Hi Frank,

Try removing this line in your function:



thinBasic_parseNumber(lightspeed)


You then have a function that takes no parameters and simply returns LightSpeed.

Charles