RichString.h 1.9 KB
Newer Older
Hisham Muhammad's avatar
Hisham Muhammad committed
1
/* Do not edit this file. It was automatically generated. */
Hisham Muhammad's avatar
Hisham Muhammad committed
2
3
4
5
6

#ifndef HEADER_RichString
#define HEADER_RichString


7
8
9
10
11
#ifndef CONFIG_H
#define CONFIG_H
#include "config.h"
#endif

Hisham Muhammad's avatar
Hisham Muhammad committed
12
13
14
#include <stdlib.h>
#include <string.h>
#include <curses.h>
15
#include <ctype.h>
Hisham Muhammad's avatar
Hisham Muhammad committed
16
17
18

#include "debug.h"
#include <assert.h>
19
20
21
#ifdef HAVE_LIBNCURSESW
#include <wchar.h>
#endif
Hisham Muhammad's avatar
Hisham Muhammad committed
22
23
24
25

#define RICHSTRING_MAXLEN 300


26
27
28
#define RichString_init(this) (this)->len = 0
#define RichString_initVal(this) (this).len = 0

29
30
31
32
33
34
35
36
37
38
#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)
#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])
#endif

Hisham Muhammad's avatar
Hisham Muhammad committed
39
40
typedef struct RichString_ {
   int len;
41
42
43
#ifdef HAVE_LIBNCURSESW
   cchar_t chstr[RICHSTRING_MAXLEN+1];
#else
Hisham Muhammad's avatar
Hisham Muhammad committed
44
   chtype chstr[RICHSTRING_MAXLEN+1];
45
#endif
Hisham Muhammad's avatar
Hisham Muhammad committed
46
47
48
} RichString;


Hisham Muhammad's avatar
Hisham Muhammad committed
49
50
51
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
Hisham Muhammad's avatar
Hisham Muhammad committed
52

53
#ifdef HAVE_LIBNCURSESW
Hisham Muhammad's avatar
Hisham Muhammad committed
54

55
extern void RichString_appendn(RichString* this, int attrs, char* data_c, int len);
Hisham Muhammad's avatar
Hisham Muhammad committed
56

57
58
59
60
61
62
63
64
65
66
67
68
69
extern void RichString_setAttrn(RichString *this, int attrs, int start, int finish);

int RichString_findChar(RichString *this, char c, int start);

#else

extern void RichString_appendn(RichString* this, int attrs, char* data_c, int len);

void RichString_setAttrn(RichString *this, int attrs, int start, int finish);

int RichString_findChar(RichString *this, char c, int start);

#endif
Hisham Muhammad's avatar
Hisham Muhammad committed
70
71
72

void RichString_setAttr(RichString *this, int attrs);

73
74
75
extern void RichString_append(RichString* this, int attrs, char* data);

void RichString_write(RichString* this, int attrs, char* data);
Hisham Muhammad's avatar
Hisham Muhammad committed
76
77
78
79

RichString RichString_quickString(int attrs, char* data);

#endif