Java bindings -> Javascript?

B

Blitzen

There is a relatively small, simple text-manipulation library written
in C (called liblouis) that does string manipulation with lots of
conditionals. Someone has written Java bindings for it - if that's the
case, does that mean it will work in Javascript? If not, what all may
be involved in writing Javacript bindings for either a Java or C
library?
 
M

Michael Haufe (\TNO\)

No, Java and JavaScript are two separate languages.

Mozilla used to support LiveConnect in the browser which may support
this. Rhino I think still supports calls to Java. I agree that it may
be wisest to just port the code to JavaScript.
 
V

VK

Blitzen said:
There is a relatively small, simple text-manipulation library written
in C (called liblouis) that does string manipulation with lots of
conditionals. Someone has written Java bindings for it - if that's the
case, does that mean it will work in Javascript? If not, what all may
be involved in writing Javacript bindings for either a Java or C
library?

What do you mean by that exactly? Unless directly patching the JS
engine and using it in a non-so-natively-browser environment, your
only option is to write an embedded applet for HTML page with some
public methods in it so JavaScript could intercommunicate with it -
wherever JVM would be available which is about 4% worldwide but may be
up to 100% your own office-wide. Even in the last case you don't get
any substantial benefits from using Java because it would be run just
like any other equal rights object's process, say an animagif sequence
frame change on the page. Thread resource management doesn't do any so
good because the max you can get is 100% of those rather humble
resources given to your applet by the OS dispatcher. The failure to
realize that ended up some really cool (S)FTP clients and some really
interesting encryption systems like BouncyCastle. So unless I
misinterpreted your question, please stay server-side and RMI with
JavaScript with the always possible JS-disabled situation fall back.
 
W

wilq

There is a relatively small, simple text-manipulation library written
in C (called liblouis) that does string manipulation with lots of
conditionals. Someone has written Java bindings for it - if that's the
case, does that mean it will work in Javascript? If not, what all may
be involved in writing Javacript bindings for either a Java or C
library?

You can teoretically look at:

https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Packages


At least I saw Java code working from Javascript in Firefox and IE6
(!!!), but I would not rely on that, because it requires a JVM to be
installed on client computer.
 
B

Blitzen

Thanks for your replies. Yes, it's a Braille editor, with only a
handful of subroutines. The only ones I need are for translating
"grade 1 Braille" (regular words like we spell them) into "grade 2
braille" (a more efficient abbreviation system to make large-font
braille books take less paper) which use pre-written translation
tables (CTB files). It is a large hash of abbreviations to their full
text equivalents, but also has lots of nested conditionals for things
like whether you're in an open quote, a number sequence, etc. It would
probably be a tedious but straightforward task of translating these
functions to Javascript which with all its text manipulation methods
would probably do it all more elegantly than C; I just want to make
sure I'm not going to spend the several days re-inventing the wheel if
there's a way to use it as-is in a client-side JS applet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top