File: | build/Linux-gtk2/duktape/dom_settable_token_list.c |
Warning: | line 130, column 5 Value stored to 'exc' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* Generated by nsgenbind |
2 | * |
3 | * nsgenbind is published under the MIT Licence. |
4 | * nsgenbind is similar to a compiler is a purely transformative tool which |
5 | * explicitly makes no copyright claim on this generated output |
6 | */ |
7 | |
8 | /* DukTape JavaScript bindings for NetSurf browser |
9 | * |
10 | * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org> |
11 | * This file is part of NetSurf, http://www.netsurf-browser.org/ |
12 | * Released under the terms of the MIT License, |
13 | * http://www.opensource.org/licenses/mit-license |
14 | */ |
15 | |
16 | #include <dom/dom.h> |
17 | |
18 | #include "utils/log.h" |
19 | #include "utils/nsurl.h" |
20 | |
21 | #include "javascript/duktape/duktape.h" |
22 | |
23 | struct browser_window; |
24 | struct html_content; |
25 | struct dom_node; |
26 | struct dom_element; |
27 | struct dom_document; |
28 | struct dom_html_element; |
29 | struct dom_node_character_data; |
30 | struct dom_node_text; |
31 | struct dom_node_list; |
32 | struct dom_node_comment; |
33 | struct dom_html_collection; |
34 | struct dom_html_br_element; |
35 | |
36 | |
37 | #include "build/Linux-gtk2/duktape/binding.h" |
38 | #include "build/Linux-gtk2/duktape/private.h" |
39 | #include "build/Linux-gtk2/duktape/prototype.h" |
40 | |
41 | #include "javascript/duktape/dukky.h" |
42 | |
43 | static void dukky_dom_settable_token_list___init(duk_context *ctx, dom_settable_token_list_private_t *priv, struct dom_tokenlist *tokens) |
44 | { |
45 | dukky_dom_token_list___init(ctx, &priv->parent, tokens); |
46 | #line 15 "DOMSettableTokenList.bnd" |
47 | #line 48 "dom_settable_token_list.c" |
48 | } |
49 | |
50 | static void dukky_dom_settable_token_list___fini(duk_context *ctx, dom_settable_token_list_private_t *priv) |
51 | { |
52 | dukky_dom_token_list___fini(ctx, &priv->parent); |
53 | } |
54 | |
55 | static duk_ret_t dukky_dom_settable_token_list___constructor(duk_context *ctx) |
56 | { |
57 | /* create private data and attach to instance */ |
58 | dom_settable_token_list_private_t *priv = calloc(1, sizeof(*priv)); |
59 | if (priv == NULL((void*)0)) return 0; |
60 | duk_push_pointer(ctx, priv); |
61 | duk_put_prop_string(ctx, 0, dukky_magic_string_private); |
62 | |
63 | dukky_dom_settable_token_list___init(ctx, priv, duk_get_pointer(ctx, 1)); |
64 | duk_set_top(ctx, 1); |
65 | return 1; |
66 | } |
67 | |
68 | static duk_ret_t dukky_dom_settable_token_list___destructor(duk_context *ctx) |
69 | { |
70 | dom_settable_token_list_private_t *priv; |
71 | duk_get_prop_string(ctx, 0, dukky_magic_string_private); |
72 | priv = duk_get_pointer(ctx, -1); |
73 | duk_pop(ctx); |
74 | if (priv == NULL((void*)0)) return 0; |
75 | |
76 | dukky_dom_settable_token_list___fini(ctx, priv); |
77 | free(priv); |
78 | return 0; |
79 | } |
80 | |
81 | static duk_ret_t dukky_dom_settable_token_list_value_getter(duk_context *ctx) |
82 | { |
83 | /* Get private data for method */ |
84 | dom_settable_token_list_private_t *priv = NULL((void*)0); |
85 | duk_push_this(ctx); |
86 | duk_get_prop_string(ctx, -1, dukky_magic_string_private); |
87 | priv = duk_get_pointer(ctx, -1); |
88 | duk_pop_2(ctx); |
89 | if (priv == NULL((void*)0)) { |
90 | return 0; /* can do? No can do. */ |
91 | } |
92 | |
93 | #line 17 "DOMSettableTokenList.bnd" |
94 | |
95 | dom_exception exc; |
96 | dom_string *value; |
97 | |
98 | exc = dom_tokenlist_get_value(priv->parent.tokens, &value); |
99 | if (exc != DOM_NO_ERR) return 0; /* coerced to undefined */ |
100 | |
101 | duk_push_lstring(ctx, dom_string_data(value), dom_string_length(value)); |
102 | dom_string_unref(value); |
103 | |
104 | return 1; |
105 | #line 106 "dom_settable_token_list.c" |
106 | } |
107 | |
108 | static duk_ret_t dukky_dom_settable_token_list_value_setter(duk_context *ctx) |
109 | { |
110 | /* Get private data for method */ |
111 | dom_settable_token_list_private_t *priv = NULL((void*)0); |
112 | duk_push_this(ctx); |
113 | duk_get_prop_string(ctx, -1, dukky_magic_string_private); |
114 | priv = duk_get_pointer(ctx, -1); |
115 | duk_pop_2(ctx); |
116 | if (priv == NULL((void*)0)) { |
117 | return 0; /* can do? No can do. */ |
118 | } |
119 | |
120 | #line 31 "DOMSettableTokenList.bnd" |
121 | |
122 | dom_exception exc; |
123 | dom_string *value; |
124 | duk_size_t slen; |
125 | const char *s = duk_require_lstring(ctx, 0, &slen); |
126 | |
127 | exc = dom_string_create_interned((const uint8_t *)s, slen, &value); |
128 | if (exc != DOM_NO_ERR) return 0; |
129 | |
130 | exc = dom_tokenlist_set_value(priv->parent.tokens, value); |
Value stored to 'exc' is never read | |
131 | dom_string_unref(value); |
132 | |
133 | return 0; |
134 | #line 135 "dom_settable_token_list.c" |
135 | } |
136 | |
137 | duk_ret_t dukky_dom_settable_token_list___proto(duk_context *ctx, void *udata) |
138 | { |
139 | /* Set this prototype's prototype (left-parent) */ |
140 | /* get prototype */ |
141 | duk_get_global_string(ctx, dukky_magic_string_prototypes); |
142 | duk_get_prop_string(ctx, -1, "\xFF\xFFNETSURF_DUKTAPE_PROTOTYPE_DOMTOKENLIST"); |
143 | duk_replace(ctx, -2); |
144 | duk_set_prototype(ctx, 0); |
145 | |
146 | /* Add read/write property */ |
147 | duk_dup(ctx, 0); |
148 | duk_push_string(ctx, "value"); |
149 | duk_push_c_function(ctx, dukky_dom_settable_token_list_value_getter, 0); |
150 | duk_push_c_function(ctx, dukky_dom_settable_token_list_value_setter, 1); |
151 | duk_def_prop(ctx, -4, DUK_DEFPROP_HAVE_GETTER(1U << 7) | |
152 | DUK_DEFPROP_HAVE_SETTER(1U << 8) | |
153 | DUK_DEFPROP_HAVE_ENUMERABLE(1U << 4) | DUK_DEFPROP_ENUMERABLE(1U << 1) | |
154 | DUK_DEFPROP_HAVE_CONFIGURABLE(1U << 5)); |
155 | duk_pop(ctx); |
156 | |
157 | /* Set the destructor */ |
158 | duk_dup(ctx, 0); |
159 | duk_push_c_function(ctx, dukky_dom_settable_token_list___destructor, 1); |
160 | duk_set_finalizer(ctx, -2); |
161 | duk_pop(ctx); |
162 | |
163 | /* Set the constructor */ |
164 | duk_dup(ctx, 0); |
165 | duk_push_c_function(ctx, dukky_dom_settable_token_list___constructor, 2); |
166 | duk_put_prop_string(ctx, -2, "\xFF\xFFNETSURF_DUKTAPE_INIT"); |
167 | duk_pop(ctx); |
168 | |
169 | return 1; /* The prototype object */ |
170 | } |
171 | |
172 |