plasma-umass / doppio

Breaks the browser language barrier (includes a plugin-free JVM).
http://plasma-umass.github.io/doppio-demo
MIT License
2.17k stars 176 forks source link

Specify and document external API #263

Closed jvilk closed 10 years ago

jvilk commented 11 years ago

We should determine what we want our external API to look like.

In both Node and the browser, doppio.js should expose a global doppio object that has all of the functionality that people will need.

Preloading files is already handled separately through the BFS interface.

So far, the following seems important:

I can't think of anything else right now.

TODO:

jvilk commented 10 years ago

Current obstacles to this:

We can expose the disassembler and tester through the JVM interface to fix those, and allow it to simply inline its own copy of util. This would also allow us to move option parsing for those instructions into JVM.ts and out of the console and browser frontends. Win/win.

jvilk commented 10 years ago

Currently blocked on process.stdout/process.stdin emulation in BrowserFS, which will allow me to use those to print to console from the disassembler/testing functions that I plan to roll into the JVM module.

...which I'm almost done implementing. Currently bugtesting to make sure it works well enough for our simple use case.

jvilk commented 10 years ago

I'm making good progress in the std_stream_refactor branch.

I think the API will look something like the following, exposed through a global doppio object:

interface doppio {
  // JVM constructor for direct manipulation.
  JVM: jvm.JVM;
  // Static methods that simulate the Java CLI.
  java: (args: string[], jcl_path: string, done_cb: (arg: boolean) => void, implicit_classpath?: string[], launcher_name?: string): jvm.JVM;
  javap: (args: string[], jcl_path: string, done_cb: (arg: boolean) => void, implicit_classpath?: string[], launcher_name?: string): jvm.JVM;
  javac: (args: string[], jcl_path: string, done_cb: (arg: boolean) => void, implicit_classpath?: string[], launcher_name?: string): jvm.JVM;
  test: (command_signature_tbd);
}

Something like that. I'm probably actually going to change those static functions so they take a single options object -- makes it easier to add new options without breaking API calls. But the above arguments should give you an idea behind what data needs to be passed through the API.

I'm probably going to add the following source files:

Overall, this will:

jvilk commented 10 years ago

Checklist:

jvilk commented 10 years ago

I need to change the java_cli file to use CamelCase, but I'm almost done with some nice documentation:

https://github.com/plasma-umass/doppio/wiki/Doppio-Developer-Guide

jvilk commented 10 years ago

The new developer guide should be enough for now, as I'm sure the interfaces for e.g. Java objects and such will be in flux as we develop further.