aboutsummaryrefslogtreecommitdiff
path: root/src/inc/stdout.h
blob: da7027fc294e862544aacff1a0e25affcf022a9e (plain)
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
32
33
34
35
36
37
38
39
40
41
#ifndef STDOUT_H
#define STDOUT_H
  #include <inttypes.h>
  #include <limits.h>

  #ifdef STDOUT_put_string
    void stdout_put_string(void (*putc)(const char c), const char* s);
  #endif

  #ifdef STDOUT_put_uint
    static const unsigned int _devisor_two[] =
    {
      /// 2147483648, 1073741824, 536870912, 268435456, 134217728, 67108864,
      /// 33554432, 16777216, 8388608, 4194304, 2097152, 1048576, 524288, 262144,
      /// 131072, 65536,
      32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64,
      32, 16, 8, 4, 2, 1
    };
    static const unsigned int _devisor_ten[] =
    {
      /// 1000000000, 100000000, 10000000, 1000000, 100000,
      10000, 1000, 100, 10, 1
    };
    void stdout_put_uint(void (*putc)(const char c), int n);
  #endif

  #ifdef STDOUT_put_binary
    void stdout_put_binary(void (*putc)( const char c), const unsigned char data);
  #endif

  #ifdef STDOUT_reverse_bits
    char stdout_reverse_bits(const unsigned char v);
  #endif

  #ifdef STDOUT_putf
    #include <stdarg.h>
    extern void dec_put_char(const char);
    void stdout_putf(void (*putc)( const char c), const char* format, ...);
  #endif

#endif
..