/*
 * $Log: Function.js,v $
 * Revision 1.2  2002/07/22 19:42:34  bc6ix
 * fix line endings
 *
 * Revision 1.1  2002/07/22 14:01:10  bc6ix
 * Initial check in
 *
 */

/* ***** BEGIN LICENSE BLOCK *****
 * Licensed under Version: MPL 1.1/GPL 2.0/LGPL 2.1
 * Full Terms at /xbProjects-license/mpl-tri-license.txt
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Bob Clary code.
 *
 * The Initial Developer of the Original Code is
 * Bob Clary.
 * Portions created by the Initial Developer are Copyright (C) 2000
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s): Bob Clary <bc@bclary.com>
 *
 * ***** END LICENSE BLOCK ***** */

// Function
//
// functionToString() is a replacement for the standard Function.toString()
// so that only the function name and argument list are returned rather than
// all of the source code for the function.
function functionToString()
{
  var s = this.oldToString();
  var i;
  var t;
  
  if (s == null || typeof(s) != 'string' || s.length == 0)
    return '';
  
  i = s.indexOf('native code');
  if (i != -1  && s.indexOf('functionToString') == -1)
    return s;
    
  i = s.indexOf(')');
  if (i == -1)
    t = s;
  else
    t = s.substr(0, i+1) + '{ [user code] }';
    
  return t;
}

Function.prototype.oldToString = Function.prototype.toString;
Function.prototype.toString    = functionToString;

