HTML Tidy  5.8.0
The HTACG Tidy HTML Project
tmbstr.h
Go to the documentation of this file.
1 #ifndef __TMBSTR_H__
2 #define __TMBSTR_H__
3 
4 /* tmbstr.h - Tidy string utility functions
5 
6  (c) 1998-2006 (W3C) MIT, ERCIM, Keio University
7  See tidy.h for the copyright notice.
8 
9 */
10 
11 #include "tidyplatform.h"
12 
13 #ifdef __cplusplus
14 extern "C"
15 {
16 #endif
17 
18 /* like strdup but using an allocator */
19 TY_PRIVATE tmbstr TY_(tmbstrdup)( TidyAllocator *allocator, ctmbstr str );
20 
21 /* like strndup but using an allocator */
22 TY_PRIVATE tmbstr TY_(tmbstrndup)( TidyAllocator *allocator, ctmbstr str, uint len);
23 
24 /* exactly same as strncpy */
25 TY_PRIVATE uint TY_(tmbstrncpy)( tmbstr s1, ctmbstr s2, uint size );
26 
27 TY_PRIVATE uint TY_(tmbstrcpy)( tmbstr s1, ctmbstr s2 );
28 
29 TY_PRIVATE uint TY_(tmbstrcat)( tmbstr s1, ctmbstr s2 );
30 
31 /* exactly same as strcmp */
32 TY_PRIVATE int TY_(tmbstrcmp)( ctmbstr s1, ctmbstr s2 );
33 
34 /* returns byte count, not char count */
35 TY_PRIVATE uint TY_(tmbstrlen)( ctmbstr str );
36 
37 /*
38  MS C 4.2 doesn't include strcasecmp.
39  Note that tolower and toupper won't
40  work on chars > 127.
41 
42  Neither do Lexer.ToLower() or Lexer.ToUpper()!
43 
44  We get away with this because, except for XML tags,
45  we are always comparing to ascii element and
46  attribute names defined by HTML specs.
47 */
48 TY_PRIVATE int TY_(tmbstrcasecmp)( ctmbstr s1, ctmbstr s2 );
49 
50 TY_PRIVATE int TY_(tmbstrncmp)( ctmbstr s1, ctmbstr s2, uint n );
51 
52 TY_PRIVATE int TY_(tmbstrncasecmp)( ctmbstr s1, ctmbstr s2, uint n );
53 
54 /* return offset of cc from beginning of s1,
55 ** -1 if not found.
56 */
57 /* TY_PRIVATE int TY_(tmbstrnchr)( ctmbstr s1, uint len1, tmbchar cc ); */
58 
59 TY_PRIVATE ctmbstr TY_(tmbsubstrn)( ctmbstr s1, uint len1, ctmbstr s2 );
60 /* TY_PRIVATE ctmbstr TY_(tmbsubstrncase)( ctmbstr s1, uint len1, ctmbstr s2 ); */
61 TY_PRIVATE ctmbstr TY_(tmbsubstr)( ctmbstr s1, ctmbstr s2 );
62 
63 /* transform string to lower case */
64 TY_PRIVATE tmbstr TY_(tmbstrtolower)( tmbstr s );
65 
66 /* Transform ASCII chars in string to upper case */
67 TY_PRIVATE tmbstr TY_(tmbstrtoupper)( tmbstr s );
68 
69 /* TY_PRIVATE Bool TY_(tmbsamefile)( ctmbstr filename1, ctmbstr filename2 ); */
70 
71 TY_PRIVATE int TY_(tmbvsnprintf)(tmbstr buffer, size_t count, ctmbstr format, va_list args)
72 #ifdef __GNUC__
73 __attribute__((format(printf, 3, 0)))
74 #endif
75 ;
76 TY_PRIVATE int TY_(tmbsnprintf)(tmbstr buffer, size_t count, ctmbstr format, ...)
77 #ifdef __GNUC__
78 __attribute__((format(printf, 3, 4)))
79 #endif
80 ;
81 
82 #ifdef __cplusplus
83 } /* extern "C" */
84 #endif
85 
86 #endif /* __TMBSTR_H__ */
#define TY_PRIVATE
Definition: forward.h:29
#define TY_(str)
Definition: forward.h:23
Platform specific definitions, specifics, and headers.
unsigned int uint
Definition: tidyplatform.h:569
const tmbchar * ctmbstr
Definition: tidyplatform.h:609
tmbchar * tmbstr
Definition: tidyplatform.h:608