[Gambas-user] Unsigned int

Ron Onstenk ronstk at ...239...
Thu Jul 20 21:15:01 CEST 2006


On Thursday 20 July 2006 19:31, Fabien Bodard wrote:
> Le Jeudi 20 Juillet 2006 17:11, Leonardo Miliani a écrit :
> > Hi Benoit,
> > do you think to inplement the "unsigned int" data type in Gambas, as is
> > in C language?
> > It could be useful in a lot of cases, i.e. when working on real 32 bit
> > words is needed.
> 
> 
> it remember me a query to Benoit :-)...
> 
> 
> Dear Benoit,
> Is it possible to have something like in c to load binary structure ?
> 
> For exemple the TYPE model...  and some keys to restrict the variable size 
> like in vb
> TYPE montype
>   mystring as string * 32
>   mySTaticarray[12] as integer
> END TYPE
> 
> dim $montype as montype
> 
> fic = open monfichier for read
> 
> Read #fic, $montype, len(montype)
> close fic
> 
> remember that a type can contain other type or array of type... In fact it 
> miss me for loading 3D object files. i've trying to do that without but... 
> it's really difficult as i need to query for each type.
> 
> if you have an idea of how to manage structures... without passing by 
> classes...  please make it ! it's usefull in many place.
> 
> Regards,
> Fabien
> 

The intention of Benoit is that UDT (User Data Types) should be declared 
as a class file. 

montype.class:

Public mystring as string[32]
public mySTaticarray[12] as integer

public sub _new()
  'the initialize of the data type if need
end

Pro: I think it is more flexible and better usable as object versus VB
Again: If there are more UDT's will be used with external library calls
you can get a mass of small (relative useless) files.
I remember modules in VB to be able to use the windows API for some components
with 10 or more (seen once over 30) of those UDT's
Calling linux libraries is now possible with gambas and a interface module
to access that library can/will have same mass of UDT's

To make a visual compact program with less files I support the request
to have a something like TYPE in gambas too.



I'm dreaming 
this way a hiearchie of the UDT is possible instead of 
spread the files between all the other in alfa sorted way.


UDT.class
public TYPE montype
  mystring as string[32]
  mySTaticarray[12] as integer
end type

public TYPE tutype
  mystring as string[32]
  mySTaticarray[12] as integer
end type

public TYPE multitutype
  mymulti as tutype[32]
  mynonmulti as integer
end type

public sub _new()
  'the initialize of the data type(s) if need
end


usage:
dim myUDT as UDT
  myUDT.montype.mystring="hello world"
  myUDT.tutype.mystring="Good morning all"

  myUDT.multitutype.mymulti[0]=myUDT.tutype
  myUDT.multitutype.mynonmulti=1234

do you like that Fabien :)

Poor Benoit :)




More information about the User mailing list