[183] in java-interest

home help back first fref pref prev next nref lref last post

Logical Subroutine that interprets Java byte-stream?

daemon@ATHENA.MIT.EDU (Robert Ayers)
Fri Jun 2 21:25:48 1995

Date: Fri, 2 Jun 1995 17:55:05 -0700
From: ayers@mv.us.adobe.com (Robert Ayers)
To: java-interest@java.Eng.Sun.COM
Cc: ayers@mv.us.adobe.com

I am wondering whether Java is potentially suitable as a scripting
language for user-extensions to Adobe Acrobat.

Mr Mcmanis replied:

  Yes, the simplest place is to look at the interpreter front end which
  does exactly that. The steps involved are,
	create a context (in the interpreter this is the primordial thread)
	load the bytes
	use ClassLoader.defineClass() to make them into a class
	invoke some method in that class.

  Now the interpreter invokes a method 'main' with the signature
	public static void main(String args[])

  If that method doesn't exist then the thing doesn't get started.

  In your case you can take two different routes:
	1) you can define a "standard" AcrobatExtension class that
	   all extensions have to subclass. As part of that class
	   you would define methods (possibly abstract) that all
	   extensions would implement.

	2) You can hack the interpreter main.c file and use a version
	   of the system() command to invoke it.

  (I obviously like the former :-)

  In either case, get the source (see how on the home page) and start
  in ../src/solaris/java/main for the interpreters front end and then
  look at the runtime directory for how the interpreter runs.

And I am game to alter the interpreter in order to "create a context,
load the bytes, use ClassLoader.defineClass() to make them into a class,
invoke some method in that class"
        
But alas the source-license agreement begins:

    Sun grants you a non-exclusive, non-transferable license to use
    the source code of the Licensed Software for the following two
    limited purposes only: (1) to permit you to understand the
    operation of the Licensed Software; and (2) to create a
    derivative work by porting the Licensed Software to new
    platforms ("Ported Software").
   
and that definitely does not include altering the interpreter so
that it is a subroutine rather than a main program.

Anyone interested in shipping a Solaris binary that is the interpreter
but as a function that takes, say, a (char *) of bytes to execute
rather than a main program that takes a (sort of) filename?

Bob

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post