English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 12 July 2020, 11:01   #1
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
[blitz] CxBroker_() - could be broken?

Hi,
the listing below adds an entry to Exchange program...


But...
the result is shown below

- no name, title, and description is broken
moreover, looks like attached msg port (to the broker) is not getting anything - The program should be terminated whenever a message comes in (e.g. by pressing any of the "command" gadgets in Exchange). .. but it is not...

Is it something wrong in my code or there is a chance that CxBroker_() in Blitz is broken?

Thanks


edit
there is a typo in the listing in the WAIT_(...) line
"cxmax" should read "cxmask"
I fixed that already but still no messages are comming.

Last edited by peceha; 12 July 2020 at 11:10.
peceha is offline  
Old 12 July 2020, 11:55   #2
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,987
CxBroker_ obviously cannot be broken because all that fails are the strings and CxBroker_ does not do anything with the strings. It just takes the pointer to the NewBroker structure and forwards it to the system's CxBroker function.

Apparently your NewBroker structure is not filled in correctly. The nb_Name, nb_Title and nb_Descr fields need to be pointers to characters. So I ask you because I don't know Blitz Basic, is &nb_name$ the right way to get a pointer to where the characters are in the string. For me this looks like nb_name$ is a pointer to the string and &nb_name$ becomes a pointer to a pointer.

The other idea is: how long to strings live in Blitz Basic? Is there something like local variables which disappear when the subroutine exits? The strings in the NewBroker structures are not copied by the system, so they need to stay alive as long as the commodity is living.


Oh, and you don't any messages because you wait for cxmax rather than cxmask. Assuming that uninitialised variables are 0, it won't wait for anything but Ctrl-C.

And even if you get one message, you'll never get another one because you never do ReplyMsg.

Last edited by thomas; 12 July 2020 at 12:02.
thomas is offline  
Old 12 July 2020, 12:19   #3
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Hi,
I've been playing with blitz and system commands for some time already and figured out most of the tricks when passing pointers and so on
So yes, if s$ is a string then &s$ is a pointer to it.
I'm aware about the strings not being copied into the structures so these strings are left untouched trough whole program.

By "broken CxBroker" I meant something wrong inside blitz wraper .

In autodocs I found that nb_Version MUST be set to #NB_VERSION
And since there is an error code if nb_Version is unknown - I tried nb_Version = -99 and a pointer in CxBroker's second argument - hoping for some clues.. but still nothing

That is why I suspect that blitz version of CxBroker_ is not passing broker structure at all.

About a cxmax / cxmask - I fixed that already

Thanks



edit
I just commented out the whole nb structure so it means all its fields are zeroed and started the program - there is only one different: description of the program in Exchange window is now empty...

and just to be sure I passed the strings without & - still the same

Last edited by peceha; 12 July 2020 at 12:34.
peceha is offline  
Old 12 July 2020, 13:00   #4
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,987
You are right, CxBroker seems to succeed even with a NULL pointer for nb.

Maybe the arguments are just swapped. Can you try CxBroker_(0,&nb) ?
thomas is offline  
Old 12 July 2020, 13:20   #5
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
That was a good idea but it didn't work either.

And yes, passing NULL pointer to NewBroker structure in CXBroker_() succeeds.
So.. I think... that Blitz implementation of that command is somehow kaput
peceha is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
[blitz basic] How much amiga-blitz friendly is this? saimon69 Coders. Blitz Basic 105 21 April 2022 19:45
Broken FDD? elanstra support.Hardware 2 11 November 2019 21:52
CF card , have I broken it ? willbloke support.Hardware 11 05 September 2011 22:12
broken CD32 orange support.Hardware 6 18 January 2011 17:17
Help! Broken Sd/ff! CU_AMiGA Hardware pics 7 16 November 2006 10:07

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:03.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07741 seconds with 13 queries