#
################################################################################
#
-# $Revision: 36 $
+# $Revision: 43 $
# $Author: mhx $
-# $Date: 2005/06/25 17:56:28 +0200 $
+# $Date: 2006/05/22 00:51:20 +0200 $
#
################################################################################
#
-# Version 3.x, Copyright (C) 2004-2005, Marcus Holland-Moritz.
+# Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz.
# Version 2.x, Copyright (C) 2001, Paul Marquess.
# Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
#
my $format = sprintf '%%-%ds %%-%ds %%s', $len+2, $len+5;
$len = 3*$len + 23;
-$data =~ s/^(.*)__EXPLICIT_API__(\s*?)^/
- sprintf("$1$format\n", 'Function', 'Static Request', 'Global Request') .
+$data =~ s!^(.*)__EXPLICIT_API__(\s*?)^!
+ sprintf("$1$format\n", 'Function / Variable', 'Static Request', 'Global Request') .
$1 . '-'x$len . "\n" .
- join('', map { sprintf "$1$format\n", "$_()", "NEED_$_", "NEED_${_}_GLOBAL" }
+ join('', map { sprintf "$1$format\n", $explicit{$_} eq 'var' ? $_ : "$_()", "NEED_$_", "NEED_${_}_GLOBAL" }
sort keys %explicit)
- /gem;
+ !gem;
}
my %raw_base = %{&parse_todo('parts/base')};
)
\s*$}
{expand_undefined($2, $1, $3)}gemx;
+ $code =~ s{^([^\S\r\n]*)__NEED_VAR__\s+(.*?)\s+(\w+)(?:\s*=\s*([^;]+?)\s*;\s*)?$}
+ {expand_need_var($1, $3, $2, $4)}gem;
+ return $code;
+}
+
+sub expand_need_var
+{
+ my($indent, $var, $type, $init) = @_;
+
+ $explicit{$var} = 'var';
+
+ my $myvar = "$DPPP(my_$var)";
+
+ my $code = <<ENDCODE;
+#if defined(NEED_$var)
+static $type $myvar = $init;
+#elif defined(NEED_${var}_GLOBAL)
+$type $myvar = $init;
+#else
+extern $type $myvar;
+#endif
+#define $var $myvar
+ENDCODE
+
+ $code =~ s/^/$indent/mg;
+
return $code;
}
{
my $expr = shift;
- if ($expr =~ /^\s*need\s*(\w+)\s*$/i) {
+ if ($expr =~ /^\s*need\s+(\w+)\s*$/i) {
my $func = $1;
my $e = $embed{$func} or die "unknown API function '$func' in NEED\n";
my $proto = make_prototype($e);
warn "found no prototype for $func\n";;
}
- $explicit{$func} = 1;
+ $explicit{$func} = 'func';
$proto =~ s/\b$func(?=\s*\()/$DPPP(my_$func)/;
my $embed = make_embed($e);
#
################################################################################
#
-# $Revision: 36 $
+# $Revision: 43 $
# $Author: mhx $
-# $Date: 2005/06/25 17:56:28 +0200 $
+# $Date: 2006/05/22 00:51:20 +0200 $
#
################################################################################
#
-# Version 3.x, Copyright (C) 2004-2005, Marcus Holland-Moritz.
+# Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz.
# Version 2.x, Copyright (C) 2001, Paul Marquess.
# Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
#
=head1 COPYRIGHT
-Version 3.x, Copyright (C) 2004-2005, Marcus Holland-Moritz.
+Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz.
Version 2.x, Copyright (C) 2001, Paul Marquess.
use strict;
use vars qw($VERSION @ISA $data);
-$VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.06_01 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' };
+$VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.08_02 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' };
@ISA = qw(DynaLoader);
%include uv
+%include memory
+
%include misc
+%include variables
+
%include threads
%include mPUSH
%include format
+%include SvREFCNT
+
%include SvPV
+%include Sv_set
+
%include sv_xpvf
+%include warn
+
+%include pvs
+
%include magic
%include cop
%include grok
+%include snprintf
+
%include exception
#endif /* _P_P_PORTABILITY_H_ */