File: init.R

package info (click to toggle)
r-cran-units 0.8-7%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,172 kB
  • sloc: xml: 2,437; cpp: 211; sh: 13; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 748 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#' @import utils
#' @import stats
#' @import graphics
#' @importFrom Rcpp evalCpp
#' @useDynLib units
NULL

.onLoad = function(libname, pkgname) {
  if (.Machine$sizeof.pointer < 8)
    packageStartupMessage("Warning: using units on a 32 bit system, which may not work correctly: https://bugs.debian.org/1102591")
  load_units_xml()

  if (ud_is_parseable("B"))
    .default_options$define_bel <- FALSE
  do.call(units_options, .default_options)

  native <- if (l10n_info()[["UTF-8"]]) "utf8"
  else if (l10n_info()[["Latin-1"]]) "latin1"
  else "ascii"
  ud_set_encoding(native)

  register_all_s3_methods()
}

.onAttach <- function(libname, pkgname) {
  packageStartupMessage(.startup_msg(TRUE))
}

.onUnload = function(libpath) {
  ud_exit()
}