aa7b9a7281f365bde0a07df260c89b9b57e06474
[reactos.git] / rosapps / smartpdf / baseutils / dstring.h
1 /****************************************************************************
2 * Dynamic strings
3 ****************************************************************************/
4
5 /*
6 * tcl.h --
7 *
8 * This header file describes the externally-visible facilities
9 * of the Tcl interpreter.
10 *
11 * Copyright (c) 1987-1994 The Regents of the University of California.
12 * Copyright (c) 1994-1996 Sun Microsystems, Inc.
13 *
14 * See the file "license.terms" for information on usage and redistribution
15 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
16 *
17 * SCCS: @(#) tcl.h 1.283 96/10/02 17:17:39
18 */
19 #ifndef DSTRING_H
20 #define DSTRING_H
21
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif
26
27 #define kDstringStaticSize 200
28
29 typedef struct DString {
30 char *pString; /* Points to beginning of string: either
31 * staticSpace below or a malloc'ed array. */
32 int length; /* Number of non-NULL characters in the
33 * string. */
34 int spaceAvl; /* Total number of bytes available for the
35 * string and its terminating NULL char. */
36 char staticSpace[kDstringStaticSize];
37 /* Space to use in common case where string
38 * is small. */
39 } DString;
40
41 #define DStringLength(dsPtr) ((dsPtr)->length)
42 #define DStringValue(dsPtr) ((dsPtr)->pString)
43 #define DStringTrunc DStringSetLength
44
45 char*
46 DStringAppend(DString* dsPtr,
47 const char* string,
48 int length);
49
50 void
51 DStringFree(DString* dsPtr);
52
53 void
54 DStringInit(DString* dsPtr);
55
56 void
57 DStringSetLength(DString* dsPtr,
58 int length);
59
60 void
61 DStringSprintf(DString* pDs,
62 const char* pFormat,
63 ...);
64 char*
65 DStringAppendLowerCase(DString* pDs,
66 const char* pIn,
67 int length);
68
69 #ifdef __cplusplus
70 }
71 #endif
72
73 #endif