fml  0.1-0
Fused Matrix Library
print.hh
1 // This file is part of fml which is released under the Boost Software
2 // License, Version 1.0. See accompanying file LICENSE or copy at
3 // https://www.boost.org/LICENSE_1_0.txt
4 
5 #ifndef FML__INTERNALS_PRINT_H
6 #define FML__INTERNALS_PRINT_H
7 #pragma once
8 
9 
10 #if (!defined(FML_PRINT_STD) && !defined(FML_PRINT_R))
11  #define FML_PRINT_STD
12 #endif
13 
14 
15 
16 #if (defined(FML_PRINT_STD))
17  #include <cstdarg>
18  #include <cstdio>
19 #elif defined(FML_PRINT_R)
20  #define R_USE_C99_IN_CXX
21  #include <R_ext/Print.h>
22  #include <cstdarg>
23 #endif
24 
25 
26 
27 namespace fml
28 {
29  namespace print
30  {
31  inline void putchar(const char c)
32  {
33  #if (defined(FML_PRINT_STD))
34  std::putchar(c);
35  #elif (defined(FML_PRINT_R))
36  Rprintf("%c", c);
37  #endif
38  }
39 
40 
41 
42  inline void vprintf(const char *fmt, va_list args)
43  {
44  #if (defined(FML_PRINT_STD))
45  std::vprintf(fmt, args);
46  #elif (defined(FML_PRINT_R))
47  Rvprintf(fmt, args);
48  #endif
49  }
50 
51 
52 
53  inline void printf(const char *fmt, ...)
54  {
55  va_list args;
56  va_start(args, fmt);
57  fml::print::vprintf(fmt, args);
58  va_end(args);
59  }
60  }
61 }
62 
63 
64 #endif
fml
Core namespace.
Definition: dimops.hh:10