home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tclX6.5c / src / tclXcreate.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-19  |  10.9 KB  |  303 lines

  1. /*
  2.  * tclXcreate.c
  3.  *
  4.  * Contains a routine to create an interpreter and initialize all the Extended
  5.  * Tcl commands.  It is is a seperate file so that an application may create
  6.  * the interpreter and add in only a subset of the Extended Tcl commands.
  7.  *-----------------------------------------------------------------------------
  8.  * Copyright 1992 Karl Lehenbauer and Mark Diekhans.
  9.  *
  10.  * Permission to use, copy, modify, and distribute this software and its
  11.  * documentation for any purpose and without fee is hereby granted, provided
  12.  * that the above copyright notice appear in all copies.  Karl Lehenbauer and
  13.  * Mark Diekhans make no representations about the suitability of this
  14.  * software for any purpose.  It is provided "as is" without express or
  15.  * implied warranty.
  16.  *-----------------------------------------------------------------------------
  17.  * $Id: tclXcreate.c,v 2.0 1992/10/16 04:50:33 markd Rel $
  18.  *-----------------------------------------------------------------------------
  19.  */
  20.  
  21. #include "tclExtdInt.h"
  22.  
  23. int matherr ();
  24.  
  25. /*
  26.  * This is a little kludge to make sure matherr is brought in from the Tcl
  27.  * library if it is not already defined.  This could be done on the link line,
  28.  * but this makes sure it happens.  This is a global so optimizers don't thow
  29.  * away the assignment to it.
  30.  */
  31. static int (*bringInMathErr)() = matherr;
  32.  
  33.  
  34. /*
  35.  *-----------------------------------------------------------------------------
  36.  *
  37.  * Tcl_CreateExtendedInterp --
  38.  *
  39.  *      Create a new TCL command interpreter and initialize all of the
  40.  *      extended Tcl commands..
  41.  *
  42.  * Results:
  43.  *      The return value is a token for the interpreter.
  44.  *-----------------------------------------------------------------------------
  45.  */
  46. Tcl_Interp *
  47. Tcl_CreateExtendedInterp ()
  48. {
  49.     Tcl_Interp *interp;
  50.  
  51.     interp = Tcl_CreateInterp ();
  52.  
  53.     /*
  54.      * from tclCkalloc.c (now part of the UCB Tcl).
  55.      */
  56. #ifdef TCL_MEM_DEBUG    
  57.     Tcl_InitMemory (interp);
  58. #endif
  59.  
  60.     /*
  61.      * from tclXbsearch.c
  62.      */
  63.     Tcl_CreateCommand (interp, "bsearch", Tcl_BsearchCmd, 
  64.                       (ClientData)NULL, (void (*)())NULL);
  65.  
  66.     /*
  67.      * from tclXchmod.c
  68.      */
  69.     Tcl_CreateCommand (interp, "chgrp", Tcl_ChgrpCmd, (ClientData)NULL,
  70.                       (void (*)())NULL);
  71.     Tcl_CreateCommand (interp, "chmod", Tcl_ChmodCmd, (ClientData)NULL,
  72.                       (void (*)())NULL);
  73.     Tcl_CreateCommand (interp, "chown", Tcl_ChownCmd, (ClientData)NULL,
  74.                       (void (*)())NULL);
  75.  
  76.     /*
  77.      * from tclXclock.c
  78.      */
  79.     Tcl_CreateCommand (interp, "getclock", Tcl_GetclockCmd, 
  80.                       (ClientData)NULL, (void (*)())NULL);
  81.     Tcl_CreateCommand (interp, "fmtclock", Tcl_FmtclockCmd, 
  82.                       (ClientData)NULL, (void (*)())NULL);
  83.  
  84.     /*
  85.      * from tclXcnvdate.c
  86.      */
  87.     Tcl_CreateCommand (interp, "convertclock", Tcl_ConvertclockCmd,
  88.                       (ClientData)NULL, (void (*)())NULL);
  89.  
  90.     /*
  91.      * from tclXcmdloop.c
  92.      */
  93.     Tcl_CreateCommand (interp, "commandloop", Tcl_CommandloopCmd, 
  94.                       (ClientData)NULL, (void (*)())NULL);
  95.  
  96.     /*
  97.      * from tclXdebug.c
  98.      */
  99.     Tcl_InitDebug (interp);
  100.  
  101.     /*
  102.      * from tclXdup.c
  103.      */
  104.     Tcl_CreateCommand (interp, "dup",  Tcl_DupCmd, 
  105.                        (ClientData) NULL, (void (*)())NULL);
  106.     /*
  107.      * from tclXtclXfcntl.c
  108.      */
  109.     Tcl_CreateCommand (interp, "fcntl", Tcl_FcntlCmd,
  110.                        (ClientData) NULL, (void (*)())NULL);
  111.  
  112.     /*
  113.      * from tclXfilecmds.c
  114.      */
  115.     Tcl_CreateCommand (interp, "pipe", Tcl_PipeCmd,
  116.                        (ClientData) NULL, (void (*)())NULL);
  117.     Tcl_CreateCommand (interp, "copyfile", Tcl_CopyfileCmd,
  118.                        (ClientData) NULL, (void (*)())NULL);
  119.     Tcl_CreateCommand (interp, "fstat", Tcl_FstatCmd,
  120.                        (ClientData) NULL, (void (*)())NULL);
  121.     Tcl_CreateCommand (interp, "lgets", Tcl_LgetsCmd,
  122.                        (ClientData) NULL, (void (*)())NULL);
  123.     Tcl_CreateCommand (interp, "flock", Tcl_FlockCmd,
  124.                        (ClientData) NULL, (void (*)())NULL);
  125.     Tcl_CreateCommand (interp, "funlock", Tcl_FunlockCmd,
  126.                        (ClientData) NULL, (void (*)())NULL);
  127.  
  128.     /*
  129.      * from tclXfilescan.c
  130.      */
  131.     Tcl_InitFilescan (interp);
  132.  
  133.     /*
  134.      * from tclXfmath.c
  135.      */
  136.     Tcl_CreateCommand(interp, "acos", Tcl_AcosCmd, 
  137.                      (ClientData)NULL, (void (*)())NULL);
  138.     Tcl_CreateCommand(interp, "asin", Tcl_AsinCmd, 
  139.                      (ClientData)NULL, (void (*)())NULL);
  140.     Tcl_CreateCommand(interp, "atan", Tcl_AtanCmd, 
  141.                      (ClientData)NULL, (void (*)())NULL);
  142.     Tcl_CreateCommand(interp, "cos", Tcl_CosCmd, 
  143.                      (ClientData)NULL, (void (*)())NULL);
  144.     Tcl_CreateCommand(interp, "sin", Tcl_SinCmd, 
  145.                      (ClientData)NULL, (void (*)())NULL);
  146.     Tcl_CreateCommand(interp, "tan", Tcl_TanCmd, 
  147.                      (ClientData)NULL, (void (*)())NULL);
  148.     Tcl_CreateCommand(interp, "cosh", Tcl_CoshCmd, 
  149.                      (ClientData)NULL, (void (*)())NULL);
  150.     Tcl_CreateCommand(interp, "sinh", Tcl_SinhCmd, 
  151.                      (ClientData)NULL, (void (*)())NULL);
  152.     Tcl_CreateCommand(interp, "tanh", Tcl_TanhCmd, 
  153.                      (ClientData)NULL, (void (*)())NULL);
  154.     Tcl_CreateCommand(interp, "exp", Tcl_ExpCmd, 
  155.                      (ClientData)NULL, (void (*)())NULL);
  156.     Tcl_CreateCommand(interp, "log", Tcl_LogCmd, 
  157.                      (ClientData)NULL, (void (*)())NULL);
  158.     Tcl_CreateCommand(interp, "log10", Tcl_Log10Cmd, 
  159.                      (ClientData)NULL, (void (*)())NULL);
  160.     Tcl_CreateCommand(interp, "sqrt", Tcl_SqrtCmd, 
  161.                      (ClientData)NULL, (void (*)())NULL);
  162.     Tcl_CreateCommand(interp, "fabs", Tcl_FabsCmd, 
  163.                      (ClientData)NULL, (void (*)())NULL);
  164.     Tcl_CreateCommand(interp, "floor", Tcl_FloorCmd, 
  165.                      (ClientData)NULL, (void (*)())NULL);
  166.     Tcl_CreateCommand(interp, "ceil", Tcl_CeilCmd, 
  167.                      (ClientData)NULL, (void (*)())NULL);
  168.     Tcl_CreateCommand(interp, "fmod", Tcl_FmodCmd, 
  169.                      (ClientData)NULL, (void (*)())NULL);
  170.     Tcl_CreateCommand(interp, "pow", Tcl_PowCmd, 
  171.                      (ClientData)NULL, (void (*)())NULL);
  172.  
  173.     /*
  174.      * from tclXgeneral.c
  175.      */
  176.     Tcl_CreateCommand(interp, "echo", Tcl_EchoCmd, 
  177.                      (ClientData)NULL, (void (*)())NULL);
  178.     Tcl_CreateCommand(interp, "infox", Tcl_InfoxCmd, 
  179.                      (ClientData)NULL, (void (*)())NULL);
  180.     Tcl_CreateCommand(interp, "loop", Tcl_LoopCmd, 
  181.                      (ClientData)NULL, (void (*)())NULL);
  182.  
  183.     /*
  184.      * from tclXid.c
  185.      */
  186.     Tcl_CreateCommand (interp, "id", Tcl_IdCmd,
  187.                        (ClientData)NULL, (void (*)())NULL);
  188.  
  189.     /*
  190.      * from tclXkeylist.c
  191.      */
  192.     Tcl_CreateCommand(interp, "keyldel", Tcl_KeyldelCmd,
  193.                      (ClientData)NULL, (void (*)())NULL);
  194.     Tcl_CreateCommand(interp, "keylget", Tcl_KeylgetCmd,
  195.                      (ClientData)NULL, (void (*)())NULL);
  196.     Tcl_CreateCommand(interp, "keylkeys", Tcl_KeylkeysCmd,
  197.                      (ClientData)NULL, (void (*)())NULL);
  198.     Tcl_CreateCommand(interp, "keylset", Tcl_KeylsetCmd,
  199.                      (ClientData)NULL, (void (*)())NULL);
  200.  
  201.     /*
  202.      * from tclXlist.c
  203.      */
  204.     Tcl_CreateCommand(interp, "lvarcat", Tcl_LvarcatCmd, 
  205.                      (ClientData)NULL, (void (*)())NULL);
  206.     Tcl_CreateCommand(interp, "lvarpop", Tcl_LvarpopCmd, 
  207.                      (ClientData)NULL, (void (*)())NULL);
  208.     Tcl_CreateCommand(interp, "lvarpush", Tcl_LvarpushCmd, 
  209.                      (ClientData)NULL, (void (*)())NULL);
  210.     Tcl_CreateCommand(interp, "lempty", Tcl_LemptyCmd, 
  211.                      (ClientData)NULL, (void (*)())NULL);
  212.     /*
  213.      * from tclXmath.c
  214.      */
  215.     Tcl_CreateCommand (interp, "max", Tcl_MaxCmd, (ClientData)NULL, 
  216.               (void (*)())NULL);
  217.     Tcl_CreateCommand (interp, "min", Tcl_MinCmd, (ClientData)NULL, 
  218.               (void (*)())NULL);
  219.     Tcl_CreateCommand (interp, "random", Tcl_RandomCmd, (ClientData)NULL, 
  220.               (void (*)())NULL);
  221.  
  222.     /*
  223.      * from tclXmsgcat.c
  224.      */
  225.     Tcl_InitMsgCat (interp);
  226.  
  227.     /*
  228.      * from tclXprocess.c
  229.      */
  230.     Tcl_CreateCommand (interp, "execl", Tcl_ExeclCmd, (ClientData)NULL,
  231.                       (void (*)())NULL);
  232.     Tcl_CreateCommand (interp, "fork", Tcl_ForkCmd, (ClientData)NULL,
  233.                       (void (*)())NULL);
  234.     Tcl_CreateCommand (interp, "wait", Tcl_WaitCmd, (ClientData)NULL,
  235.                       (void (*)())NULL);
  236.  
  237.     /*
  238.      * from tclXprofile.c
  239.      */
  240.     Tcl_InitProfile (interp);
  241.  
  242.     /*
  243.      * from tclXselect.c
  244.      */
  245.     Tcl_CreateCommand (interp, "select", Tcl_SelectCmd,
  246.                        (ClientData) NULL, (void (*)())NULL);
  247.  
  248.     /*
  249.      * from tclXsignal.c
  250.      */
  251.     Tcl_InitSignalHandling (interp);
  252.  
  253.     /*
  254.      * from tclXstring.c
  255.      */
  256.     Tcl_CreateCommand(interp, "cindex", Tcl_CindexCmd, 
  257.                      (ClientData)NULL, (void (*)())NULL);
  258.     Tcl_CreateCommand(interp, "clength", Tcl_ClengthCmd, 
  259.                      (ClientData)NULL, (void (*)())NULL);
  260.     Tcl_CreateCommand(interp, "crange", Tcl_CrangeCmd, 
  261.                      (ClientData)NULL, (void (*)())NULL);
  262.     Tcl_CreateCommand(interp, "csubstr", Tcl_CrangeCmd, 
  263.                      (ClientData)NULL, (void (*)())NULL);
  264.     Tcl_CreateCommand(interp, "replicate", Tcl_ReplicateCmd, 
  265.                      (ClientData)NULL, (void (*)())NULL);
  266.     Tcl_CreateCommand (interp, "translit", Tcl_TranslitCmd, (ClientData)NULL,
  267.                        (void (*)())NULL);
  268.     Tcl_CreateCommand (interp, "ctype", Tcl_CtypeCmd,
  269.                        (ClientData)NULL, (void (*)())NULL);
  270.  
  271.     /*
  272.      * from tclXlib.c
  273.      */
  274.     Tcl_CreateCommand (interp, "demand_load", Tcl_Demand_loadCmd,
  275.                       (ClientData)NULL, (void (*)())NULL);
  276.     Tcl_CreateCommand (interp, "loadlibindex", Tcl_LoadlibindexCmd,
  277.                       (ClientData)NULL, (void (*)())NULL);
  278.  
  279.     /*
  280.      * from tclXunixcmds.c
  281.      */
  282.     Tcl_CreateCommand (interp, "system", Tcl_SystemCmd, (ClientData)NULL,
  283.                       (void (*)())NULL);
  284.     Tcl_CreateCommand (interp, "times", Tcl_TimesCmd, (ClientData)NULL,
  285.                       (void (*)())NULL);
  286.     Tcl_CreateCommand (interp, "umask", Tcl_UmaskCmd, (ClientData)NULL,
  287.                       (void (*)())NULL);
  288.     Tcl_CreateCommand (interp, "link", Tcl_LinkCmd, (ClientData)NULL,
  289.                       (void (*)())NULL);
  290.     Tcl_CreateCommand (interp, "unlink", Tcl_UnlinkCmd, (ClientData)NULL,
  291.                       (void (*)())NULL);
  292.     Tcl_CreateCommand (interp, "mkdir", Tcl_MkdirCmd, (ClientData)NULL,
  293.                       (void (*)())NULL);
  294.     Tcl_CreateCommand (interp, "rmdir", Tcl_RmdirCmd, (ClientData)NULL,
  295.                       (void (*)())NULL);
  296.     Tcl_CreateCommand (interp, "alarm", Tcl_AlarmCmd, (ClientData)NULL, 
  297.                       (void (*)())NULL);
  298.     Tcl_CreateCommand (interp, "sleep", Tcl_SleepCmd, (ClientData)NULL, 
  299.                       (void (*)())NULL);
  300.  
  301.     return interp;
  302. }
  303.