The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
/*
 * This file was generated automatically by xsubpp version 1.9508 from the
 * contents of Preprocessor.xs. Do not edit this file, edit Preprocessor.xs instead.
 *
 *	ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "Preprocessor.xs"
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "ppport.h"


static SV * startElementHandler = (SV*) NULL;
static SV * endElementHandler = (SV*) NULL;
static SV * characterDataHandler = (SV*) NULL;
static SV * processingInstructionHandler = (SV*) NULL;
static SV * commentHandler = (SV*) NULL;
static SV * startCdataHandler = (SV*) NULL;
static SV * endCdataHandler = (SV*) NULL;
static SV * xmlDeclHandler = (SV*) NULL;

void
call_StartElementHandlerCommon(tag, hasChild)
char * tag;
int hasChild;
{
    dSP;

    ENTER;
    SAVETMPS;

    PUSHMARK(SP);
    XPUSHs(sv_2mortal(newSVpv(tag, 0)));
    XPUSHs(sv_2mortal(newSViv(hasChild)));
    PUTBACK;

    if(startElementHandler != (SV*) NULL)
        call_sv(startElementHandler, G_DISCARD);

    FREETMPS;
    LEAVE;
}

void
call_StartElementHandlerIdentifier(tag, hasChild, identifier, replaceable)
char * tag;
int hasChild;
char * identifier;
char * replaceable;
{
    dSP;

    ENTER;
    SAVETMPS;

    PUSHMARK(SP);
    XPUSHs(sv_2mortal(newSVpv(tag, 0)));
    XPUSHs(sv_2mortal(newSViv(hasChild)));
    XPUSHs(sv_2mortal(newSVpv("identifier", 0)));
    XPUSHs(sv_2mortal(newSVpv(identifier, 0)));
    XPUSHs(sv_2mortal(newSVpv("replaceable", 0)));
    XPUSHs(sv_2mortal(newSVpv(replaceable, 0)));
    PUTBACK;

    if(startElementHandler != (SV*) NULL)
        call_sv(startElementHandler, G_DISCARD);

    FREETMPS;
    LEAVE;
}

void
call_StartElementHandlerMacro(tag, hasChild, identifier)
char * tag;
int hasChild;
char * identifier;
{
    dSP;

    ENTER;
    SAVETMPS;

    PUSHMARK(SP);
    XPUSHs(sv_2mortal(newSVpv(tag, 0)));
    XPUSHs(sv_2mortal(newSViv(hasChild)));
    XPUSHs(sv_2mortal(newSVpv("identifier", 0)));
    XPUSHs(sv_2mortal(newSVpv(identifier, 0)));
    PUTBACK;

    if(startElementHandler != (SV*) NULL)
        call_sv(startElementHandler, G_DISCARD);

    FREETMPS;
    LEAVE;
}

void
call_StartElementHandlerText(tag, hasChild, value)
char * tag;
int hasChild;
char * value;
{
    dSP;

    ENTER;
    SAVETMPS;

    PUSHMARK(SP);
    XPUSHs(sv_2mortal(newSVpv(tag, 0)));
    XPUSHs(sv_2mortal(newSViv(hasChild)));
    XPUSHs(sv_2mortal(newSVpv("value", 0)));
    XPUSHs(sv_2mortal(newSVpv(value, 0)));
    PUTBACK;

    if(startElementHandler != (SV*) NULL)
        call_sv(startElementHandler, G_DISCARD);

    FREETMPS;
    LEAVE;
}

void
call_StartElementHandlerFile(tag, hasChild, path, lines, guarded, guardId)
char * tag;
int hasChild;
char * path;
int lines;
int guarded;
char * guardId;
{
    dSP;

    ENTER;
    SAVETMPS;

    PUSHMARK(SP);
    XPUSHs(sv_2mortal(newSVpv(tag, 0)));
    XPUSHs(sv_2mortal(newSViv(hasChild)));
    XPUSHs(sv_2mortal(newSVpv("path", 0)));
    XPUSHs(sv_2mortal(newSVpv(path, 0)));
    XPUSHs(sv_2mortal(newSVpv("lines", 0)));
    XPUSHs(sv_2mortal(newSViv(lines)));
    XPUSHs(sv_2mortal(newSVpv("guarded", 0)));
    if(guarded != 0) {
      XPUSHs(sv_2mortal(newSVpv("yes", 0)));
      if(guardId != NULL) {
        XPUSHs(sv_2mortal(newSVpv("guardId", 0)));
        XPUSHs(sv_2mortal(newSVpv(guardId, 0)));
      }
    } else {
      XPUSHs(sv_2mortal(newSVpv("no", 0)));
    }
    PUTBACK;

    if(startElementHandler != (SV*) NULL)
        call_sv(startElementHandler, G_DISCARD);

    FREETMPS;
    LEAVE;
}

void
call_StartElementHandlerIncludePath(tag, hasChild, path, used)
char * tag;
int hasChild;
char * path;
int used;
{
    dSP;

    ENTER;
    SAVETMPS;

    PUSHMARK(SP);
    XPUSHs(sv_2mortal(newSVpv(tag, 0)));
    XPUSHs(sv_2mortal(newSViv(hasChild)));
    XPUSHs(sv_2mortal(newSVpv("path", 0)));
    XPUSHs(sv_2mortal(newSVpv(path, 0)));
    XPUSHs(sv_2mortal(newSVpv("used", 0)));
    if(used != 0) {
      XPUSHs(sv_2mortal(newSVpv("yes", 0)));
    } else {
      XPUSHs(sv_2mortal(newSVpv("no", 0)));
    }
    PUTBACK;

    if(startElementHandler != (SV*) NULL)
        call_sv(startElementHandler, G_DISCARD);

    FREETMPS;
    LEAVE;
}

void
call_EndElementHandler(tag)
char * tag;
{
    dSP;

    ENTER;
    SAVETMPS;

    PUSHMARK(SP);
    XPUSHs(sv_2mortal(newSVpv(tag, 0)));
    PUTBACK;

    if(endElementHandler != (SV*) NULL)
        call_sv(endElementHandler, G_DISCARD);

    FREETMPS;
    LEAVE;
}

void
call_CharacterDataHandler(string)
char * string;
{
    dSP;

    ENTER;
    SAVETMPS;

    PUSHMARK(SP);
    XPUSHs(sv_2mortal(newSVpv(string, 0)));
    PUTBACK;

    if(characterDataHandler != (SV*) NULL)
        call_sv(characterDataHandler, G_DISCARD);

    FREETMPS;
    LEAVE;
}

void
call_ProcessingInstructionHandler(target,data)
char * target;
char * data;
{
    dSP;

    ENTER;
    SAVETMPS;

    PUSHMARK(SP);
    XPUSHs(sv_2mortal(newSVpv(target, 0)));
    XPUSHs(sv_2mortal(newSVpv(data, 0)));
    PUTBACK;

    if(processingInstructionHandler != (SV*) NULL)
        call_sv(processingInstructionHandler, G_DISCARD);

    FREETMPS;
    LEAVE;
}

void
call_CommentHandler(string)
char * string;
{
    dSP;

    ENTER;
    SAVETMPS;

    PUSHMARK(SP);
    XPUSHs(sv_2mortal(newSVpv(string, 0)));
    PUTBACK;

    if(commentHandler != (SV*) NULL)
        call_sv(commentHandler, G_DISCARD);

    FREETMPS;
    LEAVE;
}

void
call_StartCdataHandler()
{
    dSP;

    ENTER;
    SAVETMPS;

    PUSHMARK(SP);
    PUTBACK;

    if(startCdataHandler != (SV*) NULL)
        call_sv(startCdataHandler, G_DISCARD|G_NOARGS);

    FREETMPS;
    LEAVE;
}


void
call_EndCdataHandler()
{
    dSP;

    ENTER;
    SAVETMPS;

    PUSHMARK(SP);
    PUTBACK;

    if(endCdataHandler != (SV*) NULL)
        call_sv(endCdataHandler, G_DISCARD|G_NOARGS);

    FREETMPS;
    LEAVE;
}

void
call_XMLDeclHandler(version, encoding, standalone)
char * version;
char * encoding;
char * standalone;
{
    dSP;

    ENTER;
    SAVETMPS;

    PUSHMARK(SP);
    XPUSHs(sv_2mortal(newSVpv(version, 0)));
    XPUSHs(sv_2mortal(newSVpv(encoding, 0)));
    XPUSHs(sv_2mortal(newSVpv(standalone, 0)));
    PUTBACK;

    if(xmlDeclHandler != (SV*) NULL)
        call_sv(xmlDeclHandler, G_DISCARD);

    FREETMPS;
    LEAVE;
}

#line 342 "Preprocessor.c"

XS(XS_Rinchi__Fortran__Preprocessor_ProcessFileArg); /* prototype to pass -Wmissing-prototypes */
XS(XS_Rinchi__Fortran__Preprocessor_ProcessFileArg)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: Rinchi::Fortran::Preprocessor::ProcessFileArg(path, args)");
    {
	const char *	path = (const char *)SvPV_nolen(ST(0));
	SV *	args = ST(1);
#line 339 "Preprocessor.xs"
        I32 argc = -1;
        int n;
        AV * av_args;
        char * arg;
        void malloc_argv(int);
        void parse(const char *);
        void add_argv(char *);

        if (SvROK(args)) {
            av_args = (AV *)SvRV(args);
            if  ((SvTYPE(SvRV(args)) == SVt_PVAV)) {
                argc = av_len(av_args);
                malloc_argv(argc+2);
            }
        }
#line 369 "Preprocessor.c"
#line 355 "Preprocessor.xs"
        for (n = 0; n <= argc; n++) {
             STRLEN l;
             arg = SvPV(*av_fetch(av_args, n, 0), l);
             add_argv(arg);
        }
        parse(path);
#line 377 "Preprocessor.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Rinchi__Fortran__Preprocessor_ProcessFile); /* prototype to pass -Wmissing-prototypes */
XS(XS_Rinchi__Fortran__Preprocessor_ProcessFile)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Rinchi::Fortran::Preprocessor::ProcessFile(path)");
    {
	const char *	path = (const char *)SvPV_nolen(ST(0));
#line 367 "Preprocessor.xs"
        {
        void parse(const char *path);
        parse(path);
        }
#line 396 "Preprocessor.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Rinchi__Fortran__Preprocessor_SetStartElementHandler); /* prototype to pass -Wmissing-prototypes */
XS(XS_Rinchi__Fortran__Preprocessor_SetStartElementHandler)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Rinchi::Fortran::Preprocessor::SetStartElementHandler(name)");
    {
	SV *	name = ST(0);
#line 376 "Preprocessor.xs"
        /* Take a copy of the callback */
        if (startElementHandler == (SV*)NULL) {
            /* First time, so create a new SV */
            startElementHandler = newSVsv(name);
        } else {
            /* Been here before, so overwrite */
            SvSetSV(startElementHandler, name);
        }
#line 419 "Preprocessor.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Rinchi__Fortran__Preprocessor_SetEndElementHandler); /* prototype to pass -Wmissing-prototypes */
XS(XS_Rinchi__Fortran__Preprocessor_SetEndElementHandler)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Rinchi::Fortran::Preprocessor::SetEndElementHandler(name)");
    {
	SV *	name = ST(0);
#line 389 "Preprocessor.xs"
        /* Take a copy of the callback */
        if (endElementHandler == (SV*)NULL) {
            /* First time, so create a new SV */
            endElementHandler = newSVsv(name);
        } else {
            /* Been here before, so overwrite */
            SvSetSV(endElementHandler, name);
        }
#line 442 "Preprocessor.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Rinchi__Fortran__Preprocessor_SetCharacterDataHandler); /* prototype to pass -Wmissing-prototypes */
XS(XS_Rinchi__Fortran__Preprocessor_SetCharacterDataHandler)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Rinchi::Fortran::Preprocessor::SetCharacterDataHandler(name)");
    {
	SV *	name = ST(0);
#line 402 "Preprocessor.xs"
        /* Take a copy of the callback */
        if (characterDataHandler == (SV*)NULL) {
            /* First time, so create a new SV */
            characterDataHandler = newSVsv(name);
        } else {
            /* Been here before, so overwrite */
            SvSetSV(characterDataHandler, name);
        }
#line 465 "Preprocessor.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Rinchi__Fortran__Preprocessor_SetProcessingInstructionHandler); /* prototype to pass -Wmissing-prototypes */
XS(XS_Rinchi__Fortran__Preprocessor_SetProcessingInstructionHandler)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Rinchi::Fortran::Preprocessor::SetProcessingInstructionHandler(name)");
    {
	SV *	name = ST(0);
#line 416 "Preprocessor.xs"
        /* Take a copy of the callback */
        if (processingInstructionHandler == (SV*)NULL) {
            /* First time, so create a new SV */
            processingInstructionHandler = newSVsv(name);
        } else {
            /* Been here before, so overwrite */
            SvSetSV(processingInstructionHandler, name);
        }
#line 488 "Preprocessor.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Rinchi__Fortran__Preprocessor_SetCommentHandler); /* prototype to pass -Wmissing-prototypes */
XS(XS_Rinchi__Fortran__Preprocessor_SetCommentHandler)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Rinchi::Fortran::Preprocessor::SetCommentHandler(name)");
    {
	SV *	name = ST(0);
#line 429 "Preprocessor.xs"
        /* Take a copy of the callback */
        if (commentHandler == (SV*)NULL) {
            /* First time, so create a new SV */
            commentHandler = newSVsv(name);
        } else {
            /* Been here before, so overwrite */
            SvSetSV(commentHandler, name);
        }
#line 511 "Preprocessor.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Rinchi__Fortran__Preprocessor_SetStartCdataHandler); /* prototype to pass -Wmissing-prototypes */
XS(XS_Rinchi__Fortran__Preprocessor_SetStartCdataHandler)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Rinchi::Fortran::Preprocessor::SetStartCdataHandler(name)");
    {
	SV *	name = ST(0);
#line 442 "Preprocessor.xs"
        /* Take a copy of the callback */
        if (startCdataHandler == (SV*)NULL) {
            /* First time, so create a new SV */
            startCdataHandler = newSVsv(name);
        } else {
            /* Been here before, so overwrite */
            SvSetSV(startCdataHandler, name);
        }
#line 534 "Preprocessor.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Rinchi__Fortran__Preprocessor_SetEndCdataHandler); /* prototype to pass -Wmissing-prototypes */
XS(XS_Rinchi__Fortran__Preprocessor_SetEndCdataHandler)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Rinchi::Fortran::Preprocessor::SetEndCdataHandler(name)");
    {
	SV *	name = ST(0);
#line 455 "Preprocessor.xs"
        /* Take a copy of the callback */
        if (endCdataHandler == (SV*)NULL) {
            /* First time, so create a new SV */
            endCdataHandler = newSVsv(name);
        } else {
            /* Been here before, so overwrite */
            SvSetSV(endCdataHandler, name);
        }
#line 557 "Preprocessor.c"
    }
    XSRETURN_EMPTY;
}


XS(XS_Rinchi__Fortran__Preprocessor_SetXMLDeclHandler); /* prototype to pass -Wmissing-prototypes */
XS(XS_Rinchi__Fortran__Preprocessor_SetXMLDeclHandler)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Rinchi::Fortran::Preprocessor::SetXMLDeclHandler(name)");
    {
	SV *	name = ST(0);
#line 468 "Preprocessor.xs"
        /* Take a copy of the callback */
        if (xmlDeclHandler == (SV*)NULL) {
            /* First time, so create a new SV */
            xmlDeclHandler = newSVsv(name);
        } else {
            /* Been here before, so overwrite */
            SvSetSV(xmlDeclHandler, name);
        }
#line 580 "Preprocessor.c"
    }
    XSRETURN_EMPTY;
}

#ifdef __cplusplus
extern "C"
#endif
XS(boot_Rinchi__Fortran__Preprocessor); /* prototype to pass -Wmissing-prototypes */
XS(boot_Rinchi__Fortran__Preprocessor)
{
    dXSARGS;
    char* file = __FILE__;

    XS_VERSION_BOOTCHECK ;

        newXS("Rinchi::Fortran::Preprocessor::ProcessFileArg", XS_Rinchi__Fortran__Preprocessor_ProcessFileArg, file);
        newXS("Rinchi::Fortran::Preprocessor::ProcessFile", XS_Rinchi__Fortran__Preprocessor_ProcessFile, file);
        newXS("Rinchi::Fortran::Preprocessor::SetStartElementHandler", XS_Rinchi__Fortran__Preprocessor_SetStartElementHandler, file);
        newXS("Rinchi::Fortran::Preprocessor::SetEndElementHandler", XS_Rinchi__Fortran__Preprocessor_SetEndElementHandler, file);
        newXS("Rinchi::Fortran::Preprocessor::SetCharacterDataHandler", XS_Rinchi__Fortran__Preprocessor_SetCharacterDataHandler, file);
        newXS("Rinchi::Fortran::Preprocessor::SetProcessingInstructionHandler", XS_Rinchi__Fortran__Preprocessor_SetProcessingInstructionHandler, file);
        newXS("Rinchi::Fortran::Preprocessor::SetCommentHandler", XS_Rinchi__Fortran__Preprocessor_SetCommentHandler, file);
        newXS("Rinchi::Fortran::Preprocessor::SetStartCdataHandler", XS_Rinchi__Fortran__Preprocessor_SetStartCdataHandler, file);
        newXS("Rinchi::Fortran::Preprocessor::SetEndCdataHandler", XS_Rinchi__Fortran__Preprocessor_SetEndCdataHandler, file);
        newXS("Rinchi::Fortran::Preprocessor::SetXMLDeclHandler", XS_Rinchi__Fortran__Preprocessor_SetXMLDeclHandler, file);
    XSRETURN_YES;
}