Page 1 of 1

Porting to Windows and/or Mac OS

Posted: Tue May 30, 2017 7:21 pm
by waltax
I have been writing programs in Smart Basic which I would now like to port to PCs. Could someone please advise a straightforward manner in which I could port my SmartBasic program to a Windows and/or Mac computer?

Re: Porting to Windows and/or Mac OS

Posted: Tue May 30, 2017 7:31 pm
by Mr. Kibernetik
Smart BASIC programs are for iOS devices. How do you want to run them on Mac or PC?

Re: Porting to Windows and/or Mac OS

Posted: Wed May 31, 2017 1:46 am
by waltax
While I am not quite sure how to respond to your response, I would generally say that anything I am able to do on the iPad/iPhone i would ultimately want to do on a PC. I have to date spent many months developing a program on the iPad and would want to get the same functionality on a PC or other machine. For example, I may want to make the program available on a web server such that others might send data to a website and then have that website provide data back to the user. Also, my immediate concern is moving data back and forth to Microsoft Excel.

Re: Porting to Windows and/or Mac OS

Posted: Wed May 31, 2017 1:50 am
by waltax
I would generally say that working with Smart Basic and being able to develop on an iPad has been a real pleasure, but my program is of such a nature that i would eventually want to go beyond an iPad/iPhone, and am now wondering how I would go about doing so.

Re: Porting to Windows and/or Mac OS

Posted: Wed May 31, 2017 2:55 am
by GeorgeMcGinn
There will be Kernal issues and since the compiler's source is linked to functions specific to IOS, as a systems programmer who has written many programming languages, a major rewrite may be needed to get commands that are IOS specific to work, or more likely functionality will be lost as in Windows there may not be a comparable system function.

My suggestion is to look at BASIC dialects that were written specifically for Windows, like PowerBASIC, QB64, and others.

There are a few BASIC dialects that will work on Windows, MAC and ISO (actually, the only one that does this is RealBASIC or XOJO) but when you use it, there are differences, and even the code that runs on one OS has to be changed to run it on another.

PureBASIC and SpiderBASIC runs on Windows, MAC and UNIX. Even with this, some code is OS specific.

George.

waltax wrote:
Wed May 31, 2017 1:50 am
I would generally say that working with Smart Basic and being able to develop on an iPad has been a real pleasure, but my program is of such a nature that i would eventually want to go beyond an iPad/iPhone, and am now wondering how I would go about doing so.

Re: Porting to Windows and/or Mac OS

Posted: Thu Jun 01, 2017 12:28 am
by Mr. Kibernetik
I am not sure that smart BASIC can be of any help outside of iOS devices.
Are you considering to choose some other language to be able to run your programs on PC, or do you intend to run namely smart BASIC programs on PC?

Re: Porting to Windows and/or Mac OS

Posted: Fri Jun 02, 2017 8:20 pm
by waltax
Thanks for the information. This is very useful.

Re: Porting to Windows and/or Mac OS

Posted: Tue Jun 13, 2017 5:38 am
by GeorgeMcGinn
Hi Walt,

NOTE: I have no idea why this went to my drafts, but I'm posting it anyway incase you find the information useful.

Anything else you need, let us know.

I wrote a partial conversion program to convert PowerBASIC to SmartBASIC code.

If your plan is to run SmartBASIC code on a PC, I can give you a few more specific pointers.

First, all languages, whether different dialects of the same language, or converting from, say COBOL to BASIC, all languages have core functions that should be easy to convert.

That's assigning variable values, moving values around, string functions, math, sequential files, and print/display* for starters. I'll explain the * by display in a bit.

But then there are other device or OS-specific features that there may not be anything to convert it to. For example, graphics. IOS and SmartBASIC has built into the interpreter access to use Retina, which does not exist outside iOS.

Then there are different ways languages identify functions. Modulo, for example, is different Among languages. Most use the convention of X=360 MOD 45, where SmartBASIC uses X=360%45. So knowing these differences when selecting a dialect on Windows is very important.

Also, there will be built in functions, some bearing the same name and others that are unique that there is no easy conversion.

One example is when converting PowerBASIC(PB) to SmartBASIC(SB) source. An easy example is PB's INCR and DECR statements. In the code, you can write DECR I. This is the same in SB as write I=I-1 or I-=1. These, you can write SB functions to do this.

File processing is one of those areas that can have great differences. In PB, I can create a record type variable that holds a mixture of string and numeric variables. I can do a WRITE #1 RECTYPE$, but this cannot be done in SmartBASIC.

I can write a book on this topic, but I just wanted to give you some of the problems you or I will run into when taking source code and trying to make it if somewhere else.

After Matt Dean gave me the source code for Deskware's COBOLScript program, while this isn't BASIC, I can tell you about the hurdles that I faced when getting the compiler (This is a real compiler and linker that creates an executable binary file) to work on Apple's OS. It works on Windows and 4 different brands of UNIX, and it does work on Macs, but there were major OS incompatibility.

COBOLScript is written and compiled in Visual Studio in C/C++. This means when I compiled the product, it took with it Visual Studio internals with it. Inbetween going from source to executable binary, you can create an object module. This module is supposed to give you the ability to do the final linkedit or make on the device you plan to run on.

Due to the VS functions and routines, I had to practically do a rewrite which reduced the functionality, as I needed to remove all the VS code. Most of this code dealt with OBDC, or the ability to use SQL products from different vendors. The VS code allowed me to not worry about the extra code needed to interface with and tell the difference between Sybase SQL vs. MySQL vs. MSSQL, or even MS-ACCESS.

So I had to select the most popular products and write my own routines. This is just one of the many headaches that developers like Mr K has to deal with in porting his product to work on another OS.

I tried to make is sound simple (much more than it actually is) so you could understand what has to be done, even if the developer gave you the source and said "Good Luck" as Matt Dean said to me back in 2006.

Since I was a systems programmer, designed new 4GL's and even added new functions to existing languages, without having to get really technical, I hope the over simplication painted a broad enough picture of the issues involved in making a language (or even a application for that matter) work in different operating systems.

The best way to make an application or a programming language work in many operating systems is to put that in your design from the beginning, where all these issues can be addressed in advanced.

SmartBASIC is very versatile when I performed the exercise of converting PB to SB. It's Functions and Subroutines practically allows you to create new programming statements. So if you like a statement from another language, chances are you can write a Function that allows you use them in your main code.

Ricardo and I (and someothers) explored this and put this in a post thread. Besides that, another showed how you can include Javacript code within your SmartBASIC source. Links to the posts are below.

Whatever language you choose to convert SB to a Windows language, you will, more than likely, be able to use the same principles of writing your own functions to serve as executing new source code statements.

The program attached here is a library of functions, where some are new statements, and some are conversions of existing PB statements that preserve not only the source statement itself (you may need to use brackets), but some new statements, such as printline, which I use so that I just pass it a parameter and it prints the number of lines I need instead of having a program where I may need to use many PRINT statements throughout. It makes the code look cleaner as well.

Example #1:
Logic Functions: viewtopic.php?f=24&t=1772&p=11040&hilit=PRINT#p11040
User Davey110 noticed and posted:
"x=5
PRINT 3+(x=5)
Other versions of BASIC will evaluate (x=5) as True, then return a 1. Then 3+(1) will print as 4."

I wrote a sample function that allowed a programmer to use this type of logic in their SB program.
Example #2
waltax wrote:
Fri Jun 02, 2017 8:20 pm
Thanks for the information. This is very useful.