TIP 20: Add C Locale-Exact CType Functions

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2017 Conference, Houston/TX, US, Oct 16-20
Send your abstracts to tclconference@googlegroups.com
by Aug 21.
Author:		Jeffrey Hobbs <jeff.hobbs@acm.org>
State:		Deferred
Type:		Project
Tcl-Version:	8.5
Vote:		Pending
Created:	08-Jan-2001
Post-History: 

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 http://sf.net/bugs/?func=detailbug&bug_id=127512&group_id=10894 ) 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.

History