summaryrefslogtreecommitdiffstats
path: root/unix/dltest
diff options
context:
space:
mode:
Diffstat (limited to 'unix/dltest')
-rw-r--r--unix/dltest/pkga.c59
-rw-r--r--unix/dltest/pkgb.c69
-rw-r--r--unix/dltest/pkgc.c61
-rw-r--r--unix/dltest/pkgd.c63
-rw-r--r--unix/dltest/pkge.c10
5 files changed, 133 insertions, 129 deletions
diff --git a/unix/dltest/pkga.c b/unix/dltest/pkga.c
index 4cda651..35bc95c 100644
--- a/unix/dltest/pkga.c
+++ b/unix/dltest/pkga.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: pkga.c,v 1.3 1999/03/11 21:47:40 stanton Exp $
+ * RCS: @(#) $Id: pkga.c,v 1.4 2000/04/04 08:06:07 hobbs Exp $
*/
#include "tcl.h"
@@ -17,15 +17,15 @@
* Prototypes for procedures defined later in this file:
*/
-static int Pkga_EqCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv));
-static int Pkga_QuoteCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv));
+static int Pkga_EqObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
+static int Pkga_QuoteObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
/*
*----------------------------------------------------------------------
*
- * Pkga_EqCmd --
+ * Pkga_EqObjCmd --
*
* This procedure is invoked to process the "pkga_eq" Tcl command.
* It expects two arguments and returns 1 if they are the same,
@@ -41,30 +41,28 @@ static int Pkga_QuoteCmd _ANSI_ARGS_((ClientData clientData,
*/
static int
-Pkga_EqCmd(dummy, interp, argc, argv)
- ClientData dummy; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Pkga_EqObjCmd(dummy, interp, objc, objv)
+ ClientData dummy; /* Not used. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int objc; /* Number of arguments. */
+ Tcl_Obj * CONST objv[]; /* Argument objects. */
{
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " string1 string2\"", (char *) NULL);
+ int result;
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "string1 string2");
return TCL_ERROR;
}
- if (strcmp(argv[1], argv[2]) == 0) {
- interp->result = "1";
- } else {
- interp->result = "0";
- }
+ result = !strcmp(Tcl_GetString(objv[1]), Tcl_GetString(objv[2]));
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(result));
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * Pkga_quoteCmd --
+ * Pkga_QuoteObjCmd --
*
* This procedure is invoked to process the "pkga_quote" Tcl command.
* It expects one argument, which it returns as result.
@@ -79,18 +77,17 @@ Pkga_EqCmd(dummy, interp, argc, argv)
*/
static int
-Pkga_QuoteCmd(dummy, interp, argc, argv)
+Pkga_QuoteObjCmd(dummy, interp, objc, objv)
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+ int objc; /* Number of arguments. */
+ Tcl_Obj * CONST objv[]; /* Argument strings. */
{
- if (argc != 2) {
- Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " value\"", (char *) NULL);
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "value");
return TCL_ERROR;
}
- strcpy(interp->result, argv[1]);
+ Tcl_SetObjResult(interp, objv[1]);
return TCL_OK;
}
@@ -125,9 +122,9 @@ Pkga_Init(interp)
if (code != TCL_OK) {
return code;
}
- Tcl_CreateCommand(interp, "pkga_eq", Pkga_EqCmd, (ClientData) 0,
- (Tcl_CmdDeleteProc *) NULL);
- Tcl_CreateCommand(interp, "pkga_quote", Pkga_QuoteCmd, (ClientData) 0,
- (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateObjCommand(interp, "pkga_eq", Pkga_EqObjCmd,
+ (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateObjCommand(interp, "pkga_quote", Pkga_QuoteObjCmd,
+ (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
return TCL_OK;
}
diff --git a/unix/dltest/pkgb.c b/unix/dltest/pkgb.c
index 5104e7c..1c43106 100644
--- a/unix/dltest/pkgb.c
+++ b/unix/dltest/pkgb.c
@@ -2,7 +2,7 @@
* pkgb.c --
*
* This file contains a simple Tcl package "pkgb" that is intended
- * for testing the Tcl dynamic loading facilities. It can be used
+ * for testing the Tcl dynamic loading facilities. It can be used
* in both safe and unsafe interpreters.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: pkgb.c,v 1.3 1999/03/11 21:47:40 stanton Exp $
+ * RCS: @(#) $Id: pkgb.c,v 1.4 2000/04/04 08:06:07 hobbs Exp $
*/
#include "tcl.h"
@@ -18,15 +18,15 @@
* Prototypes for procedures defined later in this file:
*/
-static int Pkgb_SubCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv));
-static int Pkgb_UnsafeCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv));
+static int Pkgb_SubObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
+static int Pkgb_UnsafeObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
/*
*----------------------------------------------------------------------
*
- * Pkgb_SubCmd --
+ * Pkgb_SubObjCmd --
*
* This procedure is invoked to process the "pkgb_sub" Tcl command.
* It expects two arguments and returns their difference.
@@ -41,31 +41,30 @@ static int Pkgb_UnsafeCmd _ANSI_ARGS_((ClientData clientData,
*/
static int
-Pkgb_SubCmd(dummy, interp, argc, argv)
- ClientData dummy; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Pkgb_SubObjCmd(dummy, interp, objc, objv)
+ ClientData dummy; /* Not used. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int objc; /* Number of arguments. */
+ Tcl_Obj * CONST objv[]; /* Argument objects. */
{
int first, second;
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " num num\"", (char *) NULL);
- return TCL_ERROR;
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "num num");
+ return TCL_ERROR;
}
- if ((Tcl_GetInt(interp, argv[1], &first) != TCL_OK)
- || (Tcl_GetInt(interp, argv[2], &second) != TCL_OK)) {
- return TCL_ERROR;
+ if ((Tcl_GetIntFromObj(interp, objv[1], &first) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[2], &second) != TCL_OK)) {
+ return TCL_ERROR;
}
- sprintf(interp->result, "%d", first - second);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(first - second));
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * Pkgb_UnsafeCmd --
+ * Pkgb_UnsafeObjCmd --
*
* This procedure is invoked to process the "pkgb_unsafe" Tcl command.
* It just returns a constant string.
@@ -80,13 +79,13 @@ Pkgb_SubCmd(dummy, interp, argc, argv)
*/
static int
-Pkgb_UnsafeCmd(dummy, interp, argc, argv)
- ClientData dummy; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Pkgb_UnsafeObjCmd(dummy, interp, objc, objv)
+ ClientData dummy; /* Not used. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int objc; /* Number of arguments. */
+ Tcl_Obj * CONST objv[]; /* Argument objects. */
{
- interp->result = "unsafe command invoked";
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("unsafe command invoked", -1));
return TCL_OK;
}
@@ -121,10 +120,10 @@ Pkgb_Init(interp)
if (code != TCL_OK) {
return code;
}
- Tcl_CreateCommand(interp, "pkgb_sub", Pkgb_SubCmd, (ClientData) 0,
- (Tcl_CmdDeleteProc *) NULL);
- Tcl_CreateCommand(interp, "pkgb_unsafe", Pkgb_UnsafeCmd, (ClientData) 0,
- (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateObjCommand(interp, "pkgb_sub", Pkgb_SubObjCmd,
+ (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateObjCommand(interp, "pkgb_unsafe", Pkgb_UnsafeObjCmd,
+ (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
return TCL_OK;
}
@@ -150,10 +149,16 @@ Pkgb_SafeInit(interp)
Tcl_Interp *interp; /* Interpreter in which the package is
* to be made available. */
{
+ int code;
+
if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
return TCL_ERROR;
}
- Tcl_CreateCommand(interp, "pkgb_sub", Pkgb_SubCmd, (ClientData) 0,
+ code = Tcl_PkgProvide(interp, "Pkgb", "2.3");
+ if (code != TCL_OK) {
+ return code;
+ }
+ Tcl_CreateObjCommand(interp, "pkgb_sub", Pkgb_SubObjCmd, (ClientData) 0,
(Tcl_CmdDeleteProc *) NULL);
return TCL_OK;
}
diff --git a/unix/dltest/pkgc.c b/unix/dltest/pkgc.c
index 9aac361..2d8f576 100644
--- a/unix/dltest/pkgc.c
+++ b/unix/dltest/pkgc.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: pkgc.c,v 1.3 1999/03/11 21:47:40 stanton Exp $
+ * RCS: @(#) $Id: pkgc.c,v 1.4 2000/04/04 08:06:07 hobbs Exp $
*/
#include "tcl.h"
@@ -18,15 +18,15 @@
* Prototypes for procedures defined later in this file:
*/
-static int Pkgc_SubCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv));
-static int Pkgc_UnsafeCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv));
+static int Pkgc_SubObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
+static int Pkgc_UnsafeObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
/*
*----------------------------------------------------------------------
*
- * Pkgc_SubCmd --
+ * Pkgc_SubObjCmd --
*
* This procedure is invoked to process the "pkgc_sub" Tcl command.
* It expects two arguments and returns their difference.
@@ -41,24 +41,23 @@ static int Pkgc_UnsafeCmd _ANSI_ARGS_((ClientData clientData,
*/
static int
-Pkgc_SubCmd(dummy, interp, argc, argv)
- ClientData dummy; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Pkgc_SubObjCmd(dummy, interp, objc, objv)
+ ClientData dummy; /* Not used. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int objc; /* Number of arguments. */
+ Tcl_Obj * CONST objv[]; /* Argument objects. */
{
int first, second;
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " num num\"", (char *) NULL);
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "num num");
return TCL_ERROR;
}
- if ((Tcl_GetInt(interp, argv[1], &first) != TCL_OK)
- || (Tcl_GetInt(interp, argv[2], &second) != TCL_OK)) {
+ if ((Tcl_GetIntFromObj(interp, objv[1], &first) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[2], &second) != TCL_OK)) {
return TCL_ERROR;
}
- sprintf(interp->result, "%d", first - second);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(first - second));
return TCL_OK;
}
@@ -80,13 +79,13 @@ Pkgc_SubCmd(dummy, interp, argc, argv)
*/
static int
-Pkgc_UnsafeCmd(dummy, interp, argc, argv)
- ClientData dummy; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Pkgc_UnsafeObjCmd(dummy, interp, objc, objv)
+ ClientData dummy; /* Not used. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int objc; /* Number of arguments. */
+ Tcl_Obj * CONST objv[]; /* Argument objects. */
{
- interp->result = "unsafe command invoked";
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("unsafe command invoked", -1));
return TCL_OK;
}
@@ -121,10 +120,10 @@ Pkgc_Init(interp)
if (code != TCL_OK) {
return code;
}
- Tcl_CreateCommand(interp, "pkgc_sub", Pkgc_SubCmd, (ClientData) 0,
- (Tcl_CmdDeleteProc *) NULL);
- Tcl_CreateCommand(interp, "pkgc_unsafe", Pkgc_UnsafeCmd, (ClientData) 0,
- (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateObjCommand(interp, "pkgc_sub", Pkgc_SubObjCmd,
+ (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateObjCommand(interp, "pkgc_unsafe", Pkgc_UnsafeObjCmd,
+ (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
return TCL_OK;
}
@@ -150,10 +149,16 @@ Pkgc_SafeInit(interp)
Tcl_Interp *interp; /* Interpreter in which the package is
* to be made available. */
{
+ int code;
+
if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
return TCL_ERROR;
}
- Tcl_CreateCommand(interp, "pkgc_sub", Pkgc_SubCmd, (ClientData) 0,
+ code = Tcl_PkgProvide(interp, "Pkgc", "1.7.2");
+ if (code != TCL_OK) {
+ return code;
+ }
+ Tcl_CreateObjCommand(interp, "pkgc_sub", Pkgc_SubObjCmd, (ClientData) 0,
(Tcl_CmdDeleteProc *) NULL);
return TCL_OK;
}
diff --git a/unix/dltest/pkgd.c b/unix/dltest/pkgd.c
index 8780b47..7c91405 100644
--- a/unix/dltest/pkgd.c
+++ b/unix/dltest/pkgd.c
@@ -2,7 +2,7 @@
* pkgd.c --
*
* This file contains a simple Tcl package "pkgd" that is intended
- * for testing the Tcl dynamic loading facilities. It can be used
+ * for testing the Tcl dynamic loading facilities. It can be used
* in both safe and unsafe interpreters.
*
* Copyright (c) 1995 Sun Microsystems, Inc.
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: pkgd.c,v 1.3 1999/03/11 21:47:40 stanton Exp $
+ * RCS: @(#) $Id: pkgd.c,v 1.4 2000/04/04 08:06:07 hobbs Exp $
*/
#include "tcl.h"
@@ -19,15 +19,15 @@
* Prototypes for procedures defined later in this file:
*/
-static int Pkgd_SubCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv));
-static int Pkgd_UnsafeCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv));
+static int Pkgd_SubObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
+static int Pkgd_UnsafeObjCmd _ANSI_ARGS_((ClientData clientData,
+ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
/*
*----------------------------------------------------------------------
*
- * Pkgd_SubCmd --
+ * Pkgd_SubObjCmd --
*
* This procedure is invoked to process the "pkgd_sub" Tcl command.
* It expects two arguments and returns their difference.
@@ -42,24 +42,23 @@ static int Pkgd_UnsafeCmd _ANSI_ARGS_((ClientData clientData,
*/
static int
-Pkgd_SubCmd(dummy, interp, argc, argv)
- ClientData dummy; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Pkgd_SubObjCmd(dummy, interp, objc, objv)
+ ClientData dummy; /* Not used. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int objc; /* Number of arguments. */
+ Tcl_Obj * CONST objv[]; /* Argument objects. */
{
int first, second;
- if (argc != 3) {
- Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " num num\"", (char *) NULL);
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "num num");
return TCL_ERROR;
}
- if ((Tcl_GetInt(interp, argv[1], &first) != TCL_OK)
- || (Tcl_GetInt(interp, argv[2], &second) != TCL_OK)) {
+ if ((Tcl_GetIntFromObj(interp, objv[1], &first) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[2], &second) != TCL_OK)) {
return TCL_ERROR;
}
- sprintf(interp->result, "%d", first - second);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(first - second));
return TCL_OK;
}
@@ -81,13 +80,13 @@ Pkgd_SubCmd(dummy, interp, argc, argv)
*/
static int
-Pkgd_UnsafeCmd(dummy, interp, argc, argv)
- ClientData dummy; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- char **argv; /* Argument strings. */
+Pkgd_UnsafeObjCmd(dummy, interp, objc, objv)
+ ClientData dummy; /* Not used. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int objc; /* Number of arguments. */
+ Tcl_Obj * CONST objv[]; /* Argument objects. */
{
- interp->result = "unsafe command invoked";
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("unsafe command invoked", -1));
return TCL_OK;
}
@@ -122,10 +121,10 @@ Pkgd_Init(interp)
if (code != TCL_OK) {
return code;
}
- Tcl_CreateCommand(interp, "pkgd_sub", Pkgd_SubCmd, (ClientData) 0,
- (Tcl_CmdDeleteProc *) NULL);
- Tcl_CreateCommand(interp, "pkgd_unsafe", Pkgd_UnsafeCmd, (ClientData) 0,
- (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateObjCommand(interp, "pkgd_sub", Pkgd_SubObjCmd,
+ (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+ Tcl_CreateObjCommand(interp, "pkgd_unsafe", Pkgd_UnsafeObjCmd,
+ (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
return TCL_OK;
}
@@ -151,10 +150,16 @@ Pkgd_SafeInit(interp)
Tcl_Interp *interp; /* Interpreter in which the package is
* to be made available. */
{
+ int code;
+
if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
return TCL_ERROR;
}
- Tcl_CreateCommand(interp, "pkgd_sub", Pkgd_SubCmd, (ClientData) 0,
+ code = Tcl_PkgProvide(interp, "Pkgd", "7.3");
+ if (code != TCL_OK) {
+ return code;
+ }
+ Tcl_CreateObjCommand(interp, "pkgd_sub", Pkgd_SubObjCmd, (ClientData) 0,
(Tcl_CmdDeleteProc *) NULL);
return TCL_OK;
}
diff --git a/unix/dltest/pkge.c b/unix/dltest/pkge.c
index 6c74366..d8f71c2 100644
--- a/unix/dltest/pkge.c
+++ b/unix/dltest/pkge.c
@@ -10,19 +10,11 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: pkge.c,v 1.4 1999/04/16 00:48:06 stanton Exp $
+ * RCS: @(#) $Id: pkge.c,v 1.5 2000/04/04 08:06:07 hobbs Exp $
*/
#include "tcl.h"
-/*
- * Prototypes for procedures defined later in this file:
- */
-
-static int Pkgd_SubCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv));
-static int Pkgd_UnsafeCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int argc, char **argv));
/*
*----------------------------------------------------------------------