Exemplo n.º 1
0
  public static Procedure findProc(Interp interp, String procName) {
    WrappedCommand cmd;
    WrappedCommand origCmd;

    try {
      cmd = Namespace.findCommand(interp, procName, null, 0);
    } catch (TclException e) {
      // This should never happen
      throw new TclRuntimeError("unexpected TclException: " + e);
    }

    if (cmd == null) {
      return null;
    }

    origCmd = Namespace.getOriginalCommand(cmd);
    if (origCmd != null) {
      cmd = origCmd;
    }
    if (!(cmd.cmd instanceof Procedure)) {
      return null;
    }
    return (Procedure) cmd.cmd;
  }