Branch: Tag:

2002-12-20

2002-12-20 19:07:07 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Some notes about the lfun:: namespace.

Rev: src/program.c:1.469

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: program.c,v 1.468 2002/12/11 20:26:45 grubba Exp $ + || $Id: program.c,v 1.469 2002/12/20 19:07:07 grubba Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.468 2002/12/11 20:26:45 grubba Exp $"); + RCSID("$Id: program.c,v 1.469 2002/12/20 19:07:07 grubba Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"
207:   };      /*! @namespace lfun:: +  *! +  *! Callback functions used to overload various builtin functions. +  *! +  *! The functions can be grouped into a few sets: +  *! +  *! @ul +  *! @item +  *! Object initialization and destruction. +  *! +  *! @[__INIT()], @[create()], @[destroy()] +  *! +  *! @item +  *! Unary operator overloading. +  *! +  *! @[`~()], @[`!()], +  *! @[_values()], @[cast()], +  *! @[_sizeof()], @[_indices()], +  *! @[__hash()] +  *! +  *! @item +  *! Binary assymetric operator overloading. +  *! +  *! @[`+()], @[``+()], +  *! @[`-()], @[``-()], +  *! @[`&()], @[``&()], +  *! @[`|()], @[``|()], +  *! @[`^()], @[``^()], +  *! @[`<<()], @[``<<()], +  *! @[`>>()], @[``>>()], +  *! @[`*()], @[``*()], +  *! @[`/()], @[``/()], +  *! @[`%()], @[``%()] +  *! +  *! @item +  *! Binary symetric operator overloading. +  *! +  *! The optimizer will make assumptions about the relations +  *! between these functions. +  *! +  *! @[`==()], @[_equal()], @[`<()], @[`>()] +  *! +  *! @item +  *! Other binary operator overloading. +  *! +  *! @[`[]()], @[`[]=()], @[`->()], +  *! @[`->=()], @[`+=()], @[`()()] +  *! +  *! @item +  *! Overloading of other builtin functions. +  *! +  *! @[_is_type()], @[_sprintf()], @[_m_delete()], +  *! @[_get_iterator()] +  *! @endul +  *! +  *! @note +  *! Although these functions are called from outside the object +  *! they exist in, they will still be used even if they are +  *! declared @tt{static@}. It is infact recommended to declare +  *! them @tt{static@}, since that will hinder them being used +  *! for other purposes. +  *! +  *! @seealso +  *! @[::]    */      /*! @decl void lfun::__INIT()
270:    *! the garbage-collector decides to destruct the object.    *!    *! @seealso -  *! @[lfun::create()], @[destruct()] +  *! @[lfun::create()], @[predef::destruct()]    */      /*! @decl mixed lfun::`+(zero ... args)
278:    *! Left associative addition operator callback.    *!    *! @seealso -  *! @[lfun::``+()], @[`+()] +  *! @[lfun::``+()], @[predef::`+()]    */      /*! @decl mixed lfun::`-(zero ... args)
286:    *! Left associative subtraction operator callback.    *!    *! @seealso -  *! @[lfun::``-()], @[`-()] +  *! @[lfun::``-()], @[predef::`-()]    */      /*! @decl mixed lfun::`&(zero ... args)
294:    *! Left associative and operator callback.    *!    *! @seealso -  *! @[lfun::``&()], @[`&()] +  *! @[lfun::``&()], @[predef::`&()]    */      /*! @decl mixed lfun::`|(zero ... args)
302:    *! Left associative or operator callback.    *!    *! @seealso -  *! @[lfun::``|()], @[`|()] +  *! @[lfun::``|()], @[predef::`|()]    */      /*! @decl mixed lfun::`^(zero ... args)
310:    *! Left associative exclusive or operator callback.    *!    *! @seealso -  *! @[lfun::``^()], @[`^()] +  *! @[lfun::``^()], @[predef::`^()]    */      /*! @decl mixed lfun::`<<(zero arg)
318:    *! Left associative left shift operator callback.    *!    *! @seealso -  *! @[lfun::``<<()], @[`<<()] +  *! @[lfun::``<<()], @[predef::`<<()]    */      /*! @decl mixed lfun::`>>(zero arg)
326:    *! Left associative right shift operator callback.    *!    *! @seealso -  *! @[lfun::``>>()], @[`>>()] +  *! @[lfun::``>>()], @[predef::`>>()]    */      /*! @decl mixed lfun::`*(zero ... args)
334:    *! Left associative multiplication operator callback.    *!    *! @seealso -  *! @[lfun::``*()], @[`*()] +  *! @[lfun::``*()], @[predef::`*()]    */      /*! @decl mixed lfun::`/(zero ... args)
342:    *! Left associative division operator callback.    *!    *! @seealso -  *! @[lfun::``/()], @[`/()] +  *! @[lfun::``/()], @[predef::`/()]    */      /*! @decl mixed lfun::`%(zero ... args)
350:    *! Left associative modulo operator callback.    *!    *! @seealso -  *! @[lfun::``%()], @[`%()] +  *! @[lfun::``%()], @[predef::`%()]    */      /*! @decl mixed lfun::`~()
358:    *! Inversion operator callback.    *!    *! @seealso -  *! @[`~()] +  *! @[predef::`~()]    */      /*! @decl int(0..1) lfun::`==(mixed arg)
366:    *! Equality operator callback.    *!    *! @seealso -  *! @[`==()] +  *! @[predef::`==()]    */      /*! @decl int(0..1) lfun::`<(mixed arg)
374:    *! Less than operator callback.    *!    *! @seealso -  *! @[`<()] +  *! @[predef::`<()]    */      /*! @decl int(0..1) lfun::`>(mixed arg)
382:    *! Greater than operator callback.    *!    *! @seealso -  *! @[`>()] +  *! @[predef::`>()]    */      /*! @decl int lfun::__hash()
425:    *! and @tt{0@} (zero) otherwise.    *!    *! @seealso -  *! @[`!()] +  *! @[predef::`!()]    */      /*! @decl mixed lfun::`[](zero arg1, zero|void arg2)
433:    *! Index/range operator callback.    *!    *! @seealso -  *! @[`[]()] +  *! @[predef::`[]()]    */      /*! @decl mixed lfun::`[]=(zero arg1, zero arg2)
441:    *! Index assignment operator callback.    *!    *! @seealso -  *! @[`[]=()], @[lfun::`->=()] +  *! @[predef::`[]=()], @[lfun::`->=()]    */      /*! @decl mixed lfun::`->(string arg)
449:    *! Arrow index operator callback.    *!    *! @seealso -  *! @[`->()] +  *! @[predef::`->()]    */      /*! @decl mixed lfun::`->=(string arg1, zero arg2)
457:    *! Arrow index assign operator callback.    *!    *! @seealso -  *! @[`->=()], @[lfun::`[]=()] +  *! @[predef::`->=()], @[lfun::`[]=()]    */      /*! @decl int lfun::_sizeof()
472:    *! Expected to return the number of valid indices in the object.    *!    *! @seealso -  *! @[sizeof()] +  *! @[predef::sizeof()]    */      /*! @decl array lfun::_indices()
483:    *! Expected to return an array with the valid indices in the object.    *!    *! @seealso -  *! @[indices()], @[lfun::_values()] +  *! @[predef::indices()], @[lfun::_values()]    */      /*! @decl array lfun::_values()
495:    *! the indices returned by @[lfun::_indices()].    *!    *! @seealso -  *! @[values()], @[lfun::_indices()] +  *! @[predef::values()], @[lfun::_indices()]    */      /*! @decl mixed lfun::`()(zero ... args)
503:    *! Function call operator callback.    *!    *! @seealso -  *! @[`()] +  *! @[predef::`()]    */      /*! @decl mixed lfun::``+(zero ... args)
511:    *! Right associative addition operator callback.    *!    *! @seealso -  *! @[lfun::`+()], @[`+()] +  *! @[lfun::`+()], @[predef::`+()]    */      /*! @decl mixed lfun::``-(zero ... args)
519:    *! Right associative subtraction operator callback.    *!    *! @seealso -  *! @[lfun::`-()], @[`-()] +  *! @[lfun::`-()], @[predef::`-()]    */      /*! @decl mixed lfun::``&(zero ... args)
527:    *! Right associative and operator callback.    *!    *! @seealso -  *! @[lfun::`&()], @[`&()] +  *! @[lfun::`&()], @[predef::`&()]    */      /*! @decl mixed lfun::``|(zero ... args)
535:    *! Right associative or operator callback.    *!    *! @seealso -  *! @[lfun::`|()], @[`|()] +  *! @[lfun::`|()], @[predef::`|()]    */      /*! @decl mixed lfun::``^(zero ... args)
543:    *! Right associative exclusive or operator callback.    *!    *! @seealso -  *! @[lfun::`^()], @[`^()] +  *! @[lfun::`^()], @[predef::`^()]    */      /*! @decl mixed lfun::``<<(zero arg)
551:    *! Right associative left shift operator callback.    *!    *! @seealso -  *! @[lfun::`<<()], @[`<<()] +  *! @[lfun::`<<()], @[predef::`<<()]    */      /*! @decl mixed lfun::``>>(zero arg)
559:    *! Right associative right shift operator callback.    *!    *! @seealso -  *! @[lfun::`>>()], @[`>>()] +  *! @[lfun::`>>()], @[predef::`>>()]    */      /*! @decl mixed lfun::``*(zero ... args)
567:    *! Right associative multiplication operator callback.    *!    *! @seealso -  *! @[lfun::`*()], @[`*()] +  *! @[lfun::`*()], @[predef::`*()]    */      /*! @decl mixed lfun::``/(zero ... args)
575:    *! Right associative division operator callback.    *!    *! @seealso -  *! @[lfun::`/()], @[`/()] +  *! @[lfun::`/()], @[predef::`/()]    */      /*! @decl mixed lfun::``%(zero ... args)
583:    *! Right associative modulo operator callback.    *!    *! @seealso -  *! @[lfun::`%()], @[`%()] +  *! @[lfun::`%()], @[predef::`%()]    */      /*! @decl mixed lfun::`+=(zero arg)
591:    *! Self increment operator callback.    *!    *! @seealso -  *! @[`+()], @[lfun::`+()] +  *! @[predef::`+()], @[lfun::`+()]    */      /*! @decl int(0..1) lfun::_is_type(string basic_type)
709:    *! @endint    *!    *! @seealso -  *! @[sprintf()] +  *! @[predef::sprintf()]    */      /*! @decl int lfun::_equal(mixed arg)
717:    *! Equal callback.    *!    *! @seealso -  *! @[equal()], @[lfun::`==()] +  *! @[predef::equal()], @[lfun::`==()]    */      /*! @decl mixed lfun::_m_delete(mixed arg)
725:    *! Mapping delete callback.    *!    *! @seealso -  *! @[m_delete()] +  *! @[predef::m_delete()]    */      /*! @decl object lfun::_get_iterator()
747:    *! @enddl    *!    *! @seealso -  *! @[Iterator], @[foreach()] +  *! @[predef::Iterator], @[predef::foreach()]    */      /*! @endnamespace