July 23, 2024, 08:40:07 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Migrating to CBasic

Started by Oliver Cromwell, November 10, 2010, 06:35:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Oliver Cromwell

As a chemist/numismatist I have been writing code using a DOS BASIC Compiler from the early 1990's. The program has grown and is now 1500 lines of code and does what I want it to do producing thermal images in color using the PSET command but of course I am now constrained by the fact that neither Windows Vista or 7 will work with an old DOS program.

In attempting to resolve this difficulty I just found the Ionic Wind website today. I am thinking my easiest option is to translate to CBasic and keep the code to a narrow range of commands to make life simple.

Question  - is this a good strategy to follow going forward or am I making a move which will require another migration to something else in the near future? I can't tell which compiler is
                going to stand the test of time and there are some choices on this website, but which compiler to use?

              - is the translation simply a slog it out or are there some shortcuts I could take to make the transfer to CBasic easier?

Any input would be well received, thanks.             


LarryMc

Okay,
I personally prefer IWBasic which is currently in development for ver 2.0.
IWBasic's capabilities are outlined here.
There are a few here who strongly prefer CBasic.
It is not currently being updated.  I'm not sure that the current owner got any/all the code necessary to ever update it when he made the purchase.
CBasic's capabilities are outlined here.

And then there are those that prefer the c-type syntax of Aurora.
Aurora has never been offically released.
Aurora's capabilities are outlined here.

I come from a Basic background so I would always pick Basic type syntax over c-type syntax.

IWbasic is more powerful than CBasic but you could accomplish your task with either one.

I am on the forum more than anyone else and try to help anytime that I can.
But I only use IWBasic so the help I can provide is limited with the other 2 languages.

But there are other forum members highly skilled with all 3 languages.

That's really about all the help I can provide.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

GWS

Hello OC .. :)

I'm an ardent CBasic user, so I'll speak to that.

You can find many varied applications created in CBasic on this Forum.

The language has stood the test of nearly 10 years of usage by many members, who love the ease of use and testing facilities provided by the interpreter.  The Help and Debugging systems are also well tested and informative.

CBasic is good at graphics and mathematical applications, so should suit your needs very well.  It has not changed in many years, and now appears unlikely to - but for many applications it is perfectly adequate.

Some like myself, would have liked to see it develop even better 2D graphics, and to have had an add-on compile feature, but circumstances conspired so that hasn't happened so far.  Not to worry, the language is quite robust as it stands.

I assume you are referring to QB45 as your DOS language - a perfectly good and useful system even today, except it doesn't do Windows.  That means the DOS user interface is pretty boring.

CBasic is very good at Windows applications, but there is a bit of learning to do about Windows and messages to give you the 'event-driven' feel of a Windows program.  There are several introductory user guides available here which explain all this.

CBasic is free (or at most a small contribution) and will probably last a long time just as QB45 has.

IWBasic is the big brother language, but is not so easy to use.  I tend to develop in CBasic as first choice - only picking up IWBasic for jobs which cannot be done in CBasic.  In practice that means hardly ever ..  :)

Your existing programs would need to be re-cast into Windows format - the calculations remaining the same.  You could rely on advice from Forum members to help out on that.

Of course, you have many other Basics to choose from - I've tried them all - but always return to good old CBasic for my applications.

Try it out on a small example to get the feel of it.  You won't be disappointed.

best wishes, :)

Graham

Tomorrow may be too late ..

aurelCB

Welcome to forum...
I suggest you to start with CBasic ....
then when you see how work then later you can migrate to IWBasic .

Oliver Cromwell

Thank you for your responses.

My current program was written using the first release of PowerBasic for DOS back around 1990. Before that I used QB45 but found it to be considerably slower and generated large files. At the time I was writing programs to predict profiles produced by imaging chemicals in use on semi-conductor and flat panel display production lines. It was all maths and graphics. This activity died in 2005 when the semiconductor industry was moved from the USA to mainland China. Now using a variant of this in financial markets.

It sounds like CBasic would be a good starting point for me. Does a CBasic program with its reduced capabilities still work under IWBasic or is it a totally different beast? This point is not clear to me at this point. Guess the question can be better phrased by asking how much of an overlap is there between CBasic and IWBasic programming?

Neville

LarryMc

There are some commands that appear to be identical.
Others are similar - the commands for creating windows and controls fall into the similar category.

The syntax for CBasic was created first.  That established a basis of thought.
Then the structure and syntax of IWBasic was created.  Because that involved going from an interpreter to a compiler some of the commands had to be changed to facilitate the new internal structure. (Also to make it more powerful.)

If you went with CB first then later on you could migrate your code to IWBasic without too much trouble.

IWBasic does make small exes and real easy to create your own custom libs and dlls if you needed them.

Again my personal preference is IWBasic but will never knock Graham (GWS) for his love of Cbasic.

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Johnny

Hello Oliver,

I find both languages great to use, I select one or the other depending of the demands of the program under development.

When the program is not very demanding, I tend to use in the first place CBasic, because it debugs so much faster...  ;D
But when the program is more demanding, like number crunching routines, or processing huge files, then you feel very well the difference in execution speed between the Interpreter-CBasic, and the compiler-IWBasic.
IWBasic would be a better choice for those more demanding applications, and I guess that the calculations for your thermal images are rather intensive?

Now, Aurel's idea is certainly not bad, you could first get used to the windows environment with CBasic, and when that version works already, and it's really too slow, then translate the program to IWBasic.
Both syntaxes are similar, but not 100% identical, so it needs a bit of changes here and there.

There exist an old software, called "Standard2Pro", from Steve Boothman aka bevets (RIP), that can be very helpful to translate from CBasic to IWBasic, it helps you a lot further in translating, but also not for 100%, and you have to rename the file extensions manually to load it with this tool and after saving the result...
http://ebasic-aurora.com/forums/index.php?topic=1644.msg15229#msg15229
Does anyone has the source of this program? Maybe it could be improved, the program is still useful nowadays, but needs some corrections to work with the latest versions...

Greetings,
Johnny


TexasPete

Johnny, I have a working compiled version of the program StandardtoPro. I would also like the source code to it so it could be updated. Does anyone have It.


Texas Pete

Brian

Hi,

My version of StandardToPro is 1.03. If this is any higher than other folks have got,
I can always zip it up and post it

I have never seen any source code for this program at all

Brian

GWS

Here's an old IBasic source of s2p .. rename the file to .cba to try it ..  :)

I may have a more recent version, but it would take a search of many CD's to find it ..  ::)

best wishes, :)

Graham
Tomorrow may be too late ..

TexasPete

November 11, 2010, 01:38:22 PM #10 Last Edit: November 11, 2010, 01:40:43 PM by TexasPete
Thanks GWS for the code . If you find the latter version put it on the board.
Texas Pete

Brian , I don't know is that is the last release or not. Why don't you post it for the new people just in case.

GWS

Ah ! .. it might not be so easy ..  ::)

The code appears to be in IBPro form, but it doesn't compile in IWBasic unfortunately .. there's always a snag.

Still, it gives an idea of how it was done ..

best wishes, :)

Graham
Tomorrow may be too late ..

TexasPete

Thanks Graham I had already tried to compile and run. And It wouldn't.

Thanks
Texas Pete
It is a shame that I can.t get my program to run under 1.15

Brian

Tee Hee!

I still have IB Pro on the ol' PC !

Brian

LarryMc

Here's the copy that Grahamposted above that he and other couldn't compile.

I fixed it so it would compile and ran the CBasic christmas tree example in it and it converted it.
I didn't check the resulting code.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Johnny

Had done almost the same to fix it, also changed the file extensions. It is attached here.
Basically, "Class" was now recognized as a keyword, and not as a variable name, and the declaration was in the wrong place, or even not needed.
It does compile and convert files now, but this version is still in the beginning stage, far from complete...
I hope a newer version of source turns up somewhere, someday...  :)

Thanks Graham & Larry!
Johnny

GWS

Wow, that was fast Larry ..  :)

Amazing what you can do when you are familiar with a language ..

best wishes, :)

Graham
Tomorrow may be too late ..

TexasPete

Thanks Everybody!  I will make one more attempt to figure out what is wrong on Cb . If I can't find it I will try migrating it over Iwbasic. Where I can split of the working sections off as include files and find the bug .
Texas Pete

Brian

Hi,

This is my version of Standard2Pro. Sorry, I don't have any source code,
but this must be a later version than recently posted, because it has an
options dialog, which allows you to set what you need to convert

Don't forget, a result of a good conversion relies on the source code
being "clean," that is, put portions of code on different lines

CONTROLCMD, etc:CONTROLcmd, etc
doesn't work so well, but
CONTROLCMD, etc
CONTROLCMD, etc
does

Brian

Oliver Cromwell

Since my previous two posts I have dabbled with CBasic and to do this studied the programming examples listed on another thread.

To be honest I have found that it is not so easy to migrate a 1500 line programme from PowerBasic to CBasic. What I anticipated and what I found were quite different. So that leads me now to ask if there is anyone out there with time to spare who would be prepared to offer a service to convert one 1500 line programme from PowerBasic DOS 3.5 to CBasic or even IWBasic, as I have no real preference?

Thanks