Converting PowerBasic Code
-
- User
- Posts: 43
- Joined: Tue Jul 10, 2007 8:09 pm
Converting PowerBasic Code
Hello all,
I need to support multiple platforms amongst other things and am considering porting some extensive code to this language.
Has anyone here used PowerBasic much?
How would things like Tsunami convert?
Does this forum have an offline searchable database of posts like the Poffs?
How do you create resources?
Is there any OOP support?
Is there MACRO support?
So many questions its hard to know where to start.
I need to support multiple platforms amongst other things and am considering porting some extensive code to this language.
Has anyone here used PowerBasic much?
How would things like Tsunami convert?
Does this forum have an offline searchable database of posts like the Poffs?
How do you create resources?
Is there any OOP support?
Is there MACRO support?
So many questions its hard to know where to start.
Re: Converting PowerBasic Code
Yes.Mike Trader wrote:Hello all,
I need to support multiple platforms amongst other things and am considering porting some extensive code to this language.
Has anyone here used PowerBasic much?
See below.How would things like Tsunami convert?
There's a search button at the top of the screen.Does this forum have an offline searchable database of posts like the Poffs?
The same way you would with Powerbasic and/or with c etc. There's an option in ithe ide to include a resource script which will then be compiled and linked in automatically.How do you create resources?
Depend on what you mean exactly. OOP can be implemented through the user of interfaces etc. and there's quite a bit of code around to show you how. Purebasic is primarily a procedural language however. If you're talking about COM, then there are some great tools around to get you started.Is there any OOP support?
Absolutely.Is there MACRO support?
So many questions its hard to know where to start.

I've converted a lot of Powerbasic code to Purebasic without any problem's at all. More accurately, I've swiped loads of Powerbasic code from the PowBas. forums and converted it!

I may look like a mule, but I'm not a complete ass.
-
- User
- Posts: 43
- Joined: Tue Jul 10, 2007 8:09 pm
Thanks for that.
I have used the web based search, but it is of course slow and cumbersome. An offline version makes a HUGE difference when you need that snippet in a hurry...
Anyways I found these threads:
http://www.purebasic.fr/english/viewtop ... powerbasic
http://www.purebasic.fr/english/viewtop ... powerbasic
Both interesting reads, and yes threads dissapear and dissention is not tolerated.
I have several products and I need a very stable compiler. I love the idea of being able to reach out to the MAC OS and I suspect that pure 32bit code cant hurt. I am not sure if the PowerBASIC compiler puts out any 16bit code along with 32bit code, its a little difficult to get to the bottom of this.
I really like the stability of PowerBASIC and the DDT tools for creating dialogs. for example:
That is very powerfull. Does PB have something like this?
I have used the web based search, but it is of course slow and cumbersome. An offline version makes a HUGE difference when you need that snippet in a hurry...
Anyways I found these threads:
http://www.purebasic.fr/english/viewtop ... powerbasic
http://www.purebasic.fr/english/viewtop ... powerbasic
Both interesting reads, and yes threads dissapear and dissention is not tolerated.
I have several products and I need a very stable compiler. I love the idea of being able to reach out to the MAC OS and I suspect that pure 32bit code cant hurt. I am not sure if the PowerBASIC compiler puts out any 16bit code along with 32bit code, its a little difficult to get to the bottom of this.
I really like the stability of PowerBASIC and the DDT tools for creating dialogs. for example:
Code: Select all
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤'
FUNCTION DeleteRecords( hParentDlg AS LONG, hDlg AS LONG ) AS LONG
LOCAL i, RetVal, hFont, SelType AS LONG
LOCAL sShow AS STRING
DIALOG NEW hParentDlg, "Delete Database Records PERMANENTLY!", 300, 40, 330, 200, %WS_SYSMENU OR %WS_THICKFRAME TO hDlg
CONTROL ADD FRAME, hDlg, 403, "", 112, -2, 50, 62
CONTROL ADD OPTION, hDlg, 600, "Records", 116, 06, 40, 12, %WS_GROUP
CONTROL ADD OPTION, hDlg, 602, "Range", 116, 30, 40, 12, 0
CONTROL ADD BUTTON, hDlg, 201, "Delete", 010, 70, 142, 40
CONTROL ADD COMBOBOX, hDlg, 801, , 10, 03, 090, 226, %CBS_DROPDOWNLIST ' Sort by
CONTROL ADD BUTTON, hDlg, 205, "Help", 010, 48, 20, 12
CONTROL ADD BUTTON, hDlg, 207, "All Done", 010, 128, 142, 16
DIALOG SHOW MODAL hDlg CALL DeleteCallback TO RetVal
hDlg = 0 ' Release handle
FUNCTION = RetVal ' Returns 0=Aborted, 1=Filter Success
END FUNCTION
There have been more recent discussions about Powerbasic v Purebasic etc. and yes they can get a little heated at times. Personally, I like both products, but my fav is Purebasic.
Not sure what you mean by 'dissension is not tolerated'? The moderators here are very accomodating and will only really remove spam posts. If you're talking about the Purebasic community in general being defensive about Purebasic, then yes you're probably right. Then again, people stick around here because of the great product and support.
I was never convinced by PowB's ddt. It always seemed a bit of a last minute 'hack' to simplify the creation of gui's. I'd have preferred a fully featured library for utilising the common controls etc. which would have been far more flexible.
Purebasic's Window and Gadget libraries are an absolute delight to use. I hesitate to say any more because I'll crack on all night and there's work to be done!
I kid ye not though, you can hack up a functional gui in Purebasic quicker than you can in VB (and this is without using any of the PureBasic visual designers etc.) It's great.
Not sure what you mean by 'dissension is not tolerated'? The moderators here are very accomodating and will only really remove spam posts. If you're talking about the Purebasic community in general being defensive about Purebasic, then yes you're probably right. Then again, people stick around here because of the great product and support.
I was never convinced by PowB's ddt. It always seemed a bit of a last minute 'hack' to simplify the creation of gui's. I'd have preferred a fully featured library for utilising the common controls etc. which would have been far more flexible.
Purebasic's Window and Gadget libraries are an absolute delight to use. I hesitate to say any more because I'll crack on all night and there's work to be done!

I may look like a mule, but I'm not a complete ass.
-
- User
- Posts: 43
- Joined: Tue Jul 10, 2007 8:09 pm
PowerBASIC DDT is something I use extensivly. I would hate to re-code all my apps using SDK. I think I would probably have to step into a Visual Designer like Paul Squires Firefly (something I have been meaning to do for a long time)
So right off the bat I have some big changes.
>Not sure what you mean by 'dissension is not tolerated'?
Referring to PowerBASIC forums.
How stable is PB now?
Do many people use it for larger projects?
Its hard to imagine that a compiler that is this cheap can be good. RealBasic for example is $500. This is what I would expect to pay for a commecial grade product with on staff support in the forums.
I hear great things about PB but to be honest the cost is not the issue, its the amount of time i will spend getting up to speed with it. If I spend that much time and get into a corner I would be upset.
Are there any well know limitations in PB that PowerBASIC does not have?
So right off the bat I have some big changes.
>Not sure what you mean by 'dissension is not tolerated'?
Referring to PowerBASIC forums.
How stable is PB now?
Do many people use it for larger projects?
Its hard to imagine that a compiler that is this cheap can be good. RealBasic for example is $500. This is what I would expect to pay for a commecial grade product with on staff support in the forums.
I hear great things about PB but to be honest the cost is not the issue, its the amount of time i will spend getting up to speed with it. If I spend that much time and get into a corner I would be upset.
Are there any well know limitations in PB that PowerBASIC does not have?
There are no limitations to Purebasic in terms of creating stable applications. Creating gui's is a as easy as using ddt, but the Purebasic window and gadget libraries are far more powerful. Besides you have full access to the api if you so wish.
There are some very impressive applications which have been written in PureB, you just need to look around. And do not think that cheap is bad where PuBasic is concerned. I am of the firm conviction that Fred should increase the price significantly, but that's his business really. And as for RealBasic... please, don't go there! Unstable, bloated, slow, massively overpriced, expensive updates, ... everything that PuBasic is not!
PuBasic's limitations? To be honest, there are a lot of people (particularly in PowBasic forums) who still think back to the days of 4 byte integers, no double precision floats, no unicode support, non-threadsafe libraries, 64 kb limitation on strings... They don't seem to realise that all of these issues have been addressed and resolved. And that does touch upon a related subject; namely that the pace of development of Purebasic is remarkable.
Anyhow, it's not my job to sell this product. It is what it is and I love it. You'll make your own mind up of course, but rest assure, PuBasic is definitely up to whatever task you set it!
There are some very impressive applications which have been written in PureB, you just need to look around. And do not think that cheap is bad where PuBasic is concerned. I am of the firm conviction that Fred should increase the price significantly, but that's his business really. And as for RealBasic... please, don't go there! Unstable, bloated, slow, massively overpriced, expensive updates, ... everything that PuBasic is not!
PuBasic's limitations? To be honest, there are a lot of people (particularly in PowBasic forums) who still think back to the days of 4 byte integers, no double precision floats, no unicode support, non-threadsafe libraries, 64 kb limitation on strings... They don't seem to realise that all of these issues have been addressed and resolved. And that does touch upon a related subject; namely that the pace of development of Purebasic is remarkable.
Anyhow, it's not my job to sell this product. It is what it is and I love it. You'll make your own mind up of course, but rest assure, PuBasic is definitely up to whatever task you set it!

I may look like a mule, but I'm not a complete ass.
-
- Enthusiast
- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
Re: Converting PowerBasic Code
Hi Mike, good to see you here. You may remember me from the PowerBasic forum.Mike Trader wrote:...How would things like Tsunami convert?...
I have been using Tsunami within my major applications written in PureBasic for over two years now. Like a charm! Tsunami's roots were in PowerBasic, but certainly not limited by/to that.
Feel free to PM me if you have any questions about interfacing the two.
Terry
I'm another old Powerbasic user... {grin} but I like it here much better.
See... everything's much more inexpensive here!
Besides, PureBasic's built in GUI development system also works very well.
--blueb
Edwin (of PwrDev fame) created PBDev ($39) that helps you create fast GUI's in PureBasic see: www.hellobasic.comI think I would probably have to step into a Visual Designer like Paul Squires Firefly (something I have been meaning to do for a long time)
See... everything's much more inexpensive here!

Besides, PureBasic's built in GUI development system also works very well.
--blueb
- It was too lonely at the top.
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
Hey Mike, I remember you from the PowerB forums
Welcome to the dark side
There was a long discussion here you might want to read if you have the time - which I'm guessing you do as a compiler switch can be a big deal
http://www.purebasic.fr/english/viewtopic.php?t=26247
If you go to my profile and click on the posts I've made, you'll see a theme in that I'm often trying to close the gap between the two compilers. They both do things out of the box that the other can't but with a little effort they can both do what the other does and they have different strengths. Often I'm just trying to do something in PureB that I'm used to doing in PowerB but in a different way.
So far, I've had a lot of success at getting the powerB stuff running and the more I use the language the more I like it. It's string engine is a little weak compared to PowerB but the pointer engine you use instead easily gets around this once you are prepared to let go of the PowerB way of doing things. I've found some things are refreshingly simpler too which is nice and then passing params between compiler dlls is still a pain and it's everyones fault
I LOVE the PureB debugger though. The PowerB debugger was so poor most people stopped using the PowerB IDE and used JFPro and hardly missed the debugger, but in PureB .... ahhhhhh bliss, everything you need is there waiting without you haveing to do anything, arrays, UDTS, UDT Arrays and arrays of UDTs just waiting to click on them.
COM seems very young in PureB so that might bite, but then it's implimentaiton in powerB kinda sucked with the way varients were done, you couldn't nest the functions because they used that pseudo DDT syntax
Get Control Text hwnd to MyVar
So it has to be on a line by itself where as if they had
MyVar = GetControlText(Hwnd)
Then you could just drop the Myvar and send the data where it's headed but nooooo
Damn, you got me monologuing again

Welcome to the dark side

There was a long discussion here you might want to read if you have the time - which I'm guessing you do as a compiler switch can be a big deal
http://www.purebasic.fr/english/viewtopic.php?t=26247
If you go to my profile and click on the posts I've made, you'll see a theme in that I'm often trying to close the gap between the two compilers. They both do things out of the box that the other can't but with a little effort they can both do what the other does and they have different strengths. Often I'm just trying to do something in PureB that I'm used to doing in PowerB but in a different way.
So far, I've had a lot of success at getting the powerB stuff running and the more I use the language the more I like it. It's string engine is a little weak compared to PowerB but the pointer engine you use instead easily gets around this once you are prepared to let go of the PowerB way of doing things. I've found some things are refreshingly simpler too which is nice and then passing params between compiler dlls is still a pain and it's everyones fault

I LOVE the PureB debugger though. The PowerB debugger was so poor most people stopped using the PowerB IDE and used JFPro and hardly missed the debugger, but in PureB .... ahhhhhh bliss, everything you need is there waiting without you haveing to do anything, arrays, UDTS, UDT Arrays and arrays of UDTs just waiting to click on them.
COM seems very young in PureB so that might bite, but then it's implimentaiton in powerB kinda sucked with the way varients were done, you couldn't nest the functions because they used that pseudo DDT syntax
Get Control Text hwnd to MyVar
So it has to be on a line by itself where as if they had
MyVar = GetControlText(Hwnd)
Then you could just drop the Myvar and send the data where it's headed but nooooo
Damn, you got me monologuing again

Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
-
- User
- Posts: 43
- Joined: Tue Jul 10, 2007 8:09 pm
Lot to read there!
why did Brice Manuel delete all his posts?
The only time I saw that on the PowerBasic forum was when a very good developer made some comments that someone didnt like and was banned. Unfortunatly he subsequently deleted all of his very usefull contributions. Such a shame. I have to say the big brother with a big stick is the biggest turn off for me. I love the product but jeeze, we are not in China! I have seen several great developers retract and often wondered why.
As for WinAPI, I dont find that too hard in PowerBasic and I knew NOTHING about it when I started. There is so much code in the archive that copying and pasting is pretty much all ya need to do.
A major factor for me is also cross platform. Just having the capability to at least get something on a MAC OS is significant.
I am sure PowerBasic will go 32bit eventually allthough no announcements about what is coming are permitted. (Vaporware is given as the reason for this)
Changing compilers is a tough step. I think in my development history I have only ever done it before because I was forced to.
Punch cards on a Vax PDP11 to a keyboard and terminal. Well that was't too much inconvenience!
FortranIV to Fortran77 that was minor
Fortran77 to Pascal now that was a pain
Pascal to Basic easier
Basic to PowerBasic and windows API - steep curve
PowerBasic to PureBasic - inconvenient
PoweBasic to C - steep curve
PowerBasic to .NET - NEVER!!!!!!
why did Brice Manuel delete all his posts?
The only time I saw that on the PowerBasic forum was when a very good developer made some comments that someone didnt like and was banned. Unfortunatly he subsequently deleted all of his very usefull contributions. Such a shame. I have to say the big brother with a big stick is the biggest turn off for me. I love the product but jeeze, we are not in China! I have seen several great developers retract and often wondered why.
As for WinAPI, I dont find that too hard in PowerBasic and I knew NOTHING about it when I started. There is so much code in the archive that copying and pasting is pretty much all ya need to do.
A major factor for me is also cross platform. Just having the capability to at least get something on a MAC OS is significant.
I am sure PowerBasic will go 32bit eventually allthough no announcements about what is coming are permitted. (Vaporware is given as the reason for this)
Changing compilers is a tough step. I think in my development history I have only ever done it before because I was forced to.
Punch cards on a Vax PDP11 to a keyboard and terminal. Well that was't too much inconvenience!
FortranIV to Fortran77 that was minor
Fortran77 to Pascal now that was a pain
Pascal to Basic easier
Basic to PowerBasic and windows API - steep curve
PowerBasic to PureBasic - inconvenient
PoweBasic to C - steep curve
PowerBasic to .NET - NEVER!!!!!!
It is a bit inconvenient I agree. mainly the syntax changes which send you back to the help file more than you would like. We should get the ex powerb's together and put a little guide together for easy compiler migration and as new people come along they can add to it.
Stuff like:
Stuff like:
Code: Select all
PowerB Pureb
======================================
^ Pow()
ubound() PeekL(a()-8) -1
Dim a as string a.s
Declare DLL OpenLibrary(#LIBRARY, "c:\my.dll")
RetResult = CallFunction(#LIBRARY, "MYFUNCT", PARAM)
Dim At Pointer to struct Array on address
Declare Winapi API Funct with "_" built into language
Binary file _ Pointers and memory manip.
manip with _
strings
etc etc
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Never heard of Import / EndImport
Taking a quick look now though it says they are for:
For advanced programmers. Import : EndImport allows to easy declare external functions and variables from a library (.lib) or an object (.obj) file.
Powerb doesn't have these features, Declare is for DLLs only.
could be wrong about Import / EndImport though, never seen them before now

Taking a quick look now though it says they are for:
For advanced programmers. Import : EndImport allows to easy declare external functions and variables from a library (.lib) or an object (.obj) file.
Powerb doesn't have these features, Declare is for DLLs only.
could be wrong about Import / EndImport though, never seen them before now
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
In the case of an import library, Import / EndImport will cause the dll's import library to be statically linked into the executable and thus allows for load-time dynamic linking with the dll as opposed to run-time dynamic linking as is the case with LoadLibrary() etc.
Loadtime dynamic linking is of course the more 'traditional' way of linking with dll's.
Loadtime dynamic linking is of course the more 'traditional' way of linking with dll's.
I may look like a mule, but I'm not a complete ass.
cool,
I didn't know that. I think PureB's docs are a bit sparse actually, the key points are often there but that's about all.
I bought the PDF version of that book Kale has linked (Kale's book? )which has been very useful too as I like detailed explanations of some things, it's a shame there's no network stuff in there though.
I didn't know that. I think PureB's docs are a bit sparse actually, the key points are often there but that's about all.
I bought the PDF version of that book Kale has linked (Kale's book? )which has been very useful too as I like detailed explanations of some things, it's a shame there's no network stuff in there though.
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein