public Procedure( Interp interp, // Current interpreter. Namespace ns, // The namespace that the proc is defined in. String name, // Name of the procedure. TclObject args, // The formal arguments of this procedure. TclObject b, // The body of the procedure. String sFileName, // Initial value for the srcFileName member. int sLineNumber) // Initial value for the srcLineNumber member. throws TclException // Standard Tcl exception. { srcFileName = sFileName; srcLineNumber = sLineNumber; // Break up the argument list into argument specifiers, then process // each argument specifier. int numArgs = TclList.getLength(interp, args); argList = new TclObject[numArgs][2]; for (int i = 0; i < numArgs; i++) { // Now divide the specifier up into name and default. TclObject argSpec = TclList.index(interp, args, i); int specLen = TclList.getLength(interp, argSpec); if (specLen == 0) { // NEM 2010-06-14: updated to match Tcl 8.5+ and [apply] throw new TclException(interp, "argument with no name"); } if (specLen > 2) { throw new TclException( interp, "too many fields in argument " + "specifier \"" + argSpec + "\""); } TclObject argName = TclList.index(interp, argSpec, 0); String argNameStr = argName.toString(); if (argNameStr.indexOf("::") != -1) { // NEM: 2010-06-14: updated to match Tcl 8.5+ throw new TclException(interp, "formal parameter \"" + argSpec + "\" is not a simple name"); } else if (Var.isArrayVarname(argNameStr)) { // NEM: 2010-06-14: updated to match Tcl 8.5+ throw new TclException(interp, "formal parameter \"" + argSpec + "\" is an array element"); } argList[i][0] = argName; argList[i][0].preserve(); if (specLen == 2) { argList[i][1] = TclList.index(interp, argSpec, 1); argList[i][1].preserve(); } else { argList[i][1] = null; } } if (numArgs > 0 && (argList[numArgs - 1][0].toString().equals("args"))) { isVarArgs = true; } else { isVarArgs = false; } body = new CharPointer(b.toString()); body_length = body.length(); }