19 {
20 const char *argname[] = {
21 "object","prune","obscure","extended",
22 "t0","time","nsample","nroot","ndeme",
23 "structure","yaml","newick",
24 "lineages","gendat","genealogy","cblv"};
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 < narg) {
42 flag[j] = *LOGICAL(AS_LOGICAL(arg));
43 if (j > 3 && flag[j]) nout++;
44 } else {
45 err(
"unrecognized argument '%s' in '%s'.",name,__func__);
46 }
47 args = CDR(args);
48 }
49
50 if (!flag[0])
err(
"no genealogy furnished to '%s'",__func__);
52
53
54 const bool *f = flag+1;
55 if (*(f++)) A.
prune();
58 bool extended = false;
59 if (*(f++)) {
60 extended = true;
61 } else {
63 }
64
65 SEXP out, outnames;
66 PROTECT(out = NEW_LIST(nout));
67 PROTECT(outnames = NEW_CHARACTER(nout));
68 k = 0;
69 if (*(f++)) {
71 }
72 if (*(f++)) {
74 }
75 if (*(f++)) {
77 }
78 if (*(f++)) {
80 }
81 if (*(f++)) {
83 }
84 if (*(f++)) {
86 }
87 if (*(f++)) {
89 }
90 if (*(f++)) {
92 }
93 if (*(f++)) {
95 }
96 if (*(f++)) {
98 }
99 if (*(f++)) {
102 SET_ATTR(
S,install(
"class"),mkString(
"gpgen"));
104 UNPROTECT(1);
105 }
106 if (*(f++)) {
108 }
109 SET_NAMES(out,outnames);
110 UNPROTECT(2);
111 return out;
112 }
genealogy_t & insert_zlb(void)
insert zero-length branches for samples where needed
SEXP gendat(SEXP State, SEXP Obscure)
data-frame format
SEXP structure(const TYPE &X)
structure in R list format
SEXP yaml(const TYPE &X)
human/machine readable output
SEXP lineage_count(const TYPE &G)
number of lineages through time
SEXP newick(const TYPE &X, bool extended)
tree in newick format
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)