|
ekg2
GIT master
|
#include "ekg2.h"#include <limits.h>#include <stdarg.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <errno.h>
Struktury danych | |
| struct | format |
Definicje | |
| #define | ROL(x) (((x>>25)&0x7f)|((x<<7)&0xffffff80)) |
| #define | NPAR 16 /* ECMA-48 CSI have got max 16 params (NPAR) defined in <linux/console_struct.h> */ |
| #define | FORMAT_ADD(format, value, replace) sprintf(tmp, format, status); format_add(tmp, value, replace) |
| #define | FORMAT_ADDF(format, fvalue, replace) FORMAT_ADD(format, theme_init_contact_helper(fvalue, color), replace); |
Funkcje | |
| static void | list_format_free (struct format *data) |
| static void | formats_add (struct format **lista, struct format *new_) |
| static struct format * | formats_removei (struct format **lista, struct format *elem) |
| static void | formats_destroy (struct format **lista) |
| static int | gim_hash (const char *name) |
| const char * | format_find (const char *name) |
| static const char * | format_ansi (char ch) |
| void | fstring_iter (const fstring_t *s, gchar **text, fstr_attr_t **attr, gssize *len) |
| gboolean | fstring_next (gchar **text, fstr_attr_t **attr, gssize *len, fstr_attr_t *change) |
| static char * | fstring2str (fstring_t *f) |
| static char * | va_format_string (const char *format, va_list ap) |
| fstring_t * | fstring_dup (const fstring_t *str) |
| fstring_t * | fstring_new (const char *str) |
| fstring_t * | fstring_new_format (const char *format,...) |
| void | fstring_free (fstring_t *str) |
| char * | format_string (const char *format,...) |
| static void | print_window_c (window_t *w, int activity, const char *theme, va_list ap) |
| static window_t * | print_window_find (const char *target, session_t *session, int separate) |
| void | print_window (const char *target, session_t *session, int activity, int separate, const char *theme,...) |
| void | print_info (const char *target, session_t *session, const char *theme,...) |
| void | print_warning (const char *target, session_t *session, const char *theme,...) |
| void | print_window_w (window_t *w, int activity, const char *theme,...) |
| void | theme_cache_reset () |
| void | format_add (const char *name, const char *value, int replace) |
| static int | format_remove (const char *name) |
| static FILE * | theme_open (const char *prefix, const char *filename) |
| int | theme_read (const char *filename, int replace) |
| int | theme_write (const char *filename) |
| void | theme_enumerate (int(*enumerator)(const char *theme, const char *value)) |
| void | theme_free () |
| void | theme_plugins_init () |
| static const char * | theme_init_contact_helper (const char *theme, char color) |
| static void | theme_init_contact_status (const char *status, char color, int want_quick_list) |
| void | theme_init () |
Zmienne | |
| static char * | prompt_cache = NULL |
| static char * | prompt2_cache = NULL |
| static char * | error_cache = NULL |
| static const char * | timestamp_cache = NULL |
| static int | no_prompt_cache = 0 |
| static int | no_prompt_cache_hash = 0x139dcbd6 |
| static struct format * | formats [0x100] |
| #define FORMAT_ADD | ( | format, | |
| value, | |||
| replace | |||
| ) | sprintf(tmp, format, status); format_add(tmp, value, replace) |
| #define FORMAT_ADDF | ( | format, | |
| fvalue, | |||
| replace | |||
| ) | FORMAT_ADD(format, theme_init_contact_helper(fvalue, color), replace); |
| #define NPAR 16 /* ECMA-48 CSI have got max 16 params (NPAR) defined in <linux/console_struct.h> */ |
| #define ROL | ( | x | ) | (((x>>25)&0x7f)|((x<<7)&0xffffff80)) |
| void format_add | ( | const char * | name, |
| const char * | value, | ||
| int | replace | ||
| ) |
Add format with name and value.
If replace set to 1, than if format with the same name exists. than format value will be replaced.
| name | - name of format |
| value | - value of format |
| replace | - if this format exists and is set to 1 than format value will be replaced with new one. else do nothing. |
|
static |
| const char* format_find | ( | const char * | name | ) |
|
static |
Remove format with given name.
| name |
| char* format_string | ( | const char * | format, |
| ... | |||
| ) |
|
static |
|
static |
| void fstring_free | ( | fstring_t * | str | ) |
Free memory allocated by str
| str | - fstring_t * to free. |
| void fstring_iter | ( | const fstring_t * | s, |
| gchar ** | text, | ||
| fstr_attr_t ** | attr, | ||
| gssize * | len | ||
| ) |
Initiate iteration over fstring_t. Set pointers to the initial values.
| s | - the iterated fstring_t. |
| text | - location to store the current text segment pointer. |
| attr | - location to store the current attr segment pointer. |
| len | - location to store the length of the current segment. |
| fstring_t* fstring_new | ( | const char * | str | ) |
Change formatted ansi string (str) to Nowy-i-Lepszy (tm) [New-and-Better].
| str | - string |
| fstring_t* fstring_new_format | ( | const char * | format, |
| ... | |||
| ) |
char *tmp = format_string("format", .....); fstr = fstring_new(tmp); xfree(tmp);
| gboolean fstring_next | ( | gchar ** | text, |
| fstr_attr_t ** | attr, | ||
| gssize * | len, | ||
| fstr_attr_t * | change | ||
| ) |
Iterate over fragments of fstring_t with unchanged attributes.
| text | - location to store the current text segment pointer. |
| attr | - location to store the current attr segment pointer. |
| len | - location to store the length of the current segment. |
| change | - location to store changed attribute map or NULL. |
|
static |
|
static |
| void print_info | ( | const char * | target, |
| session_t * | session, | ||
| const char * | theme, | ||
| ... | |||
| ) |
| void print_warning | ( | const char * | target, |
| session_t * | session, | ||
| const char * | theme, | ||
| ... | |||
| ) |
| void print_window | ( | const char * | target, |
| session_t * | session, | ||
| int | activity, | ||
| int | separate, | ||
| const char * | theme, | ||
| ... | |||
| ) |
Print given text in given window [target+ session]
| target | - target to look for. |
| session | - session to look for. |
| activity | - how important is text? |
| separate | - if essence of text is important to create new window |
| theme | - Name of format to format_string() with ... Text will be be built. |
| ... |
|
static |
Mind abbreviation ;) print_window_c() -> print_window_common()
Common stuff for: print_window() and print_window_w()
Change w->act if needed, format theme, make fstring() and send everything to window_print()
|
static |
Find given window [based on target and session] if not found, and separate set, create new one.
Print given text in given window [target+ session]
| target | - target to look for. |
| session | - session to look for. |
| separate | - if essence of text is important to create new window |
| void print_window_w | ( | window_t * | w, |
| int | activity, | ||
| const char * | theme, | ||
| ... | |||
| ) |
Like print_window() but it takes window_t struct instead of target+session.
print_window_c(window_find_ptr(w), separate, theme, ...) And in worst case text will be displayed in (__status / or __current) window instead of a usual one.. But ekg2 won't crash.| w | - window to display, if NULL than __status or __current will be used. it depends on: config_default_status_window and config_display_crap variables. |
| static void theme_cache_reset | ( | ) |
Remove cached: prompt_cache, prompt2_cache, error_cache and timestamp_cache
These values are used by va_format_string() to don't call format_find() on:
["prompt" "%>", "prompt2" "%)", "errror" "%!", "timestamp" "%#"]
| void theme_enumerate | ( | int(*)(const char *theme, const char *value) | enumerator | ) |
| void theme_free | ( | ) |
| void theme_init | ( | ) |
|
static |
|
static |
|
static |
| void theme_plugins_init | ( | ) |
| int theme_read | ( | const char * | filename, |
| int | replace | ||
| ) |
| int theme_write | ( | const char * | filename | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
1.8.13