Page 1 of 3

Little Class Preprocessor Released

Posted: Mon Aug 28, 2006 5:06 am
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

Posted: Mon Aug 28, 2006 7:42 am
by Amundo
YAY!

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

:D

Posted: Mon Aug 28, 2006 2:05 pm
by ts-soft
thanks fsw, good work!

Posted: Mon Aug 28, 2006 2:43 pm
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

Posted: Mon Aug 28, 2006 3:26 pm
by Dare
Thanks fsw!

Posted: Mon Aug 28, 2006 3:56 pm
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.

Posted: Mon Aug 28, 2006 4:05 pm
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 :!:

Posted: Mon Aug 28, 2006 4:07 pm
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

Posted: Mon Aug 28, 2006 4:16 pm
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 ... :)

Posted: Mon Aug 28, 2006 4:20 pm
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

Posted: Mon Aug 28, 2006 4:24 pm
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.

Posted: Mon Aug 28, 2006 4:29 pm
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.

Posted: Mon Aug 28, 2006 5:10 pm
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.

Posted: Mon Aug 28, 2006 5:24 pm
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

Posted: Mon Aug 28, 2006 6:27 pm
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.