19 {
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 *);
26 bool flag[narg];
27 SEXP object = R_NilValue;
28 size_t nout = 0;
29 int k;
30
31 for (k = 0; k < narg; k++) flag[k] = false;
32 args = CDR(args);
33
34 while (args != R_NilValue) {
35 const char *name = isNull(TAG(args)) ? "" : CHAR(PRINTNAME(TAG(args)));
36 SEXP arg = CAR(args);
38 if (j == 0) {
39 object = arg;
40 flag[0] = true;
41 } else if (j < 3) {
42 flag[j] = *LOGICAL(AS_LOGICAL(arg));
43 } else if (j < narg) {
44 flag[j] = *LOGICAL(AS_LOGICAL(arg));
45 if (flag[j]) nout++;
46 } else {
47 err(
"unrecognized argument '%s' in '%s'.",name,__func__);
48 }
49 args = CDR(args);
50 }
51
52 if (!flag[0])
err(
"no genealogy furnished to '%s'",__func__);
54
55
56 const bool *f = flag+1;
57 if (*(f++)) A.
prune();
60
61 SEXP out, outnames;
62 PROTECT(out = NEW_LIST(nout));
63 PROTECT(outnames = NEW_CHARACTER(nout));
64 k = 0;
65 if (*(f++)) {
67 }
68 if (*(f++)) {
70 }
71 if (*(f++)) {
73 }
74 if (*(f++)) {
76 }
77 if (*(f++)) {
79 }
80 if (*(f++)) {
82 }
83 if (*(f++)) {
85 }
86 if (*(f++)) {
88 }
89 if (*(f++)) {
91 }
92 if (*(f++)) {
94 }
95 if (*(f++)) {
98 SET_ATTR(
S,install(
"class"),mkString(
"gpgen"));
100 UNPROTECT(1);
101 }
102 SET_NAMES(out,outnames);
103 UNPROTECT(2);
104 return out;
105 }
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)