\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#338: Embedder Access to Startup Scripts of *\_Main()}
\date{October 22, 2008}
\author{Don Porter}
\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 \#338}&\textbf{Embedder Access to Startup Scripts of *\_Main()}\\\hline
Author&

Don Porter \tipmail{dgp}{users.sf.net}
\\
Created&Wednesday, \(\text{22}^{\text{nd}}\) October 2008\\
Type&Project\\
Tcl Version&\(8.6\)\\
State&Final\\
Vote&Done\\
Version&\tipversion$Revision: 1.4 $\\
Keywords&Tcl, Tk, tclsh, wish\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

This TIP proposes to make public the routines that get and set the startup script file that \textit{Tcl\_Main} or \textit{Tk\_Main} evaluate in their non-interactive modes.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Background}

When support for the \textbf{-encoding} option was added to tclsh and wish \cite{tip137}, two new internal routines were added to Tcl:

\begin{quote}
Tcl\_Obj *\textbf{Tcl\_GetStartupScript}(const char **\textit{encodingNamePtr})
\end{quote}

\begin{quote}
void \textbf{Tcl\_SetStartupScript}(Tcl\_Obj *\textit{pathPtr}, const char *\textit{encodingName})
\end{quote}

These routines (or other weaker alternative internal routines) are used by both wish and Tclkit by way of the internal stubs table to manipulate the startup script for \textit{Tcl\_Main} or \textit{Tk\_Main} to evaluate.

\section{Rationale}

The naming of these routines indicate they were always intended to be(come) public.

These are the last ``private'' Tcl routines used by Tk and wish. After implementation of this TIP, Tk can drop use of tclInt.h.

\section{Proposal}

Make these routines public.

\section{Compatibility}

There will need to be some care taken for existing users of these routines via the private stubs table. The ability to compile against Tcl 8.6 headers, yet run against a pre-8.6 stubs table will likely be lost.

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\begin{thebibliography}{TIP \#1}
\addcontentsline{toc}{section}{References}
\bibitem[TIP \#137]{tip137}
Anton Kovalenko,
\emph{Specifying Script Encodings for [source] and tclsh},
on-line at \url{http://purl.org/tcl/tip/137.html}
\end{thebibliography}
\end{document}
