Page 1 of 1

New features in 4.60 compiler?

Posted: Tue Dec 27, 2011 10:46 pm
by bosker
Does anybody know if there's a complete list of enhancements made to the 4.60 compiler?
The reason I'm interested is that I found a useful new feature and I wonder what else is in there.

Somebody asked for @"string" to be allowed in Data statements a while back (sorry I don't remember who) and I found out it's been implemented in the compiler. I can't see any mention of it in the history.

A short compilable example showing how it allows data tables to be directly created and used.

Code: Select all

EnableExplicit

Structure TRec    ; each entry in table
    RType.a
    RStat.a
    RPad.w
    sTitle.s
    sDesc.s
EndStructure

Structure TRecList
    Recs.TRec[0]
EndStructure

Procedure PBMain()
    Protected.l i
    Protected.TRecList *x = ?StartTable   ; constant table is ready for use now

    For i = 0 To 3
        With *x\Recs[i]
            PrintN(LStr(\RType) + #TAB$ + LStr(\RStat) + #TAB$ + LStr(\RPad))
            PrintN(\sTitle)
            PrintN(\sDesc)
            PrintN("")
        EndWith
    Next

DataSection
StartTable:
    Data.a 1, 10
    Data.w 1024
    Data.i @"Title 1: this is it", @"Desc 1: not much to say here"

    Data.a 2, 20
    Data.w 2048
    Data.i @"Title 2: the title of the 2nd record" , @"Desc 2: abcdefghijklmnopqrstuvwxyz"

    Data.a 3, 30
    Data.w 4096
    Data.i @"Title 3: nothing more" , @"Desc 3: nor here"

    Data.a 4, 40
    Data.w 8192
    Data.i @"Title 4: this is the last test record" , @"Desc 4: see, I said it was the last one"
EndDataSection
EndProcedure

OpenConsole()
PBMain()
Some of the stuff I make in PB has huge data tables and this feature is VERY helpful to me.
If everybody else already knew about this, I apologize for the noise.

Re: New features in 4.60 compiler?

Posted: Wed Dec 28, 2011 12:26 am
by skywalk
Thanks bosker, this is a neat find. 8)
This was not available in earlier versions?
By the way, I think it was Marlin's request...
http://www.purebasic.fr/english/viewtop ... =3&t=45062

Re: New features in 4.60 compiler?

Posted: Wed Dec 28, 2011 1:23 am
by Demivec
skywalk wrote:By the way, I think it was Marlin's request...
http://www.purebasic.fr/english/viewtop ... =3&t=45062
Marlin's request was to be able to obtain the address of a string (.s) variable, not the address of the string it pointed to.

bosker's example above shows that the address of a literal string can be obtained for use in Data statements.

Re: New features in 4.60 compiler?

Posted: Fri Dec 30, 2011 12:28 pm
by Seymour Clufley
He might be referring to my request for a StringSection/EndStringSection feature.