#include "ekg2-config.h"
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include "dynstuff.h"
#include "stuff.h"
#include "recode.h"
#include "themes.h"
#include "xmalloc.h"
#include "windows.h"
#include "userlist.h"
#include "debug.h"
#include "dynstuff_inline.h"
#include "queries.h"
Struktury danych | |
struct | format |
Definicje | |
#define | _XOPEN_SOURCE 600 |
#define | ROL(x) (((x>>25)&0x7f)|((x<<7)&0xffffff80)) |
#define | NPAR 16 |
#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 | LIST_FREE_ITEM (list_format_free, struct format *) |
DYNSTUFF_LIST_DECLARE (formats, struct format, list_format_free, static __DYNSTUFF_ADD_BEGINNING, static __DYNSTUFF_REMOVE_ITER, static __DYNSTUFF_DESTROY) static int gim_hash(const char *name) | |
const char * | format_find (const char *name) |
static const char * | format_ansi (char ch) |
static char * | va_format_string (const char *format, va_list ap) |
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 _XOPEN_SOURCE 600 |
#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 |
#define ROL | ( | x | ) | (((x>>25)&0x7f)|((x<<7)&0xffffff80)) |
DYNSTUFF_LIST_DECLARE | ( | formats | , | |
struct format | , | |||
list_format_free | , | |||
static | __DYNSTUFF_ADD_BEGINNING, | |||
static | __DYNSTUFF_REMOVE_ITER, | |||
static | __DYNSTUFF_DESTROY | |||
) | const |
gim_hash()
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_ansi | ( | char | ch | ) | [static] |
const char* format_find | ( | const char * | name | ) |
static int format_remove | ( | const char * | name | ) | [static] |
Remove format with given name.
name |
char* format_string | ( | const char * | format, | |
... | ||||
) |
void fstring_free | ( | fstring_t * | str | ) |
Free memory allocated by str
str | - fstring_t * to free. |
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);
static LIST_FREE_ITEM | ( | list_format_free | , | |
struct format * | ||||
) | [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 void print_window_c | ( | window_t * | w, | |
int | activity, | |||
const char * | theme, | |||
va_list | ap | |||
) | [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 window_t* print_window_find | ( | const char * | target, | |
session_t * | session, | |||
int | separate | |||
) | [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 const char* theme_init_contact_helper | ( | const char * | theme, | |
char | color | |||
) | [static] |
static void theme_init_contact_status | ( | const char * | status, | |
char | color, | |||
int | want_quick_list | |||
) | [static] |
static FILE* theme_open | ( | const char * | prefix, | |
const char * | filename | |||
) | [static] |
void theme_plugins_init | ( | ) |
int theme_read | ( | const char * | filename, | |
int | replace | |||
) |
int theme_write | ( | const char * | filename | ) |
static char* va_format_string | ( | const char * | format, | |
va_list | ap | |||
) | [static] |
char * error_cache = NULL [static] |
int no_prompt_cache = 0 [static] |
int no_prompt_cache_hash = 0x139dcbd6 [static] |
char * prompt2_cache = NULL [static] |
char* prompt_cache = NULL [static] |
const char* timestamp_cache = NULL [static] |