HTML Tidy
0.1
|
00001 #ifndef __TMBSTR_H__ 00002 #define __TMBSTR_H__ 00003 00004 /* tmbstr.h - Tidy string utility functions 00005 00006 (c) 1998-2006 (W3C) MIT, ERCIM, Keio University 00007 See tidy.h for the copyright notice. 00008 00009 CVS Info : 00010 00011 $Author: arnaud02 $ 00012 $Date: 2006/12/29 16:31:09 $ 00013 $Revision: 1.11 $ 00014 00015 */ 00016 00017 #include "platform.h" 00018 00019 #ifdef __cplusplus 00020 extern "C" 00021 { 00022 #endif 00023 00024 /* like strdup but using an allocator */ 00025 tmbstr TY_(tmbstrdup)( TidyAllocator *allocator, ctmbstr str ); 00026 00027 /* like strndup but using an allocator */ 00028 tmbstr TY_(tmbstrndup)( TidyAllocator *allocator, ctmbstr str, uint len); 00029 00030 /* exactly same as strncpy */ 00031 uint TY_(tmbstrncpy)( tmbstr s1, ctmbstr s2, uint size ); 00032 00033 uint TY_(tmbstrcpy)( tmbstr s1, ctmbstr s2 ); 00034 00035 uint TY_(tmbstrcat)( tmbstr s1, ctmbstr s2 ); 00036 00037 /* exactly same as strcmp */ 00038 int TY_(tmbstrcmp)( ctmbstr s1, ctmbstr s2 ); 00039 00040 /* returns byte count, not char count */ 00041 uint TY_(tmbstrlen)( ctmbstr str ); 00042 00043 /* 00044 MS C 4.2 doesn't include strcasecmp. 00045 Note that tolower and toupper won't 00046 work on chars > 127. 00047 00048 Neither do Lexer.ToLower() or Lexer.ToUpper()! 00049 00050 We get away with this because, except for XML tags, 00051 we are always comparing to ascii element and 00052 attribute names defined by HTML specs. 00053 */ 00054 int TY_(tmbstrcasecmp)( ctmbstr s1, ctmbstr s2 ); 00055 00056 int TY_(tmbstrncmp)( ctmbstr s1, ctmbstr s2, uint n ); 00057 00058 int TY_(tmbstrncasecmp)( ctmbstr s1, ctmbstr s2, uint n ); 00059 00060 /* return offset of cc from beginning of s1, 00061 ** -1 if not found. 00062 */ 00063 /* int TY_(tmbstrnchr)( ctmbstr s1, uint len1, tmbchar cc ); */ 00064 00065 ctmbstr TY_(tmbsubstrn)( ctmbstr s1, uint len1, ctmbstr s2 ); 00066 /* ctmbstr TY_(tmbsubstrncase)( ctmbstr s1, uint len1, ctmbstr s2 ); */ 00067 ctmbstr TY_(tmbsubstr)( ctmbstr s1, ctmbstr s2 ); 00068 00069 /* transform string to lower case */ 00070 tmbstr TY_(tmbstrtolower)( tmbstr s ); 00071 00072 /* Transform ASCII chars in string to upper case */ 00073 tmbstr TY_(tmbstrtoupper)( tmbstr s ); 00074 00075 /* Bool TY_(tmbsamefile)( ctmbstr filename1, ctmbstr filename2 ); */ 00076 00077 int TY_(tmbvsnprintf)(tmbstr buffer, size_t count, ctmbstr format, va_list args) 00078 #ifdef __GNUC__ 00079 __attribute__((format(printf, 3, 0))) 00080 #endif 00081 ; 00082 int TY_(tmbsnprintf)(tmbstr buffer, size_t count, ctmbstr format, ...) 00083 #ifdef __GNUC__ 00084 __attribute__((format(printf, 3, 4))) 00085 #endif 00086 ; 00087 00088 #ifdef __cplusplus 00089 } /* extern "C" */ 00090 #endif 00091 00092 #endif /* __TMBSTR_H__ */