7 static size_t matchargs (
const char *prov,
const char **set,
size_t n) {
9 for (i = 0; i <
n; i++) {
10 if (strcmp(prov,set[i]) == 0)
break;
20 const char *argname[] = {
21 "object",
"prune",
"obscure",
22 "t0",
"time",
"nsample",
"ndeme",
23 "description",
"structure",
"yaml",
"newick",
24 "lineages",
"gendat",
"genealogy"};
25 const int narg =
sizeof(argname)/
sizeof(
const char *);
27 SEXP
object = R_NilValue;
31 for (k = 0; k < narg; k++) flag[k] =
false;
34 while (args != R_NilValue) {
35 const char *name = isNull(TAG(args)) ?
"" : CHAR(PRINTNAME(TAG(args)));
42 flag[j] = *LOGICAL(AS_LOGICAL(arg));
43 }
else if (j < narg) {
44 flag[j] = *LOGICAL(AS_LOGICAL(arg));
47 err(
"unrecognized argument '%s' in '%s'.",name,__func__);
52 if (!flag[0])
err(
"no genealogy furnished to '%s'",__func__);
56 const bool *f = flag+1;
57 if (*(f++)) A.
prune();
62 PROTECT(out = NEW_LIST(nout));
63 PROTECT(outnames = NEW_CHARACTER(nout));
98 SET_ATTR(
S,install(
"class"),mkString(
"gpgen"));
102 SET_NAMES(out,outnames);
SEXP yaml(SEXP State)
extract a YAML description
SEXP gendat(SEXP State)
data-frame format
genealogy_t & prune(void)
prune the tree (drop all black balls)
genealogy_t & obscure(void)
erase all deme information
void trace_lineages(void)
SEXP describe(const TYPE &X)
human readable output
SEXP structure(const TYPE &X)
structure in R list format
SEXP newick(const TYPE &X)
tree in newick format
SEXP serial(const TYPE &X)
binary serialization
SEXP lineage_count(const TYPE &G)
number of lineages through time
static size_t matchargs(const char *prov, const char **set, size_t n)
static int set_list_elem(SEXP list, SEXP names, SEXP element, const char *name, int pos)