No cvs access?
cvs diff -D"2 hours ago" -Dnow
Index: lib/master.pike.in =================================================================== RCS file: /pike/data/cvsroot/Pike/7.8/lib/master.pike.in,v retrieving revision 1.474 retrieving revision 1.476 diff -u -r1.474 -r1.476 --- lib/master.pike.in 28 Jul 2010 10:29:59 -0000 1.474 +++ lib/master.pike.in 28 Jul 2010 22:58:01 -0000 1.476 @@ -6,7 +6,7 @@ // Pike is distributed under GPL, LGPL and MPL. See the file COPYING // for more information. // -// $Id: master.pike.in,v 1.474 2010/07/28 10:29:59 mast Exp $ +// $Id: master.pike.in,v 1.476 2010/07/28 22:58:01 mast Exp $
#pike __REAL_VERSION__ //#pragma strict_types @@ -85,6 +85,13 @@ //! int show_if_constant_errors = 0;
+int is_pike_master = 0; +// This integer variable should exist in any object that aspires to be +// the master. It gets set to 1 when the master is installed, and is +// therefore set in any object that is or has been the master. That +// makes the Encoder class encode references to the master and all +// ex-masters as references to the current master object. + // --- Functions begin here.
// Have to access some stuff without going through the resolver. @@ -5092,6 +5099,11 @@ } }
+ else if (what->is_pike_master) { + ENC_MSG (" is a master object\n"); + ENC_RETURN ("o/master"); + } + program prog; if ((prog = objects_reverse_lookup (what))) ENC_MSG (" found program in objects: %O\n", prog); Index: lib/modules/Tools.pmod/Standalone.pmod/dump.pike =================================================================== RCS file: /pike/data/cvsroot/Pike/7.8/lib/modules/Tools.pmod/Standalone.pmod/dump.pike,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- lib/modules/Tools.pmod/Standalone.pmod/dump.pike 25 Sep 2009 11:12:59 -0000 1.11 +++ lib/modules/Tools.pmod/Standalone.pmod/dump.pike 28 Jul 2010 23:31:42 -0000 1.12 @@ -6,7 +6,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: dump.pike,v 1.11 2009/09/25 11:12:59 grubba Exp $ +|| $Id: dump.pike,v 1.12 2010/07/28 23:31:42 mast Exp $ */
constant description = "Dumps Pike files into object files."; @@ -114,9 +114,11 @@ } programs["/master"] = this_program; objects[this_program] = this; -#if constant(_gdb_breakpoint) - _gdb_breakpoint(); -#endif + + // When we arrive at our own dump.pike during dumping, we should + // dump it as a module class like any other, and thus we should + // remove the /main special case. + m_delete (programs, "/main"); } }
Index: src/builtin_functions.c =================================================================== RCS file: /pike/data/cvsroot/Pike/7.8/src/builtin_functions.c,v retrieving revision 1.704 retrieving revision 1.705 diff -u -r1.704 -r1.705 --- src/builtin_functions.c 27 Jul 2010 16:46:01 -0000 1.704 +++ src/builtin_functions.c 28 Jul 2010 22:51:00 -0000 1.705 @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: builtin_functions.c,v 1.704 2010/07/27 16:46:01 mast Exp $ +|| $Id: builtin_functions.c,v 1.705 2010/07/28 22:51:00 mast Exp $ */
#include "global.h" @@ -7364,22 +7364,28 @@ */ PMOD_EXPORT void f_replace_master(INT32 args) { + struct object *new_master; ASSERT_SECURITY_ROOT("replace_master");
if(!args) SIMPLE_TOO_FEW_ARGS_ERROR("replace_master", 1); if(Pike_sp[-args].type != T_OBJECT) SIMPLE_BAD_ARG_ERROR("replace_master", 1, "object"); - if(!Pike_sp[-args].u.object->prog) + new_master = Pike_sp[-args].u.object; + if(!new_master->prog) bad_arg_error("replace_master", Pike_sp-args, args, 1, "object", Pike_sp-args, "Called with destructed object.\n");
if (Pike_sp[-args].subtype) bad_arg_error("replace_master", Pike_sp-args, args, 1, "object", Pike_sp-args, "Subtyped master objects are not supported yet.\n"); - + + push_constant_text ("is_pike_master"); + args++; + object_set_index (new_master, 0, Pike_sp - 1, &svalue_int_one); + free_object(master_object); - master_object=Pike_sp[-args].u.object; + master_object=new_master; add_ref(master_object);
free_program(master_program); Index: src/object.c =================================================================== RCS file: /pike/data/cvsroot/Pike/7.8/src/object.c,v retrieving revision 1.310 retrieving revision 1.311 diff -u -r1.310 -r1.311 --- src/object.c 11 Jul 2010 10:08:02 -0000 1.310 +++ src/object.c 28 Jul 2010 22:50:59 -0000 1.311 @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: object.c,v 1.310 2010/07/11 10:08:02 grubba Exp $ +|| $Id: object.c,v 1.311 2010/07/28 22:50:59 mast Exp $ */
#include "global.h" @@ -658,6 +658,7 @@ }
{ + int f; ONERROR uwp;
/* fprintf(stderr, "Cloning master...\n"); */ @@ -673,7 +674,11 @@
call_c_initializers(master_object); call_pike_initializers(master_object,0); - + + f = find_identifier ("is_pike_master", master_program); + if (f >= 0) + object_low_set_index (master_object, f, &svalue_int_one); + /* fprintf(stderr, "Master loaded.\n"); */
UNSET_ONERROR (uwp); Index: src/svalue.c =================================================================== RCS file: /pike/data/cvsroot/Pike/7.8/src/svalue.c,v retrieving revision 1.261 retrieving revision 1.262 diff -u -r1.261 -r1.262 --- src/svalue.c 11 Jul 2010 12:39:10 -0000 1.261 +++ src/svalue.c 28 Jul 2010 22:46:39 -0000 1.262 @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: svalue.c,v 1.261 2010/07/11 12:39:10 jonasw Exp $ +|| $Id: svalue.c,v 1.262 2010/07/28 22:46:39 mast Exp $ */
#include "global.h" @@ -30,14 +30,10 @@
#define sp Pike_sp
-PMOD_EXPORT const struct svalue svalue_undefined = +PMOD_EXPORT struct svalue svalue_undefined = SVALUE_INIT (T_INT, NUMBER_UNDEFINED, 0); -PMOD_EXPORT const struct svalue svalue_int_zero = SVALUE_INIT_INT (0); -#ifdef HAVE_UNION_INIT -PMOD_EXPORT const struct svalue svalue_int_one = SVALUE_INIT_INT (1); -#else +PMOD_EXPORT struct svalue svalue_int_zero = SVALUE_INIT_INT (0); PMOD_EXPORT struct svalue svalue_int_one = SVALUE_INIT_INT (1); -#endif
#ifdef PIKE_DEBUG PMOD_EXPORT const char msg_type_error[] = Index: src/svalue.h =================================================================== RCS file: /pike/data/cvsroot/Pike/7.8/src/svalue.h,v retrieving revision 1.172 retrieving revision 1.173 diff -u -r1.172 -r1.173 --- src/svalue.h 18 Feb 2010 08:52:55 -0000 1.172 +++ src/svalue.h 28 Jul 2010 22:46:40 -0000 1.173 @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: svalue.h,v 1.172 2010/02/18 08:52:55 srb Exp $ +|| $Id: svalue.h,v 1.173 2010/07/28 22:46:40 mast Exp $ */
#ifndef SVALUE_H @@ -323,13 +323,8 @@
#define FUNCTION_BUILTIN USHRT_MAX
-extern PMOD_EXPORT const struct svalue svalue_undefined, svalue_int_zero; -#ifdef HAVE_UNION_INIT -extern PMOD_EXPORT const struct svalue svalue_int_one; -#else -/* The value 1 is initialized first thing in init_pike. */ -extern PMOD_EXPORT struct svalue svalue_int_one; -#endif +extern PMOD_EXPORT struct svalue svalue_undefined, + svalue_int_zero, svalue_int_one;
#define is_gt(a,b) is_lt(b,a) #define is_ge(a,b) is_le(b,a)