diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2010-11-22 12:40:20 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2010-11-22 12:40:20 +0000 |
commit | d8e1480a27e1e26b8dfa97681bf8e7f90946d336 (patch) | |
tree | e32ebba1c4d7abba3dc8be6e0e0863e778e660ba /RichString.h | |
parent | 25551d44c1bc939e20fec7db81dfdb4198409b58 (diff) |
Remove arbitrary limit from rich strings
Fix subtree hiding
Fix reading of CPU values in hidden threads
Fix hiding of zombie processes as kernel threads
Remove "debug proc" code
Code cleanup in processElements
Diffstat (limited to 'RichString.h')
-rw-r--r-- | RichString.h | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/RichString.h b/RichString.h index 7b2de38e..b6622a13 100644 --- a/RichString.h +++ b/RichString.h @@ -24,26 +24,31 @@ #define RICHSTRING_MAXLEN 300 -#define RichString_init(this) (this)->len = 0 -#define RichString_initVal(this) (this).len = 0 +#define RichString_size(this) ((this)->chlen) +#define RichString_sizeVal(this) ((this).chlen) + +#define RichString_begin(this) RichString (this); (this).chlen = 0; (this).chptr = (this).chstr; +#define RichString_beginAllocated(this) (this).chlen = 0; (this).chptr = (this).chstr; +#define RichString_end(this) RichString_prune(&(this)); #ifdef HAVE_LIBNCURSESW -#define RichString_printVal(this, y, x) mvadd_wchstr(y, x, this.chstr) -#define RichString_printoffnVal(this, y, x, off, n) mvadd_wchnstr(y, x, this.chstr + off, n) -#define RichString_getCharVal(this, i) (this.chstr[i].chars[0] & 255) +#define RichString_printVal(this, y, x) mvadd_wchstr(y, x, (this).chptr) +#define RichString_printoffnVal(this, y, x, off, n) mvadd_wchnstr(y, x, (this).chptr + off, n) +#define RichString_getCharVal(this, i) ((this).chptr[i].chars[0] & 255) +#define RichString_setChar(this, at, ch) do{ (this)->chptr[(at)].chars[0] = ch; } while(0) +#define CharType cchar_t #else -#define RichString_printVal(this, y, x) mvaddchstr(y, x, this.chstr) -#define RichString_printoffnVal(this, y, x, off, n) mvaddchnstr(y, x, this.chstr + off, n) -#define RichString_getCharVal(this, i) (this.chstr[i]) +#define RichString_printVal(this, y, x) mvaddchstr(y, x, (this).chptr) +#define RichString_printoffnVal(this, y, x, off, n) mvaddchnstr(y, x, (this).chptr + off, n) +#define RichString_getCharVal(this, i) ((this).chptr[i]) +#define RichString_setChar(this, at, ch) do{ (this)->chptr[(at)] = ch; } while(0) +#define CharType chtype #endif typedef struct RichString_ { - int len; -#ifdef HAVE_LIBNCURSESW - cchar_t chstr[RICHSTRING_MAXLEN+1]; -#else - chtype chstr[RICHSTRING_MAXLEN+1]; -#endif + int chlen; + CharType chstr[RICHSTRING_MAXLEN+1]; + CharType* chptr; } RichString; @@ -51,32 +56,32 @@ typedef struct RichString_ { #define MIN(a,b) ((a)<(b)?(a):(b)) #endif +#define charBytes(n) (sizeof(CharType) * (n)) + #ifdef HAVE_LIBNCURSESW extern void RichString_appendn(RichString* this, int attrs, const char* data_c, int len); -extern void RichString_setAttrn(RichString *this, int attrs, int start, int finish); +extern void RichString_setAttrn(RichString* this, int attrs, int start, int finish); -int RichString_findChar(RichString *this, char c, int start); +int RichString_findChar(RichString* this, char c, int start); #else extern void RichString_appendn(RichString* this, int attrs, const char* data_c, int len); -void RichString_setAttrn(RichString *this, int attrs, int start, int finish); +void RichString_setAttrn(RichString* this, int attrs, int start, int finish); -int RichString_findChar(RichString *this, char c, int start); +int RichString_findChar(RichString* this, char c, int start); #endif void RichString_prune(RichString* this); -void RichString_setAttr(RichString *this, int attrs); +void RichString_setAttr(RichString* this, int attrs); extern void RichString_append(RichString* this, int attrs, const char* data); void RichString_write(RichString* this, int attrs, const char* data); -RichString RichString_quickString(int attrs, const char* data); - #endif |