ekg2
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje Grupay Strony
Struktury danych | Definicje | Funkcje | Zmienne
Dokumentacja pliku themes.c
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "stuff.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 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 FORE_COMMON(x)
#define FORE_COMMON_BOLD(x)
#define BACK_COMMON(x)

Funkcje

static void theme_cache_reset ()
static LIST_FREE_ITEM (list_format_free, struct format *)
 DYNSTUFF_LIST_DECLARE (formats, struct format, list_format_free, static __DYNSTUFF_ADD_BEGINNING, __DYNSTUFF_NOREMOVE, 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 void format_ansi_append (string_t str, char ch)
static char * va_format_string (const char *format, va_list ap)
fstring_tfstring_new (const char *str)
fstring_tfstring_new_format (const char *format,...)
void fstring_free (fstring_t *str)
char * format_string (const char *format,...)
static char * split_line (char **ptr)
static void window_print (window_t *w, fstring_t *line)
void print_window_w (window_t *w, int activity, const char *theme,...)
static fstring_tremote_format_string (const char *str, time_t ts)
EXPORTNOT void remote_print_window (int id, time_t ts, char *data)
static void format_add_c (const char *name, const char *value, int remote)
void format_add (const char *name, const char *value, int replace)
EXPORTNOT void remote_format_add (const char *name, const char *value)
EXPORTNOT void theme_free ()
EXPORTNOT 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 formatformats [0x100]

Dokumentacja definicji

#define BACK_COMMON (   x)
Wartość:
attr |= x << 3; \
break;
#define FORE_COMMON (   x)
Wartość:
attr &= (FSTR_BACKMASK); \
attr &= ~(FSTR_NORMAL+FSTR_FOREMASK); \
attr |= x; \
isbold = 0; \
break;
#define FORE_COMMON_BOLD (   x)
Wartość:
attr |= x; \
attr |= FSTR_BOLD; \
isbold = 1; \
break;
#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))

Dokumentacja funkcji

DYNSTUFF_LIST_DECLARE ( formats  ,
struct format  ,
list_format_free  ,
static  __DYNSTUFF_ADD_BEGINNING,
__DYNSTUFF_NOREMOVE  ,
static  __DYNSTUFF_DESTROY 
) const
void format_add ( const char *  name,
const char *  value,
int  replace 
)

format_add()

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.

Do zrobienia:
What about creating global variable: formats_unique_here.. and if set to 1, don't search if this format already exists? It should speedup theme_init() a little.
Parametry
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 void format_add_c ( const char *  name,
const char *  value,
int  remote 
)
static
static const char* format_ansi ( char  ch)
static
static void format_ansi_append ( string_t  str,
char  ch 
)
static
const char* format_find ( const char *  name)
char* format_string ( const char *  format,
  ... 
)
void fstring_free ( fstring_t str)

fstring_free()

Free memory allocated by str

Do zrobienia:
XXX Think about freeing str->priv_data
Parametry
str- fstring_t * to free.
fstring_t* fstring_new ( const char *  str)

fstring_new()

Change formatted ansi string (str) to Nowy-i-Lepszy (tm) [New-and-Better].

Parametry
str- string
Zobacz również
format_string() - Function to format strings.
fstring_free() - Function to free fstring_t.
Zwraca
Allocated fstring_t.
fstring_t* fstring_new_format ( const char *  format,
  ... 
)

fstring_new_format()

 char *tmp = format_string("format", .....);
 fstr = fstring_new(tmp);
 xfree(tmp);
static LIST_FREE_ITEM ( list_format_free  ,
struct format  
)
static
void print_window_w ( window_t w,
int  activity,
const char *  theme,
  ... 
)

print_window_w()

Like print_window() but it takes window_t struct instead of target+session.

Nota
The same as in print_window_c(): we don't check if w is valid window ptr. Just be careful. If you are not sure call:
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.
Parametry
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.
EXPORTNOT void remote_format_add ( const char *  name,
const char *  value 
)
static fstring_t* remote_format_string ( const char *  str,
time_t  ts 
)
static
EXPORTNOT void remote_print_window ( int  id,
time_t  ts,
char *  data 
)
static char* split_line ( char **  ptr)
static
static void theme_cache_reset ( )
static
EXPORTNOT void theme_free ( )
EXPORTNOT void theme_init ( )
static char* va_format_string ( const char *  format,
va_list  ap 
)
static
static void window_print ( window_t w,
fstring_t line 
)
static

Dokumentacja zmiennych

char * error_cache = NULL
static
struct format* formats[0x100]
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