- Added functions id, id_2obj, register, idhash, idhashes
Sun Jun 17 15:10:45 CEST 2007
- In preparation for release
- added tests for new functions
- pod partially re-written to describe the multi-level
interface
- updated pod part of lib/Hash/Util.pm
+ - release accepted by p5p
+
+1.02 Sat Jul 14 22:38:33 CEST 2007
+ - prototype set to ($) for id()
+ - tests added for prototypes
+ - some cleanup in xs code
+ - small pod fixes
/* A Perl sub that returns a hashref to the object registry */
#define HUF_OB_REG "Hash::Util::FieldHash::_ob_reg"
-/* Magic cookies to recognize object id's. Hi, Eva, David */
-#define HUF_COOKIE 2805.1980
-#define HUF_REFADDR_COOKIE 1811.1976
/* Identifier for PERL_MAGIC_ext magic */
#define HUF_IDCACHE 0x4944
return 0;
}
+/* see if something is a field hash */
+int HUF_get_status(HV* hash) {
+ int ans = 0;
+ if (hash && (SvTYPE(hash) == SVt_PVHV)) {
+ MAGIC* mg;
+ struct ufuncs* uf;
+ if ((mg = mg_find((SV*)hash, PERL_MAGIC_uvar)) &&
+ (uf = (struct ufuncs *)mg->mg_ptr) &&
+ (uf->uf_set == NULL)
+ ) {
+ ans = HUF_func_2mode(uf->uf_val);
+ }
+ }
+ return ans;
+}
+
int HUF_func_2mode( I32(* val)(pTHX_ IV, SV*)) {
int ans = 0;
if (val == &HUF_watch_key_id)
return(ans);
}
-/* see if something is a field hash */
-int HUF_get_status(HV* hash) {
- int ans = 0;
- if (hash && (SvTYPE(hash) == SVt_PVHV)) {
- MAGIC* mg;
- struct ufuncs* uf;
- if ((mg = mg_find((SV*)hash, PERL_MAGIC_uvar)) &&
- (uf = (struct ufuncs *)mg->mg_ptr) &&
- (uf->uf_set == NULL)
- ) {
- ans = HUF_func_2mode(uf->uf_val);
- }
- }
- return ans;
-}
-
/* Thread support. These routines are called by CLONE (and nothing else) */
/* Fix entries for one object in all field hashes */
void
id(SV* ref)
+PROTOTYPE: $
PPCODE:
if (SvROK(ref)) {
XPUSHs(HUF_obj_id(ref));
use warnings;
use Scalar::Util qw( reftype);
+our $VERSION = '1.02';
+
require Exporter;
our @ISA = qw(Exporter);
our %EXPORT_TAGS = (
);
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
-our $VERSION = '1.01';
-
{
require XSLoader;
my %ob_reg; # private object registry
=head1 AUTHOR
-Anno Siegel, E<lt>anno4000@zrz.tu-berlin.deE<gt>
+Anno Siegel (ANNO) wrote the xs code and the changes in perl proper
+Jerry Hedden (JDHEDDEN) made it faster
=head1 COPYRIGHT AND LICENSE
}
{
+ # prototypes in place?
+ my %proto_tab = (
+ fieldhash => '\\%',
+ fieldhashes => '',
+ idhash => '\\%',
+ idhashes => '',
+ id => '$',
+ id_2obj => '$',
+ register => '$@',
+ );
+
+
+ my @notfound = grep !exists $proto_tab{ $_} =>
+ @Hash::Util::FieldHash::EXPORT_OK;
+ ok @notfound == 0, "All exports in table";
+ is prototype( "Hash::Util::FieldHash::$_") || '', $proto_tab{ $_},
+ "$_ has prototype ($proto_tab{ $_})" for
+ @Hash::Util::FieldHash::EXPORT_OK;
+
+ BEGIN { $n_tests += 1 + @Hash::Util::FieldHash::EXPORT_OK }
+}
+
+{
BEGIN { $n_tests += 1 }
Hash::Util::FieldHash::_fieldhash \ my( %h), $fieldhash_mode;
bless \ %h, 'abc'; # this bus-errors with a certain bug