home *** CD-ROM | disk | FTP | other *** search
- #ifdef MPW
- # pragma segment TCLExtend
- #endif
- /*
- * tclXcreate.c
- *
- * Contains a routine to create an interpreter and initialize all the Extended
- * Tcl commands. It is is a seperate file so that an application may create
- * the interpreter and add in only a subset of the Extended Tcl commands.
- *-----------------------------------------------------------------------------
- * Copyright 1991-1993 Karl Lehenbauer and Mark Diekhans.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appear in all copies. Karl Lehenbauer and
- * Mark Diekhans make no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *-----------------------------------------------------------------------------
- * $Id: tclXcreate.c,v 2.6 1993/07/31 03:45:25 markd Exp $
- *-----------------------------------------------------------------------------
- */
-
- #include "tclExtdInt.h"
-
-
- #ifdef macintosh
-
- int
- TclX_MacUnImpedOK(clientData, interp, argc, argv)
- ClientData clientData;
- Tcl_Interp *interp;
- int argc;
- char **argv;
- {
- #pragma unused (clientData, interp, argc, argv)
-
- return TCL_OK;
- }
-
- int
- TclX_MacUnImpedErr(clientData, interp, argc, argv)
- ClientData clientData;
- Tcl_Interp *interp;
- int argc;
- char **argv;
- {
- #pragma unused (clientData, interp, argc, argv)
-
- Tcl_AppendResult( interp, "\"", argv[0],
- "\" is not implemented for Macintosh.",
- NULL);
- return TCL_ERROR;
- }
-
- #endif
-
-
- /*
- *-----------------------------------------------------------------------------
- *
- * Tcl_AddExtendedCmds --
- *
- * Add the Extended Tcl commands to the specified interpreter (except for
- * the library commands that override that standard Tcl procedures).
- *-----------------------------------------------------------------------------
- */
- void
- Tcl_AddExtendedCmds (interp)
- Tcl_Interp *interp;
- {
-
- /*
- * from tclCkalloc.c (now part of the UCB Tcl).
- */
- #ifdef TCL_MEM_DEBUG
- Tcl_InitMemory (interp);
- #endif
-
-
- /*
- * from tclXbsearch.c
- */
- Tcl_CreateCommand (interp, "bsearch", Tcl_BsearchCmd,
- (ClientData) NULL, (void (*)()) NULL);
-
- /*
- * from tclXchmod.c
- */
- #ifdef macintosh
- Tcl_CreateCommand (interp, "chgrp", TclX_MacUnImpedOK,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "chmod", TclX_MacUnImpedOK,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "chown", TclX_MacUnImpedOK,
- (ClientData) NULL, (void (*)()) NULL);
- #else
- Tcl_CreateCommand (interp, "chgrp", Tcl_ChgrpCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "chmod", Tcl_ChmodCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "chown", Tcl_ChownCmd,
- (ClientData) NULL, (void (*)()) NULL);
- #endif
-
- /*
- * from tclXclock.c
- */
- Tcl_CreateCommand (interp, "getclock", Tcl_GetclockCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "fmtclock", Tcl_FmtclockCmd,
- (ClientData) NULL, (void (*)()) NULL);
-
-
- /*
- * from tclXcnvdate.c
- */
- #ifdef macintosh
- Tcl_CreateCommand (interp, "convertclock", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- #else
- Tcl_CreateCommand (interp, "convertclock", Tcl_ConvertclockCmd,
- (ClientData) NULL, (void (*)()) NULL);
- #endif
-
- /*
- * from tclXcmdloop.c
- */
- #ifdef macintosh
- Tcl_CreateCommand (interp, "commandloop", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- #else
- Tcl_CreateCommand (interp, "commandloop", Tcl_CommandloopCmd,
- (ClientData) NULL, (void (*)()) NULL);
- #endif
-
- /*
- * from tclXdebug.c
- */
- Tcl_InitDebug (interp);
-
- /*
- * from ndebug.c
- */
- Tcl_InitnDebug (interp);
-
- /*
- * from tclXdup.c
- */
- #ifdef macintosh
- Tcl_CreateCommand (interp, "dup", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- #else
- Tcl_CreateCommand (interp, "dup", Tcl_DupCmd,
- (ClientData) NULL, (void (*)()) NULL);
- #endif
-
- /*
- * from tclXtclXfcntl.c
- */
- #ifdef macintosh
- Tcl_CreateCommand (interp, "fcntl", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- #else
- Tcl_CreateCommand (interp, "fcntl", Tcl_FcntlCmd,
- (ClientData) NULL, (void (*)()) NULL);
- #endif
-
- /*
- * from tclXfilecmds.c
- */
- Tcl_CreateCommand (interp, "pipe", Tcl_PipeCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "copyfile", Tcl_CopyfileCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "lgets", Tcl_LgetsCmd,
- (ClientData) NULL, (void (*)()) NULL);
-
- /*
- * from tclXfstat.c
- */
- Tcl_CreateCommand (interp, "fstat", Tcl_FstatCmd,
- (ClientData) NULL, (void (*)()) NULL);
-
- /*
- * from tclXflock.c
- */
- #ifdef macintosh
- Tcl_CreateCommand (interp, "flock", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "funlock", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- #else
- Tcl_CreateCommand (interp, "flock", Tcl_FlockCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "funlock", Tcl_FunlockCmd,
- (ClientData) NULL, (void (*)()) NULL);
- #endif
-
- /*
- * from tclXfilescan.c
- */
- Tcl_InitFilescan (interp);
-
- /*
- * from tclXgeneral.c
- */
- Tcl_CreateCommand(interp, "echo", Tcl_EchoCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand(interp, "infox", Tcl_InfoxCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand(interp, "loop", Tcl_LoopCmd,
- (ClientData) NULL, (void (*)()) NULL);
-
- /*
- * from tclXid.c
- */
- Tcl_CreateCommand (interp, "id", Tcl_IdCmd,
- (ClientData) NULL, (void (*)()) NULL);
-
- /*
- * from tclXkeylist.c
- */
- Tcl_CreateCommand(interp, "keyldel", Tcl_KeyldelCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand(interp, "keylget", Tcl_KeylgetCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand(interp, "keylkeys", Tcl_KeylkeysCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand(interp, "keylset", Tcl_KeylsetCmd,
- (ClientData) NULL, (void (*)()) NULL);
-
- /*
- * from tclXlist.c
- */
- Tcl_CreateCommand(interp, "lvarcat", Tcl_LvarcatCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand(interp, "lvarpop", Tcl_LvarpopCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand(interp, "lvarpush", Tcl_LvarpushCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand(interp, "lempty", Tcl_LemptyCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand(interp, "lassign", Tcl_LassignCmd,
- (ClientData) NULL, (void (*)()) NULL);
- /*
- * from tclXmath.c
- */
- Tcl_CreateCommand (interp, "max", Tcl_MaxCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "min", Tcl_MinCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "random", Tcl_RandomCmd,
- (ClientData) NULL, (void (*)()) NULL);
-
- /*
- * from tclXmsgcat.c
- */
- #ifdef macintosh
- Tcl_CreateCommand (interp, "catopen", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "catgets", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "catclose", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- #else
- Tcl_InitMsgCat (interp);
- #endif
-
- /*
- * from tclXprocess.c
- */
- #ifdef macintosh
- Tcl_CreateCommand (interp, "execl", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "fork", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "wait", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- #else
- Tcl_CreateCommand (interp, "execl", Tcl_ExeclCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "fork", Tcl_ForkCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "wait", Tcl_WaitCmd,
- (ClientData) NULL, (void (*)()) NULL);
- #endif
-
- /*
- * from tclXselect.c
- */
- #ifdef macintosh
- Tcl_CreateCommand (interp, "select", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- #else
- Tcl_CreateCommand (interp, "select", Tcl_SelectCmd,
- (ClientData) NULL, (void (*)()) NULL);
- #endif
-
- /*
- * from tclXsignal.c
- */
- #ifdef macintosh
- Tcl_CreateCommand (interp, "kill", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "signal", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- #else
- Tcl_InitSignalHandling (interp);
- #endif
-
- /*
- * from tclXprofile.c
- */
- Tcl_InitProfile (interp);
-
- /*
- * from tclXstring.c
- */
- Tcl_CreateCommand(interp, "cindex", Tcl_CindexCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand(interp, "clength", Tcl_ClengthCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand(interp, "crange", Tcl_CrangeCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand(interp, "csubstr", Tcl_CrangeCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand(interp, "replicate", Tcl_ReplicateCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "translit", Tcl_TranslitCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "ctype", Tcl_CtypeCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "ctoken", Tcl_CtokenCmd,
- (ClientData) NULL, (void (*)()) NULL);
-
- /*
- * from tclXunixcmds.c
- */
- #ifdef macintosh
- {
- extern int TclMac_RM();
-
- Tcl_CreateCommand (interp, "system", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "times", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "umask", TclX_MacUnImpedOK,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "link", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "unlink", TclMac_RM,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "alarm", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "sleep", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- }
- #else
- Tcl_CreateCommand (interp, "system", Tcl_SystemCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "times", Tcl_TimesCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "umask", Tcl_UmaskCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "link", Tcl_LinkCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "unlink", Tcl_UnlinkCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "mkdir", Tcl_MkdirCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "rmdir", Tcl_RmdirCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "alarm", Tcl_AlarmCmd,
- (ClientData) NULL, (void (*)()) NULL);
- Tcl_CreateCommand (interp, "sleep", Tcl_SleepCmd,
- (ClientData) NULL,(void (*)()) NULL);
- #endif
-
- /*
- * from tclXserver.c
- */
- #ifdef macintosh
- Tcl_CreateCommand (interp, "server_open", TclX_MacUnImpedErr,
- (ClientData) NULL, (void (*)()) NULL);
- #else
- Tcl_CreateCommand (interp, "server_open", Tcl_ServerOpenCmd,
- (ClientData) NULL, (void (*)()) NULL);
- #endif
- }
-
- /*
- *-----------------------------------------------------------------------------
- *
- * Tcl_AddExtendedLibCmds --
- *
- * Add the Extended Tcl library management commands. These override the
- * standard Tcl procedures.
- *-----------------------------------------------------------------------------
- */
- void
- Tcl_AddExtendedLibCmds (interp)
- Tcl_Interp *interp;
- {
- /*
- * from tclXlib.c
- */
- Tcl_InitLibrary (interp);
- }
-
-
- /*
- *-----------------------------------------------------------------------------
- *
- * Tcl_CreateExtendedInterp --
- *
- * Create a new TCL command interpreter and initialize all of the
- * extended Tcl commands..
- *
- * Returns:
- * The return value is a token for the interpreter.
- *-----------------------------------------------------------------------------
- */
-
- int
- Tcl_InitExtended (interp)
- Tcl_Interp *interp;
- {
- if (interp != NULL)
- {
- Tcl_AddExtendedCmds (interp);
- Tcl_AddExtendedLibCmds (interp);
- }
-
- return TCL_OK;
- }
-
- Tcl_Interp *
- Tcl_CreateExtendedInterp ()
- {
- Tcl_Interp *interp;
-
- interp = Tcl_CreateInterp();
-
- if (interp != NULL)
- {
- Tcl_InitExtended(interp);
- }
-
- return interp;
- }
-