Revision cc8edaf7e8e8eff2fc61804b5f00f0d32db7887d authored by Rene Brun on 01 July 2004, 20:02:52 UTC, committed by Rene Brun on 01 July 2004, 20:02:52 UTC
I attached the modifications that are needed in gcc3strm.cxx to compile with gcc 3.4.0.

There are 2 problems.

One is that I could not find any trace of
    ostream& operator<< (ostream&,const streampos&);
in the gcc 3.3.1 or the gcc 3.4.0 header files.
However it is in cint/lib/gcc3strm/iostrm.h and of course in gcc3strm.cxx

The second problem is more fundamental.  In gcc 3.4.0, streamoff is defined
as (include/c++/3.4.0/bits/postypes.h)
  #ifdef _GLIBCXX_HAVE_INT64_T
    typedef int64_t       streamoff;
  #else
    typedef long long     streamoff;
  #endif
in turn int64_t is platform dependent.  In particular, on my node int64_t
is typedef to an int.  In gcc 3.3.1, streamoff was a long.

This leads to the compilation error:

  cint/src/gcc3strm.cxx: In function `int G__G__stream_6_4_0(G__value*, const char*, G__param*, int)':
  cint/src/gcc3strm.cxx:149: error: 'const class std::fpos<mbstate_t>' has no member named 'operator long int'

As a quick fix, I simply replaced the implementatio of the wrapper so
that it does not do an explicit call to the operator long:
   const fpos<mbstate_t>*pos = (const fpos<mbstate_t>*)(G__getstructoffset());
   G__letint(result7,108,(long)(*pos));
instead of
   G__letint(result7,108,(long)((const fpos<mbstate_t>*)(G__getstructoffset()))->operator long());

Of course, this is fundamentally wrong, since on a 64 bit platform, this will truncate the long long
into a long.

I am not sure what would be good solution (theoritically, it would require to make sure that the
dictionary for fpos<mbstate_t> is different (long vs long long) on the appropriate platforms).


git-svn-id: http://root.cern.ch/svn/root/trunk@9367 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 023bf10
Raw File
TPoints3D.cxx
// @(#)root/star:$Name:  $:$Id: TPoints3D.cxx,v 1.4 2003/01/27 20:41:36 brun Exp $
// Author: Valery Fine(fine@mail.cern.ch)   24/04/99

// $Id: TPoints3D.cxx,v 1.4 2003/01/27 20:41:36 brun Exp $
// ***********************************************************************
// *  C++ class to define the abstract array of 3D points
// * Copyright(c) 1997~1999  [BNL] Brookhaven National Laboratory, STAR, All rights reserved
// * Author                  Valerie Fine  (fine@bnl.gov)
// * Copyright(c) 1997~1999  Valerie Fine  (fine@bnl.gov)
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// *
// * Permission to use, copy, modify and distribute this software and its
// * documentation for any purpose is hereby granted without fee,
// * provided that the above copyright notice appear in all copies and
// * that both that copyright notice and this permission notice appear
// * in supporting documentation.  Brookhaven National Laboratory makes no
// * representations about the suitability of this software for any
// * purpose.  It is provided "as is" without express or implied warranty.
// ************************************************************************

#include "Riostream.h"

#include "TROOT.h"
#include "TClass.h"
#include "TPoints3D.h"
#include "TPointsArray3D.h"

ClassImp(TPoints3D)

//______________________________________________________________________________
// TPoints3D is an abstract class of the array of 3-dimensional points.
// It has 4 different constructors.
//
// This class has no implemenatation for Paint, Draw, and SavePrimitive methods
//
//   First one, without any parameters TPoints3D(), we call 'default
// constructor' and it's used in a case that just an initialisation is
// needed (i.e. pointer declaration).
//
//       Example:
//                 TPoints3D *pl1 = new TPoints3D;
//
//
//   Second one is 'normal constructor' with, usually, one parameter
// n (number of points), and it just allocates a space for the points.
//
//       Example:
//                 TPoints3D pl1(150);
//
//
//   Third one allocates a space for the points, and also makes
// initialisation from the given array.
//
//       Example:
//                 TPoints3D pl1(150, pointerToAnArray);
//
//
//   Fourth one is, almost, similar to the constructor above, except
// initialisation is provided with three independent arrays (array of
// x coordinates, y coordinates and z coordinates).
//
//       Example:
//                 TPoints3D pl1(150, xArray, yArray, zArray);
//


//______________________________________________________________________________
TPoints3D::TPoints3D(TPoints3DABC *points) : fPoints(points)
{
//*-*-*-*-*-*-*-*-*-*-*-*-*3-D PolyLine default constructor*-*-*-*-*-*-*-*-*-*-*
//*-*                      ================================
  DoOwner(kFALSE);
  fPoints = points;
  if (!fPoints) {
    fPoints = new TPointsArray3D;
    DoOwner();
  }
}

//______________________________________________________________________________
TPoints3D::TPoints3D(Int_t n, Option_t *option) : fPoints( new TPointsArray3D(n,option))
{
//*-*-*-*-*-*3-D PolyLine normal constructor without initialisation*-*-*-*-*-*-*
//*-*        ======================================================
//*-*  If n < 0 the default size (2 points) is set
//*-*
   DoOwner();
}

//______________________________________________________________________________
TPoints3D::TPoints3D(Int_t n, Float_t *p, Option_t *option) : fPoints(new TPointsArray3D(n,p,option))
{
//*-*-*-*-*-*-*-*-*-*-*-*-*3-D Point3D normal constructor*-*-*-*-*-*-*-*-*-*-*-*
//*-*                      ===============================
//*-*  If n < 0 the default size (2 points) is set
//*-*
   DoOwner();
}


//______________________________________________________________________________
TPoints3D::TPoints3D(Int_t n, Float_t *x, Float_t *y, Float_t *z, Option_t *option)
                       : fPoints(new TPointsArray3D(n,x,y,z,option))
{
//*-*-*-*-*-*-*-*-*-*-*-*-*3-D PolyLine normal constructor*-*-*-*-*-*-*-*-*-*-*-*
//*-*                      ===============================
//*-*  If n < 0 the default size (2 points) is set
//*-*
   DoOwner();
}


//______________________________________________________________________________
TPoints3D::~TPoints3D()
{
//*-*-*-*-*-*-*-*-*-*-*-*-*3-D PolyLine default destructor*-*-*-*-*-*-*-*-*-*-*-*
//*-*                      ===============================
   Delete();
}
//______________________________________________________________________________
TPoints3D::TPoints3D(const TPoints3D &point) : TPoints3DABC(point)
{
   ((TPoints3D&)point).Copy(*this);
}
//______________________________________________________________________________
void TPoints3D::Copy(TObject &obj) const
{
//*-*-*-*-*-*-*-*-*-*-*-*-*Copy this TPoints3D to another *-*-*-*-*-*-*-*-*-*-*-*
//*-*                      ==============================

   TPoints3DABC::Copy(obj);
   TPoints3D &thatObject = (TPoints3D&)obj;
   thatObject.Delete();
   if (thatObject.IsOwner()) {
      thatObject.fPoints =  new TPoints3D(GetN(),GetP(),GetOption());
     (thatObject.fPoints)->SetLastPosition(GetLastPosition());
   }
   else
     thatObject.fPoints = fPoints;
}

//______________________________________________________________________________
void TPoints3D::Delete()
{
  // Delete only own object
  if (fPoints && IsOwner()) delete fPoints;
  fPoints = 0;
}

//______________________________________________________________________________
Bool_t TPoints3D::DoOwner(Bool_t done) {
  if (done) SetBit(kIsOwner);
  else ResetBit(kIsOwner);
  return IsOwner();
}

//______________________________________________________________________________
void TPoints3D::ExecuteEvent(Int_t event, Int_t px, Int_t py)
{
//*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*-*-*-*-*-*-*
//*-*                =========================================
  if (fPoints)
      fPoints->ExecuteEvent(event,px,py);
}

//______________________________________________________________________________
void TPoints3D::ls(Option_t *option) const
{
//*-*-*-*-*-*-*-*-*-*List this 3-D polyline with its attributes*-*-*-*-*-*-*
//*-*                ==========================================

   TROOT::IndentLevel();
   cout << IsA()->GetName() << " N=" <<GetN()<<" Option="<<option<<endl;
//   IsOwner()?"Owner":"Not owner" << endl;
}

//______________________________________________________________________________
void TPoints3D::Print(Option_t *option) const
{
//*-*-*-*-*-*-*-*-*-*Dump this 3-D polyline with its attributes*-*-*-*-*-*-*-*-*
//*-*                ==========================================
   cout <<"   " << IsA()->GetName() <<" Printing N=" <<GetN()<<" Option="<<option<<endl;
//   IsOwner()?"Owner":"Not owner" << endl;
}

back to top