TIP #20: Add C Locale-Exact CType Functions


TIP:20
Title:Add C Locale-Exact CType Functions
Version:$Revision: 1.4 $
Author:Jeffrey Hobbs <jeff dot hobbs at acm dot org>
State:Deferred
Type:Project
Tcl-Version:8.5
Vote:Pending
Created:Monday, 08 January 2001

Abstract

This TIP adds functions to Tcl that are a subset of the standard ctype functions (isspace, isalpha, ...) that are ensured to operate only in the C locale (char < 0x80).

Rationale

Tcl used to force the C locale everywhere in order to have parsing work as expected throughout Tcl, but that prevented certain i18n features from working correctly (like native character input). In enabling the i18n features, some bugs (like [1]) were exposed that required the C locale to be enabled to function properly. Since we don't want to force that requirement, creating ctype functions that work as if they were always in the C locale is the best solution.

Reference Implementation

Add a file generic/tclC.c (to parallel generic/tclUtf.c) that contains functions following the convention C_isspace, C_isalpha, ... These functions would use character or bit maps to ensure greatest speed and efficiency of the functions.

Not all use of the ctype functions need be replaced. Those that walk over a string, especially backwards, are the ones that need replacement.

Copyright

This document is in the public domain.


Powered by Tcl[Index] [History] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]

TIP AutoGenerator - written by Donal K. Fellows