Skip to content

Commit 46ff771

Browse files
committed
C++ code formatting
1 parent 40b2a9b commit 46ff771

File tree

12 files changed

+485
-408
lines changed

12 files changed

+485
-408
lines changed

tskitr/.Rbuildignore

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
^test\.trees$
77
^.*\.o$
88
^.*\.so$
9+
^\.clang-format$
910
^\.covrignore$
1011
^\.github$
11-
^pkg_dev_notes\.md
12-
^codecov\.yaml
13-
^notes_pkg_dev\.Rmd
14-
^inst/examples/create_test\.trees\.R
15-
^inst/examples/create_test\.trees\.py
12+
^pkg_dev_notes\.md$
13+
^codecov\.yaml$
14+
^notes_pkg_dev\.Rmd$
15+
^inst/examples/create_test\.trees\.R$
16+
^inst/examples/create_test\.trees\.py$

tskitr/.clang-format

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
BasedOnStyle: LLVM
2+
IndentWidth: 2
3+
ColumnLimit: 80

tskitr/R/RcppExports.R

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
22
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
33

4-
#' @name ts_metadata_length
5-
#' @title Get the length of metadata in a tree sequence and its tables
6-
#' @param ts tree sequence as an external pointer to a \code{tsk_treeseq_t} object.
7-
#' @details This function returns the length of metadata stored on the tree
8-
#' sequence and in each table by calling
9-
#' \code{tsk_treeseq_get_metadata_length()} \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_metadata_length} on tree sequence and
10-
NULL
11-
124
#' Report the version of installed kastore C API
135
#'
146
#' @details The version is stored in the installed header \code{kastore.h}.
157
#' @return A named vector with three elements \code{major}, \code{minor}, and
16-
#' \code{patch}.
8+
#' \code{patch}.
179
#' @examples
1810
#' kastore_version()
1911
#' @export
@@ -25,7 +17,7 @@ kastore_version <- function() {
2517
#'
2618
#' @details The version is defined in the installed header \code{tskit/core.h}.
2719
#' @return A named vector with three elements \code{major}, \code{minor}, and
28-
#' \code{patch}.
20+
#' \code{patch}.
2921
#' @examples
3022
#' tskit_version()
3123
#' @export
@@ -38,9 +30,10 @@ tskit_version <- function() {
3830
#' @param file a string specifying the full path of the tree sequence file.
3931
#' @param options integer bitwise options (see details).
4032
#' @details This function calls \code{tsk_treeseq_load()} from the tskit C API.
41-
#' See \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_load}
42-
#' for more details.
43-
#' @return Tree sequence as an external pointer to a \code{tsk_treeseq_t} object.
33+
#' \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_load}
34+
#' provides more details.
35+
#' @return Tree sequence as an external pointer to a \code{tsk_treeseq_t}
36+
#' object.
4437
#' @examples
4538
#' ts_file <- system.file("examples/test.trees", package = "tskitr")
4639
#' ts <- tskitr::ts_load(ts_file) # slendr also has ts_load()!
@@ -54,12 +47,13 @@ ts_load <- function(file, options = 0L) {
5447

5548
#' Write a tree sequence to file.
5649
#'
57-
#' @param ts tree sequence as an external pointer to a \code{tsk_treeseq_t} object.
58-
#' @param file a string specifying the full path of the tree sequence file.
50+
#' @param ts tree sequence as an external pointer to a \code{tsk_treeseq_t}
51+
#' object.
52+
#' @param file a string specifying the full path of the tree sequence file
5953
#' @param options integer bitwise options (see details).
6054
#' @details This function calls \code{tsk_treeseq_dump()} from the tskit C API
61-
#' See \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_dump}
62-
#' for more details.
55+
#' \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_dump}
56+
#' provides more details.
6357
#' @return No return value, called for side effects.
6458
#' @examples
6559
#' ts_file <- system.file("examples/test.trees", package = "tskitr")
@@ -73,26 +67,41 @@ ts_dump <- function(ts, file, options = 0L) {
7367
}
7468

7569
#' @name ts_summary
76-
#' @title Get the summary of properties and number of records in a tree sequence
77-
#' @param ts tree sequence as an external pointer to a \code{tsk_treeseq_t} object.
78-
#' @details These functions return the summary of properties and number of records
79-
#' in a tree sequence, by calling
80-
#' \code{tsk_treeseq_get_num_provenances()} \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_provenances},
81-
#' \code{tsk_treeseq_get_num_populations()} \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_populations},
82-
#' \code{tsk_treeseq_get_num_migrations()} \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_migrations},
83-
#' \code{tsk_treeseq_get_num_individuals()} \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_individuals},
84-
#' \code{tsk_treeseq_get_num_samples()} \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_samples},
85-
#' \code{tsk_treeseq_get_num_nodes()} \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_nodes},
86-
#' \code{tsk_treeseq_get_num_edges()} \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_edges},
87-
#' \code{tsk_treeseq_get_num_trees()} \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_trees},
88-
#' \code{tsk_treeseq_get_num_sites()} \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_sites},
89-
#' \code{tsk_treeseq_get_num_mutations()} \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_mutations},
90-
#' \code{tsk_treeseq_get_sequence_length()} \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_sequence_length},
70+
#' @title Get the summary of properties and number of records in a tree
71+
#' sequence
72+
#' @param ts tree sequence as an external pointer to a \code{tsk_treeseq_t}
73+
#' object.
74+
#' @details These functions return the summary of properties and number of
75+
#' records in a tree sequence, by calling
76+
#' \code{tsk_treeseq_get_num_provenances()}
77+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_provenances},
78+
#' \code{tsk_treeseq_get_num_populations()}
79+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_populations},
80+
#' \code{tsk_treeseq_get_num_migrations()}
81+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_migrations},
82+
#' \code{tsk_treeseq_get_num_individuals()}
83+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_individuals},
84+
#' \code{tsk_treeseq_get_num_samples()}
85+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_samples},
86+
#' \code{tsk_treeseq_get_num_nodes()}
87+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_nodes},
88+
#' \code{tsk_treeseq_get_num_edges()}
89+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_edges},
90+
#' \code{tsk_treeseq_get_num_trees()}
91+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_trees},
92+
#' \code{tsk_treeseq_get_num_sites()}
93+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_sites},
94+
#' \code{tsk_treeseq_get_num_mutations()}
95+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_num_mutations},
96+
#' \code{tsk_treeseq_get_sequence_length()}
97+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_sequence_length},
9198
#' and
92-
#' \code{tsk_treeseq_get_time_units()} \url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_time_units}.
99+
#' \code{tsk_treeseq_get_time_units()}
100+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_time_units}.
93101
#' from the tskit C API. See the linked documentation for more details.
94-
#' @return \code{ts_summary} returns a named list with the number/value for all items,
95-
#' while other functions \code{ts_num_x} etc. return the number/value of each item.
102+
#' @return \code{ts_summary} returns a named list with the number/value for
103+
#' all items, while other functions \code{ts_num_x} etc. return the
104+
#' number/value of each item.
96105
#' @examples
97106
#' ts_file <- system.file("examples/test.trees", package = "tskitr")
98107
#' ts <- tskitr::ts_load(ts_file) # slendr also has ts_load()!
@@ -138,7 +147,8 @@ ts_num_individuals <- function(ts) {
138147
.Call(`_tskitr_ts_num_individuals`, ts)
139148
}
140149

141-
#' @describeIn ts_summary Get the number of samples (of nodes) in a tree sequence
150+
#' @describeIn ts_summary Get the number of samples (of nodes) in a tree
151+
#' sequence
142152
#' @export
143153
ts_num_samples <- function(ts) {
144154
.Call(`_tskitr_ts_num_samples`, ts)
@@ -186,6 +196,17 @@ ts_time_units <- function(ts) {
186196
.Call(`_tskitr_ts_time_units`, ts)
187197
}
188198

199+
#' @name ts_metadata_length
200+
#' @title Get the length of metadata in a tree sequence and its tables
201+
#' @param ts tree sequence as an external pointer to a \code{tsk_treeseq_t}
202+
#' object.
203+
#' @details This function returns the length of metadata stored on the tree
204+
#' sequence and in each table by calling
205+
#' \code{tsk_treeseq_get_metadata_length()}
206+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_treeseq_get_metadata_length}
207+
#' on tree sequence and
208+
#' \code{ts->tables->x->metadata_length} on each table \code{x}, e.g.,
209+
#'\url{https://tskit.dev/tskit/docs/stable/c-api.html#c.tsk_population_table_t.metadata_length},
189210
#' from the tskit C API. See the linked documentation for more details.
190211
#' @return A named list with the length of metadata.
191212
#' @examples

tskitr/man/kastore_version.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tskitr/man/ts_dump.Rd

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tskitr/man/ts_load.Rd

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tskitr/man/ts_metadata_length.Rd

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tskitr/man/ts_summary.Rd

Lines changed: 37 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tskitr/man/tskit_version.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tskitr/src/Makevars.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ TSKIT_OBJECTS = $(TSKIT_SOURCES:.c=.o)
1616
# tskitr C++ sources & objects
1717
# TSKITR_SOURCES = $(wildcard *.cpp) # wildcard is a GNU extension and not desired on CRAN
1818
TSKITR_SOURCES = \
19-
tskitr_minimal.cpp \
19+
tskitr.cpp \
2020
RcppExports.cpp
2121
# $(info TSKITR_SOURCES = $(TSKITR_SOURCES)) # for debugging, info is also a GNU extension
2222
TSKITR_OBJECTS = $(TSKITR_SOURCES:.cpp=.o)
@@ -33,7 +33,7 @@ PKG_CPPFLAGS = -I../inst/include -I../inst/include/tskit -I../inst/include/tskit
3333
# TODO: Remove asserts as per Writting R extensions manual #5
3434
# https://github.com/HighlanderLab/tskitr/issues/5
3535
# Note clang++ uses -DNDEBUG by default (see below output from devtools::install()) #5
36-
# clang++ -arch arm64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include -I../inst/include/tskit -I../inst/include/tskit/tskit -I/opt/homebrew/opt/gettext/include -I'/Users/ggorjanc/Library/R/arm64/4.5/library/Rcpp/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c tskitr_minimal.cpp -o tskitr_minimal.o
36+
# clang++ -arch arm64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include -I../inst/include/tskit -I../inst/include/tskit/tskit -I/opt/homebrew/opt/gettext/include -I'/Users/ggorjanc/Library/R/arm64/4.5/library/Rcpp/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c tskitr.cpp -o tskitr.o
3737
# PKG_CFLAGS = -DNDEBUG
3838
# TODO: Should we port any flags from extern/tskit/c/meson.build to R build system? #6
3939
# https://github.com/HighlanderLab/tskitr/issues/6

0 commit comments

Comments
 (0)