• Print

Author Topic: QB to Java?  (Read 1173 times)

angros47

  • Jr. Member
  • **
  • Posts: 94
QB to Java?
« on: October 12, 2008, 09:48:51 AM »
Will Qb64 ever support a java emitter? if it can emit c++, java shouldn't be too different (other compilers, that emit asm or c, would be more difficult to port)

Since QB64 don't use console, and can emulate a lot of features of QB, it would be a perfect programming environment to develop browser-embedded programs: a simple applet could emulate the QB screen, and old QB programs could be ported to the web. By now, the only way to do that is compiling with QB (with licensing problems) and then using JPC: so the applet, being a compiled QB running on freedos running on an emulator running on a virtual machine, will be very slow and resource-consuming, and the download will require the JPC emulator, the HD-image, the freedos, its drivers, and your program.

A QB code translated to java, and binded with a runtime able to emulate only needed features (basically, screenmodes, keyboard scancodes and maybe a bit of sound) would be faster and lighter to download, and I'm sure a lot of QB programmers will be glad to see gorilla, or nibbles, or their old and new games running on a web page with no changes.


Q bgúÿ

  • Guest
Re: QB to Java?
« Reply #1 on: October 12, 2008, 09:56:16 AM »
Making it translate to Java instead of C++ will also allow it to run on multiple platforms, including Mac OS, Windows, GNU/Linux, FreeBSD, and Solaris.  Qb64 uses the sdl library which can work with java: http://sdljava.sourceforge.net/ http://jsdl.sourceforge.net/

angros47

  • Jr. Member
  • **
  • Posts: 94
Re: QB to Java?
« Reply #2 on: October 12, 2008, 10:43:13 AM »
GCC too exists on other platform, and is faster than java... anyway, gcc supports java (gcc.gnu.org/java/ ), and also have a java-to-x86 compiler. So, using java, under windows sources could be compiled with GCJ, providing a real executable, as fast as actual C++ compiled, and under any other platform (or even windows, if you want) the classic java bytecode could be used.

IMHO, the actual QB64 compiler would be a great tool to develop web-based multiplatform small applications, because it tries to avoid hardware-dependent features, is easy to learn, has a lot of powerful built-in commands and large library of already-done programs, and allows very quick coding.

Under java, a simple "hello world" requires up to ten commands.... maybe it's needed for very large modules or applications (but who need them in applets?), but when I need a simple, quick-to-write-and-easy-to-read program, it's awful.

Galleon

  • Administrator
  • Hero Member
  • *******
  • Posts: 3769
  • QB Forever
    • Email
Re: QB to Java?
« Reply #3 on: October 13, 2008, 03:07:53 AM »
Sounds good, but I'd need to learn Java!

Also, I wouldn't feel like converting thousands of lines of C code into Java.

Marco

  • Guest
Re: QB to Java?
« Reply #4 on: October 13, 2008, 05:03:48 AM »
Quote from: angros47 on October 12, 2008, 09:48:51 AM
Will Qb64 ever support a java emitter? if it can emit c++, java shouldn't be too different (other compilers, that emit asm or c, would be more difficult to port)

That's a weird statement, since the C++ standard includes nearly the entire C standard.


Marco

  • Guest
Re: QB to Java?
« Reply #5 on: October 13, 2008, 05:08:42 AM »
Quote from: angros47 on October 12, 2008, 10:43:13 AM
GCC too exists on other platform, and is faster than java... anyway, gcc supports java (gcc.gnu.org/java/ ), and also have a java-to-x86 compiler. So, using java, under windows sources could be compiled with GCJ, providing a real executable, as fast as actual C++ compiled, and under any other platform (or even windows, if you want) the classic java bytecode could be used.

This is also not true, two different frontends of gcc do not necessarily generate the same code, and/or are not necessarily similar in speedcharacteristics. And even less in a browser, since then it will be interpreted




  • Print