• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/tcl-102/tcl84/tcl/generic/

Lines Matching +defs:from +defs:encoding

4  *	Contains the implementation of the encoding conversion package.
20 * The following data structure represents an encoding, which describes how
25 char *name; /* Name of encoding. Malloced because (1)
26 * hash table entry that owns this encoding
27 * may be freed prior to this encoding being
32 /* Procedure to convert from external
33 * encoding into UTF-8. */
35 /* Procedure to convert from UTF-8 into
36 * external encoding. */
39 * encoding is deleted. */
41 * end-of-string in this encoding. This
45 ClientData clientData; /* Arbitrary value associated with encoding
48 * null-terminated strings in this encoding.
54 Tcl_HashEntry *hPtr; /* Hash table entry that owns this encoding. */
59 * table-driven encoding created by LoadTableEncoding(). It maps between
61 * encoding.
65 int fallback; /* Character (in this encoding) to
66 * substitute when this encoding cannot
73 * characters from the encoding to Unicode.
80 * characters from Unicode to the encoding.
83 * is no corresponding character the encoding,
90 * escape-driven encoding that is itself comprised of other simpler
99 char sequence[16]; /* Escape code that marks this encoding. */
100 char name[32]; /* Name for encoding. */
102 * if this sub-encoding has not been needed
107 int fallback; /* Character (in this encoding) to
108 * substitute when this encoding cannot
123 * used by this encoding type. The actual
129 * Constants used when loading an encoding file to identify the type of the
139 * Initialize the default encoding directory. If this variable contains
141 * system encoding files.
150 * the string names that represent the encoding, values are (Encoding *).
159 * of the system encoding will be used to perform the conversion.
194 static void FreeEncoding _ANSI_ARGS_((Tcl_Encoding encoding));
252 "encoding", FreeEncodingIntRep, DupEncodingIntRep, NULL, NULL
263 * if possible, and returns TCL_OK. If no such encoding exists,
283 Tcl_Encoding encoding = Tcl_GetEncoding(interp, name);
285 if (encoding == NULL) {
291 objPtr->internalRep.otherValuePtr = (VOID *) encoding;
304 * The Tcl_FreeInternalRepProc for the "encoding" Tcl_ObjType.
321 * The Tcl_DupInternalRepProc for the "encoding" Tcl_ObjType.
401 * Release the state associated with the encoding subsystem.
484 * Given the name of a encoding, find the corresponding Tcl_Encoding
485 * token. If the encoding did not already exist, Tcl attempts to
486 * dynamically load an encoding by that name.
489 * Returns a token that represents the encoding. If the name didn't
490 * refer to any known or loadable encoding, NULL is returned. If
495 * The new encoding type is entered into a table visible to all
496 * interpreters, keyed off the encoding's name. For each call to
507 CONST char *name; /* The name of the desired encoding. */
537 * This procedure is called to release an encoding allocated by
544 * The reference count associated with the encoding is decremented
545 * and the encoding may be deleted if nothing is using it anymore.
551 Tcl_FreeEncoding(encoding)
552 Tcl_Encoding encoding;
555 FreeEncoding(encoding);
565 * This procedure is called to release an encoding by procedures
572 * The reference count associated with the encoding is decremented
573 * and the encoding may be deleted if nothing is using it anymore.
579 FreeEncoding(encoding)
580 Tcl_Encoding encoding;
584 encodingPtr = (Encoding *) encoding;
610 * Given an encoding, return the name that was used to constuct
611 * the encoding.
614 * The name of the encoding.
623 Tcl_GetEncodingName(encoding)
624 Tcl_Encoding encoding; /* The encoding whose name to fetch. */
628 if (encoding == NULL) {
629 encoding = systemEncoding;
631 encodingPtr = (Encoding *) encoding;
642 * as files on disk in the encoding path.
682 Tcl_Obj* encodingObj = Tcl_NewStringObj("encoding",-1);
692 * Construct the path from the element of pathPtr,
693 * joined with 'encoding'.
708 * which is the encoding name with a .enc extension
760 * Sets the default encoding that should be used whenever the user
762 * If the supplied name is NULL, the system encoding is reset to the
763 * default system encoding.
766 * The return value is TCL_OK if the system encoding was successfully
767 * set to the encoding specified by name, TCL_ERROR otherwise. If
772 * The reference count of the new system encoding is incremented.
773 * The reference count of the old system encoding is decremented and
782 CONST char *name; /* The name of the desired encoding, or NULL
783 * to reset to default encoding. */
785 Tcl_Encoding encoding;
790 encoding = defaultEncoding;
791 encodingPtr = (Encoding *) encoding;
795 encoding = Tcl_GetEncoding(interp, name);
796 if (encoding == NULL) {
803 systemEncoding = encoding;
815 * This procedure is called to define a new encoding and the procedures
816 * that are used to convert between the specified encoding and Unicode.
819 * Returns a token that represents the encoding. If an encoding with
820 * the same name already existed, the old encoding token remains
824 * retrieve the most recent encoding token.
827 * The new encoding type is entered into a table visible to all
828 * interpreters, keyed off the encoding's name. For each call to
838 Tcl_EncodingType *typePtr; /* The encoding type. */
849 * Remove old encoding from hash table, but don't delete it until
886 * Convert a source buffer from the specified encoding into UTF-8.
888 * be represented in the target encoding, a default fallback
903 Tcl_ExternalToUtfDString(encoding, src, srcLen, dstPtr)
904 Tcl_Encoding encoding; /* The encoding for the source string, or
905 * NULL for the default system encoding. */
906 CONST char *src; /* Source string in specified encoding. */
908 * encoding-specific string length. */
921 if (encoding == NULL) {
922 encoding = systemEncoding;
924 encodingPtr = (Encoding *) encoding;
959 * Convert a source buffer from the specified encoding into UTF-8.
973 Tcl_ExternalToUtf(interp, encoding, src, srcLen, flags, statePtr, dst,
976 Tcl_Encoding encoding; /* The encoding for the source string, or
977 * NULL for the default system encoding. */
978 CONST char *src; /* Source string in specified encoding. */
980 * encoding-specific string length. */
991 int *srcReadPtr; /* Filled with the number of bytes from the
1007 if (encoding == NULL) {
1008 encoding = systemEncoding;
1010 encodingPtr = (Encoding *) encoding;
1051 * Convert a source buffer from UTF-8 into the specified encoding.
1053 * be represented in the target encoding, a default fallback
1058 * NULL terminated in an encoding-specific manner. The return value
1068 Tcl_UtfToExternalDString(encoding, src, srcLen, dstPtr)
1069 Tcl_Encoding encoding; /* The encoding for the converted string,
1070 * or NULL for the default system encoding. */
1086 if (encoding == NULL) {
1087 encoding = systemEncoding;
1089 encodingPtr = (Encoding *) encoding;
1127 * Convert a buffer from UTF-8 into the specified encoding.
1141 Tcl_UtfToExternal(interp, encoding, src, srcLen, flags, statePtr, dst,
1144 Tcl_Encoding encoding; /* The encoding for the converted string,
1145 * or NULL for the default system encoding. */
1159 int *srcReadPtr; /* Filled with the number of bytes from the
1175 if (encoding == NULL) {
1176 encoding = systemEncoding;
1178 encodingPtr = (Encoding *) encoding;
1254 * The value returned from TclpNameOfExecutable is a UTF string that
1259 * UTF string to the default native encoding before the default
1260 * encoding is initialized. Then, convert it back to UTF after the
1261 * system encoding is loaded.
1297 * Read a file that describes an encoding and create a new Encoding
1298 * from the data.
1307 * File read from disk.
1315 CONST char *name; /* The name of the encoding file on disk
1316 * and also the name for new encoding. */
1322 Tcl_Encoding encoding;
1343 Tcl_SetChannelOption(NULL, chan, "-encoding", "utf-8");
1357 encoding = NULL;
1360 encoding = LoadTableEncoding(interp, name, ENCODING_SINGLEBYTE,
1365 encoding = LoadTableEncoding(interp, name, ENCODING_DOUBLEBYTE,
1370 encoding = LoadTableEncoding(interp, name, ENCODING_MULTIBYTE,
1375 encoding = LoadEscapeEncoding(name, chan);
1379 if ((encoding == NULL) && (interp != NULL)) {
1380 Tcl_AppendResult(interp, "invalid encoding file \"", name, "\"", NULL);
1382 Tcl_AppendResult(interp, " or missing sub-encoding", NULL);
1386 return encoding;
1390 Tcl_AppendResult(interp, "unknown encoding \"", name, "\"", NULL);
1401 * Look for the file encoding/<name>.enc in the specified
1426 argv[1] = "encoding";
1450 * converts between Unicode and some other encoding and creates an
1451 * encoding (using a TableEncoding structure) from that information.
1458 * The return value is the new encoding, or NULL if the encoding
1470 CONST char *name; /* Name for new encoding. */
1471 int type; /* Type of encoding (ENCODING_?????). */
1472 Tcl_Channel chan; /* File containing new encoding. */
1486 * sequences in the encoding files.
1636 * (question mark) when converting from UTF-8 to external encoding.
1649 * Make a special symbol encoding that not only maps the symbol
1650 * characters from their Unicode code points down into page 0, but
1676 * For trailing 'R'everse encoding, see [Patch #689341]
1695 int to, from;
1706 from = (staticHex[p[0]] << 12) + (staticHex[p[1]] << 8)
1708 if (from == 0) {
1711 dataPtr->fromUnicode[from >> 8][from & 0xff] = to;
1733 * that converts between Unicode and some other encoding.
1736 * are used to choose an encoding and the associated names for the
1740 * The return value is the new encoding, or NULL if the encoding
1751 CONST char *name; /* Name for new encoding. */
1752 Tcl_Channel chan; /* File containing new encoding. */
1800 * trying to use a half-loaded system encoding to
1876 CONST char *src; /* Source string (unknown encoding). */
1888 int *srcReadPtr; /* Filled with the number of bytes from the
1923 * Convert from UTF-8 to UTF-8. While converting null-bytes from
1951 int *srcReadPtr; /* Filled with the number of bytes from the
1972 * Convert from UTF-8 to UTF-8 while converting null-bytes from
2000 int *srcReadPtr; /* Filled with the number of bytes from the
2021 * Convert from UTF-8 to UTF-8. Note that the UTF-8 to UTF-8
2050 int *srcReadPtr; /* Filled with the number of bytes from the
2061 int pureNullMode; /* Convert embedded nulls from
2140 * Convert from Unicode to UTF-8.
2167 int *srcReadPtr; /* Filled with the number of bytes from the
2227 * Convert from UTF-8 to Unicode.
2241 ClientData clientData; /* TableEncodingData that specifies encoding. */
2254 int *srcReadPtr; /* Filled with the number of bytes from the
2321 * Convert from the encoding specified by the TableEncodingData into
2337 * encoding. */
2338 CONST char *src; /* Source string in specified encoding. */
2350 int *srcReadPtr; /* Filled with the number of bytes from the
2431 * Convert from UTF-8 into the encoding specified by the
2447 * encoding. */
2460 int *srcReadPtr; /* Filled with the number of bytes from the
2555 * This procedure is invoked when an encoding is deleted. It deletes
2570 * encoding. */
2590 * Convert from the encoding specified by the EscapeEncodingData into
2606 * encoding. */
2607 CONST char *src; /* Source string in specified encoding. */
2619 int *srcReadPtr; /* Filled with the number of bytes from the
2801 * Convert from UTF-8 into the encoding specified by the
2817 * encoding. */
2830 int *srcReadPtr; /* Filled with the number of bytes from the
3018 * This procedure is invoked when an EscapeEncodingData encoding is
3019 * deleted. It deletes the memory used by the encoding.
3032 ClientData clientData; /* EscapeEncodingData that specifies encoding. */
3047 * from under the following loop's feet [Bug 2891556].
3070 * encoding (of type TextEncodingData) that represents the specified
3074 * The return value is the encoding.
3077 * If the encoding that represents the specified state has not
3148 * Find and load the encoding file for this operating system.
3150 * native string representation, but the true encoding is not
3165 CONST char *argv0; /* Name of executable from argv[0] to main()
3166 * in native multi-byte encoding. */
3173 * back into this routine from some of the procedures below.
3196 * default encoding.