[comp.lang.eiffel] Bug fix

marc@eiffel.UUCP (Jean-Marc Nerson) (10/20/89)

An oversight in the preparation of the C files of the 2.2 Eiffel
run-time will prevent ``deep_clone'' and ``deep_equal'' (the deep equality
and deep copy routines, inherited by every class from
the universal class ANY) from working properly.

The bug can be fixed as follows in the Eiffel deliveries made so far.

1. Changes in kernel library
----------------------------

In Eiffel library file  installation/Eiffel/library/kernel/any.e, change 
the name of the external C function called from deep_clone  
to Deepcopy (instead of DeepCopy). This means replacing the line

          c_deep_copy  name  "DeepCopy"  language  "C"
by
          c_deep_copy  name  "Deepcopy"  language  "C"

Similarly, the external function called by deep_equal should be
Deepequal (instead of DeepEqual). This means replacing the line

          c_deep_copy  name  "DeepEqual"  language  "C"
by
          c_deep_copy  name  "Deepequal"  language  "C"

You may want to recompile ANY at this point.
  
2. Changes in run-time.
-----------------------

2.1 Edit the file installation/Eiffel/files/_deep.c and do the
corresponding substitutions (one for each):

           DeepCopy  -> Deepcopy
           DeepEqual  -> Deepequal

 
2.2 In the same file, change the body of routine ``deepCopy'',
as follows:

-----------------------------------------------------------------------
static OBJPTR deepCopy(src, flag)
OBJPTR   src;
BOOL flag;
{
        /* 8 lines skipped */
      }
      else {
         dst = Allocate(DType(src));
         dst->info &= ungenmask;
         dst->info |= genmask & src->info;
      }
   /* ----> BEGIN: LINES ADDED */
#ifdef BSD
      bcopy((char *)Access(src), (char *)Access(dst), nrfields * _rt_40d);
#endif
#ifdef SYSTEMV
      memcpy((char *)Access(dst), (char *)Access(src), nrfields * _rt_40d);
#endif
   /* ---> END */
   }
   else dst = destination;
   EXPCOPY(dst,src);
   .....
-----------------------------------------------------------------------
 
  
2.3 Finally, re-build your run-time system archive _run_time.a by running
the following:

    If you are under BSD:
       make  f _makeD "CFLAGS= -O  -DBSD"

    If you are under SYSTEM V:
       make  f _makeD "CFLAGS= -O  -DSYSTEMV"

-- Jean-Marc Nerson
marc@eiffel.com