diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2015-07-19 12:36:39 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2015-07-19 12:36:39 +0100 |
commit | 10c5dcd078700ff574512fc692adb6835653ba38 (patch) | |
tree | 94828bb4a1a14e3a9c78d2d9a45c25e902330161 /javascript/duktape/comment.c | |
parent | d68e2c879c9254cae1ea8e248ebe70ddf5e797e6 (diff) | |
download | netsurf-10c5dcd078700ff574512fc692adb6835653ba38.tar.gz netsurf-10c5dcd078700ff574512fc692adb6835653ba38.tar.bz2 |
REWORK: ALL THIS CRUD
Diffstat (limited to 'javascript/duktape/comment.c')
-rw-r--r-- | javascript/duktape/comment.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/javascript/duktape/comment.c b/javascript/duktape/comment.c new file mode 100644 index 000000000..877793af2 --- /dev/null +++ b/javascript/duktape/comment.c @@ -0,0 +1,50 @@ +/* DO NOT USE, DODGY BIT FOR VINCE */ + +#include <dom/dom.h> + +#include "utils/log.h" + +#include "javascript/dukky.h" + +DUKKY_FUNC_INIT(comment, struct dom_node_comment *comment) +{ + DUKKY_FUNC_T(character_data, __init)(ctx, &priv->parent, (struct dom_node_character_data *)comment); + LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); +} + +DUKKY_FUNC_FINI(comment) +{ + /* do any comment finalisation here, priv ptr exists */ + LOG("Finalise %p", duk_get_heapptr(ctx, 0)); + DUKKY_FUNC_T(character_data, __fini)(ctx, &priv->parent); +} + +static DUKKY_FUNC(comment, __constructor) +{ + DUKKY_CREATE_PRIVATE(comment); + DUKKY_FUNC_T(comment, __init)(ctx, priv, + duk_get_pointer(ctx, 1)); + duk_set_top(ctx, 1); + return 1; +} + +static DUKKY_FUNC(comment, __destructor) +{ + DUKKY_SAFE_GET_PRIVATE(comment, 0); + DUKKY_FUNC_T(comment, __fini)(ctx, priv); + free(priv); + return 0; +} + +DUKKY_FUNC(comment, __proto) +{ + /* Populate comment's prototypical functionality */ + + /* Set this prototype's prototype (left-parent)*/ + DUKKY_GET_PROTOTYPE(character_data); + duk_set_prototype(ctx, 0); + /* And the initialiser/finalizer */ + DUKKY_SET_DESTRUCTOR(0, comment); + DUKKY_SET_CONSTRUCTOR(0, comment, 1); + return 1; /* The proto object */ +} |