Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement base nucleus API #3

Open
8 of 16 tasks
Fishrock123 opened this issue Jul 21, 2016 · 2 comments
Open
8 of 16 tasks

Implement base nucleus API #3

Fishrock123 opened this issue Jul 21, 2016 · 2 comments

Comments

@Fishrock123
Copy link
Member

Fishrock123 commented Jul 21, 2016

From https://github.com/nucleus-js/design/blob/master/api/nucleus.md

Guide

Properties should be added in src/nucleus.rs.

The Duktape API is documented at http://duktape.org/api.html

Functions should be put in src/nucleus_functions.rs and accessed via nucleus_functions::your_fn.
Functions should be exposed under this comment in src/nucleus.rs in the following manner:

duk::push_c_function(ctx, nucleus_functions::/* Your fn name */, /* number of arguments it accepts */);
duk::put_prop_string(ctx, -2, "/* your fn's JS name */");

If new duktape APIs are necessary they should probably be exposed in src/duk_api.rs for easy use and re-use.

A direct declaration of the duktape C api is required in the extern { } block.

The new exposed API should then drop the duk_ (it will be accessed via duk::) and handle the unsafe block and any major type conversions (such as CString).

New command line options can be added to this code in src/main.rs.


System

Runtime

Resources

@Fishrock123
Copy link
Member Author

Fishrock123 commented Aug 6, 2016

nucleus.base and nucleus.compile should be quite easy now if someone wants to pick them up -- the relevant base_path handling code already exists in the code base, as well as a compile function for dofile.

@Fishrock123
Copy link
Member Author

Fishrock123 commented Aug 23, 2016

Hmm, looks like this guide is a bit out of date, will update soon. Most of the core bits should still be correct though.

Edit: done, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant