Little Class Preprocessor Released

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Little Class Preprocessor Released

Post by fsw »

OK, here it is... finally.

For PB users that don't know what it is:
LCP is a preprocessor and adds 4 keywords to PureBasic:
Class, EndClass, New and This.

Grab it here:
http://fsw.pb.home.comcast.net/lcp.0v82.zip

Some examples are included.
If you find bugs or have suggestions please post them here.

Take care
Amundo
Enthusiast
Enthusiast
Posts: 200
Joined: Thu Feb 16, 2006 1:41 am
Location: New Zealand

Post by Amundo »

YAY!

I'm the first to say "Thanks fsw!!!!"

:D
Win10, PB6.x, okayish CPU, onboard video card, fuzzy monitor (or is that my eyesight?)
"When the facts change, I change my mind" - John Maynard Keynes
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

thanks fsw, good work!
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
ebs
Enthusiast
Enthusiast
Posts: 557
Joined: Fri Apr 25, 2003 11:08 pm

Post by ebs »

I just processed the example file "test.opb" and got an error when compiling the "test.pb" output file, on this line:

Code: Select all

ProcedureReturn ReadFile_ ( hFile , pBuffer , NumBytes , pBytesRead , 0 ) ! 1
because the procedure is defined to return a string:

Code: Select all

Procedure.s MyClass_My2ndMethod(*THIS.MyClass_Properties_)
Eric
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Thanks fsw!
Dare2 cut down to size
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

ebs wrote:I just processed the example file "test.opb" and got an error when compiling the "test.pb" output file, on this line:

Code: Select all

ProcedureReturn ReadFile_ ( hFile , pBuffer , NumBytes , pBytesRead , 0 ) ! 1
because the procedure is defined to return a string:

Code: Select all

Procedure.s MyClass_My2ndMethod(*THIS.MyClass_Properties_)
Eric
Suppose you are refering to test_!.pb...
Thank you for your input, as this file has actually no use for you guys/gals.
It's in the zip file by mistake, my mistake.

This file is not intendet to be compiled, as you can see there is no class declaration... nothing except a procedure with "!" used in 2 different ways.
The intention was to make the preprocessor intelligent enough to understand if the "!" referes to ASM code or not.

This file is now deleted in the 0v82 zip file.

Thanks again.
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

Post by remi_meier »

Ok, that's neat! The output looks very simple and functional! If this tool
is (or gets) reliable, I'm one of your users, I think :)

Good work :!:
Athlon64 3700+, 1024MB Ram, Radeon X1600
ebs
Enthusiast
Enthusiast
Posts: 557
Joined: Fri Apr 25, 2003 11:08 pm

Post by ebs »

Suppose you are refering to test_!.pb...
No - I am referring to the file "test.opb", which has this procedure at the end:

Code: Select all

Procedure.s MyClass::My2ndMethod()
    If *THIS->My1stProperty
        *THIS->My2ndProperty = "My1stProperty is set to: " + Str(*THIS->My1stProperty)
        ProcedureReturn *THIS->My2ndProperty
    Else
        *THIS->My2ndProperty = "My1stProperty is not set"
    EndIf
    
    *THIS->ProcAddr = @Test()
    Debug *THIS->ProcAddr

    ProcedureReturn  ReadFile_(hFile, pBuffer, NumBytes, pBytesRead, 0) ! 1
EndProcedure
Eric
inc.
Enthusiast
Enthusiast
Posts: 406
Joined: Thu May 06, 2004 4:28 pm
Location: Cologne/GER

Post by inc. »

Hi fsw,

thanks for all your efforts, but your License makes it (still :) ) useless to me.
Please do think about some paragraphs as for instance it shouldnt be a must to report u if I would use that nice plugin when writing code.
License wrote: For the creation of commercial applications: you can test this software but you need to notify me if you want to use this software. If you use it to create and sell commercial applications you have to contact me at: fsw DOT pb AT comcast DOT net

Again: You cannot use this software for the creation of commercial applications without my consent.
No offense, but could you think about it again ... :)
Check out OOP support for PB here!
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

ebs wrote:
Suppose you are refering to test_!.pb...
No - I am referring to the file "test.opb", which has this procedure at the end:

Code: Select all

Procedure.s MyClass::My2ndMethod()
    If *THIS->My1stProperty
        *THIS->My2ndProperty = "My1stProperty is set to: " + Str(*THIS->My1stProperty)
        ProcedureReturn *THIS->My2ndProperty
    Else
        *THIS->My2ndProperty = "My1stProperty is not set"
    EndIf
    
    *THIS->ProcAddr = @Test()
    Debug *THIS->ProcAddr

    ProcedureReturn  ReadFile_(hFile, pBuffer, NumBytes, pBytesRead, 0) ! 1
EndProcedure
Eric
UPS :oops:
Please change:

Code: Select all

ProcedureReturn  ReadFile_(hFile, pBuffer, NumBytes, pBytesRead, 0) ! 1
with:

Code: Select all

ProcedureReturn  "0"
...somehow the 2 test codes (test.pb and test_!.pb) got mixed up.
Sorry for the inconvenience.

ZIP file is changed accordingly.

Thanks ebs. :D
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

inc. wrote:Hi fsw,

thanks for all your efforts, but your License makes it (still :) ) useless to me.
Please do think about some paragraphs as for instance it shouldnt be a must to report u if I would use that nice plugin when writing code.
License wrote: For the creation of commercial applications: you can test this software but you need to notify me if you want to use this software. If you use it to create and sell commercial applications you have to contact me at: fsw DOT pb AT comcast DOT net

Again: You cannot use this software for the creation of commercial applications without my consent.
No offense, but could you think about it again ... :)
What do you dislike about it?
Is it too much to ask to send an e-mail?
Sending an e-mail is not needed while testing, only if you use it for production of commercial applications.
inc.
Enthusiast
Enthusiast
Posts: 406
Joined: Thu May 06, 2004 4:28 pm
Location: Cologne/GER

Post by inc. »

Its at least quite uncommon thats all.
Im also not forced to email Gnozal or GPI if I enjoy their great efforts on JaPBe when using it for Coding ;)
Remi Meier also doesnt wants you to email and ask him if u use his lexer in your parser.

But its your decision, so no big issue, it was just a *hint* to think about it and I gave my statement as I do respect licenses, so thats all.
Check out OOP support for PB here!
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Thank you for your input.

Because you mention Remi Meier: As soon as he wants a copy of the modified lexer I will give it to him; no question about it.


BTW: the ratio of the code (without gui) is:
lexer 33%
parser 65%
bugs 2% (hopefully less...)

The parser code is double in size, but supposedly only because Remi Meier's code is cool and efficient and his coding skills are lightyears ahead compared with my coding skills.
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

Post by remi_meier »

As soon as he wants a copy of the modified lexer I will give it to him; no question about it.
Thanks, as long as we find no bugs, I don't need it at the moment :)
only because Remi Meier's code is cool and efficient and his coding skills are lightyears ahead compared with my coding skills.
Don't exaggerate! I didn't have to write the hard part :!:


And btw: The next will be the delete keyword, right? :P
Athlon64 3700+, 1024MB Ram, Radeon X1600
inc.
Enthusiast
Enthusiast
Posts: 406
Joined: Thu May 06, 2004 4:28 pm
Location: Cologne/GER

Post by inc. »

Because you mention Remi Meier: As soon as he wants a copy of the modified lexer I will give it to him; no question about it.
You catched me wrong, I didn't want to tease by mention the Lexer approach ;)
He didnt release using the GPL so your aren't forced to anything.
The parser code is double in size, but supposedly only because Remi Meier's code is cool and efficient and his coding skills are lightyears ahead compared with my coding skills.
As already I stated you in another thread. Its the effort that counts, not the skills.
Check out OOP support for PB here!
Post Reply