ldmud-3.2.9/doc/
ldmud-3.2.9/doc/efun/
ldmud-3.2.9/mud/
ldmud-3.2.9/mud/heaven7/
ldmud-3.2.9/mud/heaven7/lib/
ldmud-3.2.9/mud/lp-245/
ldmud-3.2.9/mud/lp-245/banish/
ldmud-3.2.9/mud/lp-245/doc/
ldmud-3.2.9/mud/lp-245/doc/examples/
ldmud-3.2.9/mud/lp-245/doc/sefun/
ldmud-3.2.9/mud/lp-245/log/
ldmud-3.2.9/mud/lp-245/obj/Go/
ldmud-3.2.9/mud/lp-245/players/lars/
ldmud-3.2.9/mud/lp-245/room/death/
ldmud-3.2.9/mud/lp-245/room/maze1/
ldmud-3.2.9/mud/lp-245/room/sub/
ldmud-3.2.9/mud/lp-245/secure/
ldmud-3.2.9/mud/morgengrauen/
ldmud-3.2.9/mud/morgengrauen/lib/
ldmud-3.2.9/mud/sticklib/
ldmud-3.2.9/mud/sticklib/src/
ldmud-3.2.9/mudlib/uni-crasher/
ldmud-3.2.9/pkg/
ldmud-3.2.9/pkg/debugger/
ldmud-3.2.9/pkg/diff/
ldmud-3.2.9/pkg/misc/
ldmud-3.2.9/src/autoconf/
ldmud-3.2.9/src/bugs/
ldmud-3.2.9/src/bugs/MudCompress/
ldmud-3.2.9/src/bugs/b-020916-files/
ldmud-3.2.9/src/bugs/doomdark/
ldmud-3.2.9/src/bugs/ferrycode/ferry/
ldmud-3.2.9/src/bugs/ferrycode/obj/
ldmud-3.2.9/src/bugs/psql/
ldmud-3.2.9/src/done/
ldmud-3.2.9/src/done/order_alist/
ldmud-3.2.9/src/done/order_alist/obj/
ldmud-3.2.9/src/done/order_alist/room/
ldmud-3.2.9/src/gcc/
ldmud-3.2.9/src/gcc/2.7.0/
ldmud-3.2.9/src/gcc/2.7.1/
ldmud-3.2.9/src/hosts/
ldmud-3.2.9/src/hosts/GnuWin32/
ldmud-3.2.9/src/hosts/amiga/NetIncl/
ldmud-3.2.9/src/hosts/amiga/NetIncl/netinet/
ldmud-3.2.9/src/hosts/amiga/NetIncl/sys/
ldmud-3.2.9/src/hosts/i386/
ldmud-3.2.9/src/hosts/msdos/byacc/
ldmud-3.2.9/src/hosts/msdos/doc/
ldmud-3.2.9/src/hosts/os2/
ldmud-3.2.9/src/hosts/win32/
ldmud-3.2.9/src/util/
ldmud-3.2.9/src/util/erq/
ldmud-3.2.9/src/util/indent/hosts/next/
ldmud-3.2.9/src/util/xerq/
ldmud-3.2.9/src/util/xerq/lpc/
ldmud-3.2.9/src/util/xerq/lpc/www/
Short: Pragma 'no_inherit' and 'no_clone'
From: Daniel Sloan
Date: 990410
Type: Patch
State: Done - implemented in 3.2.7-dev.120

diff-pragmas : A diff for the pragmas '#pragma no_clone' and
               '#pragma no_inherit'.  I emailed you a while ago with the
               concept.  This patch needs some testing done on it, since I'm
               not completely certain about the 'no_inherit' bit in prolang.y.
               However, they are very useful, and so far I've had no problems
               with it.

diff -r -c ldmud-3.2.6/src/lex.c ldmud-dev/src/lex.c
*** ldmud-3.2.6/src/lex.c	Wed Mar 31 12:28:11 1999
--- ldmud-dev/src/lex.c	Sat Apr 10 12:39:02 1999
***************
*** 149,154 ****
--- 149,162 ----
    /* True: give info on the context of an error.
     */

+ /* TODO: BOOL */ int pragma_no_clone;
+   /* True: prevent the program from being cloned.
+    */
+
+ /* TODO: BOOL */ int pragma_no_inherit;
+   /* True: prevent the program from being inherited.
+    */
+
  char *last_lex_string;
    /* When lexing string literals, this is the (shared) string lexed
     * so far. It is used to pass string values to lang.c .
***************
*** 1874,1879 ****
--- 1882,1895 ----
      else if (strcmp(str, "verbose_errors") == 0)
      {
          pragma_verbose_errors = MY_TRUE;
+     }
+     else if (strcmp(str, "no_clone") == 0)
+     {
+         pragma_no_clone = MY_TRUE;
+     }
+     else if (strcmp(str, "no_inherit") == 0)
+     {
+         pragma_no_inherit = MY_TRUE;
  #if defined( DEBUG ) && defined ( TRACE_CODE )
      }
      else if (strcmp(str, "set_code_window") == 0)
***************
*** 3209,3214 ****
--- 3225,3232 ----

      pragma_strict_types = PRAGMA_WEAK_TYPES; /* I would prefer !o_flag /Lars */
      instrs[F_CALL_OTHER-F_OFFSET].ret_type = TYPE_ANY;
+     pragma_no_clone = MY_FALSE;
+     pragma_no_inherit = MY_FALSE;
      pragma_save_types = MY_FALSE;
      pragma_verbose_errors = MY_FALSE;

diff -r -c ldmud-3.2.6/src/lex.h ldmud-dev/src/lex.h
*** ldmud-3.2.6/src/lex.h	Thu Dec 10 13:37:36 1998
--- ldmud-dev/src/lex.h	Sat Apr 10 12:39:43 1999
***************
*** 141,146 ****
--- 141,148 ----
  extern /* TODO: BOOL */ int pragma_save_types;
  extern /* TODO: BOOL */ int pragma_combine_strings;
  extern /* TODO: BOOL */ int pragma_verbose_errors;
+ extern /* TODO: BOOL */ int pragma_no_clone;
+ extern /* TODO: BOOL */ int pragma_no_inherit;
  extern char *last_lex_string;
  extern struct ident *all_efuns;

diff -r -c ldmud-3.2.6/src/prolang.y ldmud-dev/src/prolang.y
*** ldmud-3.2.6/src/prolang.y	Wed Mar 31 12:28:11 1999
--- ldmud-dev/src/prolang.y	Sat Apr 10 12:51:42 1999
***************
*** 1452,1457 ****
--- 1452,1469 ----
                          yyerror("Out of memory");
                          YYACCEPT;
                      }
+ 		    if (ob->prog->flags & P_NO_INHERIT)
+ 		    {
+ 		        /* Hrm, do we need to check anything here?
+ 			 * Should we be doing YYACCEPT?
+ 			 * If any problems appear with
+ 			 * this patch, check here first :-)
+ 			 * However, it seems to work good, even when I watched
+ 			 * it with the debugger.
+ 			 */
+ 		        yyerror("Illegal to inherit an object which sets '#pragma no_inherit'.\n");
+ 			YYACCEPT;
+ 		    }
                      free_string(last_string_constant);
                      last_string_constant = 0;
                      if (ob->flags & O_APPROVED)
***************
*** 5734,5739 ****
--- 5746,5753 ----
          prog->heart_beat = heart_beat;
          prog->id_number =
            ++current_id_number ? current_id_number : renumber_programs();
+         prog->flags = (pragma_no_clone ? P_NO_CLONE : 0) |
+ 	              (pragma_no_inherit ? P_NO_INHERIT : 0);
          prog->load_time = current_time;
          total_prog_block_size += prog->total_size;
          total_num_prog_blocks += 1;
diff -r -c ldmud-3.2.6/src/simulate.c ldmud-dev/src/simulate.c
*** ldmud-3.2.6/src/simulate.c	Wed Mar 31 12:28:11 1999
--- ldmud-dev/src/simulate.c	Sat Apr 10 12:38:57 1999
***************
*** 699,704 ****
--- 699,710 ----
          return 0;
      if (ob->super)
          error("Cloning a bad object !\n");
+
+     if (ob->prog->flags & P_NO_CLONE)
+     {
+         error("Illegal to clone an object which sets '#pragma no_clone'.\n");
+     }
+
      if (ob->flags & O_CLONE) {
          char c;
          char *p;