Manual Pages for UNIX Darwin command on man Tcl_AppInit
MyWebUniversity

Manual Pages for UNIX Darwin command on man Tcl_AppInit

TclAppInit(3) Tcl Library Procedures TclAppInit(3)

NAME

TclAppInit - perform application-specific initialization

SYNOPSIS

##iinncclluuddee <>

int TTccllAAppppIInniitt(interp) AARRGGUUMMEENNTTSS TclInterp *interp (in) Interpreter for the application.

DESCRIPTION

TTccllAAppppIInniitt is a ``hook'' procedure that is invoked by the main pro-

grams for Tcl applications such as ttccllsshh and wwiisshh. Its purpose is to allow new Tcl applications to be created without modifying the main programs provided as part of Tcl and Tk. To create a new application you write a new version of TTccllAAppppIInniitt to replace the default version provided by Tcl, then link your new TTccllAAppppIInniitt with the Tcl library. TTccllAAppppIInniitt is invoked after by TTccllMMaaiinn and TTkkMMaaiinn after their own initialization and before entering the main loop to process commands. Here are some examples of things that TTccllAAppppIInniitt might do: [1] Call initialization procedures for various packages used by the application. Each initialization procedure adds new commands to

interp for its package and performs other package-specific ini-

tialization.

[2] Process command-line arguments, which can be accessed from the

Tcl variables aarrggvv and aarrggvv00 in interp. [3] Invoke a startup script to initialize the application.

TTccllAAppppIInniitt returns TCLOK or TCLERROR. If it returns TCLERROR then

it must leave an error message in for the interpreter's result; other-

wise the result is ignored.

In addition to TTccllAAppppIInniitt, your application should also contain a pro-

cedure mmaaiinn that calls TTccllMMaaiinn as follows: TclMain(argc, argv, TclAppInit);

The third argument to TTccllMMaaiinn gives the address of the application-

specific initialization procedure to invoke. This means that you don't have to use the name TTccllAAppppIInniitt for the procedure, but in practice the name is nearly always TTccllAAppppIInniitt (in versions before Tcl 7.4 the name TTccllAAppppIInniitt was implicit; there was no way to specify the procedure explicitly). The best way to get started is to make a copy of the file

ttccllAAppppIInniitt..cc from the Tcl library or source directory. It already con-

tains a mmaaiinn procedure and a template for TTccllAAppppIInniitt that you can mod-

ify for your application. KKEEYYWWOORRDDSS application, argument, command, initialization, interpreter Tcl 7.0 TclAppInit(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™