| 1 |
#' @import utils |
| 2 |
#' @import stats |
| 3 |
#' @import graphics |
| 4 |
#' @importFrom Rcpp evalCpp |
| 5 |
#' @useDynLib units |
| 6 |
NULL |
| 7 |
|
| 8 |
.onLoad = function(libname, pkgname) { |
| 9 |
load_units_xml() |
| 10 |
|
| 11 |
if (ud_is_parseable("B")) |
| 12 |
.default_options$define_bel <- FALSE |
| 13 |
do.call(units_options, .default_options) |
| 14 |
|
| 15 |
native <- if (l10n_info()[["UTF-8"]]) "utf8" |
| 16 |
else if (l10n_info()[["Latin-1"]]) "latin1" |
| 17 |
else "ascii" |
| 18 |
ud_set_encoding(native) |
| 19 |
|
| 20 |
register_all_s3_methods() |
| 21 |
if (exists("matrixOps")) |
| 22 |
registerS3method("matrixOps", "units", matrixOps.units) |
| 23 |
} |
| 24 |
|
| 25 |
.onAttach <- function(libname, pkgname) { |
| 26 |
packageStartupMessage(.startup_msg(TRUE)) |
| 27 |
} |
| 28 |
|
| 29 |
.onUnload = function(libpath) { |
| 30 |
ud_exit() |
| 31 |
} |