The R Project SVN R

Rev

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

Rev 12976 Rev 14018
Line 313... Line 313...
313
    }
313
    }
314
    *len = nargs;
314
    *len = nargs;
315
    return args;
315
    return args;
316
}
316
}
317
 
317
 
-
 
318
static void setDLLname(SEXP s) {
-
 
319
  SEXP ss = CAR(s); char *name;
-
 
320
  if(TYPEOF(ss) != STRSXP || length(ss) != 1)
-
 
321
    error("PACKAGE argument must be a single character string");
-
 
322
  name = CHAR(STRING_ELT(ss, 0));
-
 
323
  /* allow the package: form of the name, as returned by find */
-
 
324
  if(strncmp(name, "package:", 8) == 0)
-
 
325
    name += 8;
-
 
326
  strcpy(DLLname, name);
-
 
327
}
-
 
328
 
318
static SEXP pkgtrim(SEXP args)
329
static SEXP pkgtrim(SEXP args)
319
{
330
{
320
    SEXP s, ss;
331
    SEXP s, ss;
321
    int pkgused=0;
332
    int pkgused=0;
322
 
333
 
Line 325... Line 336...
325
	/* Look for PACKAGE=. We look at the next arg, unless
336
	/* Look for PACKAGE=. We look at the next arg, unless
326
	   this is the last one (which will only happen for one arg),
337
	   this is the last one (which will only happen for one arg),
327
	   and remove it */
338
	   and remove it */
328
	if(ss == R_NilValue && TAG(s) == PkgSymbol) {
339
	if(ss == R_NilValue && TAG(s) == PkgSymbol) {
329
	    if(pkgused++ == 1) warning("PACKAGE used more than once");
340
	    if(pkgused++ == 1) warning("PACKAGE used more than once");
330
	    strcpy(DLLname, CHAR(STRING_ELT(CAR(s), 0)));
341
	    setDLLname(s);
331
	    return R_NilValue;
342
	    return R_NilValue;
332
	}
343
	}
333
	if(TAG(ss) == PkgSymbol) {
344
	if(TAG(ss) == PkgSymbol) {
334
	    if(pkgused++ == 1) warning("PACKAGE used more than once");
345
	    if(pkgused++ == 1) warning("PACKAGE used more than once");
335
	    strcpy(DLLname, CHAR(STRING_ELT(CAR(ss), 0)));
346
	    setDLLname(ss);
336
	    SETCDR(s, CDR(ss));
347
	    SETCDR(s, CDR(ss));
337
	}
348
	}
338
	s = CDR(s);
349
	s = CDR(s);
339
    }
350
    }
340
    return args;
351
    return args;