~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Include/unicodeobject.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-04-08 02:29:05 UTC
  • mto: (10.1.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20090408022905-xa5zbe8821m2o77o
Tags: upstream-2.6.2~rc1
ImportĀ upstreamĀ versionĀ 2.6.2~rc1

Show diffs side-by-side

added added

removed removed

Lines of Context:
130
130
typedef unsigned long Py_UCS4; 
131
131
#endif
132
132
 
 
133
/* Py_UNICODE is the native Unicode storage format (code unit) used by
 
134
   Python and represents a single Unicode element in the Unicode
 
135
   type. */
 
136
 
133
137
typedef PY_UNICODE_TYPE Py_UNICODE;
134
138
 
135
139
/* --- UCS-2/UCS-4 Name Mangling ------------------------------------------ */
153
157
# define PyUnicode_AsUnicode PyUnicodeUCS2_AsUnicode
154
158
# define PyUnicode_AsUnicodeEscapeString PyUnicodeUCS2_AsUnicodeEscapeString
155
159
# define PyUnicode_AsWideChar PyUnicodeUCS2_AsWideChar
 
160
# define PyUnicode_ClearFreeList PyUnicodeUCS2_ClearFreelist
156
161
# define PyUnicode_Compare PyUnicodeUCS2_Compare
157
162
# define PyUnicode_Concat PyUnicodeUCS2_Concat
158
163
# define PyUnicode_Contains PyUnicodeUCS2_Contains
182
187
# define PyUnicode_Find PyUnicodeUCS2_Find
183
188
# define PyUnicode_Format PyUnicodeUCS2_Format
184
189
# define PyUnicode_FromEncodedObject PyUnicodeUCS2_FromEncodedObject
 
190
# define PyUnicode_FromFormat PyUnicodeUCS2_FromFormat
 
191
# define PyUnicode_FromFormatV PyUnicodeUCS2_FromFormatV
185
192
# define PyUnicode_FromObject PyUnicodeUCS2_FromObject
186
193
# define PyUnicode_FromOrdinal PyUnicodeUCS2_FromOrdinal
187
 
# define PyUnicode_FromUnicode PyUnicodeUCS2_FromUnicode
188
194
# define PyUnicode_FromString PyUnicodeUCS2_FromString
189
195
# define PyUnicode_FromStringAndSize PyUnicodeUCS2_FromStringAndSize
190
 
# define PyUnicode_FromFormatV PyUnicodeUCS2_FromFormatV
191
 
# define PyUnicode_FromFormat PyUnicodeUCS2_FromFormat
 
196
# define PyUnicode_FromUnicode PyUnicodeUCS2_FromUnicode
192
197
# define PyUnicode_FromWideChar PyUnicodeUCS2_FromWideChar
193
198
# define PyUnicode_GetDefaultEncoding PyUnicodeUCS2_GetDefaultEncoding
194
199
# define PyUnicode_GetMax PyUnicodeUCS2_GetMax
209
214
# define _PyUnicode_AsDefaultEncodedString _PyUnicodeUCS2_AsDefaultEncodedString
210
215
# define _PyUnicode_Fini _PyUnicodeUCS2_Fini
211
216
# define _PyUnicode_Init _PyUnicodeUCS2_Init
212
 
# define PyUnicode_ClearFreeList PyUnicodeUCS2_ClearFreelist
213
217
# define _PyUnicode_IsAlpha _PyUnicodeUCS2_IsAlpha
214
218
# define _PyUnicode_IsDecimalDigit _PyUnicodeUCS2_IsDecimalDigit
215
219
# define _PyUnicode_IsDigit _PyUnicodeUCS2_IsDigit
240
244
# define PyUnicode_AsUnicode PyUnicodeUCS4_AsUnicode
241
245
# define PyUnicode_AsUnicodeEscapeString PyUnicodeUCS4_AsUnicodeEscapeString
242
246
# define PyUnicode_AsWideChar PyUnicodeUCS4_AsWideChar
 
247
# define PyUnicode_ClearFreeList PyUnicodeUCS4_ClearFreelist
243
248
# define PyUnicode_Compare PyUnicodeUCS4_Compare
244
249
# define PyUnicode_Concat PyUnicodeUCS4_Concat
245
250
# define PyUnicode_Contains PyUnicodeUCS4_Contains
269
274
# define PyUnicode_Find PyUnicodeUCS4_Find
270
275
# define PyUnicode_Format PyUnicodeUCS4_Format
271
276
# define PyUnicode_FromEncodedObject PyUnicodeUCS4_FromEncodedObject
 
277
# define PyUnicode_FromFormat PyUnicodeUCS4_FromFormat
 
278
# define PyUnicode_FromFormatV PyUnicodeUCS4_FromFormatV
272
279
# define PyUnicode_FromObject PyUnicodeUCS4_FromObject
273
280
# define PyUnicode_FromOrdinal PyUnicodeUCS4_FromOrdinal
274
 
# define PyUnicode_FromUnicode PyUnicodeUCS4_FromUnicode
275
281
# define PyUnicode_FromString PyUnicodeUCS4_FromString
276
282
# define PyUnicode_FromStringAndSize PyUnicodeUCS4_FromStringAndSize
277
 
# define PyUnicode_FromFormatV PyUnicodeUCS4_FromFormatV
278
 
# define PyUnicode_FromFormat PyUnicodeUCS4_FromFormat
 
283
# define PyUnicode_FromUnicode PyUnicodeUCS4_FromUnicode
279
284
# define PyUnicode_FromWideChar PyUnicodeUCS4_FromWideChar
280
285
# define PyUnicode_GetDefaultEncoding PyUnicodeUCS4_GetDefaultEncoding
281
286
# define PyUnicode_GetMax PyUnicodeUCS4_GetMax
296
301
# define _PyUnicode_AsDefaultEncodedString _PyUnicodeUCS4_AsDefaultEncodedString
297
302
# define _PyUnicode_Fini _PyUnicodeUCS4_Fini
298
303
# define _PyUnicode_Init _PyUnicodeUCS4_Init
299
 
# define PyUnicode_ClearFreeList PyUnicodeUCS2_ClearFreelist
300
304
# define _PyUnicode_IsAlpha _PyUnicodeUCS4_IsAlpha
301
305
# define _PyUnicode_IsDecimalDigit _PyUnicodeUCS4_IsDecimalDigit
302
306
# define _PyUnicode_IsDigit _PyUnicodeUCS4_IsDigit
350
354
 
351
355
#else
352
356
 
353
 
/* Since splitting on whitespace is an important use case, and whitespace
354
 
   in most situations is solely ASCII whitespace, we optimize for the common
355
 
   case by using a quick look-up table with an inlined check.
 
357
/* Since splitting on whitespace is an important use case, and
 
358
   whitespace in most situations is solely ASCII whitespace, we
 
359
   optimize for the common case by using a quick look-up table
 
360
   _Py_ascii_whitespace (see below) with an inlined check.
 
361
 
356
362
 */
357
 
PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[];
358
 
 
359
363
#define Py_UNICODE_ISSPACE(ch) \
360
364
        ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch))
361
365
 
389
393
#define Py_UNICODE_COPY(target, source, length)                         \
390
394
        Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE))
391
395
 
392
 
#define Py_UNICODE_FILL(target, value, length) do\
393
 
    {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\
 
396
#define Py_UNICODE_FILL(target, value, length) \
 
397
    do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\
394
398
        for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\
395
399
    } while (0)
396
400
 
397
 
/* check if substring matches at given offset.  the offset must be
 
401
/* Check if substring matches at given offset.  the offset must be
398
402
   valid, and the substring must not be empty */
 
403
 
399
404
#define Py_UNICODE_MATCH(string, offset, substring) \
400
405
    ((*((string)->str + (offset)) == *((substring)->str)) && \
401
406
    ((*((string)->str + (offset) + (substring)->length-1) == *((substring)->str + (substring)->length-1))) && \
405
410
extern "C" {
406
411
#endif
407
412
 
408
 
PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);
409
 
 
410
413
/* --- Unicode Type ------------------------------------------------------- */
411
414
 
412
415
typedef struct {
605
608
 
606
609
PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal);
607
610
 
 
611
/* --- Free-list management ----------------------------------------------- */
 
612
 
 
613
/* Clear the free list used by the Unicode implementation.
 
614
 
 
615
   This can be used to release memory used for objects on the free
 
616
   list back to the Python memory allocator.
 
617
 
 
618
*/
 
619
 
 
620
PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);
 
621
 
608
622
/* === Builtin Codecs ===================================================== 
609
623
 
610
624
   Many of these APIs take two arguments encoding and errors. These
1323
1337
 
1324
1338
/* === Characters Type APIs =============================================== */
1325
1339
 
 
1340
/* Helper array used by Py_UNICODE_ISSPACE(). */
 
1341
 
 
1342
PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[];
 
1343
 
1326
1344
/* These should not be used directly. Use the Py_UNICODE_IS* and
1327
1345
   Py_UNICODE_TO* macros instead. 
1328
1346