[Gambas-user] read/data commands
Fabien Bodard
gambas.fr at ...626...
Fri Jun 28 13:21:20 CEST 2013
In gambas
Dim grata as integer[][]=[[1,2,3,4][1,2,3,4][1,2,3,4][1,2,3,4]]
But also an internal file in gambas can be used
Dim a as integer[]=split(file.load("data"))
For I =3 to 3
For j = 0 to 3
Adata[i][j]=a[I*j]
Next
Next
Or a structure via gb.setting
.. so many ways
But for a short sequence the first is for me the better
Le 28 juin 2013 12:38, "Jussi Lahtinen" <jussi.lahtinen at ...626...> a écrit :
> I remember read/data statements, but I never used them.
> There is inline assembler in C...
>
> Jussi
>
>
> On Fri, Jun 28, 2013 at 1:23 PM, Caveat <Gambas at ...1950...> wrote:
>
> > Think the rest of the list are pretending to be younger than they are!
> >
> > Of course I remember read/data statements, it was quite a popular way of
> > getting a little (and sometimes not so little!) snippet of machine code
> > into a basic program.
> >
> > I still have my Spectrum 48k, my ZX81, and my ZX80 :-D
> >
> > Kind regards,
> > Caveat
> >
> > On 27/06/13 23:54, Keith Clark wrote:
> > > No, the data was just an example. What if it were to be 255 unrelated
> > > values?
> > >
> > > Did nobody else use BASIC from the 80s?
> > >
> > > Read/Data statments.....
> > >
> > > On 13-06-27 05:48 PM, Jussi Lahtinen wrote:
> > >> I don't quite understand usage of data...
> > >>
> > >> Will this do what you want?
> > >>
> > >> Dim data As Integer[] = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
> > >> Dim v As New Integer[]
> > >>
> > >> v = data.Copy()
> > >>
> > >>
> > >> Or this:
> > >>
> > >> Dim ii As Integer, jj As Integer
> > >> Dim data As New Integer[5, 5]
> > >>
> > >> For ii = 0 To 4
> > >> For jj = 0 To 4
> > >> data[ii, jj] = jj + 1
> > >> Next
> > >> Next
> > >>
> > >>
> > >> Jussi
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> On Thu, Jun 27, 2013 at 10:55 PM, Keith Clark <
> > keithclark at ...2185...>wrote:
> > >>
> > >>> On 13-06-27 05:34 AM, Tobias Boege wrote:
> > >>>> On Wed, 26 Jun 2013, Keith Clark wrote:
> > >>>>> Does Gambas support read/data commands like the following for
> > loading a
> > >>>>> simple array with fixed values?
> > >>>>>
> > >>>>> for t=0 to 4
> > >>>>> for x = 0 to 4
> > >>>>> read v(t,x)
> > >>>>> next x
> > >>>>> next t
> > >>>>>
> > >>>>> data 1,2,3,4,5,1,2,3,4,5,1,2,3,4,5......
> > >>>>>
> > >>>>> Maybe I'm just not finding it?
> > >>>>>
> > >>>> I don't know what you want to do, actually, and your snippet does
> not
> > >>>> resemble Gambas at all... Maybe you want to access elements of a 2D
> > array
> > >>>> where t is the row and x is the column? So if v is an Integer[][],
> > then
> > >>> you
> > >>>> need to do:
> > >>>>
> > >>>> For t = 0 To 4
> > >>>> For x = 0 To 4
> > >>>> Print v[t][x]
> > >>>> Next
> > >>>> Next
> > >>>>
> > >>>> Regards,
> > >>>> Tobi
> > >>>>
> > >>>>
> > >>> Yeah, I posted that question rather quickly. I want to fill an array
> > >>> with a very simple, fixed dataset that will never change. The code I
> > >>> gave above is from an old dialect, but really just the curved
> brackets
> > >>> should have been square.
> > >>>
> > >>> for t=0 to 4
> > >>> for x = 0 to 4
> > >>> read v[t,x]
> > >>> next x
> > >>> next t
> > >>>
> > >>> data 1,2,3,4,5,1,2,3,4,5,1,2,3,4,5......
> > >>>
> > >>> Would read into the array v the data in the 'data' statement
> > >>>
> > >>> v[0,0]=1
> > >>> v[0,1]=2
> > >>> and so on.
> > >>>
> > >>> For reference:
> > >>> http://www.antonis.de/qbebooks/gwbasman/read.html
> > >>>
> > >>>
> > >>>
> >
> ------------------------------------------------------------------------------
> > >>> This SF.net email is sponsored by Windows:
> > >>>
> > >>> Build for Windows Store.
> > >>>
> > >>> http://p.sf.net/sfu/windows-dev2dev
> > >>> _______________________________________________
> > >>> Gambas-user mailing list
> > >>> Gambas-user at lists.sourceforge.net
> > >>> https://lists.sourceforge.net/lists/listinfo/gambas-user
> > >>>
> > >>
> >
> ------------------------------------------------------------------------------
> > >> This SF.net email is sponsored by Windows:
> > >>
> > >> Build for Windows Store.
> > >>
> > >> http://p.sf.net/sfu/windows-dev2dev
> > >> _______________________________________________
> > >> Gambas-user mailing list
> > >> Gambas-user at lists.sourceforge.net
> > >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> > >
> >
> ------------------------------------------------------------------------------
> > > This SF.net email is sponsored by Windows:
> > >
> > > Build for Windows Store.
> > >
> > > http://p.sf.net/sfu/windows-dev2dev
> > > _______________________________________________
> > > Gambas-user mailing list
> > > Gambas-user at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > >
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > This SF.net email is sponsored by Windows:
> >
> > Build for Windows Store.
> >
> > http://p.sf.net/sfu/windows-dev2dev
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> 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