Anarres-Mud-Driver

 view release on metacpan or  search on metacpan

Efun/Core/Core.pm  view on Meta::CPAN

package Anarres::Mud::Driver::Efun::Core;

use strict;
use warnings;
use vars qw($VERSION @ISA);

# XXX Where should I be requiring these: before or after bootstrap?

use Anarres::Mud::Driver::Compiler::Type qw(:all);	# We do this twice?!

# Efuns need to be normal functions in a program symbol table but
# will not inherit or issue a warning if redefined.

# Note that we don't actually register all available efuns. We
# register only those which are visible as efuns to the LPC code.
# We may have more efuns, an individual efun typecheck_call method
# may decide to rebless the node into a different efun class.
# For example, map => map_array or map_mapping. In this way we
# can use the Perl object oriented dispatch mechanism to speed up
# many operations where a pure Perl conditional would be slower.

require DynaLoader;

$VERSION = 0.10;
@ISA = qw(DynaLoader);

bootstrap Anarres::Mud::Driver::Efun::Core;

use Anarres::Mud::Driver::Compiler::Type qw(:all);	# We do this twice?!
use Anarres::Mud::Driver::Program::Efun qw(register);
use Anarres::Mud::Driver::Program::Method;

{
	# As traditional, [ flags, return type, argtype .... ]
	my $pflags = M_PURE | M_NOMASK;	# This just lets me format nicely.
	my %efuns = (
		# Common stuff

		copy			=> [ 0,		T_UNKNOWN, T_UNKNOWN, ],

		# Object stuff

		this_object		=> [ 0,		T_OBJECT, ],
		previous_object	=> [ 0,		T_OBJECT, T_INTEGER, ],
	all_previous_objects=> [ 0,		T_OBJECT->array ],
		file_name		=> [ 0,		T_STRING, T_OBJECT, ],
		find_object		=> [ 0,		T_OBJECT, T_STRING, ],
		load_object		=> [ 0,		T_OBJECT, T_STRING, ],
		clone_object	=> [ 0,		T_OBJECT, T_STRING, ],
		destruct		=> [ 0,		T_INTEGER, T_OBJECT, ],
		children		=> [ 0,		T_OBJECT->array, T_STRING, ],
		objects			=> [ 0,		T_OBJECT->array, ],

		# String stuff

		implode		=> [ M_PURE, T_STRING, T_STRING->array, T_STRING ],
		explode		=> [ M_PURE, T_STRING->array, T_STRING, T_STRING ],
		lower_case		=> [ M_PURE, T_STRING, T_STRING, ],
		upper_case		=> [ M_PURE, T_STRING, T_STRING, ],
		strlen			=> [ M_PURE, T_INTEGER, T_STRING, ],
		replace_string	=> [ M_PURE, T_STRING, T_STRING, T_STRING, T_STRING, ],
		substr			=> [ M_PURE, T_STRING,
										T_STRING,
										T_INTEGER, T_INTEGER,	# off
										T_INTEGER, T_INTEGER, ],# end
		subchar			=> [ M_PURE, T_INTEGER,
										T_STRING,		# offset
										T_INTEGER, ],	# from end?
		capitalize		=> [ M_PURE, T_STRING, T_STRING, ],
		strsrch			=> [ M_PURE, T_INTEGER, T_STRING, T_STRING, ],
		regexp			=> [ M_PURE, T_INTEGER, T_STRING, T_STRING, ],

		# XXX varargs
		sprintf			=> [ M_PURE, T_STRING, T_STRING, T_ARRAY, ],
		sscanf			=> [ M_PURE, T_STRING, T_STRING, T_ARRAY, ],

		# Array stuff



( run in 0.591 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )