Changeset 388 for python/vendor/current/Include/unicodeobject.h
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Include/unicodeobject.h
r2 r388 29 29 * -------------------------------------------------------------------- 30 30 * This Unicode String Type is 31 * 31 * 32 32 * Copyright (c) 1999 by Secret Labs AB 33 33 * Copyright (c) 1999 by Fredrik Lundh 34 * 34 * 35 35 * By obtaining, using, and/or copying this software and/or its 36 36 * associated documentation, you agree that you have read, understood, 37 37 * and will comply with the following terms and conditions: 38 * 38 * 39 39 * Permission to use, copy, modify, and distribute this software and its 40 40 * associated documentation for any purpose and without fee is hereby … … 45 45 * distribution of the software without specific, written prior 46 46 * permission. 47 * 47 * 48 48 * SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO 49 49 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND … … 125 125 * as single unsigned integer. 126 126 */ 127 #if SIZEOF_INT >= 4 128 typedef unsigned int Py_UCS4; 127 #if SIZEOF_INT >= 4 128 typedef unsigned int Py_UCS4; 129 129 #elif SIZEOF_LONG >= 4 130 typedef unsigned long Py_UCS4; 130 typedef unsigned long Py_UCS4; 131 131 #endif 132 132 … … 362 362 */ 363 363 #define Py_UNICODE_ISSPACE(ch) \ 364 364 ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch)) 365 365 366 366 #define Py_UNICODE_ISLOWER(ch) _PyUnicode_IsLowercase(ch) … … 387 387 #define Py_UNICODE_ISALNUM(ch) \ 388 388 (Py_UNICODE_ISALPHA(ch) || \ 389 390 391 392 393 #define Py_UNICODE_COPY(target, source, length) 394 389 Py_UNICODE_ISDECIMAL(ch) || \ 390 Py_UNICODE_ISDIGIT(ch) || \ 391 Py_UNICODE_ISNUMERIC(ch)) 392 393 #define Py_UNICODE_COPY(target, source, length) \ 394 Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE)) 395 395 396 396 #define Py_UNICODE_FILL(target, value, length) \ 397 397 do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\ 398 398 for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\ 399 399 } while (0) 400 400 … … 415 415 typedef struct { 416 416 PyObject_HEAD 417 Py_ssize_t length; 418 Py_UNICODE *str; 419 long hash; 420 PyObject *defenc; 421 422 417 Py_ssize_t length; /* Length of raw Unicode data in buffer */ 418 Py_UNICODE *str; /* Raw Unicode buffer */ 419 long hash; /* Hash value; -1 if not set */ 420 PyObject *defenc; /* (Default) Encoded version as Python 421 string, or NULL; this is used for 422 implementing the buffer protocol */ 423 423 } PyUnicodeObject; 424 424 … … 431 431 /* Fast access macros */ 432 432 #define PyUnicode_GET_SIZE(op) \ 433 433 (((PyUnicodeObject *)(op))->length) 434 434 #define PyUnicode_GET_DATA_SIZE(op) \ 435 435 (((PyUnicodeObject *)(op))->length * sizeof(Py_UNICODE)) 436 436 #define PyUnicode_AS_UNICODE(op) \ 437 437 (((PyUnicodeObject *)(op))->str) 438 438 #define PyUnicode_AS_DATA(op) \ 439 439 ((const char *)((PyUnicodeObject *)(op))->str) 440 440 441 441 /* --- Constants ---------------------------------------------------------- */ … … 453 453 454 454 /* Create a Unicode Object from the Py_UNICODE buffer u of the given 455 size. 455 size. 456 456 457 457 u may be NULL which causes the contents to be undefined. It is the … … 483 483 484 484 PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( 485 PyObject *unicode 485 PyObject *unicode /* Unicode object */ 486 486 ); 487 487 … … 489 489 490 490 PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize( 491 PyObject *unicode 491 PyObject *unicode /* Unicode object */ 492 492 ); 493 493 … … 510 510 511 511 PyAPI_FUNC(int) PyUnicode_Resize( 512 PyObject **unicode, 513 Py_ssize_t length 512 PyObject **unicode, /* Pointer to the Unicode object */ 513 Py_ssize_t length /* New length */ 514 514 ); 515 515 … … 532 532 533 533 PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject( 534 register PyObject *obj, 534 register PyObject *obj, /* Object */ 535 535 const char *encoding, /* encoding */ 536 536 const char *errors /* error handling */ … … 539 539 /* Coerce obj to an Unicode object and return a reference with 540 540 *incremented* refcount. 541 541 542 542 Unicode objects are passed back as-is (subclasses are converted to 543 543 true Unicode objects), all other objects are delegated to … … 551 551 552 552 PyAPI_FUNC(PyObject*) PyUnicode_FromObject( 553 register PyObject *obj 553 register PyObject *obj /* Object */ 554 554 ); 555 555 … … 560 560 (Advanced String Formatting). */ 561 561 PyAPI_FUNC(PyObject *) _PyUnicode_FormatAdvanced(PyObject *obj, 562 563 562 Py_UNICODE *format_spec, 563 Py_ssize_t format_spec_len); 564 564 565 565 /* --- wchar_t support for platforms which support it --------------------- */ … … 599 599 /* --- Unicode ordinals --------------------------------------------------- */ 600 600 601 /* Create a Unicode Object from the given Unicode code point ordinal. 602 601 /* Create a Unicode Object from the given Unicode code point ordinal. 602 603 603 The ordinal must be in range(0x10000) on narrow Python builds 604 604 (UCS2), and range(0x110000) on wide builds (UCS4). A ValueError is … … 620 620 PyAPI_FUNC(int) PyUnicode_ClearFreeList(void); 621 621 622 /* === Builtin Codecs ===================================================== 622 /* === Builtin Codecs ===================================================== 623 623 624 624 Many of these APIs take two arguments encoding and errors. These 625 625 parameters encoding and errors have the same semantics as the ones 626 of the builtin unicode() API. 626 of the builtin unicode() API. 627 627 628 628 Setting encoding to NULL causes the default encoding to be used. … … 641 641 642 642 /* Return a Python string holding the default encoded value of the 643 Unicode object. 643 Unicode object. 644 644 645 645 The resulting string is cached in the Unicode object for subsequent … … 663 663 interpreter to become a parameter which is managed on a per-thread 664 664 basis. 665 665 666 666 */ 667 667 … … 671 671 672 672 Returns 0 on success, -1 in case of an error. 673 673 674 674 */ 675 675 676 676 PyAPI_FUNC(int) PyUnicode_SetDefaultEncoding( 677 const char *encoding 677 const char *encoding /* Encoding name in standard form */ 678 678 ); 679 679 … … 690 690 ); 691 691 692 /* Encodes a Py_UNICODE buffer of the given size and returns a 692 /* Encodes a Py_UNICODE buffer of the given size and returns a 693 693 Python string object. */ 694 694 … … 704 704 705 705 PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject( 706 PyObject *unicode, 707 const char *encoding, 708 const char *errors 706 PyObject *unicode, /* Unicode object */ 707 const char *encoding, /* encoding */ 708 const char *errors /* error handling */ 709 709 ); 710 710 … … 713 713 714 714 PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString( 715 PyObject *unicode, 716 const char *encoding, 717 const char *errors 715 PyObject *unicode, /* Unicode object */ 716 const char *encoding, /* encoding */ 717 const char *errors /* error handling */ 718 718 ); 719 719 … … 726 726 727 727 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7( 728 const char *string, 729 Py_ssize_t length, 730 const char *errors 728 const char *string, /* UTF-7 encoded string */ 729 Py_ssize_t length, /* size of string */ 730 const char *errors /* error handling */ 731 731 ); 732 732 733 733 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful( 734 const char *string, 735 Py_ssize_t length, 736 const char *errors, 737 Py_ssize_t *consumed 734 const char *string, /* UTF-7 encoded string */ 735 Py_ssize_t length, /* size of string */ 736 const char *errors, /* error handling */ 737 Py_ssize_t *consumed /* bytes consumed */ 738 738 ); 739 739 740 740 PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7( 741 const Py_UNICODE *data, /* Unicode char buffer */ 742 Py_ssize_t length, /* number of Py_UNICODE chars to encode */ 743 int encodeSetO, /* force the encoder to encode characters in 744 Set O, as described in RFC2152 */ 745 int encodeWhiteSpace, /* force the encoder to encode space, tab, 746 carriage return and linefeed characters */ 747 const char *errors /* error handling */ 741 const Py_UNICODE *data, /* Unicode char buffer */ 742 Py_ssize_t length, /* number of Py_UNICODE chars to encode */ 743 int base64SetO, /* Encode RFC2152 Set O characters in base64 */ 744 int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */ 745 const char *errors /* error handling */ 748 746 ); 749 747 … … 751 749 752 750 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8( 753 const char *string, 754 Py_ssize_t length, 755 const char *errors 751 const char *string, /* UTF-8 encoded string */ 752 Py_ssize_t length, /* size of string */ 753 const char *errors /* error handling */ 756 754 ); 757 755 758 756 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful( 759 const char *string, 760 Py_ssize_t length, 761 const char *errors, 762 Py_ssize_t *consumed 757 const char *string, /* UTF-8 encoded string */ 758 Py_ssize_t length, /* size of string */ 759 const char *errors, /* error handling */ 760 Py_ssize_t *consumed /* bytes consumed */ 763 761 ); 764 762 765 763 PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String( 766 PyObject *unicode 764 PyObject *unicode /* Unicode object */ 767 765 ); 768 766 769 767 PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( 770 const Py_UNICODE *data, 771 Py_ssize_t length, 772 const char *errors 768 const Py_UNICODE *data, /* Unicode char buffer */ 769 Py_ssize_t length, /* number of Py_UNICODE chars to encode */ 770 const char *errors /* error handling */ 773 771 ); 774 772 … … 779 777 780 778 errors (if non-NULL) defines the error handling. It defaults 781 to "strict". 779 to "strict". 782 780 783 781 If byteorder is non-NULL, the decoder starts decoding using the 784 782 given byte order: 785 783 786 787 788 784 *byteorder == -1: little endian 785 *byteorder == 0: native order 786 *byteorder == 1: big endian 789 787 790 788 In native mode, the first four bytes of the stream are checked for a … … 799 797 800 798 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32( 801 const char *string, 802 Py_ssize_t length, 803 const char *errors, 804 int *byteorder 805 806 799 const char *string, /* UTF-32 encoded string */ 800 Py_ssize_t length, /* size of string */ 801 const char *errors, /* error handling */ 802 int *byteorder /* pointer to byteorder to use 803 0=native;-1=LE,1=BE; updated on 804 exit */ 807 805 ); 808 806 809 807 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful( 810 const char *string, 811 Py_ssize_t length, 812 const char *errors, 813 int *byteorder, 814 815 816 Py_ssize_t *consumed 808 const char *string, /* UTF-32 encoded string */ 809 Py_ssize_t length, /* size of string */ 810 const char *errors, /* error handling */ 811 int *byteorder, /* pointer to byteorder to use 812 0=native;-1=LE,1=BE; updated on 813 exit */ 814 Py_ssize_t *consumed /* bytes consumed */ 817 815 ); 818 816 … … 821 819 822 820 PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String( 823 PyObject *unicode 821 PyObject *unicode /* Unicode object */ 824 822 ); 825 823 … … 841 839 842 840 PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32( 843 const Py_UNICODE *data, 844 Py_ssize_t length, 845 const char *errors, 846 int byteorder 841 const Py_UNICODE *data, /* Unicode char buffer */ 842 Py_ssize_t length, /* number of Py_UNICODE chars to encode */ 843 const char *errors, /* error handling */ 844 int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ 847 845 ); 848 846 … … 853 851 854 852 errors (if non-NULL) defines the error handling. It defaults 855 to "strict". 853 to "strict". 856 854 857 855 If byteorder is non-NULL, the decoder starts decoding using the 858 856 given byte order: 859 857 860 861 862 858 *byteorder == -1: little endian 859 *byteorder == 0: native order 860 *byteorder == 1: big endian 863 861 864 862 In native mode, the first two bytes of the stream are checked for a … … 873 871 874 872 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16( 875 const char *string, 876 Py_ssize_t length, 877 const char *errors, 878 int *byteorder 879 880 873 const char *string, /* UTF-16 encoded string */ 874 Py_ssize_t length, /* size of string */ 875 const char *errors, /* error handling */ 876 int *byteorder /* pointer to byteorder to use 877 0=native;-1=LE,1=BE; updated on 878 exit */ 881 879 ); 882 880 883 881 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful( 884 const char *string, 885 Py_ssize_t length, 886 const char *errors, 887 int *byteorder, 888 889 890 Py_ssize_t *consumed 882 const char *string, /* UTF-16 encoded string */ 883 Py_ssize_t length, /* size of string */ 884 const char *errors, /* error handling */ 885 int *byteorder, /* pointer to byteorder to use 886 0=native;-1=LE,1=BE; updated on 887 exit */ 888 Py_ssize_t *consumed /* bytes consumed */ 891 889 ); 892 890 … … 895 893 896 894 PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( 897 PyObject *unicode 895 PyObject *unicode /* Unicode object */ 898 896 ); 899 897 … … 919 917 920 918 PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16( 921 const Py_UNICODE *data, 922 Py_ssize_t length, 923 const char *errors, 924 int byteorder 919 const Py_UNICODE *data, /* Unicode char buffer */ 920 Py_ssize_t length, /* number of Py_UNICODE chars to encode */ 921 const char *errors, /* error handling */ 922 int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ 925 923 ); 926 924 … … 928 926 929 927 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape( 930 const char *string, 931 Py_ssize_t length, 932 const char *errors 928 const char *string, /* Unicode-Escape encoded string */ 929 Py_ssize_t length, /* size of string */ 930 const char *errors /* error handling */ 933 931 ); 934 932 935 933 PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( 936 PyObject *unicode 934 PyObject *unicode /* Unicode object */ 937 935 ); 938 936 939 937 PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape( 940 const Py_UNICODE *data, 941 Py_ssize_t length 938 const Py_UNICODE *data, /* Unicode char buffer */ 939 Py_ssize_t length /* Number of Py_UNICODE chars to encode */ 942 940 ); 943 941 … … 945 943 946 944 PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape( 947 const char *string, 948 Py_ssize_t length, 949 const char *errors 945 const char *string, /* Raw-Unicode-Escape encoded string */ 946 Py_ssize_t length, /* size of string */ 947 const char *errors /* error handling */ 950 948 ); 951 949 952 950 PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString( 953 PyObject *unicode 951 PyObject *unicode /* Unicode object */ 954 952 ); 955 953 956 954 PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape( 957 const Py_UNICODE *data, 958 Py_ssize_t length 955 const Py_UNICODE *data, /* Unicode char buffer */ 956 Py_ssize_t length /* Number of Py_UNICODE chars to encode */ 959 957 ); 960 958 … … 969 967 ); 970 968 971 /* --- Latin-1 Codecs ----------------------------------------------------- 969 /* --- Latin-1 Codecs ----------------------------------------------------- 972 970 973 971 Note: Latin-1 corresponds to the first 256 Unicode ordinals. … … 976 974 977 975 PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1( 978 const char *string, 979 Py_ssize_t length, 980 const char *errors 976 const char *string, /* Latin-1 encoded string */ 977 Py_ssize_t length, /* size of string */ 978 const char *errors /* error handling */ 981 979 ); 982 980 983 981 PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String( 984 PyObject *unicode 982 PyObject *unicode /* Unicode object */ 985 983 ); 986 984 987 985 PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1( 988 const Py_UNICODE *data, 989 Py_ssize_t length, 990 const char *errors 991 ); 992 993 /* --- ASCII Codecs ------------------------------------------------------- 986 const Py_UNICODE *data, /* Unicode char buffer */ 987 Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ 988 const char *errors /* error handling */ 989 ); 990 991 /* --- ASCII Codecs ------------------------------------------------------- 994 992 995 993 Only 7-bit ASCII data is excepted. All other codes generate errors. … … 998 996 999 997 PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII( 1000 const char *string, 1001 Py_ssize_t length, 1002 const char *errors 998 const char *string, /* ASCII encoded string */ 999 Py_ssize_t length, /* size of string */ 1000 const char *errors /* error handling */ 1003 1001 ); 1004 1002 1005 1003 PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString( 1006 PyObject *unicode 1004 PyObject *unicode /* Unicode object */ 1007 1005 ); 1008 1006 1009 1007 PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( 1010 const Py_UNICODE *data, 1011 Py_ssize_t length, 1012 const char *errors 1013 ); 1014 1015 /* --- Character Map Codecs ----------------------------------------------- 1016 1017 This codec uses mappings to encode and decode characters. 1008 const Py_UNICODE *data, /* Unicode char buffer */ 1009 Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ 1010 const char *errors /* error handling */ 1011 ); 1012 1013 /* --- Character Map Codecs ----------------------------------------------- 1014 1015 This codec uses mappings to encode and decode characters. 1018 1016 1019 1017 Decoding mappings must map single string characters to single … … 1036 1034 1037 1035 PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap( 1038 const char *string, 1039 Py_ssize_t length, 1040 PyObject *mapping, /* character mapping1041 1042 const char *errors 1036 const char *string, /* Encoded string */ 1037 Py_ssize_t length, /* size of string */ 1038 PyObject *mapping, /* character mapping 1039 (char ordinal -> unicode ordinal) */ 1040 const char *errors /* error handling */ 1043 1041 ); 1044 1042 1045 1043 PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString( 1046 PyObject *unicode, 1047 PyObject *mapping /* character mapping1048 1044 PyObject *unicode, /* Unicode object */ 1045 PyObject *mapping /* character mapping 1046 (unicode ordinal -> char ordinal) */ 1049 1047 ); 1050 1048 1051 1049 PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( 1052 const Py_UNICODE *data, 1053 Py_ssize_t length, 1054 PyObject *mapping, /* character mapping1055 1056 const char *errors 1050 const Py_UNICODE *data, /* Unicode char buffer */ 1051 Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ 1052 PyObject *mapping, /* character mapping 1053 (unicode ordinal -> char ordinal) */ 1054 const char *errors /* error handling */ 1057 1055 ); 1058 1056 … … 1062 1060 1063 1061 The mapping table must map Unicode ordinal integers to Unicode 1064 ordinal integers or None (causing deletion of the character). 1062 ordinal integers or None (causing deletion of the character). 1065 1063 1066 1064 Mapping tables may be dictionaries or sequences. Unmapped character … … 1071 1069 1072 1070 PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap( 1073 const Py_UNICODE *data, 1074 Py_ssize_t length, 1075 PyObject *table, 1076 const char *errors 1071 const Py_UNICODE *data, /* Unicode char buffer */ 1072 Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ 1073 PyObject *table, /* Translate table */ 1074 const char *errors /* error handling */ 1077 1075 ); 1078 1076 … … 1123 1121 NULL or "strict": raise a ValueError 1124 1122 "ignore": ignore the wrong characters (these are not copied to the 1125 1123 output buffer) 1126 1124 "replace": replaces illegal characters with '?' 1127 1125 … … 1131 1129 1132 1130 PyAPI_FUNC(int) PyUnicode_EncodeDecimal( 1133 Py_UNICODE *s, 1134 Py_ssize_t length, 1135 char *output, 1136 const char *errors 1131 Py_UNICODE *s, /* Unicode buffer */ 1132 Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ 1133 char *output, /* Output buffer; must have size >= length */ 1134 const char *errors /* error handling */ 1137 1135 ); 1138 1136 … … 1146 1144 1147 1145 PyAPI_FUNC(PyObject*) PyUnicode_Concat( 1148 PyObject *left, 1149 PyObject *right 1146 PyObject *left, /* Left string */ 1147 PyObject *right /* Right string */ 1150 1148 ); 1151 1149 … … 1162 1160 1163 1161 PyAPI_FUNC(PyObject*) PyUnicode_Split( 1164 PyObject *s, 1165 PyObject *sep, 1166 Py_ssize_t maxsplit 1167 ); 1162 PyObject *s, /* String to split */ 1163 PyObject *sep, /* String separator */ 1164 Py_ssize_t maxsplit /* Maxsplit count */ 1165 ); 1168 1166 1169 1167 /* Dito, but split at line breaks. … … 1171 1169 CRLF is considered to be one line break. Line breaks are not 1172 1170 included in the resulting list. */ 1173 1171 1174 1172 PyAPI_FUNC(PyObject*) PyUnicode_Splitlines( 1175 PyObject *s, 1176 int keepends 1177 ); 1173 PyObject *s, /* String to split */ 1174 int keepends /* If true, line end markers are included */ 1175 ); 1178 1176 1179 1177 /* Partition a string using a given separator. */ 1180 1178 1181 1179 PyAPI_FUNC(PyObject*) PyUnicode_Partition( 1182 PyObject *s, 1183 PyObject *sep 1184 ); 1180 PyObject *s, /* String to partition */ 1181 PyObject *sep /* String separator */ 1182 ); 1185 1183 1186 1184 /* Partition a string using a given separator, searching from the end of the … … 1188 1186 1189 1187 PyAPI_FUNC(PyObject*) PyUnicode_RPartition( 1190 PyObject *s, 1191 PyObject *sep 1192 ); 1188 PyObject *s, /* String to partition */ 1189 PyObject *sep /* String separator */ 1190 ); 1193 1191 1194 1192 /* Split a string giving a list of Unicode strings. … … 1206 1204 1207 1205 PyAPI_FUNC(PyObject*) PyUnicode_RSplit( 1208 PyObject *s, 1209 PyObject *sep, 1210 Py_ssize_t maxsplit 1211 ); 1206 PyObject *s, /* String to split */ 1207 PyObject *sep, /* String separator */ 1208 Py_ssize_t maxsplit /* Maxsplit count */ 1209 ); 1212 1210 1213 1211 /* Translate a string by applying a character mapping table to it and … … 1215 1213 1216 1214 The mapping table must map Unicode ordinal integers to Unicode 1217 ordinal integers or None (causing deletion of the character). 1215 ordinal integers or None (causing deletion of the character). 1218 1216 1219 1217 Mapping tables may be dictionaries or sequences. Unmapped character … … 1224 1222 1225 1223 PyAPI_FUNC(PyObject *) PyUnicode_Translate( 1226 PyObject *str, /* String */1227 PyObject *table, 1228 const char *errors 1224 PyObject *str, /* String */ 1225 PyObject *table, /* Translate table */ 1226 const char *errors /* error handling */ 1229 1227 ); 1230 1228 1231 1229 /* Join a sequence of strings using the given separator and return 1232 1230 the resulting Unicode string. */ 1233 1231 1234 1232 PyAPI_FUNC(PyObject*) PyUnicode_Join( 1235 PyObject *separator, 1236 PyObject *seq 1233 PyObject *separator, /* Separator string */ 1234 PyObject *seq /* Sequence object */ 1237 1235 ); 1238 1236 … … 1241 1239 1242 1240 PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch( 1243 PyObject *str, /* String */1244 PyObject *substr, 1245 Py_ssize_t start, 1246 Py_ssize_t end, 1247 int direction 1241 PyObject *str, /* String */ 1242 PyObject *substr, /* Prefix or Suffix string */ 1243 Py_ssize_t start, /* Start index */ 1244 Py_ssize_t end, /* Stop index */ 1245 int direction /* Tail end: -1 prefix, +1 suffix */ 1248 1246 ); 1249 1247 … … 1253 1251 1254 1252 PyAPI_FUNC(Py_ssize_t) PyUnicode_Find( 1255 PyObject *str, /* String */1256 PyObject *substr, 1257 Py_ssize_t start, 1258 Py_ssize_t end, 1259 int direction 1253 PyObject *str, /* String */ 1254 PyObject *substr, /* Substring to find */ 1255 Py_ssize_t start, /* Start index */ 1256 Py_ssize_t end, /* Stop index */ 1257 int direction /* Find direction: +1 forward, -1 backward */ 1260 1258 ); 1261 1259 … … 1263 1261 1264 1262 PyAPI_FUNC(Py_ssize_t) PyUnicode_Count( 1265 PyObject *str, /* String */1266 PyObject *substr, 1267 Py_ssize_t start, 1268 Py_ssize_t end 1263 PyObject *str, /* String */ 1264 PyObject *substr, /* Substring to count */ 1265 Py_ssize_t start, /* Start index */ 1266 Py_ssize_t end /* Stop index */ 1269 1267 ); 1270 1268 … … 1273 1271 1274 1272 PyAPI_FUNC(PyObject *) PyUnicode_Replace( 1275 PyObject *str, /* String */1276 PyObject *substr, 1277 PyObject *replstr, 1278 Py_ssize_t maxcount 1279 1273 PyObject *str, /* String */ 1274 PyObject *substr, /* Substring to find */ 1275 PyObject *replstr, /* Substring to replace */ 1276 Py_ssize_t maxcount /* Max. number of replacements to apply; 1277 -1 = all */ 1280 1278 ); 1281 1279 … … 1284 1282 1285 1283 PyAPI_FUNC(int) PyUnicode_Compare( 1286 PyObject *left, /* Left string */1287 PyObject *right 1284 PyObject *left, /* Left string */ 1285 PyObject *right /* Right string */ 1288 1286 ); 1289 1287 … … 1305 1303 1306 1304 PyAPI_FUNC(PyObject *) PyUnicode_RichCompare( 1307 PyObject *left, /* Left string */1308 PyObject *right, 1309 int op 1305 PyObject *left, /* Left string */ 1306 PyObject *right, /* Right string */ 1307 int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */ 1310 1308 ); 1311 1309 … … 1314 1312 1315 1313 PyAPI_FUNC(PyObject *) PyUnicode_Format( 1316 PyObject *format, /* Format string */1317 PyObject *args 1314 PyObject *format, /* Format string */ 1315 PyObject *args /* Argument tuple or dictionary */ 1318 1316 ); 1319 1317 … … 1325 1323 1326 1324 PyAPI_FUNC(int) PyUnicode_Contains( 1327 PyObject *container, /* Container string */1328 PyObject *element 1325 PyObject *container, /* Container string */ 1326 PyObject *element /* Element string */ 1329 1327 ); 1330 1328 … … 1343 1341 1344 1342 /* These should not be used directly. Use the Py_UNICODE_IS* and 1345 Py_UNICODE_TO* macros instead. 1343 Py_UNICODE_TO* macros instead. 1346 1344 1347 1345 These APIs are implemented in Objects/unicodectype.c. … … 1350 1348 1351 1349 PyAPI_FUNC(int) _PyUnicode_IsLowercase( 1352 Py_UNICODE ch 1350 Py_UNICODE ch /* Unicode character */ 1353 1351 ); 1354 1352 1355 1353 PyAPI_FUNC(int) _PyUnicode_IsUppercase( 1356 Py_UNICODE ch 1354 Py_UNICODE ch /* Unicode character */ 1357 1355 ); 1358 1356 1359 1357 PyAPI_FUNC(int) _PyUnicode_IsTitlecase( 1360 Py_UNICODE ch 1358 Py_UNICODE ch /* Unicode character */ 1361 1359 ); 1362 1360 1363 1361 PyAPI_FUNC(int) _PyUnicode_IsWhitespace( 1364 const Py_UNICODE ch 1362 const Py_UNICODE ch /* Unicode character */ 1365 1363 ); 1366 1364 1367 1365 PyAPI_FUNC(int) _PyUnicode_IsLinebreak( 1368 const Py_UNICODE ch 1366 const Py_UNICODE ch /* Unicode character */ 1369 1367 ); 1370 1368 1371 1369 PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToLowercase( 1372 Py_UNICODE ch 1370 Py_UNICODE ch /* Unicode character */ 1373 1371 ); 1374 1372 1375 1373 PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToUppercase( 1376 Py_UNICODE ch 1374 Py_UNICODE ch /* Unicode character */ 1377 1375 ); 1378 1376 1379 1377 PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToTitlecase( 1380 Py_UNICODE ch 1378 Py_UNICODE ch /* Unicode character */ 1381 1379 ); 1382 1380 1383 1381 PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit( 1384 Py_UNICODE ch 1382 Py_UNICODE ch /* Unicode character */ 1385 1383 ); 1386 1384 1387 1385 PyAPI_FUNC(int) _PyUnicode_ToDigit( 1388 Py_UNICODE ch 1386 Py_UNICODE ch /* Unicode character */ 1389 1387 ); 1390 1388 1391 1389 PyAPI_FUNC(double) _PyUnicode_ToNumeric( 1392 Py_UNICODE ch 1390 Py_UNICODE ch /* Unicode character */ 1393 1391 ); 1394 1392 1395 1393 PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit( 1396 Py_UNICODE ch 1394 Py_UNICODE ch /* Unicode character */ 1397 1395 ); 1398 1396 1399 1397 PyAPI_FUNC(int) _PyUnicode_IsDigit( 1400 Py_UNICODE ch 1398 Py_UNICODE ch /* Unicode character */ 1401 1399 ); 1402 1400 1403 1401 PyAPI_FUNC(int) _PyUnicode_IsNumeric( 1404 Py_UNICODE ch 1402 Py_UNICODE ch /* Unicode character */ 1405 1403 ); 1406 1404 1407 1405 PyAPI_FUNC(int) _PyUnicode_IsAlpha( 1408 Py_UNICODE ch 1406 Py_UNICODE ch /* Unicode character */ 1409 1407 ); 1410 1408
Note:
See TracChangeset
for help on using the changeset viewer.