New features in 4.60 compiler?

Everything else that doesn't fall into one of the other PB categories.
bosker
Enthusiast
Enthusiast
Posts: 105
Joined: Fri Jan 08, 2010 11:04 pm
Location: Hampshire, UK

New features in 4.60 compiler?

Post 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.
User avatar
skywalk
Addict
Addict
Posts: 4318
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: New features in 4.60 compiler?

Post 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
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Demivec
Addict
Addict
Posts: 4283
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: New features in 4.60 compiler?

Post 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.
Seymour Clufley
Addict
Addict
Posts: 1267
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: New features in 4.60 compiler?

Post by Seymour Clufley »

He might be referring to my request for a StringSection/EndStringSection feature.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
Post Reply