summaryrefslogtreecommitdiffstats
path: root/generic/tclProcess.c
diff options
context:
space:
mode:
authorf.bonnet <f.bonnet>2017-08-17 13:02:27 (GMT)
committerf.bonnet <f.bonnet>2017-08-17 13:02:27 (GMT)
commitc86a23de04031e905caf60b8b28dfeed64b8ba5f (patch)
tree238f1f08b1c456d2542149fd47b3f00a225d2cbe /generic/tclProcess.c
parentf0aac87b35eafdc69d4fd6cbe7c00bd9417cf6c0 (diff)
downloadtcl-c86a23de04031e905caf60b8b28dfeed64b8ba5f.zip
tcl-c86a23de04031e905caf60b8b28dfeed64b8ba5f.tar.gz
tcl-c86a23de04031e905caf60b8b28dfeed64b8ba5f.tar.bz2
Basic scaffolding for tcl::process
Diffstat (limited to 'generic/tclProcess.c')
-rw-r--r--generic/tclProcess.c175
1 files changed, 175 insertions, 0 deletions
diff --git a/generic/tclProcess.c b/generic/tclProcess.c
new file mode 100644
index 0000000..3fcdacd
--- /dev/null
+++ b/generic/tclProcess.c
@@ -0,0 +1,175 @@
+/*
+ * tclProcess.c --
+ *
+ * This file implements the "tcl::process" ensemble for subprocess
+ * management as defined by TIP #462.
+ *
+ * Copyright (c) 2017 Frederic Bonnet.
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+ #include "tclInt.h"
+
+ /*
+ * Prototypes for functions defined later in this file:
+ */
+
+static int ProcessListObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int ProcessStatusObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int ProcessPurgeObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int ProcessAutopurgeObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+
+/*----------------------------------------------------------------------
+ *
+ * ProcessListObjCmd --
+ *
+ * This function implements the 'tcl::process list' Tcl command.
+ * Refer to the user documentation for details on what it does.
+ *
+ * Results:
+ * Returns a standard Tcl result.
+ *
+ * Side effects:
+ * None.TODO
+ *
+ *----------------------------------------------------------------------
+ */
+
+ static int
+ ProcessListObjCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+ {
+ /* TODO */
+ return TCL_ERROR;
+ }
+
+/*----------------------------------------------------------------------
+ *
+ * ProcessStatusObjCmd --
+ *
+ * This function implements the 'tcl::process status' Tcl command.
+ * Refer to the user documentation for details on what it does.
+ *
+ * Results:
+ * Returns a standard Tcl result.
+ *
+ * Side effects:
+ * None.TODO
+ *
+ *----------------------------------------------------------------------
+ */
+
+ static int
+ ProcessStatusObjCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+ {
+ /* TODO */
+ return TCL_ERROR;
+ }
+
+/*----------------------------------------------------------------------
+ *
+ * ProcessPurgeObjCmd --
+ *
+ * This function implements the 'tcl::process purge' Tcl command.
+ * Refer to the user documentation for details on what it does.
+ *
+ * Results:
+ * Returns a standard Tcl result.
+ *
+ * Side effects:
+ * None.TODO
+ *
+ *----------------------------------------------------------------------
+ */
+
+ static int
+ ProcessPurgeObjCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+ {
+ /* TODO */
+ return TCL_ERROR;
+ }
+
+/*----------------------------------------------------------------------
+ *
+ * ProcessAutopurgeObjCmd --
+ *
+ * This function implements the 'tcl::process autopurge' Tcl command.
+ * Refer to the user documentation for details on what it does.
+ *
+ * Results:
+ * Returns a standard Tcl result.
+ *
+ * Side effects:
+ * None.TODO
+ *
+ *----------------------------------------------------------------------
+ */
+
+ static int
+ ProcessAutopurgeObjCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+ {
+ /* TODO */
+ return TCL_ERROR;
+ }
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TclInitProcessCmd --
+ *
+ * This procedure creates the "tcl::process" Tcl command. See the user
+ * documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+ Tcl_Command
+ TclInitProcessCmd(
+ Tcl_Interp *interp) /* Current interpreter. */
+ {
+ static const EnsembleImplMap processImplMap[] = {
+ {"list", ProcessListObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 1},
+ {"status", ProcessStatusObjCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 1},
+ {"purge", ProcessPurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
+ {"autopurge", ProcessAutopurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1},
+ {NULL, NULL, NULL, NULL, NULL, 0}
+ };
+ Tcl_Command processCmd;
+
+ processCmd = TclMakeEnsemble(interp, "::tcl::process", processImplMap);
+ Tcl_Export(interp, Tcl_FindNamespace(interp, "::tcl", NULL, 0),
+ "process", 0);
+ return processCmd;
+ }
+ \ No newline at end of file