Artifact b1754d15e5ebf06511b978ba7834c68ddfd31182b7e4aa90f5c13d526a5e71cc:
- File doc/markdown/Init.md — part of check-in [5e80e55e41] at 2026-09-26 22:40:07 on branch tip-700 — - added a "title" metadata element to the generated yaml block to satisfy Pandoc when converting to HTML - added markdown2html.tcl as prototype/placeholder of conversion script markdown -> HTML - added some CSS to play with a good visual representation of the generated HTML, starting with the n section pages - fixed man2markdown.tcl not giving the two .TP/.IP parsing places the same treatment (user: Torsten, size: 3954) [annotate] [blame] [check-ins using]
- File doc/markdown/TclCAPI/Init.md — part of check-in [b84ce0eee1] at 2026-10-04 22:10:02 on branch tip-700 — file location re-organisation (part 1) (user: Torsten, size: 3954) [annotate] [blame] [check-ins using]
CommandName: Tcl_Init title: Tcl_Init ManualSection: 3 Version: 9.0 TclPart: Tcl TclDescription: Tcl Library Procedures Links:
- Tcl_AppInit
- Tcl_Main Keywords:
- application
- initialization
- interpreter Copyright:
- Copyright (c) 1998-2000 Scriptics Corporation. ---
Name
Tcl_Init - find and source initialization script
Synopsis
::: {.synopsis} ::: #include <tcl.h> [int]{.ret} [Tcl_Init]{.ccmd} [interp]{.cargs} [const char *]{.ret} [Tcl_SetPreInitScript]{.ccmd} [scriptPtr]{.cargs} [typedef int]{.ret} [Tcl_PostInitProc]{.ccmd version="TIP755"} [Tcl_Interp *interp, void *clientData]{.cargs} [int]{.ret} [Tcl_RegisterPostInitProc]{.ccmd version="TIP755"} [postInitProc, clientData]{.cargs} [int]{.ret} [Tcl_UnregisterPostInitProc]{.ccmd version="TIP755"} [postInitProc, clientData]{.cargs} [int]{.ret} [Tcl_ClearPostInitProcs]{.ccmd version="TIP755"} [void]{.cargs} :::
Arguments
::: {.arguments} :::
[*interp]{.carg .in type="Tcl_Interp"} : Interpreter to initialize.
[*scriptPtr]{.carg .in type="const char"} : Address of the initialization script.
[*postInitProc]{.carg .in type="Tcl_PostInitProc"} : Function to call post initialization of interpreter.
[*clientData]{.carg .in type="void"} : Arbitrary one-word value to pass to postInitProc.
:::
Description
Tcl_Init is a helper procedure that finds and sources the init.tcl script, which should exist somewhere on the Tcl library path.
Tcl_Init is typically called from Tcl_AppInit procedures.
Tcl_SetPreInitScript registers the pre-initialization script and returns the former (now replaced) script pointer. A value of NULL may be passed to not register any script. The pre-initialization script is executed by Tcl_Init before accessing the file system. The purpose is to typically prepare a custom file system (like an embedded zip-file) to be activated before the search.
Tcl_RegisterPostInitProc registers a callback that should be invoked by Tcl_Init at the end of initialization of subsequently created interpreters except safe interpreters. The function returns a Tcl return code.
This callback function is passed the interpreter being initialized and the opaque clientData value that was passed at the time of registration. It should return a Tcl return code. Multiple callbacks are supported and will be invoked in the order of their registration except that an error return from a callback will skip the remaining registrations. The Tcl return code from the last callback invoked is returned as the return value from Tcl_Init.
Tcl_UnregisterPostInitProc unregisters a previously registered callback. Both postInitProc and clientData must match the the corresponding values that were passed to Tcl_RegisterPostInitProc. The function returns a standard Tcl return code. It is not an error if there is no matching prior registration.
The Tcl_ClearPostInitProcs function unregisters all currently registered callbacks.
Callback functions registered through Tcl_RegisterPostInitProc may load static packages, add commands, or set up other facilities so they are available in all interpreters. They cannot however execute any code that may result in new interpreters and should not delete the passed interpreter.
The Tcl\_RegisterPostInitProc and Tcl\_UnregisterPostInitProc functions may be invoked from within a registered callback. However, the change in registration will not have effect for the interpreter that is being initialized.
When used in stub-enabled embedders, the stubs table must be first initialized using one of Tcl_InitSubsystems, Tcl_SetPanicProc, Tcl_FindExecutable or TclZipfs_AppHook before Tcl_SetPreInitScript may be called.