Skip to content
This repository
Newer
Older
100644 357 lines (249 sloc) 8.937 kb
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
1 /*
e69d2a4f » petdance
2010-03-30 Made pcc_params be static. Removed unused arg from build_func. Header…
2 Copyright (C) 2001-2010, Parrot Foundation.
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
3 $Id$
4
5 =head1 NAME
6
f474cd7f » bschmalhofer
2006-01-18 [perl #38235] Rename (dyn)?classes to (dyn)?pmc
7 src/pmc/nci.pmc - Native Call Interface
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
8
9 =head1 DESCRIPTION
10
11 The vtable functions for the native C call functions.
12
13 =head2 Methods
14
15 =over 4
16
17 =cut
18
19 */
2a2c19b1 » Dan Sugalski
2002-11-21 Added in code to properly do native calls to library routines loaded via
20
6bdd5f99 » petdance
2010-03-28 headerizer now runs on PMC files
21 /* HEADERIZER HFILE: none */
22 /* HEADERIZER BEGIN: static */
e69d2a4f » petdance
2010-03-30 Made pcc_params be static. Removed unused arg from build_func. Header…
23 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
24
25 PARROT_IGNORABLE_RESULT
26 static nci_thunk_t /*@alt void@*/
27 build_func(PARROT_INTERP,
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
28 ARGMOD(Parrot_NCI_attributes *nci))
e69d2a4f » petdance
2010-03-30 Made pcc_params be static. Removed unused arg from build_func. Header…
29 __attribute__nonnull__(1)
30 __attribute__nonnull__(2)
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
31 FUNC_MODIFIES(*nci);
e69d2a4f » petdance
2010-03-30 Made pcc_params be static. Removed unused arg from build_func. Header…
32
33 #define ASSERT_ARGS_build_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
34 PARROT_ASSERT_ARG(interp) \
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
35 , PARROT_ASSERT_ARG(nci))
e69d2a4f » petdance
2010-03-30 Made pcc_params be static. Removed unused arg from build_func. Header…
36 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
6bdd5f99 » petdance
2010-03-28 headerizer now runs on PMC files
37 /* HEADERIZER END: static */
38
0c5f9c3f » John Harrison
2010-08-17 GSoC: The majority of my NCI changes in 1 commit.
39 /*
40
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
41 =item C<static nci_thunk_t build_func(PARROT_INTERP, Parrot_NCI_attributes
42 *nci)>
0c5f9c3f » John Harrison
2010-08-17 GSoC: The majority of my NCI changes in 1 commit.
43
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
44 Actually build the NCI thunk.
0c5f9c3f » John Harrison
2010-08-17 GSoC: The majority of my NCI changes in 1 commit.
45
46 =cut
47
48 */
49
e69d2a4f » petdance
2010-03-30 Made pcc_params be static. Removed unused arg from build_func. Header…
50 PARROT_IGNORABLE_RESULT
51 static nci_thunk_t
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
52 build_func(PARROT_INTERP, ARGMOD(Parrot_NCI_attributes *nci))
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
53 {
4d774df0 » mikehh
2010-03-30 fix codetest failure - assert args - src/pmc/nci.pmc
54 ASSERT_ARGS(build_func)
55
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
56 nci->signature = Parrot_nci_parse_signature(interp, nci->sig_str);
57 Parrot_nci_sig_to_pcc(interp, nci->signature,
58 &nci->pcc_params_signature,
59 &nci->pcc_return_signature);
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
60
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
61 /* Arity is length of the signature minus one (the return type). */
62 nci->arity = VTABLE_elements(interp, nci->signature) - 1;
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
63
64 /* Build call function. */
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
65 nci->fb_info = build_call_func(interp, nci->sig_str);
66 nci->func = F2DPTR(VTABLE_get_pointer(interp, nci->fb_info));
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
67
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
68 return (nci_thunk_t)nci->func;
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
69 }
70
26469515 » tewk
2008-08-22 [gsoc_nci] gsoc_nci_001 merge
71
336b07ce » bacek
2010-05-16 Add 'does invokable' to all PMCs with VTABLE_invoke (except Object). …
72 pmclass NCI auto_attrs provides invokable {
9d723e0d » plobsing
2010-05-14 update NCI signature parsing to emit new (half year old) PCC param an…
73 /* NCI thunk handling attributes */
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
74 ATTR PMC *signature; /* parsed signature */
75 ATTR STRING *sig_str; /* signature string */
76 ATTR void *func; /* function pointer to call */
77 ATTR PMC *fb_info; /* frame-builder info */
78 ATTR void *orig_func; /* pointer to wrapped function */
0c5f9c3f » John Harrison
2010-08-17 GSoC: The majority of my NCI changes in 1 commit.
79
9d723e0d » plobsing
2010-05-14 update NCI signature parsing to emit new (half year old) PCC param an…
80 /* Parrot Sub-ish attributes */
81 ATTR STRING *pcc_params_signature;
82 ATTR STRING *pcc_return_signature;
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
83 ATTR INTVAL arity;
9d723e0d » plobsing
2010-05-14 update NCI signature parsing to emit new (half year old) PCC param an…
84
85 /* MMD fields */
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
86 ATTR STRING *long_signature;
87 ATTR PMC *multi_sig;
2a2c19b1 » Dan Sugalski
2002-11-21 Added in code to properly do native calls to library routines loaded via
88
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
89 /*
90
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
91 =item C<METHOD get_multisig()>
1415cdab » Leopold Toetsch
2006-03-21 add introspection method get_multisig
92
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
93 Return the MMD signature PMC, if any or C<PMCNULL>.
1415cdab » Leopold Toetsch
2006-03-21 add introspection method get_multisig
94
95 =cut
96
97 */
98
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
99 METHOD get_multisig() {
26f7d7ba » cotto
2009-02-19 [PMC] replace PMC_pmc_val with an ATTR in the NCI PMC
100 PMC *sig;
101 GET_ATTR_multi_sig(INTERP, SELF, sig);
83dd9f26 » NotFound
2009-05-18 [core] partial fix for TT #667, examples/namespace/namespace_dump.pir…
102 if (PMC_IS_NULL(sig))
26f7d7ba » cotto
2009-02-19 [PMC] replace PMC_pmc_val with an ATTR in the NCI PMC
103 sig = PMCNULL;
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
104 RETURN(PMC *sig);
1415cdab » Leopold Toetsch
2006-03-21 add introspection method get_multisig
105 }
106
107 /*
108
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
109 =item C<void init()>
110
111 Initializes the NCI with a C<NULL> function pointer.
112
113 =cut
114
115 */
116
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
117 VTABLE void init() {
26469515 » tewk
2008-08-22 [gsoc_nci] gsoc_nci_001 merge
118 PObj_custom_mark_SET(SELF);
f7fc86b0 » Leopold Toetsch
2003-01-21 nci
119 }
120
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
121 VTABLE void *get_pointer() {
122 return PARROT_NCI(SELF)->orig_func;
123 }
124
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
125 /*
126
380c0ba5 » Leopold Toetsch
2004-05-07 fix NCI related DOD problem
127 =item C<void set_pointer_keyed_str(STRING *key, void *func)>
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
128
380c0ba5 » Leopold Toetsch
2004-05-07 fix NCI related DOD problem
129 Sets the specified function pointer and signature (C<*key>).
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
130
131 =cut
132
133 */
134
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
135 VTABLE void set_pointer_keyed_str(STRING *key, void *func) {
1764f4cd » chromatic
2009-08-16 [PMC] Optimized NCI registration signature handling slightly by avoiding
136 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
637246fc » jnthn
2007-12-15 Refactor the NCI PMC to have an underlying structure, in preparation …
137
62e30495 » petdance
2007-12-17 consting, and fixed embedded tabs
138 /* Store the original function and signature. */
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
139 SET_ATTR_orig_func(INTERP, SELF, func);
c4cd2815 » chromatic
2009-05-14 [PMC] Avoided an unnecessary STRING copying and creation in NCI's
140
141 /* ensure that the STRING signature is constant */
142 if (!PObj_constant_TEST(key)) {
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
143 char * const key_c = Parrot_str_to_cstring(INTERP, key);
e69d2a4f » petdance
2010-03-30 Made pcc_params be static. Removed unused arg from build_func. Header…
144 const size_t key_length = Parrot_str_byte_length(interp, key);
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
145 key = Parrot_str_new_init(interp, key_c, key_length,
146 Parrot_default_encoding_ptr, PObj_constant_FLAG);
c4cd2815 » chromatic
2009-05-14 [PMC] Avoided an unnecessary STRING copying and creation in NCI's
147 Parrot_str_free_cstring(key_c);
148 }
149
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
150 nci_info->sig_str = key;
26469515 » tewk
2008-08-22 [gsoc_nci] gsoc_nci_001 merge
151 }
03918bc6 » chromatic
2008-11-09 [PMC] Fixed a read of unitialized memory in NCI PMC reported by Valgr…
152
26469515 » tewk
2008-08-22 [gsoc_nci] gsoc_nci_001 merge
153 /*
154
155 =item C<void mark()>
156
157 Mark any referenced strings and PMCs.
158
159 =cut
160
161 */
162 VTABLE void mark() {
163 if (PARROT_NCI(SELF)) {
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
164 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
26469515 » tewk
2008-08-22 [gsoc_nci] gsoc_nci_001 merge
165
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
166 Parrot_gc_mark_PMC_alive(interp, nci_info->signature);
3b094c73 » plobsing
2010-03-23 add NCI.fb_info for frame buffer info
167 Parrot_gc_mark_PMC_alive(interp, nci_info->fb_info);
18dd1479 » NotFound
2009-09-24 [gc] add new mark_... _alive functions, use it in a lot of mark vtabl…
168 Parrot_gc_mark_PMC_alive(interp, nci_info->multi_sig);
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
169
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
170 Parrot_gc_mark_STRING_alive(interp, nci_info->sig_str);
171 Parrot_gc_mark_STRING_alive(interp, nci_info->long_signature);
172 Parrot_gc_mark_STRING_alive(interp, nci_info->pcc_params_signature);
173 Parrot_gc_mark_STRING_alive(interp, nci_info->pcc_return_signature);
0c5f9c3f » John Harrison
2010-08-17 GSoC: The majority of my NCI changes in 1 commit.
174 }
175 }
176
177 /*
178
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
179 =item C<PMC *clone()>
180
181 Creates and returns a clone of the NCI.
182
183 =cut
184
185 */
186
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
187 VTABLE PMC *clone() {
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
188 Parrot_NCI_attributes * const nci_info_self = PARROT_NCI(SELF);
189 Parrot_NCI_attributes *nci_info_ret;
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
190 void *orig_func;
62e30495 » petdance
2007-12-17 consting, and fixed embedded tabs
191
083213a2 » Whiteknight
2010-02-16 start rename of pmc_new to Parrot_pmc_new
192 PMC * const ret = Parrot_pmc_new(INTERP, SELF->vtable->base_type);
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
193 nci_info_ret = PARROT_NCI(ret);
82c7cf65 » chromatic
2007-08-30 [PMC] Minor cleanups and tidyings.
194
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
195 /* FIXME if data is malloced (JIT/i386!) then we need
196 * the length of data here, to memcpy it
197 * ManagedStruct or Buffer?
198 */
26469515 » tewk
2008-08-22 [gsoc_nci] gsoc_nci_001 merge
199 nci_info_ret->func = nci_info_self->func;
3b094c73 » plobsing
2010-03-23 add NCI.fb_info for frame buffer info
200 nci_info_ret->fb_info = nci_info_self->fb_info;
811a7df5 » cotto
2009-02-21 [PMC] make NCI PMCs use ATTRs, with one temporary workaround for i386…
201 nci_info_ret->orig_func = nci_info_self->orig_func;
26469515 » tewk
2008-08-22 [gsoc_nci] gsoc_nci_001 merge
202 nci_info_ret->signature = nci_info_self->signature;
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
203 nci_info_ret->sig_str = nci_info_self->sig_str;
26469515 » tewk
2008-08-22 [gsoc_nci] gsoc_nci_001 merge
204 nci_info_ret->pcc_params_signature = nci_info_self->pcc_params_signature;
9d723e0d » plobsing
2010-05-14 update NCI signature parsing to emit new (half year old) PCC param an…
205 nci_info_ret->pcc_return_signature = nci_info_self->pcc_params_signature;
26469515 » tewk
2008-08-22 [gsoc_nci] gsoc_nci_001 merge
206 nci_info_ret->arity = nci_info_self->arity;
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
207 PObj_get_FLAGS(ret) = PObj_get_FLAGS(SELF);
82c7cf65 » chromatic
2007-08-30 [PMC] Minor cleanups and tidyings.
208
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
209 return ret;
2a2c19b1 » Dan Sugalski
2002-11-21 Added in code to properly do native calls to library routines loaded via
210 }
211
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
212 /*
213
214 =item C<INTVAL defined()>
215
216 Returns whether the NCI is defined.
217
218 =cut
219
220 */
221
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
222 VTABLE INTVAL defined() {
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
223 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
224 return nci_info->orig_func != NULL;
2a2c19b1 » Dan Sugalski
2002-11-21 Added in code to properly do native calls to library routines loaded via
225 }
226
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
227 /*
228
0ae5d554 » paultcochrane
2007-03-30 Patch courtesy of Steve Peters <steve at fisharerojo dot org>, his co…
229 =item C<opcode_t *invoke(void *next)>
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
230
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
231 Calls the associated C function, returning C<*next>. If the invocant is a
232 class, the PMC arguments are shifted down.
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
233
234 =cut
235
236 */
237
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
238 VTABLE opcode_t *invoke(void *next) {
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
239 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
240 nci_thunk_t func;
241 PMC *fb_info;
bbd8ef43 » cotto
2009-09-03 [strings] first of many patches from darbelo++ getting rid of ->strst…
242 char *sig_str;
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
243 void *orig_func;
811a7df5 » cotto
2009-02-21 [PMC] make NCI PMCs use ATTRs, with one temporary workaround for i386…
244 PMC *cont;
82c7cf65 » chromatic
2007-08-30 [PMC] Minor cleanups and tidyings.
245
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
246 GET_ATTR_orig_func(INTERP, SELF, orig_func);
247 func = (nci_thunk_t)D2FPTR(nci_info->func);
158fbfa3 » plobsing
2010-03-23 add fb_info parameter to nci_thunk_t signature
248
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
249 GET_ATTR_fb_info(INTERP, SELF, fb_info);
0c5f9c3f » John Harrison
2010-08-17 GSoC: The majority of my NCI changes in 1 commit.
250
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
251 if (!func) {
252 /* build the thunk only when necessary */
253 func = build_func(interp, nci_info);
82c7cf65 » chromatic
2007-08-30 [PMC] Minor cleanups and tidyings.
254
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
255 if (!func)
256 Parrot_ex_throw_from_c_args(INTERP, NULL,
257 EXCEPTION_INVALID_OPERATION,
258 "attempt to call NULL function");
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
259 }
26469515 » tewk
2008-08-22 [gsoc_nci] gsoc_nci_001 merge
260
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
261 func(INTERP, SELF, fb_info);
92c390d5 » Leopold Toetsch
2006-03-14 Fix tailcalls to NCI, #38724
262 cont = INTERP->current_cont;
82c7cf65 » chromatic
2007-08-30 [PMC] Minor cleanups and tidyings.
263
8838c7fb » Leopold Toetsch
2005-03-19 builtins 1 - first shot
264 /*
92c390d5 » Leopold Toetsch
2006-03-14 Fix tailcalls to NCI, #38724
265 * If the NCI function was tailcalled, the return result
266 * is already passed back to the caller of this frame
267 * - see Parrot_init_ret_nci(). We therefore invoke the
268 * return continuation here, which gets rid of this frame
269 * and returns the real return address
8838c7fb » Leopold Toetsch
2005-03-19 builtins 1 - first shot
270 */
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
271 if (cont && cont != NEED_CONTINUATION
272 && (PObj_get_FLAGS(cont) & SUB_FLAG_TAILCALL)) {
540d4c31 » bacek
2009-09-03 Merge context_pmc3 branch into trunk.
273 cont = Parrot_pcc_get_continuation(interp, CURRENT_CONTEXT(interp));
92c390d5 » Leopold Toetsch
2006-03-14 Fix tailcalls to NCI, #38724
274 next = VTABLE_invoke(INTERP, cont, next);
275 }
82c7cf65 » chromatic
2007-08-30 [PMC] Minor cleanups and tidyings.
276
e063e497 » chromatic
2007-04-26 Continuing Parrot/C++ cleanups (Steve Peters, RT #42746).
277 return (opcode_t *)next;
2a2c19b1 » Dan Sugalski
2002-11-21 Added in code to properly do native calls to library routines loaded via
278 }
380c0ba5 » Leopold Toetsch
2004-05-07 fix NCI related DOD problem
279
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
280 /*
281
282 =item C<INTVAL get_integer()>
283
284 Returns the function pointer as an integer.
285
286 =cut
287
288 */
289
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
290 VTABLE INTVAL get_integer() {
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
291 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
292 if (!nci_info->func)
e69d2a4f » petdance
2010-03-30 Made pcc_params be static. Removed unused arg from build_func. Header…
293 build_func(INTERP, nci_info);
637246fc » jnthn
2007-12-15 Refactor the NCI PMC to have an underlying structure, in preparation …
294 return (INTVAL)nci_info->func;
3168931a » Dan Sugalski
2003-10-24 Forth can now generate code for words on the fly and execute them.
295 }
296
f35b03c9 » rubys
2004-12-20 Initial support for sort
297 /*
298
299 =item C<INTVAL get_bool()>
300
301 Returns the boolean value of the pointer.
302
303 =cut
304
305 */
306
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
307 VTABLE INTVAL get_bool() {
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
308 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
309 return (0 != (INTVAL)nci_info->orig_func);
f35b03c9 » rubys
2004-12-20 Initial support for sort
310 }
311
6586a2ca » jnthn
2007-12-15 Implement arity method on NCI PMCs, plus a test for it.
312 /*
313
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
314 =item C<METHOD arity()>
6586a2ca » jnthn
2007-12-15 Implement arity method on NCI PMCs, plus a test for it.
315
01e804c8 » Util
2009-03-13 [pmc] Typo corrections
316 Return the arity of the NCI (the number of arguments).
6586a2ca » jnthn
2007-12-15 Implement arity method on NCI PMCs, plus a test for it.
317
318 =cut
319
320 */
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
321 METHOD arity() {
971e9977 » NotFound
2008-09-08 rename pmc attributes struct from Parrot_<type> to Parrot_<type>_attr…
322 Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
48d2796f » NotFound
2008-07-10 Another unreachable warning, codingstd in jit_emit ppc
323 INTVAL arity = 0;
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
324
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
325 if (nci_info) {
c64fa8d3 » plobsing
2010-10-27 split NCI signature parser out from nci.pmc
326 if (!nci_info->func)
327 build_func(INTERP, nci_info);
328 if (nci_info->func) {
329 arity = nci_info->arity;
330 RETURN(INTVAL arity);
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
331 }
332 }
6586a2ca » jnthn
2007-12-15 Implement arity method on NCI PMCs, plus a test for it.
333
8832378c » chromatic
2009-08-20 [PMC] Delayed NCI thunk initialization until absolutely necessary. This
334 Parrot_ex_throw_from_c_args(INTERP, NULL,
335 EXCEPTION_INVALID_OPERATION,
336 "You cannot get the arity of an undefined NCI.");
59661f18 » allisonrandal
2008-03-11 [pdd17pmc] Merging the pdd17pmc branch into trunk (r24435 to r26307).
337 }
2a2c19b1 » Dan Sugalski
2002-11-21 Added in code to properly do native calls to library routines loaded via
338 }
c64e58f7 » Michael Scott
2004-02-17 pmc docs update 3
339
340 /*
341
342 =back
343
344 =head1 SEE ALSO
345
346 F<docs/pdds/pdd03_calling_conventions.pod>.
347
348 =cut
349
350 */
351
0eb3eb34 » Michael Scott
2004-02-22 added formatting footer and detabbed
352 /*
353 * Local variables:
72575ae0 » bschmalhofer
2006-10-09 #40481: [PATCH] C-code coda in pmc files
354 * c-file-style: "parrot"
0eb3eb34 » Michael Scott
2004-02-22 added formatting footer and detabbed
355 * End:
356 * vim: expandtab shiftwidth=4:
72575ae0 » bschmalhofer
2006-10-09 #40481: [PATCH] C-code coda in pmc files
357 */
Something went wrong with that request. Please try again.