/* Copyright (c) 1997-2006 -*- C -*- Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany) http://www.math.tu-berlin.de/polymake, mailto:polymake@math.tu-berlin.de This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version: http://www.gnu.org/licenses/gpl.txt. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ident "$Project: polymake $$Id: Overload.xs 7164 2006-03-07 17:54:08Z gawrilow $" #include "Ext.h" static HV *keyword_stash, *UNIVERSAL_stash; MODULE = Poly::Overload PACKAGE = Poly::Overload PROTOTYPES: DISABLE void can_signature(arg, signature, keywords) SV *arg; SV *signature; SV *keywords; PPCODE: { STRLEN method_name_len; char *method_name=SvPV(signature,method_name_len); HV *stash= SvROK(arg) && SvOBJECT(SvRV(arg)) ? SvSTASH(SvRV(arg)) : SvTRUE(keywords) && SvIsUV(arg) ? keyword_stash : UNIVERSAL_stash; GV *glob=gv_fetchmeth(stash, method_name, method_name_len, 0); if (glob) PUSHs( sv_2mortal(newRV((SV*)GvCV(glob))) ); else PUSHs( &PL_sv_undef ); } BOOT: keyword_stash=gv_stashpv("Poly::Overload::keyword", TRUE); UNIVERSAL_stash=gv_stashpv("UNIVERSAL", FALSE);