/* * This file was generated automatically by ExtUtils::ParseXS version 2.18 from the * contents of Shell.xs. Do not edit this file, edit Shell.xs instead. * * ANY CHANGES MADE HERE WILL BE LOST! * */ #line 1 "Shell.xs" /* Copyright (c) 1997-2005 -*- 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: Shell.xs 6660 2005-12-21 20:34:01Z gawrilow $" #include "Ext.h" #ifndef PERL_UNUSED_VAR # define PERL_UNUSED_VAR(var) if (0) var = var #endif #line 34 "Shell.c" XS(XS_Poly__Shell_return_to_var); /* prototype to pass -Wmissing-prototypes */ XS(XS_Poly__Shell_return_to_var) { #ifdef dVAR dVAR; dXSARGS; #else dXSARGS; #endif if (items != 0) Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::Shell::return_to_var", ""); PERL_UNUSED_VAR(cv); /* -W */ PERL_UNUSED_VAR(ax); /* -Wall */ SP -= items; { #line 27 "Shell.xs" { PERL_CONTEXT *cx_bottom=cxstack, *cx=cx_bottom+cxstack_ix; OP *next_op; GV *gv; XPUSHs(&PL_sv_undef); /* default answer */ while (cx >= cx_bottom) { if (CxTYPE(cx) == CXt_SUB && (!avoid_db_sub || cx->blk_sub.cv == avoid_db_sub)) { if (cx->blk_gimme != G_SCALAR) break; next_op=PL_retstack[cx->blk_oldretsp-1]; if (next_op->op_type != OP_LEAVESUB) { if (next_op->op_type == OP_GVSV && next_op->op_next->op_type == OP_SASSIGN) { #ifdef USE_ITHREADS SV **saved_curpad=PL_curpad; PL_curpad=get_cx_curpad(aTHX_ cx, cx_bottom); #endif gv=cGVOPx_gv(next_op); #ifdef USE_ITHREADS PL_curpad=saved_curpad; #endif TOPs=sv_2mortal(newSVpvn(GvNAME(gv),GvNAMELEN(gv))); } break; } } --cx; } } #line 80 "Shell.c" PUTBACK; return; } } XS(XS_Poly__Shell_get_chained); /* prototype to pass -Wmissing-prototypes */ XS(XS_Poly__Shell_get_chained) { #ifdef dVAR dVAR; dXSARGS; #else dXSARGS; #endif PERL_UNUSED_VAR(cv); /* -W */ PERL_UNUSED_VAR(ax); /* -Wall */ SP -= items; { #line 60 "Shell.xs" { PERL_CONTEXT *cx_bottom=cxstack, *cx=cx_bottom+cxstack_ix; while (cx >= cx_bottom) { if (CxTYPE(cx) == CXt_SUB && (!avoid_db_sub || cx->blk_sub.cv == avoid_db_sub)) { OP *o=PL_retstack[cx->blk_oldretsp-1]; cx->blk_gimme=G_ARRAY; if (o->op_type != OP_LEAVESUB) { I32 skip=FALSE; #ifdef USE_ITHREADS SV **saved_curpad=0; #endif while (o->op_type == OP_CONST && o->op_next->op_type == OP_CONCAT) { #ifdef USE_ITHREADS if (!skip) { saved_curpad=PL_curpad; PL_curpad=get_cx_curpad(aTHX_ cx, cx_bottom); } #endif XPUSHs(cSVOPo_sv); skip=TRUE; o=o->op_next->op_next; } if (skip) { PL_retstack[cx->blk_oldretsp-1]=o; #ifdef USE_ITHREADS PL_curpad=saved_curpad; #endif } break; } } --cx; } } items=0; #line 135 "Shell.c" PUTBACK; return; } } XS(XS_Poly__Shell_passed_to); /* prototype to pass -Wmissing-prototypes */ XS(XS_Poly__Shell_passed_to) { #ifdef dVAR dVAR; dXSARGS; #else dXSARGS; #endif if (items != 1) Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::Shell::passed_to", "sub"); PERL_UNUSED_VAR(cv); /* -W */ PERL_UNUSED_VAR(ax); /* -Wall */ SP -= items; { SV * sub = ST(0); #line 100 "Shell.xs" { PERL_CONTEXT *cx_bottom=cxstack, *cx_top=cx_bottom+cxstack_ix, *cx=cx_top; OP *o; while (cx >= cx_bottom) { if (CxTYPE(cx) == CXt_SUB && (!avoid_db_sub || cx->blk_sub.cv == avoid_db_sub)) { o=PL_retstack[cx->blk_oldretsp-1]; if (o->op_type != OP_LEAVESUB && o->op_type != OP_LEAVESUBLV) { if (o->op_type == OP_GV && o->op_next->op_type == OP_ENTERSUB) { CV *cv; #ifdef USE_ITHREADS SV **saved_curpad=PL_curpad; PL_curpad=get_cx_curpad(aTHX_ cx, cx_bottom); #endif cv=GvCV(cGVOPo_gv); #ifdef USE_ITHREADS PL_curpad=saved_curpad; #endif if (cv == (CV*)SvRV(sub)) XSRETURN_YES; } break; } } --cx; } XSRETURN_NO; } #line 184 "Shell.c" PUTBACK; return; } } #ifdef __cplusplus extern "C" #endif XS(boot_Poly__Shell); /* prototype to pass -Wmissing-prototypes */ XS(boot_Poly__Shell) { #ifdef dVAR dVAR; dXSARGS; #else dXSARGS; #endif char* file = __FILE__; PERL_UNUSED_VAR(cv); /* -W */ PERL_UNUSED_VAR(items); /* -W */ XS_VERSION_BOOTCHECK ; newXS("Poly::Shell::return_to_var", XS_Poly__Shell_return_to_var, file); newXS("Poly::Shell::get_chained", XS_Poly__Shell_get_chained, file); newXS("Poly::Shell::passed_to", XS_Poly__Shell_passed_to, file); /* Initialisation Section */ #line 128 "Shell.xs" if (PL_DBgv) { CvNODEBUG_on(get_cv("Poly::Shell::return_to_var", FALSE)); CvNODEBUG_on(get_cv("Poly::Shell::get_chained", FALSE)); CvNODEBUG_on(get_cv("Poly::Shell::passed_to", FALSE)); } #line 220 "Shell.c" /* End of Initialisation Section */ XSRETURN_YES; }