Author: leo Date: Sun Jan 15 11:55:09 2006 New Revision: 11200 Modified: trunk/runtime/parrot/library/dumper.pir trunk/src/global.c trunk/src/ops/var.ops Log: find_global returns a Null PMC on failure now
* iff global lookup exceptions are off, a Null PMC is returned instead of Undef on lookup failure * change dumper.pir Modified: trunk/runtime/parrot/library/dumper.pir ============================================================================== --- trunk/runtime/parrot/library/dumper.pir (original) +++ trunk/runtime/parrot/library/dumper.pir Sun Jan 15 11:55:09 2006 @@ -154,10 +154,11 @@ TYPE_OK: errorsoff .PARROT_ERRORS_GLOBALS_FLAG find_global self, "Data::Dumper", "global" errorson .PARROT_ERRORS_GLOBALS_FLAG + if null self goto create_type typeof type, self if type == mytype goto END - +create_type: new self, mytype store_global "Data::Dumper", "global", self Modified: trunk/src/global.c ============================================================================== --- trunk/src/global.c (original) +++ trunk/src/global.c Sun Jan 15 11:55:09 2006 @@ -38,7 +38,7 @@ Return NULL if the global isn't found or Parrot_get_global(Parrot_Interp interpreter, STRING *class, STRING *globalname)> If the global exists, return it. If not either throw an exception or return an -C<Undef> depending on the interpreter's error settings. +C<Null> PMC depending on the interpreter's error settings. =cut @@ -162,7 +162,7 @@ Parrot_get_global(Parrot_Interp interpre "Global '%Ss' not found", name); } - return pmc_new(interpreter, enum_class_Undef); + return PMCNULL; } PMC * @@ -176,7 +176,7 @@ Parrot_get_global_p(Parrot_Interp interp "Global '%Ss' not found", name); } - return pmc_new(interpreter, enum_class_Undef); + return PMCNULL; } /* @@ -184,7 +184,7 @@ Parrot_get_global_p(Parrot_Interp interp =item C<PMC* Parrot_get_name(Interp* interpreter, STRING *name)> Find the name in lexicals, globals, and builtins. If the name -isn't found throw and exception or return Undef, depending on +isn't found throw and exception or return the Null PMC, depending on the interpreter's errors setting. =cut @@ -232,7 +232,7 @@ Parrot_get_name(Interp* interpreter, STR "Name '%Ss' not found", name); } - return pmc_new(interpreter, enum_class_Undef); + return PMCNULL; } /* Modified: trunk/src/ops/var.ops ============================================================================== --- trunk/src/ops/var.ops (original) +++ trunk/src/ops/var.ops Sun Jan 15 11:55:09 2006 @@ -128,13 +128,13 @@ op store_global(in PMC, in STR, in PMC) =item B<find_global>(out PMC, in STR) Find the global named $2 and store it in $1. If the global doesn't exist -either throws an exception or sets $1 to undef, depending on current +either throws an exception or sets $1 to the Null PMC, depending on current errors settings, s. B<errorson>. =item B<find_global>(out PMC, in STR, in STR) Find the global named $3 in namespace $2 and store it in $1. If the -global doesn't exist either throws an exception or sets $1 to undef, +global doesn't exist either throws an exception or sets $1 to the Null PMC, depending on current errors settings, s. B<errorson>. If $3 is NULL the namespace hash for namespace $2 is returned. @@ -143,7 +143,7 @@ If $3 is NULL the namespace hash for nam Find the global named $3 in the namespace specified by $2 and store it in $1. If the global doesn't exist either throws an -exception or sets $1 to undef, depending on current errors settings, +exception or sets $1 to the Null PMC, depending on current errors settings, s. B<errorson>. =cut