The R Project SVN R

Rev

Rev 6098 | Rev 6994 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6098 Rev 6191
Line 392... Line 392...
392
    /* But it is needed for clearing R_alloc and to be like .Call <BDR>*/
392
    /* But it is needed for clearing R_alloc and to be like .Call <BDR>*/
393
    char *vmax = vmaxget();
393
    char *vmax = vmaxget();
394
 
394
 
395
    op = CAR(args);
395
    op = CAR(args);
396
    if (!isValidString(op))
396
    if (!isValidString(op))
397
	errorcall(call, "function name must be a string (of length 1)\n");
397
	errorcall(call, "function name must be a string (of length 1)");
398
    if (PkgSymbol == NULL) PkgSymbol = install("PACKAGE");
398
    if (PkgSymbol == NULL) PkgSymbol = install("PACKAGE");
399
    strcpy(DLLname, "");
399
    strcpy(DLLname, "");
400
    args = pkgtrim(args);
400
    args = pkgtrim(args);
401
 
401
 
402
    if (!(fun=R_FindSymbol(CHAR(STRING(op)[0]), DLLname)))
402
    if (!(fun=R_FindSymbol(CHAR(STRING(op)[0]), DLLname)))
403
	errorcall(call, "C function name not in load table\n");
403
	errorcall(call, "C function name not in load table");
404
 
404
 
405
    retval = (SEXP)fun(args);
405
    retval = (SEXP)fun(args);
406
    vmaxset(vmax);
406
    vmaxset(vmax);
407
    return retval;
407
    return retval;
408
}
408
}
Line 414... Line 414...
414
    SEXP retval, cargs[MAX_ARGS], pargs;
414
    SEXP retval, cargs[MAX_ARGS], pargs;
415
    int nargs;
415
    int nargs;
416
    char *vmax = vmaxget();
416
    char *vmax = vmaxget();
417
    op = CAR(args);
417
    op = CAR(args);
418
    if (!isValidString(op))
418
    if (!isValidString(op))
419
	errorcall(call, "function name must be a string (of length 1)\n");
419
	errorcall(call, "function name must be a string (of length 1)");
420
 
420
 
421
    if (PkgSymbol == NULL) PkgSymbol = install("PACKAGE");
421
    if (PkgSymbol == NULL) PkgSymbol = install("PACKAGE");
422
    strcpy(DLLname, "");
422
    strcpy(DLLname, "");
423
    args = pkgtrim(args);
423
    args = pkgtrim(args);
424
 
424
 
425
    if (!(fun=R_FindSymbol(CHAR(STRING(op)[0]), DLLname)))
425
    if (!(fun=R_FindSymbol(CHAR(STRING(op)[0]), DLLname)))
426
        errorcall(call, "C function name not in load table\n");
426
        errorcall(call, "C function name not in load table");
427
    args = CDR(args);
427
    args = CDR(args);
428
 
428
 
429
    for(nargs = 0, pargs = args ; pargs != R_NilValue; pargs = CDR(pargs)) {
429
    for(nargs = 0, pargs = args ; pargs != R_NilValue; pargs = CDR(pargs)) {
430
        if (nargs == MAX_ARGS)
430
        if (nargs == MAX_ARGS)
431
            errorcall(call, "too many arguments in foreign function call");
431
            errorcall(call, "too many arguments in foreign function call");