~clint-fewbar/ubuntu/precise/erlang/merge-15b

« back to all changes in this revision

Viewing changes to erts/emulator/beam/erl_bif_op.c

  • Committer: Package Import Robot
  • Author(s): Sergei Golovan
  • Date: 2011-12-15 19:20:10 UTC
  • mfrom: (1.1.18) (3.5.15 sid)
  • mto: (3.5.16 sid)
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: package-import@ubuntu.com-20111215192010-jnxcfe3tbrpp0big
Tags: 1:15.b-dfsg-1
* New upstream release.
* Upload to experimental because this release breaks external drivers
  API along with ABI, so several applications are to be fixed.
* Removed SSL patch because the old SSL implementation is removed from
  the upstream distribution.
* Removed never used patch which added native code to erlang beam files.
* Removed the erlang-docbuilder binary package because the docbuilder
  application was dropped by upstream.
* Documented dropping ${erlang-docbuilder:Depends} substvar in
  erlang-depends(1) manpage.
* Made erlang-base and erlang-base-hipe provide virtual package
  erlang-abi-15.b (the number means the first erlang version, which
  provides current ABI).

Show diffs side-by-side

added added

removed removed

Lines of Context:
225
225
 
226
226
BIF_RETTYPE is_function_2(BIF_ALIST_2)
227
227
{
 
228
    BIF_RET(erl_is_function(BIF_P, BIF_ARG_1, BIF_ARG_2));
 
229
}
 
230
 
 
231
Eterm erl_is_function(Process* p, Eterm arg1, Eterm arg2)
 
232
{
228
233
    Sint arity;
229
234
 
230
235
    /*
231
236
     * Verify argument 2 (arity); arity must be >= 0.
232
237
     */ 
233
 
    if (is_small(BIF_ARG_2)) {
234
 
        arity = signed_val(BIF_ARG_2);
 
238
    if (is_small(arg2)) {
 
239
        arity = signed_val(arg2);
235
240
        if (arity < 0) {
236
241
        error:
237
 
            BIF_ERROR(BIF_P, BADARG);
 
242
            BIF_ERROR(p, BADARG);
238
243
        }
239
 
    } else if (is_big(BIF_ARG_2) && !bignum_header_is_neg(*big_val(BIF_ARG_2))) {
 
244
    } else if (is_big(arg2) && !bignum_header_is_neg(*big_val(arg2))) {
240
245
        /* A positive bignum is OK, but can't possibly match. */
241
246
        arity = -1;
242
247
    } else {
244
249
        goto error;
245
250
    }
246
251
 
247
 
    if (is_fun(BIF_ARG_1)) {
248
 
        ErlFunThing* funp = (ErlFunThing *) fun_val(BIF_ARG_1);
 
252
    if (is_fun(arg1)) {
 
253
        ErlFunThing* funp = (ErlFunThing *) fun_val(arg1);
249
254
 
250
255
        if (funp->arity == (Uint) arity) {
251
256
            BIF_RET(am_true);
252
257
        }
253
 
    } else if (is_export(BIF_ARG_1)) {
254
 
        Export* exp = (Export *) EXPAND_POINTER((export_val(BIF_ARG_1))[1]);
 
258
    } else if (is_export(arg1)) {
 
259
        Export* exp = (Export *) EXPAND_POINTER((export_val(arg1))[1]);
255
260
 
256
261
        if (exp->code[2] == (Uint) arity) {
257
262
            BIF_RET(am_true);
258
263
        }
259
 
    } else if (is_tuple(BIF_ARG_1)) {
260
 
        Eterm* tp = tuple_val(BIF_ARG_1);
 
264
    } else if (is_tuple(arg1)) {
 
265
        Eterm* tp = tuple_val(arg1);
261
266
        if (tp[0] == make_arityval(2) && is_atom(tp[1]) && is_atom(tp[2])) {
262
267
            BIF_RET(am_true);
263
268
        }