~ubuntu-branches/ubuntu/gutsy/tidy/gutsy

« back to all changes in this revision

Viewing changes to src/tmbstr.h

  • Committer: Bazaar Package Importer
  • Author(s): Jason Thomas
  • Date: 2005-04-20 11:22:49 UTC
  • mfrom: (0.2.1 upstream) (1.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050420112249-mygnr5vcrutwsen3
Tags: 20050415-1
New upstream release 

Show diffs side-by-side

added added

removed removed

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