[Gambas-user] Unsigned int
Fabien Bodard
sirfabien at ...626...
Fri Jul 21 18:34:03 CEST 2006
Le Jeudi 20 Juillet 2006 21:15, Ron Onstenk a écrit :
> 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 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 :)
no !
public TYPE tutype
mystring as string[32]
mySTaticarray[12] as integer
end type
public TYPE montype
mystring as string[32]
mySTaticarray[12] as integer
mytutipe[3] as tutype
end type
dim myudt as UDT.Montype
mydut.mystring="hello"
myudt.mystringarray[0]="coucou"
myudt.mytutipe.mystring = "word"
or
TYPE StringData
Name as string * 10
FirstName as string *10
END TYPE
dim myString data as stringdata
Read #file, MystringData, TypeLen(MyStingData) 'who is = to 20
in the file :
'Bodard Fabien '
now i can draw a function in gambas like :
FileRead(File as stream, type as type, n)
(chhht!! it's fread in c in fact)
but i like the idea to have the capability to load ad save binary data in one
time like in C.
>
> Poor Benoit :)
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your opinions on IT & business topics through brief surveys -- and earn
> cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list