Mescal
Loading...
Searching...
No Matches
tools.h
1
6
7#ifndef TOOLS_H_
8#define TOOLS_H_
9
10 /* ____ _ _ _ _ */
11 /* | _ \‍(_)___ _ __ | | __ _ _ _ | |_ ___ ___ | |___ */
12 /* | | | | / __| '_ \| |/ _` | | | | | __/ _ \ / _ \| / __| */
13 /* | |_| | \__ \ |_) | | (_| | |_| | | || (_) | (_) | \__ \ */
14 /* |____/|_|___/ .__/|_|\__,_|\__, | \__\___/ \___/|_|___/ */
15 /* |_| |___/ */
16
17#include <stdbool.h>
18#include <stdarg.h>
19#include <stdlib.h>
20#include <stdio.h>
21#include <unistd.h>
22#include <string.h>
23#include <fcntl.h>
24#include "alloc.h"
25#include "error.h"
26#include "type_basic.h"
27#include "type_dequeue.h"
28
29
37int compare_uint(const void* p1,
38 const void* p2
39);
40
41
42bool mem_array_sorted(uint e, uint* array, uint size, uint* ind);
43
44uint array_sort_norepeat_uint(uint* array,
45 uint size
46);
47
55uint get_uint_length(uint n
56);
57
58
66uchar get_uint_lbinary(uint n
67);
68
79char* multiple_strcat(char* s,
80 ...
81);
82
83/************************/
85/************************/
86
91void print_top_line(uint length,
92 FILE* out
93);
94
99void print_mid_line(uint length,
100 FILE* out
101);
102
107void print_bot_line(uint length,
108 FILE* out
109);
110
115void print_sep_line(uint length,
116 FILE* out
117);
118
123void print_dtop_line(uint length,
124 FILE* out
125);
126
131void print_dmid_line(uint length,
132 FILE* out
133);
134
139void print_dbot_line(uint length,
140 FILE* out
141);
142
147void print_spaces(uint number,
148 FILE* out
149);
150
155void print_copies_string(uint number,
156 char* s,
157 FILE* out
158);
159
167uint count_utf8_code_points(const char* s
168);
169
180void print_title_box(uint length,
181 bool closed,
182 FILE* out,
183 uint nlines,
184 ...
185);
186
197void print_dtitle_box(uint length,
198 bool closed,
199 FILE* out,
200 uint nlines,
201 ...
202);
203
211void print_line_box(uint length,
212 FILE* out,
213 char* s
214);
215
223void print_dline_box(uint length,
224 FILE* out,
225 char* s
226);
227
235uint fprint_subsc_utf8(uint n,
236 FILE* out
237);
238
246uint fprint_power_utf8(uint n,
247 FILE* out
248);
249
257int sprint_subsc_utf8(uint n,
258 char* out
259);
260
268int sprint_power_utf8(uint n,
269 char* out
270);
271
276typedef enum { RED, GREEN, YELLOW, BLUE, PURPLE, CYAN, WHITE } color;
277
278
283void print_color(char* s,
284 color col,
285 FILE* out
286);
287
288
289#endif // TOOLS_H_
Macros and functions to help memory allocation.
Macros for displaying error messages.
Basic types.
Implementation of dequeues of unsigned integers.