From dc01772814d7b6a143c19405d3386783c0b0bc25 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Sun, 10 Mar 2024 13:42:04 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=20e7743?= =?UTF-8?q?31c8086cc62472148fcb6a32cbf8bfee8e6=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- carg_8c.html | 63 ++-- carg_8c_source.html | 72 ++-- carg_8h.html | 14 +- carg_8h_source.html | 2 +- cmdapp_8c.html | 2 +- cmdapp_8c_source.html | 2 +- cmdapp_8h.html | 2 +- functions.html | 2 +- functions_vars.html | 2 +- globals_func_t.html | 3 +- globals_s.html | 2 +- globals_t.html | 5 +- search/all_11.js | 33 +- search/all_12.js | 91 ++--- search/all_b.js | 2 +- search/functions_c.js | 25 +- search/variables_9.js | 2 +- structArgSplitter.html | 18 - termcolor_8c.html | 698 +++++++++++++++++++------------------ termcolor_8c_source.html | 719 ++++++++++++++++++++------------------- termcolor_8h.html | 350 ++++++++++--------- termcolor_8h_source.html | 84 ++--- 22 files changed, 1117 insertions(+), 1076 deletions(-) diff --git a/carg_8c.html b/carg_8c.html index 6122d58..34d0484 100644 --- a/carg_8c.html +++ b/carg_8c.html @@ -138,37 +138,36 @@

-

Definition at line 22 of file carg.c.

-
22 {
-
23 const size_t sz = strlen(as->str);
-
24 char *buf = mp_malloc2(mp, sz + 1);
-
25 char prev = '\0';
-
26 m_uint i = 0, j = 0;
-
27 char c;
-
28 while ((c = as->str[i]) != '\0') {
-
29 const bool skip = prev == '\\';
-
30 const bool comma = c == ',';
-
31 if (comma) {
-
32 if (!skip) break;
-
33 --j;
-
34 }
-
35 buf[j++] = (prev = c);
-
36 ++i;
-
37 }
-
38 buf[i] = '\0';
-
39 vector_add(as->v, (vtype)mstrdup(as->mp, buf));
-
40 mp_free2(mp, sz + 1, buf);
-
41 if (i == sz) return;
-
42 as->str += i + 1;
-
43 _split_args(mp, as);
-
44}
-
static ANN void _split_args(MemPool mp, struct ArgSplitter *as)
Definition carg.c:22
+

Definition at line 21 of file carg.c.

+
21 {
+
22 const size_t sz = strlen(as->str);
+
23 char *buf = mp_malloc2(mp, sz + 1);
+
24 char prev = '\0';
+
25 m_uint i = 0, j = 0;
+
26 char c;
+
27 while ((c = as->str[i]) != '\0') {
+
28 const bool skip = prev == '\\';
+
29 const bool comma = c == ',';
+
30 if (comma) {
+
31 if (!skip) break;
+
32 --j;
+
33 }
+
34 buf[j++] = (prev = c);
+
35 ++i;
+
36 }
+
37 buf[i] = '\0';
+
38 vector_add(as->v, (vtype)mstrdup(mp, buf));
+
39 mp_free2(mp, sz + 1, buf);
+
40 if (i == sz) return;
+
41 as->str += i + 1;
+
42 _split_args(mp, as);
+
43}
+
static ANN void _split_args(MemPool mp, struct ArgSplitter *as)
Definition carg.c:21
uintptr_t vtype
Definition container.h:14
uintptr_t m_uint
Definition gwcommon.h:11
static ANN m_str mstrdup(MemPool mp, const char *name)
mp_alloc version of strdup
Definition mp_string.h:13
#define mp_free2(p, sz, a)
Definition mpool.h:28
#define mp_malloc2(p, sz)
Definition mpool.h:30
-
MemPool mp
Definition carg.c:19
m_str str
Definition carg.c:17
Vector v
Definition carg.c:18
ANN void vector_add(const Vector v, const vtype data)
Definition vector.c:21
@@ -231,12 +230,12 @@

Definition at line 46 of file carg.c.

-
46 {
-
47 struct ArgSplitter as = {.str = str, .v = new_vector(p), .mp = p};
-
48 _split_args(p, &as);
-
49 return as.v;
-
50}
+

Definition at line 45 of file carg.c.

+
45 {
+
46 struct ArgSplitter as = {.str = str, .v = new_vector(p) };
+
47 _split_args(p, &as);
+
48 return as.v;
+
49}
used internally to split arguments
Definition carg.c:16
Vector new_vector(MemPool p)
Definition vector.c:8
diff --git a/carg_8c_source.html b/carg_8c_source.html index f597628..660aba9 100644 --- a/carg_8c_source.html +++ b/carg_8c_source.html @@ -101,46 +101,45 @@ - -
20};
+
19};
-
21
-
-
22ANN static void _split_args(MemPool mp, struct ArgSplitter *as) {
-
23 const size_t sz = strlen(as->str);
-
24 char *buf = mp_malloc2(mp, sz + 1);
-
25 char prev = '\0';
-
26 m_uint i = 0, j = 0;
-
27 char c;
-
28 while ((c = as->str[i]) != '\0') {
-
29 const bool skip = prev == '\\';
-
30 const bool comma = c == ',';
-
31 if (comma) {
-
32 if (!skip) break;
-
33 --j;
-
34 }
-
35 buf[j++] = (prev = c);
-
36 ++i;
-
37 }
-
38 buf[i] = '\0';
-
39 vector_add(as->v, (vtype)mstrdup(as->mp, buf));
-
40 mp_free2(mp, sz + 1, buf);
-
41 if (i == sz) return;
-
42 as->str += i + 1;
-
43 _split_args(mp, as);
-
44}
+
20
+
+
21ANN static void _split_args(MemPool mp, struct ArgSplitter *as) {
+
22 const size_t sz = strlen(as->str);
+
23 char *buf = mp_malloc2(mp, sz + 1);
+
24 char prev = '\0';
+
25 m_uint i = 0, j = 0;
+
26 char c;
+
27 while ((c = as->str[i]) != '\0') {
+
28 const bool skip = prev == '\\';
+
29 const bool comma = c == ',';
+
30 if (comma) {
+
31 if (!skip) break;
+
32 --j;
+
33 }
+
34 buf[j++] = (prev = c);
+
35 ++i;
+
36 }
+
37 buf[i] = '\0';
+
38 vector_add(as->v, (vtype)mstrdup(mp, buf));
+
39 mp_free2(mp, sz + 1, buf);
+
40 if (i == sz) return;
+
41 as->str += i + 1;
+
42 _split_args(mp, as);
+
43}
-
45
-
- -
47 struct ArgSplitter as = {.str = str, .v = new_vector(p), .mp = p};
-
48 _split_args(p, &as);
-
49 return as.v;
-
50}
+
44
+
+ +
46 struct ArgSplitter as = {.str = str, .v = new_vector(p) };
+
47 _split_args(p, &as);
+
48 return as.v;
+
49}
-
ANN Vector split_args(MemPool p, const m_str str)
returns separated arguments from a string in a vector.
Definition carg.c:46
+
ANN Vector split_args(MemPool p, const m_str str)
returns separated arguments from a string in a vector.
Definition carg.c:45
ANN m_str option_argument(struct CArg *ca)
returns the option to the argument, errors and returns if none
Definition carg.c:7
-
static ANN void _split_args(MemPool mp, struct ArgSplitter *as)
Definition carg.c:22
+
static ANN void _split_args(MemPool mp, struct ArgSplitter *as)
Definition carg.c:21
uintptr_t vtype
Definition container.h:14
#define _(String)
Definition defs.h:13
#define ANN
Definition defs.h:19
@@ -153,7 +152,6 @@
#define mp_free2(p, sz, a)
Definition mpool.h:28
#define mp_malloc2(p, sz)
Definition mpool.h:30
used internally to split arguments
Definition carg.c:16
-
MemPool mp
Definition carg.c:19
m_str str
Definition carg.c:17
Vector v
Definition carg.c:18
structure used to parse arguments
Definition carg.h:8
diff --git a/carg_8h.html b/carg_8h.html index 4610443..9ce17b6 100644 --- a/carg_8h.html +++ b/carg_8h.html @@ -164,13 +164,13 @@

Definition at line 46 of file carg.c.

-
46 {
-
47 struct ArgSplitter as = {.str = str, .v = new_vector(p), .mp = p};
-
48 _split_args(p, &as);
-
49 return as.v;
-
50}
-
static ANN void _split_args(MemPool mp, struct ArgSplitter *as)
Definition carg.c:22
+

Definition at line 45 of file carg.c.

+
45 {
+
46 struct ArgSplitter as = {.str = str, .v = new_vector(p) };
+
47 _split_args(p, &as);
+
48 return as.v;
+
49}
+
static ANN void _split_args(MemPool mp, struct ArgSplitter *as)
Definition carg.c:21
used internally to split arguments
Definition carg.c:16
m_str str
Definition carg.c:17
Vector v
Definition carg.c:18
diff --git a/carg_8h_source.html b/carg_8h_source.html index 6331c93..1b9419f 100644 --- a/carg_8h_source.html +++ b/carg_8h_source.html @@ -100,7 +100,7 @@
16
22#endif
-
ANN Vector split_args(MemPool, const m_str str)
returns separated arguments from a string in a vector.
Definition carg.c:46
+
ANN Vector split_args(MemPool, const m_str str)
returns separated arguments from a string in a vector.
Definition carg.c:45
ANN m_str option_argument(struct CArg *ca)
returns the option to the argument, errors and returns if none
Definition carg.c:7
#define ANN
Definition defs.h:19
char * m_str
Definition gwcommon.h:14
diff --git a/cmdapp_8c.html b/cmdapp_8c.html index e8c9c96..6df23cf 100644 --- a/cmdapp_8c.html +++ b/cmdapp_8c.html @@ -621,7 +621,7 @@

const char * longo
Definition cmdapp.h:38

char shorto
Definition cmdapp.h:37
const char * argtype
Definition cmdapp.h:40
-
int tcol_printf(const char *fmt,...)
Definition termcolor.c:369
+
int tcol_printf(const char *fmt,...)
Definition termcolor.c:373

diff --git a/cmdapp_8c_source.html b/cmdapp_8c_source.html index 7a63ec9..ab56a1f 100644 --- a/cmdapp_8c_source.html +++ b/cmdapp_8c_source.html @@ -561,7 +561,7 @@
const char * longo
Definition cmdapp.h:38
char shorto
Definition cmdapp.h:37
const char * argtype
Definition cmdapp.h:40
-
int tcol_printf(const char *fmt,...)
Definition termcolor.c:369
+
int tcol_printf(const char *fmt,...)
Definition termcolor.c:373
void void * arg
Definition threadpool.h:27

diff --git a/cmdapp_8h.html b/cmdapp_8h.html index ed384b1..2ef0c37 100644 --- a/cmdapp_8h.html +++ b/cmdapp_8h.html @@ -743,7 +743,7 @@

const char * longo
Definition cmdapp.h:38
char shorto
Definition cmdapp.h:37
const char * argtype
Definition cmdapp.h:40
-
int tcol_printf(const char *fmt,...)
Definition termcolor.c:369
+
int tcol_printf(const char *fmt,...)
Definition termcolor.c:373
diff --git a/functions.html b/functions.html index 4c1e15d..4796403 100644 --- a/functions.html +++ b/functions.html @@ -149,7 +149,7 @@

- l -

    - m -

    diff --git a/functions_vars.html b/functions_vars.html index 6723481..e06fa6f 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -149,7 +149,7 @@

    - l -

      - m -

      diff --git a/globals_func_t.html b/globals_func_t.html index a754d76..7b0eca6 100644 --- a/globals_func_t.html +++ b/globals_func_t.html @@ -79,8 +79,9 @@

      - t -

      • tcol_errorstr() : termcolor.c, termcolor.h
      • tcol_fmt_parse() : termcolor.c
      • tcol_fprintf() : termcolor.c, termcolor.h
      • +
      • tcol_has_color() : termcolor.c, termcolor.h
      • tcol_override_color_checks() : termcolor.c, termcolor.h
      • -
      • tcol_printf() : termcolor.c, termcolor.h
      • +
      • tcol_printf() : termcolor.h, termcolor.c
      • tcol_snprintf() : termcolor.c, termcolor.h
      • tcol_vfprintf() : termcolor.c
      • tcol_vsnprintf() : termcolor.c
      • diff --git a/globals_s.html b/globals_s.html index 787643b..a4b8689 100644 --- a/globals_s.html +++ b/globals_s.html @@ -91,8 +91,8 @@

        - s -

        • SMALL_BLK : mpool.c
        • split_args() : carg.c, carg.h
        • start() : threadpool.c
        • -
        • str : gwion_print.h
        • STR : gwion_thread.h
        • +
        • str : gwion_print.h
        • STR_EXPAND : gwion_thread.h
        • strdup() : windows_missing.h
        • strndup() : windows_missing.h
        • diff --git a/globals_t.html b/globals_t.html index 78e2252..1575992 100644 --- a/globals_t.html +++ b/globals_t.html @@ -81,8 +81,9 @@

          - t -

          • tcol_errorstrs : termcolor.c
          • tcol_fmt_parse() : termcolor.c
          • tcol_fprintf() : termcolor.c, termcolor.h
          • +
          • tcol_has_color() : termcolor.c, termcolor.h
          • tcol_override_color_checks() : termcolor.c, termcolor.h
          • -
          • tcol_printf() : termcolor.c, termcolor.h
          • +
          • tcol_printf() : termcolor.h, termcolor.c
          • tcol_snprintf() : termcolor.c, termcolor.h
          • tcol_vfprintf() : termcolor.c
          • tcol_vsnprintf() : termcolor.c
          • @@ -93,7 +94,7 @@

            - t -

            • TermColorErrorNone : termcolor.h
            • TermColorErrorPrintingFailed : termcolor.h
            • TermColorErrorUnterminatedColor : termcolor.h
            • -
            • text_add() : gwion_text.h, text.c
            • +
            • text_add() : text.c, gwion_text.h
            • text_grow() : text.c
            • text_init() : gwion_text.h
            • text_release() : gwion_text.h
            • diff --git a/search/all_11.js b/search/all_11.js index 6d2cb5d..593b131 100644 --- a/search/all_11.js +++ b/search/all_11.js @@ -25,22 +25,21 @@ var searchData= ['split_5fargs_22',['split_args',['../carg_8c.html#a3034a483044b365bd22a7b5082701858',1,'split_args(MemPool p, const m_str str): carg.c'],['../carg_8h.html#a0a98b55aa20636ca37a9790212ce6df9',1,'split_args(MemPool, const m_str str): carg.c']]], ['start_23',['start',['../threadpool_8c.html#a3894d8da81939354904466d4173b1b2a',1,'threadpool.c']]], ['started_24',['started',['../structthreadpool__t.html#a5c801fc5798e6c2851367667e051a4cd',1,'threadpool_t']]], - ['str_25',['str',['../structArgSplitter.html#a9fa86c0b2a471471fbddb568aecb7cee',1,'ArgSplitter::str'],['../structGwText__.html#a6dcca7bae982686b33476bc6cf463d67',1,'GwText_::str']]], + ['str_25',['str',['../structArgSplitter.html#a9fa86c0b2a471471fbddb568aecb7cee',1,'ArgSplitter::str'],['../structGwText__.html#a6dcca7bae982686b33476bc6cf463d67',1,'GwText_::str'],['../gwion__print_8h.html#a0152c0786fc5e4375f6400f14b1da464',1,'str: gwion_print.h']]], ['str_26',['STR',['../gwion__thread_8h.html#a05b95a47759fd66b4deab2740ba27453',1,'gwion_thread.h']]], - ['str_27',['str',['../gwion__print_8h.html#a0152c0786fc5e4375f6400f14b1da464',1,'gwion_print.h']]], - ['str_5fexpand_28',['STR_EXPAND',['../gwion__thread_8h.html#a61469a2fe6aebc934e696bde3522a763',1,'gwion_thread.h']]], - ['strdup_29',['strdup',['../windows__missing_8h.html#a5ffaef3fc3f7ddb9856ccd4bcb79e9bc',1,'windows_missing.h']]], - ['strndup_30',['strndup',['../windows__missing_8h.html#ae1dd96623292aa543d16c28d1b6ce211',1,'windows_missing.h']]], - ['strsep_31',['strsep',['../windows__missing_8h.html#a098b232e1cfa2b0ce1d94b7ad0440cbb',1,'windows_missing.h']]], - ['sym_32',['sym',['../structSymTable__.html#aebf1c9402749af3417c005443e403cb6',1,'SymTable_']]], - ['symbol_33',['Symbol',['../symbol_8h.html#af5a7a75d6e13311eed0af65155ed4f9f',1,'symbol.h']]], - ['symbol_2ec_34',['symbol.c',['../symbol_8c.html',1,'']]], - ['symbol_2eh_35',['symbol.h',['../symbol_8h.html',1,'']]], - ['symbol_5f_36',['Symbol_',['../structSymbol__.html',1,'']]], - ['symtable_37',['SymTable',['../symbol_8h.html#ae300fdf4e3b772d3755da1aa41dfcf96',1,'symbol.h']]], - ['symtable_5f_38',['SymTable_',['../structSymTable__.html',1,'']]], - ['synopses_39',['synopses',['../structcmdapp__info__t.html#aa525aebb8220cc5878989f4cc3854513',1,'cmdapp_info_t']]], - ['sz_40',['sz',['../structMemPool__.html#ae7ed1cf61c95853982ddf9579e7c91ed',1,'MemPool_::sz'],['../structSymTable__.html#a0214d7a9597cf6a110ab4e4cee48eaec',1,'SymTable_::sz']]], - ['sz_5ffloat_41',['SZ_FLOAT',['../gwcommon_8h.html#a61f1386f5d2320698ef773cd99ec45c2',1,'gwcommon.h']]], - ['sz_5fint_42',['SZ_INT',['../gwcommon_8h.html#a61ab0ac32d257c02bc3b3f12dfe668e9',1,'gwcommon.h']]] + ['str_5fexpand_27',['STR_EXPAND',['../gwion__thread_8h.html#a61469a2fe6aebc934e696bde3522a763',1,'gwion_thread.h']]], + ['strdup_28',['strdup',['../windows__missing_8h.html#a5ffaef3fc3f7ddb9856ccd4bcb79e9bc',1,'windows_missing.h']]], + ['strndup_29',['strndup',['../windows__missing_8h.html#ae1dd96623292aa543d16c28d1b6ce211',1,'windows_missing.h']]], + ['strsep_30',['strsep',['../windows__missing_8h.html#a098b232e1cfa2b0ce1d94b7ad0440cbb',1,'windows_missing.h']]], + ['sym_31',['sym',['../structSymTable__.html#aebf1c9402749af3417c005443e403cb6',1,'SymTable_']]], + ['symbol_32',['Symbol',['../symbol_8h.html#af5a7a75d6e13311eed0af65155ed4f9f',1,'symbol.h']]], + ['symbol_2ec_33',['symbol.c',['../symbol_8c.html',1,'']]], + ['symbol_2eh_34',['symbol.h',['../symbol_8h.html',1,'']]], + ['symbol_5f_35',['Symbol_',['../structSymbol__.html',1,'']]], + ['symtable_36',['SymTable',['../symbol_8h.html#ae300fdf4e3b772d3755da1aa41dfcf96',1,'symbol.h']]], + ['symtable_5f_37',['SymTable_',['../structSymTable__.html',1,'']]], + ['synopses_38',['synopses',['../structcmdapp__info__t.html#aa525aebb8220cc5878989f4cc3854513',1,'cmdapp_info_t']]], + ['sz_39',['sz',['../structMemPool__.html#ae7ed1cf61c95853982ddf9579e7c91ed',1,'MemPool_::sz'],['../structSymTable__.html#a0214d7a9597cf6a110ab4e4cee48eaec',1,'SymTable_::sz']]], + ['sz_5ffloat_40',['SZ_FLOAT',['../gwcommon_8h.html#a61f1386f5d2320698ef773cd99ec45c2',1,'gwcommon.h']]], + ['sz_5fint_41',['SZ_INT',['../gwcommon_8h.html#a61ab0ac32d257c02bc3b3f12dfe668e9',1,'gwcommon.h']]] ]; diff --git a/search/all_12.js b/search/all_12.js index 6ce5ac0..8e5a230 100644 --- a/search/all_12.js +++ b/search/all_12.js @@ -9,49 +9,50 @@ var searchData= ['tcol_5ferrorstrs_6',['tcol_errorstrs',['../termcolor_8c.html#a3857960899e6fdcb12965887f6ecb67a',1,'termcolor.c']]], ['tcol_5ffmt_5fparse_7',['tcol_fmt_parse',['../termcolor_8c.html#a814d3c4218299c57ec5ab6fbddf5d728',1,'termcolor.c']]], ['tcol_5ffprintf_8',['tcol_fprintf',['../termcolor_8c.html#a22c2d3666092d1f4ec58c27e06b96406',1,'tcol_fprintf(FILE *stream, const char *fmt,...): termcolor.c'],['../termcolor_8h.html#a22c2d3666092d1f4ec58c27e06b96406',1,'tcol_fprintf(FILE *stream, const char *fmt,...): termcolor.c']]], - ['tcol_5foverride_5fcolor_5fchecks_9',['tcol_override_color_checks',['../termcolor_8c.html#a45276491c40829998caacbdae38e9ab4',1,'tcol_override_color_checks(bool enable_color): termcolor.c'],['../termcolor_8h.html#a45276491c40829998caacbdae38e9ab4',1,'tcol_override_color_checks(bool enable_color): termcolor.c']]], - ['tcol_5fprintf_10',['tcol_printf',['../termcolor_8c.html#a3904600e47ea1b5e9b5190813e771726',1,'tcol_printf(const char *fmt,...): termcolor.c'],['../termcolor_8h.html#a3904600e47ea1b5e9b5190813e771726',1,'tcol_printf(const char *fmt,...): termcolor.c']]], - ['tcol_5fsnprintf_11',['tcol_snprintf',['../termcolor_8c.html#a5d7c664db8584c4396bd5bb6c46939b7',1,'tcol_snprintf(char *stream, size_t N, const char *fmt,...): termcolor.c'],['../termcolor_8h.html#a04f7ab41736b98fbba6b28c76f0d36f6',1,'tcol_snprintf(char *buffer, size_t N, const char *fmt,...): termcolor.c']]], - ['tcol_5fvfprintf_12',['tcol_vfprintf',['../termcolor_8c.html#abceb3cf9bcb5a4958f611458b711e996',1,'termcolor.c']]], - ['tcol_5fvsnprintf_13',['tcol_vsnprintf',['../termcolor_8c.html#a3328b083df29d219389ca7c1cffb7289',1,'termcolor.c']]], - ['term_5fcolor_5ferror_5fcount_14',['TERM_COLOR_ERROR_COUNT',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46ba18311f036b966c8d8d0b3e7ca9de9125',1,'termcolor.h']]], - ['term_5fcolor_5ferror_5ft_15',['term_color_error_t',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46b',1,'termcolor.h']]], - ['termcolor_2ec_16',['termcolor.c',['../termcolor_8c.html',1,'']]], - ['termcolor_2eh_17',['termcolor.h',['../termcolor_8h.html',1,'']]], - ['termcolorerrorallocationfailed_18',['TermColorErrorAllocationFailed',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46ba9a739a636bd0b48c8e875ef480855ae5',1,'termcolor.h']]], - ['termcolorerrorinvalidcolor_19',['TermColorErrorInvalidColor',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46ba06a0e7f68df54c17a5b8208b27dff83d',1,'termcolor.h']]], - ['termcolorerrornone_20',['TermColorErrorNone',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46bac7bf7e10166d187eef17c6f71bbfa3cd',1,'termcolor.h']]], - ['termcolorerrorprintingfailed_21',['TermColorErrorPrintingFailed',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46bacd281161f0a834ac9668792db1e10d03',1,'termcolor.h']]], - ['termcolorerrorunterminatedcolor_22',['TermColorErrorUnterminatedColor',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46ba1227b9061ccd1ae1f08663813c997941',1,'termcolor.h']]], - ['text_2ec_23',['text.c',['../text_8c.html',1,'']]], - ['text_5fadd_24',['text_add',['../text_8c.html#a12e169fc9d93563391f9946efe86a380',1,'text_add(GwText *text, const char *str): text.c'],['../gwion__text_8h.html#a9cdc47b67c84e2a87c5908c3074c41a5',1,'text_add(GwText *, const char *): text.c']]], - ['text_5fgrow_25',['text_grow',['../text_8c.html#a6676f1e3cf8449a4aa756c029ac9a053',1,'text.c']]], - ['text_5finit_26',['text_init',['../gwion__text_8h.html#a06a5be3f975a55f3f1a0c96b9a78454c',1,'gwion_text.h']]], - ['text_5frelease_27',['text_release',['../gwion__text_8h.html#a8f885a2b609315784a1ca023e403bd43',1,'gwion_text.h']]], - ['text_5freset_28',['text_reset',['../gwion__text_8h.html#a0ee05644261d6721da77d6e82d377153',1,'gwion_text.h']]], - ['thread_5fcond_5fbroadcast_29',['THREAD_COND_BROADCAST',['../gwion__thread_8h.html#a8fa7020cd72973db2af5de783ff4a1c2',1,'gwion_thread.h']]], - ['thread_5fcond_5fcleanup_30',['THREAD_COND_CLEANUP',['../gwion__thread_8h.html#a7e307dfe60e30c7c953283031a09c72b',1,'gwion_thread.h']]], - ['thread_5fcond_5fsetup_31',['THREAD_COND_SETUP',['../gwion__thread_8h.html#a3d93fc0a1cc0db288695989bbffb704a',1,'gwion_thread.h']]], - ['thread_5fcond_5fsignal_32',['THREAD_COND_SIGNAL',['../gwion__thread_8h.html#afe58fe34a9dac2526796eedc93417652',1,'gwion_thread.h']]], - ['thread_5fcond_5ftype_33',['THREAD_COND_TYPE',['../gwion__thread_8h.html#a3e2835fe70b1eaf44eeabad652062ad4',1,'gwion_thread.h']]], - ['thread_5fcond_5fwait_34',['THREAD_COND_WAIT',['../gwion__thread_8h.html#a8b459dbc6d165c396134b045a72a6d74',1,'gwion_thread.h']]], - ['thread_5fcreate_35',['THREAD_CREATE',['../gwion__thread_8h.html#a0d6735b6a6b74cb75e999d16f1eb2d9e',1,'gwion_thread.h']]], - ['thread_5fdetach_36',['THREAD_DETACH',['../gwion__thread_8h.html#a4bf3369b61ceeec33cd50c9e66de04f5',1,'gwion_thread.h']]], - ['thread_5ffunc_37',['THREAD_FUNC',['../gwion__thread_8h.html#a3637287c89ec5d3696006f53de1b9617',1,'gwion_thread.h']]], - ['thread_5fjoin_38',['THREAD_JOIN',['../gwion__thread_8h.html#ab2c7c48d11176ee55bda16531ba59363',1,'gwion_thread.h']]], - ['thread_5frettype_39',['THREAD_RETTYPE',['../gwion__thread_8h.html#aa6e1228d7e1d7da1e094240f2fa92a7d',1,'gwion_thread.h']]], - ['thread_5freturn_40',['THREAD_RETURN',['../gwion__thread_8h.html#a515c663597d2215632df9477bde675f6',1,'gwion_thread.h']]], - ['thread_5ftype_41',['THREAD_TYPE',['../gwion__thread_8h.html#a53ca774b0fc84afe282a5419d2d7239a',1,'gwion_thread.h']]], - ['threadpool_2ec_42',['threadpool.c',['../threadpool_8c.html',1,'']]], - ['threadpool_2eh_43',['threadpool.h',['../threadpool_8h.html',1,'']]], - ['threadpool_5fadd_44',['threadpool_add',['../threadpool_8c.html#a1d4ac1614d1076b3f64a161ec8a2d1d5',1,'threadpool.c']]], - ['threadpool_5ferror_5ft_45',['threadpool_error_t',['../threadpool_8h.html#a8a6eee42eb9ec77ec476dd5003fa8a15',1,'threadpool.h']]], - ['threadpool_5flock_5ffailure_46',['threadpool_lock_failure',['../threadpool_8h.html#a8a6eee42eb9ec77ec476dd5003fa8a15a561ad2293f0fceae47dac28babf3c012',1,'threadpool.h']]], - ['threadpool_5fqueue_5ffull_47',['threadpool_queue_full',['../threadpool_8h.html#a8a6eee42eb9ec77ec476dd5003fa8a15abda3787fb0868847e27a3f4f4755def5',1,'threadpool.h']]], - ['threadpool_5fshutdown_48',['threadpool_shutdown',['../threadpool_8h.html#a8a6eee42eb9ec77ec476dd5003fa8a15aa2024ae2b243c037f07edf80c0a12311',1,'threadpool.h']]], - ['threadpool_5ft_49',['threadpool_t',['../structthreadpool__t.html',1,'threadpool_t'],['../threadpool_8h.html#a7cf07228762e9a259db1c324e992a4c2',1,'threadpool_t: threadpool.h']]], - ['threadpool_5fthread_50',['threadpool_thread',['../threadpool_8c.html#a6366ee00becf3487b07ed88fccff7f43',1,'threadpool.c']]], - ['threadpool_5fthread_5ffailure_51',['threadpool_thread_failure',['../threadpool_8h.html#a8a6eee42eb9ec77ec476dd5003fa8a15a385969d03ee20f2af1b727310f736e6e',1,'threadpool.h']]], - ['threads_52',['threads',['../structthreadpool__t.html#a4037578d62efe5812c6a71bdf80ca71f',1,'threadpool_t']]], - ['todo_53',['TODO',['../index.html#autotoc_md2',1,'']]] + ['tcol_5fhas_5fcolor_9',['tcol_has_color',['../termcolor_8c.html#aaacfae8f2f863c6e5536f276eec1ce79',1,'tcol_has_color(void): termcolor.c'],['../termcolor_8h.html#aaacfae8f2f863c6e5536f276eec1ce79',1,'tcol_has_color(void): termcolor.c']]], + ['tcol_5foverride_5fcolor_5fchecks_10',['tcol_override_color_checks',['../termcolor_8c.html#a45276491c40829998caacbdae38e9ab4',1,'tcol_override_color_checks(bool enable_color): termcolor.c'],['../termcolor_8h.html#a45276491c40829998caacbdae38e9ab4',1,'tcol_override_color_checks(bool enable_color): termcolor.c']]], + ['tcol_5fprintf_11',['tcol_printf',['../termcolor_8c.html#a3904600e47ea1b5e9b5190813e771726',1,'tcol_printf(const char *fmt,...): termcolor.c'],['../termcolor_8h.html#a3904600e47ea1b5e9b5190813e771726',1,'tcol_printf(const char *fmt,...): termcolor.c']]], + ['tcol_5fsnprintf_12',['tcol_snprintf',['../termcolor_8c.html#a5d7c664db8584c4396bd5bb6c46939b7',1,'tcol_snprintf(char *stream, size_t N, const char *fmt,...): termcolor.c'],['../termcolor_8h.html#a04f7ab41736b98fbba6b28c76f0d36f6',1,'tcol_snprintf(char *buffer, size_t N, const char *fmt,...): termcolor.c']]], + ['tcol_5fvfprintf_13',['tcol_vfprintf',['../termcolor_8c.html#abceb3cf9bcb5a4958f611458b711e996',1,'termcolor.c']]], + ['tcol_5fvsnprintf_14',['tcol_vsnprintf',['../termcolor_8c.html#a3328b083df29d219389ca7c1cffb7289',1,'termcolor.c']]], + ['term_5fcolor_5ferror_5fcount_15',['TERM_COLOR_ERROR_COUNT',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46ba18311f036b966c8d8d0b3e7ca9de9125',1,'termcolor.h']]], + ['term_5fcolor_5ferror_5ft_16',['term_color_error_t',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46b',1,'termcolor.h']]], + ['termcolor_2ec_17',['termcolor.c',['../termcolor_8c.html',1,'']]], + ['termcolor_2eh_18',['termcolor.h',['../termcolor_8h.html',1,'']]], + ['termcolorerrorallocationfailed_19',['TermColorErrorAllocationFailed',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46ba9a739a636bd0b48c8e875ef480855ae5',1,'termcolor.h']]], + ['termcolorerrorinvalidcolor_20',['TermColorErrorInvalidColor',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46ba06a0e7f68df54c17a5b8208b27dff83d',1,'termcolor.h']]], + ['termcolorerrornone_21',['TermColorErrorNone',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46bac7bf7e10166d187eef17c6f71bbfa3cd',1,'termcolor.h']]], + ['termcolorerrorprintingfailed_22',['TermColorErrorPrintingFailed',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46bacd281161f0a834ac9668792db1e10d03',1,'termcolor.h']]], + ['termcolorerrorunterminatedcolor_23',['TermColorErrorUnterminatedColor',['../termcolor_8h.html#ae1d993ec016dde10bee74d23dc09c46ba1227b9061ccd1ae1f08663813c997941',1,'termcolor.h']]], + ['text_2ec_24',['text.c',['../text_8c.html',1,'']]], + ['text_5fadd_25',['text_add',['../text_8c.html#a12e169fc9d93563391f9946efe86a380',1,'text_add(GwText *text, const char *str): text.c'],['../gwion__text_8h.html#a9cdc47b67c84e2a87c5908c3074c41a5',1,'text_add(GwText *, const char *): text.c']]], + ['text_5fgrow_26',['text_grow',['../text_8c.html#a6676f1e3cf8449a4aa756c029ac9a053',1,'text.c']]], + ['text_5finit_27',['text_init',['../gwion__text_8h.html#a06a5be3f975a55f3f1a0c96b9a78454c',1,'gwion_text.h']]], + ['text_5frelease_28',['text_release',['../gwion__text_8h.html#a8f885a2b609315784a1ca023e403bd43',1,'gwion_text.h']]], + ['text_5freset_29',['text_reset',['../gwion__text_8h.html#a0ee05644261d6721da77d6e82d377153',1,'gwion_text.h']]], + ['thread_5fcond_5fbroadcast_30',['THREAD_COND_BROADCAST',['../gwion__thread_8h.html#a8fa7020cd72973db2af5de783ff4a1c2',1,'gwion_thread.h']]], + ['thread_5fcond_5fcleanup_31',['THREAD_COND_CLEANUP',['../gwion__thread_8h.html#a7e307dfe60e30c7c953283031a09c72b',1,'gwion_thread.h']]], + ['thread_5fcond_5fsetup_32',['THREAD_COND_SETUP',['../gwion__thread_8h.html#a3d93fc0a1cc0db288695989bbffb704a',1,'gwion_thread.h']]], + ['thread_5fcond_5fsignal_33',['THREAD_COND_SIGNAL',['../gwion__thread_8h.html#afe58fe34a9dac2526796eedc93417652',1,'gwion_thread.h']]], + ['thread_5fcond_5ftype_34',['THREAD_COND_TYPE',['../gwion__thread_8h.html#a3e2835fe70b1eaf44eeabad652062ad4',1,'gwion_thread.h']]], + ['thread_5fcond_5fwait_35',['THREAD_COND_WAIT',['../gwion__thread_8h.html#a8b459dbc6d165c396134b045a72a6d74',1,'gwion_thread.h']]], + ['thread_5fcreate_36',['THREAD_CREATE',['../gwion__thread_8h.html#a0d6735b6a6b74cb75e999d16f1eb2d9e',1,'gwion_thread.h']]], + ['thread_5fdetach_37',['THREAD_DETACH',['../gwion__thread_8h.html#a4bf3369b61ceeec33cd50c9e66de04f5',1,'gwion_thread.h']]], + ['thread_5ffunc_38',['THREAD_FUNC',['../gwion__thread_8h.html#a3637287c89ec5d3696006f53de1b9617',1,'gwion_thread.h']]], + ['thread_5fjoin_39',['THREAD_JOIN',['../gwion__thread_8h.html#ab2c7c48d11176ee55bda16531ba59363',1,'gwion_thread.h']]], + ['thread_5frettype_40',['THREAD_RETTYPE',['../gwion__thread_8h.html#aa6e1228d7e1d7da1e094240f2fa92a7d',1,'gwion_thread.h']]], + ['thread_5freturn_41',['THREAD_RETURN',['../gwion__thread_8h.html#a515c663597d2215632df9477bde675f6',1,'gwion_thread.h']]], + ['thread_5ftype_42',['THREAD_TYPE',['../gwion__thread_8h.html#a53ca774b0fc84afe282a5419d2d7239a',1,'gwion_thread.h']]], + ['threadpool_2ec_43',['threadpool.c',['../threadpool_8c.html',1,'']]], + ['threadpool_2eh_44',['threadpool.h',['../threadpool_8h.html',1,'']]], + ['threadpool_5fadd_45',['threadpool_add',['../threadpool_8c.html#a1d4ac1614d1076b3f64a161ec8a2d1d5',1,'threadpool.c']]], + ['threadpool_5ferror_5ft_46',['threadpool_error_t',['../threadpool_8h.html#a8a6eee42eb9ec77ec476dd5003fa8a15',1,'threadpool.h']]], + ['threadpool_5flock_5ffailure_47',['threadpool_lock_failure',['../threadpool_8h.html#a8a6eee42eb9ec77ec476dd5003fa8a15a561ad2293f0fceae47dac28babf3c012',1,'threadpool.h']]], + ['threadpool_5fqueue_5ffull_48',['threadpool_queue_full',['../threadpool_8h.html#a8a6eee42eb9ec77ec476dd5003fa8a15abda3787fb0868847e27a3f4f4755def5',1,'threadpool.h']]], + ['threadpool_5fshutdown_49',['threadpool_shutdown',['../threadpool_8h.html#a8a6eee42eb9ec77ec476dd5003fa8a15aa2024ae2b243c037f07edf80c0a12311',1,'threadpool.h']]], + ['threadpool_5ft_50',['threadpool_t',['../structthreadpool__t.html',1,'threadpool_t'],['../threadpool_8h.html#a7cf07228762e9a259db1c324e992a4c2',1,'threadpool_t: threadpool.h']]], + ['threadpool_5fthread_51',['threadpool_thread',['../threadpool_8c.html#a6366ee00becf3487b07ed88fccff7f43',1,'threadpool.c']]], + ['threadpool_5fthread_5ffailure_52',['threadpool_thread_failure',['../threadpool_8h.html#a8a6eee42eb9ec77ec476dd5003fa8a15a385969d03ee20f2af1b727310f736e6e',1,'threadpool.h']]], + ['threads_53',['threads',['../structthreadpool__t.html#a4037578d62efe5812c6a71bdf80ca71f',1,'threadpool_t']]], + ['todo_54',['TODO',['../index.html#autotoc_md2',1,'']]] ]; diff --git a/search/all_b.js b/search/all_b.js index 4735674..c44f790 100644 --- a/search/all_b.js +++ b/search/all_b.js @@ -45,7 +45,7 @@ var searchData= ['mempool_5fend_42',['mempool_end',['../mpool_8c.html#a8429a695a1af2385ae1c5d7a5771caf5',1,'mempool_end(MemPool mp): mpool.c'],['../mpool_8h.html#a8429a695a1af2385ae1c5d7a5771caf5',1,'mempool_end(MemPool mp): mpool.c']]], ['mempool_5fini_43',['mempool_ini',['../mpool_8c.html#a5a897670de44393bce837bce9fdc23ef',1,'mempool_ini(const size_t sz): mpool.c'],['../mpool_8h.html#a5a897670de44393bce837bce9fdc23ef',1,'mempool_ini(const size_t sz): mpool.c']]], ['mksymbol_44',['mksymbol',['../symbol_8c.html#a0df73efd7dba8292cf21fe28a3f4c10b',1,'symbol.c']]], - ['mp_45',['mp',['../structArgSplitter.html#a5143eb2485df5c7c28dc7d0bee8a5468',1,'ArgSplitter::mp'],['../structGwText__.html#ab898b542618ba8f288ff5f83e5a03c57',1,'GwText_::mp']]], + ['mp_45',['mp',['../structGwText__.html#ab898b542618ba8f288ff5f83e5a03c57',1,'GwText_']]], ['mp_5falloc_46',['MP_ALLOC',['../mpool_8c.html#a506ee1ccf7cac90f6eeea9b6d4ec0e44',1,'mpool.c']]], ['mp_5fcalloc_47',['mp_calloc',['../mpool_8h.html#a2c191a434fae6c134bab72438b8f01be',1,'mpool.h']]], ['mp_5fcalloc2_48',['mp_calloc2',['../mpool_8h.html#a6ad492253c67e5c5f6edbda4b0331c9c',1,'mpool.h']]], diff --git a/search/functions_c.js b/search/functions_c.js index 6134250..1c8cdc7 100644 --- a/search/functions_c.js +++ b/search/functions_c.js @@ -4,16 +4,17 @@ var searchData= ['tcol_5ferrorstr_1',['tcol_errorstr',['../termcolor_8c.html#a02a0b19d11c2a2fed211f535890223f0',1,'tcol_errorstr(const enum term_color_error_t err): termcolor.c'],['../termcolor_8h.html#a02a0b19d11c2a2fed211f535890223f0',1,'tcol_errorstr(const enum term_color_error_t err): termcolor.c']]], ['tcol_5ffmt_5fparse_2',['tcol_fmt_parse',['../termcolor_8c.html#a814d3c4218299c57ec5ab6fbddf5d728',1,'termcolor.c']]], ['tcol_5ffprintf_3',['tcol_fprintf',['../termcolor_8c.html#a22c2d3666092d1f4ec58c27e06b96406',1,'tcol_fprintf(FILE *stream, const char *fmt,...): termcolor.c'],['../termcolor_8h.html#a22c2d3666092d1f4ec58c27e06b96406',1,'tcol_fprintf(FILE *stream, const char *fmt,...): termcolor.c']]], - ['tcol_5foverride_5fcolor_5fchecks_4',['tcol_override_color_checks',['../termcolor_8c.html#a45276491c40829998caacbdae38e9ab4',1,'tcol_override_color_checks(bool enable_color): termcolor.c'],['../termcolor_8h.html#a45276491c40829998caacbdae38e9ab4',1,'tcol_override_color_checks(bool enable_color): termcolor.c']]], - ['tcol_5fprintf_5',['tcol_printf',['../termcolor_8c.html#a3904600e47ea1b5e9b5190813e771726',1,'tcol_printf(const char *fmt,...): termcolor.c'],['../termcolor_8h.html#a3904600e47ea1b5e9b5190813e771726',1,'tcol_printf(const char *fmt,...): termcolor.c']]], - ['tcol_5fsnprintf_6',['tcol_snprintf',['../termcolor_8c.html#a5d7c664db8584c4396bd5bb6c46939b7',1,'tcol_snprintf(char *stream, size_t N, const char *fmt,...): termcolor.c'],['../termcolor_8h.html#a04f7ab41736b98fbba6b28c76f0d36f6',1,'tcol_snprintf(char *buffer, size_t N, const char *fmt,...): termcolor.c']]], - ['tcol_5fvfprintf_7',['tcol_vfprintf',['../termcolor_8c.html#abceb3cf9bcb5a4958f611458b711e996',1,'termcolor.c']]], - ['tcol_5fvsnprintf_8',['tcol_vsnprintf',['../termcolor_8c.html#a3328b083df29d219389ca7c1cffb7289',1,'termcolor.c']]], - ['text_5fadd_9',['text_add',['../text_8c.html#a12e169fc9d93563391f9946efe86a380',1,'text_add(GwText *text, const char *str): text.c'],['../gwion__text_8h.html#a9cdc47b67c84e2a87c5908c3074c41a5',1,'text_add(GwText *, const char *): text.c']]], - ['text_5fgrow_10',['text_grow',['../text_8c.html#a6676f1e3cf8449a4aa756c029ac9a053',1,'text.c']]], - ['text_5finit_11',['text_init',['../gwion__text_8h.html#a06a5be3f975a55f3f1a0c96b9a78454c',1,'gwion_text.h']]], - ['text_5frelease_12',['text_release',['../gwion__text_8h.html#a8f885a2b609315784a1ca023e403bd43',1,'gwion_text.h']]], - ['text_5freset_13',['text_reset',['../gwion__text_8h.html#a0ee05644261d6721da77d6e82d377153',1,'gwion_text.h']]], - ['threadpool_5fadd_14',['threadpool_add',['../threadpool_8c.html#a1d4ac1614d1076b3f64a161ec8a2d1d5',1,'threadpool.c']]], - ['threadpool_5fthread_15',['threadpool_thread',['../threadpool_8c.html#a6366ee00becf3487b07ed88fccff7f43',1,'threadpool.c']]] + ['tcol_5fhas_5fcolor_4',['tcol_has_color',['../termcolor_8c.html#aaacfae8f2f863c6e5536f276eec1ce79',1,'tcol_has_color(void): termcolor.c'],['../termcolor_8h.html#aaacfae8f2f863c6e5536f276eec1ce79',1,'tcol_has_color(void): termcolor.c']]], + ['tcol_5foverride_5fcolor_5fchecks_5',['tcol_override_color_checks',['../termcolor_8c.html#a45276491c40829998caacbdae38e9ab4',1,'tcol_override_color_checks(bool enable_color): termcolor.c'],['../termcolor_8h.html#a45276491c40829998caacbdae38e9ab4',1,'tcol_override_color_checks(bool enable_color): termcolor.c']]], + ['tcol_5fprintf_6',['tcol_printf',['../termcolor_8c.html#a3904600e47ea1b5e9b5190813e771726',1,'tcol_printf(const char *fmt,...): termcolor.c'],['../termcolor_8h.html#a3904600e47ea1b5e9b5190813e771726',1,'tcol_printf(const char *fmt,...): termcolor.c']]], + ['tcol_5fsnprintf_7',['tcol_snprintf',['../termcolor_8c.html#a5d7c664db8584c4396bd5bb6c46939b7',1,'tcol_snprintf(char *stream, size_t N, const char *fmt,...): termcolor.c'],['../termcolor_8h.html#a04f7ab41736b98fbba6b28c76f0d36f6',1,'tcol_snprintf(char *buffer, size_t N, const char *fmt,...): termcolor.c']]], + ['tcol_5fvfprintf_8',['tcol_vfprintf',['../termcolor_8c.html#abceb3cf9bcb5a4958f611458b711e996',1,'termcolor.c']]], + ['tcol_5fvsnprintf_9',['tcol_vsnprintf',['../termcolor_8c.html#a3328b083df29d219389ca7c1cffb7289',1,'termcolor.c']]], + ['text_5fadd_10',['text_add',['../text_8c.html#a12e169fc9d93563391f9946efe86a380',1,'text_add(GwText *text, const char *str): text.c'],['../gwion__text_8h.html#a9cdc47b67c84e2a87c5908c3074c41a5',1,'text_add(GwText *, const char *): text.c']]], + ['text_5fgrow_11',['text_grow',['../text_8c.html#a6676f1e3cf8449a4aa756c029ac9a053',1,'text.c']]], + ['text_5finit_12',['text_init',['../gwion__text_8h.html#a06a5be3f975a55f3f1a0c96b9a78454c',1,'gwion_text.h']]], + ['text_5frelease_13',['text_release',['../gwion__text_8h.html#a8f885a2b609315784a1ca023e403bd43',1,'gwion_text.h']]], + ['text_5freset_14',['text_reset',['../gwion__text_8h.html#a0ee05644261d6721da77d6e82d377153',1,'gwion_text.h']]], + ['threadpool_5fadd_15',['threadpool_add',['../threadpool_8c.html#a1d4ac1614d1076b3f64a161ec8a2d1d5',1,'threadpool.c']]], + ['threadpool_5fthread_16',['threadpool_thread',['../threadpool_8c.html#a6366ee00becf3487b07ed88fccff7f43',1,'threadpool.c']]] ]; diff --git a/search/variables_9.js b/search/variables_9.js index d11008d..2acd858 100644 --- a/search/variables_9.js +++ b/search/variables_9.js @@ -2,6 +2,6 @@ var searchData= [ ['map_0',['map',['../structScope__.html#aa3e251b77360860c8454fdc9e9692926',1,'Scope_']]], ['master_5fpool_1',['master_pool',['../structMemPool__.html#a9bbb7dc5f44f5497a8604479bb73273b',1,'MemPool_']]], - ['mp_2',['mp',['../structArgSplitter.html#a5143eb2485df5c7c28dc7d0bee8a5468',1,'ArgSplitter::mp'],['../structGwText__.html#ab898b542618ba8f288ff5f83e5a03c57',1,'GwText_::mp']]], + ['mp_2',['mp',['../structGwText__.html#ab898b542618ba8f288ff5f83e5a03c57',1,'GwText_']]], ['mutex_3',['mutex',['../structpool.html#ad2629bb0437d0b069fd8f6aeb4971f00',1,'pool::mutex'],['../structSymTable__.html#ad62dede8061bce852252f4763c44a7f4',1,'SymTable_::mutex']]] ]; diff --git a/structArgSplitter.html b/structArgSplitter.html index 30fe38d..490475d 100644 --- a/structArgSplitter.html +++ b/structArgSplitter.html @@ -87,30 +87,12 @@   Vector v   -MemPool mp

              Detailed Description

              used internally to split arguments

              Definition at line 16 of file carg.c.

              Field Documentation

              - -

              ◆ mp

              - -
              -
              - - - - -
              MemPool ArgSplitter::mp
              -
              - -

              Definition at line 19 of file carg.c.

              - -
              -

              ◆ str

              diff --git a/termcolor_8c.html b/termcolor_8c.html index 9a822d5..9208f54 100644 --- a/termcolor_8c.html +++ b/termcolor_8c.html @@ -114,6 +114,8 @@ Functions

const char * tcol_errorstr (const enum term_color_error_t err)   +bool tcol_has_color (void) +  void tcol_override_color_checks (bool enable_color)   int _termcolor_internal_lookup (const char color_name) @@ -186,21 +188,21 @@

_termcolor_internal_color_ITLC  -

Definition at line 63 of file termcolor.c.

-
63 {
- - - - - - -
70};
-
@ _termcolor_internal_color_FANT
Definition termcolor.c:65
-
@ _termcolor_internal_color_BOLD
Definition termcolor.c:64
-
@ _termcolor_internal_color_UNDR
Definition termcolor.c:66
-
@ _termcolor_internal_color_STRK
Definition termcolor.c:68
-
@ _termcolor_internal_color_BLNK
Definition termcolor.c:67
-
@ _termcolor_internal_color_ITLC
Definition termcolor.c:69
+

Definition at line 67 of file termcolor.c.

+
67 {
+ + + + + + +
74};
+
@ _termcolor_internal_color_FANT
Definition termcolor.c:69
+
@ _termcolor_internal_color_BOLD
Definition termcolor.c:68
+
@ _termcolor_internal_color_UNDR
Definition termcolor.c:70
+
@ _termcolor_internal_color_STRK
Definition termcolor.c:72
+
@ _termcolor_internal_color_BLNK
Definition termcolor.c:71
+
@ _termcolor_internal_color_ITLC
Definition termcolor.c:73
@@ -244,71 +246,71 @@

-

Definition at line 72 of file termcolor.c.

-
73 {
-
74 /* Much of the code here was informed by the following gist:
-
75 https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797 */
-
76
-
77 size_t j = 0;
-
78
-
79 /* This macro checks to make sure we don't overrun the buffer when we add
-
80 a new character, */
-
81 #define __APPEND(c) do { \
-
82 dst[j++] = (c); \
-
83 if (j >= dstn) return TermColorErrorNone; \
-
84 } while (0)
-
85
-
86 /* Every escape code begins with "\e[" */
-
87 __APPEND('\033');
-
88 __APPEND('[');
+

Definition at line 76 of file termcolor.c.

+
77 {
+
78 /* Much of the code here was informed by the following gist:
+
79 https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797 */
+
80
+
81 size_t j = 0;
+
82
+
83 /* This macro checks to make sure we don't overrun the buffer when we add
+
84 a new character, */
+
85 #define __APPEND(c) do { \
+
86 dst[j++] = (c); \
+
87 if (j >= dstn) return TermColorErrorNone; \
+
88 } while (0)
89
-
90 /* Add the appropriate parameters to our escape sequence depending on the
-
91 flags set in rep(resentation). */
- -
93 __APPEND('1');
-
94 __APPEND(';');
-
95 }
- -
97 __APPEND('2');
+
90 /* Every escape code begins with "\e[" */
+
91 __APPEND('\033');
+
92 __APPEND('[');
+
93
+
94 /* Add the appropriate parameters to our escape sequence depending on the
+
95 flags set in rep(resentation). */
+ +
97 __APPEND('1');
98 __APPEND(';');
99 }
- -
101 __APPEND('3');
+ +
101 __APPEND('2');
102 __APPEND(';');
103 }
- -
105 __APPEND('4');
+ +
105 __APPEND('3');
106 __APPEND(';');
107 }
- -
109 __APPEND('5');
+ +
109 __APPEND('4');
110 __APPEND(';');
111 }
- -
113 __APPEND('9');
+ +
113 __APPEND('5');
114 __APPEND(';');
115 }
-
116
-
117 /* If foreground and background colors were provided, snprintf them to dst. */
-
118 if (foreground != -1) {
-
119 j += snprintf(dst + j, dstn - j, "%d;", foreground);
-
120 if (j >= dstn) return TermColorErrorNone;
-
121 }
-
122 if (background != -1) {
-
123 j += snprintf(dst + j, dstn - j, "%d;", background + 10);
+ +
117 __APPEND('9');
+
118 __APPEND(';');
+
119 }
+
120
+
121 /* If foreground and background colors were provided, snprintf them to dst. */
+
122 if (foreground != -1) {
+
123 j += snprintf(dst + j, dstn - j, "%d;", foreground);
124 if (j >= dstn) return TermColorErrorNone;
125 }
-
126
-
127 if (dst[j - 1] == ';') {
-
128 j--;
+
126 if (background != -1) {
+
127 j += snprintf(dst + j, dstn - j, "%d;", background + 10);
+
128 if (j >= dstn) return TermColorErrorNone;
129 }
130
-
131 /* Graphics mode escape sequences end with 'm' */
-
132 __APPEND('m');
-
133
-
134 *len = j;
-
135 return TermColorErrorNone;
-
136}
+
131 if (dst[j - 1] == ';') {
+
132 j--;
+
133 }
+
134
+
135 /* Graphics mode escape sequences end with 'm' */
+
136 __APPEND('m');
+
137
+
138 *len = j;
+
139 return TermColorErrorNone;
+
140}
#define __APPEND(c)
@@ -328,29 +330,29 @@

-

Definition at line 40 of file termcolor.c.

-
40 {
-
41 switch (color_name) {
-
42 case 'N':
-
43 return 30;
-
44 case 'R':
-
45 return 31;
-
46 case 'G':
-
47 return 32;
-
48 case 'Y':
-
49 return 33;
-
50 case 'B':
-
51 return 34;
-
52 case 'M':
-
53 return 35;
-
54 case 'C':
-
55 return 36;
-
56 case 'W':
-
57 return 37;
-
58 default:
-
59 return -1;
-
60 }
-
61}
+

Definition at line 44 of file termcolor.c.

+
44 {
+
45 switch (color_name) {
+
46 case 'N':
+
47 return 30;
+
48 case 'R':
+
49 return 31;
+
50 case 'G':
+
51 return 32;
+
52 case 'Y':
+
53 return 33;
+
54 case 'B':
+
55 return 34;
+
56 case 'M':
+
57 return 35;
+
58 case 'C':
+
59 return 36;
+
60 case 'W':
+
61 return 37;
+
62 default:
+
63 return -1;
+
64 }
+
65}
@@ -388,86 +390,86 @@

-

Definition at line 138 of file termcolor.c.

-
139 {
-
140 if (!use_color) {
-
141 *len = 0;
-
142 return TermColorErrorNone;
-
143 }
-
144
-
145 /* '0' signifies no color, i.e. a reset */
-
146 if (k == 1 && *color == '0') {
-
147 size_t j = 0;
-
148 __APPEND('\033');
-
149 __APPEND('[');
-
150 __APPEND('m');
-
151 *len = j;
-
152 return TermColorErrorNone;
-
153 }
-
154
-
155 /* As -1 they are ignored. Otherwise they are set to the foreground color
-
156 code. The backround code is later added 10 to. */
-
157 int foreground = -1;
-
158 int background = -1;
-
159
-
160 enum _termcolor_internal_color rep = 0;
-
161 size_t i;
-
162 for (i = 0; i < k; i++) {
-
163 switch (color[i]) {
-
164 /* Farily straightforward; just sets the flags corresponding to the
-
165 color attributes. */
-
166 case '+':
- -
168 break;
-
169 case '-':
- -
171 break;
-
172 case '_':
- -
174 break;
-
175 case '*':
- -
177 break;
-
178 case '~':
- -
180 break;
-
181 case '/':
- -
183 break;
-
184
-
185 /* Here we take the character after the ',' and use that as our
-
186 background color code, like Nano does. */
-
187 case ',': {
-
188 if (i + 1 >= k) {
- -
190 }
-
191 const int result = _termcolor_internal_lookup(color[i + 1]);
-
192 if (result == -1) {
+

Definition at line 142 of file termcolor.c.

+
143 {
+
144 if (!use_color) {
+
145 *len = 0;
+
146 return TermColorErrorNone;
+
147 }
+
148
+
149 /* '0' signifies no color, i.e. a reset */
+
150 if (k == 1 && *color == '0') {
+
151 size_t j = 0;
+
152 __APPEND('\033');
+
153 __APPEND('[');
+
154 __APPEND('m');
+
155 *len = j;
+
156 return TermColorErrorNone;
+
157 }
+
158
+
159 /* As -1 they are ignored. Otherwise they are set to the foreground color
+
160 code. The backround code is later added 10 to. */
+
161 int foreground = -1;
+
162 int background = -1;
+
163
+
164 enum _termcolor_internal_color rep = 0;
+
165 size_t i;
+
166 for (i = 0; i < k; i++) {
+
167 switch (color[i]) {
+
168 /* Farily straightforward; just sets the flags corresponding to the
+
169 color attributes. */
+
170 case '+':
+ +
172 break;
+
173 case '-':
+ +
175 break;
+
176 case '_':
+ +
178 break;
+
179 case '*':
+ +
181 break;
+
182 case '~':
+ +
184 break;
+
185 case '/':
+ +
187 break;
+
188
+
189 /* Here we take the character after the ',' and use that as our
+
190 background color code, like Nano does. */
+
191 case ',': {
+
192 if (i + 1 >= k) {
194 }
-
195 background = result;
-
196 i++;
-
197 break;
-
198 }
-
199 default: {
-
200 /* If we haven't matched anything, we assume its a foreground
-
201 color. Make sure it is and error if not. */
-
202 const int result = _termcolor_internal_lookup(color[i]);
-
203 if (result != -1) {
-
204 foreground = result;
-
205 break;
-
206 }
- -
208 }
-
209 }
-
210 }
-
211
-
212 return _tcol_color_generate(dst, dstn, len, rep, foreground, background);
-
213}
-
int _tcol_color_generate(char *dst, size_t dstn, size_t *len, int rep, int foreground, int background)
Definition termcolor.c:72
-
_termcolor_internal_color
Definition termcolor.c:63
+
195 const int result = _termcolor_internal_lookup(color[i + 1]);
+
196 if (result == -1) {
+ +
198 }
+
199 background = result;
+
200 i++;
+
201 break;
+
202 }
+
203 default: {
+
204 /* If we haven't matched anything, we assume its a foreground
+
205 color. Make sure it is and error if not. */
+
206 const int result = _termcolor_internal_lookup(color[i]);
+
207 if (result != -1) {
+
208 foreground = result;
+
209 break;
+
210 }
+ +
212 }
+
213 }
+
214 }
+
215
+
216 return _tcol_color_generate(dst, dstn, len, rep, foreground, background);
+
217}
+
int _tcol_color_generate(char *dst, size_t dstn, size_t *len, int rep, int foreground, int background)
Definition termcolor.c:76
+
_termcolor_internal_color
Definition termcolor.c:67
static bool use_color
Definition termcolor.c:22
-
int _termcolor_internal_lookup(const char color_name)
Definition termcolor.c:40
+
int _termcolor_internal_lookup(const char color_name)
Definition termcolor.c:44
@ TermColorErrorInvalidColor
Definition termcolor.h:42
@@ -540,79 +542,79 @@

-

Definition at line 215 of file termcolor.c.

-
216 {
-
217 /* Variables:
-
218 i = index in source
-
219 j = index in destination
-
220
-
221 1. We loop throughout the source until we reach the end or until we
-
222 cannot write into dst anymore. */
-
223 if (dstn == 0) {
-
224 return TermColorErrorNone;
-
225 }
-
226 size_t j = 0, i;
-
227 dstn--;
-
228 for (i = 0; i < srcn && j < dstn; i++) {
-
229 loop_top:
-
230 /* 2. We check if the current character is '{'. */
-
231 if (src[i] == '{') {
-
232 /* 3.B. If it is, we make sure it's not escaped with "{{". */
-
233 if (i + 1 < srcn && src[i + 1] == '{') {
-
234 i++;
-
235 dst[j++] = '{';
-
236 } else {
-
237 i++;
-
238
-
239 /* 4. If not escape, we obtain the color and parse it. */
-
240 char color[16];
-
241 int k = 0;
-
242 while (i < srcn && src[i] != '}') {
-
243 /* Allow spaces in the color */
-
244 if (src[i] == ' ') {
-
245 i++;
-
246 if (src[i] == '}') {
-
247 i++;
-
248 /* If the color is all spaces, ignore it. */
-
249 goto loop_top;
-
250 }
-
251 continue;
-
252 }
-
253
-
254 /* Copy over the contents of the source to the color buffer. */
-
255 color[k++] = src[i++];
-
256
-
257 /* Make sure no bounds are overrun. */
-
258 if (k > 16) {
- -
260 }
-
261 }
-
262
-
263 /* Confirm we ended on a right bracket */
-
264 if (src[i] != '}') {
- -
266 }
-
267
-
268 /* Create the escape sequence. */
-
269 size_t len = 0;
-
270 int status = tcol_color_parse(dst + j, dstn - j, color, k,
-
271 &len);
-
272 if (status != TermColorErrorNone) {
-
273 return status;
-
274 }
-
275 j += len;
-
276 }
-
277 } else {
-
278 /* 3.A. If not, just write the character to the destination to
-
279 copy verbatim. */
-
280 dst[j++] = src[i];
-
281 }
-
282 }
-
283 dst[dstn] = 0;
-
284 dst[j] = 0;
-
285 return TermColorErrorNone;
-
286}
-
int tcol_color_parse(char *dst, size_t dstn, char color[16], size_t k, size_t *len)
Definition termcolor.c:138
+

Definition at line 219 of file termcolor.c.

+
220 {
+
221 /* Variables:
+
222 i = index in source
+
223 j = index in destination
+
224
+
225 1. We loop throughout the source until we reach the end or until we
+
226 cannot write into dst anymore. */
+
227 if (dstn == 0) {
+
228 return TermColorErrorNone;
+
229 }
+
230 size_t j = 0, i;
+
231 dstn--;
+
232 for (i = 0; i < srcn && j < dstn; i++) {
+
233 loop_top:
+
234 /* 2. We check if the current character is '{'. */
+
235 if (src[i] == '{') {
+
236 /* 3.B. If it is, we make sure it's not escaped with "{{". */
+
237 if (i + 1 < srcn && src[i + 1] == '{') {
+
238 i++;
+
239 dst[j++] = '{';
+
240 } else {
+
241 i++;
+
242
+
243 /* 4. If not escape, we obtain the color and parse it. */
+
244 char color[16];
+
245 int k = 0;
+
246 while (i < srcn && src[i] != '}') {
+
247 /* Allow spaces in the color */
+
248 if (src[i] == ' ') {
+
249 i++;
+
250 if (src[i] == '}') {
+
251 i++;
+
252 /* If the color is all spaces, ignore it. */
+
253 goto loop_top;
+
254 }
+
255 continue;
+
256 }
+
257
+
258 /* Copy over the contents of the source to the color buffer. */
+
259 color[k++] = src[i++];
+
260
+
261 /* Make sure no bounds are overrun. */
+
262 if (k > 16) {
+ +
264 }
+
265 }
+
266
+
267 /* Confirm we ended on a right bracket */
+
268 if (src[i] != '}') {
+ +
270 }
+
271
+
272 /* Create the escape sequence. */
+
273 size_t len = 0;
+
274 int status = tcol_color_parse(dst + j, dstn - j, color, k,
+
275 &len);
+
276 if (status != TermColorErrorNone) {
+
277 return status;
+
278 }
+
279 j += len;
+
280 }
+
281 } else {
+
282 /* 3.A. If not, just write the character to the destination to
+
283 copy verbatim. */
+
284 dst[j++] = src[i];
+
285 }
+
286 }
+
287 dst[dstn] = 0;
+
288 dst[j] = 0;
+
289 return TermColorErrorNone;
+
290}
+
int tcol_color_parse(char *dst, size_t dstn, char color[16], size_t k, size_t *len)
Definition termcolor.c:142
@ TermColorErrorUnterminatedColor
Definition termcolor.h:43
@@ -641,16 +643,38 @@

-

Definition at line 361 of file termcolor.c.

-
361 {
-
362 va_list ap;
-
363 va_start(ap, fmt);
-
364 const int status = tcol_vfprintf(stream, fmt, ap);
-
365 va_end(ap);
-
366 return status;
-
367}
+

Definition at line 365 of file termcolor.c.

+
365 {
+
366 va_list ap;
+
367 va_start(ap, fmt);
+
368 const int status = tcol_vfprintf(stream, fmt, ap);
+
369 va_end(ap);
+
370 return status;
+
371}
char const char * fmt
Definition gwion_print.h:2
-
static int tcol_vfprintf(FILE *stream, const char *fmt, va_list ap)
Definition termcolor.c:320
+
static int tcol_vfprintf(FILE *stream, const char *fmt, va_list ap)
Definition termcolor.c:324
+
+
+ + +

◆ tcol_has_color()

+ +
+
+ + + + + + + +
bool tcol_has_color (void )
+
+ +

Definition at line 36 of file termcolor.c.

+
36 {
+
37 return use_color;
+
38}
@@ -669,10 +693,10 @@

-

Definition at line 36 of file termcolor.c.

-
36 {
-
37 use_color = enable_color;
-
38}
+

Definition at line 40 of file termcolor.c.

+
40 {
+
41 use_color = enable_color;
+
42}
@@ -695,14 +719,14 @@

-

Definition at line 369 of file termcolor.c.

-
369 {
-
370 va_list ap;
-
371 va_start(ap, fmt);
-
372 const int status = tcol_vfprintf(stdout, fmt, ap);
-
373 va_end(ap);
-
374 return status;
-
375}
+

Definition at line 373 of file termcolor.c.

+
373 {
+
374 va_list ap;
+
375 va_start(ap, fmt);
+
376 const int status = tcol_vfprintf(stdout, fmt, ap);
+
377 va_end(ap);
+
378 return status;
+
379}
@@ -735,15 +759,15 @@

-

Definition at line 378 of file termcolor.c.

-
378 {
-
379 va_list ap;
-
380 va_start(ap, fmt);
-
381 const int status = tcol_vsnprintf(stream, N, fmt, ap);
-
382 va_end(ap);
-
383 return status;
-
384}
-
static int tcol_vsnprintf(char *stream, size_t N, const char *fmt, va_list ap)
Definition termcolor.c:288
+

Definition at line 382 of file termcolor.c.

+
382 {
+
383 va_list ap;
+
384 va_start(ap, fmt);
+
385 const int status = tcol_vsnprintf(stream, N, fmt, ap);
+
386 va_end(ap);
+
387 return status;
+
388}
+
static int tcol_vsnprintf(char *stream, size_t N, const char *fmt, va_list ap)
Definition termcolor.c:292
@@ -779,46 +803,46 @@

-

Definition at line 320 of file termcolor.c.

-
320 {
-
321 /* Gets the length of the format string and calculates a length for the new
-
322 format string to be created. */
-
323 const size_t l = strlen(fmt);
-
324 const size_t n = l * 2 + 16;
-
325
-
326 /* Allocates and produces the new format string. */
-
327 char *buffer = malloc(n);
-
328 if (buffer == NULL) {
- -
330 }
-
331 const int status = tcol_fmt_parse(buffer, n, fmt, l);
-
332 if (status != TermColorErrorNone) {
-
333 free(buffer);
-
334 return status;
-
335 }
-
336 #ifdef TERMCOLOR_OS_WIN
-
337 HANDLE output = GetStdHandle(STD_OUTPUT_HANDLE); /* Console Output */
-
338 DWORD mode;
-
339 GetConsoleMode(output, &mode);
-
340 mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; /* Process ANSI Escape */
-
341 mode |= ENABLE_PROCESSED_OUTPUT; /* Process ASCII Escape */
-
342 WINBOOL set = !SetConsoleMode(output, mode);
-
343 if (set) { /* If we could not set the console mode, we cannot print it */
- -
345 }
-
346 #endif
-
347 /* Perform the printf itself. */
-
348 if (vfprintf(stream, buffer, ap) < 0) {
-
349 free(buffer);
- -
351 }
-
352
-
353 /* Cleanup resources. */
-
354 free(buffer);
-
355
-
356 return TermColorErrorNone;
-
357}
-
static int tcol_fmt_parse(char *dst, size_t dstn, const char *src, size_t srcn)
Definition termcolor.c:215
+

Definition at line 324 of file termcolor.c.

+
324 {
+
325 /* Gets the length of the format string and calculates a length for the new
+
326 format string to be created. */
+
327 const size_t l = strlen(fmt);
+
328 const size_t n = l * 2 + 16;
+
329
+
330 /* Allocates and produces the new format string. */
+
331 char *buffer = malloc(n);
+
332 if (buffer == NULL) {
+ +
334 }
+
335 const int status = tcol_fmt_parse(buffer, n, fmt, l);
+
336 if (status != TermColorErrorNone) {
+
337 free(buffer);
+
338 return status;
+
339 }
+
340 #ifdef TERMCOLOR_OS_WIN
+
341 HANDLE output = GetStdHandle(STD_OUTPUT_HANDLE); /* Console Output */
+
342 DWORD mode;
+
343 GetConsoleMode(output, &mode);
+
344 mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; /* Process ANSI Escape */
+
345 mode |= ENABLE_PROCESSED_OUTPUT; /* Process ASCII Escape */
+
346 WINBOOL set = !SetConsoleMode(output, mode);
+
347 if (set) { /* If we could not set the console mode, we cannot print it */
+ +
349 }
+
350 #endif
+
351 /* Perform the printf itself. */
+
352 if (vfprintf(stream, buffer, ap) < 0) {
+
353 free(buffer);
+ +
355 }
+
356
+
357 /* Cleanup resources. */
+
358 free(buffer);
+
359
+
360 return TermColorErrorNone;
+
361}
+
static int tcol_fmt_parse(char *dst, size_t dstn, const char *src, size_t srcn)
Definition termcolor.c:219
@ TermColorErrorAllocationFailed
Definition termcolor.h:40
@ TermColorErrorPrintingFailed
Definition termcolor.h:41
@@ -861,35 +885,35 @@

-

Definition at line 288 of file termcolor.c.

-
289 {
-
290 /* Gets the length of the format string and calculates a length for the new
-
291 format string to be created. */
-
292 const size_t l = strlen(fmt);
-
293 const size_t n = l * 2 + 16;
-
294
-
295 /* Allocates and produces the new format string. */
-
296 char *buffer = malloc(n);
-
297 if (buffer == NULL) {
- -
299 }
-
300 const int status = tcol_fmt_parse(buffer, n, fmt, l);
-
301 if (status != TermColorErrorNone) {
-
302 free(buffer);
-
303 return status;
-
304 }
-
305
-
306 /* Perform the snprintf itself. */
-
307 if (vsnprintf(stream, N, buffer, ap) < 0) {
-
308 free(buffer);
- -
310 }
-
311
-
312 /* Cleanup resources. */
-
313 free(buffer);
-
314
-
315 return TermColorErrorNone;
-
316}
+

Definition at line 292 of file termcolor.c.

+
293 {
+
294 /* Gets the length of the format string and calculates a length for the new
+
295 format string to be created. */
+
296 const size_t l = strlen(fmt);
+
297 const size_t n = l * 2 + 16;
+
298
+
299 /* Allocates and produces the new format string. */
+
300 char *buffer = malloc(n);
+
301 if (buffer == NULL) {
+ +
303 }
+
304 const int status = tcol_fmt_parse(buffer, n, fmt, l);
+
305 if (status != TermColorErrorNone) {
+
306 free(buffer);
+
307 return status;
+
308 }
+
309
+
310 /* Perform the snprintf itself. */
+
311 if (vsnprintf(stream, N, buffer, ap) < 0) {
+
312 free(buffer);
+ +
314 }
+
315
+
316 /* Cleanup resources. */
+
317 free(buffer);
+
318
+
319 return TermColorErrorNone;
+
320}

diff --git a/termcolor_8c_source.html b/termcolor_8c_source.html index bfcb9e7..5c0d300 100644 --- a/termcolor_8c_source.html +++ b/termcolor_8c_source.html @@ -124,398 +124,405 @@
35
-
36void tcol_override_color_checks(bool enable_color) {
-
37 use_color = enable_color;
+
36bool tcol_has_color(void) {
+
37 return use_color;
38}
39
-
40int _termcolor_internal_lookup(const char color_name) {
-
41 switch (color_name) {
-
42 case 'N':
-
43 return 30;
-
44 case 'R':
-
45 return 31;
-
46 case 'G':
-
47 return 32;
-
48 case 'Y':
-
49 return 33;
-
50 case 'B':
-
51 return 34;
-
52 case 'M':
-
53 return 35;
-
54 case 'C':
-
55 return 36;
-
56 case 'W':
-
57 return 37;
-
58 default:
-
59 return -1;
-
60 }
-
61}
+
40void tcol_override_color_checks(bool enable_color) {
+
41 use_color = enable_color;
+
42}
-
62
-
- - - - - - - -
70};
+
43
+
+
44int _termcolor_internal_lookup(const char color_name) {
+
45 switch (color_name) {
+
46 case 'N':
+
47 return 30;
+
48 case 'R':
+
49 return 31;
+
50 case 'G':
+
51 return 32;
+
52 case 'Y':
+
53 return 33;
+
54 case 'B':
+
55 return 34;
+
56 case 'M':
+
57 return 35;
+
58 case 'C':
+
59 return 36;
+
60 case 'W':
+
61 return 37;
+
62 default:
+
63 return -1;
+
64 }
+
65}
-
71
-
-
72int _tcol_color_generate(char *dst, size_t dstn, size_t *len, int rep,
-
73 int foreground, int background) {
-
74 /* Much of the code here was informed by the following gist:
-
75 https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797 */
-
76
-
77 size_t j = 0;
-
78
-
79 /* This macro checks to make sure we don't overrun the buffer when we add
-
80 a new character, */
-
81 #define __APPEND(c) do { \
-
82 dst[j++] = (c); \
-
83 if (j >= dstn) return TermColorErrorNone; \
-
84 } while (0)
-
85
-
86 /* Every escape code begins with "\e[" */
-
87 __APPEND('\033');
-
88 __APPEND('[');
+
66
+ +
75
+
+
76int _tcol_color_generate(char *dst, size_t dstn, size_t *len, int rep,
+
77 int foreground, int background) {
+
78 /* Much of the code here was informed by the following gist:
+
79 https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797 */
+
80
+
81 size_t j = 0;
+
82
+
83 /* This macro checks to make sure we don't overrun the buffer when we add
+
84 a new character, */
+
85 #define __APPEND(c) do { \
+
86 dst[j++] = (c); \
+
87 if (j >= dstn) return TermColorErrorNone; \
+
88 } while (0)
89
-
90 /* Add the appropriate parameters to our escape sequence depending on the
-
91 flags set in rep(resentation). */
- -
93 __APPEND('1');
-
94 __APPEND(';');
-
95 }
- -
97 __APPEND('2');
+
90 /* Every escape code begins with "\e[" */
+
91 __APPEND('\033');
+
92 __APPEND('[');
+
93
+
94 /* Add the appropriate parameters to our escape sequence depending on the
+
95 flags set in rep(resentation). */
+ +
97 __APPEND('1');
98 __APPEND(';');
99 }
- -
101 __APPEND('3');
+ +
101 __APPEND('2');
102 __APPEND(';');
103 }
- -
105 __APPEND('4');
+ +
105 __APPEND('3');
106 __APPEND(';');
107 }
- -
109 __APPEND('5');
+ +
109 __APPEND('4');
110 __APPEND(';');
111 }
- -
113 __APPEND('9');
+ +
113 __APPEND('5');
114 __APPEND(';');
115 }
-
116
-
117 /* If foreground and background colors were provided, snprintf them to dst. */
-
118 if (foreground != -1) {
-
119 j += snprintf(dst + j, dstn - j, "%d;", foreground);
-
120 if (j >= dstn) return TermColorErrorNone;
-
121 }
-
122 if (background != -1) {
-
123 j += snprintf(dst + j, dstn - j, "%d;", background + 10);
+ +
117 __APPEND('9');
+
118 __APPEND(';');
+
119 }
+
120
+
121 /* If foreground and background colors were provided, snprintf them to dst. */
+
122 if (foreground != -1) {
+
123 j += snprintf(dst + j, dstn - j, "%d;", foreground);
124 if (j >= dstn) return TermColorErrorNone;
125 }
-
126
-
127 if (dst[j - 1] == ';') {
-
128 j--;
+
126 if (background != -1) {
+
127 j += snprintf(dst + j, dstn - j, "%d;", background + 10);
+
128 if (j >= dstn) return TermColorErrorNone;
129 }
130
-
131 /* Graphics mode escape sequences end with 'm' */
-
132 __APPEND('m');
-
133
-
134 *len = j;
-
135 return TermColorErrorNone;
-
136}
-
+
131 if (dst[j - 1] == ';') {
+
132 j--;
+
133 }
+
134
+
135 /* Graphics mode escape sequences end with 'm' */
+
136 __APPEND('m');
137
-
-
138int tcol_color_parse(char *dst, size_t dstn, char color[16], size_t k,
-
139 size_t *len) {
-
140 if (!use_color) {
-
141 *len = 0;
-
142 return TermColorErrorNone;
-
143 }
-
144
-
145 /* '0' signifies no color, i.e. a reset */
-
146 if (k == 1 && *color == '0') {
-
147 size_t j = 0;
-
148 __APPEND('\033');
-
149 __APPEND('[');
-
150 __APPEND('m');
-
151 *len = j;
-
152 return TermColorErrorNone;
-
153 }
-
154
-
155 /* As -1 they are ignored. Otherwise they are set to the foreground color
-
156 code. The backround code is later added 10 to. */
-
157 int foreground = -1;
-
158 int background = -1;
-
159
-
160 enum _termcolor_internal_color rep = 0;
-
161 size_t i;
-
162 for (i = 0; i < k; i++) {
-
163 switch (color[i]) {
-
164 /* Farily straightforward; just sets the flags corresponding to the
-
165 color attributes. */
-
166 case '+':
- -
168 break;
-
169 case '-':
- -
171 break;
-
172 case '_':
- -
174 break;
-
175 case '*':
- -
177 break;
-
178 case '~':
- -
180 break;
-
181 case '/':
- -
183 break;
-
184
-
185 /* Here we take the character after the ',' and use that as our
-
186 background color code, like Nano does. */
-
187 case ',': {
-
188 if (i + 1 >= k) {
- -
190 }
-
191 const int result = _termcolor_internal_lookup(color[i + 1]);
-
192 if (result == -1) {
+
138 *len = j;
+
139 return TermColorErrorNone;
+
140}
+
+
141
+
+
142int tcol_color_parse(char *dst, size_t dstn, char color[16], size_t k,
+
143 size_t *len) {
+
144 if (!use_color) {
+
145 *len = 0;
+
146 return TermColorErrorNone;
+
147 }
+
148
+
149 /* '0' signifies no color, i.e. a reset */
+
150 if (k == 1 && *color == '0') {
+
151 size_t j = 0;
+
152 __APPEND('\033');
+
153 __APPEND('[');
+
154 __APPEND('m');
+
155 *len = j;
+
156 return TermColorErrorNone;
+
157 }
+
158
+
159 /* As -1 they are ignored. Otherwise they are set to the foreground color
+
160 code. The backround code is later added 10 to. */
+
161 int foreground = -1;
+
162 int background = -1;
+
163
+
164 enum _termcolor_internal_color rep = 0;
+
165 size_t i;
+
166 for (i = 0; i < k; i++) {
+
167 switch (color[i]) {
+
168 /* Farily straightforward; just sets the flags corresponding to the
+
169 color attributes. */
+
170 case '+':
+ +
172 break;
+
173 case '-':
+ +
175 break;
+
176 case '_':
+ +
178 break;
+
179 case '*':
+ +
181 break;
+
182 case '~':
+ +
184 break;
+
185 case '/':
+ +
187 break;
+
188
+
189 /* Here we take the character after the ',' and use that as our
+
190 background color code, like Nano does. */
+
191 case ',': {
+
192 if (i + 1 >= k) {
194 }
-
195 background = result;
-
196 i++;
-
197 break;
-
198 }
-
199 default: {
-
200 /* If we haven't matched anything, we assume its a foreground
-
201 color. Make sure it is and error if not. */
-
202 const int result = _termcolor_internal_lookup(color[i]);
-
203 if (result != -1) {
-
204 foreground = result;
-
205 break;
-
206 }
- -
208 }
-
209 }
-
210 }
-
211
-
212 return _tcol_color_generate(dst, dstn, len, rep, foreground, background);
-
213}
+
195 const int result = _termcolor_internal_lookup(color[i + 1]);
+
196 if (result == -1) {
+ +
198 }
+
199 background = result;
+
200 i++;
+
201 break;
+
202 }
+
203 default: {
+
204 /* If we haven't matched anything, we assume its a foreground
+
205 color. Make sure it is and error if not. */
+
206 const int result = _termcolor_internal_lookup(color[i]);
+
207 if (result != -1) {
+
208 foreground = result;
+
209 break;
+
210 }
+ +
212 }
+
213 }
+
214 }
+
215
+
216 return _tcol_color_generate(dst, dstn, len, rep, foreground, background);
+
217}
-
214
-
-
215static inline int tcol_fmt_parse(char *dst, size_t dstn, const char *src,
-
216 size_t srcn) {
-
217 /* Variables:
-
218 i = index in source
-
219 j = index in destination
-
220
-
221 1. We loop throughout the source until we reach the end or until we
-
222 cannot write into dst anymore. */
-
223 if (dstn == 0) {
-
224 return TermColorErrorNone;
-
225 }
-
226 size_t j = 0, i;
-
227 dstn--;
-
228 for (i = 0; i < srcn && j < dstn; i++) {
-
229 loop_top:
-
230 /* 2. We check if the current character is '{'. */
-
231 if (src[i] == '{') {
-
232 /* 3.B. If it is, we make sure it's not escaped with "{{". */
-
233 if (i + 1 < srcn && src[i + 1] == '{') {
-
234 i++;
-
235 dst[j++] = '{';
-
236 } else {
-
237 i++;
-
238
-
239 /* 4. If not escape, we obtain the color and parse it. */
-
240 char color[16];
-
241 int k = 0;
-
242 while (i < srcn && src[i] != '}') {
-
243 /* Allow spaces in the color */
-
244 if (src[i] == ' ') {
-
245 i++;
-
246 if (src[i] == '}') {
-
247 i++;
-
248 /* If the color is all spaces, ignore it. */
-
249 goto loop_top;
-
250 }
-
251 continue;
-
252 }
-
253
-
254 /* Copy over the contents of the source to the color buffer. */
-
255 color[k++] = src[i++];
-
256
-
257 /* Make sure no bounds are overrun. */
-
258 if (k > 16) {
- -
260 }
-
261 }
-
262
-
263 /* Confirm we ended on a right bracket */
-
264 if (src[i] != '}') {
- -
266 }
-
267
-
268 /* Create the escape sequence. */
-
269 size_t len = 0;
-
270 int status = tcol_color_parse(dst + j, dstn - j, color, k,
-
271 &len);
-
272 if (status != TermColorErrorNone) {
-
273 return status;
-
274 }
-
275 j += len;
-
276 }
-
277 } else {
-
278 /* 3.A. If not, just write the character to the destination to
-
279 copy verbatim. */
-
280 dst[j++] = src[i];
-
281 }
-
282 }
-
283 dst[dstn] = 0;
-
284 dst[j] = 0;
-
285 return TermColorErrorNone;
-
286}
+
218
+
+
219static inline int tcol_fmt_parse(char *dst, size_t dstn, const char *src,
+
220 size_t srcn) {
+
221 /* Variables:
+
222 i = index in source
+
223 j = index in destination
+
224
+
225 1. We loop throughout the source until we reach the end or until we
+
226 cannot write into dst anymore. */
+
227 if (dstn == 0) {
+
228 return TermColorErrorNone;
+
229 }
+
230 size_t j = 0, i;
+
231 dstn--;
+
232 for (i = 0; i < srcn && j < dstn; i++) {
+
233 loop_top:
+
234 /* 2. We check if the current character is '{'. */
+
235 if (src[i] == '{') {
+
236 /* 3.B. If it is, we make sure it's not escaped with "{{". */
+
237 if (i + 1 < srcn && src[i + 1] == '{') {
+
238 i++;
+
239 dst[j++] = '{';
+
240 } else {
+
241 i++;
+
242
+
243 /* 4. If not escape, we obtain the color and parse it. */
+
244 char color[16];
+
245 int k = 0;
+
246 while (i < srcn && src[i] != '}') {
+
247 /* Allow spaces in the color */
+
248 if (src[i] == ' ') {
+
249 i++;
+
250 if (src[i] == '}') {
+
251 i++;
+
252 /* If the color is all spaces, ignore it. */
+
253 goto loop_top;
+
254 }
+
255 continue;
+
256 }
+
257
+
258 /* Copy over the contents of the source to the color buffer. */
+
259 color[k++] = src[i++];
+
260
+
261 /* Make sure no bounds are overrun. */
+
262 if (k > 16) {
+ +
264 }
+
265 }
+
266
+
267 /* Confirm we ended on a right bracket */
+
268 if (src[i] != '}') {
+ +
270 }
+
271
+
272 /* Create the escape sequence. */
+
273 size_t len = 0;
+
274 int status = tcol_color_parse(dst + j, dstn - j, color, k,
+
275 &len);
+
276 if (status != TermColorErrorNone) {
+
277 return status;
+
278 }
+
279 j += len;
+
280 }
+
281 } else {
+
282 /* 3.A. If not, just write the character to the destination to
+
283 copy verbatim. */
+
284 dst[j++] = src[i];
+
285 }
+
286 }
+
287 dst[dstn] = 0;
+
288 dst[j] = 0;
+
289 return TermColorErrorNone;
+
290}
-
287
-
-
288static inline int tcol_vsnprintf(char *stream, size_t N, const char *fmt,
-
289 va_list ap) {
-
290 /* Gets the length of the format string and calculates a length for the new
-
291 format string to be created. */
-
292 const size_t l = strlen(fmt);
-
293 const size_t n = l * 2 + 16;
-
294
-
295 /* Allocates and produces the new format string. */
-
296 char *buffer = malloc(n);
-
297 if (buffer == NULL) {
- -
299 }
-
300 const int status = tcol_fmt_parse(buffer, n, fmt, l);
-
301 if (status != TermColorErrorNone) {
-
302 free(buffer);
-
303 return status;
-
304 }
-
305
-
306 /* Perform the snprintf itself. */
-
307 if (vsnprintf(stream, N, buffer, ap) < 0) {
-
308 free(buffer);
- -
310 }
-
311
-
312 /* Cleanup resources. */
-
313 free(buffer);
-
314
-
315 return TermColorErrorNone;
-
316}
+
291
+
+
292static inline int tcol_vsnprintf(char *stream, size_t N, const char *fmt,
+
293 va_list ap) {
+
294 /* Gets the length of the format string and calculates a length for the new
+
295 format string to be created. */
+
296 const size_t l = strlen(fmt);
+
297 const size_t n = l * 2 + 16;
+
298
+
299 /* Allocates and produces the new format string. */
+
300 char *buffer = malloc(n);
+
301 if (buffer == NULL) {
+ +
303 }
+
304 const int status = tcol_fmt_parse(buffer, n, fmt, l);
+
305 if (status != TermColorErrorNone) {
+
306 free(buffer);
+
307 return status;
+
308 }
+
309
+
310 /* Perform the snprintf itself. */
+
311 if (vsnprintf(stream, N, buffer, ap) < 0) {
+
312 free(buffer);
+ +
314 }
+
315
+
316 /* Cleanup resources. */
+
317 free(buffer);
+
318
+
319 return TermColorErrorNone;
+
320}
-
317
-
318/* TODO: BAD! Remove this code duplication. */
-
319
-
-
320static inline int tcol_vfprintf(FILE *stream, const char *fmt, va_list ap) {
-
321 /* Gets the length of the format string and calculates a length for the new
-
322 format string to be created. */
-
323 const size_t l = strlen(fmt);
-
324 const size_t n = l * 2 + 16;
-
325
-
326 /* Allocates and produces the new format string. */
-
327 char *buffer = malloc(n);
-
328 if (buffer == NULL) {
- -
330 }
-
331 const int status = tcol_fmt_parse(buffer, n, fmt, l);
-
332 if (status != TermColorErrorNone) {
-
333 free(buffer);
-
334 return status;
-
335 }
-
336 #ifdef TERMCOLOR_OS_WIN
-
337 HANDLE output = GetStdHandle(STD_OUTPUT_HANDLE); /* Console Output */
-
338 DWORD mode;
-
339 GetConsoleMode(output, &mode);
-
340 mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; /* Process ANSI Escape */
-
341 mode |= ENABLE_PROCESSED_OUTPUT; /* Process ASCII Escape */
-
342 WINBOOL set = !SetConsoleMode(output, mode);
-
343 if (set) { /* If we could not set the console mode, we cannot print it */
- -
345 }
-
346 #endif
-
347 /* Perform the printf itself. */
-
348 if (vfprintf(stream, buffer, ap) < 0) {
-
349 free(buffer);
- -
351 }
-
352
-
353 /* Cleanup resources. */
-
354 free(buffer);
-
355
-
356 return TermColorErrorNone;
-
357}
+
321
+
322/* TODO: BAD! Remove this code duplication. */
+
323
+
+
324static inline int tcol_vfprintf(FILE *stream, const char *fmt, va_list ap) {
+
325 /* Gets the length of the format string and calculates a length for the new
+
326 format string to be created. */
+
327 const size_t l = strlen(fmt);
+
328 const size_t n = l * 2 + 16;
+
329
+
330 /* Allocates and produces the new format string. */
+
331 char *buffer = malloc(n);
+
332 if (buffer == NULL) {
+ +
334 }
+
335 const int status = tcol_fmt_parse(buffer, n, fmt, l);
+
336 if (status != TermColorErrorNone) {
+
337 free(buffer);
+
338 return status;
+
339 }
+
340 #ifdef TERMCOLOR_OS_WIN
+
341 HANDLE output = GetStdHandle(STD_OUTPUT_HANDLE); /* Console Output */
+
342 DWORD mode;
+
343 GetConsoleMode(output, &mode);
+
344 mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; /* Process ANSI Escape */
+
345 mode |= ENABLE_PROCESSED_OUTPUT; /* Process ASCII Escape */
+
346 WINBOOL set = !SetConsoleMode(output, mode);
+
347 if (set) { /* If we could not set the console mode, we cannot print it */
+ +
349 }
+
350 #endif
+
351 /* Perform the printf itself. */
+
352 if (vfprintf(stream, buffer, ap) < 0) {
+
353 free(buffer);
+ +
355 }
+
356
+
357 /* Cleanup resources. */
+
358 free(buffer);
+
359
+
360 return TermColorErrorNone;
+
361}
-
358
-
359/* These functions just create a variable argument list and call tcol_vfprintf
-
360 with the appropriate FILE* stream. */
-
-
361int tcol_fprintf(FILE *stream, const char *fmt, ...) {
-
362 va_list ap;
-
363 va_start(ap, fmt);
-
364 const int status = tcol_vfprintf(stream, fmt, ap);
-
365 va_end(ap);
-
366 return status;
-
367}
+
362
+
363/* These functions just create a variable argument list and call tcol_vfprintf
+
364 with the appropriate FILE* stream. */
+
+
365int tcol_fprintf(FILE *stream, const char *fmt, ...) {
+
366 va_list ap;
+
367 va_start(ap, fmt);
+
368 const int status = tcol_vfprintf(stream, fmt, ap);
+
369 va_end(ap);
+
370 return status;
+
371}
-
368
-
-
369int tcol_printf(const char *fmt, ...) {
-
370 va_list ap;
-
371 va_start(ap, fmt);
-
372 const int status = tcol_vfprintf(stdout, fmt, ap);
-
373 va_end(ap);
-
374 return status;
-
375}
+
372
+
+
373int tcol_printf(const char *fmt, ...) {
+
374 va_list ap;
+
375 va_start(ap, fmt);
+
376 const int status = tcol_vfprintf(stdout, fmt, ap);
+
377 va_end(ap);
+
378 return status;
+
379}
-
376
-
377/* This is similar except it prints to a buffer */
-
-
378int tcol_snprintf(char *stream, size_t N, const char *fmt, ...) {
-
379 va_list ap;
-
380 va_start(ap, fmt);
-
381 const int status = tcol_vsnprintf(stream, N, fmt, ap);
-
382 va_end(ap);
-
383 return status;
-
384}
+
380
+
381/* This is similar except it prints to a buffer */
+
+
382int tcol_snprintf(char *stream, size_t N, const char *fmt, ...) {
+
383 va_list ap;
+
384 va_start(ap, fmt);
+
385 const int status = tcol_vsnprintf(stream, N, fmt, ap);
+
386 va_end(ap);
+
387 return status;
+
388}
char const char * fmt
Definition gwion_print.h:2
const char * tcol_errorstr(const enum term_color_error_t err)
Definition termcolor.c:32
-
int tcol_fprintf(FILE *stream, const char *fmt,...)
Definition termcolor.c:361
-
static int tcol_vsnprintf(char *stream, size_t N, const char *fmt, va_list ap)
Definition termcolor.c:288
+
int tcol_fprintf(FILE *stream, const char *fmt,...)
Definition termcolor.c:365
+
static int tcol_vsnprintf(char *stream, size_t N, const char *fmt, va_list ap)
Definition termcolor.c:292
const char * tcol_errorstrs[TERM_COLOR_ERROR_COUNT]
Definition termcolor.c:24
-
int tcol_printf(const char *fmt,...)
Definition termcolor.c:369
-
int _tcol_color_generate(char *dst, size_t dstn, size_t *len, int rep, int foreground, int background)
Definition termcolor.c:72
-
_termcolor_internal_color
Definition termcolor.c:63
-
@ _termcolor_internal_color_FANT
Definition termcolor.c:65
-
@ _termcolor_internal_color_BOLD
Definition termcolor.c:64
-
@ _termcolor_internal_color_UNDR
Definition termcolor.c:66
-
@ _termcolor_internal_color_STRK
Definition termcolor.c:68
-
@ _termcolor_internal_color_BLNK
Definition termcolor.c:67
-
@ _termcolor_internal_color_ITLC
Definition termcolor.c:69
-
void tcol_override_color_checks(bool enable_color)
Definition termcolor.c:36
-
int tcol_snprintf(char *stream, size_t N, const char *fmt,...)
Definition termcolor.c:378
+
int tcol_printf(const char *fmt,...)
Definition termcolor.c:373
+
int _tcol_color_generate(char *dst, size_t dstn, size_t *len, int rep, int foreground, int background)
Definition termcolor.c:76
+
_termcolor_internal_color
Definition termcolor.c:67
+
@ _termcolor_internal_color_FANT
Definition termcolor.c:69
+
@ _termcolor_internal_color_BOLD
Definition termcolor.c:68
+
@ _termcolor_internal_color_UNDR
Definition termcolor.c:70
+
@ _termcolor_internal_color_STRK
Definition termcolor.c:72
+
@ _termcolor_internal_color_BLNK
Definition termcolor.c:71
+
@ _termcolor_internal_color_ITLC
Definition termcolor.c:73
+
void tcol_override_color_checks(bool enable_color)
Definition termcolor.c:40
+
int tcol_snprintf(char *stream, size_t N, const char *fmt,...)
Definition termcolor.c:382
static bool use_color
Definition termcolor.c:22
-
static int tcol_fmt_parse(char *dst, size_t dstn, const char *src, size_t srcn)
Definition termcolor.c:215
+
static int tcol_fmt_parse(char *dst, size_t dstn, const char *src, size_t srcn)
Definition termcolor.c:219
#define __APPEND(c)
-
int _termcolor_internal_lookup(const char color_name)
Definition termcolor.c:40
-
int tcol_color_parse(char *dst, size_t dstn, char color[16], size_t k, size_t *len)
Definition termcolor.c:138
-
static int tcol_vfprintf(FILE *stream, const char *fmt, va_list ap)
Definition termcolor.c:320
+
int _termcolor_internal_lookup(const char color_name)
Definition termcolor.c:44
+
int tcol_color_parse(char *dst, size_t dstn, char color[16], size_t k, size_t *len)
Definition termcolor.c:142
+
bool tcol_has_color(void)
Definition termcolor.c:36
+
static int tcol_vfprintf(FILE *stream, const char *fmt, va_list ap)
Definition termcolor.c:324
term_color_error_t
Definition termcolor.h:38
@ TermColorErrorInvalidColor
Definition termcolor.h:42
diff --git a/termcolor_8h.html b/termcolor_8h.html index 1ee63e2..1c21c02 100644 --- a/termcolor_8h.html +++ b/termcolor_8h.html @@ -111,6 +111,8 @@   void tcol_override_color_checks (bool enable_color)   +bool tcol_has_color (void) +  int tcol_fprintf (FILE *stream, const char *fmt,...)   int tcol_printf (const char *fmt,...) @@ -197,77 +199,77 @@

-

Definition at line 72 of file termcolor.c.

-
73 {
-
74 /* Much of the code here was informed by the following gist:
-
75 https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797 */
-
76
-
77 size_t j = 0;
-
78
-
79 /* This macro checks to make sure we don't overrun the buffer when we add
-
80 a new character, */
-
81 #define __APPEND(c) do { \
-
82 dst[j++] = (c); \
-
83 if (j >= dstn) return TermColorErrorNone; \
-
84 } while (0)
-
85
-
86 /* Every escape code begins with "\e[" */
-
87 __APPEND('\033');
-
88 __APPEND('[');
+

Definition at line 76 of file termcolor.c.

+
77 {
+
78 /* Much of the code here was informed by the following gist:
+
79 https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797 */
+
80
+
81 size_t j = 0;
+
82
+
83 /* This macro checks to make sure we don't overrun the buffer when we add
+
84 a new character, */
+
85 #define __APPEND(c) do { \
+
86 dst[j++] = (c); \
+
87 if (j >= dstn) return TermColorErrorNone; \
+
88 } while (0)
89
-
90 /* Add the appropriate parameters to our escape sequence depending on the
-
91 flags set in rep(resentation). */
- -
93 __APPEND('1');
-
94 __APPEND(';');
-
95 }
- -
97 __APPEND('2');
+
90 /* Every escape code begins with "\e[" */
+
91 __APPEND('\033');
+
92 __APPEND('[');
+
93
+
94 /* Add the appropriate parameters to our escape sequence depending on the
+
95 flags set in rep(resentation). */
+ +
97 __APPEND('1');
98 __APPEND(';');
99 }
- -
101 __APPEND('3');
+ +
101 __APPEND('2');
102 __APPEND(';');
103 }
- -
105 __APPEND('4');
+ +
105 __APPEND('3');
106 __APPEND(';');
107 }
- -
109 __APPEND('5');
+ +
109 __APPEND('4');
110 __APPEND(';');
111 }
- -
113 __APPEND('9');
+ +
113 __APPEND('5');
114 __APPEND(';');
115 }
-
116
-
117 /* If foreground and background colors were provided, snprintf them to dst. */
-
118 if (foreground != -1) {
-
119 j += snprintf(dst + j, dstn - j, "%d;", foreground);
-
120 if (j >= dstn) return TermColorErrorNone;
-
121 }
-
122 if (background != -1) {
-
123 j += snprintf(dst + j, dstn - j, "%d;", background + 10);
+ +
117 __APPEND('9');
+
118 __APPEND(';');
+
119 }
+
120
+
121 /* If foreground and background colors were provided, snprintf them to dst. */
+
122 if (foreground != -1) {
+
123 j += snprintf(dst + j, dstn - j, "%d;", foreground);
124 if (j >= dstn) return TermColorErrorNone;
125 }
-
126
-
127 if (dst[j - 1] == ';') {
-
128 j--;
+
126 if (background != -1) {
+
127 j += snprintf(dst + j, dstn - j, "%d;", background + 10);
+
128 if (j >= dstn) return TermColorErrorNone;
129 }
130
-
131 /* Graphics mode escape sequences end with 'm' */
-
132 __APPEND('m');
-
133
-
134 *len = j;
-
135 return TermColorErrorNone;
-
136}
-
@ _termcolor_internal_color_FANT
Definition termcolor.c:65
-
@ _termcolor_internal_color_BOLD
Definition termcolor.c:64
-
@ _termcolor_internal_color_UNDR
Definition termcolor.c:66
-
@ _termcolor_internal_color_STRK
Definition termcolor.c:68
-
@ _termcolor_internal_color_BLNK
Definition termcolor.c:67
-
@ _termcolor_internal_color_ITLC
Definition termcolor.c:69
+
131 if (dst[j - 1] == ';') {
+
132 j--;
+
133 }
+
134
+
135 /* Graphics mode escape sequences end with 'm' */
+
136 __APPEND('m');
+
137
+
138 *len = j;
+
139 return TermColorErrorNone;
+
140}
+
@ _termcolor_internal_color_FANT
Definition termcolor.c:69
+
@ _termcolor_internal_color_BOLD
Definition termcolor.c:68
+
@ _termcolor_internal_color_UNDR
Definition termcolor.c:70
+
@ _termcolor_internal_color_STRK
Definition termcolor.c:72
+
@ _termcolor_internal_color_BLNK
Definition termcolor.c:71
+
@ _termcolor_internal_color_ITLC
Definition termcolor.c:73
#define __APPEND(c)
@@ -306,86 +308,86 @@

-

Definition at line 138 of file termcolor.c.

-
139 {
-
140 if (!use_color) {
-
141 *len = 0;
-
142 return TermColorErrorNone;
-
143 }
-
144
-
145 /* '0' signifies no color, i.e. a reset */
-
146 if (k == 1 && *color == '0') {
-
147 size_t j = 0;
-
148 __APPEND('\033');
-
149 __APPEND('[');
-
150 __APPEND('m');
-
151 *len = j;
-
152 return TermColorErrorNone;
-
153 }
-
154
-
155 /* As -1 they are ignored. Otherwise they are set to the foreground color
-
156 code. The backround code is later added 10 to. */
-
157 int foreground = -1;
-
158 int background = -1;
-
159
-
160 enum _termcolor_internal_color rep = 0;
-
161 size_t i;
-
162 for (i = 0; i < k; i++) {
-
163 switch (color[i]) {
-
164 /* Farily straightforward; just sets the flags corresponding to the
-
165 color attributes. */
-
166 case '+':
- -
168 break;
-
169 case '-':
- -
171 break;
-
172 case '_':
- -
174 break;
-
175 case '*':
- -
177 break;
-
178 case '~':
- -
180 break;
-
181 case '/':
- -
183 break;
-
184
-
185 /* Here we take the character after the ',' and use that as our
-
186 background color code, like Nano does. */
-
187 case ',': {
-
188 if (i + 1 >= k) {
- -
190 }
-
191 const int result = _termcolor_internal_lookup(color[i + 1]);
-
192 if (result == -1) {
+

Definition at line 142 of file termcolor.c.

+
143 {
+
144 if (!use_color) {
+
145 *len = 0;
+
146 return TermColorErrorNone;
+
147 }
+
148
+
149 /* '0' signifies no color, i.e. a reset */
+
150 if (k == 1 && *color == '0') {
+
151 size_t j = 0;
+
152 __APPEND('\033');
+
153 __APPEND('[');
+
154 __APPEND('m');
+
155 *len = j;
+
156 return TermColorErrorNone;
+
157 }
+
158
+
159 /* As -1 they are ignored. Otherwise they are set to the foreground color
+
160 code. The backround code is later added 10 to. */
+
161 int foreground = -1;
+
162 int background = -1;
+
163
+
164 enum _termcolor_internal_color rep = 0;
+
165 size_t i;
+
166 for (i = 0; i < k; i++) {
+
167 switch (color[i]) {
+
168 /* Farily straightforward; just sets the flags corresponding to the
+
169 color attributes. */
+
170 case '+':
+ +
172 break;
+
173 case '-':
+ +
175 break;
+
176 case '_':
+ +
178 break;
+
179 case '*':
+ +
181 break;
+
182 case '~':
+ +
184 break;
+
185 case '/':
+ +
187 break;
+
188
+
189 /* Here we take the character after the ',' and use that as our
+
190 background color code, like Nano does. */
+
191 case ',': {
+
192 if (i + 1 >= k) {
194 }
-
195 background = result;
-
196 i++;
-
197 break;
-
198 }
-
199 default: {
-
200 /* If we haven't matched anything, we assume its a foreground
-
201 color. Make sure it is and error if not. */
-
202 const int result = _termcolor_internal_lookup(color[i]);
-
203 if (result != -1) {
-
204 foreground = result;
-
205 break;
-
206 }
- -
208 }
-
209 }
-
210 }
-
211
-
212 return _tcol_color_generate(dst, dstn, len, rep, foreground, background);
-
213}
-
int _tcol_color_generate(char *dst, size_t dstn, size_t *len, int rep, int foreground, int background)
Definition termcolor.c:72
-
_termcolor_internal_color
Definition termcolor.c:63
+
195 const int result = _termcolor_internal_lookup(color[i + 1]);
+
196 if (result == -1) {
+ +
198 }
+
199 background = result;
+
200 i++;
+
201 break;
+
202 }
+
203 default: {
+
204 /* If we haven't matched anything, we assume its a foreground
+
205 color. Make sure it is and error if not. */
+
206 const int result = _termcolor_internal_lookup(color[i]);
+
207 if (result != -1) {
+
208 foreground = result;
+
209 break;
+
210 }
+ +
212 }
+
213 }
+
214 }
+
215
+
216 return _tcol_color_generate(dst, dstn, len, rep, foreground, background);
+
217}
+
int _tcol_color_generate(char *dst, size_t dstn, size_t *len, int rep, int foreground, int background)
Definition termcolor.c:76
+
_termcolor_internal_color
Definition termcolor.c:67
static bool use_color
Definition termcolor.c:22
-
int _termcolor_internal_lookup(const char color_name)
Definition termcolor.c:40
+
int _termcolor_internal_lookup(const char color_name)
Definition termcolor.c:44

@@ -444,16 +446,38 @@

-

Definition at line 361 of file termcolor.c.

-
361 {
-
362 va_list ap;
-
363 va_start(ap, fmt);
-
364 const int status = tcol_vfprintf(stream, fmt, ap);
-
365 va_end(ap);
-
366 return status;
-
367}
+

Definition at line 365 of file termcolor.c.

+
365 {
+
366 va_list ap;
+
367 va_start(ap, fmt);
+
368 const int status = tcol_vfprintf(stream, fmt, ap);
+
369 va_end(ap);
+
370 return status;
+
371}
char const char * fmt
Definition gwion_print.h:2
-
static int tcol_vfprintf(FILE *stream, const char *fmt, va_list ap)
Definition termcolor.c:320
+
static int tcol_vfprintf(FILE *stream, const char *fmt, va_list ap)
Definition termcolor.c:324
+
+
+

+ +

◆ tcol_has_color()

+ +
+
+ + + + + + + +
bool tcol_has_color (void )
+
+ +

Definition at line 36 of file termcolor.c.

+
36 {
+
37 return use_color;
+
38}
@@ -472,10 +496,10 @@

-

Definition at line 36 of file termcolor.c.

-
36 {
-
37 use_color = enable_color;
-
38}
+

Definition at line 40 of file termcolor.c.

+
40 {
+
41 use_color = enable_color;
+
42}

@@ -498,14 +522,14 @@

-

Definition at line 369 of file termcolor.c.

-
369 {
-
370 va_list ap;
-
371 va_start(ap, fmt);
-
372 const int status = tcol_vfprintf(stdout, fmt, ap);
-
373 va_end(ap);
-
374 return status;
-
375}
+

Definition at line 373 of file termcolor.c.

+
373 {
+
374 va_list ap;
+
375 va_start(ap, fmt);
+
376 const int status = tcol_vfprintf(stdout, fmt, ap);
+
377 va_end(ap);
+
378 return status;
+
379}

@@ -538,15 +562,15 @@

-

Definition at line 378 of file termcolor.c.

-
378 {
-
379 va_list ap;
-
380 va_start(ap, fmt);
-
381 const int status = tcol_vsnprintf(stream, N, fmt, ap);
-
382 va_end(ap);
-
383 return status;
-
384}
-
static int tcol_vsnprintf(char *stream, size_t N, const char *fmt, va_list ap)
Definition termcolor.c:288
+

Definition at line 382 of file termcolor.c.

+
382 {
+
383 va_list ap;
+
384 va_start(ap, fmt);
+
385 const int status = tcol_vsnprintf(stream, N, fmt, ap);
+
386 va_end(ap);
+
387 return status;
+
388}
+
static int tcol_vsnprintf(char *stream, size_t N, const char *fmt, va_list ap)
Definition termcolor.c:292

diff --git a/termcolor_8h_source.html b/termcolor_8h_source.html index 1e5f028..979bb90 100644 --- a/termcolor_8h_source.html +++ b/termcolor_8h_source.html @@ -181,48 +181,52 @@
93 - `enable_color`: Whether to enable "colorization" of the format string */
94void tcol_override_color_checks(bool enable_color);
95
-
96/* Printfs the colorized format string to the specified stream.
-
97
-
98 Parameters:
-
99 - `fmt`: The termcolor format string
-
100 - `...`: The variable argumentsto replace the format specifiers with
-
101
-
102 Return Value:
-
103 - `int`: One of the values `enum term_color_error_t` */
-
104int tcol_fprintf(FILE *stream, const char *fmt, ...);
-
105
-
106/* Printfs the colorized format string to the standard output.
-
107
-
108 Parameters:
-
109 - `stream`: The `FILE*` stream to printf to
-
110 - `fmt`: The termcolor format string
-
111 - `...`: The variable argumentsto replace the format specifiers with
-
112
-
113 Return Value:
-
114 - `int`: One of the values `enum term_color_error_t` */
-
115int tcol_printf(const char *fmt, ...);
-
116
-
117/* Snprintfs the colorized format string to the specified string stream.
-
118
-
119 Parameters:
-
120 - `buffer`: The `char*` stream to printf to
-
121 - `N`: The total size of `buffer`, including the null terminatr
-
122 - `fmt`: The termcolor format string
-
123 - `...`: The variable argumentsto replace the format specifiers with
-
124
-
125 Return Value:
-
126 - `int`: One of the values `enum term_color_error_t`*/
-
127int tcol_snprintf(char *buffer, size_t N, const char *fmt, ...);
-
128
-
129#endif /* _LIBTERMCOLOR_TERMCOLOR_H */
+
96/* Return the current state of colorization. */
+
97bool tcol_has_color(void);
+
98
+
99/* Printfs the colorized format string to the specified stream.
+
100
+
101 Parameters:
+
102 - `fmt`: The termcolor format string
+
103 - `...`: The variable argumentsto replace the format specifiers with
+
104
+
105 Return Value:
+
106 - `int`: One of the values `enum term_color_error_t` */
+
107int tcol_fprintf(FILE *stream, const char *fmt, ...);
+
108
+
109/* Printfs the colorized format string to the standard output.
+
110
+
111 Parameters:
+
112 - `stream`: The `FILE*` stream to printf to
+
113 - `fmt`: The termcolor format string
+
114 - `...`: The variable argumentsto replace the format specifiers with
+
115
+
116 Return Value:
+
117 - `int`: One of the values `enum term_color_error_t` */
+
118int tcol_printf(const char *fmt, ...);
+
119
+
120/* Snprintfs the colorized format string to the specified string stream.
+
121
+
122 Parameters:
+
123 - `buffer`: The `char*` stream to printf to
+
124 - `N`: The total size of `buffer`, including the null terminatr
+
125 - `fmt`: The termcolor format string
+
126 - `...`: The variable argumentsto replace the format specifiers with
+
127
+
128 Return Value:
+
129 - `int`: One of the values `enum term_color_error_t`*/
+
130int tcol_snprintf(char *buffer, size_t N, const char *fmt, ...);
+
131
+
132#endif /* _LIBTERMCOLOR_TERMCOLOR_H */
char const char * fmt
Definition gwion_print.h:2
const char * tcol_errorstr(const enum term_color_error_t err)
Definition termcolor.c:32
-
int tcol_snprintf(char *buffer, size_t N, const char *fmt,...)
Definition termcolor.c:378
-
int tcol_fprintf(FILE *stream, const char *fmt,...)
Definition termcolor.c:361
-
int tcol_printf(const char *fmt,...)
Definition termcolor.c:369
-
int _tcol_color_generate(char *dst, size_t dstn, size_t *len, int rep, int foreground, int background)
Definition termcolor.c:72
-
void tcol_override_color_checks(bool enable_color)
Definition termcolor.c:36
-
int tcol_color_parse(char *dst, size_t dstn, char color[16], size_t k, size_t *len)
Definition termcolor.c:138
+
int tcol_snprintf(char *buffer, size_t N, const char *fmt,...)
Definition termcolor.c:382
+
int tcol_fprintf(FILE *stream, const char *fmt,...)
Definition termcolor.c:365
+
int tcol_printf(const char *fmt,...)
Definition termcolor.c:373
+
int _tcol_color_generate(char *dst, size_t dstn, size_t *len, int rep, int foreground, int background)
Definition termcolor.c:76
+
void tcol_override_color_checks(bool enable_color)
Definition termcolor.c:40
+
int tcol_color_parse(char *dst, size_t dstn, char color[16], size_t k, size_t *len)
Definition termcolor.c:142
+
bool tcol_has_color(void)
Definition termcolor.c:36
term_color_error_t
Definition termcolor.h:38
@ TermColorErrorInvalidColor
Definition termcolor.h:42
@ TermColorErrorUnterminatedColor
Definition termcolor.h:43