I mentioned previously that cross compilation to one of the other versions of purebasic would be great, i.e compile an amiga or linux program in the microsoft version. etc
But also a version that will compile to Java Bytecode would be GREAT!!!
This would allow PureBasic programs to run on almost any system. Of course only a subset of the commands would work, but it would still be good.
cross compilation & java bytecode
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
-
- Enthusiast
- Posts: 423
- Joined: Fri Apr 25, 2003 5:22 pm
- Contact:
Yes, that would be wonderful !
[In fact I sometimes used PB together with Java: in the way calling PB-DLL-functions as native Java-functions and for the actual project I write the GUI in PB and let Java do some calculation (because of full doubles & int64 support - and it is possible to encapsulate the java-part to let it run on all machines at the university - via SSH
)]
Perhaps it would be the easiest way to write a sourcecode-parser that 'simply' translates your PB-code to Java-source and then compile that to bytecode using an installed java-compiler. This should give no problems with all datatypes, maths, arrays, linked lists, loops, ifs, procedures, and perhaps even the window-lib (perhaps - I never used e.g. swing yet) and some others (file, network,...) etc.
But there will exist problems with the 3D-engine and the main limitation that Java doesn't support pointers of any kind. So you cannot directly address the memory (for Peek/Poke/@/? and all this stuff). This is all done by Java Runtime itself (and seems to be necessary for this huge crossplatform-compatibility) But perhaps you could make a workaround using bytearrays for this.
OK - Fred ? Do you think this is possible for you until May ? pleeease
[In fact I sometimes used PB together with Java: in the way calling PB-DLL-functions as native Java-functions and for the actual project I write the GUI in PB and let Java do some calculation (because of full doubles & int64 support - and it is possible to encapsulate the java-part to let it run on all machines at the university - via SSH

Perhaps it would be the easiest way to write a sourcecode-parser that 'simply' translates your PB-code to Java-source and then compile that to bytecode using an installed java-compiler. This should give no problems with all datatypes, maths, arrays, linked lists, loops, ifs, procedures, and perhaps even the window-lib (perhaps - I never used e.g. swing yet) and some others (file, network,...) etc.
But there will exist problems with the 3D-engine and the main limitation that Java doesn't support pointers of any kind. So you cannot directly address the memory (for Peek/Poke/@/? and all this stuff). This is all done by Java Runtime itself (and seems to be necessary for this huge crossplatform-compatibility) But perhaps you could make a workaround using bytearrays for this.
OK - Fred ? Do you think this is possible for you until May ? pleeease

%1>>1+1*1/1-1!1|1&1<<$1=1
-
- Addict
- Posts: 1126
- Joined: Wed Oct 15, 2003 12:40 am
- Location: Sweden
- Contact:
Yeah - I agree... Java would only be a very small part of PB with it's limitation and so on - and lets face it Java is JAVA, Pure Basic is BASIC... It really doesn't "fit" in the Pure Basic concept and for example... What GUI should you use? Swing classes? Should it support Java 2? Applets or only native Java code?freak wrote:If you want Java Bytecode, why don't you use... Java?
Better with a Pure Basic plug-in in that case... as Clickteam have done with Jamagic.
That's my opinion... :roll:

(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
I don't know if I was being clear enough...
I mean compile to the virtual machine bytecode, not to the java language. Its the bytecode thats interpreted, not the Java source. Thus to Fred its just another machine to compile to, like the 68k or others.
This way the resultant file will run on any system that has implemented a Java interpreter.
In any event, even if you think that "JavaByteCode" output is a long way off, possibly cross compilation between the 2 x86 BASIC versions (Linux and Microsoft) isn't?
What do you reckon Fred?
I mean compile to the virtual machine bytecode, not to the java language. Its the bytecode thats interpreted, not the Java source. Thus to Fred its just another machine to compile to, like the 68k or others.
This way the resultant file will run on any system that has implemented a Java interpreter.
In any event, even if you think that "JavaByteCode" output is a long way off, possibly cross compilation between the 2 x86 BASIC versions (Linux and Microsoft) isn't?
What do you reckon Fred?
-
- Addict
- Posts: 1126
- Joined: Wed Oct 15, 2003 12:40 am
- Location: Sweden
- Contact:
Yes - but you still will be stuck with the limitations (and speed) of Java... and need all the Sun JRE-stuff... and I don't see the point really - of the 660 Pure Basic command, you maybe can use 100 - 200 for use in Java bytecode (at most)... (my guess - can be totally wrong)DoubleDutch wrote:I mean compile to the virtual machine bytecode, not to the java language. Its the bytecode thats interpreted, not the Java source. Thus to Fred its just another machine to compile to, like the 68k or others.
No DirectX access, no access to hardware, no access to the filesystem (if you run it as an applet), different GUI - you have to remake PB totally...
To generate Java bytecode, isn't the same as for example generate XBox binaries. There you have the same foundation and can use the same dll's.
I CAN see the point if you wanna do a simple 2D game in Pure and then generate Java bytecode, so you can run it on different platforms - it's the only use I can see... and the most easy implementation... That would be pretty cool...
If you wanna use GUI and so on... GOD, what a workload for Fred... *L*
Why not generate code that you can run with MS .NET Framework to begin with?


(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
-
- Addict
- Posts: 1126
- Joined: Wed Oct 15, 2003 12:40 am
- Location: Sweden
- Contact: