aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/ao_utils.org
blob: 9f3bdb54049d35bf1eb8cc2daae44fe00a8702d3 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#+TITLE: sdp utils
#+AUTHOR: Ralph Amissah
#+EMAIL: ralph.amissah@gmail.com
#+STARTUP: indent
#+LANGUAGE: en
#+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil -:t f:t *:t <:t
#+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+OPTIONS: author:nil email:nil creator:nil timestamp:nil
#+OPTIONS: ^:nil _:nil#+OPTIONS: ^:nil _:nil
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+FILETAGS: :sdp:rel:ao:
#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n)

* utils                                                               :utils:
[[./sdp.org][sdp]]  [[./][org/]]
** set colors for terminal                                  :colors:terminal:
#+name: ao_utils
#+BEGIN_SRC d                                                  :exports none
string[string] scr_txt_color = [
  "off"           : "\033[0m",
  "white"         : "\033[37m",
  "white_bold"    : "\033[1m",
  "marker"        : "\033[42m",
  "bold"          : "\033[1m",
  "underline"     : "\033[4m",
  "invert"        : "\033[7m",
  "darkgrey_hi"   : "\033[100m",
  "grey_hi"       : "\033[47m",
  "pink_hi"       : "\033[105m",
  "fuchsia_hi"    : "\033[45m",
  "red_hi"        : "\033[41m",
  "orange_hi"     : "\033[101m",
  "yellow_hi"     : "\033[103m",
  "brown_hi"      : "\033[43m",
  "lightgreen_hi" : "\033[102m",
  "green_hi"      : "\033[42m",
  "cyan_hi"       : "\033[106m",
  "blue_hi"       : "\033[104m",
  "navy_hi"       : "\033[44m",
  "grey"          : "\033[90m",
  "pink"          : "\033[95m",
  "fuchsia"       : "\033[35m",
  "ruby"          : "\033[31m",
  "red"           : "\033[91m",
  "orange"        : "\033[91m",
  "yellow"        : "\033[93m",
  "brown"         : "\033[33m",
  "green"         : "\033[92m",
  "darkgreen"     : "\033[32m",
  "cyan"          : "\033[36m",
  "blue"          : "\033[94m",
  "navy"          : "\033[34m",
  "black"         : "\033[30m"
];
string[string] scr_txt_marker = [
  "white"         : "\033[37m*\033[0m ",
  "bold"          : "\033[1m*\033[0m ",
  "invert"        : "\033[7m*\033[0m ",
  "darkgrey_hi"   : "\033[100m*\033[0m ",
  "grey_hi"       : "\033[47m*\033[0m ",
  "pink_hi"       : "\033[105m*\033[0m ",
  "fuchsia_hi"    : "\033[45m*\033[0m ",
  "red_hi"        : "\033[41m*\033[0m ",
  "orange_hi"     : "\033[101m*\033[0m ",
  "yellow_hi"     : "\033[103m*\033[0m ",
  "brown_hi"      : "\033[43m*\033[0m ",
  "lightgreen_hi" : "\033[102m*\033[0m ",
  "green_hi"      : "\033[42m*\033[0m ",
  "cyan_hi"       : "\033[106m*\033[0m ",
  "blue_hi"       : "\033[104m*\033[0m ",
  "navy_hi"       : "\033[44m*\033[0m ",
  "grey"          : "\033[90m*\033[0m ",
  "pink"          : "\033[95m*\033[0m ",
  "fuchsia"       : "\033[35m*\033[0m ",
  "ruby"          : "\033[31m*\033[0m ",
  "red"           : "\033[91m*\033[0m ",
  "orange"        : "\033[91m*\033[0m ",
  "yellow"        : "\033[93m*\033[0m ",
  "brown"         : "\033[33m*\033[0m ",
  "green"         : "\033[92m*\033[0m ",
  "darkgreen"     : "\033[32m*\033[0m ",
  "cyan"          : "\033[36m*\033[0m ",
  "blue"          : "\033[94m*\033[0m ",
  "navy"          : "\033[34m*\033[0m ",
  "black"         : "\033[30m*\033[0m "
];
#+END_SRC

* code snippets, use as needed                           :code:snippet:debug:
** called from
#+BEGIN_SRC d  :tangle no                                      :exports none
string functionName = __FUNCTION__,
string file = __FILE__,
size_t line = __LINE__) {
writefln("Called from function %s at file %s, line %s",
  functionName, file, line);
#+END_SRC      :tangle no
#+BEGIN_SRC d                                                  :exports none
writefln("Inside function %s at file %s, line %s",
  __FUNCTION__, __FILE__, __LINE__);
#+END_SRC
* tangles                                                            :tangle:
** code structure:                                                   :ao_util.d:
#+name: tangle_ao_utils
#+BEGIN_SRC d :tangle ../lib/sdp/ao_utils.d :padline no :exports none :noweb yes
/*
  utils
  ao_util.d
*/
mixin template ScreenTxtColors() {
  <<ao_utils>>
}
#+END_SRC