Skip to content

Commit

Permalink
Centralize P5/Parrot header cruft in one file
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Apr 4, 2010
1 parent 4c0982a commit 9e586b0
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 106 deletions.
17 changes: 3 additions & 14 deletions src/pmc/bkmarshal.c
Expand Up @@ -12,26 +12,15 @@ src/pmc/p5marshal.c - wrap P5 and Parrot calling conventions
*/

/* Various Perl 5 headers that we need. */
#undef _
#define PERL_NO_GET_CONTEXT
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>


/* Plus need to know about the interpreter and scalar wrapper. */
/* Need to know about the interpreter and scalar wrapper. */
#define PARROT_IN_EXTENSION
#define CONST_STRING(i, s) Parrot_str_new_constant((i), s)
#define CONST_STRING_GEN(i, s) Parrot_str_new_constant((i), s)
#include "parrot/parrot.h"
#include "parrot/extend.h"
#include "parrot/dynext.h"
#include "pmc_p5interpreter.h"
#include "pmc_p5scalar.h"
#include "pmc_p5namespace.h"
#include "bkmarshal.h"
#include "parrot/oplib/ops.h"

#include "blizkost.h"

PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
Expand Down
7 changes: 1 addition & 6 deletions src/pmc/bkmarshal.h
Expand Up @@ -4,7 +4,7 @@ Copyright (C) 2009-2010, Jonathan Worthington and friends
=head1 NAME
src/pmc/p5marshal.c - wrap P5 and Parrot calling conventions
src/pmc/bkmarshal.h - wrap P5 and Parrot calling conventions
=head1 DESCRIPTION
Expand All @@ -15,11 +15,6 @@ src/pmc/p5marshal.c - wrap P5 and Parrot calling conventions
#ifndef BLIZKOST_MARSHAL_H_GUARD
#define BLIZKOST_MARSHAL_H_GUARD

/* Various Perl 5 headers that we need. */
#undef _
#include <EXTERN.h>
#include <perl.h>

PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
SV *blizkost_marshal_arg(PARROT_INTERP, PMC *p5i, PMC *arg);
Expand Down
39 changes: 39 additions & 0 deletions src/pmc/blizkost.h
@@ -0,0 +1,39 @@
/*
Copyright (C) 2009-2010, Jonathan Worthington and friends
$Id$
=head1 NAME
src/pmc/blizkost.h - centralize P5+Parrot header cruft
=head1 DESCRIPTION
Perl5 and Parrot headers like to trample on each other. This module
does the necessary cruft to import both in the same file.
=cut
*/

#ifndef BLIZKOST_H_GUARD
#define BLIZKOST_H_GUARD

#define PARROT_IN_EXTENSION
#include "parrot/parrot.h"
#include "parrot/extend.h"
#include "parrot/dynext.h"

#define PERL_NO_GET_CONTEXT
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>

#include "pmc_p5interpreter.h"
#include "pmc_p5invocation.h"
#include "pmc_p5namespace.h"
#include "pmc_p5sv.h"
#include "pmc_p5scalar.h"

#include "bkmarshal.h"

#endif
18 changes: 1 addition & 17 deletions src/pmc/p5interpreter.pmc
Expand Up @@ -13,26 +13,10 @@ These are the vtable functions for the P5Interpreter class.

*/

/* Various Perl 5 headers plus XS initialization. */
#undef __attribute__
#undef __attribute__noreturn__
#undef __attribute__deprecated__
#include "blizkost.h"

#undef __attribute__pure__
#undef __attribute__format__
#undef __attribute__nonnull__
#undef __attribute__warn_unused_result__
#undef __attribute__unused__


#define __attribute__(x) /* */
#include "init_with_xs.h"

/* Need to know a bit about other PMCs. */
#include "pmc_p5scalar.h"
#include "pmc_p5namespace.h"
#include "bkmarshal.h"

/* Tracking of whether we've initialized or not. */
static int inited = 0;

Expand Down
21 changes: 1 addition & 20 deletions src/pmc/p5invocation.pmc
Expand Up @@ -15,26 +15,7 @@ invocation model and calling conventions.

*/

/* Various Perl 5 headers that we need. */
#undef __attribute__
#undef __attribute__noreturn__
#undef __attribute__deprecated__
#undef __attribute__pure__
#undef __attribute__format__
#undef __attribute__nonnull__
#undef __attribute__warn_unused_result__
#undef __attribute__unused__
#define __attribute__(x) /* */
#include <EXTERN.h>
#include <perl.h>

/* Plus need to know about the interpreter and scalar wrapper. */
#include "pmc_p5interpreter.h"
#include "pmc_p5scalar.h"
#include "pmc_p5namespace.h"
#include "parrot/oplib/ops.h"

#include "bkmarshal.h"
#include "blizkost.h"

pmclass P5Invocation group blizkost_group dynpmc {
ATTR PMC *p5i;
Expand Down
18 changes: 1 addition & 17 deletions src/pmc/p5namespace.pmc
Expand Up @@ -14,23 +14,7 @@ These are the vtable functions for the P5Namespace class.

*/

/* Various Perl 5 headers that we need. */
#undef __attribute__
#undef __attribute__noreturn__
#undef __attribute__deprecated__
#undef __attribute__pure__
#undef __attribute__format__
#undef __attribute__nonnull__
#undef __attribute__warn_unused_result__
#undef __attribute__unused__
#define __attribute__(x) /* */
#include <EXTERN.h>
#include <perl.h>

/* Plus need to know about some other PMCs. */
#include "pmc_p5interpreter.h"
#include "pmc_p5invocation.h"
#include "pmc_p5scalar.h"
#include "blizkost.h"

pmclass P5Namespace group blizkost_group dynpmc {
ATTR PMC *p5i;
Expand Down
18 changes: 1 addition & 17 deletions src/pmc/p5scalar.pmc
Expand Up @@ -14,23 +14,7 @@ These are the vtable functions for the P5Scalar class.

*/

/* Various Perl 5 headers that we need. */
#undef __attribute__
#undef __attribute__noreturn__
#undef __attribute__deprecated__
#undef __attribute__pure__
#undef __attribute__format__
#undef __attribute__nonnull__
#undef __attribute__warn_unused_result__
#undef __attribute__unused__
#define __attribute__(x) /* */
#include <EXTERN.h>
#include <perl.h>

/* Plus need to know about the interpreter and invocation PMCs. */
#include "pmc_p5interpreter.h"
#include "pmc_p5invocation.h"
#include "pmc_p5sv.h"
#include "blizkost.h"

pmclass P5Scalar extends P5SV group blizkost_group dynpmc {

Expand Down
16 changes: 1 addition & 15 deletions src/pmc/p5sv.pmc
Expand Up @@ -14,21 +14,7 @@ These are the vtable functions for the P5SV class.

*/

/* Various Perl 5 headers that we need. */
#undef __attribute__
#undef __attribute__noreturn__
#undef __attribute__deprecated__
#undef __attribute__pure__
#undef __attribute__format__
#undef __attribute__nonnull__
#undef __attribute__warn_unused_result__
#undef __attribute__unused__
#define __attribute__(x) /* */
#include <EXTERN.h>
#include <perl.h>

/* Plus need to know about the interpreter PMC. */
#include "pmc_p5interpreter.h"
#include "blizkost.h"

pmclass P5SV group blizkost_group dynpmc {
ATTR PMC *p5i;
Expand Down

0 comments on commit 9e586b0

Please sign in to comment.