4 * This file contains a simple Tcl package "pkga" that is intended for
5 * testing the Tcl dynamic loading facilities.
7 * Copyright (c) 1995 Sun Microsystems, Inc.
9 * See the file "license.terms" for information on usage and redistribution of
10 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
17 * Prototypes for procedures defined later in this file:
20 static int Pkga_EqObjCmd(ClientData clientData,
21 Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
22 static int Pkga_QuoteObjCmd(ClientData clientData,
23 Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
26 *----------------------------------------------------------------------
30 * This procedure is invoked to process the "pkga_eq" Tcl command. It
31 * expects two arguments and returns 1 if they are the same, 0 if they
35 * A standard Tcl result.
38 * See the user documentation.
40 *----------------------------------------------------------------------
45 ClientData dummy, /* Not used. */
46 Tcl_Interp *interp, /* Current interpreter. */
47 int objc, /* Number of arguments. */
48 Tcl_Obj *const objv[]) /* Argument objects. */
51 const char *str1, *str2;
56 Tcl_WrongNumArgs(interp, 1, objv, "string1 string2");
60 str1 = Tcl_GetStringFromObj(objv[1], &len1);
61 str2 = Tcl_GetStringFromObj(objv[2], &len2);
63 result = (Tcl_UtfNcmp(str1, str2, len1) == 0);
67 Tcl_SetObjResult(interp, Tcl_NewIntObj(result));
72 *----------------------------------------------------------------------
76 * This procedure is invoked to process the "pkga_quote" Tcl command. It
77 * expects one argument, which it returns as result.
80 * A standard Tcl result.
83 * See the user documentation.
85 *----------------------------------------------------------------------
90 ClientData dummy, /* Not used. */
91 Tcl_Interp *interp, /* Current interpreter. */
92 int objc, /* Number of arguments. */
93 Tcl_Obj *const objv[]) /* Argument strings. */
98 Tcl_WrongNumArgs(interp, 1, objv, "value");
101 Tcl_SetObjResult(interp, objv[1]);
106 *----------------------------------------------------------------------
110 * This is a package initialization procedure, which is called by Tcl
111 * when this package is to be added to an interpreter.
119 *----------------------------------------------------------------------
124 Tcl_Interp *interp) /* Interpreter in which the package is to be
129 if (Tcl_InitStubs(interp, "8.5", 0) == NULL) {
132 code = Tcl_PkgProvide(interp, "pkga", "1.0");
133 if (code != TCL_OK) {
136 Tcl_CreateObjCommand(interp, "pkga_eq", Pkga_EqObjCmd, NULL, NULL);
137 Tcl_CreateObjCommand(interp, "pkga_quote", Pkga_QuoteObjCmd, NULL,