Pre-purchasing question on string handling

Everything else that doesn't fall into one of the other PB categories.
erosolmi
User
User
Posts: 19
Joined: Wed Aug 08, 2007 4:05 pm
Location: Milan - Italy
Contact:

Post by erosolmi »

Yes,

that was one of my reply to PowerBasic owner when I had licence problems. In any case M$ does not have any restriction on that (as far as I know) while any software house can set whatever rule inside its software licence. The most important thing is to know the rules before. Here I know, so no problem :)

Thanks
Eros
http://www.thinbasic.com | http://community.thinbasic.com
WinXP Pro SP2 - Centrino Core 2 2GHz - 2Gb Ram - Ati Radeon Mobility X1600 512Mb
Fred
Administrator
Administrator
Posts: 18150
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Flype wrote:
erosolmi wrote:
PB wrote:It's not a wrapper if your function does other things, as in your example.
After all, one of PureBasic's selling points is the creation of DLLs to use in
third-party apps, so how can this be done if you don't use ANY PureBasic
commands in the procedures? :)
For PowerBasic owner also that functions were wrappers. Just adding few lines of code around a unique compiler feature was considered a wrapper.
But I do not want here to go too much on this, if possible. Maybe it is not the right time also because I really need to spend time on learning PureBasic.

In any case, thanks.
Eros
Hi,

PureBasic itself has many commands that are just wrapping Win32/API functions. For example, OpenFile() is wrapping CreateFile() of the Kernel32.dll (at least, on Windows), with some code before, and some code after.
While some commands are just wrappers (and even, it depends of the OS), most of them are not, it would be too easy ;). For example the File library you took in example has a full cache handling which really needs some code to manage all that.
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

Sure, purebasic is much more than a simple wrapper :D
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

erosolmi wrote:Thanks Paul.
No big problem with strings. I do not use strings to store structures. Almost 90% of the work I've done is by using pointers so it is just a matter of language syntax to get used. Anyhow, so far I like it.

Regarding licence, PureBasic licence clearly state:
"All components, libraries, and binaries are copyrighted by Fantaisie Software. The PureBasic license explicitly forbids the creation of DLLs whose primary function is to serve as a 'wrapper' for PureBasic functions."
So unless an official written permission, I have to stay with this and this will not allow me to port thinBasic source from Power Basic to Pure Basic. I had already a licence problem in the past and I do not want to fall into those matters again.

For the rest, it seems quite nice so far. I'm now dealing with DLL creation. I have some problems but I will wait some days to post for help. I'm pretty sure the problem is still on my side. I need to test more and write some code from the beginning.

Ciao.
Eros
Hi Eros,

if your interpreter is a straight executable (.exe) that contains all the functionality that PB libraries offer, there shouldn't be a problem.
Wrapping PB functionality in a DLL and selling it as your product would pose a problem though.

ciao
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
erosolmi
User
User
Posts: 19
Joined: Wed Aug 08, 2007 4:05 pm
Location: Milan - Italy
Contact:

Post by erosolmi »

dell_jockey,

thanks for your reply but I do not think it is so simple. thinBasic project is quite complex. It is more than 140000 lines project not including all compiler include files (other something 50000). It is composed by executable and special dll called thinBasic modules usable only under thinBasic control so details are much more than just exe or dll division.

In any case so far I do not think to use PureBasic for thinBasic development. But if I will, I will ask privately for some special precise requests.

I will in any case consider PureBasic for my other development, especially for company ones. I like the semplicity of user interface creation under PureBasic.

Ciao
Eros
Last edited by erosolmi on Sat Sep 08, 2007 12:08 pm, edited 1 time in total.
http://www.thinbasic.com | http://community.thinbasic.com
WinXP Pro SP2 - Centrino Core 2 2GHz - 2Gb Ram - Ati Radeon Mobility X1600 512Mb
User avatar
SimpleMind
Enthusiast
Enthusiast
Posts: 112
Joined: Sun May 18, 2003 12:40 pm
Location: Netherlands

Post by SimpleMind »

Welcome Eros.

I just read some of your history threads at Powerbasic and now I see you here. Nice to see you here. :)

I was interested in the basics of creating an interpreter and the info you mentioned about Herbert Schildt. If you have some straight information to start, i would be happy.

BTW, PureBasic is one of a kind.
Give me books, fruit, french wine, fine weather and a little music.
John Keats
User avatar
SimpleMind
Enthusiast
Enthusiast
Posts: 112
Joined: Sun May 18, 2003 12:40 pm
Location: Netherlands

Post by SimpleMind »

I found the link to the article Dr. Dobb's about the c interpreter. http://www.ddj.com/184408184

And another link from Al Stevens: http://www.ddj.com/184408141

http://www.cs.virginia.edu/cs150/book/c ... reters.pdf
Last edited by SimpleMind on Sun Sep 09, 2007 12:55 am, edited 2 times in total.
Give me books, fruit, french wine, fine weather and a little music.
John Keats
erosolmi
User
User
Posts: 19
Joined: Wed Aug 08, 2007 4:05 pm
Location: Milan - Italy
Contact:

Post by erosolmi »

Ciao SimpleMind.

Well, I cannot give any other info because all the job about thinBasic has been done in house. The only starting point was the descendant parser technique used by Herbert Schildt in his books. I have many books from Herbert Schildt about C, C++ and C# and in all of them you can find the descendant parsing technique developed using the language the book is about so just keep one of them (latest edition) and you will get it. Attention, some parsers are on parsing Basic interpreter, some on C so if you are interested in Basic interpreter, if possible read some pages before spending money.

Another source I can give you is to have a look at Euphoria interpreter at http://www.rapideuphoria.com/hotnew.htm It is developed in C but in a clear way. You can get many ideas. More: Euphoria is the fastest interpreter I've even seen (and I have seen many). Script execution speed is very very close to compiled applications in many cases.

Last one, if you have Power Basic, I can give you sources of one project I stopped development some time ago. Its name is BINT32 and is a DLL able to add basic scripting functionalities to any application. Binary and Power Basic examples can be found at http://www.powerbasic.com/support/downl ... BINT32.zip If still interested I can send you via private mail (or at thinBasic forum) the sources and see if you can port to Pure Basic or do whatever you prefer. Project is quite old. Parsed language is Basic but not support for functions or sub, just main code. The biggest problem I can see is the use of dynamic OLE32 strings that are not supported natively by Pure Basic. The rest are just ... pointers. In any case you can use Power Basic dynamic strings using Microsoft OLE functions you can find here: http://msdn2.microsoft.com/en-us/library/ms221105.aspx


Ciao
Eros
http://www.thinbasic.com | http://community.thinbasic.com
WinXP Pro SP2 - Centrino Core 2 2GHz - 2Gb Ram - Ati Radeon Mobility X1600 512Mb
User avatar
SimpleMind
Enthusiast
Enthusiast
Posts: 112
Joined: Sun May 18, 2003 12:40 pm
Location: Netherlands

Post by SimpleMind »

erosolmi wrote:Ciao SimpleMind.

Well, I cannot give any other info because all the job about thinBasic has been done in house. The only starting point was the descendant parser technique used by Herbert Schildt in his books. I have many books from Herbert Schildt about C, C++ and C# and in all of them you can find the descendant parsing technique developed using the language the book is about so just keep one of them (latest edition) and you will get it. Attention, some parsers are on parsing Basic interpreter, some on C so if you are interested in Basic interpreter, if possible read some pages before spending money.
Thanks for the info, I'll scan the book first when I find one in the bookstore or university library.
erosolmi wrote:Another source I can give you is to have a look at Euphoria interpreter at http://www.rapideuphoria.com/hotnew.htm It is developed in C but in a clear way. You can get many ideas. More: Euphoria is the fastest interpreter I've even seen (and I have seen many). Script execution speed is very very close to compiled applications in many cases.
I programmed two years in Euphoria version 1.4/1.5 in '96-'97. This is indeed a very fast interpreter and simple to use. I stopped using it because it couldn't support Windows in a simple way. The Windows support library at that time was very new and the statements very long and not easy to understand. Later the Windows support became better. But still I like this language very much.
erosolmi wrote:Last one, if you have Power Basic, I can give you sources of one project I stopped development some time ago. Its name is BINT32 and is a DLL able to add basic scripting functionalities to any application. Binary and Power Basic examples can be found at http://www.powerbasic.com/support/downl ... BINT32.zip If still interested I can send you via private mail (or at thinBasic forum) the sources and see if you can port to Pure Basic or do whatever you prefer. Project is quite old. Parsed language is Basic but not support for functions or sub, just main code. The biggest problem I can see is the use of dynamic OLE32 strings that are not supported natively by Pure Basic. The rest are just ... pointers. In any case you can use Power Basic dynamic strings using Microsoft OLE functions you can find here: http://msdn2.microsoft.com/en-us/library/ms221105.aspx

Ciao
Eros
I don't have PowerBasic and have no intention to buy it, I'll stick to PureBasic and VBA. On the PowerBasic forum I was looking for information about an interpreter construction and indeed I did come along BINT32. I'm interested in the basic start and making of a simple basic like script interpreter that has to run on the text level of a text processor. I don't know if BINT32 can help me on this level. If you think it can I'd like to take a look at the source which I'll have to translate into VBA.

The strings in PureBasic do work very well but yes they are not easy to understand for a VBA programmer when interfacing strings from VBA to a DLL written in PureBasic vice, versa. I got it working with the help of the people here. But still they are not as easy as OLE32 strings.

Maybe that will be the next major update for PureBasic 4.
Give me books, fruit, french wine, fine weather and a little music.
John Keats
erosolmi
User
User
Posts: 19
Joined: Wed Aug 08, 2007 4:05 pm
Location: Milan - Italy
Contact:

Post by erosolmi »

OK, I do not know if BINT32 can help you. I suppose yes, maybe just as a starting. In any case you can find download here: http://www.thinbasic.com/index.php?opti ... &Itemid=66

ZIP file contains binary and sources (Power Basic) of BINT32. Check Examples directory for examples on how to use it. Examples are in source and compiled form so you can have a look at source before execute.

BINT32 is quite basic engine but full of potentiality. Language has all the main program flow you need: WHILE/WEND, DO/LOOP, FOR/NEXT, IF/ELSE/ELSEIF, GOTO/GOSUB, SELECT/CASE. It has just 2 data types: numbers (extended, 10 bytes) and strings (dynamic any size up to 2Gb automatically handled by the interpreter). More, the language can be extended by the calling application (or directly into the engine) adding new keywords and linking them to compiled functions using function pointers.

BINT32 is not anymore maintained but if someone would like to port to any other language or just have some more info, please ask in our forum at http://community.thinbasic.com
Maybe that will be the next major update for PureBasic 4.
That would be a big pro for me using Pure Basic and I suppose for many others. OLE32 strings are nothing more that few pointers to memory buffers. Delphi has also something very close. Mainly a string is a 32bit pointers to a buffer. Buffer is than organized in 2 parts: first 4 bytes contain string len (DWORD), second parts is the string itself. VARPTR function of a OLE32 string return a pointer to the string pointer. STRPTR function of a OLE32 string will return a pointer to the first byte of the string data, LEN of a OLE string just return the first 4 bytes (DWORD) info. All OLE32 strings can contain any kind of data up to 2Gb in size. In any case OLE engine add a NULL terminator always. In this way OLE strings can also be used for API functions where an ASCIIZ string is expected: you just need to pass STRPTR(MyOleString) to be API compatible. If someone is interested we can discuss in another thread.

Ciao
Eros
http://www.thinbasic.com | http://community.thinbasic.com
WinXP Pro SP2 - Centrino Core 2 2GHz - 2Gb Ram - Ati Radeon Mobility X1600 512Mb
User avatar
SimpleMind
Enthusiast
Enthusiast
Posts: 112
Joined: Sun May 18, 2003 12:40 pm
Location: Netherlands

Post by SimpleMind »

Thanks, Eros for the link, I downloaded the code and made a very quick study. That is a nice project you did with BINT32. I saw you also incorporated mscriptcontrol.

For me the BINT32 code is overwhelming and that is an understatement. Without some background documentation about the principles I'm lost. A second problem is the PowerBasic syntax, I'm not familiar with it.

I look first at a simple basic interpreter example and start with small steps.

Kind regards,

Marcel
Give me books, fruit, french wine, fine weather and a little music.
John Keats
Post Reply