#1992: [NCI] callback sub parameter definition isn't unified with callback
definition in the C lib.
--------------------+-------------------------------------------------------
Reporter: jimmy | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: core | Version: 3.0.0
Severity: medium | Keywords:
Lang: | Patch:
Platform: |
--------------------+-------------------------------------------------------
Description changed by jimmy:
Old description:
> Hello,
> see https://github.com/parrot/parrot/blob/master/src/nci_test.c#-115 ,
> there are two define here.
>
> typedef void (*cb_C1_func)(const char*, void*);
> PARROT_DYNEXT_EXPORT void nci_cb_C1(cb_C1_func, void*);
>
> the callback is created by:
> cb_wrapped = new_callback cb, user_data, "vtU"
>
> which means it's first parameter is external_data, and the two is
> user_data. that is, the callback function should be defined as this one:
> .sub _call_back
> .param string external_data
> .param pmc user_data
> print "user data: "
> print u
> print "\n"
> print "external data: "
> print s
> print "\n"
> .end
>
> but actually in t/pmc/nci.t, it's defined as:
> .sub _call_back
> .param pmc user_data
> .param string external_data
> print "user data: "
> print u
> print "\n"
> print "external data: "
> print s
> print "\n"
> .end
>
> according to t/pmc/nci.t it seems that no matter user_data is the first
> parameter or two, the callback sub must defined as:
> .sub _call_back
> .param pmc user_data
> .param string external_data
> .end
>
> then I took a look at PDD16, and it's said user_data should be defined in
> the second parameter:
>
> .sub _call_back
> .param string external_data
> .param pmc user_data
> .end
>
> which is right.
New description:
Hello,
see https://github.com/parrot/parrot/blob/master/src/nci_test.c#-115 ,
there are two define here.
{{{
typedef void (*cb_C1_func)(const char*, void*);
PARROT_DYNEXT_EXPORT void nci_cb_C1(cb_C1_func, void*);
}}}
the callback is created by:
{{{
cb_wrapped = new_callback cb, user_data, "vtU"
}}}
which means it's first parameter is external_data, and the two is
user_data. that is, the callback function should be defined as this one:
{{{
.sub _call_back
.param string external_data
.param pmc user_data
print "user data: "
print u
print "\n"
print "external data: "
print s
print "\n"
.end
}}}
but actually in t/pmc/nci.t, it's defined as:
{{{
.sub _call_back
.param pmc user_data
.param string external_data
print "user data: "
print u
print "\n"
print "external data: "
print s
print "\n"
.end
}}}
according to t/pmc/nci.t it seems that no matter user_data is the first
parameter or two, the callback sub must defined as:
{{{
.sub _call_back
.param pmc user_data
.param string external_data
.end
}}}
then I took a look at PDD16, and it's said user_data should be defined in
the second parameter:
{{{
.sub _call_back
.param string external_data
.param pmc user_data
.end
}}}
which is right.
--
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/1992#comment:1>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets