/* * This file was generated automatically by ExtUtils::ParseXS version 2.18 from the * contents of Weight.xs. Do not edit this file, edit Weight.xs instead. * * ANY CHANGES MADE HERE WILL BE LOST! * */ #line 1 "Weight.xs" /* Copyright (c) 1997-2004 -*- 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: Weight.xs 4889 2004-07-30 17:08:06Z gawrilow $" #include "Ext.h" #ifndef PERL_UNUSED_VAR # define PERL_UNUSED_VAR(var) if (0) var = var #endif #line 34 "Weight.c" XS(XS_Poly__Rule__Weight_add_atom); /* prototype to pass -Wmissing-prototypes */ XS(XS_Poly__Rule__Weight_add_atom) { #ifdef dVAR dVAR; dXSARGS; #else dXSARGS; #endif if (items != 3) Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::Rule::Weight::add_atom", "wt, major, minor"); PERL_UNUSED_VAR(cv); /* -W */ { SV * wt =SvRV(ST(0)); I32 major = (I32)SvIV(ST(1)); I32 minor = (I32)SvIV(ST(2)); #line 30 "Weight.xs" { I32 l=SvCUR(wt)/sizeof(I32); ((I32*)SvPVX(wt))[l-1-major] += minor; } #line 56 "Weight.c" } XSRETURN_EMPTY; } XS(XS_Poly__Rule__Weight_set_atom); /* prototype to pass -Wmissing-prototypes */ XS(XS_Poly__Rule__Weight_set_atom) { #ifdef dVAR dVAR; dXSARGS; #else dXSARGS; #endif if (items != 3) Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::Rule::Weight::set_atom", "wt, major, minor"); PERL_UNUSED_VAR(cv); /* -W */ { SV * wt =SvRV(ST(0)); I32 major = (I32)SvIV(ST(1)); I32 minor = (I32)SvIV(ST(2)); #line 41 "Weight.xs" { I32 l=SvCUR(wt)/sizeof(I32); ((I32*)SvPVX(wt))[l-1-major] = minor; } #line 82 "Weight.c" } XSRETURN_EMPTY; } XS(XS_Poly__Rule__Weight_sum); /* prototype to pass -Wmissing-prototypes */ XS(XS_Poly__Rule__Weight_sum) { #ifdef dVAR dVAR; dXSARGS; #else dXSARGS; #endif if (items != 2) Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::Rule::Weight::sum", "wt1, wt2"); PERL_UNUSED_VAR(cv); /* -W */ { SV * wt1 =SvRV(ST(0)); SV * wt2 =SvRV(ST(1)); #line 51 "Weight.xs" { I32 *wtp1=(I32*)SvPVX(wt1), *wtp2=(I32*)SvPVX(wt2); I32 l=SvCUR(wt1)/sizeof(I32); for ( ; l>0; l--) (*wtp1++) += (*wtp2++); } #line 110 "Weight.c" } XSRETURN_EMPTY; } XS(XS_Poly__Rule__Weight_compare); /* prototype to pass -Wmissing-prototypes */ XS(XS_Poly__Rule__Weight_compare) { #ifdef dVAR dVAR; dXSARGS; #else dXSARGS; #endif if (items != 3) Perl_croak(aTHX_ "Usage: %s(%s)", "Poly::Rule::Weight::compare", "wt1, wt2, reverse"); PERL_UNUSED_VAR(cv); /* -W */ { SV * wt1 = SvRV(ST(0)); SV * wt2 = SvRV(ST(1)); I32 reverse = (I32)SvIV(ST(2)); I32 RETVAL; dXSTARG; #line 65 "Weight.xs" RETVAL=0; { I32 *wtp1=(I32*)SvPVX(wt1), *wtp2=(I32*)SvPVX(wt2); I32 l=SvCUR(wt1)/sizeof(I32); while (--l>=0 && !(RETVAL = (*wtp1++) - (*wtp2++))) ; if (reverse) RETVAL=-RETVAL; } #line 142 "Weight.c" XSprePUSH; PUSHi((IV)RETVAL); } XSRETURN(1); } #ifdef __cplusplus extern "C" #endif XS(boot_Poly__Rule__Weight); /* prototype to pass -Wmissing-prototypes */ XS(boot_Poly__Rule__Weight) { #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::Rule::Weight::add_atom", XS_Poly__Rule__Weight_add_atom, file); newXS("Poly::Rule::Weight::set_atom", XS_Poly__Rule__Weight_set_atom, file); newXS("Poly::Rule::Weight::sum", XS_Poly__Rule__Weight_sum, file); newXS("Poly::Rule::Weight::compare", XS_Poly__Rule__Weight_compare, file); XSRETURN_YES; }