ReactOS  0.4.13-dev-687-g023794c
stream.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  strbuf_t
 
struct  stream_t
 

Macros

#define BLOCK_BITS   12
 
#define BLOCK_SIZE   (1 << BLOCK_BITS)
 
#define BLOCK_MASK   (BLOCK_SIZE-1)
 

Functions

void strbuf_init (strbuf_t *buf) DECLSPEC_HIDDEN
 
void strbuf_zero (strbuf_t *buf) DECLSPEC_HIDDEN
 
void strbuf_free (strbuf_t *buf) DECLSPEC_HIDDEN
 
void stream_init (stream_t *stream, IStream *str) DECLSPEC_HIDDEN
 
void get_node_name (strbuf_t *node, strbuf_t *name) DECLSPEC_HIDDEN
 
BOOL next_content (stream_t *stream, strbuf_t *buf) DECLSPEC_HIDDEN
 
BOOL next_node (stream_t *stream, strbuf_t *buf) DECLSPEC_HIDDEN
 
const charget_attr (const char *node, const char *name, int *len) DECLSPEC_HIDDEN
 

Variables

typedef helpstring
 

Macro Definition Documentation

◆ BLOCK_BITS

#define BLOCK_BITS   12

Definition at line 22 of file stream.h.

◆ BLOCK_MASK

#define BLOCK_MASK   (BLOCK_SIZE-1)

Definition at line 24 of file stream.h.

◆ BLOCK_SIZE

#define BLOCK_SIZE   (1 << BLOCK_BITS)

Definition at line 23 of file stream.h.

Function Documentation

◆ get_attr()

const char* get_attr ( const char node,
const char name,
int len 
)

Definition at line 162 of file stream.c.

163 {
164  const char *ptr, *ptr2;
165  int name_len, node_len;
166  char name_buf[32];
167  char *node_buf;
168  int i;
169 
170  /* Create a lower case copy of the node */
171  node_len = strlen(node)+1;
172  node_buf = heap_alloc(node_len*sizeof(char));
173  if(!node_buf)
174  return NULL;
175  memcpy(node_buf, node, node_len);
176  for(i=0;i<node_len;i++)
177  node_buf[i] = tolower(node_buf[i]);
178  /* Create a lower case copy of the attribute name (search string) */
179  name_len = strlen(name);
180  memcpy(name_buf, name, name_len);
181  for(i=0;i<name_len;i++)
182  name_buf[i] = tolower(name_buf[i]);
183  name_buf[name_len++] = '=';
184  name_buf[name_len++] = '\"';
185  name_buf[name_len] = 0;
186 
187  ptr = strstr(node_buf, name_buf);
188  if(!ptr) {
189  WARN("name not found\n");
190  heap_free(node_buf);
191  return NULL;
192  }
193 
194  ptr += name_len;
195  ptr2 = strchr(ptr, '\"');
196  if(!ptr2)
197  {
198  heap_free(node_buf);
199  return NULL;
200  }
201 
202  *len = ptr2-ptr;
203  /* Return the pointer offset within the original string */
204  ptr = node+(ptr-node_buf);
205 
206  heap_free(node_buf);
207  return ptr;
208 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define WARN(fmt,...)
Definition: debug.h:111
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
char * strchr(const char *String, int ch)
Definition: utclib.c:501
Definition: name.c:36
int tolower(int c)
Definition: utclib.c:902
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
Definition: dlist.c:348

Referenced by parse_index_obj_node_param(), parse_li(), parse_obj_node_param(), and parse_ul().

◆ get_node_name()

void get_node_name ( strbuf_t node,
strbuf_t name 
)

Definition at line 88 of file stream.c.

89 {
90  const char *ptr = node->buf+1;
91 
93 
94  while(*ptr != '>' && !isspace(*ptr))
95  ptr++;
96 
97  strbuf_append(name, node->buf+1, ptr-node->buf-1);
98  strbuf_append(name, "", 1);
99 }
#define isspace(c)
Definition: acclib.h:69
static PVOID ptr
Definition: dispmode.c:27
static void strbuf_append(strbuf_t *buf, const char *data, int len)
Definition: stream.c:43
Definition: name.c:36
void strbuf_zero(strbuf_t *buf)
Definition: stream.c:33
Definition: dlist.c:348

Referenced by GetDocumentTitle(), parse_hhc(), parse_hhindex(), parse_index_sitemap_object(), parse_li(), parse_sitemap_object(), parse_ul(), and SearchCHM_File().

◆ next_content()

BOOL next_content ( stream_t stream,
strbuf_t buf 
)

Definition at line 105 of file stream.c.

106 {
107  if(!stream_chr(stream, buf, '<'))
108  return FALSE;
109 
110  return TRUE;
111 }
#define TRUE
Definition: types.h:120
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static BOOL stream_chr(stream_t *stream, strbuf_t *buf, char c)
Definition: stream.c:60
Definition: parse.h:22

Referenced by GetDocumentTitle(), and SearchCHM_File().

◆ next_node()

BOOL next_node ( stream_t stream,
strbuf_t buf 
)

Definition at line 140 of file stream.c.

141 {
142  /* find the beginning of the next node */
143  if(!stream_chr(stream, NULL, '<'))
144  return FALSE;
145 
146  /* read out the data of the next node */
147  if(!find_node_end(stream, buf))
148  return FALSE;
149 
150  strbuf_append(buf, ">", 2);
151 
152  return TRUE;
153 }
#define TRUE
Definition: types.h:120
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static BOOL stream_chr(stream_t *stream, strbuf_t *buf, char c)
Definition: stream.c:60
smooth NULL
Definition: ftsmooth.c:416
Definition: parse.h:22
static void strbuf_append(strbuf_t *buf, const char *data, int len)
Definition: stream.c:43
static BOOL find_node_end(stream_t *stream, strbuf_t *buf)
Definition: stream.c:113

Referenced by ext4_fs_xattr_iterate(), ext4_xattr_purge_items(), ext4_xattr_remove_item(), free_instr_list(), GetDocumentTitle(), parse_hhc(), parse_hhindex(), parse_index_sitemap_object(), parse_li(), parse_sitemap_object(), parse_ul(), and SearchCHM_File().

◆ strbuf_free()

void strbuf_free ( strbuf_t buf)

Definition at line 38 of file stream.c.

39 {
40  heap_free(buf->buf);
41 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by GetDocumentTitle(), parse_hhc(), parse_hhindex(), parse_index_sitemap_object(), parse_li(), parse_sitemap_object(), parse_ul(), and SearchCHM_File().

◆ strbuf_init()

void strbuf_init ( strbuf_t buf)

Definition at line 26 of file stream.c.

27 {
28  buf->size = 8;
29  buf->len = 0;
30  buf->buf = heap_alloc(buf->size);
31 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static void * heap_alloc(size_t len)
Definition: appwiz.h:65

◆ strbuf_zero()

void strbuf_zero ( strbuf_t buf)

Definition at line 33 of file stream.c.

34 {
35  buf->len = 0;
36 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751

Referenced by get_node_name(), GetDocumentTitle(), parse_hhc(), parse_hhindex(), parse_index_sitemap_object(), parse_li(), parse_sitemap_object(), parse_ul(), and SearchCHM_File().

◆ stream_init()

void stream_init ( stream_t stream,
IStream str 
)

Definition at line 54 of file stream.c.

55 {
56  memset(stream, 0, sizeof(stream_t));
57  stream->str = str;
58 }
const WCHAR * str
Definition: parse.h:22
#define memset(x, y, z)
Definition: compat.h:39

Referenced by GetDocumentTitle(), parse_hhc(), parse_hhindex(), and SearchCHM_File().

Variable Documentation

◆ helpstring

typedef helpstring