[Gambas-user] gb3 RC1: using structures to replace the loss of Mk$ functions

Kevin Fishburne kevinfishburne at ...1887...
Fri Apr 1 07:36:00 CEST 2011


On 04/01/2011 01:15 AM, Bruce Bruen wrote:
> On Friday, April 01, 2011 01:17:50 PM Kevin Fishburne wrote:
>> I'm finding that the task of replacing the Mk$ functions with structures
>> for UDP packet client/server transactions is a massive undertaking. So
>> far it's affecting every part of my project that constructs, parses,
>> sends and receives data. As a consequence the network code is going from
>> dozens of lines to hundreds, and I'm beginning to see that the actual
>> logic of network operations will need to be changed as well.
> Pure stab in the dark.  Could you write a "helper" class to replace the Mk$
> functions, then you'd only have to develop a limited amount of code and leave
> the working code alone?

That's what I was doing before the functions were created. I wrote gb 
functions/procedures to convert a datatype to its string representation 
and the corresponding functions/procedures to convert them back to their 
original datatypes. It worked well for shorts and integers, but I could 
never figure out how to convert a single or double both ways. I also 
lost that code after implementing the new gb functions as GAMBAS doesn't 
support revision history or whatever you call it, and my dumb ass didn't 
backup the functions to a text file somewhere.

If anyone wants to show the code for converting the basic datatypes 
(short, integer, single, double) to a string and converting that string 
back to its basic datatype that would be a nice hack. Basically what I 
was doing in the first place but with the float datatypes.

Also, for anyone curious, the reason the functions were removed is 
because they weren't endian-agnostic. In my case it didn't matter, as 
I'm not sending data to some ARM device or the like. Why different CPU 
architectures don't put bits in the same damn order I I'll never know.

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list