\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#20: Add C Locale-Exact CType Functions}
\date{January 08, 2001}
\author{Jeffrey Hobbs}
\urlstyle{sf}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\def\tipversion$#1${\texttt{\$#1\$}}
\def\tiplangle#1{\ensuremath{<}}
\def\tiprangle#1{\ensuremath{>}}
\def\tipbar#1{\ensuremath{|}}
\def\tipmail#1#2{\(\langle\){\small\expandafter\url{#1@#2}}\(\rangle\)}
\ifx\pdfoutput\undefined
\newcommand{\tipimage}[2]{\typeout{Make sure you download #1.eps}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.eps}}{\includegraphics[width=0.8\textwidth]{#1.eps}}}
\newcommand{\tipxref}[1]{}
\newcommand{\tipxrefend}{}
\else
\newcommand{\tipimage}[2]{\typeout{Make sure you create #1.pdf}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.pdf}}{\includegraphics[width=0.8\textwidth]{#1.pdf}}}
\pdfcatalog{/PageMode /UseOutlines}
\newcommand{\tipxref}[1]{\pdfannotlink attr {/C [0.5 0.5 1.0] /Border [0 0 1]} goto name {#1}}
\newcommand{\tipxrefend}{\pdfendlink}
\fi
\newenvironment{tipabstract}{\begin{abstract}}{\end{abstract}}
\begin{document}\maketitle
\begin{center}\begin{tabularx}{\linewidth}{|r@{: }X|}\hline
\textbf{TIP \#20}&\textbf{Add C Locale-Exact CType Functions}\\\hline
Author&

Jeffrey Hobbs \tipmail{jeff.hobbs}{acm.org}
\\
Created&Monday, \(\text{8}^{\text{th}}\) January 2001\\
Type&Project\\
Tcl Version&\(8.5\)\\
State&Deferred\\
Vote&Pending\\
Version&\tipversion$Revision: 1.4 $\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

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 \tiplangle{} 0x80).
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{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 [\url{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.

\section{Reference Implementation}

Add a file \textit{generic/tclC.c} (to parallel \textit{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.

\section{Copyright}

This document is in the public domain. 

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\end{document}
