clhep-2.1.4.1.orig/0000755000175000017500000000000012242515221012371 5ustar olesolesclhep-2.1.4.1.orig/GenericFunctions/0000755000175000017500000000000012242515151015640 5ustar olesolesclhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/0000755000175000017500000000000012242515150021104 5ustar olesolesclhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ClebschGordanCoefficientSet.hh0000644000175000017500000000320512012777433026747 0ustar olesoles#ifndef _ClebschGordanCoefficientSet_h_ #define _ClebschGordanCoefficientSet_h_ #include #include #include namespace Genfun { class ClebschGordanCoefficientSet { public: double operator () (unsigned int l1, unsigned int l2, int m1, int m2, int L, int M) const; private: // Key used to optimize access (look up previously calcuated results). class Key { public: inline Key(unsigned int xl1, unsigned int xl2, int xm1, int xm2, unsigned int xL): l1(xl1),l2(xl2),m1(xm1),m2(xm2),L(xL) {} inline bool operator < (const Key & o) const { if ( l1!=o.l1) return l1 coeff; static double calcCoefficient(int l1, int l2, int L, int m1, int m2, int M); }; inline double ClebschGordanCoefficientSet::operator () (unsigned int l1, unsigned int l2, int m1, int m2, int L, int M) const { if ((m1+m2)!=M) return 0; Key key(l1,l2,m1,m2,L); std::map::iterator i=coeff.find(key),end=coeff.end(); if (i==end) { double c = calcCoefficient(l1, l2, L, m1, m2,M); coeff[key]=c; return c; } return (*i).second; } } #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/AdaptiveRKStepper.hh0000644000175000017500000000625412006746030024772 0ustar olesoles#ifndef _AdaptiveRKStepper_h_ #define _AdaptiveRKStepper_h_ #include "CLHEP/GenericFunctions/RKIntegrator.hh" // // This is the default RKStepper routine, used within the RKIntegrator // when no other stepper is provided. // namespace Genfun { class AdaptiveRKStepper:public RKIntegrator::RKStepper { public: class EEStepper; // Constructor. A default stepper is created if none // is specified--it is an Embedded Runge Kutta stepper // using a Cash-Karp extended Butcher Tableau, which // is fourth-order. AdaptiveRKStepper(const EEStepper *eeStepper=NULL); // Copy constructor: AdaptiveRKStepper(const AdaptiveRKStepper & right); // Destructor: virtual ~AdaptiveRKStepper(); // Takes *multiple* steps if needed up to or exceeding the // specified time. This called from the RKFunction and not // by users. If a time limit is specified, only one step // is taken--this mode is used to interpolate between cached // meshpoints. // Input: data contains diffEqn information and cache: // sData a summary of starting point information // timeLimit (if nonzero) time limit for step // Output dData a summary of into at the ending point. // virtual void step (const RKIntegrator::RKData * data, const RKIntegrator::RKData::Data & sdata, RKIntegrator::RKData::Data & ddata, double timeLimit) const ; // Clone virtual AdaptiveRKStepper *clone() const; // Accessors and modifiers to algorithmic parameters. Roughly // speaking these are ordered according to importance: the user // will often wish to modify the tolerance and the starting // stepsize, but rarely should need to touch any of the others. // The tolerance: double & tolerance(); const double & tolerance() const; // The starting stepsize: double & startingStepsize(); const double & startingStepsize() const; // The safety factor. Step size increases are moderated by this // factor: double & safetyFactor(); const double & safetyFactor() const; // The minimum amount by which a step size is decreased: double & rmin(); const double & rmin() const; // The maximum amount by which a step size is increased: double & rmax(); const double & rmax() const; private: // It is illegal to assign an AdaptiveRKStepper: AdaptiveRKStepper & operator=(const AdaptiveRKStepper & right); const EEStepper *eeStepper; double T; double sStepsize; double S; double Rmin; double Rmax; mutable double stepsize; }; // // An abstract base class for steppers that return an error // estimate at each step: // class AdaptiveRKStepper::EEStepper { public: virtual ~EEStepper(); virtual void step (const RKIntegrator::RKData * data, const RKIntegrator::RKData::Data & sdata, RKIntegrator::RKData::Data & ddata, std::vector & errors) const = 0; virtual EEStepper *clone() const=0; virtual unsigned int order() const=0; }; } #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ParameterProduct.hh0000755000175000017500000000252107726364536024736 0ustar olesoles// -*- C++ -*- // $Id: ParameterProduct.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------ParameterProduct--------------------------------// // // // ParameterProduct, result of multiplication of two parameters. // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ParameterProduct_h #define ParameterProduct_h 1 #include "CLHEP/GenericFunctions/AbsParameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ParameterProduct : public AbsParameter { PARAMETER_OBJECT_DEF(ParameterProduct) public: // Constructor ParameterProduct(const AbsParameter *arg1, const AbsParameter *arg2); // Copy constructor ParameterProduct(const ParameterProduct &right); // Destructor virtual ~ParameterProduct(); // Retreive function value virtual double getValue() const; private: // It is illegal to assign a ParameterProduct const ParameterProduct & operator=(const ParameterProduct &right); AbsParameter *_arg1; AbsParameter *_arg2; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Legendre.icc0000755000175000017500000000134711406213111023312 0ustar olesoles// -*- C++ -*- // $Id: #include "gsl/gsl_sf_legendre.h" #include #include #include namespace Genfun { FUNCTION_OBJECT_IMP(Legendre) inline Legendre::Legendre(unsigned int order): _order(order) { } inline Legendre::~Legendre() { } inline Legendre::Legendre(const Legendre & right): _order(right._order) { } inline double Legendre::operator() (double x) const { gsl_sf_result result; int status = gsl_sf_legendre_Pl_e(_order,x, &result); if (status!=0) { std::cerr << "Warning, GSL function gsl_sf_legendre_e" << " return code" << status << std::endl; raise(SIGFPE); } return result.val; } } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/EllipticIntegral.hh0000755000175000017500000000603307705060311024667 0ustar olesoles// -*- C++ -*- // $Id: //---------------------EllipticIntegral---------------------------------------// // // // // // Joe Boudreau, September 2001 // // // //-------------------------------------------------------------------------- // #ifndef EllipticIntegral_h #define EllipticIntegral_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { namespace EllipticIntegral { class FirstKind : public AbsFunction { FUNCTION_OBJECT_DEF(FirstKind) public: // Constructor: FirstKind (); // Copy constructor FirstKind(const FirstKind &right); // Destructor virtual ~FirstKind(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the k-parameter. Default value = 1.0. Parameter & k(); const Parameter & k() const; private: // It is illegal to assign an adjustable constant const FirstKind & operator=(const FirstKind &right); Parameter _k; // the k parameter }; class SecondKind : public AbsFunction { FUNCTION_OBJECT_DEF(SecondKind) public: // Constructor: SecondKind (); // Copy constructor SecondKind(const SecondKind &right); // Destructor virtual ~SecondKind(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the k-parameter. Default value = 1.0. Parameter & k(); const Parameter & k() const; private: // It is illegal to assign an adjustable constant const SecondKind & operator=(const SecondKind &right); Parameter _k; // the k parameter }; class ThirdKind : public AbsFunction { FUNCTION_OBJECT_DEF(ThirdKind) public: // Constructor: ThirdKind (); // Copy constructor ThirdKind(const ThirdKind &right); // Destructor virtual ~ThirdKind(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the k-parameter. Default value = 1.0. Parameter & k(); const Parameter & k() const; // Get the n-parameter. Default value = 1.0. Parameter & n(); const Parameter & n() const; private: // It is illegal to assign an adjustable constant const ThirdKind & operator=(const ThirdKind &right); Parameter _k; // the k parameter Parameter _n; // the n parameter }; } // end namespace EllipticIntegral } // end namespace Genfun #include "CLHEP/GenericFunctions/EllipticIntegral.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Theta.hh0000755000175000017500000000252511651542310022502 0ustar olesoles// -*- C++ -*- // $Id: //---------------------Theta------------------------------------------------// // // // Class Theta // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef Theta_h #define Theta_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Theta : public AbsFunction { FUNCTION_OBJECT_DEF(Theta) public: // Constructor Theta(); // Destructor virtual ~Theta(); // Copy constructor Theta(const Theta &right); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a Theta const Theta & operator=(const Theta &right); }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/FunctionNoop.hh0000755000175000017500000000314607726364536024102 0ustar olesoles// -*- C++ -*- // $Id: FunctionNoop.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------FunctionNoop------------------------------------// // // // Class FunctionNoop, output of the unary + operator: // // Joe Boudreau, February 2001 // // // //--------------------------------------------------------------------------// #ifndef FunctionNoop_h #define FunctionNoop_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class FunctionNoop : public AbsFunction { FUNCTION_OBJECT_DEF(FunctionNoop) public: // Constructor FunctionNoop(const AbsFunction *arg1); // Copy constructor. FunctionNoop(const FunctionNoop &right); // Destructor virtual ~FunctionNoop(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const; // Dimensionality virtual unsigned int dimensionality() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a FunctionNoop const FunctionNoop & operator=(const FunctionNoop &right); // The function we're negating. const AbsFunction *_arg1; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Exp.hh0000755000175000017500000000265307726364536022217 0ustar olesoles// -*- C++ -*- // $Id: Exp.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------Exp--------------------------------------------------// // // // Class Exp // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef Exp_h #define Exp_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Exp : public AbsFunction { FUNCTION_OBJECT_DEF(Exp) public: // Constructor Exp(); // Copy constructor Exp(const Exp &right); // Destructor virtual ~Exp(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign an adjustable constant const Exp & operator=(const Exp &right); }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/cmake-defs.h.in0000644000175000017500000000172511607115601023667 0ustar olesoles/* @PACKAGE@/defs.h Generated by cmake. */ #ifndef @UPACKAGE@_DEFS_H #define @UPACKAGE@_DEFS_H /* Name of package */ #ifndef PACKAGE #define PACKAGE "@PACKAGE@" #endif /* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #define PACKAGE_BUGREPORT "http://savannah.cern.ch/projects/clhep/" #endif /* Define to the full name of this package. */ #ifndef PACKAGE_NAME #define PACKAGE_NAME "@PROJECT_NAME@ @PACKAGE@" #endif /* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #define PACKAGE_STRING "@PROJECT_NAME@ @PACKAGE@ @VERSION@" #endif /* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #define PACKAGE_TARNAME "@PACKAGE@" #endif /* Define to the version of this package. */ #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "@VERSION@" #endif /* Version number of package */ #ifndef VERSION #define VERSION "@VERSION@" #endif #endif // @UPACKAGE@_DEFS_H clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/SymToArgAdaptor.hh0000644000175000017500000000651310554745431024465 0ustar olesoles// -*- C++ -*- // $Id: //-----------------------Class ParaToArgAdaptor-----------------------------// // // // Joe Boudreau // // June 2004 // // // // The purpose of this adaptor is to be able to create, starting FROM // // a function F of several variables and controlled by several parameters: // // // // F(alpha, beta, gamma....; x, y, z) // // // // a new function of several variables in which the parameter values are // // set by some of the variables. Application: event-per-event errors. // // // // Arguments to the adaptor: // // 1) The original generic function to adapt. // // 2) The symbolic expression to apply it to. // // 3) The name of a parameter to tweak. // // 4) The symbolic expression to tweak it with // // // //--------------------------------------------------------------------------// #ifndef _SYMTOARGADAPTOR_ #define _SYMTOARGADAPTOR_ #include #include #include #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { template class SymToArgAdaptor : public AbsFunction { FUNCTION_OBJECT_DEF(SymToArgAdaptor) public: // ScopedMethodName typedef Parameter & (F::*ScopedMethodPtr) (); // Constructor SymToArgAdaptor( F & function, // A function. const AbsFunction & f_expression, // An expression to apply it to ScopedMethodPtr parameterFetchMethod, // A parameter. const AbsFunction * p_expression); // An expression for the parameter // Copy constructor SymToArgAdaptor(const SymToArgAdaptor &right); // Destructor virtual ~SymToArgAdaptor(); // Retreive function value virtual double operator ()(double argument) const; // Gives an error. virtual double operator ()(const Argument & a) const; // Must use this one // Dimensionality virtual unsigned int dimensionality() const; private: // It is illegal to assign an adjustable constant const SymToArgAdaptor & operator=(const SymToArgAdaptor &right); // Here is the function being adapted; F *_function; // A Variable (int an argument) to which the function is going to apply: const AbsFunction *_f_expression; // Here is the recipe for fetching the parameter from the function: std::mem_fun_ref_t _parameterFetchMethod; // Here is the symbol to be connect to the parameter: const AbsFunction *_p_expression; }; } // namespace Genfun #include "CLHEP/GenericFunctions/SymToArgAdaptor.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/SphericalHarmonicExpansion.icc0000644000175000017500000000575211746557221027072 0ustar olesoles// -*- C++ -*- // $Id: #include #include #include #include #include #include #include namespace Genfun { FUNCTION_OBJECT_IMP(SphericalHarmonicExpansion) class SphericalHarmonicExpansion::Clockwork { public: Clockwork(SphericalHarmonicExpansion::Type type, const SphericalHarmonicCoefficientSet & coefficients):type(type),coefficients(coefficients){} SphericalHarmonicExpansion::Type type; SphericalHarmonicCoefficientSet coefficients; }; inline SphericalHarmonicExpansion::SphericalHarmonicExpansion(Type type, const SphericalHarmonicCoefficientSet & coefficients): c(new Clockwork(type,coefficients)) { } inline SphericalHarmonicExpansion::~SphericalHarmonicExpansion() { delete c; } inline SphericalHarmonicExpansion::SphericalHarmonicExpansion(const SphericalHarmonicExpansion & right): AbsFunction(), c(new Clockwork(right.c->type,right.c->coefficients)) { } inline double SphericalHarmonicExpansion::operator() (double ) const { throw std::runtime_error("Dimensionality error in SphericalHarmonicExpansion"); return 0; } inline double SphericalHarmonicExpansion::operator() (const Argument & a ) const { const unsigned int LMAX=c->coefficients.getLMax(); double x = a[0]; double phi=a[1]; // Note, the calling sequence of the GSL Special Function forces us to // transpose Plm from its "natural" order.. It is addressed as P[m][l]. //double Plm[LMAX+1][LMAX+1]; std::vector< std::vector > Plm(LMAX+1); for (int m=0;m<=int(LMAX);m++) { Plm[m].resize(LMAX+1); gsl_sf_legendre_sphPlm_array (LMAX, m, x, &*Plm[m].begin()); //gsl_sf_legendre_sphPlm_array (LMAX, m, x, Plm[m]); } std::complex P=0.0; std::complex I(0,1.0); for (unsigned int l=0;l<=LMAX;l++) { for (int m=0;m<=int(l);m++) { { int LP=l-abs(m); double Pn= Plm[abs(m)][LP]; if (!finite(Pn)) { std::ostringstream stream; stream << "Non-finite Pn(x=" << x << ")"; throw std::runtime_error(stream.str()); } // Once for positive m (in all cases): P+=(c->coefficients(l,m)*Pn*exp(I*(m*phi))); // Once for negative m (skip if m==0); if (m!=0) P+= ( (m%2 ?-1.0:1.0)*c->coefficients(l,-m)*Pn*exp(-I*(m*phi))); } } } double retVal=0; if (c->type==MAGSQ) return norm(P); if (c->type==MAG) return abs(P); if (c->type==REAL) return real(P); if (c->type==IMAG) return imag(P); if (!finite(retVal)) { throw std::runtime_error("Non-finite return value in SphericalHarmonicExpansion"); } return retVal; } inline const SphericalHarmonicCoefficientSet & SphericalHarmonicExpansion::coefficientSet() const { return c->coefficients; } inline SphericalHarmonicCoefficientSet & SphericalHarmonicExpansion::coefficientSet() { return c->coefficients; } } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/F1D.hh0000644000175000017500000000232612033561751022010 0ustar olesoles// -*- C++ -*------------------------------------------------------ // // This class is an adaptor from any function (double *f)(double x) // of one real variable, to generic functions. This allows one // to plot, differentiate, sum, compose, etc, any standard C or // C++ math function by converting it to a Generic Function. // // Joe Boudreau October 2012 //----------------------------------------------------- #ifndef F1D_h #define F1D_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class F1D : public AbsFunction { typedef double (*FcnPtr)(double); FUNCTION_OBJECT_DEF(F1D) public: // Constructor F1D(FcnPtr fcn):p(fcn){}; // Destructor virtual ~F1D(){}; // Copy constructor F1D(const F1D &right):AbsFunction(),p(right.p){}; // Retreive function value virtual double operator ()(double x) const { return (*p)(x); } virtual double operator ()(const Argument & a) const {return operator() (a[0]);} private: // It is illegal to assign a F1D const F1D & operator=(const F1D &right); // Data: FcnPtr p; }; FUNCTION_OBJECT_IMP(F1D) } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ConstOverParameter.hh0000755000175000017500000000253407726364536025244 0ustar olesoles// -*- C++ -*- // $Id: ConstOverParameter.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------ConstOverParameter------------------------------// // // // ConstOverParameter, result of multiplying a parameter with a constant. // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ConstOverParameter_h #define ConstOverParameter_h 1 #include "CLHEP/GenericFunctions/AbsParameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ConstOverParameter : public AbsParameter { PARAMETER_OBJECT_DEF(ConstOverParameter) public: // Constructor ConstOverParameter(double, const AbsParameter *); // Copy constructor ConstOverParameter(const ConstOverParameter &right); // Destructor virtual ~ConstOverParameter(); // Retreive function value virtual double getValue() const; private: // It is illegal to assign a ConstOverParameter const ConstOverParameter & operator=(const ConstOverParameter &right); double _constant; AbsParameter *_parameter; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/SphericalNeumann.hh0000755000175000017500000000306212047553071024674 0ustar olesoles// -*- C++ -*- // $Id: SphericalNeumann.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------SphericalNeumann-------------------------------------// // // // Class SphericalNeumann. An spherical neumann function of integral order // // Joe Boudreau, Petar Maksimovic, January 2000 // // // //--------------------------------------------------------------------------// #ifndef SphericalNeumann_h #define SphericalNeumann_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class SphericalNeumann : public AbsFunction { FUNCTION_OBJECT_DEF(SphericalNeumann) public: // Constructor SphericalNeumann(unsigned int l); // Copy constructor SphericalNeumann(const SphericalNeumann &right); // Destructor virtual ~SphericalNeumann(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the integer variable l unsigned int l() const; private: // It is illegal to assign a spherical neumann const SphericalNeumann & operator=(const SphericalNeumann &right); // Here is the index unsigned int _l; }; } // namespace Genfun #include "CLHEP/GenericFunctions/SphericalNeumann.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/AbsParameter.hh0000755000175000017500000000670507726364536024033 0ustar olesoles// -*- C++ -*- // $Id: AbsParameter.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ #ifndef _AbsParameter_h_ #define _AbsParameter_h_ namespace Genfun { class Parameter; class ParameterSum; class ParameterDifference; class ParameterProduct; class ParameterQuotient; class ParameterNegation; class ConstPlusParameter; class ConstMinusParameter; class ConstTimesParameter; class ConstOverParameter; /** * @author * @ingroup genfun */ class AbsParameter { public: // Default Constructor AbsParameter(); // Copy constructor: AbsParameter(const AbsParameter &); // Destructor virtual ~AbsParameter(); // Parameter value virtual double getValue() const=0; // Every parameter must override this: AbsParameter * clone() const; // Extra lingual type information: virtual Parameter *parameter() {return 0;} virtual const Parameter *parameter() const {return 0;} private: // Cannot assign an AbsParameter: AbsParameter & operator= (const AbsParameter &); virtual AbsParameter *_clone() const=0; }; // Now for some additional operations: ConstTimesParameter operator * (double c, const AbsParameter &op2); ConstPlusParameter operator + (double c, const AbsParameter &op2); ConstMinusParameter operator - (double c, const AbsParameter &op2); ConstOverParameter operator / (double c, const AbsParameter &op2); ConstTimesParameter operator * (const AbsParameter &op2, double c); ConstPlusParameter operator + (const AbsParameter &op2, double c); ConstPlusParameter operator - (const AbsParameter &op2, double c); ConstTimesParameter operator / (const AbsParameter &op2, double c); ParameterProduct operator * (const AbsParameter &op1, const AbsParameter &op2); ParameterSum operator + (const AbsParameter &op1, const AbsParameter &op2); ParameterDifference operator - (const AbsParameter &op1, const AbsParameter &op2); ParameterQuotient operator / (const AbsParameter &op1, const AbsParameter &op2); ParameterNegation operator - (const AbsParameter &op1); typedef const AbsParameter & GENPARAMETER; } // namespace Genfun // Poor man's covariant return type: #define PARAMETER_OBJECT_DEF(classname) \ public: \ classname *clone() const; \ private: \ virtual AbsParameter* _clone() const; // Poor man's covariant return type: #define PARAMETER_OBJECT_IMP(classname) \ classname *classname::clone () const { \ return (classname *) _clone(); \ } \ AbsParameter *classname::_clone () const { \ return new classname(*this); \ } #include "CLHEP/GenericFunctions/ParameterProduct.hh" #include "CLHEP/GenericFunctions/ParameterSum.hh" #include "CLHEP/GenericFunctions/ParameterDifference.hh" #include "CLHEP/GenericFunctions/ParameterQuotient.hh" #include "CLHEP/GenericFunctions/ParameterNegation.hh" #include "CLHEP/GenericFunctions/ConstPlusParameter.hh" #include "CLHEP/GenericFunctions/ConstMinusParameter.hh" #include "CLHEP/GenericFunctions/ConstTimesParameter.hh" #include "CLHEP/GenericFunctions/ConstOverParameter.hh" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Variable.hh0000755000175000017500000000373207726364536023207 0ustar olesoles// -*- C++ -*- // $Id: Variable.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //----------------------X------------ --------------------------------------// // // // Class Variable // // Joe Boudreau, Petar Maksimovic, Nov. 1999 // // // // Variable is a function that returns the variable itself. // //--------------------------------------------------------------------------// #ifndef Variable_h #define Variable_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Variable : public AbsFunction { FUNCTION_OBJECT_DEF(Variable) public: // Constructor Variable(unsigned int selectionIndex=0, unsigned int dimensionality=1); // Copy constructor Variable(const Variable &right); // Destructor virtual ~Variable(); // Retrieve function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const; // Get the dimensionality, as specified in the constructor: virtual unsigned int dimensionality() const ; // Get the selectionIndex: unsigned int index() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a fixed constant const Variable & operator=(const Variable &right); // The selection index is used to select a particular element from // the argument. By default it is zero..... unsigned int _selectionIndex; // The dimensionality, length of the argument list: unsigned int _dimensionality; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/DoubleParamToArgAdaptor.hh0000755000175000017500000000656707726364536026136 0ustar olesoles// -*- C++ -*- // $Id: DoubleParamToArgAdaptor.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //-----------------------Class ParaToArgAdaptor-----------------------------// // // // Joe Boudreau // // January 2000 // // // // This class changes the interpretation of two PARAMETERs to a function // // connects them to a single argument, with scale factors controlling how // // the argument is increased before it is used to adjust the parameter. // // In other words it makes a function like // // // // F(a_0, a_1, a_2; x) // // // // and reinterprets it as // // // // F(a_0; x, a_1) // // // // // //--------------------------------------------------------------------------// #ifndef DoubleParamToArgAdaptor_h_ #define DoubleParamToArgAdaptor_h_ #include #include #include #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ template class DoubleParamToArgAdaptor : public AbsFunction { FUNCTION_OBJECT_DEF(DoubleParamToArgAdaptor) public: // ScopedMethodName typedef Parameter & (F::*ScopedMethodPtr) (); // Constructor DoubleParamToArgAdaptor(const F & function, ScopedMethodPtr parameterFetchMethod0, ScopedMethodPtr paraemterFetchMethod1); // Copy constructor DoubleParamToArgAdaptor(const DoubleParamToArgAdaptor &right); // Destructor virtual ~DoubleParamToArgAdaptor(); // Retreive function value virtual double operator ()(double argument) const; // Gives an error. virtual double operator ()(const Argument & a) const; // Must use this one // Dimensionality virtual unsigned int dimensionality() const; // Get the mean of the DoubleParamToArgAdaptor Parameter & scaleFactor0(); const Parameter & scaleFactor0() const; // Get the mean of the DoubleParamToArgAdaptor Parameter & scaleFactor1(); const Parameter & scaleFactor1() const; private: // It is illegal to assign an adjustable constant const DoubleParamToArgAdaptor & operator=(const DoubleParamToArgAdaptor &right); // Here is the scale: Parameter _scaleFactor0; Parameter _scaleFactor1; // Here is the function being adapted; F *_function; // Here is the recipe for fetching the parameter from the function: std::mem_fun_ref_t _parameterFetchMethod0; std::mem_fun_ref_t _parameterFetchMethod1; }; } // namespace Genfun #include "CLHEP/GenericFunctions/DoubleParamToArgAdaptor.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ExtendedButcherTableau.icc0000644000175000017500000001450312047015056026145 0ustar olesolesnamespace Genfun { ExtendedButcherTableau::ExtendedButcherTableau(const std::string &mname, unsigned int xorder, unsigned int xorderHat):_name(mname), _order(xorder), _orderHat(xorderHat){ } const std::string & ExtendedButcherTableau::name() const { return _name; } unsigned int ExtendedButcherTableau::order() const{ return _order; } unsigned int ExtendedButcherTableau::orderHat() const{ return _orderHat; } unsigned int ExtendedButcherTableau::nSteps() const{ return _A.size(); } // don't generate warnings about intentional shadowing #if defined __GNUC__ #if __GNUC__ > 3 && __GNUC_MINOR__ > 6 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" #endif #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wshadow" #endif double & ExtendedButcherTableau::A(unsigned int i, unsigned int j) { if (i>=_A.size()) { unsigned int newSize=i+1; // (shadowed) for (unsigned int ii=0;ii<_A.size();ii++) { _A[ii].resize(newSize,0.0); } for (unsigned int ii=_A.size();ii(newSize,0)); } if (j>=_A[i].size()) { unsigned int newSize=j+1; // (shadow) for (unsigned int ii=0;ii<_A.size();ii++) { _A[ii].resize(newSize,0.0); } } } return _A[i][j]; } #if defined __GNUC__ #if __GNUC__ > 3 && __GNUC_MINOR__ > 6 #pragma GCC diagnostic pop #endif #endif #ifdef __clang__ #pragma clang diagnostic pop #endif double & ExtendedButcherTableau::b(unsigned int i){ if (i>=_b.size()) _b.resize(i+1); return _b[i]; } double & ExtendedButcherTableau::bHat(unsigned int i){ if (i>=_bHat.size()) _bHat.resize(i+1); return _bHat[i]; } double & ExtendedButcherTableau::c(unsigned int i){ if (i>=_c.size()) _c.resize(i+1); return _c[i]; } const double & ExtendedButcherTableau::A(unsigned int i, unsigned int j) const{ return _A[i][j]; } const double & ExtendedButcherTableau::b(unsigned int i) const{ return _b[i]; } const double & ExtendedButcherTableau::bHat(unsigned int i) const{ return _bHat[i]; } const double & ExtendedButcherTableau::c(unsigned int i) const{ return _c[i]; } } std::ostream & operator << (std::ostream & o, const Genfun::ExtendedButcherTableau & b) { o << "Name " << b.name() << " of order " << b.order() << std::endl; o << "A" << std::endl; for (unsigned int i=0;i namespace Genfun { class LegendreCoefficientSet::Clockwork { public: std::vector > data; }; inline LegendreCoefficientSet::LegendreCoefficientSet(unsigned int LMAX):c(new Clockwork()){ for (unsigned int l=0;l<=LMAX;l++) { c->data.push_back(0); } } inline LegendreCoefficientSet::~LegendreCoefficientSet(){ delete c; } inline LegendreCoefficientSet::LegendreCoefficientSet(const LegendreCoefficientSet & right): c(new Clockwork(*right.c)) { } inline unsigned int LegendreCoefficientSet::getLMax() const { return c->data.size()-1; } inline const std::complex &LegendreCoefficientSet:: operator () (unsigned int l) const { return c->data[l]; } inline std::complex & LegendreCoefficientSet::operator () (unsigned int l) { return c->data[l]; } inline std::ostream & operator << ( std::ostream & o, const LegendreCoefficientSet & c) { for (unsigned int l=0;l<=c.getLMax();l++) { o << l << " mag: " << c(l) << std::endl; } o << std::endl; return o; } inline LegendreCoefficientSet & LegendreCoefficientSet::operator= (const LegendreCoefficientSet & source ){ if (this!=&source) { delete c; c = new Clockwork(*source.c); } return *this; } } clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Argument.hh0000755000175000017500000000336507726364536023246 0ustar olesoles// -*- C++ -*- // $Id: Argument.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ #ifndef __ARGUMENT_H_ #define __ARGUMENT_H_ #include #include #include #include // Here is an argument namespace Genfun { /** * @author * @ingroup genfun */ class Argument { public: // Constructor Argument(int ndim=0); // Copy Constructor Argument( const Argument &); // Assignment operator const Argument & operator=(const Argument &); // Destructor: ~Argument(); // Set/Get Value double & operator[] (int I); const double & operator[] (int i) const; // Get the dimensions unsigned int dimension() const; private: std::vector *_data; friend std::ostream & operator << (std::ostream & o, const Argument & a); }; inline Argument::Argument(const Argument & right): _data(new std::vector(*(right._data))){ } inline const Argument & Argument::operator=( const Argument & right) { if (this != &right) { delete _data; _data=NULL; _data = new std::vector(*(right._data)); } return *this; } inline unsigned int Argument::dimension() const { return _data->size(); } inline double & Argument::operator[] (int i) { return (*_data)[i]; } inline const double & Argument::operator[] (int i) const { return (*_data)[i]; } inline Argument::Argument(int ndim): _data(new std::vector(ndim)) { } inline Argument::~Argument() { delete _data; } inline std::ostream & operator << (std::ostream & os, const Argument & a) { std::ostream_iterator oi(os,","); std::copy (a._data->begin(),a._data->end(),oi); return os; } } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Gaussian.hh0000755000175000017500000000342407726364536023232 0ustar olesoles// -*- C++ -*- // $Id: Gaussian.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------Gaussian---------------------------------------------// // // // Class Gaussian // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef Gaussian_h #define Gaussian_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Gaussian : public AbsFunction { FUNCTION_OBJECT_DEF(Gaussian) public: // Constructor Gaussian(); // Copy constructor Gaussian(const Gaussian &right); // Destructor virtual ~Gaussian(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the mean of the Gaussian Parameter & mean(); const Parameter & mean() const; // Get the sigma of the Gaussian Parameter & sigma(); const Parameter & sigma() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign an adjustable constant const Gaussian & operator=(const Gaussian &right); // Here is the decay constant Parameter _mean; // Here is the sigma Parameter _sigma; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ACos.hh0000755000175000017500000000252207726364536022303 0ustar olesoles// -*- C++ -*- // $Id: ACos.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------ACos-------------------------------------------------// // // // Class ACos // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ACos_h #define ACos_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { class ACos : public AbsFunction { FUNCTION_OBJECT_DEF(ACos) public: // Constructor ACos(); // Destructor virtual ~ACos(); // Copy constructor ACos(const ACos &right); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a ACosine const ACos & operator=(const ACos &right); }; } // end namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/SphericalBessel.icc0000755000175000017500000000260512047553071024651 0ustar olesoles// -*- C++ -*- // $Id: SphericalBessel.icc,v 1.4 2010/06/16 18:22:01 garren Exp $ #include "CLHEP/GenericFunctions/Sin.hh" #include "CLHEP/GenericFunctions/Cos.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include "gsl/gsl_sf_bessel.h" #include namespace Genfun { FUNCTION_OBJECT_IMP(SphericalBessel) //---------------------------------------------------------------------------------// // Implementation notes: The Spherical Bessel function is implemented in terms of // // lower order spherical bessel functions. This is possible thanks to a recursion // // relation. // //---------------------------------------------------------------------------------// inline SphericalBessel::SphericalBessel(unsigned int l): _l(l) { } inline SphericalBessel::~SphericalBessel() { } inline SphericalBessel::SphericalBessel(const SphericalBessel & right): _l(right._l) { } inline double SphericalBessel::operator() (double x) const { // // First try the GSL implementation: // gsl_sf_result result; int status =gsl_sf_bessel_jl_e(_l, x,&result); if (status!=0) { std::cerr << "Warning, GSL function gsl_sf_bessel_jl_impl" << " return code" << status << std::endl; raise(SIGFPE); } return result.val; } inline unsigned int SphericalBessel::l() const { return _l; } } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Exponential.hh0000755000175000017500000000326507726364536023751 0ustar olesoles// -*- C++ -*- // $Id: Exponential.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------Exponential------------------------------------------// // // // Class Exponential // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef Exponential_h #define Exponential_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Exponential : public AbsFunction { FUNCTION_OBJECT_DEF(Exponential) public: // Constructor Exponential(); // Copy constructor Exponential(const Exponential &right); // Destructor virtual ~Exponential(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the decay constant Parameter & decayConstant(); const Parameter & decayConstant() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign an adjustable constant const Exponential & operator=(const Exponential &right); // Here is the decay constant Parameter _decayConstant; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/SphericalHarmonicCoefficientSet.icc0000644000175000017500000001023211746557221030005 0ustar olesoles#include #include "CLHEP/GenericFunctions/ClebschGordanCoefficientSet.hh" #include namespace Genfun { class SphericalHarmonicCoefficientSet::Clockwork { public: std::vector > > data; }; inline SphericalHarmonicCoefficientSet::SphericalHarmonicCoefficientSet(unsigned int LMAX):c(new Clockwork()){ for (unsigned int l=0;l<=LMAX;l++) { std::vector > theMs; for (int m=-l; m<=int(l);m++) { theMs.push_back(std::complex (0.0)); } c->data.push_back(theMs); } } inline SphericalHarmonicCoefficientSet::~SphericalHarmonicCoefficientSet(){ delete c; } inline SphericalHarmonicCoefficientSet::SphericalHarmonicCoefficientSet(const SphericalHarmonicCoefficientSet & right): c(new Clockwork(*right.c)) { } inline unsigned int SphericalHarmonicCoefficientSet::getLMax() const { return c->data.size()-1; } inline const std::complex &SphericalHarmonicCoefficientSet:: operator () (unsigned int l, int m) const { return c->data[l][m+l]; } inline std::complex & SphericalHarmonicCoefficientSet::operator () (unsigned int l, int m) { return c->data[l][m+l]; } inline std::ostream & operator << ( std::ostream & o, const SphericalHarmonicCoefficientSet & c) { for (unsigned int l=0;l<=c.getLMax();l++) { for (int m=-l;m<=int(l);m++) { o << "l=" << l << " m=" ; if (m==0) o << " "; if (m>0 ) o << "+"; o << m << " mag: " << c(l,m) << std::endl; } o << std::endl; } return o; } inline SphericalHarmonicCoefficientSet & SphericalHarmonicCoefficientSet::operator= (const SphericalHarmonicCoefficientSet & source ){ if (this!=&source) { delete c; c = new Clockwork(*source.c); } return *this; } inline SphericalHarmonicCoefficientSet & SphericalHarmonicCoefficientSet::operator*= (const std::complex & s ){ unsigned int LMAX=getLMax(); for (unsigned int l=0;l<=LMAX;l++) { for (int m=-l;m<=int(l);m++) { operator()(l,m)*=s; } } return *this; } inline SphericalHarmonicCoefficientSet & SphericalHarmonicCoefficientSet::operator+= (const SphericalHarmonicCoefficientSet & source ){ unsigned int LMAX=getLMax(); for (unsigned int l=0;l<=LMAX;l++) { for (int m=-l;m<=int(l);m++) { operator()(l,m)+=source(l,m); } } return *this; } inline SphericalHarmonicCoefficientSet & SphericalHarmonicCoefficientSet::operator-= (const SphericalHarmonicCoefficientSet & source ){ unsigned int LMAX=getLMax(); for (unsigned int l=0;l<=LMAX;l++) { for (int m=-l;m<=int(l);m++) { operator()(l,m)-=source(l,m); } } return *this; } inline std::complex dot(const SphericalHarmonicCoefficientSet &a, const SphericalHarmonicCoefficientSet &b) { std::complex result=0.0; if (a.getLMax()!=b.getLMax()) throw std::runtime_error ("function dot: SphericalHarmonicCoefficientSets of different dimension"); for (unsigned int l=0;l<=a.getLMax();l++) { for (int m=-l;m<=int(l);m++) { result += a(l,m)*conj(b(l,m)); } } return result; } inline SphericalHarmonicCoefficientSet squareExpansionCoefficients(const SphericalHarmonicCoefficientSet & coefficientsA) { unsigned int LMAX=coefficientsA.getLMax(); SphericalHarmonicCoefficientSet coefficientsASq(2*LMAX); static ClebschGordanCoefficientSet clebschGordan; for (unsigned int L=0;L<=2*LMAX;L++) { for (int M=-L; M<=int(L); M++) { coefficientsASq(L,M)=0.0; for (unsigned int l1=0;l1<=LMAX;l1++) { for (unsigned int l2=0;l2<=LMAX;l2++) { for (int m1=-l1;m1<=int(l1);m1++) { for (int m2=-l2;m2<=int(l2);m2++) { if (m1-m2==M) { if (((l1+l2) >= L) && abs(l1-l2) <= int(L)) { coefficientsASq(L,M) += (coefficientsA(l1,m1)* conj(coefficientsA(l2,m2))* (m2%2 ? -1.0:1.0) * sqrt((2*l1+1)*(2*l2+1)/(4*M_PI*(2*L+1)))* clebschGordan(l1,l2,0,0,L,0)*clebschGordan(l1,l2,m1,-m2,L,M)); } } } } } } } } return coefficientsASq; } } clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ParameterSum.hh0000755000175000017500000000244107726364536024063 0ustar olesoles// -*- C++ -*- // $Id: ParameterSum.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------ParameterSum------------------------------------// // // // ParameterSum, result of addition of two parameters. // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ParameterSum_h #define ParameterSum_h 1 #include "CLHEP/GenericFunctions/AbsParameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ParameterSum : public AbsParameter { PARAMETER_OBJECT_DEF(ParameterSum) public: // Constructor ParameterSum(const AbsParameter *arg1, const AbsParameter *arg2); // Copy constructor ParameterSum(const ParameterSum &right); // Destructor virtual ~ParameterSum(); // Retreive function value virtual double getValue() const; private: // It is illegal to assign a ParameterSum const ParameterSum & operator=(const ParameterSum &right); AbsParameter *_arg1; AbsParameter *_arg2; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ArrayFunction.hh0000755000175000017500000000201307726364536024235 0ustar olesoles// -*- C++ -*- // $Id: #ifndef _ArrayFunction_h_ #define _ArrayFunction_h_ //-------------------------------------------------------// // This one dimensional function takes its values from // // an array..which it copies in. // //-------------------------------------------------------// #include "CLHEP/GenericFunctions/AbsFunction.hh" #include namespace Genfun { class ArrayFunction : public AbsFunction { FUNCTION_OBJECT_DEF(ArrayFunction) public: // Constructor ArrayFunction(const double *begin, const double *end); // Destructor virtual ~ArrayFunction(); // Copy constructor ArrayFunction(const ArrayFunction &right); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} private: // It is illegal to assign a ArrayFunction const ArrayFunction & operator=(const ArrayFunction &right); std::vector _values; }; } #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Sqrt.hh0000755000175000017500000000272607726364536022415 0ustar olesoles// -*- C++ -*- // $Id: Sqrt.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //----------------------Sqrt--------- --------------------------------------// // // // Class Sqrt // // Joe Boudreau, Petar Maksimovic, Nov. 1999 // // // // Sqrt is a function that returns the square root of the argument // //--------------------------------------------------------------------------// #ifndef Sqrt_h #define Sqrt_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Sqrt : public AbsFunction { FUNCTION_OBJECT_DEF(Sqrt) public: // Constructor Sqrt(); // Copy constructor Sqrt(const Sqrt &right); // Destructor virtual ~Sqrt(); // Retrieve function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a fixed constant const Sqrt & operator=(const Sqrt &right); }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/copy-header.pl.in0000755000175000017500000000164110043512734024255 0ustar olesoles#!/usr/bin/env perl # # copy a header into the temporary CLHEP header tree if # a) the header is not already there # b) the source is newer # if ($#ARGV != 1) { print "mungeit requires two arguments - exit\n"; exit; } else { $source_header=$ARGV[0]; $dest_header=$ARGV[1]; &check_header; } exit; sub check_header { # make sure source exists if ( ! -e $source_header ) { print "$source_header does not exist - exit\n"; exit; } # copy if not already there - otherwise, check the time stamp if ( ! -e $dest_header ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } else { $source_header_time = -M $source_header; $dest_header_time = -M $dest_header; # copy only if source is newer if( $source_header_time < $dest_header_time ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } } } clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Bessel.hh0000755000175000017500000000714307726364536022677 0ustar olesoles// -*- C++ -*- // $Id: Bessel.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------Bessel-------------------------------------------------// // // // Class Bessel, providing Bessel Functions The Namespace "FractionalORder" // // and "Integral order" are nested here, so that you fully specify the class // // like this: // // // // Genfun::FractionalOrder::Bessel // // // // or // // // // Genfun::IntegralOrder::Bessel // // // // // // Joe Boudreau, April 2001 // // // //-------------------------------------------------------------------------- // #ifndef Bessel_h #define Bessel_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { namespace FractionalOrder { /** * @author * @ingroup genfun */ class Bessel : public AbsFunction { FUNCTION_OBJECT_DEF(Bessel) public: // Enumerated type: enum Type {J, Y}; // Constructor: Use this one and you will get a Bessel function of // integer order Bessel (Type type); // Copy constructor Bessel(const Bessel &right); // Destructor virtual ~Bessel(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the order of the Bessel Function. Default value, 0.0. If modified the // Bessel function Parameter & order(); const Parameter & order() const; private: // It is illegal to assign an adjustable constant const Bessel & operator=(const Bessel &right); // The type and order of the Bessel function Type _type; Parameter _order; // the fractional order: }; } // namespace FractionalOrder namespace IntegralOrder { /** * @author * @ingroup genfun */ class Bessel : public AbsFunction { FUNCTION_OBJECT_DEF(Bessel) public: // Enumerated type: enum Type {J, Y}; // Constructor: Use this one and you will get a Bessel function of // integer order Bessel (Type type, unsigned int order); // Copy constructor Bessel(const Bessel &right); // Destructor virtual ~Bessel(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} private: // It is illegal to assign an adjustable constant const Bessel & operator=(const Bessel &right); // The type and order of the Bessel function Type _type; unsigned int _order; double _bessel_IJ_taylor(double nu, double x, int sign, int kmax, double threshhold) const; }; } // namespace IntegralOrder } // namespace Genfun #include "CLHEP/GenericFunctions/Bessel.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/LikelihoodFunctional.hh0000755000175000017500000000213107726364536025560 0ustar olesoles// -*- C++ -*- // $Id: LikelihoodFunctional.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //-------------------------------------------------------------// // // // This functional returns the Likelihood of a functoin // // given some data // // // //-------------------------------------------------------------// #ifndef _LikelihoodFunctional_h_ #define _LikelihoodFunctional_h_ #include "CLHEP/GenericFunctions/AbsFunctional.hh" #include "CLHEP/GenericFunctions/ArgumentList.hh" namespace Genfun { /** * @author * @ingroup genfun */ class LikelihoodFunctional:public AbsFunctional { public: // Constructor: LikelihoodFunctional(const ArgumentList & aList); // Destructor: ~LikelihoodFunctional(); // Evaluate ChiSquared of a function w.r.t the data. virtual double operator [] (const AbsFunction & function) const; private: const ArgumentList _aList; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/X.hh0000755000175000017500000000240407726364536021664 0ustar olesoles// -*- C++ -*- // $Id: X.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //----------------------X------------ --------------------------------------// // // // Class X_ // // Joe Boudreau, Petar Maksimovic, Nov. 1999 // // // // X_ is a function that returns the variable itself. // //--------------------------------------------------------------------------// #ifndef X__h #define X__h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class X_ : public AbsFunction { FUNCTION_OBJECT_DEF(X_) public: // Constructor X_(); // Copy constructor X_(const X_ &right); // Destructor virtual ~X_(); // Retrieve function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} private: // It is illegal to assign a fixed constant const X_ & operator=(const X_ &right); }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Makefile.am0000755000175000017500000000705212047552013023151 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@ COPY_P = @COPY_P@ pkginclude_HEADERS = \ AbsFunctional.hh \ AbsFunction.hh \ Abs.hh \ AbsParameter.hh \ ACos.hh \ AdaptiveRKStepper.hh \ Airy.hh \ Airy.icc \ AnalyticConvolution.hh \ Argument.hh \ ArgumentList.hh \ ArrayFunction.hh \ ASin.hh \ AssociatedLaguerre.hh \ AssociatedLegendre.hh \ AssociatedLegendre.icc \ ATan.hh \ Bessel.hh \ Bessel.icc \ BetaDistribution.hh \ BivariateGaussian.hh \ ButcherTableau.hh \ ButcherTableau.icc \ ClassicalSolver.hh \ ClebschGordanCoefficientSet.hh \ ConstMinusFunction.hh \ ConstMinusParameter.hh \ ConstOverFunction.hh \ ConstOverParameter.hh \ ConstPlusFunction.hh \ ConstPlusParameter.hh \ ConstTimesFunction.hh \ ConstTimesParameter.hh \ Cos.hh \ CubicSplinePolynomial.hh \ CubicSplinePolynomial.icc \ CumulativeChiSquare.hh \ CutBase.hh \ CutBase.icc \ DefiniteIntegral.hh \ DoubleParamToArgAdaptor.hh \ DoubleParamToArgAdaptor.icc \ EfficiencyFunctional.hh \ EllipticIntegral.hh \ EllipticIntegral.icc \ EmbeddedRKStepper.hh \ Erf.hh \ Exp.hh \ Exponential.hh \ ExtendedButcherTableau.hh \ ExtendedButcherTableau.icc \ F1D.hh \ FixedConstant.hh \ FloatingConstant.hh \ FourierFit.hh \ FourierFit.icc \ FunctionComposition.hh \ FunctionConvolution.hh \ FunctionDifference.hh \ FunctionDirectProduct.hh \ FunctionNegation.hh \ FunctionNoop.hh \ FunctionNumDeriv.hh \ FunctionPlusParameter.hh \ FunctionProduct.hh \ FunctionQuotient.hh \ FunctionSum.hh \ FunctionTimesParameter.hh \ GammaDistribution.hh \ Gamma.hh \ Gaussian.hh \ GenericFunctions.hh \ HermitePolynomial.hh \ IncompleteGamma.hh \ InterpolatingPolynomial.hh \ KroneckerDelta.hh \ Landau.hh \ LegendreCoefficientSet.hh \ LegendreCoefficientSet.icc \ LegendreExpansion.hh \ LegendreExpansion.icc \ LegendreFit.hh \ LegendreFit.icc \ Legendre.hh \ Legendre.icc \ LikelihoodFunctional.hh \ Ln.hh \ LogGamma.hh \ LogisticFunction.hh \ Mod.hh \ NonrelativisticBW.hh \ ParameterComposition.hh \ ParameterDifference.hh \ Parameter.hh \ ParameterNegation.hh \ ParameterProduct.hh \ ParameterQuotient.hh \ ParameterSum.hh \ ParamToArgAdaptor.hh \ ParamToArgAdaptor.icc \ PeriodicRectangular.hh \ PhaseSpace.hh \ Power.hh \ Psi2Hydrogen.hh \ Psi2Hydrogen.icc \ PtRelFcn.hh \ PuncturedSmearedExp.hh \ RCBase.hh \ Rectangular.hh \ RelativisticBW.hh \ ReverseExponential.hh \ RKIntegrator.hh \ RungeKuttaClassicalSolver.hh \ Sigma.hh \ SimpleRKStepper.hh \ Sin.hh \ SphericalBessel.hh \ SphericalBessel.icc \ SphericalHarmonicCoefficientSet.hh \ SphericalHarmonicCoefficientSet.icc \ SphericalHarmonicExpansion.hh \ SphericalHarmonicExpansion.icc \ SphericalHarmonicFit.hh \ SphericalHarmonicFit.icc \ SphericalNeumann.hh \ SphericalNeumann.icc \ Sqrt.hh \ Square.hh \ StepDoublingRKStepper.hh \ SymToArgAdaptor.hh \ SymToArgAdaptor.icc \ Tan.hh \ Theta.hh \ TrivariateGaussian.hh \ Variable.hh \ VoigtProfile.hh \ X.hh \ defs.h # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = defs.h # copy headers into $(tempincludedir) install-tmpHEADERS: @echo " install headers in $(tempincludedir) " @list='$(pkginclude_HEADERS)'; \ if test $(tempincludedir); then \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ ./copy-header.pl $$d$$p $(tempincludedir)/$$f; \ done; \ fi; test -z "$$fail" clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Sin.hh0000755000175000017500000000255607726364536022216 0ustar olesoles// -*- C++ -*- // $Id: Sin.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------Sin--------------------------------------------------// // // // Class Sin // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef Sin_h #define Sin_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Sin : public AbsFunction { FUNCTION_OBJECT_DEF(Sin) public: // Constructor Sin(); // Destructor virtual ~Sin(); // Copy constructor Sin(const Sin &right); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a Sin const Sin & operator=(const Sin &right); }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Abs.hh0000755000175000017500000000224207726364536022162 0ustar olesoles// $Id: // -*- C++ -*- // //----------------------Abs---------- --------------------------------------// // // // Class Abs // // Joe Boudreau, Petar Maksimovic, Nov. 1999 // // // // Abs is a function that returns the absolute value of its argument // //--------------------------------------------------------------------------// #ifndef Abs_h #define Abs_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { class Abs : public AbsFunction { FUNCTION_OBJECT_DEF(Abs) public: // Constructor Abs(); // Copy constructor Abs(const Abs &right); // Destructor virtual ~Abs(); // Retrieve function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} private: // It is illegal to assign a fixed constant const Abs & operator=(const Abs &right); }; } #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/CumulativeChiSquare.hh0000755000175000017500000000330107726364536025375 0ustar olesoles// -*- C++ -*- // $Id: CumulativeChiSquare.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------CumulativeChiSquare----------------------------------// // // // Class CumulativeChiSquare, also known as the probability chi squared // // Joe Boudreau, October 2000 // // // //--------------------------------------------------------------------------// #ifndef CumulativeChiSquare_h #define CumulativeChiSquare_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class CumulativeChiSquare : public AbsFunction { FUNCTION_OBJECT_DEF(CumulativeChiSquare) public: // Constructor CumulativeChiSquare(unsigned int nDof); // Copy constructor CumulativeChiSquare(const CumulativeChiSquare &right); // Destructor virtual ~CumulativeChiSquare(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the integer variable l unsigned int nDof() const; private: // It is illegal to assign an adjustable constant const CumulativeChiSquare & operator=(const CumulativeChiSquare &right); // Here is the decay constant unsigned int _nDof; // Here is the "work function" const AbsFunction *_function; // This function is needed in all constructors: void create(); }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/LegendreExpansion.hh0000755000175000017500000000317211734353266025062 0ustar olesoles// -*- C++ -*- // $Id: //---------------------SphericalHarmonicExpansion---------------------------// // // // Class LegendreExpansion This is an expansion in terms of a super // // position of N legendre polynomials. // //--------------------------------------------------------------------------// #ifndef LegendreExpansion_h #define LegendreExpansion_h #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/LegendreCoefficientSet.hh" namespace Genfun { /** * @author * @ingroup genfun */ class LegendreExpansion : public AbsFunction { FUNCTION_OBJECT_DEF(LegendreExpansion) public: enum Type {REAL,IMAG,MAG, MAGSQ}; // Constructor. Builds all the LegendreExpansion(Type type, const LegendreCoefficientSet & coefficients); // Copy constructor LegendreExpansion(const LegendreExpansion &right); // Destructor virtual ~LegendreExpansion(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the expansion coefficients: const LegendreCoefficientSet & coefficientSet() const; private: // It is illegal to assign an adjustable constant const LegendreExpansion & operator=(const LegendreExpansion &right); class Clockwork; Clockwork *c; }; } // namespace Genfun #include "CLHEP/GenericFunctions/LegendreExpansion.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/RCBase.hh0000755000175000017500000000207007726364536022553 0ustar olesoles// -*- C++ -*- // $Id: //------------------RCBase--------------------------------------------------// // // // Class RCBase // // Joe Boudreau // // Base class for reference counting // // // //--------------------------------------------------------------------------// #ifndef RCBase_h #define RCBase_h 1 namespace Genfun { /** * @author * @ingroup genfun */ class RCBase { public: RCBase(); void ref() const; void unref() const; unsigned int refCount() const; protected: virtual ~RCBase(); private: RCBase(const RCBase &right); const RCBase & operator=(const RCBase &right); mutable unsigned short int _count; }; } #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/TrivariateGaussian.hh0000755000175000017500000000476707726364536025300 0ustar olesoles// -*- C++ -*- // $Id: TrivariateGaussian.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------TrivariateGaussian-----------------------------------// // // // Class TrivariateGaussian // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef TrivariateGaussian_h #define TrivariateGaussian_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class TrivariateGaussian : public AbsFunction { FUNCTION_OBJECT_DEF(TrivariateGaussian) public: // Constructor TrivariateGaussian(); // Copy constructor TrivariateGaussian(const TrivariateGaussian &right); // Destructor virtual ~TrivariateGaussian(); // Retreive function value virtual double operator ()(double argument) const; // Gives an error. virtual double operator ()(const Argument & a) const; // Must use this one // Dimensionality virtual unsigned int dimensionality() const; // Get the mean of the TrivariateGaussian Parameter & mean0(); const Parameter & mean0() const; Parameter & mean1(); const Parameter & mean1() const; Parameter & mean2(); const Parameter & mean2() const; // Get the sigma of the TrivariateGaussian Parameter & sigma0(); const Parameter & sigma0() const; Parameter & sigma1(); const Parameter & sigma1() const; Parameter & sigma2(); const Parameter & sigma2() const; // Get the correlation coefficient: Parameter & corr01(); const Parameter & corr01() const; Parameter & corr02(); const Parameter & corr02() const; Parameter & corr12(); const Parameter & corr12() const; private: // It is illegal to assign an adjustable constant const TrivariateGaussian & operator=(const TrivariateGaussian &right); // Here is the decay constant Parameter _mean0; Parameter _mean1; Parameter _mean2; // Here is the sigma Parameter _sigma0; Parameter _sigma1; Parameter _sigma2; // Here is the correlation coefficient: Parameter _corr01; Parameter _corr02; Parameter _corr12; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/CubicSplinePolynomial.icc0000644000175000017500000000731712047552013026042 0ustar olesoles// -*- C++ -*- // $Id: #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/Vector.h" #include #include #include namespace Genfun { FUNCTION_OBJECT_IMP(CubicSplinePolynomial) class CubicSplinePolynomial::Clockwork { public: bool stale; mutable CLHEP::HepMatrix A; mutable CLHEP::HepVector V; mutable CLHEP::HepVector Q; std::vector > xPoints; inline void computeSlopes() const { unsigned int N=xPoints.size()-1; A=CLHEP::HepMatrix(N+1,N+1,0); V=CLHEP::HepVector(N+1,0); // First take care of the "normal elements, i=1,N-1; for (unsigned int i=1;istale=true; } inline CubicSplinePolynomial::CubicSplinePolynomial(const CubicSplinePolynomial & right) :Genfun::AbsFunction(),c(new Clockwork) { (*c) = (*right.c); } inline CubicSplinePolynomial::~CubicSplinePolynomial() { delete c; } inline double CubicSplinePolynomial::operator() (double x) const { unsigned int N=c->xPoints.size()-1; if (c->xPoints.size()==0) return 0; if (c->xPoints.size()==1) return c->xPoints[0].second; if (c->stale) { c->computeSlopes(); c->stale=false; } std::pair fk(x,0); std::vector >::const_iterator n=std::lower_bound(c->xPoints.begin(),c->xPoints.end(),fk); unsigned int i = n-c->xPoints.begin(); if (i==0) { double x0=c->xPoints[0].first; double y0=c->xPoints[0].second; double m = c->Q[0]; return y0 + m*(x-x0); } else if (i==c->xPoints.size()) { double x0=c->xPoints[N].first; double y0=c->xPoints[N].second; double m = c->Q[N]; return y0 + m*(x-x0); } else { double x0=c->xPoints[i-1].first; double x1=c->xPoints[i].first; double y0=c->xPoints[i-1].second; double y1=c->xPoints[i].second; double dx = x1-x0; double dy = y1-y0; double m = dy/dx; double Q0 = c->Q[i-1]; double Q1 = c->Q[i]; double a = (Q0-m)*dx; double b = (m-Q1)*dx; double t = (x-x0)/dx; double u = (1-t); return u*y0+t*y1 + t*u*(u*a + t*b); } } inline void CubicSplinePolynomial::addPoint( double x, double y) { c->xPoints.push_back(std::make_pair(x,y)); std::sort(c->xPoints.begin(),c->xPoints.end()); c->stale=true; } inline void CubicSplinePolynomial::getRange( double & min, double & max) const { min=DBL_MAX, max=-DBL_MAX; for (unsigned int i=0;ixPoints.size();i++) { min = std::min(min,c->xPoints[i].first); max = std::max(max,c->xPoints[i].first); } } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ParameterDifference.hh0000755000175000017500000000256607726364536025361 0ustar olesoles// -*- C++ -*- // $Id: ParameterDifference.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------ParameterDifference-----------------------------// // // // ParameterDifference, result of subtraction of two parameters. // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ParameterDifference_h #define ParameterDifference_h 1 #include "CLHEP/GenericFunctions/AbsParameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ParameterDifference : public AbsParameter { PARAMETER_OBJECT_DEF(ParameterDifference) public: // Constructor ParameterDifference(const AbsParameter *arg1, const AbsParameter *arg2); // Copy constructor ParameterDifference(const ParameterDifference &right); // Destructor virtual ~ParameterDifference(); // Retreive parameter value virtual double getValue() const; private: // It is illegal to assign a ParameterDifference const ParameterDifference & operator=(const ParameterDifference &right); AbsParameter *_arg1; AbsParameter *_arg2; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Rectangular.hh0000755000175000017500000000411107726364536023721 0ustar olesoles// -*- C++ -*- // $Id: Rectangular.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------Rectangular------------------------------------------// // // // Class Exponential // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef Rectangular_h #define Rectangular_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Rectangular : public AbsFunction { FUNCTION_OBJECT_DEF(Rectangular) public: // Constructor Rectangular(); // Copy constructor Rectangular(const Rectangular &right); // Destructor virtual ~Rectangular(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the position of the first discontinuity const Parameter & x0() const; Parameter & x0(); // Get the position of the second discontinuity const Parameter & x1() const; Parameter & x1(); // Get the value of the function at its baseline const Parameter & baseline() const; Parameter & baseline(); // Get the value of the function at its top const Parameter & height() const; Parameter & height(); // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign an adjustable constant const Rectangular & operator=(const Rectangular &right); // Here is the decay constant Parameter _x0; Parameter _x1; Parameter _baseline; Parameter _height; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ClassicalSolver.hh0000644000175000017500000000510611712611770024526 0ustar olesoles// This is a class the creates an N-Dimensional Phase Space // // It is for use in computing the time development of classical // // Hamiltonian Systems. // // Joe Boudreau October 2011 // //--------------------------------------------------------------// #ifndef _ClassicalSolver_h__ #define _ClassicalSolver_h__ #include "CLHEP/GenericFunctions/PhaseSpace.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { class EnergyFunction; } namespace Classical { class Solver { public: // // Constructor--takes a hamiltonian and a point in p-space: // Solver(){}; // // Destructor: // virtual ~Solver(){}; // // Returns the time evolution for a variable (q_i or p_i) // virtual Genfun::GENFUNCTION equationOf(const Genfun::Variable & v) const=0; // // Returns the phase space // virtual const PhaseSpace & phaseSpace() const=0; // // Returns the Hamiltonian (function of the 2N phase space variables). // virtual Genfun::GENFUNCTION hamiltonian() const=0; // // Returns the energy (function of time). // virtual Genfun::GENFUNCTION energy() const=0; // // This is in the rare case that the user needs to edit starting values. // or parameterize the Hamiltonian. Most users: can ignore. virtual Genfun::Parameter *takeQ0(unsigned int index)=0; virtual Genfun::Parameter *takeP0(unsigned int index)=0; virtual Genfun::Parameter *createControlParameter(const std::string & variableName="anon", double defStartingValue=0.0, double startingValueMin=0.0, double startingValueMax=0.0) const = 0; private: // Illegal Operations: Solver (const Solver &); Solver & operator=(const Solver &); }; } namespace Genfun { class EnergyFunction: public Genfun::AbsFunction { FUNCTION_OBJECT_DEF(EnergyFunction) public: // Constructor EnergyFunction(const Classical::Solver &); // Destructor virtual ~EnergyFunction(); // Copy constructor EnergyFunction(const EnergyFunction &right); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} private: // It is illegal to assign a EnergyFunction const EnergyFunction & operator=(const EnergyFunction &right); const Classical::Solver & solver; }; } #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/PhaseSpace.hh0000644000175000017500000000351511651542310023446 0ustar olesoles// This is a class the creates an N-Dimensional Phase Space // // It is for use in computing the time development of classical // // Hamiltonian Systems. // // Joe Boudreau October 2011 // //--------------------------------------------------------------// #ifndef _PHASE_SPACE_ #define _PHASE_SPACE_ #include "CLHEP/GenericFunctions/Variable.hh" #include namespace Classical { class PhaseSpace { public: // A component is like a vector: of coordinates or momenta: class Component; // constructor PhaseSpace(unsigned int NDIM); // Destructor ~PhaseSpace(); // Get the dimensionality: unsigned int dim() const; // Get the coordinates: const Component & coordinates() const; // Get the momenta: const Component & momenta() const; // Set starting values for the coordinates or momenta: void start (const Genfun::Variable & variable, double value); // Get starting values for the coordinates or momenta: double startValue(const Genfun::Variable & component) const ; // Each component has N-dimensions: class Component { public: // Access to the ith element; Genfun::Variable operator [] (unsigned int i) const; private: // Constructor: Component(unsigned int NDIM, bool isMomentum); // Destructor: ~Component(); // Illegal operations: Component (const Component &); Component & operator=(const Component &); // Internal clockwork; class Clockwork; Clockwork *c; friend class PhaseSpace; }; private: Component _coordinates; Component _momenta; std::vector _q0; std::vector _p0; unsigned int DIM; }; } #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/PtRelFcn.hh0000755000175000017500000000445507726364536023142 0ustar olesoles// -*- C++ -*- // $Id: //---------------------PtRelFcn---------------------------------------------// // // // Class PtRelFcn // // // // This class is a parameterization of ptrel distributions measured at // // CDF. It has 6 parameters, and is normalized. Alternate descriptions, // // in the past, have used 7 parameters but without normalization. // // // // Joe Boudreau, Azizur Rahaman, March 2003 // // // //--------------------------------------------------------------------------// #ifndef PtRelFcn_h #define PtRelFcn_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/LogGamma.hh" #include "CLHEP/GenericFunctions/Erf.hh" namespace Genfun { /** * @author * @ingroup genfun */ class PtRelFcn : public AbsFunction { FUNCTION_OBJECT_DEF(PtRelFcn) public: // Constructor PtRelFcn(); // Copy constructor PtRelFcn(const PtRelFcn &right); // Destructor virtual ~PtRelFcn(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Parameter P0: Parameter & P0(); const Parameter & P0() const; // Parameter P1: Parameter & P1(); const Parameter & P1() const; // Parameter P2: Parameter & P2(); const Parameter & P2() const; // Parameter P3: Parameter & P3(); const Parameter & P3() const; // Parameter P4: Parameter & P4(); const Parameter & P4() const; // Parameter P5: Parameter & P5(); const Parameter & P5() const; private: // It is illegal to assign an adjustable constant const PtRelFcn & operator=(const PtRelFcn &right); // Here are the parameters: Parameter _p0,_p1,_p2,_p3,_p4,_p5; LogGamma _logGamma; Erf _erf; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/DefiniteIntegral.hh0000755000175000017500000000375212041137064024655 0ustar olesoles// -*- C++ -*- // $Id: DefiniteIntegral.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //-------------------------------------------------------------// // // // This functional performs Romberg integration on a function // // between lower bound and upper bound b. // // // // Two types: OPEN: use open quadrature formula // // for improper integrals // // CLOSED (default) use closed quadrature // // formula. // // // //-------------------------------------------------------------// #ifndef _DefiniteIntegral_h_ #define _DefiniteIntegral_h_ #include "CLHEP/GenericFunctions/AbsFunctional.hh" namespace Genfun { /** * @author * @ingroup genfun */ class DefiniteIntegral:public AbsFunctional { public: // Type definition: typedef enum {CLOSED, OPEN} Type; // Constructor: DefiniteIntegral(double a, double b, Type=CLOSED); // Copy Constructor: DefiniteIntegral(const DefiniteIntegral &); // Assignment Operator: DefiniteIntegral & operator=(const DefiniteIntegral &) ; // Destructor: ~DefiniteIntegral(); // Take the definite integral of a function between the bounds: virtual double operator [] (const AbsFunction & function) const; // Retrieve the number of function calls for the last operation: unsigned int numFunctionCalls() const; // Algorithmic parameters: // Desired precision (default 1.0E-06) void setEpsilon(double eps); // Maximum number of iterations (default 20(closed) 14 (open)) void setMaxIter (unsigned int maxIter); // Minimum order: void setMinOrder (unsigned int order); private: class Clockwork; Clockwork *c; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/FloatingConstant.hh0000755000175000017500000000400207726364536024726 0ustar olesoles// -*- C++ -*- // $Id: FloatingConstant.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //----------------------FloatingConstant -----------------------------------// // // // Class FloatingConstant // // Joe Boudreau, Petar Maksimovic, Nov. 1999 // // // // FloatingConstant allows use to treat constants as floating-constant // // functions so that they automatically will inherit all the algebraic // // operations we have so painstakingly defined for functions. // // // //--------------------------------------------------------------------------// #ifndef FloatingConstant_h #define FloatingConstant_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class FloatingConstant : public AbsFunction { FUNCTION_OBJECT_DEF(FloatingConstant) public: // Constructor FloatingConstant(const AbsParameter & p); // Copy constructor FloatingConstant(const FloatingConstant &right); // Destructor virtual ~FloatingConstant(); // Retrieve the parameter: AbsParameter & value(); // Retrieve function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a fixed constant const FloatingConstant & operator=(const FloatingConstant &right); // The value of the constant: AbsParameter *_value; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Parameter.hh0000755000175000017500000000645007726364536023402 0ustar olesoles// -*- C++ -*- // $Id: Parameter.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //-----------------------Class Parameter------------------------------------// // // // Joe Boudreau // // Petar Maksimovic // // November 1999 // // // // This class is a simple low-level double precision number, together with // // some limiting values. It is designed essentially as an ingredient for // // building function objects. // // // // Parameters can be connnected to one another. If a parameter is // // connected, it takes is value (and limits) from the parameter to which // // it is connected. // // When disconnected, it captures the values of the connected field before // // dropping the connection. An attempt to alter the values of the field // // while the Parameter is connected to another parameter will result in // // an obnoxious warning mesage. // // // //--------------------------------------------------------------------------// #ifndef Parameter_h #define Parameter_h 1 #include #include #include "CLHEP/GenericFunctions/AbsParameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Parameter:public AbsParameter { PARAMETER_OBJECT_DEF(Parameter) public: // Constructor. Parameter(std::string name, double value, double lowerLimit=-1e100, double upperLimit= 1e100); // Copy constructor Parameter(const Parameter & right); // Destructor virtual ~Parameter(); // Assignment const Parameter & operator=(const Parameter &right); // Accessor for the Parameter name const std::string & getName() const; // Accessor for value virtual double getValue() const; // Accessor for Lower Limit double getLowerLimit() const; // Accessor for Upper Limit double getUpperLimit() const; // Set Value void setValue(double value); // Set Lower Limit void setLowerLimit(double lowerLimit); // Set Upper Limit void setUpperLimit(double upperLimit); // Take values + limits from some other parameter. void connectFrom(const AbsParameter * source); // Extra lingual type information: virtual Parameter *parameter() {return this;} virtual const Parameter *parameter() const {return this;} private: std::string _name ; // name double _value; // value double _lowerLimit; // lower limit double _upperLimit; // upper limit const AbsParameter *_sourceParameter; // connection }; std::ostream & operator << ( std::ostream & o, const Parameter &p); } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ParamToArgAdaptor.icc0000755000175000017500000000532507726364536025131 0ustar olesoles// -*- C++ -*- // $Id: ParamToArgAdaptor.icc,v 1.2 2003/09/06 14:04:13 boudreau Exp $ #include "CLHEP/GenericFunctions/ParamToArgAdaptor.hh" #include #include #include namespace Genfun { //FUNCTION_OBJECT_IMP(ParamToArgAdaptor) Do it by hand here: template FunctionComposition ParamToArgAdaptor::operator()(const AbsFunction & function) const { return AbsFunction::operator() (function); } template ParamToArgAdaptor *ParamToArgAdaptor::clone () const { return (ParamToArgAdaptor *) _clone(); } template AbsFunction *ParamToArgAdaptor::_clone () const { return new ParamToArgAdaptor(*this); } template ParamToArgAdaptor::ParamToArgAdaptor(const F &function, ParamToArgAdaptor::ScopedMethodPtr parameterFetchMethod): _scaleFactor("Sigma", 1.0, 0, 10), _function(function.clone()), _parameterFetchMethod(parameterFetchMethod) { _parameterFetchMethod(*_function).setLowerLimit(-DBL_MAX); _parameterFetchMethod(*_function).setUpperLimit(+DBL_MAX); } template ParamToArgAdaptor::~ParamToArgAdaptor() { delete _function; } template ParamToArgAdaptor::ParamToArgAdaptor(const ParamToArgAdaptor & right): _scaleFactor(right._scaleFactor), _parameterFetchMethod(right._parameterFetchMethod), _function(right._function->clone()) { _parameterFetchMethod(*_function).setLowerLimit(-DBL_MAX); _parameterFetchMethod(*_function).setUpperLimit(+DBL_MAX); } template double ParamToArgAdaptor::operator ()(double x) const { std::cerr << "Warning. ParamToArgAdaptor called with scalar argument" << std::endl; assert(0); return 0; } template Parameter & ParamToArgAdaptor::scaleFactor() { return _scaleFactor; } template const Parameter & ParamToArgAdaptor::scaleFactor() const { return _scaleFactor; } template unsigned int ParamToArgAdaptor::dimensionality() const { return _function->dimensionality()+1; } template double ParamToArgAdaptor::operator() (const Argument & a) const { if (dimensionality()!= a.dimension()) { std::cerr << "Warning: ParamToArgAdaptor function/argument dimension mismatch" << std::endl; assert(0); return 0; } int dMinus = a.dimension()-1; Argument aPrime(dMinus); for (int i=0;i namespace Genfun { FUNCTION_OBJECT_IMP(SphericalNeumann) //----------------------------------------------------------------------------------// // Implementation notes: The Spherical Neumann function is implemented in terms of // // lower order spherical neumann functions. This is possible thanks to a recursion // // relation. // //----------------------------------------------------------------------------------// inline SphericalNeumann::SphericalNeumann(unsigned int l): _l(l) { } inline SphericalNeumann::~SphericalNeumann() { } inline SphericalNeumann::SphericalNeumann(const SphericalNeumann & right): _l(right._l) { } inline double SphericalNeumann::operator() (double x) const { // // First try the GSL implementation: // gsl_sf_result result; int status =gsl_sf_bessel_yl_e(_l, x,&result); if (status!=0) { std::cerr << "Warning, GSL function gsl_sf_bessel_yl_impl" << " return code" << status << std::endl; raise(SIGFPE); } return result.val; } inline unsigned int SphericalNeumann::l() const { return _l; } } // end of namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Sigma.hh0000755000175000017500000000266207726364536022523 0ustar olesoles// -*- C++ -*- // $Id: //--------------------------Sigma-------------------------------------------// // // // Sigma, result of addition of N functions // // // //--------------------------------------------------------------------------// #ifndef Sigma_h #define Sigma_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Sigma : public AbsFunction { FUNCTION_OBJECT_DEF(Sigma) public: // Constructor Sigma(); // Copy constructor Sigma(const Sigma &right); // Destructor virtual ~Sigma(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const; // Dimensionality virtual unsigned int dimensionality() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} // Add a function to the sum: void accumulate (const AbsFunction & fcn); private: // It is illegal to assign a Sigma const Sigma & operator=(const Sigma &right); std::vector _fcn; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/AnalyticConvolution.hh0000755000175000017500000000565407726364536025473 0ustar olesoles// -*- C++ -*- // $Id: AnalyticConvolution.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ // ---------------------------------------------------------------------------// // This function-object makes analytic convolutions of a gaussian plus either // // an exponential, or else the function exp * (1+/-cos) // // The choice depends on which constructor is used to build the analytic // // convolution and which arguments are used. // // // // Joe Boudreau, Petar Maksimovic, Hongquan Niu, Craig Blocker // // // // ---------------------------------------------------------------------------// #ifndef _AnalyticConvolution_h_ #define _AnalyticConvolution_h_ #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include namespace Genfun { class Gaussian; class Exponential; class Cosine; /** * @author * @ingroup genfun */ class AnalyticConvolution: public AbsFunction { FUNCTION_OBJECT_DEF(AnalyticConvolution) public: // Flag for mixed or unmixed: enum Type {MIXED =0, // PDF for mixed events UNMIXED =1, // PDF for unmixed events SMEARED_EXP =2, // Exponential (convolve) Gaussian SMEARED_COS_EXP=3, // Exponential * Cosine (convolve) Gaussian SMEARED_SIN_EXP=4, // Exponential * Sine (convolve) Gaussian SMEARED_NEG_EXP=5}; // Negative exponential (convolve) Gaussian // Constructor AnalyticConvolution(Type=SMEARED_EXP); // Copy constructor AnalyticConvolution(const AnalyticConvolution &right); // Destructor: virtual ~AnalyticConvolution(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Frequency of oscillation Parameter & frequency(); const Parameter & frequency() const; // Lifetime of exponential: Parameter & lifetime(); const Parameter & lifetime() const; // Width of the gaussian: Parameter & sigma(); const Parameter & sigma() const; // The mean of the gaussian: Parameter & offset(); const Parameter & offset() const; private: // These are for calculating mixing terms. double pow(double x, int n) const ; double erfc(double x) const ; std::complex nwwerf(std::complex z) const; // It is illegal to assign an adjustable constant const AnalyticConvolution & operator=(const AnalyticConvolution &right); Parameter _lifetime; Parameter _frequency; Parameter _sigma; Parameter _offset; Type _type; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/CutBase.icc0000755000175000017500000001141211111035300023100 0ustar olesoles// -*- C++ -*- // $Id: CutBase.icc,v 1.3 2008/11/19 16:11:44 boudreau Exp $ //-------------------------------------------------------------------// // // // Implementations for the Cut class // // // //-------------------------------------------------------------------// template Cut::Cut() {} template Cut::Cut(const Cut & ) {} template Cut::~Cut() {} template typename Cut::OR Cut::operator || (const Cut & A) const { return OR(*this,A); } template typename Cut::AND Cut::operator && (const Cut & A) const { return AND(*this,A); } template typename Cut::NOT Cut::operator ! () const { return NOT(*this); } //-------------------------------------------------------------------// // // // Implementations for the AND class // // // //-------------------------------------------------------------------// template Cut::AND::AND(const AND & right):Cut(), _pA(right._pA->clone()), _pB(right._pB->clone()) { } template Cut::AND::AND(const Cut & A, const Cut & B):Cut(), _pA(A.clone()), _pB(B.clone()) { } template Cut::AND::~AND() { delete _pA; delete _pB; } template typename Cut::AND *Cut::AND::clone() const { return new AND(*this); } template bool Cut::AND::operator () (const Type & t) const { return _pA->operator()(t) && _pB->operator()(t); } //-------------------------------------------------------------------// // // // Implementations for the OR class // // // //-------------------------------------------------------------------// template Cut::OR::OR(const OR & right):Cut(), _pA(right._pA->clone()), _pB(right._pB->clone()) { } template Cut::OR::OR(const Cut & A, const Cut & B):Cut(), _pA(A.clone()), _pB(B.clone()) { } template Cut::OR::~OR() { delete _pA; delete _pB; } template typename Cut::OR *Cut::OR::clone() const { return new OR(*this); } template bool Cut::OR::operator () (const Type & t) const { return _pA->operator()(t) || _pB->operator()(t); } //-------------------------------------------------------------------// // // // Implementations for the NOT class // // // //-------------------------------------------------------------------// template Cut::NOT::NOT(const NOT & right):Cut(), _pA(right._pA->clone()) { } template Cut::NOT::NOT(const Cut & A):Cut(), _pA(A.clone()) { } template Cut::NOT::~NOT() { delete _pA; } template typename Cut::NOT *Cut::NOT::clone() const { return new NOT(*this); } template bool Cut::NOT::operator () (const Type & t) const { return !_pA->operator()(t); } //-------------------------------------------------------------------// // // // Implementations for the Predicate class, representing a unary // // No-op and useful as a user-level data type, because it is // // concrete, and clones on copy, therefore is useful in e.g. STL // // routines. // // // //-------------------------------------------------------------------// template Cut::Predicate::Predicate(const Predicate & right): _pA(right._pA->clone()) { } template Cut::Predicate::Predicate(const Cut & A): _pA(A.clone()) { } template Cut::Predicate::~Predicate() { delete _pA; } template typename Cut::Predicate *Cut::Predicate::clone() const { return new Predicate(*this); } template bool Cut::Predicate::operator () (const Type & t) const { return _pA->operator()(t); } clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ButcherTableau.icc0000644000175000017500000001060212047015056024460 0ustar olesolesnamespace Genfun { ButcherTableau::ButcherTableau(const std::string &xname, unsigned int xorder):_name(xname),_order(xorder){ } const std::string & ButcherTableau::name() const { return _name; } unsigned int ButcherTableau::order() const{ return _order; } unsigned int ButcherTableau::nSteps() const{ return _A.size(); } // don't generate warnings about intentional shadowing #if defined __GNUC__ #if __GNUC__ > 3 && __GNUC_MINOR__ > 6 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" #endif #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wshadow" #endif double & ButcherTableau::A(unsigned int i, unsigned int j) { if (i>=_A.size()) { unsigned int newSize=i+1; // (shadowed) for (unsigned int ii=0;ii<_A.size();ii++) { _A[ii].resize(newSize,0.0); } for (unsigned int ii=_A.size();ii(newSize,0)); } if (j>=_A[i].size()) { unsigned int newSize=j+1; // (shadow) for (unsigned int ii=0;ii<_A.size();ii++) { _A[ii].resize(newSize,0.0); } } } return _A[i][j]; } #if defined __GNUC__ #if __GNUC__ > 3 && __GNUC_MINOR__ > 6 #pragma GCC diagnostic pop #endif #endif #ifdef __clang__ #pragma clang diagnostic pop #endif double & ButcherTableau::b(unsigned int i){ if (i>=_b.size()) _b.resize(i+1); return _b[i]; } double & ButcherTableau::c(unsigned int i){ if (i>=_c.size()) _c.resize(i+1); return _c[i]; } const double & ButcherTableau::A(unsigned int i, unsigned int j) const{ return _A[i][j]; } const double & ButcherTableau::b(unsigned int i) const{ return _b[i]; } const double & ButcherTableau::c(unsigned int i) const{ return _c[i]; } } std::ostream & operator << (std::ostream & o, const Genfun::ButcherTableau & b) { o << "Name " << b.name() << " of order " << b.order() << std::endl; o << "A" << std::endl; for (unsigned int i=0;i #include #include namespace Genfun { //FUNCTION_OBJECT_IMP(SymToArgAdaptor) Do it by hand here: template inline FunctionComposition SymToArgAdaptor::operator()(const AbsFunction & function) const { return AbsFunction::operator() (function); } template inline SymToArgAdaptor *SymToArgAdaptor::clone () const { return (SymToArgAdaptor *) _clone(); } template inline AbsFunction *SymToArgAdaptor::_clone () const { return new SymToArgAdaptor(*this); } template inline ParameterComposition SymToArgAdaptor::operator()(const AbsParameter & p) const { \ return AbsFunction::operator() (p); \ } template inline SymToArgAdaptor::SymToArgAdaptor(F &function, const AbsFunction & f_expression, SymToArgAdaptor::ScopedMethodPtr parameterFetchMethod, const AbsFunction * p_expression): _function(function.clone()), _f_expression(f_expression.clone()), _parameterFetchMethod(parameterFetchMethod), _p_expression(p_expression->clone()) { _parameterFetchMethod(*_function).setLowerLimit(-DBL_MAX); _parameterFetchMethod(*_function).setUpperLimit(+DBL_MAX); assert(f_expression.dimensionality()==p_expression->dimensionality()); } template inline SymToArgAdaptor::~SymToArgAdaptor() { delete _function; delete _f_expression; delete _p_expression; } template inline SymToArgAdaptor::SymToArgAdaptor(const SymToArgAdaptor & right): _function(right._function->clone()), _f_expression(right._f_expression->clone()), _parameterFetchMethod(right._parameterFetchMethod), _p_expression(right._p_expression->clone()) { _parameterFetchMethod(*_function).setLowerLimit(-DBL_MAX); _parameterFetchMethod(*_function).setUpperLimit(+DBL_MAX); } template inline double SymToArgAdaptor::operator ()(double x) const { std::cerr << "Warning. SymToArgAdaptor called with scalar argument" << std::endl; assert(0); return 0; } template inline unsigned int SymToArgAdaptor::dimensionality() const { return _f_expression->dimensionality(); } template inline double SymToArgAdaptor::operator() (const Argument & a) const { if (dimensionality()!= a.dimension()) { std::cerr << "Warning: SymToArgAdaptor function/argument dimension mismatch" << std::endl; assert(0); return 0; } // First evaluate the sumbol. double pVal= (*_p_expression)(a); // Then set the associated parameter: (_parameterFetchMethod(*_function)).setValue(pVal); // Now evaluate the function: return (*_function)((*_f_expression) (a)); } } // end of namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/SphericalHarmonicCoefficientSet.hh0000644000175000017500000000350311734353266027651 0ustar olesoles#ifndef _SPHERICALHARMONICCOEFFICIENTSET_H_ #define _SPHERICALHARMONICCOEFFICIENTSET_H_ #include namespace Genfun { class SphericalHarmonicCoefficientSet { public: // Constructor: SphericalHarmonicCoefficientSet(unsigned int LMAX); // Copy Constructor: SphericalHarmonicCoefficientSet(const SphericalHarmonicCoefficientSet &); // Destructor: ~SphericalHarmonicCoefficientSet(); // Get the size of the set: unsigned int getLMax() const; // Readonly access to a specific coefficient: const std::complex & operator () (unsigned int l, int m) const; // Read/write access to a specific coefficient: std::complex & operator () (unsigned int l, int m); // Assignement SphericalHarmonicCoefficientSet & operator= (const SphericalHarmonicCoefficientSet & ); // Scale: SphericalHarmonicCoefficientSet & operator*= (const std::complex & s ); // Addition: SphericalHarmonicCoefficientSet & operator+= (const SphericalHarmonicCoefficientSet & ); // Subtraction: SphericalHarmonicCoefficientSet & operator-= (const SphericalHarmonicCoefficientSet & ); private: class Clockwork; Clockwork *c; }; // Dump: std::ostream & operator<< ( std::ostream & o, const SphericalHarmonicCoefficientSet & c); // Take the dot product: std::complex dot(const SphericalHarmonicCoefficientSet &, const SphericalHarmonicCoefficientSet &) ; // If an expansion in Spherical Harmonics is squared, another expansion in Spherical // harmonics is the result: SphericalHarmonicCoefficientSet squareExpansionCoefficients(const SphericalHarmonicCoefficientSet &); } #include "CLHEP/GenericFunctions/SphericalHarmonicCoefficientSet.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/LogisticFunction.hh0000755000175000017500000000341612012777433024730 0ustar olesoles// -*- C++ -*- // $Id: //---------------------Gaussian---------------------------------------------// // // // Class LogisticFunction // // Joe Boudreau, November 2002 // // // //--------------------------------------------------------------------------// #ifndef LogisticFunction_h #define LogisticFunction_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include namespace Genfun { /** * @author * @ingroup genfun */ class LogisticFunction : public AbsFunction { FUNCTION_OBJECT_DEF(LogisticFunction) public: // Constructor LogisticFunction(); // Copy constructor LogisticFunction(const LogisticFunction &right); // Destructor virtual ~LogisticFunction(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & arg) const {return operator() (arg[0]);} // Get the starting value of the LogisticFunction Parameter & x0(); const Parameter & x0() const; // Get the control parameter of the LogisticFunction Parameter & a(); const Parameter & a() const; private: // It is illegal to assign an adjustable constant const LogisticFunction & operator=(const LogisticFunction &right); // Here is the decay constant Parameter _x0; // Here is the sigma Parameter _a; // A vector of values. mutable std::vector fx; // Some cache: mutable double __a, __x0; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/CutBase.hh0000755000175000017500000001541507726364536023011 0ustar olesoles// -*- C++ -*- // $Id: CutBase.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ // --------------------CutBase--------------------------------// // // // CutBase, by Joe Boudreau // // // // // // CutBase: set of classes for doing boolean operations on // // cuts. These classes function a little like STL // // predicates, but they extend functionality by permitting // // Boolean operations. They are sitting here in Generic // // Functions package because they are quite similar to the // // generic functions, except that instead of obeying a // // Function algebra, these objects obey a Boolean algebra. // // // // IF YOU INHERIT YOUR PREDICATE FROM Cut, you will // // for free get all the boolean operations on the predicate. // // Here is an example where the type is an integer: // // // // // // class IsPrime:public Cut { // // // Implies you will implement operator () (int) const, // // // And clone() const // // } // // // // class IsInRange:public Cut { // // // Implies you will implement operator () (int) const, // // // And clone() const // // } // // // // // // Then the following example should work, note the use of // // Boolean operations: // // // // const int N=100; // // int array[N]; // // for (int i=0;i dest(std::cout,"\n"); // // // // const Cut::Predicate cut = IsPrime() && IsInRange(3,9); // std::remove_copy_if(array, array+N, dest, !cut); // // // // // // // // // // -----------------------------------------------------------// #ifndef _CutBase_h_ #define _CutBase_h_ #include /** * @author * @ingroup genfun */ template class Cut { public: //-----------Boolean operations-----------------------------// // // //...For OR'ing the cuts. // // // class OR; // OR operator ||( const Cut & A ) const; // // // //...For AND'ing the cuts. // // // class AND; // AND operator &&( const Cut & A ) const; // // // //...For negating the cuts: // // // class NOT; // NOT operator ! ( void ) const; // // // //----------------------------------------------------------// //-----------Constructors & cetera--------------------------// Cut(); // Cut(const Cut & right); // virtual ~Cut(); // virtual Cut * clone() const = 0; // //----------------------------------------------------------// //-----------Concrete class holding any cut:----------------// // // class Predicate; // // // //----------------------------------------------------------// //----------------------------------------------------------// // Evaluate predicate // // // virtual bool operator ()( const Type & t ) const = 0; // // // //----------------------------------------------------------// }; //-------------------------------------------------------------------------- // Common standard Cut classes //-------------------------------------------------------------------------- template class Cut::AND : public Cut { public: AND( const AND & right ); AND( const Cut & A, const Cut & B ); virtual ~AND(); virtual AND * clone( void ) const; virtual bool operator ()( const Type & t ) const; private: const AND & operator=( const AND & right ); Cut * _pA; Cut * _pB; }; template class Cut::OR : public Cut { public: OR( const OR & right ); OR( const Cut & A, const Cut & B ); virtual ~OR(); virtual OR * clone( void ) const; virtual bool operator ()( const Type & t ) const; private: const OR & operator=( const OR & right ); Cut * _pA; Cut * _pB; }; template class Cut::NOT : public Cut { public: NOT( const NOT & right ); NOT( const Cut & A ); virtual ~NOT(); virtual NOT * clone( void ) const; virtual bool operator ()( const Type & t ) const; private: const NOT & operator=( const NOT & right ); Cut * _pA ; }; template class Cut::Predicate : public Cut { public: Predicate( const Predicate & right ); Predicate( const Cut & A ); virtual ~Predicate(); virtual Predicate * clone( void ) const; virtual bool operator ()( const Type & t ) const; private: const Predicate & operator=( const Predicate & right ); Cut * _pA ; }; #include "CLHEP/GenericFunctions/CutBase.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Legendre.hh0000755000175000017500000000164410554745431023175 0ustar olesoles// -*- C++ -*- // $Id: // Legendre Functions P_l(x) #ifndef Legendre_h #define Legendre_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Legendre : public AbsFunction { FUNCTION_OBJECT_DEF(Legendre) public: // Constructor: Legendre (unsigned int order); // Copy constructor Legendre(const Legendre &right); // Destructor virtual ~Legendre(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} private: // It is illegal to assign an adjustable constant const Legendre & operator=(const Legendre &right); // The type and order of the Legendre function unsigned int _order; }; } // namespace Genfun #include "CLHEP/GenericFunctions/Legendre.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ConstMinusParameter.hh0000755000175000017500000000255007726364536025422 0ustar olesoles// -*- C++ -*- // $Id: ConstMinusParameter.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------ConstMinusParameter-----------------------------// // // // ConstMinusParameter, result of subtracting a parameter from a constant. // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ConstMinusParameter_h #define ConstMinusParameter_h 1 #include "CLHEP/GenericFunctions/AbsParameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ConstMinusParameter : public AbsParameter { PARAMETER_OBJECT_DEF(ConstMinusParameter) public: // Constructor ConstMinusParameter(double, const AbsParameter *); // Copy constructor ConstMinusParameter(const ConstMinusParameter &right); // Destructor virtual ~ConstMinusParameter(); // Retreive function value virtual double getValue() const; private: // It is illegal to assign a ConstMinusParameter const ConstMinusParameter & operator=(const ConstMinusParameter &right); double _constant; AbsParameter *_parameter; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Gamma.hh0000755000175000017500000000247510555532620022470 0ustar olesoles// -*- C++ -*- // $Id: //---------------------Gamma------------------------------------------------// // // // The // // Joe Boudreau, Jan 2007 // // // //--------------------------------------------------------------------------// #ifndef Gamma_h #define Gamma_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/LogGamma.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Gamma : public AbsFunction { FUNCTION_OBJECT_DEF(Gamma) public: // Constructor Gamma(); // Copy constructor Gamma(const Gamma &right); // Destructor virtual ~Gamma(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} private: // It is illegal to assign an adjustable constant const Gamma & operator=(const Gamma &right); // This function has a LogGamma Function; LogGamma _logGamma; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ReverseExponential.hh0000755000175000017500000000344307726364536025303 0ustar olesoles// -*- C++ -*- // $Id: ReverseExponential.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------ReverseExponential-----------------------------------// // // // Class ReverseExponential..like Exponential but appropriate for describing// // negative lifetime tails. // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ReverseExponential_h #define ReverseExponential_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ReverseExponential : public AbsFunction { FUNCTION_OBJECT_DEF(ReverseExponential) public: // Constructor ReverseExponential(); // Copy constructor ReverseExponential(const ReverseExponential &right); // Destructor virtual ~ReverseExponential(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the decay constant Parameter & decayConstant(); // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign an adjustable constant const ReverseExponential & operator=(const ReverseExponential &right); // Here is the decay constant Parameter _decayConstant; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/InterpolatingPolynomial.hh0000644000175000017500000000332411651542310026313 0ustar olesoles// -*- C++ -*- // $Id: // ------------------------------------------------------------------------------// // Lagrange's Interpolating Polynomial // // // // // // Joe Boudreau. // // // // ------------------------------------------------------------------------------// #ifndef _InterpolatingPolynomial_h_ #define _InterpolatingPolynomial_h_ #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include namespace Genfun { /** * @author * @ingroup genfun */ class InterpolatingPolynomial: public AbsFunction { FUNCTION_OBJECT_DEF(InterpolatingPolynomial) public: // Constructor InterpolatingPolynomial(); // Copy constructor InterpolatingPolynomial(const InterpolatingPolynomial &right); // Destructor: virtual ~InterpolatingPolynomial(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Puncture this thing: void addPoint(double x, double y); // Get the range: void getRange(double & min, double & max) const; private: // It is illegal to assign an adjustable constant const InterpolatingPolynomial & operator=(const InterpolatingPolynomial &right); std::vector > xPoints; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/.cvsignore0000755000175000017500000000002607705453233023120 0ustar olesolesMakefile.in defs.h.in clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ParamToArgAdaptor.hh0000755000175000017500000000560707726364536024775 0ustar olesoles// -*- C++ -*- // $Id: ParamToArgAdaptor.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //-----------------------Class ParaToArgAdaptor-----------------------------// // // // Joe Boudreau // // January 2000 // // // // This class changes the interpretation of a function's PARAMETER and // // turns it into an argument. In other words it makes a function like // // // // F(a_0, a_1, a_2; x) // // // // and reinterprets it as // // // // F(a_0, a_2; x, a_1) // // // // // //--------------------------------------------------------------------------// #ifndef ParamToArgAdaptor_h_ #define ParamToArgAdaptor_h_ #include #include #include #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ template class ParamToArgAdaptor : public AbsFunction { FUNCTION_OBJECT_DEF(ParamToArgAdaptor) public: // ScopedMethodName typedef Parameter & (F::*ScopedMethodPtr) (); // Constructor ParamToArgAdaptor(const F & function, ScopedMethodPtr parameterFetchMethod); // Copy constructor ParamToArgAdaptor(const ParamToArgAdaptor &right); // Destructor virtual ~ParamToArgAdaptor(); // Retreive function value virtual double operator ()(double argument) const; // Gives an error. virtual double operator ()(const Argument & a) const; // Must use this one // Dimensionality virtual unsigned int dimensionality() const; // Get the mean of the ParamToArgAdaptor Parameter & scaleFactor(); const Parameter & scaleFactor() const; private: // It is illegal to assign an adjustable constant const ParamToArgAdaptor & operator=(const ParamToArgAdaptor &right); // Here is the sigma Parameter _scaleFactor; // Here is the function being adapted; F *_function; // Here is the recipe for fetching the parameter from the function: std::mem_fun_ref_t _parameterFetchMethod; }; } // namespace Genfun #include "CLHEP/GenericFunctions/ParamToArgAdaptor.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/SphericalBessel.hh0000755000175000017500000000304512047553071024511 0ustar olesoles// -*- C++ -*- // $Id: SphericalBessel.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------SphericalBessel--------------------------------------// // // // Class SphericalBessel. An spherical bessel function of integral order // // Joe Boudreau, Petar Maksimovic, January 2000 // // // //--------------------------------------------------------------------------// #ifndef SphericalBessel_h #define SphericalBessel_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class SphericalBessel : public AbsFunction { FUNCTION_OBJECT_DEF(SphericalBessel) public: // Constructor SphericalBessel(unsigned int l); // Copy constructor SphericalBessel(const SphericalBessel &right); // Destructor virtual ~SphericalBessel(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the integer variable l unsigned int l() const; private: // It is illegal to assign a spherical bessel const SphericalBessel & operator=(const SphericalBessel &right); // Here is the index unsigned int _l; }; } // namespace Genfun #include "CLHEP/GenericFunctions/SphericalBessel.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/FourierFit.icc0000644000175000017500000000343111675636357023671 0ustar olesoles// -*- C++ -*- // $Id: #include #include #include namespace Genfun { FUNCTION_OBJECT_IMP(FourierFit) inline FourierFit::FourierFit(unsigned int N): N(N) { for (unsigned int i=0;i P=0.0; std::complex I(0,1.0); double f=1.0; while (1) { if (n==0) { double fn=1.0; double Pn=sqrt(1/2.0/M_PI); P+=(sqrt(f*fn)*Pn); break; } else { double fn=getFraction(n-1)->getValue(); double px=getPhase(n-1)->getValue(); double Pn=sqrt(1/M_PI)*sin(n*x/2.0); P+=exp(I*px)*sqrt(f*fn)*Pn; f*=(1-fn); n--; } } return std::norm(P); } inline unsigned int FourierFit::order() const{ return N; } inline Parameter *FourierFit::getFraction(unsigned int i) { return fraction[i]; } inline const Parameter *FourierFit::getFraction(unsigned int i) const{ return fraction[i]; } inline Parameter *FourierFit::getPhase(unsigned int i) { return phase[i]; } inline const Parameter *FourierFit::getPhase(unsigned int i) const{ return phase[i]; } } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ConstTimesFunction.hh0000755000175000017500000000326507726364536025261 0ustar olesoles// -*- C++ -*- // $Id: ConstTimesFunction.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------ConstOverFunction-------------------------------// // // // ConstOverFunction, result of multiplying a constant and a function // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ConstTimesFunction_h #define ConstTimesFunction_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ConstTimesFunction : public AbsFunction { FUNCTION_OBJECT_DEF(ConstTimesFunction) public: // Constructor ConstTimesFunction(double constant, const AbsFunction *arg); // Copy constructor ConstTimesFunction(const ConstTimesFunction &right); // Destructor virtual ~ConstTimesFunction(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const; // Dimensionality virtual unsigned int dimensionality() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a ConstTimesFunction const ConstTimesFunction & operator=(const ConstTimesFunction &right); double _constant; const AbsFunction *_arg; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/PuncturedSmearedExp.hh0000755000175000017500000000446411406213111025360 0ustar olesoles// -*- C++ -*- // $Id: PuncturedSmearedExp.hh,v 1.3 2010/06/16 18:22:01 garren Exp $ // ------------------------------------------------------------------------------// // This function-object makes an exponential with acceptance holes ("punctures") // // smeared by a resolution function. // // // // // // Joe Boudreau. // // // // ------------------------------------------------------------------------------// #ifndef _PuncturedSmearedExp_h_ #define _PuncturedSmearedExp_h_ #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class PuncturedSmearedExp: public AbsFunction { FUNCTION_OBJECT_DEF(PuncturedSmearedExp) public: // Constructor PuncturedSmearedExp(); // Copy constructor PuncturedSmearedExp(const PuncturedSmearedExp &right); // Destructor: virtual ~PuncturedSmearedExp(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Lifetime of exponential: Parameter & lifetime(); const Parameter & lifetime() const; // Width of the gaussian: Parameter & sigma(); const Parameter & sigma() const; // Puncture this thing: void puncture(double min, double max); // Get the puncture parameters: Parameter & min(unsigned int i); Parameter & max(unsigned int i); const Parameter & min(unsigned int i) const; const Parameter & max(unsigned int i) const; private: // These are for calculating mixing terms. double pow(double x, int n) const ; double erfc(double x) const ; // It is illegal to assign an adjustable constant const PuncturedSmearedExp & operator=(const PuncturedSmearedExp &right); Parameter _lifetime; Parameter _sigma; std::vector _punctures; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ArgumentList.hh0000755000175000017500000000042107726364536024070 0ustar olesoles// -*- C++ -*- // $Id: ArgumentList.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ #ifndef __ARGUMENT_LIST__ #define __ARGUMENT_LIST__ #include "CLHEP/GenericFunctions/Argument.hh" namespace Genfun { typedef std::vector ArgumentList; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Cos.hh0000755000175000017500000000255607726364536022211 0ustar olesoles// -*- C++ -*- // $Id: Cos.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------Cos--------------------------------------------------// // // // Class Cos // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef Cos_h #define Cos_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Cos : public AbsFunction { FUNCTION_OBJECT_DEF(Cos) public: // Constructor Cos(); // Destructor virtual ~Cos(); // Copy constructor Cos(const Cos &right); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a Cosine const Cos & operator=(const Cos &right); }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ConstPlusParameter.hh0000755000175000017500000000253407726364536025254 0ustar olesoles// -*- C++ -*- // $Id: ConstPlusParameter.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------ConstPlusParameter------------------------------// // // // ConstPlusParameter, result of adding a constant to a parameters. // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ConstPlusParameter_h #define ConstPlusParameter_h 1 #include "CLHEP/GenericFunctions/AbsParameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ConstPlusParameter : public AbsParameter { PARAMETER_OBJECT_DEF(ConstPlusParameter) public: // Constructor ConstPlusParameter(double, const AbsParameter *); // Copy constructor ConstPlusParameter(const ConstPlusParameter &right); // Destructor virtual ~ConstPlusParameter(); // Retreive function value virtual double getValue() const; private: // It is illegal to assign a ConstPlusParameter const ConstPlusParameter & operator=(const ConstPlusParameter &right); double _constant; AbsParameter *_parameter; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/SimpleRKStepper.hh0000644000175000017500000000236412006746030024464 0ustar olesoles#ifndef _SimpleRKStepper_h_ #define _SimpleRKStepper_h_ #include "CLHEP/GenericFunctions/RKIntegrator.hh" // // This is a stepper that steps with stepsize h using an // Explicit Runge-Kutte method determined by a Butcher // tableau. // // The stepsize is therefore not adaptively determined; // so this type of stepper is mostly useful in attempting // to categorize the different explicit RK Algorithms // and probably not for real-life problems unless one has // some a priori knowledge about how to set the stepsize. // #include "CLHEP/GenericFunctions/ButcherTableau.hh" namespace Genfun { class SimpleRKStepper:public RKIntegrator::RKStepper{ public: // Constructor: SimpleRKStepper(const ButcherTableau & tableau, double stepsize); // Destructor: virtual ~SimpleRKStepper(); // Take a step: virtual void step (const RKIntegrator::RKData * data, // functions const RKIntegrator::RKData::Data & sdata, // start point RKIntegrator::RKData::Data & ddata, // end point double timeLimit // time limit ) const ; // Clone: virtual SimpleRKStepper *clone() const; private: ButcherTableau tableau; double stepsize; }; } #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/LegendreFit.icc0000644000175000017500000000564611746557221024004 0ustar olesoles// -*- C++ -*- // $Id: #include #include #include #include namespace Genfun { FUNCTION_OBJECT_IMP(LegendreFit) inline LegendreFit::LegendreFit(unsigned int N): N(N),coefA(N),coefASq(2*N) { for (unsigned int i=0;i Pk(N+1); gsl_sf_legendre_Pl_array(N, x, &Pk[0]); unsigned int n=N; std::complex P=0.0; std::complex I(0,1.0); while (1) { if (n==0) { double Pn=sqrt((2*n+1.0)/2.0)*Pk[n]; P+=coefA(n)*Pn; break; } else { double Pn=sqrt((2*n+1.0)/2.0)*Pk[n]; P+=coefA(n)*Pn; n--; } } return std::norm(P); } inline unsigned int LegendreFit::order() const{ return N; } inline Parameter *LegendreFit::getFraction(unsigned int i) { return fraction[i]; } inline const Parameter *LegendreFit::getFraction(unsigned int i) const{ return fraction[i]; } inline Parameter *LegendreFit::getPhase(unsigned int i) { return phase[i]; } inline const Parameter *LegendreFit::getPhase(unsigned int i) const{ return phase[i]; } inline const LegendreCoefficientSet & LegendreFit::coefficientsA() const { recomputeCoefficients(); return coefA; } inline const LegendreCoefficientSet & LegendreFit::coefficientsASq() const { recomputeCoefficients(); unsigned int LMAX=coefA.getLMax(); for (unsigned int L=0;L<=2*LMAX;L++) { coefASq(L)=0.0; for (unsigned int l1=0;l1<=LMAX;l1++) { for (unsigned int l2=0;l2<=LMAX;l2++) { if (((l1+l2) >= L) && abs(l1-l2) <= int(L)) { coefASq(L) += (coefA(l1)* conj(coefA(l2))* sqrt((2*l1+1)*(2*l2+1)/4.0)* pow(ClebschGordan(l1,l2,0,0,L,0),2)); } } } } return coefASq; } inline void LegendreFit::recomputeCoefficients() const { unsigned int n=N; std::complex P=0.0; std::complex I(0,1.0); double f=1.0; while (1) { if (n==0) { double fn=1.0; coefA(n)=sqrt(f*fn); break; } else { double fn=getFraction(n-1)->getValue(); double px=getPhase(n-1)->getValue(); coefA(n)=exp(I*px)*sqrt(f*fn); f*=(1-fn); n--; } } } } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/VoigtProfile.hh0000755000175000017500000000325011601353407024044 0ustar olesoles// -*- C++ -*- // $Id: //---------------------VoigtProfile----------------------------------------// // // // // // Joe Boudreau, June 2011 // // // //--------------------------------------------------------------------------// #ifndef VoigtProfile_h #define VoigtProfile_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/IncompleteGamma.hh" namespace Genfun { /** * @author * @ingroup genfun */ class VoigtProfile : public AbsFunction { FUNCTION_OBJECT_DEF(VoigtProfile) public: // Constructor VoigtProfile(); // Copy constructor VoigtProfile(const VoigtProfile &right); // Destructor virtual ~VoigtProfile(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the paramter alpha Parameter & mass(); // Get the parameter beta Parameter & width(); // Get the parameter beta Parameter & sigma(); private: // It is illegal to assign an adjustable constant const VoigtProfile & operator=(const VoigtProfile &right); // Here are the two parameters alpha and beta: Parameter _mass; Parameter _width; Parameter _sigma; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/AbsFunction.hh0000755000175000017500000001654311675636357023702 0ustar olesoles// -*- C++ -*- // $Id: AbsFunction.hh,v 1.3 2007/01/21 20:20:40 boudreau Exp $ //------------------------AbsFunction-----------------------------------// // // // AbsFunction, base class for function objects // // Joe Boudreau, Petar Maksimovic // // Nov 1999 // // // //----------------------------------------------------------------------// #ifndef AbsFunction_h #define AbsFunction_h 1 #include "CLHEP/GenericFunctions/Argument.hh" namespace Genfun { class AbsParameter; //-----------------------------------------------------------------------// // Exact return type of arithmentic operations. To the user, the return // // type is GENFUNCTION, or const AbsFunction &. // //-----------------------------------------------------------------------// class FunctionProduct; class FunctionSum; class FunctionDifference; class FunctionQuotient; class FunctionNegation; class FunctionConvolution; class FunctionDirectProduct; class FunctionComposition; class ConstPlusFunction; class ConstTimesFunction; class ConstMinusFunction; class ConstOverFunction; class FunctionPlusParameter; class FunctionTimesParameter; class FunctionNumDeriv; class Variable; class FunctionNoop; class ParameterComposition; typedef FunctionNoop Derivative; /** * @author * @ingroup genfun */ class AbsFunction { public: // Default Constructor AbsFunction(); // Copy Constructor: AbsFunction(const AbsFunction &right); // Destructor virtual ~AbsFunction(); // Function value: N-dimensional functions must override these: virtual unsigned int dimensionality() const ; // returns 1; // Function value virtual double operator() (double argument) const=0; virtual double operator() (const Argument &argument) const=0; // Every function must override this: virtual AbsFunction * clone() const=0; // Function composition. Do not attempt to override: virtual FunctionComposition operator () (const AbsFunction &f) const; // Parameter composition. Do not attempt to override: virtual ParameterComposition operator() ( const AbsParameter &p) const; // Derivative, (All functions) (do not override) Derivative derivative(const Variable &v) const; // Derivative (1D functions only) (do not override) Derivative prime() const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return false;} // Derivative. Overriders may be provided, numerical method by default! virtual Derivative partial(unsigned int) const; private: // It is illegal to assign a function. const AbsFunction & operator=(const AbsFunction &right); }; FunctionProduct operator * (const AbsFunction &op1, const AbsFunction &op2); FunctionSum operator + (const AbsFunction &op1, const AbsFunction &op2); FunctionDifference operator - (const AbsFunction &op1, const AbsFunction &op2); FunctionQuotient operator / (const AbsFunction &op1, const AbsFunction &op2); FunctionNegation operator - (const AbsFunction &op1); ConstTimesFunction operator * (double c, const AbsFunction &op2); ConstPlusFunction operator + (double c, const AbsFunction &op2); ConstMinusFunction operator - (double c, const AbsFunction &op2); ConstOverFunction operator / (double c, const AbsFunction &op2); ConstTimesFunction operator * (const AbsFunction &op2, double c); ConstPlusFunction operator + (const AbsFunction &op2, double c); ConstPlusFunction operator - (const AbsFunction &op2, double c); ConstTimesFunction operator / (const AbsFunction &op2, double c); FunctionTimesParameter operator * (const AbsFunction &op1, const AbsParameter &op2); FunctionPlusParameter operator + (const AbsFunction &op1, const AbsParameter &op2); FunctionPlusParameter operator - (const AbsFunction &op1, const AbsParameter &op2); FunctionTimesParameter operator / (const AbsFunction &op1, const AbsParameter &op2); FunctionTimesParameter operator * (const AbsParameter &op1, const AbsFunction &op2); FunctionPlusParameter operator + (const AbsParameter &op1, const AbsFunction &op2); FunctionPlusParameter operator - (const AbsParameter &op1, const AbsFunction &op2); FunctionTimesParameter operator / (const AbsParameter &op1, const AbsFunction &op2); FunctionConvolution convolve (const AbsFunction &op1, const AbsFunction &op2, double x0, double x1); FunctionDirectProduct operator % (const AbsFunction &op1, const AbsFunction &op2); typedef const AbsFunction & GENFUNCTION; } // namespace Genfun //---------------------------------------------------------------------------- // // This macro does all the ugly boilerplate. For reference I will lis what // it is doing: // // 1). It uses the base class function composition operator. It would be // nice to just use the // // using AbsFunction::operator(); // // directive but unfortunately this is compiler-dependent! // #define FUNCTION_OBJECT_DEF(classname) \ public: \ virtual FunctionComposition operator()(const AbsFunction &function) const; \ virtual ParameterComposition operator()(const AbsParameter &p) const; \ virtual classname *clone() const; \ private: //---------------------------------------------------------------------------- // // This macro implements the ugly boilerplate // #define FUNCTION_OBJECT_IMP(classname) \ inline FunctionComposition classname::operator()(const AbsFunction & function) const\ { \ return AbsFunction::operator() (function); \ } \ inline ParameterComposition classname::operator()(const AbsParameter & p) const\ { \ return AbsFunction::operator() (p); \ } \ inline classname *classname::clone() const \ { \ return new classname(*this); \ } //---------------------------------------------------------------------------- #include "CLHEP/GenericFunctions/FunctionProduct.hh" #include "CLHEP/GenericFunctions/FunctionSum.hh" #include "CLHEP/GenericFunctions/FunctionDifference.hh" #include "CLHEP/GenericFunctions/FunctionQuotient.hh" #include "CLHEP/GenericFunctions/FunctionConvolution.hh" #include "CLHEP/GenericFunctions/FunctionNegation.hh" #include "CLHEP/GenericFunctions/FunctionDirectProduct.hh" #include "CLHEP/GenericFunctions/FunctionComposition.hh" #include "CLHEP/GenericFunctions/ConstPlusFunction.hh" #include "CLHEP/GenericFunctions/ConstTimesFunction.hh" #include "CLHEP/GenericFunctions/ConstMinusFunction.hh" #include "CLHEP/GenericFunctions/ConstOverFunction.hh" #include "CLHEP/GenericFunctions/FunctionPlusParameter.hh" #include "CLHEP/GenericFunctions/FunctionTimesParameter.hh" #include "CLHEP/GenericFunctions/FunctionNoop.hh" #include "CLHEP/GenericFunctions/ParameterComposition.hh" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Erf.hh0000755000175000017500000000305207726364536022171 0ustar olesoles// -*- C++ -*- // $Id: Erf.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------Erf--------------------------------------------------// // // // Class Erf // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef Erf_h #define Erf_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/IncompleteGamma.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Erf : public AbsFunction { FUNCTION_OBJECT_DEF(Erf) public: // Constructor Erf(); // Copy constructor Erf(const Erf &right); // Destructor virtual ~Erf(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign an adjustable constant const Erf & operator=(const Erf &right); IncompleteGamma _incompleteGamma; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Bessel.icc0000755000175000017500000000427211406213111023002 0ustar olesoles// -*- C++ -*- // $Id: #include "gsl/gsl_sf_bessel.h" #include #include #include #define GF_DBL_EPSILON 2.2204460492503131e-16 namespace Genfun { namespace IntegralOrder { FUNCTION_OBJECT_IMP(Bessel) inline Bessel::Bessel(Type type, unsigned int order): _type(type),_order(order) { } inline Bessel::~Bessel() { } inline Bessel::Bessel(const Bessel & right): _type(right._type), _order(right._order) { } inline double Bessel::operator() (double x) const { gsl_sf_result result; if (_type==J) { int status = gsl_sf_bessel_Jn_e(_order, x, &result); if (status!=0) { std::cerr << "Warning, GSL function gsl_sf_bessel_Jn_impl" << " return code" << status << std::endl; raise(SIGFPE); } return result.val; } else if (_type==Y) { int status = gsl_sf_bessel_Yn_e(_order, x, &result); if (status!=0) { std::cerr << "Warning, GSL function gsl_sf_bessel_Yn_impl" << " return code" << status << std::endl; raise(SIGFPE); } return result.val; } else { return 0; } } } // end namespace IntegralOrder namespace FractionalOrder { FUNCTION_OBJECT_IMP(Bessel) inline Bessel::Bessel(Type type): _type(type), _order("Order", 0.0,-10,10) { } inline Bessel::~Bessel() { } inline Bessel::Bessel(const Bessel & right): _type(right._type), _order(right._order) { } inline Parameter & Bessel::order() { return _order; } inline const Parameter & Bessel::order() const { return _order; } inline double Bessel::operator() (double x) const { gsl_sf_result result; if (_type==J) { int status = gsl_sf_bessel_Jnu_e(_order.getValue(), x, &result); if (status!=0) { std::cerr << "Warning, GSL function gsl_sf_bessel_Jnu_impl" << " return code" << status << std::endl; raise(SIGFPE); } return result.val; } else if (_type==Y) { int status = gsl_sf_bessel_Ynu_e(_order.getValue(), x, &result); if (status!=0) { std::cerr << "Warning, GSL function gsl_sf_bessel_Ynu_impl" << " return code" << status << std::endl; raise(SIGFPE); } return result.val; } return result.val; } } // end namespace FractionalOrder } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ConstMinusFunction.hh0000755000175000017500000000326607726364536025274 0ustar olesoles// -*- C++ -*- // $Id: ConstMinusFunction.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------ConstMinusFunction------------------------------// // // // ConstMinusFunction, result of subtracting a function from constant // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ConstMinusFunction_h #define ConstMinusFunction_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ConstMinusFunction : public AbsFunction { FUNCTION_OBJECT_DEF(ConstMinusFunction) public: // Constructor ConstMinusFunction(double constant, const AbsFunction *arg); // Copy constructor ConstMinusFunction(const ConstMinusFunction &right); // Destructor virtual ~ConstMinusFunction(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const; // Dimensionality virtual unsigned int dimensionality() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a ConstMinusFunction const ConstMinusFunction & operator=(const ConstMinusFunction &right); double _constant; const AbsFunction *_arg; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/RKIntegrator.hh0000755000175000017500000001441012006746030024004 0ustar olesoles// -*- C++ -*- // $Id: //---------------------Runge-Kutte Integrator-------------------------------// // // // Class RKIntegrator // // Joe Boudreau, November 2002 // // // // This is a Runge-Kutta Numerical integrator for a set of N autonomous // // first order differential equations in N variables. The point is to // // create one or more functions which are defined by A) the differential // // equations governing their time evolution, and B) their values at time // // t=0. // // // // You add differential eqns one at a time to this integrator. Each one // // is a GENFUNCTION governing the time evolution of the i^th variable, and // // should depend on all of the N variables, but not on the time // // explicitly. You should add N differential equations in all. Each // // time you add a differential equation the integrator creates a parameter // // for you representing the starting value of the variable, and returns a // // pointer. You may either set the values of that parameter to desired // // values or else connect it to an external parameter if you wish to vary // // the shape of the function by adjusting starting values. // // // // In addition, you may request the integrator to create a control // // parameter. The control parameter may also be set, or connected. // // It can be used in the equations that define the time evolution of the // // variables. // //--------------------------------------------------------------------------// #ifndef RKIntegrator_h #define RKIntegrator_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/RCBase.hh" #include #include namespace Genfun { /** * @author * @ingroup genfun */ class RKIntegrator { public: // Some helper classes: class RKFunction; class RKData; class RKStepper; // Constructor RKIntegrator(const RKStepper *stepper=NULL); // Destructor virtual ~RKIntegrator(); // Add a differential equation governing the time evolution of the next variable. // Get back a parameter representing the starting value of that variable. You // can either arrange for that parameter to have the right starting value, or you // can connect it to another parameter so that you may change it. Parameter * addDiffEquation (const AbsFunction * diffEquation, const std::string & variableName="anon", double defStartingValue=0.0, double startingValueMin=0.0, double startingValueMax=0.0); // Create a control parameter. You can then connnect this to some other // parameter. Parameter *createControlParameter (const std::string & variableName="anon", double defStartingValue=0.0, double startingValueMin=0.0, double startingValueMax=0.0); // Get back a function. This function will now actually change as parameters // are changed; this includes both control parameters and starting value // parameters. const RKFunction *getFunction(unsigned int i) const; private: // It is illegal to assign an RKIntegrator const RKIntegrator & operator=(const RKIntegrator &right); // It is illegal to copy an RKIntegrator RKIntegrator(const RKIntegrator &right); // Here is the data, it belongs to the integrator and to the // functions, and is reference counted: RKData *_data; // Here are the functions: std::vector _fcn; }; class RKIntegrator::RKData : public Genfun::RCBase { public: // Information about solution at each mesh point. struct Data{ std::vector variable; // Solution mutable std::vector firstDerivative; // It's first derivative double time; // time Data(int size): variable(size), firstDerivative(size), time(0) {} bool operator < (const Data & right) const { return time < right.time; } bool operator == (const Data & right) const { return time==right.time; } }; RKData(); void lock(); void recache(); std::vector _startingValParameter; std::vector _startingValParameterCache; std::vector _controlParameter; std::vector _controlParameterCache; std::vector _diffEqn; std::set _fx; bool _locked; const RKStepper *_stepper; private: ~RKData(); friend class ImaginaryFriend; // Silence compiler warnings. }; class RKIntegrator::RKFunction : public AbsFunction { FUNCTION_OBJECT_DEF(RKFunction) public: // Constructor RKFunction(RKData *data, unsigned int index); // Destructor virtual ~RKFunction(); // Copy constructor RKFunction(const RKFunction &right); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} private: // It is illegal to assign a RKFunction const RKFunction & operator=(const RKFunction &right); // The shared data: RKData *_data; const unsigned int _index; }; // An abstract base class for steppers: class RKIntegrator::RKStepper { public: virtual ~RKStepper(); virtual void step (const RKIntegrator::RKData *data, const RKIntegrator::RKData::Data & sdata, RKIntegrator::RKData::Data & ddata, double timeLimit=0) const =0; virtual RKStepper *clone() const=0; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/GammaDistribution.hh0000755000175000017500000000334411670471104025062 0ustar olesoles// -*- C++ -*- // $Id: //---------------------GammaDistribution------------------------------------// // // // Class Gamma, x^a * e(-x/b) / (b^(a+1) Gamma(Alpha+1)); // // Joe Boudreau, Jan 2007 // // // //--------------------------------------------------------------------------// #ifndef GammaDistribution_h #define GammaDistribution_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/LogGamma.hh" #define _GAMMADISTRIBUTION_REVISED_ 1 namespace Genfun { /** * @author * @ingroup genfun */ class GammaDistribution : public AbsFunction { FUNCTION_OBJECT_DEF(GammaDistribution) public: // Constructor GammaDistribution(); // Copy constructor GammaDistribution(const GammaDistribution &right); // Destructor virtual ~GammaDistribution(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the paramter alpha Parameter & alpha(); // Get the paramter alpha Parameter & beta(); private: // It is illegal to assign an adjustable constant const GammaDistribution & operator=(const GammaDistribution &right); // Here are the two parameters alpha and beta: Parameter _alpha; Parameter _beta; // This function has a LogGamma Function; LogGamma _logGamma; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ASin.hh0000755000175000017500000000251707726364536022314 0ustar olesoles// -*- C++ -*- // $Id: ASin.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------ASin-------------------------------------------------// // // // Class ASin // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ASin_h #define ASin_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { class ASin : public AbsFunction { FUNCTION_OBJECT_DEF(ASin) public: // Constructor ASin(); // Destructor virtual ~ASin(); // Copy constructor ASin(const ASin &right); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a ASin const ASin & operator=(const ASin &right); }; } // end namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ConstTimesParameter.hh0000755000175000017500000000255007726364536025410 0ustar olesoles// -*- C++ -*- // $Id: ConstTimesParameter.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------ConstTimesParameter-----------------------------// // // // ConstTimesParameter, result of subtracting a parameter from a constant. // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ConstTimesParameter_h #define ConstTimesParameter_h 1 #include "CLHEP/GenericFunctions/AbsParameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ConstTimesParameter : public AbsParameter { PARAMETER_OBJECT_DEF(ConstTimesParameter) public: // Constructor ConstTimesParameter(double, const AbsParameter *); // Copy constructor ConstTimesParameter(const ConstTimesParameter &right); // Destructor virtual ~ConstTimesParameter(); // Retreive function value virtual double getValue() const; private: // It is illegal to assign a ConstTimesParameter const ConstTimesParameter & operator=(const ConstTimesParameter &right); double _constant; AbsParameter *_parameter; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Psi2Hydrogen.icc0000755000175000017500000000356111734353266024126 0ustar olesoles// -*- C++ -*- // $Id: #include "CLHEP/GenericFunctions/Psi2Hydrogen.hh" #include "CLHEP/GenericFunctions/AssociatedLegendre.hh" #include "CLHEP/GenericFunctions/AssociatedLaguerre.hh" #include "CLHEP/GenericFunctions/Power.hh" #include "CLHEP/GenericFunctions/Exponential.hh" #include "CLHEP/GenericFunctions/FixedConstant.hh" #include "CLHEP/GenericFunctions/Psi2Hydrogen.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include "CLHEP/GenericFunctions/Power.hh" #include #include // for pow() namespace Genfun { FUNCTION_OBJECT_IMP(Psi2Hydrogen) // This is the product n (n-1) (n-1)... inline double factorial (int n) { if (n<=1) return 1.0; else return n*factorial(n-1); } // inline Psi2Hydrogen::Psi2Hydrogen(unsigned int n, unsigned int l, unsigned int m): _n(n), _l(l), _m(m) { assert(m<=l); create(); } inline Psi2Hydrogen::~Psi2Hydrogen() { delete _function; } inline Psi2Hydrogen::Psi2Hydrogen(const Psi2Hydrogen & right): _n(right._n), _l(right._l), _m(right._m) { create(); } inline double Psi2Hydrogen::operator() (const Argument & a) const { assert (a.dimension()==3); return (*_function)(a); } inline double Psi2Hydrogen::operator() (double x) const { std::cerr << "Warning. Psi2Hydrogen called with scalar argument" << std::endl; assert(0); return 0; } inline unsigned int Psi2Hydrogen::n() const { return _n; } inline unsigned int Psi2Hydrogen::l() const { return _l; } inline unsigned int Psi2Hydrogen::m() const { return _m; } inline void Psi2Hydrogen::create() { FixedConstant I(1.0); Variable r; double asq = pow(2.0/_n, 3.0)*factorial(_n-_l-1)/(2.0*_n*factorial(_n+_l)); GENFUNCTION ar = (2.0/_n)*r; AssociatedLegendre P(_l, _m); AssociatedLaguerre L(_n-_l-1, 2*_l+1); Exponential exp; Power pow2L(2*_l); _function = (asq*exp(ar)*pow2L(ar)*L(ar)*L(ar)%(P*P)%(I*I)).clone(); } } clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ParameterQuotient.hh0000755000175000017500000000253407726364536025132 0ustar olesoles// -*- C++ -*- // $Id: ParameterQuotient.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------ParameterQuotient-------------------------------// // // // ParameterQuotient, result of division of two parameters. // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ParameterQuotient_h #define ParameterQuotient_h 1 #include "CLHEP/GenericFunctions/AbsParameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ParameterQuotient : public AbsParameter { PARAMETER_OBJECT_DEF(ParameterQuotient) public: // Constructor ParameterQuotient(const AbsParameter *arg1, const AbsParameter *arg2); // Copy constructor ParameterQuotient(const ParameterQuotient &right); // Destructor virtual ~ParameterQuotient(); // Retreive function value virtual double getValue() const; private: // It is illegal to assign a ParameterQuotient const ParameterQuotient & operator=(const ParameterQuotient &right); AbsParameter *_arg1; AbsParameter *_arg2; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ExtendedButcherTableau.hh0000644000175000017500000000541012047015056026003 0ustar olesoles#ifndef _ExtendedButcherTableau_h_ #define _ExtendedButcherTableau_h_ // This class defines a ExtendedButcher Tableau, which completely specifies // an *embedded* Runge-Kutte integration scheme. ExtendedButcher Tableau // are described in Numerical Methods for Ordinary Differential Equations, // John Wiley & sons, West Sussex England. // // General form is : // // c|A // --- // |b^T // |bHat^T // // where A is a matrix and b, bHat, and c are column vectors. // // The ExtendedButcher Tableau Class presents itself as an empty structure // that the user has to fill up. One can blithely fill write into // any element of A, b, bHat or c. Space is automatically allocated. #include #include namespace Genfun { class ExtendedButcherTableau { public: // Constructor: inline ExtendedButcherTableau(const std::string &name, unsigned int order, unsigned int orderHat); // Returns the name: inline const std::string & name() const; // Returns the order of the main formula inline unsigned int order() const; // Returns the order of the controlling formula inline unsigned int orderHat() const; // Returns the number of steps: inline unsigned int nSteps() const; // Write access to elements: inline double & A(unsigned int i, unsigned int j); inline double & b(unsigned int i); inline double & bHat(unsigned int i); inline double & c(unsigned int i); // Read access to elements (inline for speed) inline const double & A(unsigned int i, unsigned int j) const; inline const double & b(unsigned int i) const; inline const double & bHat(unsigned int i) const; inline const double & c(unsigned int i) const; private: std::vector< std::vector > _A; std::vector _b; std::vector _bHat; std::vector _c; std::string _name; unsigned int _order; unsigned int _orderHat; }; class HeunEulerXtTableau: public ExtendedButcherTableau { // Constructor: public: inline HeunEulerXtTableau(); }; class BogackiShampineXtTableau: public ExtendedButcherTableau { // Constructor: public: inline BogackiShampineXtTableau(); }; class FehlbergRK45F2XtTableau: public ExtendedButcherTableau { // Constructor: public: inline FehlbergRK45F2XtTableau(); }; class CashKarpXtTableau: public ExtendedButcherTableau { // Constructor: public: inline CashKarpXtTableau(); }; } inline std::ostream & operator << (std::ostream & o, const Genfun::ExtendedButcherTableau & b); #include "CLHEP/GenericFunctions/ExtendedButcherTableau.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/CubicSplinePolynomial.hh0000644000175000017500000000336012047552013025675 0ustar olesoles// -*- C++ -*- // $Id: // ------------------------------------------------------------------------------// // Natural cubic spline function, used for interpolation // // // // // // Joe Boudreau. // // // // ------------------------------------------------------------------------------// #ifndef _CubicSplinePolynomial_h_ #define _CubicSplinePolynomial_h_ #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include namespace Genfun { /** * @author * @ingroup genfun */ class CubicSplinePolynomial: public AbsFunction { FUNCTION_OBJECT_DEF(CubicSplinePolynomial) public: // Constructor CubicSplinePolynomial(); // Copy constructor CubicSplinePolynomial(const CubicSplinePolynomial &right); // Destructor: virtual ~CubicSplinePolynomial(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Puncture this thing: void addPoint(double x, double y); // Get the range: void getRange(double & min, double & max) const; private: // It is illegal to assign an adjustable constant const CubicSplinePolynomial & operator=(const CubicSplinePolynomial &right); class Clockwork; Clockwork *c; }; } // namespace Genfun #include "CLHEP/GenericFunctions/CubicSplinePolynomial.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/FunctionPlusParameter.hh0000755000175000017500000000340207726364536025746 0ustar olesoles// -*- C++ -*- // $Id: FunctionPlusParameter.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------FunctionPlusParameter---------------------------// // // // ConstOverFunction, result of adding a function and a parameter // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef FunctionPlusParameter_h #define FunctionPlusParameter_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class FunctionPlusParameter : public AbsFunction { FUNCTION_OBJECT_DEF(FunctionPlusParameter) public: // Constructor FunctionPlusParameter(const AbsParameter *parameter, const AbsFunction *function); // Copy constructor FunctionPlusParameter(const FunctionPlusParameter &right); // Destructor virtual ~FunctionPlusParameter(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const; // Dimensionality virtual unsigned int dimensionality() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a FunctionPlusParameter const FunctionPlusParameter & operator=(const FunctionPlusParameter &right); const AbsFunction *_function; AbsParameter *_parameter; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/PeriodicRectangular.hh0000755000175000017500000000364012012777433025372 0ustar olesoles// -*- C++ -*- // $Id: PeriodicRectangular.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------Rectangular------------------------------------------// // // // Class Exponential // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef PeriodicRectangular_h_ #define PeriodicRectangular_h_ 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class PeriodicRectangular : public AbsFunction { FUNCTION_OBJECT_DEF(PeriodicRectangular) public: // Constructor PeriodicRectangular(); // Copy constructor PeriodicRectangular(const PeriodicRectangular &right); // Destructor virtual ~PeriodicRectangular(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & arg) const {return operator() (arg[0]);} // Get the position of the first discontinuity Parameter & a(); // Get the position of the second discontinuity Parameter & b(); // Get the value of the function at its top Parameter & height(); // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign an adjustable constant const PeriodicRectangular & operator=(const PeriodicRectangular &right); // Here is the decay constant Parameter _a; Parameter _b; Parameter _height; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/AbsFunctional.hh0000755000175000017500000000121207726364536024201 0ustar olesoles// -*- C++ -*- // $Id: AbsFunctional.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ // A functional is a mapping from functions to real numbers. // Here is their base class: #ifndef _AbsFunctional_h_ #define _AbsFunctional_h_ namespace Genfun { class AbsFunction; /** * @author * @ingroup genfun */ class AbsFunctional { public: // Constructor AbsFunctional(); // Destructor: virtual ~AbsFunctional(); // A functional is a mapping from functions to // real numbers. This defines that mapping: virtual double operator[] (const AbsFunction & function) const = 0; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/EmbeddedRKStepper.hh0000644000175000017500000000200012005450057024707 0ustar olesoles#ifndef _EmbeddedRKStepper_hh_ #define _EmbeddedRKStepper_hh_ #include "CLHEP/GenericFunctions/AdaptiveRKStepper.hh" #include "CLHEP/GenericFunctions/ExtendedButcherTableau.hh" // // Class EmbeddedRK stepper is a class at that implements // Fehlberg algorithms, or embedded Runge-Kutta Algorithms. // namespace Genfun { class EmbeddedRKStepper: public AdaptiveRKStepper::EEStepper { public: // Constructor: EmbeddedRKStepper(const ExtendedButcherTableau & tableau=CashKarpXtTableau()); // Destructor: virtual ~EmbeddedRKStepper(); // Take a single step with error estimate: virtual void step (const RKIntegrator::RKData * data, const RKIntegrator::RKData::Data & sdata, RKIntegrator::RKData::Data & ddata, std::vector & errors) const; // Clone self: virtual EmbeddedRKStepper *clone() const; // Return the order: virtual unsigned int order() const; private: ExtendedButcherTableau tableau; }; } #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/BivariateGaussian.hh0000755000175000017500000000421707726364536025062 0ustar olesoles// -*- C++ -*- // $Id: BivariateGaussian.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------BivariateGaussian------------------------------------// // // // Class BivariateGaussian // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef BivariateGaussian_h #define BivariateGaussian_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class BivariateGaussian : public AbsFunction { FUNCTION_OBJECT_DEF(BivariateGaussian) public: // Constructor BivariateGaussian(); // Copy constructor BivariateGaussian(const BivariateGaussian &right); // Destructor virtual ~BivariateGaussian(); // Retreive function value virtual double operator ()(double argument) const; // Gives an error. virtual double operator ()(const Argument & a) const; // Must use this one // Dimensionality virtual unsigned int dimensionality() const; // Get the mean of the BivariateGaussian Parameter & mean0(); const Parameter & mean0() const; Parameter & mean1(); const Parameter & mean1() const; // Get the sigma of the BivariateGaussian Parameter & sigma0(); const Parameter & sigma0() const; Parameter & sigma1(); const Parameter & sigma1() const; // Get the correlation coefficient: Parameter & corr01(); const Parameter & corr01() const; private: // It is illegal to assign an adjustable constant const BivariateGaussian & operator=(const BivariateGaussian &right); // Here is the decay constant Parameter _mean0; Parameter _mean1; // Here is the sigma Parameter _sigma0; Parameter _sigma1; // Here is the correlation coefficient: Parameter _corr01; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ConstPlusFunction.hh0000755000175000017500000000325207726364536025117 0ustar olesoles// -*- C++ -*- // $Id: ConstPlusFunction.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------ConstPlusFunction-------------------------------// // // // ConstPlusFunction, result of adding a function and a constant // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ConstPlusFunction_h #define ConstPlusFunction_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ConstPlusFunction : public AbsFunction { FUNCTION_OBJECT_DEF(ConstPlusFunction) public: // Constructor ConstPlusFunction(double constant, const AbsFunction *arg); // Copy constructor ConstPlusFunction(const ConstPlusFunction &right); // Destructor virtual ~ConstPlusFunction(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const; // Dimensionality virtual unsigned int dimensionality() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a ConstPlusFunction const ConstPlusFunction & operator=(const ConstPlusFunction &right); double _constant; const AbsFunction *_arg; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/SphericalHarmonicExpansion.hh0000755000175000017500000000431111746557221026724 0ustar olesoles// -*- C++ -*- // $Id: //---------------------SphericalHarmonicExpansion------------------------------------------// // // // Class SphericalHarmonicExpansion. This is a fitting function consisting of a super // // position of N legendre polynomials. Cascading fractions and phases are // // the input parameters. Function is normalized to one (on [-1,1]) // // Joe Boudreau, Petar Maksimovic, January 2000 // // // //--------------------------------------------------------------------------// #ifndef SphericalHarmonicExpansion_h #define SphericalHarmonicExpansion_h #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/SphericalHarmonicCoefficientSet.hh" namespace Genfun { /** * @author * @ingroup genfun */ class SphericalHarmonicExpansion : public AbsFunction { FUNCTION_OBJECT_DEF(SphericalHarmonicExpansion) public: enum Type {REAL,IMAG,MAG, MAGSQ}; // Constructor. Builds all the SphericalHarmonicExpansion(Type type, const SphericalHarmonicCoefficientSet & coefficients); // Copy constructor SphericalHarmonicExpansion(const SphericalHarmonicExpansion &right); // Destructor virtual ~SphericalHarmonicExpansion(); // Dimensionality=2. They are; cosTheta (not theta) and phi virtual unsigned int dimensionality() const {return 2;} // Retreive function value virtual double operator ()(double argument) const; // Gives an error. virtual double operator ()(const Argument & a) const; // Must use this one // Get the expansion coefficients: SphericalHarmonicCoefficientSet & coefficientSet(); const SphericalHarmonicCoefficientSet & coefficientSet() const; private: // It is illegal to assign an adjustable constant const SphericalHarmonicExpansion & operator=(const SphericalHarmonicExpansion &right); class Clockwork; Clockwork *c; }; } // namespace Genfun #include "CLHEP/GenericFunctions/SphericalHarmonicExpansion.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Airy.hh0000755000175000017500000000166010554745431022352 0ustar olesoles// -*- C++ -*- // $Id: // Airy Functions Ai and Bi #ifndef Airy_h #define Airy_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Airy : public AbsFunction { FUNCTION_OBJECT_DEF(Airy) public: enum Type {Ai, Bi}; // Constructor: Use this one and you will get a Airy function Ai or Bi Airy (Type type); // Copy constructor Airy(const Airy &right); // Destructor virtual ~Airy(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} private: // It is illegal to assign an adjustable constant const Airy & operator=(const Airy &right); // The type and order of the Airy function Type _type; }; } // namespace Genfun #include "CLHEP/GenericFunctions/Airy.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/FunctionConvolution.hh0000755000175000017500000000370107726364536025503 0ustar olesoles// -*- C++ -*- // $Id: FunctionConvolution.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //------------------------------FunctionConvolution-------------------------// // // // FunctionConvolution: output of the Convolve[f,g] operation // // // // Petar Maksimovic, Joe Boudreau, November 1999 // // // // Warning! This is not a very good convolution algorithm! Does anybody // // out there really know how to perform a reasonable numerical convolution // // ? Wanna help the Generic Functions Project? // // // //--------------------------------------------------------------------------// #ifndef FunctionConvolution_h #define FunctionConvolution_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class FunctionConvolution : public AbsFunction { FUNCTION_OBJECT_DEF(FunctionConvolution) public: // Constructor FunctionConvolution(const AbsFunction *arg1, const AbsFunction *arg2, double x0, double x1); // Copy Constructor FunctionConvolution(const FunctionConvolution &right); // Destructor virtual ~FunctionConvolution(); // Retrieve function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} private: // It is illegal to assign a convolution const FunctionConvolution & operator=(const FunctionConvolution &right); // Input functions to convolution const AbsFunction *_arg1; const AbsFunction *_arg2; double _x0; double _x1; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Psi2Hydrogen.hh0000755000175000017500000000372012047550473023761 0ustar olesoles// -*- C++ -*- // $Id: //----------------------------Psi2Hydrogen----------------------------------// // // // Class Psi2Hydrogen. The hydrogen wavefunction^2 as a function of r // // theta, and phi. // // // // Joe Boudreau April 2002 // // // //--------------------------------------------------------------------------// #ifndef Psi2Hydrogen_h #define Psi2Hydrogen_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { class Psi2Hydrogen : public AbsFunction { FUNCTION_OBJECT_DEF(Psi2Hydrogen) public: // Constructor Psi2Hydrogen(unsigned int n, unsigned int l, unsigned int m); // Copy constructor Psi2Hydrogen(const Psi2Hydrogen &right); // Destructor virtual ~Psi2Hydrogen(); // Retreive function value virtual double operator ()(double argument) const; // Gives an error virtual double operator ()(const Argument & a) const;// Must use this one // Get the integer variable n unsigned int n() const; // Get the integer variable l unsigned int l() const; // Get the integer variable m unsigned int m() const; private: // It is illegal to assign an adjustable constant const Psi2Hydrogen & operator=(const Psi2Hydrogen &right); // Here is the constant n unsigned int _n; // Here is the constant l unsigned int _l; // Here is the constant m unsigned int _m; // Here is the "work function" const AbsFunction *_function; // This function is needed in all constructors: void create(); }; } #include "CLHEP/GenericFunctions/Psi2Hydrogen.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/FunctionTimesParameter.hh0000755000175000017500000000340207726364536026104 0ustar olesoles// -*- C++ -*- // $Id: FunctionTimesParameter.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------FunctionTimesParameter--------------------------// // // // ConstOverFunction, result of multiplying a function and a parameter // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef FunctionTimesParameter_h #define FunctionTimesParameter_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class FunctionTimesParameter : public AbsFunction { FUNCTION_OBJECT_DEF(FunctionTimesParameter) public: // Constructor FunctionTimesParameter(const AbsParameter *parameter, const AbsFunction *function); // Copy constructor FunctionTimesParameter(const FunctionTimesParameter &right); // Destructor virtual ~FunctionTimesParameter(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const; // Dimensionality virtual unsigned int dimensionality() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a FunctionTimesParameter const FunctionTimesParameter & operator=(const FunctionTimesParameter &right); const AbsFunction *_function; AbsParameter *_parameter; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/FunctionDifference.hh0000755000175000017500000000330007726364536025211 0ustar olesoles// -*- C++ -*- // $Id: FunctionDifference.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------FunctionDifference------------------------------// // // // FunctionDifference, result of subtraction of two functions // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef FunctionDifference_h #define FunctionDifference_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class FunctionDifference : public AbsFunction { FUNCTION_OBJECT_DEF(FunctionDifference) public: // Constructor FunctionDifference(const AbsFunction* arg1, const AbsFunction *arg2); // Copy constructor FunctionDifference(const FunctionDifference &right); // Destructor virtual ~FunctionDifference(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const; // Dimensionality virtual unsigned int dimensionality() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a FunctionDifference const FunctionDifference & operator=(const FunctionDifference &right); const AbsFunction *_arg1; const AbsFunction *_arg2; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/CMakeLists.txt0000644000175000017500000000560412012777433023662 0ustar olesoles set( pkginclude_HEADERS AbsFunctional.hh AbsFunction.hh Abs.hh AbsParameter.hh ACos.hh AdaptiveRKStepper.hh Airy.hh Airy.icc AnalyticConvolution.hh Argument.hh ArgumentList.hh ArrayFunction.hh ASin.hh AssociatedLaguerre.hh AssociatedLegendre.hh AssociatedLegendre.icc ATan.hh Bessel.hh Bessel.icc BetaDistribution.hh BivariateGaussian.hh ButcherTableau.hh ButcherTableau.icc ClassicalSolver.hh ClebschGordanCoefficientSet.hh ConstMinusFunction.hh ConstMinusParameter.hh ConstOverFunction.hh ConstOverParameter.hh ConstPlusFunction.hh ConstPlusParameter.hh ConstTimesFunction.hh ConstTimesParameter.hh Cos.hh CumulativeChiSquare.hh CutBase.hh CutBase.icc DefiniteIntegral.hh DoubleParamToArgAdaptor.hh DoubleParamToArgAdaptor.icc EfficiencyFunctional.hh EllipticIntegral.hh EllipticIntegral.icc EmbeddedRKStepper.hh Erf.hh Exp.hh Exponential.hh ExtendedButcherTableau.hh ExtendedButcherTableau.icc FixedConstant.hh FloatingConstant.hh FourierFit.hh FourierFit.icc FunctionComposition.hh FunctionConvolution.hh FunctionDifference.hh FunctionDirectProduct.hh FunctionNegation.hh FunctionNoop.hh FunctionNumDeriv.hh FunctionPlusParameter.hh FunctionProduct.hh FunctionQuotient.hh FunctionSum.hh FunctionTimesParameter.hh GammaDistribution.hh Gamma.hh Gaussian.hh GenericFunctions.hh IncompleteGamma.hh InterpolatingPolynomial.hh KroneckerDelta.hh Landau.hh LegendreCoefficientSet.hh LegendreCoefficientSet.icc LegendreExpansion.hh LegendreExpansion.icc LegendreFit.hh LegendreFit.icc Legendre.hh Legendre.icc LikelihoodFunctional.hh Ln.hh LogGamma.hh LogisticFunction.hh Mod.hh NonrelativisticBW.hh ParameterComposition.hh ParameterDifference.hh Parameter.hh ParameterNegation.hh ParameterProduct.hh ParameterQuotient.hh ParameterSum.hh ParamToArgAdaptor.hh ParamToArgAdaptor.icc PeriodicRectangular.hh PhaseSpace.hh Power.hh Psi2Hydrogen.hh Psi2Hydrogen.icc PtRelFcn.hh PuncturedSmearedExp.hh RCBase.hh Rectangular.hh RelativisticBW.hh ReverseExponential.hh RKIntegrator.hh RungeKuttaClassicalSolver.hh Sigma.hh SimpleRKStepper.hh Sin.hh SphericalBessel.hh SphericalBessel.icc SphericalHarmonicCoefficientSet.hh SphericalHarmonicCoefficientSet.icc SphericalHarmonicExpansion.hh SphericalHarmonicExpansion.icc SphericalHarmonicFit.hh SphericalHarmonicFit.icc SphericalNeumann.hh SphericalNeumann.icc Sqrt.hh Square.hh StepDoublingRKStepper.hh SymToArgAdaptor.hh SymToArgAdaptor.icc Tan.hh Theta.hh TrivariateGaussian.hh Variable.hh VoigtProfile.hh X.hh ) INSTALL (FILES ${pkginclude_HEADERS} DESTINATION include/CLHEP/GenericFunctions ) clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Airy.icc0000755000175000017500000000176711406213111022477 0ustar olesoles// -*- C++ -*- // $Id: #include "gsl/gsl_sf_airy.h" #include #include #include namespace Genfun { FUNCTION_OBJECT_IMP(Airy) inline Airy::Airy(Type type): _type(type) { } inline Airy::~Airy() { } inline Airy::Airy(const Airy & right): _type(right._type) { } inline double Airy::operator() (double x) const { gsl_sf_result result; if (_type==Ai) { int status = gsl_sf_airy_Ai_e(x, GSL_PREC_DOUBLE, &result); if (status!=0) { std::cerr << "Warning, GSL function gsl_sf_airy_ai" << " return code" << status << std::endl; raise(SIGFPE); } return result.val; } else if (_type==Bi) { int status = gsl_sf_airy_Bi_e( x, GSL_PREC_DOUBLE, &result); if (status!=0) { std::cerr << "Warning, GSL function gsl_sf_airy_bi" << " return code" << status << std::endl; raise(SIGFPE); } return result.val; } return result.val; } } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/FunctionQuotient.hh0000755000175000017500000000324407726364536024776 0ustar olesoles// -*- C++ -*- // $Id: FunctionQuotient.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------FunctionQuotient--------------------------------// // // // FunctionProduct, result of multiplication of two functions. // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef FunctionQuotient_h #define FunctionQuotient_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class FunctionQuotient : public AbsFunction { FUNCTION_OBJECT_DEF(FunctionQuotient) public: // Constructor FunctionQuotient(const AbsFunction *arg1, const AbsFunction *arg2); // Copy constructor FunctionQuotient(const FunctionQuotient &right); // Destructor virtual ~FunctionQuotient(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const; // Dimensionality virtual unsigned int dimensionality() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a FunctionQuotient const FunctionQuotient & operator=(const FunctionQuotient &right); const AbsFunction *_arg1; const AbsFunction *_arg2; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ParameterNegation.hh0000755000175000017500000000252007726364536025061 0ustar olesoles// -*- C++ -*- // $Id: ParameterNegation.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------ParameterNegation-------------------------------// // // // ParameterNegation, result of negating a parameters. // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ParameterNegation_h #define ParameterNegation_h 1 #include "CLHEP/GenericFunctions/AbsParameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ParameterNegation : public AbsParameter { PARAMETER_OBJECT_DEF(ParameterNegation) public: // Constructor ParameterNegation(const AbsParameter *arg1); // Copy constructor ParameterNegation(const ParameterNegation &right); // Destructor virtual ~ParameterNegation(); // Retreive parameter value virtual double getValue() const; private: // It is illegal to assign a ParameterNegation const ParameterNegation & operator=(const ParameterNegation &right); // The parameter to be negated: AbsParameter *_arg1; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/LegendreCoefficientSet.hh0000644000175000017500000000176111734353266026007 0ustar olesoles#ifndef _LEGENDRECOEFFICIENTSET_H_ #define _LEGENDRECOEFFICIENTSET_H_ #include namespace Genfun { class LegendreCoefficientSet { public: // Constructor: LegendreCoefficientSet(unsigned int LMAX); // Copy Constructor: LegendreCoefficientSet(const LegendreCoefficientSet &); // Destructor: ~LegendreCoefficientSet(); // Get the size of the set: unsigned int getLMax() const; // Readonly access to a specific coefficient: const std::complex & operator () (unsigned int l) const; // Read/write access to a specific coefficient: std::complex & operator () (unsigned int l); LegendreCoefficientSet & operator= (const LegendreCoefficientSet & ); private: class Clockwork; Clockwork *c; }; std::ostream & operator<< ( std::ostream & o, const LegendreCoefficientSet & c); } #include "CLHEP/GenericFunctions/LegendreCoefficientSet.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/LegendreFit.hh0000755000175000017500000000514311734353266023640 0ustar olesoles// -*- C++ -*- // $Id: LegendreFit.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------LegendreFit------------------------------------------// // // // Class LegendreFit. This is a fitting function consisting of a super // // position of N legendre polynomials. Cascading fractions and phases are // // the input parameters. Function is normalized to one (on [-1,1]) // // // //--------------------------------------------------------------------------// #ifndef LegendreFit_h #define LegendreFit_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/LegendreCoefficientSet.hh" #include "CLHEP/GenericFunctions/ClebschGordanCoefficientSet.hh" namespace Genfun { /** * @author * @ingroup genfun */ class LegendreFit : public AbsFunction { FUNCTION_OBJECT_DEF(LegendreFit) public: // Constructor LegendreFit(unsigned int N); // Copy constructor LegendreFit(const LegendreFit &right); // Destructor virtual ~LegendreFit(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} unsigned int order() const; Parameter *getFraction(unsigned int i); const Parameter *getFraction(unsigned int i) const; Parameter *getPhase(unsigned int i); const Parameter *getPhase(unsigned int i) const; // Gets the coefficients the coefficients of the function which is // Squared to obtain a probability distribution (amplitude) const LegendreCoefficientSet & coefficientsA() const; // Gets the coefficients the coefficients of the function which is // Squared to obtain a probability distribution: const LegendreCoefficientSet & coefficientsASq() const; // Recompute coefficients from the parameters: void recomputeCoefficients() const; private: // It is illegal to assign an adjustable constant const LegendreFit & operator=(const LegendreFit &right); // const unsigned int N; std::vector fraction; std::vector phase; mutable LegendreCoefficientSet coefA; mutable LegendreCoefficientSet coefASq; mutable ClebschGordanCoefficientSet ClebschGordan; }; } // namespace Genfun #include "CLHEP/GenericFunctions/LegendreFit.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/SphericalHarmonicFit.hh0000755000175000017500000000733111734353266025507 0ustar olesoles// -*- C++ -*- // $Id: //---------------------SphericalHarmonicFit------------------------------------------// // // // Class SphericalHarmonicFit. This is a fitting function consisting of a super // // position of N legendre polynomials. Cascading fractions and phases are // // the input parameters. Function is normalized to one (on [-1,1]) // // Joe Boudreau, Petar Maksimovic, January 2000 // // // //--------------------------------------------------------------------------// #ifndef SphericalHarmonicFit_h #define SphericalHarmonicFit_h #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/SphericalHarmonicCoefficientSet.hh" namespace Genfun { /** * @author * @ingroup genfun */ class SphericalHarmonicFit : public AbsFunction { FUNCTION_OBJECT_DEF(SphericalHarmonicFit) public: // Constructor. Builds all the SphericalHarmonicFit(unsigned int LMAX); // Copy constructor SphericalHarmonicFit(const SphericalHarmonicFit &right); // Destructor virtual ~SphericalHarmonicFit(); // Dimensionality=2. They are; cosTheta (not theta) and phi virtual unsigned int dimensionality() const {return 2;} // Retreive function value virtual double operator ()(double argument) const; // Gives an error. virtual double operator ()(const Argument & a) const; // Must use this one // Total number of parameters unsigned int numComponents() const; // Max L ("angular momentum") unsigned int lMax() const; // MINUIT-SAFE PARAMETERIZATION: Fractions vary on the range 0,1, // Phases need not be bounded: // The fraction of amplitude sq which is L OR HIGHER: Parameter *getFractionLOrHigher(unsigned int L); const Parameter *getFractionLOrHigher(unsigned int L) const; // The phase of coefficient L, M=0; Parameter *getPhaseLM0(unsigned int L); const Parameter *getPhaseLM0(unsigned int L) const; // The fraction of amplitude sq which is L which is +- M OR HIGHER Parameter *getFractionAbsMOrHigher(unsigned int L, unsigned int M); const Parameter *getFractionAbsMOrHigher(unsigned int L, unsigned int M) const; // The fraction of amplitude sq which is +- M, which is positive Parameter *getFractionMPositive(unsigned int L, unsigned int M); const Parameter *getFractionMPositive(unsigned int L, unsigned int M) const; // The phase of the positive M coefficient Parameter *getPhaseMPlus(unsigned int L, unsigned int M); const Parameter *getPhaseMPlus(unsigned int L, unsigned int M) const; // The phase of the negative M coefficient Parameter *getPhaseMMinus(unsigned int L, unsigned int M); const Parameter *getPhaseMMinus(unsigned int L, unsigned int M) const; // Gets the coefficients the coefficients of the function which is // Squared to obtain a probability distribution (amplitude) const SphericalHarmonicCoefficientSet & coefficientsA() const; // Gets the coefficients the coefficients of the function which is // Squared to obtain a probability distribution: const SphericalHarmonicCoefficientSet & coefficientsASq() const; // Recompute coefficients from the parameters: void recomputeCoefficients() const; private: // It is illegal to assign an adjustable constant const SphericalHarmonicFit & operator=(const SphericalHarmonicFit &right); class Clockwork; Clockwork *c; }; } // namespace Genfun #include "CLHEP/GenericFunctions/SphericalHarmonicFit.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ButcherTableau.hh0000644000175000017500000000514712047015056024331 0ustar olesoles#ifndef _ButcherTableau_h_ #define _ButcherTableau_h_ // This class defines a Butcher Tableau, which completely specifies // a Runge-Kutte integration scheme. Butcher Tableau are described // in Numerical Methods for Ordinary Differential Equations, John // Wiley & sons, West Sussex England. // // General form is : // // c|A // --- // |b^T // // where A is a matrix and b, c are column vectors. // // The Butcher Tableau Class presents itself as an empty structure // that the user has to fill up. One can blithely fill write into // any element of A, b, or c. Space is automatically allocated. #include #include namespace Genfun { class ButcherTableau { public: // Constructor: inline ButcherTableau(const std::string &name, unsigned int order); // Returns the name: inline const std::string & name() const; // Returns the order: inline unsigned int order() const; // Returns the number of steps: inline unsigned int nSteps() const; // Write access to elements: inline double & A(unsigned int i, unsigned int j); inline double & b(unsigned int i); inline double & c(unsigned int i); // Read access to elements (inline for speed) inline const double & A(unsigned int i, unsigned int j) const; inline const double & b(unsigned int i) const; inline const double & c(unsigned int i) const; private: std::vector< std::vector > _A; std::vector _b; std::vector _c; std::string _name; unsigned int _order; }; class EulerTableau: public ButcherTableau { // Constructor: public: inline EulerTableau(); }; class MidpointTableau: public ButcherTableau { // Constructor: public: inline MidpointTableau(); }; class TrapezoidTableau: public ButcherTableau { // Constructor: public: inline TrapezoidTableau(); }; class RK31Tableau: public ButcherTableau { // Constructor: public: inline RK31Tableau(); }; class RK32Tableau: public ButcherTableau { // Constructor: public: inline RK32Tableau(); }; class ClassicalRungeKuttaTableau: public ButcherTableau { // Constructor: public: inline ClassicalRungeKuttaTableau(); }; class ThreeEighthsRuleTableau: public ButcherTableau { // Constructor: public: inline ThreeEighthsRuleTableau(); }; } inline std::ostream & operator << (std::ostream & o, const Genfun::ButcherTableau & b); #include "CLHEP/GenericFunctions/ButcherTableau.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/DoubleParamToArgAdaptor.icc0000755000175000017500000000761107726364536026264 0ustar olesoles// -*- C++ -*- // $Id: DoubleParamToArgAdaptor.icc,v 1.2 2003/09/06 14:04:13 boudreau Exp $ #include "CLHEP/GenericFunctions/DoubleParamToArgAdaptor.hh" #include #include namespace Genfun { //FUNCTION_OBJECT_IMP(DoubleParamToArgAdaptor) Do it by hand here: template FunctionComposition DoubleParamToArgAdaptor::operator()(const AbsFunction & function) const { return AbsFunction::operator() (function); } template DoubleParamToArgAdaptor *DoubleParamToArgAdaptor::clone () const { return (DoubleParamToArgAdaptor *) _clone(); } template AbsFunction *DoubleParamToArgAdaptor::_clone () const { return new DoubleParamToArgAdaptor(*this); } template DoubleParamToArgAdaptor::DoubleParamToArgAdaptor(const F &function, DoubleParamToArgAdaptor::ScopedMethodPtr parameterFetchMethod0, DoubleParamToArgAdaptor::ScopedMethodPtr parameterFetchMethod1): _scaleFactor0("Scale 0", 1.0, 0, 10), _scaleFactor1("Scale 1", 1.0, 0, 10), _function(function.clone()), _parameterFetchMethod0(parameterFetchMethod0), _parameterFetchMethod1(parameterFetchMethod1) { _parameterFetchMethod0(*_function).setLowerLimit(-std::numeric_limits::max()); _parameterFetchMethod0(*_function).setUpperLimit(+std::numeric_limits::max()); _parameterFetchMethod1(*_function).setLowerLimit(-std::numeric_limits::max()); _parameterFetchMethod1(*_function).setUpperLimit(+std::numeric_limits::max()); } template DoubleParamToArgAdaptor::~DoubleParamToArgAdaptor() { delete _function; } template DoubleParamToArgAdaptor::DoubleParamToArgAdaptor(const DoubleParamToArgAdaptor & right): _scaleFactor0(right._scaleFactor0), _scaleFactor1(right._scaleFactor1), _parameterFetchMethod0(right._parameterFetchMethod0), _parameterFetchMethod1(right._parameterFetchMethod1), _function(right._function->clone()) { _parameterFetchMethod0(*_function).setLowerLimit(-std::numeric_limits::max()); _parameterFetchMethod0(*_function).setUpperLimit(+std::numeric_limits::max()); _parameterFetchMethod1(*_function).setLowerLimit(-std::numeric_limits::max()); _parameterFetchMethod1(*_function).setUpperLimit(+std::numeric_limits::max()); } template double DoubleParamToArgAdaptor::operator ()(double x) const { std::cerr << "Warning. DoubleParamToArgAdaptor called with scalar argument" << std::endl; assert(0); return 0; } template Parameter & DoubleParamToArgAdaptor::scaleFactor0() { return _scaleFactor0; } template const Parameter & DoubleParamToArgAdaptor::scaleFactor0() const { return _scaleFactor0; } template Parameter & DoubleParamToArgAdaptor::scaleFactor1() { return _scaleFactor1; } template const Parameter & DoubleParamToArgAdaptor::scaleFactor1() const { return _scaleFactor1; } template unsigned int DoubleParamToArgAdaptor::dimensionality() const { return _function->dimensionality()+1; } template double DoubleParamToArgAdaptor::operator() (const Argument & a) const { if (dimensionality()!= a.dimension()) { std::cerr << "Warning: DoubleParamToArgAdaptor function/argument dimension mismatch" << std::endl; assert(0); return 0; } int dMinus = a.dimension()-1; Argument aPrime(dMinus); for (int i=0;i #include #include #include namespace Genfun { FUNCTION_OBJECT_IMP(AssociatedLegendre) // This is the product n (n-2) (n-4)... inline double dfactorial (int n) { if (n<=1) return 1.0; else return n*dfactorial(n-2); } // inline AssociatedLegendre::AssociatedLegendre(unsigned int l, unsigned int m): AbsFunction(), _l(l), _m(m) { assert(m<=l); } inline AssociatedLegendre::~AssociatedLegendre() { } inline AssociatedLegendre::AssociatedLegendre(const AssociatedLegendre & right): AbsFunction(), _l(right._l), _m(right._m) { } inline unsigned int AssociatedLegendre::l() const { return _l; } inline unsigned int AssociatedLegendre::m() const { return _m; } inline double AssociatedLegendre::operator() (double x) const { gsl_sf_result result; int status = gsl_sf_legendre_Plm_e (_l, _m, x, &result); if (status!=0) { std::cerr << "Warning, GSL function gsl_sf_bessel_Yn_impl" << " return code" << status << std::endl; raise(SIGFPE); } return result.val; } } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Power.hh0000755000175000017500000000330407726364536022551 0ustar olesoles// -*- C++ -*- // $Id: Power.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //----------------------Power-----------------------------------------------// // // // Class Power // // Joe Boudreau, Petar Maksimovic, Nov. 1999 // // // // Power(x) returns x^n // //--------------------------------------------------------------------------// #ifndef Power_h #define Power_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Power : public AbsFunction { FUNCTION_OBJECT_DEF(Power) public: // Constructor Power(double n); Power(int n); Power(unsigned int n); // Copy constructor Power(const Power &right); // Destructor virtual ~Power(); // Retrieve function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a fixed constant const Power & operator=(const Power &right); double _doublePower; // power (as a double) int _intPower; // power (as an integer) bool _asInteger; // flag: object constructed with integer argument }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Square.hh0000755000175000017500000000275207726364536022723 0ustar olesoles// -*- C++ -*- // $Id: Square.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //----------------------Square------- --------------------------------------// // // // Class Square // // Joe Boudreau, Petar Maksimovic, Nov. 1999 // // // // Square(x) returns x*x. // //--------------------------------------------------------------------------// #ifndef Square_h #define Square_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Square : public AbsFunction { FUNCTION_OBJECT_DEF(Square) public: // Constructor Square(); // Copy constructor Square(const Square &right); // Destructor virtual ~Square(); // Retrieve function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a fixed constant const Square & operator=(const Square &right); }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/EllipticIntegral.icc0000755000175000017500000000604211406213111025015 0ustar olesoles// -*- C++ -*- // $Id: #include "gsl/gsl_sf_ellint.h" #include #include #include namespace Genfun { namespace EllipticIntegral { //-----------------------------------------------------------------------------// // FIRST KIND // //-----------------------------------------------------------------------------// FUNCTION_OBJECT_IMP(FirstKind) inline FirstKind::FirstKind(): _k("K", 1.0,0.0,1.0) { } inline FirstKind::~FirstKind() { } inline FirstKind::FirstKind(const FirstKind & right): _k(right._k) { } inline Parameter & FirstKind::k() { return _k; } inline const Parameter & FirstKind::k() const { return _k; } inline double FirstKind::operator() (double x) const { gsl_sf_result result; int status = gsl_sf_ellint_F_e(x,_k.getValue(), GSL_PREC_DOUBLE, &result); if (status!=0) { std::cerr << "Warning, GSL function gsl_sf_ellint_F_impl" << " return code" << status << std::endl; raise(SIGFPE); } return result.val; } //-----------------------------------------------------------------------------// // SECOND KIND // //-----------------------------------------------------------------------------// FUNCTION_OBJECT_IMP(SecondKind) inline SecondKind::SecondKind(): _k("K", 1.0,0.0,1.0) { } inline SecondKind::~SecondKind() { } inline SecondKind::SecondKind(const SecondKind & right): _k(right._k) { } inline Parameter & SecondKind::k() { return _k; } inline const Parameter & SecondKind::k() const { return _k; } inline double SecondKind::operator() (double x) const { gsl_sf_result result; int status = gsl_sf_ellint_E_e(x,_k.getValue(), GSL_PREC_DOUBLE, &result); if (status!=0) { std::cerr << "Warning, GSL function gsl_sf_ellint_E_impl" << " return code" << status << std::endl; raise(SIGFPE); } return result.val; } //-----------------------------------------------------------------------------// // THIRD KIND // //-----------------------------------------------------------------------------// FUNCTION_OBJECT_IMP(ThirdKind) inline ThirdKind::ThirdKind(): _k("K", 1.0,0.0, 1.0), _n("N", 1.0,0.0,10.0) { } inline ThirdKind::~ThirdKind() { } inline ThirdKind::ThirdKind(const ThirdKind & right): _k(right._k), _n(right._n) { } inline Parameter & ThirdKind::k() { return _k; } inline const Parameter & ThirdKind::k() const { return _k; } inline Parameter & ThirdKind::n() { return _n; } inline const Parameter & ThirdKind::n() const { return _n; } inline double ThirdKind::operator() (double x) const { gsl_sf_result result; int status = gsl_sf_ellint_P_e(x,_k.getValue(),_n.getValue(), GSL_PREC_DOUBLE, &result); if (status!=0) { std::cerr << "Warning, GSL function gsl_ellint_P_impl" << " return code" << status << std::endl; raise(SIGFPE); } return result.val; } } // end namespace EllipticIntegral } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Ln.hh0000755000175000017500000000254207726364536022031 0ustar olesoles// -*- C++ -*- // $Id: Ln.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------Ln---------------------------------------------------// // // // Class Ln // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef Ln_h #define Ln_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Ln : public AbsFunction { FUNCTION_OBJECT_DEF(Ln) public: // Constructor Ln(); // Destructor virtual ~Ln(); // Copy constructor Ln(const Ln &right); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a Ln const Ln & operator=(const Ln &right); }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/StepDoublingRKStepper.hh0000644000175000017500000000215212005450057025625 0ustar olesoles#ifndef _FelhbergStepper_hh_ #define _StepDoublingRKStepper_hh_ #include "CLHEP/GenericFunctions/AdaptiveRKStepper.hh" #include "CLHEP/GenericFunctions/ButcherTableau.hh" // // Class StepDoublingRK stepper is a class at that implements // Fehlberg algorithms, or embedded Runge-Kutta Algorithms. // namespace Genfun { class StepDoublingRKStepper: public AdaptiveRKStepper::EEStepper { public: // Constructor: StepDoublingRKStepper(const ButcherTableau & tableau); // Destructor: virtual ~StepDoublingRKStepper(); // Take a single step with error estimate: virtual void step (const RKIntegrator::RKData * data, const RKIntegrator::RKData::Data & sdata, RKIntegrator::RKData::Data & ddata, std::vector & errors) const; // Clone self: virtual StepDoublingRKStepper *clone() const; void doStep(const RKIntegrator::RKData * data, const RKIntegrator::RKData::Data & s, RKIntegrator::RKData::Data & d) const; virtual unsigned int order() const; private: ButcherTableau tableau; }; } #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Mod.hh0000755000175000017500000000240107726364536022171 0ustar olesoles// -*- C++ -*- // $Id: //----------------------Mod-----------------------------------------------// // // // Class Mod (Modulo) // // Joe Boudreau, Petar Maksimovic, Nov. 2002 // // // // Mod(x) returns x%y // //------------------------------------------------------------------------// #ifndef Mod_h #define Mod_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Mod : public AbsFunction { FUNCTION_OBJECT_DEF(Mod) public: // Constructor Mod(double y); // Copy constructor Mod(const Mod &right); // Destructor virtual ~Mod(); // Retrieve function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} private: // It is illegal to assign a fixed constant const Mod & operator=(const Mod &right); double _y; // mod (as a double) }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/IncompleteGamma.hh0000755000175000017500000000375412012777433024514 0ustar olesoles// -*- C++ -*- // $Id: IncompleteGamma.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------IncompleteGamma--------------------------------------// // // // Class IncompleteGamma, the incomplete Gamma function // // Joe Boudreau, October 2000 // // // //--------------------------------------------------------------------------// #ifndef IncompleteGamma_h #define IncompleteGamma_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/LogGamma.hh" namespace Genfun { /** * @author * @ingroup genfun */ class IncompleteGamma : public AbsFunction { FUNCTION_OBJECT_DEF(IncompleteGamma) public: // Constructor IncompleteGamma(); // Copy constructor IncompleteGamma(const IncompleteGamma &right); // Destructor virtual ~IncompleteGamma(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & arg) const {return operator() (arg[0]);} // Get the paramter a Parameter & a(); private: // It is illegal to assign an adjustable constant const IncompleteGamma & operator=(const IncompleteGamma &right); // Here is the parameter of the Incomplete Gamma Function Parameter _a; // Compute via series representation: double _gamser(double a, double x, double logGamma) const; // Compute via continued fraction representation: double _gammcf(double a, double x, double logGamma) const; // This function has a LogGamma Function; LogGamma _logGamma; static const int ITMAX; static const double EPS; static const double FPMIN; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/AssociatedLegendre.hh0000755000175000017500000000333411734353266025175 0ustar olesoles// -*- C++ -*- // $Id: AssociatedLegendre.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------AssociatedLegendre-----------------------------------// // // // Class AssociatedLegendre. An associated legendre polynomial // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef AssociatedLegendre_h #define AssociatedLegendre_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class AssociatedLegendre : public AbsFunction { FUNCTION_OBJECT_DEF(AssociatedLegendre) public: // Constructor AssociatedLegendre(unsigned int l, unsigned int m); // Copy constructor AssociatedLegendre(const AssociatedLegendre &right); // Destructor virtual ~AssociatedLegendre(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the integer variable l unsigned int l() const; // Get the integer variable mj unsigned int m() const; private: // It is illegal to assign an adjustable constant const AssociatedLegendre & operator=(const AssociatedLegendre &right); // Here is the decay constant unsigned int _l; // Here is the sigma unsigned int _m; }; } // namespace Genfun #include "CLHEP/GenericFunctions/AssociatedLegendre.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/SphericalHarmonicFit.icc0000644000175000017500000002541211746557221025643 0ustar olesoles// -*- C++ -*- // $Id: #include #include #include #include #include #include #include "CLHEP/GenericFunctions/ClebschGordanCoefficientSet.hh" namespace Genfun { FUNCTION_OBJECT_IMP(SphericalHarmonicFit) class SphericalHarmonicFit::Clockwork { public: Clockwork(unsigned int LMAX):LMAX(LMAX),coefficientsA(LMAX),coefficientsASq(2*LMAX) {} struct MStruct { unsigned int M; Genfun::Parameter *fractionAbsMOrHigher; Genfun::Parameter *fractionMPositive; Genfun::Parameter *phaseMPlus; Genfun::Parameter *phaseMMinus; }; struct LStruct { unsigned int L; Genfun::Parameter *fractionLOrHigher; Genfun::Parameter *phaseLM0; std::vector mstruct; }; std::vector lstruct; const unsigned int LMAX; SphericalHarmonicCoefficientSet coefficientsA; SphericalHarmonicCoefficientSet coefficientsASq; ClebschGordanCoefficientSet ClebschGordan; void recomputeCoefficients() { // Note, the calling sequence of the GSL Special Function forces us to // transpose Plm from its "natural" order.. It is addressed as P[m][l]. // double ampSq=0.0; std::complex I(0,1.0); double f=1.0; double fThisSum=0.0; for (unsigned int l=0;l<=LMAX;l++) { // lStructThis is zero if l==0; // lStructNext is zero if l==LMAX; const LStruct *lStructThis= (l==0 ? NULL: & lstruct[l-1]); const LStruct *lStructNext= (l==LMAX ? NULL: & lstruct[l]); double fHigher = lStructNext ? lStructNext->fractionLOrHigher->getValue() : NULL; double fThis = f*(1-fHigher); fThisSum+=fThis; double g=1.0; double gThisSum=0.0; for (int m=0;m<=int(l);m++) { // mStructThis is zero if m==0; // mStructNext is zero if m==l; const MStruct *mStructThis= ((m==0 || !lStructThis) ? NULL: & lStructThis->mstruct[m-1]); const MStruct *mStructNext= (m==int(l) ? NULL: & lStructThis->mstruct[m]); double gHigher = mStructNext ? mStructNext->fractionAbsMOrHigher->getValue() : NULL; double gThis = g*(1-gHigher); gThisSum+=gThis; if (fThis<0) { std::cout << "L-fraction correction" << fThis << "-->0" << std::endl; fThis=0.0; } if (gThis<0) { std::cout << "M-fraction correction" << gThis << "-->0" << std::endl; gThis=0.0; } double px=0.0; // phase if (m==0) { if (lStructThis) { double amplitude = sqrt(fThis*gThis); px = lStructThis->phaseLM0->getValue();; coefficientsA(l,m)=exp(I*px)*amplitude; } // L=0 occurs here: else { double amplitude = sqrt(fThis*gThis); coefficientsA(l,m)=exp(I*px)*amplitude; } } // Split it between positive and negative: else { { double amplitude = sqrt(fThis*gThis*mStructThis->fractionMPositive->getValue()); px = mStructThis->phaseMPlus->getValue();; coefficientsA(l,m)=exp(I*px)*amplitude; } { double amplitude = sqrt(fThis*gThis*(1-mStructThis->fractionMPositive->getValue())); px = mStructThis->phaseMMinus->getValue();; coefficientsA(l,-m)=exp(I*px)*amplitude; } } g*=gHigher; } f*=fHigher; } } }; inline SphericalHarmonicFit::SphericalHarmonicFit(unsigned int LMAX): c(new Clockwork(LMAX)) { for (unsigned int l=1;l<=LMAX;l++) { Clockwork::LStruct lstruct; lstruct.L=l; { std::ostringstream stream; stream << "Fraction L>=" << l; lstruct.fractionLOrHigher= new Genfun::Parameter(stream.str(), 0.5, 0, 1); } { std::ostringstream stream; stream << "Phase L=" << l << "; M=0"; lstruct.phaseLM0= new Genfun::Parameter(stream.str(), M_PI, -2*M_PI, 2*M_PI); } for (unsigned int m=1;m<=l;m++) { Clockwork::MStruct mstruct; mstruct.M=m; { std::ostringstream stream; stream << "Fraction L= " << l << "; |M| >=" << m; mstruct.fractionAbsMOrHigher= new Genfun::Parameter(stream.str(), 0.5, 0, 1); } { std::ostringstream stream; stream << "Fraction L=" << l << "; M=+" << m ; mstruct.fractionMPositive= new Genfun::Parameter(stream.str(), 0.5, 0, 1); } { std::ostringstream stream; stream << "Phase L=" << l << "; M=+" << m ; mstruct.phaseMPlus= new Genfun::Parameter(stream.str(), M_PI, -2*M_PI, 2*M_PI); } { std::ostringstream stream; stream << "Phase L=" << l << "; M=-" << m ; mstruct.phaseMMinus= new Genfun::Parameter(stream.str(), M_PI, -2*M_PI, 2*M_PI); } lstruct.mstruct.push_back(mstruct); } c->lstruct.push_back(lstruct); } } inline SphericalHarmonicFit::~SphericalHarmonicFit() { for (unsigned int i=0;ilstruct.size();i++) { delete c->lstruct[i].fractionLOrHigher; delete c->lstruct[i].phaseLM0; for (unsigned int j=0;jlstruct[i].mstruct.size();j++) { delete c->lstruct[i].mstruct[j].fractionAbsMOrHigher; delete c->lstruct[i].mstruct[j].fractionMPositive; delete c->lstruct[i].mstruct[j].phaseMPlus; delete c->lstruct[i].mstruct[j].phaseMMinus; } } delete c; } inline SphericalHarmonicFit::SphericalHarmonicFit(const SphericalHarmonicFit & right): AbsFunction(), c(new Clockwork(right.c->LMAX)) { for (unsigned int i=0;ilstruct.size();i++) { Clockwork::LStruct lstruct; lstruct.L= right.c->lstruct[i].L; lstruct.fractionLOrHigher = new Parameter(*right.c->lstruct[i].fractionLOrHigher); lstruct.phaseLM0 = new Parameter(*right.c->lstruct[i].phaseLM0); for (unsigned int j=0;jlstruct[i].mstruct.size();j++) { Clockwork::MStruct mstruct; mstruct.M=right.c->lstruct[i].mstruct[j].M; mstruct.fractionAbsMOrHigher=new Parameter(*right.c->lstruct[i].mstruct[j].fractionAbsMOrHigher); mstruct.fractionMPositive =new Parameter(*right.c->lstruct[i].mstruct[j].fractionMPositive); mstruct.phaseMPlus =new Parameter(*right.c->lstruct[i].mstruct[j].phaseMPlus); mstruct.phaseMMinus =new Parameter(*right.c->lstruct[i].mstruct[j].phaseMMinus); lstruct.mstruct.push_back(mstruct); } c->lstruct.push_back(lstruct); } } inline double SphericalHarmonicFit::operator() (double ) const { throw std::runtime_error("Dimensionality error in SphericalHarmonicFit"); return 0; } inline double SphericalHarmonicFit::operator() (const Argument & a ) const { unsigned int LMAX=c->LMAX; double x = a[0]; double phi=a[1]; // Note, the calling sequence of the GSL Special Function forces us to // transpose Plm from its "natural" order.. It is addressed as P[m][l]. //double Plm[LMAX+1][LMAX+1]; std::vector< std::vector > Plm(LMAX+1); for (int m=0;m<=int(LMAX);m++) { Plm[m].resize(LMAX+1); gsl_sf_legendre_sphPlm_array (LMAX, m, x, &*Plm[m].begin()); } c->recomputeCoefficients(); std::complex P=0.0; std::complex I(0,1.0); for (unsigned int l=0;l<=LMAX;l++) { for (int m=0;m<=int(l);m++) { { int LP=l-abs(m); double Pn= Plm[abs(m)][LP]; if (!finite(Pn)) return 0.0; // Once for positive m (in all cases): P+=(c->coefficientsA(l,m)*Pn*exp(I*(m*phi))); // Once for negative m (skip if m==0); if (m!=0) P+= ( (m%2 ?-1.0:1.0)*c->coefficientsA(l,-m)*Pn*exp(-I*(m*phi))); } } } double retVal=std::norm(P); if (!finite(retVal)) { return 0.0; } return retVal; } inline unsigned int SphericalHarmonicFit::lMax() const { return c->LMAX; } inline unsigned int SphericalHarmonicFit::numComponents() const { return (c->LMAX+1)*(c->LMAX+1)-1; } // The fraction of Amplitude sq which is L or higher inline Parameter *SphericalHarmonicFit::getFractionLOrHigher(unsigned int L){ return c->lstruct[L-1].fractionLOrHigher; } inline const Parameter *SphericalHarmonicFit::getFractionLOrHigher(unsigned int L) const { return c->lstruct[L-1].fractionLOrHigher; } // The phase of coefficient L, M=0; inline Parameter *SphericalHarmonicFit::getPhaseLM0(unsigned int L){ return c->lstruct[L-1].phaseLM0; } inline const Parameter *SphericalHarmonicFit::getPhaseLM0(unsigned int L) const{ return c->lstruct[L-1].phaseLM0; } // The fraction of amplitude sq which is L which is +- M OR HIGHER inline Parameter *SphericalHarmonicFit::getFractionAbsMOrHigher(unsigned int L, unsigned int M){ return c->lstruct[L-1].mstruct[M-1].fractionAbsMOrHigher; } inline const Parameter *SphericalHarmonicFit::getFractionAbsMOrHigher(unsigned int L, unsigned int M) const{ return c->lstruct[L-1].mstruct[M-1].fractionAbsMOrHigher; } // The fraction of amplitude sq which is +- M, which is positive inline Parameter *SphericalHarmonicFit::getFractionMPositive(unsigned int L, unsigned int M){ return c->lstruct[L-1].mstruct[M-1].fractionMPositive; } inline const Parameter *SphericalHarmonicFit::getFractionMPositive(unsigned int L, unsigned int M) const{ return c->lstruct[L-1].mstruct[M-1].fractionMPositive; } // The phase of the positive M coefficient inline Parameter *SphericalHarmonicFit::getPhaseMPlus(unsigned int L, unsigned int M){ return c->lstruct[L-1].mstruct[M-1].phaseMPlus; } inline const Parameter *SphericalHarmonicFit::getPhaseMPlus(unsigned int L, unsigned int M) const{ return c->lstruct[L-1].mstruct[M-1].phaseMPlus; } // The phase of the negative M coefficient inline Parameter *SphericalHarmonicFit::getPhaseMMinus(unsigned int L, unsigned int M){ return c->lstruct[L-1].mstruct[M-1].phaseMMinus; } inline const Parameter *SphericalHarmonicFit::getPhaseMMinus(unsigned int L, unsigned int M) const{ return c->lstruct[L-1].mstruct[M-1].phaseMMinus; } inline const SphericalHarmonicCoefficientSet & SphericalHarmonicFit::coefficientsA() const { c->recomputeCoefficients(); return c->coefficientsA; } inline const SphericalHarmonicCoefficientSet & SphericalHarmonicFit::coefficientsASq() const{ c->recomputeCoefficients(); unsigned int LMAX=c->coefficientsA.getLMax(); for (unsigned int L=0;L<=2*LMAX;L++) { for (int M=-L; M<=int(L); M++) { c->coefficientsASq(L,M)=0.0; for (unsigned int l1=0;l1<=LMAX;l1++) { for (unsigned int l2=0;l2<=LMAX;l2++) { for (int m1=-l1;m1<=int(l1);m1++) { for (int m2=-l2;m2<=int(l2);m2++) { if (m1-m2==M) { if (((l1+l2) >= L) && abs(l1-l2) <=int(L)) { c->coefficientsASq(L,M) += (c->coefficientsA(l1,m1)* conj(c->coefficientsA(l2,m2))* (m2%2 ? -1.0:1.0) * sqrt((2*l1+1)*(2*l2+1)/(4*M_PI*(2*L+1)))* c->ClebschGordan(l1,l2,0,0,L,0)*c->ClebschGordan(l1,l2,m1,-m2,L,M)); } } } } } } } } return c->coefficientsASq; } inline void SphericalHarmonicFit::recomputeCoefficients() const { c->recomputeCoefficients(); } } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/Landau.hh0000755000175000017500000000322507726364536022663 0ustar olesoles// -*- C++ -*- // $Id: Landau.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------Landau-----------------------------------------------// // // // Class Landau // // Joe Boudreau, November 1999 // // // //--------------------------------------------------------------------------// #ifndef Landau_h #define Landau_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class Landau : public AbsFunction { FUNCTION_OBJECT_DEF(Landau) public: // Constructor Landau(); // Copy constructor Landau(const Landau &right); // Destructor virtual ~Landau(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the mean of the Landau Parameter & peak(); const Parameter & peak() const; // Get the sigma of the Landau Parameter & width(); const Parameter & width() const; private: // It is illegal to assign an adjustable constant const Landau & operator=(const Landau &right); // Here is the decay constant Parameter _peak; // Here is the sigma Parameter _width; // The old cernlib routine does the work: double _denlan(double x) const; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/FixedConstant.hh0000755000175000017500000000354707726364536024237 0ustar olesoles// -*- C++ -*- // $Id: FixedConstant.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //----------------------FixedConstant --------------------------------------// // // // Class FixedConstant // // Joe Boudreau, Petar Maksimovic, Nov. 1999 // // // // FixedConstant allows use to treat "promote" fixed contants to constant // // functions so that they automatically will inherit all the algebraic // // operations we have so painstakingly defined for functions. // // // //--------------------------------------------------------------------------// #ifndef FixedConstant_h #define FixedConstant_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class FixedConstant : public AbsFunction { FUNCTION_OBJECT_DEF(FixedConstant) public: // Constructor FixedConstant(double value); // Copy constructor FixedConstant(const FixedConstant &right); // Destructor virtual ~FixedConstant(); // Retrieve function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a fixed constant const FixedConstant & operator=(const FixedConstant &right); // The value of the constant: double _value; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/BetaDistribution.hh0000755000175000017500000000333111672177604024721 0ustar olesoles// -*- C++ -*- // $Id: //---------------------BetaDistribution-------------------------------------// // // // Class Beta, x^(a-1)(1-x)^beta-1 Gamma(a+b)/Gamma(a)/Gamma(b); // // Joe Boudreau, Jan 2007 // // // //--------------------------------------------------------------------------// #ifndef BetaDistribution_h #define BetaDistribution_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/LogGamma.hh" #define _BETADISTRIBUTION_REVISED_ 1 namespace Genfun { /** * @author * @ingroup genfun */ class BetaDistribution : public AbsFunction { FUNCTION_OBJECT_DEF(BetaDistribution) public: // Constructor BetaDistribution(); // Copy constructor BetaDistribution(const BetaDistribution &right); // Destructor virtual ~BetaDistribution(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the paramter alpha Parameter & alpha(); // Get the paramter alpha Parameter & beta(); private: // It is illegal to assign an adjustable constant const BetaDistribution & operator=(const BetaDistribution &right); // Here are the two parameters alpha and beta: Parameter _alpha; Parameter _beta; // This function has a LogGamma Function; LogGamma _logGamma; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/FunctionComposition.hh0000755000175000017500000000330307726364536025465 0ustar olesoles// -*- C++ -*- // $Id: FunctionComposition.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------FunctionComposition-----------------------------// // // // FunctionComposition, result of composition of two functions. // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef FunctionComposition_h #define FunctionComposition_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class FunctionComposition : public AbsFunction { FUNCTION_OBJECT_DEF(FunctionComposition) public: // Constructor FunctionComposition(const AbsFunction *arg1, const AbsFunction *arg2); // Copy constructor FunctionComposition(const FunctionComposition &right); // Destructor virtual ~FunctionComposition(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const; // Dimensionality virtual unsigned int dimensionality() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a FunctionComposition const FunctionComposition & operator=(const FunctionComposition &right); const AbsFunction *_arg1; const AbsFunction *_arg2; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/LegendreExpansion.icc0000644000175000017500000000337411746557221025222 0ustar olesoles// -*- C++ -*- // $Id: #include #include #include #include #include #include namespace Genfun { FUNCTION_OBJECT_IMP(LegendreExpansion) class LegendreExpansion::Clockwork { public: Clockwork(LegendreExpansion::Type type, const LegendreCoefficientSet & coefficients):type(type),coefficients(coefficients){} LegendreExpansion::Type type; LegendreCoefficientSet coefficients; }; inline LegendreExpansion::LegendreExpansion(Type type, const LegendreCoefficientSet & coefficients): c(new Clockwork(type,coefficients)) { } inline LegendreExpansion::~LegendreExpansion() { delete c; } inline LegendreExpansion::LegendreExpansion(const LegendreExpansion & right): AbsFunction(), c(new Clockwork(right.c->type,right.c->coefficients)) { } inline double LegendreExpansion::operator() (double x) const { int N=c->coefficients.getLMax(); std::vector Pk(N+1); gsl_sf_legendre_Pl_array(N, x, &Pk[0]); unsigned int n=N; std::complex P=0.0; std::complex I(0,1.0); while (1) { if (n==0) { P+=c->coefficients(n)*Pk[n]; break; } else { P+=c->coefficients(n)*Pk[n]; n--; } } double retVal=0; if (c->type==MAGSQ) return norm(P); if (c->type==MAG) return abs(P); if (c->type==REAL) return real(P); if (c->type==IMAG) return imag(P); if (!finite(retVal)) { throw std::runtime_error("Non-finite return value in LegendreExpansion"); } return retVal; } inline const LegendreCoefficientSet & LegendreExpansion::coefficientSet() const { return c->coefficients; } } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/ParameterComposition.hh0000644000175000017500000000256410554745431025613 0ustar olesoles// -*- C++ -*- // $Id: //--------------------------ParameterComposition----------------------------// // // // ParameterComposition, result of composition of two functions. // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef ParameterComposition_h #define ParameterComposition_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/AbsParameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class ParameterComposition : public AbsParameter { PARAMETER_OBJECT_DEF(ParameterComposition) public: // Constructor ParameterComposition(const AbsFunction *arg1, const AbsParameter *arg2); // Copy constructor ParameterComposition(const ParameterComposition &right); // Destructor virtual ~ParameterComposition(); // Retreive parameter value virtual double getValue() const; private: // It is illegal to assign a ParameterComposition const ParameterComposition & operator=(const ParameterComposition &right); const AbsFunction *_arg1; AbsParameter *_arg2; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/FunctionNegation.hh0000755000175000017500000000322607726364536024732 0ustar olesoles// -*- C++ -*- // $Id: FunctionNegation.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------FunctionNegation--------------------------------// // // // Class FunctionNegation, output of the unary - operator // // Joe Boudreau, Petar Maksimovic, November 1999 // // // //--------------------------------------------------------------------------// #ifndef FunctionNegation_h #define FunctionNegation_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class FunctionNegation : public AbsFunction { FUNCTION_OBJECT_DEF(FunctionNegation) public: // Constructor FunctionNegation(const AbsFunction *arg1); // Copy constructor. FunctionNegation(const FunctionNegation &right); // Destructor virtual ~FunctionNegation(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const; // Dimensionality virtual unsigned int dimensionality() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a FunctionNegation const FunctionNegation & operator=(const FunctionNegation &right); // The function we're negating. const AbsFunction *_arg1; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/NonrelativisticBW.hh0000755000175000017500000000337711601353407025053 0ustar olesoles// -*- C++ -*- // $Id: //---------------------NonrelativisticBWDistribution------------------------// // // // // // Joe Boudreau, June 2011 // // // //--------------------------------------------------------------------------// #ifndef NonrelativisticBWDistribution_h #define NonrelativisticBWDistribution_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/IncompleteGamma.hh" namespace Genfun { /** * @author * @ingroup genfun */ class NonrelativisticBWDistribution : public AbsFunction { FUNCTION_OBJECT_DEF(NonrelativisticBWDistribution) public: // Constructor NonrelativisticBWDistribution(); // Copy constructor NonrelativisticBWDistribution(const NonrelativisticBWDistribution &right); // Destructor virtual ~NonrelativisticBWDistribution(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the paramter alpha Parameter & mass(); // Get the parameter beta Parameter & width(); private: // It is illegal to assign an adjustable constant const NonrelativisticBWDistribution & operator=(const NonrelativisticBWDistribution &right); // Here are the two parameters alpha and beta: Parameter _mass; Parameter _width; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/GenericFunctions.hh0000755000175000017500000000130207726364536024716 0ustar olesoles// -*- C++ -*- // $Id: GenericFunctions.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //--------------------------------------------------------------------------- // This header file includes other header files; in fact it includes // everything the user needs from the GenericFunctions area. // //--------------------------------------------------------------------------- #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include "CLHEP/GenericFunctions/FixedConstant.hh" #include "CLHEP/GenericFunctions/FloatingConstant.hh" #include "CLHEP/GenericFunctions/Square.hh" #include "CLHEP/GenericFunctions/Sqrt.hh" #include "CLHEP/GenericFunctions/Parameter.hh" clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/RelativisticBW.hh0000755000175000017500000000334111601353407024327 0ustar olesoles// -*- C++ -*- // $Id: //---------------------RelativisticBWDistribution---------------------------// // // // // // Joe Boudreau, June 2011 // // // //--------------------------------------------------------------------------// #ifndef RelativisticBWDistribution_h #define RelativisticBWDistribution_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/IncompleteGamma.hh" namespace Genfun { /** * @author * @ingroup genfun */ class RelativisticBWDistribution : public AbsFunction { FUNCTION_OBJECT_DEF(RelativisticBWDistribution) public: // Constructor RelativisticBWDistribution(); // Copy constructor RelativisticBWDistribution(const RelativisticBWDistribution &right); // Destructor virtual ~RelativisticBWDistribution(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the paramter alpha Parameter & mass(); // Get the parameter beta Parameter & width(); private: // It is illegal to assign an adjustable constant const RelativisticBWDistribution & operator=(const RelativisticBWDistribution &right); // Here are the two parameters alpha and beta: Parameter _mass; Parameter _width; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/HermitePolynomial.hh0000755000175000017500000000321612044565005025077 0ustar olesoles// -*- C++ -*- // $Id: //---------------------Hermite----------------------------------------------// // // // Class HermitePolynomial. (Hermite polynomials) // // Joe Boudreau, October 2012 // // // //--------------------------------------------------------------------------// #ifndef HermitePolynomial_h_ #define HermitePolynomial_h_ 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class HermitePolynomial : public AbsFunction { FUNCTION_OBJECT_DEF(HermitePolynomial) public: // Constructor HermitePolynomial(unsigned int N); // Copy constructor HermitePolynomial(const HermitePolynomial &right); // Destructor virtual ~HermitePolynomial(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the integer variable N unsigned int N() const; // Derivative. Derivative partial (unsigned int) const; // Does this function have an analytic derivative? virtual bool hasAnalyticDerivative() const {return true;} private: // It is illegal to assign a Hermite Polynomial const HermitePolynomial & operator=(const HermitePolynomial &right); // Here is the sigma unsigned int _N; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/AssociatedLaguerre.hh0000755000175000017500000000407607726364536025232 0ustar olesoles// -*- C++ -*- // $Id: AssociatedLaguerre.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $ //---------------------AssociatedLaguerre-----------------------------------// // // // Class AssociatedLaguerre. An associated laguerre polynomial L_n^k(x) // // Joe Boudreau, Petar Maksimovic, November 1999 // // // // // // Different definitions exist. These are taken from Arfken, Mathematical // // Methods for physicists // // // //--------------------------------------------------------------------------// #ifndef AssociatedLaguerre_h #define AssociatedLaguerre_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { /** * @author * @ingroup genfun */ class AssociatedLaguerre : public AbsFunction { FUNCTION_OBJECT_DEF(AssociatedLaguerre) public: // Constructor AssociatedLaguerre(unsigned int n, unsigned int k); // Copy constructor AssociatedLaguerre(const AssociatedLaguerre &right); // Destructor virtual ~AssociatedLaguerre(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} // Get the integer variable n unsigned int n() const; // Get the integer variable k unsigned int k() const; private: // It is illegal to assign an adjustable constant const AssociatedLaguerre & operator=(const AssociatedLaguerre &right); // Here is the decay constant unsigned int _n; // Here is the sigma unsigned int _k; // Here is the "work function" const AbsFunction *_function; // This function is needed in all constructors: void create(); }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/FourierFit.hh0000755000175000017500000000354111675636357023537 0ustar olesoles// -*- C++ -*- // $Id: //---------------------FourierFit-------------------------------------------// // // // Class FourierFit. This is a fitting function consisting of a super // // position of N legendre polynomials. Cascading fractions and phases are // // the input parameters. Function is normalized to one (on [0,2PI]) // // Joe Boudreau, Petar Maksimovic, January 2000 // // // //--------------------------------------------------------------------------// #ifndef FourierFit_h #define FourierFit_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { /** * @author * @ingroup genfun */ class FourierFit : public AbsFunction { FUNCTION_OBJECT_DEF(FourierFit) public: // Constructor FourierFit(unsigned int N); // Copy constructor FourierFit(const FourierFit &right); // Destructor virtual ~FourierFit(); // Retreive function value virtual double operator ()(double argument) const; virtual double operator ()(const Argument & a) const {return operator() (a[0]);} unsigned int order() const; Parameter *getFraction(unsigned int i); const Parameter *getFraction(unsigned int i) const; Parameter *getPhase(unsigned int i); const Parameter *getPhase(unsigned int i) const; private: // It is illegal to assign an adjustable constant const FourierFit & operator=(const FourierFit &right); // const unsigned int N; std::vector fraction; std::vector phase; }; } // namespace Genfun #include "CLHEP/GenericFunctions/FourierFit.icc" #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/RungeKuttaClassicalSolver.hh0000644000175000017500000000431212051300027026521 0ustar olesoles// This is a class the creates an N-Dimensional Phase Space // // It is for use in computing the time development of classical // // Hamiltonian Systems. // // Joe Boudreau October 2011 // //--------------------------------------------------------------// #ifndef _RKClassicalSolver_h__ #define _RKClassicalSolver_h__ #include "CLHEP/GenericFunctions/PhaseSpace.hh" #include "CLHEP/GenericFunctions/ClassicalSolver.hh" #include "CLHEP/GenericFunctions/RKIntegrator.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include namespace Classical { class RungeKuttaSolver : public Solver { public: // // Constructor--takes a hamiltonian and a point in p-space: // RungeKuttaSolver(Genfun::GENFUNCTION H, const PhaseSpace & phaseSpace, const Genfun::RKIntegrator::RKStepper *stepper=NULL); // // Destructor: // ~RungeKuttaSolver(); // // Returns the time evolution for a variable (q_i or p_i) // virtual Genfun::GENFUNCTION equationOf(const Genfun::Variable & v) const; // // Returns the phase space // virtual const PhaseSpace & phaseSpace() const; // // Returns the Hamiltonian (function of the 2N phase space variables). // virtual Genfun::GENFUNCTION hamiltonian() const; // // Returns the energy (function of time). // virtual Genfun::GENFUNCTION energy() const; // // This is in the rare case that the user needs to edit starting values. // or parameterize the Hamiltonian. Most users: can ignore. virtual Genfun::Parameter *takeQ0(unsigned int index); virtual Genfun::Parameter *takeP0(unsigned int index); virtual Genfun::Parameter *createControlParameter(const std::string & variableName="anon", double defStartingValue=0.0, double startingValueMin=0.0, double startingValueMax=0.0) const; private: // Illegal Operations: RungeKuttaSolver (const RungeKuttaSolver &); RungeKuttaSolver & operator=(const RungeKuttaSolver &); // Clockwork class Clockwork; Clockwork *c; }; } #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions/EfficiencyFunctional.hh0000755000175000017500000000203011675636357025540 0ustar olesoles// -*- C++ -*- // $Id: //-------------------------------------------------------------// // // // This functional returns the Likelihood of a functoin // // given some data // // // //-------------------------------------------------------------// #ifndef _EfficiencyFunctional_h_ #define _EfficiencyFunctional_h_ #include "CLHEP/GenericFunctions/AbsFunctional.hh" #include "CLHEP/GenericFunctions/ArgumentList.hh" namespace Genfun { /** * @author * @ingroup genfun */ class EfficiencyFunctional:public AbsFunctional { public: // Constructor: EfficiencyFunctional(const ArgumentList & aList); // Destructor: ~EfficiencyFunctional(); // Evaluate ChiSquared of a function w.r.t the data. virtual double operator [] (const AbsFunction & function) const; private: const ArgumentList _aList; }; } // namespace Genfun #endif clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions-config.in0000755000175000017500000000413012234340066022703 0ustar olesoles#! /bin/sh # @configure_input@ # we include the paths of the original install directories for reference orig_prefix="@prefix@" orig_exec_prefix="@exec_prefix@" orig_includedir="@includedir@" # use the full name of this script to get the current path configpath=`dirname ${0}` # check for a leading slash to determine if this is a relative path firstc=`expr ${configpath} : "\/"` calldir=`pwd` if [ ${firstc} -eq 0 ] then cd "${calldir}/${configpath}"; newpath=`pwd` binpath=${newpath} else binpath=${configpath} fi # OK - now we have to strip the trailing "/bin" out of the path prefix=`dirname "${binpath}"` includedir=${prefix}/include libdir=${prefix}/lib usage() { cat < /configure --prefix= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make check (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # configure options #------------------------------------------------------------- A variety of options can be given to configure. Below is a list of the options that you are likely to find most useful. --help provides a partial list of options --prefix=PREFIX install architecture-independent files in PREFIX [default is /usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [default is the same as PREFIX] --disable-shared build only static libraries --disable-static build only shared libraries --enable-exceptions use the CLHEP/Exceptions package --disable-exceptions DO NOT use the CLHEP/Exceptions package [--disable-exceptions is the default] #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are neither built nor installed automatically. Use the following commands to build and install documents: make docs make install-docs #------------------------------------------------------------- # building from cvs #------------------------------------------------------------- You will need current versions of automake, autoconf, and libtool. See building autotools below. cvs co CLHEP/package OR cvs co package cd [CLHEP/]package ./bootstrap Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building autotools #------------------------------------------------------------- If you do not have at least autoconf 2.59 and automake 1.9.1, you will need to build autoconf, automake, and libtool. On some platforms, you may also need to build m4 and texinfo. Download the relevant tarballs from gnu.org (http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/, and http://www.gnu.org/software/libtool/) Untar them in a common source code tree. Decide whether you want to install them in /usr/local or your own install directory. If you use your own install directory, use --prefix= with configure. For each autotool package: /configure [--prefix=] make make install Make sure that /bin is at the front of your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/GenericFunctions/Makefile.am0000755000175000017500000000453010233524355017705 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP # put . first so that CLHEP directory is built before anything else SUBDIRS = GenericFunctions . src test # list all subdirectories - for distribution and cleaning DIST_SUBDIRS = GenericFunctions . src test doc bin_SCRIPTS = GenericFunctions-config all-local: $(top_builddir)/CLHEP # create temporary CLHEP header tree # we only copy headers for packages listed in @PACKAGE@-deps # search for header directories in the following order: # 1. $(top_builddir)/this-package # 2. $(top_builddir)/../other-packages # 3. $(CLHEPSOURCE_DIR)/CLHEP # 4. $(CLHEP_DIR)/include/CLHEP # # abs_ => absolute path abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ COPY_P = @COPY_P@ $(top_builddir)/CLHEP: temp-package-dirs @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ if test -d "$$pkg" ; then \ (cd $$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d ../"$$pkg"/"$$pkg" ; then \ (cd ../$$pkg/$$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg"; then \ hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ else \ if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/include/CLHEP; then \ if test -d $(CLHEP_DIR)/include/CLHEP/"$$pkg"; then \ hdrs=`ls $(CLHEP_DIR)/include/CLHEP/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEP_DIR)/include/CLHEP/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ fi; \ fi; \ fi; \ fi; \ fi; \ done; temp-package-dirs: $(mkinstalldirs) $(abs_top_builddir)/CLHEP; @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ $(mkinstalldirs) $(abs_top_builddir)/CLHEP/$$pkg; \ done; docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs # extra clean rule clean-local: rm -rf $(top_builddir)/CLHEP clhep-2.1.4.1.orig/GenericFunctions/bootstrap0000755000175000017500000000071510233524355017612 0ustar olesoles#! /bin/sh set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 rm -f Makefile.in */Makefile.in */defs.h.in rm -f autotools/config* autotools/depcomp autotools/install-sh autotools/m* rm -f configure config.* # run autotool commands aclocal -I autotools autoheader automake --add-missing --copy autoconf # ready to make a source code distribution tarball clhep-2.1.4.1.orig/GenericFunctions/configure.ac0000755000175000017500000002751512241267303020145 0ustar olesoles# ====================================================================== # This is the GenericFunctions configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.59) AC_INIT(CLHEP GenericFunctions, 2.1.4.1, http://savannah.cern.ch/projects/clhep/, GenericFunctions) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([src/Abs.cc]) AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # ---------------------------------------------------------------------- # --enable-shared and --enable-static # both shared and static libraries are built by default # ---------------------------------------------------------------------- AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Header containing #defines: AM_CONFIG_HEADER([GenericFunctions/defs.h]) # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([GenericFunctions/Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([doc/Makefile]) AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([GenericFunctions-deps]) AC_CONFIG_FILES([GenericFunctions/copy-header.pl], [chmod +x GenericFunctions/copy-header.pl]) # Configuration inquiry program/script: AC_CONFIG_FILES([GenericFunctions-config], [chmod +x GenericFunctions-config]) # Test driver program/script: AC_CONFIG_FILES([test/testGenericFunctions.sh], [chmod +x test/testGenericFunctions.sh]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- GenericFunctions_CPPFLAGS="-I$includedir" GenericFunctions_LDFLAGS="-L$libdir" GenericFunctions_LIBS="-lCLHEP-$PACKAGE-$VERSION" AC_SUBST(GenericFunctions_CPPFLAGS) AC_SUBST(GenericFunctions_LIBS) AC_SUBST(GenericFunctions_LDFLAGS) # ---------------------------------------------------------------------- # Supply boilerplate for GenericFunctions/defs.h source header: # ---------------------------------------------------------------------- AH_TOP([#ifndef GENERICFUNCTIONS_DEFS_H #define GENERICFUNCTIONS_DEFS_H]) ## the undefs are converted by configure AH_VERBATIM([PACKAGE],[/* Name of package */ #ifndef PACKAGE #undef PACKAGE #endif]) AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif]) AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */ #ifndef PACKAGE_NAME #undef PACKAGE_NAME #endif]) AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #undef PACKAGE_STRING #endif]) AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif]) AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */ #ifndef PACKAGE_VERSION #undef PACKAGE_VERSION #endif]) AH_VERBATIM([VERSION],[/* Version number of package */ #ifndef VERSION #undef VERSION #endif]) AH_BOTTOM([#endif // GENERICFUNCTIONS_DEFS_H]) # ---------------------------------------------------------------------- # Account for any user configuration options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; icc) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Set system-dependent options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed libraries: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed header files: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed typedefs, structures, and compiler characteristics: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed library functions: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/GenericFunctions/GenericFunctions-deps.in0000755000175000017500000000006507720431750022401 0ustar olesolesCLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ clhep-2.1.4.1.orig/GenericFunctions/COPYING.LESSER0000644000175000017500000001674311406213111017672 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/GenericFunctions/doc/0000755000175000017500000000000013046323655016416 5ustar olesolesclhep-2.1.4.1.orig/GenericFunctions/doc/Makefile.am0000755000175000017500000000217011406213111020434 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif TEX = latex doc_srcdir = $(top_srcdir)/doc doc_builddir = $(top_builddir)/doc doc_installdir = $(prefix)/doc/@PACKAGE@ DOC_POSTSCRIPT = genericFunctions.ps genericFunctions.pdf DOC_INCLUDES = example.ps \ hydrogen.ps \ PartiallyClosed.ps \ TotallyClosed.ps \ WideOpen.ps \ psfig.sty SUFFIXES = .ps .pdf .dvi .tex .dvi.ps: dvips -o $@ $(@:.ps=.dvi) .dvi.pdf: dvipdf $(@:.pdf=.dvi) all: docs docs: get-includes $(DOC_POSTSCRIPT) get-includes: list='$(DOC_INCLUDES)'; for file in $$list; do \ if test ! -f $$file; then \ (cp $(srcdir)/$$file $(doc_builddir)/$$file); fi; done install-docs: $(mkinstalldirs) $(DESTDIR)$(doc_installdir) $(INSTALL_DATA) $(doc_builddir)/genericFunctions.ps $(DESTDIR)$(doc_installdir)/genericFunctions.ps $(INSTALL_DATA) $(doc_builddir)/genericFunctions.pdf $(DESTDIR)$(doc_installdir)/genericFunctions.pdf # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = $(DOC_POSTSCRIPT) $(DOC_INCLUDES) *.aux *.log *.toc *.dvi clhep-2.1.4.1.orig/GenericFunctions/doc/PartiallyClosed.ps0000755000175000017500000004642207705060311022060 0ustar olesoles%!PS-Adobe-2.0 EPSF-2.0 %%Title: PartiallyClosed.eps %%Creator: xwpick Version 2.20 Rev: 20/09/94 - by Evgeni Chernyaev %%CreationDate: Tue Aug 15 19:33:22 2000 %%BoundingBox: 0 0 482 631 %%EndComments %*********************************************************************** %* * %* Function: Display a Lempel-Ziv Welch (LZW) encoded color image. * %* This is an Encapsulated PostScript file suitable for any * % kind of PostScript printer: Level I/II, color/grayscale...* %* To optimize output on GrayScale printers you may uncomment* %* line '/GRAYneeded true def'. * %* * %* Author: Evgeni CHERNYAEV (chernaev@vxcern.cern.ch) * %* * %*********************************************************************** gsave userdict begin /EPSneeded true def %/GRAYneeded true def end %*********************************************************************** %* Image Description * %*********************************************************************** /colomns 482 def /rows 631 def /mm {2.835 mul} def userdict /EPSneeded known { /EPSneeded userdict /EPSneeded get def }{ /EPSneeded false def } ifelse userdict /GRAYneeded known { /GRAYneeded userdict /GRAYneeded get def }{ /GRAYneeded false def } ifelse EPSneeded { /IfRotate false def /MarginX 0 def /MarginY 0 def /Ymax rows def /Xmax colomns def /Ymin 0 def /Xmin 0 def }{ /IfRotate colomns rows gt {true} {false} ifelse def /MarginX 8 mm def /MarginY 18 mm def 0 0 moveto clippath pathbbox /Ymax exch def /Xmax exch def /Ymin exch def /Xmin exch def } ifelse /IfColor systemdict /colorimage known {true} {false} ifelse def GRAYneeded {/IfColor false def} if /IfLevel2 systemdict /filter known systemdict /setcolorspace known and {true} {false} ifelse def %*********************************************************************** % Procedures * %*********************************************************************** /Table 4096 array def /StrArray 10 array def /InLine 70 string def /BinCodes 112 string def /CurBit 0 def /FreeCode 258 def /CurCodeSize 9 def /CurMask 511 def /incr IfColor {3} {1} ifelse def IfLevel2 not {/setcolorspace null def /filter null def} if %*********************************************************************** /ReadLine { % Read Next Data Line (ASCII85 decode) * %*********************************************************************** BinCodes 0 BinCodes 56 56 getinterval putinterval currentfile InLine readline pop pop 1 1 14 { /i exch 1 sub def /k i 5 mul def /c1 InLine k get 33 sub 255 and def /rest c1 1868977 mul InLine k 1 add get 33 sub 255 and 614125 mul add InLine k 2 add get 33 sub 255 and 7225 mul add InLine k 3 add get 33 sub 255 and 85 mul add InLine k 4 add get 33 sub 255 and add def /k i 4 mul 56 add def BinCodes k c1 3 mul rest 16777216 idiv add 255 and put /rest rest 16777216 mod def BinCodes k 1 add rest 65536 idiv put BinCodes k 2 add rest 256 idiv 255 and put BinCodes k 3 add rest 255 and put } for } bind def %*********************************************************************** /ReadCode { % Read next code * %*********************************************************************** /CurByte CurBit 8 idiv def /CurCode BinCodes CurByte get 8 bitshift BinCodes CurByte 1 add get add 8 bitshift BinCodes CurByte 2 add get add CurCodeSize CurBit 7 and add 24 sub bitshift CurMask and def /CurBit CurBit CurCodeSize add dup 448 ge {ReadLine 448 sub} if def } bind def %*********************************************************************** /DecodeCode { % Decode CurCode * %*********************************************************************** ReadCode CurCode 256 eq { /FreeCode 258 def /CurCodeSize 9 def /CurMask 511 def /StrInd -1 def /Lrest 0 def ReadCode }{ L Lrest gt { /StrInd StrInd 1 add def /Lrest 65535 def StrArray StrInd get null eq {StrArray StrInd 65535 string put} if /CurStr StrArray StrInd get def } if Table FreeCode CurStr 65535 Lrest sub L getinterval dup 0 Table OldCode get putinterval dup L incr sub Table CurCode FreeCode lt {CurCode} {OldCode} ifelse get 0 incr getinterval putinterval put /Lrest Lrest L sub def /FreeCode FreeCode 1 add def FreeCode CurMask ge CurCodeSize 12 lt and { /CurCodeSize CurCodeSize 1 add def /CurMask CurMask 1 bitshift 1 add def } if } ifelse /OldCode CurCode def Table CurCode get dup length incr add /L exch def } bind def %*********************************************************************** /DisplayImage { % Display a LZW-encoded color image * %*********************************************************************** /DelX Xmax Xmin sub MarginX 2 mul sub def /DelY Ymax Ymin sub MarginY 2 mul sub def /SizeX IfRotate {rows} {colomns} ifelse def /SizeY IfRotate {colomns} {rows} ifelse def /FactorX DelX SizeX div def /FactorY DelY SizeY div def /Factor FactorX FactorY le {FactorX} {FactorY} ifelse def /ScaleX SizeX Factor mul def /ScaleY SizeY Factor mul def Xmin DelX ScaleX sub 2 div MarginX add add Ymin DelY ScaleY sub 2 div MarginY add add translate IfRotate {ScaleY ScaleX} {ScaleX ScaleY} ifelse scale /Palette currentfile 768 string readhexstring pop def currentfile InLine readline pop pop IfColor not { 0 1 255 { Palette exch dup /i exch 3 mul def Palette i 0 add get 0.299 mul Palette i 1 add get 0.587 mul add Palette i 2 add get 0.114 mul add cvi put } for /Palette Palette 0 256 getinterval def } if /Matr IfRotate {[0 colomns rows 0 0 0]} {[colomns 0 0 rows neg 0 rows]} ifelse def IfLevel2 { [/Indexed IfColor {/DeviceRGB} {/DeviceGray} ifelse 255 Palette] setcolorspace /infile currentfile /ASCII85Decode filter /LZWDecode filter def 8 dict dup /ImageType 1 put dup /Width colomns put dup /Height rows put dup /BitsPerComponent 8 put dup /ImageMatrix Matr put dup /Interpolate false put dup /Decode [0 255] put dup /DataSource infile put image }{ 0 1 255 { Table exch dup incr mul Palette exch incr getinterval put } for ReadLine ReadLine colomns rows 8 Matr {DecodeCode} IfColor {false 3 colorimage} {image} ifelse } ifelse } bind def %*********************************************************************** %* Image decoding * %*********************************************************************** DisplayImage fefefe 000000 828282 c3c3c3 a2a2a2 ededed 864545 ffffff 7acac5 68aca7 c5e8e5 416b68 ffffff 78a0d4 6688b4 c4d5ec 3e536e ffffff 9f9abe 8783a2 d5d3e3 545265 ffffff 3296c6 2a80a8 a3d0e5 194b63 ffffff e19c83 bf846f f2d3c8 775345 ffffff 768ba0 647788 c1cbd4 3b4650 ffffff 505e85 445071 adb3c6 252c3f ffffff 78a0d4 e1e1e1 afafaf 4b4b4b c8c8c8 ff00ff ffff00 ff0000 969696 646464 0000ff 00ff00 7d7d7d 323232 8a98b4 ffcc33 bbcfe9 ffff00 ccff00 ffcc00 cccc00 ff99ff cc99ff ff66ff cc66ff ff99cc cc99cc ff66cc cc66cc ff33ff cc33ff ff00ff cc00ff ff33cc cc33cc ff00cc cc00cc 99ffff 66ffff 99ccff 66ccff 99ffcc 66ffcc 99cccc 66cccc 33ffff 00ffff 33ccff 00ccff 33ffcc 00ffcc 33cccc 00cccc 9999ff 6699ff 9966ff 6666ff 9999cc 6699cc 9966cc 6666cc 3399ff 0099ff 3366ff 0066ff 3399cc 0099cc 3366cc 0066cc 9933ff 6633ff 9900ff 6600ff 9933cc 6633cc 9900cc 6600cc 3333ff 0033ff 3300ff 0000ff 3333cc 0033cc 3300cc 0000cc ff9999 cc9999 ff6699 cc6699 ff9966 cc9966 ff6666 cc6666 ff3399 cc3399 ff0099 cc0099 ff3366 cc3366 ff0066 cc0066 99ff99 66ff99 99cc99 66cc99 99ff66 66ff66 99cc66 66cc66 33ff99 00ff99 33cc99 00cc99 33ff66 00ff66 33cc66 00cc66 999999 669999 996699 666699 999966 669966 996666 666666 339999 009999 336699 006699 339966 009966 336666 006666 993399 663399 990099 660099 993366 663366 990066 660066 333399 003399 330099 000099 333366 003366 330066 000066 ff9933 cc9933 ff6633 cc6633 ff9900 cc9900 ff6600 cc6600 ff3333 cc3333 ff0033 cc0033 ff3300 cc3300 ff0000 cc0000 99ff33 66ff33 99cc33 66cc33 99ff00 66ff00 99cc00 66cc00 33ff33 00ff33 33cc33 00cc33 33ff00 00ff00 33cc00 00cc00 999933 669933 996633 666633 999900 669900 996600 666600 339933 009933 336633 006633 339900 009900 336600 006600 993333 663333 990033 660033 993300 663300 990000 660000 333333 003333 330033 000033 333300 003300 330000 000000 J,g]g3$]7K#D>EP:q1$o*=mro@So+\<\5,H7Uo<*jE<[!!Q\eL3@'nb-^757;Rp>:$SRl@ AlC^cenm@9:1l?8jS"!dTMT<$3[GQ$8#/E7'Y7iOF\er8C/kf[2Q^&^ioV%DqpO\mOaSHkmM-LULQp'q>adMhK,]E`kF= .k+$/jlb;*eos9Db@g$ASJ8+bV:96u3ZV2k8Ke*#Ftt0KUMFZ"bB3U:k4Z]ohb&%L4jOdM [^BqL]=ne7SOnBRjh*c0hfHs"D#5u)YA7S'mIgAi:+WT:de%is]FS#d$Rb60ptm^5b"(1^ rB($t0%6,n4g5=tP#=Gd/q!6UU^WB:ttd35q^?bP/!ti .18QS$o%<@;'\..54EAU)5V=&blC0ebFKBZ;/@Ns5&]cW(V=X>D&Xbj4EVsW;<+8j7P=U# ,/MS-Pj:E5UW4dl;8ekU[1[PNiMtH*3XmHVK;)DQ(`4@\J*n8UpSM[WLXlV1b/F&cp;:Lj_9iKRW9iY3D M0K2![C#g'!EHP0D-PU,c#m3UV8dBq%QnB,/iY[[,L-jKe-&^e#c'O;S\@+8Uj;A:ZN^.j_7?cgN8e7(M=Z09Hjr")# !9MmoD4BKES(jCp)=Dp"k>4&WTBM^qhk7kJ*f[#\QNiQfBj,DNWS0C\H`64ucF%(qdXJI' ll-9`Y0;4k`O"q;B#uuJgJ6S6TNb[o[dG*;`OSh"VX;(_42i5RDk%<*^Jinm"iKO$-"Fi4 *,]W4=o;nQalPX;;kA$"c5/SW4H_1b(mkN]) `Ui"fp!8'Rn3R#j[,`oR(5Nn4]u#2 _CUoW\JJX)8WkdE5EKPo,p]hbO=cJLaI*VfO0T-_BH[W!.,,;-F@MI7XgLaR$Rhhq7S?UY =/L6X-tU>@Q'1KmZ,mq:A6MimVhksT,[iF(e@_2B107-ESLl,_`_=cc,"lr^.]-IoQdQa# 9GFFk-:/u;WVTO-)':bFbUf(!`cKF]2`d_%EdSEf9hslP4<`eVRh2/=cY(-Z$l&;oZha#c !rkN]ba"i^-A*,W&H$3Gc_73'LW2q1n#2Y#U9U.,;0PZ&9?eE01j4p?qES@8X:h4+Q.rHN cV*MV0r@pqRT!C,:$KVWVPM%H+GtSCl30JP<=Ya&>)cDE77jIY/uDV%SQ"g-5C+u]!<>`o 107tMRHR>h,[-oTdM]uZ7UCI=kCW,C:-sKf@p1) X,/kgi"EW'C@>IF[*o"Wi3*21oVk,soTMHG3:]e!((X`cbN=5+jEbr(]WA9Q.!FkpY9 m>SB[Y-D.,-"/?u'=>39G$9T^B'j0?YSMd'>JtGr/K#P:G0tG:AWL^\e]Fs0q'=b49jm<; e[Tf8ESP,bE\:AF[FU)j;qn7f0!`I.(M;aaZqY5:p"s0/L%3lta`=RB^Ubpnl/&8OHPRX^ ^%Sc,Umob7DmKJZ&*\f*]n^_f8B@2;@dn>2\j [m'iDCcR8cSd!%jk7QXB94>(drP2rmrF3AI2oLice%QZG!QeG_W!RHug"j7Q\[^`uX5[+-dCD/mESGeE(I9H"LAW'ZqC[-*j7_c:K&! 2O?5J>dT)W\^q@d[)S-2BT_m,O3j2"2'RGe2fmJ=eRb/hN\]a8:EI#3TPP,JiVU6,mkW$n8m+Q3VC-kRP1.O9NsW*S]#O7Y?d5AVpZ(A"e*12&_%Ihc6p4/] ojg;++%3BoHHJPE1Q08k5ATZ!W>5"e/)?epC[GA_7tmpr86+^rsemJDs#.Pq#0VQI:`cbE!G#l r;9;U!,%rheEbm'!8mYA=X%QrB\*3`'>"g*Z.OCjYNT*DNY HZ5&hc"aljT(^7)N/N"$c M$qY_&M[o9&Q9ULTc=KU*)X*R0kbi0PoU4D'JP"WYk]9"V]IS+)U[(OES2*[2&Pko+Hatf N<^M`fcJO$+A^`3`N:5>\KB6Ja)Tu[Z"kCWdie1c+Yf^%0rH2C1Em1B,E];VZ1/kJ6QiYs )Y(]kni\.Yb8[`/(D3,`dH`.gW?^tX,t4jZ9#h',Bclm[k#*cOd,ua5q^GF0,I3(P;?nOh HIU;I.a8JPP-Z6,].Bo^!ncL*LNrk'0/ET/K1;s6kq&FEb,SK]! E"$0\lsir_Gqo%GL9B/?9bU?#+#=?0Eq]Kg`RLXL6C4%]KFU1nn3:giE1ES8Fh!bWEndf=a8$s!?=YZ)U1@gB-NfG3<@T;XtnjKM$ !j6Yt"k>C-eMg+-\M^W$-.PD`oj7L&@o&>S<@_K+&gp`QECF`f:NLk`F-d&q5?J>"=A#i" .nNfbO%L%]YLu!NEIE=l!?6,@24o!o!r2; "_%*2%oc\Ant@ZKj'=.b?$747[NT%e5n$bi@b%G3'uOO);.Hr0KGG#-Ft7)UL8_%X=4Qb= <`M2H%qeo(>EL.Fbs!J -#Ii0D^H-9G*d$r[nV#ZB[=G4G4fg_j!ZhuD&&s$pDD"r0lcqF(ig3o[hE]p"`)\e0(s]j WaBT8buE:]nFoDb'n(6A@rc]$?ahV'(EI]7X'uIqFYh3`[t/bq5:giuH(q'WG/\X$O%46< 9eK4f(>X:4$"D'es)YRG/dW8pdp?1mmTO0ac;CAnk"gN eq]6OI=YCnMmnCqW9&aieO'jTp%+qGFF<>]C?7BSB(rctf=Q@YA<_0Op^^eqNkFpXgQEEP Pdo>0q$+mL^PU7CNV"inNiJJ,\ic3Q6(*CaGt.!Ld;a)Dk_Qp8R,6[[$TlVdO1@iMGdWsG 5n3VjCR@fYB-T-5Yc9_*S@Qn7q9b`neX^HKS)RS,.RS9u$([LKT"46[q=1(;gQNHr!@I13 6J#>-r*fF&4;m7RAhfsQe"BkU@2]h2\f%3=%AEBiU.4ICPTQRp/YJ1eG?R/)l>:In2J2NB G`7?O>">:7=et%rY$,%.)C)()nYEH7Y&Kl-)GuM0hX$Q>T8X_e\p#J>K#X6\&9eR`X=L1s BTf]IQOksP[kF'BOchbNRJN`3<\hP'O/E@]FaC#c98dqX-(>62\GD*iHFCWC7@+Z:D45gO pa4%-hl>DFWtgl3[j,kXafTd=Xh&e\(MtYeb;N5[oXe[t_&Ge:r$S&iDBYJ$i`^&+;52iGCsl+B*%-G-fm)]-2Wp0ToK \minq]:ZlNV7dL#]j(ZS>SLXp$b\XlY8e_&--R%bE(dC_c?*?gV(Jh o;gQ;c5^#**)0g'3FeRAD)Q3n8-"g=T/@ABa/Tc54Engo]uY(>O(am#*(copqQnm=_'[LJ kkR,AEe\t@`-dMu4Jg2i$-QS]b9naY.^>cHS8;H(32ln:#R@Th\#mY#qHT-d)@&8U&TBt[\#SR:$U>>$!$EBT%m]p`WjO$F]Pg,\t]rN'YFVCPr9gFF(8#D:aD]j4pZ Gl>V:CA6M]S)!thZX'/>S_Ks2hJRc$EW,$<4mHWB[mqJ0F+*IprVPL.e9ZPri%+EVk6p4g /)^^LiC6]%FH,8!6fJ0NgV+r_Zk%ih0>tRBS3AiC?9=Ui5NA=>HThhuD4B%k2%nErbKV^<'XElTV`>EpN&2!U53*lb:=G*g&:nc^]1%"uCmaU:c#(c:"_smotn3W3**oZY+NUe.Bnj89*T$AGY+:nS["+rnu &=?EL)%D?giXm#@'FP&%7H4uIe8@8eO%87D)&/*&-'Lp^&t)_%=Y5q)UND fkn3&mM+tEVWi5W>4+>=eaE6]Jm@`r)l;QmKu7?h'H@;b)-XmdEZ#j_:-"6PjlmW[VJeJc ^#cR=)cTm%V:0/FH4:Xm+.C\pp)=n+X')jBkr)b:f'Z8>gMc6oNTUh/`P94Pr!l[J?,l&K o=OEsYFEn#!+VRV7r,N`mn!:\4V(W/g%.i5^0aoBO]_-o]UlXRDu]q,IA!3Mmpkl'rk>S: nGU'sPJ[(!YD`bb^FuA`#=6]&)[SfLU_N:5coVC6_,+qk$H'+7.1ehl/27R9d+ep>_@P-t !5Hnq.hXnj1etls;49?W`%_)O(r:,aEp#osZI'B#;;?L'_Jo-u+\%N/MUk>e>^$"[E;Zs? a>/+#,"bONEA"7hjMp%Lo)b7.9Z_D"2E+Q&d\P-/H;un!Xd%j+-M+&'5>/?4p6s=6rFWQ?:1n?D^;RE_M9N+pnG>;)8ANs#@m=e&.2YBLC!``6(&Q;][ UGl:U-oGX@f5-.Z>ZXqeK#6-iNIbM?ld^hlfZ?6[B3Fq^UM3nTV5nB8p;O@T>B],?Dd2r> T!2?t-('lkp-eEMWja99F!S4`dl6)tV;"XKkp>A89\6#:HVsOS7t"`bmJhW2N"3mnguRO^K=gAVHeE?Il0o$bdf98 g@WFd-sFQ+69gmX/%"6GRTm5=qg9HDinLWuh/-t/_m)s`-KVobq*+\j2I$<7]>HG%cbs0Q >][pHHl!#OE4Iis+**mQ8^"$eHk3>tGDAQ5ECql?btrfM]+IKE2cUT8M,-bC-Y*XY^%\pc:sj1SahbL^n/;ShGim%:$*qL57afW"kbYfQ]FGId.irq`2Tr(Ko- Q[*IUS&tVhpYEH/h`X-pW1RG\_`qU:rZB:ZIq9)g^Z,1l$!Zm_&/:g'GS"4);lqB#%%9C+ @0B>I'6c,;$P8[ZN1eS9K9$?M61^KHM@:&LA]>@qW)!a1$UKKE()NIm@gX@eLPD\g)j4;? E$=!fLS_F$P":1CiZ(BGOWWFS1?G1'@2Psa0 Og#<[c6rWP-/@@1'0r,4RF*c;<8F+/[P1Jj%ld+uejU7`A^>u@5,CC'Il![H(V0`Uq[/YS&G% ;)KPeRcCf[V,"_UC@8Xb1mr&Y2Qp1c[m->:a(=sJXP&KIAu]WoZdq1TcW_$BXQ+<-[MmLo eEq"E'pZ27^=UsU7.Hu2;RWune'?-8DO>!.Xk#\J>SOMY/aM]2o6MS/4,\/kj`7nGg?D6l W1@fOBY*_[m&%e\W\-/sY_l3FWdDd"D^pp_lA"rc$LrJFh<)>Rb3uOWkBek`3j7,SnR%P! HgSf<]GC(W?lShSDsYQ](9+FlZR(.'*Uur!:>O_.2h\8%$TiS;*a[?dU@?^3_iedI3-d<9 'D/"(.n41%Vhj9Z&`KtopcXq (!`'P4#W&f1gci"a]\<%?Z`?Ao?lgJ;s-M/q69=*;c>_Fj%Fs`[>H0OA_oF1KC,u6nWA_IJXL`0`l`Ag[2.Q74qMr^91;-H22"%V_ 03[c!OHXjWcIhPh?a_JWZDsM_Gh]]"j^]sL0(se$X;?II]/J?M(-UHM/k"9`p-V+I38?MI.qT@"JSQiFD $QZUGLML/.[nq5(i0cZn2suU9]5n15a_VK<3ZKXHGQ(ItBL=Q;Rl?g)Ac'/aet9OuRg_2^ )oDN"$]2uAqk*$a\>Vol@]/\@TZGpqHo:h8.u2MujeV?eP1RT%A(bi4@I*m8[-UkXN*TQs hcIRKlMgp*q4A2[r\<1&9EX9q0:1&b8$)Ib75k(p'D(fcf!8XY"amM`^qR]+qcjJnqS0d, m%,!j,kLY=H/GZKDsdE$Hh^D8;qo'b9`E^XppHls5MPEclLdBZ@4du?.3&#rnRfJpI]T=J W9a\o>Q;.d]>,&)5O8_B1I]*l$p\V<1TU6_gX&1o&&?Bj07pl"\uri=&O*90^D%6coC,&( V3bYaZodipZkPHX*41A>_;l.n98g(Y+[56:1& 6g1YGgd"79+2c;hP;GQD"@SIW6ad+^`+[K8H[nMC8INa2MW@Du\@=rKZ,GT@`:0Tk,Z"l- ;&gh"_(/a$Rg_ECdBmF"4"OGQ`$`"9LRU@c'%>j4<*bD->s;h-J]:!a7O+PF1!.FgB#\q(^>"4Y&tcQ=(.C4,`hSp@;MrL>YJt%>3'&9?gi(2rUT+.I 7^?,9oD'oT#f,eLa'l$hF0.l9GfB!Y['Y/fl__YFH:K^aa5aTs9Pd$PFUG4'7IuP5F,?Cq >.IbK7>"(MT`D)t=eTpB8GmSK<.2j"R`-]`7fglV7$Pbk]#e@a8PkmF,a\sMR2psLO=Z_[ oULtIS"RE68a1QCgYp9e'$;H^8hg^r6gVrm8kNUa8oZ7N1WM7$aZ7RO,a=pmWpMoB%jQ*h b1N+RUbBb+/!+0?`FOr[)`YYZ<\V1oYmd\VF9n0PW'[O"[fIS6ZuN]O?]re`4H.":HU1=. F;&2i*q[+TH_*1F,"F@79Q\$0KP3gPD+&KG4OZ5L,SEa9,e5Iea8EfbEsK)tdk"aVa99FS \X(AHL,k4+bp3EQ9ZYHSr60Q;8=<&n8>]+'N4;!cc'6W#SCl%)e')@]9U(9qo\LeiX#c`s :5k3p"C+T![P'^gcE+N%=ij=,CD<#qNGRJf%(_^OeetjbQ#qhOSFEALAP!Ka:M>U29W:Rh El*M+Phbl!7/B^$dSJPp:[J*&Pg$j9!KJH$-N+%14THDF!Dlqrcn"BXJN-J?[nqJ[+JenR [1&8D$QI%n;!JloPP!67<7(H^;%40_72-b"'iA-l;/+k6I2F3j)'1(B;6!)_,Q#m8da1O= b9\6$9ccQ2+c_O$Sn/ni3_Iglpjaj8;N3+BPopOL.FPm\'GW*k!.e&802ha&;[kH[*AUPF 1K-Fn;b],J>rGVu2cG,a;iNe9SN9]O-Os-<;p@I(h*+d)5?%MG<"2,l<@/qMJ:I ~> showpage grestore %%Trailer clhep-2.1.4.1.orig/GenericFunctions/doc/TotallyClosed.ps0000755000175000017500000004544607705060311021554 0ustar olesoles%!PS-Adobe-2.0 EPSF-2.0 %%Title: TotallyClosed.eps %%Creator: xwpick Version 2.20 Rev: 20/09/94 - by Evgeni Chernyaev %%CreationDate: Tue Aug 15 19:34:55 2000 %%BoundingBox: 0 0 479 631 %%EndComments %*********************************************************************** %* * %* Function: Display a Lempel-Ziv Welch (LZW) encoded color image. * %* This is an Encapsulated PostScript file suitable for any * % kind of PostScript printer: Level I/II, color/grayscale...* %* To optimize output on GrayScale printers you may uncomment* %* line '/GRAYneeded true def'. * %* * %* Author: Evgeni CHERNYAEV (chernaev@vxcern.cern.ch) * %* * %*********************************************************************** gsave userdict begin /EPSneeded true def %/GRAYneeded true def end %*********************************************************************** %* Image Description * %*********************************************************************** /colomns 479 def /rows 631 def /mm {2.835 mul} def userdict /EPSneeded known { /EPSneeded userdict /EPSneeded get def }{ /EPSneeded false def } ifelse userdict /GRAYneeded known { /GRAYneeded userdict /GRAYneeded get def }{ /GRAYneeded false def } ifelse EPSneeded { /IfRotate false def /MarginX 0 def /MarginY 0 def /Ymax rows def /Xmax colomns def /Ymin 0 def /Xmin 0 def }{ /IfRotate colomns rows gt {true} {false} ifelse def /MarginX 8 mm def /MarginY 18 mm def 0 0 moveto clippath pathbbox /Ymax exch def /Xmax exch def /Ymin exch def /Xmin exch def } ifelse /IfColor systemdict /colorimage known {true} {false} ifelse def GRAYneeded {/IfColor false def} if /IfLevel2 systemdict /filter known systemdict /setcolorspace known and {true} {false} ifelse def %*********************************************************************** % Procedures * %*********************************************************************** /Table 4096 array def /StrArray 10 array def /InLine 70 string def /BinCodes 112 string def /CurBit 0 def /FreeCode 258 def /CurCodeSize 9 def /CurMask 511 def /incr IfColor {3} {1} ifelse def IfLevel2 not {/setcolorspace null def /filter null def} if %*********************************************************************** /ReadLine { % Read Next Data Line (ASCII85 decode) * %*********************************************************************** BinCodes 0 BinCodes 56 56 getinterval putinterval currentfile InLine readline pop pop 1 1 14 { /i exch 1 sub def /k i 5 mul def /c1 InLine k get 33 sub 255 and def /rest c1 1868977 mul InLine k 1 add get 33 sub 255 and 614125 mul add InLine k 2 add get 33 sub 255 and 7225 mul add InLine k 3 add get 33 sub 255 and 85 mul add InLine k 4 add get 33 sub 255 and add def /k i 4 mul 56 add def BinCodes k c1 3 mul rest 16777216 idiv add 255 and put /rest rest 16777216 mod def BinCodes k 1 add rest 65536 idiv put BinCodes k 2 add rest 256 idiv 255 and put BinCodes k 3 add rest 255 and put } for } bind def %*********************************************************************** /ReadCode { % Read next code * %*********************************************************************** /CurByte CurBit 8 idiv def /CurCode BinCodes CurByte get 8 bitshift BinCodes CurByte 1 add get add 8 bitshift BinCodes CurByte 2 add get add CurCodeSize CurBit 7 and add 24 sub bitshift CurMask and def /CurBit CurBit CurCodeSize add dup 448 ge {ReadLine 448 sub} if def } bind def %*********************************************************************** /DecodeCode { % Decode CurCode * %*********************************************************************** ReadCode CurCode 256 eq { /FreeCode 258 def /CurCodeSize 9 def /CurMask 511 def /StrInd -1 def /Lrest 0 def ReadCode }{ L Lrest gt { /StrInd StrInd 1 add def /Lrest 65535 def StrArray StrInd get null eq {StrArray StrInd 65535 string put} if /CurStr StrArray StrInd get def } if Table FreeCode CurStr 65535 Lrest sub L getinterval dup 0 Table OldCode get putinterval dup L incr sub Table CurCode FreeCode lt {CurCode} {OldCode} ifelse get 0 incr getinterval putinterval put /Lrest Lrest L sub def /FreeCode FreeCode 1 add def FreeCode CurMask ge CurCodeSize 12 lt and { /CurCodeSize CurCodeSize 1 add def /CurMask CurMask 1 bitshift 1 add def } if } ifelse /OldCode CurCode def Table CurCode get dup length incr add /L exch def } bind def %*********************************************************************** /DisplayImage { % Display a LZW-encoded color image * %*********************************************************************** /DelX Xmax Xmin sub MarginX 2 mul sub def /DelY Ymax Ymin sub MarginY 2 mul sub def /SizeX IfRotate {rows} {colomns} ifelse def /SizeY IfRotate {colomns} {rows} ifelse def /FactorX DelX SizeX div def /FactorY DelY SizeY div def /Factor FactorX FactorY le {FactorX} {FactorY} ifelse def /ScaleX SizeX Factor mul def /ScaleY SizeY Factor mul def Xmin DelX ScaleX sub 2 div MarginX add add Ymin DelY ScaleY sub 2 div MarginY add add translate IfRotate {ScaleY ScaleX} {ScaleX ScaleY} ifelse scale /Palette currentfile 768 string readhexstring pop def currentfile InLine readline pop pop IfColor not { 0 1 255 { Palette exch dup /i exch 3 mul def Palette i 0 add get 0.299 mul Palette i 1 add get 0.587 mul add Palette i 2 add get 0.114 mul add cvi put } for /Palette Palette 0 256 getinterval def } if /Matr IfRotate {[0 colomns rows 0 0 0]} {[colomns 0 0 rows neg 0 rows]} ifelse def IfLevel2 { [/Indexed IfColor {/DeviceRGB} {/DeviceGray} ifelse 255 Palette] setcolorspace /infile currentfile /ASCII85Decode filter /LZWDecode filter def 8 dict dup /ImageType 1 put dup /Width colomns put dup /Height rows put dup /BitsPerComponent 8 put dup /ImageMatrix Matr put dup /Interpolate false put dup /Decode [0 255] put dup /DataSource infile put image }{ 0 1 255 { Table exch dup incr mul Palette exch incr getinterval put } for ReadLine ReadLine colomns rows 8 Matr {DecodeCode} IfColor {false 3 colorimage} {image} ifelse } ifelse } bind def %*********************************************************************** %* Image decoding * %*********************************************************************** DisplayImage fefefe 000000 828282 c3c3c3 a2a2a2 ededed 864545 ffffff 7acac5 68aca7 c5e8e5 416b68 ffffff 78a0d4 6688b4 c4d5ec 3e536e ffffff 9f9abe 8783a2 d5d3e3 545265 ffffff 3296c6 2a80a8 a3d0e5 194b63 ffffff e19c83 bf846f f2d3c8 775345 ffffff 768ba0 647788 c1cbd4 3b4650 ffffff 505e85 445071 adb3c6 252c3f ffffff 78a0d4 e1e1e1 afafaf 4b4b4b c8c8c8 ff00ff ffff00 ff0000 969696 646464 0000ff 00ff00 7d7d7d 323232 8a98b4 ffcc33 bbcfe9 ffff00 ccff00 ffcc00 cccc00 ff99ff cc99ff ff66ff cc66ff ff99cc cc99cc ff66cc cc66cc ff33ff cc33ff ff00ff cc00ff ff33cc cc33cc ff00cc cc00cc 99ffff 66ffff 99ccff 66ccff 99ffcc 66ffcc 99cccc 66cccc 33ffff 00ffff 33ccff 00ccff 33ffcc 00ffcc 33cccc 00cccc 9999ff 6699ff 9966ff 6666ff 9999cc 6699cc 9966cc 6666cc 3399ff 0099ff 3366ff 0066ff 3399cc 0099cc 3366cc 0066cc 9933ff 6633ff 9900ff 6600ff 9933cc 6633cc 9900cc 6600cc 3333ff 0033ff 3300ff 0000ff 3333cc 0033cc 3300cc 0000cc ff9999 cc9999 ff6699 cc6699 ff9966 cc9966 ff6666 cc6666 ff3399 cc3399 ff0099 cc0099 ff3366 cc3366 ff0066 cc0066 99ff99 66ff99 99cc99 66cc99 99ff66 66ff66 99cc66 66cc66 33ff99 00ff99 33cc99 00cc99 33ff66 00ff66 33cc66 00cc66 999999 669999 996699 666699 999966 669966 996666 666666 339999 009999 336699 006699 339966 009966 336666 006666 993399 663399 990099 660099 993366 663366 990066 660066 333399 003399 330099 000099 333366 003366 330066 000066 ff9933 cc9933 ff6633 cc6633 ff9900 cc9900 ff6600 cc6600 ff3333 cc3333 ff0033 cc0033 ff3300 cc3300 ff0000 cc0000 99ff33 66ff33 99cc33 66cc33 99ff00 66ff00 99cc00 66cc00 33ff33 00ff33 33cc33 00cc33 33ff00 00ff00 33cc00 00cc00 999933 669933 996633 666633 999900 669900 996600 666600 339933 009933 336633 006633 339900 009900 336600 006600 993333 663333 990033 660033 993300 663300 990000 660000 333333 003333 330033 000033 333300 003300 330000 000000 J,g]g3$]7K#D>EP:q1$o*=mro@So+\<\5,H7Uo<*jE:$SRl@ AlC^cenm@9:1l?8jS"!dTMT<$3[GQ$8#0$s<4Qi1SPQ1`C&f_pN .]&$IB=(iZON9k/Vnbi)98V4jL6H ]AdP812Tf;C!Pi1q@ZNHYC"+PG'd-4*uAk9n*T1`Xu;o/cgc.*db_`Wh='`TFM88ML[31W q7`Im0<.qD^(:\Uf/p1Rmde%%ldkmF/pi]a238e($+(6p+T8m5KBiq0a\2Pr5S0_[&[5*= 1BYA;;oo6]E's(-]o?i")9.U49_#K-F3+AAXt*3+3O-dm(V8"YCEpq/CPJ]WD8N=baYJgN XN>3^Rg$q)1oDqKMQEhS9(EUs-qgltbb%Ppm)_'.PA3fKZVt,b3R+m_00)dkbe#qlb9EcI ckHom6-tiJ%7AMW8ma/3F5n_N;,iN$8^`j*/PE*cA)[Qbo^+e;e.iE];:Lj\.6KKpI8*_l Q#0f.eeO&i<&O>KAR!b$c#m=DLfJ-j;jHa(@G$ktN/QN1*f2bO/>?VfEX_ZYs jeU4+QHd*]g_U;$D6p\<`H0iO9ndUD=#JNPhA;/EFu&f7ja5l$c&k^^2mr=.i"ue1H8=+G "bYbMQ3bXkfM3HBg_a6EL>j&Q/SANdSgfTXR-f0XZ5DF]OlVdN5fVkf/le1d)*8_#jdD-> N9/8i@@?9rard(W=h]$NkQiec`95haNLaa!2N+?pR?!HHl$@6DP%jGMa,.d>mY;KR*l_cP`oG)j:\b#b19iH.LLJ-+hPn-e>E;a]dO72KA=5!O!eg@4Dj#c1Lf6t(e(tG^hVUM!!Ta*u0=$6+raH&uqu/OIO8;LF WI0(7?b?"/*tQ'NTq?8Di-)7&ch)QJa2Rh'T5Wf`htuhjCMEX7kO/"M)gJ7EGQE`RlgV,6B8@ nBMq8fL6N`**%Zq+uI/Xso' @R%rdY_hEr)Mp/a"/*`S+s^%@M6]0;&Es9BA>1$+M)IK;.5N1om&>S6aR@%q>]SqBVh7M1 %)Kgf-KS4;BM]DD6P?dE-.Ac4o(l_:Jen2mI)0rc7Uf%h.iG&9b',M'Zo;*41nBl\/G!$4 9aS&f-IHFpO#h3jBu4AW1ut3+Q-ITp_`6Y_%%WDZG89B$1gh$hEg,"UcZdnXVpg\XPR`:A =q*d]71#Ye/r!3V(/,IRo:f2ZMG[P/7Hh].UJu,k;;+0'kli6+<0!,=2.]%g,q5ZiY*Mu> >taF90r@pqRSrDnXIt7J>4_hrdY_g9l30JMAN;sgO9>S5]!8.il"\\d=\l%4;6!U0U(a9C ;C2MUWJdLK._;9/M:/>;?!CI^FjsE;_cuDc@l#C1X43DC>&.$[Xc(K6_UrFV@MKo@Z'K9m=;pF7Wm!K/b@8[F.lCrj h4?k)K!VHb.qmK#V01>^e67c1A8=%7[L7E71>?M[D,$*;oodYURW35rc+R'LT&<]9DfG)T ]"&OCf>=#,F)1a#/9aSDh)2N>3fj2S_g?TU%41nWip?'>tS/kVSq8)Rr[`K _hkj/m+VY%F3O%1]N$7B-*^h1KR8"5LUFrh>_/(B$=?D3"h;'"B]0Ngo8ppD,&4JLq8/kba6#G8OBq;Pp3:WGIhLL[]DMeQ+VOj7UU \L+-3]\\Jha^N?$r*_)QJc50]-*j>%2FUIbPb*-o+ZWt%l'h(=.GfYE3NkH'SVg<<0"'"r h`p!=Ipbme>(`Yt3^GoA\9#q=f6AZX@!cTA3j-h!]@Q<8Rq1&1:B.0f`NJ\U&nX/m%RrQe h=,d?^+DPkVgM53ngfdDXj8Z-4Na8dA2AQ+D=?\8:R_>*PcT#Y)LO&:`--Lbkk,aqCj2FO:]PG0`rn(!RIKq%_/lB51&dcbci`' MI?Y/f_k33"]/7M0O"QOcNX_mp5dknE,u*,r4M%tt?E`6qJl6kE]6nBgUc!2F1T$:571OE@rC i6L\b@438s7TU)FpA^5.%+*h B3QEt(e`9Werd-Qnfmpn%14b[c#Ns@Z4qCXr*HSm"-;go"p5rf1A4)o")W4eYlPB?dj9#A g2]h4kQ'-g56Ifd,#UmT@!gA@$d-?=GX;Jc)jK`dKt%WW^@nlS'G>q'_k+EHSf,aM3*K#kZoY0R+;Bd;&a*\u1p:?%Ap( PV.,Ndl?^>*q]#%/I+Wp8J!u/M)-RLlB>1,;Zd(W5:$sj0^b1i%]Y5'h_sJZ1)!kK'+Hcs :dsE?mIN7(W@K^?LH*_Q3>6a";Niu%X#H4115-Z+15R.f\M`sJ.T=/@a/_?.2`;1Z4S,[+ oA;Zo]Mihk4Yu)>'A4\B?5m?^4;nG!<%m*_q /CW]&Z,]3g2+)<@6,hqP'JD:>7idNb5BJJAZqipVf*JCY*hmL>D''bCdjK$#,UQ3t8uei> @*hk`n.]RcPER7fjU#mO8$ol!eE'3Z*T>"sE!D95m9Y?)HC>Ep"+PUT7Hmo=Ha<&#C1:ZkDi5utB: >]mGWo]JqjlV4`"98=Ta27HpMND5X3R!?!&;ro:Wl`g5piYh#eC/c-fFo,[6Rr%6OD)PgD(fA1Fp^2tFI([lmVj5]IR86h`M& mP*[=lJmQ9ilEf2'2g)&hbOk:=a%u('>-A9pGaE2PS]+!1:E?;D-7RpGLd4@G:H*2>iF,D jX?AV=-DI-Z[%i!H.KTAG.o8(Y`eT7Q?TGdm`RV-q>b`M@MYSRZkAEn51H?\Y>ZYOtf )1@c-H+"rApHp^&k;,'c2KH>f:);s#q,aquBJrOo[bR%pTLYto1;q.`M"]lHWI1j&7nEH( [TqD4#b=cA0QLZ?f5Dq%)1U6_JZ%CYV0@Ue&g_`oE`K!fl:ZmlFbb3eLU_bfpjf0Kl$QA. >PNi,plUCmQ&0aQUf`@pf)6%hX!2UdMFPF#L,FiJXCE*OA2puTAXSF>EJt*5N)PXmprHRI bUG2NN@,l]R,O&T'kdYKc_X@8,Yl<&W ;hc`%=Y$Id+jV>nT[is:%O[o9p][9A/2_A\Mol.d2L\9<4U8>\YGD"`jU/ur4/)V 9+RRn_k/rDgY)+gXkB@?I@mTrTBibO[#^AG"-NCT$Pj`Gu4/"Mb&S^l&[q4!IY3MVZT UX_)p)<7Mr8"l@*U"SD$7bOSrT;:"ETGh3JR;n^"BifUXVYY;0:h-DK1T.g3@bPmqe]jod ?`9hPW;7I43bt[_Qsoi^V7N@uR[:$d*NH\4V:iDT3jc$#=f]-;W-YeO-I&Is)lq;gX:"Wj \":C>#&tQlUq53eg>'X_eZWbPJ-MpS\nA2A=0FXdT*bLDkgGG'F.u3KX/VdrNJ`J&,gAku P"\Qa-c3ubJpo`,K&j%_q[e#>YW/u iP[Mo_gGFpgf)2h1WDOf>l7_cHsOao?,iCVDqoWYV7jn.KuA@hhffCJV:EXRK?0REll7cm giLTMNH-#8`n[.u]VEW^S]CZ9Mk%?$\AQJOM9A#soUNj6>fk3m.EhY==IbU(*1>'SpW]5h EnnrT*7N34GKu`N>!24fh"utVrbJ&+=rcCXI.P^u%S[rWcoi.s]c5;2*gZa3=oB\.]dd0u /sBQsdp3/o>pI[$2O,:ENVrV%Zu=Im;1(1+eTgo=k0_`7h:;ede3*'H@U7R?jjsQ4c933! L@s/'gXh$SfA.b*#7]6i?e&GI_]>/u]K=ZWTN=:4,lN_P63%&f^u1;V1`d58KgOa[fQ8MK "TUsMO]\ts0c>s?j,r!dIR,->8E>q:1nIPnPtL-\-knjR0pt_tOVq]dEB0RbkEFTkrdcJa 9dl601sTr(V,HQBg3#TQ9qfu"Q!1C%P>SG_l]p2sIWJGgf^+^rc%=>W[9Ds^WtgrZEIum2 [p-8snTfuGmT8-hde/1-@.9BGjnfWh^gV5Mgibk=LW&99Yq1W:0q#l=ZC0H*>;`,%B^=?q p7,Z+9/-gKh8E7BkH]Z$V'>G4LnTZ)lVjkBVnG,.pf_8aXPjNgmSduXpe+iNYIm;7hkl;prKAsh`E!e;u 5Hi!>r?BSZcND$,":"u]cnm$S5;6TerPL9f1C(f/$n2Od:qT4"`$h\d&4(4c71m'b.q971 &PO,`6ZL=W(d='-B!TF\P]%)G;.I]I]ag9QlGrGsa!"$2oTq!dnoUJ(8i!Dh.SFXNY:MD& UqEPIZQjBB9I_m,1X37H.5]:A,hY-%ZLm0;.2*]g5#8N'nsI^dm0Th6_Uk% 'hCp$Po@0[oSkLWdWD:;4jt,;@nj/6[6IPGP\!17<-9cnbgc;QR82:tPgN3*lE+&hf.84R >9J(*;[unf'o-7#[Pa+V=Z09HAm)QbT4hCdQ)A%@Q0!@"\+S9(oI;c4D/?$>27GX$WeJ2h gb,/>79mu`d8XCC/]W$/[rS$a<&^#5HI4[_V-;KW?"0[;QgDD8WL(jgIAD*G%k?Nf?5H43 dd+p@@MA/T[pV00kCPn,]NG$j;s$'4ifn=4P,$ZY9c.FK#$"%PLsBQ8jqkI4_dh?sokbq! IX.JN3Q?E%UUh4qCRp6(eTcu_F:l166rSn=2kXVL.?(:>saM;Gp.lk2d5U25m6 baiSaQ5Ylq)g%pd3?"^3Y3ij5X1Y>LPh!>j48/[:E%/O,0^uTu&LMKhB,N7?aSudl2r'V! WUFqPQD!ghbAYY%>bn"8A_eD;d;aR&4GEGhB3,di]UrQ`+[)-tg-GTd>MOEN5BjC,\i4KO GYG:;j*::,KB45I,D5.QhFC<(H7Hs#TR-U<1Z,-;c_KaerqlfdV#\EcA 5CVMYHsY>*mO/%XpG&kiP.rhGrE?i6E"DpC4u\`-Rg]Q`O9h"76n8A/'G*278DHj"8%3"KdG_Gr /[4;t6kblZR3EP`d3./]U-B;$<).7,4mFKkLo)AimtP_s/4''I*K2S2OjXWWBbKr;Cl=5b 3/0gXP^27DO_M+Q9G,pYDW.[22U"?^_t(2a:#qB`P-.cooa*)Rgoa,0^n&XsV_&T&[PBTI ]u/D!0::P-,;S3,9M']h=7jQY'.D>R`]#]MXO'42$*$]fm,@*CUR2]AD)@Zj\Q@k,S)dUa *LV#9-*69snhs2lRG(DK8Xaa"h=+49-TKfWj_>CmDU6GUB4qBYBJ^3E:GlPO)*J:2Zk@jC q@;*?Jo@/87Z"?!.`*UG:ngoDh+ppg57DnjUrGHSc'h'a.!4TR%%`R/g)=$A8W8-UgqqLF /O<0t,UW0I_Gcm<&1H8bW!'E"(cmLABO*HiXl?0V=^+bT"\C"_/AT'$ZsK`mlDi%)X:hPE ?>ARsW797aQ+G+E.m4`HFfA_K3b(Ef[;`,;[]$MMh+0'@,*Rj8@)jba?.n%`Top0_9kE]E lh+tp0$GsGg XA=e`[b&\A5uh`\P)]!p8_^*dpM@g)Sot8J7GCI7TCp732JTfBqe&h[1L%7e6KtX&&TdBZ aHKWkh\<,#>&LG?\*n4$gfHjemZ"9ZF:$$m(dR ^fU4l?h`N0=H3Kg3#.3P@\%d:rTC)u:BhlnTnSBt(q-L2$!>,m2t6Ju_A=R3fj#"cEBS-W 2hr-lA5H5[H!8-&V[^-ED1h=WD9$NA*&igdJ$GPt`46>ujBNL`h,[+LR4fZ!]RpVA[Sjg5 CA"?j9 iS$u^=>T5RchX0e`Km9mn4&.U\]ODU\3Hg#[Y<-8gI13f.3Z(j>LNbN7m5ZeV!OYj\[XK( C,c*j?uDN-N>#>s#a1;BF=#KVUJ'MQAZ`>*YLN$q)I^MMXQAf1ZRj'S! (.GS[S2biKs'03>7.2jRg-ctjl]_T27RX3gK-@_']Lk;QRmtV ^UQ33DQCC6pm$?D4G('D8[h!9AS?o\Bro)XV cZ@t!f=OD1dtkWfHS3!Dl$*..CqK!AlZudPp>1X`]I/WMhAqLKSNl0rT6T9Mfo`R)/_L!A &>ZRC3-j4tjI'<.[k\nGGJ=NIL["mRt@pIh)4$/"D!IcgnEf?2F6+kdI*4pH*$EkeDc>lsIcfs"E^9 ?Y?DXK>]m" $'Le\*399._[jQ1e3N$&0!jM#KF5A^$]9j+_,M&[CDf=hC-dLi_3>hRU`.(V)jZEr4ZjOs `#cbe+2S.'_@^HIe(VV%Vm+8E]VHd64=#kP'1-,(3eSfrM'"G\$UUhP6?*B"Ub%P]/X7#& _XQhX!>@g70p8mo_)sOjX>6$A1W*VU6ZBP%J_iD/'UJ)ISI:Ar1d&\99>f081"80,.cn'@ (;*QN0_$F"j9cK=RDVuE[AbC`$qIWKb-e5t2=*pAr&L#&9#TbA6o7QG>Z&F%:n!V7`6;1< &jrSWeAW,#7;P[d8_6C1*^mA=6c(IWUfYKM9Z<2W7ES:ln@umb,9+!l5td&'oNK5(=$PGk `_kg6Rr:aF?q(F"`ggI,KM9CrY/H8D2CjM3l]+@@lMksL;N7O]`T4Euj% H&B6qa0[isHh'\[>t;`-8,6E2$!YHOJW1@qS)f5;A;(@QI7Rbs89'4%M,hWaU<&"FN?!kE "H=-ANZMB67H8b=F0ishTI@^T8L%D11k*2[Qpa4a`_'"DnE;i9l44St8[0=)/*`2*n4D:+ 7p/m7F8j:4*"`K&O\m;lkop]&rk8N58oYCR8OUZ[R7PMHTR^H- 2bLX[8i[(g.O[b[R(8\gbC!J]A(W!Q[?'*W7JSa_8et')Y"K2730Mk:%(a*QY"&>lb;hK( l8L9$]$)^mb%+Am0b)9aYtW*E5;XS)KTSXE:JCj7%nS"fWLJrR[m^_SNf9X"`*P?,9G;fn Lif_bXNd$+>J4R\Rrm=.bJM;6X\IeLa?5LlI,LfJiY;%F%8>gs`8rEfjqPJk.?<)#sqD^g!;*5cT15b`:Su#or\Gl'IY e@n_pp.oN(McBOIV#^t3!`0=.$O$Z0;)1sZ#*RdF022c"Tn-%*$IHa#PQ_*pFUldk&((Ol d1m8@,neT_'@B5_d8^q/AJW[9(X[pRd?PTsV&I\U):>i3dFB8bjW;hB+4:<8dM3KnKF*G? ~> showpage grestore %%Trailer clhep-2.1.4.1.orig/GenericFunctions/doc/.cvsignore0000755000175000017500000000001407746044120020411 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/GenericFunctions/doc/hydrogen.ps0000755000175000017500000014740407705060311020606 0ustar olesoles%!PS-Adobe-2.0 EPSF-2.0 %%Title: hy5.eps %%Creator: xwpick Version 2.20 Rev: 20/09/94 - by Evgeni Chernyaev %%CreationDate: Tue Aug 15 19:39:58 2000 %%BoundingBox: 0 0 520 510 %%EndComments %*********************************************************************** %* * %* Function: Display a Lempel-Ziv Welch (LZW) encoded color image. * %* This is an Encapsulated PostScript file suitable for any * % kind of PostScript printer: Level I/II, color/grayscale...* %* To optimize output on GrayScale printers you may uncomment* %* line '/GRAYneeded true def'. * %* * %* Author: Evgeni CHERNYAEV (chernaev@vxcern.cern.ch) * %* * %*********************************************************************** gsave userdict begin /EPSneeded true def %/GRAYneeded true def end %*********************************************************************** %* Image Description * %*********************************************************************** /colomns 520 def /rows 510 def /mm {2.835 mul} def userdict /EPSneeded known { /EPSneeded userdict /EPSneeded get def }{ /EPSneeded false def } ifelse userdict /GRAYneeded known { /GRAYneeded userdict /GRAYneeded get def }{ /GRAYneeded false def } ifelse EPSneeded { /IfRotate false def /MarginX 0 def /MarginY 0 def /Ymax rows def /Xmax colomns def /Ymin 0 def /Xmin 0 def }{ /IfRotate colomns rows gt {true} {false} ifelse def /MarginX 8 mm def /MarginY 18 mm def 0 0 moveto clippath pathbbox /Ymax exch def /Xmax exch def /Ymin exch def /Xmin exch def } ifelse /IfColor systemdict /colorimage known {true} {false} ifelse def GRAYneeded {/IfColor false def} if /IfLevel2 systemdict /filter known systemdict /setcolorspace known and {true} {false} ifelse def %*********************************************************************** % Procedures * %*********************************************************************** /Table 4096 array def /StrArray 10 array def /InLine 70 string def /BinCodes 112 string def /CurBit 0 def /FreeCode 258 def /CurCodeSize 9 def /CurMask 511 def /incr IfColor {3} {1} ifelse def IfLevel2 not {/setcolorspace null def /filter null def} if %*********************************************************************** /ReadLine { % Read Next Data Line (ASCII85 decode) * %*********************************************************************** BinCodes 0 BinCodes 56 56 getinterval putinterval currentfile InLine readline pop pop 1 1 14 { /i exch 1 sub def /k i 5 mul def /c1 InLine k get 33 sub 255 and def /rest c1 1868977 mul InLine k 1 add get 33 sub 255 and 614125 mul add InLine k 2 add get 33 sub 255 and 7225 mul add InLine k 3 add get 33 sub 255 and 85 mul add InLine k 4 add get 33 sub 255 and add def /k i 4 mul 56 add def BinCodes k c1 3 mul rest 16777216 idiv add 255 and put /rest rest 16777216 mod def BinCodes k 1 add rest 65536 idiv put BinCodes k 2 add rest 256 idiv 255 and put BinCodes k 3 add rest 255 and put } for } bind def %*********************************************************************** /ReadCode { % Read next code * %*********************************************************************** /CurByte CurBit 8 idiv def /CurCode BinCodes CurByte get 8 bitshift BinCodes CurByte 1 add get add 8 bitshift BinCodes CurByte 2 add get add CurCodeSize CurBit 7 and add 24 sub bitshift CurMask and def /CurBit CurBit CurCodeSize add dup 448 ge {ReadLine 448 sub} if def } bind def %*********************************************************************** /DecodeCode { % Decode CurCode * %*********************************************************************** ReadCode CurCode 256 eq { /FreeCode 258 def /CurCodeSize 9 def /CurMask 511 def /StrInd -1 def /Lrest 0 def ReadCode }{ L Lrest gt { /StrInd StrInd 1 add def /Lrest 65535 def StrArray StrInd get null eq {StrArray StrInd 65535 string put} if /CurStr StrArray StrInd get def } if Table FreeCode CurStr 65535 Lrest sub L getinterval dup 0 Table OldCode get putinterval dup L incr sub Table CurCode FreeCode lt {CurCode} {OldCode} ifelse get 0 incr getinterval putinterval put /Lrest Lrest L sub def /FreeCode FreeCode 1 add def FreeCode CurMask ge CurCodeSize 12 lt and { /CurCodeSize CurCodeSize 1 add def /CurMask CurMask 1 bitshift 1 add def } if } ifelse /OldCode CurCode def Table CurCode get dup length incr add /L exch def } bind def %*********************************************************************** /DisplayImage { % Display a LZW-encoded color image * %*********************************************************************** /DelX Xmax Xmin sub MarginX 2 mul sub def /DelY Ymax Ymin sub MarginY 2 mul sub def /SizeX IfRotate {rows} {colomns} ifelse def /SizeY IfRotate {colomns} {rows} ifelse def /FactorX DelX SizeX div def /FactorY DelY SizeY div def /Factor FactorX FactorY le {FactorX} {FactorY} ifelse def /ScaleX SizeX Factor mul def /ScaleY SizeY Factor mul def Xmin DelX ScaleX sub 2 div MarginX add add Ymin DelY ScaleY sub 2 div MarginY add add translate IfRotate {ScaleY ScaleX} {ScaleX ScaleY} ifelse scale /Palette currentfile 768 string readhexstring pop def currentfile InLine readline pop pop IfColor not { 0 1 255 { Palette exch dup /i exch 3 mul def Palette i 0 add get 0.299 mul Palette i 1 add get 0.587 mul add Palette i 2 add get 0.114 mul add cvi put } for /Palette Palette 0 256 getinterval def } if /Matr IfRotate {[0 colomns rows 0 0 0]} {[colomns 0 0 rows neg 0 rows]} ifelse def IfLevel2 { [/Indexed IfColor {/DeviceRGB} {/DeviceGray} ifelse 255 Palette] setcolorspace /infile currentfile /ASCII85Decode filter /LZWDecode filter def 8 dict dup /ImageType 1 put dup /Width colomns put dup /Height rows put dup /BitsPerComponent 8 put dup /ImageMatrix Matr put dup /Interpolate false put dup /Decode [0 255] put dup /DataSource infile put image }{ 0 1 255 { Table exch dup incr mul Palette exch incr getinterval put } for ReadLine ReadLine colomns rows 8 Matr {DecodeCode} IfColor {false 3 colorimage} {image} ifelse } ifelse } bind def %*********************************************************************** %* Image decoding * %*********************************************************************** DisplayImage 040505 fcfdfc 613ce4 29db3c aa1237 65ccde 060590 d97bf1 777576 04494b c7c9c8 0705f1 05042e 2faf95 d7cfd2 ce477d e6e9e7 7d1b91 acabad 046104 6d6f6d 14af04 050350 9698f2 050370 442753 eeecee 3c80c6 babbba 3e07ca 6a696a 8168bc cbb8c9 3946b0 0706b1 17a550 0806d2 6577f2 d8d7d9 75085d 0b1471 7dc49d 0b1391 b34cad 1708d2 4da7ff 0b1553 edacf6 171770 248085 1609b2 4f0596 171851 9e7d96 a79ea8 0c477d 0b1412 624893 0b13b0 b1cbf6 161590 2cabce 0b1332 5da1a5 160b93 9b6bf8 555556 b07ac3 1707ef 8e48d6 5e595e 2ad567 160a71 753259 28272b 3c9c62 161736 95367d 1714b0 45066e 160854 651ace 1414ce 044822 4f4d53 7c37ab 160310 ee8bd6 f4dcfd 3443d6 2904d1 7887d6 2a04b0 5028a3 2f2f31 1eaa27 172466 45c682 290c92 cb9cf4 2b1592 6359ce 2a0cb1 788aa2 2b0492 7c5af5 2708ef 4ab8b8 251d2a 6968a0 290cd3 b563e2 1413ed a51c59 160430 ca8bb1 192341 652a7d 2915ae 410649 17208f 954b9d 2b0772 b098d3 40069b 659bea 2a1473 30bc4a 8a878c 815984 827b8e 2c88a2 9a9ba3 99baec 806a7c 4e376b 281c73 8e186c 9aa8ab d0b9f9 161fab 1e9265 2a1954 6348b0 282568 30b96e 2914d8 4593ac b2a9f8 ae8af7 b5b8f7 17c41c b099fb 8479f3 290651 4d57de 270329 4e28cd dfc9fa 78388a 2a208e 344b4d c7cbf8 9b6ac6 451773 ca9fc2 d3adf3 918ad4 9b7cf6 aecbcf 4013cd 053562 665a8f 7d99f2 9489f6 c3dbe5 8f8baf 8258a5 8479be 4a4b92 42179c 6d8b75 63045c ae87aa 411852 073290 8268ef 66196d 97a9ed 40aa85 7c5cce 6018a0 6429a1 7d39d0 2a21ae 6657f0 1abb47 9a5ea8 603b72 4a55ab cfabcd 27a573 7a4bcb 299e88 453a4b 4b38b6 9d7bb9 493491 9758e0 822775 073840 16d13a 482874 5d8dad cd87fa 4938da efb8fb 652ed4 5e4ace b775ec 20ba6b 826898 996e9a 880e58 644967 b26fb2 6337a3 799b99 045215 8148f0 600895 45a7b1 687595 7727d0 7d4c8f f09dda aa89cf 3224d8 696ae8 5216cb 4b48e0 29a64f 634cf3 f4caff 6659b3 902581 10a930 39ba8e 40279e 7b4aaa 1f1ed7 2e9493 2bd249 0eb710 7d2aaa 349569 J-5sN-m1hc#D>EP:q1$o*=mro@So+\<\5,H7Uo<*jE<[.O@Wn[3,!%3-5/Z&Y^&(6>q_R= AlC^cenm@9:1mM9jS"!dTMT<$3[GQ$8#0$pZB0U(!Y>K#JQ4b-i&E,SJ__f"]Zuj.aPjkAqjjZo)*;ZYd2,DKfH$ne"tIt@sWR:+'5St\oqt>?PY`Hk4/6D\%aSKbLc7V`8.Ue@lpFY q7RlQs0(5D\hqIc#i&W4j0mr^=UPlV2"\BP-\LFf(4MU?bYnR-W`si oo!;0$N/K]bdOn'@fr$tPiY^KWp7l7P:_1ibKA(Z(Ypu\^FI[SSEjWi9*M4f966s"44b-( #t<,PfHGmj[`liee[RJWhHR"NGR.8E]ug=bR,o'1j,14m/mAf\4-!GD:]WjeEonS/Y$gBm WTJFN3G7,^`PAKW\1RT*k#g^LWoPhQ-!/?Wb?\UZeZuYfADdYjQ,AqgCJi"$%ZPdA<92Yr Y'U?TFQJO8T3u(f:_X4&2Qb)3B"'pq4(fD";`q)1jJdN/i@k:707'G/WGM2rFQdZ<(C@K! RBC#$==^8bR95lZh-0@G(!E6?30cPPJ_?Y_Hf3VA2lB[2QFG=_qUM.XE>foL^t_%Y#C>PQ miaITghjO'g&)3DhZOSaj*+lL4O'j'YV-Zqn*ht8G?L6^]-YSIB=7+'T#\MjHkLqH*\2Tf ?S:Gbs%/YWSla_)I5F@nkI'W[!DI78c=<^@R8npSQl>m6Y(8)Vf2B6MSk'G9SChZeiM5OdKFuRTqJbn;#2$nS1G*!RBbiLa'Nc.MQVf$J,jQQ_8A]b 9Vr`9BVN51qgj[O_4`W_Nm/Qn=D^nIJi]9`s.X!NNXWoj7gQ.7R>bQdCMBq$34eM0XH[^b;?O5Gk004j?(5Z01.=\^3$OfoT$Q,/\Ap0DgD%8TVI;j1 $"2eW/;'EI10ZB1MOJ3GMfNeT5YfmY1a^DkQdZuIcZf4#Ro<`GEtk[ap7c5tFA\\^d/kW6 `A4bV^oCeo@Fi(q"@FH%#L9hBIKVR7J,@,afoQ!I-2%*GACERdoiGsL,qU+^U*XO*tD Yiq9O<3ZUF\gc-qSrCjA&>=J:H.:dkr&9G.o@J+>QRX2(0^70< O,]BVQc8lUtud ^eD4FY#\07FB)cS.F<-hp*t^$I+#%E?`PLU0dt&Ce8kG#ak&Rf B6^LVP]G9qGe5[*-!aLl:g?SHEBH-'S6s6s?+UaGCA&)B@A9--'cJgjdmpiijWRa,%7*T* 1mX)f%Eh?K"E=n+=Bd!bilaW'F;g1,qB"PN4bbC:%_[PG Sre$hda<%P5G;!Y&n$#iTYXR#JiVZ?I%BT9pPs[Z\o3,eocM!E:>\VUOgEX;OL38`e,2iB^>g,@NXW72 (oPG4cF!g:qaT/m'28D?;;R">?RW"p7^)D^7!\IfRgkiSZgO+>iB/NrtA$iQbR):a60W3=.9*r\-&+-@H0Gr+tkI ][,m:%8Q9u9+"7!"4/T9.P0Ir_$Fs$$mbiOnnG/]g'!Vca/'Ci%?;55"+GnlI&'+qbi0u"RqG8q4&)mQ:Y&YC$T boKY/%q#tgnL-DK%3/4J!<0sAKd3:1[ttndE`_nq[q`tm39_!0uGLS ,:Tn>*7CN,Z'QtoV'[r^+S'k0P*IJYfd61e//$J`Z?7Ct)^dC<.M:2`1*%d+h'\@A*Kh3a n^f%KP8;S,)\LOBZL]JBq_0fB,B8\qZ<&`#o./6]3J(E\JdYeqrCg_ntOIH4m'bJkJ7'oZVoMJ%6=D6iko.$Y+#BpA=YtfE4 :pga/oasWe&1\F:/!RX2!k/]*'2is%;RJ)@ZT.WWWDTY4;<40YkU^'U#u^Ff<4,G"huQ\k V,=3V;=p+P'dZipAQEqf:A"9\F]^-d>inAd<-;tXomp4%HW)8@4XPVI?.-obfma3\HZRoF/-1Q+^H\eQm7H9$_+1aYm/LG":Q2 =4Pu1p$l7o<)]fIM;kdAF@'G:d9ed<@'t\l7IlNKh >e:aP!Q)6PFtI5_78Xeqf#7l(AT:_raS='O.X!1MG%"u>b>gu/91K2cii-1ecVblKAla=m oZ:MI/i.=/B,/NlcU9=-?YC4CBseWtKd=P^9jtoOUl[NG(7f5![7'^"D$_I]7e9g/o^Tf% Bm-t%p;kqhpCTUk "WpS>&FfE)na@LZU^5??Eii\fVL<4r'6A@X4VY%F@T,nj2C-eR!WW9J!`/kG4U)\HF15Fr @LN5\SMK2"-!*HU6CW(:oh08S=SD!%pORQ*(*M3r1QssWoeS\("9d5<"E8-QFgZHQV/r@E 4/-"FpP3j7(Kgk8s"rbW=/UF(c[*G6A"XuF+>m.G3I=(mH\0IS(L)8gj_+=N+P5"goi$=k lm\,UEL)dbNi.7@kC@`(FHinW+pWO?n/sssFVd8fYi+mMX+!#7K!m0c!`Esh)bT`%I5gbH i`g:STk/HrGPEbCp1#nq%s7R[G8M5I\'T'FqCu$N:2Me=Qr/Vrf5qgEIeVHHfGGa9ofMlh %AKtT=ETHXf614e3nMe+(_D/U9nQm[IFnK]2I1VgQ&BeVI^g:FQsY7t1O3AI,m'c*os&(Q Oc,U[=i+6g5]A#.o2@T3KG?Y)f2ldu[>h]l>CmNHpX02[E$Vq++SV@),Za#YWJu0"OgSbS B1$d.)h.SHH$Go'fL6-ln8PmWOkDlq_@_ZH3JI(63nG0sph=VG#DCbpQ+7q^[uZPnC*:(H#neP'kQ(OT@t;ZG>4IXUR(^kM7LkQ5m3n44]qOUU&$oE=,D02=d6IP P.;h=!/66I+=k!jU\\7d31;#->D;hI1Y61ZbmOs4oqhM18f?SD),5[N@rtkV/.YaSRX;"j IO1.q):9og;B8$N#GZO'E8$SWoQ2ALh'4V&#f-Nm&aoT.O%FUuWuB5ORA)#&a/rfO,j6^/ A!`t%c`V@<-'sOG=cI].X[EF*"k6&9]'6FU+<^m5LJ#`\c292&jg4he51XE!/e1Yd&[?/[$!RA:]5^&> ?<_;3T-EH.[?B:tH+,kl4L^&YmO0Rp#Zl0kM\^TJ]:hDgDKX&@N)eu3)W.WN$b1PY\@-(B .(6ue@ClTeZb*i\'/N0pP.c\*iRmSi=jsD*cb=JJ]B\rsJ3]2i;c39CeQS*LS,p.O(1ml% `f-[(7Kuii'sZNr_7-Wu6i,Dh6>E>!\/'9f>62RpUTfJB?)EM-p2dm.j(%sf_csfh#+CLR N6ck.R9IePg];2iN%;OmZ*2o?4CQ5e^pb]7Cg'm8HH4#&F1hE^;ej"ZgdM[OgUiu2XS,:l .puc9FeN9T]\K!ZF#@7iHtI6a\-G5,S8l^L2oQMpd9(7Cf6`]dXistR\o#N7:5hm"Es_Y$ \6M\ORif+NnFZ*,`%Co\qH&LN1X@'3+IhBn(->8B`)Addd$f5Pc$8u=Q+-[TJm=#WgK5bS 58UY!&.j%X\uY#)g&[d<8cGugr19a; P-RUY.\0uRqH;hWbM6?G2QKA@l4m+Z<5BMPPFZFA^@0aF:f=4Z7\6!i!q#=nS]%"mnh^%A T08n!]!uAkEh:u7qe9,n.ILNB!$=Khha9R-R6BG?Qe!j0.b8Qs\qg3Hm;4$2)I;F^(^>Ma oH.F)?]UuYLh`tkRk.9XhCA0=&)8(ep&C$F-;X7uL%ZElG&LPY'rX$T\[+EaiEX:++-ZB5 (]rQ.rBIXS!-.mC\Y]'0B+31$NM:V\GL(5JOaeDp!!j8K#mGrIi=MAU/f>+R6fJ[pPYN&( Ma5=u_EbmS!fk+Vn2U=a0-c?GjV!t\Y$!?3"==/Bi$]9dREYc]OAIuU-CRZl@Gpe95r]$F AsA`a/pB,Z"XV\;Ptn;YX%7a@_5(7%.$IZt()n!K,T6qkJ^h;&Ee-HF:4Y^RI5:%Z[,"#6 5kU<9ID9.J("fcH\QOXi]\?#KD=k>/&]-oXqA$ '_EekF&qJ7cBJVC3cGEUm%CB*)"#3p&g"oaYe3T45j@"jT.R*ICq-Cd]/\u]:n+!<[F$gO `l&0NY)e>Kg-c;Ma\6t#8Eu,U[jL$RI(([X\p4'@d\<'8aV)L$+JD*>3=[c/@%ebq1,Qj];Q*jQjtLb'.25./S(U`5-mBBW]Q:."V/`7EtSj=E>fcM:K0Yb'IWLXP9p=G!g8,< 8YdWE.2/Lm/($36BgKpY1\UgCWo/8Xbd?b9,eWB;>alj-TE(T2^u\sTK9MMSppmSKSNKnQ !i!V+W:53fU;4+DO\i+g6"&C1A/Rb'FY0);JGh4\gQ9LJXp,Dd?Fgd?nB ST3KLHks:9J5QN^TSpLo9ZF<-^DpPo:#(T+E8Aal^Z^*%"p2Yq;1N$g>*a`;onBH'JP$SM 9M2UrpP7-5EXQ=V(-P-GK#.*b0>"7*BZ.-r-6#9]q4\)e??D13=F_-g[*`6AID3*jfrXj5 >c9XGYLHq`9T_F(YV6n=N(sqc96XEpO4m2iG,!5i2.2lU.WcgQ=*1SCO)%`h_/dU>At>cn kkJg6!uY+*Au(h)fe[7-7`C;KH.&1S\es:ZIGaqq6(+BJ;FZei)q)"r$l'U1*`RtSif`!F #5cEUQBe_5kELjbMds3`JtcpQDV*:[ocbFo;t'F\;WNc\/?PY^^efr'5\:aq5J"-j%EmRu 3I)sZ[Wg6!QEUA?!?3e<`8coVRloN]V_''G!esk$EndDeKnWM*S)4*C%jJs['Bd%KoXWm" *%eOApNif89ZBhZk_OjIcbh>+L'i6W/?a+C88fG9$LFor $?T)a`i-4GUedH47B9f+).[?LbrM\AOI7)dfLZ5dqTB$PrOT5@4pD'V*-UCgn[\?ub=kO* A8e"_^6i_HRc-5K-r!m37J)S!@[:N/73fFO7->Qb4@j,\;1s^X_SL7[Lh(Y)6oIkk,'5&Y A?I=LitiE[MlL*ag&I;XZCN&jq^IWX4=-^AqO?JL.j9EW!FQ?S8Eug<%ht--i.0?"&g&An A?e^>9-MDU&Ljra4h?uW\.'uo=/f4&8gJRJRW0U=C7QN#^gQ"AfGJ[FPp(^16<;jb3.=b[ =<08pV4C16>/eE"4h.eW%Voa4;As&>sj%fdLV"2IG8!&P11&X3t6 83!Rg`kp^/1^]A"1L/T,/KciUQ_?RK" /.-q>"p!*4&HaL0m7Aji%g`^&]6-[`>j>dceCL%M,o2],CLg#W69r=V'eAR[[#SZkKos`$ ]28+?.j/!-41PIGktuR!8k$_N'1KFX <5MM0%2-Sqf)"0;X:K@>Gn,AFDR-#p+/ap>$s/lETYSM[N?H:[&fY3f.oOTskRKHA#tBT/p`1T".5RN($mc=>R0Nl#P[/'LD][DS\.o&Qm9q-0t/:82r?"p0<[$@tVd !5OC'!_]HtV[,E#Z945egUmLRb]Dm&u]$;.e"4 Er/#TUPFZ-[(-KknAci:7iG=c8996@7_.2VJ^pa8P!7F4MCBgG?.WcTRkeS+pR#*h#XIT% oq8u*JWDm)>PWad4"UVk@G-3H%kr[!RXh\YFH;RCJtV(FWT-J^q?- (_h@H8NW0<\jVaRE&A&^Z\<4Od(-Z`]6u?/O.+eW%jk@F#r>5`_O@?@f3,qh>h&,]Qo#FT 6pCKhCRt\1!kj\-'o4&_`[)q!"I.P@>[F`tHI#L/JEAY_QK`P3H]r"`)p1M#*G\Jc%j*Yi K=(_[7':U:U!=SJWU3Dq,/BqDXG^/5RTf#8=pHJ;0Hg$&P4t#aWC[anYmgAu^s!bNb3Yi6 \uc(mig_\=9H\$eF)")#F,s8hNbt<'Q3>%?_[0reELLM*R^=!*ZW'(`3:]"AaIk's!4mn0/Q`jhTW8-%8U27[ i^7T\fU$7JKVHU?W$uDl_@uo9Ya=fX9%W(-oYh9'gNR(7@#u`pM8D]]((J@;56jqIh,,kT %fq*ql%!KcWG]dPe@.?k:^Et.Uo9OLR)o*46;\U:Yj.Njr'DOa*C?lE :K+0j#0M"NWuK]_489*aE4;WV/URTg3)iJQ't3PI.VT*B`r$3(niO:]i-B#+:\.*9eLZ)EYc+L,.Zm)FRO^?`G=r UEO/9@'1l6d1GnP1E8@['.Z';Sf8(SQ&69;P8?9KW&L;`P]/&LL6\0d'mBEkcUsdU-P4,Ol3@V5g$p,jpYm-GUAXa:&`doS( dp3k*@\u7/Uq+eR".5f3a=m(G1oZT;"#d.KnU]\nW1!>[;MN*tdCfZK6?j+j":?nG]H7tQ (/XCk_UoJ0EX3i0O6JoeadFIiAsGI!*LT?m6@YcrhNk4&N2a1B^q6\IZG`d^VVqH(YS\[^ JOW=pMTbP#RE[A5e2*TuJKQp9]EpZHZTTe3a^`]:^aCpRnZ.g\.u]0O3:.Cu_Q;+e!eO-" e:afg#QP6R\p?Q/kaRA?>.EWhU_07CR-;.U7P`P!\]\+0"&9 $NAXR%U"E\j+#g5)J2J$;8=J+r.)1Cosb@^b`0hWQRGtOJMEULbY;54+^/r+g?'3 52=\mF74W9.*6QY"CohCld2GR26NVs)ks>bBi%(qJN?)[4cJ)\8@-H8SJ%($,M8O+P/n2e 7[1!SOh4.;b.^#s>-`+.(K7IO+@m[/[mK#h.RIMnWk,k7J]i/%0RW@TKF#PdT1<-lY^A_; dVl-I-3tMpMU?Ug.1T0j+J5F*9s`Q\M$'hqVL\duVs2YV9Ai5@H:l&tXe6IVdE*`_cA;&Q 3Jd'RE\o&1V]9r_d9$AUgt/3?YXPR3_us5bUmF%tQGBO]]1<+S$e%UJ*\'Pi+iJl3n]MI@ 0-XR>)rM)Lo90uP[E+0!2<"RuOaRb(O[F63-b3,3Wf!NF"UOq*X#](.`"5K3O#%`g+'R-b $R*]7co/LO9j>+tXO'UfQ+?Mo/t/K=lCs4MigF6$'H6'A._(ET03*Oc5s,+b\l+G`r^N9G b++@s,TK0uiY)?I,IsZ[&oJVpk7n>L"2H03)@TCLdEQ1hd.L.1j6a^!nP98S4*$tp;7k.W baD<\T`j%63l%.]cTRAN9H!In>!+icr4(6k=.)&aqCX=e$;`7")k.7d"ZmaI[?M4=(I\(T q`e+JcR&M;.O@h_9C@A\$I\TB!*_J6)X5]i#1gCaVZhZ$Z@r>;'c9fIN(=a&3FsWK8BuM+ 8GUET4;>e]5*9!+b']#1JnUP4Cf1lJWjPgA$5+ReW!N!g,:WkI!(97QaW_>B=T\lK<16jD "h(eM<84laSCOo)&Nc)&95I\*Orp`=Pp_,7Lp/!'!msqSP5qgT)4bss366W$3#U^*(mkt" fgrb0"VHr(9QN_=rAh+R,mc'3UIj6*)KZsa2%&BSZ6cNoC[8s1N2dib>-mWtZdLOlc\'*M UCiXj7EmMH+hHVB0"l7'AOK$BrNO1C5Q%?M8jBiESH+mf,,tNo'`]OoIMV;2[#J&'SALXq )(-k28+6]bU:21,Dlun:2"HI3lI2aa%F$]TeJ$?Z29FRZ-e><_+p(8d5nB\`&35Vk.RF^Q dZ5?A$CcWUPsr-Nnkp@Q3g#&;$36L%r/<@Vgl'F*2Dpgt9N&EY#-LjI+u-&2)XT//8V(7b +(K2g3UsV<[(B$a>c"I6,u-iD$U20`Q:c'H"JMOY"un:Z:S"1"_B1,r&'p(eaue61#ke`O ljTW`%LMJ1aNkt@`&T#.g!Z;4/A.Q;"BTFC/kf>#5T_-$MrXS,^U^kSI3[Q/7Q:J9isAUeF(WaE%l%&!>EYZCV;N]\gIPN#kBgV@Yq7]p($sa;G1/" D0M$`\1D@n'RWuAc`LB+/Qq%&0i-$R->@OaS]e//%hpbN"RAVLE\m#eOJWj%66D(JNk9PR!0O$Moj#s[4\q-(6\co':L954;,!@R*J6pXF A@8V#(Z_-nK>/5I$`<1ed0'[3"'U l3eLJ)LG8AJRg7oWZa[(ILfn&E%(hrZ:n?No/N]8['\1B:=bJ2VU4cpM1LqLm1:Hh)n@]g >q9YHW2;C2-,o5O"6$f<3 mG.nd\8&K,Z`[7q+n-8[)Y&-d)g.G*5el,^6.R)6'+S=sO[qa=d:a6qf(Ea'M87\C3)bY6 ZQh.VYT=LBS&9/"1=n%t"bUihnOHsZmp?/t"Tqh[GVZsL1STE8(23(ffW1b'4+Ar!E.Gmt ,^Q1E<>-Ld#=):,k7XFbEF`dh=;p4[:#i18HEX7\H?@U5]Bi+S%Ko$&ns5pEcY0LUsLOBEc*u#:b_?<#/\1VY$T1MTrEmf!SBK 55c0\=Wu$g\4KaW^fo7,QkiHoZYqfI")o$%Qo,%Jd"9U["*^_q+%sUf,qQ 9d_ct"Z2#8(^qkr#_[`5+Qu3S$jqZ>5njSY4:D;n_18al:`,,pJ._>@0PMX6"!dA^7&EdE PtP]:q1Qb!1R_$Mdr:!$+:89D`rWtP3dF$q#:NK-+F"J\VGdN4$>i8/6ja)Eom4Sh[9Ke+ UpC@aQiIOC"f.po^q^d(!t-:38/N1@)2eiT=*qG0om/Sc6rC`WYUj1iPD"\l+L&@n2[^'_ 6InQ3*Aq=qR3QZmZn*D2F'-j6WZk>s'VT/i`SLb/.1W%JLh%,5$G4>',6;n$1CYU"XEH$e L/5UfnT`i<7,T1+S^1lS%Wn_**Y22L<8&^'U_F>[Hen]*@u2rf=GIYJV2R)nZO-]N#W9Ct *0S(WKaB/@#!D;j(m)7G$um9-8Xa\^-]16@#6Dt$9d$8>0K9CgC5]Bj ]&6JZmAeRhW@Fs,$tbi!006u/,f.@^'nXMi3<#[GZ4$gXi?RL84tI(K/Z_9sJ%^S0!_f.\@hl3n!? W#3(JEH8dSNf*aE)SC*uBj/$Ge!d!2$6"j'3XQ%6lT:-FTdQd^41=S.em4Z-LD?7j(cWYG 8,skdau4i*'2fW(/aNp5JPR'39f1VAFQQR*"0b3_P8%D89+jXT(f;GB?s"H_K,FC*'ggjF )&Po%+;.)e8dZ=e8<=7u,65Vn^p_>*//9:Y;G)r/0go?3XN:5i@\_M;b=p[l3O4H)c5`72D:6-!D_%c#D+UBSheh-C88J;:.^gn&d JQAB:+sE35)&:CN(,Cibd23T/"JF0cQe85FHkaJ;A0;:H?t9?OMnUaR2^#oo+ti7==G!3e >AZ:9pn_$.BYejW-=cH?Kq<>Yh"+eCbVWJXLVpZrQk:b>t)>_"N,dF@Ggs2k^ :pG]Tj6pn/oaKHOU$KSn7O&kpfS?[M^gnu%!C7()P,,'2/;0hPg.[kYi%.M3!WrKt'<'q2 ^S3-p>.OdeBLjR>gc`@[7>NW5)/lIEW=7 JT6),.tb(0a\/FO@"=slR*q2HCSt<4JiFa+\o9ue,&6%D,SF#YI8JUr04Yp<0UB"N,#\2( VPQ;@ETE_n"?[3(BR,-Dck6R31B?H;)$JnJ#=-'9%Dd!^$AB44lK/aGNEbP]1 #`:U;eqf;Z8K`c;MmR^#MTLdXN\^O$5N78k!AR7nm*tD&W!`Wl6jJ9!!b`=UCeIccemp?L (e9`_7E]-eC1KdI2>.[XbI`!.aFq?`?n`[QYa?-AN$j5IME.KBGlkgD4p\C.."RIb$\>,J L='NW',gNS$fi?HBi"lcU6T'sTn\*-113DsI6M1,M7pm,c]8t:RP]Dp5NIS=8NOL6E"s_> Jsf61>\tpMU6&:dBcPdsXur\?MBaCb?tHs*7&D7j0%0UP9CQ,(8lR5\Z%a*GYZMFPn2(HF 3"*TJrW(lJV[WXI$&#NJ)[9tkT"qF!6pMT.Ktt,!,8u:%:a@dRM%_OtI]*O/])rS>h1N`p I;&")VH*P\^Z(3qOq8`]oXW@*(2#E@PqQcN!lu#K.i,o#3![L4'TuJ$?&SPo!G7]j69q%] N(n1e7Cg&Hf'*e\lZ>P>W`g+Gnj[7 O?WnFd@A/UPWj\0cNZ]_,cC>B$,[_jOYt^'!nA1++TSjt_Ce3s&V!9Hd,E0LPGHUi)LuT@ +dEU)0hN2E=RLq9XIU_/jmg/eUh#S3_DXb`YW>ZrW<]nobh`H,Cs-4./dJ)Y(kP"K)A;*R #%3r."V>>LVXu[#=Jd^%&@rRlN%U'_PQNr5)%)I+-7o>*@aJl75-8E+Y"!S$c,e# !mjE[E!?Q#&d]N>MUC!]V:989*hC**!WYO9.]FqJ!0.#n:8\+Ag4I>UAokZUm?BQjI:q5V 1.;iq=Ui@J@7Z ?pPSal5F1hiu0m*G+^N7(9+B*_Lmq#I;6lJ1VQV7$Rb85R-"#0V56ph&F7)5!8b&e_Br!; q,_hoQ7))lObe*YNnjCf"5\A$i-YV-Len,&ZmpZX:E>!KC]s5g*eTQC^u3-=Da_Gc1`F1c )M(Eh5jA[78.qUYTRf?0_%7"^ar-kf'$jf!_"8BbO9ORP$uLY&J?T^fb`ZBM$qV?G^r/LA (f&0Y<9-_dk(Wj9BK)`uq!X<&cuAmHK)23`qI>ohcFjI[:-"?I3j'*;MHDq)@0^_d,ledZ k?]@LfR6#T!l4:;!%\ODbR"9jnGk*B5gU$me.+dC!l7DG!J2)IC_X\[&qH&]^n;Q1p]Y)B %m[]:^uQIY9EX5n&4%FVbZkii/.)D#,d*XL@/(.=*Y1s,'Oc(t!'UlX0GR1/'aPj)i9\Vk ^jST4h;EgtVMmrS@,=5i.n]^dA?uT;NXZh\P"UOPORB$nXEE9@KB!7!ZUHg@^ :o4L!BEJ80#m!;:i>)nh*$##a%#o!2!3?t;/.rG_$3;shTkkenL(6L?'7k$(!=1`Z!"-NQ $_[8%TfrY=8/)'?*P`L-5bK!ifF\-D(N@G%i@5@h.MkBM'hY.m5VQ!o2Sg^goML,i5\QK0 ]O[+H(IDLiNk.:;`WLuUY_7cHi#LWlh#!/>.Bo3`l=1PsBZEKid0*o0_&WF?`"0[Z&&9%n U.PlfFooL7!s%s*@?;%n(sQKH%de?=J?0K9YR]S.'nDM\7Q.0_(ZIO//A9'j5=5O!C&(W`"mm5%tPc9OLA#=,/q\_2_?.'@PT3=M]pM87h$r9WJmXI MFaP1V%#cu#%j:olq4=i3$PM/",QBI+?lbD(hH5Q+^c'YMA1hP&qIn)@#>Ym/Esqe'7i+I @.Xj-Fqrp8((/%^J;bja'F;Md%mcEq+g;TPSdn&V$Gg*SJOC]5*Y"gU&0X"E+g;Jsi!TT; SUipH7/f@/blTSpoLlJ[$fNdnC5bT;!QB4a-ief+']BP[8e0f*';e8U&p;Ss-6QuA^_ghE r!`]_(#X$9!$k#6l5@EK%A7_X!Bpct!YU);!J)4(J^ePp(_n46#6:/OT]d-k!#Dp#,bZ=m _+kt8j:oE3#+uqO?nMu+ScZ^[)&%N6J;aU3&-7=b'X<3#daJS6H7Wd_Fmi!U;l'3JAM1=- .r]ntdOHW?UEZR7.O(niUmT6BNA,Hj47m8IB^.+Se/1]c`PP4e!#Q.&!$774$G`_WTJ@(o 1_YF6"$s.*J@Yc4E"[\o%RB)+@0d;$9E`0;9CaPDJ?0:``WmWZ'T=sP`*sMA5=>&o$c"S4 5b8$B!"tHnA-2!JD5b'DK._f)ZF#R$CjqbjHDH7BB)jpKV2YdYEC]HY;?Mt76uFO[5^r6$ ,nX*#^jpIY;2i*C66#i8bDWS,`R( !DoQoi\=R+'Ggf@#9lnS^`3@TPR`4_%AB.&&)Id^%eIIJ*.Y*pJI`rt5RP;c!!"bTPm.pf 1aKH*!Y<-KJADrHV"l^9r)NT,ZP-\aQMR>OF-M&"MoRJY*5)E,.M_D7'g68QAn2WEEg19G ("V@(Ipc_:#lp'OP->m5jGi*!)o*9q+gk"[e0OA=.*['K+=nFhMA@?GAb'/k$!=pqo`YBXh&A^=/d7lI51)5`.qYC MdEM>R0%Xq[I\KmP+#p!iR8BGk:%R.XV1o!%YB!PTF_Q_(^be$o[0X7^oS+*4pD$u)8V1D 5t2H)4X_L<$INMkd4e$4TG82FFl?qC'U:MJC'rLG('0d0^bQbWDQq!u$Rr8maf^Q#k6B;) Eb1h_"BGj=9I1s$FEQ>![]O9L3-2%F=27OFJsTg:nPco/N`-Eg:iR;.V['5Eh$%ud"U-pQO8W$tL4XHnH[kcJ^lSS]2('7)GJ/NSG(P:qmG6% U3Uc(TI;+17o5IWO_V.V9ft9V'bs5<9BB"=NIEkOMI][[=cF7QH^2sS>b]FU6+[>6ne/h% r/3!J[d@1,L_%;>,bZW+eYbXiX9Q*>=lAuR!B^qgU];2T/6&g532U/]<%qm^,:@@R&>ZVk kXAR3A+kaaW4eIa?7)Y*,-/d4URWa.RWF`M0J&7]=NUYDMkGcuIh84LCn,1ejJ-7l4[LV] VQi9N0!@lfFnSEYC2],qiY,;<7;20$5VN?C64SQ7*QT="JJ9B.nd[t$4Q8=@_W[%(W")6e %@>/poc,N&5]U9FIqS.5jL^l"XdI9h/h"--!lbJ%[@5/,]1Xt*f$#DTQs'&l!#1]m\dH(t 3e1dbYhBg-"as`:@!%!l.$?X)RaVT/,eGr>ClkFnK^+mU,\X.F/a,ACJ5o1VGQe0U,n$pW !FEAhTlQu-,6?^+5XR&X,g\e.V$eoWG$Hq?7cEXG:RqOFR Skj[hQfKA]CfM>a/oI3O`\QD:`]Wf+-.i/dab6J!<`f?@.("'s5YMI2C5k:EN5fG'R*[f0 eF(5/,\S+\i!l:;0Le)[b!Q+"_q(.V:fQe!NoSfJF4.G>2TK0)5g1e\ =EX7,Rt/Tt/Q<=BE!67o*YP_T:X0Q7Jn%3e&W'n*i2l1`clmO8\A9>c9OfJ0W[qOc#SLKX +u9TSb^AI-+JLT(H8b[M\=6-ul-Fdqr,[G`8>K1g=9>50G,%-&-OBJ`0K@CskOl#jM4f-l Z_1PW!-L;SFs*Ld;hp<#p'`/'&"*_euQ#tne;>Ej9jKG'O[RmTIgbSTkqh,dnEc=68Tsj.4tE2,+S,N !ZOAOH3`4Tr$&u*>4jqcg6c>u8>$qn[!EtmBIQI]dE^djr(RuZ?`_:SS!i[J7e/0Kh$W8T 6V!-f`\"&W+HV+a:8&4(MO4U!*!4nL!s*!G_(+[lA>tbB^5q,0FIYe3&jC%[/l%rMJTNHY @EesB!s%gE+InK>MnXi+"5u3J5VNNFoJ`I?$4p1>W$Z4oV?L4X5%7,PU,0&@$6sp3Uk7!^ Cilk45B?[ACjV9uS!?'#!*<(l4%#t_g)t!2loSFXh`V*\g$4"(?im&2cP%'7:,9Xc4TdC$9i-,?"0T).`#7Lc+ *"g'7,(^LlJgNF[h@?7M$4JZJ7+D0`4<^F5h;2B[U@(1$\5aC,7LD42bt@E;o*>=QF2WMR +?@gpT2R/i#s!9H?I*E.\S0/:4\9$+]BD1?bV`q`5HPb&a>+)udYS.s%`1gZL+!&'8-;aIgC0DG^(^1!A@F,hk ##N-u0EiM[8YFM2,Dlp_P>S;YlBPP\?EmY8;2Mf@Lu\E@Gmufdq5l; Xu@jZ:aoY_?LO68m674K*"S_4;4mo/8#QLn_-k4HLaWrEW.kS*Z61>?%]3]#==e#E$k/ii ,2q2e'gs.&6G['ORSX2!J-H"\a;=q<*C@\q&NDqmHI'7doP^nUQAVj(b?O87R4a+`7@X,5_/S)E:+,C$Nu's0c1<+9[[;\-'/c] b_6-#L;bRFBIobU!V2PpW)-rbU+&p-r=23!oKK7,9)(4H/SbnWZ:)KI33oWJEltjDd43SU `_36Y%n%#ZG9///ien'bn@U*`!l:WP+L0!sM@9g8bR0_m9^if5-)dc4I5K1n*^gEE_(tuo 7*:$YP/(LNLn93KoOSWp+:K@tJ@Z7MJAKWX0F_OfVLB7gBG(Nr"IO'h"[[49SHomZoRjM\ 734T#Ao\e,#:.ZJ$k1$=\1RpHp^'b9k(rpC$W#]VQU%O>1BT_4dMF47$4pSZ-t6YC,UeTY NnPp318>5t[M=QaY^a&nD_#luHVW?E%U+dNs*R$9/5Ui%SZ7A<:@$&j[)S!#-,DJ11a-Lu^Au"JB9] $\eYS$OR%m>[38!Lr+T@@$oLdRti/sD@bfbOr0NE)#/dk"o&otPJ](8Eg*;ETM5M'W*j0@ @mIV)(5(OWHC!(^&dXDId*O$\N?^@a+ojD_Q7-V:Kj2V76A-`t)Z#d/YuU-0D='D_ZlDJR -)hQsH[n*n`O;5c)D'HQ'c_(;oncu+9#Yld>Y$o8_hH5P_!n[$MHUl&>`*V<1&Pr>n?_dS Ad+!IBm:%u5^5Ec[b=&bpelJ4L;j)IT!. 99SE\Q48A^1#=/X!dL_*(?4QQ/d%k6TNI^[E%FqK6f?<[N<$tY4.`4':0S^RkW3(."0c;f 8a(]$G_A=a80'*3",1`-"H7na'\:EQhC)*gWO>k-"'b;'"Mb-N!/N!++JE\)J5?@bKQ(.g j;DhHKt&^j*=5U-6ja*"`\(_VigKCn-VL,+JUhuh!&-M8`#P9[f.'/p@dAM8:_FlnL_19" !-H5j+9u<4#m2)"=/?>#t8/ih-\;.ITDaC-C"rJ&HEB%#!hg_JoGiP6$P9k">h,$c.-Qq?pNSl'7H-% "Wr@g:/mM,'eqti+VWTPhG@37J%reC+,B2*KK-Y$T].?'7!/VK,7!aCqAe[OU^^l(1/d?ih&k)M`$0*n4L+m3r 7/70'iS5]8TZ/YeL_6uqfNS`fSib2>^h`AVEW"]K,J1OG_s5=*Q"lE OlTb%"s>TZK]$nXiBU"i.XVYUQnJd(a:!\&Ccpp8&/N,.7"TA%r'NgS#`nCJ!^P[0AH=Wi 86Nj287YRI.MP1+mUJppe!Y+Pjh**E?G\.>0C%t:c5DG7AjV.YM@rE["Ek[pF28>PJWHo# =aHuTAfM`*.l<@C!ug+))h>_h(gsRn![()B"n;;AJB1K;TIpWTn3@A4\srtTYUG=KFppYZ AH[O21kM2D(kWBH&(0AN`E:;$+uF!6_"80?&:+Za<,IS?[AQLi<_c["nae&RN,XK7hcpG]7+(b#.!],T".lBCHk0iF]$]6gupR?D> >i\clQ=;7U7V+S^DSPXk)2D+'a--:<]2G&c95CUE#,J7G:-#Ha5jUgn\"X4\+IbAX[#U,d +QYsEFp8GT1^"C?:4iPsAHQl`N3UGeLTla[j-,mgYYZ)FkSF8OHma]C.A+O\D$PW"&IY;$ ('(S@jXrMS%:O]E`(Z:/9uG? lHNPi^#TDBCWKdCiF[b6bJ>,[jA=Sk7GPMBU6JRq%RK)E1SGB'p'((]9Q3N.!P3T7TO\T: aX`k>3'.6JAkKnd,s-Y"Op]RE"p\k<#D,cK%'*2.KRhJeUMq[&+B?^BLgLPMfOTM2Oq,WZ T+7R9B7M.1,m[$G&jWZ0#N7QL!l10+6c_4nO>&*g==4;kB)ju9XFM+C3XSCt`rcX5igS3u E5/S1TlkGZ&6VN&9*9<\*sF?BPIr\>!5JVM-3O7ZP%)1n`KC>u[ioi(!jd]PYDHC]3,-F/ ^lT(QHAT]j%<0o"d>JC#@t9(6!n\8PLk>b:4W3IU"fk_4cs2:G6&17' _;GZRBL.[b"p6gh"E6JUO?J1\*XGkE"%cDl?q^g@8ch7J!l-/i?q(.%Lq:Y;O5L++(nA*4 7L[A+*&n<._'PPu9g=N@MBN;4YTFFE"d$g"2fb]Z1A!Z&X>=>V]=Y_UgVC_VD!u+$""P=+di5Z&K8qSpc K)j;NdMn&L4.bA_K)gCRqcL8I.>"$lLZgCB^_[6.cBLR8"40Pg?oF*s)?d9+"jqLEi&8JH /.(f\!dHO'Lb1'SI15ZiM6P8:+;-Xh)hC>^S5FRD8Kg2PFM!.g^Z7YlR';LJCE'p36hA"# UGSJ"o>bmTa'6#;`&W\t3XQJ@4#i396-BNh:QGc%(Q!57E;.F]rIH)FSJ#]=-p%lW/dAm+ JAZJ!+:hNP<48I_^7G*'XjWq8EI '>KGU28Be>bS.N[[0[^:FTJ)b@!3i.D\\f3tEl,2aLerlBl$NVq1B=Xd %QNL)=bVK!M1Z[D"ZToj_:p%4XWE9d$UcrXG+%.U);M ^pVJ#Z_d<%6hEU`eET\_WlpN4$oqT5C7u8NKRgk1!+;.MdDCim$PcL`"H\Y,EIn_bPQL.h *>3S(3&:^\"pBIMKRhg0&6&Y66j0/:"=\VJ!5Jq$$NVg:"2V)VM'3ZHa+XXP*2+[;iPMqr $O"?I3V`?4J1^nDCCbJT`;#&r]Lo5TbYZF*'uZ>e"SIWXTL9u%OKoTo'^umms2W)%^_j[B TtSWt+<+7%('(:jE59]p\')$r]0-rC<9+PjL-krn\F\qc;#p`;$nejI!Fm#n'!sOeBE[gs ZIB-"5V!@)mg,=+Jq.)-(o!)LT-;Y%KCL9%KeYCZ4&KsK-Y_dr!U,)"G8#6OK&BX)H-3,X 5RWLsVJ2!Q1H:8VsEh^Orp*`=Te` DGg@5)bdRf]6_c`!0L1K\''*G9nF>WJ^N]icmc(+]_I%Cd)/6[M2[*<:tn>cVh@>Z"B^M3 FXOr+"JM1k!UpC]?#,([Fp?Ii!jL>ZJ2.0kTb$@bX"]Ba@eR.4M?mSi!jN+_.\`8g1^Y(T L(sCg)hLk2+PI,"!cZ9uR"L8YJIlK25@j#Y32+l^*nZ0E7teEQ6N,K5U?0;_R'JVA3dpn@oalTVI*h2PrmHbOh#->&2'&!Q-Y7e[.?"8][6Gg&tD(Kpc1tYb),/)48WgJ`3k(5pP0`""q""[maHN ?0](.`(/qIMQJ$`_Q:B*<*eSQi-Tl[@M4s>gX;4%]7D47#fd`)=\suOTCQPPq6.-8"rA\a 1ZJ+naC>5F"pGho#'0=maGPV6@Y?3Gc]Ac:jC=Gt'`gR7"u-;j8/qW&K9WG5Wu3$=p_6^) q@mc0?)7/=N4RZG(L6#^cP?o'n?C=l[AER&isWY/"tq;3FMHAd=ljkXR\LG#_h "$ARDA]bWHBfoL>;Ifpg4a0\30AmaEgCVBUZZM)"_Ts8[(+"SKICm*:_/>BL_e5Y41ul^DM:_XhIZ,W:CKQ/,d=V`&MAkV5L*B@$j;[3631TdeHM&$8JnlLBkW':!?JD.gL[CM;\-@8:%Otbj0s^2s-7&_F 7017J7>,V7K!78lfM2LP4+Q6>"^j]Q!)EX":lqU]!lc,`?sEjP7qn=j"1T>`k]$e\8cl4e !jG,RcmrVQDMCR\Kof>Na:Mml3JL"e^IQ<;BMp!*OD3idjfcF-D]g*Qa=CSCG9nV)9 Z1'c]4(Edk&QrD8.h"hjAhQq%6l;ro=mKt%\6/NE3-5:r/;;GfKc`D\+?`mV.L&.V"Q2cR&2Jk<*J=tS"u$2m Ai\?);?[%G"!nD/ZN&9rXRbg4jtObq4R1ZS0rg3#BNVlcQWqm@?I']sC5-4`:ndu@:^S%( "OKA9pf7Qc0-rXHF!k2bBaArF/(^7rB"<^PEF'f(f>D4J(#08EPTF"dE 5_Y#!"MbEJ-jB_a;MO[_#*TOb9l:!t[4F#SmNH`KB;[Fp6[1[8_BqZ&r(Ak]_d0 =p=M@M-_ebRmpM'5lD0PNe=Pg'ZPGd7u_/dQM7Lgph,@%Ug'.&qE_^[!d[MFKZW2L*RrA.X8H!WY"YFJf4[dt@-k!3f&q YVI&j*mQ7="L+L!W-OWj7"du9 Kn)8h0hm;)<&I&f$5bi^71G'A"C_53An\:5OKFCa\$#D[$Y>$*=1$C7?ZS0b(*'PiR&XZ0 )i;sIS5:+;Jp`ne4"J)a!9c$?OC^=($O*22KhsrN\aouDp,HT^qaC:0RO9:&-PjN!%D="ouObE6).!i0]-#_Vo3./IR7toKnAI$t8&-ZD!s+Ko!sSd(lEu:BqIGY= aYMZD4E>8/-b7A5\>q*bS?47j.`A#4bDpD+QR6G=OHThUMEHrR_*d9$"@3T$(')V7@P/*V e,4$="6$U.%$nY5N]YfoI%Q 1bA]8;'\>")rqW+iF'#O%`<8@2&/I;-o(l5&F:89iW-q>^;45kCD-jCG"RVS_!H@X`Y!sZ 2hj"3=VLs'ln]*fi!_Fr,k->#L0tTI9/L)X[.au^O@UQ$KTHTX!F[*B+5EMs>TQWr.sR@_ \P?,cb"f"Il<#qGRd4Pm1prV3'(!?)XWaO=PGM"^FosAUi*[Z2K2@@]>>o[PD*?3ci%kb" !Tl1%ciEiCK`T0t*!ld:dpLuV+ Z&T*@+:W@F^p<3F[r(D4+"ZYWF34!0FaiT;Fq/:qF*9MX@4G%H/()Jb1X;(5i3l/t9hmdK/(^i^hk__B<&)]K''!J5f$]flfpcXCBTQ2G[j7e?3 &qpmAd>V"L3\CCu@3cTj)Psdo#ak$C_ZW9P6jj/+A/G^](7^cPXD)>Bko^%4AZGi@1?]-h >g&dO`E]L[(`Z.Ja]^\-khcDMhJgq?.O*fE>*8;^>2.sj"\#\4)3rpFJWL6CM#H'^B7^R7$b9E63`$A0HW+2R1F$6]7#!oTUXU3O(sJ7&k;1'VG8(c+@!TS\kR K`Q11pUFd@iS1npABmcfXR]=($QD0YnZ8oSF/K$YoE963*RR?tm0&9n+?.5L!$mba!uta$ ,uO`NKdJp"_NM5,_;SIP+OgJKX%lCk8N$l#MAH9.*=W9nMM=E+/-')R(a=70$kQ_oKlN%^ _T?ka\V[OU=N/YFQjk61 /cj>C,s\]#$NhM!Mm/ir!9e>=60K[#+Y3eId.CcI??<6(%.5$DFY68%+%oSh,Sats"Fr+I J7)@9R0lSG9%9)V@%_liK\E:lD?7'JC/ZIM3K<943n$-;Eb=AGNE5\';d906gd$GpaW"bB8u1!nkb!S'_9-3u;)OCSNigj>F9n?%%A4Of "%iG2TtDM$!=C-BG^'jPU`Mr)6tjP\)[fY7gk-j*X<^>7IC+RC&U;*R81isuJ/N%&)b2[N '[2)=4j;UABN8cc4*2u&ptsa0*f3]i/gn;s9(_"VPA"oFZ#,MQ.R@'c'-FXnU?bG3gbj`4 Y6TU_jM-4q-36q/)g-fO%03aRJImbJ0?@1M;&Bdn^eSCU!"5[TP,o$n4LZ]l83Z?Mr'2t= _B=ZH_D_r3SO4c87(*&bMrB/YI*ZDke>m.IO-PaeomrMtrgVBp8(1@*,N,P].dLeI,42G, FG)#G>U$4KEbpTWfI)\YfT3o-\cW$kDr679CTSKN^o2o&B76HJZ?eOHCW/;Sk/F;gqL 1J1kT9L\##D/f-830k;T$m4f6!K[75;sWS2DnVX_[X+P1>%OZ>N6*[_e3!f.eN5((LSYSL o.&hUK:Fem_72&(Z=J:%LX>Tr_OsI'!Sen)J6IAp^`#n]Nl0%/HmJr<6t+IeBBY"O-22KPkls%tk!97Rb(q9u+G'.,8t'ILcA `&D_d#CrfdoA\A#Lq7FsTGS[f0P/54%Rf>Xc:\3^,Sm"5fXu.5_*9&5'S,HK]8[BrUl!A/ /[&^dHrAQb^e*2mDe)%'&03u#<"]Ze-S>HfH,`0lPPW//b#:oIjbVtq?r>P6?A6dsY-^fk 8nCMrc2),0,FBi=COPb#%5I#U?1L(9n&Yu6IY633?D/>G0;a9_;Z,FegZs!50s]YUOW#Dr8I#su `"nX&?JS*]Q-)Eg+B2'h>ht'j2fE1'As*TmP]hR<%8R&Z7[1_^Aj;#0:8`J`!8KbRE]B%: _8k?207'/m?AlT-Q,D[JaSb@b18MtUn>X8O04$2*mU[g%VX*T!c1\&R&fDEaG\>7Y\\GS:>lFgUZRf'n0nGBm(73r#_98^`OpW!U(#)d8&g?A B+cgDLn5"*,4&i?XX#N47O%%R$'34Ri4s#:f"HS6"or&:8,BT3N+Hc]RP.E.m\YNqZKgru B*(?TillDd^r\hmMre>'DV3S0.P;8JiJGc1C/#76jpr!(pI:C`Ks1ZZU1o.bmmQGFC$quH fXkgl'h90$CNABc5le/hnt8g.9T80?(mX,O$`0GV$mI:'K*Pk#l*2jBYMTU1W;]n'+-C+9i4lO-p8JE&5A#LE)&Ts$r24_P"k))A&iOm6VSS1$3g_K !NSsic/-`B$J3UK>!qR-@L,Ol=?^;.J'g/$brm%"6on0nriQ&:cUbf;Pi'_i,DCGq,&Wd( r'![F!K*I#A))]5\kK"7WJrO]^ekVW9af>Qc)bBdJ4-h[mZN6\@gcou1&@L*[iXa45)tF_ 08p-ha9;\TIYD*iaahV>>[#9G-YjJVJ:':`n1G-^-B2FPdSPH\L1X(>hlTlN,dOciele0c -%sDmV\C8J5cTK6h<6cWOM:8J@Ypb#(i3S3C#'HgEp#1F[ZULUa([;LOU[2U.>J8TJ:QdF XSdhfV%+(3D$Lad)C">Yn<.s"TR:`-oLY*N)\VFd;EZW6W;_];F/\7Io3sfpmO\\s-A"`7 c/ps;f\l7br+04C#f,eeIP0^2m49ORDiDM'<+?7&Bh-mDZa2EbfZ1umT&r4iB`nLTe,bUU V%H,i79TpjCn/\mQGhL>1JHa;$7h1j2em%YY=PQG]ZS8R,gtpA"-tL$mNk9HE\MTTUP;'I kl:g-"\dZ!?qA9?K&,p#-_o\BB+FiT=CUm-]8RUhF@=q4gl`'iE2V'8V5#(br?jA+s68E$ N/Tr?<+No`,(a-_6@Ca+"?D5j#\B,DX]Es^!ts+08chbab=o\1;E4$5E@L,"&Pmf^f1UY.+:;X^tp2^-Z%l%k)aQ#b;$7+4cEd[ Vrm\N%c#&dYi'WaW4=uHbgMb][HZ+Yd_t]dfX@G`In*IAKj9QH0g0G3O9bEbU>J.ip`ni/ 54omUlSTqb+VH)]rh>Z:SH)bN@n0g# #i+Zu"UWXXp#NrJ,*9s=aT\K2W_k/N_?#c'FeEt3;j)RhL]t\J3%V`Q@TlgnO\=2L>%F-q 8Zc-Oj&#r]*#9\_@W6hhS<+(\@1>Xbb8`qW!%pbR-%k3#E2t#jAGcjjc32m%eCS#HA=*fd &#c3V;;3Vd?9T$]8;1T.@t%,cL'\55>!RV6o\/PQ1KdU=,`P`"-=\"eNG5,q,U:]?c!r'g 0b^s;-7"a5k7gVP82q(k96B%Hms8!8f2`Z$7(-d]0q(h]4)?#V"r=elf'd#7+'i8[8kVf] 9ft+0]4@b]A.(mdp8g9_,sQL-^5`%?1];&'UJ\K:C@N,f/P%H#=tU$m/YEsIFD2Wp+A4b$3NZRCB;'i+O4dQ;nDurHM:Z!#B[U(=)MOZ*tQ:Yj?bOBVPGV2#jB+dnBb)1(f;'r3,X,1g3-1cUOY@1<1BJ&F+[,sb! V/?@_'Ze6A!"[U2d,m2tbc^A<[+^\0dq7 M,8JTe+3i)-'=P#EnM04FWr0s^Hk1m,?Xa1U/P08k_$b51ru4+,D%l,GLS1AY&bmf,Wcq]"df_L]WSWBXD=JB7MB+bLN?#T>Y4m?:hF^Ijd ?C22Od`m6@H*nd4IX`^[Sq:3,q$+-\e$GjdSJi613Y/BfFU.Bno[&.7V2L38D5[8%4JG@t j*V*`QWUQ;3,&A8K8GOr$4.![P"XQ1M1VN`]3\/Dm>==%C6\+n/VeV^O,?mFH p`6dR2f*b,CCZO!^tEZl/FsF=f\f<020ZS`HY,gZG6jlB/_";>KW6a8[,Zfp,%QZW5RIR, 1`+VH;&."2=b83&HNu`,M5ucMl*]O"RJ.@>,/QoNS:6.;[OP_d)GK"p(k2o:.h+Ik(N>o4 H]ALOnsECD'm?D?Nc=/(bLZ20pc#W`NP0^CIo=Ka[uY6nRB>)?ETF%#3W.E/[EtX^Xdm7u *(-eD]t=!D>*F[mAPj-.Gq0\?Uejq5Y(!f1f+4%MiK\nZ%;!+l>W7'PbNZr(?ti+LeTa4t ]OHXT(+IWkPChV/5oC-U47uf&N?">sfJ+1[lQ@c?\-N(V/f7L[9neV?h.@O0MdtQ0@&9S# a"5Ku)VdhB"+4cQbl:kqfA^_UdCGC?n5uKadC?8@(mNNqJ1RIVE3DA((p^!^SdCk43#Hc2 YB%V_/;b6]h+-Pre!$(4iR'jLWR_'bAH,:=m&k<5#VHV=Y=ggL)B; "X@9gdFrU$3L"TUh$BKU["HSEg=][.=.pZp-I@o#l@Rt#78)c*Y7hRm.\(r?bBFN"mGq(I 92a^SasS2/J\356n8l#K433pFY,5DTr&56%BX>EGlPm[4F9pH#p@IO8QF?bt%:jW=V`?2C kH#Sm$mJmCJ2^lPD,JmXX4&G>_q62u2fCDU=L_$aGAAD[^#I$9$=DTmIF.p)Y#uY!*jHr# `&S]Nh`3)3UQ-U2E,o*)r4$H$-gBeFi@kdj"fng;Er`I_C\!V.lp>!@gV'P-%P6LL-W$#g ^!NX_C8ac.WNlK5k^$mlE=JAHbDJIT"U"Tka-'JT_)6jJ9O5b]8$*^r#S S*@^V.`RZ,Q.T2BkE+D^,uNltf,#TaCLnGZ=0LL=XXg5J- 2QJ?c)'DR6XMZVB?rXjj_,MTe"\97;*]\dmNs$Th65GE4K;,sfToG4"&uDiprtRt@CGu*i WZ5=K7P++pTVr;N=WL"PiaBd2BUUF9L.E62L7gh1+M<8=*0e!h88Ga'8LQhX(bi+%ij+0P ;So`QYtTL!9PFQJ)pIi:CD\GAA+KTBPD%q]9IZ_RQ*IS*0IJ"2<$mDQi=L+D:eOKFL9R>V n-hYOfYHmJLerI!:TaQ/e2C7$j\7ncF7T.68kdb453c*g:"8i&Ctu:5_DO_6mRrT#bH&SU 5G5<7#)YE,OCT@`5dPFsL5[%a!XKKL,tt1Nr.>#?ohD1S9Zc((1r`.!8Ppk!IALjI%)h?6 3:aDaZ6=e\'^(%68d5Aj/c^/(6=Jm]L'7jg..O?i!(="cbe/DU:DWp:e5NaFM]+e*M`Yc3 [5JJN@Vf//$)6h<0h3AXji6;;:?Cj"3>.=/\Y:T(:)kF/!t-75G7$\0#fna+Mke+6;A2RHSH _6le!;CLlc2;QR3L58"h"'8o0R,`u?4VS]LiM8:X9&"tG[IEYY&GtG]F%:pY&[Hh&nJn>! lnN<'Y:-)EeIi`'86h@U9/;C9'JYm"?m$$s%>P8O\ott&qN'&ip1.W_=grMjZ:+RKl+=YBAgP<[Wh1QS;"MHH[Yr3n?T;C4H4Zn^ap?X !+65DKLgFt^+9'<;-d$"F9i6WJ<9Js,QfMIgnco!_W4k;%4Q,dh4oTs!?Is;-,l-tOlN\= a\s]BB)%!31UqKE;7J-57.$K7\.=l[rdp5'<'AZkcBDJiEQnCu3/+#*RbKW6DReE"+94u( =_^aj(pL8uZsX@g:bZEfPsJq\$XpVd@1^tB[TFAC@?\EW0ho&E,jn/3CXdDWE3UroAd/@R @Q'nK,X9caY`r*;7+$Ob6^YO&?*^8GN9'dV(`nXb99YDg#!3FiS4at"M(tkAZ9R7u*YZ@. O`6O1)cej_TF?OeqeDp,S-E\&b)JHTWH16/h(V$3PaXs(`WS" ^LSO])o_dj.e"McLSeP_!2_SJ26D$T%1u+pJKfmn9!*3tsOC`@C?.hN*>_FU2IPF)cJ2mM(*>.\_A 7GkVPK#qCS,R4Gu]/6Z_j'V"i;/aRa"qk2T90=Rt%`fENO'Uh0_FnWIp(4i(jJ!<<-%N,c !ke:bcC)XISScJgcDF(\D[ofsNgRK2"0nni6 ))qa"ldqUL_3Be^,58C4n4I7]B=0Vo5peYp!,r[ecIV;1!DErd00kE?\`5qP/A%\.qO,^t .CnYro_p[jU:Wm6U0(Z%PO8,fe%0eNB<[UnmEU21<9%"68>RdJ,dqR$RmlZ=G^KhZP.00+ Q%`[%Xg?TI%=m@d"<`E+_@T0DKO@,V9eiS)6P=du@_U/$-L"2+g@\lh MgpYW(D,4(Ob)$CI5T-(!Hoa>l>f;0+[@RT=eA*SG7AV$or chOtX`VWT'na3as]&$BDIBcKn'4jd[0.=OGn1q,G$> Ai33n^k&1T.R_)L!<\3J,:c2MS\kR-`M5*)lsgJsf"6G= !q]&@ZT:GE4@9+@6-o`f6to+/ZURW+3uRIrUh?h,)+G;C+CapBPUOG2#QSp*!-E%bj5*8i K#U3((7[9J'PBbe3(&Wo_u`4jLb(.!00O7t!:t!7\0D"6m!t912XGASUngb\aaCI]J ZYY/V9Hf=!2!e-q9PUR 8W0W)KH@J4NK"p<['Smc>^/:lP"FH+.XK2Co"rJLUFl')_!6RQe:>PS3\aR,\cXN@_KCBN 5tYt!/R0YX82!Thi(E?8Oc.mEo'a$bKtc9r^r>%$\o1REOZb_Rk9=CHG5F.noTi:+>,?"05)L-H5$?^rnf6I*"#L /l"7g+=+t@9.)T]O@$3K\>)$sCH2B9]r\T'cE-V44F=b0Aq4uaXk4:ZZb!`Tn'-@h:O>2t 6=S8'rApD]7"_O,HLoIi4%b/7JMbGA*O$P"3_J_`h9*AO:t>MHa^lo 8k_LkI0S(-Sifs\J9,SI+A'5Bd1mT\N#4Fi9eQAZd'I<+a=eoG >qB3.4OfkJ"WPl_850cn!)s$G'Yb6IS[bLD1:7J-bp?94&\+AS-X=?8<%k*Gmk6Xh:e]0_ 74hG0g[ED5RK=#;gb?:lTe5t2,i7#;9Y8U1>^3+h,BI?!*#o;70udOa\A$F e)a(3j*8Ia2c,kAd?O&4CPi+78l=pge9t+6jZc9N"&PO:5J.-Aa<^fo`l(RbJ.43;]ei^e =U`cg!->0\5QJ:4%D6OZ78&KQb=P;]gstbpeEpDi46+e"WrNLuJ[JrTEYuQQ!6J^+JCNGt `FN#jWlmMH!7a@jI)jM!3`ZD-f*dM_`8XhJFU>Ena\?KQ4_mrS[o*BA1S[.bI5BJ\I9,.N .bmlXP=`*oHo0&OemgbHKn7:(IFqhK8%j+FK&'MED)K:)!7b`*"N8r(NCuO/fY(csh38R)5?IfEc=F]@>uet`HeC4C=\YA!/LFP@7+Kp7=Tgh:7:=)O@F:X0ftEV< 2-a1!M,oUDYsAF`GJ; P2&L0gf;>2A96EMQH=Btc"q"B<><@,T%\m#gpKp[m?g"l%omFP*Sb"+_XpiLOO9oR=PV[q 9q\hUhcq2(h#5m\V#9&NWR'qYg>__X?')fQE\b%/dP[cU'kBt\\D,3]?/Z[Voi/f!@QHC) hM$A&h5]),n(8LU"sXOrN?gHMHntHgeIIuNT+9`aj/h9fcm))A)0TXh$q`\,l#.q(U!H??WIJ5PH$O:-efptPpJeL qQZ8]N[lp.^;n>i9CO)@cD5pc:(-)'00#>[SLLFVDC1CZ2Yg\*+&m!o6cW"OL/_jE]hW47u 5F&od<67;PZ":$p5"'KIRl`5$=#oS@#%UXq@c#>a5LRP\;beG8i$C;Y"jMQ:!Q;FpSHqmu $-Y3>;#Y4l[8=X[EDSd]e&`Fmcl6-CK7Yr0`mt0'4X@uL;.kf62mc!9XB8VS>VI+F!O_>g *dhVG27g4k/`((!I+L)aC0s[=kY;smAA)IWAQAFRbQO56%H(eMMb^CZA]:QB>eafcJS:5' =a!t_*<"mhQ"BhQ?3F8.7MRbO;;u2T;%!@PK:5ACDs(i,(i.eka9O4?o"s0uKG;_ZY+Eog :XCq&KEe62jE?)2Ia\sZKEI\JA:lhJ3ll!1kn^5BY+NC$6p-*=!\cnA[CX&0C.6A&a*srP 4U/o1Wrs2?Xj4''["([]?q,YV7(<^0=3ejdl(jSW58+@9b')[%EN<\?4Fm.91p.+enAm:KZ2gK[+#XD1M-9(Wd0^=Z1< \Ai>E6JM(O?jLTpeWXN_6emVYhU]bal0]%E>fKK,`EhZj+`:0r\b"puA<>ttMXI@@=j*j3 U@19g;^0cY5$hMHf(Dl5`G[$!@&)gc4$2n2"VhFLDo1;E[XdUkqFjp,K(I0(oGa<,"[LZ. >il=]*l_M2o1):QY5ALEp"mD]lFsUiDc?sXk6OZ(gW)Q(5@`unD\#_QM:?7CU0rD0?G3<0JnO9lp2l;+N/pLGIVr X#gOCn:+,'/U"8j7YtJBZe,R@k;c8n8ob_H`Kkp,9].rF(+I4ZdG;45oXK#qme*bWfQE!8 /cJ?7oC;N7@IIYp9l<++s"G4/U]W*Rgtamo)"rGYA%,f!)^o^M!;?9X`2cXL:Khr&2,2&t :/_@9^mteKiei53GGrsaYbNYaaXrj.GOL$*s*aYAJTr8gGV=\o5D48RaEUd@G]/@^Iu&?1 M0PYMGculpHiS]Dd](.?GIMqnWZ$D>ij]?Tq(Ig'^QOst$?t4GH"`^nJ!YGAR!GH0>r48`I'nhr&;ZD:W@dCa8BksI%SN.YKVBlc$[:Nr3t""cd$ptR@%`F0,cA< 8uiJYSZ%BA%1gp7q="4.Cj_#MI>>N6\(^`;UFDhgICJ*^s58>:iI2m.IO_B9l3$ouEh<'# HlqAq#c%=o5T"Nq'6!,`&*s4_a8X]VrU-K\J+.punUDYOIjh)];KdD"lOg\HqbP^i+6:@i fDde\Vbur]1+Rg/qg[9<7"%CX!%J*Y#6KPi=<&Li!ej!M0Z[Ka3>%-;@aTG=Ai1Nf7q9sB "GT>iP"B0##cM\^-Ad>N:oLaq)(L2m"Oe5^g`7&taeTQReHUU:U/>UREklFG)Cu"?<8&Wb QV+%'C=RXL,,7c-;Sj.uPrc6QWD;B8lU@]$CURGaf(gFL&MTPG`"Uf<_W_no_/HRd4pL2# _;MPb!*+oY<5i?%R&[93`DXfhC)Lbm?T"7TA2Dd6G$^)7U?&\T!(>NiL"9]%gAPp,?*W+" p=h1=f5nFWDg.]LhZnSHi,I__/1mH-&Y8N=YUDWZ$aIM4n$8pj0;I0U9Y"G4:eSdf)[?T( 0/&s?i3E&!).`F+gd0!Y&O^/d[1WDe*PX&/X1]"Cko;mC1:ZYVt^_'q3b#b/h8:;@%*DD9Vf])8dQ3eM0P2Q)R*th>b^"apV>ST+ 1Ej^i(Ds-He;nb9Xr37 .O;s#2Z'>@Z>2tI;LuY!.9i=BMUIcu:l!"@gLFo5;MhJCeccoPZ\E"M6@4808k,[gc^Ai@ Nm(Zm8Eg!uRFI+X;hY[.*Z1?Fd5EGD1a4_f'+dcY9VbBGLXJX5 Y/r5>hK.'K^u=T@Qf/ZEKVEmsRHlbtd+PGPje0D0<^nII'j).34MX9@*[diCgb`pL'M=?L \E=muV0/r^/INcU`D46'+IlBPSBa^L3SC):-B[R2-J7sGTkT'G0W;S48:9lom+OhBRWqPp l3%X!R#+hAp!m!^r*'VSYB=p/al %sr^oG.G%=.ogsC4JW6YH1&-Y[qZl*EhHI_Rn9KWr@#"+AF;lq.WQI-t=*`uruW:_L6eCpNo0-G7>!'h6pjC45:)G*QoSLW4? UKUQdENSnu^s@j?.d6gd6r=tlVb,"QBN;+6mHNLOoY,$Qe5kcKXGGQ?8GaI*i-E7=6U.Ot 2P\j1Hrp_<4AEd;D>H#L"=*.5bbGd5rT1]dO`s5P74[`3agC+pAm:;s1ctFQL(K&m9$D\sj2hj8h*TP4!7U+jp6Wsg;0P/Vsir[[dMg7SrrX?r(kggVC_#bYH2jV YL^;2;sSjYY4X@MTX4b2FF*_8!MChQJ4E#i4V+7XT&JJ:Vafm_pR:gtj5#"lI,4be](cd& h##f!n6OPnni\GBr+D#ND%i5%)1//9VD-^f:X"(ESR]at^"5Gt?>Ehjkkt1Kf3XflCBL>a #gX[GhS"(n"=_KqpU$F.72'sBTan,pnb6Aii"BK>mq-Yr/`-BKi0Xet%`o^cAGbQADkj]% +2Rg1CO#fIL0C.V^Q)u1E:uV." showpage grestore %%Trailer clhep-2.1.4.1.orig/GenericFunctions/doc/genericFunctions.tex0000755000175000017500000012100707705060311022441 0ustar olesoles\documentclass{report} \input{psfig.sty} \oddsidemargin 0.0in \evensidemargin 0.0in \setlength{\unitlength}{1mm} \textheight 8.75in \textwidth 6.5in \parskip 1.45ex \begin{document} \title{A Library of Function Objects} \author{J. Boudreau, Mark Fischler, Petar Maksimovic} \maketitle \section{Why Function Objects?} \noindent In many applications it is desireable to treat mathematical functions as objects; the action of function-objects on their arguments and on each other (in other words, their algebra) can be defined in C++ so that it reflects the acutal mathematics, and instances of thes functions can be applied flexibly at run time either to data representing arugments or to other functions. Well-known use cases include: plotting, data modelling, simulation, function approximation, and integral transforms. \noindent Using pointers-to-functions is a frequently used approach in either C or FORTRAN which gives some run-time flexibility but not nearly the power of function-objects. Using the native C math library we can write \verb#sin(x)+exp(x)#, but we cannot write \verb#sin+exp# nor pass this sum to other procedures. However, since we are free to overload operators in C++, we can get around this shortcoming by endowing the abstract interface to all function classes with all the operations we want our functions to have. For clarity we have attempted to restrict this interface to mathematically well defined operations, which will be discussed below. Another way to view this design is as one in which the abstract interface to functions permits the function library to be extended {\it not only through subclassing}, but also through ``composition''\footnote{here we mean composition in the sense of obect composition not function composition}. We believe that the composition of functions through arithmetic operations is simple and intuitive since it is based on algebraic rules we've learned during childhood and is expressed in the same natural language. \noindent In addition, we want to control the shape of a function: when we fit a function to data, for example. We can do so by possibly associating one or more {\it parameters} to a function, such as amplitude or frequency, lifetime, or width. This can be accomplished in C++ with parameter objects that can be part of or composed together with the functions. Altering a parameter alters the function or functions of which it is a component. \noindent We have written a small class library (``GenericFunctions'') which implements the features described above, for inclusion in the CLHEP project. Although our class library does not contain a comprehensive set of functions for mathematics and physics, it does provide an extensible framework for developing such a library. At the present writing it contains: \begin{itemize} \item{An abstract base class for functions.} \item{Classes representing parameters.} \item{Arithmetic operations acting on both functions and parameters} \item{Class representing a possibly multidimensional {\it argument} to a function} \item{A small set of implemented functions} \end{itemize} \section{A Word to the Wise} \noindent Somebody told you once that C++ software is self-documenting. Being generally a trusting individual, you believed this for a while. But now, you're not so naive. \noindent You're going to need documentation in order to make sense of the Generic Functions library. {\it This} is the documentation you'll need. There are a large number of classes here that you as a user don't need to know about at all. The header files aren't encrypted so you can browse them if you like, but you won't learn much that way. Read this documention instead. Thank you. \section{Example Application} \noindent Our example application is a program to demonstrate the phenomena of interference and diffraction. This standalone program should allow one to control the width and separation of two slits in a filter, and also the intensity of light from each of the slits. As we change the parameters describing these variables we wish to see the {\it impulse function}, or the intensity of light radiation at the position of the filter, change in real time. Also we wish to simultaneously see the {\it response function} or the intensity pattern on the far screen, change in a way that is controlled by the same parameters. For this example, we are not going to worry about how to display the function. Graphics are outside the scope of the Generic Functions library. However just imagine that there is a plotter somewhere that gets a function object \verb#f# and invokes the function-call operator during plotting, like this: \begin{verbatim} double y = f(x); // f is a function object \end{verbatim} \noindent The construction of functions is more involved than their invocation, so we're going to look at the code that sets up the functions and ties their shapes to the four parameters listed above. This code is shown in Example~\ref{ref:ExampleCode}, while screen shots from an application are shown in Figs.~\ref{ref:WideOpen}, \ref{ref:PartiallyClosed}, and \ref{ref:TotallyClosed}. \noindent Fig.~\ref{ref:WideOpen} shows both slits wide open and the classic double-slit interference pattern on the screen. Fig.~\ref{ref:PartiallyClosed} shows the the pattern when one of the slits is partially closed and the interference fringes are less sharp, and Fig~\ref{ref:TotallyClosed} shows the one of the slits fully closed. In this last case you can see that the interference pattern has turned into a single-slit diffraction pattern. \noindent We have two functions that need to be displayed: the impulse function and the response function. Neither of these functions are part of the library {\it per se}, but we can build them both out of the primitive functions \verb#Rectangular# (for the impulse function) and \verb#Sin# and \verb#Cos# (for the response function). which are in the library. The response function, by the way, is given by the following expression: \begin{displaymath} I = \left[ A_0 \sin{ax/2}/(ax/2) \right ]^2 + \left[ A_1 \sin{ax/2}/(ax/2) \right ]^2 + 2A_0A_1\left[\sin{ax/2}/(ax/2) \right ]^2 \cos{dx} \end{displaymath} where $x=\sin{\theta}$ and $a$ is equal to the slit widht in units of the wavelength, $d$ is equal to the separation between the slits in units of the wavelength, and $A_0$ and $A_1$ are the amplitudes from the two slits. The functions we require are simple enough to be built easily but complicated enough to illustrate several fundamental features of the library. \begin{figure} \centerline{\makebox{\psfig{figure=example.ps}}} \caption{Example. Use of Generic Functions libary. See text for explanation.} \label{ref:ExampleCode} \end{figure} \begin{figure} \centerline{\makebox{\psfig{figure=WideOpen.ps}}} \caption{Picture of the example application which is discussed in the text. Above, the impulse function shows both slots wide open. Each of the sliders changes parameters and causes the plotter to update. Below, the response function shows the classic two-slit interference pattern.} \label{ref:WideOpen} \end{figure} \begin{figure} \centerline{\makebox{\psfig{figure=PartiallyClosed.ps}}} \caption{The parameter values are now changed. All of the functions, both primitive and derived, change their shape in response. Not that changing one parameter has affected both functions.} \label{ref:PartiallyClosed} \end{figure} \begin{figure} \centerline{\makebox{\psfig{figure=TotallyClosed.ps}}} \caption{The second slit has been effectively closed, by setting the intensity of light through this slit to zero. The two-slit interference pattern then reduces to single-slit diffraction. This simple classroom demonstration program can now be used as an aid in discussing optics or quantum mechanics, and can be built in a few lines with a few minutes of programmer's time.} \label{ref:TotallyClosed} \end{figure} \noindent The basic parameters of the model are the intensities of the two slits, the width of the slits (this program does not allow the two slit widths to be varied independently) and the separation. These parameters are set up in lines 1-4 of the example. The variables corresponding to these parameters are called \verb#a1#, \verb#a2#, \verb#s#, and \verb#d#. \noindent However some parameters of the impulse and response functions do not conveniently map onto these parameters but to simple combinations thereof. So, we can make derived parameters out of the basic input parameters. A derived parameter is a \verb#GENPARAMETER#. This is shown in lines 5-8 where derived parameters \verb#x0_0#, \verb#x0_1#, \verb#x1_0#, \verb#x1_1# are defined in terms of input parameters. \noindent The impulse function will be built out of two rectangular functions. So, we instantiate these functions (Line 9), connect their internal parameters to the input parameters (Line 10-11) and to the derived parameters (Lines 12-15). The input parameters are now referenced both by the derived parameters and by functions and {\bf must not go out of scope} until the functions and derived parameters are no longer needed. \noindent Now, whenever we vary the external parameter we're going to change the shape of the function. The two rectangular functions can be added to obtain the response function (Line 16). The sum of the two functions maintains its connections to the controlling parameters. The four parameters with variable names \verb#a1#, \verb#a2#, \verb#s#, and \verb#d# now not only control the two rectangular functions, but also their sum. \noindent In the next few lines we build the response function, which is somewhat more involved. First we make instances of the functions we're going to use (Lines 17-20). Among these functions is a function \verb#x# of class \verb#Variable#, which just returns the value of its argument. We multiply this function by the constant 0.5 and by the Parameter \verb#s# to obtain a new function, \verb#alpha# in Line 21, and then perform a similar set of operations to obtain a function \verb#beta# in Line 22. A derived function is a GENFUNCTION. Our algebra is defined on all of these data types. We also use functions of type \verb#Square#, \verb#Sin#, and \verb#Cos#. \noindent The composition of functions is indicated by parenthensis \verb#()#. The function \verb#square# acts by squaring its argument. The function \verb#amplitude0# is a simple function of the angular distance \verb#x#. So, the function which we naturally express as \verb#square(amplitude0)# in Line 23, is the composition of the function \verb#square# with the function \verb#amplitude0#. In this example, function composition is used again in lines 24-28. \noindent In general, we have tried to design this library so that single dimensional functions, multidimensional functions, double-precision constants and parameters all behave exactly as expected. If you find that they don't, then report it to us. It's a flaw that we want to fix. We have found no technical reason that functions, parameters, and constants cannot be made to mirror quite closely a mathematical language. \noindent After the impulse function and the response function have been defined they can be passed around to other routines that may be written to the abstract interface of all functions, \verb#AbsFunction#. This abstract interface allows one, essentially, to evaluate the function using \verb#operator()(double x)# and to further compose it with functions, scalars, and parameters. In this example the functions \verb#impulse# and \verb#response# are passed on to some plotters. The shape of the function is controlled by the parameters; changing the vlaue of a parameter changes all the shapes of all functions that depend on it, both primitive and derived. In this example we have arranged things so that the parameters are modified when the scale is moved, giving users a way to control the shapes of both functions while seeing the visual representation of the function respond in real time to the scale setting. \section{Automatic derivatives} Any function, whether simple or composite, one dimensional or multidimensional, can return partial derivatives with respect to any argument. The computation is done symbolically, in general, not numerically. In case an analytic derivative is not available for any function, a numerical calculation is provided instead. For one-dimensional functions, the derivative is returned using this method: \begin{verbatim} GENFUNCTION fprime = f.prime(); // F is a GENFUNCTION \end{verbatim} Partial derivatives of multidimensional functions with respect to one of their arguments is taken up in section~\ref{section:multidimensional} below. Information on whether the derivative of a particular function is analytic or not can be obtained through the use of the method \verb+bool AbsFunction::hasAnalyticDerivative() const+. \section{The AbsFunction Class} \noindent The abstract base class for all functions of one or more dimensions is \verb#AbsFunction#. The header file for this class also defines operations on the class. The base class describes the essential behaviour of all functions: \begin{itemize} \item{virtual double operator() (double) const = 0} \item{virtual double operator() (const Argument \&) const = 0;} \item{virtual unsigned int dimensionality() const;} \item{virtual Derivative prime() const;} \item{virtual bool hasAnalyticDerivative() const;} \end{itemize} It also defines a default constructor and a virtual destructor, and hides the copy constructor and the default assignment operator. The data type \verb+Derivative+ is an \verb+AbsFunction+, and may be handled like any other \verb+AbsFunction+. \section {Multidimensional Functions and Arguments} \label{section:multidimensional} \noindent Functions of more than one variable can be defined within this scheme. The way this is handled is using the class \verb+Argument+, which essentially is a vector-like list of double-precision numbers. The argument is constructed using the integer number-of-dimensions; then each element of the argument can be set using \verb#operator[](int i)#; for example: \begin {verbatim} Argument a(2); a[0]=1.0; a[1]=2.0; cout << myFunction(a) << endl; \end{verbatim} \noindent Users should take care to pass to functions an argument of the right dimensionality. Failure to do so will result in a run-time error. In addition care should be excercised when operating on functions with binary operations like addition or multiplication, that the functions both operands has the same dimensionality. Otherwise, a run-time error results. \noindent In case of functions of a one-dimensional argument, one may either call \begin{verbatim} operator() (double) const \end{verbatim} or \begin{verbatim} operator() (const Argument &) const, \end{verbatim} and passing one-dimensional arguments only. For multidimensional functions, one can obtain the partial derivative with respect to any argument using the method \verb+virtual Derivative AbsFunction::partial( unsigned int i) const+. An alternate way to express this depends upon our ability to associate names to components of a multidimensional argument, and is described in the next section. \section {Variables} The class \verb+Variable+ is the most elementary function. The function value it returns is just the argument itself. It is useful because it can be used in function composition, like this: \begin{verbatim} Sin sin; Variable x; GENFUNCTION f = sin(2.0*x); \end{verbatim} The class Variable can also be used to associate names with particular components of a multidimensional argument, using the alternate form of the constructor, like this: \begin{verbatim} Variable x(0), y(1); Genfunction f = cos(y)sin(x) + sin(x)cos(y); \end{verbatim} The function \verb+f+ is now a function of two variables. Alternately, the function may be constructed from the direct product operator \verb+%+, see section~\ref{section:arithmetic} below. If \verb+v+ is a variable and \verb+f+ is a multidimensional function, we can express the partial derivative of \verb+f+ with respect to the variable \verb+v+ like this: \begin{verbatim} GENFUNCTION fPartialV = f.partial(v); \end{verbatim} i.e. using the method \verb+virtual Derivative AbsFunction::partial( const Variable & v) const+. \section{AbsParameters} \noindent \verb#AbsParameter# is an abstract base class for simple parameter classes representing double precision numbers. There are two main types of \verb#AbsParameter#s. The first kind, simply called \verb#Parameter#, comes with certain other services such as upper limits, lower limits, and connections to other parameters. The other kind is composite parameters, resulting from arithmetic operations on parameters. For now we will discuss only the first kind, \verb#Parameter#. Neither class is really intended to be extended any further by users. \section{Parameters} \noindent The first service that parameters perform is to provide limits: it is impossible to set a parameter value outside of its limits--if this is attempted the parameter value will be set to the maximum or minimum allowed value. \noindent Parameters can be made to take their value from other parameters. The programmer sets this relationship through the \verb#connectFrom()# method, as illustrated here: \begin{verbatim} Rectangular rect; Parameter height("Height", 1.0, 0.5, 2.0); rect.height().connectFrom(height); \end{verbatim} \noindent The first line creates a \verb#Rectangular# function. The second line instantiates a parameter object called \verb#height# with name "Height", lower and upper limits of 0.5 and 2 and a value of 1.0; The third line first accesses the internal parameter \verb#height()# used by the function and connects this function permanently to the parameter \verb#height#. \noindent Functions allow access to their parameters. The shape of the function is then determined in one of three ways: \begin{itemize} \item {The default value of the parameter can be taken.} \item {The value of the parameter can be set to a new value.} \item {The value of the parameter can be obtained from another parameter (if the parameter is connected).} \end{itemize} \noindent When functions are used as arguments to arithmetic operations, and their parameters are connected, the connections are maintained in the composite function so created. However if a parameter in a function is connected after the function has been used in creating a composite, the composite function does not respond to changes in the value of the connected parameter. Instead it has the value of the parameter at the time it was created "frozen in. \subsection {Parameter class interface} \noindent Here is the public interface to the parameter class; the destructor, copy constructor , and assignment operator are not included on this list but are defined; the default constructor is not defined. \begin{verbatim} Constructors: Parameter(std::string, double, double x0=-1e100, double xl= 1e100); Accessors: const std::string & getName() const; double getValue() const; double getLowerLimit() const; double getUpperLimit() const; Modifiers: void setValue(double); void setLowerLimit(double lowerLimit); void setUpperLimit(double upperLimit); void connectFrom(Parameter *); Print method: std::ostream & operator << ( std::ostream &, const Parameter &); \end{verbatim} \section {Arithmetic Operations} \label{section:arithmetic} \noindent The result of binary or unary arithmetic operation involving an \verb#AbsFunction# is another \verb#AbsFunction#: however it is special kind of \verb#AbsFunction#; generally the user will not care which kind since the actual return type depends on the last operation to be evaluated in the expression. The user needs to learn one trick, which is to handle the result of the arithmetic operation through the base class. This is demonstrated here where, we multiply an exponential with a cosine: \begin{verbatim} 1 Exponential exp; // makes an exponential 2 Cos cosine; // make a cosine 3 AbsFunction & f = exp*cosine; // multiply the functions. 4 cout << f(5) << endl; // evaluate & print. \end{verbatim} \noindent The third line of this example is standard and safe. It generates a function of class \verb#FunctionProduct#, which also has type \verb#AbsFunction#. All operations on functions return a value that has type \verb#AbsFunction#, although the class depends on the actual operation, e.g. multiplication, division, et cetera. However the user does not care about which {\it class} is returned, but only cares that the return value has {\it type} \verb#AbsFunction#, because he or she should handles it through the base class, \verb#AbsFunction#. \noindent Another way of accomplishing the same thing is provided by the data type \verb#GENFUNCTION#, typedef'd back to \verb#const AbsFunction &#. It allows one to reexpress line 3 above in the following way: \begin {verbatim} GENFUNCTION f = exp*cos; \end{verbatim} \noindent You can use this syntax if you find it more natural. For technically-minded people, the syntax generates a temporary object and a reference thereto. In ANSI standard C++ the temporary is guaranteed to persist until the refererence \verb#f# goes out of scope. \noindent Most of the operations that are valid on functions are also valid on parameters. Two parameters may be added, subtracted, multiplied, and divided-to yield another parameter. As in the case of functions, the return type of an operation yielding a parameter is an \verb#AbsParameter &#, which is typedef'd as \verb#GENPARAMETER#, for example: \begin{verbatim} GENPARAMETER x_s = Delta_m/Gamma; \end{verbatim} where \verb#Delta_m# and \verb#Gamma# are both \verb#AbsParameters#. Finally, operations between \verb#AbsFunctions#, \verb#AbsParameters#, and simple double precision numbers (we'll call them constants) are also defined. Unary negation is also defined on all of these data types. \begin{table*} \begin{center} \begin{tabular}{|l|l|l|l|l|} \hline Symbol & Name & Operand 1 & Operand 2 & return type \\ \hline +,-,* / & Simple & AbsFunction & AbsFunction & AbsFunction \\ & Arithmetic & AbsFunction & Constant & AbsFunction \\ & Operations & Constant & AbsFunction & AbsFunction \\ & & AbsFunction & AbsParameter & AbsFunction \\ & & AbsParameter& AbsFunction & AbsFunction \\ & & AbsParameter& AbsParameter & AbsParameter\\ & & Constant & AbsParameter & AbsParameter\\ & & AbsParameter& Constant & AbsParameter\\ \hline unary - & Negation & AbsFunction & & AbsFunction \\ & & AbsParameter& & AbsParameter\\ \hline () & Composition & AbsFunction & AbsFunction & AbsFunction \\ & & AbsFunction & AbsParameter & AbsParameter\\ \hline \% & Direct Product & AbsFunction & AbsFunction & AbsFunction \\ \hline convolve & Convolution & AbsFunction & AbsFunction & AbsFunction \\ \hline \end{tabular} \end{center} \end{table*} \noindent Three additional operations are defined for functions. The direct product is for constructing multidimensional functions from lower-dimensional functions. For example a multivariate gaussian distribution of two uncorrelated variables could be built from two one dimensional gaussians using the following syntax: \begin{verbatim} Gaussian f; Gaussian g; GENFUNCTION h = f%g; \end{verbatim} \noindent Mathematically, this is equivalent to $f(x)*g(y) = h(x,y)$. Some multidimensional functions may be constructed from lower dimensional functions but of course not all functions can be constructed this way. Where it fails, one can still resort to inheritance and build the needed function by subclassing \verb#AbsFunction#. The picture in Fig.~\ref{ref:hydrogen} illustrates a multidimensional function obtained by forming a three dimensional function from lower dimensional functions, the illustration is the probability density function for a higher excited state of hydrogen. \begin{figure} \centerline{\makebox{\psfig{figure=hydrogen.ps}}} \caption{Multidimensional functions can be expressed as a direct product of lower dimensional functions; this example combines a Legendre Polynomial with the product of an exponential, a power function and a Laguerre Polynomial to obtain the probability density function of an electron in an excited state of hydrogen. The dots are generated by performing a random throwaway against a generic function of three dimensions.} \label{ref:hydrogen} \end{figure} \noindent The composition operator is for taking functions of functions, or functions of parameters. It is denoted with the function call operator, \verb#()#. For example the following syntax is valid: \begin {verbatim} Exponential exponential; Sin sine; GENFUNCTION f = sine(exponential) ; \end{verbatim} \noindent A convolution of two functions has no special symbol-we ran out of them- but is produced with the convolve method. This function performs a numerical convolution of the two functions treating the first function as a response function, the second as a resolution function. The function has two addtional arguments, which are the limits of the numerical convolution. The convolve function is then used like this: \begin{verbatim} Exponential exp; Gaussian gauss; GENFUNCTION h = convolve(exp, gauss, -10.0, 10.0); \end{verbatim} \noindent The technique employed is to sample the product $f(x-y) g(y)$ at 200 points between $x0 < y < x1$, where $f$ is the response function and $g$ is the resolution function. We hope to use Fourier techniques to improve this method in due time. \section{Some Functions in the library} \noindent Several types of functions have been implemented in this scheme. A table of those functions is shown here. Certain functions, such as Legendre Polynomials, take arguments to their constructor that specify the order of the polynomial. In other cases internal parameters govern the shape of the function. The distinction is arbitrary at times, since, for example, Bessel functions need not be of integral order. In general we have preferred to leave parameters out of functions if one can obtain the same result by other means, for example, objects of class \verb#Sin# do not have a frequency parameter since one can obtain this as follows: \begin{verbatim} Parameter freq (``freq'', 10.0); Sin sine; Variable x; GENFUNCTION f = sine(freq*x); \end{verbatim} \begin{table*} \begin{center} \begin{tabular}{|l|l|l|} \hline Function & Name & Parameters \\ \hline Variable & Returns its own input & \\ \hline FixedConstant & Returns a constant & \\ \hline Sqrt & Sqrt & \\ \hline Square & Returns square of input & \\ \hline Power & Returns a power of input & \\ \hline Exp & Exponential & \\ \hline Sin & Sine & \\ \hline Cos & Cosine & \\ \hline Tan & Tangent & \\ \hline Ln & Natural Logarithm & \\ \hline Erf & Error function & \\ \hline ForwardExp & Forward Exponentail tail & decayConstant \\ \hline ReverseExp & Reverse Exponential tail & decayConstant \\ \hline LogGamma & Natural log of Gamma function & \\ \hline IncompleteGamma & Incomplete Gamma Function & a \\ \hline CumulativeChiSquare & Probability($\chi^2$) & \\ \hline Gauss & Gaussian (Normal) distribution & mean \\ & & sigma \\ \hline Landau & Landau distribution & peak \\ & & width \\ \hline Rectangular & Rectangular function & x0 \\ & & x1 \\ & & baseline \\ & & height \\ \hline PeriodicRectangular & Periodic rectangular & spacing \\ & & width \\ & & height \\ \hline SphericalBessel & Spherical Bessel Functions & \\ \hline SphericalNeumann & Spherical Neumann Function & \\ \hline AssociatedLaguerre & Associated Laguerre Polynomial & \\ \hline AssociatedLegendre & Associated Legendre Polynomial & \\ \hline AnalyticConvolution & Moser-Roussarie convolutions & frequency \\ & & lifetime \\ & & resolution \\ \hline IntegralOrder::Bessel & Bessel and Neumann functions & \\ \hline FractionalOrder::Bessel & Bessel and Neumann functions & order \\ \hline BivariateGaussian & Gaussian in 2 variables & mean0, mean1, \\ & & sigma0,sigma1, corr01 \\ \hline TrivariateGaussian & Gaussian in 3 variables & mean[0-2],sigma[0-2] \\ & & corr[0-2][0-2] \\ \hline \end{tabular} \end{center} \end{table*} \section {Parameter to Argument Adaptors} Parameters control the shape of a function, which then act in the space of their arguments. In many applications it is useful to be able to create a new function out of an existing function by treating one of its parameters as an argument. A use case would be the following. Suppose that one has written a function to describe a measured quantity, like lifetime, smeared with a resolution function which is a Gaussian. The resulting function is parametrized by $\sigma$, the width of the Gaussian distribution. However to use this function in an unbinned log likelihood fit, we often need to incorporate event-by-event estimates of $\sigma$. To do this is to formally promote the parameter $\sigma$ to an argument, in other words to turn: \begin {equation} F(\alpha_i, \sigma; x) \end {equation} into \begin{equation} F(\alpha_i; \sigma, x) \end{equation} We do this using a helper class called \verb+ParamToArgAdaptor+. The class is an \verb+AbsFunction+ that takes as arguments to its constructor: \begin{itemize} \item{The name of an auxilary function, whose parameter it is to promote.} \item{The name of a member function of the auxilary function, which accesses the parameter to promote.} \end{itemize} For example, one can turn a smeared expontial function of one variable into a function of two variables, where the second variable is the event-per-event error estimate. \begin{verbatim} Genfun::AnalyticConvolution smearedExponential (Genfun::AnalyticConvolution::SMEARED_EXP); ParamToArgAdaptor smExpEventByEvent(smearedExponential, &AnalyticConvolution::sigma); \end{verbatim} The function \verb+smearedExponential+ is a function of one argument, so the new function \verb+smExpEventByEvent+ is a function of 2 arguments. The last argument is the event-by-event resolution. Scale factors may be added to the newly created function, so that the actual value of the parameter used is some scale factor times the argument provided. The scale factor is in fact a parameter of the adaptor class, accessed via the method \verb+scaleFactor+, and may be set or connected just like any other parameter. In case two parameters need to be promoted along these lines, we provide an additional class: \begin{verbatim} DoubleParamToArgAdaptor \end{verbatim} which differs from \verb+ParamToArgAdaptor+ only by the presence of an additional argument to the constructor (the name of a member function accessing the second parameter to be promoted) and the presence of a second parameter (an additional scale factor). \section {How to extend the Generic Functions package with your own function} \noindent Creating a function for the Generic Function package or inserting an existing function into the framework has low work overhead. Of course if the function is complicated and hard to write, this the framework does not make it easier! However there are only a small number of steps involved in creating a one- or multi-dimensional function and endowing it with parameters that control its shape. We present this procedure as a checklist: \begin{enumerate} \item{Derive your function publically as a subclass of \verb#AbsFunction#.} \item {What is the dimensionality of your function? If the answer is "one", then you don't need to override the method \begin{verbatim} virtual unsigned int dimensionality() const; \end{verbatim} because the base class provides a default implementation which returns the value 1. Otherwise, if your function has two or more dimensions, you will need to override the method.} \item {Which parameters (if any) does your function depend on? For each parameter you need to add a \verb#Parameter# data member for that parameter, and initialize it with its default value and range in the constructor. Also you will want a way of getting a reference to the parameter-and actually you will want two methods, overloaded on const. The purpose of having both methods is so that you will get back a parameter that you can modify if the function itself is modifiable, and a read-only parameter if the function is readonly. If overloading on const is strange to you, you can read up on it in Meyers; or you can just adapt both of these example lines: \begin{verbatim} Parameter & parm(); const Parameter & parm() const; \end{verbatim} which shows, for example how to retrieve a parameter called "parm" from a function. This is important and the compiler errors may appear very mysterious if you don't write your parameter accessors this way.} \item {You must provide an implementation of these two functions which are pure abstract in the base class: \begin{verbatim} virtual double operator() (double) const; virtual double operator() (const Argument &) const; \end{verbatim} These operators are what your function "does" so how you go about doing this is your business. But typically, for one dimensional functions the second form of the function just calls the first; while for multidimensional functions the first form generates a run-time error and the second form checks the dimension of the argument before evaluating it.} \item { The composition operator, \verb#operator()( const AbsFunction &)# is overloaded in the base class and you don't want to hide it in the subclass, so put the line \verb#using AbsFunction::operator()# in the header file of your derived class.} \item {Copy constructors are required for the proper operation of your function within the framework. You can use the compiler-generated copy of this constructor if you wish; the usual caveats about dynamically allocated memory apply here as with any class. The assignment operator is confusing because it only allows one to assign Gaussians to Gaussians, exponentials to exponentials, et cetera, so this function should be turned off. The way to do this is to a) declare the assignment operator, b) make it private, and c) do not provide an implementation.} \item {You will need to declare and define the method: \begin{verbatim} virtual SubClass * clone() const; \end{verbatim} where \verb#SubClass# is your new class. This construction uses the covariant return type mechanism, since the function in the base class returns an \verb#AbsFunction *#. The purpose of the routine is of course to return a pointer to a newly allocated object. The easiest way of implementing this function is to use the copy constructor that you wrote (if you wrote one, otherwise you can take the default copy constructor that the compiler wrote for you).} \item {{\bf Optional} If you will be providing an analytic derivative for your new function, then override the method \begin{verbatim} Derivative partial (unsigned int) const; \end{verbatim} The function \verb+Sin+ provides a good example of how to do this. Should you choose to provide an analytic derivative, you should also then override the method \begin{verbatim} bool hasAnalyticDerivative() const \end{verbatim} so that it returns true. Our preference is to put the implementation right in the header file since it provides useful information (``yes, this class has an analtyic derivative'') for users. } \end{enumerate} \section {Cut classes} GenericFunctions is based on our ability, in C++, to write classes having the algebra of real functions of one or more variables. The same techniques which have been applied here can be used to describe other algebras. In particular, there is an extremely useful extension to {\it cut classes}, which are objects that return a true or false decision on some data type, and which support the algebra of boolean operations. A set of base classes has been written to allow one to create cuts on any data type, to combine them using the operators \verb+||+, \verb+&&+ and! We have written these classes to interoperate with with the standard template library. A simple example will show the usefulness of this. In this example, the cut-object \verb+IsPrime+ and \verb+IsInRange+ have been written as subclasses of \verb+Cut+. In the example we use these cuts to select prime numbers in the range 30-60, and print out the result (31,37, 41, 43, 47, 53, 59) to the terminal screen: \begin{verbatim} int main(int, char **) { // // Make an array of integers: // const int LENGTH=100; int integers[LENGTH]; // // Fill them with the integers: // for (int i=0;i dest(std::cout,"\n"); // // Cut on prime numbers between 30 and 60: // const Cut::Predicate cut = IsPrime() && IsInRange(30, 60); std::remove_copy_if(integers, integers+LENGTH, dest, !cut); // // Bye: // return 0; } \end{verbatim} Let's look in detail at how one of these cut objects was declared (note that it inherits from \verb+Cut+): \begin{verbatim} class IsPrime:public Cut { public: // Constructor: IsPrime(); // Destructor: virtual ~IsPrime(); // Truth operator: bool operator () (const int & arg) const; // Clone virtual IsPrime *clone() const; }; \end{verbatim} Readers familiar with the standard template library will ask, ``How does this relate to STL predicate types? What has been gained, and what has been the cost?'' One has gained the ability to combine existing cut-objects with boolean operations. The cost has been: some virtual function calls in the evaluation of these objects, and the necessity of inheriting from \verb+Cut+, meaning also that two pure virtual functions: \begin{itemize} \item{\verb+virtual Cut * clone() const = 0;+ } \item{\verb+virtual bool operator ()( const Type & t ) const = 0;+} \end{itemize} will have to be defined by the user. Unlike the function-objects, we do not provide any concrete cut-objects. Instead what we provide is the base classes that allow one to easily write STL predicates supporting boolean operations\footnote{To be sure, the STL has a set of classes that allow one to combine cuts using boolean operations, but their interface is appalling.} To access these, include the header file \verb+CLHEP/GenericFunctions/TrackCutBase.hh+. \end{document} clhep-2.1.4.1.orig/GenericFunctions/doc/CMakeLists.txt0000644000175000017500000000040511607661650021156 0ustar olesoles# build GenericFunctions documentation include(ClhepBuildTex) clhep_latex( GenericFunctions genericFunctions example.ps hydrogen.ps PartiallyClosed.ps TotallyClosed.ps WideOpen.ps psfig.sty ) clhep-2.1.4.1.orig/GenericFunctions/doc/example.ps0000755000175000017500000005240107705060311020412 0ustar olesoles%!PS-Adobe-2.0 EPSF-2.0 %%Title: example.eps %%Creator: xwpick Version 2.20 Rev: 20/09/94 - by Evgeni Chernyaev %%CreationDate: Tue Aug 15 19:36:55 2000 %%BoundingBox: 0 0 514 470 %%EndComments %*********************************************************************** %* * %* Function: Display a Lempel-Ziv Welch (LZW) encoded color image. * %* This is an Encapsulated PostScript file suitable for any * % kind of PostScript printer: Level I/II, color/grayscale...* %* To optimize output on GrayScale printers you may uncomment* %* line '/GRAYneeded true def'. * %* * %* Author: Evgeni CHERNYAEV (chernaev@vxcern.cern.ch) * %* * %*********************************************************************** gsave userdict begin /EPSneeded true def %/GRAYneeded true def end %*********************************************************************** %* Image Description * %*********************************************************************** /colomns 514 def /rows 470 def /mm {2.835 mul} def userdict /EPSneeded known { /EPSneeded userdict /EPSneeded get def }{ /EPSneeded false def } ifelse userdict /GRAYneeded known { /GRAYneeded userdict /GRAYneeded get def }{ /GRAYneeded false def } ifelse EPSneeded { /IfRotate false def /MarginX 0 def /MarginY 0 def /Ymax rows def /Xmax colomns def /Ymin 0 def /Xmin 0 def }{ /IfRotate colomns rows gt {true} {false} ifelse def /MarginX 8 mm def /MarginY 18 mm def 0 0 moveto clippath pathbbox /Ymax exch def /Xmax exch def /Ymin exch def /Xmin exch def } ifelse /IfColor systemdict /colorimage known {true} {false} ifelse def GRAYneeded {/IfColor false def} if /IfLevel2 systemdict /filter known systemdict /setcolorspace known and {true} {false} ifelse def %*********************************************************************** % Procedures * %*********************************************************************** /Table 4096 array def /StrArray 10 array def /InLine 70 string def /BinCodes 112 string def /CurBit 0 def /FreeCode 258 def /CurCodeSize 9 def /CurMask 511 def /incr IfColor {3} {1} ifelse def IfLevel2 not {/setcolorspace null def /filter null def} if %*********************************************************************** /ReadLine { % Read Next Data Line (ASCII85 decode) * %*********************************************************************** BinCodes 0 BinCodes 56 56 getinterval putinterval currentfile InLine readline pop pop 1 1 14 { /i exch 1 sub def /k i 5 mul def /c1 InLine k get 33 sub 255 and def /rest c1 1868977 mul InLine k 1 add get 33 sub 255 and 614125 mul add InLine k 2 add get 33 sub 255 and 7225 mul add InLine k 3 add get 33 sub 255 and 85 mul add InLine k 4 add get 33 sub 255 and add def /k i 4 mul 56 add def BinCodes k c1 3 mul rest 16777216 idiv add 255 and put /rest rest 16777216 mod def BinCodes k 1 add rest 65536 idiv put BinCodes k 2 add rest 256 idiv 255 and put BinCodes k 3 add rest 255 and put } for } bind def %*********************************************************************** /ReadCode { % Read next code * %*********************************************************************** /CurByte CurBit 8 idiv def /CurCode BinCodes CurByte get 8 bitshift BinCodes CurByte 1 add get add 8 bitshift BinCodes CurByte 2 add get add CurCodeSize CurBit 7 and add 24 sub bitshift CurMask and def /CurBit CurBit CurCodeSize add dup 448 ge {ReadLine 448 sub} if def } bind def %*********************************************************************** /DecodeCode { % Decode CurCode * %*********************************************************************** ReadCode CurCode 256 eq { /FreeCode 258 def /CurCodeSize 9 def /CurMask 511 def /StrInd -1 def /Lrest 0 def ReadCode }{ L Lrest gt { /StrInd StrInd 1 add def /Lrest 65535 def StrArray StrInd get null eq {StrArray StrInd 65535 string put} if /CurStr StrArray StrInd get def } if Table FreeCode CurStr 65535 Lrest sub L getinterval dup 0 Table OldCode get putinterval dup L incr sub Table CurCode FreeCode lt {CurCode} {OldCode} ifelse get 0 incr getinterval putinterval put /Lrest Lrest L sub def /FreeCode FreeCode 1 add def FreeCode CurMask ge CurCodeSize 12 lt and { /CurCodeSize CurCodeSize 1 add def /CurMask CurMask 1 bitshift 1 add def } if } ifelse /OldCode CurCode def Table CurCode get dup length incr add /L exch def } bind def %*********************************************************************** /DisplayImage { % Display a LZW-encoded color image * %*********************************************************************** /DelX Xmax Xmin sub MarginX 2 mul sub def /DelY Ymax Ymin sub MarginY 2 mul sub def /SizeX IfRotate {rows} {colomns} ifelse def /SizeY IfRotate {colomns} {rows} ifelse def /FactorX DelX SizeX div def /FactorY DelY SizeY div def /Factor FactorX FactorY le {FactorX} {FactorY} ifelse def /ScaleX SizeX Factor mul def /ScaleY SizeY Factor mul def Xmin DelX ScaleX sub 2 div MarginX add add Ymin DelY ScaleY sub 2 div MarginY add add translate IfRotate {ScaleY ScaleX} {ScaleX ScaleY} ifelse scale /Palette currentfile 768 string readhexstring pop def currentfile InLine readline pop pop IfColor not { 0 1 255 { Palette exch dup /i exch 3 mul def Palette i 0 add get 0.299 mul Palette i 1 add get 0.587 mul add Palette i 2 add get 0.114 mul add cvi put } for /Palette Palette 0 256 getinterval def } if /Matr IfRotate {[0 colomns rows 0 0 0]} {[colomns 0 0 rows neg 0 rows]} ifelse def IfLevel2 { [/Indexed IfColor {/DeviceRGB} {/DeviceGray} ifelse 255 Palette] setcolorspace /infile currentfile /ASCII85Decode filter /LZWDecode filter def 8 dict dup /ImageType 1 put dup /Width colomns put dup /Height rows put dup /BitsPerComponent 8 put dup /ImageMatrix Matr put dup /Interpolate false put dup /Decode [0 255] put dup /DataSource infile put image }{ 0 1 255 { Table exch dup incr mul Palette exch incr getinterval put } for ReadLine ReadLine colomns rows 8 Matr {DecodeCode} IfColor {false 3 colorimage} {image} ifelse } ifelse } bind def %*********************************************************************** %* Image decoding * %*********************************************************************** DisplayImage cdcdcd 000000 0000fe fe0000 8b008b 218921 fefefe cd0000 7acac5 68aca7 c5e8e5 416b68 ffffff 78a0d4 6688b4 c4d5ec 3e536e ffffff 9f9abe 8783a2 d5d3e3 545265 ffffff 3296c6 2a80a8 a3d0e5 194b63 ffffff e19c83 bf846f f2d3c8 775345 ffffff 768ba0 647788 c1cbd4 3b4650 ffffff 505e85 445071 adb3c6 252c3f ffffff 78a0d4 e1e1e1 afafaf 4b4b4b c8c8c8 ff00ff ffff00 ff0000 969696 646464 0000ff 00ff00 7d7d7d 323232 8a98b4 ffcc33 bbcfe9 ffff00 ccff00 ffcc00 cccc00 ff99ff cc99ff ff66ff cc66ff ff99cc cc99cc ff66cc cc66cc ff33ff cc33ff ff00ff cc00ff ff33cc cc33cc ff00cc cc00cc 99ffff 66ffff 99ccff 66ccff 99ffcc 66ffcc 99cccc 66cccc 33ffff 00ffff 33ccff 00ccff 33ffcc 00ffcc 33cccc 00cccc 9999ff 6699ff 9966ff 6666ff 9999cc 6699cc 9966cc 6666cc 3399ff 0099ff 3366ff 0066ff 3399cc 0099cc 3366cc 0066cc 9933ff 6633ff 9900ff 6600ff 9933cc 6633cc 9900cc 6600cc 3333ff 0033ff 3300ff 0000ff 3333cc 0033cc 3300cc 0000cc ff9999 cc9999 ff6699 cc6699 ff9966 cc9966 ff6666 cc6666 ff3399 cc3399 ff0099 cc0099 ff3366 cc3366 ff0066 cc0066 99ff99 66ff99 99cc99 66cc99 99ff66 66ff66 99cc66 66cc66 33ff99 00ff99 33cc99 00cc99 33ff66 00ff66 33cc66 00cc66 999999 669999 996699 666699 999966 669966 996666 666666 339999 009999 336699 006699 339966 009966 336666 006666 993399 663399 990099 660099 993366 663366 990066 660066 333399 003399 330099 000099 333366 003366 330066 000066 ff9933 cc9933 ff6633 cc6633 ff9900 cc9900 ff6600 cc6600 ff3333 cc3333 ff0033 cc0033 ff3300 cc3300 ff0000 cc0000 99ff33 66ff33 99cc33 66cc33 99ff00 66ff00 99cc00 66cc00 33ff33 00ff33 33cc33 00cc33 33ff00 00ff00 33cc00 00cc00 999933 669933 996633 666633 999900 669900 996600 666600 339933 009933 336633 006633 339900 009900 336600 006600 993333 663333 990033 660033 993300 663300 990000 660000 333333 003333 330033 000033 333300 003300 330000 000000 J,g]g3$]7K#D>EP:q1$o*=mro@So+\<\5,H7Uo<*jE<[.O@Wn[3@'nb-^757;Rp>H>q_R= AlC^cenm@9:1mM9jS"!dTMT<$3[GQ$8#0$s<4ZX!SPQ1`C/mPVajn=1L]tj%Q)oRX&KUZF(fXtb8!=HEmY'5ei %aen1jY7WX[RSXLb\-LV+9kV3V:9.a\h+\a=c15cG#96,-R5S,mVVZ'-KBNIhWt(C--PH;qHZ94#HOiLEI'`0k&7Aqe*o>'*'U![i6:K"2][ZPh:(*Nofb":s-4&2 mle:3B)eC]^@/-#h)Q!n%0OC^;jdQfD7bi15d-\"!P#:ZT]WfR]GT'aE5W>!^(?/5m''32 0r,I&_LtV)%*pb(L_SF3bp[ta2Pd[*2_7U@4O5NO+>!IU +]A/(5p:=/5<,>m%.&o"<([BaU=;TY8(*8(+\)MGU.7kO1X$:kdjQdRK[a].91dTsN=/@R P\hd,9XS/7=f<'-%9H;HUuP_/1F2]U:39Ke?IBM*Z@Z$$FOrl&PU+".TQC&3JQ`$WT5!#F `N*h/(@A#3;"^)?Nn)36bApif"_rle[+/k]?*t.%GG)DsC]ITs`K']DeK(Q#<*#!bC1*D] %>3Be&ku,+kggZ(@JFuoLfWcbms"sMM>Z.h3=fuhBR>O1D[)B(nT`$,ajTl>\'&WKPqQiToG+d[o@O"0QWnXA?`Rl4AjsgTg\!E_j#D6aNa5paWS?pA s&#koRh@mAGPT!niV+eiGN*Dp8!Kc[ra25ZqAt\2G:JnQN'CK"$,[NWV6i6^=ZV5VUm^;oT*TDOo=)7PM0;W0mZXir8#n)2M?3RUs_YtYj k't_MY/(Aj:E'AF;$lbNX2NGignU'7:\!b4-e.9d4$QGU!H#BdU;,M>rcARND`QCsR[MW. K'i[FWqQf&8PSE*E DUGdC2\=7Z48C#D-+=H*RhR#leS6_%]>mt=VW#]2I'E/o5pgFa;lLIS&5iil2[n&>'M<(: 1).alXNVT8;df,qPX*lCnmbN3Dsdd/8Vk#SUu[ANZ6D(ik1$me$mo>#SUNKjSL`HqFD>hn dC6"NcD&OPOH&ZJa>.TN88F)bMombJ3&ou)U5rCeSRa`loa+f*Uh,\1dRP)Dl))*JFRG^f 4"*"hh0]$_o+!Fe3PP86446]`!0k5Ifc[$mnTD1;,Ymo)-(]MXSs/RH:Pnm3kQLuoO7Ii8 Q#D 8`1TEO6Y;PZZiB?,W'mf[&AVTLeNmEj)^4M_3hdp/P[_Q1Y1"Wqu))cFRu?LPno@.9F1jYbka;K5[psl+5Kh\)0jGIIG/N ^I]pL'3dP%$0;)@YF./n)j=QC[=PB8b)+PE3H\I^0SYr#MW$uE"Da!!:0.eOhYMA+.Jo4' fKKuur$<.A`ReAtgG#AP5CR<966e;FP)+]XD[[q$OGdsa/H'@dbu3Cjq'2<$KRL/Z6Pdrn04"!/n:NUc s&[dt?e-P2XKWKRh`7N41E1@gX[>D:GbLO:jIW,J(F`E:T;,U!^rb#bS`RI@3b23i^]Z_a k)@Q_kX:KZ(.U:BbbLHoSZBI^k/u/a`mCg4PcU"N5&%Lb']kXj`>7cGAhA4FE8HK#&`rmn k4P_B',IXXIUp:M)jlP:p%5D0N V5>p$N?[#RQ!`?K(%6n@hBdaSDb]t!2uCaXS-OXb?4FaG7g\-Z08=H&*Q.Z-&`R%kMK)rS `V@Ikj'6M_ES`k!q$/)(>`Y%g?;8Q;7k*G3&J=TZ%h!94V_s3/?i]9P70;]qbJ:Hi7Ls47hPh<_'P$[3j9N"J!7lH!V>*jg.KOj@pZ?,5hM';O5W$1[9CJ&HLDP(aFm 1@Y8MIX"W3KhnV#n]4)>U#.POqdLN9h5AD@?R/kO\`rcXe'o;>+HKB4M2h@X_^mH%>?:cV+2h:U/4[oAq1qiA_;D*li-gK6cfC=ek`k61R.(+SciD'p #5Onm!KZmNYSM\H')E.6J*O>qAj$%_?N?ra[S$&j-A_[G#mB`l![T%oYM.$Y==nJj#;=eIDqP+^9"%GHY6?Q^E.%bkFSo\_ _6$=bd"X&E2#bhS#&jLI&*jWXB3$PEadc-[:\2$jm3$^*RM.$#QM,8nnR(_P?/dOls;h\4$B#-`dkZ6cm^7oIjd(+.'efGOWP2KN^r"<.C,HDns:J^TMBO#3g,aJjOGZA U*UGL+EFKYORi7OZNs@4h=4&NnP&i^+UmiV-]A9\@[Sb.1G2.1K2BH(Z.T%QE<&k%h%JBd Eo/JNPqG<(/rbO_O_0B1#Zsmc,Kdm@n&G0B*@.k8^p#1?6A6rNXYA#A)_a&Rk\gQe6Sni86!?EbE%<2h5!b!lM!AfF:*\8TYEm"b[cI1'WW/P-^o)CRA8JD]C2?J4TUq8OE <-Kfr$-'K`0U-]9SHht^q1lp8Bi?N\N$<>)+B+OJn@JtS4Z?<3,nnF^E6U@>d)FI=hc$s/ o".!*bq*hpcRYb;&PF\]4[1Hf-I?ra&Q95q*s,'<-kkGao'&7(&N`r%+`nA`Ynnk[S3uk2 /^tq1oIqb7:b?\e*39N8,)n]`Y![^ES`,6IKd>V&;Z.I3UG03O;!s#?l,o #6(nb,#gWn$].>L/D,$:R8Q6c;\_jPD(b$;Z"5/F"]?&Z;A-5o!ZOZ>>8G`5;5gZcE9/FGM'-m05>SgSF\J`1 q^o*p(UB5iL#G;I4T`"<PHV-7f3k(726mUGAPYThW!kMgnoU8_B"Bj5%'k[Irf"'?c?c!8+*pS(AfKT[OeiEW** 5BY98,?=\FP@gu`g='s96?<-D;FmLFJ#Vm.f>LiH>j@]%H9^.0^knYa=Nq2nP 1dqpk4c`Y;@j(&I2.D5DnDn:gNrDN:CL`EC4I.Zg2Gcn]a("aOl(gl=(&ML+_.Ap-7,p.: %pVPu[d#b[4#SSS(-q>3ASH,i6>l5WcLaA&[;'VD kk:hBG0+M%l"i"/C_#SecU."P(Mn9TD>)aK!F>lp8qM?gd/rf#79K5X*bXm#G]CD]`r$N]_saC:>j< cP^Qn-Y`;WF8!W=NqISa)f#S5E`SrS%ik)b'),H"GRlu&QJ6KT"`n2HCnp*5[ddpQQ#3\7 E`Y>IJ!0=$(XfQOfYJrZ4[eAu9+pt]Bg0iU8O)_GNftt\eEo]pTp=;@ OgJU=<@(7_.?tTfbIL\"\S78TV2e]28i^`GZWiSK(RK7r(:c#^q)]KJnH%_.PF887=^]bs Z&,j oq5h>?&Q&eQGtW/\b7>I#<^L$]?T`3dOe!?Il64e2"a-@ZS/&:@$)?LRM.a0c%-YROcJa- 6q;*f08g^B+-9XUQ'pHoF+jVD:q:O$7/:m8WK>gK7fs>l+d'+$PGFr]O/3ABV-6rqfajA^ K9C04rn/L)W3JAR2c=J(S*_^tYQ$VOLHt)pC`1^!)/G]S%ni#!QeJg1&f";`JY_[?XL!== oa@QOhkQEaQ1HH!':2R]!b*j$de`]7.lQ#u],p>gXu\Em)X.)[OcqJqWHi\X&WrF6UR.H! R;#)N)N>ZHDjsUUQkVKN4c(Q\W(i4&]V_e&#=h_Gq:>G"Rh,sJ@]*"]1 B%8t',7R5/)g%Y[A#PCQQMZ8i3\S#?PrjeVt@!VU.q1>%AXjlYi8NS bC`Saf=/&H\[]>:qYd-Yo1u92UmaTFgC$JTbtL,&SJkj6#/.FK5(i6t2`iss;*@+TZ)2SY CsiNTg4L>k=$lfI3nZBZpuRu+%o?IRPkq(+WduuEQ)_6'%%?%]HMt[cUVp$OQ(#OleInei h,;ouc8uKQEWnj'Q`ZKt;jg(b]865%8XOe0R(Q?+>SFuE>HUsP`Y5*'*0CW!5)C3^^0Fq[ RhqP.TsC1=`#J`XZ9(sS6-+F:RFI3YdN,**;&($9OI>'nH0(*gF2-*q[-:/`qKWT-F3\"/ '^_g2ZXFo9`_p0:+^]!EH&Xf[L3S@Cog>dMV$6Pu?,!'-O/rP,n5q#!8!SbofM3S%]1^3ojr:L)M4I>=\a\_%:]BH678 C^m^V6dbisdn1G)rDD^:K@8Lue6[73&ngD,KR%ti-(QEpY`^MMKchFXdqHds^(W%;\`UuD %_I1b/2Q%gD6H8rh[Lsb_I_:3LY(g12YIC%b_;rWoKi4aK8^l[E`uXn8IB21LFksYae@J&F hY1'"\aSAAnrqS'IkBn++iruqah$3p9Pg&,"actp>4.a_Ee/B&3M++1: kjjO7XtMC/;rG%YKG(+YWDpYJLn"eq>b=e7eAtX1).]"8X0F(LQ6Qj8c>E9e9W#KgV,sh+ GeC2u8AAO$(`X;$+)8JZCK3BL.\eYUb,1PQ#"F)gS_>U)ClJ5Z8t9.,H0j+&0mni:2&`#d Y??R`jWg.]]i,pWX_Y50C'5nYRbpmmf)7eI7CeoK2A&[7*rD,`CO.!BQVMC4i5`)aD6+gt Vp]BAqn!(@JXbWdl'u#a0#,Ktl$WG*Qd=phnRV>Vb\_"er7XC%X3/OCYRAPT3KQVc"?e=5 NmP6h4;@k/&&[cB6L_jJl`H2aWiIW]oKK95E#RHA5`i#@Z:+4ld^(BB>3<&m&W5B^`X@FP (W=^b$QD2\Cbm5*E[6PP2=`Lo+M+b8P:&rmKVH/m16OL@UscoV/PC-F].YE^$tCs7F!Spb 9_1[$2)S.9`5+O@ZZ.P>e!qiC8J>A#4X5lL.\jFNK(h2im\JT$UiUAV+OK_]pI@pf>6+*< 08&:SYO>A2o2;sVWCPG/bm`qh.YL;'<4*uK)UQnE!)Z ]MVL-F'?OP].a%!!$Kde*BZZQ>rLV#9Z&LC7di^gpK,qpmj?"3-,VI@[QD#4;Jt9enQ8ij XP_#4`1(VuN?&=3=nMCW5?q:N\T1YmA$pkP:PF-se$)R&!FJp)Z[0I_R,$"%m^^Pc[m`&AaG2-+Kl<7Nj&lR];`HZiFEgeSa*\g;Wp Jd>=%IQFn:u8HD6=YdL6<4Wp=ujK^r(moe3K7HR?p(9KP/][;C8&gL7cW'ZXg\ F]=&^WB5:p.nj,p'rW\\rI:_O&T#A$_jOQnU2Fgb1Tr?VNqK^9aPIXO@(j5"Wk..B*l7/:6n Vh%T8&=E/\AY#66KhmiqWODZshRhHqL\:S_<=jdZOYT)(%G8C<=UA9,11kE(*OmD;B3ZsC BH:jZ!7+A;43KfksVtbdgAenln`:q_#t&V3\Fb OA"S9/`oB"R:LVUbQQNOLpY*dP1!i2#,hL!PYnN/,*m@">RBhkY.1oEaoSWl$c9j/E&BQXl\':Oah R?^.<>goE(DN@Yp5t>Vu'Vc;`OjRnm0.3#4Q4t&]:jN^m`<0Cff$%59W[/$AZR[2=B a$-K`ih^c!T@(3Y4DF1IV3Ms^OG]/hBUpcPog"I6\j&Ps767GK>,G:<8NZ3K#pXS5Vq$Z/ ;/%%PVq#sgjI)lZ'B4AfNT5! &l!PL',#ai8]s:K`;-.6(3IfJ2aF6gTV%GQF\^[g;'i=8['TV*g*u?$CqR'Zp8WYg.jU4X UiDgrk2.s&HZ/OpB#kg@em4/I+"e0Id@8<>B<[r5Wup^VCRG0g0X>aJ!R*!A<,cGb,MfC8YjI?M5G`6c;"jLeR$9n(^^m9^JeH_L]< L!H@i7f3]P0LbPC\09$XX7Z\"L(TTR&]hnfSFMm#eo1)(g(eDrLG;\'_g&@$@f0YnEL&E# P"#&?K39>NTc+_5tYFY<#i7l[q*R&=^!;&2]dd45?sk')lC"<(8* -6$L^W?39G*Q&\?/\h%iZ;DrWP:B#2k3S$u1JB[H=gCK%QR_qU+Y:fq#;7X@_4@@-15m#0 hr7=[8'qWEMPuN)@-n,n8fiQ3>$"@2I5.U@es_MrT/u5Hqg^HNOOP1Q4@5"OWH"f5FYSqD Ou@-UnpubN3iYFaXV1IHGs[-;EZ&>=rJ%_eGXYes>ol.L``VY,L-H'aq\kQ1iMK jVr(b6:O/Oq%"4j56#-RP0ifkB?9kl[IH"]>0V7M;.h/@iN8Ud[=5FfqS.!;`=>D^5.^0# \bD;*2$;c"3Q,Gl;t[Tr!OeDZ4EFttWr!rah`n/^^UossJZ-):dhK.H^&,a[Ro2@O)*6`p 0G3:Vqa*DCr&YQ],/Kcnb5@G(^7&h\T_V&AqD^U",.hq5(ZZE!RcM0#)aV[g$:3[;,Fo=& _ElkZThF1G.O0ta_*J2K^#TWm+`sq=dQjX2:7R)Un]! @Efg.cB(.?T+ioi)r&1c)P1Yf4kpoB'J_aRoGrMH524H"6p;a"r&QWT+RBfKd:YDN0g5_. 5C*#f9LGG21cFq0(!++tF.>;fl]>?.6qg:kPOHG"P!++4Mm=0fX)Z&sU;S4)Qc\O2jA*DS M*MrsMVM@RX8p2-$F[Mc25EN&1AsW]6"`nYH$lu,Ah0>Zn\USCW$qg/rT.Zg$]_-%j8>Q)3^CS^!f0Vfp_@2hO,-UpdV Y=YG.K/l#<`'a^i^GEP10j$YNGHp[OV%c#*KIb$(Bu8?OT/81@qpCn/JO9!N7,-5/`,q79 Ku[(dYa\\."Br`cMF`r(89tY01NGXPhDr_.47!S=Z4/GaK"cUBU#Ddg<#2Yt=usKS4jaJ, .mp,E.lNku6dt&5MrVPL[tW^E#4^RRYSC!NmAcldoC9*?k?'KWfnKV*'N a[=Vs60UXsqS*?lTq#)j_1G:kYar^=a'80pFBgl4!4+5AbQ.8il^u6M3Z!KC.0u$b/@7$ jBb)e3_S5(1k]71FOJ=u,#.I;gY&t#R,=9a&e3RK0_HFgI0j2;m_T0SAd"%:K RP^6;mQLd6$*8d#oRtBB8P'm#9O*h,'N%9JQ-lXa;)Eg?KNHL$rQ,cNaTR8p!_5,drPWM. _Se%D>aA$I]ZGLW8W!I=RsMh#F3nqP4Tq=M@HF6R;)0Dl9L1a=+U+/4Ptkd];FM_GbMk_H oKF!L2&Y/nUd7V[gs*dn:@XYnAC=%3dEVn7`?d^m"9M5M,J]4U^-b%`I^REED+P66cQJ80Ps-!N7gdN4%cTdYKY3aXC"5H@6\kke,"@ckB!t`JiIFMj:\i=T_mZ`+%%tHQkli :HX'Rm1.eiOq>ip_^mXg4_18IM8IMn=c#"71PX(Y-+r!b;9bY#21*rKld!Co7m.R>io\>[ oY/iF7"L'+nW?G'>?&RGd_0CVrEWTLCXIs\e7$V9go+DY3EnQB(H%u2`*L9/#29:[g4Q$N X4>cp>La?'e&84heN:K^YM56aaISsIFOi+9Iaeh?>?gXHbr]+aS(nS?c:*-$W49>WI+%Z\ 4D\Y.Kdo[#GbWH[>E-`M'oH9H7bp5W,ZU_t?.Upp"Bg@KP#Rs.39IU`f?sM@Z"!7O(#L1j grM>HR>p(UPM\T!i7e^3M!tFODN-qqd/+R %-[B8APQI@'gUj:C5Tj&QKtc3u3^^&LEg$AoT.i%>Mt2>U[? %a?=)ho[$A"e/pY$FtP($4[*p4o&H]l/E0I@IQ!@:g!Wr@lku09IkB;!al"/i6tLf1@*K?X=Q*c5>Mp5[S[9970?>FqNWg :GXmd_:*+-mMBEB:#l3hiV!H!%Sku[4[f6Ei=T+#"fGoa.qM0m@;Zq?r[Yt-&E'mldBoh" /h5F+U1%A6iFZ'I:)@LFVe)Oqf'U,sXt[*LULGQM@*SFT(,',D79CTUake;3-:A6eE_S_\ OqqEZSieW+FcpokkB8tI?;]mAO66X#jgKPLlQE\YAE*:G#qgX=R#G\iKBOq>BL[U[^4^/p "R$muk_gYJk"%+gUuLf:ka$qd5)N]JO6!HV$"eqUD@^FkI9r#dB2p,<]VI@?M<8]2kK]1M `XHQN?Kk4RB^h$q2IC1GXMdKSkP^SN*bXX7DJ<-GBGMcV7W2fQ"_8[:@>4Sd*UN&lDWs?b C9DJicD]e6Rqeh&j=[TIjpgW/"Odj%>ht4G2E>?o9O``LC:6e$Q=k!IAnGA_AlcG%rhJ\; TBb"@jOR>t%UEm7YA34)CdU?/q$H,2N%_&fBQgt%b\Rd*i)[^-T"eX(cKnTJCsH?t -DYITLhW0fAo>n1Cn3qYo.E1%$+?#a0$nC:^hmE/CZa1R:)301NU+%#lCQjJ%c;-KdVTcZ B`29!NUj;1e;:>@m7q6\#/]dtRr&Yslcs\@riBuIlt&rZm,#ql7V-CJn8@@bEM".hY8_Jr*-':F EShgWmiQQL+E@u9EZZKG0-bL%,]Z[,EaL/6D^TQ2J:I ~> showpage grestore %%Trailer clhep-2.1.4.1.orig/GenericFunctions/doc/WideOpen.ps0000755000175000017500000004763707705060311020510 0ustar olesoles%!PS-Adobe-2.0 EPSF-2.0 %%Title: WideOpen.eps %%Creator: xwpick Version 2.20 Rev: 20/09/94 - by Evgeni Chernyaev %%CreationDate: Tue Aug 15 19:35:55 2000 %%BoundingBox: 0 0 480 629 %%EndComments %*********************************************************************** %* * %* Function: Display a Lempel-Ziv Welch (LZW) encoded color image. * %* This is an Encapsulated PostScript file suitable for any * % kind of PostScript printer: Level I/II, color/grayscale...* %* To optimize output on GrayScale printers you may uncomment* %* line '/GRAYneeded true def'. * %* * %* Author: Evgeni CHERNYAEV (chernaev@vxcern.cern.ch) * %* * %*********************************************************************** gsave userdict begin /EPSneeded true def %/GRAYneeded true def end %*********************************************************************** %* Image Description * %*********************************************************************** /colomns 480 def /rows 629 def /mm {2.835 mul} def userdict /EPSneeded known { /EPSneeded userdict /EPSneeded get def }{ /EPSneeded false def } ifelse userdict /GRAYneeded known { /GRAYneeded userdict /GRAYneeded get def }{ /GRAYneeded false def } ifelse EPSneeded { /IfRotate false def /MarginX 0 def /MarginY 0 def /Ymax rows def /Xmax colomns def /Ymin 0 def /Xmin 0 def }{ /IfRotate colomns rows gt {true} {false} ifelse def /MarginX 8 mm def /MarginY 18 mm def 0 0 moveto clippath pathbbox /Ymax exch def /Xmax exch def /Ymin exch def /Xmin exch def } ifelse /IfColor systemdict /colorimage known {true} {false} ifelse def GRAYneeded {/IfColor false def} if /IfLevel2 systemdict /filter known systemdict /setcolorspace known and {true} {false} ifelse def %*********************************************************************** % Procedures * %*********************************************************************** /Table 4096 array def /StrArray 10 array def /InLine 70 string def /BinCodes 112 string def /CurBit 0 def /FreeCode 258 def /CurCodeSize 9 def /CurMask 511 def /incr IfColor {3} {1} ifelse def IfLevel2 not {/setcolorspace null def /filter null def} if %*********************************************************************** /ReadLine { % Read Next Data Line (ASCII85 decode) * %*********************************************************************** BinCodes 0 BinCodes 56 56 getinterval putinterval currentfile InLine readline pop pop 1 1 14 { /i exch 1 sub def /k i 5 mul def /c1 InLine k get 33 sub 255 and def /rest c1 1868977 mul InLine k 1 add get 33 sub 255 and 614125 mul add InLine k 2 add get 33 sub 255 and 7225 mul add InLine k 3 add get 33 sub 255 and 85 mul add InLine k 4 add get 33 sub 255 and add def /k i 4 mul 56 add def BinCodes k c1 3 mul rest 16777216 idiv add 255 and put /rest rest 16777216 mod def BinCodes k 1 add rest 65536 idiv put BinCodes k 2 add rest 256 idiv 255 and put BinCodes k 3 add rest 255 and put } for } bind def %*********************************************************************** /ReadCode { % Read next code * %*********************************************************************** /CurByte CurBit 8 idiv def /CurCode BinCodes CurByte get 8 bitshift BinCodes CurByte 1 add get add 8 bitshift BinCodes CurByte 2 add get add CurCodeSize CurBit 7 and add 24 sub bitshift CurMask and def /CurBit CurBit CurCodeSize add dup 448 ge {ReadLine 448 sub} if def } bind def %*********************************************************************** /DecodeCode { % Decode CurCode * %*********************************************************************** ReadCode CurCode 256 eq { /FreeCode 258 def /CurCodeSize 9 def /CurMask 511 def /StrInd -1 def /Lrest 0 def ReadCode }{ L Lrest gt { /StrInd StrInd 1 add def /Lrest 65535 def StrArray StrInd get null eq {StrArray StrInd 65535 string put} if /CurStr StrArray StrInd get def } if Table FreeCode CurStr 65535 Lrest sub L getinterval dup 0 Table OldCode get putinterval dup L incr sub Table CurCode FreeCode lt {CurCode} {OldCode} ifelse get 0 incr getinterval putinterval put /Lrest Lrest L sub def /FreeCode FreeCode 1 add def FreeCode CurMask ge CurCodeSize 12 lt and { /CurCodeSize CurCodeSize 1 add def /CurMask CurMask 1 bitshift 1 add def } if } ifelse /OldCode CurCode def Table CurCode get dup length incr add /L exch def } bind def %*********************************************************************** /DisplayImage { % Display a LZW-encoded color image * %*********************************************************************** /DelX Xmax Xmin sub MarginX 2 mul sub def /DelY Ymax Ymin sub MarginY 2 mul sub def /SizeX IfRotate {rows} {colomns} ifelse def /SizeY IfRotate {colomns} {rows} ifelse def /FactorX DelX SizeX div def /FactorY DelY SizeY div def /Factor FactorX FactorY le {FactorX} {FactorY} ifelse def /ScaleX SizeX Factor mul def /ScaleY SizeY Factor mul def Xmin DelX ScaleX sub 2 div MarginX add add Ymin DelY ScaleY sub 2 div MarginY add add translate IfRotate {ScaleY ScaleX} {ScaleX ScaleY} ifelse scale /Palette currentfile 768 string readhexstring pop def currentfile InLine readline pop pop IfColor not { 0 1 255 { Palette exch dup /i exch 3 mul def Palette i 0 add get 0.299 mul Palette i 1 add get 0.587 mul add Palette i 2 add get 0.114 mul add cvi put } for /Palette Palette 0 256 getinterval def } if /Matr IfRotate {[0 colomns rows 0 0 0]} {[colomns 0 0 rows neg 0 rows]} ifelse def IfLevel2 { [/Indexed IfColor {/DeviceRGB} {/DeviceGray} ifelse 255 Palette] setcolorspace /infile currentfile /ASCII85Decode filter /LZWDecode filter def 8 dict dup /ImageType 1 put dup /Width colomns put dup /Height rows put dup /BitsPerComponent 8 put dup /ImageMatrix Matr put dup /Interpolate false put dup /Decode [0 255] put dup /DataSource infile put image }{ 0 1 255 { Table exch dup incr mul Palette exch incr getinterval put } for ReadLine ReadLine colomns rows 8 Matr {DecodeCode} IfColor {false 3 colorimage} {image} ifelse } ifelse } bind def %*********************************************************************** %* Image decoding * %*********************************************************************** DisplayImage fefefe 000000 828282 c3c3c3 a2a2a2 ededed 864545 ffffff 7acac5 68aca7 c5e8e5 416b68 ffffff 78a0d4 6688b4 c4d5ec 3e536e ffffff 9f9abe 8783a2 d5d3e3 545265 ffffff 3296c6 2a80a8 a3d0e5 194b63 ffffff e19c83 bf846f f2d3c8 775345 ffffff 768ba0 647788 c1cbd4 3b4650 ffffff 505e85 445071 adb3c6 252c3f ffffff 78a0d4 e1e1e1 afafaf 4b4b4b c8c8c8 ff00ff ffff00 ff0000 969696 646464 0000ff 00ff00 7d7d7d 323232 8a98b4 ffcc33 bbcfe9 ffff00 ccff00 ffcc00 cccc00 ff99ff cc99ff ff66ff cc66ff ff99cc cc99cc ff66cc cc66cc ff33ff cc33ff ff00ff cc00ff ff33cc cc33cc ff00cc cc00cc 99ffff 66ffff 99ccff 66ccff 99ffcc 66ffcc 99cccc 66cccc 33ffff 00ffff 33ccff 00ccff 33ffcc 00ffcc 33cccc 00cccc 9999ff 6699ff 9966ff 6666ff 9999cc 6699cc 9966cc 6666cc 3399ff 0099ff 3366ff 0066ff 3399cc 0099cc 3366cc 0066cc 9933ff 6633ff 9900ff 6600ff 9933cc 6633cc 9900cc 6600cc 3333ff 0033ff 3300ff 0000ff 3333cc 0033cc 3300cc 0000cc ff9999 cc9999 ff6699 cc6699 ff9966 cc9966 ff6666 cc6666 ff3399 cc3399 ff0099 cc0099 ff3366 cc3366 ff0066 cc0066 99ff99 66ff99 99cc99 66cc99 99ff66 66ff66 99cc66 66cc66 33ff99 00ff99 33cc99 00cc99 33ff66 00ff66 33cc66 00cc66 999999 669999 996699 666699 999966 669966 996666 666666 339999 009999 336699 006699 339966 009966 336666 006666 993399 663399 990099 660099 993366 663366 990066 660066 333399 003399 330099 000099 333366 003366 330066 000066 ff9933 cc9933 ff6633 cc6633 ff9900 cc9900 ff6600 cc6600 ff3333 cc3333 ff0033 cc0033 ff3300 cc3300 ff0000 cc0000 99ff33 66ff33 99cc33 66cc33 99ff00 66ff00 99cc00 66cc00 33ff33 00ff33 33cc33 00cc33 33ff00 00ff00 33cc00 00cc00 999933 669933 996633 666633 999900 669900 996600 666600 339933 009933 336633 006633 339900 009900 336600 006600 993333 663333 990033 660033 993300 663300 990000 660000 333333 003333 330033 000033 333300 003300 330000 000000 J,nM(3$]7K#D>EP:q1$o('TL^@So+\<\5,H7Uo;oFETehO@Wn[3@'nb-^74g&t*:=59#t` AlC^O$=,T\:1mM9jRtkiT29'\$5F44XlXID]N6r4?A ZK-%7g)a6j$OGJO2#T#88dW)oof)he/lu1Ik4j=#IV10FPM>gn>n6TBe^O;?UV)'uf9,1U m5LX9([nlh4Y=irK0-#1kkdXT'Cb'I:a>c23q$ke$)*G1Npo=gb?kF]:i#/"3c=8g#IeW) /IN^54>dkXE8t@;67r*3'"uQm'faK[b)80aZa1:? -BnrC6-tiJ%7AMW9bg*k!#54K:WtKr7T,JQ/PFP,bqtm:e#3TR<##j2;:Lj_9iKRW9iY3D Q#0f.eeO0U=k8k?D-PU,ZB7Y^BSCM7fG4pM@G$ktNFUWVX`mQD2Jo!tg(o[EC"bIM1LF=O c*_ECQL2@o>0p!KDqp[2c#_\VFi+>eG>6n;hA;15:u-&tgNhZmc1QM;pT*V,hj=lWJ`)e^ r:/\^/es*!Q];RG@5r-NM;jhu*q8/KXu24!Q3Ju(j#HHqOlVd.54__K/le1uPnm-mjZ.3i RH&R?)49QSc?4a$d-bnEkSaonT#LO)KqmlK/r:b8g.n3:g3R"pVWo)&X^c*Deu>_9RdG$p bhCpeZ0[`n_)H170%IAZHT_24m@0-Z[o+0"jh'iJV0fgm)t'?30j,"b_\XX:4pG< gd`+"k+#oda)W0&=33-9V_-0S>f-NcF.EdkcS+)Z7FU4d,59Q/*Gu,40-+\2g#$(ele-HP c5f[6qr`+ZhHdGOgisklal+k$-]R6BIR4uONmJBi LBKLK1ItLQ+^=;ab*!H(Lg[IGPVj_jd.a@]ZONVh(2-Lp+2Om1&DtX)Ls[5^5sr#&,6@$u d>5pf'E"*B"Ag8'op%s:)\=3oqhT5!/B,\#(Qf$WM^JqT9)Ak$e&?6',r-XkNIR;s'T c.:Vj$7smYF#%Z$#Y9UUS'Z^!6?9cmcS\=Y`/sM(G/>]b==7'gT!/QKQ.baRjBVS.1\@hG pfTkRPlrUZ)D"^?NC&NQ%"hBZLJ[f^`$XRZSre\a]NQFYBOhFB1j.]VZB7`C74G'4Y*Mu> >taF90r:[7DG")L:$KVWVc<)U;qcXql30JP<=Ya&>)cDDe'1b*#QduZSQ"g-;6!VkW`<6) +eP'!?.r&D/E;,]YLQLd%o3\\lW(9=pWeP!0sg*f';,, .uMZUFkX]7<6h;b2/A_>]"_>>ojCj$@^*:9\la$F@I-u3=;Eg808gtHCmC6lSJ-9Zj`op*K! %h;pY0Ks]t$RZjD5EnEj]E#))EjQ*4]^fR^BmkLF_Gk"dL'#Y&j$6hmriC2gL!NpE7,r,"XC1GLdJ>_/ BI.YoFHq'I>)u>/b/"W3L7DQGHPkQJ6Wj"&Ur!m%<7^FqWiaRUuf;C X[lgkm+/eJEc*aG];JB5=#80K=5DNN[c8Lf9&kEigf_Hq2Z[J+Mh>$T&?5EBn_e0>L[`t9 ;R\09id3nJE:,Ed0`N0(4B5;L&tbB\:EnkIIWTVY582+Y".MEui83gLm$_hFOUmHsoK7H85'5b<.)N4I"Y0L3-Ff]sNHf7'dM@9Nd4uqN;ETEqc9.5*+*; _Q]I!U.Y"e]eg9'n<6akRe:!gZ[5lbpe?!]*_&pAji('?;np%]b@.\iZML$H2:;+iRat7 -_ADLqb;_1]e?m]53SPac[4Vma2%I4Ybc_cO6(gkSbQ8Ni\U%soPEF6jMa4<:k,^S4Z;^( XV^=%rX&;5)bg1ERqM_\1?AF$Yki`OnF-tFk'rEUAlSVqs3LE;c9TZg%coAIpZN+cc!pc. '`i7jVIu.NNT..fk0]8"!g"mCDsC=SGh9"[fC0''l8\q0gAmK.-$IIfI&ONJe@1s57$rLjQ;,h&1=QpE' "`\_od:F-A*pW8Y$LmL$YW3Qh]*Rod(bq3jk!p8&^BIJU)Gs-30M`V59,Y!Q&ohs%;%UXM OW8A+(6O.e&Q]b\cO4_E%ro>m0i&^Mh\gEf*`:6&cds"2`:EH?%+5"mYk8S_mi\mA+D$TH 0E3$>k,GWdoPcN.bl],Oj!%AK,-VG!n_dQu+TV'n*caCLdAnNIY9/KZ)b+*O%=9AiWuNlp *Kk/I;I&rN\J-f1'f#:6nke-T8IH/T&s@SWZ=tVJD(/A&+S'dYW`^.#R2rR*(U@pfZ?#_\ M\+=1.P]NtP,TiBB-#C+.FKQZEYfr)-Os#V">QEU`>mPDjA9mN@rg6Hd]4U5M#];`+gS9r 1=Tc2ZMKXMF7Rd5o%,QALEpjFq1pORZ>hTn4!RW"0u`N6nsM!A,Zli?'D!b^lSS_L56=\p 0/>sOP$7nkHL0#U#ZEKfP4'Xe9f4^j@1"eJb>f%XI4UPZ0bX^J8*)UiJqNU0,SOKdZTBc$ UAZF:3)F.JdnqaH2R@J".C3ca':f7;AN,bU2q&R(ZEZA&*q7W_&$remZ_k2f_);tFokAO6 JemK?3;Llgq(mdXdq:^?]eXZW^sbK988@P<"?Ae.?a6C=r&7djS/oMU^TImm-bmdo#"NBO]^+?,dP_51p]d%rE0[(=;qkkT2.'InaV<85 <>E0Tp"Nbm&RH1'6$;?VR[6GI\bAdoJebDe;ALu-2GIWoDbj4L BpLhpecRR&T4-<0dakI(Yeb+V6Y0;PAX*4.[_ZQ6`B,nZ2ca!te/N#cR;Wk=@oi>5Z_)"+ ZWFS"C=`So2B,rLkdHCDD=L>7=(lcfF\C\4QRQ[9@83&%G1P,^:Yia`B76 GKoGt!fmug/Su78H$(]a/F.BOF)]`"A!_aj\%uGg(G`Ih>uul/(Un>V-[XHDI5Wa,Z71(c Z[+NB5?Ft$[sp<&n?6u7V"a[eQb.2OO+,Z"?MFnYfAgbV)1Ii6JX6UJotI_tH!>I:I.EVT <^gkGkCd;WH;"!YQY1Ekmo`+uKZ_&`(dE^Sm7m2mJJXH#Q5,&gM1q"mJ$c\7p+%>^(qMphif'sW]. qi$`.N7Ujb=N,e-a,6'HMTXn;'ci34PE(iDNn3BN(itF4)+G;#8efM3-u_Fc8g(PeM-*]< <-sH2M*_p9-PZ"4.0LdH)d>:UNB&;-Gpo-&aQA+MRP'nq$&jUpB1UWE<7j9J(TWboD`4AG 7[1pYFCp^s%nNK!40\OH)"EO[AVaJ/p@U36R;Y\br9K26O`YE!6]7<+j*b$JLKA8YGHY(> U@KaPO>L`DNlLX->ai4!`OUnb3;%Q"Xa-5`noP%+F9+d4_*2t"Q&/G0\%aoUZ&Vu_GVbX< o])7jk<^fSTPf#9c@;H&l^q>/?CBDB)///8'gf8U2QiY9mZs&NZBmSAoguW2RMV%F.=/>%AfIhGQ)si/@=$Hm )TAhV;Q4m_Y.Etrpc#?FTaqtqa]d`.7X6pdq]N&VW\\UaD;h6eh<\2uga4$bg0rO,Q^'NM\BOegXcOtJndG(mM%#I$o3IJqHn6]]tXBu]oC.J)`tc1ftNGI 9fd"'eGH]$.C/j[\(eFuS-6$"_7mN+)d>2,4>4Af1AEr^MbiZD9\[26IDU=BDHoH.S"6h^ .E&(W`;9eX>N`qp=D`Fk]=1(E9>.nVAnZQ5dX5K=HtC?1ai:t:a8@3r)e6rZ,KHgd`@GH? 4HsG_M9"CiFo6="I%jpeVocRr^_5&<-G@T*e"O81hUI-#La!Ic#Nc0KV7W^X5*brCh&MMgDbI3sF? 7FK6-NY*+j*;Qg#R'O`e74[7NH 7Y1NGd`jSF4"Ij)2oFH5hl#,&>s_qijsXLUc3:uC@Y<^T4BoNb-f.;QHDf]X:iH=?DSB36 P6uEFlfI6=jJ%"^rb5Cs@Wd-4k;h9SIXGg8CaYfokURn@HBIF3(ZhOgksg6fFKt)MGNol^ l:,p]O.Y^mQg"`nkJ"=2hO*#G^1Mi!9`D`lCUYsgct'l68KQ4FC]!FQL[G*!`.$8)VE=1> ?0K#le,I5>hYLcSoHh6In1CF'rsd;gjEWrRnNRQJ*unct"solLnh/J]mPXRm-1_Z+o3/Wn B:n_/4RZW;V4U4d?R@Ej7J-%EoWo#"Ra^rdAbI&*oEVGiIq]'N&beClp0N%=SON:&J6sBr ,p+Z4EOY^MOEZ1jH[g&2Ecq1bTO$H4,l`r%J#XdOYPK?H,ephaJ%Iu'Vt[rpHp=8#++V'2$&(_)OP"Y=+VBQ!ifR?M?83=W7K>[r!"M:< O\"Pr=Yu^I.@!Ndi(ttB@540Dk*&rThJkQ6a(+\^o_sD-ThD:_=u@@`8Yo>L1WgFrTi%K1 .@")E?EmY89^1(WomX[YW`JJP>;`#"7]tB\QJ#i0drDp'm[%#rY2+B:8?NbEp&>&DS6djn >Aa*;WRX`8HF:T f_%UXSR!mUf*q*Argn&3O1"]ZqL1Z]1YVRZDhIt@5;1LO"2S``=bD?"@Bf?E:c"#`fTN8'?.+Z?PkFNPUd\7YN/ap 89*+`*_3:nG9a),baRB[1/c"3apFl9.lNQTVQ\.Jb$chom?G(4.T5oX1efZU4YjUsACWY7 /%jOn^%6X54A?J7lHW0]o\hsZM?M6id'$^W5pt/.%7Wj/V%UjHFDWBW;=oJK8Q(f%;aaOJ 9f#Mn/G2)#2AHs&,ZOX[*nTiOHk= RuP#Ia^#^amomI&Ir*E&"2Rq5`!]miH-['8Ds<;63n:K!5K.Z&:FqlS'5o`4]_ZOWcU]&@ 3Q?'H19]1"0D@_koM[ApZM%D8CjO71[_t\]!61H2O aOq9W!G,(MLHm\)!Dk7^b0% #@;KoI;l"j68^2"LnlCb:s%/&fHR"tYnMlu"s#[:,nErP5CG4d$PJ8N&X2i_L)FOVcuX:/pf$+t:q&YVgf.45JEj%;=oVk-Q'#peHhZj'hlD@oHs'PHJM m#]N':e7!BgZ9]_>B6R[X%*mR9_.k?17[%@W2D2:'XV*8_$8'WpFV18ISJ$!5s2-)#%f-5 R)uL%ajN[*,]aB^ZAk_U'.Y^EFM;Y@+jS?M.3iI^b?gB%A/a[62iU5gF*"%c:8u%Z,Q_qV '5D?K=k9.9oQu0Gk'bDjV_nbhpJ"To)9tSg4,?<'1mB.?d&DdSQYc>/1eDN1)EC/+XRr0m (pQ['CIauo7%Ekj^JYD,lcQU^0dmnB*;X55Bk8l@'Tjom#2IdDXV7T(ibHr:B1r^K25eh6 Ct'AW60]UKW5]%;9mV:ejQ0*aPeN_f8uY^Vh+Xj`BlQ+IP=h@I@&^PjW)cO&=co7gW)]g> f#m5V9EbodFCCfn,b\3'XTMgnl&F<6l!5b*?I^C_nba7WR6"kiOWT;(LQYQJ-m2?JBU_;:IX%qbn8h,tb>2>l6 @[JD]D78$Oi`]O'ECeol/sVa`h#cbW;k5))f(C.jM]Zu4:!B^u(.L,rW*HKjh7TT(lV)Xd [q^8pZr<^kQCH1\YF0(;F%XR(k*H@T6n4pTEr/Q=_-CmlOC+@0Zeo!IJr;M^\8"M9hs9B+ n/`%UpVsr"W`pt2c2Y[^(C])`=+r?b"gN;J&\_H3M!j[W^_>$.@GFk;*YjCB(kh&$S/bOJ L$`-teF;DILm/ZF]N+^V?]/LgXHC MIPE=\p'a`i;03TE2bFi3,XE-]@2T&?/6QGh1*q@H*h@sQcDh()6__7AtL*M]6L))iL;=T F$93;\N_?kgmHf9N^:&G\OGVlfm(]!M8d#g-0C_1Lepi,Hh8X9gV"\nkWW&Ep\j'==Mlk1tV64X['n[l-i][OH8M[Xh,?*a$?`n7mCLY8'0RI6Yb`q?D( IQ\*Vjl^:-Q:b`HCra$Z)`,gqs'HrJMgY+;UX",Q!S'?d^%\h5ht=`#i;HGcZs9ZlX`'CS ra2#RRj[CjhZ'Q=Rc!tIs6InT(Y$-*\bj!?n#h_h3.Dmqo_\C4af4t*HW?m,p`"bG5L]X/ g1NT"gqR'e[j-aEgIjd&q5(rg5\&tpU46c%:]H0@t &OFUd5qE[0Jo8CkN5?bDXO4+&K8%01*C4cu_IOs^0atk("ZpM$5`iRdj=eAT$Gl'U_UC=r N$l09qnjBO6S%4B]=XGWdR-VO'#I*\HcM[3ahL_8St%gG9H13'*KQTtR&S0@i;:Cp(FlD6 _t5EEr&2;^;B7j>Y=(pM&T&&s72u.l0qhm=>Xh&e9pRmY\fu"1'LtR0-Ub#G6[GpP).1?n *Q;PjQ6X^B\^M':=gCkS>VKt'\3`:GrLXGA>gM&9/k8@3e9_Ze-/M+H]T^`8;'HWeCI 1I00Fa;b&q3S6KbQ7@QLR4NKtFIaPf]'[ a@riqbe[=ReBO0kcB;GZ*i.0kABN.?4ZGihbt6m=0e,lp>"/4g08/#a[$[=6:eel$6j]=, >`gZo+f[7,8\:Wj.':c?Tc!F\:%TT!;Y;qGeWHUK:-/]qPiPSuk/"A":a(/d+Vg8GtW,5Z:padqqCeR2\u^"'!6/_>HPt I-JjD8]nG5`6@1.g]YTL?.@t'[hN5_'a)g:%8ont9,1>dW>a8;JCVnFu/bZ@ob]Ee?hp#F/-rr=rbd68*)DTA5JD";cCmodu?OLT_(\&4]_581;ufdi#dA'loc)G+\/Gc.uf*"YCTdGpN'1):a-X]l_lb7ogT!=:KZ03SW0iJs)+GSje=b ;+fI[pK2]qfC?m`R=a(k-"tA,+9Ju'W7mAng/+,>SZCJ\ 86VsPg?#Kkorm*RYhKntgEj/[27)%+[+eTggL[hJFgp+Z\D*:ZgSLe[Kt?$X]\CuMgZ?0( otT8c^tVB[#RC ~> showpage grestore %%Trailer clhep-2.1.4.1.orig/GenericFunctions/.cvsignore0000755000175000017500000000007407746044120017652 0ustar olesolesMakefile.in configure aclocal.m4 autom4te.cache config.h.in clhep-2.1.4.1.orig/GenericFunctions/COPYING0000644000175000017500000010451311406213111016667 0ustar olesoles GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/GenericFunctions/test/0000755000175000017500000000000012242515144016621 5ustar olesolesclhep-2.1.4.1.orig/GenericFunctions/test/testGenericFunctions.sh.in0000755000175000017500000000020511776622027023741 0ustar olesoles#! /bin/sh # @configure_input@ ./testGenericFunctions@EXEEXT@ \ | @DIFF_Q@ - "@srcdir@/testGenericFunctions.output" > /dev/null clhep-2.1.4.1.orig/GenericFunctions/test/Makefile.am0000755000175000017500000000361211406213111020650 0ustar olesoles# Applicable to each test program: if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir)/ # libraries to link, and whence if BUILD_STATIC LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.a OUTFLAG = -o $@ else if BUILD_VISUAL LDADD = $(top_builddir)/src/CLHEP-@PACKAGE@-@VERSION@.$(SHEXT) OUTFLAG = /Fo$@ else LIBS += $(MY_LD)$(top_builddir)/src LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.$(SHEXT) OUTFLAG = -o $@ endif endif # normally, CXXLINK is supplied by automake, but we need to use /Fo instead # of -o when compiling with Visual C++ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ $(OUTFLAG) # Identify executables needed during testing: check_PROGRAMS = \ testGenericFunctions check_SCRIPTS = \ testGenericFunctions.sh # Identify test(s) to run when 'make check' is requested: TESTS = \ testGenericFunctions.sh # Identify the test(s) for which failure is the intended outcome: XFAIL_TESTS = # Identify the dependencies on a per-test basis: testGenericFunctions_SOURCES = testGenericFunctions.cc # Identify input data file(s) and prototype output file(s): EXTRA_DIST = \ testGenericFunctions.output # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = # supply our own suffix rule .cc.obj: if BUILD_VISUAL # $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c $(OUTFLAG) `$(CYGPATH_W) '$<'` # mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po source='$<' object='$@' libtool=no \ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ $(CXXCOMPILE) -c $(OUTFLAG) `$(CYGPATH_W) '$<'` else if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c $(OUTFLAG) `$(CYGPATH_W) '$<'`; \ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi # source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ # $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` endif clhep-2.1.4.1.orig/GenericFunctions/test/testGenericFunctions.cc0000755000175000017500000000317607716514316023321 0ustar olesoles#include "CLHEP/GenericFunctions/GenericFunctions.hh" #include "CLHEP/GenericFunctions/Sin.hh" #include "CLHEP/GenericFunctions/Cos.hh" #include "CLHEP/GenericFunctions/defs.h" #include #include #include int main(int, char **) { using namespace Genfun; GENFUNCTION f = Sin(), g = Cos(); GENPARAMETER p = Parameter("Parameter", 4.0); for (double x = 0; x < 100; x++) { // Test Simple Arithmetic Operations Between Functions assert (fabs((f*g) (x) - (sin(x)*cos(x))) <= FLT_EPSILON); assert (fabs((f+g) (x) - (sin(x)+cos(x))) <= FLT_EPSILON); assert (fabs((f-g) (x) - (sin(x)-cos(x))) <= FLT_EPSILON); assert (fabs((f/g) (x) - (sin(x)/cos(x))) <= FLT_EPSILON); // Test Simple Arithmetic Operations Between Functions and Parameters assert (fabs((p*f)(x)- 4.0*sin(x)) <= FLT_EPSILON); assert (fabs((f*p)(x)- 4.0*sin(x)) <= FLT_EPSILON); // Test Simple Arithmetic Operations Between Functions and Constants assert (fabs((f*4.0)(x)- 4.0*sin(x)) <= FLT_EPSILON); assert (fabs((4.0*f)(x)- 4.0*sin(x)) <= FLT_EPSILON); // Test Function composition assert (fabs(((f(g))(x)) - sin(cos(x))) <= FLT_EPSILON); } // Test Simple Arithmetic Operations Between Parameters assert (fabs((p*p).getValue()- 4.0*4.0) <= FLT_EPSILON); // Test Simple Arithmetic Operations Between Parameters and Constants assert (fabs((4*p).getValue()- 4.0*4.0) <= FLT_EPSILON); assert (fabs((p*4).getValue()- 4.0*4.0) <= FLT_EPSILON); // Congratulate the lucky user: std::cout << "GenericFunctions autotest has passed" << std::endl; return 0; } clhep-2.1.4.1.orig/GenericFunctions/test/.cvsignore0000755000175000017500000000001407705456124020631 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/GenericFunctions/test/testGenericFunctions.output0000755000175000017500000000004507705456124024264 0ustar olesolesGenericFunctions autotest has passed clhep-2.1.4.1.orig/GenericFunctions/test/CMakeLists.txt0000644000175000017500000000004411606714767021376 0ustar olesoles clhep_test( testGenericFunctions ) clhep-2.1.4.1.orig/GenericFunctions/ChangeLog0000755000175000017500000004710212241267303017423 0ustar olesoles============================== 14.11.13 Release CLHEP-2.1.4.1 ============================== ============================== 05.11.13 Release CLHEP-2.1.4.0 ============================== ============================== 14.11.12 Release CLHEP-2.1.3.1 ============================== ============================== 06.11.12 Release CLHEP-2.1.3.0 ============================== ============================== 16.08.12 Release CLHEP-2.1.2.5 ============================== 2012-08-16 Lynn Garren * use std::pow() explicitly 2012-08-15 Lynn Garren * latest changes from Joe Boudreau * change the names of internal variables so -Wshadow does not complain ============================== 09.07.12 Release CLHEP-2.1.2.4 ============================== ============================== 31.05.12 Release CLHEP-2.1.2.3 ============================== 2012-05-30 Lynn Garren * latest changes from Joe Boudreau * GenericFunctions/Psi2Hydrogen.icc: replaces src/Psi2Hydrogen.cc * GenericFunctions/AssociatedLegendre.icc: replaces src/AssociatedLegendre.cc ============================== 14.02.12 Release CLHEP-2.1.2.2 ============================== ============================== 06.02.12 Release CLHEP-2.1.2.1 ============================== 2012-02-02 Lynn Garren * GenericFunctions/ClassicalSolver.hh: make destructor virtual * src/PhaseSpace.cc: fix typo, GenFun::Variable index() returns unsigned int, not double * src/InterpolatingPolynomial.cc: deal with int comparison ============================== 16.12.11 Release CLHEP-2.1.2.0 ============================== ============================== 29.07.11 Release CLHEP-2.1.1.0 ============================== ============================== 11.11.10 Release CLHEP-2.1.0.1 ============================== ============================== 23.07.10 Release CLHEP-2.1.0.0 ============================== 2010-07-22 Lynn Garren * GenericFunctions/src/AnalyticConvolution.cc: replace finite with std::isfinite (for MacOSX) use _finite from float.h if _WIN32 (for VC++) 2010-03-09 Lynn Garren * GenericFunctions/src/RKIntegrator.cc: Add parentheses to fix a VC++ warning ============================== 16.06.10 Release CLHEP-2.1.0.0.b01 ============================== 2009/06/26 boudreau * src/AnalyticConvolution.cc: add protection to gauss and exp 2008/11/19 boudreau * GenericFunctions/CutBase.icc: fix compiler warnings 2007-01-23 boudreau * src/AnalyticConvolution.cc: patch for sigma=0 2007/01/21 boudreau * GenericFunctions/AbsFunction.hh: use new ParameterComposition * GenericFunctions/Bessel.icc: bug fix (remove extra "inline") * new functions: Airy.hh Gamma.hh GammaDistribution.hh KroneckerDelta.hh Legendre.hh ParameterComposition.hh SymToArgAdaptor.hh ============================== 11.06.10 Release CLHEP-2.0.5.0.b01 ============================== ============================== 09.03.10 Release CLHEP-2.0.4.6 ============================== 2010-03-09 Lynn Garren * src/RKIntegrator.cc: add parentheses to fix a VC++ warning ============================== 08.12.09 Release CLHEP-2.0.4.5 ============================== ============================== 12.11.09 Release CLHEP-2.0.4.4 ============================== 2009-11-10 Lynn Garren * src/Gaussian.cc, BivariateGaussian.cc, PtRelFcn.cc, TrivariateGaussian.cc: protect against M_PI in cmath 2009-11-04 Lynn Garren * GenericFunctions/Bessel.icc, EllipticIntegral.icc: replace math.h with cmath ============================== 03.11.09 Release CLHEP-2.0.4.4.b01 ============================== ============================== 04.07.09 Release CLHEP-2.0.4.3 ============================== ============================== 18.11.08 Release CLHEP-2.0.4.2 ============================== ============================== 04.11.08 Release CLHEP-2.0.4.1 ============================== ============================== 07.08.08 Release CLHEP-2.0.4.0 ============================== ============================== 01.05.08 Release CLHEP-2.0.3.3 ============================== ============================== 18.10.07 Release CLHEP-2.0.3.2 ============================== ============================== 15.11.06 Release CLHEP-2.0.3.1 ============================== ============================== 18.10.06 Release CLHEP-2.0.3.0 ============================== ============================== 20.06.06 Release CLHEP-2.0.2.3 ============================== ============================== 21.11.05 Release CLHEP-2.0.2.2 ============================== 2005-11-21 Lynn Garren * src/Makefile.am, test/Makefile.am: Build libraries for Windows Visual C++ without lib prefix. ============================== 22.06.05 Release CLHEP-2.0.2.1 ============================== Wed Jun 22 2005 Andreas Pfeiffer * configure.in: changed soname to install_name for darwin targets, dylibs still don't build properly on 10.3/10.4, static libs ok. 2005-06-19 Lynn Garren * configure.in, Makefile.am: Use lib when building Visual C++ libraries. Disable shared library build for Solaris CC. ============================== 22.04.05 Release CLHEP-2.0.2.0 ============================== 2005-04-07 Lynn Garren * configure.in: set AR and ARFLAGS 2005-02-18 Lynn Garren * configure.in, Makefile.am: Stop using libtool. The newer releases of libtool seem to have dropped support for Windows Visual C++. 2005-02-14 Lynn Garren * configure.in: Visual C++ flags are now "-EHsc -nologo -GR -GX -MD" Fri Feb 11 2005 Mark Fischler * LogGamma.h Removed sigms(), which never should have been there for this one. (Bug 2167) * Bessel.icc, SphericalBessel.icc, SphericalNeumann.icc, EllibpitcIntegral.icc Declared methods inline to prevent double-inclusion problem (Bug 2166) 2005-02-03 Lynn Garren * configure.in: install step creates libCLHEP.a, libCLHEP.so, and/or libCLHEP.dylib by adding a symbolic link. 2005-02-02 Andreas PFEIFFER * configure.in: modified compiler flags for windows: added "-O -GR -GX -MD" as this is needed for the multi-thread environments used. ============================== 30.11.04 Release CLHEP-2.0.1.2 ============================== ============================== 27.10.04 Release CLHEP-2.0.1.1 ============================== Fri Sep 24 2004 Lynn Garren * use AM_CXXFLAGS * require autoconf 2.59, automake 1.9.1, and libtool 1.9b Tue Aug 31 2004 Lynn Garren * change Solaris CC compile flags from "-O -mt" to "-O" * libtools 1.9b or later is required for Solaris CC ============================== 23.07.04 Release CLHEP-2.0.1.0 ============================== ============================== 11.05.04 Release CLHEP-2.0.0.2 ============================== ============================== 11.05.04 Release CLHEP-1.9.0.2 ============================== ============================== 21.04.04 Release CLHEP-2.0.0.1 ============================== ============================== 24.10.03 Release CLHEP-2.0.0.0 ============================== Fri Oct 24 2003 Lynn Garren * tagged for CLHEP 2.0.0.0 * backwards compatibility code disabled ============================== 23.10.03 Release CLHEP-1.9.0.0 ============================== Sun Nov 24 16:03:56 2002 Joe Boudreau * GenericFunctions/GSLMetaProxy.c,GSLMetaProxy.h (Removed): * GenericFunctions/Bessel.hh,EllipticIntegral.hh,SphericalBessel.hh: * GenericFunctions/SphericalNeumann.hh: * GenericFunctions/Bessel.cc,EllipticIntegral.cc,SphericalBessel.cc: * GenericFunctions/SphericalNeumann.cc: Finally got rid of the MetaProxy scheme in favor of something much simpler suggested a long time ago by Evgueni.. Namely putting all the code that calls GSL into .icc files. That makes CLHEP independent of the external package but user code will develop a dependency as soon as it includes either the Bessels, the Spherical Bessels/Neumanns, or the Elliptic Integrals. Mon Oct 28 15:07:43 2002 Mark Fischler * GenericFunctions/Psi2Hydrogen.cc: Correct a warning about double to int, caused by using a 1.0 in an expression being used as int argument to factorial. Thu Oct 10 16:33:48 2002 Joe Boudreau * GenericFunctions/Psi2Hydrogen.cc,Psi2Hydrogen.hh (Added): Added Hydrogenic Wavefunctions * GenericFunctions/Abs.cc,Abs.hh (Added): Added Absolute value functions * GenericFunctions/Variable.cc,Variable.hh: Brought the variable class up to date with the FNAL repository version where most of the development work has been taking place till now * GenericFunctions/Parameter.cc: Portability change in print method * GenericFunctions/ParamToArgAdaptor.icc: Removed numeric_limits class, use of which limits portability ============================== 01.06.02 Release CLHEP-1.8.0.0 ============================== Mon May 27 15:07:16 2002 Evgueni Tcherniaev * GenericFunctions/AbsFunction.hh,AbsParameter.hh: The copy constructors are now public rather than private. It has been done to avoid multiple warnings on Sun Solaris. An example of the compiler message: "ACos.cc", line 33: Warning (Anachronism): Genfun::AbsFunction::AbsFunction(const Genfun::AbsFunction&) is not accessible from Genfun::ACos::partial(unsigned) const. 1 Warning(s) detected. Wed May 8 13:46:50 2002 Mark Fischler * GenericFunctions/DoubleParamToArgAdaptor.icc,ParamToArgAdaptor.icc: * GenericFunctions/ACos.cc,ACos.hh,ASin.cc,ASin.hh (Added): * GenericFunctions/ATan.cc,ATan.hh,Bessel.cc (Added): * GenericFunctions/EllipticIntegral.cc,EllipticIntegral.hh (Added): * GenericFunctions/SphericalBessel.cc,SphericalNeumann.cc (Added): Files that had been in ZOOM's CLHEP but were not in the CERN version. These have been brought up to date so as to work with the latest config.h (that is, HEP_BEGIN_NAMESPACE no longer appears, etc.) Wed May 8 11:14:51 2002 Lynn Garren * HepMC/GenEvent.h,GenVertex.h: use conditional typedefs for forward iterators ========================================= 25.04.02 revised StdHep uses HepMC ========================================= Wed Apr 17 10:08:52 2002 Mark Fischler * GenericFunctions/IncompleteGamma.hh,IncompleteGamma.cc: Prevent the warning in gcc 3 about comparison of signed to unsigned int, while not breaking the behavion of the code, by making the static const ITMAX into an int instead of an unsigned int. ========================================= 08.03.02 HepMC has become a part of CLHEP ========================================= Tue Mar 5 16:41:23 2002 Mark Fischler * GenericFunctions/IncompleteGamma.cc: Fix something that fails to compile on some good compilers (gcc 3). ========================================== 09.11.01 HepPDT has become a part of CLHEP ========================================== ============================== 15.06.01 Release CLHEP-1.7.0.0 ============================== Mon Jun 11 10:20:35 2001 Evgueni Tcherniaev * GenericFunctions/FunctionNumDeriv.cc: Replaced max() by if() * GenericFunctions/Variable.hh: Removed const from parameters of the constructor Variable(unsigned int selectionIndex=0); Fri Jun 8 17:47:25 2001 Evgueni Tcherniaev * GenericFunctiuons/Makefile.in: Disabled compilation of Bessel.cc, SphericalBessel.cc and SphericalNeumann.cc Wed May 16 07:10:41 2001 Joe Boudreau * ENTIRE_GenericFunctions_Package: * GenericFunctions/Bessel.cc,Bessel.hh (Added): * GenericFunctions/BivariateGaussian.cc,BivariateGaussian.hh (Added): * GenericFunctions/CutBase.hh,CutBase.icc (Added): * GenericFunctions/DoubleParamToArgAdaptor.hh (Added): * GenericFunctions/DoubleParamToArgAdaptor.icc (Added): * GenericFunctions/Exp.cc,Exp.hh (Added): * GenericFunctions/FunctionNoop.cc,FunctionNoop.hh (Added): * GenericFunctions/FunctionNumDeriv.cc,FunctionNumDeriv.hh (Added): * GenericFunctions/GSLMetaProxy.c,GSLMetaProxy.h (Added): * GenericFunctions/Landau.cc,Landau.hh,Ln.cc,Ln.hh (Added): * GenericFunctions/ParamToArgAdaptor.hh,ParamToArgAdaptor.icc (Added): * GenericFunctions/Tan.cc,Tan.hh (Added): * GenericFunctions/TrivariateGaussian.cc (Added): * GenericFunctions/TrivariateGaussian.hh (Added): * GenericFunctions/doc/genericFunctions.tex: Bringing the official CLHEP release up to date. The development has been happening within another repository (at Fermilab), now I am putting several months of work back into the CLHEP repository. In addition to routine bug fixes, the major points are: * Automatic derivative computation * Bessel functions, Landau functions, Bivariate and Trivariate Gaussian distributions, Parameter-to-argument adaptors. * Use of GSL where available, and a Meta-proxy library used to limp along without the GSL. * The base classes for Cuts, providing a for functions that return a yes/no decision for a particular data type, BUT.. obeying a boolean algebra. Designed to interoperate with the STL; and templated on the data type which is cut upon. I discussed this a little in HEPVis'01, and just decided to implement it. ========================================================================== 18.01.01 ZOOM PhysicsVectors Capabilities have become part of CLHEP/Vector ========================================================================== ====================================================================== 24.10.00 Generic Functions by Joe Boudreau have become a part of CLHEP ====================================================================== Tue Oct 24 09:16:12 2000 Evgueni Tcherniaev * Makefile.in,configure.in: * GenericFunctions/Makefile.in (Added): * GenericFunctions/AbsFunction.cc,AbsFunction.hh (Added): * GenericFunctions/AbsFunctional.cc,AbsFunctional.hh (Added): * GenericFunctions/AbsParameter.cc,AbsParameter.hh (Added): * GenericFunctions/AnalyticConvolution.cc (Added): * GenericFunctions/AnalyticConvolution.hh (Added): * GenericFunctions/Argument.hh,ArgumentList.hh (Added): * GenericFunctions/AssociatedLaguerre.cc (Added): * GenericFunctions/AssociatedLaguerre.hh (Added): * GenericFunctions/AssociatedLegendre.cc (Added): * GenericFunctions/AssociatedLegendre.hh (Added): * GenericFunctions/ConstMinusFunction.cc (Added): * GenericFunctions/ConstMinusFunction.hh (Added): * GenericFunctions/ConstMinusParameter.cc (Added): * GenericFunctions/ConstMinusParameter.hh (Added): * GenericFunctions/ConstOverFunction.cc,ConstOverFunction.hh (Added): * GenericFunctions/ConstOverParameter.cc (Added): * GenericFunctions/ConstOverParameter.hh (Added): * GenericFunctions/ConstPlusFunction.cc,ConstPlusFunction.hh (Added): * GenericFunctions/ConstPlusParameter.cc (Added): * GenericFunctions/ConstPlusParameter.hh (Added): * GenericFunctions/ConstTimesFunction.cc (Added): * GenericFunctions/ConstTimesFunction.hh (Added): * GenericFunctions/ConstTimesParameter.cc (Added): * GenericFunctions/ConstTimesParameter.hh (Added): * GenericFunctions/Cos.cc,Cos.hh (Added): * GenericFunctions/CumulativeChiSquare.cc (Added): * GenericFunctions/CumulativeChiSquare.hh (Added): * GenericFunctions/DefiniteIntegral.cc,DefiniteIntegral.hh (Added): * GenericFunctions/Erf.cc,Erf.hh (Added): * GenericFunctions/Exponential.cc,Exponential.hh (Added): * GenericFunctions/FixedConstant.cc,FixedConstant.hh (Added): * GenericFunctions/FloatingConstant.cc,FloatingConstant.hh (Added): * GenericFunctions/FunctionComposition.cc (Added): * GenericFunctions/FunctionComposition.hh (Added): * GenericFunctions/FunctionConvolution.cc (Added): * GenericFunctions/FunctionConvolution.hh (Added): * GenericFunctions/FunctionDifference.cc (Added): * GenericFunctions/FunctionDifference.hh (Added): * GenericFunctions/FunctionDirectProduct.cc (Added): * GenericFunctions/FunctionDirectProduct.hh (Added): * GenericFunctions/FunctionNegation.cc,FunctionNegation.hh (Added): * GenericFunctions/FunctionPlusParameter.cc (Added): * GenericFunctions/FunctionPlusParameter.hh (Added): * GenericFunctions/FunctionProduct.cc,FunctionProduct.hh (Added): * GenericFunctions/FunctionQuotient.cc,FunctionQuotient.hh (Added): * GenericFunctions/FunctionSum.cc,FunctionSum.hh (Added): * GenericFunctions/FunctionTimesParameter.cc (Added): * GenericFunctions/FunctionTimesParameter.hh (Added): * GenericFunctions/Gaussian.cc,Gaussian.hh (Added): * GenericFunctions/GenericFunctions.hh (Added): * GenericFunctions/IncompleteGamma.cc,IncompleteGamma.hh (Added): * GenericFunctions/LikelihoodFunctional.cc (Added): * GenericFunctions/LikelihoodFunctional.hh (Added): * GenericFunctions/LogGamma.cc,LogGamma.hh (Added): * GenericFunctions/Parameter.cc,Parameter.hh (Added): * GenericFunctions/ParameterDifference.cc (Added): * GenericFunctions/ParameterDifference.hh (Added): * GenericFunctions/ParameterNegation.cc,ParameterNegation.hh (Added): * GenericFunctions/ParameterProduct.cc,ParameterProduct.hh (Added): * GenericFunctions/ParameterQuotient.cc,ParameterQuotient.hh (Added): * GenericFunctions/ParameterSum.cc,ParameterSum.hh (Added): * GenericFunctions/PeriodicRectangular.cc (Added): * GenericFunctions/PeriodicRectangular.hh (Added): * GenericFunctions/Power.cc,Power.hh (Added): * GenericFunctions/Rectangular.cc,Rectangular.hh (Added): * GenericFunctions/ReverseExponential.cc (Added): * GenericFunctions/ReverseExponential.hh (Added): * GenericFunctions/Sin.cc,Sin.hh (Added): * GenericFunctions/SphericalBessel.cc,SphericalBessel.hh (Added): * GenericFunctions/SphericalNeumann.cc,SphericalNeumann.hh (Added): * GenericFunctions/Sqrt.cc,Sqrt.hh (Added): * GenericFunctions/Square.cc,Square.hh (Added): * GenericFunctions/Variable.cc,Variable.hh,X.cc,X.hh (Added): * GenericFunctions/doc/Makefile (Added): * GenericFunctions/doc/PartiallyClosed.ps,TotallyClosed.ps (Added): * GenericFunctions/doc/WideOpen.ps,example.ps,hydrogen.ps (Added): * GenericFunctions/doc/genericFunctions.ps (Added): * GenericFunctions/doc/genericFunctions.tex (Added): * test/Makefile.in: * test/testGenericFunctions.cc,testGenericFunctions.out.save (Added): Added new package - GenericFunctions ============================== 20.10.00 Release CLHEP-1.6.0.0 ============================== ============================================================================== 12.10.00 Expression Evaluator by Evgueni Tcherniaev has become a part of CLHEP Alist, String and Combination have been disabled ============================================================================== ============================== 08.05.00 Release CLHEP-1.5.0.0 ============================== ============================================================ 24.04.00 StdHepC++ by Lynn Garren has become a part of CLHEP ============================================================ ============================== 20.04.99 Release CLHEP-1.4.0.0 ============================== ========================================================================= 16.12.98 Started: merging with BaBar version of CLHEP provided by G.Cosmo ========================================================================= ========================== 28.07.98 Release CLHEP-1.3 ========================== ========================== 05.02.98 Release CLHEP-1.2 ========================== ======================================================== 08.12.97 Release CLHEP-1.1: Geant4 has migrated to CLHEP ======================================================== clhep-2.1.4.1.orig/GenericFunctions/CMakeLists.txt0000644000175000017500000000050211761250753020406 0ustar olesoles# main GenericFunctions cmake instructions # automake/autoconf variables set( PACKAGE GenericFunctions ) clhep_package_config() add_subdirectory(GenericFunctions) add_subdirectory(src) add_subdirectory(test) if ( CLHEP_BUILD_DOCS ) message(STATUS "building documents for ${PACKAGE}" ) add_subdirectory(doc) endif() clhep-2.1.4.1.orig/GenericFunctions/autotools/0000755000175000017500000000000012242515146017675 5ustar olesolesclhep-2.1.4.1.orig/GenericFunctions/autotools/.cvsignore0000755000175000017500000000010107705060311021665 0ustar olesolesconfig.sub config.guess depcomp install-sh missing mkinstalldirs clhep-2.1.4.1.orig/GenericFunctions/autotools/ltmain.sh0000755000175000017500000057547210233524355021544 0ustar olesoles# Generated from ltmain.in; do not edit by hand # ltmain.sh (GNU libtool) 1.9b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: powerpc-apple-darwin7.5.0 # shell: $SHELL # compiler: $LTCC # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 1.9b # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST elif test -n "${BASH_VERSION+set}${KSH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh dirname="s,/[^/]*$,," basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: PROGRAM=ltmain.sh progname=`echo "$progpath" | $SED "$basename"` # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *) progdir=`echo "$progpath" | $SED "$dirname"` progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; esac # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.9b TIMESTAMP="" package_revision=1.1571 # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $echo $progname${mode+: }$mode: warning: ${1+"$@"} 1>&2 } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } # func_version # Echo version message to standard output and exit. func_version () { $SED '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# //; s/^# *$//; s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED '/^# Usage:/,/# -h/ { s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" echo echo "run \`$progname --help | more' for full usage" exit $EXIT_SUCCESS } # func_help # Echo long help message to standard output and exit. func_help () { $SED '/^# Usage:/,/# Report bugs to/ { s/^# //; s/^# *$//; s:\$progname:'$progname':; s:\$SHELL:'"$SHELL"':; s:\$LTCC:'"$LTCC"':; s:\$LD:'"$LD"':; s/\$with_gnu_ld/'"$with_gnu_ld"'/; s/\$automake_version/'"`automake --version 2>/dev/null |$SED 1q`"'/; s/\$autoconf_version/'"`autoconf --version 2>/dev/null |$SED 1q`"'/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $EXIT_SUCCESS } # func_features # Display the features supported by this script. func_features () { $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable "`\"foo\"`", so we have to do # it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $echo \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $echo $echo "Try \`$progname --help' for more information about other modes." exit $EXIT_SUCCESS } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # sed scripts: my_sed_single_opt='1s/^\(..\).*$/\1/;q' my_sed_single_rest='1s/^..\(.*\)$/\1/;q' my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' exit_cmd=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set -- --mode clean ${1+"$@"} ;; compile|compil|compi|comp|com|co|c) shift; set -- --mode compile ${1+"$@"} ;; execute|execut|execu|exec|exe|ex|e) shift; set -- --mode execute ${1+"$@"} ;; finish|finis|fini|fin|fi|f) shift; set -- --mode finish ${1+"$@"} ;; install|instal|insta|inst|ins|in|i) shift; set -- --mode install ${1+"$@"} ;; link|lin|li|l) shift; set -- --mode link ${1+"$@"} ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set -- --mode uninstall ${1+"$@"} ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" set -x ;; --dlopen) test $# -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" ;; --dry-run | -n) run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test $# -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" show=: ;; --tag) test $# -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: --dlopen=*|--mode=*|--tag=*) arg=`echo "$opt" | $SED "$my_sed_long_arg"` opt=`echo "$opt" | $SED "$my_sed_long_opt"` set -- "$opt" "$arg" ${1+"$@"} ;; # Separate optargs to short options: # -x*|-y*) # arg=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "$arg" ${1+"$@"} # ;; # Separate non-argument short options: # -z*|-z*|-y*) # rest=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "-$rest" ${1+"$@"} # ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`echo "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$my_dlsyms" test -z "$run" && $echo > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do $show "extracting global C symbols from \`$progfile'" $run eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for dlprefile in $dlprefiles; do $show "extracting global C symbols from \`$dlprefile'" name=`$echo "$dlprefile" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ const struct { const char *originator; const struct { const char *name; void *address; } symbols[]; } lt_${my_prefix}_LTX_preloaded_symbols = {\ \"$my_originator\", { " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" $echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} } }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" status=$? if test "$status" -ne 0 && test ! -d "$my_xdir"; then exit $status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename $darwin_archive` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" # Remove the table of contents from the thin files. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" $AR -xo "${darwin_base_archive}" rm "${darwin_base_archive}" cd "$darwin_curdir" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist rm -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir (cd $my_xdir && $AR x $my_xabs) || exit $? fi # $darwin_arches fi # $run ;; *) # We will extract separately just the conflicting names and we will # no longer touch any unique names. It is faster to leave these # extract automatically by $AR in one run. $show "(cd $my_xdir && $AR x $my_xabs)" $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; renaming object files" func_warning "to ensure that they will not overwrite" $AR t "$my_xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_mode_compile arg... func_mode_compile () { # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1 || \ func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi } # func_mode_finish arg... func_mode_finish () { libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit $EXIT_SUCCESS } # func_mode_install arg... func_mode_install () { # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files test "$#" -gt 2 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. (${SED} -e '2q' $file | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1 || \ func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" $show "$relink_command" $run eval "$relink_command" || \ func_fatal_error "error: relink \`$file' with the above command before installing it" fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | $GREP "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. test -z "$notinst_deplibs" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask func_error "error: cannot create temporary directory \`$tmpdir'" continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" ${rm}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } # func_mode_link arg... func_mode_link () { case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static # See comment for -static flag below, for more details. compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" || \ func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else func_fatal_error "link input file \`$save_arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) # The effects of -all-static are defined in a previous loop. continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs $inherited_linker_flags" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *[\\/]*.la) . $lib ;; *.la) . ./$lib ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`echo "$deplib" |$SED "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$inherited_linker_flags " in *" $deplib "*) ;; * ) inherited_linker_flags="$inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $lib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not use here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib'" fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then : else func_fatal_error "\`$lib' is not a valid libtool archive" fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac case $host in *-*-darwin*) # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then inherited_linker_flags=`$echo "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` fi dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP "bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $echo "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "*** And there doesn't seem to be a static archive available" $echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs $inherited_linker_flags; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" eval darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//' | xargs` compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for archives" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath test "$#" -gt 2 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" test -n "$8" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "AGE \`$age' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | ${SED} 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null | ${SED} 10q | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` inherited_linker_flags=`$echo "X $inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$echo "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`echo "$output" | $SED $basename` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnk $echo "creating GNU ld script: $output" $echo 'INPUT (' > $output for obj in $save_libobjs do $echo \""$obj"\" >> $output done $echo ')' >> $output else $echo "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for objects" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; struct stat st; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$dlsymsobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; overriding AR_FLAGS to 'cq'" func_warning "to ensure that POSIX-compatible ar will work" AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS } # func_mode_uninstall arg... func_mode_uninstall () { rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done test -z "$rm" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 || (test -h "$file") >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status } ## ----------- ## ## Main. ## ## ----------- ## { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." case $mode in compile) func_mode_compile ${1+"$@"} ;; execute) func_mode_execute ${1+"$@"} ;; finish) func_mode_finish ${1+"$@"} ;; install) func_mode_install ${1+"$@"} ;; link|relink) func_mode_link ${1+"$@"} ;; uninstall|clean) func_mode_uninstall ${1+"$@"} ;; "") help="$generic_help" func_fatal_help "you must specify a MODE" ;; esac test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi } exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: clhep-2.1.4.1.orig/GenericFunctions/src/0000755000175000017500000000000012242515145016432 5ustar olesolesclhep-2.1.4.1.orig/GenericFunctions/src/ConstTimesFunction.cc0000755000175000017500000000204112045031613022531 0ustar olesoles// -*- C++ -*- // $Id: ConstTimesFunction.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/ConstTimesFunction.hh" namespace Genfun { FUNCTION_OBJECT_IMP(ConstTimesFunction) ConstTimesFunction::ConstTimesFunction(double constant, const AbsFunction *arg): _constant(constant), _arg(arg->clone()) { } ConstTimesFunction::ConstTimesFunction(const ConstTimesFunction & right) : AbsFunction(right), _constant(right._constant), _arg(right._arg->clone()) {} unsigned int ConstTimesFunction::dimensionality() const { return _arg->dimensionality(); } ConstTimesFunction::~ConstTimesFunction() { delete _arg; } double ConstTimesFunction::operator ()(double x) const { return _constant * (*_arg)(x); } double ConstTimesFunction::operator ()(const Argument & x) const { return _constant * (*_arg)(x); } Derivative ConstTimesFunction::partial(unsigned int index) const { // d/dx (k*f) = k*(df/dx) const AbsFunction & fPrime = _constant*(_arg->partial(index)); return Derivative(& fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ReverseExponential.cc0000755000175000017500000000167712045031613022573 0ustar olesoles// -*- C++ -*- // $Id: ReverseExponential.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ #include "CLHEP/GenericFunctions/ReverseExponential.hh" #include #include // for exp() namespace Genfun { FUNCTION_OBJECT_IMP(ReverseExponential) ReverseExponential::ReverseExponential(): _decayConstant("Decay Constant", 1.0, 0,10) {} ReverseExponential::ReverseExponential(const ReverseExponential & right) : AbsFunction(right), _decayConstant(right._decayConstant) { } ReverseExponential::~ReverseExponential() { } double ReverseExponential::operator() (double x) const { if (x>0) return 0; return exp(x/_decayConstant.getValue())/_decayConstant.getValue(); } Parameter & ReverseExponential::decayConstant() { return _decayConstant; } Derivative ReverseExponential::partial(unsigned int index) const { assert(index==0); const AbsFunction & fPrime = _decayConstant*(*this); return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/LikelihoodFunctional.cc0000755000175000017500000000167511734354552023073 0ustar olesoles// -*- C++ -*- // $Id: LikelihoodFunctional.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ #include "CLHEP/GenericFunctions/LikelihoodFunctional.hh" #include "CLHEP/GenericFunctions/Argument.hh" #include "CLHEP/GenericFunctions/AbsFunction.hh" #include #include #include #include // for log() namespace Genfun { LikelihoodFunctional::LikelihoodFunctional(const ArgumentList & aList): _aList(aList) {} LikelihoodFunctional::~LikelihoodFunctional() { } double LikelihoodFunctional::operator [] (const AbsFunction & function) const { double logLikelihood(0); for (unsigned int i=0; i<_aList.size();i++) { Argument a = _aList[i]; double f = function(a); if (f<=0.0) { std::ostringstream stream; stream << "Negative likelihood arg[" << i << "]=" << a; throw std::runtime_error(stream.str()); } logLikelihood -= log(f); } return 2.0*logLikelihood; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/FunctionProduct.cc0000755000175000017500000000234312045031613022066 0ustar olesoles// -*- C++ -*- // $Id: FunctionProduct.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/FunctionProduct.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(FunctionProduct) FunctionProduct::FunctionProduct(const AbsFunction *arg1, const AbsFunction *arg2): _arg1(arg1->clone()), _arg2(arg2->clone()) { if (arg1->dimensionality()!=arg2->dimensionality()) { std::cout << "Warning: dimension mismatch in function product" << std::endl; assert(0); } } FunctionProduct::FunctionProduct(const FunctionProduct & right) : AbsFunction(right), _arg1(right._arg1->clone()), _arg2(right._arg2->clone()) { } FunctionProduct::~FunctionProduct() { delete _arg1; delete _arg2; } unsigned int FunctionProduct::dimensionality() const { return _arg1->dimensionality(); } double FunctionProduct::operator ()(double x) const { return (*_arg1)(x)*(*_arg2)(x); } double FunctionProduct::operator ()(const Argument & x) const { return (*_arg1)(x)*(*_arg2)(x); } Derivative FunctionProduct::partial(unsigned int index) const { const AbsFunction & fPrime = (*_arg1)*(_arg2->partial(index)) + (_arg1->partial(index))*(*_arg2); return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/RungeKuttaClassicalSolver.cc0000644000175000017500000000543712051300014024036 0ustar olesoles#include "CLHEP/GenericFunctions/RungeKuttaClassicalSolver.hh" #include "CLHEP/GenericFunctions/RKIntegrator.hh" #include "CLHEP/GenericFunctions/AdaptiveRKStepper.hh" namespace Classical { // // This is the private innards of RungeKuttaSolver // class RungeKuttaSolver::Clockwork { public: Clockwork(Genfun::GENFUNCTION gH, const PhaseSpace & mphaseSpace):H(gH),phaseSpace(mphaseSpace), integrator(NULL){ } Genfun::GENFUNCTION H; const Classical::PhaseSpace & phaseSpace; Genfun::RKIntegrator *integrator; std::vector startingQ; std::vector startingP; Genfun::EnergyFunction *energy; }; RungeKuttaSolver::RungeKuttaSolver(Genfun::GENFUNCTION gH, const PhaseSpace & mphaseSpace, const Genfun::RKIntegrator::RKStepper *stepper):c(new Clockwork(gH,mphaseSpace)){ c->integrator=new Genfun::RKIntegrator(stepper); // // Dimension (of coords, or phase space) // const unsigned int DIM=c->phaseSpace.dim(); // // Equations of motion via hamilton's equations: // const Classical::PhaseSpace::Component & X=c->phaseSpace.coordinates(); const Classical::PhaseSpace::Component & P=c->phaseSpace.momenta(); for (unsigned int i=0;iH.partial(P[i].index()); c->startingQ.push_back(c->integrator->addDiffEquation(&DXDT,"X",c->phaseSpace.startValue(X[i]))); } for (unsigned int i=0;iH.partial(X[i].index()); c->startingP.push_back(c->integrator->addDiffEquation(&DPDT,"P",c->phaseSpace.startValue(P[i]))); } c->energy=NULL; } RungeKuttaSolver::~RungeKuttaSolver(){ delete c->integrator; delete c->energy; delete c; } Genfun::GENFUNCTION RungeKuttaSolver::equationOf(const Genfun::Variable & v) const { return *c->integrator->getFunction(v.index()); } Genfun::GENFUNCTION RungeKuttaSolver::hamiltonian() const { return c->H; } const Classical::PhaseSpace & RungeKuttaSolver::phaseSpace() const { return c->phaseSpace; } Genfun::GENFUNCTION RungeKuttaSolver::energy() const { if (!c->energy) c->energy=new Genfun::EnergyFunction(*this); return *c->energy; } Genfun::Parameter *RungeKuttaSolver::createControlParameter(const std::string & variableName, double defStartingValue, double startingValueMin, double startingValueMax) const { return c->integrator->createControlParameter(variableName, defStartingValue, startingValueMin, startingValueMax) ; } Genfun::Parameter *RungeKuttaSolver::takeQ0(unsigned int index) { return c->startingQ[index]; } Genfun::Parameter *RungeKuttaSolver::takeP0(unsigned int index) { return c->startingP[index]; } } clhep-2.1.4.1.orig/GenericFunctions/src/PeriodicRectangular.cc0000755000175000017500000000242212045031613022664 0ustar olesoles// -*- C++ -*- // $Id: PeriodicRectangular.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ #include "CLHEP/GenericFunctions/PeriodicRectangular.hh" #include "CLHEP/GenericFunctions/FixedConstant.hh" #include #include // for floor() namespace Genfun { FUNCTION_OBJECT_IMP(PeriodicRectangular) PeriodicRectangular::PeriodicRectangular(): _a("Size-of-valley (a)", 1.0, 1.0, 10), _b("Size-of-plateau (b)", 1.0, 1.0, 10), _height("height",1, 0,10) {} PeriodicRectangular::PeriodicRectangular(const PeriodicRectangular & right): AbsFunction(right), _a(right._a), _b(right._b), _height(right._height) { } PeriodicRectangular::~PeriodicRectangular() { } double PeriodicRectangular::operator() (double x) const { double xx = x/(_a.getValue()+_b.getValue()); xx = xx - floor(xx); if (xx < _a.getValue()/(_a.getValue()+_b.getValue())) { return 0; } else { return _height.getValue(); } } Parameter & PeriodicRectangular::a() { return _a; } Parameter & PeriodicRectangular::b() { return _b; } Parameter & PeriodicRectangular::height() { return _height; } Derivative PeriodicRectangular::partial(unsigned int index) const { assert(index==0); const AbsFunction & fPrime = FixedConstant(0); return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ParameterSum.cc0000755000175000017500000000155512045031613021351 0ustar olesoles// -*- C++ -*- // $Id: ParameterSum.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/ParameterSum.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { PARAMETER_OBJECT_IMP(ParameterSum) ParameterSum::ParameterSum(const AbsParameter *arg1, const AbsParameter *arg2): _arg1(arg1->clone()), _arg2(arg2->clone()) { if (arg1->parameter() && _arg1->parameter()) _arg1->parameter()->connectFrom(arg1->parameter()); if (arg2->parameter() && _arg2->parameter()) _arg2->parameter()->connectFrom(arg2->parameter()); } ParameterSum::ParameterSum(const ParameterSum & right) : AbsParameter(), _arg1(right._arg1->clone()), _arg2(right._arg2->clone()) {} ParameterSum::~ParameterSum() { delete _arg1; delete _arg2; } double ParameterSum::getValue() const { return _arg1->getValue()+_arg2->getValue(); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/IncompleteGamma.cc0000755000175000017500000000410612045031613022001 0ustar olesoles// -*- C++ -*- // $Id: IncompleteGamma.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ #include "CLHEP/GenericFunctions/IncompleteGamma.hh" #include #include using namespace std; namespace Genfun { FUNCTION_OBJECT_IMP(IncompleteGamma) const int IncompleteGamma::ITMAX =100; const double IncompleteGamma::EPS =3.0E-7; const double IncompleteGamma::FPMIN =1.0e-30; IncompleteGamma::IncompleteGamma(): _a("a", 1.0, 0,10) {} IncompleteGamma::IncompleteGamma(const IncompleteGamma & right): AbsFunction(right), _a(right._a) { } IncompleteGamma::~IncompleteGamma() { } double IncompleteGamma::operator() (double x) const { assert(x>=0.0 && _a.getValue() > 0.0); if (x < (_a.getValue()+1.0)) return _gamser(_a.getValue(),x,_logGamma(_a.getValue())); else return 1.0-_gammcf(_a.getValue(),x,_logGamma(_a.getValue())); } Parameter & IncompleteGamma::a() { return _a; } /* ------------------Incomplete gamma function-----------------*/ /* ------------------via its series representation-------------*/ double IncompleteGamma::_gamser(double xa, double x, double logGamma) const { double n; double ap,del,sum; ap=xa; del=sum=1.0/xa; for (n=1;n #include namespace Genfun { FUNCTION_OBJECT_IMP(Sin) Sin::Sin() {} Sin::~Sin() { } Sin::Sin(const Sin & right) : AbsFunction(right) { } double Sin::operator() (double x) const { return sin(x); } Derivative Sin::partial(unsigned int index) const { assert(index==0); const AbsFunction & fPrime = Cos(); return Derivative(& fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Exponential.cc0000755000175000017500000000167412045031613021234 0ustar olesoles// -*- C++ -*- // $Id: Exponential.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ #include "CLHEP/GenericFunctions/Exponential.hh" #include #include // for exp() namespace Genfun { FUNCTION_OBJECT_IMP(Exponential) Exponential::Exponential(): _decayConstant("Decay Constant", 1.0, 0,10) {} Exponential::Exponential(const Exponential & right): AbsFunction(right), _decayConstant(right._decayConstant) { } Exponential::~Exponential() { } double Exponential::operator() (double x) const { if (x<0) return 0; return exp(-x/_decayConstant.getValue())/_decayConstant.getValue(); } Parameter & Exponential::decayConstant() { return _decayConstant; } const Parameter & Exponential::decayConstant() const { return _decayConstant; } Derivative Exponential::partial(unsigned int index) const { assert(index==0); const AbsFunction & fPrime = -_decayConstant*(*this); return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ConstPlusParameter.cc0000755000175000017500000000152412045031613022533 0ustar olesoles// -*- C++ -*- // $Id: ConstPlusParameter.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/ConstPlusParameter.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { PARAMETER_OBJECT_IMP(ConstPlusParameter) ConstPlusParameter::ConstPlusParameter(double xconstant, const AbsParameter *aparm): _constant(xconstant), _parameter(aparm->clone()) { if (aparm->parameter() && _parameter->parameter()) _parameter->parameter()->connectFrom(aparm->parameter()); } ConstPlusParameter::ConstPlusParameter(const ConstPlusParameter & right) : AbsParameter(), _constant(right._constant), _parameter(right._parameter->clone()) {} ConstPlusParameter::~ConstPlusParameter() { delete _parameter; } double ConstPlusParameter::getValue() const { return _constant + _parameter->getValue(); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/LogisticFunction.cc0000755000175000017500000000250012045031613022216 0ustar olesoles// -*- C++ -*- // $Id: #include "CLHEP/GenericFunctions/LogisticFunction.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include #define MAXRANGE 1000 namespace Genfun { FUNCTION_OBJECT_IMP(LogisticFunction) LogisticFunction::LogisticFunction(): _x0("X0", 0.0,0.0,1.0), _a("A",2.0,1.0, 4.0) {} LogisticFunction::~LogisticFunction() { } LogisticFunction::LogisticFunction(const LogisticFunction & right): AbsFunction(right), _x0(right._x0), _a(right._a) { } double LogisticFunction::operator() (double x) const { int i = (int) (x+0.5), &back = i, end=back+1; if (i<0 || i>MAXRANGE) { return 0; } else { // Is the vector of values stale? if (__a!=_a.getValue() || __x0!=_x0.getValue()) { // Empty the vector fx.erase(fx.begin(),fx.end()); // And update the cache. __a = _a.getValue(); __x0 = _x0.getValue(); } if (fx.empty()) fx.push_back(__x0); while (fx.size() #include using namespace std; namespace Genfun { FUNCTION_OBJECT_IMP(GammaDistribution) GammaDistribution::GammaDistribution(): _alpha("a", 2.0, 1.0, 100), _beta ("beta", 0.0, 0, 100) {} GammaDistribution::GammaDistribution(const GammaDistribution & right): AbsFunction(right), _alpha(right._alpha), _beta (right._beta) { } GammaDistribution::~GammaDistribution() { } double GammaDistribution::operator() (double x) const { return std::pow(x,_alpha.getValue()-1)* exp(-x/_beta.getValue())/std::pow(_beta.getValue(),(_alpha.getValue()))/ exp(_logGamma(_alpha.getValue())); } Parameter & GammaDistribution::alpha() { return _alpha; } Parameter & GammaDistribution::beta() { return _beta; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/NonrelativisticBW.cc0000644000175000017500000000215211607575003022352 0ustar olesoles#include "CLHEP/GenericFunctions/NonrelativisticBW.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include #include #if (defined __STRICT_ANSI__) || (defined _WIN32) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif // M_PI #endif // __STRICT_ANSI__ using namespace std; namespace Genfun { FUNCTION_OBJECT_IMP(NonrelativisticBWDistribution) NonrelativisticBWDistribution::NonrelativisticBWDistribution(): _mass("mass", 50, 10, 90), _width ("width", 5, 0, 100) {} NonrelativisticBWDistribution::NonrelativisticBWDistribution(const NonrelativisticBWDistribution & right): AbsFunction(), _mass(right._mass), _width (right._width) { } NonrelativisticBWDistribution::~NonrelativisticBWDistribution() { } double NonrelativisticBWDistribution::operator() (double x) const { double M=_mass.getValue(); double G=_width.getValue()/2.0; double f = (1.0/M_PI)*G/((x-M)*(x-M) +G*G); return f; } Parameter & NonrelativisticBWDistribution::mass() { return _mass; } Parameter & NonrelativisticBWDistribution::width() { return _width; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ConstOverFunction.cc0000755000175000017500000000205412045031613022367 0ustar olesoles// -*- C++ -*- // $Id: ConstOverFunction.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/ConstOverFunction.hh" namespace Genfun { FUNCTION_OBJECT_IMP(ConstOverFunction) ConstOverFunction::ConstOverFunction(double constant, const AbsFunction *arg): _constant(constant), _arg(arg->clone()) { } ConstOverFunction::ConstOverFunction(const ConstOverFunction & right) : AbsFunction(right), _constant(right._constant), _arg(right._arg->clone()) {} unsigned int ConstOverFunction::dimensionality() const { return _arg->dimensionality(); } ConstOverFunction::~ConstOverFunction() { delete _arg; } double ConstOverFunction::operator ()(double x) const { return _constant / (*_arg)(x); } double ConstOverFunction::operator ()(const Argument & x) const { return _constant / (*_arg)(x); } Derivative ConstOverFunction::partial(unsigned int index) const { // d/dx (k/f) = -(k/f^2)(df/dx) const AbsFunction & fPrime = -_constant/(*_arg)/(*_arg)*(_arg->partial(index)); return Derivative(& fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Cos.cc0000755000175000017500000000077312045031613017471 0ustar olesoles// -*- C++ -*- // $Id: Cos.cc,v 1.5 2003/10/10 17:40:39 garren Exp $ #include "CLHEP/GenericFunctions/Cos.hh" #include "CLHEP/GenericFunctions/Sin.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(Cos) Cos::Cos() {} Cos::~Cos() { } Cos::Cos(const Cos & right) : AbsFunction(right) { } double Cos::operator() (double x) const { return cos(x); } Derivative Cos::partial(unsigned int) const { const AbsFunction & fPrime = -Sin(); return Derivative(& fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ClebschGordanCoefficientSet.cc0000644000175000017500000000300612012777433024256 0ustar olesoles#include "CLHEP/GenericFunctions/ClebschGordanCoefficientSet.hh" #include #include #include inline double factorial (int N) { double retVal(1.0); for (int i=2;i<=N;i++) retVal*=i; return retVal; } namespace Genfun { double ClebschGordanCoefficientSet::calcCoefficient(int l1, int l2, int L, int xm1, int xm2, int M) { if (xm1+xm2!=M) return 0; double F1=sqrt((2*L+1)*factorial(L+l1-l2)*factorial(L-l1+l2)*factorial(l1+l2-L)/factorial(l1+l2+L+1)); double F2=sqrt(factorial(L+M)*factorial(L-M)*factorial(l1-xm1)*factorial(l1+xm1)*factorial(l2-xm2) *factorial(l2+xm2)); double F3=0.0; int max=0; max = std::max(max,l2+xm2); max = std::max(max,l1-xm1); max = std::max(max,l1+l2-L); // max = std::max(max,l2-L-xm1); // max = std::max(max,l1+xm2-L); for (int k=0;k<=max;k++) { double term = factorial(k); bool skipTerm=false; { int T=l1 + l2 -L -k; if (T>=0) term *= factorial(T); else skipTerm=true; } if (!skipTerm) { int T=l1-xm1-k; if (T>=0) term *= factorial(T); else skipTerm=true; } if (!skipTerm) { int T=l2+xm2-k; if (T>=0) term *= factorial(T); else skipTerm=true; } if (!skipTerm) { int T=L-l2+xm1+k; if (T>=0) term *= factorial(T); else skipTerm=true; } if (!skipTerm) { int T=L-l1-xm2+k; if (T>=0) term *= factorial(T); else skipTerm=true; } if (!skipTerm) F3+= ((k%2) ? -1:1)/term; } return F1*F2*F3; } } clhep-2.1.4.1.orig/GenericFunctions/src/ConstTimesParameter.cc0000755000175000017500000000154012045031613022667 0ustar olesoles// -*- C++ -*- // $Id: ConstTimesParameter.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/ConstTimesParameter.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { PARAMETER_OBJECT_IMP(ConstTimesParameter) ConstTimesParameter::ConstTimesParameter(double xconstant, const AbsParameter *aparm): _constant(xconstant), _parameter(aparm->clone()) { if (aparm->parameter() && _parameter->parameter()) _parameter->parameter()->connectFrom(aparm->parameter()); } ConstTimesParameter::ConstTimesParameter(const ConstTimesParameter & right) : AbsParameter(), _constant(right._constant), _parameter(right._parameter->clone()) {} ConstTimesParameter::~ConstTimesParameter() { delete _parameter; } double ConstTimesParameter::getValue() const { return _constant * _parameter->getValue(); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ParameterComposition.cc0000644000175000017500000000154610554745431023122 0ustar olesoles// -*- C++ -*- // $Id: #include "CLHEP/GenericFunctions/ParameterComposition.hh" #include "CLHEP/GenericFunctions/Parameter.hh" #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { PARAMETER_OBJECT_IMP(ParameterComposition) ParameterComposition::ParameterComposition(const AbsFunction *arg1, const AbsParameter *arg2): AbsParameter(), _arg1(arg1->clone()), _arg2(arg2->clone()) { if (arg2->parameter() && _arg2->parameter()) _arg2->parameter()->connectFrom(arg2->parameter()); } ParameterComposition::ParameterComposition(const ParameterComposition & right) : AbsParameter(), _arg1(right._arg1->clone()), _arg2(right._arg2->clone()) {} ParameterComposition::~ParameterComposition() { delete _arg1; delete _arg2; } double ParameterComposition::getValue() const { return _arg1->operator() (_arg2->getValue()); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/FunctionSum.cc0000755000175000017500000000222012045031613021204 0ustar olesoles// -*- C++ -*- // $Id: FunctionSum.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/FunctionSum.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(FunctionSum) FunctionSum::FunctionSum(const AbsFunction *arg1, const AbsFunction *arg2): _arg1(arg1->clone()), _arg2(arg2->clone()) { if (arg1->dimensionality()!=arg2->dimensionality()) { std::cout << "Warning: dimension mismatch in function sum" << std::endl; assert(0); } } FunctionSum::FunctionSum(const FunctionSum & right) : AbsFunction(right), _arg1(right._arg1->clone()), _arg2(right._arg2->clone()) {} unsigned int FunctionSum::dimensionality() const { return _arg1->dimensionality(); } FunctionSum::~FunctionSum() { delete _arg1; delete _arg2; } double FunctionSum::operator ()(double x) const { return (*_arg1)(x)+(*_arg2)(x); } double FunctionSum::operator ()(const Argument & x) const { return (*_arg1)(x)+(*_arg2)(x); } Derivative FunctionSum::partial(unsigned int index) const { const AbsFunction & fPrime = _arg1->partial(index) + _arg2->partial(index); return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/FunctionTimesParameter.cc0000755000175000017500000000257612045031613023400 0ustar olesoles// -*- C++ -*- // $Id: FunctionTimesParameter.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/FunctionTimesParameter.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { FUNCTION_OBJECT_IMP(FunctionTimesParameter) FunctionTimesParameter::FunctionTimesParameter(const AbsParameter *parameter, const AbsFunction *function): _function(function->clone()), _parameter(parameter->clone()) { if (parameter->parameter() && _parameter->parameter()) { _parameter->parameter()->connectFrom(parameter->parameter()); } } FunctionTimesParameter::FunctionTimesParameter(const FunctionTimesParameter & right) : AbsFunction(right), _function(right._function->clone()), _parameter(right._parameter->clone()) {} unsigned int FunctionTimesParameter::dimensionality() const { return _function->dimensionality(); } FunctionTimesParameter::~FunctionTimesParameter() { delete _function; delete _parameter; } double FunctionTimesParameter::operator ()(double x) const { return _parameter->getValue() * (*_function)(x); } double FunctionTimesParameter::operator ()(const Argument & x) const { return _parameter->getValue() * (*_function)(x); } Derivative FunctionTimesParameter::partial(unsigned int index) const { const AbsFunction & fPrime = (*_parameter)*(_function->partial(index)); return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/LogGamma.cc0000755000175000017500000000147712045031613020433 0ustar olesoles// -*- C++ -*- // $Id: LogGamma.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ // --------------------------------------------------------------------------- #include "CLHEP/GenericFunctions/LogGamma.hh" #include // for log() namespace Genfun { FUNCTION_OBJECT_IMP(LogGamma) const double LogGamma::_coefficient[6]={ +76.18009172947146, -86.50532032941677, +24.01409824083091, -1.231739572450155, 0.1208650973866179E-2, -0.5395239384953E-5}; LogGamma::LogGamma() {} LogGamma::LogGamma(const LogGamma & right) : AbsFunction(right) {} LogGamma::~LogGamma() { } double LogGamma::operator() (double x) const { double y=x,tmp=x+5.5,ser=1.000000000190015,c=2.5066282746310005; tmp -= (x+0.5)*log(tmp); for (int j=0;j<6;j++) ser += _coefficient[j]/++y; return -tmp+log(c*ser/x); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/BivariateGaussian.cc0000755000175000017500000000461612045031613022346 0ustar olesoles// -*- C++ -*- // $Id: BivariateGaussian.cc,v 1.8 2010/06/16 18:22:01 garren Exp $ #include "CLHEP/GenericFunctions/defs.h" #include "CLHEP/GenericFunctions/BivariateGaussian.hh" #include #include // for exp() #if (defined __STRICT_ANSI__) || (defined _WIN32) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif // M_PI #endif // __STRICT_ANSI__ namespace Genfun { FUNCTION_OBJECT_IMP(BivariateGaussian) BivariateGaussian::BivariateGaussian(): _mean0("Mean0", 0.0,-10,10), _mean1("Mean1", 0.0,-10,10), _sigma0("Sigma0",1.0,0, 10), _sigma1("Sigma1",1.0,0, 10), _corr01("Corr01", 0.0, -1.0, 1.0) {} BivariateGaussian::~BivariateGaussian() { } BivariateGaussian::BivariateGaussian(const BivariateGaussian & right): AbsFunction(right), _mean0(right._mean0), _mean1(right._mean1), _sigma0(right._sigma0), _sigma1(right._sigma1), _corr01(right._corr01) { } double BivariateGaussian::operator() (const Argument & a) const { assert (a.dimension()==2); double x = a[0]; double y = a[1]; double x0 = _mean0.getValue(); double y0 = _mean1.getValue(); double dx = x-x0; double dy = y-y0; double sx = _sigma0.getValue(); double sy = _sigma1.getValue(); double sxs = sx*sx; double sys = sy*sy; double rho = _corr01.getValue(); double dt = (1.0+rho)*(1.0-rho); return (1.0/(2*M_PI*sx*sy*sqrt(dt))) * exp(-1.0/(2.0*dt)*(dx*dx/sxs+dy*dy/sys-2.0*rho*dx*dy/sx/sy)); } Parameter & BivariateGaussian::mean0() { return _mean0; } Parameter & BivariateGaussian::sigma0() { return _sigma0; } const Parameter & BivariateGaussian::mean0() const { return _mean0; } const Parameter & BivariateGaussian::sigma0() const { return _sigma0; } Parameter & BivariateGaussian::mean1() { return _mean1; } Parameter & BivariateGaussian::sigma1() { return _sigma1; } const Parameter & BivariateGaussian::mean1() const { return _mean1; } const Parameter & BivariateGaussian::sigma1() const { return _sigma1; } Parameter & BivariateGaussian::corr01() { return _corr01; } const Parameter & BivariateGaussian::corr01() const { return _corr01; } unsigned int BivariateGaussian::dimensionality() const { return 2; } double BivariateGaussian::operator ()(double) const { std::cerr << "Warning. bivariate Gaussian called with scalar argument" << std::endl; assert(0); return 0; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/VoigtProfile.cc0000644000175000017500000000527111651542310021354 0ustar olesoles#include "CLHEP/GenericFunctions/VoigtProfile.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include #include #if (defined __STRICT_ANSI__) || (defined _WIN32) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif // M_PI #endif // __STRICT_ANSI__ using namespace std; inline double Pow(double x,int n) { double val=1; for(int i=0;i nwwerf(std::complex z) { std::complex zh,r[38],s,t,v; const double z1 = 1; const double hf = z1/2; const double z10 = 10; const double c1 = 74/z10; const double c2 = 83/z10; const double c3 = z10/32; const double c4 = 16/z10; const double c = 1.12837916709551257; const double p = Pow(2.0*c4,33); double x=z.real(); double y=z.imag(); double xa=(x >= 0) ? x : -x; double ya=(y >= 0) ? y : -y; if(ya < c1 && xa < c2){ zh = std::complex(ya+c4,xa); r[37]= std::complex(0,0); // do 1 n = 36,1,-1 for(int n = 36; n>0; n--){ t=zh+double(n)*std::conj(r[n+1]); r[n]=hf*t/std::norm(t); } double xl=p; s=std::complex(0,0); // do 2 n = 33,1,-1 for(int k=33; k>0; k--){ xl=c3*xl; s=r[k]*(s+xl); } v=c*s; } else{ zh=std::complex(ya,xa); r[1]=std::complex(0,0); // do 3 n = 9,1,-1 for(int n=9;n>0;n--){ t=zh+double(n)*std::conj(r[1]); r[1]=hf*t/std::norm(t); } v=c*r[1]; } if(ya == 0) v= std::complex(exp(-xa*xa),v.imag()); if(y < 0) { v=2.0*std::exp(std::complex(-xa,-ya)*std::complex(xa,ya))-v; if(x > 0) v=std::conj(v); } else{ if(x < 0) v=std::conj(v); } return v; } namespace Genfun { FUNCTION_OBJECT_IMP(VoigtProfile) VoigtProfile::VoigtProfile(): _mass("mass", 50, 10, 90), _width ("width", 5, 0, 100), _sigma("sigma", 5, 0, 100) {} VoigtProfile::VoigtProfile(const VoigtProfile & right): AbsFunction(), _mass(right._mass), _width (right._width), _sigma(right._sigma) { } VoigtProfile::~VoigtProfile() { } double VoigtProfile::operator() (double x) const { double M=_mass.getValue(); double G=_width.getValue()/2.0; double s=_sigma.getValue(); static const double sqrt2=sqrt(2.0); static const double sqrt2PI=sqrt(2.0*M_PI); static const std::complex I(0,1); std::complex z = ((x-M) + I*G)/sqrt2/s; double f=nwwerf(z).real()/s/sqrt2PI; return f; } Parameter & VoigtProfile::mass() { return _mass; } Parameter & VoigtProfile::width() { return _width; } Parameter & VoigtProfile::sigma() { return _sigma; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Makefile.am0000755000175000017500000000677412044565005020507 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir) libCLHEP_GenericFunctions_@VERSION@_a_SOURCES = \ Abs.cc \ AbsFunctional.cc \ AbsFunction.cc \ AbsParameter.cc \ ACos.cc \ AdaptiveRKStepper.cc \ AnalyticConvolution.cc \ ArrayFunction.cc \ ASin.cc \ AssociatedLaguerre.cc \ ATan.cc \ BetaDistribution.cc \ BivariateGaussian.cc \ ClassicalSolver.cc \ ClebschGordanCoefficientSet.cc \ ConstMinusFunction.cc \ ConstMinusParameter.cc \ ConstOverFunction.cc \ ConstOverParameter.cc \ ConstPlusFunction.cc \ ConstPlusParameter.cc \ ConstTimesFunction.cc \ ConstTimesParameter.cc \ Cos.cc \ CumulativeChiSquare.cc \ DefiniteIntegral.cc \ EfficiencyFunctional.cc \ EmbeddedRKStepper.cc \ Erf.cc \ Exp.cc \ Exponential.cc \ FixedConstant.cc \ FloatingConstant.cc \ FunctionComposition.cc \ FunctionConvolution.cc \ FunctionDifference.cc \ FunctionDirectProduct.cc \ FunctionNegation.cc \ FunctionNoop.cc \ FunctionNumDeriv.cc \ FunctionPlusParameter.cc \ FunctionProduct.cc \ FunctionQuotient.cc \ FunctionSum.cc \ FunctionTimesParameter.cc \ Gamma.cc \ GammaDistribution.cc \ Gaussian.cc \ HermitePolynomial.cc \ IncompleteGamma.cc \ InterpolatingPolynomial.cc \ KroneckerDelta.cc \ Landau.cc \ LikelihoodFunctional.cc \ Ln.cc \ LogGamma.cc \ LogisticFunction.cc \ Mod.cc \ NonrelativisticBW.cc \ Parameter.cc \ ParameterComposition.cc \ ParameterDifference.cc \ ParameterNegation.cc \ ParameterProduct.cc \ ParameterQuotient.cc \ ParameterSum.cc \ PeriodicRectangular.cc \ PhaseSpace.cc \ Power.cc \ PtRelFcn.cc \ PuncturedSmearedExp.cc \ RCBase.cc \ Rectangular.cc \ RelativisticBW.cc \ ReverseExponential.cc \ RKIntegrator.cc \ RungeKuttaClassicalSolver.cc \ Sigma.cc \ SimpleRKStepper.cc \ Sin.cc \ Sqrt.cc \ Square.cc \ StepDoublingRKStepper.cc \ Tan.cc \ Theta.cc \ TrivariateGaussian.cc \ Variable.cc \ VoigtProfile.cc \ X.cc libCLHEP_GenericFunctions_@VERSION@_so_OBJECTS = $(patsubst %.cc,$(shareddir)/%.$(OBJEXT),$(libCLHEP_GenericFunctions_@VERSION@_a_SOURCES)) # these if/else blocks will be parsed by automake and translated if BUILD_SHARED shareddir = shared if BUILD_VISUAL lib_shared = CLHEP-GenericFunctions-@VERSION@.$(SHEXT) else lib_shared = libCLHEP-GenericFunctions-@VERSION@.$(SHEXT) endif SHFLAGS = @MY_SHFLAGS@ SHLINK = @MY_SHLINK@ @MY_SHEXTRA@ SHNAME = @MY_SHNAME@ endif if BUILD_STATIC lib_LIBRARIES = libCLHEP-GenericFunctions-@VERSION@.a endif CLEANFILES = $(lib_shared) all-local: $(shareddir) $(lib_shared) $(shareddir): test -d $(shareddir) || mkdir $(shareddir) if BUILD_VISUAL $(lib_shared): $(libCLHEP_GenericFunctions_@VERSION@_so_OBJECTS) $(SHLINK) $(SHNAME)$@ $(libCLHEP_GenericFunctions_@VERSION@_so_OBJECTS) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) /c /Fo$@ $< else $(lib_shared): $(libCLHEP_GenericFunctions_@VERSION@_so_OBJECTS) $(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_GenericFunctions_@VERSION@_so_OBJECTS) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) -c -o $@ $< endif install-exec-local: $(lib_shared) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_shared)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$p'"; \ $(INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done clean-local: -test -d $(shareddir) && rm -f $(shareddir)/*.$(OBJEXT) distclean-local: -test -d $(shareddir) && rm -rf ./$(shareddir) clhep-2.1.4.1.orig/GenericFunctions/src/ConstMinusFunction.cc0000755000175000017500000000177512045031613022560 0ustar olesoles// -*- C++ -*- // $Id: ConstMinusFunction.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/ConstMinusFunction.hh" namespace Genfun { FUNCTION_OBJECT_IMP(ConstMinusFunction) ConstMinusFunction::ConstMinusFunction(double constant, const AbsFunction *arg): _constant(constant), _arg(arg->clone()) { } ConstMinusFunction::ConstMinusFunction(const ConstMinusFunction & right) : AbsFunction(right), _constant(right._constant), _arg(right._arg->clone()) {} unsigned int ConstMinusFunction::dimensionality() const { return _arg->dimensionality(); } ConstMinusFunction::~ConstMinusFunction() { delete _arg; } double ConstMinusFunction::operator ()(double x) const { return _constant - (*_arg)(x); } double ConstMinusFunction::operator ()(const Argument & x) const { return _constant - (*_arg)(x); } Derivative ConstMinusFunction::partial(unsigned int index) const { const AbsFunction & fPrime = -_arg->partial(index); return Derivative(& fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ConstPlusFunction.cc0000755000175000017500000000167012045031613022402 0ustar olesoles// -*- C++ -*- // $Id: ConstPlusFunction.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/ConstPlusFunction.hh" namespace Genfun { FUNCTION_OBJECT_IMP(ConstPlusFunction) ConstPlusFunction::ConstPlusFunction(double constant, const AbsFunction *arg): _constant(constant), _arg(arg->clone()) { } ConstPlusFunction::ConstPlusFunction(const ConstPlusFunction & right) : AbsFunction(right), _constant(right._constant), _arg(right._arg->clone()) {} unsigned int ConstPlusFunction::dimensionality() const { return _arg->dimensionality(); } ConstPlusFunction::~ConstPlusFunction() { delete _arg; } double ConstPlusFunction::operator ()(double x) const { return _constant + (*_arg)(x); } double ConstPlusFunction::operator ()(const Argument & x) const { return _constant + (*_arg)(x); } Derivative ConstPlusFunction::partial(unsigned int index) const { return _arg->partial(index); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ParameterNegation.cc0000755000175000017500000000132212045031613022341 0ustar olesoles// -*- C++ -*- // $Id: ParameterNegation.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/ParameterNegation.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { PARAMETER_OBJECT_IMP(ParameterNegation) ParameterNegation::ParameterNegation(const AbsParameter *arg1): _arg1(arg1->clone()) { if (arg1->parameter() && _arg1->parameter()) _arg1->parameter()->connectFrom(arg1->parameter()); } ParameterNegation::ParameterNegation(const ParameterNegation & right) : AbsParameter(), _arg1(right._arg1->clone()) {} ParameterNegation::~ParameterNegation() { delete _arg1; } double ParameterNegation::getValue() const { return - _arg1->getValue(); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/FloatingConstant.cc0000755000175000017500000000162712045031613022221 0ustar olesoles// -*- C++ -*- // $Id: FloatingConstant.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/FloatingConstant.hh" #include "CLHEP/GenericFunctions/FixedConstant.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(FloatingConstant) FloatingConstant::FloatingConstant(const AbsParameter & p): _value(p.clone()) { if (_value->parameter() && p.parameter()) _value->parameter()->connectFrom(&p); } FloatingConstant::FloatingConstant(const FloatingConstant & right): AbsFunction(right), _value(right._value->clone()) { } FloatingConstant::~FloatingConstant() { } AbsParameter & FloatingConstant::value() { return *_value; } double FloatingConstant::operator ()(double) const { return _value->getValue(); } Derivative FloatingConstant::partial(unsigned int index) const { assert(index==0); FixedConstant fPrime(0.0); return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Square.cc0000755000175000017500000000111112045031613020170 0ustar olesoles// -*- C++ -*- // $Id: Square.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/Square.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(Square) Square::Square() {} Square::Square(const Square & right) : AbsFunction(right) { } Square::~Square() { } double Square::operator() (double x) const { return x*x; } Derivative Square::partial(unsigned int index) const { assert(index==0); Variable x; const AbsFunction & fPrime = 2*x; return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ParameterProduct.cc0000755000175000017500000000163112045031613022220 0ustar olesoles// -*- C++ -*- // $Id: ParameterProduct.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/ParameterProduct.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { PARAMETER_OBJECT_IMP(ParameterProduct) ParameterProduct::ParameterProduct(const AbsParameter *arg1, const AbsParameter *arg2): _arg1(arg1->clone()), _arg2(arg2->clone()) { if (arg1->parameter() && _arg1->parameter()) _arg1->parameter()->connectFrom(arg1->parameter()); if (arg2->parameter() && _arg2->parameter()) _arg2->parameter()->connectFrom(arg2->parameter()); } ParameterProduct::ParameterProduct(const ParameterProduct & right) : AbsParameter(), _arg1(right._arg1->clone()), _arg2(right._arg2->clone()) {} ParameterProduct::~ParameterProduct() { delete _arg1; delete _arg2; } double ParameterProduct::getValue() const { return _arg1->getValue()*_arg2->getValue(); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/KroneckerDelta.cc0000755000175000017500000000132012045031613021627 0ustar olesoles// -*- C++ -*- // $Id: KroneckerDelta.cc,v 1.1 2007/01/21 20:54:34 boudreau Exp $ #include "CLHEP/GenericFunctions/KroneckerDelta.hh" #include "CLHEP/GenericFunctions/FixedConstant.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(KroneckerDelta) KroneckerDelta::KroneckerDelta() {} KroneckerDelta::KroneckerDelta(const KroneckerDelta & right) : AbsFunction(right) { } KroneckerDelta::~KroneckerDelta() { } double KroneckerDelta::operator() (double x) const { if (x < 0.5 && x > -0.5) return 1; return 0; } Derivative KroneckerDelta::partial(unsigned int index) const { assert(index==0); const AbsFunction & fPrime = FixedConstant(0);; return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/PtRelFcn.cc0000755000175000017500000000426212045031613020417 0ustar olesoles// -*- C++ -*- // $Id: #include "CLHEP/GenericFunctions/defs.h" #include "CLHEP/GenericFunctions/PtRelFcn.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include #include // for pow() and exp() and isfinite() #include #if (defined __STRICT_ANSI__) || (defined _WIN32) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif // M_PI #endif // __STRICT_ANSI__ namespace Genfun { FUNCTION_OBJECT_IMP(PtRelFcn) PtRelFcn::PtRelFcn(): _p0("P0", 0, 0, 1), _p1("P1", 0, 0, 2), _p2("P2", 1, 0, 10), _p3("P3", 0, 0, 10), _p4("P4", 1.0, 0.1, 5.0), _p5("P5", 0.0, 0, 50) {} PtRelFcn::~PtRelFcn() { } PtRelFcn::PtRelFcn(const PtRelFcn & right): AbsFunction(right), _p0(right._p0), _p1(right._p1), _p2(right._p2), _p3(right._p3), _p4(right._p4), _p5(right._p5) { } double PtRelFcn::operator() (double x) const { double p0 = _p0.getValue(); double p1 = _p1.getValue(); double p2 = _p2.getValue(); double p3 = _p3.getValue(); double p4 = _p4.getValue(); double p5 = _p5.getValue(); //assert ((p0>=0.0) && (p0<=1.0)); if (p0<0.0) p0=FLT_MIN; if (p0>1.0) p0=1.0-FLT_MIN; if (x<=0.0) return 1.0E-10; double n = (1+p1)/p3; double a = (1/p3)*std::pow(p2,-n); double norm = 1.0/(a*exp(_logGamma(n))); static const double s2 = sqrt(2.0); double retVal= norm*p0*std::pow(x,p1)*exp(-p2*std::pow(x,p3)) + (2.0/(1+_erf(p5/p4/s2))*(1.0-p0)/(sqrt(2*M_PI)*p4))*exp(-(x-p5)*(x-p5)/(2.0*p4*p4)); //if (!std::isfinite(retVal)) return 1.0E-10; return std::max(retVal,1.0E-10); } Parameter & PtRelFcn::P0() { return _p0; } const Parameter & PtRelFcn::P0() const { return _p0; } Parameter & PtRelFcn::P1() { return _p1; } const Parameter & PtRelFcn::P1() const { return _p1; } Parameter & PtRelFcn::P2() { return _p2; } const Parameter & PtRelFcn::P2() const { return _p2; } Parameter & PtRelFcn::P3() { return _p3; } const Parameter & PtRelFcn::P3() const { return _p3; } Parameter & PtRelFcn::P4() { return _p4; } const Parameter & PtRelFcn::P4() const { return _p4; } Parameter & PtRelFcn::P5() { return _p5; } const Parameter & PtRelFcn::P5() const { return _p5; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/HermitePolynomial.cc0000755000175000017500000000216412044565005022410 0ustar olesoles// -*- C++ -*- // $Id: #include "CLHEP/GenericFunctions/HermitePolynomial.hh" #include "CLHEP/GenericFunctions/FixedConstant.hh" #include #include namespace Genfun { FUNCTION_OBJECT_IMP(HermitePolynomial) HermitePolynomial::HermitePolynomial(unsigned int N) :_N(N) {} HermitePolynomial::~HermitePolynomial() { } HermitePolynomial::HermitePolynomial(const HermitePolynomial & right) :AbsFunction(), _N(right._N) { } double HermitePolynomial::operator() (double x) const { const static double h00=0.0; const static double h0=sqrt(M_PI/4.0); double p0=h00; double p1=h00; double pn=h0; for (unsigned int i=1;i<=_N;i++) { p0=p1; p1=pn; pn=x*sqrt(2.0/i)*p1-sqrt((i-1.0)/i)*p0; } return pn; } unsigned int HermitePolynomial::N() const { return _N; } Derivative HermitePolynomial::partial(unsigned int index) const { assert(index==0); if (_N>0) { const AbsFunction & fPrime = sqrt(2.0*_N)*HermitePolynomial(_N-1); return Derivative(& fPrime); } else { const AbsFunction & fPrime = FixedConstant(0.0); return Derivative(& fPrime); } } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/InterpolatingPolynomial.cc0000644000175000017500000000341611712611770023632 0ustar olesoles// -*- C++ -*- // $Id: #include "CLHEP/GenericFunctions/InterpolatingPolynomial.hh" #include #include #include namespace Genfun { FUNCTION_OBJECT_IMP(InterpolatingPolynomial) InterpolatingPolynomial::InterpolatingPolynomial() :Genfun::AbsFunction() {} InterpolatingPolynomial::InterpolatingPolynomial(const InterpolatingPolynomial & right) :Genfun::AbsFunction(),xPoints(right.xPoints) {} InterpolatingPolynomial::~InterpolatingPolynomial() { } double InterpolatingPolynomial::operator() (double x) const { double y=0.0; double deltay=0; // also gives error; double dif = fabs(x-xPoints[0].first),dift; const unsigned int _K=xPoints.size(),_KP=_K+1; std::vectorc(_KP),d(_KP); int ns=0; for (unsigned int i=0;i<_K;i++) { dift=fabs(x-xPoints[i].first); if (dift namespace Genfun { FUNCTION_OBJECT_IMP(Abs) Abs::Abs() {} Abs::Abs(const Abs & right) : AbsFunction(right) { } Abs::~Abs() { } double Abs::operator() (double x) const { return std::abs(x); } } clhep-2.1.4.1.orig/GenericFunctions/src/AbsParameter.cc0000755000175000017500000000364512045031613021314 0ustar olesoles// -*- C++ -*- // $Id: AbsParameter.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/AbsParameter.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { // Two do-nothing functions: AbsParameter::AbsParameter() { } AbsParameter::~AbsParameter(){ } AbsParameter::AbsParameter(const AbsParameter &) {} AbsParameter *AbsParameter::clone() const { return _clone(); } ParameterSum operator + (const AbsParameter & a, const AbsParameter & b) { return ParameterSum(&a,&b); } ParameterDifference operator - (const AbsParameter & a, const AbsParameter & b) { return ParameterDifference(&a,&b); } ParameterProduct operator * (const AbsParameter & a, const AbsParameter & b) { return ParameterProduct(&a,&b); } ParameterQuotient operator / (const AbsParameter & a, const AbsParameter & b) { return ParameterQuotient(&a,&b); } ParameterNegation operator - (const AbsParameter & a) { return ParameterNegation(&a); } ConstTimesParameter operator * (double c, const AbsParameter &op2){ return ConstTimesParameter (c, &op2); } ConstPlusParameter operator + (double c, const AbsParameter &op2){ return ConstPlusParameter (c, &op2); } ConstMinusParameter operator - (double c, const AbsParameter &op2){ return ConstMinusParameter(c, &op2); } ConstOverParameter operator / (double c, const AbsParameter &op2){ return ConstOverParameter(c, &op2); } ConstTimesParameter operator * (const AbsParameter &op2, double c){ return ConstTimesParameter (c, &op2); } ConstPlusParameter operator + (const AbsParameter &op2, double c){ return ConstPlusParameter (c, &op2); } ConstPlusParameter operator - (const AbsParameter &op2, double c){ return ConstPlusParameter(-c, &op2); } ConstTimesParameter operator / (const AbsParameter &op2, double c){ return ConstTimesParameter(1/c, &op2); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Power.cc0000755000175000017500000000241612045031613020035 0ustar olesoles// -*- C++ -*- // $Id: Power.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ #include "CLHEP/GenericFunctions/Power.hh" #include // for pow() namespace Genfun { FUNCTION_OBJECT_IMP(Power) Power::Power(int n): _intPower(n), _asInteger(true) {} Power::Power(unsigned int n): _intPower(n), _asInteger(true) {} Power::Power(double n): _doublePower(n), _asInteger(false) {} Power::Power(const Power & right) : AbsFunction(right), _doublePower(right._doublePower), _intPower(right._intPower), _asInteger(right._asInteger) {} Power::~Power() { } double Power::operator() (double x) const { if (_asInteger) { if (_intPower==0) { return 1; } else if (_intPower>0) { double f = 1; for (int i=0;i<_intPower;i++) { f *=x; } return f; } else { double f = 1; for (int i=0;i<-_intPower;i++) { f /=x; } return f; } } else { return std::pow(x,_doublePower); } } Derivative Power::partial(unsigned int) const { if (_asInteger) { const AbsFunction & fPrime = _intPower*Power(_intPower-1); return Derivative(&fPrime); } else { const AbsFunction & fPrime = _doublePower*Power(_doublePower-1); return Derivative(&fPrime); } } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/StepDoublingRKStepper.cc0000644000175000017500000000466612013205200023134 0ustar olesoles#include "CLHEP/GenericFunctions/StepDoublingRKStepper.hh" #include #include namespace Genfun { StepDoublingRKStepper::StepDoublingRKStepper(const ButcherTableau & xtableau):tableau(xtableau) { } StepDoublingRKStepper::~StepDoublingRKStepper() { } void StepDoublingRKStepper::step (const RKIntegrator::RKData * data, const RKIntegrator::RKData::Data & s, RKIntegrator::RKData::Data & d, std::vector & errors) const { const unsigned int nvar = s.variable.size(); RKIntegrator::RKData::Data d1(nvar),d2(nvar); doStep(data,s,d); double dt = (d.time - s.time); d1.time = s.time + dt/2.0; d2.time = d.time; doStep(data, s,d1); doStep(data,d1,d2); // Error estimate: errors.resize(nvar); for (size_t v=0;v >k(tableau.nSteps()); for (unsigned int i=0;i_diffEqn[v])(arg); } // // Final result. // for (unsigned int v=0;vclone()), _arg2(arg2->clone()) { if (arg1->parameter() && _arg1->parameter()) _arg1->parameter()->connectFrom(arg1->parameter()); if (arg2->parameter() && _arg2->parameter()) _arg2->parameter()->connectFrom(arg2->parameter()); } ParameterDifference::ParameterDifference(const ParameterDifference & right) : AbsParameter(), _arg1(right._arg1->clone()), _arg2(right._arg2->clone()) {} ParameterDifference::~ParameterDifference() { delete _arg1; delete _arg2; } double ParameterDifference::getValue() const { return _arg1->getValue()-_arg2->getValue(); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ConstMinusParameter.cc0000755000175000017500000000154712045031613022710 0ustar olesoles// -*- C++ -*- // $Id: ConstMinusParameter.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/ConstMinusParameter.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { PARAMETER_OBJECT_IMP(ConstMinusParameter) ConstMinusParameter::ConstMinusParameter(double xconstant, const AbsParameter *aparm): _constant(xconstant), _parameter(aparm->clone()) { if (aparm->parameter() && _parameter->parameter()) _parameter->parameter()->connectFrom(aparm->parameter()); } ConstMinusParameter::ConstMinusParameter(const ConstMinusParameter & right) : AbsParameter(right), _constant(right._constant), _parameter(right._parameter->clone()) {} ConstMinusParameter::~ConstMinusParameter() { delete _parameter; } double ConstMinusParameter::getValue() const { return _constant - _parameter->getValue(); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/.cvsignore0000755000175000017500000000001407705453233020437 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/GenericFunctions/src/AnalyticConvolution.cc0000755000175000017500000001617012045031613022747 0ustar olesoles// -*- C++ -*- // $Id: AnalyticConvolution.cc,v 1.8 2010/07/22 21:55:10 garren Exp $ #include "CLHEP/GenericFunctions/AnalyticConvolution.hh" #include "CLHEP/GenericFunctions/Gaussian.hh" #include "CLHEP/GenericFunctions/Exponential.hh" #include // for isfinite #if (defined _WIN32) #include // Visual C++ _finite #endif namespace Genfun { FUNCTION_OBJECT_IMP(AnalyticConvolution) AnalyticConvolution::AnalyticConvolution(AnalyticConvolution::Type type) : _lifetime ("Lifetime", 1.0, 0.0), // Bounded from below by zero, by default _frequency("Frequency", 0.0, 0.0), // Bounded from below by zero, by default _sigma ("Sigma", 1.0, 0.0), // Bounded from below by zero, by default _offset ("Offset", 0.0), // Offset is unbounded _type(type) { } AnalyticConvolution::AnalyticConvolution(const AnalyticConvolution & right): AbsFunction(right), _lifetime (right._lifetime), _frequency (right._frequency), _sigma (right._sigma), _offset (right._offset), _type(right._type) { } AnalyticConvolution::~AnalyticConvolution() { } Parameter & AnalyticConvolution::frequency() { return _frequency; } const Parameter & AnalyticConvolution::frequency() const { return _frequency; } Parameter & AnalyticConvolution::lifetime() { return _lifetime; } const Parameter & AnalyticConvolution::lifetime() const { return _lifetime; } Parameter & AnalyticConvolution::sigma() { return _sigma; } const Parameter & AnalyticConvolution::sigma() const { return _sigma; } Parameter & AnalyticConvolution::offset() { return _offset; } const Parameter & AnalyticConvolution::offset() const { return _offset; } double AnalyticConvolution::operator() (double argument) const { // Fetch the paramters. This operator does not convolve numerically. static const double sqrtTwo = sqrt(2.0); double xsigma = _sigma.getValue(); double tau = _lifetime.getValue(); double xoffset = _offset.getValue(); double x = argument-xoffset; double freq = _frequency.getValue(); // smeared exponential an its asymmetry. double expG=0.0, asymm=0.0; if (_type==SMEARED_NEG_EXP) { expG = exp((xsigma*xsigma +2*tau*(/*xoffset*/x))/(2.0*tau*tau)) * erfc((xsigma*xsigma+tau*(/*xoffset*/x))/(sqrtTwo*xsigma*tau))/(2.0*tau); #if (defined _WIN32) if (!_finite(expG)) { expG=0.0; } #else if (!std::isfinite(expG)) { expG=0.0; } #endif return expG; } else { expG = exp((xsigma*xsigma +2*tau*(/*xoffset*/-x))/(2.0*tau*tau)) * erfc((xsigma*xsigma+tau*(/*xoffset*/-x))/(sqrtTwo*xsigma*tau))/(2.0*tau); } // Both sign distribution=> return smeared exponential: if (_type==SMEARED_EXP) { #if (defined _WIN32) if (!_finite(expG)) { expG=0.0; } #else if (!std::isfinite(expG)) { expG=0.0; } #endif return expG; } // Calcualtion of asymmetry: // First, if the mixing frequency is too high compared with the lifetime, we // cannot see this oscillation. We abandon the complicated approach and just do // this instead: if (xsigma>6.0*tau) { asymm = expG*(1/(1+tau*tau*freq*freq)); } else if (xsigma==0.0) { if (_type==SMEARED_COS_EXP|| _type==MIXED || _type==UNMIXED ) { if (x>=0) asymm= (expG*cos(freq*x)); } else if (_type==SMEARED_SIN_EXP) { if (x>=0) asymm= (expG*sin(freq*x)); } } else { std::complex z(freq*xsigma/sqrtTwo, (xsigma/tau-x/xsigma)/sqrtTwo); if (x<0) { if (_type==SMEARED_COS_EXP|| _type==MIXED || _type==UNMIXED ) { asymm= 2.0*nwwerf(z).real()/tau/4.0*exp(-x*x/2.0/xsigma/xsigma); } else if (_type==SMEARED_SIN_EXP) { asymm= 2.0*nwwerf(z).imag()/tau/4.0*exp(-x*x/2.0/xsigma/xsigma); } } else { if (_type==SMEARED_COS_EXP||_type==MIXED || _type==UNMIXED) { asymm= -2.0*nwwerf(std::conj(z)).real()/tau/4*exp(-x*x/2.0/xsigma/xsigma) + exp(xsigma*xsigma/2 *(1/tau/tau - freq*freq) - x/tau)*(1./tau)*cos(freq*x - freq/tau*xsigma*xsigma); } else if (_type==SMEARED_SIN_EXP) { asymm= +2.0*nwwerf(std::conj(z)).imag()/tau/4*exp(-x*x/2.0/xsigma/xsigma) + exp(xsigma*xsigma/2 *(1/tau/tau - freq*freq) - x/tau)*(1./tau)*sin(freq*x - freq/tau*xsigma*xsigma); } } } // Return either MIXED, UNMIXED, or ASYMMETRY function. if (_type==UNMIXED) { double retVal = (expG+asymm)/2.0; if (retVal<0) std::cerr << "Warning in AnalyticConvolution: negative probablity" << std::endl; if (retVal<0) std::cerr << xsigma << ' ' << tau << ' ' << xoffset << ' ' << freq << ' '<< argument << std::endl; if (retVal<0) std::cerr << retVal << std::endl; return retVal; } else if (_type==MIXED) { double retVal = (expG-asymm)/2.0; if (retVal<0) std::cerr << "Warning in AnalyticConvolution: negative probablity" << std::endl; if (retVal<0) std::cerr << xsigma << ' ' << tau << ' ' << xoffset << ' ' << freq << ' ' << argument << std::endl; if (retVal<0) std::cerr << retVal << std::endl; return retVal; } else if (_type==SMEARED_COS_EXP || _type==SMEARED_SIN_EXP) { return asymm; } else { std::cerr << "Unknown sign parity. State is not allowed" << std::endl; exit(0); return 0.0; } } double AnalyticConvolution::erfc(double x) const { // This is accurate to 7 places. // See Numerical Recipes P 221 double t, z, ans; z = (x < 0) ? -x : x; t = 1.0/(1.0+.5*z); ans = t*exp(-z*z-1.26551223+t*(1.00002368+t*(0.37409196+t*(0.09678418+ t*(-0.18628806+t*(0.27886807+t*(-1.13520398+t*(1.48851587+ t*(-0.82215223+t*0.17087277 ))) ))) ))); if ( x < 0 ) ans = 2.0 - ans; return ans; } double AnalyticConvolution::pow(double x,int n) const { double val=1; for(int i=0;i AnalyticConvolution::nwwerf(std::complex z) const { std::complex zh,r[38],s,t,v; const double z1 = 1; const double hf = z1/2; const double z10 = 10; const double c1 = 74/z10; const double c2 = 83/z10; const double c3 = z10/32; const double c4 = 16/z10; const double c = 1.12837916709551257; const double p = pow(2.0*c4,33); double x=z.real(); double y=z.imag(); double xa=(x >= 0) ? x : -x; double ya=(y >= 0) ? y : -y; if(ya < c1 && xa < c2){ zh = std::complex(ya+c4,xa); r[37]= std::complex(0,0); // do 1 n = 36,1,-1 for(int n = 36; n>0; n--){ t=zh+double(n)*std::conj(r[n+1]); r[n]=hf*t/std::norm(t); } double xl=p; s=std::complex(0,0); // do 2 n = 33,1,-1 for(int k=33; k>0; k--){ xl=c3*xl; s=r[k]*(s+xl); } v=c*s; } else{ zh=std::complex(ya,xa); r[1]=std::complex(0,0); // do 3 n = 9,1,-1 for(int n=9;n>0;n--){ t=zh+double(n)*std::conj(r[1]); r[1]=hf*t/std::norm(t); } v=c*r[1]; } if(ya == 0) v= std::complex(exp(-xa*xa),v.imag()); if(y < 0) { v=2.0*std::exp(std::complex(-xa,-ya)*std::complex(xa,ya))-v; if(x > 0) v=std::conj(v); } else{ if(x < 0) v=std::conj(v); } return v; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/PhaseSpace.cc0000644000175000017500000000472011712611770020762 0ustar olesoles#include "CLHEP/GenericFunctions/PhaseSpace.hh" #include // Three classes are defined here: // 1) Classical::PhaseSpace::Component::Clockwork // 2) Classical::PhaseSpace::Component // 2) Classical::PhaseSpace namespace Classical { //------------------------------------------------// // // // 1. Classical::PhaseSpace::Component::Clockwork // // This class just holds variables: // // // //------------------------------------------------// class PhaseSpace::Component::Clockwork { public: // Constructor: Clockwork(){}; // Destructor ~Clockwork () { for (size_t i=0;i functions; }; //------------------------------------------------// // // // 2. Classical::PhaseSpace::Component // // This class gives access to the variables that // // make up the coordinates and momenta. // // // //------------------------------------------------// PhaseSpace::Component::Component(unsigned int NDIM, bool isMomenta) : c(new Clockwork()) { for (unsigned int i=0;ifunctions.push_back(new Genfun::Variable(i+offset, 2*NDIM)); } } PhaseSpace::Component::~Component() { delete c; } Genfun::Variable PhaseSpace::Component::operator[] (unsigned int i) const { return *(c->functions[i]); } PhaseSpace::PhaseSpace(unsigned int NDIM): _coordinates(NDIM,false),_momenta(NDIM,true),_q0(NDIM),_p0(NDIM),DIM(NDIM) { } PhaseSpace::~PhaseSpace() { } const PhaseSpace::Component & PhaseSpace::coordinates() const { return _coordinates; } const PhaseSpace::Component & PhaseSpace::momenta() const { return _momenta; } void PhaseSpace::start (const Genfun::Variable & v, double value){ unsigned int index =v.index(); if (index #include // for log() namespace Genfun { EfficiencyFunctional::EfficiencyFunctional(const ArgumentList & aList): _aList(aList) {} EfficiencyFunctional::~EfficiencyFunctional() { } double EfficiencyFunctional::operator [] (const AbsFunction & function) const { double logEfficiency(0); for (unsigned int i=0; i<_aList.size()-1;i++) { Argument a = _aList[i]; Argument b(a.dimension()-1); for (unsigned int j=0;j1) { std::cerr << "Warning.. negative likelihood arg[" << i << "]=" << a << "f=" << f << std::endl; } logEfficiency -= (a[a.dimension()-1]>0.5) ? log(f):log(1-f); } return 2.0*logEfficiency; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/FunctionNegation.cc0000755000175000017500000000163312045031613022213 0ustar olesoles// -*- C++ -*- // $Id: FunctionNegation.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/FunctionNegation.hh" namespace Genfun { FUNCTION_OBJECT_IMP(FunctionNegation) FunctionNegation::FunctionNegation(const AbsFunction *arg1): _arg1(arg1->clone()) { } FunctionNegation::FunctionNegation(const FunctionNegation & right): AbsFunction(right), _arg1(right._arg1->clone()) { } FunctionNegation::~FunctionNegation() { delete _arg1; } unsigned int FunctionNegation::dimensionality() const { return _arg1->dimensionality(); } double FunctionNegation::operator ()(double x) const { return -((*_arg1)(x)); } double FunctionNegation::operator ()(const Argument & x) const { return -((*_arg1)(x)); } Derivative FunctionNegation::partial(unsigned int index) const { const AbsFunction & fPrime = -(_arg1->partial(index)); return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/PuncturedSmearedExp.cc0000755000175000017500000000756112045031613022676 0ustar olesoles// -*- C++ -*- // $Id: PuncturedSmearedExp.cc,v 1.4 2010/06/16 18:22:01 garren Exp $ #include "CLHEP/GenericFunctions/PuncturedSmearedExp.hh" #include #include namespace Genfun { FUNCTION_OBJECT_IMP(PuncturedSmearedExp) PuncturedSmearedExp::PuncturedSmearedExp() : _lifetime ("Lifetime", 1.0, 0.0), // Bounded from below by zero, by default _sigma ("Sigma", 1.0, 0.0) // Bounded from below by zero, by default { } PuncturedSmearedExp::PuncturedSmearedExp(const PuncturedSmearedExp & right): AbsFunction(right), _lifetime (right._lifetime), _sigma (right._sigma), _punctures (right._punctures) { } void PuncturedSmearedExp::puncture(double xmin, double xmax) { std::ostringstream mn, mx; mn << "Min_" << _punctures.size()/2; mx << "Max_" << _punctures.size()/2; _punctures.push_back(Parameter(mn.str(), xmin, 0.0, 10.0)); _punctures.push_back(Parameter(mx.str(), xmax, 0.0, 10.0)); } Parameter & PuncturedSmearedExp::min(unsigned int i) { return _punctures[2*i]; } const Parameter & PuncturedSmearedExp::min(unsigned int i) const { return _punctures[2*i]; } Parameter & PuncturedSmearedExp::max(unsigned int i) { return _punctures[2*i+1]; } const Parameter & PuncturedSmearedExp::max(unsigned int i) const { return _punctures[2*i+1]; } PuncturedSmearedExp::~PuncturedSmearedExp() { } Parameter & PuncturedSmearedExp::lifetime() { return _lifetime; } const Parameter & PuncturedSmearedExp::lifetime() const { return _lifetime; } Parameter & PuncturedSmearedExp::sigma() { return _sigma; } const Parameter & PuncturedSmearedExp::sigma() const { return _sigma; } double PuncturedSmearedExp::operator() (double argument) const { // Fetch the paramters. This operator does not convolve numerically. static const double sqrtTwo = sqrt(2.0); double xsigma = _sigma.getValue(); double tau = _lifetime.getValue(); double x = argument; // Copy: std::vector punctures(_punctures.size()); for (size_t i=0;i<_punctures.size();i++) punctures[i]=_punctures[i].getValue(); // Overlap elimination: bool overlap=true; while (overlap) { overlap=false; for (size_t i=0;imin1 && max1>min2) || (min1>min2 && max2::iterator t0=punctures.begin()+2*j, t1=t0+2; punctures.erase(t0,t1); overlap=true; break; } } if (overlap) break; } } double expG=0,norm=0; for (size_t i=0;i #include #if (defined __STRICT_ANSI__) || (defined _WIN32) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif // M_PI #endif // __STRICT_ANSI__ using namespace std; namespace Genfun { FUNCTION_OBJECT_IMP(RelativisticBWDistribution) RelativisticBWDistribution::RelativisticBWDistribution(): _mass("mass", 50, 10, 90), _width ("width", 5, 0, 100) {} RelativisticBWDistribution::RelativisticBWDistribution(const RelativisticBWDistribution & right): AbsFunction(), _mass(right._mass), _width (right._width) { } RelativisticBWDistribution::~RelativisticBWDistribution() { } double RelativisticBWDistribution::operator() (double x) const { double M=_mass.getValue(); double G=_width.getValue(); double g=sqrt(M*M*(M*M+G*G)); double k = 2.0*sqrt(2.0)*M*G*g/M_PI/sqrt(M*M+g); double f = k/((x-M)*(x-M)*(x+M)*(x+M)+M*M*G*G); return f; } Parameter & RelativisticBWDistribution::mass() { return _mass; } Parameter & RelativisticBWDistribution::width() { return _width; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/FixedConstant.cc0000755000175000017500000000121112045031613021502 0ustar olesoles// -*- C++ -*- // $Id: FixedConstant.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/FixedConstant.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(FixedConstant) FixedConstant::FixedConstant(double value): _value(value) { } FixedConstant::FixedConstant(const FixedConstant & right): AbsFunction(right), _value(right._value) { } FixedConstant::~FixedConstant() { } double FixedConstant::operator ()(double) const { return _value; } Derivative FixedConstant::partial(unsigned int index) const { assert(index==0); FixedConstant fPrime(0.0); return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Parameter.cc0000755000175000017500000000477412045031613020672 0ustar olesoles// -*- C++ -*- // $Id: Parameter.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { PARAMETER_OBJECT_IMP(Parameter) Parameter::Parameter(std::string name, double value, double lowerLimit, double upperLimit): _name(name),_value(value),_lowerLimit(lowerLimit),_upperLimit(upperLimit),_sourceParameter(NULL) { } Parameter::~Parameter() { } std::ostream & operator << ( std::ostream & o, const Parameter & p) { return o << p.getName() << "\t" << " value = " << p.getValue() << "\t" <<" limits: [" << p.getLowerLimit() << "," << p.getUpperLimit() << "]" << std::endl; } const std::string & Parameter::getName() const { return _name; } double Parameter::getValue() const { if (_sourceParameter) { return _sourceParameter->getValue(); } else { return _value; } } double Parameter::getLowerLimit() const { if (_sourceParameter) { return -1E-100; } else { return _lowerLimit; } } double Parameter::getUpperLimit() const { if (_sourceParameter) { return 1E100; } else { return _upperLimit; } } void Parameter::setValue(double value) { if (_sourceParameter) { std::cerr << "Warning: Parameter is connected. Function has no effect." << std::endl; } else { _value=value; } } void Parameter::setLowerLimit(double lowerLimit) { if (_sourceParameter) { std::cerr << "Warning: Parameter is connected. Function has no effect." << std::endl; } else { _lowerLimit=lowerLimit; } } void Parameter::setUpperLimit(double upperLimit) { if (_sourceParameter) { std::cerr << "Warning: Parameter is connected. Function has no effect." << std::endl; } else { _upperLimit=upperLimit; } } void Parameter::connectFrom(const AbsParameter * source) { const Parameter *sp = source->parameter(); if (sp && sp->_sourceParameter) { connectFrom(sp->_sourceParameter); } else { _sourceParameter = source; } } Parameter::Parameter(const Parameter & right): AbsParameter(right), _name(right._name), _value(right._value), _lowerLimit(right._lowerLimit), _upperLimit(right._upperLimit), _sourceParameter(right._sourceParameter) { } const Parameter & Parameter::operator=(const Parameter &right) { if (this != &right) { _name=right._name; _value=right._value; _lowerLimit=right._lowerLimit; _upperLimit=right._upperLimit; _sourceParameter=right._sourceParameter; } return *this; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Erf.cc0000755000175000017500000000136312045031613017455 0ustar olesoles// -*- C++ -*- // $Id: Erf.cc,v 1.6 2010/06/16 18:22:01 garren Exp $ #include #include "CLHEP/GenericFunctions/Erf.hh" #include "CLHEP/GenericFunctions/Gaussian.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(Erf) Erf::Erf() { _incompleteGamma.a().setValue(0.5); } Erf::Erf(const Erf & right): AbsFunction(right), _incompleteGamma(right._incompleteGamma) { } Erf::~Erf() { } double Erf::operator() (double x) const { return x<0 ? -_incompleteGamma(x*x): _incompleteGamma(x*x); } Derivative Erf::partial(unsigned int index) const { assert(index==0); Gaussian gauss = Gaussian(); gauss.sigma().setValue(sqrt(2.0)); const AbsFunction & fPrime = 2.0*gauss; return Derivative(& fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Rectangular.cc0000755000175000017500000000272712045031613021215 0ustar olesoles// -*- C++ -*- // $Id: Rectangular.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/Rectangular.hh" #include "CLHEP/GenericFunctions/FixedConstant.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(Rectangular) Rectangular::Rectangular(): _x0("x0", -1.0, -10, 0), _x1("x1", 1.0, 0, 10), _baseline("baseline", 0,-10, 10), _height("height",1, -10, 10) {} Rectangular::Rectangular(const Rectangular & right) : AbsFunction(right), _x0(right._x0), _x1(right._x1), _baseline(right._baseline), _height(right._height) { } Rectangular::~Rectangular() { } double Rectangular::operator() (double x) const { if (x<_x0.getValue()) { return _baseline.getValue(); } else if (x<_x1.getValue()) { return _height.getValue(); } else { return _baseline.getValue(); } } Parameter & Rectangular::x0() { return _x0; } Parameter & Rectangular::x1() { return _x1; } Parameter & Rectangular::baseline() { return _baseline; } Parameter & Rectangular::height() { return _height; } const Parameter & Rectangular::x0() const { return _x0; } const Parameter & Rectangular::x1() const { return _x1; } const Parameter & Rectangular::baseline() const { return _baseline; } const Parameter & Rectangular::height() const{ return _height; } Derivative Rectangular::partial(unsigned int index) const { assert(index==0); const AbsFunction & fPrime = FixedConstant(0);; return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/FunctionNoop.cc0000755000175000017500000000156612045031613021367 0ustar olesoles// -*- C++ -*- // $Id: FunctionNoop.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ // --------------------------------------------------------------------------- #include "CLHEP/GenericFunctions/FunctionNoop.hh" namespace Genfun { FUNCTION_OBJECT_IMP(FunctionNoop) FunctionNoop::FunctionNoop(const AbsFunction *arg1): _arg1(arg1->clone()) { } FunctionNoop::FunctionNoop(const FunctionNoop & right): AbsFunction(right), _arg1(right._arg1->clone()) { } FunctionNoop::~FunctionNoop() { delete _arg1; } unsigned int FunctionNoop::dimensionality() const { return _arg1->dimensionality(); } double FunctionNoop::operator ()(double x) const { return +((*_arg1)(x)); } double FunctionNoop::operator ()(const Argument & x) const { return +((*_arg1)(x)); } Derivative FunctionNoop::partial(unsigned int index) const { return _arg1->partial(index); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/X.cc0000755000175000017500000000046612045031613017153 0ustar olesoles// -*- C++ -*- // $Id: X.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/X.hh" namespace Genfun { FUNCTION_OBJECT_IMP(X_) X_::X_() {} X_::X_(const X_ & right) : AbsFunction(right) { } X_::~X_() { } double X_::operator() (double x) const { return x; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Exp.cc0000755000175000017500000000074512045031613017500 0ustar olesoles// -*- C++ -*- // $Id: Exp.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ #include "CLHEP/GenericFunctions/Exp.hh" #include #include // for exp() namespace Genfun { FUNCTION_OBJECT_IMP(Exp) Exp::Exp() {} Exp::Exp(const Exp & right) : AbsFunction(right) {} Exp::~Exp() { } double Exp::operator() (double x) const { return exp(x); } Derivative Exp::partial(unsigned int index) const { assert(index==0); return Derivative(this); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/AdaptiveRKStepper.cc0000644000175000017500000000654412200255242022300 0ustar olesoles#include "CLHEP/GenericFunctions/AdaptiveRKStepper.hh" #include "CLHEP/GenericFunctions/EmbeddedRKStepper.hh" #include #include namespace Genfun { AdaptiveRKStepper::AdaptiveRKStepper(const EEStepper *stepper): eeStepper(stepper ? stepper->clone():new EmbeddedRKStepper()), T(1.0E-6), sStepsize(0.01), S(0.9), Rmin(0.0), Rmax(5.0), stepsize(sStepsize) { } AdaptiveRKStepper::AdaptiveRKStepper(const AdaptiveRKStepper & right): RKStepper(right), eeStepper(right.eeStepper->clone()), T(right.T), sStepsize(right.sStepsize), S(right.S), Rmin(right.Rmin), Rmax(right.Rmax), stepsize(right.sStepsize) { } void AdaptiveRKStepper::step(const RKIntegrator::RKData * data, const RKIntegrator::RKData::Data & s, RKIntegrator::RKData::Data & d, double timeLimit) const { // // Adaptive stepsize control // if (s.time==0.0) { stepsize=sStepsize; } const unsigned int p = eeStepper->order(); // Order of the stepper const double deltaMax = T*std::pow(S/Rmax, (int)(p+1)); // Maximum error 4 adjustment. const double TINY = 1.0E-30; // Denominator regularization double hnext; // // Time limited step ? // d.time= timeLimit==0? s.time+stepsize : timeLimit; //--------------------------------------// // Take one step, from s to d: // //--------------------------------------// double h = d.time-s.time; while (1) { std::vector errors; eeStepper->step(data, s, d, errors); if (timeLimit!=0.0) return; // Take absolute value: for (size_t e=0;e T) { // // Bail out and try a smaller step. // h = std::max(S*h*std::pow(T/(delta + TINY), 1.0/(p+1)),Rmin*h); if (!(((double) (s.time+h) - (double) s.time) > 0) ) { throw std::runtime_error("Warning, RK Integrator step underflow"); } d.time = s.time+h; hnext=h; continue; } else { if (delta < deltaMax) { hnext = S*h*std::pow(T/(delta + TINY),1.0/(p+1)); // stepsize is supposed to increase; if (hnext #include // for log() namespace Genfun { FUNCTION_OBJECT_IMP(Ln) Ln::Ln() {} Ln::~Ln() { } Ln::Ln(const Ln & right) : AbsFunction(right) { } double Ln::operator() (double x) const { return log(x); } Derivative Ln::partial(unsigned int index) const { assert(index==0); const AbsFunction & fPrime = 1.0/Variable(); return Derivative(& fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/FunctionDifference.cc0000755000175000017500000000237612045031613022506 0ustar olesoles// -*- C++ -*- // $Id: FunctionDifference.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/FunctionDifference.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(FunctionDifference) FunctionDifference::FunctionDifference(const AbsFunction *arg1, const AbsFunction *arg2): _arg1(arg1->clone()), _arg2(arg2->clone()) { if (arg1->dimensionality()!=arg2->dimensionality()) { std::cout << "Warning: dimension mismatch in function difference" << std::endl; assert(0); } } FunctionDifference::FunctionDifference(const FunctionDifference & right): AbsFunction(right), _arg1(right._arg1->clone()), _arg2(right._arg2->clone()) { } unsigned int FunctionDifference::dimensionality() const { return _arg1->dimensionality(); } FunctionDifference::~FunctionDifference() { delete _arg1; delete _arg2; } double FunctionDifference::operator ()(double x) const { return (*_arg1)(x)-(*_arg2)(x); } double FunctionDifference::operator ()(const Argument & x) const { return (*_arg1)(x)-(*_arg2)(x); } Derivative FunctionDifference::partial(unsigned int index) const { const AbsFunction & fPrime = _arg1->partial(index) - _arg2->partial(index); return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/EmbeddedRKStepper.cc0000644000175000017500000000371512012777433022245 0ustar olesoles#include "CLHEP/GenericFunctions/EmbeddedRKStepper.hh" #include "CLHEP/GenericFunctions/ExtendedButcherTableau.hh" #include namespace Genfun { EmbeddedRKStepper::EmbeddedRKStepper(const ExtendedButcherTableau & mtableau): tableau(mtableau){ } EmbeddedRKStepper::~EmbeddedRKStepper() { } void EmbeddedRKStepper::step (const RKIntegrator::RKData * data, const RKIntegrator::RKData::Data & s, RKIntegrator::RKData::Data & d, std::vector & errors) const { // First step: double h = d.time - s.time; if (h<=0) throw std::runtime_error ("Runtime error in RKIntegrator (zero or negative stepsize)"); unsigned int nvar = s.variable.size(); // Compute all of the k's..: // std::vector >k(tableau.nSteps()); for (unsigned int i=0;i_diffEqn[v])(arg); } // // Final result. // for (unsigned int v=0;v namespace Genfun { FUNCTION_OBJECT_IMP(FunctionConvolution) FunctionConvolution::FunctionConvolution(const AbsFunction *arg1, const AbsFunction *arg2, double x0, double x1):_arg1(arg1->clone()),_arg2(arg2->clone()),_x0(x0), _x1(x1) { if ((arg1->dimensionality()!=1) || arg2->dimensionality()!=1) { std::cout << "Warning: dimension mismatch in function convolution" << std::endl; assert(0); } } FunctionConvolution::FunctionConvolution(const FunctionConvolution & right): AbsFunction(right), _arg1(right._arg1->clone()), _arg2(right._arg2->clone()), _x0(right._x0), _x1(right._x1) {} FunctionConvolution::~FunctionConvolution() { delete _arg1; delete _arg2; } double FunctionConvolution::operator ()(double argument) const { const double NDIVISIONS=200.0; double dx = (_x1-_x0)/NDIVISIONS; double result=0.0; for (double x=_x0; x<_x1; x+=dx) { result += (*_arg1)(argument-x)*(*_arg2)(x); } result/=NDIVISIONS; return result; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ParameterQuotient.cc0000755000175000017500000000164412045031613022414 0ustar olesoles// -*- C++ -*- // $Id: ParameterQuotient.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/ParameterQuotient.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { PARAMETER_OBJECT_IMP(ParameterQuotient) ParameterQuotient::ParameterQuotient(const AbsParameter *arg1, const AbsParameter *arg2): _arg1(arg1->clone()), _arg2(arg2->clone()) { if (arg1->parameter() && _arg1->parameter()) _arg1->parameter()->connectFrom(arg1->parameter()); if (arg2->parameter() && _arg2->parameter()) _arg2->parameter()->connectFrom(arg2->parameter()); } ParameterQuotient::ParameterQuotient(const ParameterQuotient & right) : AbsParameter(), _arg1(right._arg1->clone()), _arg2(right._arg2->clone()) {} ParameterQuotient::~ParameterQuotient() { delete _arg1; delete _arg2; } double ParameterQuotient::getValue() const { return _arg1->getValue()/_arg2->getValue(); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ACos.cc0000755000175000017500000000125712045031613017570 0ustar olesoles// -*- C++ -*- // $Id: ACos.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ #include "CLHEP/GenericFunctions/ACos.hh" #include "CLHEP/GenericFunctions/Sqrt.hh" #include "CLHEP/GenericFunctions/Square.hh" #include #include // for acos() namespace Genfun { FUNCTION_OBJECT_IMP(ACos) ACos::ACos() {} ACos::~ACos() { } ACos::ACos(const ACos & right) : AbsFunction(right) { } double ACos::operator() (double x) const { return acos(x); } Derivative ACos::partial(unsigned int index) const { assert(index==0); Square square; Sqrt root; const AbsFunction & fPrime = - 1.0/root(1.0-square) ; return Derivative(& fPrime); } } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Landau.cc0000755000175000017500000001144512045031613020147 0ustar olesoles// -*- C++ -*- // $Id: Landau.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ // --------------------------------------------------------------------------- #include "CLHEP/GenericFunctions/Landau.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include #include using namespace std; namespace Genfun { FUNCTION_OBJECT_IMP(Landau) Landau::Landau(): _peak("Peak", 5.0 ,0, 10), _width("Width",1.0,0, 10) {} Landau::~Landau() { } Landau::Landau(const Landau & right): AbsFunction(right), _peak(right._peak), _width(right._width) { } double Landau::operator() (double x) const { double s = _width.getValue(); double x0 = _peak.getValue(); double xs = x0 + 0.222782*s; return _denlan((x-xs)/s)/s; } Parameter & Landau::peak() { return _peak; } Parameter & Landau::width() { return _width; } const Parameter & Landau::peak() const { return _peak; } const Parameter & Landau::width() const { return _width; } double Landau::_denlan(double x) const { /* Initialized data */ static float p1[5] = { (float).4259894875,(float)-.124976255,(float) .039842437,(float)-.006298287635,(float).001511162253 }; static float q5[5] = { (float)1.,(float)156.9424537,(float)3745.310488,( float)9834.698876,(float)66924.28357 }; static float p6[5] = { (float)1.000827619,(float)664.9143136,(float) 62972.92665,(float)475554.6998,(float)-5743609.109 }; static float q6[5] = { (float)1.,(float)651.4101098,(float)56974.73333,( float)165917.4725,(float)-2815759.939 }; static float a1[3] = { (float).04166666667,(float)-.01996527778,(float) .02709538966 }; static float a2[2] = { (float)-1.84556867,(float)-4.284640743 }; static float q1[5] = { (float)1.,(float)-.3388260629,(float).09594393323,( float)-.01608042283,(float).003778942063 }; static float p2[5] = { (float).1788541609,(float).1173957403,(float) .01488850518,(float)-.001394989411,(float)1.283617211e-4 }; static float q2[5] = { (float)1.,(float).7428795082,(float).3153932961,( float).06694219548,(float).008790609714 }; static float p3[5] = { (float).1788544503,(float).09359161662,(float) .006325387654,(float)6.611667319e-5,(float)-2.031049101e-6 }; static float q3[5] = { (float)1.,(float).6097809921,(float).2560616665,( float).04746722384,(float).006957301675 }; static float p4[5] = { (float).9874054407,(float)118.6723273,(float) 849.279436,(float)-743.7792444,(float)427.0262186 }; static float q4[5] = { (float)1.,(float)106.8615961,(float)337.6496214,( float)2016.712389,(float)1597.063511 }; static float p5[5] = { (float)1.003675074,(float)167.5702434,(float) 4789.711289,(float)21217.86767,(float)-22324.9491 }; /* System generated locals */ float ret_val, r__1; /* Local variables */ static float u, v; v = x; if (v < (float)-5.5) { u = exp(v + (float)1.); ret_val = exp(-1 / u) / sqrt(u) * (float).3989422803 * ((a1[0] + (a1[ 1] + a1[2] * u) * u) * u + 1); } else if (v < (float)-1.) { u = exp(-v - 1); ret_val = exp(-u) * sqrt(u) * (p1[0] + (p1[1] + (p1[2] + (p1[3] + p1[ 4] * v) * v) * v) * v) / (q1[0] + (q1[1] + (q1[2] + (q1[3] + q1[4] * v) * v) * v) * v); } else if (v < (float)1.) { ret_val = (p2[0] + (p2[1] + (p2[2] + (p2[3] + p2[4] * v) * v) * v) * v) / (q2[0] + (q2[1] + (q2[2] + (q2[3] + q2[4] * v) * v) * v) * v); } else if (v < (float)5.) { ret_val = (p3[0] + (p3[1] + (p3[2] + (p3[3] + p3[4] * v) * v) * v) * v) / (q3[0] + (q3[1] + (q3[2] + (q3[3] + q3[4] * v) * v) * v) * v); } else if (v < (float)12.) { u = 1 / v; /* Computing 2nd power */ r__1 = u; ret_val = r__1 * r__1 * (p4[0] + (p4[1] + (p4[2] + (p4[3] + p4[4] * u) * u) * u) * u) / (q4[0] + (q4[1] + (q4[2] + (q4[3] + q4[4] * u) * u) * u) * u); } else if (v < (float)50.) { u = 1 / v; /* Computing 2nd power */ r__1 = u; ret_val = r__1 * r__1 * (p5[0] + (p5[1] + (p5[2] + (p5[3] + p5[4] * u) * u) * u) * u) / (q5[0] + (q5[1] + (q5[2] + (q5[3] + q5[4] * u) * u) * u) * u); } else if (v < (float)300.) { u = 1 / v; /* Computing 2nd power */ r__1 = u; ret_val = r__1 * r__1 * (p6[0] + (p6[1] + (p6[2] + (p6[3] + p6[4] * u) * u) * u) * u) / (q6[0] + (q6[1] + (q6[2] + (q6[3] + q6[4] * u) * u) * u) * u); } else { u = 1 / (v - v * log(v) / (v + 1)); /* Computing 2nd power */ r__1 = u; ret_val = r__1 * r__1 * ((a2[0] + a2[1] * u) * u + 1); } return ret_val; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ATan.cc0000755000175000017500000000116012045031613017557 0ustar olesoles// -*- C++ -*- // $Id: ATan.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ #include "CLHEP/GenericFunctions/ATan.hh" #include "CLHEP/GenericFunctions/Square.hh" #include #include // for atan() namespace Genfun { FUNCTION_OBJECT_IMP(ATan) ATan::ATan() {} ATan::~ATan() { } ATan::ATan(const ATan & right) : AbsFunction(right) { } double ATan::operator() (double x) const { return atan(x); } Derivative ATan::partial(unsigned int index) const { assert(index==0); Square square; const AbsFunction & fPrime=1.0/(1.0+square);; return Derivative(& fPrime); } } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/TrivariateGaussian.cc0000755000175000017500000000732312045031613022550 0ustar olesoles// -*- C++ -*- // $Id: TrivariateGaussian.cc,v 1.8 2010/06/16 18:22:01 garren Exp $ // --------------------------------------------------------------------------- #include "CLHEP/GenericFunctions/defs.h" #include "CLHEP/GenericFunctions/TrivariateGaussian.hh" #include #include // for exp() #if (defined __STRICT_ANSI__) || (defined _WIN32) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif // M_PI #endif // __STRICT_ANSI__ namespace Genfun { FUNCTION_OBJECT_IMP(TrivariateGaussian) TrivariateGaussian::TrivariateGaussian(): _mean0("Mean0", 0.0,-10,10), _mean1("Mean1", 0.0,-10,10), _mean2("Mean2", 0.0,-10,10), _sigma0("Sigma0",1.0,0, 10), _sigma1("Sigma1",1.0,0, 10), _sigma2("Sigma2",1.0,0, 10), _corr01("Corr01", 0.0, -1.0, 1.0), _corr02("Corr02", 0.0, -1.0, 1.0), _corr12("Corr12", 0.0, -1.0, 1.0) {} TrivariateGaussian::~TrivariateGaussian() { } TrivariateGaussian::TrivariateGaussian(const TrivariateGaussian & right): AbsFunction(right), _mean0(right._mean0), _mean1(right._mean1), _mean2(right._mean2), _sigma0(right._sigma0), _sigma1(right._sigma1), _sigma2(right._sigma2), _corr01(right._corr01), _corr02(right._corr02), _corr12(right._corr12) { } double TrivariateGaussian::operator() (const Argument & a) const { assert (a.dimension()==3); double x = a[0]; double y = a[1]; double z = a[2]; double x0 = _mean0.getValue(); double y0 = _mean1.getValue(); double z0 = _mean2.getValue(); double dx = x-x0; double dy = y-y0; double dz = z-z0; double sx = _sigma0.getValue(); double sy = _sigma1.getValue(); double sz = _sigma2.getValue(); double sxs = sx*sx; double sys = sy*sy; double szs = sz*sz; double rho1 = _corr01.getValue(); double rho2 = _corr12.getValue(); double rho3 = _corr02.getValue(); double dt = (1.0+rho1*rho2*rho3-rho1*rho1-rho2*rho2-rho3*rho3); double tmp1 ,tmp2; tmp1= 1.0/((2*M_PI)*sqrt(2*M_PI)*sx*sy*sz*sqrt(dt)); tmp2= exp(-0.5/dt*(dx*dx*(1.0-rho2*rho2)/sxs+dy*dy*(1.0-rho3*rho3)/sys+dz*dz*(1.0-rho1*rho1)/szs+2.0*dx*dy*(rho2*rho3-rho1)/sx/sy+2.0*dy*dz*(rho1*rho3-rho2)/sy/sz+2.0*dx*dz*(rho1*rho2-rho3)/sx/sz)); return tmp1*tmp2; } Parameter & TrivariateGaussian::mean0() { return _mean0; } Parameter & TrivariateGaussian::sigma0() { return _sigma0; } const Parameter & TrivariateGaussian::mean0() const { return _mean0; } const Parameter & TrivariateGaussian::sigma0() const { return _sigma0; } Parameter & TrivariateGaussian::mean1() { return _mean1; } Parameter & TrivariateGaussian::sigma1() { return _sigma1; } const Parameter & TrivariateGaussian::mean1() const { return _mean1; } const Parameter & TrivariateGaussian::sigma1() const { return _sigma1; } Parameter & TrivariateGaussian::mean2() { return _mean2; } Parameter & TrivariateGaussian::sigma2() { return _sigma2; } const Parameter & TrivariateGaussian::mean2() const { return _mean2; } const Parameter & TrivariateGaussian::sigma2() const { return _sigma2; } Parameter & TrivariateGaussian::corr01() { return _corr01; } const Parameter & TrivariateGaussian::corr01() const { return _corr01; } Parameter & TrivariateGaussian::corr02() { return _corr02; } const Parameter & TrivariateGaussian::corr02() const { return _corr02; } Parameter & TrivariateGaussian::corr12() { return _corr12; } const Parameter & TrivariateGaussian::corr12() const { return _corr12; } unsigned int TrivariateGaussian::dimensionality() const { return 3; } double TrivariateGaussian::operator ()(double) const { std::cerr << "Warning. trivariate Gaussian called with scalar argument" << std::endl; assert(0); return 0; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Mod.cc0000755000175000017500000000073212045031613017457 0ustar olesoles// -*- C++ -*- // $Id: #include "CLHEP/GenericFunctions/Mod.hh" #include #include namespace Genfun { FUNCTION_OBJECT_IMP(Mod) Mod::Mod(double y): _y(y) {} Mod::Mod(const Mod & right) : AbsFunction(right), _y(right._y) {} Mod::~Mod() { } // HAD BEEN: // double Mod::operator() (double x) const { // return drem_local(x-_y/2.0,_y) + _y/2.0; //} double Mod::operator() (double x) const { return (x - _y*floor(x/_y)); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/CMakeLists.txt0000644000175000017500000000472512012777433021207 0ustar olesolesset( GenericFunctions_source Abs.cc AbsFunctional.cc AbsFunction.cc AbsParameter.cc ACos.cc AdaptiveRKStepper.cc AnalyticConvolution.cc ArrayFunction.cc ASin.cc AssociatedLaguerre.cc ATan.cc BetaDistribution.cc BivariateGaussian.cc ClassicalSolver.cc ClebschGordanCoefficientSet.cc ConstMinusFunction.cc ConstMinusParameter.cc ConstOverFunction.cc ConstOverParameter.cc ConstPlusFunction.cc ConstPlusParameter.cc ConstTimesFunction.cc ConstTimesParameter.cc Cos.cc CumulativeChiSquare.cc DefiniteIntegral.cc EfficiencyFunctional.cc EmbeddedRKStepper.cc Erf.cc Exp.cc Exponential.cc FixedConstant.cc FloatingConstant.cc FunctionComposition.cc FunctionConvolution.cc FunctionDifference.cc FunctionDirectProduct.cc FunctionNegation.cc FunctionNoop.cc FunctionNumDeriv.cc FunctionPlusParameter.cc FunctionProduct.cc FunctionQuotient.cc FunctionSum.cc FunctionTimesParameter.cc Gamma.cc GammaDistribution.cc Gaussian.cc IncompleteGamma.cc InterpolatingPolynomial.cc KroneckerDelta.cc Landau.cc LikelihoodFunctional.cc Ln.cc LogGamma.cc LogisticFunction.cc Mod.cc NonrelativisticBW.cc Parameter.cc ParameterComposition.cc ParameterDifference.cc ParameterNegation.cc ParameterProduct.cc ParameterQuotient.cc ParameterSum.cc PeriodicRectangular.cc PhaseSpace.cc Power.cc PtRelFcn.cc PuncturedSmearedExp.cc RCBase.cc Rectangular.cc RelativisticBW.cc ReverseExponential.cc RKIntegrator.cc RungeKuttaClassicalSolver.cc Sigma.cc SimpleRKStepper.cc Sin.cc Sqrt.cc Square.cc StepDoublingRKStepper.cc Tan.cc Theta.cc TrivariateGaussian.cc Variable.cc VoigtProfile.cc X.cc ) clhep_build_library( GenericFunctions ${GenericFunctions_source} ) clhep-2.1.4.1.orig/GenericFunctions/src/Tan.cc0000755000175000017500000000120312045031613017454 0ustar olesoles// -*- C++ -*- // $Id: Tan.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ // --------------------------------------------------------------------------- #include "CLHEP/GenericFunctions/Tan.hh" #include "CLHEP/GenericFunctions/Cos.hh" #include #include namespace Genfun { FUNCTION_OBJECT_IMP(Tan) Tan::Tan() {} Tan::~Tan() { } Tan::Tan(const Tan & right) : AbsFunction(right) { } double Tan::operator() (double x) const { return tan(x); } Derivative Tan::partial(unsigned int index) const { assert(index==0); const AbsFunction & fPrime = 1.0/Cos()/Cos(); return Derivative(& fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/FunctionNumDeriv.cc0000755000175000017500000001041712045031613022200 0ustar olesoles// -*- C++ -*- // $Id: FunctionNumDeriv.cc,v 1.4 2003/10/10 17:40:39 garren Exp $ // --------------------------------------------------------------------------- #include "CLHEP/GenericFunctions/FunctionNumDeriv.hh" #include #include // for pow() namespace Genfun { FUNCTION_OBJECT_IMP(FunctionNumDeriv) FunctionNumDeriv::FunctionNumDeriv(const AbsFunction *arg1, unsigned int index): _arg1(arg1->clone()), _wrtIndex(index) { } FunctionNumDeriv::FunctionNumDeriv(const FunctionNumDeriv & right): AbsFunction(right), _arg1(right._arg1->clone()), _wrtIndex(right._wrtIndex) { } FunctionNumDeriv::~FunctionNumDeriv() { delete _arg1; } unsigned int FunctionNumDeriv::dimensionality() const { return _arg1->dimensionality(); } #define ROBUST_DERIVATIVES #ifdef ROBUST_DERIVATIVES double FunctionNumDeriv::f_x (double x) const { return (*_arg1)(x); } double FunctionNumDeriv::f_Arg (double x) const { _xArg [_wrtIndex] = x; return (*_arg1)(_xArg); } double FunctionNumDeriv::operator ()(double x) const { assert (_wrtIndex==0); return numericalDerivative ( &FunctionNumDeriv::f_x, x ); } double FunctionNumDeriv::operator ()(const Argument & x) const { assert (_wrtIndex curvature scale < 1/1250. const int nItersMax = 6; int nIters; double bestError = 1.0E30; double bestAns = 0; const double valFactor = std::pow(2.0, -16); const double w = 5.0/8; const double wi2 = 64.0/25.0; const double wi4 = wi2*wi2; double size = fabs((this->*f)(x)); if (size==0) size = std::pow(2.0, -53); const double adjustmentFactor[nItersMax] = { 1.0, std::pow(2.0, -17), std::pow(2.0, +17), std::pow(2.0, -34), std::pow(2.0, +34), std::pow(2.0, -51) }; for ( nIters = 0; nIters < nItersMax; ++nIters ) { double h = h0 * adjustmentFactor[nIters]; // Step A: Three estimates based on h and two smaller values: double A1 = ((this->*f)(x+h) - (this->*f)(x-h))/(2.0*h); // size = max(fabs(A1), size); if (fabs(A1) > size) size = fabs(A1); double hh = w*h; double A2 = ((this->*f)(x+hh) - (this->*f)(x-hh))/(2.0*hh); // size = max(fabs(A2), size); if (fabs(A2) > size) size = fabs(A2); hh *= w; double A3 = ((this->*f)(x+hh) - (this->*f)(x-hh))/(2.0*hh); // size = max(fabs(A3), size); if (fabs(A3) > size) size = fabs(A3); if ( (fabs(A1-A2)/size > maxErrorA) || (fabs(A1-A3)/size > maxErrorA) ) { continue; } // Step B: Two second-order estimates based on h h*w, from A estimates double B1 = ( A2 * wi2 - A1 ) / ( wi2 - 1 ); double B2 = ( A3 * wi2 - A2 ) / ( wi2 - 1 ); if ( fabs(B1-B2)/size > maxErrorB ) { continue; } // Step C: Third-order estimate, from B estimates: double ans = ( B2 * wi4 - B1 ) / ( wi4 - 1 ); double err = fabs ( ans - B1 ); if ( err < bestError ) { bestError = err; bestAns = ans; } // Validation estimate based on much smaller h value: hh = h * valFactor; double val = ((this->*f)(x+hh) - (this->*f)(x-hh))/(2.0*hh); if ( fabs(val-ans)/size > maxErrorC ) { continue; } // Having passed both apparent accuracy and validation, we are finished: break; } return bestAns; } #endif // ROBUST_DERIVATIVES #ifdef SIMPLER_DERIVATIVES double FunctionNumDeriv::operator ()(double x) const { assert (_wrtIndex==0); const double h=1.0E-6; return ((*_arg1)(x+h) - (*_arg1)(x-h))/(2.0*h); } double FunctionNumDeriv::operator ()(const Argument & x) const { assert (_wrtIndexclone()) { if (aparm->parameter() && _parameter->parameter()) _parameter->parameter()->connectFrom(aparm->parameter()); } ConstOverParameter::ConstOverParameter(const ConstOverParameter & right) : AbsParameter(right), _constant(right._constant), _parameter(right._parameter->clone()) {} ConstOverParameter::~ConstOverParameter() { delete _parameter; } double ConstOverParameter::getValue() const { return _constant / _parameter->getValue(); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/RKIntegrator.cc0000755000175000017500000001103512045031613021311 0ustar olesoles// -*- C++ -*- // $Id: #include "CLHEP/GenericFunctions/RKIntegrator.hh" #include "CLHEP/GenericFunctions/AdaptiveRKStepper.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include #include namespace Genfun { FUNCTION_OBJECT_IMP(RKIntegrator::RKFunction) RKIntegrator::RKFunction::RKFunction(RKData *data, unsigned int index) :_data(data), _index(index) { _data->ref(); } RKIntegrator::RKFunction::~RKFunction() { _data->unref(); } RKIntegrator::RKFunction::RKFunction(const RKIntegrator::RKFunction & right) :AbsFunction(right), _data(right._data), _index(right._index) { _data->ref(); } double RKIntegrator::RKFunction::operator() (double t) const { if (t<0) return 0; if (!_data->_locked) _data->lock(); // Do this first, thereafter, just read the cache _data->recache(); // If the cache is empty, make an entry for t=0; size_t nvar = _data->_startingValParameter.size(); if (_data->_fx.empty()) { RKData::Data d(nvar); d.time=0; Argument arg(nvar); for (size_t f=0;f_startingValParameterCache[f]; arg[f]=d.variable[f]; } _data->_fx.insert(d); } if (t==0) return (*_data->_fx.begin()).variable[_index]; RKData::Data dt(nvar); dt.time=t; std::set::iterator l =_data->_fx.lower_bound(dt); // We did find an exact value (measure 0), just return it. if (l!=_data->_fx.end() && (*l).time==t) { return (*l).variable[_index]; } else { std::set::iterator u =_data->_fx.upper_bound(dt); while (u==_data->_fx.end()) { u--; RKData::Data newData(nvar);; _data->_stepper->step(_data,*u, newData, 0); _data->_fx.insert(l,newData); if (newData.time==t) return newData.variable[_index]; u = _data->_fx.upper_bound(dt); } u--; _data->_stepper->step(_data,*u, dt, t); return dt.variable[_index]; } } RKIntegrator::RKData::RKData():_locked(false) { } RKIntegrator::RKData::~RKData() { for (size_t i=0;i<_startingValParameter.size();i++) delete _startingValParameter[i]; for (size_t i=0;i<_controlParameter.size();i++) delete _controlParameter[i]; for (size_t i=0;i<_diffEqn.size(); i++) delete _diffEqn[i]; delete _stepper; } RKIntegrator::RKIntegrator(const RKIntegrator::RKStepper *stepper) : _data(new RKData()) { if (stepper) _data->_stepper=stepper->clone(); else _data->_stepper= new AdaptiveRKStepper(); _data->ref(); } RKIntegrator::~RKIntegrator() { _data->unref(); for (size_t i=0;i<_fcn.size();i++) delete _fcn[i]; } Parameter * RKIntegrator::addDiffEquation(const AbsFunction * diffEquation, const std::string &variableName, double defStartingValue, double defValueMin, double defValueMax) { Parameter *par = new Parameter(variableName, defStartingValue, defValueMin, defValueMax); _data->_startingValParameter.push_back(par); _data->_diffEqn.push_back(diffEquation->clone()); _data->_startingValParameterCache.push_back(defStartingValue); _fcn.push_back(new RKFunction(_data,_fcn.size())); return par; } Parameter * RKIntegrator::createControlParameter (const std::string & variableName, double defStartingValue, double startingValueMin, double startingValueMax) { Parameter *par = new Parameter(variableName, defStartingValue, startingValueMin, startingValueMax); _data->_controlParameter.push_back(par); _data->_controlParameterCache.push_back(defStartingValue); return par; } const RKIntegrator::RKFunction * RKIntegrator::getFunction(unsigned int i) const { return _fcn[i]; } void RKIntegrator::RKData::lock() { if (!_locked) { unsigned int size = _diffEqn.size(); for (size_t i=0;idimensionality()==size)) throw std::runtime_error("Runtime error in RKIntegrator"); } _locked=true; } } void RKIntegrator::RKData::recache() { bool stale=false; if (!stale) { for (size_t p=0;p<_startingValParameter.size();p++) { if (_startingValParameter[p]->getValue()!=_startingValParameterCache[p]) { _startingValParameterCache[p]=_startingValParameter[p]->getValue(); stale=true; break; } } } if (!stale) { for (size_t p=0;p<_controlParameter.size();p++) { if (_controlParameter[p]->getValue()!=_controlParameterCache[p]) { _controlParameterCache[p]=_controlParameter[p]->getValue(); stale=true; break; } } } if (stale) { _fx.erase(_fx.begin(),_fx.end()); } } RKIntegrator::RKStepper::~RKStepper(){} } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Variable.cc0000755000175000017500000000270112045031613020463 0ustar olesoles// -*- C++ -*- // $Id: Variable.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/Variable.hh" #include "CLHEP/GenericFunctions/FixedConstant.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(Variable) Variable::Variable(unsigned int selectionIndex, unsigned int dmsnlty): _selectionIndex(selectionIndex), _dimensionality(dmsnlty) {} Variable::Variable(const Variable & right): AbsFunction(right), _selectionIndex(right._selectionIndex), _dimensionality(right._dimensionality) { } Variable::~Variable() { } double Variable::operator() (double x) const { if (_selectionIndex!=0) throw std::runtime_error("Genfun::Variable: selection index !=0") ; return x; } double Variable::operator () (const Argument & a) const { if (!(_selectionIndex namespace Genfun { FUNCTION_OBJECT_IMP(Theta) Theta::Theta() {} Theta::~Theta() { } Theta::Theta(const Theta & right) : AbsFunction(right) { } double Theta::operator() (double x) const { return (x>=0) ? 1.0:0.0; } Derivative Theta::partial(unsigned int index) const { if (index!=0) throw std::runtime_error("Theta::Partial: index out of range"); const AbsFunction & fPrime = FixedConstant(0.0); return Derivative(& fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Gaussian.cc0000755000175000017500000000243612045031613020515 0ustar olesoles// -*- C++ -*- // $Id: Gaussian.cc,v 1.8 2010/06/16 18:22:01 garren Exp $ #include "CLHEP/GenericFunctions/defs.h" #include "CLHEP/GenericFunctions/Gaussian.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include #include // for exp() #if (defined __STRICT_ANSI__) || (defined _WIN32) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif // M_PI #endif // __STRICT_ANSI__ namespace Genfun { FUNCTION_OBJECT_IMP(Gaussian) Gaussian::Gaussian(): _mean("Mean", 0.0,-10,10), _sigma("Sigma",1.0,0, 10) {} Gaussian::~Gaussian() { } Gaussian::Gaussian(const Gaussian & right): AbsFunction(right), _mean(right._mean), _sigma(right._sigma) { } double Gaussian::operator() (double x) const { double s = _sigma.getValue(); double x0 = _mean.getValue(); return (1.0/(sqrt(2*M_PI)*s))* exp(-(x-x0)*(x-x0)/(2.0*s*s)); } Parameter & Gaussian::mean() { return _mean; } Parameter & Gaussian::sigma() { return _sigma; } const Parameter & Gaussian::mean() const { return _mean; } const Parameter & Gaussian::sigma() const { return _sigma; } Derivative Gaussian::partial(unsigned int index) const { assert(index==0); Variable x; const AbsFunction & fPrime = (*this)*(_mean-x)/_sigma/_sigma; return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/RCBase.cc0000755000175000017500000000057507726364536020073 0ustar olesoles#include "CLHEP/GenericFunctions/RCBase.hh" namespace Genfun { RCBase::RCBase() : _count(0) { } RCBase::~RCBase() { } void RCBase::ref() const { _count++; } void RCBase::unref() const { if (!_count) { } else { _count--; if (!_count) delete this; } } unsigned int RCBase::refCount() const { return _count; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/DefiniteIntegral.cc0000755000175000017500000001655512046254434022200 0ustar olesoles// -*- C++ -*- // $Id: DefiniteIntegral.cc,v 1.6 2010/06/16 18:22:01 garren Exp $ #include #include #include #include "CLHEP/GenericFunctions/DefiniteIntegral.hh" #include "CLHEP/GenericFunctions/AbsFunction.hh" namespace Genfun { class DefiniteIntegral::Clockwork { // // This class has limited visibility its functions, data, // and nested classes are all public: // public: class QuadratureRule { public: // Constructorctor: QuadratureRule() {}; // Destructor: virtual ~QuadratureRule() {}; // Integrate at the j^th level of refinement: virtual double integrate(const AbsFunction & function, double a, double b, unsigned int j) const=0; // Return the step multiplier: virtual unsigned int stepMultiplier () const=0; // Return the number of function calls: virtual unsigned int numFunctionCalls() const =0; }; class TrapezoidQuadratureRule:public QuadratureRule { public: // Constructor: TrapezoidQuadratureRule():retVal(0),nFunctionCalls(0) {}; // Destructor: ~TrapezoidQuadratureRule() {}; // Integrate at the j^th level of refinement: virtual double integrate(const AbsFunction & function, double a, double b, unsigned int j) const; // The step is doubled at each level of refinement: virtual unsigned int stepMultiplier () const {return 2;} // Returns number of function calls: virtual unsigned int numFunctionCalls() const {return nFunctionCalls;}; private: mutable double retVal; mutable unsigned int nFunctionCalls; }; class XtMidpointQuadratureRule:public QuadratureRule { public: // Constructor: XtMidpointQuadratureRule():retVal(0),nFunctionCalls(0) {}; // Destructorctor: ~XtMidpointQuadratureRule() {}; // Integrate at the j^th level of refinement: virtual double integrate(const AbsFunction & function, double a, double b, unsigned int j) const; // The step is tripled at each level of refinement: virtual unsigned int stepMultiplier () const {return 3;} // Returns number of function calls: virtual unsigned int numFunctionCalls() const {return nFunctionCalls;}; private: mutable double retVal; mutable unsigned int nFunctionCalls; }; double a; // lower limit of integration double b; // upper limit of integration DefiniteIntegral::Type type; // open or closed mutable unsigned int nFunctionCalls; // bookkeeping unsigned int MAXITER; // Max no of step doubling, tripling, etc. double EPS; // Target precision unsigned int K; // Minimum order =2*5=10 // Polynomial interpolation with Neville's method: void polint(std::vector::iterator xArray, std::vector::iterator yArray, double x, double & y, double & deltay) const; }; DefiniteIntegral::DefiniteIntegral(double a, double b, Type type): c(new Clockwork()) { c->a = a; c->b = b; c->type = type; c->nFunctionCalls = 0; c->MAXITER = type==OPEN ? 20 : 14; c->EPS = 1.0E-6; c->K = 5; } DefiniteIntegral::~DefiniteIntegral() { delete c; } DefiniteIntegral::DefiniteIntegral(const DefiniteIntegral & right) :AbsFunctional(right), c(new Clockwork(*right.c)) { } DefiniteIntegral & DefiniteIntegral::operator = (const DefiniteIntegral & right) { if (this!=&right) { delete c; c = new Clockwork(*right.c); } return *this; } void DefiniteIntegral::setEpsilon(double eps) { c->EPS=eps; } void DefiniteIntegral::setMaxIter(unsigned int maxIter) { c->MAXITER=maxIter; } void DefiniteIntegral::setMinOrder(unsigned int minOrder) { c->K=(minOrder+1)/2; } double DefiniteIntegral::operator [] (const AbsFunction & function) const { const Clockwork::QuadratureRule * rule = c->type==OPEN ? (Clockwork::QuadratureRule *) new Clockwork::XtMidpointQuadratureRule() : (Clockwork::QuadratureRule *) new Clockwork::TrapezoidQuadratureRule(); double xMult=rule->stepMultiplier(); c->nFunctionCalls=0; std::vector s(c->MAXITER+2),h(c->MAXITER+2); h[1]=1.0; for (unsigned int j=1;j<=c->MAXITER;j++) { s[j]=rule->integrate(function, c->a, c->b, j); c->nFunctionCalls=rule->numFunctionCalls(); if (j>=c->K) { double ss, dss; c->polint(h.begin()+j-c->K,s.begin()+j-c->K,0.0,ss, dss); if (fabs(dss) <= c->EPS*fabs(ss)) { delete rule; return ss; } } s[j+1]=s[j]; h[j+1]=h[j]/xMult/xMult; } delete rule; throw std::runtime_error("DefiniteIntegral: too many steps. No convergence"); return 0.0; // Never get here. } void DefiniteIntegral::Clockwork::polint(std::vector::iterator xArray, std::vector::iterator yArray, double x, double & y, double & deltay) const { double dif = fabs(x-xArray[1]),dift; std::vector c(K+1),d(K+1); unsigned int ns=1; for (unsigned int i=1;i<=K;i++) { dift=fabs(x-xArray[i]); if (diftnFunctionCalls; } // Quadrature rules: double DefiniteIntegral::Clockwork::TrapezoidQuadratureRule::integrate(const AbsFunction & function, double a, double b, unsigned int n) const { unsigned int it, j; if (n==1) { retVal = 0.5*(b-a)*(function(a)+function(b)); nFunctionCalls+=2; } else { for (it=1,j=1;j #include // for asin() namespace Genfun { FUNCTION_OBJECT_IMP(ASin) ASin::ASin() {} ASin::~ASin() { } ASin::ASin(const ASin & right) : AbsFunction(right) { } double ASin::operator() (double x) const { return asin(x); } Derivative ASin::partial(unsigned int index) const { assert(index==0); Square square; Sqrt root; const AbsFunction & fPrime = 1.0/root(1.0-square) ; return Derivative(& fPrime); } } // end namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/AssociatedLaguerre.cc0000755000175000017500000000242712045031613022511 0ustar olesoles// -*- C++ -*- // $Id: AssociatedLaguerre.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/AssociatedLaguerre.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include "CLHEP/GenericFunctions/FixedConstant.hh" namespace Genfun { FUNCTION_OBJECT_IMP(AssociatedLaguerre) // This is the product n (n-2) (n-4)... inline double factorial (int n) { if (n<=1) return 1.0; else return n*factorial(n-1); } AssociatedLaguerre::AssociatedLaguerre(unsigned int xn, unsigned int xk): _n(xn), _k(xk) { create(); } AssociatedLaguerre::~AssociatedLaguerre() { delete _function; } AssociatedLaguerre::AssociatedLaguerre(const AssociatedLaguerre & right): AbsFunction(right), _n(right._n), _k(right._k) { create(); } double AssociatedLaguerre::operator() (double x) const { return (*_function)(x); } unsigned int AssociatedLaguerre::n() const { return _n; } unsigned int AssociatedLaguerre::k() const { return _k; } void AssociatedLaguerre::create() { Variable x; if (_n==0) { _function = FixedConstant(1.0).clone(); } else if (_n==1) { _function = (-x + _k + 1).clone(); } else { _function = ((1.0/_n)*((2*_n -1 +_k -x)*AssociatedLaguerre(_n-1,_k) - (_n+_k-1)*AssociatedLaguerre(_n-2,_k))).clone(); } } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Sqrt.cc0000755000175000017500000000103312045031613017664 0ustar olesoles// -*- C++ -*- // $Id: Sqrt.cc,v 1.7 2010/06/16 18:22:01 garren Exp $ #include "CLHEP/GenericFunctions/Sqrt.hh" #include #include // for sqrt namespace Genfun { FUNCTION_OBJECT_IMP(Sqrt) Sqrt::Sqrt() {} Sqrt::Sqrt(const Sqrt & right) : AbsFunction(right) { } Sqrt::~Sqrt() { } double Sqrt::operator() (double x) const { return sqrt(x); } Derivative Sqrt::partial(unsigned int index) const { assert(index==0); const AbsFunction & fPrime = (0.5)/Sqrt(); return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/CumulativeChiSquare.cc0000755000175000017500000000254312045031613022665 0ustar olesoles// -*- C++ -*- // $Id: CumulativeChiSquare.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ // --------------------------------------------------------------------------- #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" #include "CLHEP/GenericFunctions/IncompleteGamma.hh" #include "CLHEP/GenericFunctions/Variable.hh" namespace Genfun { FUNCTION_OBJECT_IMP(CumulativeChiSquare) //---------------------------------------------------------------------------------// // Implementation notes: The Cumulative Chi Square function is implemented in // // terms of the incomplete gamma function. // //---------------------------------------------------------------------------------// CumulativeChiSquare::CumulativeChiSquare(unsigned int ndf): _nDof(ndf) { create(); } CumulativeChiSquare::~CumulativeChiSquare() { delete _function; } CumulativeChiSquare::CumulativeChiSquare(const CumulativeChiSquare & right): AbsFunction(right), _nDof(right._nDof) { create(); } double CumulativeChiSquare::operator() (double x) const { return (*_function)(x); } unsigned int CumulativeChiSquare::nDof() const { return _nDof; } void CumulativeChiSquare::create() { Variable x; IncompleteGamma incompleteGamma; incompleteGamma.a().setValue(_nDof/2.0); _function = (incompleteGamma(x/2.0)).clone(); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/ClassicalSolver.cc0000755000175000017500000000167212045031613022035 0ustar olesoles// -*- C++ -*- // $Id: #include "CLHEP/GenericFunctions/ClassicalSolver.hh" #include "CLHEP/GenericFunctions/PhaseSpace.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(EnergyFunction) EnergyFunction::EnergyFunction(const Classical::Solver & xsolver): solver(xsolver) {} EnergyFunction::~EnergyFunction() { } EnergyFunction::EnergyFunction(const EnergyFunction & right) :AbsFunction(right), solver(right.solver) { } double EnergyFunction::operator() (double t) const { const Classical::PhaseSpace & phaseSpace=solver.phaseSpace(); const unsigned int DIM=phaseSpace.dim(); Genfun::Argument arg(2*DIM); for (unsigned int i=0;i #include using namespace std; namespace Genfun { FUNCTION_OBJECT_IMP(BetaDistribution) BetaDistribution::BetaDistribution(): _alpha("a", 1.0, 0.0, 100), _beta ("beta", 1.0, 0.0, 100) {} BetaDistribution::BetaDistribution(const BetaDistribution & right): AbsFunction( right ), _alpha(right._alpha), _beta (right._beta) { } BetaDistribution::~BetaDistribution() { } double BetaDistribution::operator() (double x) const { double a = _alpha.getValue(),b=_beta.getValue(); return pow(x,a-1)*pow((1-x),b-1)* exp(_logGamma(a+b)-_logGamma(a)-_logGamma(b)); } Parameter & BetaDistribution::alpha() { return _alpha; } Parameter & BetaDistribution::beta() { return _beta; } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/SimpleRKStepper.cc0000644000175000017500000000322112012777433021775 0ustar olesoles#include "CLHEP/GenericFunctions/SimpleRKStepper.hh" #include #include namespace Genfun { SimpleRKStepper::SimpleRKStepper(const ButcherTableau & mtableau,double xstepsize): tableau(mtableau), stepsize(xstepsize) { } void SimpleRKStepper::step(const RKIntegrator::RKData * data, const RKIntegrator::RKData::Data & s, RKIntegrator::RKData::Data & d, double timeLimit ) const { const double h = timeLimit==0 ? stepsize : timeLimit - s.time; if (h<=0) throw std::runtime_error ("SimpleRKStepper: negative stepsize"); const unsigned int nvar = s.variable.size(); // Compute all of the k's..: // std::vector >k(tableau.nSteps()); for (unsigned int i=0;i_diffEqn[v])(arg); } // // Final result. // for (unsigned int v=0;v=int(_values.size())) return 0; else return _values[i]; } } clhep-2.1.4.1.orig/GenericFunctions/src/Gamma.cc0000755000175000017500000000057212045031613017764 0ustar olesoles// -*- C++ -*- // $Id: #include "CLHEP/GenericFunctions/Gamma.hh" #include #include using namespace std; namespace Genfun { FUNCTION_OBJECT_IMP(Gamma) Gamma::Gamma() {} Gamma::Gamma(const Gamma & right) : AbsFunction(right) { } Gamma::~Gamma() { } double Gamma::operator() (double x) const { return exp(_logGamma(x)); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/Sigma.cc0000755000175000017500000000213312045031613017775 0ustar olesoles// -*- C++ -*- // $Id: #include "CLHEP/GenericFunctions/Sigma.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(Sigma) void Sigma::accumulate( const AbsFunction & fcn) { _fcn.push_back(fcn.clone()); } Sigma::Sigma() { } Sigma::Sigma(const Sigma & right) : AbsFunction(right) { for (size_t i=0; iclone()); } } unsigned int Sigma::dimensionality() const { assert (_fcn.size()!=0); return _fcn[0]->dimensionality(); } Sigma::~Sigma() { for (size_t i=0; i<_fcn.size();i++) { delete _fcn[i]; } } double Sigma::operator ()(double x) const { double retVal=0.0; for (size_t i=0;i<_fcn.size();i++) retVal += (*_fcn[i])(x); return retVal; } double Sigma::operator ()(const Argument & x) const { double retVal=0.0; for (size_t i=0;i<_fcn.size();i++) retVal += (*_fcn[i])(x); return retVal; } Derivative Sigma::partial(unsigned int index) const { Sigma fPrime; for (size_t i=0;i<_fcn.size();i++) { fPrime.accumulate(_fcn[i]->partial(index)); } return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/FunctionPlusParameter.cc0000755000175000017500000000245012045031613023231 0ustar olesoles// -*- C++ -*- // $Id: FunctionPlusParameter.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/FunctionPlusParameter.hh" #include "CLHEP/GenericFunctions/Parameter.hh" namespace Genfun { FUNCTION_OBJECT_IMP(FunctionPlusParameter) FunctionPlusParameter::FunctionPlusParameter(const AbsParameter *parameter, const AbsFunction *function): _function(function->clone()), _parameter(parameter->clone()) { if (parameter->parameter() && _parameter->parameter()) { _parameter->parameter()->connectFrom(parameter->parameter()); } } FunctionPlusParameter::FunctionPlusParameter(const FunctionPlusParameter & right) : AbsFunction(right), _function(right._function->clone()), _parameter(right._parameter->clone()) {} unsigned int FunctionPlusParameter::dimensionality() const { return _function->dimensionality(); } FunctionPlusParameter::~FunctionPlusParameter() { delete _function; delete _parameter; } double FunctionPlusParameter::operator ()(double x) const { return _parameter->getValue() + (*_function)(x); } double FunctionPlusParameter::operator ()(const Argument & x) const { return _parameter->getValue() + (*_function)(x); } Derivative FunctionPlusParameter::partial(unsigned int index) const { return _function->partial(index); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/FunctionDirectProduct.cc0000755000175000017500000000340112045031613023215 0ustar olesoles// -*- C++ -*- // $Id: FunctionDirectProduct.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/FunctionDirectProduct.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(FunctionDirectProduct) FunctionDirectProduct::FunctionDirectProduct(const AbsFunction *arg1, const AbsFunction *arg2): _arg1(arg1->clone()), _arg2(arg2->clone()), _m(arg1->dimensionality()), _n(arg2->dimensionality()) { } FunctionDirectProduct::FunctionDirectProduct(const FunctionDirectProduct & right): AbsFunction(right), _arg1(right._arg1->clone()), _arg2(right._arg2->clone()), _m(right._m), _n(right._n) { } FunctionDirectProduct::~FunctionDirectProduct() { delete _arg1; delete _arg2; } double FunctionDirectProduct::operator() (const Argument & a) const { unsigned int P = a.dimension(); Argument x1(_m); Argument x2(_n); if (_m+_n != P) { std::cerr << "Warning: Direct product function/argument dimension mismatch" << std::endl; assert(0); return 0; } for (unsigned int i = 0; i<_m;i++) { x1[i]=a[i]; } for (unsigned int j = 0;j<_n;j++) { x2[j]=a[j+_m]; } return (*_arg1)(x1) * (*_arg2)(x2); } unsigned int FunctionDirectProduct::dimensionality() const { return _m+_n; } double FunctionDirectProduct::operator ()(double) const { std::cerr << "Warning. direct product called with scalar argument" << std::endl; assert(0); return 0; } Derivative FunctionDirectProduct::partial(unsigned int index) const { assert (index<(_m+_n)); if (index<_m) { const AbsFunction & fPrime = (_arg1->partial(index))%(*_arg2); return Derivative(&fPrime); } else { const AbsFunction & fPrime = (*_arg1)%(_arg2->partial(index-_m)); return Derivative(&fPrime); } } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/FunctionQuotient.cc0000755000175000017500000000241312045031613022254 0ustar olesoles// -*- C++ -*- // $Id: FunctionQuotient.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/FunctionQuotient.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(FunctionQuotient) FunctionQuotient::FunctionQuotient(const AbsFunction *arg1, const AbsFunction *arg2): _arg1(arg1->clone()), _arg2(arg2->clone()) { if (arg1->dimensionality()!=arg2->dimensionality()) { std::cout << "Warning: dimension mismatch in function quotient" << std::endl; assert(0); } } FunctionQuotient::FunctionQuotient( const FunctionQuotient & right) : AbsFunction(right), _arg1(right._arg1->clone()), _arg2(right._arg2->clone()) {} FunctionQuotient::~FunctionQuotient() { delete _arg1; delete _arg2; } unsigned int FunctionQuotient::dimensionality() const { return _arg1->dimensionality(); } double FunctionQuotient::operator ()(double x) const { return (*_arg1)(x)/(*_arg2)(x); } double FunctionQuotient::operator ()(const Argument & x) const { return (*_arg1)(x)/(*_arg2)(x); } Derivative FunctionQuotient::partial(unsigned int index) const { const AbsFunction & fPrime = ((_arg1->partial(index))*(*_arg2)-(*_arg1)*(_arg2->partial(index))) / (*_arg2)/ (*_arg2); return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/FunctionComposition.cc0000755000175000017500000000322612045031613022752 0ustar olesoles// -*- C++ -*- // $Id: FunctionComposition.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $ #include "CLHEP/GenericFunctions/FunctionComposition.hh" #include namespace Genfun { FUNCTION_OBJECT_IMP(FunctionComposition) FunctionComposition::FunctionComposition(const AbsFunction *arg1, const AbsFunction *arg2):_arg1(arg1->clone()),_arg2(arg2->clone()) { if (arg1->dimensionality()!=1) { std::cout << "Warning: dimension mismatch in function convolution" << std::endl; assert(0); } } FunctionComposition::FunctionComposition(const FunctionComposition & right): AbsFunction(right), _arg1(right._arg1->clone()), _arg2(right._arg2->clone()) {} FunctionComposition::~FunctionComposition() { delete _arg1; delete _arg2; } unsigned int FunctionComposition::dimensionality() const { return _arg2->dimensionality(); } double FunctionComposition::operator ()(double argument) const { if (dimensionality()!=1) { std::cerr << "Warning: LifetimeResolutionConvolution function/argument " << "dimension mismatch" << std::endl; assert(0); return 0; } else { return (*_arg1)((*_arg2)(argument)); } } double FunctionComposition::operator() (const Argument & v) const { if (v.dimension()!=_arg2->dimensionality()) { std::cerr << "Warning: FunctionComposition function/argument dimension mismatch" << std::endl; assert(0); return 0; } else { return (*_arg1)((*_arg2)(v)); } } Derivative FunctionComposition::partial(unsigned int index) const { const AbsFunction & fPrime = (_arg1->partial(0))(*_arg2)*_arg2->partial(index); return Derivative(&fPrime); } } // namespace Genfun clhep-2.1.4.1.orig/GenericFunctions/src/AbsFunction.cc0000755000175000017500000001116312045031613021153 0ustar olesoles// -*- C++ -*- // $Id: AbsFunction.cc,v 1.4 2007/01/21 20:20:41 boudreau Exp $ #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/ConstTimesFunction.hh" #include "CLHEP/GenericFunctions/ConstOverFunction.hh" #include "CLHEP/GenericFunctions/ConstPlusFunction.hh" #include "CLHEP/GenericFunctions/ConstMinusFunction.hh" #include "CLHEP/GenericFunctions/FunctionSum.hh" #include "CLHEP/GenericFunctions/FunctionDifference.hh" #include "CLHEP/GenericFunctions/FunctionProduct.hh" #include "CLHEP/GenericFunctions/FunctionQuotient.hh" #include "CLHEP/GenericFunctions/FunctionConvolution.hh" #include "CLHEP/GenericFunctions/FunctionNegation.hh" #include "CLHEP/GenericFunctions/FunctionDirectProduct.hh" #include "CLHEP/GenericFunctions/FixedConstant.hh" #include "CLHEP/GenericFunctions/FloatingConstant.hh" #include "CLHEP/GenericFunctions/FunctionNumDeriv.hh" #include "CLHEP/GenericFunctions/Variable.hh" #include "CLHEP/GenericFunctions/FunctionNoop.hh" #include "CLHEP/GenericFunctions/ParameterComposition.hh" #include namespace Genfun { AbsFunction::AbsFunction() { } AbsFunction::~AbsFunction() { } AbsFunction::AbsFunction(const AbsFunction &) { } FunctionComposition AbsFunction::operator () (const AbsFunction &function) const { return FunctionComposition(this, &function); } ParameterComposition AbsFunction::operator() (const AbsParameter &p) const { return ParameterComposition(this, &p); } Derivative AbsFunction::partial(unsigned int index) const { FunctionNumDeriv fPrime(this,index); return Derivative(&fPrime); } Derivative AbsFunction::derivative(const Variable &v) const { return partial(v.index()); } Derivative AbsFunction::prime() const { assert(dimensionality()==1); return partial(0); } FunctionSum operator + (const AbsFunction & a, const AbsFunction & b) { return FunctionSum(&a,&b); } FunctionDifference operator - (const AbsFunction & a, const AbsFunction & b) { return FunctionDifference(&a,&b); } FunctionProduct operator * (const AbsFunction & a, const AbsFunction & b) { return FunctionProduct(&a,&b); } FunctionQuotient operator / (const AbsFunction & a, const AbsFunction & b) { return FunctionQuotient(&a,&b); } FunctionConvolution convolve (const AbsFunction & a, const AbsFunction & b, double x0, double x1) { return FunctionConvolution(&a,&b, x0, x1); } FunctionNegation operator - (const AbsFunction & a) { return FunctionNegation(&a); } unsigned int AbsFunction::dimensionality() const { return 1; } FunctionDirectProduct operator % (const AbsFunction & a, const AbsFunction & b) { return FunctionDirectProduct(&a,&b); } ConstTimesFunction operator * (const AbsFunction &op2, double c) { return ConstTimesFunction(c, &op2); } ConstPlusFunction operator + (const AbsFunction &op2, double c) { return ConstPlusFunction(c,&op2); } ConstPlusFunction operator - (const AbsFunction &op2, double c) { return ConstPlusFunction(-c, &op2); } ConstTimesFunction operator / (const AbsFunction &op2, double c) { return ConstTimesFunction(1/c,&op2); } ConstTimesFunction operator * (double c, const AbsFunction &op2) { return ConstTimesFunction(c,&op2); } ConstPlusFunction operator + (double c, const AbsFunction &op2) { return ConstPlusFunction(c,&op2); } ConstMinusFunction operator - (double c, const AbsFunction &op2) { return ConstMinusFunction(c,&op2); } ConstOverFunction operator / (double c, const AbsFunction &op2) { return ConstOverFunction(c,&op2); } FunctionTimesParameter operator * (const AbsFunction &f, const AbsParameter & p) { return FunctionTimesParameter(&p, &f); } FunctionPlusParameter operator + (const AbsFunction &f, const AbsParameter & p) { return FunctionPlusParameter(&p, &f); } FunctionPlusParameter operator - (const AbsFunction &f, const AbsParameter & p) { GENPARAMETER MinusP = -p; return FunctionPlusParameter(&MinusP, &f); } FunctionTimesParameter operator / (const AbsFunction &f, const AbsParameter & p) { GENPARAMETER oneOverP = 1.0/p; return FunctionTimesParameter(&oneOverP, &f); } FunctionTimesParameter operator * (const AbsParameter & p, const AbsFunction &f) { return FunctionTimesParameter(&p, &f); } FunctionPlusParameter operator + (const AbsParameter & p, const AbsFunction &f) { return FunctionPlusParameter(&p, &f); } FunctionPlusParameter operator - (const AbsParameter & p, const AbsFunction &f) { GENFUNCTION MinusF = -f; return FunctionPlusParameter(&p, &MinusF); } FunctionTimesParameter operator / (const AbsParameter & p, const AbsFunction &f) { GENFUNCTION oneOverF = 1.0/f; return FunctionTimesParameter(&p, &oneOverF); } } // namespace Genfun clhep-2.1.4.1.orig/getObjectList.in0000755000175000017500000000062011406214373015471 0ustar olesoles#!/bin/sh # get a list of object files # getObjectList [-static|-shared] filelist="" for arg in "$@" do if [ "$arg" = "-static" ] then extra="" elif [ "$arg" = "-shared" ] then extra="/shared" else if [ -d ${arg}/src${extra} ] then thispkg=`ls $arg/src$extra/*.@OBJEXT@` filelist="$filelist $thispkg" fi fi done echo $filelist clhep-2.1.4.1.orig/buildDoxy.sh0000755000175000017500000000076211406214373014705 0ustar olesoles#! /bin/sh # this script runs doxygen to create the html reference manual # For a number of reasons, doxygen needs to run in the top directory # of the CLHEP source code distribution. # Copy or move the generated html directory to the appropriate place. # doxygen.conf is compatable with Doxygen 1.4 # the LCG cmt system contains a doxygen configuration file for Doxygen 1.5 set -x # run doxygen if present if [ `whereis doxygen | wc -w` -gt 1 ]; then rm -rf html doxygen doxygen.conf fi clhep-2.1.4.1.orig/Random/0000755000175000017500000000000012242515140013611 5ustar olesolesclhep-2.1.4.1.orig/Random/Random/0000755000175000017500000000000012242515137015037 5ustar olesolesclhep-2.1.4.1.orig/Random/Random/RandGaussT.icc0000755000175000017500000000411511406204345017533 0ustar olesoles// $Id: RandGaussT.icc,v 1.4 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGaussT --- // inlined functions implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // M. Fischler - Created: 04 Feb, 2000 // // M. Fischler - Modified fire() to use local engine, not getTheEngine() // 12/13/04 // ======================================================================= // Constructors // ------------ namespace CLHEP { RandGaussT::RandGaussT(HepRandomEngine & anEngine, double mean, double stdDev ) : RandGauss(anEngine, mean, stdDev) {} RandGaussT::RandGaussT(HepRandomEngine * anEngine, double mean, double stdDev ) : RandGauss(anEngine, mean, stdDev) {} // Getting a Gaussian deviate - static methods // ------------------------------------------- double RandGaussT::shoot() { HepRandomEngine* anEngine = HepRandom::getTheEngine(); return HepStat::flatToGaussian (anEngine->flat()); } double RandGaussT::shoot( HepRandomEngine* anotherEngine ) { return HepStat::flatToGaussian (anotherEngine->flat()); } double RandGaussT::shoot(double mean, double stdDev) { return shoot()*stdDev + mean; } double RandGaussT::shoot(HepRandomEngine* anotherEngine, double mean, double stdDev) { return shoot(anotherEngine)*stdDev + mean; } // Getting a Gaussian deviate - instance methods // --------------------------------------------- double RandGaussT::fire() { return HepStat::flatToGaussian(localEngine->flat()) * defaultStdDev + defaultMean; } double RandGaussT::fire(double mean, double stdDev) { return HepStat::flatToGaussian(localEngine->flat()) * stdDev + mean; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/Stat.h0000755000175000017500000000512307746044120016131 0ustar olesoles// $Id: Stat.h,v 1.3 2003/10/23 21:29:51 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- HepStat --- // Purely static class containing useful statistics methods // ----------------------------------------------------------------------- // HepStat is a substitute for using a namespace. // One would never instantiate a HepStat object; // usage of any of these methods looks like -- // // double x = HepStat::erf ( .1 ); // // A user may wish to improve the readability of algortihm code which uses // one method many times by lines like using HepStat::erf // // and later, x = erf(u); will work. // // These methods are implemented in separate .cc files so that // user code need pull in only the code that is necessary. Time // (ROUGH estimates in cycles) and table footprint info is provided // in this header. // ======================================================================= // M. Fischler - Created: 1/25/00 // // M. Fischler - Inserted flatToGaussian 1/25/00 // From code of an attempt to speed up RandGauss // by use of tables and splines. The code was not // significantly faster than Box-Mueller, so that // algorithm is left as the RandGauss implementation. // - Inserted inverseErf // M. Fischler - Inserted gammln 2/4/00 // M. Fischler - Made constructor private; removed private destructor 4/17/00 // ======================================================================= #ifndef HepStat_h #define HepStat_h 1 #include "CLHEP/Random/defs.h" namespace CLHEP { /** * @author * @ingroup random */ class HepStat { private: HepStat(); // You CANNOT instantiate a HepStat object. public: static double flatToGaussian (double r); // This is defined by the satement that if e() provides a uniform random // on (0,1) then flatToGaussian(e()) is distributed as a unit normal // Gaussian. That is, flatToGaussian is the inverse of the c.d.f. of // a Gaussian. // Footprint: 30 K // Time: 150 cycles static double inverseErf (double t); static double erf (double x); // defined in flatToGaussian.cc static double erfQ (double x); // Quicker, and with less footprint, than erf and gaussianCDF // but only accurate to 7 digits. // Footprint: 0 // Time: static double gammln (double x); // ln (gamma(x)) }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif clhep-2.1.4.1.orig/Random/Random/RandGauss.icc0000755000175000017500000000315611406204345017413 0ustar olesoles// $Id: RandGauss.icc,v 1.3 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGauss --- // inlined functions implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 19th August 1998 // ======================================================================= namespace CLHEP { inline RandGauss::RandGauss(HepRandomEngine & anEngine, double mean, double stdDev ) : HepRandom(), defaultMean(mean), defaultStdDev(stdDev), localEngine(&anEngine, do_nothing_deleter()), set(false), nextGauss(0.0){} inline RandGauss::RandGauss(HepRandomEngine * anEngine, double mean, double stdDev ) : HepRandom(), defaultMean(mean), defaultStdDev(stdDev), localEngine(anEngine), set(false), nextGauss(0.0) {} inline double RandGauss::shoot(double mean, double stdDev) { return shoot()*stdDev + mean; } inline double RandGauss::shoot(HepRandomEngine* anEngine, double mean, double stdDev) { return shoot(anEngine)*stdDev + mean; } inline double RandGauss::fire() { return normal()*defaultStdDev + defaultMean; } inline double RandGauss::fire(double mean, double stdDev) { return normal()*stdDev + mean; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/RandExponential.icc0000755000175000017500000000310511753236267020626 0ustar olesoles// $Id: RandExponential.icc,v 1.3 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandExponential --- // inlined functions implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 19th August 1998 // ======================================================================= #include // for log() namespace CLHEP { inline RandExponential::RandExponential(HepRandomEngine & anEngine, double mean ) : HepRandom(), localEngine(&anEngine, do_nothing_deleter()), defaultMean(mean) {} inline RandExponential::RandExponential(HepRandomEngine * anEngine, double mean ) : HepRandom(), localEngine(anEngine), defaultMean(mean) {} //------------- inline double RandExponential::shoot(HepRandomEngine* anEngine) { return -std::log(anEngine->flat()); } inline double RandExponential::shoot(HepRandomEngine* anEngine, double mean) { return -std::log(anEngine->flat())*mean; } //------------- inline double RandExponential::fire() { return -std::log(localEngine->flat())*defaultMean; } inline double RandExponential::fire(double mean) { return -std::log(localEngine->flat())*mean; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/cmake-defs.h.in0000644000175000017500000000203211607115601017605 0ustar olesoles/* @PACKAGE@/defs.h Generated by cmake. */ #ifndef @UPACKAGE@_DEFS_H #define @UPACKAGE@_DEFS_H /* Define to 1 if you have the `drand48' function. */ @DRAND48_DEF@ /* Name of package */ #ifndef PACKAGE #define PACKAGE "@PACKAGE@" #endif /* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #define PACKAGE_BUGREPORT "http://savannah.cern.ch/projects/clhep/" #endif /* Define to the full name of this package. */ #ifndef PACKAGE_NAME #define PACKAGE_NAME "@PROJECT_NAME@ @PACKAGE@" #endif /* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #define PACKAGE_STRING "@PROJECT_NAME@ @PACKAGE@ @VERSION@" #endif /* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #define PACKAGE_TARNAME "@PACKAGE@" #endif /* Define to the version of this package. */ #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "@VERSION@" #endif /* Version number of package */ #ifndef VERSION #define VERSION "@VERSION@" #endif #endif // @UPACKAGE@_DEFS_H clhep-2.1.4.1.orig/Random/Random/RanshiEngine.h0000755000175000017500000001040011406204345017555 0ustar olesoles// $Id: RanshiEngine.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RanshiEngine --- // class header file // ----------------------------------------------------------------------- // // // The algorithm for this random engine was taken from "F.Gutbrod, Comp. // Phys. Comm. 87 (1995) 291-306". // // The algorithm can be imagined as a physical system as follows: Imagine // 512 "black balls" each with their own unique spin, and positions char- // acterized by disrete angles, where the spin is a 32-bit unsigned integer. // A "red ball" collides based upon the angle determined by the last 8 bits // of its spin, and the spin of the colliding ball is taken as the output // random number. The spin of the colliding ball is replaced then with the // left circular shift of the black ball's spin XOR'd with the red ball's // spin. The black ball's old spin becomes the red ball's. // // To avoid the traps presented, two measures are taken: first, the red // ball will oscillate between hitting the lower half of the buffer on one // turn and the upper half on another; second, the red ball's spin is // incremented by a counter of the number of random numbers produced. // // The result is scaled to a double precision floating point number to which // is added another random double further scaled 2^(53-32) places to the // right in order to ensure that the remaining bits of the result are not // left empty due to the mere 32 bits representation used internally. // ======================================================================= // Ken Smith - Created: 9th June 1998 // - Removed pow() from flat method: 21st Jul 1998 // - Added conversion operators: 6th Aug 1998 // Mark Fischler Methods put, get for instance save/restore 12/8/04 // Mark Fischler methods for anonymous save/restore 12/27/04 // ======================================================================= #ifndef HepRanshiEngine_h #define HepRanshiEngine_h #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" namespace CLHEP { /** * @author * @ingroup random */ class RanshiEngine: public HepRandomEngine { public: RanshiEngine(); RanshiEngine(std::istream &is); RanshiEngine(long seed); RanshiEngine(int rowIndex, int colIndex); virtual ~RanshiEngine(); // Constructors and destructor double flat(); // Returns a pseudo random number between 0 and 1 void flatArray(const int size, double* vect); // Fills the array "vect" of specified size with flat random values void setSeed(long seed, int); // Sets the state of the algorithm according to seed. void setSeeds(const long* seeds, int); // Sets the state of the algorithm according to the zero-terminated // array of seeds. void saveStatus(const char filename[] = "RanshiEngine.conf") const; // Saves on named file the current engine status void restoreStatus(const char filename[] = "RanshiEngine.conf"); // Reads from named file the last saved engine status // and restores it. void showStatus() const; // Dumps the engine status on the screen operator float(); // flat value, without worrying about filling bits operator unsigned int(); // 32-bit flat value, quickest of all virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); std::string name() const; static std::string engineName() {return "RanshiEngine";} std::vector put () const; bool get (const std::vector & v); bool getState (const std::vector & v); private: static int numEngines; enum {numBuff = 512}; unsigned int halfBuff, numFlats; unsigned int buffer[numBuff]; unsigned int redSpin; static const unsigned int VECTOR_STATE_SIZE = numBuff + 4; }; // RanshiEngine } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif // HepRanshiEngine_h clhep-2.1.4.1.orig/Random/Random/RandChiSquare.icc0000755000175000017500000000241411406204345020211 0ustar olesoles// $Id: RandChiSquare.icc,v 1.3 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandChiSquare --- // inlined functions implementation file // ----------------------------------------------------------------------- // ======================================================================= // Gabriele Cosmo - Created: 19th August 1998 // ======================================================================= namespace CLHEP { inline RandChiSquare::RandChiSquare(HepRandomEngine & anEngine, double a) : HepRandom( ), localEngine(&anEngine, do_nothing_deleter()), defaultA(a) {} inline RandChiSquare::RandChiSquare(HepRandomEngine * anEngine, double a) : HepRandom( ), localEngine(anEngine), defaultA(a) {} inline double RandChiSquare::fire() { return fire( defaultA ); } inline double RandChiSquare::shoot() { return shoot( 1.0 ); } inline double RandChiSquare::operator()() { return fire( defaultA ); } inline double RandChiSquare::operator()( double a ) { return fire( a ); } inline double RandChiSquare::shoot( HepRandomEngine* anEngine ) { return shoot( anEngine, 1.0 ); } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/RandBit.h0000755000175000017500000000740311406204345016537 0ustar olesoles// $Id: RandBit.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandBit --- // class header file // ----------------------------------------------------------------------- // // Class defining methods for shooting Flat or Bit random numbers, double or // integers. // It provides methods to fill with double flat values arrays of // specified size, as well as methods for shooting sequences of 0,1 (bits). // Default boundaries ]0.1[ for operator()(). // This is derived from RandFlat and is a drop-in replacement. However // the shootBit() and fireBit() methods are stateless (which makes them // an order of magnitude slower, but allows save/restore engine status // to work correctly). // ======================================================================= // M. Fischler - Created: 15th Feb 2000 // M Fischler - put and get to/from streams 12/10/04 // M Fischler - static save/restore to streams streams 12/20/04 // ======================================================================= #ifndef RandBit_h #define RandBit_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandFlat.h" namespace CLHEP { /** * @author * @ingroup random */ class RandBit : public RandFlat { public: inline RandBit ( HepRandomEngine& anEngine ); inline RandBit ( HepRandomEngine& anEngine, double width ); inline RandBit ( HepRandomEngine& anEngine, double a, double b ); inline RandBit ( HepRandomEngine* anEngine ); inline RandBit ( HepRandomEngine* anEngine, double width ); inline RandBit ( HepRandomEngine* anEngine, double a, double b ); // These constructors should be used to instantiate a RandBit // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandBit destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandBit destructor. virtual ~RandBit(); // Destructor // Other than the Bit routines, constructors, and destructor, everything is // simply inherited from RandFlat. static inline int shootBit(); static inline int shootBit( HepRandomEngine* ); // Methods using the localEngine to shoot random values, by-passing // the static generator. inline int fireBit(); // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); std::string name() const; static std::string distributionName() {return "RandBit";} // Provides the name of this distribution class static std::ostream& saveFullState ( std::ostream & os ) // Saves to stream the state of the engine and cached data. {return RandFlat::saveFullState(os);} static std::istream& restoreFullState ( std::istream & is ) // Restores from stream the state of the engine and cached data. {return RandFlat::restoreFullState(is);} static std::ostream& saveDistState ( std::ostream & os ) // Saves to stream the state of the cached data. {return RandFlat::saveDistState(os);} static std::istream& restoreDistState ( std::istream & is ) // Restores from stream the state of the cached data. {return RandFlat::restoreDistState(is);} private: // All the engine info, and the default A and B, are in the RandFlat // base class. }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandBit.icc" #endif clhep-2.1.4.1.orig/Random/Random/RandomFunc.h0000755000175000017500000000347611406204345017256 0ustar olesoles// -*- C++ -*- // $Id: RandomFunc.h,v 1.6 2010/06/16 17:24:53 garren Exp $ // ----------------------------------------------------------------------- // HEP RandomFunc // get proper system headers for drand, etc. // ----------------------------------------------------------------------- #ifndef RANDOMFUNC_H #define RANDOMFUNC_H // Those function are available on all unix platform but their // prototypes are not included in stdlib when strict ANSI flag is set. // Such behaviour was noticed with "KCC --strict" and "g++ -ansi". // // To provide declaration of those functions on Linux g++ should be used // with -D_GNU_SOURCE. Similar options for non-Linux plaforms are: // _HPUX_SOURCE, _IRIX_SOURCE, but we prefer just explicitely declare // the functions on those platforms. // // drand48() extracted from GNU C Library 2.1.3 is used on Windows NT // and Macintosh (see drand48.src) #if !defined(__GNUC__) extern "C" { extern double drand48(void); extern void srand48(long); extern unsigned short * seed48(unsigned short int [3]); } #else // only use stdlib.h if -D_GNU_SOURCE is present #if defined(_GNU_SOURCE) #include #else extern "C" { extern double drand48(void); extern void srand48(long); extern unsigned short * seed48(unsigned short int [3]); } #endif #endif #include "CLHEP/Random/defs.h" namespace CLHEP { //#ifdef WIN32 //#include "drand48.src" //#endif /* WIN32 */ //#ifdef __APPLE__ //#include "drand48.src" //#endif /* __APPLE__ */ // configure checks for drand48 #ifndef HAVE_DRAND48 #if !defined(__GNUC__) // IRIX gets confused #include "drand48.src" #endif #endif } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif // RANDOMFUNC_H clhep-2.1.4.1.orig/Random/Random/TripleRand.h0000755000175000017500000001263611406204345017264 0ustar olesoles// $Id: TripleRand.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // Hep Random // --- TripleRand --- // class header file // ----------------------------------------------------------------------- // A canopy pseudo-random number generator. Using the Tausworthe // exclusive-or shift register, a simple Integer Coungruence generator, and // the Hurd 288 total bit shift register, all XOR'd with each other, we // provide an engine that should be a fairly good "mother" generator. // // This is similar to DualRand, with the addition of the Hurd288Engine. // From DualRand, we have the following: // Exclusive or of a feedback shift register and integer congruence // random number generator. The feedback shift register uses offsets // 127 and 97. The integer congruence generator uses a different // multiplier for each stream. The multipliers are chosen to give // full period and maximum "potency" for modulo 2^32. The period of // the combined random number generator is 2^159 - 2^32, and the // sequences are different for each stream (not just started in a // different place). // The above is then amended to also add in the exclusive or of the // 288-total bit Hurd engine which in this case is a series of 32 // interconnected 9-bit shift registers, with the newest bit of each register // formed by the XOR of the previous bit and some bit b-d from a previous // register where d is chosen to create a primitive polynomial to maximize // the period. // ======================================================================= // Ken Smith - Initial draft started: 23rd Jul 1998 // - Added conversion operators: 6th Aug 1998 // M Fischler - Big merge with CLHEP 13 May 1999 // - Elimination of unused Taus() and Cong() accessors // Mark Fischler Methods put, get for instance save/restore 12/8/04 // Mark Fischler methods for anonymous save/restore 12/27/04 // ======================================================================= #ifndef TripleRand_h #define TripleRand_h #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" #include "CLHEP/Random/Hurd288Engine.h" namespace CLHEP { /** * @author * @ingroup random */ class TripleRand: public HepRandomEngine { public: TripleRand(); TripleRand( long seed ); TripleRand( std::istream & is ); TripleRand( int rowIndex, int colIndex ); virtual ~TripleRand(); // Constructors and destructor double flat(); // Returns a pseudo random number between 0 and 1 // (excluding the end points) void flatArray( const int size, double * vect ); // Fills an array "vect" of specified size with flat random values. void setSeed( long seed, int ); // Sets the state of the algorithm according to seed. void setSeeds( const long * seeds, int ); // Sets the state of the algorithm according to the zero-terminated // array of seeds. void saveStatus( const char filename[] = "TripleRand.conf" ) const; // Saves on named file the current engine status. void restoreStatus( const char filename[] = "TripleRand.conf" ); // Reads from named file the last saved engine status and restores it. void showStatus() const; // Dumps the current engine status on the screen. operator float(); // flat value, without worrying about filling bits operator unsigned int(); // 32-bit flat value, quickest of all virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); std::string name() const; static std::string engineName() {return "TripleRand";} std::vector put () const; bool get (const std::vector & v); bool getState (const std::vector & v); static const unsigned int VECTOR_STATE_SIZE = 20; private: static int numEngines; /** * @author * @ingroup random */ class Tausworthe { public: Tausworthe(); Tausworthe(unsigned int seed); operator unsigned int(); void put( std::ostream & os ) const; void put(std::vector & v) const; void get( std::istream & is ); bool get(std::vector::const_iterator & iv); private: int wordIndex; unsigned int words[4]; }; // Tausworthe /** * @author * @ingroup random */ class IntegerCong { public: IntegerCong(); IntegerCong(unsigned int seed, int streamNumber); operator unsigned int(); void put( std::ostream & os ) const; void put(std::vector & v) const; void get( std::istream & is ); bool get(std::vector::const_iterator & iv); private: unsigned int state, multiplier, addend; }; // IntegerCong Hurd288Engine & Hurd(); // retrieve the constituent engine for input const Tausworthe & ConstTaus() const; // Same as above const IntegerCong & ConstCong() const; // necessary for const Hurd288Engine & ConstHurd() const; // output Tausworthe tausworthe; // Instances of each of the IntegerCong integerCong; // three engines that combine to make Hurd288Engine hurd; // one TripleRand instance }; // TripleRand } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif // TripleRand_h clhep-2.1.4.1.orig/Random/Random/RandBinomial.h0000755000175000017500000000754111406204345017556 0ustar olesoles// $Id: RandBinomial.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandBinomial --- // class header file // ----------------------------------------------------------------------- // Class defining methods for shooting binomial distributed random values, // given a sample size n (default=1) and a probability p (default=0.5). // Default values are used for operator()(). // // Valid input values satisfy the relation n*min(p,1-p) > 0. When invalid // values are presented, the code silently returns -1.0. // ======================================================================= // John Marraffino - Created: 12th May 1998 Based on the C-Rand package // by Ernst Stadlober and Franz Niederl of the Technical // University of Graz, Austria. // Gabriele Cosmo - Removed useless methods and data: 5th Jan 1999 // M Fischler - put and get to/from streams 12/10/04 // ======================================================================= #ifndef RandBinomial_h #define RandBinomial_h 1 #include "CLHEP/Random/Random.h" #include "CLHEP/Utility/memory.h" namespace CLHEP { /** * @author * @ingroup random */ class RandBinomial : public HepRandom { public: inline RandBinomial ( HepRandomEngine& anEngine, long n=1, double p=0.5 ); inline RandBinomial ( HepRandomEngine* anEngine, long n=1, double p=0.5 ); // These constructors should be used to instantiate a RandBinomial // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandBinomial destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandBinomial destructor. virtual ~RandBinomial(); // Destructor // Static methods to shoot random values using the static generator static inline double shoot(); static double shoot( long n, double p ); static void shootArray ( const int size, double* vect, long n=1, double p=0.5 ); // Static methods to shoot random values using a given engine // by-passing the static generator. static inline double shoot( HepRandomEngine* anEngine ); static double shoot( HepRandomEngine* anEngine, long n, double p ); static void shootArray ( HepRandomEngine* anEngine, const int size, double* vect, long n=1, double p=0.5 ); // Methods using the localEngine to shoot random values, by-passing // the static generator. inline double fire(); double fire( long n, double p ); void fireArray ( const int size, double* vect); void fireArray ( const int size, double* vect, long n, double p ); inline double operator()(); inline double operator()( long n, double p ); // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandBinomial";} // Provides the name of this distribution class private: static double genBinomial( HepRandomEngine *anEngine, long n, double p ); shared_ptr localEngine; long defaultN; double defaultP; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandBinomial.icc" #endif clhep-2.1.4.1.orig/Random/Random/copy-header.pl.in0000755000175000017500000000164110043476464020214 0ustar olesoles#!/usr/bin/env perl # # copy a header into the temporary CLHEP header tree if # a) the header is not already there # b) the source is newer # if ($#ARGV != 1) { print "mungeit requires two arguments - exit\n"; exit; } else { $source_header=$ARGV[0]; $dest_header=$ARGV[1]; &check_header; } exit; sub check_header { # make sure source exists if ( ! -e $source_header ) { print "$source_header does not exist - exit\n"; exit; } # copy if not already there - otherwise, check the time stamp if ( ! -e $dest_header ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } else { $source_header_time = -M $source_header; $dest_header_time = -M $dest_header; # copy only if source is newer if( $source_header_time < $dest_header_time ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } } } clhep-2.1.4.1.orig/Random/Random/Makefile.am0000755000175000017500000000341312221102474017070 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@ COPY_P = @COPY_P@ pkginclude_HEADERS = \ DoubConv.hh \ DRand48Engine.h \ DualRand.h \ EngineFactory.h \ engineIDulong.h \ Hurd160Engine.h \ Hurd288Engine.h \ JamesRandom.h \ MTwistEngine.h \ NonRandomEngine.h \ RandBinomial.h \ RandBinomial.icc \ RandBit.h \ RandBit.icc \ RandBreitWigner.h \ RandBreitWigner.icc \ RandChiSquare.h \ RandChiSquare.icc \ RandEngine.h \ RandExponential.h \ RandExponential.icc \ RandExpZiggurat.h \ RandFlat.h \ RandFlat.icc \ RandGamma.h \ RandGamma.icc \ RandGauss.h \ RandGauss.icc \ RandGaussQ.h \ RandGaussQ.icc \ RandGaussT.h \ RandGaussT.icc \ RandGaussZiggurat.h \ RandGeneral.h \ RandGeneral.icc \ RandLandau.h \ RandLandau.icc \ RandomEngine.h \ RandomEngine.icc \ Random.h \ Random.icc \ Randomize.h \ RandomFunc.h \ RandPoisson.h \ RandPoisson.icc \ RandPoissonQ.h \ RandPoissonQ.icc \ RandPoissonT.h \ RandPoissonT.icc \ RandSkewNormal.h \ RandSkewNormal.icc \ RandStudentT.h \ RandStudentT.icc \ RanecuEngine.h \ Ranlux64Engine.h \ RanluxEngine.h \ RanshiEngine.h \ SeedTable.h \ Stat.h \ StaticRandomStates.h \ TripleRand.h \ defs.h # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = defs.h # copy headers into $(tempincludedir) install-tmpHEADERS: @echo " install headers in $(tempincludedir) " @list='$(pkginclude_HEADERS)'; \ if test $(tempincludedir); then \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ ./copy-header.pl $$d$$p $(tempincludedir)/$$f; \ done; \ fi; test -z "$$fail" clhep-2.1.4.1.orig/Random/Random/SeedTable.h0000755000175000017500000003346707746044120017062 0ustar olesoles// $Id: SeedTable.h,v 1.3 2003/10/23 21:29:51 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // table of seeds // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // // Static definition for the table of seeds. // This table of seeds has been taken from the original FORTRAN77 // implementation of the HEP CERN Library routine RECUSQ. // Each sequence has a period of 10**9 numbers. // ======================================================================= // Gabriele Cosmo - Created: 2nd February 1996 // ======================================================================= #ifndef SeedTable_h #define SeedTable_h 1 #include "CLHEP/Random/defs.h" namespace CLHEP { const long HepRandom::seedTable[215][2] = { { 9876, 54321 }, { 1299961164, 253987020 }, { 669708517, 2079157264 }, { 190904760, 417696270 }, { 1289741558, 1376336092 }, { 1803730167, 324952955 }, { 489854550, 582847132 }, { 1348037628, 1661577989 }, { 350557787, 1155446919 }, { 591502945, 634133404 }, { 1901084678, 862916278 }, { 1988640932, 1785523494 }, { 1873836227, 508007031 }, { 1146416592, 967585720 }, { 1837193353, 1522927634 }, { 38219936, 921609208 }, { 349152748, 112892610 }, { 744459040, 1735807920 }, { 1983990104, 728277902 }, { 309164507, 2126677523 }, { 362993787, 1897782044 }, { 556776976, 462072869 }, { 1584900822, 2019394912 }, { 1249892722, 791083656 }, { 1686600998, 1983731097 }, { 1127381380, 198976625 }, { 1999420861, 1810452455 }, { 1972906041, 664182577 }, { 84636481, 1291886301 }, { 1186362995, 954388413 }, { 2141621785, 61738584 }, { 1969581251, 1557880415 }, { 1150606439, 136325185 }, { 95187861, 1592224108 }, { 940517655, 1629971798 }, { 215350428, 922659102 }, { 786161212, 1121345074 }, { 1450830056, 1922787776 }, { 1696578057, 2025150487 }, { 1803414346, 1851324780 }, { 1017898585, 1452594263 }, { 1184497978, 82122239 }, { 633338765, 1829684974 }, { 430889421, 230039326 }, { 492544653, 76320266 }, { 389386975, 1314148944 }, { 1720322786, 709120323 }, { 1868768216, 1992898523 }, { 443210610, 811117710 }, { 1191938868, 1548484733 }, { 616890172, 159787986 }, { 935835339, 1231440405 }, { 1058009367, 1527613300 }, { 1463148129, 1970575097 }, { 1795336935, 434768675 }, { 274019517, 605098487 }, { 483689317, 217146977 }, { 2070804364, 340596558 }, { 930226308, 1602100969 }, { 989324440, 801809442 }, { 410606853, 1893139948 }, { 1583588576, 1219225407 }, { 2102034391, 1394921405 }, { 2005037790, 2031006861 }, { 1244218766, 923231061 }, { 49312790, 775496649 }, { 721012176, 321339902 }, { 1719909107, 1865748178 }, { 1156177430, 1257110891 }, { 307561322, 1918244397 }, { 906041433, 360476981 }, { 1591375755, 268492659 }, { 461522398, 227343256 }, { 2145930725, 2020665454 }, { 1938419274, 1331283701 }, { 174405412, 524140103 }, { 494343653, 18063908 }, { 1025534808, 181709577 }, { 2048959776, 1913665637 }, { 950636517, 794796256 }, { 1828843197, 1335757744 }, { 211109723, 983900607 }, { 825474095, 1046009991 }, { 374915657, 381856628 }, { 1241296328, 698149463 }, { 1260624655, 1024538273 }, { 900676210, 1628865823 }, { 697951025, 500570753 }, { 1007920268, 1708398558 }, { 264596520, 624727803 }, { 1977924811, 674673241 }, { 1440257718, 271184151 }, { 1928778847, 993535203 }, { 1307807366, 1801502463 }, { 1498732610, 300876954 }, { 1617712402, 1574250679 }, { 1261800762, 1556667280 }, { 949929273, 560721070 }, { 1766170474, 1953522912 }, { 1849939248, 19435166 }, { 887262858, 1219627824 }, { 483086133, 603728993 }, { 1330541052, 1582596025 }, { 1850591475, 723593133 }, { 1431775678, 1558439000 }, { 922493739, 1356554404 }, { 1058517206, 948567762 }, { 709067283, 1350890215 }, { 1044787723, 2144304941 }, { 999707003, 513837520 }, { 2140038663, 1850568788 }, { 1803100150, 127574047 }, { 867445693, 1149173981 }, { 408583729, 914837991 }, { 1166715497, 602315845 }, { 430738528, 1743308384 }, { 1388022681, 1760110496 }, { 1664028066, 654300326 }, { 1767741172, 1338181197 }, { 1625723550, 1742482745 }, { 464486085, 1507852127 }, { 754082421, 1187454014 }, { 1315342834, 425995190 }, { 960416608, 2004255418 }, { 1262630671, 671761697 }, { 59809238, 103525918 }, { 1205644919, 2107823293 }, { 1615183160, 1152411412 }, { 1024474681, 2118672937 }, { 1703877649, 1235091369 }, { 1821417852, 1098463802 }, { 1738806466, 1529062843 }, { 620780646, 1654833544 }, { 1070174101, 795158254 }, { 658537995, 1693620426 }, { 2055317555, 508053916 }, { 1647371686, 1282395762 }, { 29067379, 409683067 }, { 1763495989, 1917939635 }, { 1602690753, 810926582 }, { 885787576, 513818500 }, { 1853512561, 1195205756 }, { 1798585498, 1970460256 }, { 1819261032, 1306536501 }, { 1133245275, 37901 }, { 689459799, 1334389069 }, { 1730609912, 1854586207 }, { 1556832175, 1228729041 }, { 251375753, 683687209 }, { 2083946182, 1763106152 }, { 2142981854, 1365385561 }, { 763711891, 1735754548 }, { 1581256466, 173689858 }, { 2121337132, 1247108250 }, { 1004003636, 891894307 }, { 569816524, 358675254 }, { 626626425, 116062841 }, { 632086003, 861268491 }, { 1008211580, 779404957 }, { 1134217766, 1766838261 }, { 1423829292, 1706666192 }, { 942037869, 1549358884 }, { 1959429535, 480779114 }, { 778311037, 1940360875 }, { 1531372185, 2009078158 }, { 241935492, 1050047003 }, { 272453504, 1870883868 }, { 390441332, 1057903098 }, { 1230238834, 1548117688 }, { 1242956379, 1217296445 }, { 515648357, 1675011378 }, { 364477932, 355212934 }, { 2096008713, 1570161804 }, { 1409752526, 214033983 }, { 1288158292, 1760636178 }, { 407562666, 1265144848 }, { 1071056491, 1582316946 }, { 1014143949, 911406955 }, { 203080461, 809380052 }, { 125647866, 1705464126 }, { 2015685843, 599230667 }, { 1425476020, 668203729 }, { 1673735652, 567931803 }, { 1714199325, 181737617 }, { 1389137652, 678147926 }, { 288547803, 435433694 }, { 200159281, 654399753 }, { 1580828223, 1298308945 }, { 1832286107, 169991953 }, { 182557704, 1046541065 }, { 1688025575, 1248944426 }, { 1508287706, 1220577001 }, { 36721212, 1377275347 }, { 1968679856, 1675229747 }, { 279109231, 1835333261 }, { 1358617667, 1416978076 }, { 740626186, 2103913602 }, { 1882655908, 251341858 }, { 648016670, 1459615287 }, { 780255321, 154906988 }, { 857296483, 203375965 }, { 1631676846, 681204578 }, { 1906971307, 1623728832 }, { 1541899600, 1168449797 }, { 1267051693, 1020078717 }, { 1998673940, 1298394942 }, { 1914117058, 1381290704 }, { 426068513, 1381618498 }, { 139365577, 1598767734 }, { 2129910384, 952266588 }, { 661788054, 19661356 }, { 1104640222, 240506063 }, { 356133630, 1676634527 }, { 242242374, 1863206182 }, { 957935844, 1490681416 } }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif // SeedTable_h clhep-2.1.4.1.orig/Random/Random/RandGeneral.icc0000755000175000017500000000227107705573342017720 0ustar olesoles// $Id: RandGeneral.icc,v 1.2 2003/07/17 19:20:02 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGeneral --- // inlined functions implementation file // ----------------------------------------------------------------------- // ======================================================================= // Gabriele Cosmo - Created: 20th August 1998 // // M. Fischler - Moved fire() and shoot(anEngine) into inline so that // the use of mapRandom does not cost an extra function call. // ======================================================================= namespace CLHEP { inline double RandGeneral::fire() { double rand = localEngine->flat(); return mapRandom(rand); } inline double RandGeneral::shoot() { return fire(); } inline double RandGeneral::operator() () { return fire(); } inline double RandGeneral::shoot( HepRandomEngine* anEngine ) { double rand = anEngine->flat(); return mapRandom(rand); } inline void RandGeneral::shootArray( const int size, double* vect ) { fireArray(size, vect); } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/RandExponential.h0000755000175000017500000000674211406204345020314 0ustar olesoles// $Id: RandExponential.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandExponential --- // class header file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // // Class defining methods for shooting exponential distributed random // values, given a mean (default mean = 1). // Default mean is used for operator()(). // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Added methods to shoot arrays: 28th July 1997 // J.Marraffino - Added default mean as attribute and // operator() with mean: 16th Feb 1998 // M Fischler - put and get to/from streams 12/10/04 // ======================================================================= #ifndef RandExponential_h #define RandExponential_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Utility/memory.h" namespace CLHEP { /** * @author * @ingroup random */ class RandExponential : public HepRandom { public: inline RandExponential ( HepRandomEngine& anEngine, double mean=1.0 ); inline RandExponential ( HepRandomEngine* anEngine, double mean=1.0 ); // These constructors should be used to instantiate a RandExponential // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandExponential destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandExponential destructor. virtual ~RandExponential(); // Destructor // Static methods to shoot random values using the static generator static double shoot(); static double shoot( double mean ); static void shootArray ( const int size, double* vect, double mean=1.0 ); // Static methods to shoot random values using a given engine // by-passing the static generator. static inline double shoot( HepRandomEngine* anEngine ); static inline double shoot( HepRandomEngine* anEngine, double mean ); static void shootArray ( HepRandomEngine* anEngine, const int size, double* vect, double mean=1.0 ); // Methods using the localEngine to shoot random values, by-passing // the static generator. inline double fire(); inline double fire( double mean ); void fireArray ( const int size, double* vect ); void fireArray ( const int size, double* vect, double mean ); double operator()(); double operator()( double mean ); // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandExponential";} // Provides the name of this distribution class private: shared_ptr localEngine; double defaultMean; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandExponential.icc" #endif clhep-2.1.4.1.orig/Random/Random/RandGaussQ.icc0000755000175000017500000000435411406204345017535 0ustar olesoles// $Id: RandGaussQ.icc,v 1.4 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGaussQ --- // inlined functions implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // M. Fischler - Created: 24 Janm 2000 // // M. Fischler - Modified fire() to use local engine, not getTheEngine() // 12/13/04 // ======================================================================= // Constructors // ------------ //#define TRACE_DEBUG namespace CLHEP { RandGaussQ::RandGaussQ(HepRandomEngine & anEngine, double mean, double stdDev ) : RandGauss(anEngine, mean, stdDev) {} RandGaussQ::RandGaussQ(HepRandomEngine * anEngine, double mean, double stdDev ) : RandGauss(anEngine, mean, stdDev) {} // Getting a Gaussian deviate - static methods // ------------------------------------------- double RandGaussQ::shoot() { #ifdef TRACE_DEBUG std::cout << "RandGaussQ::shoot() in icc file\n"; #endif HepRandomEngine* anEngine = HepRandom::getTheEngine(); #ifdef TRACE_DEBUG std::cout << "RandGaussQ::shoot() engine is " << anEngine->name() << "\n"; #endif return transformQuick (anEngine->flat()); } double RandGaussQ::shoot( HepRandomEngine* anotherEngine ) { return transformQuick (anotherEngine->flat()); } double RandGaussQ::shoot(double mean, double stdDev) { return shoot()*stdDev + mean; } double RandGaussQ::shoot(HepRandomEngine* anotherEngine, double mean, double stdDev) { return shoot(anotherEngine)*stdDev + mean; } // Getting a Gaussian deviate - instance methods // --------------------------------------------- double RandGaussQ::fire() { return transformQuick(localEngine->flat()) * defaultStdDev + defaultMean; } double RandGaussQ::fire(double mean, double stdDev) { return transformQuick(localEngine->flat()) * stdDev + mean; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/RandStudentT.h0000755000175000017500000000753211406204345017576 0ustar olesoles// $Id: RandStudentT.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandStudentT --- // class header file // ----------------------------------------------------------------------- // Class defining methods for shooting Student's t- distributed random // values, given a number of degrees of freedom a (default=1.0). // Default values are used for operator()(). // Valid input values are a > 0. When invalid values are presented, the // code silently returns DBL_MAX from which is the same as // MAXDOUBLE in on systems where the latter exists. // ======================================================================= // John Marraffino - Created: Based on the C-Rand package // by Ernst Stadlober and Franz Niederl of the Technical // University of Graz, Austria : 12th May 1998 // - Removed because that won't work // on NT : 26th Jun 1998 // Gabriele Cosmo - Fixed minor bug on inline definition for shoot() // methods. Created .icc file : 20th Aug 1998 // - Removed useless methods and data: 5th Jan 1999 // M Fischler - put and get to/from streams 12/10/04 // ======================================================================= #ifndef RandStudentT_h #define RandStudentT_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Utility/memory.h" namespace CLHEP { /** * @author * @ingroup random */ class RandStudentT : public HepRandom { public: inline RandStudentT ( HepRandomEngine& anEngine, double a=1.0 ); inline RandStudentT ( HepRandomEngine* anEngine, double a=1.0 ); // These constructors should be used to instantiate a RandStudentT // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandStudentT destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandStudentT destructor. virtual ~RandStudentT(); // Destructor // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); // Static methods to shoot random values using the static generator static inline double shoot(); static double shoot( double a ); static void shootArray ( const int size, double* vect, double a=1.0 ); // Static methods to shoot random values using a given engine // by-passing the static generator. static inline double shoot( HepRandomEngine* anEngine ); static double shoot( HepRandomEngine* anEngine, double a ); static void shootArray ( HepRandomEngine* anEngine, const int size, double* vect, double a=1.0 ); // Methods using the localEngine to shoot random values, by-passing // the static generator. inline double fire(); double fire( double a ); void fireArray ( const int size, double* vect ); void fireArray ( const int size, double* vect, double a ); double operator()(); double operator()( double a ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandStudentT";} // Provides the name of this distribution class private: shared_ptr localEngine; double defaultA; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandStudentT.icc" #endif clhep-2.1.4.1.orig/Random/Random/RandChiSquare.h0000755000175000017500000000715511406204345017711 0ustar olesoles// $Id: RandChiSquare.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandChiSquare --- // class header file // ----------------------------------------------------------------------- // Class defining methods for shooting Chi^2 distributed random values, // given a number of degrees of freedom a (default=1.0). // Default values are used for operator()(). // Valid values of a satisfy a > 1. When invalid values are presented, // the code silently returns -1.0. // ======================================================================= // John Marraffino - Created: 12th May 1998 Based on the C-Rand package // by Ernst Stadlober and Franz Niederl of the Technical // University of Graz, Austria. // Gabriele Cosmo - Removed useless methods and data: 5th Jan 1999 // M Fischler - put and get to/from streams 12/10/04 // ======================================================================= #ifndef RandChiSquare_h #define RandChiSquare_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Utility/memory.h" namespace CLHEP { /** * @author * @ingroup random */ class RandChiSquare : public HepRandom { public: inline RandChiSquare ( HepRandomEngine& anEngine, double a=1 ); inline RandChiSquare ( HepRandomEngine* anEngine, double a=1 ); // These constructors should be used to instantiate a RandChiSquare // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandChiSquare destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandChiSquare destructor. virtual ~RandChiSquare(); // Destructor // Static methods to shoot random values using the static generator static inline double shoot(); static double shoot( double a ); static void shootArray ( const int size, double* vect, double a=1.0 ); // Static methods to shoot random values using a given engine // by-passing the static generator. static inline double shoot( HepRandomEngine* anEngine ); static double shoot( HepRandomEngine* anEngine, double a ); static void shootArray ( HepRandomEngine* anEngine, const int size, double* vect, double a=1.0 ); // Methods using the localEngine to shoot random values, by-passing // the static generator. inline double fire(); double fire( double a ); void fireArray ( const int size, double* vect); void fireArray ( const int size, double* vect, double a ); inline double operator()(); inline double operator()( double a ); // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandChiSquare";} // Provides the name of this distribution class private: static double genChiSquare( HepRandomEngine *anEngine, double a ); shared_ptr localEngine; double defaultA; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandChiSquare.icc" #endif clhep-2.1.4.1.orig/Random/Random/RandPoissonT.icc0000755000175000017500000000117107705060311020102 0ustar olesoles// $Id: RandPoissonT.icc,v 1.1.1.1 2003/07/15 20:15:05 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandPoissonT --- // inlined functions implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // M. Fischler - Created: 1/26/00 // ======================================================================= clhep-2.1.4.1.orig/Random/Random/RandStudentT.icc0000755000175000017500000000216011406204345020075 0ustar olesoles// $Id: RandStudentT.icc,v 1.3 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandStudentT --- // inlined functions implementation file // ----------------------------------------------------------------------- // ======================================================================= // Gabriele Cosmo - Created: 19th August 1998 // ======================================================================= namespace CLHEP { inline RandStudentT::RandStudentT(HepRandomEngine & anEngine, double a) : HepRandom( ), localEngine( &anEngine, do_nothing_deleter() ), defaultA(a) {} inline RandStudentT::RandStudentT(HepRandomEngine * anEngine, double a) : HepRandom( ), localEngine( anEngine ), defaultA(a) {} inline double RandStudentT::fire() { return fire( defaultA ); } inline double RandStudentT::shoot() { return shoot( 1.0 ); } inline double RandStudentT::shoot( HepRandomEngine* anEngine ) { return shoot( anEngine, 1.0 ); } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/NonRandomEngine.h0000755000175000017500000000634311753247440020247 0ustar olesoles// $Id: NonRandomEngine.h,v 1.7 2011/07/01 15:20:30 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- NonRandomEngine --- // class header file // ----------------------------------------------------------------------- // This class is present EXCLUSIVELY as a means to test distributions (and // other programs that depend on random numbers) by feeding them a stream // of "randoms" that the testing program supplies explicitly. // // The testing program calls setNextRandom (double) to setup the next // value to be produced when flat() is done. // // To protect against accidental use of this NON-RANDOM engine as a random // engine, if setNextRandom () is never called, all attempts to generate // a random will fail and exit. // ======================================================================= // Mark Fischler - Created: 9/30/99 // Mark Fischler methods for distrib. instance save/restore 12/8/04 // Mark Fischler methods for anonymous save/restore 12/27/04 // ======================================================================= #ifndef NonRandomEngine_h #define NonRandomEngine_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" #include namespace CLHEP { /** * @author * @ingroup random */ class NonRandomEngine : public HepRandomEngine { public: NonRandomEngine(); virtual ~NonRandomEngine(); // Constructors and destructor void setNextRandom (double r); // Preset the next random to be delivered void setRandomSequence (double *s, int n); // Establish a sequence of n next randoms; // replaces setNextRandom n times. void setRandomInterval (double x); // Establish that if there is no sequence active each // random should be bumped by this interval (mod 1) compared // to the last. x should be between 0 and 1. double flat(); // It returns the previously established setNextRandom and bumps that up // by the non-zero randomInterval supplied. Thus repeated calls to flat() // generate an evenly spaced sequence (mod 1). void flatArray (const int size, double* vect); // Fills the array "vect" of specified size with flat random values. virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); std::string name() const; static std::string engineName() {return "NonRandomEngine";} std::vector put () const; bool get (const std::vector & v); bool getState (const std::vector & v); private: bool nextHasBeenSet; bool sequenceHasBeenSet; bool intervalHasBeenSet; double nextRandom; std::vector sequence; unsigned int nInSeq; double randomInterval; // The following are necessary to fill virtual methods but should never // be used: virtual void setSeed(long , int) {}; virtual void setSeeds(const long * , int) {}; virtual void saveStatus( const char* ) const {}; virtual void restoreStatus( const char* ) {}; virtual void showStatus() const {}; }; } // namespace CLHEP #endif clhep-2.1.4.1.orig/Random/Random/RandFlat.icc0000755000175000017500000001221711761721356017227 0ustar olesoles// $Id: RandFlat.icc,v 1.3 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandFlat --- // inlined functions implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // Peter Urban - ShootBit() and related stuff added: 5th Sep 1996 // Gabriele Cosmo - Additional methods to fill arrays specifying // boundaries: 24th Jul 1997 // - Fixed bug in shootInt(m,n): 25th Sep 1997 // J.Marraffino - Added default arguments as attributes: 16th Feb 1998 // M.Fischler - Corrected initialization of deleteEngine which should // be true for all constructors taking HepRandomEngine*. // ======================================================================= namespace CLHEP { inline RandFlat::RandFlat(HepRandomEngine & anEngine) : HepRandom(), firstUnusedBit(0), localEngine(&anEngine, do_nothing_deleter()), defaultWidth(1.0), defaultA(0.0), defaultB(1.0) {} inline RandFlat::RandFlat(HepRandomEngine & anEngine, double width ) : HepRandom(), firstUnusedBit(0), localEngine(&anEngine, do_nothing_deleter()), defaultWidth(width), defaultA(0.0), defaultB(width) {} inline RandFlat::RandFlat(HepRandomEngine & anEngine, double a, double b ) : HepRandom(), firstUnusedBit(0), localEngine(&anEngine, do_nothing_deleter()), defaultWidth(b-a), defaultA(a), defaultB(b) {} inline RandFlat::RandFlat(HepRandomEngine * anEngine) : HepRandom(), firstUnusedBit(0), localEngine(anEngine), defaultWidth(1.0), defaultA(0.0), defaultB(1.0) {} inline RandFlat::RandFlat(HepRandomEngine * anEngine, double width ) : HepRandom(), firstUnusedBit(0), localEngine(anEngine), defaultWidth(width), defaultA(0.0), defaultB(width) {} inline RandFlat::RandFlat(HepRandomEngine * anEngine, double a, double b ) : HepRandom(), firstUnusedBit(0), localEngine(anEngine), defaultWidth(b-a), defaultA(a), defaultB(b) {} inline double RandFlat::shoot(double a, double b) { return (b-a)* shoot() + a; } inline double RandFlat::shoot(double width) { return width * shoot(); } inline long RandFlat::shootInt(long n) { return long(shoot()*double(n)); } inline long RandFlat::shootInt(long a1, long n) { return long(shoot()*double(n-a1)) + a1; } inline void RandFlat::shootBits() { const double factor= 2.0*MSB; // this should fit into a double! staticFirstUnusedBit= MSB; staticRandomInt= (unsigned long)(factor*shoot()); } inline int RandFlat::shootBit() { if (staticFirstUnusedBit==0) shootBits(); unsigned long temp= staticFirstUnusedBit&staticRandomInt; staticFirstUnusedBit>>= 1; return temp!=0; } //--------------------- inline double RandFlat::shoot(HepRandomEngine* anEngine) { return anEngine->flat(); } inline double RandFlat::shoot(HepRandomEngine* anEngine, double a, double b) { return (b-a)* anEngine->flat() + a; } inline double RandFlat::shoot(HepRandomEngine* anEngine, double width) { return width * anEngine->flat(); } inline long RandFlat::shootInt(HepRandomEngine* anEngine, long n) { return long(anEngine->flat()*double(n)); } inline long RandFlat::shootInt(HepRandomEngine* anEngine, long a1, long n) { return long(double(n-a1)*anEngine->flat()) + a1; } inline void RandFlat::shootArray(HepRandomEngine* anEngine, const int size, double* vect) { anEngine->flatArray(size,vect); } inline void RandFlat::shootBits(HepRandomEngine* engine) { const double factor= 2.0*MSB; // this should fit into a double! staticFirstUnusedBit= MSB; staticRandomInt= (unsigned long)(factor*shoot(engine)); } inline int RandFlat::shootBit(HepRandomEngine* engine) { if (staticFirstUnusedBit==0) shootBits(engine); unsigned long temp= staticFirstUnusedBit&staticRandomInt; staticFirstUnusedBit>>= 1; return temp!=0; } //--------------------- inline double RandFlat::fire() { return (defaultB-defaultA)*localEngine->flat()+defaultA; } inline double RandFlat::fire(double a, double b) { return (b-a)* localEngine->flat() + a; } inline double RandFlat::fire(double width) { return width * localEngine->flat(); } inline long RandFlat::fireInt(long n) { return long(localEngine->flat()*double(n)); } inline long RandFlat::fireInt(long a1, long n) { return long(localEngine->flat()*double(n-a1)) + a1; } inline void RandFlat::fireBits() { const double factor= 2.0*MSB; // this should fit into a double! firstUnusedBit= MSB; randomInt= (unsigned long)(factor*localEngine->flat()); } inline int RandFlat::fireBit() { if (firstUnusedBit==0) fireBits(); unsigned long temp= firstUnusedBit&randomInt; firstUnusedBit>>= 1; return temp!=0; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/RandLandau.h0000755000175000017500000000707111406204345017226 0ustar olesoles// $Id: RandLandau.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandLandau --- // class header file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // Class defining methods for shooting or firing Landau distributed // random values. // // The Landau distribution is parameterless and describes the fluctuations // in energy loss of a particle, making certain assumptions. For // definitions and algorithms, the following papers could be read: // // Landau, Jour Phys VIII, No. 4, p. 201 (1944) // Borsh-Supan, Jour Res. of NBS 65B NO. 4 p. 245 (1961) // Kolbig & Schorr Comp Phys Comm 31 p. 97 (1984) // // The algorithm implemented comes form RANLAN in CERNLIB. // ======================================================================= // M. Fischler - Created: 5th January 2000 // M Fischler - put and get to/from streams 12/10/04 // // ======================================================================= #ifndef RandLandau_h #define RandLandau_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Utility/memory.h" namespace CLHEP { /** * @author * @ingroup random */ class RandLandau : public HepRandom { public: inline RandLandau ( HepRandomEngine& anEngine ); inline RandLandau ( HepRandomEngine* anEngine ); // These constructors should be used to instantiate a RandLandau // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandLandau destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandLandau destructor. virtual ~RandLandau(); // Destructor // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); // // Methods to generate Landau-distributed random deviates. // // These deviates are accurate to the actual Landau distribution to // one part in 10**5 or better. // Static methods to shoot random values using the static generator static inline double shoot(); static void shootArray ( const int size, double* vect ); // Static methods to shoot random values using a given engine // by-passing the static generator. static inline double shoot( HepRandomEngine* anotherEngine ); static void shootArray ( HepRandomEngine* anotherEngine, const int size, double* vect ); // Instance methods using the localEngine to instead of the static // generator, and the default mean and stdDev established at construction inline double fire(); void fireArray ( const int size, double* vect); inline double operator()(); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandLandau";} // Provides the name of this distribution class protected: static double transform (double r); static double transformSmall (double r); private: shared_ptr localEngine; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandLandau.icc" #endif clhep-2.1.4.1.orig/Random/Random/Random.h0000755000175000017500000001431611406204345016435 0ustar olesoles// $Id: Random.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- HepRandom --- // class header file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // // It's a singleton instantiated by default within the HEP Random module. // It uses an instantiated HepJamesRandom engine as default algorithm // for pseudo-random number generation. HepRandom defines a static private // data member theGenerator and a set of static inlined methods to manipulate // it. By means of theGenerator the user can change the underlying engine // algorithm, get and set the seeds and use any kind of defined random // distribution. // Distribution classes inherit from HepRandom and define both static and // not-static interfaces. // A static table of uncorrelated seeds is available in this class. // A static method "getTheTableSeeds()" is defined to access a couple of // seeds at a given index in the table. // ======================================================================= // Gabriele Cosmo - Created: 5th Sep 1995 // - Minor update: 17th May 1996 // - Poisson now operates on doubles : 31st Oct 1996 // - Added methods for engine status: 19th Nov 1996 // - Fixed default values to setTheSeed() and // setTheSeeds() static methods: 16th Oct 1997 // - Modified HepRandom to act as a singleton, constructors // are kept public for backward compatibility. Added table // of seeds from HepRandomEngine: 19th Mar 1998 // - Relocated Poisson and Gauss data and simplified // initialisation of static generator: 5th Jan 1999 // ======================================================================= #ifndef HepRandom_h #define HepRandom_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" namespace CLHEP { /** * @author * @ingroup random */ class HepRandom { public: HepRandom(); HepRandom(long seed); // Contructors with and without a seed using the default engine // (JamesRandom). HepRandom(HepRandomEngine & algorithm); HepRandom(HepRandomEngine * algorithm); // Constructor taking an alternative engine as argument. If a pointer is // given the corresponding object will be deleted by the HepRandom // destructor. virtual ~HepRandom(); // Destructor // implicitly allow compiler-generated copy functions double flat(); // Returns the flat value ( interval ]0...1[ ). void flatArray(const int size, double* vect); // Fills "vect" array of flat random values, given the size. inline double flat (HepRandomEngine* theNewEngine); // Returns a flat value, given a defined Random Engine. inline void flatArray(HepRandomEngine* theNewEngine, const int size, double* vect); // Fills "vect" array of flat random values, given the size // and a defined Random Engine. virtual double operator()(); // To get a flat random number using the operator (). virtual std::string name() const; virtual HepRandomEngine & engine(); virtual std::ostream & put ( std::ostream & os ) const; virtual std::istream & get ( std::istream & is ); // Save and restore to/from streams // -------------------------------------------------- // Static member functions using the static generator // -------------------------------------------------- static void setTheSeed(long seed, int lux=3); // (Re)Initializes the generator with a seed. static long getTheSeed(); // Gets the current seed of the current generator. static void setTheSeeds(const long* seeds, int aux=-1); // (Re)Initializes the generator with a zero terminated list of seeds. static const long* getTheSeeds(); // Gets the current array of seeds of the current generator. static void getTheTableSeeds (long* seeds, int index); // Gets the array of seeds in the static seedTable at "index" position. static HepRandom * getTheGenerator(); // Return the current static generator. static void setTheEngine (HepRandomEngine* theNewEngine); // To set the underlying algorithm object. static HepRandomEngine * getTheEngine(); // Returns a pointer to the underlying algorithm object. static void saveEngineStatus( const char filename[] = "Config.conf" ); // Saves to file the current status of the current engine. static void restoreEngineStatus( const char filename[] = "Config.conf" ); // Restores a saved status (if any) for the current engine. static std::ostream& saveFullState ( std::ostream & os ); // Saves to stream the state of the engine and cached data. static std::istream& restoreFullState ( std::istream & is ); // Restores from stream the state of the engine and cached data. static std::ostream& saveDistState ( std::ostream & os ) {return os;} // Saves to stream the state of the cached data. static std::istream& restoreDistState ( std::istream & is ) {return is;} // Restores from stream the state of the cached data. static std::ostream& saveStaticRandomStates ( std::ostream & os ); // Saves to stream the engine and cached data for all distributions. static std::istream& restoreStaticRandomStates ( std::istream & is ); // Restores from stream the engine and cached data for all distributions. static void showEngineStatus(); // Dumps the current engine status on screen. static int createInstance(); // used to initialise the default engine static std::string distributionName() {return "HepRandomEngine";} // Provides the name of this distribution class protected: // -------- Data members --------- static const long seedTable[215][2]; // Table of seeds }; std::ostream & operator<< (std::ostream & os, const HepRandom & dist); std::istream & operator>> (std::istream & is, HepRandom & dist); } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/Random.icc" #endif clhep-2.1.4.1.orig/Random/Random/RandPoissonQ.icc0000755000175000017500000000175011761721356020114 0ustar olesoles// $Id: RandPoissonQ.icc,v 1.2 2003/07/17 19:20:02 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandPoissonQ --- // inlined functions implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // M. Fischler - Created: 1/26/00 // ======================================================================= namespace CLHEP { inline RandPoissonQ::RandPoissonQ(HepRandomEngine & anEngine, double b1 ) : RandPoisson(anEngine, b1) { setupForDefaultMu(); } inline RandPoissonQ::RandPoissonQ(HepRandomEngine * anEngine, double b1 ) : RandPoisson(anEngine, b1) { setupForDefaultMu(); } inline int RandPoissonQ::tableBoundary() { return int(LAST_MU + S); } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/RandBit.icc0000755000175000017500000000317511406204345017050 0ustar olesoles// $Id: RandBit.icc,v 1.3 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandBit --- // inlined functions implementation file // ----------------------------------------------------------------------- // ======================================================================= // M.Fischler - Created, along same lines as RandGaussQ.icc // ======================================================================= namespace CLHEP { inline RandBit::RandBit(HepRandomEngine & anEngine) : RandFlat (anEngine) {} inline RandBit::RandBit(HepRandomEngine & anEngine, double width ) : RandFlat (anEngine, width) {} inline RandBit::RandBit(HepRandomEngine & anEngine, double a, double b ) : RandFlat (anEngine, a, b) {} inline RandBit::RandBit(HepRandomEngine * anEngine) : RandFlat (anEngine) {} inline RandBit::RandBit(HepRandomEngine * anEngine, double width ) : RandFlat (anEngine, width) {} inline RandBit::RandBit(HepRandomEngine * anEngine, double a, double b ) : RandFlat (anEngine, a, b) {} //--------------------- inline int RandBit::shootBit() { double x = shoot(); return (x > .5) ? 1 : 0; } //--------------------- inline int RandBit::shootBit(HepRandomEngine* engine) { double x = shoot(engine); return (x > .5) ? 1 : 0; } //--------------------- inline int RandBit::fireBit() { double x = fire(0,1); return (x > .5) ? 1 : 0; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/DoubConv.hh0000644000175000017500000000440710233771102017076 0ustar olesoles#ifndef DOUBCONV_HH #define DOUBCONV_HH #include #include #include namespace CLHEP { class DoubConvException : public std::exception { public: DoubConvException(const std::string & w) throw() : msg(w) {} ~DoubConvException() throw() {} const char* what() const throw() { return msg.c_str(); } private: std::string msg; }; class DoubConv { public: // dto2longs(d) returns (in a vector) two unsigned longs string containing the // representation of its double input. This is byte-ordering // independant, and depends for complete portability ONLY on adherance // to the IEEE 754 standard for 64-bit floating point representation. // The first unsigned long contains the high-order bits in IEEE; thus // 1.0 will always be 0x3FF00000, 00000000 static std::vector dto2longs(double d); // longs2double (v) returns a double containing the value represented by its // input, which must be a vector containing 2 unsigned longs. // The input is taken to be the representation according to // the IEEE 754 standard for a 64-bit floating point number, whose value // is returned as a double. The byte-ordering of the double result is, // of course, tailored to the proper byte-ordering for the system. static double longs2double (const std::vector & v); // dtox(d) returns a 16-character string containing the (zero-filled) hex // representation of its double input. This is byte-ordering // independant, and depends for complete portability ONLY on adherance // to the IEEE 754 standard for 64-bit floating point representation. static std::string d2x(double d); private: union DB8 { unsigned char b[8]; double d; }; static void fill_byte_order (); static bool byte_order_known; static int byte_order[8]; // Meaning of byte_order: The first (high-order in IEEE 754) byte to // output (or the high-order byte of the first unsigned long) // is of db.b[byte_order[0]]. Thus the index INTO byte_order // is a position in the IEEE representation of the double, and the value // of byte_order[k] is an offset in the memory representation of the // double. }; } #endif // DOUBCONV_HH clhep-2.1.4.1.orig/Random/Random/RandPoissonT.h0000755000175000017500000000675211406204345017605 0ustar olesoles// $Id: RandPoissonT.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandPoissonT --- // class header file // ----------------------------------------------------------------------- // Class defining methods for shooting numbers according to the Poisson // distribution, given a mean. RandPoissonT is derived from RandPoisson // and shares the identical user interface. RandPoissonT is always // perfectly accurate for any value of mu. // For mu > 100 the algorithm used is taken from the base class RandPoisson // (Algorithm from "W.H.Press et al., Numerical Recipes in C, Second Edition".) // // For mu < 100, algorithm used is a table lookup based on [mu/K] for some // smallish K, followed by an explicit series-drived poisson for the small // remaining part of mu. This method is exact, and is substantially faster // than the method used by the base class. The implementation of this method // is in the RandPoissonQ class. // ======================================================================= // M. Fischler - Created 26 Jan 2000 // M Fischler - put and get to/from streams 12/10/04 // ======================================================================= #ifndef RandPoissonT_h #define RandPoissonT_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandPoisson.h" namespace CLHEP { /** * @author * @ingroup random */ class RandPoissonT : public RandPoisson { public: RandPoissonT ( HepRandomEngine& anEngine, double m=1.0 ); RandPoissonT ( HepRandomEngine* anEngine, double m=1.0 ); // These constructors should be used to instantiate a RandPoissonT // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandPoissonT destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandPoissonT destructor. virtual ~RandPoissonT(); // Destructor // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); // Static methods to shoot random values using the static generator static long shoot( double m=1.0 ); static void shootArray ( const int size, long* vect, double m=1.0 ); // Static methods to shoot random values using a given engine // by-passing the static generator. static long shoot( HepRandomEngine* anEngine, double m=1.0 ); static void shootArray ( HepRandomEngine* anEngine, const int size, long* vect, double m=1.0 ); // Methods using the localEngine to shoot random values, by-passing // the static generator. long fire(); long fire( double m ); void fireArray ( const int size, long* vect ); void fireArray ( const int size, long* vect, double m); double operator()(); double operator()( double m ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandPoissonT";} // Provides the name of this distribution class private: }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandPoissonT.icc" #endif clhep-2.1.4.1.orig/Random/Random/StaticRandomStates.h0000644000175000017500000000215210233771102020756 0ustar olesoles// $Id // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- StaticRandomStates --- // class header file // ----------------------------------------------------------------------- // // It's a holder for methods to save and restore the full states of all // static random distribution generators, including engine and cached data. // // ======================================================================= // Mark Fischler - Created: Dec. 21, 2004 // ======================================================================= #ifndef StaticRandomStates_h #define StaticRandomStates_h 1 #include "CLHEP/Random/defs.h" #include namespace CLHEP { /** * @author */ class StaticRandomStates { public: static std::ostream & save (std::ostream & os); static std::istream & restore(std::istream & is); }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif clhep-2.1.4.1.orig/Random/Random/.cvsignore0000755000175000017500000000002607705453233017046 0ustar olesolesMakefile.in defs.h.in clhep-2.1.4.1.orig/Random/Random/RandLandau.icc0000755000175000017500000000314511406204345017533 0ustar olesoles// $Id: RandLandau.icc,v 1.3 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandLandau --- // inlined functions implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 19th August 1998 // M Fischler - Added some inline methods that had been in the .cc file, // which are shells for calls to transform(r): 30 Sep 1999 // ======================================================================= // Constructors // ------------ namespace CLHEP { RandLandau::RandLandau(HepRandomEngine & anEngine ) : HepRandom(), localEngine(&anEngine, do_nothing_deleter()) {} RandLandau::RandLandau(HepRandomEngine * anEngine ) : HepRandom(), localEngine(anEngine) {} // Getting a Landau deviate - static methods // ------------------------------------------- double RandLandau::shoot() { HepRandomEngine* anEngine = HepRandom::getTheEngine(); return transform (anEngine->flat()); } double RandLandau::shoot( HepRandomEngine* anotherEngine ) { return transform (anotherEngine->flat()); } // Getting a Landau deviate - instance methods // --------------------------------------------- double RandLandau::fire() { return transform(localEngine->flat()); } double RandLandau::operator()() { return transform(localEngine->flat()); } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/RandPoisson.icc0000755000175000017500000000225411761721356017773 0ustar olesoles// $Id: RandPoisson.icc,v 1.3 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandPoisson --- // inlined functions implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 19th August 1998 // ======================================================================= namespace CLHEP { inline RandPoisson::RandPoisson(HepRandomEngine & anEngine, double a1 ) : HepRandom(), meanMax(2.0E9), defaultMean(a1), localEngine(&anEngine, do_nothing_deleter()), oldm(-1.0) { status[0] = status[1] = status[2] = 0.; } inline RandPoisson::RandPoisson(HepRandomEngine * anEngine, double a1 ) : HepRandom(), meanMax(2.0E9), defaultMean(a1), localEngine(anEngine), oldm(-1.0) { status[0] = status[1] = status[2] = 0.; } inline HepRandomEngine * RandPoisson::getLocalEngine() { return localEngine.get(); } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/Randomize.h0000755000175000017500000000540612241262566017154 0ustar olesoles// $Id: Randomize.h,v 1.4 2011/05/31 20:57:00 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // // This file must be included to make use of the HEP Random module // On some compilers the static instance of the HepRandom generator // needs to be created explicitly in the client code. The static // generator is assured to be correctly initialized by including this // header in the client code. // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // Gabriele Cosmo - Last change: 13th February 1996 // Ken Smith - Added Ranshi and DualRand engines: 4th June 1998 // - Added Ranlux64 and MTwist engines: 14th July 1998 // - Added Hurd160, Hurd288m and TripleRand 6th Aug 1998 // ======================================================================= #ifndef Rndmze_h #define Rndmze_h 1 // Including Engines ... #include "CLHEP/Random/defs.h" #include "CLHEP/Random/DRand48Engine.h" #include "CLHEP/Random/DualRand.h" #include "CLHEP/Random/Hurd160Engine.h" #include "CLHEP/Random/Hurd288Engine.h" #include "CLHEP/Random/JamesRandom.h" #include "CLHEP/Random/MTwistEngine.h" #include "CLHEP/Random/RandEngine.h" #include "CLHEP/Random/RanecuEngine.h" #include "CLHEP/Random/RanluxEngine.h" #include "CLHEP/Random/Ranlux64Engine.h" #include "CLHEP/Random/RanshiEngine.h" #include "CLHEP/Random/TripleRand.h" // Including distributions ... #include "CLHEP/Random/RandBinomial.h" #include "CLHEP/Random/RandBreitWigner.h" #include "CLHEP/Random/RandChiSquare.h" #include "CLHEP/Random/RandExponential.h" #include "CLHEP/Random/RandExpZiggurat.h" #include "CLHEP/Random/RandFlat.h" #include "CLHEP/Random/RandBit.h" #include "CLHEP/Random/RandGamma.h" #include "CLHEP/Random/RandGauss.h" #include "CLHEP/Random/RandGaussQ.h" #include "CLHEP/Random/RandGaussT.h" #include "CLHEP/Random/RandGaussZiggurat.h" #include "CLHEP/Random/RandGeneral.h" #include "CLHEP/Random/RandLandau.h" #include "CLHEP/Random/RandPoissonQ.h" #include "CLHEP/Random/RandPoissonT.h" #include "CLHEP/Random/RandSkewNormal.h" #include "CLHEP/Random/RandStudentT.h" namespace CLHEP { #define HepUniformRand() HepRandom::getTheEngine()->flat() // On some compilers the static instance of the HepRandom generator // needs to be created explicitly in the client code (i.e. here). static int HepRandomGenActive = HepRandom::createInstance(); } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif clhep-2.1.4.1.orig/Random/Random/RandEngine.h0000755000175000017500000001102311406204345017217 0ustar olesoles// $Id: RandEngine.h,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandEngine --- // class header file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // // Simple random engine using rand() and srand() functions from C standard // library to implement the flat() basic distribution and for setting // seeds. // Copy constructor and operator= are private for objects of this class. // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Minor corrections: 31st October 1996 // - Added methods for engine status: 19th November 1996 // - setSeed(), setSeeds() now have default dummy argument // set to zero: 11th July 1997 // - Private copy constructor and operator=: 26th Feb 1998 // J.Marraffino - Added stream operators and related constructor. // Added automatic seed selection from seed table and // engine counter: 15th Feb 1998 // Ken Smith - Added conversion operators: 6th Aug 1998 // replace mx by mantissa_bit_32 // M Fischler - Inserted warnings about the fact that the quality of rand() // is quite poor. // Mark Fischler Methods for distrib. instance save/restore 12/8/04 // Mark Fischler methods for anonymous save/restore 12/27/04 // ======================================================================= #ifndef RandEngine_h #define RandEngine_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" namespace CLHEP { /** * @author * @ingroup random */ class RandEngine : public HepRandomEngine { public: RandEngine(std::istream& is); RandEngine(); RandEngine(long seed); RandEngine(int rowIndex, int colIndex); virtual ~RandEngine(); // Constructors and destructor double flat(); // It returns a pseudo random number between 0 and 1, // according to the standard stdlib random function rand() // but excluding the end points. // // WARNING: rand() is quite a weak generator on most systems, < // will not pass several randomness tests, and does not give a < // reproducible sequence of numbers. < void flatArray (const int size, double* vect); // Fills the array "vect" of specified size with flat random values. void setSeed(long seed, int dum=0); // Sets the state of the algorithm according to seed. void setSeeds(const long * seeds, int dum=0); // Sets the state of the algorithm according to the zero terminated // array of seeds. Only the first seed is used. void saveStatus( const char filename[] = "Rand.conf" ) const; // Saves on file Rand.conf the current engine status. // WARNING: This is non-functional, as rand() on various systems will < // not give reproducible streams. < void restoreStatus( const char filename[] = "Rand.conf" ); // Reads from file Rand.conf the last saved engine status // and restores it. // WARNING: This is non-functional, as rand() on various systems will < // not give reproducible streams. < void showStatus() const; // Dumps the engine status on the screen. operator unsigned int(); // 32-bit flat value, quickest of all. virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); std::string name() const; static std::string engineName() {return "RandEngine";} std::vector put () const; bool get (const std::vector & v); bool getState (const std::vector & v); static const unsigned int VECTOR_STATE_SIZE = 3; private: RandEngine(const RandEngine &p); RandEngine & operator = (const RandEngine &p); // Private copy constructor and assignment operator. private: long seq; static int numEngines; static int maxIndex; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif clhep-2.1.4.1.orig/Random/Random/RandExpZiggurat.h0000644000175000017500000001363512241262566020302 0ustar olesoles/* Code adapted from: http://www.jstatsoft.org/v05/i08/ Original disclaimer: The ziggurat method for RNOR and REXP Combine the code below with the main program in which you want normal or exponential variates. Then use of RNOR in any expression will provide a standard normal variate with mean zero, variance 1, while use of REXP in any expression will provide an exponential variate with density exp(-x),x>0. Before using RNOR or REXP in your main, insert a command such as zigset(86947731 ); with your own choice of seed value>0, rather than 86947731. (If you do not invoke zigset(...) you will get all zeros for RNOR and REXP.) For details of the method, see Marsaglia and Tsang, "The ziggurat method for generating random variables", Journ. Statistical Software. */ #ifndef RandExpZiggurat_h #define RandExpZiggurat_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" namespace CLHEP { /** * @author ATLAS * @ingroup random */ class RandExpZiggurat : public HepRandom { public: inline RandExpZiggurat ( HepRandomEngine& anEngine, double mean=1.0 ); inline RandExpZiggurat ( HepRandomEngine* anEngine, double mean=1.0 ); // These constructors should be used to instantiate a RandExpZiggurat // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandExpZiggurat destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandExpZiggurat destructor. virtual ~RandExpZiggurat(); // Destructor // Static methods to shoot random values using the static generator static float shoot() {return shoot(HepRandom::getTheEngine());}; static float shoot( float mean ) {return shoot(HepRandom::getTheEngine(),mean);}; /* ENGINE IS INTRINSIC FLOAT static double shoot() {return shoot(HepRandom::getTheEngine());}; static double shoot( double mean ) {return shoot(HepRandom::getTheEngine(),mean);}; */ static void shootArray ( const int size, float* vect, float mean=1.0 ); static void shootArray ( const int size, double* vect, double mean=1.0 ); // Static methods to shoot random values using a given engine // by-passing the static generator. static inline float shoot( HepRandomEngine* anEngine ) {return ziggurat_REXP(anEngine);}; static inline float shoot( HepRandomEngine* anEngine, float mean ) {return shoot(anEngine)*mean;}; /* ENGINE IS INTRINSIC FLOAT static inline double shoot( HepRandomEngine* anEngine ) {return ziggurat_REXP(anEngine);}; static inline double shoot( HepRandomEngine* anEngine, double mean ) {return shoot(anEngine)*mean;}; */ static void shootArray ( HepRandomEngine* anEngine, const int size, float* vect, float mean=1.0 ); static void shootArray ( HepRandomEngine* anEngine, const int size, double* vect, double mean=1.0 ); // Methods using the localEngine to shoot random values, by-passing // the static generator. inline float fire() {return fire(defaultMean);}; inline float fire( float mean ) {return ziggurat_REXP(localEngine)*mean;}; /* ENGINE IS INTRINSIC FLOAT inline double fire() {return fire(defaultMean);}; inline double fire( double mean ) {return ziggurat_REXP(localEngine)*mean;}; */ void fireArray ( const int size, float* vect ); void fireArray ( const int size, double* vect ); void fireArray ( const int size, float* vect, float mean ); void fireArray ( const int size, double* vect, double mean ); virtual double operator()(); inline float operator()( float mean ) {return fire( mean );}; // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandExpZiggurat";} // Provides the name of this distribution class static bool ziggurat_init(); protected: ////////////////////////// // Ziggurat Original code: ////////////////////////// //static unsigned long jz,jsr=123456789; // //#define SHR3 (jz=jsr, jsr^=(jsr<<13), jsr^=(jsr>>17), jsr^=(jsr<<5),jz+jsr) //#define UNI (.5 + (signed) SHR3*.2328306e-9) //#define IUNI SHR3 // //static long hz; //static unsigned long iz, kn[128], ke[256]; //static float wn[128],fn[128], we[256],fe[256]; // //#define RNOR (hz=SHR3, iz=hz&127, (fabs(hz)flat();}; static inline float ziggurat_REXP(HepRandomEngine* anEngine) { unsigned long jz=ziggurat_SHR3(anEngine); unsigned long iz=jz&255; return (jz * @ingroup random */ class DRand48Engine : public HepRandomEngine, public noncopyable { public: DRand48Engine(std::istream& is); DRand48Engine(); DRand48Engine(long seed); DRand48Engine(int rowIndex, int colIndex); virtual ~DRand48Engine(); // Constructors and destructor double flat(); // It returns a pseudo random number between 0 and 1, // according to the standard stdlib random function drand48() // but excluding the end points. void flatArray (const int size, double* vect); // Fills the array "vect" of specified size with flat random values. void setSeed(long seed, int dum=0); // Sets the state of the algorithm according to seed. void setSeeds(const long * seeds, int dum=0); // Sets the state of the algorithm according to the zero terminated // array of seeds. Only the first seed is used. void saveStatus( const char filename[] = "DRand48.conf" ) const; // Saves on file DRand48.conf the current engine status. void restoreStatus( const char filename[] = "DRand48.conf" ); // Reads from file DRand48.conf the last saved engine status // and restores it. void showStatus() const; // Dumps the engine status on the screen. virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); std::string name() const; static std::string engineName() {return "DRand48Engine";} std::vector put () const; bool get (const std::vector & v); bool getState (const std::vector & v); static const unsigned int VECTOR_STATE_SIZE = 4; private: static int numEngines; static int maxIndex; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif clhep-2.1.4.1.orig/Random/Random/RandGaussT.h0000755000175000017500000001034211406204345017223 0ustar olesoles// $Id: RandGaussT.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGaussT --- // class header file // ----------------------------------------------------------------------- // Class defining methods RandGaussT, which is derived from RandGauss. // The user interface is identical. // RandGaussT --- // Always uses exactly one flat random from the engine // Is stateless so that saveEngineStatus works even if invoked knowing // only that the distribution is a HepRandom. (RandGauss is not stateless.) // Is accurate to more than 12 decimal places in all cases, and more so // near the end points. // Runs about as fast as RandGauss. // RandGaussT utilizes HepStat::flatToGaussian(r), so its effective footprint // (for the tables used) is almost 30K bytes. // ======================================================================= // M. Fischler Created 2/2/00 // M Fischler - put and get to/from streams 12/10/04 // // ======================================================================= #ifndef RandGaussT_h #define RandGaussT_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandGauss.h" #include "CLHEP/Random/Stat.h" namespace CLHEP { /** * @author * @ingroup random */ class RandGaussT : public RandGauss { public: inline RandGaussT ( HepRandomEngine& anEngine, double mean=0.0, double stdDev=1.0 ); inline RandGaussT ( HepRandomEngine* anEngine, double mean=0.0, double stdDev=1.0 ); // These constructors should be used to instantiate a RandGaussT // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandGaussT destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandGaussT destructor. // Destructor virtual ~RandGaussT(); // // Methods to generate Gaussian-distributed random deviates: // // If a fast good engine takes 1 usec, RandGauss::fire() adds 1 usec; // RandGaussT::fire() similarly adds 1 usec. // // Static methods to shoot random values using the static generator static inline double shoot(); static inline double shoot( double mean, double stdDev ); static void shootArray ( const int size, double* vect, double mean=0.0, double stdDev=1.0 ); // Static methods to shoot random values using a given engine // by-passing the static generator. static inline double shoot( HepRandomEngine* anotherEngine ); static inline double shoot( HepRandomEngine* anotherEngine, double mean, double stdDev ); static void shootArray ( HepRandomEngine* anotherEngine, const int size, double* vect, double mean=0.0, double stdDev=1.0 ); // Instance methods using the localEngine to instead of the static // generator, and the default mean and stdDev established at construction inline double fire(); inline double fire ( double mean, double stdDev ); void fireArray ( const int size, double* vect); void fireArray ( const int size, double* vect, double mean, double stdDev ); virtual double operator()(); virtual double operator()( double mean, double stdDev ); // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandGaussT";} // Provides the name of this distribution class private: // All the engine info, and the default mean and sigma, are in the RandGauss // base class. }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandGaussT.icc" #endif clhep-2.1.4.1.orig/Random/Random/Random.icc0000755000175000017500000000220607705573342016754 0ustar olesoles// $Id: Random.icc,v 1.2 2003/07/17 19:20:02 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- HepRandom --- // inlined functions implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Added methods for engine status: 19th November 1996 // - operator()() is now virtual: 28th July 1997 // - Simplified initialisation of static generator: 5th Jan 1999 // ======================================================================= namespace CLHEP { inline double HepRandom::flat(HepRandomEngine* theNewEngine) { return theNewEngine->flat(); } inline void HepRandom::flatArray(HepRandomEngine* theNewEngine, const int size, double* vect) { theNewEngine->flatArray(size,vect); } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/RandomEngine.h0000755000175000017500000001505611461345007017567 0ustar olesoles// $Id: RandomEngine.h,v 1.6 2010/10/25 18:18:47 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- HepRandomEngine --- // class header file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // // Is the abstract class defining the interface for each random engine. It // implements the getSeed() and getSeeds() methods which return the initial // seed value and the initial array of seeds respectively. It defines 7 // pure virtual functions: flat(), flatArray(), setSeed(), setSeeds(), // saveStatus(), restoreStatus() and showStatus(), which are implemented by // the concrete random engines each one inheriting from this abstract class. // Many concrete random engines can be defined and added to the structure, // simply making them inheriting from HepRandomEngine and defining the six // functions flat(), flatArray(), setSeed(), setSeeds(), saveStatus(), // restoreStatus() and showStatus() in such a way that flat() and // flatArray() return double random values ranging between ]0,1[. // All the random engines have a default seed value already set but they // can be instantiated with a different seed value set up by the user. // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Minor corrections: 31st October 1996 // - Added methods for engine status: 19th November 1996 // - Removed default values to setSeed() and // setSeeds() pure virtual methods: 16th Oct 1997 // - Moved seeds table to HepRandom: 19th Mar 1998 // Ken Smith - Added conversion operators: 6th Aug 1998 // Mark Fischler - Added static twoToMinus_xx constants: 11 Sept 1998 // Mark Fischler - Removed getTableSeeds, which was migrated to HepRandom // in 1998. 10 Feb 2005. // ======================================================================= #ifndef HepRandomEngine_h #define HepRandomEngine_h 1 #include #include #include #include #include #include #include "CLHEP/Random/defs.h" namespace CLHEP { /** * @author * @ingroup random */ class HepRandomEngine { public: HepRandomEngine(); virtual ~HepRandomEngine(); // Constructor and destructor inline bool operator==(const HepRandomEngine& engine); inline bool operator!=(const HepRandomEngine& engine); // Overloaded operators, ==, != virtual double flat() = 0; // Should return a pseudo random number between 0 and 1 // (excluding the end points) virtual void flatArray(const int size, double* vect) = 0; // Fills an array "vect" of specified size with flat random values. virtual void setSeed(long seed, int) = 0; // Should initialise the status of the algorithm according to seed. virtual void setSeeds(const long * seeds, int) = 0; // Should initialise the status of the algorithm according to the zero terminated // array of seeds. It is allowed to ignore one or many seeds in this array. virtual void saveStatus( const char filename[] = "Config.conf") const = 0; // Should save on a file specific to the instantiated engine in use // the current status. virtual void restoreStatus( const char filename[] = "Config.conf" ) = 0; // Should read from a file (specific to the instantiated engine in use) // and restore the last saved engine configuration. virtual void showStatus() const = 0; // Should dump the current engine status on the screen. virtual std::string name() const = 0; // Engine name. virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); // Save and restore to/from streams static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); // Helpers for EngineFactory which restores anonymous engine from istream static HepRandomEngine* newEngine(std::istream & is); // Instantiates on the heap a new engine of type specified by content of is static HepRandomEngine* newEngine(const std::vector & v); // Instantiates on the heap a new engine of type specified by content of v virtual std::vector put () const; virtual bool get (const std::vector & v); virtual bool getState (const std::vector & v); // Save and restore to/from vectors long getSeed() const { return theSeed; } // Gets the current seed. const long* getSeeds() const { return theSeeds; } // Gets the current array of seeds. virtual operator double(); // Returns same as flat() virtual operator float(); // less precise flat, faster if possible virtual operator unsigned int(); // 32-bit int flat, faster if possible // The above three conversion operators permit one to retrieve a pseudo- // random number as either a double-precision float, a single-precision // float, or a 32-bit unsigned integer. The usage, presuming an object // of the respective engine class "e", is as follows: // Recommended: // float x; // x = float( e ); // Reasonable: // x = e; // Works, but bad practice: // x = 1.5 + e; // Won't compile: // x = e + 1.5; protected: long theSeed; const long* theSeeds; static inline double exponent_bit_32(); static inline double mantissa_bit_12(); static inline double mantissa_bit_24(); static inline double mantissa_bit_32(); static inline double twoToMinus_32(); static inline double twoToMinus_48(); static inline double twoToMinus_49(); static inline double twoToMinus_53(); static inline double nearlyTwoToMinus_54(); static bool checkFile (std::istream & file, const std::string & filename, const std::string & classname, const std::string & methodname); }; std::ostream & operator<< (std::ostream & os, const HepRandomEngine & e); std::istream & operator>> (std::istream & is, HepRandomEngine & e); template bool possibleKeywordInput (IS & is, const std::string & key, T & t) { std::string firstWord; is >> firstWord; if (firstWord == key) return true; std::istringstream reread(firstWord); reread >> t; return false; } } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandomEngine.icc" #endif clhep-2.1.4.1.orig/Random/Random/engineIDulong.h0000644000175000017500000000170510233771102017734 0ustar olesoles// $Id // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- engineIDulong --- // function header file // ----------------------------------------------------------------------- // Class generating new engines from streamed saves. // ======================================================================= // M Fischler - Created: Mar. 8, 2005 // ======================================================================= #ifndef engineIDulong_h #define engineIDulong_h 1 namespace CLHEP { unsigned long crc32ul(const std::string & s); template unsigned long engineIDulong() { static unsigned long id = crc32ul(E::engineName()); return id; } } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif clhep-2.1.4.1.orig/Random/Random/RandBreitWigner.icc0000755000175000017500000000212211406204345020542 0ustar olesoles// $Id: RandBreitWigner.icc,v 1.3 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandBreitWigner --- // inlined functions implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 19th August 1998 // ======================================================================= namespace CLHEP { inline RandBreitWigner::RandBreitWigner(HepRandomEngine & anEngine, double a, double b ) : HepRandom( ), localEngine(&anEngine, do_nothing_deleter()), defaultA(a), defaultB(b) {} inline RandBreitWigner::RandBreitWigner(HepRandomEngine * anEngine, double a, double b ) : HepRandom( ), localEngine(anEngine), defaultA(a), defaultB(b) {} } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/Hurd160Engine.h0000755000175000017500000000720111406204345017467 0ustar olesoles// $Id: Hurd160Engine.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- Hurd160Engine --- // class header file // ----------------------------------------------------------------------- // // The starting point for the Hurd Random algorithm is the paper in // IEEE Transactions on Computers c23, 2 Feb 1974. The algorithm is // essentially a series of 32 interconnected b-bit registers. The basic // property is that at each step, bit 1 becomes bit 0, bit 2 the new bit 1, // bit b the new bit b-1. This is modified so that the new bit b0 is the old // bit b1 XOR'd with some bit b-d from the previous bit register. The values // of d can be chosen so as to generate a primitive polynomial, a maximal // length sequence through all bit patterns except the zero pattern. // // This generator, Hurd160 use values based upon Table I of the afore // mentioned paper, such that we have 160 total bits, representing 32 // 5-bit registers (actually implemented as an array of 5 32-bit words) // ======================================================================= // 07-23-98 KLS Initial draft started // Ken Smith - Added conversion operators: 6th Aug 1998 // Mark Fischler - Methods put, get for instance save/restore 12/8/04 // Mark Fischler - methods for anonymous save/restore 12/27/04 // ======================================================================= #ifndef Hurd160Engine_h #define Hurd160Engine_h #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" namespace CLHEP { /** * @author * @ingroup random */ class Hurd160Engine: public HepRandomEngine { public: Hurd160Engine(); Hurd160Engine( std::istream &is); Hurd160Engine( long seed ); Hurd160Engine( int rowIndex, int colIndex ); virtual ~Hurd160Engine(); // Constructors and destructor. double flat(); // Returns a pseudo random number between 0 and 1 void flatArray( const int size, double* vect ); // Fills the array "vect" of specified size with flat random values. void setSeed( long seed, int ); // Sets the state of the algorithm according to seed. void setSeeds( const long* seeds, int ); // Sets the state of the algorithm according to the zero-terminated // array of seeds. void saveStatus( const char filename[] = "Hurd160Engine.conf" ) const; // Saves on named file the current engine status void restoreStatus( const char filename[] = "Hurd160Engine.conf" ); // Reads from named file the last saved engine status // and restores it. void showStatus() const; // Dumps the engine status on the screen operator float(); // flat value, without worrying about filling bits operator unsigned int(); // 32-bit flat value, quickest of all virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); std::string name() const; static std::string engineName() {return "Hurd160Engine";} static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); std::vector put () const; bool get (const std::vector & v); bool getState (const std::vector & v); static const unsigned int VECTOR_STATE_SIZE = 7; private: static int numEngines; static int maxIndex; void advance(); int wordIndex; unsigned int words[5]; }; // Hurd160Engine } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif // Hurd160Engine_h clhep-2.1.4.1.orig/Random/Random/RanluxEngine.h0000755000175000017500000001107711406204345017615 0ustar olesoles// $Id: RanluxEngine.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RanluxEngine --- // class header file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // // The algorithm for this random engine has been taken from the original // implementation in FORTRAN by Fred James as part of the MATHLIB HEP // library. // The initialisation is carried out using a Multiplicative Congruential // generator using formula constants of L'Ecuyer as described in "F.James, // Comp. Phys. Comm. 60 (1990) 329-344". // ======================================================================= // Adeyemi Adesanya - Created: 6th November 1995 // Gabriele Cosmo - Adapted & Revised: 22nd November 1995 // Adeyemi Adesanya - Added setSeeds() method: 2nd February 1996 // Gabriele Cosmo - Added flatArray() method: 8th February 1996 // - Added methods for engine status: 19th November 1996 // - Added default luxury value for setSeed() // and setSeeds(): 21st July 1997 // J.Marraffino - Added stream operators and related constructor. // Added automatic seed selection from seed table and // engine counter: 14th Feb 1998 // Ken Smith - Added conversion operators: 6th Aug 1998 // Mark Fischler Methods put, get for instance save/restore 12/8/04 // Mark Fischler methods for anonymous save/restore 12/27/04 // ======================================================================= #ifndef RanluxEngine_h #define RanluxEngine_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" namespace CLHEP { /** * @author * @ingroup random */ class RanluxEngine : public HepRandomEngine { public: RanluxEngine( std::istream& is ); RanluxEngine(); RanluxEngine( long seed, int lux = 3 ); RanluxEngine( int rowIndex, int colIndex, int lux ); virtual ~RanluxEngine(); // Constructors and destructor // Luxury level is set in the same way as the original FORTRAN routine. // level 0 (p=24): equivalent to the original RCARRY of Marsaglia // and Zaman, very long period, but fails many tests. // level 1 (p=48): considerable improvement in quality over level 0, // now passes the gap test, but still fails spectral test. // level 2 (p=97): passes all known tests, but theoretically still // defective. // level 3 (p=223): DEFAULT VALUE. Any theoretically possible // correlations have very small chance of being observed. // level 4 (p=389): highest possible luxury, all 24 bits chaotic. double flat(); // It returns a pseudo random number between 0 and 1, // excluding the end points. void flatArray (const int size, double* vect); // Fills the array "vect" of specified size with flat random values. void setSeed(long seed, int lux=3); // Sets the state of the algorithm according to seed. void setSeeds(const long * seeds, int lux=3); // Sets the state of the algorithm according to the zero terminated // array of seeds. Only the first seed is used. void saveStatus( const char filename[] = "Ranlux.conf" ) const; // Saves on file Ranlux.conf the current engine status. void restoreStatus( const char filename[] = "Ranlux.conf" ); // Reads from file Ranlux.conf the last saved engine status // and restores it. void showStatus() const; // Dumps the engine status on the screen. int getLuxury() const { return luxury; } // Gets the luxury level. operator unsigned int(); // 32-bit flat, but slower than double or float virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); std::string name() const; static std::string engineName() {return "RanluxEngine";} std::vector put () const; bool get (const std::vector & v); bool getState (const std::vector & v); static const unsigned int VECTOR_STATE_SIZE = 31; private: int nskip, luxury; float float_seed_table[24]; int i_lag,j_lag; float carry; int count24; static const int int_modulus = 0x1000000; static int numEngines; static int maxIndex; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif clhep-2.1.4.1.orig/Random/Random/RandGeneral.h0000755000175000017500000001206511406204345017376 0ustar olesoles// $Id: RandGeneral.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGeneral --- // class header file // ----------------------------------------------------------------------- // Class defining methods for shooting generally distributed random values, // given a user-defined probability distribution function. // ======================================================================= // S.Magni & G.Pieri - Created: 29 April 1998 // G.Cosmo - Added constructor using default engine from the // static generator: 20 Aug 1998 // S.Magni & G.Pieri - Added linear interpolation: 24 March 1999 // M. Fischler - Added private methods that simplify the implementaion // prepareTables(), useFlatDistribution(), mapRandom() // - Added private variable oneOverNbins. // - Made the warning about shoot() not being static a tad // more prominent. 14 May 1999 // M Fischler - put and get to/from streams 12/15/04 // ======================================================================= #ifndef RandGeneral_h #define RandGeneral_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Utility/memory.h" #include namespace CLHEP { /** * @author * @ingroup random */ class RandGeneral : public HepRandom { public: RandGeneral ( const double* aProbFunc, int theProbSize, int IntType=0 ); RandGeneral ( HepRandomEngine& anEngine, const double* aProbFunc, int theProbSize, int IntType=0 ); RandGeneral ( HepRandomEngine* anEngine, const double* aProbFunc, int theProbSize, int IntType=0 ); // These constructors should be used to instantiate a RandGeneral // distribution object defining a local engine for it. // The static generator will be skipped by using the non-static methods // defined below. In case no engine is specified in the constructor, the // default engine used by the static generator is applied. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandGeneral destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandGeneral destructor. // The probability distribution function (Pdf) must be provided by the user // as an array of positive real number. The array size must also be // provided. The Pdf doesn't need to be normalized to 1. // if IntType = 0 ( default value ) a uniform random number is // generated using the engine. The uniform number is then transformed // to the user's distribution using the cumulative probability // distribution constructed from his histogram. The cumulative // distribution is inverted using a binary search for the nearest // bin boundary and a linear interpolation within the // bin. RandGeneral therefore generates a constant density within // each bin. // if IntType = 1 no interpolation is performed and the result is a // discrete distribution. virtual ~RandGeneral(); // Destructor // Methods to shoot random values using the static generator // N.B.: The methods are NOT static since they use nonstatic members // theIntegralPdf & nBins ///////////////////// // // // BIG RED WARNING // // // ///////////////////// // // The above N.B. is telling users that the shoot() methods in this // class are NOT STATIC. You cannot do // double x = RandGeneral::shoot(); // It would not make sense to provide a static shoot -- what would // the default probability function look like? inline double shoot(); inline void shootArray ( const int size, double* vect); // Methods to shoot random values using a given engine // by-passing the static generator. double shoot( HepRandomEngine* anEngine ); void shootArray ( HepRandomEngine* anEngine, const int size, double* vect ); // Methods using the localEngine to shoot random values, by-passing // the static generator. double fire(); void fireArray ( const int size, double* vect); double operator()(); // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandGeneral";} // Provides the name of this distribution class private: shared_ptr localEngine; std::vector theIntegralPdf; int nBins; double oneOverNbins; int InterpolationType; // Private methods to factor out replicated implementation sections void prepareTable(const double* aProbFunc); void useFlatDistribution(); double mapRandom(double rand) const; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandGeneral.icc" #endif clhep-2.1.4.1.orig/Random/Random/RandBreitWigner.h0000755000175000017500000001230311406204345020235 0ustar olesoles// $Id: RandBreitWigner.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandBreitWigner --- // class header file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // // Class defining methods for shooting numbers according to the // Breit-Wigner distribution algorithms (plain or mean^2). // Default values are set: mean=1, gamma=.2, cut=1. // Plain algorithm is used for shootArray() and fireArray(). // Plain algorithm with default values is used for operator()(). // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Added methods to shoot arrays: 28th July 1997 // J.Marraffino - Added default arguments as attributes and // operator() with arguments: 16th Feb 1998 // M Fischler - put and get to/from streams 12/10/04 // ======================================================================= #ifndef RandBreitWigner_h #define RandBreitWigner_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandFlat.h" #include "CLHEP/Utility/memory.h" namespace CLHEP { /** * @author * @ingroup random */ class RandBreitWigner : public HepRandom { public: inline RandBreitWigner ( HepRandomEngine& anEngine, double a=1.0, double b=0.2 ); inline RandBreitWigner ( HepRandomEngine* anEngine, double a=1.0, double b=0.2 ); // These constructors should be used to instantiate a RandBreitWigner // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandBreitWigner destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandBreitWigner destructor. virtual ~RandBreitWigner(); // Destructor // Static methods to shoot random values using the static generator static double shoot( double a=1.0, double b=0.2 ); static double shoot( double a, double b, double c ); static double shootM2( double a=1.0, double b=0.2 ); static double shootM2( double a, double b, double c ); static void shootArray ( const int size, double* vect); static void shootArray ( const int size, double* vect, double a, double b ); static void shootArray ( const int size, double* vect, double a, double b, double c ); // Static methods to shoot random values using a given engine // by-passing the static generator. static double shoot( HepRandomEngine* anEngine, double a=1.0, double b=0.2 ); static double shoot( HepRandomEngine* anEngine, double a, double b, double c ); static double shootM2( HepRandomEngine* anEngine, double a=1.0, double b=0.2 ); static double shootM2( HepRandomEngine* anEngine, double a, double b, double c ); static void shootArray ( HepRandomEngine* anEngine, const int size, double* vect ); static void shootArray ( HepRandomEngine* anEngine, const int size, double* vect, double a, double b ); static void shootArray ( HepRandomEngine* anEngine, const int size, double* vect, double a, double b, double c ); // Methods using the localEngine to shoot random values, by-passing // the static generator. These methods respect distribution parameters // passed by the user at instantiation unless superseded by actual // arguments in the call. double fire(); double fire( double a, double b ); double fire( double a, double b, double c ); double fireM2(); double fireM2( double a, double b ); double fireM2( double a, double b, double c ); void fireArray ( const int size, double* vect); void fireArray ( const int size, double* vect, double a, double b ); void fireArray ( const int size, double* vect, double a, double b, double c ); double operator()(); double operator()( double a, double b ); double operator()( double a, double b, double c ); // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandBreitWigner";} // Provides the name of this distribution class private: shared_ptr localEngine; double defaultA; double defaultB; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandBreitWigner.icc" #endif clhep-2.1.4.1.orig/Random/Random/RandGaussZiggurat.h0000644000175000017500000001233712236214257020624 0ustar olesoles/* Code adapted from: http://www.jstatsoft.org/v05/i08/ Original disclaimer: The ziggurat method for RNOR and REXP Combine the code below with the main program in which you want normal or exponential variates. Then use of RNOR in any expression will provide a standard normal variate with mean zero, variance 1, while use of REXP in any expression will provide an exponential variate with density exp(-x),x>0. Before using RNOR or REXP in your main, insert a command such as zigset(86947731 ); with your own choice of seed value>0, rather than 86947731. (If you do not invoke zigset(...) you will get all zeros for RNOR and REXP.) For details of the method, see Marsaglia and Tsang, "The ziggurat method for generating random variables", Journ. Statistical Software. */ #ifndef RandGaussZiggurat_h #define RandGaussZiggurat_h 1 #include "cmath" #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandGauss.h" namespace CLHEP { /** * @author ATLAS * @ingroup random */ class RandGaussZiggurat : public RandGauss { public: inline RandGaussZiggurat ( HepRandomEngine& anEngine, double mean=0.0, double stdDev=1.0 ); inline RandGaussZiggurat ( HepRandomEngine* anEngine, double mean=0.0, double stdDev=1.0 ); // Destructor virtual ~RandGaussZiggurat(); // Static methods to shoot random values using the static generator static inline float shoot() {return ziggurat_RNOR(HepRandom::getTheEngine());}; static inline float shoot( float mean, float stdDev ) {return shoot()*stdDev + mean;}; static void shootArray ( const int size, float* vect, float mean=0.0, float stdDev=1.0 ); static void shootArray ( const int size, double* vect, double mean=0.0, double stdDev=1.0 ); // Static methods to shoot random values using a given engine // by-passing the static generator. static inline float shoot( HepRandomEngine* anotherEngine ) {return ziggurat_RNOR(anotherEngine);}; static inline float shoot( HepRandomEngine* anotherEngine, float mean, float stdDev ) {return shoot(anotherEngine)*stdDev + mean;}; static void shootArray ( HepRandomEngine* anotherEngine, const int size, float* vect, float mean=0.0, float stdDev=1.0 ); static void shootArray ( HepRandomEngine* anotherEngine, const int size, double* vect, double mean=0.0, double stdDev=1.0 ); // Instance methods using the localEngine to instead of the static // generator, and the default mean and stdDev established at construction inline float fire() {return ziggurat_RNOR(localEngine.get()) * defaultStdDev + defaultMean;}; inline float fire ( float mean, float stdDev ) {return ziggurat_RNOR(localEngine.get()) * stdDev + mean;}; void fireArray ( const int size, float* vect); void fireArray ( const int size, double* vect); void fireArray ( const int size, float* vect, float mean, float stdDev ); void fireArray ( const int size, double* vect, double mean, double stdDev ); virtual double operator()(); virtual double operator()( double mean, double stdDev ); // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandGaussZiggurat";} // Provides the name of this distribution class static bool ziggurat_init(); protected: ////////////////////////// // Ziggurat Original code: ////////////////////////// //static unsigned long jz,jsr=123456789; // //#define SHR3 (jz=jsr, jsr^=(jsr<<13), jsr^=(jsr>>17), jsr^=(jsr<<5),jz+jsr) //#define UNI (.5 + (signed) SHR3*.2328306e-9) //#define IUNI SHR3 // //static long hz; //static unsigned long iz, kn[128], ke[256]; //static float wn[128],fn[128], we[256],fe[256]; // //#define RNOR (hz=SHR3, iz=hz&127, (fabs(hz)flat();}; static inline float ziggurat_RNOR(HepRandomEngine* anEngine) { long hz=(signed)ziggurat_SHR3(anEngine); unsigned long iz=hz&127; return ((unsigned long)abs(hz) * @ingroup random */ class RandFlat : public HepRandom { public: inline RandFlat ( HepRandomEngine& anEngine ); inline RandFlat ( HepRandomEngine& anEngine, double width ); inline RandFlat ( HepRandomEngine& anEngine, double a, double b ); inline RandFlat ( HepRandomEngine* anEngine ); inline RandFlat ( HepRandomEngine* anEngine, double width ); inline RandFlat ( HepRandomEngine* anEngine, double a, double b ); // These constructors should be used to instantiate a RandFlat // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandFlat destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandFlat destructor. virtual ~RandFlat(); // Destructor // Static methods to shoot random values using the static generator static double shoot(); static inline double shoot( double width ); static inline double shoot( double a, double b ); static inline long shootInt( long n ); static inline long shootInt( long a1, long n ); static inline int shootBit(); static void shootArray ( const int size, double* vect ); static void shootArray ( const int size, double* vect, double lx, double dx ); // Static methods to shoot random values using a given engine // by-passing the static generator. static inline double shoot ( HepRandomEngine* anEngine ); static inline double shoot( HepRandomEngine* anEngine, double width ); static inline double shoot( HepRandomEngine* anEngine, double a, double b ); static inline long shootInt( HepRandomEngine* anEngine, long n ); static inline long shootInt( HepRandomEngine* anEngine, long a1, long n ); static inline int shootBit( HepRandomEngine* ); static inline void shootArray ( HepRandomEngine* anEngine, const int size, double* vect ); static void shootArray ( HepRandomEngine* anEngine, const int size, double* vect, double lx, double dx ); // Methods using the localEngine to shoot random values, by-passing // the static generator. inline double fire(); inline double fire( double width ); inline double fire( double a, double b ); inline long fireInt( long n ); inline long fireInt( long a1, long n ); inline int fireBit(); void fireArray (const int size, double* vect); void fireArray (const int size, double* vect, double lx, double dx); double operator()(); double operator()( double width ); double operator()( double a, double b ); // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandFlat";} // Provides the name of this distribution class // Methods overriding the base class static saveEngineStatus ones, // by adding extra data so that save in one program, then further shootBit()s // will produce the identical sequence to restore in another program, then // generating shootBit() randoms there static void saveEngineStatus( const char filename[] = "Config.conf" ); // Saves to file the current status of the current engine. static void restoreEngineStatus( const char filename[] = "Config.conf" ); // Restores a saved status (if any) for the current engine. static std::ostream& saveFullState ( std::ostream & os ); // Saves to stream the state of the engine and cached data. static std::istream& restoreFullState ( std::istream & is ); // Restores from stream the state of the engine and cached data. static std::ostream& saveDistState ( std::ostream & os ); // Saves to stream the state of the cached data. static std::istream& restoreDistState ( std::istream & is ); // Restores from stream the state of the cached data. protected: #if 0 // Protected copy constructor. Defining it here disallows use by users. RandFlat(const RandFlat& d); #endif // 0 private: // ShootBits generates an integer random number, // which is used by fireBit(). // The number is stored in randomInt and firstUnusedBit inline void fireBits(); static inline void shootBits(); static inline void shootBits(HepRandomEngine*); // In MSB, the most significant bit of the integer random number // generated by ShootBits() is set. // Note: // the number of significant bits must be chosen so that // - an unsigned long can hold it // - and it should be less than the number of bits returned // by Shoot() which are not affected by precision problems // on _each_ architecture. // (Aim: the random generators should be machine-independent). static const unsigned long MSB; static const int MSBBits; // These two are set up in RandFlat.cc and need not be saved/restored unsigned long randomInt; unsigned long firstUnusedBit; static unsigned long staticRandomInt; static unsigned long staticFirstUnusedBit; shared_ptr localEngine; double defaultWidth; double defaultA; double defaultB; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandFlat.icc" #endif clhep-2.1.4.1.orig/Random/Random/MTwistEngine.h0000755000175000017500000000701211406204345017565 0ustar olesoles// $Id: MTwistEngine.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- MTwistEngine --- // class header file // ----------------------------------------------------------------------- // A "fast, compact, huge-period generator" based on M. Matsumoto and // T. Nishimura, "Mersenne Twister: A 623-dimensionally equidistributed // uniform pseudorandom number generator", to appear in ACM Trans. on // Modeling and Computer Simulation. It is a twisted GFSR generator // with a Mersenne-prime period of 2^19937-1, uniform on open interval (0,1) // For further information, see http://www.math.keio.ac.jp/~matumoto/emt.html // ======================================================================= // Ken Smith - Started initial draft: 14th Jul 1998 // - Optimized to get pow() out of flat() method: 21st Jul // - Added conversion operators: 6th Aug 1998 // M Fischler - Changes in way powers of two are kept: 16-Sep-1998 // Mark Fischler - Methods for distrib. instance save/restore 12/8/04 // Mark Fischler methods for anonymous save/restore 12/27/04 // ======================================================================= #ifndef MTwistEngine_h #define MTwistEngine_h #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" namespace CLHEP { /** * @author * @ingroup random */ class MTwistEngine : public HepRandomEngine { public: MTwistEngine(); MTwistEngine( long seed ); MTwistEngine( int rowIndex, int colIndex ); MTwistEngine( std::istream & is ); virtual ~MTwistEngine(); // Constructors and destructor. double flat(); // Returns a pseudo random number between 0 and 1 (excluding the end points). void flatArray(const int size, double* vect); // Fills an array "vect" of specified size with flat random values. void setSeed(long seed, int); // Sets the state of the algorithm according to seed. void setSeeds(const long * seeds, int); // Sets the state of the algorithm according to the zero terminated // array of seeds. It is allowed to ignore one or many seeds in this array. void saveStatus( const char filename[] = "MTwist.conf") const; // Saves the current engine status in the named file void restoreStatus( const char filename[] = "MTwist.conf" ); // Reads from named file the the last saved engine status and restores it. void showStatus() const; // Dumps the current engine status on the screen. operator float(); // returns flat, without worrying about filling bits operator unsigned int(); // 32-bit flat, quickest of all virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); std::string name() const; static std::string engineName() {return "MTwistEngine";} std::vector put () const; bool get (const std::vector & v); bool getState (const std::vector & v); static const unsigned int VECTOR_STATE_SIZE = 626; private: unsigned int mt[624]; int count624; enum{ NminusM = 227, M = 397, N = 624}; static int numEngines; static int maxIndex; }; // MTwistEngine } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif // MTwistEngine_h clhep-2.1.4.1.orig/Random/Random/JamesRandom.h0000755000175000017500000000743711406204345017423 0ustar olesoles// $Id: JamesRandom.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- HepJamesRandom --- // class header file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // // HepJamesRandom implements the algorithm by Marsaglia-Zaman RANMAR // described in "F.James, Comp. Phys. Comm. 60 (1990) 329" and implemented // in FORTRAN77 as part of the MATHLIB HEP library for pseudo-random // numbers generation. // This is the default random engine invoked by each distribution unless // the user sets a different one. // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Minor corrections: 31st October 1996 // - Added methods for engine status: 19th November 1996 // - setSeed(), setSeeds() now have default dummy argument // set to zero: 11th July 1997 // J.Marraffino - Added stream operators and related constructor. // Added automatic seed selection from seed table and // engine counter: 16th Feb 1998 // Ken Smith - Added conversion operators: 6th Aug 1998 // V. Innocente - changed pointers to indices 3 may 2000 // Mark Fischler - Methods for distrib. instance save/restore 12/8/04 // Mark Fischler methods for anonymous save/restore 12/27/04 // ======================================================================= #ifndef HepJamesRandom_h #define HepJamesRandom_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" namespace CLHEP { /** * @author * @ingroup random */ class HepJamesRandom: public HepRandomEngine { public: HepJamesRandom(std::istream& is); HepJamesRandom(); HepJamesRandom(long seed); HepJamesRandom(int rowIndex, int colIndex); virtual ~HepJamesRandom(); // Constructor and destructor. double flat(); // Returns a pseudo random number between 0 and 1 // (excluding the end points) void flatArray (const int size, double* vect); // Fills the array "vect" of specified size with flat random values. void setSeed(long seed, int dum=0); // Sets the state of the algorithm according to seed. void setSeeds(const long * seeds, int dum=0); // Sets the state of the algorithm according to the zero terminated // array of seeds. Only the first seed is used. void saveStatus( const char filename[] = "JamesRand.conf" ) const; // Saves on file JamesRand.conf the current engine status. void restoreStatus( const char filename[] = "JamesRand.conf" ); // Reads from file JamesRand.conf the last saved engine status // and restores it. void showStatus() const; // Dumps the engine status on the screen. operator unsigned int(); // 32-bit flat, but slower than double or float. virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); std::string name() const; static std::string engineName() {return "HepJamesRandom";} std::vector put () const; bool get (const std::vector & v); bool getState (const std::vector & v); static const unsigned int VECTOR_STATE_SIZE = 202; private: // Members defining the current status of the generator. double u[97]; double c, cd, cm; int i97, j97; static int numEngines; static int maxIndex; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif clhep-2.1.4.1.orig/Random/Random/CMakeLists.txt0000644000175000017500000000233512221102474017573 0ustar olesoles set( pkginclude_HEADERS DoubConv.hh DRand48Engine.h DualRand.h EngineFactory.h engineIDulong.h Hurd160Engine.h Hurd288Engine.h JamesRandom.h MTwistEngine.h NonRandomEngine.h RandBinomial.h RandBinomial.icc RandBit.h RandBit.icc RandBreitWigner.h RandBreitWigner.icc RandChiSquare.h RandChiSquare.icc RandEngine.h RandExponential.h RandExponential.icc RandExpZiggurat.h RandFlat.h RandFlat.icc RandGamma.h RandGamma.icc RandGauss.h RandGauss.icc RandGaussQ.h RandGaussQ.icc RandGaussT.h RandGaussT.icc RandGaussZiggurat.h RandGeneral.h RandGeneral.icc RandLandau.h RandLandau.icc RandomEngine.h RandomEngine.icc Random.h Random.icc Randomize.h RandomFunc.h RandPoisson.h RandPoisson.icc RandPoissonQ.h RandPoissonQ.icc RandPoissonT.h RandPoissonT.icc RandSkewNormal.h RandSkewNormal.icc RandStudentT.h RandStudentT.icc RanecuEngine.h Ranlux64Engine.h RanluxEngine.h RanshiEngine.h SeedTable.h Stat.h StaticRandomStates.h TripleRand.h ) # notice that defs.h is not referenced here INSTALL (FILES ${pkginclude_HEADERS} DESTINATION include/CLHEP/Random ) clhep-2.1.4.1.orig/Random/Random/RandPoisson.h0000755000175000017500000001031411761721356017460 0ustar olesoles// $Id: RandPoisson.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandPoisson --- // class header file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // Class defining methods for shooting numbers according to the Poisson // distribution, given a mean (Algorithm taken from "W.H.Press et al., // Numerical Recipes in C, Second Edition". // Default mean value is set to 1, value used for operator()(). // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Added not static Shoot() method: 17th May 1996 // - Algorithm now operates on doubles : 31st Oct 1996 // - Added methods to shoot arrays: 28th July 1997 // J.Marraffino - Added default mean as attribute and // operator() with mean: 16th Feb 1998 // Gabriele Cosmo - Relocated static data from HepRandom: 5th Jan 1999 // M. Fischler - Moved meanMax and defaultMean from private to protected // to accomodate derived classes RandPoissonQ & RandPoissonT // M Fischler - put and get to/from streams 12/10/04 // ======================================================================= #ifndef RandPoisson_h #define RandPoisson_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Utility/memory.h" namespace CLHEP { /** * @author * @ingroup random */ class RandPoisson : public HepRandom { public: inline RandPoisson ( HepRandomEngine& anEngine, double a1=1.0 ); inline RandPoisson ( HepRandomEngine* anEngine, double a1=1.0 ); // These constructors should be used to instantiate a RandPoisson // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandPoisson destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandPoisson destructor. virtual ~RandPoisson(); // Destructor // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); // Static methods to shoot random values using the static generator static long shoot( double m=1.0 ); static void shootArray ( const int size, long* vect, double m=1.0 ); // Static methods to shoot random values using a given engine // by-passing the static generator. static long shoot( HepRandomEngine* anEngine, double m=1.0 ); static void shootArray ( HepRandomEngine* anEngine, const int size, long* vect, double m=1.0 ); // Methods using the localEngine to shoot random values, by-passing // the static generator. long fire(); long fire( double m ); void fireArray ( const int size, long* vect ); void fireArray ( const int size, long* vect, double m); double operator()(); double operator()( double m ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandPoisson";} // Provides the name of this distribution class protected: double meanMax; double defaultMean; static double getOldMean() {return oldm_st;} static double getMaxMean() {return meanMax_st;} static void setOldMean( double val ){oldm_st = val;} static double* getPStatus() {return status_st;} static void setPStatus(double sq, double alxm, double g1) { status_st[0] = sq; status_st[1] = alxm; status_st[2] = g1; } inline HepRandomEngine* getLocalEngine(); private: shared_ptr localEngine; double status[3], oldm; // static data static double status_st[3]; static double oldm_st; static const double meanMax_st; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandPoisson.icc" #endif clhep-2.1.4.1.orig/Random/Random/RandGamma.h0000755000175000017500000000770711406204345017052 0ustar olesoles// $Id: RandGamma.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGamma --- // class header file // ----------------------------------------------------------------------- // Class defining methods for shooting gamma distributed random values, // given a k (default=1) and specifying also a lambda (default=1). // Default values are used for operator()(). // Valid input values are k > 0 and lambda > 0. When invalid values are // presented, the code silently returns -1.0. // ======================================================================= // John Marraffino - Created: 12th May 1998 Based on the C-Rand package // by Ernst Stadlober and Franz Niederl of the Technical // University of Graz, Austria. // Gabriele Cosmo - Removed useless methods and data: 5th Jan 1999 // M Fischler - put and get to/from streams 12/10/04 // ======================================================================= #ifndef RandGamma_h #define RandGamma_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Utility/memory.h" namespace CLHEP { /** * @author * @ingroup random */ class RandGamma : public HepRandom { public: inline RandGamma ( HepRandomEngine& anEngine, double k=1.0, double lambda=1.0 ); inline RandGamma ( HepRandomEngine* anEngine, double k=1.0, double lambda=1.0 ); // These constructors should be used to instantiate a RandGamma // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandGamma destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandGamma destructor. virtual ~RandGamma(); // Destructor // Static methods to shoot random values using the static generator static inline double shoot(); static double shoot( double k, double lambda ); static void shootArray ( const int size, double* vect, double k=1.0, double lambda=1.0 ); // Static methods to shoot random values using a given engine // by-passing the static generator. static inline double shoot( HepRandomEngine* anEngine ); static double shoot( HepRandomEngine* anEngine, double k, double lambda ); static void shootArray ( HepRandomEngine* anEngine, const int size, double* vect, double k=1.0, double lambda=1.0 ); // Methods using the localEngine to shoot random values, by-passing // the static generator. inline double fire(); double fire( double k, double lambda ); void fireArray ( const int size, double* vect); void fireArray ( const int size, double* vect, double k, double lambda ); inline double operator()(); inline double operator()( double k, double lambda ); // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandGamma";} // Provides the name of this distribution class private: static double genGamma( HepRandomEngine *anEngine, double k, double lambda ); shared_ptr localEngine; double defaultK; double defaultLambda; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandGamma.icc" #endif clhep-2.1.4.1.orig/Random/Random/RandGamma.icc0000755000175000017500000000273311406204345017353 0ustar olesoles// $Id: RandGamma.icc,v 1.3 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGamma --- // inlined functions implementation file // ----------------------------------------------------------------------- // ======================================================================= // Gabriele Cosmo - Created: 19th August 1998 // ======================================================================= namespace CLHEP { inline RandGamma::RandGamma(HepRandomEngine & anEngine, double k, double lambda ) : HepRandom(), localEngine(&anEngine, do_nothing_deleter()), defaultK(k), defaultLambda(lambda) {} inline RandGamma::RandGamma(HepRandomEngine * anEngine, double k, double lambda ) : HepRandom(), localEngine(anEngine), defaultK(k), defaultLambda(lambda) {} inline double RandGamma::shoot() { return shoot( 1.0, 1.0 ); } inline double RandGamma::shoot( HepRandomEngine* anEngine ) { return shoot( anEngine, 1.0, 1.0 ); } inline double RandGamma::operator()() { return fire( defaultK, defaultLambda ); } inline double RandGamma::operator()( double k, double lambda ) { return fire( k, lambda ); } inline double RandGamma::fire() { return fire( defaultK, defaultLambda ); } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/DualRand.h0000755000175000017500000001150111406204345016700 0ustar olesoles// $Id: DualRand.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // Hep Random // --- DualRand --- // class header file // ----------------------------------------------------------------------- // // Canopy random number generator DualRand // Re-written as C++ routine for 32-bit ints MF 1/26/98 // // Exclusive or of a feedback shift register and integer congruence // random number generator. The feedback shift register uses offsets // 127 and 97. The integer congruence generator uses a different // multiplier for each stream. The multipliers are chosen to give // full period and maximum "potency" for modulo 2^32. The period of // the combined random number generator is 2^159 - 2^32, and the // sequences are different for each stream (not just started in a // different place). // // ======================================================================= // Canopy random number generator DualRand. // Doug Toussaint 5/25/88 // Optimized by GMH 7/26/88 // Optimized by GMH 7/26/88 // Repaired by GMH 12/1/88 to update modular congruence state // Put into ranlib by GMH 6/23/89 // Re-written as C++ routine for 32-bit ints MF 1/26/98 // Re-written for CLHEP package KLS 6/04/98 // Removed pow() from flat method for speed KLS 7/21/98 // Ken Smith - Added conversion operators: 6th Aug 1998 // Mark Fischler methods for distrib. instance save/restore 12/8/04 // Mark Fischler methods for anonymous save/restore 12/27/04 // Mark Fischler - methods for vector save/restore 3/7/05 // ======================================================================= #ifndef DualRand_h #define DualRand_h #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" namespace CLHEP { /** * @author * @ingroup random */ class DualRand: public HepRandomEngine { public: DualRand(); DualRand(long seed); DualRand(std::istream & is); DualRand(int rowIndex, int colIndex); virtual ~DualRand(); // let the compiler generate the copy constructors //DualRand(const DualRand & p); //DualRand & operator=(const DualRand & p); double flat(); // Returns a pseudo random number between 0 and 1 // (excluding the end points) void flatArray(const int size, double * vect); // Fills an array "vect" of specified size with flat random values. void setSeed(long seed, int); // Sets the state of the algorithm according to seed. void setSeeds(const long * seeds, int); // Sets the state of the algorithm according to the zero-terminated // array of seeds. void saveStatus( const char filename[] = "DualRand.conf") const; // Saves on named file the current engine status. void restoreStatus( const char filename[] = "DualRand.conf" ); // Reads from named file the last saved engine status and restores it. void showStatus() const; // Dumps the current engine status on the screen. operator float(); // flat value, without worrying about filling bits operator unsigned int(); // 32-bit flat value, quickest of all virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); std::string name() const; static std::string engineName() {return "DualRand";} std::vector put () const; bool get (const std::vector & v); bool getState (const std::vector & v); static const unsigned int VECTOR_STATE_SIZE = 9; private: static int numEngines; // This generator is composed of two others combined: class Tausworthe { public: Tausworthe(); Tausworthe(unsigned int seed); operator unsigned int(); void put(std::ostream & os) const; void put(std::vector & v) const; void get(std::istream & is); bool get(std::vector::const_iterator & iv); private: int wordIndex; unsigned int words[4]; }; // Tausworthe class IntegerCong { public: IntegerCong(); IntegerCong(unsigned int seed, int streamNumber); operator unsigned int(); void put(std::ostream & os) const; void put(std::vector & v) const; void get(std::istream & is); bool get(std::vector::const_iterator & iv); private: unsigned int state, multiplier, addend; }; // IntegerCong Tausworthe tausworthe; IntegerCong integerCong; }; // DualRand } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif // DualRand_h clhep-2.1.4.1.orig/Random/Random/Ranlux64Engine.h0000755000175000017500000001033711406204345017765 0ustar olesoles// $Id: Ranlux64Engine.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- Ranlux64Engine --- // class header file // ----------------------------------------------------------------------- // The algorithm for this random engine has been taken from the notes of // a double-precision ranlux implementation by Martin Luscher, dated // November 1997. // // Like the previous ranlux generator, this one also has "luxury" levels, // determining how many pseudo-random numbers are discarded for every // twelve values used. Three levels are given, with the note that Luscher // himself advocates only the highest two levels for this engine. // level 0 (p=109): Throw away 109 values for every 12 used // level 1 (p=202): (default) Throw away 202 values for every 12 used // level 2 (p=397): Throw away 397 values for every 12 used // // The initialization is carried out using a Multiplicative Congruential // generator using formula constants of L'Ecuyer as described in "F.James, // Comp. Phys. Comm. 60 (1990) 329-344". // ======================================================================= // Ken Smith - Created Initial draft: 14th Jul 1998 // - Added conversion operators: 6th Aug 1998 // Mark Fischler // 9/9/98 - Added update() routine to allow computation of many at once // - Replaced algorithm with jone exactly matching Luscher: // 48-bits generated // skip n-12 instead of n numbers // - Corrected protection agains overflow // 12/8/04 - Methods for instance save/restore // 12/27/04 - methods for anonymous save/restore 12/27/04 // // ======================================================================= #ifndef Ranlux64Engine_h #define Ranlux64Engine_h #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" namespace CLHEP { /** * @author * @ingroup random */ class Ranlux64Engine : public HepRandomEngine { public: Ranlux64Engine( std::istream& is ); Ranlux64Engine(); Ranlux64Engine( long seed, int lux = 1 ); Ranlux64Engine( int rowIndex, int colIndex, int lux ); virtual ~Ranlux64Engine(); // Constructors and destructor double flat(); // It returns a pseudo random number between 0 and 1, // excluding the end points. void flatArray (const int size, double* vect); // Fills the array "vect" of specified size with flat random values. void setSeed(long seed, int lux=1); // Sets the state of the algorithm according to seed. void setSeeds(const long * seeds, int lux=1); // Sets the state of the algorithm according to the zero terminated // array of seeds. Only the first seed is used. void saveStatus( const char filename[] = "Ranlux64.conf" ) const; // Saves in named file the current engine status. void restoreStatus( const char filename[] = "Ranlux64.conf" ); // Reads from named file the last saved engine status and restores it. void showStatus() const; // Dumps the engine status on the screen. int getLuxury() const { return luxury; } // Gets the luxury level. virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); std::string name() const; static std::string engineName() {return "Ranlux64Engine";} std::vector put () const; bool get (const std::vector & v); bool getState (const std::vector & v); static const unsigned int VECTOR_STATE_SIZE = 30; private: void update(); void advance(int dozens); int pDiscard; // separate sequence by p-r = p-12 discarded elements int pDozens; // pDiscard / 12; int endIters; // pDiscard % 12; int luxury; int index; double randoms[12]; // randoms [i] is the x[n-i] of Luscher's note double carry; static int numEngines; static int maxIndex; }; // Ranlux64Engine } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif // Ranlux64Engine_h clhep-2.1.4.1.orig/Random/Random/Hurd288Engine.h0000755000175000017500000000717411406204345017513 0ustar olesoles// $Id: Hurd288Engine.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- Hurd288Engine --- // class header file // ----------------------------------------------------------------------- // The starting point for the Hurd Random algorithm is the paper in // IEEE Transactions on Computers c23, 2 Feb 1974. The algorithm is // essentially a series of 32 interconnected b-bit registers. The basic // property is that at each step, bit 1 becomes bit 0, bit 2 the new bit 1, // bit b the new bit b-1. This is modified so that the new bit b0 is the old // bit b1 XOR'd with some bit b-d from the previous bit register. The values // of d can be chosen so as to generate a primitive polynomial, a maximal // length sequence through all bit patterns except the zero pattern. // // This generator, Hurd288, use values based upon Table I of the afore- // mentioned paper, such that we have 288 total bits, representing 32 // 9-bit registers (actually implemented as an array of 9 32-bit words) // ======================================================================= // 07-23-98 KLS Initial draft started // Ken Smith - Added conversion operators: 6th Aug 1998 // Mark Fischler - methods for distrib. instacne save/restore 12/8/04 // Mark Fischler - methods for anonymous save/restore 12/27/04 // ======================================================================= #ifndef Hurd288Engine_h #define Hurd288Engine_h #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" namespace CLHEP { /** * @author * @ingroup random */ class Hurd288Engine: public HepRandomEngine { public: Hurd288Engine(); Hurd288Engine( std::istream &is ); Hurd288Engine( long seed ); Hurd288Engine( int rowIndex, int colIndex ); virtual ~Hurd288Engine(); // Constructors and destructor. double flat(); // Returns a pseudo random number between 0 and 1 void flatArray( const int size, double* vect ); // Fills the array "vect" of specified size with flat random values. void setSeed( long seed, int ); // Sets the state of the algorithm according to seed. void setSeeds( const long* seeds, int ); // Sets the state of the algorithm according to the zero-terminated // array of seeds. void saveStatus( const char filename[] = "Hurd288Engine.conf" ) const; // Saves on named file the current engine status void restoreStatus( const char filename[] = "Hurd288Engine.conf" ); // Reads from named file the last saved engine status // and restores it. void showStatus() const; // Dumps the engine status on the screen operator float(); // flat value, without worrying about filling bits operator unsigned int(); // 32-bit flat value, quickest of all virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); std::string name() const; static std::string engineName() {return "Hurd288Engine";} std::vector put () const; bool get (const std::vector & v); bool getState (const std::vector & v); static const unsigned int VECTOR_STATE_SIZE = 11; private: static int numEngines; static int maxIndex; void advance(); int wordIndex; unsigned int words[9]; }; // Hurd288Engine } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif // Hurd288Engine_h clhep-2.1.4.1.orig/Random/Random/RanecuEngine.h0000755000175000017500000001132011421362612017547 0ustar olesoles// $Id: RanecuEngine.h,v 1.6 2010/07/20 18:06:02 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RanecuEngine --- // class header file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // // RANECU Random Engine - algorithm originally written in FORTRAN77 // as part of the MATHLIB HEP library. // The initialisation is carried out using a Multiplicative Congruential // generator using formula constants of L'Ecuyer as described in "F.James, // Comp. Phys. Comm. 60 (1990) 329-344". // Seeds are taken from a seed table given an index, the getSeed() method // returns the current index in the seed table, the getSeeds() method // returns a pointer to the couple of seeds stored in the local table of // seeds at the current index. // ======================================================================= // Gabriele Cosmo - Created: 2nd February 1996 // - Minor corrections: 31st October 1996 // - Added methods for engine status: 19th November 1996 // - setSeed() now has default dummy argument // set to zero: 11th July 1997 // - Added default index to setSeeds(): 16th Oct 1997 // J.Marraffino - Added stream operators and related constructor. // Added automatic seed selection from seed table and // engine counter: 16th Feb 1998 // Ken Smith - Added conversion operators: 6th Aug 1998 // Mark Fischler Methods for distrib. instance save/restore 12/8/04 // Mark Fischler methods for anonymous save/restore 12/27/04 // ======================================================================= #ifndef RanecuEngine_h #define RanecuEngine_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" namespace CLHEP { /** * @author * @ingroup random */ class RanecuEngine : public HepRandomEngine { public: RanecuEngine(std::istream& is); RanecuEngine(); RanecuEngine(int index); virtual ~RanecuEngine(); // Constructors and destructor. double flat(); // Returns a pseudo random number between 0 and 1 // (excluding the end points) void flatArray (const int size, double* vect); // Fills an array "vect" of specified size with flat random values. void setIndex (long index); // Sets the state of the algorithm according to "index", the position // in the local table of seeds. void setSeed (long index, int dum=0); // Resets the state of the algorithm according to "index", the position // in the static table of seeds stored in HepRandom. void setSeeds (const long* seeds, int index=-1); // Sets the state of the algorithm according to the array of seeds // "seeds" containing two seed values to be stored in the local table at // "index" position. void saveStatus( const char filename[] = "Ranecu.conf" ) const; // Saves on file Ranecu.conf the current engine status. void restoreStatus( const char filename[] = "Ranecu.conf" ); // Reads from file Ranecu.conf the last saved engine status // and restores it. void showStatus() const; // Dumps the engine status on the screen. operator unsigned int(); // 32-bit int flat, faster in this case virtual std::ostream & put (std::ostream & os) const; virtual std::istream & get (std::istream & is); static std::string beginTag ( ); virtual std::istream & getState ( std::istream & is ); std::string name() const; static std::string engineName() {return "RanecuEngine";} std::vector put () const; bool get (const std::vector & v); bool getState (const std::vector & v); protected: // Suggested L'ecuyer coefficients for portable 32 bits generators. static const int ecuyer_a = 40014; static const int ecuyer_b = 53668; static const int ecuyer_c = 12211; static const int ecuyer_d = 40692; static const int ecuyer_e = 52774; static const int ecuyer_f = 3791; static const int shift1 = 2147483563; static const int shift2 = 2147483399; static const unsigned int VECTOR_STATE_SIZE = 4; private: // private method used to mitigate the effects of using a lookup table void further_randomize (int seq, int col, int index, int modulus); // Members defining the current state of the generator. static const int maxSeq = 215; long table[215][2]; int seq; static int numEngines; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif clhep-2.1.4.1.orig/Random/Random/RandSkewNormal.h0000644000175000017500000000667411570005551020111 0ustar olesoles// $Id: RandSkewNormal.h,v 1.1 2011/05/27 20:36:28 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandSkewNormal --- // class header file // ----------------------------------------------------------------------- // RandSkewNormal --- // returns a skew-normal distribution with shape parameter k // To get a distribution with scale parameter b and location m: // r = m + b * RandSkewNormal.fire(k); // http://azzalini.stat.unipd.it/SN/ // algorithm from K. McFarlane, June 2010. // ======================================================================= // M Fischler and L Garren - Created: 26 May 2011 // ======================================================================= #ifndef RandSkewNormal_h #define RandSkewNormal_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Utility/memory.h" namespace CLHEP { /** * @author * @ingroup random */ class RandSkewNormal : public HepRandom { public: inline RandSkewNormal ( HepRandomEngine& anEngine, double shape=0. ); inline RandSkewNormal ( HepRandomEngine* anEngine, double shape=0. ); // These constructors should be used to instantiate a RandSkewNormal // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandSkewNormal destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandSkewNormal destructor. virtual ~RandSkewNormal(); // Destructor // Static methods to shoot random values using the static generator static double shoot(); static double shoot( double shape ); static void shootArray ( const int size, double* vect, double shape=0. ); // Static methods to shoot random values using a given engine // by-passing the static generator. static double shoot( HepRandomEngine* anEngine ); static double shoot( HepRandomEngine* anEngine, double shape ); static void shootArray ( HepRandomEngine* anEngine, const int size, double* vect, double shape=0. ); // Methods using the localEngine to shoot random values, by-passing // the static generator. double fire(); double fire( double shape ); void fireArray ( const int size, double* vect ); void fireArray ( const int size, double* vect, double shape ); double operator()(); double operator()( double shape ); // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandSkewNormal";} // Provides the name of this distribution class protected: static double gaussianSkewNormal ( HepRandomEngine *e, double k); double getShapeParameter() { return shapeParameter; } inline HepRandomEngine* getLocalEngine(); private: shared_ptr localEngine; double shapeParameter; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandSkewNormal.icc" #endif clhep-2.1.4.1.orig/Random/Random/RandSkewNormal.icc0000644000175000017500000000176511570005551020414 0ustar olesoles// $Id: RandSkewNormal.icc,v 1.1 2011/05/27 20:36:28 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandSkewNormal --- // inlined functions implementation file // ----------------------------------------------------------------------- // ======================================================================= // M Fischler and L Garren - Created: 26 May 2011 // ======================================================================= namespace CLHEP { RandSkewNormal::RandSkewNormal(HepRandomEngine & anEngine, double shape ) : HepRandom(), localEngine(&anEngine, do_nothing_deleter()), shapeParameter(shape) {} RandSkewNormal::RandSkewNormal(HepRandomEngine * anEngine, double shape ) : HepRandom(), localEngine(anEngine), shapeParameter(shape) {} HepRandomEngine * RandSkewNormal::getLocalEngine() { return localEngine.get(); } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/RandGaussQ.h0000755000175000017500000000757311406204345017234 0ustar olesoles// $Id: RandGaussQ.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGaussQ --- // class header file // ----------------------------------------------------------------------- // Class defining methods RandGaussQ, which is derived from RandGauss. // The user interface is identical; but RandGaussQ is faster and a bit less // accurate. // ======================================================================= // M. Fischler - Created: 24th Jan 2000 // M Fischler - put and get to/from streams 12/10/04 // // ======================================================================= #ifndef RandGaussQ_h #define RandGaussQ_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandGauss.h" namespace CLHEP { /** * @author * @ingroup random */ class RandGaussQ : public RandGauss { public: inline RandGaussQ ( HepRandomEngine& anEngine, double mean=0.0, double stdDev=1.0 ); inline RandGaussQ ( HepRandomEngine* anEngine, double mean=0.0, double stdDev=1.0 ); // These constructors should be used to instantiate a RandGaussQ // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandGaussQ destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandGaussQ destructor. // Destructor virtual ~RandGaussQ(); // // Methods to generate Gaussian-distributed random deviates: // // If a fast good engine takes 1 usec, RandGauss::fire() adds 1 usec while // RandGaussQ::fire() adds only .4 usec. // // Static methods to shoot random values using the static generator static inline double shoot(); static inline double shoot( double mean, double stdDev ); static void shootArray ( const int size, double* vect, double mean=0.0, double stdDev=1.0 ); // Static methods to shoot random values using a given engine // by-passing the static generator. static inline double shoot( HepRandomEngine* anotherEngine ); static inline double shoot( HepRandomEngine* anotherEngine, double mean, double stdDev ); static void shootArray ( HepRandomEngine* anotherEngine, const int size, double* vect, double mean=0.0, double stdDev=1.0 ); // Instance methods using the localEngine to instead of the static // generator, and the default mean and stdDev established at construction inline double fire(); inline double fire ( double mean, double stdDev ); void fireArray ( const int size, double* vect); void fireArray ( const int size, double* vect, double mean, double stdDev ); virtual double operator()(); virtual double operator()( double mean, double stdDev ); // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandGaussQ";} // Provides the name of this distribution class protected: static double transformQuick (double r); static double transformSmall (double r); private: // All the engine info, and the default mean and sigma, are in the RandGauss // base class. }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandGaussQ.icc" #endif clhep-2.1.4.1.orig/Random/Random/EngineFactory.h0000644000175000017500000000200510233771102017734 0ustar olesoles// $Id // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- EngineFactory --- // class header file // ----------------------------------------------------------------------- // Class generating new engines from streamed saves. // ======================================================================= // M Fischler - Created: 12/21/04 // ======================================================================= #ifndef EngineFactory_h #define EngineFactory_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" namespace CLHEP { class EngineFactory { public: static HepRandomEngine* newEngine(std::istream & is); static HepRandomEngine* newEngine(std::vector const & v); }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif clhep-2.1.4.1.orig/Random/Random/RandGauss.h0000755000175000017500000001330511406204345017101 0ustar olesoles// $Id: RandGauss.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGauss --- // class header file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // Class defining methods for shooting gaussian distributed random values, // given a mean (default=0) or specifying also a deviation (default=1). // Gaussian random numbers are generated two at the time, so every // other time shoot is called the number returned is the one generated the // time before. // Default values are used for operator()(). // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Minor corrections: 31st October 1996 // - Added methods to shoot arrays: 28th July 1997 // J.Marraffino - Added default arguments as attributes and // operator() with arguments. Introduced method normal() // for computation in fire(): 16th Feb 1998 // Gabriele Cosmo - Relocated static data from HepRandom: 5th Jan 1999 // M Fischler - put and get to/from streams 12/8/04 // ======================================================================= #ifndef RandGauss_h #define RandGauss_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Utility/memory.h" namespace CLHEP { /** * @author * @ingroup random */ class RandGauss : public HepRandom { public: inline RandGauss ( HepRandomEngine& anEngine, double mean=0.0, double stdDev=1.0 ); inline RandGauss ( HepRandomEngine* anEngine, double mean=0.0, double stdDev=1.0 ); // These constructors should be used to instantiate a RandGauss // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandGauss destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandGauss destructor. virtual ~RandGauss(); // Destructor // Static methods to shoot random values using the static generator static double shoot(); static inline double shoot( double mean, double stdDev ); static void shootArray ( const int size, double* vect, double mean=0.0, double stdDev=1.0 ); // Static methods to shoot random values using a given engine // by-passing the static generator. static double shoot( HepRandomEngine* anEngine ); static inline double shoot( HepRandomEngine* anEngine, double mean, double stdDev ); static void shootArray ( HepRandomEngine* anEngine, const int size, double* vect, double mean=0.0, double stdDev=1.0 ); // Methods using the localEngine to shoot random values, by-passing // the static generator. double fire(); inline double fire( double mean, double stdDev ); void fireArray ( const int size, double* vect); void fireArray ( const int size, double* vect, double mean, double stdDev ); virtual double operator()(); virtual double operator()( double mean, double stdDev ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandGauss";} // Provides the name of this distribution class // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); // Methods setFlag(false) and setF(false) if invoked in the client // code before shoot/fire will force generation of a new couple of // values. static bool getFlag() {return set_st;} static void setFlag( bool val ) {set_st = val;} bool getF() const {return set;} void setF( bool val ) {set = val;} // Methods overriding the base class static saveEngineStatus ones, // by adding extra data so that save in one program, then further gaussians, // will produce the identical sequence to restore in another program, then // generating gaussian randoms there static void saveEngineStatus( const char filename[] = "Config.conf" ); // Saves to file the current status of the current engine. static void restoreEngineStatus( const char filename[] = "Config.conf" ); // Restores a saved status (if any) for the current engine. static std::ostream& saveFullState ( std::ostream & os ); // Saves to stream the state of the engine and cached data. static std::istream& restoreFullState ( std::istream & is ); // Restores from stream the state of the engine and cached data. static std::ostream& saveDistState ( std::ostream & os ); // Saves to stream the state of the cached data. static std::istream& restoreDistState ( std::istream & is ); // Restores from stream the state of the cached data. protected: static double getVal() {return nextGauss_st;} static void setVal( double nextVal ) {nextGauss_st = nextVal;} double normal(); double defaultMean; double defaultStdDev; shared_ptr localEngine; private: bool set; double nextGauss; // static data static bool set_st; static double nextGauss_st; }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandGauss.icc" #endif clhep-2.1.4.1.orig/Random/Random/RandomEngine.icc0000755000175000017500000000421311461345007020067 0ustar olesoles// $Id: RandomEngine.icc,v 1.4 2010/10/25 18:18:47 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- HepRandomEngine --- // inlined functions implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Added == and != operators: 19th November 1996 // - Moved seeds table to HepRandom: 19th March 1998 // ======================================================================= #include namespace CLHEP { inline bool HepRandomEngine::operator==(const HepRandomEngine& engine) { return (this==&engine); } inline bool HepRandomEngine::operator!=(const HepRandomEngine& engine) { return (this!=&engine); } inline double HepRandomEngine::exponent_bit_32() { static double exponent_bit_32 = std::pow(2.0, 32.0); return exponent_bit_32; } inline double HepRandomEngine::mantissa_bit_12() { static double mantissa_bit_12 = std::pow(0.5, 12.0); return mantissa_bit_12; } inline double HepRandomEngine::mantissa_bit_24() { static double mantissa_bit_24 = std::pow(0.5, 24.0); return mantissa_bit_24; } inline double HepRandomEngine::twoToMinus_32() { static double twoToMinus_32 = std::ldexp(1.0, -32); return twoToMinus_32; } inline double HepRandomEngine::twoToMinus_48() { static double twoToMinus_48 = std::ldexp(1.0, -48); return twoToMinus_48; } inline double HepRandomEngine::twoToMinus_49() { static double twoToMinus_49 = std::ldexp(1.0, -49); return twoToMinus_49; } inline double HepRandomEngine::twoToMinus_53() { static double twoToMinus_53 = std::ldexp(1.0, -53); return twoToMinus_53; } inline double HepRandomEngine::nearlyTwoToMinus_54() { static double nearlyTwoToMinus_54 = std::ldexp(1.0, -54) - std::ldexp(1.0, -100); return nearlyTwoToMinus_54; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/RandBinomial.icc0000755000175000017500000000272511406204345020064 0ustar olesoles// $Id: RandBinomial.icc,v 1.3 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandBinomial --- // inlined functions implementation file // ----------------------------------------------------------------------- // ======================================================================= // Gabriele Cosmo - Created: 18th August 1998 // ======================================================================= namespace CLHEP { inline RandBinomial::RandBinomial(HepRandomEngine & anEngine, long n, double p ) : HepRandom ( ), localEngine( &anEngine, do_nothing_deleter() ), defaultN(n), defaultP(p) {} inline RandBinomial::RandBinomial(HepRandomEngine * anEngine, long n, double p ) : HepRandom ( ), localEngine( anEngine), defaultN(n), defaultP(p) {} inline double RandBinomial::shoot() { return shoot( 1, 0.5 ); } inline double RandBinomial::shoot( HepRandomEngine* anEngine ) { return shoot( anEngine, 1, 0.5 ); } inline double RandBinomial::operator()() { return fire( defaultN, defaultP ); } inline double RandBinomial::operator()( long n, double p ) { return fire( n, p ); } inline double RandBinomial::fire() { return fire( defaultN, defaultP ); } } // namespace CLHEP clhep-2.1.4.1.orig/Random/Random/RandPoissonQ.h0000755000175000017500000001241511761721356017605 0ustar olesoles// $Id: RandPoissonQ.h,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandPoissonQ --- // class header file // ----------------------------------------------------------------------- // Class defining RandPoissonQ, which is derived from RandPoison. // The user interface is identical; but RandGaussQ is much faster in all cases // and a bit less accurate when mu > 100. // ======================================================================= // M. Fischler - Created: 4th Feb 2000 // M Fischler - put and get to/from streams 12/10/04 // // ======================================================================= #ifndef RandPoissonQ_h #define RandPoissonQ_h 1 #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Random/RandPoisson.h" namespace CLHEP { /** * @author * @ingroup random */ class RandPoissonQ : public RandPoisson { public: inline RandPoissonQ ( HepRandomEngine& anEngine, double b1=1.0 ); inline RandPoissonQ ( HepRandomEngine* anEngine, double b1=1.0 ); // These constructors should be used to instantiate a RandPoissonQ // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandPoissonQ destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandPoissonQ destructor. virtual ~RandPoissonQ(); // Destructor // Save and restore to/from streams std::ostream & put ( std::ostream & os ) const; std::istream & get ( std::istream & is ); // Methods to generate Poisson-distributed random deviates. // The method used for mu <= 100 is exact, and 3-7 times faster than // that used by RandPoisson. // For mu > 100 then we use a corrected version of a // (quick) Gaussian approximation. Naively that would be: // // Poisson(mu) ~ floor( mu + .5 + Gaussian(sqrt(mu)) ) // // but actually, that would give a slightly incorrect sigma and a // very different skew than a true Poisson. Instead we return // // Poisson(mu) ~ floor( a0*mu + a1*g + a2*g*g ) ) // (with g a gaussian normal) // // where a0, a1, a2 are chosen to give the exctly correct mean, sigma, // and skew for the Poisson distribution. // Static methods to shoot random values using the static generator static long shoot( double m=1.0 ); static void shootArray ( const int size, long* vect, double m=1.0 ); // Static methods to shoot random values using a given engine // by-passing the static generator. static long shoot( HepRandomEngine* anEngine, double m=1.0 ); static void shootArray ( HepRandomEngine* anEngine, const int size, long* vect, double m=1.0 ); // Methods using the localEngine to shoot random values, by-passing // the static generator. long fire(); long fire( double m ); void fireArray ( const int size, long* vect ); void fireArray ( const int size, long* vect, double m); double operator()(); double operator()( double m ); std::string name() const; HepRandomEngine & engine(); static std::string distributionName() {return "RandPoissonQ";} // Provides the name of this distribution class // static constants of possible interest to users: // RandPoisson will never return a deviate greater than this value: static const double MAXIMUM_POISSON_DEVIATE; // Will be 2.0E9 static inline int tableBoundary(); private: // constructor helper void setupForDefaultMu(); // algorithm helper methods - all static since the shoot methods mayneed them static long poissonDeviateSmall ( HepRandomEngine * e, double mean ); static long poissonDeviateQuick ( HepRandomEngine * e, double mean ); static long poissonDeviateQuick ( HepRandomEngine * e, double A0, double A1, double A2, double sig ); // All the engine info, and the default mean, are in the // RandPoisson base class. // quantities for approximate Poisson by corrected Gaussian double a0; double a1; double a2; double sigma; // static data - constants only, so that saveEngineStatus works properly! // The following MUST MATCH the corresponding values used (in // poissonTables.cc) when poissonTables.cdat was created. // poissonTables.cc gets these values by including this header, // but we must be careful not to change these values, // and rebuild RandPoissonQ before re-generating poissonTables.cdat. // (These statics are given values near the start of the .cc file) static const double FIRST_MU; // lowest mu value in table static const double LAST_MU; // highest mu value static const double S; // Spacing between mu values static const int BELOW; // Starting point for N is at mu - BELOW static const int ENTRIES; // Number of entries in each mu row }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Random/RandPoissonQ.icc" #endif clhep-2.1.4.1.orig/Random/Random-config.in0000755000175000017500000000404612234340066016637 0ustar olesoles#! /bin/sh # @configure_input@ # we include the paths of the original install directories for reference orig_prefix="@prefix@" orig_exec_prefix="@exec_prefix@" orig_includedir="@includedir@" # use the full name of this script to get the current path configpath=`dirname ${0}` # check for a leading slash to determine if this is a relative path firstc=`expr ${configpath} : "\/"` calldir=`pwd` if [ ${firstc} -eq 0 ] then cd "${calldir}/${configpath}"; newpath=`pwd` binpath=${newpath} else binpath=${configpath} fi # OK - now we have to strip the trailing "/bin" out of the path prefix=`dirname "${binpath}"` includedir=${prefix}/include libdir=${prefix}/lib usage() { cat < /configure --prefix= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make check (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # configure options #------------------------------------------------------------- A variety of options can be given to configure. Below is a list of the options that you are likely to find most useful. --help provides a partial list of options --prefix=PREFIX install architecture-independent files in PREFIX [default is /usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [default is the same as PREFIX] --disable-shared build only static libraries --disable-static build only shared libraries --enable-exceptions use the CLHEP/Exceptions package --disable-exceptions DO NOT use the CLHEP/Exceptions package [--disable-exceptions is the default] #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are neither built nor installed automatically. Use the following commands to build and install documents: make docs make install-docs #------------------------------------------------------------- # building from cvs #------------------------------------------------------------- You will need current versions of automake, autoconf, and libtool. See building autotools below. cvs co CLHEP/package OR cvs co package cd [CLHEP/]package ./bootstrap Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building autotools #------------------------------------------------------------- If you do not have at least autoconf 2.59 and automake 1.9.1, you will need to build autoconf, automake, and libtool. On some platforms, you may also need to build m4 and texinfo. Download the relevant tarballs from gnu.org (http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/, and http://www.gnu.org/software/libtool/) Untar them in a common source code tree. Decide whether you want to install them in /usr/local or your own install directory. If you use your own install directory, use --prefix= with configure. For each autotool package: /configure [--prefix=] make make install Make sure that /bin is at the front of your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/Random/Makefile.am0000755000175000017500000000447210233771102015657 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP # put . first so that CLHEP directory is built before anything else SUBDIRS = Random . src test # list all subdirectories - for distribution and cleaning DIST_SUBDIRS = Random . src test doc bin_SCRIPTS = Random-config all-local: $(top_builddir)/CLHEP # create temporary CLHEP header tree # we only copy headers for packages listed in @PACKAGE@-deps # search for header directories in the following order: # 1. $(top_builddir)/this-package # 2. $(top_builddir)/../other-packages # 3. $(CLHEPSOURCE_DIR)/CLHEP # 4. $(CLHEP_DIR)/include/CLHEP # # abs_ => absolute path abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ COPY_P = @COPY_P@ $(top_builddir)/CLHEP: temp-package-dirs @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ if test -d "$$pkg" ; then \ (cd $$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d ../"$$pkg"/"$$pkg" ; then \ (cd ../$$pkg/$$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg"; then \ hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ else \ if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/include/CLHEP; then \ if test -d $(CLHEP_DIR)/include/CLHEP/"$$pkg"; then \ hdrs=`ls $(CLHEP_DIR)/include/CLHEP/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEP_DIR)/include/CLHEP/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ fi; \ fi; \ fi; \ fi; \ fi; \ done; temp-package-dirs: $(mkinstalldirs) $(abs_top_builddir)/CLHEP; @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ $(mkinstalldirs) $(abs_top_builddir)/CLHEP/$$pkg; \ done; docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs # extra clean rule clean-local: rm -rf $(top_builddir)/CLHEP clhep-2.1.4.1.orig/Random/bootstrap0000755000175000017500000000071510233771102015557 0ustar olesoles#! /bin/sh set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 rm -f Makefile.in */Makefile.in */defs.h.in rm -f autotools/config* autotools/depcomp autotools/install-sh autotools/m* rm -f configure config.* # run autotool commands aclocal -I autotools autoheader automake --add-missing --copy autoconf # ready to make a source code distribution tarball clhep-2.1.4.1.orig/Random/configure.ac0000755000175000017500000002761612241267303016122 0ustar olesoles# ====================================================================== # This is the Random configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.59) AC_INIT(CLHEP Random, 2.1.4.1, http://savannah.cern.ch/projects/clhep/, Random) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([src/DRand48Engine.cc]) AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # ---------------------------------------------------------------------- # --enable-shared and --enable-static # both shared and static libraries are built by default # ---------------------------------------------------------------------- AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Header containing #defines: AM_CONFIG_HEADER([Random/defs.h]) # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Random/Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([doc/Makefile]) AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([Random-deps]) AC_CONFIG_FILES([Random/copy-header.pl], [chmod +x Random/copy-header.pl]) # Configuration inquiry program/script: AC_CONFIG_FILES([Random-config], [chmod +x Random-config]) # Test driver program/script: AC_CONFIG_FILES([test/testRandDists.sh], [chmod +x test/testRandDists.sh]) AC_CONFIG_FILES([test/testRandom.sh], [chmod +x test/testRandom.sh]) AC_CONFIG_FILES([test/gaussSmall.sh], [chmod +x test/gaussSmall.sh]) AC_CONFIG_FILES([test/gaussSpeed.sh], [chmod +x test/gaussSpeed.sh]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- Random_CPPFLAGS="-I$includedir" Random_LDFLAGS="-L$libdir" Random_LIBS="-lCLHEP-$PACKAGE-$VERSION" AC_SUBST(Random_CPPFLAGS) AC_SUBST(Random_LIBS) AC_SUBST(Random_LDFLAGS) TARGET=$target AC_SUBST(TARGET) # ---------------------------------------------------------------------- # Supply boilerplate for Random/defs.h source header: # ---------------------------------------------------------------------- AH_TOP([#ifndef RANDOM_DEFS_H #define RANDOM_DEFS_H]) ## the undefs are converted by configure AH_VERBATIM([PACKAGE],[/* Name of package */ #ifndef PACKAGE #undef PACKAGE #endif]) AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif]) AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */ #ifndef PACKAGE_NAME #undef PACKAGE_NAME #endif]) AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #undef PACKAGE_STRING #endif]) AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif]) AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */ #ifndef PACKAGE_VERSION #undef PACKAGE_VERSION #endif]) AH_VERBATIM([VERSION],[/* Version number of package */ #ifndef VERSION #undef VERSION #endif]) AH_BOTTOM([#endif // RANDOM_DEFS_H]) # ---------------------------------------------------------------------- # Account for any user configuration options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; icc) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Set system-dependent options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed libraries: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed header files: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed typedefs, structures, and compiler characteristics: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed library functions: # ---------------------------------------------------------------------- AC_CHECK_FUNCS([drand48]) # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/Random/COPYING.LESSER0000644000175000017500000001674311406204345015656 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/Random/Random-deps.in0000755000175000017500000000022711406204345016321 0ustar olesolesCLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Units-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Utility-@VERSION@ clhep-2.1.4.1.orig/Random/doc/0000755000175000017500000000000012242515140014356 5ustar olesolesclhep-2.1.4.1.orig/Random/doc/Random.html0000755000175000017500000012052607705060311016500 0ustar olesoles CLHEP - HEP Random
 

HEP Random

release 2.1.1 - Thu, Jan 28 1999


  1. Introduction.
  2. Classes description.
  3. Distribution Classes description & examples.
  4. Design Issues.

1. Introduction

The HEP Random module originally part of GEANT4, has been designed and developed starting from the Random class of MC++, the CLHEP's HepRandom module with no persistency and the Rogue Wave approach in Math.h++ package.
The current release consists of 24 classes implementing 12 different random engines and 10 different random distributions.
Each random distribution belongs to a different distribution-class which can collect different algorithms and different calling sequence for each method to define distribution parameters or range-intervals.
Each distribution-class collects also methods to fill arrays of specified size of distributed random values.

There are 3 different ways of shooting random values:

  • Using the static generator defined in HepRandom:
    random values are shooted using static methods shoot() defined for each distribution class. The static generator will use as default engine an HepJamesRandom global object and the user can set its properties or change it with a new instantiated engine object by using the static methods defined in HepRandom.
    The static generator is a singleton; createInstance() is the method to invoke to create it.
  • Skiping the static generator and specifying an engine object:
    random values are shooted using static methods shoot(*HepRandomEngine) defined for each distribution class. The user must instantiate an engine object and give it as argument to the shoot method. The generator mechanism will be then by-passed by using the basic flat() method of the specified engine.
    The user must take care of the engine objects he/she instantiates.
  • Skiping the static generator and instantiating a distribution object:
    random values are shooted using methods fire() (NOT static) defined for each distribution class. The user must instantiate a distribution object giving as argument to the constructor an engine by pointer or by reference.
    Doing so, the engine will be associated to the distribution object and the generator mechanism will be by-passed by using the basic flat() method of that engine. If the engine is passed by pointer the corresponding engine object will be deleted by the distribution's destructor, if passed by reference it will not be deleted by the distribution's destructor.
  • 2. Classes description

    HepRandomEngine
    Is the abstract class defining the interface for each random engine. It implements the getSeed() and getSeeds() methods which return the initial seed value and the initial array of seeds respectively. It defines 7 pure virtual functions: flat(), flatArray(), setSeed(), setSeeds(), saveStatus(), restoreStatus() and showStatus(), which are implemented by the concrete random engines each one inheriting from this abstract class.
    Many concrete random engines can be defined and added to the structure, simply making them inheriting from HepRandomEngine and defining concrete methods for them in such a way that flat() and flatArray() return double random values ranging between ]0,1[.
    All the random engines have a default seed value already set. They can however be instantiated with a different seed value set up by the user. The user, whenever necessary, can initialise the engine with a new seed by either using a static method defined in HepRandom, or the methods to set seeds defined in the engine itself.
    Methods saveStatus() and restoreStatus() can be used to save to file the current status of an engine and restore it from a previous saved configuration.
    The showStatus() method dumps on screen the status of the engine currently in use.
    All these methods can be called statically from HepRandom or directly at engine level.

    HepJamesRandom
    This class implements the algorithm described in "F.James, Comp. Phys. Comm. 60 (1990) 329" for pseudo-random numbers generation.
    This is the default random engine for the static generator; it will be invoked by each distribution class unless the user sets a different one.
    The engine state can be streamed through ad-hoc defined stream operators << and >>.

    DRand48Engine
    Random engine using the drand48() and srand48() system functions from C standard library to implement the flat() basic distribution and for setting seeds respectively.
    DRand48Engine uses the seed48() function from C standard library to retrieve the current internal status of the generator, which is represented by 3 short values. Copies of an object of this kind are not allowed.
    The engine state can be streamed through ad-hoc defined stream operators << and >>.

    RandEngine
    Simple random engine using the rand() and srand() system functions from C standard library to implement the flat() basic distribution and for setting seeds respectively.
    To keep track of the current status of an engine of this kind, a counter is used and its value is stored as data-member. Copies of an object of this kind are not allowed.
    The engine state can be streamed through ad-hoc defined stream operators << and >>.

    RanluxEngine
    The algorithm for RanluxEngine has been taken from the original implementation in FORTRAN77 by Fred James, part of the MATHLIB HEP library.
    The initialisation is carried out using a Multiplicative Congruential generator using formula constants of L'Ecuyer as described in "F.James, Comp. Phys. Comm. 60 (1990) 329-344". It provides 5 different luxury levels:

  • level 0 (p=24): equivalent to the original RCARRY of Marsaglia and Zaman, very long period, but fails many tests.
  • level 1 (p=48): considerable improvement in quality over level 0, now passes the gap test, but still fails spectral test.
  • level 2 (p=97): passes all known tests, but theoretically still defective.
  • level 3 (p=223): DEFAULT value. Any theoretically possible correlations have very small chance of being observed.
  • level 4 (p=389): highest possible luxury, all 24 bits chaotic.
  • When instantiating a RanluxEngine, the user can specify the luxury level to the constructor (if not, the default value is taken):
      ex. ...
         RanluxEngine theRanluxEngine(seed,4);
         // instantiates an engine with "seed" and the best luxury-level
          ... or
         RanluxEngine theRanluxEngine;
         // instatiates an engine with default seed value and luxury-level 3
          ...
    
    The class provides a method getLuxury() to get the engine luxury level.
    The SetSeed() and SetSeeds() methods can be invoked specifying the luxury level:
      ex. ...
         HepRandom::setTheSeed(seed,4);  // sets the seed to "seed" and luxury
                                         // to 4
         HepRandom::setTheSeed(seed);  // sets the seed to "seed" keeping the
                                       // current luxury level
    
    The engine state can be streamed through ad-hoc defined stream operators << and >>.

    Ranlux64Engine
    The algorithm for this random engine has been taken from the notes of a double-precision ranlux implementation by Martin Luscher, dated November 1997.
    This engine has "luxury" levels, determining how many pseudo-random numbers are discarded for every twelve values used. Three levels are given, with the note that Luscher himself advocates only the highest two levels for this engine.

  • level 0 (p=109): Throw away 109 values for every 12 used
  • level 1 (p=202): DEFAULT. Throw away 202 values for every 12 used
  • level 2 (p=397): Throw away 397 values for every 12 used
  • The initialization is carried out using a Multiplicative Congruential generator using formula constants of L'Ecuyer as described in "F.James, Comp. Phys. Comm. 60 (1990) 329-344".
    The engine state can be streamed through ad-hoc defined stream operators << and >>.

    RanecuEngine
    The algorithm for RanecuEngine is taken from the one originally written in FORTRAN77 as part of the MATHLIB HEP library. The initialisation is carried out using a Multiplicative Congruential generator using formula constants of L'Ecuyer as described in "F.James, Comp. Phys. Comm. 60 (1990) 329-344".
    Seeds are taken from SeedTable given an index, the getSeed() method returns the current index of SeedTable. The setSeeds() method will set seeds in the local SeedTable at a given position index (if the index number specified exceeds the table's size, (index%size) is taken):

      ex. ...
         int index=n;
         long seeds[2];
         const long* table;
         table = HepRandom::getTheSeeds();
           // it returns a pointer "table" to the local SeedTable at the
           // current "index" position
         ...
         HepRandom::setTheSeeds(seeds,index);
           // sets the new "index" for seeds and modify the values inside
           // the local SeedTable at the "index" position. If the index is
           // not specified, the current index in the table is considered.
         ...
    
    The setSeed() method resets the current status of the engine to the original seeds stored in the static table of seeds in HepRandom, at the specified index.
    The engine state can be streamed through ad-hoc defined stream operators << and >>.

    Hurd160Engine
    The starting point for the Hurd Random algorithm is the paper in "IEEE Transactions on Computers c23, 2 Feb 1974". The algorithm is essentially a series of 32 interconnected b-bit registers. The basic property is that at each step, bit 1 becomes bit 0, bit 2 the new bit 1, bit b the new bit b-1. This is modified so that the new bit b0 is the old bit b1 XOR'd with some bit b-d from the previous bit register. The values of d can be chosen so as to generate a primitive polynomial, a maximal length sequence through all bit patterns except the zero pattern.
    This engine uses values based upon Table I of the afore mentioned paper, such that we have 160 total bits, representing 32 5-bit registers (actually implemented as an array of 5 32-bit words).
    The engine state can also be streamed through ad-hoc defined stream operators << and >>.

    Hurd288Engine
    The algorithm adopted for this engine is essentially the same as for Hurd160Engine, except that it acts over a number of 288 total bits, representing 32 9-bit registers (actually implemented as an array of 9 32-bit words).
    The engine state can be streamed through ad-hoc defined stream operators << and >>.

    MTwistEngine
    The algorithm for this random engine is based on the article by M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator", to appear in ACM Trans. on Modeling and Computer Simulation.
    It is a twisted GFSR generator with a Mersenne-prime period of 2^19937-1, uniform on open interval (0,1).
    For further information, see www.math.keio.ac.jp/~matumoto/emt.html.
    The engine state can be streamed through ad-hoc defined stream operators << and >>.

    RanshiEngine
    The algorithm for this random engine was taken from "F.Gutbrod, Comp. Phys. Comm. 87 (1995) 291-306".
    As figurative explanation of the algorithm, imagine a physical system as follows: 512 "black balls" each with their own unique spin, and positions characterized by discrete angles, where the spin is a 32-bit unsigned integer. A "red ball" collides based upon the angle determined by the last 8 bits of its spin, and the spin of the colliding ball is taken as the output random number. The spin of the colliding ball is replaced then with the left circular shift of the black ball's spin XOR'd with the red ball's spin. The black ball's old spin becomes the red ball's.
    To avoid the traps presented, two measures are taken: first, the red ball will oscillate between hitting the lower half of the buffer on one turn and the upper half on another; second, the red ball's spin is incremented by a counter of the number of random numbers produced.
    The result is scaled to a double precision floating point number to which is added another random double further scaled 2^(53-32) places to the right in order to ensure that the remaining bits of the result are not left empty due to the mere 32 bits representation used internally.
    The engine state can be streamed through ad-hoc defined stream operators << and >>.

    DualRand Engine
    This is a 32-bit C++ implementation of the Canopy random number generator DualRand: exclusive-or of a feedback shift register and integer congruence random number generator.
    The feedback shift register uses offsets 127 and 97. The integer congruence generator uses a different multiplier for each stream. The multipliers are chosen to give full period and maximum potency for modulo 2^32. The period of the combined random number generator is 2^159 - 2^32, and the sequences are different for each stream (not just started in a different place).
    The engine state can be streamed through ad-hoc defined stream operators << and >>.

    TripleRand Engine
    TripleRand is canopy pseudo-random number generator. It uses the Tausworthe exclusive-or shift register, a simple Integer Coungruence generator, and the Hurd 288 total bit shift register, all XOR'd with each other.
    It behavies similarly to DualRand, with the addition of the Hurd288Engine. In addition to DualRand, this generator is amended to also add in the exclusive or of the 288-total bit Hurd engine which in this case is a series of 32 interconnected 9-bit shift registers, with the newest bit of each register formed by the XOR of the previous bit and some bit b-d from a previous register, where d is chosen to create a primitive polynomial to maximize the period.
    The engine state can be streamed through ad-hoc defined stream operators << and >>.

    HepRandom
    This is a singleton class, instantiated by default within the HEP Random module and using an HepJamesRandom engine as default algorithm for pseudo-random number generation.

    However, on some compilers the static instance of the HepRandom generator needs to be created explicitly in the client code. The static generator is assured to be correctly initialized by including the Randomize.h header in the client code, or by invoking explicitly the HepRandom::createInstance() static function before any usage of the Random classes.

      ex.
          HepRandom::createInstance();  // to force instantiation of static generator
                                        // before any usage of HepRandom classes!
    
    HepRandom defines a static private data member theGenerator and a set of static inlined methods to manipulate it. By means of theGenerator the user can change the underlying engine algorithm, get and set the seeds and use any kind of defined random distribution.
    The static methods setTheSeed() and getTheSeed() will set and get respectively the initial seed to the main engine used by the static generator.
    The static method getTheTableSeeds() returns the seeds stored in the global seedTable at the given position.
      ex.  ...
          HepRandom::setTheSeed(seed);  // to change the current seed to 'seed'
          int startSeed = HepRandom::getTheSeed();  // to get the current
           ...                                      // initial seed
          HepRandom::saveEngineStatus();    // to save the current engine status
                                            // on file.
          HepRandom::restoreEngineStatus(); // to restore the current engine to
                                            // a previous saved configuration.
          HepRandom::showEngineStatus();    // to display the current engine
                                            // status to the std output.
          ...
          int index=n;
          long seeds[2];
          HepRandom::getTheTableSeeds(seeds,index);
            // fills "seeds" with the values stored in the global seedTable
            // at position "index"
    
    Only one random engine can be active at a time, the user can decide at any time to change it, define a new one (if not done already) and set it:
      ex.  ...
          DRand48Engine theNewEngine;
          HepRandom::setTheEngine(&theNewEngine);
           ...
    
    or simply setting it to an old instantiated engine (the old engine status is kept and the new random sequence will start exactly from the last one previously interrupted):
      ex.  ...
          HepRandom::setTheEngine(&myOldEngine);
    

    3. Distribution Classes description & examples

    RandFlat
    Distribution-class defining methods for shooting flat random numbers, double or integers. It provides also methods to fill with double flat values arrays of specified size.

      ex.  ...
          double m,n;
          ...
          double fnum = RandFlat::shoot();         // fnum  ]0,1[
          double fnum = RandFlat::shoot(n);        // fnum  ]0,n[
          double fnum = RandFlat::shoot(-m,n);     // fnum  ]-m,n[
          long h,k;
          ...
          long inum = RandFlat::shootInt(k);       // inum  [0,k[
          long inum = RandFlat::shootInt(-h,k);    // inum  [-h,k[
          ...
          int i = RandFlat::shootBit();     // it returns just a bit (0 or 1)
          ...                               // of a random number
          const int size=n;
          double vect[size];
          RandFlat::shootArray(size,vect);  // to fill an array "vect" of n
                                            // double flat values
    
    A speculate set of static methods is provided to shoot random numbers from given random engines. Using these methods, the user is responsible of the state of the random engine(s) he/she is activating, since these methods act directly on the flat distribution provided by the engine, by-passing the HepRandom generator mechanism.
      ex.  ...
          RanecuEngine theRanecuEngine;
          double m,n;
          ...
          double fnum = RandFlat::shoot(&theRanecuEngine);      // fnum  ]0,1[
          double fnum = RandFlat::shoot(&theRanecuEngine,n);    // fnum  ]0,n[
          double fnum = RandFlat::shoot(&theRanecuEngine,-m,n); // fnum  ]-m,n[
          long h,k;
          ...
          long inum = RandFlat::shootInt(&theRanecuEngine,k);     // inum  [0,k[
          long inum = RandFlat::shootInt(&theRanecuEngine,-h,k); // inum  [-h,k[
           ...
          int i = RandFlat::shootBit(&theRanecuEngine); // it returns just a bit
          ...                                           // of a random number
          const int size=n;                       // to fill an array "vect"
          double vect[size];                      // of n double flat values
          RandFlat::shootArray(&theRanecuEngine,size,vect);
    
    A speculate set of fire()/fireArray() methods is provided to shoot random numbers via an instantiated RandFlat object. These methods act directly on the flat distribution provided by the engine given as argument to the constructor of RandFlat. These methods will by-pass the HepRandom generator mechanism. If the engine is passed by pointer to the constructor, the corresponding engine object will be deleted by the RandFlat destructor, if passed by reference it will not be deleted by the RandFlat destructor.
    An operator () corresponding to the fire() method is provided.
      ex.  ...
          RanecuEngine aRanecuEngine;
          RandFlat FlatDist(aRanecuEngine);
          double m,n;
          ...
          double fnum = FlatDist.fire();        // fnum  ]0,1[
          double fnum = FlatDist.fire(n);       // fnum  ]0,n[
          double fnum = FlatDist.fire(-m,n);    // fnum  ]-m,n[
          long h,k;
          ...
          long inum = FlatDist.fireInt(k);      // inum  [0,k[
          long inum = FlatDist.fireInt(-h,k);   // inum  [-h,k[
          ...
          int i = FlatDist.fireBit();       // it returns just a bit (0 or 1)
          ...                               // of a random number
          const int size=n;                     // to fill an array "vect"
          double vect[size];                    // of n double flat values
          FlatDist.fireArray(size,vect);
    
    RandExponential
    Distribution-class defining methods for shooting exponential distributed random values, given a mean (default mean = 1).
      ex.  ...
          double m;
          ...
          double num = RandExponential::shoot();   // (mean=1)
          double num = RandExponential::shoot(m);  // (mean=m)
    
    A speculate set of static methods is provided to shoot random numbers from given random engines. Using these methods, the user is responsible of the state of the random engine(s) he/she is activating, since these methods act directly on the flat distribution of the engine, by-passing the HepRandom generator mechanism.
      ex.  ...
          RanluxEngine theRanluxEngine(19780503,4);
          double m;
          ...
          double num = RandExponential::shoot(&theRanluxEngine);   // (mean=1)
          double num = RandExponential::shoot(&theRanluxEngine,m); // (mean=m)
    
    A speculate set of fire()/fireArray() methods is provided to shoot random numbers via an instantiated RandExponential object. These methods act directly on the flat distribution provided by the engine given as argument to the constructor of RandExponential; they will by-pass the HepRandom generator mechanism. If the engine is passed by pointer to the constructor, the corresponding engine object will be deleted by the RandExponential destructor, if passed by reference it will not be deleted by the RandExponential destructor.
    An operator () using the default mean value is provided.
      ex.  ...
          RanluxEngine aRanluxEngine(19780503,4);
          RandExponential ExpDist(aRanluxEngine);
          double m;
          ...
          double num = ExpDist.fire();   // (mean=1)
          double num = ExpDist.fire(m);  // (mean=m)
    
    RandGauss
    Distribution-class defining methods for shooting gaussian distributed random values, given a mean (default = 0) or specifying also a deviation (default = 1) . Gaussian random numbers are generated two at the time, so every other time shoot() or fire() is called the number returned is the one generated the time before.
      ex.  ...
          double m,s;
          ...
          double num = RandGauss::shoot();     // (mean=0)
          double num = RandGauss::shoot(m,s);  // (mean=m, stDev=s)
    
    A speculate set of static methods is provided to shoot random numbers from given random engines. Using these methods, the user is responsible of the state of the random engine(s) he/she is activating, since these methods act directly on the flat distribution of the engine, by-passing the HepRandom generator mechanism.
      ex.  ...
          RandEngine theRandEngine;
          double m,s;
          ...
          double num = RandGauss::shoot(&theRandEngine);
          double num = RandGauss::shoot(&theRandEngine,m,s);
    
    A speculate set of fire()/fireArray() methods is provided to shoot random numbers via an instantiated RandGauss object. These methods act directly on the flat distribution provided by the engine given as argument to the constructor of RandGauss; they will by-pass the HepRandom generator mechanism. If the engine is passed by pointer to the constructor, the corresponding engine object will be deleted by the RandGauss destructor, if passed by reference it will not be deleted by the RandGauss destructor.
    An operator () using default mean and deviation is provided.
      ex.  ...
          RandEngine aRandEngine;
          RandGauss GaussDist(aRandEngine);
          double m,s;
          ...
          double num = GaussDist.fire();
          double num = GaussDist.fire(m,s);
    
    RandBreitWigner
    Distribution-class defining methods for shooting numbers according to the Breit-Wigner distribution algorithms (plain or mean^2).
      ex.  ...
        double m,g,c;
        ...
        double num = RandBreitWigner::shoot(m,g);   // (mean=m, gamma=g)
        double num = RandBreitWigner::shoot(m,g,c); // (mean=m, gamma=g, cut=c)
    
    A speculate set of static methods is provided to shoot random numbers from given random engines. Using these methods, the user is responsible of the state of the random engine(s) he/she is activating, since these methods act directly on the flat distribution of the engine, by-passing the HepRandom generator mechanism.
      ex.  ...
        double m,g,c;
        DRand48Engine theDRand48Engine;
        ...
        double num = RandBreitWigner::shoot(&theDRand48Engine,m,g);
        double num = RandBreitWigner::shoot(&theDRand48Engine,m,g,c);
    
    A speculate set of fire()/fireArray() methods is provided to shoot random numbers via an instantiated RandBreitWigner object. These methods act directly on the flat distribution provided by the engine given as argument to the constructor of RandBreitWigner; they will by-pass the HepRandom generator mechanism. If the engine is passed by pointer to the constructor, the corresponding engine object will be deleted by the RandBreitWigner destructor, if passed by reference it will not be deleted by the RandBreitWigner destructor.
    An operator () using the plain algorithm and default values is provided.
      ex.  ...
        double m,g,c;
        DRand48Engine aDRand48Engine;
        RandBreitWigner BWDist(aDRand48Engine);
        ...
        double num = BWDist.fire(m,g);
        double num = BWDist.fire(m,g,c);
    
    RandPoisson
    Distribution-class defining methods for shooting numbers according to the Poisson distribution, given a mean (default = 1) (Algorithm taken from "W.H.Press et al., Numerical Recipes in C, Second Edition").
      ex.  ...
          double m;
          ...
          long num = RandPoisson::shoot(m);  // (mean=m)
    
    Other static methods are provided to shoot random numbers from given random engines. Using these methods, the user is responsible of the state of the random engine(s) he/she is activating, since these methods act directly on the flat distribution of the engine, by-passing the HepRandom generator mechanism.
      ex.  ...
          RanecuEngine theRanecuEngine;
          double m;
          ...
          long num = RandPoisson::shoot(&theRanecuEngine,m);  // (mean=m)
    
    Other fire()/fireArray() methods are provided to shoot random numbers via an instantiated RandPoisson object. These methods act directly on the flat distribution of the engine passed as argument to the constructor of RandPoisson; they will by-pass the HepRandom generator mechanism. If the engine is passed by pointer to the constructor, the corresponding engine object will be deleted by the RandPoisson destructor, if passed by reference it will not be deleted by the RandPoisson destructor.
    Operators () are provided.
      ex.  ...
          RanecuEngine aRanecuEngine;
          RandPoisson PoissonDist(aRanecuEngine);
          double m;
          ...
          long num = PoissonDist.fire(m);  // (mean=m)
    
    RandBinomial
    Class defining methods for shooting binomial distributed random values, given a sample size n (default=1) and a probability p (default=0.5). Default values are used for operator ().
    Valid input values satisfy the relation n*min(p,1-p) > 0. When invalid values are presented, the code silently returns -1.
      ex.  ...
          double n,p;
          ...
          double num = RandBinomial::shoot();        // (sample=1, prob=1)
          double num = RandBinomial::shoot(n,p);     // (sample=n, prob=p)
    
    A speculate set of static methods is provided to shoot random numbers from given random engines. Using these methods, the user is responsible of the state of the random engine(s) he/she is activating, since these methods act directly on the flat distribution of the engine, by-passing the HepRandom generator mechanism.
      ex.  ...
          RanshiEngine theRanshiEngine;
          double n,p;
          ...
          double num =
            RandBinomial::shoot(&theRanshiEngine);     // (sample=1, prob=1)
          double num =
            RandBinomial::shoot(&theRanshiEngine,n,p); // (sample=n, prob=p)
    
    A speculate set of fire()/fireArray() methods is provided to shoot random numbers via an instantiated RandBinomial object. These methods act directly on the flat distribution provided by the engine given as argument to the constructor of RandBinomial; they will by-pass the HepRandom generator mechanism. If the engine is passed by pointer to the constructor, the corresponding engine object will be deleted by the RandBinomial destructor, if passed by reference it will not be deleted by the RandBinomial destructor.
    Operators () are provided.
      ex.  ...
          Hurd160Engine aHurd160Engine;
          RandBinomial BinDist(aHurd160Engine);
          double n,p;
          ...
          double num = BinDist.fire();     // (sample=1, prob=1)
          double num = BinDist.fire(n,p);  // (sample=n, prob=p)
    
    RandChiSquare
    Class defining methods for shooting Chi^2 distributed random values, given a number of degrees of freedom a (default=1.0). Default values are used for operator ().
    Valid values of a satisfy a > 1. When invalid values are presented, the code silently returns -1.
      ex.  ...
          double a;
          ...
          double num = RandChiSquare::shoot();        // (deg=1)
          double num = RandChiSquare::shoot(a);       // (deg=a)
    
    A speculate set of static methods is provided to shoot random numbers from given random engines. Using these methods, the user is responsible of the state of the random engine(s) he/she is activating, since these methods act directly on the flat distribution of the engine, by-passing the HepRandom generator mechanism.
      ex.  ...
          DualRand theDualRandEngine;
          double a;
          ...
          double num =
            RandChiSquare::shoot(&theDualRandEngine);   // (deg=1)
          double num =
            RandChisquare::shoot(&theDualRandEngine,a); // (deg=a)
    
    A speculate set of fire()/fireArray() methods is provided to shoot random numbers via an instantiated RandChiSquare object. These methods act directly on the flat distribution provided by the engine given as argument to the constructor of RandChiSquare; they will by-pass the HepRandom generator mechanism. If the engine is passed by pointer to the constructor, the corresponding engine object will be deleted by the RandChiSquare destructor, if passed by reference it will not be deleted by the RandChiSquare destructor.
    Operators () are provided.
      ex.  ...
          Hurd288Engine aHurd288Engine;
          RandChiSquare Chi2Dist(aHurd288Engine);
          double a;
          ...
          double num = Chi2Dist.fire();   // (deg=1)
          double num = Chi2Dist.fire(a);  // (deg=a)
    
    RandGamma
    Class defining methods for shooting gamma distributed random values, given a k (default=1) and specifying also a lambda (default=1). Default values are used for operator ().
    Valid input values are k > 0 and lambda > 0. When invalid values are presented, the code silently returns -1.
      ex.  ...
          double a,lm;
          ...
          double num = RandGamma::shoot();        // (k=1, lambda=1)
          double num = RandGamma::shoot(a,lm);    // (k=a, lambda=lm)
    
    A speculate set of static methods is provided to shoot random numbers from given random engines. Using these methods, the user is responsible of the state of the random engine(s) he/she is activating, since these methods act directly on the flat distribution of the engine, by-passing the HepRandom generator mechanism.
      ex.  ...
          MTwistEngine theMTwistEngine;
          double a,lm;
          ...
          double num =
            RandGamma::shoot(&theMTwistEngine);      // (k=1, lambda=1)
          double num =
            RandGamma::shoot(&theMTwistEngine,a,lm); // (k=a, lambda=lm)
    
    A speculate set of fire()/fireArray() methods is provided to shoot random numbers via an instantiated RandGamma object. These methods act directly on the flat distribution provided by the engine given as argument to the constructor of RandGamma; they will by-pass the HepRandom generator mechanism. If the engine is passed by pointer to the constructor, the corresponding engine object will be deleted by the RandGamma destructor, if passed by reference it will not be deleted by the RandGamma destructor.
    Operators () are provided.
      ex.  ...
          Ranlux64Engine aRanlux64Engine;
          RandGamma GammaDist(aRanlux64Engine);
          double a,lm;
          ...
          double num = GammaDist.fire();      // (k=1, lambda=1)
          double num = GammaDist.fire(a,lm);  // (k=a, lambda=lm)
    
    RandStudentT
    Class defining methods for shooting Student's t- distributed random values, given a number of degrees of freedom a (default=1.0). The implementation is based on the one provided in the C-Rand package by Ernst Stadlober and Franz Niederl of the Technical University of Graz, Austria (May 1998).
    Default values are used for operator (). Valid input values are a > 0. When invalid values are presented, the code silently returns HUGE_VAL from math.h.
      ex.  ...
          double a;
          ...
          double num = RandStudentT::shoot();        // (deg=1)
          double num = RandStudentT::shoot(a);       // (deg=a)
    
    A speculate set of static methods is provided to shoot random numbers from given random engines. Using these methods, the user is responsible of the state of the random engine(s) he/she is activating, since these methods act directly on the flat distribution of the engine, by-passing the HepRandom generator mechanism.
      ex.  ...
          TripleRand theTripleRandEngine;
          double a;
          ...
          double num =
            RandStudentT::shoot(&theTripleRandEngine);   // (deg=1)
          double num =
            RandStudentT::shoot(&theTripleRandEngine,a); // (deg=a)
    
    A speculate set of fire()/fireArray() methods is provided to shoot random numbers via an instantiated RandStudentT object. These methods act directly on the flat distribution provided by the engine given as argument to the constructor of RandStudentT; they will by-pass the HepRandom generator mechanism. If the engine is passed by pointer to the constructor, the corresponding engine object will be deleted by the RandStudentT destructor, if passed by reference it will not be deleted by the RandStudentT destructor.
    Operators () are provided.
      ex.  ...
          RandEngine aRandEngine;
          RandChiSquare StudDist(aRandEngine);
          double a;
          ...
          double num = StudDist.fire();   // (deg=1)
          double num = StudDist.fire(a);  // (deg=a)
    
    RandGeneral
    This class defines methods for shooting generally distributed random values, given a user-defined probability distribution function.
    The probability distribution function Pdf must be provided by the user as an array of positive real numbers. The array size must also be provided. Pdf doesn't need to be normalized to 1.
    NOTE - No static methods are provided by this class, since objects of this kind must be explicitly instantiated !
      ex.  ...
          double* probList;
          int nBins;
          ...
          RandGeneral GenDist(probList,nBins);
          double num = GenDist.shoot();  // shoots values using the engine
                                         // in the static generator. shoot()
                                         // provides the same functionality
                                         // of fire() in this case.
    
    A speculate set of static methods is provided to shoot random numbers from given random engines. Using these methods, the user is responsible of the state of the random engine(s) he/she is activating, since these methods act directly on the flat distribution of the engine, by-passing the HepRandom generator mechanism.
      ex.  ...
          RanecuEngine aRanecuEngine;
          double* probList;
          int nBins;
          ...
          RandGeneral GenDist(probList,nBins);
          double num = GenDist.shoot(&aRanecuEngine);   // shoots values using the
                                                        // specified engine
    
    A speculate set of fire()/fireArray() methods is provided to shoot random numbers via an instantiated RandGeneral object. These methods act directly on the flat distribution provided by the engine given as argument to the constructor of RandGeneral; in case an engine is not specified the engine of the static generator will be used. If the engine is passed by pointer to the constructor, the corresponding engine object will be deleted by the RandGeneral destructor, if passed by reference it will not be deleted by the RandGeneral destructor.
    An Operator () is provided.
      ex.  ...
          RanluxEngine aRanluxEngine;
          double* probList;
          int nBins;
          ...
          RandGeneral GenDist(aRanluxEngine,probList,nBins);
          ...
          double num = GenDist.fire();  // shoots values using the specified
                                        // engine local to the distribution
    

    4. Design Issues

    The use of a static generator has been introduced in the original design of HEP Random as a project requirement in Geant4. In applications like Geant4, where it is necessary to shoot random numbers (normally of the same engine) in many different methods and parts of the program, it is highly desirable not to have to rely-on/know global objects instantiated. By using static methods via a unique generator, randomness of a sequence of numbers is best assured.

    Analysis and design of the HEP Random module have been achieved following the Booch Object-Oriented methodology.
    Here follows a list of diagrams describing the model according to the Booch notation:

  • Class Diagram
  • Object Diagram: shooting via the generator
  • Object Diagram: shooting via distribution objects
  • Object Diagram: shooting with arbitrary engines
  • Interaction Diagram: shooting via the generator
  • Interaction Diagram: shooting via distribution objects
  • Interaction Diagram: shooting with arbitrary engines
  • Class Specifications

  • clhep-2.1.4.1.orig/Random/doc/Makefile.am0000755000175000017500000000136411406204345016424 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif doc_srcdir = $(top_srcdir)/doc doc_builddir = $(top_builddir)/doc doc_installdir = $(prefix)/doc/@PACKAGE@ install-docs: $(mkinstalldirs) $(DESTDIR)$(doc_installdir) $(INSTALL_DATA) $(doc_srcdir)/Random.html $(DESTDIR)$(doc_installdir)/Random.html $(INSTALL_DATA) $(doc_srcdir)/validation.doc $(DESTDIR)$(doc_installdir)/validation.doc $(INSTALL_DATA) $(doc_srcdir)/JamesRandomSeeding.txt $(DESTDIR)$(doc_installdir)/JamesRandomSeeding.txt $(INSTALL_DATA) $(doc_srcdir)/html/CLHEP-random.html $(DESTDIR)$(doc_installdir)/CLHEP-random.html $(INSTALL_DATA) $(doc_srcdir)/html/onSavingRandomStates.html $(DESTDIR)$(doc_installdir)/onSavingRandomStates.html clhep-2.1.4.1.orig/Random/doc/html/0000755000175000017500000000000012242515140015322 5ustar olesolesclhep-2.1.4.1.orig/Random/doc/html/CLHEP-random.html0000755000175000017500000004536207705060311020341 0ustar olesoles Fermi Physics Class Libraries Package: CLHEP-Random

    ZOOM ZOOM

    ZOOM Validated CLHEP Random Package

    HEP Random is a collection of random number engines and a variety of distributions which use those engines to generate pseudo-random numbers.

    The ZOOM validation consists of

    • Verifying correct statistical properties of the engines and distributions
    • Testing the original code and correcting minor bugs
    • Providing a few additional methods requested by the Run II user community
    • Completing the set of distributions, to include the full list Review of Particle Properties.

    The source code for headers and implementations of the ZOOM version of CLHEP Random may be browsed here .

    The extensions, corrections and validations on this page are completed and reflected in the Random sub-package of the ZOOM distribution of CLHEP.


    What is new:

    10/23/98
    New Distribution: RandMultiGauss Multivariate Gaussian Distribution, as per page 170 of the new Review of Particle Physics. Returns a HepVector of random variates according to a given HepVector means mu and HepSymMatrix covariance about the mean S.

    10/23/98
    Tests of Distributions:

    testRandDists has Tests based on generating a large number of variates and verifying that known properties of each distribution hold. Distributions tested thus far are:

    RandGauss
    Mean and first four moments.
    Counts at 1, 2, 3, 4, and 5+ sigma.
    RandMultiGauss
    Mean.
    Covariance matrix.
    9/17/98
    Cleanup of the new random engines:
    Ranlux64
    The earlier CLHEP implementation of this did not accurately follow Luscher's prescription. Though it passed all the usual tests, it would likely have a shorter period that the correct algorithm. The implementation has been corrected to match Luscher's ranlxd.
    Hurd288Engine, Hurd160Engine, TripleRand, Mtwist
    These have had several cleanups associated with the translation from integer bit streams to doubles.
    (float) and (unsigned int)
    Methods returning random variables of single precision are included. As compared with flat(), for engines which take the trouble to ensure randomness out to 53 bits of mantissa, (float) and (unsigned int) run faster by generating fewer random bits.

    8/25/98
    Several new random engines have been added:

    TripleRand
    is a combination of the DualRand and the Hurd288 engines, with a period of over 2**400. This is intended as a small-state (60 bytes) reasonably fast "mother of all generators" for applications that are fairly paranoid.
    Hurd288Engine
    Hurd160ENgine
    are a pair of linearly interconnected shift register engines, based on the paper by William Hurd (not to be confused with GNU Hurd) in IEEE Transactions on Computers, C23 No. 2 page 146. This method is claimed to remove some unsatisfactory properties in the Tausworthe methods, stemming from the latter using trinomial primitive polynomials. We implement 160 and 288 bit instances, based on lines 9 and 10 of table I in that paper.

    Older "Whats New" Items


    Testing for Proper Behavior of CLHEP Random sub-package

    • Random Engine Validation
        We have applied the "DIEHARD" suite of statistical tests for uniformly distributed random numbers to each of the engines in CLHEP Random.
        Results show that several engines pass the full suite of tests:
        • DualRand
        • Hurd288Engine
        • MTwistEngine
        • RanecuEngine
        • RanluxEngine on luxury level 2 or higher
        • Ranlux64Engine
        • RanshiEngine
        • TripleRand
        Other engines fail one or more tests of randomness; in particular RandEngine and RanluxEngine on level zero fail several significant tests and should not be considered reliably random. RanshiEngine and Hurd288Engine are about as fast as these (and much faster for 32-bit interger generation) and should be considered as substitutes.
    • Distribution Generator Validation
        Validation of proper behavior of each distribution is mathematically subtle in some cases. This validation is has been done for:
        • RandGauss
        • RandMultiGauss
        Run testRandDists to execute these tests.


    ZOOM-supplied Extensions

    A couple of extensions to the basic interface are useful to our community. These are in the area of internally saving and restoring state, and support for large collections of generators without getting identical sequences.

    (In no case will these extensions modify or eliminate existing correct functionality.
    Any bug fixes which may change behavior will be indicated explicitly.)
    Changes (fed back to CLHEP) are discussed here.

  • Additional Methods
    • Saving and restoring engine state to file with user-supplied name.
        RanluxEngine e;
        e.saveStatus ( "myFile.conf" );
        e.restoreStatus ( "yourFile.conf" );

    • Engine state stream output via << and input via >> . There are also constructors accepting an istream to determine the state.
        RanluxEngine e;
        cin >> e;
        cout << e;
        RanLuxEngine e2 ( cin );

    • The flat() methods in all added engines supply double precision numbers random out to the last bit. If the underlying engine works with 32-bit numbers, this requires a bit of extra work. We will provide conversion constructors for each engine, which can be used as in:
        DualRand e;
        double x; float f; unsigned int u;
        x = double(e);        // Exactly equivalent to x = e.flat();
        f = float(e);         // Equivalent to f = e.flat(); 
                              // but somewhat faster
        u = unsigned int(e);  // Equivalient to u=pow(2.0, 32)*e.flat() 
                              // but supplies the 32-bits obtained from
                              // the algorithm kernel, without the "middleman"
        
      A shorter syntax will also work, but is disparaged because it looks too mysterious:
        x = e;                // Will come out x = double(e);
        f = e;                // Will come out f = float(e);
        u = e;                // Will come out f = unsigned int(e);
        
      For consistency, the double, float and unsigned int operators are also be provided for the original engines, but these save no time.

  • Additional Distributions

    The package now include the following distributions:

    • All eight distributions in table 28.1 of the Review of Particle Properties. Of these, Uniform, Poisson, and Gaussian were already present in HEP Random. The ZOOM work adds:
      1. Binomial -- RandBinomial
      2. Chi-squared -- RandChiSquare
      3. Student's t -- RandStudentT
      4. Gamma -- RandGamma
      5. Multivariate Gaussian -- RandMultiGauss
    • The two special cases of these (Exponential and Breit-Wigner) provided in the original CLHEP Random.

  • Additional Random Engines
    DualRand
    A new random engine, implementing one which is in wide use in the Lattice Gauge Monte Carlo community. It is a combination of a (127,97) Tausworthe shift register generator and ordinary 32-bit integer congruence. This passes the statistical tests in the Diehard suite, and is rather fast. It also has the property that two instances based on different seeds will give truly different streams, and not two separated segments of the same long stream.
    Ranshi
    A huge-state (2K bytes) generator based on F. Gutbrod's method of that same name. It repeatedly simulates throwing spinning balls onto a large collection of other spinning balls. One instance of Ranshi uses as a state one 32-bit "red ball" and 512 32-bit "black ball" spins. Techniques to avoid "trap" sequences are employed. Though the properties of this process have not been studied with any rigor, the huge state lends confidence in a good random sequence of long period. Despite the huge state, the time taken to generate a single random is excellent.
    Ranlux64
    A 64-bit variant of the Ranlux engine, again from Europe. This (along with all the ZOOM-supplied additional engines) supplies doubles which are random out to all 53 bits of mantissa, rather than just 32 as the original Ranlux does.
    MTwist
    The Mersenne Twister engine. This is a huge-state (~2.5 Kbytes) engine which has mathematically proven outstanding randomness properties and a period of 2**19,937 -1. Our implementation is from the algorithm in the paper; there is a culture on the web page of speed improvements but it is rather fast as it is, and we wanted as few risks of incorrectness as possible. This is probably the best huge-state engine available.
    TripleRand
    is a combination of the DualRand and the Hurd288 engines, with a period of over 2**400. This is intended as a small-state (60 bytes) reasonably fast "mother of all generators" for applications that are fairly paranoid. The Hurd288 engine implements a set of linearly interconnected shift register engines, based on the paper by William Hurd (not to be confused with GNU Hurd) in IEEE Transactions on Computers, C23 No. 2 page 146. This method is claimed to remove some unsatisfactory properties in the Tausworthe methods, stemming from the latter using trinomial primitive polynomials. We implement 160 and 288 bit instances, based on lines 9 and 10 of table I in that paper.


    Corrections

    Several minor changes were made in the behavior of these classes, either to conform to the clearly intended behavior, or to conform to normal semantics a user would expect in C++:
    • When engines were constructed, they were supposed to be given zero-terminated arrays of seed numbers as arguments. They were not, and in the case of RanLuxEngine this made a difference. In principle, this could lead to access violations; in typical use, the only effect would be that two identically seeded distributions would after a short while begin to diverge. This bug has been fixed, for all the distribution classes.

    • The previous behavior of default constructors of random engines was such that if the user instantiated two intances of the same engine class using the default constructor each time, the sequences obtained would be identical. This is very trappy, and contradicts the most probable purpose of using this syntax. We now provide a different starting state each time. The user can get two matching sequences by explicitly supplying a specific seed, or by copying the engine object itself.

    Validation and Extensions in Progress

  • Additional Methods

    • Default constructors will be provided for each of the distributions. These will conform to the following semantics: When a distribution is instantiated without specifying a specific engine, a new instance of a good random engine will be constructed, and will be owned only by the new distribution instance.

    • Copy constructors and assignment operators will be provided for each distribution. The semantics for what engine is used when copying a distribution are as yet undecided. The three possibilities are:
      1. A clone of the same class of engine as used in the original distribution is instantiated and associated with the copy distribution. Thus the original and the copy distributions will have two completely independent streams.
      2. The copy distribution will share the same engine as the original. Thus firing either will advance the state of the other.
      3. A copy of the engine associated with the original will be made and associated with the copy distribution. Thus the distribution and its copy will fire identical streams of randoms.
      We are leaning toward the first of these possibilities. we welcome comments as to which choice people feel is most useful.

  • Additional Distributions
    • Distributions for fluctuation of ionization energy loss:
      1. Landau distribution.
      2. Vavilov distribution, an approximation-free version of the Landau distribution with energy cutoff.
          This version will be quicker than the CERNLIB versions of Vavilov.
      3. Vavilov distribution corrected for spin-1/2 particles.

  • Additional Engines
      RanUniEngine
      Another engine in use in the Lattice Gauge community. This comes from Marsaglia, and appears to be a lagged addition Fibonacci, added mod 1 to a simple c*d mod m. Since the set of other engines do not include a lagged Fibonacci, we will likely incorporate this one.

      The following engines are also logical candidates for inclusion but we presently do not plan to provide them:

      Ran2 from Numerical recipes, which is related to Ranecu.
      Ran4 from Numerical recipes, which is related to the DES encryption standard.
      GFSR, a 4-tap feedback shift register discussed by R. Ziff in Computers in Physics, July 1998.

  • Validation
      There have been problems in the past understanding the results of the DIEHARD tests.

      There is work in progress to:

      • put this Marsaglia suite into clear C++;
      • correct a suspected flaw in the Minimum Distance test, possibly introduced in the course of going from the original Fortran through f2c;
      • add a couple of other tests which would have been impractical before the available computing power was at today's level.

    ZOOM Home Page - Fermilab at Work - Fermilab Home


    Mark Fischler
    Last modified: October 23, 1998 clhep-2.1.4.1.orig/Random/doc/html/onSavingRandomStates.html0000755000175000017500000004627310233771102022340 0ustar olesoles Saving and Restoring States of CLHEP Random Engines and Distributions

    Saving and Restoring States of CLHEP Random Engines and Distributions

    We have added new (as of late 2004) methods to the CLHEP Random classes allowing more convenient and natural saving and restoring of engines and distributions. Some inconvenient features of the original methods are:

    • The saveStatus and restoreStatus methods are based on a named file, so that each distribution saved must be placed in its own file.
    • Since opening the file is left to the restoreStatus method, there can be no user-controlled flexibility in how to deal with trouble (such as file not found) in opening that file.
    • Each distribution saves the state of the engine it is using. If several distributions share a single instance of an engine, then this wastes I/O time and space on multiple copies of the same data.
    • There was never a way to save an engine, and then have another program instantiate a HepRandomEngine* and read back the state to create an engine of the appropriate type, without knowing what sort of engine was saved. We call this functionallity an "engine factory."
    • For cases where the user program has its own scheme to persist numbers (for example, unsigned longs), there is no way to cause an engine to produce its state (or restore from a saved state) as a vector of unsigned longs.
    The usual idiom for saving data would be to write to an ostream and read from an istream. It is assumed that users know how to construct an fstream (ofstream or ifstream) to work with a file, and using these fstreams as ostreams and istreams.

    We have added methods that stick to this idiom, which greatly helps matters. (In fact, the first two of these inconveniences are immediately resolved, and the structure is right for dealing with the third.)

    We have also added engine factory capability to deal with anonymous engine saves, and we have given every engine the ability to save and restore to/from a vector of unsigned longs.

    Use Cases

    Each of these motivating use cases are based on the following theme: An experiment wishes, when running a simulation job in "debuggable" mode, to capture before each event enough information that a subsequent job can restart at an arbitrary critical event and get the same results (or more typically, exhibit the same problem for investigation). The states of all random engines evolve across events, so this state information must be saved with each event (and restored for the critical event).

      There have been occasional requests for methods to let a job restore a "generic" engine (that is, to start using an engine without knowing at compile time which type of engine will have been saved). Some of these added methods provide that capability in special circumstances. In general, however, we make the assumption that the restoring user knows the classes which have been saved. If the restore does not match the save, this will be indicated in the usual ways; in the Random package, this includes output to cerr and setting the state of the restoring istream to "bad."

    One static distribution

    The user employs one static distribution, calling (say) RandGauss::shoot(). She wishes to save/restore the full state (including underlying engine) of just that distribution. This is completely analogous to doing RandGauss::saveState("filename"), but it is desired that this state be added to a file rather than placed in its own file.

    One instance of a distribution

    The user has an instance of a distribution, which uses some instance of an engine. She wishes to save/restore its full state, including that of the underlying engine.

    Some distributions sharing various engines

    The user has several instances of a distributions of various types, (and/or uses the shoot() method of several static distributions) and one or more instances of engines of various types. To conserve I/O space, she wishes to separately save each engine and the non-engine-dependant state of each distribution. Since she knows which engines are used by which distributions, she will be able to restore the full states of all the distributions after restoring individual engine and distribution states.

    All the static distributions

    A multi-module program written by a collaboration makes extensive use of the shoot() method of various static distributions. They wish to make a single call to save/restore the states of all the static distributions in the CLHEP Randoms package. The program restoring the states of the distributions and the common underlying engine has no a priori knowledge of which type of the underlying engine has been set.

    If the static distributions each used a separate engine, this method would need to ensure that states of shared engines would be saved only once, and that all needed engine instances would be saved. However, as currently implemented, every static distribution shares one common engine. Since the (non-engine) state of a distribution itself is miniscule, and only a couple of distributions contain state information other than non-standard distribution parameters (which do not apply to static distributions), the "wasted" cost of saving any unused static distributions is acceptable.

    One engine of unknown type

    An application wishes to deal with an engine restored from a saved engine state, without compile-time knowledge of which engine type this will be. For example, the saved engine may be a product of a simulation job where the engine created was determined by run-time input.

    Saving and restoring state via a vector of unsigned longs

    An experiment framework has a means of imbedding an array of numbers into the data for an event, and would wish to use this to hold the state of the engine(s) used. Here, the model of saving to a stream is less convenient and much less efficient. HepMC assumes random engines can produce their states in the form of a vector of unsigned longs.

    Added Methods in CLHEP Random

    There are two types of save and restore activities on a distribution, just as there are two modes of using a distribution to generate a random variate, depending on whether you want the static distribution or an instance of the distribution. For the generation activity, the methods are Class::shoot() to use the static distribution, and instance.fire() to use an instance.

    For these added methods which deal with saving and restoring to an fstream, the static methods all take the stream as an argument, while the instance methods use the ostream << whatever or istream >> whatever syntax.

    As in the case of variate generation, all the methods dealing with just an engine are based on an instance.

    Static methods in the distribution classes

    Each distribution has six new static methods, which override static methods of the same names in the HepRandom class:
    static ostream& saveFullState   (ostream& os) const;
    static istream& restoreFullState(istream& is);
    
      Saves (or restores) the state of the distribution, including the engine used when shoot() is invoked and any additional cached data, such as the second gaussian in the Box-Mueller method used by RandGauss.
    static ostream& saveDistState   (ostream& os) const;
    static istream& restoreDistState(istream& is);
    
      Saves (or restores) the static state of the distribution, including cached data used in the course of the shoot() method, so that if the engine used is also restored, the full state will have been replicated. For distributions which do not distributions contain cached data (all distributions other than RandGauss, RandFlat, and RandBit) this method has no effect.
    static ostream& saveStaticRandomStates (ostream& os) const;
    
      Determines the identity of theEngine used in the static shoot() method of the distributions. Saves the state of that engine, followed by the static state of each distribution, such that the states can be restored by restoreStaticRandomStates.
    static istream& restoreStaticRandomStates(istream& is);
    
      Restores the cached data for every static distribution and the engine used as theEngine in the static shoot() method of the distributions.

      If, at the point of calling restoreStaticRandomStates, the common engine has been set to an engine of the type matching that saved, then that engine's state will be changed to the saved state.

      If the two engine types do not match, a new engine of the saved type will be instantiated, and attached to the static distribuitions via a setTheEngine() call. The previously existing engine will not be deleted (since it might be shared by some distribution objects), and the new engine is a post-startup new object that won't automatically be deleted, so this may be detected by tools such as Purify as a memory leak.

    Instance methods in the distribution classes

    ostream& operator << (ostream& os, const HepRandom & distribution);
    istream& operator >> (istream& is,       HepRandom & distribution);
    
      Saves (or restores) the state of this instance of the distribution, including cached data used in the course of the fire() method, so that if the engine used is also restored, the full state will have been replicated.
    RandomEngine * HepRandom::engine();
    
      Provides a pointer to engine underlying this instance of distribution. This is needed to save the full state of this instance of distribution.
    Conventionally, when saving the full state of a distribution, one should follow the order used by the methods for static distributions, which save the engine and then the remainder of the distribution state.

    Instance methods in the engine classes

    Some added methods of engine are provided, as tools for implementation of "generic engine" capability:
    string RandomEngine::name();
    
      Provides a string identifying the engine type.
    istream& RandomEngine::getName(istream&);
    
      Reads a string identifying the engine type, and verifies that it is the expected identification.
    istream& RandomEngine::getState(istream&);
    
      Inputs engine state.
    ostream& RandomEngine::put(ostream&);
    istream& RandomEngine::get(istream&);
    
      Outputs or inputs engine state, including identifying name.
      Used by operator<< and operator>>.
    vector < unsigned long > RandomEngine::put() const;
    bool RandomEngine::get(const vector &);
    
      Writes or sets engine state, including 32-bit identifier, to a vector of unsigned longs.
    Methods for I/O of engine states to streams are already present. Though not "additional methods," this are listed here because they are logically on the same footing as the distribution I/O methods, and will appear in the section describing how to code the use cases.
    ostream& operator << (ostream& os, const RandomEngine & engine);
    istream& operator >> (istream& is,       RandomEngine & engine);
    
      Saves (or restores) the state of the engine, including an identifying string to help catch mismatches where erroneous code tries to use an engine state as the state of a different kind of engine.
    Finally, the base class HepRandomEngine has a pair of methods to obtain a pointer to a new engine based on "generic" or anonymous engine input:
    static HepRandomEngine* HepRandomEngine::newEngine(istream& is);
    static HepRandomEngine* HepRandomEngine::newEngine
    				(const vector & v);
    
      Based on the contents of the istream or vector, which must contain the output of saving some engine, this instantiates a new engine of the saved type, and returns a pointer to that object. The semantics are that of new: It is the user's responsibility to invoke delete when the engine is no longer needed.
      Note that although the engine type is deduced from the input, if the saving program had any non-trivial engine sharing among multiple distribution objects, the restoring program would have to set up the same sharing to get the same subsequent random sequence behaviors.

    Caveat concerning RandEngine

    In the case of an engine based on system random generator engine whose internal state is not controllable by the Random package, such as RandEngine, the additional save/restore capability is still presented. However, in such a case, the only way to achieve the restore is to start in the original seed state, and fire off however many variates were requested prior to the save. In the case of restoring state based on a late event in a long job, this may be quite inefficient. Therefore, we heavily recommend against using RandEngine in applications involving saving and restoring engine states.

    How the Use Cases Can Be Coded

    One static distribution

    The "saving job" does:
      DualRand e(24681357);         // Illustrating that the engine need not 
      RandGauss::setTheEngine (&e); // be the default engine for RandGauss.
      ofstream fs(filename);        // Open it, or pass an ofstream already in use
      codeUsingRandGaussManyTimes();
     
      RandGauss::saveFullState(fs);
    
    
    The "restoring job" does:
      DualRand e();   
      RandGauss::setTheEngine (e);  
      ifstream file(filename);      // Open it, or pass an ifstream already in use
     
      RandGauss::restoreFullState(fs);  
    
    

    One instance of a distribution

    The "saving job" does:
      DualRand e(24681357);   
      RandGauss g(e);               // Normal distribution, based on engine e  
      ofstream fs(filename);        
      codeUsing_g_ManyTimes();
     
      fs << g.engine() << g;
    
    
    The "restoring job" does:
      DualRand e();   
      RandGauss g(e);
      ifstream fs(filename);      
     
      fs >> g.engine() >> g; 
    
    

    Some distributions sharing various engines

    The "saving job" does:
      DualRand e1(24681357);  
      MTwistEngine e2(135797531); 
      RandGauss g(e1);
      RandFlat  f(e1); 
      RandBit   b(e2);                
      ofstream fs(filename);        
      codeUsing_g_f_and_b();
     
      fs << e1 << e2 << g << f << b;
    
    
    The "restoring job" does:
      e = new DualRand();   
      RandGauss g(e);
      ifstream fs(filename);      
     
      fs >> e1 >> e2 >> g >> f >> b;
    
    
    To save and restore successfully in the general case, you must know not only which types of engines underlie the various distributions, but also which distributions share an engine.

    All the static distributions

    The "saving job" does:
      e = new DualRand(24681357);   // illustrating that the some distributions 
      RandGauss::setTheEngine (e);  // need not use the default engine
      ofstream fs(filename);        
      codeUsingVariousDistributions();
     
      saveStaticRandomStates(fs);
    
    
    The "restoring job" does:
      e = new DualRand();   
      RandGauss::setTheEngine (e);  
      ifstream file(filename);      
     
      restoreStaticRandomStates(fs);
    
    

    One engine of unknown type

    The "saving job" does:
      DualRand *     e1 = new DualRand(24681357);
      RanecuEngine * e2 = new RanecuEngine(24563291);  
      HepRandomEngine *eptr;
      if (someControl) eptr = e1; else eptr = e2;  
      RandGauss g(*eptr);             
      ofstream fs(filename);        
      codeUsing_g_ManyTimes();
     
      fs << g.engine() << g;
    
      delete e1; delete e2; // (when g goes out of scope)
    
    The "restoring job" does:
      ifstream fs(filename);      
     
      HepRandomEngine * eptr = HepRandomEngine::newEngine(fs);
      if (eptr==0) throw "problem inputting an engine";
      RandGauss g(*eptr);
    
      codeUsing_g();  // using g without knowing or caring 
                      // what type the engine is
      delete eptr;    // (delete engine when g goes out of scope) 
    

    Saving and restoring state via a vector of unsigned longs

    The "saving job" does:
      HepJamesRandom e = new HepJamesRandom(12343211);  
      codeUsing_e (e);
      std::vector < unsigned long > v;
     
      v = e.put();
    
      eventData.add_a_vector (v);
    
    The "restoring job" does:
      eventData.add_a_vector (v);
      HepJamesRandom e;
     
      bool ok = e.get(v);
      if (!ok) throw "problem restoring an engine";
    
      codeUsing_e(e);  
    


    Author:
    Mark Fischler

    Last modified: March 15, 2005 clhep-2.1.4.1.orig/Random/doc/JamesRandomSeeding.txt0000644000175000017500000000756710233771102020635 0ustar olesolesTechnical Maintenance Note for CLHEP Random Consequences of seeding JamesRandom with positive seed values greater than 900000000 ----------------------------------------- In the source code JamesRandom.cc, // The input value for "seed" should be within the range [0,900000000] The usual way of seeding a generator is via the default ctor, which makes use of the table of seeds (with some trickery to ensure that the values won't repeat after the table rows are exhausted). The trickery preserves the fact that sees are never negative (because the table values are never negative, and the seed is the xor of a mask which starts with a 0 bit and the seed from the table. But it can, and often does, supply a seed of more than 900,000,000. Does that adversely affect the behavior of the engine? We look at the seeding process: long ij = seed/30082; long kl = seed - 30082*ij; long i = (ij/177) % 177 + 2; long j = ij % 177 + 2; long k = (kl/169) % 178 + 1; long l = kl % 169; theSeed = seed; for ( n = 1 ; n < 98 ; n++ ) { s = 0.0; t = 0.5; for ( m = 1 ; m < 25 ; m++) { mm = ( ( (i*j) % 179 ) * k ) % 179; i = j; j = k; k = mm; l = ( 53 * l + 1 ) % 169; if ( (l*mm % 64 ) >= 32 ) s += t; t *= 0.5; } u[n-1] = s; } ij, which if seed < 900000001 must be less than 29919, now can be up to 71387 (when s = 2147483648, ij is that 71387). kl, which is the residue mod 30082, retains the same range as before. ij/177, which formerly had to be less than 170, can now be up to 403. However, the process immediately takes ij/177 mod 177, which of course is less than 177. So i, which before was between 2 and 171, is now between 2 and 178. k and l have the same ranjes as before: 0 < k < 179 and 0 <= l < 169. Now the loop, to produce 98 floating point numbers, applies Schrage's algorithm 25 times for each number needed, to generate 25 random leading bits. In this algorithm, the first step is to take i*j (mod 179) -- and no value attainable for 171 < i < 179 is not attainable for values of i <= 171 and arbitrary values of j. So any seed greater than 900000000 is equivalent to some positive seed greater than 900000000. Thus the engine is as validly random for a seed above 900000000 as for one in the sanctioned range. Past the leading bit of u[0], you cannot tell a seed above 900000000 from some equivalent seed in the sanctioned range. Consequences of seeding JamesRandom with negative seed values ----------------------------------------- Andreas pointed out that negative seeds can lead to bad sequences; he gives as an example -1200590225. With a negative seed, the nature of the % operator is such that i, j, k, and l start off negative. The iteration to fill the bits of the words is such that if i, j, and k are negative, mm will always be negative as well. And most of the time, l will be negative too, which means the if ( (l*mm % 64 ) >= 32 ) can fall either on the true sid or the false. The advance of l by multiplying by 53 and adding 1 mod 169 will ALMOST always leave a negative l negative. The exception is l= -118, where the answer is 0 mod 169. After that, l will be positive (and remain positive forever). Yet mm will always be negative, so in the test condition l*mm is always negative, thus every bit is zero thereafter! For that seed of -1200590225, it happens that the first bit is 1, the second and third zero, and at that point l is -118, so all remaining bits are zero. So the lagged Fibbonacci array is filled with all zeros except for the first number. And that first number is precisely 1/2. So the sequence obtained from the central part of the engine is just a long string of zeros, then a long string of .5, and back to zeros. The engine degenerates to the very lame addition mod r engine formed by c, cd and cm. clhep-2.1.4.1.orig/Random/doc/.cvsignore0000755000175000017500000000001407746044120016364 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Random/doc/CMakeLists.txt0000644000175000017500000000034711606714767017145 0ustar olesoles# install Random documentation INSTALL (FILES Random.html validation.doc JamesRandomSeeding.txt html/CLHEP-random.html html/onSavingRandomStates.html DESTINATION doc/Random ) clhep-2.1.4.1.orig/Random/doc/validation.doc0000755000175000017500000003330607705060311017212 0ustar olesoles How the various random distributions are validated -------------------------------------------------- The distributions in CLHEP, for example RandGauss, are "independently validated." By validation, we mean checking that * The algorithm is mathematically correct * The algorithm is properly coded * The compilation of the algorithm is proper for this plaform * There is no subtle interaction between the algorithm and the random engine used that detectably impacts the distribution This validation must be done without reference to the coded algorithm itself (independent). It must be done by generating some (selectable) number of deviates, and testing that these obey the mathematical properties of the desired distribution. For each distribution, those properties (hence the tests) differ. Since one can always increase the number of deviates to detect smaller anomalies, we reject conservatively: Generally, if the distribution is 3 sigma away from the proper properties, we reject, asserting that something is wrong with the algorithm of coding. For distributions which will be tested in many ways, we make our rejection criteria a bit more severe; the goal is to keep the overall "false rejection" probability down at the .1% to 1% level. For each validated distribution, we discuss here: * the method used to produce the deviates * timings * the validation tests applied * the level (number of deviates to which the distribution passes validation A word about timing, which of course is by necessity relative timing. We take the time for a single random via one of the fastest good generators (DualRand) to be 1 unit. These are not super-carful timings, and at any rate the ratios will vary by around 30% depending on the processor and memory configuration used. A timing for a distribution of 1.0 units would mean no time used beyond the uniform random. Summary ------- Distribution Validated Validation Rejected Past N ------------ --------- -------------------------- RandGauss N = 50,000,000 ------- RandGaussT N = 50,000,000 ------- RandGaussQ N = 30,000,000 N = 50,000,000 RandGeneral (approximating a gaussian) linear N = 1,000,000 N = 1,000,000 (1,000 bins) stepwise N = 1,000,000 N = 1,000,000 (10,000 bins) RandPoisson N = 10,000,000 ------- RandPoissonT mu<100 N = 50,000,000 ------- mu>100 N = 10,000,000 ------- RandPoissonQ mu<100 N = 50,000,000 ------- (same as RandPoissonT) mu>100 N = 5,000,000 N = 10,000,000 ---------------------------------------------------------- 1. RandGauss Method: RandGauss is left unchanged from the original: A Box-Mueller pair of deviates is generated using rejection technique (which may on occasion reject the first pair of randoms). Timing: fire(), shoot() etc 2.5 units Validation tests applied: We know analytically the proper values of the first six moments of a gaussian, and I have also analytically computed with the standard errors associated with these quantities. (For the latter, we ignore corrections of the order 1/N, but since one would never apply the validation using fewer than 1000 deviates, this is completely safe.) Along with these first six moments, we also histogram the deviates into bins at intervals of .5 sigma, from -6 to +6 sigma. The correct fraction of deviates in each bin is known from tables of the error function. The standard error is taken to be sqrt(npq). (It is technically superior to do a chi-square test on the contents of the 13 bins, but the results are almost identical.) So we now have about 20 measurements. If any one of these is too many sigma off ites expected value, we reject the hypothesis that this distribution is correct. We choose 4 sigma for rejection (controlled by the const REJECT) because with 20 measurements, the chances are a bit less that .1% that such a level will occur by coincidence. Validation Level: The standard validation suite uses N = 1 million, but the method is in principle exact. It has been explicitly validated at N = 50,000,000. 1a. RandGaussQ Method: RandGauss starts from a uniform random, and does a lookup into a table of inverse cumulative density function. It then does a linear interpolation, getting a result which is in principle accurate to about 23 significant bits. To deal well with the tails, the table is broken up into 2 tables, with increasingly finer spacing below r = .0005; and below .000001, a very accurate series is substituted for the table method. Timing: fire(), shoot() etc 1.7 units Validation tests applied: The same tests for RandGauss were applied here. Validation Level: The standard validation suite uses N = 1 million, but we have applied this test for higher values of N to see where the deviation from the true Gaussian can be detected. This method in fact has about 1.6% too many variates between 3.0 and 3.5 sigma from the mean (.113% instead of .111%). Because that range of values is rare, and other deviations from perfection are smaller, RandGaussQ passes validation with up to 30,000,000 numbers. However, the difference between RandGaussQ and an actual gaussian is detectable as rejecting validation when applied at the level of 50,000,000 samples. 1b. RandGaussT Method: flatToGaussian(engine->flat()) is used: This does a lookup into a table of inverse cumulative density function. It then does a cubic spline interpolation, getting a result which is in principle accurate to 40-44 significant bits. To deal well with the tails, the table is broken up into 5 tables, with increasingly finer spacing; and below about 10**(-13) a series approximation is used: In that range this approximation is very accurate. Timing: flatToGaussian (double x) 1.3 units RandGaussT() 2.3 units Validation tests applied: The same tests for RandGauss were applied here. Validation Level: The standard validation suite uses N = 1 million, but we have applied this test with N up to 50 million, and never get anywhere near the rejection point. Analytical considerations indicate that the validation test would not reject until O(10**24) samples were inspected. ---------------------------------------------------------- 2. RandGeneral Method: RandGeneral sets up a distribution using a supplied histogram of pdf. The value returned is computed by a lookup, with optional linear interpolation. Timing: (Not done in isolation). Grows with log (nbins). Validation tests applied: To test the distribution purporting to use supplied histogram of pdf, we supply the pdf for a Gaussian (which is easy to provide explicitly, involving just an exponential). To this we apply the validation test for a Gaussian. In order that the entire probablility is held by the finite range of the histogram (0 to 1), we use a mean of .5 and suggest a sigma of .06, which leaves room for 8 sigma deviations. There are two types of uses of RandGeneral - stepwise or piecewise-linear approximation of the pdf. The former gives a weaker match to the function being appoximated, for a given number of bins. We validate these separately. Validation Level: This validation would be expected to fail if too few bins were used, and in fact with one million deviates generated, the Gaussian validation detects a rejectable discrepancy if the number of bins is 300 (for piecewise-linear) or 5000 (for stepwise). (This rejection gives us excellent confidence that the RandGauss validation is powerful - a 300 bin piecewise-linear approximation to a Gaussian looks quite good to the eye, yet our validation would reject it.) The standard validation suite uses N = 1 million, with 1000 bins for validation of the linear case, and 10000 bins for stepwise. If N is increased, the number of bins should also be increased, since the more powerful resolution associated with larger N will let the validation detect the discrepancy. ---------------------------------------------------------- 3. RandPoisson Method: The original algorithm uses direct computation by multiplying uniform randoms for mu up to 12, and a rejection algorithm (from Numerical recipes) for mu greater than 12. This produces accurate poissons, however is fairly time consuming. Timing: The method used takes time which differs according to the value of mu. (Also in some instances speed is gained becuause of prior stored values for the default mu; but this is a small effect. We list the faster time.) mu time 2.5 4.8 7.5 9.3 11.0 14.1 51.0 14.3 94.9 14.5 110 14.8 Validation tests applied: Since the Poisson distribution is a discrete distribution, we can bin the deviates and analytically determine how many should be in each bin. The appropriate test to apply is chi-squared, and we do apply this, rejecting if the significance is more extreme than .01%. However, for large mu, we can do a bit better: If there is a discrepancy, it is likely to show up as wrong fractions in a range of bins, rather than a single bin being off. So we could "clump" several bins together, increasing the resolution power of the test for any given N deviates. We do this, clumping together sqrt(mu) bins, as a second chi-squared test. Finally, since programs may be very sensitive to incorrect mean values, we also check the sample mean and sample sigma-squared. The expected variances in the mean and in sigma2 can be computed analytically in terms of mu and N (for instance, expectedSigma2Variance = (2*N*mu*mu/(N-1) + mu) / N), so we can translate these into a number of standard deviations off their expected values. We reject at 3.5 sigma for these. The combination of 4 tests will be expected to falsely reject about one time in 2000, for any given value of mu. We apply these tests to a variety of large, small, and medium values of mu, paying particular attention to values near change-points in the underlying algorithm. In all, we would expect false rejection about one time in 300; since we wish to have good resolution power even if just one of the mu values is flawed, it would be unwise to dial this down any further. Validation Level: The standard validation suite uses N = 1 million, for several values of mu, but we have applied this with much higher N. We validated the main fire() method for a variety of mu values between 0 and 100 at a level of 10,000,000 trials. It showed no sign of approaching the rejectable p-values or errors in mean and sigma. 3a. RandPoissonT Method: This new algorithm does the direct sum method, using a table for 1/N (which is 30% faster than the product method because it does not need an exp) for mu < 5. For 5 < mu < 100 it does a table lookup followed by a series for the remainder, using the fact that the sum of two Poissons is a Poisson with mu as the sum of the mu's. For mu > 100 it uses the original method; I could not create a faster method completely accurate that does not require overly large tables. Timing: The timing differs according to the value of mu, and takes a major step up when we cross mu=100 and go over to the lod algorithm. mu time 2.5 1.6 7.5 3.9 11.0 3.9 51.0 3.9 94.9 3.9 110 14.8 Validation tests applied: The same tests are applied as for RandPoisson. Validation Level: The standard validation suite uses N = 1 million, for several values of mu, but we have applied this with much higher N. We validated the main fire() method for a variety of mu values between 0 and 100 at a level of 50,000,000 trials. It showed no sign of approaching the rejectable p-values or errors in mean and sigma. Above 100, the method matches the original algorithm; this we validated with 10,000,000 samples (it is more time consuming) with no problems. We validated the quick() routine (which differs only above mu = 100) at mu = 110, finding no rejection at 5,000,000 trials but rejectable errors at 10,000,000. The (corrected) gaussian approximation appears to improve quadratically with higher mu. For example, for mu = 300 a sample of 10,000,000 could not distinguish between quick() and a true Poisson. RandPoisson *, N = 10,000 N = 25,000 * simple gaussian mu>100 NOT IN THE CLASS! 3a. RandPoissonQ Method: For mu < 100 we use the method of RandPoissonT, which is fast enough. For mu > 100, we use a Gaussian approximation, quadratically transformed to properly match the Poisson mean, sigma, and skew. The quadratic correction is needed; the naive Gaussian approximation is inaccurate at a level which, for mu = 110, turns out to be detectable in a sample of only 25,000 deviates. Timing: The timing differs according to the value of mu, being the same as RandPoissonT for mu < 100. Above 100, it makes a noticeable difference whether the default or last-used value of mu is used, and both times are quoted. mu time 2.5 1.6 7.5 3.9 11.0 3.9 51.0 3.9 94.9 3.9 110 2.6 - 4.4 Validation tests applied: The same tests are applied as for RandPoisson. Validation Level: The standard validation suite uses N = 1 million, for several values of mu, but we have applied this with higher N. Below mu = 100, the validation never fails. We validated the main fire() method for mu values above but near to 100 for 5,000,000 trials with no rejectable deviations. However, at 10,000,000 trials the distribution is detectably inferior. For higher values of mu, the approximation improves; by mu = 300 we were unable to sample the distribution sufficiently to expose any deviance. By way of comparison, at mu = 130, the simple gaussian approximation poisson = floor( .5 + mu + sqrt(mu)*normal ) passes at N = 10,000 samples but fails at 25,000 samples. And without the .5 correction it is much worse still. clhep-2.1.4.1.orig/Random/.cvsignore0000755000175000017500000000007407746044120015625 0ustar olesolesMakefile.in configure aclocal.m4 autom4te.cache config.h.in clhep-2.1.4.1.orig/Random/COPYING0000644000175000017500000010451311406204345014653 0ustar olesoles GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/Random/test/0000755000175000017500000000000012242515135014574 5ustar olesolesclhep-2.1.4.1.orig/Random/test/testRandDists.output0000755000175000017500000012637011606616401020666 0ustar olesoles -------------------------------------------- Test of RandGauss distribution Please enter an integer seed: 1357924 How many numbers should we generate: 500000 Enter mu: 20 Enter sigma: 4 Instantiating distribution utilizing TripleRand engine... Sample fire(): 26.7408 Testing operator() ... 0 50001 100002 150003 200004 250005 300006 350007 400008 450009 Mean (should be close to 20): 20.004 Second moment (should be close to 16): 15.95 Third moment (should be close to zero): -0.012332 Fourth moment (should be close to 768): 762.39 Fifth moment (should be close to zero): -11.238 Sixth moment (should be close to 61440): 60359 These represent 0.71506, 1.5512, 0.055624, 1.581, 0.2892, 1.8504 standard deviations from expectations Between 0 sigma and 0.5 sigma (should be about 95731): 96022 negative and 96081 positive These represent 1.046 and 1.258 sigma from expectations Between 0.5 sigma and 1 sigma (should be about 74941): 74975 negative and 74625 positive These represent 0.1347 and 1.252 sigma from expectations Between 1 sigma and 1.5 sigma (should be about 45924): 45803 negative and 45982 positive These represent 0.5925 and 0.28401 sigma from expectations Between 1.5 sigma and 2 sigma (should be about 22028.5): 21851 negative and 22064 positive These represent 1.2232 and 0.24464 sigma from expectations Between 2 sigma and 2.5 sigma (should be about 8270): 8218 negative and 8154 positive These represent 0.5766 and 1.2863 sigma from expectations Between 2.5 sigma and 3 sigma (should be about 2430): 2426 negative and 2514 positive These represent 0.081342 and 1.7082 sigma from expectations Between 3 sigma and 3.5 sigma (should be about 558.5): 525 negative and 541 positive These represent 1.4183 and 0.74092 sigma from expectations Between 3.5 sigma and 4 sigma (should be about 100.5): 102 negative and 92 positive These represent 0.14964 and 0.84797 sigma from expectations Between 4 sigma and 4.5 sigma (should be about 14.15): 15 negative and 10 positive These represent 0.22597 and 1.1033 sigma from expectations Between 4.5 sigma and 5 sigma (should be about 1.555): 0 negative and 0 positive These represent 1.247 and 1.247 sigma from expectations Between 5 sigma and 5.5 sigma (should be about 0.1935): 0 negative and 0 positive These represent 0.43989 and 0.43989 sigma from expectations The worst deviation encountered (out of about 25) was 1.8504 sigma -------------------------------------------- Test of RandGaussQ distribution Please enter an integer seed: 1366781 How many numbers should we generate: 1000000 Enter mu: 0 Enter sigma: 1 Instantiating distribution utilizing DualRand engine... Sample fire(): -0.933146 Testing operator() ... 0 100001 200002 300003 400004 500005 600006 700007 800008 900009 Mean (should be close to 0): -0.00024951 Second moment (should be close to 1): 0.99963 Third moment (should be close to zero): -0.0023588 Fourth moment (should be close to 3): 3.0026 Fifth moment (should be close to zero): -0.0198 Sixth moment (should be close to 15): 15.047 These represent 0.24951, 0.25834, 0.96299, 0.26104, 0.73789, 0.46688 standard deviations from expectations Between 0 sigma and 0.5 sigma (should be about 191462): 191300 negative and 191581 positive These represent 0.41174 and 0.30245 sigma from expectations Between 0.5 sigma and 1 sigma (should be about 149882): 150248 negative and 150025 positive These represent 1.0253 and 0.40061 sigma from expectations Between 1 sigma and 1.5 sigma (should be about 91848): 91705 negative and 91584 positive These represent 0.49513 and 0.91409 sigma from expectations Between 1.5 sigma and 2 sigma (should be about 44057): 43780 negative and 44290 positive These represent 1.3498 and 1.1354 sigma from expectations Between 2 sigma and 2.5 sigma (should be about 16540): 16691 negative and 16391 positive These represent 1.1839 and 1.1683 sigma from expectations Between 2.5 sigma and 3 sigma (should be about 4860): 4898 negative and 4777 positive These represent 0.54642 and 1.1935 sigma from expectations Between 3 sigma and 3.5 sigma (should be about 1117): 1110 negative and 1143 positive These represent 0.20956 and 0.77838 sigma from expectations Between 3.5 sigma and 4 sigma (should be about 201): 206 negative and 208 positive These represent 0.35271 and 0.49379 sigma from expectations Between 4 sigma and 4.5 sigma (should be about 28.3): 34 negative and 25 positive These represent 1.0715 and 0.62034 sigma from expectations Between 4.5 sigma and 5 sigma (should be about 3.11): 2 negative and 2 positive These represent 0.62942 and 0.62942 sigma from expectations Between 5 sigma and 5.5 sigma (should be about 0.387): 0 negative and 0 positive These represent 0.62209 and 0.62209 sigma from expectations The worst deviation encountered (out of about 25) was 1.3498 sigma -------------------------------------------- Test of RandGaussT distribution Please enter an integer seed: 2354789 How many numbers should we generate: 1000000 Enter mu: 10 Enter sigma: 5 Instantiating distribution utilizing TripleRand engine... Sample fire(): 19.9288 Testing operator() ... 0 100001 200002 300003 400004 500005 600006 700007 800008 900009 Mean (should be close to 10): 10.007 Second moment (should be close to 25): 24.995 Third moment (should be close to zero): -0.33843 Fourth moment (should be close to 1875): 1872.6 Fifth moment (should be close to zero): -153.02 Sixth moment (should be close to 2.3438e+05): 2.3322e+05 These represent 1.4634, 0.15033, 1.1053, 0.39904, 1.8248, 0.73091 standard deviations from expectations Between 0 sigma and 0.5 sigma (should be about 191462): 191661 negative and 191168 positive These represent 0.50578 and 0.74723 sigma from expectations Between 0.5 sigma and 1 sigma (should be about 149882): 150041 negative and 150074 positive These represent 0.44543 and 0.53788 sigma from expectations Between 1 sigma and 1.5 sigma (should be about 91848): 91449 negative and 91915 positive These represent 1.3815 and 0.23199 sigma from expectations Between 1.5 sigma and 2 sigma (should be about 44057): 43899 negative and 44317 positive These represent 0.7699 and 1.2669 sigma from expectations Between 2 sigma and 2.5 sigma (should be about 16540): 16439 negative and 16617 positive These represent 0.79191 and 0.60373 sigma from expectations Between 2.5 sigma and 3 sigma (should be about 4860): 4895 negative and 4895 positive These represent 0.50328 and 0.50328 sigma from expectations Between 3 sigma and 3.5 sigma (should be about 1117): 1124 negative and 1042 positive These represent 0.20956 and 2.2453 sigma from expectations Between 3.5 sigma and 4 sigma (should be about 201): 229 negative and 180 positive These represent 1.9752 and 1.4814 sigma from expectations Between 4 sigma and 4.5 sigma (should be about 28.3): 19 negative and 26 positive These represent 1.7482 and 0.43236 sigma from expectations Between 4.5 sigma and 5 sigma (should be about 3.11): 3 negative and 6 positive These represent 0.062375 and 1.6388 sigma from expectations Between 5 sigma and 5.5 sigma (should be about 0.387): 1 negative and 0 positive These represent 0.98538 and 0.62209 sigma from expectations The worst deviation encountered (out of about 25) was 2.2453 sigma -------------------------------------------- Test of RandGeneral distribution (using a Gaussian shape) Please enter an integer seed: 1234987 How many numbers should we generate: 500000 Enter sigma: 0.06 Enter nBins for stepwise pdf test: 10000 Instantiating distribution utilizing Ranlux64 engine... Sample fire(): 0.4408 Testing operator() ... 0 50001 100002 150003 200004 250005 300006 350007 400008 450009 Mean (should be close to 0.5): 0.49988 Second moment (should be close to 0.0036): 0.0035996 Third moment (should be close to zero): 5.2049e-07 Fourth moment (should be close to 3.888e-05): 3.9082e-05 Fifth moment (should be close to zero): 2.4841e-08 Sixth moment (should be close to 6.9984e-07): 7.1025e-07 These represent 1.3553, 0.056148, 0.69561, 1.1263, 0.84186, 1.5638 standard deviations from expectations Between 0 sigma and 0.5 sigma (should be about 95731): 95879 negative and 95631 positive These represent 0.53197 and 0.35944 sigma from expectations Between 0.5 sigma and 1 sigma (should be about 74941): 74863 negative and 75293 positive These represent 0.30903 and 1.3946 sigma from expectations Between 1 sigma and 1.5 sigma (should be about 45924): 46032 negative and 45416 positive These represent 0.52884 and 2.4875 sigma from expectations Between 1.5 sigma and 2 sigma (should be about 22028.5): 22020 negative and 21866 positive These represent 0.058575 and 1.1198 sigma from expectations Between 2 sigma and 2.5 sigma (should be about 8270): 8381 negative and 8344 positive These represent 1.2308 and 0.82054 sigma from expectations Between 2.5 sigma and 3 sigma (should be about 2430): 2423 negative and 2472 positive These represent 0.14235 and 0.85409 sigma from expectations Between 3 sigma and 3.5 sigma (should be about 558.5): 574 negative and 556 positive These represent 0.65624 and 0.10585 sigma from expectations Between 3.5 sigma and 4 sigma (should be about 100.5): 101 negative and 114 positive These represent 0.04988 and 1.3468 sigma from expectations Between 4 sigma and 4.5 sigma (should be about 14.15): 10 negative and 19 positive These represent 1.1033 and 1.2893 sigma from expectations Between 4.5 sigma and 5 sigma (should be about 1.555): 4 negative and 1 positive These represent 1.9607 and 0.44507 sigma from expectations Between 5 sigma and 5.5 sigma (should be about 0.1935): 1 negative and 0 positive These represent 1.8334 and 0.43989 sigma from expectations The worst deviation encountered (out of about 25) was 2.4875 sigma Enter nBins for linearized pdf test: 1000 Sample operator(): 0.463128 Testing operator() ... 0 50001 100002 150003 200004 250005 300006 350007 400008 450009 Mean (should be close to 0.5): 0.50006 Second moment (should be close to 0.0036): 0.0036028 Third moment (should be close to zero): -4.7605e-07 Fourth moment (should be close to 3.888e-05): 3.8957e-05 Fifth moment (should be close to zero): -2.1491e-08 Sixth moment (should be close to 6.9984e-07): 6.9999e-07 These represent 0.6852, 0.39504, 0.63622, 0.42945, 0.72832, 0.02247 standard deviations from expectations Between 0 sigma and 0.5 sigma (should be about 95731): 95333 negative and 96081 positive These represent 1.4306 and 1.258 sigma from expectations Between 0.5 sigma and 1 sigma (should be about 74941): 74969 negative and 75075 positive These represent 0.11093 and 0.53089 sigma from expectations Between 1 sigma and 1.5 sigma (should be about 45924): 45820 negative and 45766 positive These represent 0.50925 and 0.77367 sigma from expectations Between 1.5 sigma and 2 sigma (should be about 22028.5): 21895 negative and 22076 positive These represent 0.91997 and 0.32733 sigma from expectations Between 2 sigma and 2.5 sigma (should be about 8270): 8310 negative and 8421 positive These represent 0.44354 and 1.6743 sigma from expectations Between 2.5 sigma and 3 sigma (should be about 2430): 2475 negative and 2443 positive These represent 0.9151 and 0.26436 sigma from expectations Between 3 sigma and 3.5 sigma (should be about 558.5): 560 negative and 545 positive These represent 0.063507 and 0.57156 sigma from expectations Between 3.5 sigma and 4 sigma (should be about 100.5): 108 negative and 91 positive These represent 0.74821 and 0.94773 sigma from expectations Between 4 sigma and 4.5 sigma (should be about 14.15): 11 negative and 17 positive These represent 0.83741 and 0.75766 sigma from expectations Between 4.5 sigma and 5 sigma (should be about 1.555): 2 negative and 2 positive These represent 0.35686 and 0.35686 sigma from expectations Between 5 sigma and 5.5 sigma (should be about 0.1935): 0 negative and 0 positive These represent 0.43989 and 0.43989 sigma from expectations The worst deviation encountered (out of about 25) was 1.6743 sigma -------------------------------------------- Test of RandPoisson distribution Please enter an integer seed: 1363971 Instantiating distribution utilizing TripleRand engine... How many numbers should we generate for each mu: 500000 Enter a value for mu: 0.12 Sample fire(): 0 Testing operator() ... 0 443889 443460 0.414589 1 52830 53215.2 2.78866 2 3149 3192.91 0.603963 3 132 131.642 0.000974309 ---- 0 496719 496675 1 3281 3324.56 Chi^2 is 3.80819 on 3 degrees of freedom. p = 0.282935 Clumps: Chi^2 is 0.574445 on 1 degrees of freedom. p = 0.448498 Mean (should be 0.12) is 0.11906 Sigma (should be 0.34641) is 0.345163 These are 1.91877 and 1.58042 standard deviations from expected values Enter a value for mu: 9.5 Sample fire(): 13 Testing operator() ... 0 37 37.4259 0.004847 1 357 355.546 0.00594454 2 1719 1688.84 0.538451 3 5250 5348.01 1.79608 4 12753 12701.5 0.208673 5 23727 24132.9 6.82641 6 38157 38210.4 0.0746223 7 51789 51857 0.0890864 8 62020 61580.2 3.14172 9 65175 65001.3 0.464332 10 61580 61751.2 0.474673 11 53199 53330.6 0.324677 12 42250 42220 0.0212483 13 30992 30853.1 0.625215 14 20950 20936 0.00930786 15 13105 13259.5 1.80006 16 7985 7872.82 1.59835 17 4377 4399.52 0.115264 18 2409 2321.97 3.2621 19 1190 1160.98 0.725175 20 519 551.467 1.91151 21 268 249.473 1.37584 22 115 107.727 0.491004 23 77 72.5389 0.274359 ---- 0 2113 2081.82 1 41730 42182.4 2 151966 151648 3 179954 180083 4 94192 94009.2 5 25467 25531.8 6 4118 4034.42 7 433 401.697 8 27 28.0429 Chi^2 is 26.159 on 23 degrees of freedom. p = 0.29342 Clumps: Chi^2 is 10.8103 on 8 degrees of freedom. p = 0.212679 Mean (should be 9.5) is 9.50529 Sigma (should be 3.08221) is 3.08259 These are 1.21269 and 0.121219 standard deviations from expected values Enter a value for mu: 130.5 Sample fire(): 118 Testing operator() ... 91 78 81.3848 0.140772 92 31 36.7233 0.891984 93 34 51.5311 5.96418 94 74 71.5406 0.0845505 95 97 98.2742 0.0165198 96 136 133.591 0.0434251 97 158 179.729 2.62693 98 246 239.333 0.185744 99 338 315.484 1.60698 100 413 411.706 0.00406449 101 494 531.957 2.70841 102 712 680.592 1.44938 103 872 862.304 0.109025 104 1059 1082.03 0.48999 105 1402 1344.8 2.43267 106 1676 1655.63 0.250609 107 2083 2019.25 2.01264 108 2486 2439.93 0.869976 109 2972 2921.2 0.883503 110 3558 3465.6 2.46344 111 4164 4074.42 1.9693 112 4758 4747.43 0.0235237 113 5427 5482.65 0.564941 114 6217 6276.2 0.558329 115 7040 7122.12 0.946825 116 8041 8012.38 0.102209 117 8871 8936.89 0.485775 118 9898 9883.59 0.0210006 119 10851 10838.7 0.0138899 120 11823 11787.1 0.109225 121 12683 12712.6 0.0687068 122 13687 13598.3 0.579041 123 14235 14427.4 2.56652 124 15236 15183.7 0.180121 125 15852 15851.8 2.8726e-06 126 16333 16417.9 0.439259 127 16744 16870.4 0.946806 128 17273 17199.9 0.310814 129 17236 17399.9 1.54355 130 17519 17466.8 0.15597 131 17390 17400.1 0.00590683 132 17133 17202.4 0.280056 133 16951 16879.1 0.306652 134 16447 16438.2 0.0047273 135 15923 15890.2 0.0675176 136 15209 15247.6 0.0978445 137 14572 14524.2 0.157328 138 13776 13734.8 0.123352 139 12925 12894.9 0.0700798 140 11904 12019.9 1.11803 141 11134 11124.8 0.00756807 142 10328 10223.9 1.06056 143 9276 9330.18 0.314566 144 8490 8455.47 0.141001 145 7632 7609.92 0.0640402 146 6803 6802.02 0.000140821 147 6044 6038.53 0.00495662 148 5392 5324.51 0.855361 149 4664 4663.42 7.30132e-05 150 3993 4057.17 1.01501 151 3535 3506.36 0.233863 152 3055 3010.4 0.660817 153 2563 2567.69 0.00857589 154 2141 2175.87 0.558798 155 1857 1831.94 0.342763 156 1499 1532.49 0.731852 157 1239 1273.82 0.951862 158 1076 1052.11 0.542389 159 844 863.526 0.441503 160 723 704.313 0.495805 161 538 570.887 1.89455 162 515 459.881 6.60617 163 374 368.187 0.0917677 164 275 292.978 1.10322 165 238 231.719 0.170243 166 196 182.165 1.05077 167 138 142.35 0.132949 168 94 110.576 2.48476 169 75 85.3854 1.26317 170 56 65.5458 1.39022 171 43 50.0218 0.98569 172 35 37.9526 0.229704 173 20 28.629 2.60084 174 78 80.9759 0.109369 ---- 8 854 892.107 9 14507 14264.9 10 80648 80627.1 11 174188 174529 12 156302 156180 13 61447 61365.7 14 11081 11126 15 924 971.828 16 49 43.4924 Chi^2 is 67.597 on 83 degrees of freedom. p = 0.889909 Clumps: Chi^2 is 9.84423 on 8 degrees of freedom. p = 0.276129 Mean (should be 130.5) is 130.492 Sigma (should be 11.4237) is 11.4284 These are 0.466962 and 0.414307 standard deviations from expected values Enter a value for mu: 0 -------------------------------------------- Test of RandPoissonQ distribution Please enter an integer seed: 1323456 Instantiating distribution utilizing TripleRand engine... How many numbers should we generate for each mu: 500000 Enter a value for mu: 1.4 Sample fire(): 0 Testing operator() ... 0 123148 123298 0.183659 1 172841 172618 0.288411 2 121143 120833 0.79782 3 55933 56388.5 3.67957 4 19803 19736 0.227609 5 5503 5526.07 0.0963413 6 1291 1289.42 0.00194302 7 279 257.883 1.72911 8 59 53.274 0.615441 ---- 0 295989 295916 1 177076 177221 2 25306 25262.1 3 1570 1547.3 4 59 53.274 Chi^2 is 7.61991 on 8 degrees of freedom. p = 0.471451 Clumps: Chi^2 is 1.16141 on 4 degrees of freedom. p = 0.884411 Mean (should be 1.4) is 1.39966 Sigma (should be 1.18322) is 1.18302 These are 0.200798 and 0.143597 standard deviations from expected values Enter a value for mu: 36.5 Sample fire(): 36 Testing operator() ... 16 64 57.508 0.732875 17 70 71.636 0.0373644 18 149 145.262 0.0961904 19 268 279.056 0.438024 20 500 509.277 0.168991 21 914 885.172 0.938863 22 1416 1468.58 1.88259 23 2419 2330.57 3.35505 24 3490 3544.41 0.835378 25 5172 5174.85 0.00156413 26 7222 7264.69 0.250819 27 9763 9820.78 0.339941 28 12854 12802.1 0.210504 29 16056 16113 0.201444 30 19763 19604.1 1.28769 31 23412 23082.3 4.7103 32 26121 26328.2 1.63079 33 29273 29120.6 0.797616 34 31090 31261.8 0.944306 35 32608 32601.6 0.0012532 36 32961 33054.4 0.263962 37 32887 32607.7 2.39187 38 31142 31320.6 1.01821 39 29028 29312.9 2.76806 40 26733 26748 0.00838496 41 23878 23812.2 0.1817 42 20659 20694 0.0590449 43 17526 17565.8 0.0901742 44 14563 14571.6 0.00510983 45 11751 11819.2 0.393649 46 9368 9378.29 0.0112822 47 7344 7283.14 0.50861 48 5596 5538.22 0.602838 49 4161 4125.41 0.307071 50 3080 3011.55 1.55591 51 2160 2155.32 0.010147 52 1521 1512.87 0.0436761 53 1030 1041.88 0.13553 54 726 704.236 0.672619 55 432 467.356 2.67479 56 291 304.616 0.608643 57 212 195.061 1.47092 58 126 122.754 0.0858297 59 86 75.9411 1.33237 60 46 46.1975 0.000844299 61 69 65.3406 0.204947 ---- 2 134 129.144 3 5666 5617.92 4 54557 54719.8 5 162267 161999 6 176629 176856 7 81211 81312 8 17548 17385.3 9 1873 1869.96 10 115 111.538 Chi^2 is 36.2677 on 45 degrees of freedom. p = 0.820234 Clumps: Chi^2 is 3.57511 on 8 degrees of freedom. p = 0.893283 Mean (should be 36.5) is 36.5002 Sigma (should be 6.04152) is 6.04718 These are 0.0224719 and 0.929886 standard deviations from expected values Enter a value for mu: 100 Sample fire(): 110 Testing operator() ... 65 63 61.5743 0.033012 66 35 34.1702 0.0201507 67 63 51.0003 2.82337 68 72 75.0005 0.120036 69 124 108.696 2.15465 70 165 155.28 0.608381 71 217 218.705 0.0132898 72 318 303.757 0.667871 73 413 416.105 0.0231717 74 556 562.304 0.0706795 75 760 749.739 0.140434 76 978 986.499 0.0732157 77 1228 1281.17 2.20638 78 1699 1642.52 1.942 79 2114 2079.14 0.584426 80 2569 2598.93 0.344615 81 3196 3208.55 0.0491034 82 3923 3912.87 0.0262348 83 4742 4714.3 0.162769 84 5655 5612.26 0.325473 85 6530 6602.66 0.799592 86 7648 7677.51 0.113437 87 8777 8824.73 0.258109 88 10113 10028.1 0.718827 89 11419 11267.5 2.03635 90 12627 12519.5 0.923538 91 13822 13757.7 0.300879 92 14896 14954 0.224804 93 15930 16079.5 1.39089 94 16900 17105.9 2.47844 95 18125 18006.2 0.78363 96 19012 18756.5 3.48116 97 19152 19336.6 1.76174 98 19786 19731.2 0.152234 99 20051 19930.5 0.728564 100 19940 19930.5 0.00452976 101 19778 19733.2 0.10186 102 19475 19346.2 0.856944 103 18824 18782.8 0.0905517 104 17895 18060.3 1.51376 105 17189 17200.3 0.00746167 106 16165 16226.7 0.234799 107 15274 15165.2 0.781086 108 14022 14041.8 0.0279714 109 12845 12882.4 0.108592 110 11621 11711.3 0.69587 111 10647 10550.7 0.879002 112 9293 9420.27 1.71934 113 8297 8336.52 0.187335 114 7331 7312.74 0.0456173 115 6397 6358.9 0.228274 116 5433 5481.81 0.434618 117 4625 4685.31 0.776278 118 3899 3970.6 1.29114 119 3217 3336.64 4.28979 120 2767 2780.53 0.0658604 121 2306 2297.96 0.0281251 122 1911 1883.57 0.399329 123 1530 1531.36 0.00121004 124 1250 1234.97 0.182951 125 973 987.975 0.22698 126 821 784.107 1.73584 127 667 617.407 3.98351 128 457 482.349 1.33221 129 358 373.914 0.67733 130 300 287.626 0.532314 131 211 219.562 0.333889 132 156 166.335 0.642141 133 119 125.064 0.294012 134 93 93.3312 0.00117553 135 82 69.1342 2.39429 136 53 50.834 0.0922914 137 28 37.1051 2.23428 138 73 92.0547 3.94421 ---- 6 357 330.442 7 8448 8395.22 8 64572 64447.4 9 170301 170178 10 171407 171369 11 70760 71164.8 12 13040 12974.2 13 1083 1095.22 14 32 45.8233 Chi^2 is 61.9182 on 73 degrees of freedom. p = 0.819169 Clumps: Chi^2 is 9.74769 on 8 degrees of freedom. p = 0.283183 Mean (should be 100) is 99.9808 Sigma (should be 10) is 9.99529 These are 1.35722 and 0.469398 standard deviations from expected values Enter a value for mu: 104.5 Sample fire(): 95 Testing operator() ... 69 78 70.7124 0.751062 70 34 37.5779 0.340653 71 61 55.3082 0.585737 72 83 80.2738 0.0925871 73 119 114.912 0.145398 74 165 162.275 0.0457588 75 225 226.103 0.0053827 76 321 310.892 0.328647 77 417 421.925 0.0574814 78 557 565.271 0.121019 79 718 747.732 1.18222 80 969 976.725 0.0610925 81 1250 1260.1 0.0808807 82 1574 1605.85 0.631834 83 2055 2021.83 0.544272 84 2520 2515.25 0.00897218 85 3202 3092.28 3.89327 86 3650 3757.48 3.07419 87 4484 4513.29 0.190094 88 5352 5359.53 0.0105872 89 6310 6292.93 0.0462788 90 7306 7306.8 8.67647e-05 91 8440 8390.77 0.288823 92 9414 9530.82 1.43192 93 10725 10709.4 0.0228277 94 11939 11905.6 0.0935698 95 13123 13096.2 0.0549025 96 14204 14255.7 0.187813 97 15356 15358 0.000258347 98 16195 16376.6 2.01452 99 17728 17286.4 11.2787 100 18226 18064.3 1.44676 101 18558 18690.3 0.936903 102 19265 19148.4 0.709698 103 19158 19427.3 3.73264 104 19218 19520.7 4.69344 105 19334 19427.7 0.452213 106 19113 19152.8 0.0827476 107 18543 18705.3 1.40848 108 18081 18099.1 0.0181486 109 17408 17351.9 0.181296 110 16642 16484.3 1.50834 111 15450 15519 0.306953 112 14569 14479.8 0.549513 113 13572 13390.6 2.45711 114 12414 12274.7 1.58025 115 11259 11154 0.988617 116 10047 10048.2 0.000144949 117 8955 8974.68 0.0431571 118 7860 7947.92 0.972488 119 6922 6979.47 0.473259 120 6111 6077.96 0.179635 121 5121 5249.15 3.12835 122 4386 4496.19 2.70066 123 3979 3819.94 6.62341 124 3210 3219.22 0.0264133 125 2774 2691.27 2.5432 126 2249 2232.04 0.128802 127 1812 1836.6 0.329593 128 1541 1499.41 1.15335 129 1280 1214.64 3.51681 130 949 976.385 0.768095 131 782 778.872 0.0125601 132 629 616.607 0.249075 133 465 484.477 0.783024 134 394 377.82 0.692918 135 280 292.461 0.530892 136 230 224.722 0.123987 137 173 171.412 0.0147179 138 121 129.801 0.596723 139 99 97.5841 0.020544 140 68 72.8396 0.321547 141 55 53.9839 0.0191242 142 42 39.7276 0.129979 143 21 29.0317 2.222 144 61 72.5299 1.83289 ---- 6 78 70.7124 7 2700 2722.27 8 31366 31395.3 9 124430 124216 10 186904 187588 11 117690 117253 12 32463 32336.4 13 4122 4150.14 14 247 268.113 Chi^2 is 78.7613 on 75 degrees of freedom. p = 0.360784 Clumps: Chi^2 is 7.80106 on 8 degrees of freedom. p = 0.45314 Mean (should be 104.5) is 104.508 Sigma (should be 10.2225) is 10.226 These are 0.572048 and 0.335223 standard deviations from expected values Enter a value for mu: 235.8 Sample fire(): 203 Testing operator() ... 183 98 102.415 0.190296 184 22 31.0742 2.64983 185 26 39.607 4.67471 186 58 50.2115 1.20811 187 55 63.3148 1.09194 188 67 79.4129 1.94025 189 89 99.0771 1.02494 190 126 122.96 0.0751647 191 152 151.801 0.000261533 192 187 186.43 0.00174094 193 204 227.773 2.4813 194 285 276.85 0.239902 195 332 334.776 0.0230179 196 391 402.756 0.343142 197 485 482.08 0.0176809 198 563 574.114 0.215151 199 684 680.282 0.020322 200 804 802.052 0.00472983 201 930 940.915 0.12662 202 1105 1098.36 0.0401981 203 1292 1275.82 0.205104 204 1432 1474.7 1.23649 205 1691 1696.27 0.0163538 206 1975 1941.65 0.57285 207 2289 2211.79 2.69515 208 2487 2507.41 0.166073 209 2764 2828.93 1.49029 210 3157 3176.48 0.119515 211 3616 3549.83 1.23327 212 3928 3948.35 0.104918 213 4387 4370.99 0.0586127 214 4842 4816.26 0.137529 215 5190 5282.21 1.60964 216 5938 5766.41 5.10589 217 6185 6265.99 1.04682 218 6839 6777.62 0.555938 219 7293 7297.54 0.00282848 220 7732 7821.64 1.02731 221 8332 8345.44 0.0216498 222 8734 8864.21 1.91278 223 9360 9373.01 0.0180587 224 9865 9866.77 0.000316423 225 10476 10340.4 1.77895 226 10884 10788.8 0.840759 227 11222 11207 0.0200708 228 11630 11590.4 0.135301 229 11960 11934.6 0.0541913 230 12171 12235.5 0.340303 231 12451 12489.8 0.120361 232 12540 12694.3 1.87664 233 13047 12846.9 3.11683 234 13071 12945.7 1.21241 235 12850 12989.8 1.50433 236 13026 12978.8 0.171794 237 12865 12913.1 0.178909 238 12730 12793.7 0.317171 239 12671 12622.4 0.187091 240 12301 12401.5 0.814636 241 12160 12133.9 0.0560214 242 11858 11823.1 0.103265 243 11584 11472.7 1.07886 244 10856 11087.2 4.82062 245 10634 10670.9 0.127263 246 10271 10228.4 0.177414 247 9831 9764.6 0.451481 248 9349 9284.25 0.45161 249 8677 8792.07 1.50605 250 8459 8292.68 3.33571 251 7770 7790.49 0.0539169 252 7296 7289.68 0.00548394 253 6809 6794.09 0.0327009 254 6345 6307.27 0.225657 255 5838 5832.37 0.0054289 256 5328 5372.16 0.36304 257 4898 4929.01 0.195109 258 4468 4504.89 0.302038 259 4197 4101.36 2.23022 260 3727 3719.62 0.0146489 261 3347 3360.48 0.0540953 262 2940 3024.43 2.3572 263 2598 2711.64 4.76256 264 2499 2421.99 2.44871 265 2140 2155.11 0.105981 266 1933 1910.43 0.266532 267 1632 1687.19 1.80552 268 1468 1484.48 0.182908 269 1324 1301.26 0.397264 270 1158 1136.44 0.409147 271 1015 988.826 0.692827 272 837 857.225 0.47717 273 744 740.416 0.0173472 274 626 637.19 0.196521 275 572 546.362 1.20309 276 508 466.783 3.63949 277 389 397.355 0.175688 278 361 337.037 1.7037 279 283 284.851 0.0120265 280 226 239.885 0.803705 281 200 201.299 0.00837779 282 163 168.32 0.168141 283 129 140.247 0.901909 284 121 116.444 0.178232 285 108 96.3424 1.4106 286 83 79.4319 0.160278 287 59 65.2615 0.600755 288 61 53.4328 1.07166 289 43 43.5968 0.00816857 290 34 35.4487 0.0592029 291 25 28.7244 0.482903 292 133 113.119 3.49421 ---- 11 32 33.6744 12 1337 1397.25 13 19224 19251.9 14 95398 95522.8 15 183594 183371 16 144200 144133 17 48337 48516.4 18 7332 7258.68 19 546 515.357 Chi^2 is 94.1689 on 109 degrees of freedom. p = 0.843355 Clumps: Chi^2 is 6.41348 on 8 degrees of freedom. p = 0.60102 Mean (should be 235.8) is 235.808 Sigma (should be 15.3558) is 15.3533 These are 0.389108 and 0.163437 standard deviations from expected values Enter a value for mu: 0 -------------------------------------------- Test of RandPoissonT distribution Please enter an integer seed: 1357531 Instantiating distribution utilizing TripleRand engine... How many numbers should we generate for each mu: 500000 Enter a value for mu: 1.4 Sample fire(): 0 Testing operator() ... 0 123493 123298 0.306875 1 172488 172618 0.0977156 2 120582 120833 0.519367 3 56258 56388.5 0.302043 4 19999 19736 3.50533 5 5509 5526.07 0.0527511 6 1359 1289.42 3.75501 7 263 257.883 0.101516 8 49 53.274 0.34289 ---- 0 295981 295916 1 176840 177221 2 25508 25262.1 3 1622 1547.3 4 49 53.274 Chi^2 is 8.98349 on 8 degrees of freedom. p = 0.34369 Clumps: Chi^2 is 7.17701 on 4 degrees of freedom. p = 0.126824 Mean (should be 1.4) is 1.40072 Sigma (should be 1.18322) is 1.18567 These are 0.431478 and 1.78031 standard deviations from expected values Enter a value for mu: 99.1 Sample fire(): 96 Testing operator() ... 64 57 54.5885 0.106528 65 33 30.8208 0.154079 66 47 46.2779 0.0112666 67 72 68.4499 0.184125 68 111 99.7556 1.26745 69 136 143.272 0.369124 70 180 202.833 2.57022 71 265 283.109 1.15828 72 377 389.667 0.411796 73 535 528.987 0.068353 74 671 708.413 1.97592 75 892 936.05 2.073 76 1197 1220.56 0.454785 77 1577 1570.88 0.0238658 78 1964 1995.82 0.507299 79 2486 2503.62 0.123958 80 3112 3101.36 0.0365374 81 3771 3794.37 0.143986 82 4605 4585.64 0.0817387 83 5440 5475.14 0.225573 84 6414 6459.37 0.31861 85 7497 7530.86 0.152241 86 8590 8678 0.892427 87 10091 9884.94 4.29535 88 11200 11131.8 0.417905 89 12369 12395.1 0.0548118 90 13389 13648.3 4.92802 91 14896 14863.2 0.0723976 92 15973 16010.2 0.0866564 93 17108 17060.4 0.132908 94 17951 17986 0.0681034 95 18711 18762.2 0.139918 96 19641 19368.1 3.8452 97 19755 19787.4 0.053084 98 20076 20009.5 0.220918 99 20040 20029.7 0.00527093 100 19835 19849.5 0.0105302 101 19289 19476.1 1.79648 102 18884 18922.3 0.0776066 103 18115 18205.8 0.453303 104 17283 17348.1 0.244063 105 16407 16373.3 0.0694733 106 15254 15307.5 0.186744 107 14130 14177.3 0.15773 108 13192 13009 2.57501 109 12053 11827.4 4.30219 110 10620 10655.4 0.117842 111 9533 9513.1 0.0416453 112 8387 8417.39 0.109727 113 7438 7381.98 0.42516 114 6460 6417.14 0.286261 115 5514 5529.9 0.0457209 116 4814 4724.25 1.70499 117 4056 4001.48 0.742798 118 3440 3360.57 1.87759 119 2786 2798.59 0.05663 120 2361 2311.17 1.07444 121 1878 1892.87 0.11675 122 1491 1537.57 1.41025 123 1231 1238.8 0.0491476 124 959 990.043 0.973374 125 792 784.906 0.0641108 126 617 617.335 0.000181805 127 501 481.716 0.771996 128 355 372.953 0.864245 129 270 286.509 0.951284 130 207 218.408 0.59588 131 161 165.223 0.107949 132 115 124.043 0.659198 133 92 92.4257 0.00196095 134 72 68.3537 0.194516 135 52 50.1766 0.0662584 136 40 36.5625 0.323176 137 87 90.1474 0.109891 ---- 6 21 21.3177 7 880 907.788 8 12811 12955.3 9 69977 69935.2 10 157500 157495 11 159237 159689 12 78011 77475.6 13 18994 18916 14 2390 2426.97 15 179 176.887 Chi^2 is 51.2478 on 73 degrees of freedom. p = 0.975104 Clumps: Chi^2 is 8.38105 on 9 degrees of freedom. p = 0.496248 Mean (should be 99.1) is 99.1201 Sigma (should be 9.9549) is 9.94589 These are 1.42474 and 0.902668 standard deviations from expected values Enter a value for mu: 100 Sample fire(): 115 Testing operator() ... 65 47 61.5743 3.44965 66 25 34.1702 2.461 67 42 51.0003 1.58834 68 79 75.0005 0.213283 69 126 108.696 2.75462 70 161 155.28 0.210672 71 225 218.705 0.181198 72 288 303.757 0.817348 73 417 416.105 0.00192448 74 565 562.304 0.0129239 75 815 749.739 5.68065 76 1000 986.499 0.184781 77 1317 1281.17 1.00221 78 1650 1642.52 0.0340464 79 1980 2079.14 4.72746 80 2662 2598.93 1.53071 81 3167 3208.55 0.538113 82 3841 3912.87 1.32001 83 4695 4714.3 0.079005 84 5637 5612.26 0.109052 85 6633 6602.66 0.139418 86 7725 7677.51 0.293738 87 8903 8824.73 0.694285 88 10029 10028.1 8.12547e-05 89 11225 11267.5 0.160495 90 12363 12519.5 1.95564 91 13704 13757.7 0.209309 92 14932 14954 0.032308 93 16193 16079.5 0.80047 94 17234 17105.9 0.959252 95 18071 18006.2 0.233102 96 18619 18756.5 1.00758 97 19281 19336.6 0.159696 98 20074 19731.2 5.95587 99 20082 19930.5 1.15164 100 20239 19930.5 4.77526 101 19622 19733.2 0.626257 102 19262 19346.2 0.366826 103 18679 18782.8 0.573183 104 18114 18060.3 0.1594 105 17039 17200.3 1.51317 106 16370 16226.7 1.26505 107 15093 15165.2 0.343394 108 13909 14041.8 1.2563 109 12759 12882.4 1.18209 110 11807 11711.3 0.782436 111 10590 10550.7 0.146403 112 9408 9420.27 0.0159715 113 8272 8336.52 0.499327 114 7223 7312.74 1.10116 115 6371 6358.9 0.0230224 116 5480 5481.81 0.000598168 117 4711 4685.31 0.140878 118 3962 3970.6 0.0186283 119 3284 3336.64 0.830434 120 2688 2780.53 3.07936 121 2340 2297.96 0.769075 122 1818 1883.57 2.28289 123 1543 1531.36 0.0884575 124 1277 1234.97 1.4305 125 974 987.975 0.197678 126 797 784.107 0.211994 127 610 617.407 0.0888662 128 475 482.349 0.11198 129 355 373.914 0.956767 130 280 287.626 0.202211 131 241 219.562 2.09318 132 162 166.335 0.112974 133 98 125.064 5.85662 134 94 93.3312 0.0047921 135 67 69.1342 0.0658863 136 55 50.834 0.341416 137 28 37.1051 2.23428 138 97 92.0547 0.265664 ---- 6 319 330.442 7 8418 8395.22 8 64517 64447.4 9 170553 170178 10 171086 171369 11 71108 71164.8 12 12877 12974.2 13 1067 1095.22 14 55 45.8233 Chi^2 is 76.6642 on 73 degrees of freedom. p = 0.361929 Clumps: Chi^2 is 5.1682 on 8 degrees of freedom. p = 0.739457 Mean (should be 100) is 99.9835 Sigma (should be 10) is 9.98948 These are 1.16489 and 1.04919 standard deviations from expected values Enter a value for mu: 130.5 Sample fire(): 141 Testing operator() ... 91 82 81.3848 0.00465078 92 30 36.7233 1.23091 93 45 51.5311 0.827767 94 74 71.5406 0.0845505 95 99 98.2742 0.00536107 96 119 133.591 1.59374 97 172 179.729 0.332347 98 246 239.333 0.185744 99 303 315.484 0.493991 100 392 411.706 0.943251 101 538 531.957 0.0686415 102 712 680.592 1.44938 103 893 862.304 1.09271 104 1083 1082.03 0.000877346 105 1333 1344.8 0.103598 106 1622 1655.63 0.683131 107 1978 2019.25 0.842683 108 2387 2439.93 1.14811 109 3127 2921.2 14.4991 110 3370 3465.6 2.6373 111 4113 4074.42 0.36522 112 4658 4747.43 1.68473 113 5506 5482.65 0.0994103 114 6295 6276.2 0.0563376 115 7187 7122.12 0.591067 116 8081 8012.38 0.587627 117 9074 8936.89 2.10359 118 9876 9883.59 0.00583329 119 10810 10838.7 0.0761548 120 11921 11787.1 1.52065 121 12832 12712.6 1.1223 122 13578 13598.3 0.0301994 123 14412 14427.4 0.0164963 124 15252 15183.7 0.307197 125 16107 15851.8 4.10893 126 16486 16417.9 0.282291 127 16783 16870.4 0.452628 128 17361 17199.9 1.50922 129 17412 17399.9 0.00843864 130 17306 17466.8 1.48043 131 17437 17400.1 0.0780916 132 17067 17202.4 1.06588 133 16603 16879.1 4.51487 134 16357 16438.2 0.400955 135 15792 15890.2 0.607425 136 15292 15247.6 0.129144 137 14397 14524.2 1.11395 138 13613 13734.8 1.08081 139 13063 12894.9 2.19036 140 12015 12019.9 0.00201804 141 11153 11124.8 0.0713602 142 10226 10223.9 0.000443665 143 9304 9330.18 0.0734332 144 8332 8455.47 1.80299 145 7676 7609.92 0.573726 146 6753 6802.02 0.35329 147 6038 6038.53 4.63612e-05 148 5334 5324.51 0.0169006 149 4684 4663.42 0.0908521 150 4199 4057.17 4.95791 151 3403 3506.36 3.04707 152 2982 3010.4 0.267891 153 2570 2567.69 0.00207354 154 2119 2175.87 1.48636 155 1819 1831.94 0.0914251 156 1526 1532.49 0.0274816 157 1322 1273.82 1.82225 158 1039 1052.11 0.1634 159 859 863.526 0.0237179 160 670 704.313 1.67168 161 590 570.887 0.639873 162 471 459.881 0.268814 163 390 368.187 1.29226 164 260 292.978 3.71211 165 226 231.719 0.141159 166 171 182.165 0.684284 167 114 142.35 5.64622 168 104 110.576 0.391043 169 101 85.3854 2.85548 170 62 65.5458 0.191819 171 49 50.0218 0.0208733 172 39 37.9526 0.0289055 173 30 28.629 0.0656564 174 94 80.9759 2.09477 ---- 8 867 892.107 9 14368 14264.9 10 80891 80627.1 11 174966 174529 12 155578 156180 13 61275 61365.7 14 11065 11126 15 941 971.828 16 49 43.4924 Chi^2 is 90.3976 on 83 degrees of freedom. p = 0.271148 Clumps: Chi^2 is 7.87616 on 8 degrees of freedom. p = 0.44566 Mean (should be 130.5) is 130.477 Sigma (should be 11.4237) is 11.4211 These are 1.45102 and 0.223599 standard deviations from expected values Enter a value for mu: 0 -------------------------------------------- Test of SkewNormal distribution Please enter an integer seed: 1357924 How many numbers should we generate: 500000 Enter k: 0 Instantiating distribution utilizing TripleRand engine... Sample fire(): -0.840613 Testing operator() ... 0 50001 100002 150003 200004 250005 300006 350007 400008 450009 Mean (should be close to 0): 0.00061911 Second moment (should be close to 1): 1.003 Third moment (should be close to 0): 0.0027104 Fourth moment (should be close to 3): 3.0107 Fifth moment (should be close to 0): 0.032555 Sixth moment (should be close to 15): 15.04 These represent 0.43778, 1.4884, 0.49486, 0.77532, 0.74883, 0.28291 standard deviations from expectations The worst deviation encountered (out of about 25) was 1.4884 sigma -------------------------------------------- Test of SkewNormal distribution Please enter an integer seed: 1357924 How many numbers should we generate: 500000 Enter k: -2 Instantiating distribution utilizing TripleRand engine... Sample fire(): -1.90152 Testing operator() ... 0 50001 100002 150003 200004 250005 300006 350007 400008 450009 Mean (should be close to -0.71365): -0.71456 Second moment (should be close to 1): 1.0034 Third moment (should be close to -1.57): -1.5773 Fourth moment (should be close to 3): 3.0154 Fifth moment (should be close to -6.3658): -6.3971 Sixth moment (should be close to 15): 15.062 These represent 0.64302, 1.7193, 1.4522, 1.1129, 0.73617, 0.43656 standard deviations from expectations The worst deviation encountered (out of about 25) was 1.7193 sigma -------------------------------------------- Test of SkewNormal distribution Please enter an integer seed: 1357924 How many numbers should we generate: 500000 Enter k: 1 Instantiating distribution utilizing TripleRand engine... Sample fire(): 0.611677 Testing operator() ... 0 50001 100002 150003 200004 250005 300006 350007 400008 450009 Mean (should be close to 0.56419): 0.56557 Second moment (should be close to 1): 1.0042 Third moment (should be close to 1.4105): 1.421 Fourth moment (should be close to 3): 3.0273 Fifth moment (should be close to 6.065): 6.1391 Sixth moment (should be close to 15): 15.212 These represent 0.97269, 2.1211, 2.0571, 1.9693, 1.7377, 1.4849 standard deviations from expectations The worst deviation encountered (out of about 25) was 2.1211 sigma -------------------------------------------- Test of SkewNormal distribution Please enter an integer seed: 1357924 How many numbers should we generate: 500000 Enter k: 5 Instantiating distribution utilizing TripleRand engine... Sample fire(): 1.50767 Testing operator() ... 0 50001 100002 150003 200004 250005 300006 350007 400008 450009 Mean (should be close to 0.78239): 0.78381 Second moment (should be close to 1): 1.0044 Third moment (should be close to 1.5949): 1.6065 Fourth moment (should be close to 3): 3.0302 Fifth moment (should be close to 6.383): 6.4649 Sixth moment (should be close to 15): 15.234 These represent 1.0055, 2.2043, 2.3215, 2.1766, 1.9257, 1.644 standard deviations from expectations The worst deviation encountered (out of about 25) was 2.3215 sigma clhep-2.1.4.1.orig/Random/test/MTwistEngine.oldsav0000644000175000017500000001506310233771102020364 0ustar olesoles123 3391908444 2613733643 1023283129 319758774 843980002 2256238577 3052271407 3379612964 1676702864 1176039815 2505546077 2103090122 1191228886 544718029 25761011 3047516408 2073309124 1184342275 777005857 4235748430 3542910762 3042800873 694520119 1279274636 3226371480 4280011967 1380965893 386338722 2026078014 3998267941 3205623579 3856578464 794266348 1594400123 1598843305 623379782 3711374514 1664442913 1528864671 4283601076 3165554176 4181160343 4047953677 289063162 1900256582 1764781469 1935635555 3469978760 3748737108 1732284403 224639249 2141492958 826477818 4283187161 4207227559 4096403228 2502514696 1460807887 4096829557 3995055826 3453807470 2534511477 215753675 4237053040 3395530428 2649246827 1043821337 2449341718 2222747010 34346513 1587371599 894640324 2641938544 2506177191 4112618877 2519461354 2552077558 2385528045 942360019 2791866968 351145700 415781795 325793281 2805210606 2067753290 807399753 1945592855 810645164 1931652984 1128279391 2369371045 1023629890 321663390 1891211717 3652026427 280352640 96084044 668497243 3289604617 3835661478 1198188882 1644188481 406246335 251850580 4273687264 3333158199 393347501 3989770394 3427235174 3647907517 526071363 2997813736 1318464884 2274303891 3224061572 2624435657 1915352163 3768636722 2284575546 1424086259 1689904137 805284748 3050764464 3505440149 2423196551 1502081966 306427014 2778022831 1551763053 548292184 991962988 3401159393 4208958395 1179761306 2339307954 895910091 1787862929 3608562756 200260952 2457173197 3775083775 1666345558 3458169022 507548519 170627797 13602800 1896634196 1097346937 1798544211 4251236706 974754186 3448971587 1089906297 3824245980 3393161504 664334533 4089397495 4129677982 3799855734 89843679 1904530717 4285401448 2358550588 3430096977 2892565931 4197002250 2191853122 3459957659 2127370305 3804779540 307928904 3051207485 2987782959 1463872326 2593052654 3255905367 344017157 3910825408 4188738340 4020624681 2558521283 476209554 3842683866 2265005587 165255977 261319276 1068634128 342562421 4104052327 1496717454 3688483686 1206031055 776363149 3391617080 2450544204 3527055809 1680250843 1884995706 2257947346 1325636907 409769329 1028353764 2271404536 807918445 454021215 205528822 3416854302 3347761223 3230210421 3198214864 3595059444 3777743705 492941363 2206380866 1005281834 1904300515 3154982041 172853308 3697858304 1420779813 2034955479 1295716734 4140145110 3366834559 260049981 1463710149 205735294 2480399775 1495008070 564054197 4256305694 174066419 10599318 2696032685 984892990 1575759711 4058793870 2748091629 2491280222 14525243 2636563758 1856982837 1251985998 1663840127 3001521798 166960085 287879358 4265221811 304105414 320529901 3994275150 2872000287 1543293406 1194473661 2687438686 626171627 1202612270 3937873701 1800569598 1265436287 2979672710 727249429 2767063230 2183298899 2620480566 708682285 1318078302 3876371679 785015918 4169904653 2511587742 272997819 3566093518 796182581 59677166 4261027103 3968536710 356407669 3141392222 166148947 1235302598 4128421357 1367705678 336916154 856859674 1763571294 4023993156 1985751050 3344106678 3668895338 3467665552 758609618 3690589738 2500771342 3506452188 1831715866 725156854 3687969930 159375016 1861715466 2272540122 1984432894 3439910740 2124177610 4077528294 4110575498 3154096208 3157500482 975155450 2276694014 3760152140 2895379754 1119724022 2674213274 404366408 2859909338 1243990010 1225062590 637939492 2859635850 1816513334 1296367338 359911472 2440263570 1556009802 394654030 3021284764 3611049946 523145462 3662195114 412420648 1420646570 2232546714 2703185406 2878315636 1887398314 2353748454 2585663786 2723894736 4105856322 2839061722 1796249675 3290110907 2605068179 3095166365 809439879 1520929063 4180784411 1765159353 50604603 3156672867 1225064067 995664269 2943240263 2535530671 2954412707 511956281 4152313563 2505511115 951761283 462095453 2010661783 1015579975 3310415947 2250413913 2654084027 2163645971 142033763 692870717 568979655 636678095 4028214547 1932301449 2630529035 1672723899 3015160019 2956380925 3188332135 3210064903 3623001403 2696760985 1768077083 6434243 1166046723 3960641293 21447239 2052136399 3014986979 2703524761 1301191195 3539091595 2044203715 2821860317 744318583 3712085959 3926017579 4244497177 4036157115 3061082995 486297923 409613501 465409319 3607183439 3569324179 3710995049 1575082187 3210702715 1490036115 1305495901 1611047431 4236865511 2788222171 689927289 3090468603 1497177251 1693987779 1823528845 511144839 1505944047 2468360995 2388223417 1681417243 4150264523 3968171779 678986461 593396311 2031005831 3912334667 452273881 351253819 1997054355 2204880931 1362929341 210354951 2337834383 2048659219 2162939081 348913611 3461002555 3342483987 3443421501 2666941543 976324039 740228731 733370969 889748059 183311363 4115130243 281103693 1372292807 3906438159 3969470371 3584864665 2304054811 1066736203 4177634435 3688611101 1577251383 3807239879 4173729579 1942853081 2180677627 2197662195 209344899 1582597117 144431847 2984254415 1503220179 3388982057 3693631947 2260167739 133272595 3945373725 2715177095 111308583 3638963227 3455108409 1067789499 828281059 3147108099 2198414605 1237607623 3084681135 2598692771 1630617145 2369792219 4109561675 1028538243 3176370525 1302533015 793775431 55257803 2686678745 2694351163 1669379475 3109224675 162149565 1130967879 2693659727 112657043 2439064201 2408544651 941481275 678855379 3997949437 1006248807 3481861511 2431523259 428233369 2172547611 2079564995 403679107 1048773645 2934971079 778087759 4217908195 4075292825 2954559387 723124875 3317615427 3970366557 3322161143 1648094151 1932282923 2524649113 1249451835 1155233523 3673221699 620603709 3626970663 1387194191 3896515347 3500169449 4006445259 4023833595 2141025427 3573374941 3921091463 3100969959 1239371227 3008549369 1630798203 3179999523 1040461379 1383132045 2085989127 3765467119 721934499 602984761 1451571227 3959973323 1568005507 611648093 2280480087 2249422471 828794443 3237525977 1151483707 585720211 2779366563 3370942909 2824216711 602156559 3114983443 3998329033 3742867275 2332992571 3874128659 683964616 3499967440 2171924286 2163713648 1464077284 713163796 2363433954 1850526432 1674748392 2570546208 1719287622 137688600 4041579252 3537407972 2808933050 1850767760 3375660808 3120697888 736388702 682746752 1665114116 1920394964 2841457714 2876044288 4065891640 3543903136 62978214 334943368 70033444 1657741460 4130627690 1097145632 2383425448 152356976 3199753886 3106131024 3739750724 3200371380 2682772930 2511323552 492984552 1758615520 368647974 3020395096 272178580 2002259428 3114335098 2955387984 1989901704 2191792320 1312650526 2304334752 1177533892 814060685 3325670179 2582369847 133 clhep-2.1.4.1.orig/Random/test/testRandom.sh.in0000755000175000017500000000021111776622027017664 0ustar olesoles#! /bin/sh # @configure_input@ # testRandom has no comparison file ./testRandom@EXEEXT@ < "@srcdir@/testRandom.input" > testRandom.out clhep-2.1.4.1.orig/Random/test/testRandDists.input-long0000755000175000017500000000060611574213256021420 0ustar olesoles1357924 1000000 20 4 1366781 1000000 0 1 2354789 1000000 10 5 1234987 500000 .06 10000 1000 1363971 1000000 .12 1.4 9.5 36.5 100.0 130.5 0 1323456 1000000 1.4 36.5 100.0 104.5 130.5 235.8 0 1357531 1000000 .12 1.4 9.5 36.5 99.1 100.0 130.5 0 1357924 1000000 0 1357924 1000000 -2 1357924 1000000 1 1357924 1000000 5 4132429 100000 1.0 11.5 4.1 0.5 12.6 2.5 .3 1.5 0 1111111 100000 -3 15 0 0 clhep-2.1.4.1.orig/Random/test/HepJamesRandom.oldsav0000644000175000017500000000372610233771102020647 0ustar olesoles123 0.4640728235244751 0.39461785554885864 0.36975836753845215 0.6521264910697937 0.85901349782943726 0.65615212917327881 0.38643825054168701 0.70392578840255737 0.65506917238235474 0.37292772531509399 0.59032237529754639 0.8152611255645752 0.77524405717849731 0.21913594007492065 0.28091764450073242 0.13783490657806396 0.16144675016403198 0.73035204410552979 0.91206574440002441 0.43129384517669678 0.52531123161315918 0.76330339908599854 0.43595212697982788 0.47654420137405396 0.46824151277542114 0.82815277576446533 0.32173073291778564 0.96219098567962646 0.37424886226654053 0.089759290218353271 0.69318819046020508 0.017406344413757324 0.53979730606079102 0.29485428333282471 0.074883997440338135 0.90476018190383911 0.93278807401657104 0.78467398881912231 0.37866681814193726 0.10878151655197144 0.37757021188735962 0.93751388788223267 0.44922637939453125 0.29848986864089966 0.86206972599029541 0.18868726491928101 0.55879920721054077 0.30729502439498901 0.7934577465057373 0.71196460723876953 0.7456430196762085 0.39395171403884888 0.16111361980438232 0.90141940116882324 0.18943911790847778 0.9512028694152832 0.32314318418502808 0.89948678016662598 0.52320319414138794 0.99470216035842896 0.60395681858062744 0.59234786033630371 0.43518340587615967 0.16201215982437134 0.85371917486190796 0.55333167314529419 0.93929272890090942 0.99868285655975342 0.18199115991592407 0.24667036533355713 0.054058730602264404 0.21622878313064575 0.38544720411300659 0.61372631788253784 0.52675950527191162 0.36143696308135986 0.60948050022125244 0.0022416114807128906 0.88378840684890747 0.49274992942810059 0.83311545848846436 0.92367696762084961 0.05624687671661377 0.72348171472549438 0.8759121298789978 0.64277809858322144 0.2067638635635376 0.37460792064666748 0.14569383859634399 0.64575916528701782 0.20384466648101807 0.50019329786300659 0.85509759187698364 0.14162176847457886 0.02689129114151001 0.47882282733917236 0.19259083271026611 0.74043691158294678 0.45623308420181274 0.99999982118606567 27 clhep-2.1.4.1.orig/Random/test/testRandDists.input0000755000175000017500000000053411574213256020463 0ustar olesoles1357924 500000 20 4 1366781 1000000 0 1 2354789 1000000 10 5 1234987 500000 .06 10000 1000 1363971 500000 .12 9.5 130.5 0 1323456 500000 1.4 36.5 100.0 104.5 235.8 0 1357531 500000 1.4 99.1 100.0 130.5 0 1357924 500000 0 1357924 500000 -2 1357924 500000 1 1357924 500000 5 4132429 100000 1.0 11.5 4.1 0.5 12.6 2.5 .3 1.5 0 1111111 100000 -3 15 0 0 clhep-2.1.4.1.orig/Random/test/Makefile.am0000755000175000017500000000765112235754600016650 0ustar olesoles# run gaussSpeed and gaussSmall interactively # Applicable to each test program: if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir) # libraries to link, and whence if BUILD_STATIC LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.a OUTFLAG = -o $@ else if BUILD_VISUAL LDADD = $(top_builddir)/src/CLHEP-@PACKAGE@-@VERSION@.$(SHEXT) OUTFLAG = /Fo$@ else LIBS += $(MY_LD)$(top_builddir)/src LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.$(SHEXT) OUTFLAG = -o $@ endif endif # normally, CXXLINK is supplied by automake, but we need to use /Fo instead # of -o when compiling with Visual C++ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ $(OUTFLAG) # Identify executables needed during testing: check_PROGRAMS = \ testRandom testRandDists gaussSpeed gaussSmall \ testSaveEngineStatus testInstanceRestore testSaveSharedEngines \ testStaticStreamSave testAnonymousEngineRestore testVectorSave \ testBug58950 testBug73093 testEngineCopy testDistCopy testRanecuSequence check_SCRIPTS = \ testRandom.sh testRandDists.sh # Identify test(s) to run when 'make check' is requested: # Note that testBug58950 uses a feature not available in cygwin if BUILD_VISUAL TESTS = \ testRandom.sh testRandDists.sh \ testSaveEngineStatus testInstanceRestore testSaveSharedEngines \ testStaticStreamSave testAnonymousEngineRestore testVectorSave \ testBug73093 testEngineCopy testDistCopy else TESTS = \ testRandom.sh testRandDists.sh \ testSaveEngineStatus testInstanceRestore testSaveSharedEngines \ testStaticStreamSave testAnonymousEngineRestore testVectorSave \ testBug58950 testBug73093 testEngineCopy testDistCopy testRanecuSequence endif # Identify the test(s) for which failure is the intended outcome: XFAIL_TESTS = # Identify the dependencies on a per-test basis: testRandDists_SOURCES = testRandDists.cc testRandom_SOURCES = testRandom.cc testSaveEngineStatus_SOURCES = testSaveEngineStatus.cc testInstanceRestore_SOURCES = testInstanceRestore.cc testSaveSharedEngines_SOURCES = testSaveSharedEngines.cc testStaticStreamSave_SOURCES = testStaticStreamSave.cc testAnonymousEngineRestore_SOURCES = testAnonymousEngineRestore.cc testVectorSave_SOURCES = testVectorSave.cc testEngineCopy_SOURCES = testEngineCopy.cc testDistCopy_SOURCES = testDistCopy.cc testRanecuSequence_SOURCES = testRanecuSequence.cc testBug58950_SOURCES = testBug58950.cc testBug73093_SOURCES = testBug73093.cc gaussSpeed_SOURCES = gaussSpeed.cc gaussSmall_SOURCES = gaussSmall.cc # Identify input data file(s) and prototype output file(s): EXTRA_DIST = \ testRandom.input testRandDists.input testRandDists.output # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = testRandom.sh testRandDists.sh \ gaussSpeed.sh gaussSmall.sh testRandom.out \ distribution.save distribution.save1 distribution.save2 \ anon_distribution.save instance_distribution.save instance2_distribution.save \ ss1_distribution.save ss2_distribution.save ss_distribution.save \ engine.save anon_engine.save instance_engine.save \ shared.save1 shared.save2 t1_shared.save t2_shared.save \ testSaveEngineStatus.cout testInstanceRestore.cout \ testSaveSharedEngines.cout testStaticStreamSave.cout \ testAnonymousEngineRestore.cout testVectorSave.cout \ anonymous.save testRanecuSequence.output # supply our own suffix rule .cc.obj: if BUILD_VISUAL # $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c $(OUTFLAG) `$(CYGPATH_W) '$<'` # mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po source='$<' object='$@' libtool=no \ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ $(CXXCOMPILE) -c $(OUTFLAG) `$(CYGPATH_W) '$<'` else if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c $(OUTFLAG) `$(CYGPATH_W) '$<'`; \ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi # source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ # $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` endif clhep-2.1.4.1.orig/Random/test/Hurd160Engine.oldsav0000644000175000017500000000010010233771102020250 0ustar olesoles19780503 3 2013148671 774905272 3666802628 814395356 298801243 clhep-2.1.4.1.orig/Random/test/gaussSmall.cc0000755000175000017500000000146007716514316017234 0ustar olesoles#include "CLHEP/Random/Randomize.h" #include "CLHEP/Random/NonRandomEngine.h" #include "CLHEP/Random/defs.h" #include #include using std::cin; using std::cout; using std::cerr; using std::endl; using namespace CLHEP; //#ifndef _WIN32 //using std::exp; //#endif // --------- // RandGauss // --------- int main() { cout << "\n--------------------------------------------\n"; cout << "Test of Gauss distribution at small r \n\n"; cout << "\nInstantiating distribution utilizing NonRandomEngine...\n"; NonRandomEngine eng; RandGauss dist (eng); double r; while (true) { cout << "r -- "; cin >> r; eng.setNextRandom(r); double x = dist.fire(); cout << " " << std::setprecision(16) << x << "\n"; if ( x > 1.0e15 ) break; } return 0; } clhep-2.1.4.1.orig/Random/test/gaussSpeed.sh.in0000755000175000017500000000015407707305616017656 0ustar olesoles#! /bin/sh # @configure_input@ # gaussSpeed has no comparison file ./gaussSpeed@EXEEXT@ > gaussSpeed.out clhep-2.1.4.1.orig/Random/test/testRandDists.sh.in0000755000175000017500000000035211776622027020345 0ustar olesoles#! /bin/sh # @configure_input@ "@builddir@/testRandDists@EXEEXT@" < "@srcdir@/testRandDists.input" \ | sed 's/e-00\([0-9]\)/e-0\1/g' \ | sed 's/e+00\([0-9]\)/e+0\1/g' \ | @DIFF_Q@ - "@srcdir@/testRandDists.output" > /dev/null clhep-2.1.4.1.orig/Random/test/DualRand.oldsav0000644000175000017500000000022110233771102017467 0ustar olesoles123 Tausworthe-begin 802101408 1815427835 2421895653 200578991 0 Tausworthe-end IntegerCong-begin 2063918419 65504413 12341 IntegerCong-end clhep-2.1.4.1.orig/Random/test/RanluxEngine.oldsav0000644000175000017500000000076210233771102020406 0ustar olesoles123 7.3313713073730469e-06 0.2933574914932251 0.40712565183639526 0.8690190315246582 0.95107603073120117 0.39580649137496948 0.99162471294403076 0.04546666145324707 0.38700234889984131 0.61554598808288574 0.576926589012146 0.166786789894104 0.82746410369873047 0.16103780269622803 0.95694607496261597 0.33520299196243286 0.83363711833953857 0.29951351881027222 0.82469093799591064 0.25734978914260864 0.22729074954986572 0.85597687959671021 0.038042366504669189 0.23839938640594482 19 5 0 4 3 199 clhep-2.1.4.1.orig/Random/test/testEngineCopy.cc0000644000175000017500000001342712013254144020046 0ustar olesoles// -*- C++ -*- // $Id: testEngineCopy.cc,v 1.2 2010/06/16 17:24:53 garren Exp $ // ---------------------------------------------------------------------- #include "CLHEP/Units/GlobalPhysicalConstants.h" // used to provoke shadowing warnings #include "CLHEP/Random/Randomize.h" #include "CLHEP/Random/NonRandomEngine.h" #include "CLHEP/Random/defs.h" #include #include #include #define CLEAN_OUTPUT #ifdef CLEAN_OUTPUT std::ofstream output("testEngineCopy.cout"); #else std::ostream & output = std::cout; #endif // Normally on for routine validation: #ifdef TURNOFF #endif #define TEST_ENGINE_COPY #define VERBOSER #define VERBOSER2 using namespace CLHEP; // Absolutely Safe Equals Without Registers Screwing Us Up bool equals01(const std::vector &ab) { return ab[1]==ab[0]; } bool equals(double a, double b) { std::vector ab(2); ab[0]=a; ab[1]=b; return (equals01(ab)); } std::vector aSequence(int n) { std::vector v; DualRand e(13542); RandFlat f(e); for (int i=0; i int vectorTest64(int n) { output << "Copy 64bit test for " << E::engineName() << "\n"; E e; double x = 0; for (int i=0; i int vectorTest64(int n) { output << "Copy 64bit test for " << NonRandomEngine::engineName() << "\n"; std::vector nonRand = aSequence(500); NonRandomEngine e; e.setRandomSequence(&nonRand[0], nonRand.size()); double x = 0; for (int i=0; i v = e.put(); NonRandomEngine f(e); x = e.flat(); output << "x = " << x << std::endl; double y = f.flat(); output << "y = " << y << std::endl; if( x != y ) return n; for( int i=0; i<300; ++i ) { if( e.flat() != f.flat() ) { output << "i = " << i << " vectorTest64 for NonRandomEngine problem: e != f \n"; return n+i; } } return 0; } template E vectorRestore1(int n, std::vector & v) { output << "Copy for " << E::engineName() << "\n"; E e(97538466); double r=0; for (int i=0; i NonRandomEngine vectorRestore1 (int n, std::vector & v) { #ifdef VERBOSER2 output << "Copy for " << NonRandomEngine::engineName() << "\n"; #endif std::vector nonRand = aSequence(500); NonRandomEngine e; e.setRandomSequence(&nonRand[0], nonRand.size()); double r=0; for (int i=0; i int vectorRestore2(E & f, const std::vector & v) { int stat = 0; std::vector k; for (int j=0; j<25; j++) k.push_back(f.flat()); #ifdef VERBOSER2 output << "First four of k are: " << k[0] << ", " << k[1] << ", " << k[2] << ", " << k[3] << "\n"; #endif for (int m1=0; m1<25; m1++) { if ( v[m1] != k[m1] ) { std::cout << "???? Incorrect copy restored value for engine: " << E::engineName() << "\n"; #ifdef CLEAN_OUTPUT output << "???? Incorrect copy restored value for engine: " << E::engineName() << "\n"; #endif stat |= 1048576; return stat; } } return stat; } template int vectorRestore(int n) { std::vector v; int status1 = vectorTest64(n); E f = vectorRestore1(n,v); int status2 = vectorRestore2(f, v); return (status1 | status2); } // --------------------------------------------- // --------------------------------------------- // --------------------------------------------- int main() { int stat = 0; #ifdef TEST_ENGINE_COPY output << "\n=================================\n"; output << " Part IX \n"; output << " Copy test of engines\n"; output << "=================================\n\n"; stat |= vectorRestore(113); // copies of DRand48Engine are not allowed //stat |= vectorRestore(114); stat |= vectorRestore(115); stat |= vectorRestore(116); stat |= vectorRestore(117); stat |= vectorRestore(118); stat |= vectorRestore(139); stat |= vectorRestore(119); stat |= vectorRestore(120); stat |= vectorRestore(121); stat |= vectorRestore(122); stat |= vectorRestore(123); // anonymous engines are not copyable //stat |= vectorRestore(129); #endif output << "\n=============================================\n\n"; if (stat != 0) { std::cout << "One or more problems detected: stat = " << stat << "\n"; output << "One or more problems detected: stat = " << stat << "\n"; } else { output << "ranRestoreTest passed with no problems detected.\n"; } if (stat == 0) return 0; if (stat > 0) return -(stat|1); return stat|1; } clhep-2.1.4.1.orig/Random/test/testRandDists.dat0000755000175000017500000000006307705060311020062 0ustar olesoles1357924 1000000 20 4 1234987 500000 .06 10000 1000 clhep-2.1.4.1.orig/Random/test/Hurd288Engine.oldsav0000644000175000017500000000015410233771102020274 0ustar olesoles19780503 7 1401580370 92320849 1535281087 2941298131 1273761123 2792994694 4177484003 1850607023 123690079 clhep-2.1.4.1.orig/Random/test/testRandom.input0000755000175000017500000000001707705573375020020 0ustar olesoles a clhep-2.1.4.1.orig/Random/test/testBug58950.cc0000644000175000017500000002111711712326340017134 0ustar olesoles// ---------------------------------------------------------------------- // // testBug58950 -- test problem with RanecuEngine on 64bit machines // // R. Weller 11/11/09 initial test from Vanderbilt // L. Garren 12/1/09 rewritten for test suite // // ---------------------------------------------------------------------- #include #include #include #include #include "CLHEP/Random/RanecuEngine.h" #include "CLHEP/Random/Random.h" #include "pretend.h" bool printCheck( int & i, double & r, std::ofstream & os ) { os << i << " " << r << std::endl; if (r < 0 || r > 1.0 ) { std::cout << "Error: bad random number " << r << std::endl; return false; } return true; } int main() { std::ofstream output("testBug58950.cout"); output << std::endl << "short " << sizeof(short) << std::endl; output << "int " << sizeof(int) << std::endl; output << "unsigned int " << sizeof(unsigned int) << std::endl; output << "long " << sizeof(long) << std::endl; output << "float " << sizeof(float) << std::endl; output << "double " << sizeof(double) << std::endl; output << "long double " << sizeof(long double) << std::endl << std::endl; CLHEP::RanecuEngine *eng = new CLHEP::RanecuEngine; CLHEP::HepRandom::setTheEngine(eng); CLHEP::HepRandom *g; g=CLHEP::HepRandom::getTheGenerator(); long rvals[2]; try { std::ifstream in("/dev/urandom", std::ios::in | std::ios::binary); if(in.is_open()) { in.read((char *)(&rvals), 2*sizeof(long)); in.close(); if(in.fail()) { throw std::runtime_error("File read error"); } } else throw std::runtime_error("File open error"); } catch(std::runtime_error e) { std::ostringstream dStr; dStr << "Error: " << e.what() << " processing seed from file \"" << "/dev/urandom" << "\"."; throw std::runtime_error(dStr.str().c_str()); } int nNumbers = 20; int badcount = 0; long seeds[3]; const long *pseeds; //*********************************************************************** // Seeds are expected to be positive. Therefore, if either seed is // negative then prior to 2.0.4.5 the generator set initial conditions // and generated the same sequence of numbers no matter what the seeds were. seeds[0]=rvals[0]; seeds[1]=rvals[1]; seeds[2]=0; if( rvals[0] > 0 ) seeds[0] = -rvals[0]; double negseq[20] = { 0.154707, 0.587114, 0.702059, 0.566, 0.988325, 0.525921, 0.191554, 0.269338, 0.234277, 0.358997, 0.549936, 0.296877, 0.162243, 0.227732, 0.528862, 0.631571, 0.176462, 0.247858, 0.170025, 0.284483 }; double eps = 1.0E-6; output << std::endl << "********************" << std::endl; output << "This is the case that may or may not fail." << std::endl; output << "However, if it has values in (0,1), they are a " << std::endl << "deterministic sequence beginning with 0.154707." << std::endl; output << "seeds[0] = " << seeds[0] << "\n" << "seeds[1] = " << seeds[1] << std::endl << std::endl; g->setTheSeeds(seeds); int rseq = 0; for (int i=0; i < nNumbers; ++i) { double r = g->flat(); if( ! printCheck(i,r,output) ) ++badcount; // before the change, the random number sequence was reliably the same if( std::fabs(r-negseq[i]) < eps ) { std::cout << " reproducing sequence " << i << " " << r << " " << negseq[i] << std::endl; ++rseq; } } if( rseq == 20 ) ++badcount; pseeds=g->getTheSeeds(); output << "Final seeds[0] = " << pseeds[0] << "\n" << "Final seeds[1] = " << pseeds[1] << std::endl << std::endl; //*********************************************************************** // Prior to the 2.0.4.5 bug fix, 64bit seeds resulted in incorrect randoms seeds[0]=labs(rvals[0]); seeds[1]=labs(rvals[1]); seeds[2]=0; output << std::endl << "********************" << std::endl; output << "This is the case that always fails." << std::endl; output << "seeds[0] = " << seeds[0] << "\n" << "seeds[1] = " << seeds[1] << std::endl << std::endl; g->setTheSeeds(seeds); for (int i=0; i < nNumbers; ++i) { double r = g->flat(); if( ! printCheck(i,r,output) ) ++badcount; } pseeds=g->getTheSeeds(); output << "Final seeds[0] = " << pseeds[0] << "\n" << "Final seeds[1] = " << pseeds[1] << std::endl << std::endl; //*********************************************************************** // recover and reuse seeds seeds[0]=labs(rvals[0]); seeds[1]=labs(rvals[1]); seeds[2]=0; output << std::endl << "********************" << std::endl; output << "Check rolling back a random number seed." << std::endl; output << "seeds[0] = " << seeds[0] << "\n" << "seeds[1] = " << seeds[1] << std::endl << std::endl; std::vector v; g->setTheSeeds(seeds); for (int i=0; i < nNumbers; ++i) { double r = g->flat(); if( ! printCheck(i,r,output) ) ++badcount; } pseeds=g->getTheSeeds(); seeds[0] = pseeds[0]; seeds[1] = pseeds[1]; output << " pseeds[0] = " << pseeds[0] << "\n" << "pseeds[1] = " << pseeds[1] << std::endl; for (int i=0; i < nNumbers; ++i) { double r = g->flat(); v.push_back(r); } g->setTheSeeds(seeds); for (int i=0; i < nNumbers; ++i) { double r = g->flat(); if(v[i] != r ) { ++badcount; std::cerr << " rollback fails: i, v[i], r " << i << " " << v[i] << " " << r << std::endl; } } output << std::endl; //*********************************************************************** // 4-byte positive integers generate valid sequences, which remain within bounds. seeds[0]= labs(static_cast(rvals[0])); seeds[1]= labs(static_cast(rvals[1])); seeds[2]=0; output << std::endl << "********************" << std::endl; output << "This is the case that works." << std::endl; output << std::endl << "seeds[0] = " << seeds[0] << "\n" << "seeds[1] = " << seeds[1] << "\n" << "seeds[2] = " << seeds[2] << std::endl << std::endl; g->setTheSeeds(seeds); for (int i=0; i < nNumbers; ++i) { double r = g->flat(); if( ! printCheck(i,r,output) ) ++badcount; } pseeds=g->getTheSeeds(); output << "Final seeds[0] = " << pseeds[0] << "\n" << "Final seeds[1] = " << pseeds[1] << std::endl << std::endl; //*********************************************************************** // Before the fix, a bad 64bit sequence would eventually rectify itself. // This starts with seeds that would have failed before the 64bit corrections // were applied and loops until both seeds are positive 32-bit integers. // This looping should no longer occur. seeds[0]=labs(rvals[0]); seeds[1]=labs(rvals[1]); seeds[2]=0; output << std::endl << "********************" << std::endl; output << "This case loops until valid short seeds occur." << std::endl; output << "seeds[0] = " << seeds[0] << "\n" << "seeds[1] = " << seeds[1] << std::endl << std::endl; g->setTheSeeds(seeds); // Loop as long as the values are bad. double r; unsigned int low = ~0; unsigned long mask = (~0) << 31; unsigned long skipcount = 0; output << "low = " << low << " mask = " << mask << std::endl; do { r = g->flat(); pretend_to_use( r ); pseeds = g->getTheSeeds(); ++skipcount; } while((pseeds[0]&mask) || (pseeds[1]&mask)); if ( skipcount > 1 ) ++badcount; output << std::endl << "Loop terminates on two short seeds." << std::endl; output << "Skipcount = " << skipcount << std::endl; output << "pseeds[0]&mask = " << (pseeds[0]&mask) << std::endl; output << "pseeds[1]&mask = " << (pseeds[1]&mask) << std::endl; output << "Final seeds[0] = " << pseeds[0] << "\n" << "Final seeds[1] = " << pseeds[1] << std::endl << std::endl; output << "This should be a valid sequence." << std::endl; for (int i=0; i < nNumbers; ++i) { double r1 = g->flat(); if( ! printCheck(i,r1,output) ) ++badcount; } pseeds=g->getTheSeeds(); output << "seeds[0] = " << pseeds[0] << "\n" << "seeds[1] = " << pseeds[1] << std::endl << std::endl; if( badcount > 0 ) std::cout << "Error count is " << badcount << std::endl; return badcount; } clhep-2.1.4.1.orig/Random/test/ranRestoreTest.cerroutput0000644000175000017500000004622510233771102021723 0ustar olesolesFailure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DRand48Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in DualRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd160Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Hurd288Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in HepJamesRandom::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in MTwistEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RandEngine::restoreStatus() Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanecuEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in Ranlux64Engine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanluxEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in RanshiEngine::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged Failure to find or open file noSuchFile in TripleRand::restoreStatus() -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged -- Engine state remains unchanged clhep-2.1.4.1.orig/Random/test/testAnonymousEngineRestore.cc0000644000175000017500000002670112235754600022477 0ustar olesoles// ---------------------------------------------------------------------- #include "CLHEP/Units/GlobalPhysicalConstants.h" // used to provoke shadowing warnings #include "CLHEP/Random/Randomize.h" #include "CLHEP/Random/NonRandomEngine.h" #include "CLHEP/Random/defs.h" #include #include #include #define CLEAN_OUTPUT #ifdef CLEAN_OUTPUT std::ofstream output("testAnonymousEngineRestore.cout"); #else std::ostream & output = std::cout; #endif // Normally on for routine validation: #ifdef TURNOFF #endif #define TEST_ANONYMOUS_ENGINE_RESTORE #define TEST_ANONYMOUS_RESTORE_STATICS #define VERBOSER #define VERBOSER2 using namespace CLHEP; template int anonymousRestoreStatics(); // Absolutely Safe Equals Without Registers Screwing Us Up bool equals01(const std::vector &ab) { return ab[1]==ab[0]; } bool equals(double a, double b) { std::vector ab(2); ab[0]=a; ab[1]=b; return (equals01(ab)); } std::vector aSequence(int n) { std::vector v; DualRand e(13542); RandFlat f(e); for (int i=0; i captureStatics() { std::vector c; c.push_back( RandGauss::shoot() ); c.push_back( RandGaussQ::shoot() ); c.push_back( RandGaussT::shoot() ); c.push_back( RandFlat::shoot() ); c.push_back( RandBit::shoot() ); for (int i=0; i<20; i++) { c.push_back( RandFlat::shootBit() ); c.push_back( RandBit::shootBit() ); } c.push_back( RandPoisson::shoot() ); c.push_back( RandPoissonQ::shoot() ); c.push_back( RandPoissonT::shoot() ); c.push_back( RandBinomial::shoot() ); c.push_back( RandBreitWigner::shoot() ); c.push_back( RandChiSquare::shoot() ); c.push_back( RandExponential::shoot() ); c.push_back( RandGamma::shoot() ); c.push_back( RandLandau::shoot() ); c.push_back( RandSkewNormal::shoot() ); c.push_back( RandStudentT::shoot() ); return c; } void saveStatics(std::string filename) { std::ofstream os(filename.c_str()); RandGeneral::saveStaticRandomStates(os); // It should be possible to call this from HepRandom, or any distribution. // RandGeneral, which is meaningless as a static distribution, should be the // toughest test, so we use that here. } void restoreStatics(std::string filename) { std::ifstream is(filename.c_str()); RandLandau::restoreStaticRandomStates(is); } // ----------- Anonymous restore of engines ----------- template void anonymousRestore1(int n, std::vector & v) { output << "Anonymous restore for " << E::engineName() << "\n"; E e(12349876); double r=0; for (int i=0; i void anonymousRestore1 (int n, std::vector & v) { #ifdef VERBOSER output << "Anonymous restore for " << NonRandomEngine::engineName() << "\n"; #endif std::vector nonRand = aSequence(500); NonRandomEngine e; e.setRandomSequence(&nonRand[0], nonRand.size()); double r=0; for (int i=0; i int anonymousRestore2(const std::vector & v) { int stat = 0; std::vector k; std::ifstream is("anonymous.save"); HepRandomEngine * a; a = HepRandomEngine::newEngine(is); for (int j=0; j<25; j++) k.push_back(a->flat()); delete a; #ifdef VERBOSER2 output << "First four of k are: " << k[0] << ", " << k[1] << ", " << k[2] << ", " << k[3] << "\n"; #endif for (int m1=0; m1<25; m1++) { if ( v[m1] != k[m1] ) { std::cout << "???? Incorrect restored value for anonymous engine" << E::engineName() << "\n"; #ifdef CLEAN_OUTPUT output << "???? Incorrect restored value for anonymous engine" << E::engineName() << "\n"; #endif stat |= 262144; return stat; } } return stat; } template int anonymousRestore(int n) { std::vector v; anonymousRestore1(n,v); return anonymousRestore2(v); } // ----------- Anonymous restore of all static distributions ----------- template int anonymousRestoreStatics1() { int stat = 0; HepRandomEngine *e = new E(12456); HepRandom::setTheEngine(e); randomizeStatics(15); output << "\nRandomized, with theEngine = " << e->name() << "\n"; saveStatics("anon_distribution.save"); output << "Saved all static distributions\n"; std::vector c = captureStatics(); output << "Captured output of all static distributions\n"; randomizeStatics(11); output << "Randomized all static distributions\n"; restoreStatics("anon_distribution.save"); output << "Restored all static distributions to saved state\n"; std::vector d = captureStatics(); output << "Captured output of all static distributions\n"; for (unsigned int iv=0; iv int anonymousRestoreStatics() { int stat = 0; if ( E1::engineName() == E2::engineName() ) { return anonymousRestoreStatics1(); } HepRandomEngine *e1 = new E1(12456); HepRandom::setTheEngine(e1); randomizeStatics(15); output << "\nRandomized, with theEngine = " << e1->name() << "\n"; saveStatics("anon_distribution.save"); #ifdef VERBOSER2 output << "Saved all static distributions\n"; #endif std::vector c = captureStatics(); #ifdef VERBOSER2 output << "Captured output of all static distributions\n"; #endif delete e1; HepRandomEngine *e2 = new E2(24653); HepRandom::setTheEngine(e2); output << "Switched to theEngine = " << e2->name() << "\n"; randomizeStatics(19); { std::ofstream os("anon_engine.save"); os << *e2; } double v1 = e2->flat(); double v2 = e2->flat(); { std::ifstream is("anon_engine.save"); is >> *e2; } #ifdef VERBOSER2 output << "Saved the " << e2->name() << " engine: \n" << "Next randoms to be " << v1 << " " << v2 << "\n" << "Restored the " << e2->name() << " engine to that state\n"; #endif restoreStatics("anon_distribution.save"); #ifdef VERBOSER2 output << "Restored all static distributions to saved state\n" << "This changes the engine type back to " << E1::engineName() << "\n"; #endif std::vector d = captureStatics(); #ifdef VERBOSER2 output << "Captured output of all static distributions\n"; #endif for (unsigned int iv=0; ivflat(); double k2 = e2->flat(); #ifdef VERBOSER2 output << "The " << e2->name() << " engine should not have been affected: \n" << "Next randoms are " << k1 << " " << k2 << "\n"; #endif if ( !equals(v1,k1) || !equals(v2,k2) ) { std::cout << "???? Engine used as theEngine was affected by restoring \n" << " static distributions to use engine of a different type.\n"; #ifdef CLEAN_OUTPUT output << "???? Engine used as theEngine was affected by restoring \n" << " static distributions to use engine of a different type.\n"; #endif stat |= 1048576; } return stat; } // --------------------------------------------- // --------------------------------------------- // --------------------------------------------- int main() { int stat = 0; #ifdef TEST_ANONYMOUS_ENGINE_RESTORE output << "\n=================================\n"; output << " Part VII \n"; output << "Anonymous restore of engines \n"; output << "=================================\n\n"; stat |= anonymousRestore(13); stat |= anonymousRestore(14); stat |= anonymousRestore(15); stat |= anonymousRestore(16); stat |= anonymousRestore(17); stat |= anonymousRestore(18); stat |= anonymousRestore(29); stat |= anonymousRestore(39); stat |= anonymousRestore(19); stat |= anonymousRestore(20); stat |= anonymousRestore(21); stat |= anonymousRestore(22); stat |= anonymousRestore(22); #endif #ifdef TEST_ANONYMOUS_RESTORE_STATICS output << "\n======================================\n"; output << " Part VIII \n"; output << "Anonymous restore static Distributions \n"; output << "======================================\n\n"; stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); #endif output << "\n=============================================\n\n"; if (stat != 0) { std::cout << "One or more problems detected: stat = " << stat << "\n"; output << "One or more problems detected: stat = " << stat << "\n"; } else { output << "testAnonymousEngineRestore passed with no problems detected.\n"; } if (stat == 0) return 0; if (stat > 0) return -(stat|1); return stat|1; } clhep-2.1.4.1.orig/Random/test/.cvsignore0000755000175000017500000000001407714461020016573 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Random/test/DRand48Engine.oldsav0000644000175000017500000000002510233771102020271 0ustar olesoles123 36117 34544 8137 clhep-2.1.4.1.orig/Random/test/gaussSpeed.cc0000755000175000017500000002074211753236267017232 0ustar olesoles#include "CLHEP/Random/Randomize.h" #include "CLHEP/Random/defs.h" #include #include "CLHEP/Random/RandGaussQ.h" #include "CLHEP/Random/RandGaussT.h" #include "CLHEP/Random/RandPoissonQ.h" #include "CLHEP/Random/RandPoissonT.h" #include "CLHEP/Random/RandBit.h" #include "CLHEP/Units/PhysicalConstants.h" using std::cin; using std::cout; using std::cerr; using std::endl; using namespace CLHEP; //#ifndef _WIN32 //using std::exp; //#endif // --------- // RandGauss // // mf 12/13/04 Correction in way engines are supplied to RandBit() ctor // (gcc3.3.1 exposed previously innocuous mistake) // --------- double gammln1(double xx) { // Returns the value ln(Gamma(xx) for xx > 0. Full accuracy is obtained for // xx > 1. For 0 < xx < 1. the reflection formula (6.1.4) can be used first. // (Adapted from Numerical Recipes in C) static double cof[6] = {76.18009172947146,-86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5}; int j; double x = xx - 1.0; double tmp = x + 5.5; tmp -= (x + 0.5) * std::log(tmp); double ser = 1.000000000190015; for ( j = 0; j <= 5; j++ ) { x += 1.0; ser += cof[j]/x; } return -tmp + std::log(2.5066282746310005*ser); } double gammln2(double xx) { // Returns the value ln(Gamma(xx) for xx > 0. Full accuracy is obtained for // xx > 1. For 0 < xx < 1. the reflection formula (6.1.4) can be used first. // (Adapted from Numerical Recipes in C) static double cof[6] = {76.18009172947146,-86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5}; int j; double x = xx - 0.0; double tmp = x + 5.5; tmp -= (x + 0.5) * std::log(tmp); double ser = 1.000000000190015; for ( j = 0; j <= 5; j++ ) { x += 1.0; ser += cof[j]/x; } return -tmp + std::log(2.5066282746310005*ser/xx); } #include int main() { cout << "Enter 1 for RandGauss, 2 for RandGaussQ, 3 for DualRand flat: "; int choice; cin >> choice; if (choice==1) { cout << "\n--------------------------------------------\n"; cout << "Test of Gauss distribution speed\n\n"; long seed; cout << "Please enter an integer seed: "; cin >> seed; int nNumbers; cout << "How many numbers should we generate: "; cin >> nNumbers; cout << "\nInstantiating distribution utilizing DualRand engine...\n"; DualRand eng (seed); RandGauss dist (eng); double sum = 0; for (int i=0; i < nNumbers; i++) { sum += dist.fire(); } cout << "\n Finished: sum is " << sum << " \n"; } if (choice==2) { cout << "\n--------------------------------------------\n"; cout << "Test of RandGaussQ distribution speed\n\n"; long seed; cout << "Please enter an integer seed: "; cin >> seed; int nNumbers; cout << "How many numbers should we generate: "; cin >> nNumbers; cout << "\nInstantiating distribution utilizing DualRand engine...\n"; DualRand eng (seed); RandGaussQ dist (eng); double sum = 0; for (int i=0; i < nNumbers; i++) { sum += dist.fire(); } cout << "\n Finished: sum is " << sum << " \n"; } if (choice==3) { cout << "\n--------------------------------------------\n"; cout << "Test of DualRand flat speed\n\n"; long seed; cout << "Please enter an integer seed: "; cin >> seed; int nNumbers; cout << "How many numbers should we generate: "; cin >> nNumbers; cout << "\nInstantiating distribution utilizing DualRand engine...\n"; DualRand eng (seed); double sum = 0; for (int i=0; i < nNumbers; i++) { sum += eng.flat(); } cout << "\n Finished: sum is " << sum << " \n"; } #ifdef GAMMA cout << "\nNow we will compute the first 20 gammas, using gammln:\n"; double x; for (x=1; x <= 20; x+=1) { cout << x << std::setprecision(20) << " " << std::exp(gammln1(x)) << " " << std::exp(gammln2(x)) << " difference in gammln2 = " << gammln1(x)-gammln2(x) << "\n"; } cout << "\nNow we will compute gamma of small numbers: \n"; for ( x=1; x > .000000001; x *= .9 ) { cout << x << std::setprecision(20) << " " << 1 - std::exp(gammln1(x)) * std::exp(gammln1(2-x)) * std::sin(CLHEP::pi*(1-x)) / (CLHEP::pi*(1-x)) << " " << 1 - std::exp(gammln2(x)) * std::exp(gammln1(2-x)) * std::sin(CLHEP::pi*(1-x)) / (CLHEP::pi*(1-x)) << "\n"; } #endif // GAMMA #ifdef POISSON cout << "\n--------------------------------------------\n"; cout << "Test of Poisson distribution speed\n\n"; long seed; cout << "Please enter an integer seed: "; cin >> seed; double mu; cout << "Please enter mu: "; cin >> mu; int nNumbers; cout << "How many numbers should we generate: "; cin >> nNumbers; cout << "\nInstantiating distribution utilizing DualRand engine...\n"; DualRand eng (seed); RandPoisson dist (eng, mu); // RandFlat dist (eng); double sum = 0; for (int i=0; i < nNumbers; i++) { sum += dist.fire(); // sum += dist.quick(); // sum += dist.fire(mu); // sum += dist.quick(mu); } cout << "\n Finished: sum is " << sum << " \n"; #endif // POISSON #define MISC #ifdef MISC DualRand e; // RandGauss usage modes cout << "testing RandGaussT::shoot(): " << RandGaussT::shoot() << "\n"; cout << "testing RandGaussT::shoot(&e): " << RandGaussT::shoot(&e) << "\n"; cout << "testing RandGaussT::shoot(100,10): " << RandGaussT::shoot(100,10) << "\n"; cout << "testing RandGaussT::shoot(&e,100,10): " << RandGaussT::shoot(&e,100,10) << "\n"; RandGaussT gt (e, 50,2); cout << "testing gt.fire(): " << gt.fire() << "\n"; cout << "testing gt.fire(200,2): " << gt.fire(200,2) << "\n"; cout << "testing RandGaussQ::shoot(): " << RandGaussQ::shoot() << "\n"; cout << "testing RandGaussQ::shoot(&e): " << RandGaussQ::shoot(&e) << "\n"; cout << "testing RandGaussQ::shoot(100,10): " << RandGaussQ::shoot(100,10) << "\n"; cout << "testing RandGaussQ::shoot(&e,100,10): " << RandGaussQ::shoot(&e,100,10) << "\n"; RandGaussQ qt (e, 50,2); cout << "testing qt.fire(): " << qt.fire() << "\n"; cout << "testing qt.fire(200,2): " << qt.fire(200,2) << "\n"; // RandPoisson usage modes cout << "testing RandPoissonT::shoot(): " << RandPoissonT::shoot() << "\n"; cout << "testing RandPoissonT::shoot(&e): " << RandPoissonT::shoot(&e) << "\n"; cout << "testing RandPoissonT::shoot(90): " << RandPoissonT::shoot(90) << "\n"; cout << "testing RandPoissonT::shoot(&e,90): " << RandPoissonT::shoot(&e,90) << "\n"; RandPoissonT pgt (e,50); cout << "testing pgt.fire(): " << pgt.fire() << "\n"; cout << "testing pgt.fire(20): " << pgt.fire(20) << "\n"; cout << "testing RandPoissonQ::shoot(): " << RandPoissonQ::shoot() << "\n"; cout << "testing RandPoissonQ::shoot(&e): " << RandPoissonQ::shoot(&e) << "\n"; cout << "testing RandPoissonQ::shoot(90): " << RandPoissonQ::shoot(90) << "\n"; cout << "testing RandPoissonQ::shoot(&e,90): " << RandPoissonQ::shoot(&e,90) << "\n"; RandPoissonQ pqt (e,50); cout << "testing pqt.fire(): " << pqt.fire() << "\n"; cout << "testing pqt.fire(20): " << pqt.fire(20) << "\n"; // RandBit modes coming from RandFlat and bit modes cout << "testing RandBit::shoot(): " << RandBit::shoot() << "\n"; cout << "testing RandBit::shoot(&e): " << RandBit::shoot(&e) << "\n"; cout << "testing RandBit::shoot(10,20): " << RandBit::shoot(10,20) << "\n"; cout << "testing RandBit::shoot(&e,10,20): "<< RandBit::shoot(&e,10,20) << "\n"; RandBit b ( e, 1000, 1100 ); cout << "testing b.fire(): " << b.fire() << "\n"; cout << "testing b.fire(10,20): " << b.fire(10,20) << "\n"; int i; cout << "testing RandBit::shootBit(): "; for (i=0; i<40; i++) { cout << RandBit::shootBit(); } cout << "\n"; cout << "testing RandBit::shootBit(&e): "; for (i=0; i<40; i++) { cout << RandBit::shootBit(&e); } cout << "\n"; cout << "testing RandBit::fireBit(): "; for (i=0; i<40; i++) { cout << b.fireBit(); } cout << "\n"; // Timing for RandBit: cout << "Timing RandFlat::shootBit(): Enter N: "; int N; cin >> N; int sum=0; for (i=0; i> N; sum = 0; for (i=0; i // for ostringstream #include // for string using namespace CLHEP; typedef unsigned int uint; // ---------------------------------------------------------------------- // copy-construction test template< typename Dist > bool copy_constructor_is_okay( Dist & d1 ) { // prime the distribution for( uint i = 0u; i != 17u; ++i ) (void) d1.fire(); // capture its state std::ostringstream os1; d1.put( os1 ); HepRandomEngine * e1 = & d1.engine(); // make a copy and capture the copy's state Dist d2( d1 ); std::ostringstream os2; d2.put( os2 ); HepRandomEngine * e2 = & d2.engine(); // do the saved states match and is the underlying engine shared? return os1.str() == os2.str() && e1 == e2; } // copy_constructor_is_okay<>() // ---------------------------------------------------------------------- // copy-construction test template< typename Dist > bool copy_assignment_is_okay( Dist & d1, Dist & d2 ) { // prime the distributions for( uint i = 0u; i != 17u; ++i ) (void) d1.fire(); for( uint i = 0u; i != 19u; ++i ) (void) d2.fire(); // capture d1's state std::ostringstream os1; d1.put( os1 ); HepRandomEngine * e1 = & d1.engine(); // make a copy and capture the copy's state d2 = d1; std::ostringstream os2; d2.put( os2 ); HepRandomEngine * e2 = & d2.engine(); // do the saved states match and is the underlying engine shared? return os1.str() == os2.str() && e1 == e2; } // copy_assignment_is_okay<>() // ---------------------------------------------------------------------- // Mask bits to form a word identifying dists that failed their test static uint const success = 0u; static uint const Binomial_failure = 1u << 1; static uint const BreitWigner_failure = 1u << 2; static uint const ChiSquare_failure = 1u << 3; static uint const Exponential_failure = 1u << 4; static uint const Flat_failure = 1u << 5; static uint const Gamma_failure = 1u << 6; static uint const Gauss_failure = 1u << 7; static uint const GaussQ_failure = 1u << 8; static uint const GaussT_failure = 1u << 9; static uint const General_failure = 1u << 10; static uint const Landau_failure = 1u << 11; static uint const Poisson_failure = 1u << 12; static uint const PoissonQ_failure = 1u << 13; static uint const PoissonT_failure = 1u << 14; static uint const StudentT_failure = 1u << 15; static uint const SkewNormal_failure = 1u << 16; // ---------------------------------------------------------------------- // RandBinomial uint testRandBinomial() { MTwistEngine r1( 97531L ); RandBinomial d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return Binomial_failure; DualRand r2( 13579L ); RandBinomial d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return Binomial_failure; return 0u; } // ---------------------------------------------------------------------- // RandBreitWigner uint testRandBreitWigner() { MTwistEngine r1( 97531L ); RandBreitWigner d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return BreitWigner_failure; DualRand r2( 13579L ); RandBreitWigner d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return BreitWigner_failure; return 0u; } // testRandBreitWigner // ---------------------------------------------------------------------- // RandChiSquare uint testRandChiSquare() { MTwistEngine r1( 97531L ); RandChiSquare d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return ChiSquare_failure; DualRand r2( 13579L ); RandChiSquare d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return ChiSquare_failure; return 0u; } // testRandChiSquare // ---------------------------------------------------------------------- // RandExponential uint testRandExponential() { MTwistEngine r1( 97531L ); RandExponential d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return Exponential_failure; DualRand r2( 13579L ); RandExponential d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return Exponential_failure; return 0u; } // testRandExponential // ---------------------------------------------------------------------- // RandFlat uint testRandFlat() { MTwistEngine r1( 97531L ); RandFlat d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return Flat_failure; DualRand r2( 13579L ); RandFlat d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return Flat_failure; return 0u; } // testRandFlat // ---------------------------------------------------------------------- // RandGamma uint testRandGamma() { MTwistEngine r1( 97531L ); RandGamma d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return Gamma_failure; DualRand r2( 13579L ); RandGamma d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return Gamma_failure; return 0u; } // testRandGamma // ---------------------------------------------------------------------- // RandGauss uint testRandGauss() { MTwistEngine r1( 97531L ); RandGauss d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return Gauss_failure; DualRand r2( 13579L ); RandGauss d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return Gauss_failure; return 0u; } // testRandGauss // ---------------------------------------------------------------------- // RandGaussQ uint testRandGaussQ() { MTwistEngine r1( 97531L ); RandGaussQ d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return GaussQ_failure; DualRand r2( 13579L ); RandGaussQ d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return GaussQ_failure; return 0u; } // testRandGaussQ // ---------------------------------------------------------------------- // RandGaussT uint testRandGaussT() { MTwistEngine r1( 97531L ); RandGaussT d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return GaussT_failure; DualRand r2( 13579L ); RandGaussT d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return GaussT_failure; return 0u; } // testRandGaussT // ---------------------------------------------------------------------- // RandGeneral uint testRandGeneral() { MTwistEngine r1( 97531L ); double pdf1[] = { 1.5, 2.5, 3.0, 4.25, 5.65 }; RandGeneral d1( r1, pdf1, sizeof(pdf1)/sizeof(pdf1[0]) ); if( ! copy_constructor_is_okay(d1) ) return General_failure; DualRand r2( 13579L ); double pdf2[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 0.60 }; RandGeneral d2( r2, pdf2, sizeof(pdf2)/sizeof(pdf2[0]) ); if( ! copy_assignment_is_okay(d1,d2) ) return General_failure; return 0u; } // testRandGeneral // ---------------------------------------------------------------------- // RandLandau uint testRandLandau() { MTwistEngine r1( 97531L ); RandLandau d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return Landau_failure; DualRand r2( 13579L ); RandLandau d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return Landau_failure; return 0u; } // testRandLandau // ---------------------------------------------------------------------- // RandPoisson uint testRandPoisson() { MTwistEngine r1( 97531L ); RandPoisson d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return Poisson_failure; DualRand r2( 13579L ); RandPoisson d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return Poisson_failure; return 0u; } // testRandPoisson // ---------------------------------------------------------------------- // RandPoissonQ uint testRandPoissonQ() { MTwistEngine r1( 97531L ); RandPoissonQ d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return PoissonQ_failure; DualRand r2( 13579L ); RandPoissonQ d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return PoissonQ_failure; return 0u; } // testRandPoissonQ // ---------------------------------------------------------------------- // RandPoissonT uint testRandPoissonT() { MTwistEngine r1( 97531L ); RandPoissonT d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return PoissonT_failure; DualRand r2( 13579L ); RandPoissonT d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return PoissonT_failure; return 0u; } // testRandPoissonT // ---------------------------------------------------------------------- // RandSkewNormal uint testRandSkewNormal() { MTwistEngine r1( 97531L ); RandSkewNormal d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return SkewNormal_failure; DualRand r2( 13579L ); RandSkewNormal d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return SkewNormal_failure; return 0u; } // testRandSkewNormal // ---------------------------------------------------------------------- // RandStudentT uint testRandStudentT() { MTwistEngine r1( 97531L ); RandStudentT d1( r1 ); if( ! copy_constructor_is_okay(d1) ) return StudentT_failure; DualRand r2( 13579L ); RandStudentT d2( r2 ); if( ! copy_assignment_is_okay(d1,d2) ) return StudentT_failure; return 0u; } // testRandStudentT // ---------------------------------------------------------------------- // main int main() { uint mask = 0u | testRandBinomial () | testRandBreitWigner() | testRandChiSquare () | testRandExponential() | testRandFlat () | testRandGamma () | testRandGauss () | testRandGaussQ () | testRandGaussT () | testRandGeneral () | testRandLandau () | testRandPoisson () | testRandPoissonQ () | testRandPoissonT () | testRandSkewNormal () | testRandStudentT () ; return - int(mask); } clhep-2.1.4.1.orig/Random/test/testVectorSave.cc0000644000175000017500000001522111406204345020064 0ustar olesoles// -*- C++ -*- // $Id: testVectorSave.cc,v 1.3 2010/06/16 17:24:53 garren Exp $ // ---------------------------------------------------------------------- #include "CLHEP/Random/Randomize.h" #include "CLHEP/Random/NonRandomEngine.h" #include "CLHEP/Random/defs.h" #include #include #include #define CLEAN_OUTPUT #ifdef CLEAN_OUTPUT std::ofstream output("testVectorSave.cout"); #else std::ostream & output = std::cout; #endif // Normally on for routine validation: #ifdef TURNOFF #endif #define TEST_VECTOR_ENGINE_RESTORE #define VERBOSER #define VERBOSER2 using namespace CLHEP; // Absolutely Safe Equals Without Registers Screwing Us Up bool equals01(const std::vector &ab) { return ab[1]==ab[0]; } bool equals(double a, double b) { std::vector ab(2); ab[0]=a; ab[1]=b; return (equals01(ab)); } std::vector aSequence(int n) { std::vector v; DualRand e(13542); RandFlat f(e); for (int i=0; i int vectorTest64(int n) { output << "Vector restore 64bit test for " << E::engineName() << "\n"; E e; double x = 0; for (int i=0; i v = e.put(); x = e.flat(); output << "x = " << x << std::endl; E f; v[0] &= 0xffffffffUL; f.get(v); double y = f.flat(); output << "y = " << y << std::endl; if( x != y ) return n; return 0; } // special case for NonRandomEngine template <> int vectorTest64(int n) { output << "Vector restore 64bit test for " << NonRandomEngine::engineName() << "\n"; std::vector nonRand = aSequence(500); NonRandomEngine e; e.setRandomSequence(&nonRand[0], nonRand.size()); double x = 0; for (int i=0; i v = e.put(); x = e.flat(); output << "x = " << x << std::endl; NonRandomEngine f; f.setRandomSequence(&nonRand[0], nonRand.size()); v[0] &= 0xffffffffUL; f.get(v); double y = f.flat(); output << "y = " << y << std::endl; if( x != y ) return n; return 0; } template std::vector vectorRestore1(int n, std::vector & v) { output << "Vector restore for " << E::engineName() << "\n"; E e(97538466); double r=0; for (int i=0; i state = e.put(); for (int j=0; j<25; j++) v.push_back(e.flat()); #ifdef VERBOSER2 output << "First four of v are: " << v[0] << ", " << v[1] << ", " << v[2] << ", " << v[3] << "\n"; #endif return state; } template <> std::vector vectorRestore1 (int n, std::vector & v) { #ifdef VERBOSER2 output << "Vector restore for " << NonRandomEngine::engineName() << "\n"; #endif std::vector nonRand = aSequence(500); NonRandomEngine e; e.setRandomSequence(&nonRand[0], nonRand.size()); double r=0; for (int i=0; i state = e.put(); for (int j=0; j<25; j++) v.push_back(e.flat()); #ifdef VERBOSER2 output << "First four of v are: " << v[0] << ", " << v[1] << ", " << v[2] << ", " << v[3] << "\n"; #endif return state; } template int vectorRestore2(const std::vector state, const std::vector & v) { int stat = 0; std::vector k; HepRandomEngine * a; a = HepRandomEngine::newEngine(state); if (!a) { std::cout << "???? could not restore engine state from vector for " << E::engineName() << "\n"; #ifdef CLEAN_OUTPUT output << "???? could not restore engine state from vector for " << E::engineName() << "\n"; #endif stat |= 1048576; return stat; } if (a->name() != E::engineName()) { #ifdef CLEAN_OUTPUT std::cout << "???? restored engine state from vector for " << E::engineName() << "to different type of engine: " << a->name() << "\n" << "There is probably a clash in CRC hashes for these two names!\n"; output << "???? restored engine state from vector for " << E::engineName() << "to different type of engine: " << a->name() << "\n" << "There is probably a clash in CRC hashes for these two names!\n"; #endif stat |= 1048576; return stat; } for (int j=0; j<25; j++) k.push_back(a->flat()); delete a; #ifdef VERBOSER2 output << "First four of k are: " << k[0] << ", " << k[1] << ", " << k[2] << ", " << k[3] << "\n"; #endif for (int m=0; m<25; m++) { if ( v[m] != k[m] ) { std::cout << "???? Incorrect vector restored value for anonymous engine: " << E::engineName() << "\n"; #ifdef CLEAN_OUTPUT output << "???? Incorrect vector restored value for anonymous engine: " << E::engineName() << "\n"; #endif stat |= 1048576; return stat; } } return stat; } template int vectorRestore(int n) { std::vector v; int status1 = vectorTest64(n); std::vector state = vectorRestore1(n,v); int status2 = vectorRestore2(state, v); return (status1 | status2); } // --------------------------------------------- // --------------------------------------------- // --------------------------------------------- int main() { int stat = 0; #ifdef TEST_VECTOR_ENGINE_RESTORE output << "\n=================================\n"; output << " Part IX \n"; output << "Save/restore of engines to vectors\n"; output << "=================================\n\n"; stat |= vectorRestore(113); stat |= vectorRestore(114); stat |= vectorRestore(115); stat |= vectorRestore(116); stat |= vectorRestore(117); stat |= vectorRestore(118); stat |= vectorRestore(139); stat |= vectorRestore(119); stat |= vectorRestore(120); stat |= vectorRestore(121); stat |= vectorRestore(122); stat |= vectorRestore(123); stat |= vectorRestore(129); #endif output << "\n=============================================\n\n"; if (stat != 0) { std::cout << "One or more problems detected: stat = " << stat << "\n"; output << "One or more problems detected: stat = " << stat << "\n"; } else { output << "ranRestoreTest passed with no problems detected.\n"; } if (stat == 0) return 0; if (stat > 0) return -(stat|1); return stat|1; } clhep-2.1.4.1.orig/Random/test/CMakeLists.txt0000644000175000017500000000242312235754600017341 0ustar olesoles set( Random_tests testRandom testRandDists ) if( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" ) set( Random_simple_tests testSaveEngineStatus testInstanceRestore testSaveSharedEngines testStaticStreamSave testAnonymousEngineRestore testVectorSave testBug73093 testEngineCopy testDistCopy testRanecuSequence ) else() set( Random_simple_tests testSaveEngineStatus testInstanceRestore testSaveSharedEngines testStaticStreamSave testAnonymousEngineRestore testVectorSave testBug58950 testBug73093 testEngineCopy testDistCopy testZiggurat testRanecuSequence ) endif() foreach ( test ${Random_tests} ) clhep_test( ${test} ) endforeach ( test ${Random_tests} ) foreach ( test ${Random_simple_tests} ) clhep_test( ${test} SIMPLE ) endforeach ( test ${Random_simple_tests} ) clhep-2.1.4.1.orig/Random/test/testBug73093.cc0000644000175000017500000000427611753236267017153 0ustar olesoles// ---------------------------------------------------------------------- // // testBug73093 -- Test of CLHEP::Ranlux64Engine with 64 bit seeds // // Frank Winklmeier 2010-09-24 // L. Garren 2010-10-21 rewritten for test suite // // ---------------------------------------------------------------------- #include #include #include #include "CLHEP/Random/Ranlux64Engine.h" int valid_range( ) { std::ofstream output("testBug73093.cout"); int bad = 0; long seed; long mult=-235421; // use several seeds for( int il=0; il<100; ++il ) { if( sizeof(long) > 4 ) { // using atol so 32bit compilers won't complain seed = atol("9899876543210000"); mult = mult + atol("120034020050070"); } else { seed = 987654321; mult = mult + 12003400; } seed += il*mult; CLHEP::Ranlux64Engine rng; const long N = 20; rng.setSeed(seed, /*lux*/ 1); output << std::endl; output << "sizeof(long) = " << sizeof(long) << std::endl; output << "Generating " << N << " random numbers with seed " << seed << std::endl; output << "Using seed " << seed << std::endl; double sum(0); for (long i=0; i 1.0 ) ++bad; output << r << std::endl; sum += r; } output << "Sum: " << sum << std::endl; output << "Average: " << sum / N << std::endl; } return bad; } int check_sequence() { // if the seed is less than 32bits long on a 64bit machine, the random // number sequence should be the same as the sequence on a 32bit machine std::ofstream output("testBug73093.seq"); int bad = 0; long seed; long mult=-235421; // use several seeds for( int il=0; il<50; ++il ) { seed = 97654321; seed += il*mult; CLHEP::Ranlux64Engine rng; const long N = 20; rng.setSeed(seed, /*lux*/ 1); double sum(0); for (long i=0; i 1.0 ) ++bad; output << "[" << il << "][" << i << "] = " << r << ";" << std::endl; sum += r; } } return bad; } int main() { int bad = 0; bad += valid_range( ); bad += check_sequence( ); return bad; } clhep-2.1.4.1.orig/Random/test/testInstanceRestore.cc0000644000175000017500000003347512235754600021133 0ustar olesoles// ---------------------------------------------------------------------- #include "CLHEP/Units/GlobalPhysicalConstants.h" // used to provoke shadowing warnings #include "CLHEP/Random/Randomize.h" #include "CLHEP/Random/NonRandomEngine.h" #include "CLHEP/Random/defs.h" #include #include #include #include #define CLEAN_OUTPUT #ifdef CLEAN_OUTPUT std::ofstream output("testInstanceRestore.cout"); #else std::ostream & output = std::cout; #endif // Normally on for routine validation: #ifdef TURNOFF #endif #define TEST_ENGINE_NAMES #define TEST_INSTANCE_METHODS #define VERBOSER #define VERBOSER2 using namespace CLHEP; // Absolutely Safe Equals Without Registers Screwing Us Up bool equals01(const std::vector &ab) { return ab[1]==ab[0]; } bool equals(double a, double b) { std::vector ab(2); ab[0]=a; ab[1]=b; return (equals01(ab)); } std::vector aSequence(int n) { std::vector v; DualRand e(13542); RandFlat f(e); for (int i=0; i int checkEngineName(const std::string & name) { int stat = 0; output << E::engineName() << "\n"; if (E::engineName() != name) { std::cout << "???? engineName mismatch for " << name << " <--> " << E::engineName() << "\n"; #ifdef CLEAN_OUTPUT output << "???? engineName mismatch for " << name << " <--> " << E::engineName() << "\n"; #endif stat |= 256; } E e(123); if (e.name() != name) { std::cout << "???? name mismatch for " << name << " <--> " << e.name() << "\n"; #ifdef CLEAN_OUTPUT output << "???? name mismatch for " << name << " <--> " << e.name() << "\n"; #endif stat |= 256; } return stat; } template int checkEngine() { int stat = 0; E e(1234); D d(e); if (d.engine().name() != e.name()) { std::cout << "???? Improper d.engine() \n"; #ifdef CLEAN_OUTPUT output << "???? Improper d.engine() \n"; #endif stat |= 512; } return stat; } template int checkEngineInstanceSave(E & e) { int stat = 0; output << "checkEngineInstanceSave for " << e.name() << "\n"; int pr=output.precision(20); double r=0; for (int i=0; i<100; i++) r += e.flat(); {std::ofstream os ("instance_engine.save"); os << e;} for (int i=0; i<100; i++) r += e.flat(); double keyValue1 = e.flat(); double keyValue2 = e.flat(); #ifdef VERBOSER output << keyValue1 << " " << keyValue2 << "\n"; #endif E e2; {std::ifstream is ("instance_engine.save"); is >> e2;} for (int i=0; i<100; i++) r += e2.flat(); double k1 = e2.flat(); double k2 = e2.flat(); #ifdef VERBOSER output << k1 << " " << k2 << "\n"; #endif if ( !(equals(k1,keyValue1)) || !(equals(k2,keyValue2)) ) { std::cout << "???? checkInstanceSave failed for " << e.name() << "\n"; #ifdef CLEAN_OUTPUT output << "???? checkInstanceSave failed for " << e.name() << "\n"; #endif stat |= 1024; } output.precision(pr); return stat; } template int checkSaveDistribution(D & d, int nth) { // verify that engine is the expected type assert( &dynamic_cast(d.engine()) ); int stat = 0; output << "checkSaveDistribution with " << d.engine().name() << ", " << d.name() << "\n"; double r=0; r = d(); double keyValue1, keyValue2, keyValue3, keyValue4; for (int i=0; i> e >> d2;} double k1 = d2(); double k2 = d2(); { std::ifstream is ("instance2_distribution.save"); is >> e >> d2;} double k3 = d2(); double k4 = d2(); #ifdef VERBOSER pr = output.precision(20); output << "k1 = " << k1 << " k2 = " << k2 << "\n"; output << "k3 = " << k3 << " k4 = " << k4 << "\n"; output.precision(pr); #endif if ( !equals(k1,keyValue1) || !equals(k2,keyValue2) || !equals(k3,keyValue3) || !equals(k4,keyValue4) ) { std::cout << "???? Incorrect restored value for distribution " << d.name() << "\n"; #ifdef CLEAN_OUTPUT output << "???? Incorrect restored value for distribution " << d.name() << "\n"; #endif stat |= 2048; } // if (stat) exit(-1); return stat; } template int checkRandGeneralDistribution(RandGeneral & d, int nth) { assert( &dynamic_cast(d.engine()) ); int stat = 0; output << "checkSaveDistribution with " << d.engine().name() << ", " << d.name() << "\n"; double r=0; r = d(); double keyValue1, keyValue2, keyValue3, keyValue4; for (int i=0; i> e >> d2;} double k1 = d2(); double k2 = d2(); { std::ifstream is ("instance2_distribution.save"); is >> e >> d2;} double k3 = d2(); double k4 = d2(); #ifdef VERBOSER pr = output.precision(20); output << "k1 = " << k1 << " k2 = " << k2 << "\n"; output << "k3 = " << k3 << " k4 = " << k4 << "\n"; output.precision(pr); #endif if ( !equals(k1,keyValue1) || !equals(k2,keyValue2) || !equals(k3,keyValue3) || !equals(k4,keyValue4) ) { std::cout << "???? Incorrect restored value for distribution " << d.name() << "\n"; #ifdef CLEAN_OUTPUT output << "???? Incorrect restored value for distribution " << d.name() << "\n"; #endif stat |= 2048; } // if (stat) exit(-1); return stat; } template int checkDistributions() { int stat = 0; {RandGauss d(new E(12561),100.0,3.0); stat |= checkSaveDistribution (d,33); } {RandGauss d(new E(12572),100.0,3.0); stat |= checkSaveDistribution (d,34); } {RandGaussQ d(new E(12563),10.0,4.0); stat |= checkSaveDistribution (d,33); } {RandGaussT d(new E(12564),5.0,2.0); stat |= checkSaveDistribution (d,33); } {RandBinomial d(new E(12565),4,0.6); stat |= checkSaveDistribution (d,33); } {RandFlat d(new E(12576),12.5,35.0); stat |= checkSaveDistribution (d,33); } {RandBit d(new E(12567)); stat |= checkSaveDistribution (d,31); } {RandBit d(new E(12578)); stat |= checkSaveDistribution (d,32); } {RandBit d(new E(12589)); stat |= checkSaveDistribution (d,33); } {RandBreitWigner d(new E(125611),50.0,15.0); stat |= checkSaveDistribution (d,33); } {RandChiSquare d(new E(125612),5.0); stat |= checkSaveDistribution (d,33); } {RandExponential d(new E(125713),8.00); stat |= checkSaveDistribution (d,33); } {RandGamma d(new E(125713),6.0,2.0); stat |= checkSaveDistribution (d,33); } {RandLandau d(new E(125714)); stat |= checkSaveDistribution (d,33); } {RandStudentT d(new E(125715),5); stat |= checkSaveDistribution (d,33); } // Multiple tests of Poisson distributions for small desired, since // the answer in each test is a small int, and coincidental agreement // is very possible. {RandPoisson d(new E(125616),2.5); stat |= checkSaveDistribution (d,33); } {RandPoisson d(new E(125617),105.0); stat |= checkSaveDistribution (d,34); } {RandPoisson d(new E(125618),2.5); stat |= checkSaveDistribution (d,35); } {RandPoisson d(new E(325618),2.5); stat |= checkSaveDistribution (d,36); } {RandPoisson d(new E(425618),2.5); stat |= checkSaveDistribution (d,37); } {RandPoisson d(new E(525618),2.5); stat |= checkSaveDistribution (d,38); } {RandPoisson d(new E(125619),110.0); stat |= checkSaveDistribution (d,39); } {RandPoissonQ d(new E(124616),2.5); stat |= checkSaveDistribution (d,33); } {RandPoissonQ d(new E(126616),2.5); stat |= checkSaveDistribution (d,32); } {RandPoissonQ d(new E(127616),2.5); stat |= checkSaveDistribution (d,31); } {RandPoissonQ d(new E(129616),2.5); stat |= checkSaveDistribution (d,30); } {RandPoissonQ d(new E(125616),110.0); stat |= checkSaveDistribution (d,33); } {RandPoissonQ d(new E(125616),2.5); stat |= checkSaveDistribution (d,34); } {RandPoissonQ d(new E(125616),110.0); stat |= checkSaveDistribution (d,34); } {RandPoissonT d(new E(125616),2.5); stat |= checkSaveDistribution (d,33); } {RandPoissonT d(new E(125616),110.0); stat |= checkSaveDistribution (d,33); } {RandPoissonT d(new E(125616),2.5); stat |= checkSaveDistribution (d,34); } {RandPoissonT d(new E(125616),110.0); stat |= checkSaveDistribution (d,34); } {RandPoissonT d(new E(125916),2.5); stat |= checkSaveDistribution (d,10); } {RandPoissonT d(new E(125816),2.5); stat |= checkSaveDistribution (d,11); } {RandPoissonT d(new E(125716),2.5); stat |= checkSaveDistribution (d,12); } {std::vector pdf; int nbins = 20; for (int i = 0; i < nbins; ++i) pdf.push_back( 5*i + (10.5-i) * (10.5-i) ); RandGeneral d(new E(125917), &pdf[0], 20); stat |= checkRandGeneralDistribution (d,33); } return stat; } // --------------------------------------------- // --------------------------------------------- // --------------------------------------------- int main() { int stat = 0; #ifdef TEST_ENGINE_NAMES output << "\n=============================================\n"; output << " Part II \n"; output << "Check all engine names were entered correctly \n"; output << "=============================================\n\n"; stat |= checkEngineName("DRand48Engine"); stat |= checkEngineName("DualRand"); stat |= checkEngineName("Hurd160Engine"); stat |= checkEngineName("Hurd288Engine"); stat |= checkEngineName("HepJamesRandom"); stat |= checkEngineName("MTwistEngine"); stat |= checkEngineName("RandEngine"); stat |= checkEngineName("RanecuEngine"); stat |= checkEngineName("Ranlux64Engine"); stat |= checkEngineName("RanluxEngine"); stat |= checkEngineName("RanshiEngine"); stat |= checkEngineName("TripleRand"); #endif #ifdef TEST_INSTANCE_METHODS output << "===========================================\n\n"; output << " Part III\n"; output << "Check instance methods for specific engines \n"; output << " specific engines and distributions\n"; output << "===========================================\n\n"; {DualRand e(234); stat |= checkEngineInstanceSave(e);} {Hurd160Engine e(234); stat |= checkEngineInstanceSave(e);} {Hurd288Engine e(234); stat |= checkEngineInstanceSave(e);} {HepJamesRandom e(234); stat |= checkEngineInstanceSave(e);} {MTwistEngine e(234); stat |= checkEngineInstanceSave(e);} {RandEngine e(234); stat |= checkEngineInstanceSave(e);} {RanecuEngine e(234); stat |= checkEngineInstanceSave(e);} {Ranlux64Engine e(234); stat |= checkEngineInstanceSave(e);} {RanluxEngine e(234); stat |= checkEngineInstanceSave(e);} {RanshiEngine e(234); stat |= checkEngineInstanceSave(e);} {TripleRand e(234); stat |= checkEngineInstanceSave(e);} {std::vector nonRand = aSequence(500); NonRandomEngine e; e.setRandomSequence(&nonRand[0], nonRand.size()); stat |= checkEngineInstanceSave(e);} stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); RandGaussQ::shoot(); // Just to verify that the static engine is OK #endif output << "\n=============================================\n\n"; if (stat != 0) { std::cout << "One or more problems detected: stat = " << stat << "\n"; output << "One or more problems detected: stat = " << stat << "\n"; } else { output << "testInstanceRestore passed with no problems detected.\n"; } if (stat == 0) return 0; if (stat > 0) return -(stat|1); return stat|1; } clhep-2.1.4.1.orig/Random/test/testRandom.cc0000755000175000017500000003367512013254144017240 0ustar olesoles// -*- C++ -*- // $Id: testRandom.cc,v 1.2 2010/06/16 17:24:53 garren Exp $ // ---------------------------------------------------------------------- #include "CLHEP/Units/GlobalPhysicalConstants.h" // used to provoke shadowing warnings #include "CLHEP/Random/Randomize.h" #include #include // for exit() using std::cout; using std::endl; using std::cin; using namespace CLHEP; HepJamesRandom theJamesEngine; RandEngine theRandEngine; DRand48Engine theDRand48Engine; RanluxEngine theRanluxEngine(19780503,4); Ranlux64Engine theRanlux64Engine; RanecuEngine theRanecuEngine; Hurd160Engine theHurd160Engine; Hurd288Engine theHurd288Engine; MTwistEngine theMTwistEngine; RanshiEngine theRanshiEngine; DualRand theDualRandEngine; TripleRand theTripleRandEngine; void init() { HepRandom r; cout << "r=" << r() << endl; cout << endl << endl; cout << "---------------------------- Random shooting test -----------------------------" << endl; cout << " -------------------- " << endl; cout << " >>> Random Engines available <<<" << endl << endl; cout << " > HepJamesRandom (default)" << endl; cout << " > Rand" << endl; cout << " > DRand48" << endl; cout << " > Ranlux" << endl; cout << " > Ranlux64" << endl; cout << " > Ranecu" << endl; cout << " > Hurd160" << endl; cout << " > Hurd288" << endl; cout << " > MTwist" << endl; cout << " > Ranshi" << endl; cout << " > DualRand" << endl; cout << " > TripleRand" << endl << endl; cout << " ----- Press to continue -----"; if ( cin.get() != '\n') exit(0); cout << endl; } // end init() void layout() { float m1=3.0; const int size=5; double vect[size]; cout << " Flat ]0,1[ : " << RandFlat::shoot() << endl; cout << " Flat ]0,5[ : " << RandFlat::shoot(5) << endl; cout << " Flat ]-5,3[ : " << RandFlat::shoot(-5,3) << endl; cout << " Exp (m=1) : " << RandExponential::shoot() << endl; cout << " Exp (m=3) : " << RandExponential::shoot(3) << endl; cout << " Gauss (m=1) : " << RandGauss::shoot() << endl; cout << " Gauss (m=3,v=1) : " << RandGauss::shoot(3,1) << endl; cout << " Wigner(1,0.2) : " << RandBreitWigner::shoot(1,0.2) << endl; cout << " Wigner(1,0.2,1) : " << RandBreitWigner::shoot(1,0.2,1) << endl; cout << " Wigner2(1,0.2) : " << RandBreitWigner::shootM2(1,0.2) << endl; cout << " Wigner2(1,0.2,1) : " << RandBreitWigner::shootM2(1,0.2,1) << endl; cout << " IntFlat [0,99[ : " << RandFlat::shootInt(99) << endl; cout << " IntFlat [-99,37[ : " << RandFlat::shootInt(-99,37) << endl; cout << " Poisson (m=3.0) : " << RandPoisson::shoot(m1) << endl; cout << " Binomial(n=1,p=0.5) : " << RandBinomial::shoot() << endl; cout << " Binomial(n=-5,p=0.3): " << RandBinomial::shoot(-5,0.3) << endl; cout << " ChiSqr (a=1) : " << RandChiSquare::shoot() << endl; cout << " ChiSqr (a=-5) : " << RandChiSquare::shoot(-5) << endl; cout << " Gamma (k=1,l=1) : " << RandGamma::shoot() << endl; cout << " Gamma (k=3,l=0.5) : " << RandGamma::shoot(3,0.5) << endl; cout << " StudT (a=1) : " << RandStudentT::shoot() << endl; cout << " StudT (a=2.5) : " << RandStudentT::shoot(2.5) << endl; cout << endl; cout << " Shooting an array of 5 flat numbers ..." << endl << endl; RandFlat::shootArray(size,vect); for ( int i=0; i to continue -----"; if ( cin.get() != '\n') exit(0); cout << endl << endl; cout << "-------------------- Shooting test on distribution objects --------------------" << endl; cout << endl; cout << " Flat ]0,1[ : " << aFlatObj.fire() << endl; cout << " Flat ]0,5[ : " << aFlatObj.fire(5) << endl; cout << " Flat ]-5,3[ : " << aFlatObj.fire(-5,3) << endl; cout << " Exp (m=1) : " << anExponentialObj.fire() << endl; cout << " Exp (m=3) : " << anExponentialObj.fire(3) << endl; cout << " Gauss (m=1) : " << aGaussObj.fire() << endl; cout << " Gauss (m=3,v=1) : " << aGaussObj.fire(3,1) << endl; cout << " Wigner(1,0.2) : " << aBreitObj.fire(1,0.2) << endl; cout << " Wigner(1,0.2,1) : " << aBreitObj.fire(1,0.2,1) << endl; cout << " Wigner2(1,0.2) : " << aBreitObj.fireM2(1,0.2) << endl; cout << " Wigner2(1,0.2,1) : " << aBreitObj.fireM2(1,0.2,1) << endl; cout << " IntFlat [0,99[ : " << aFlatObj.fireInt(99) << endl; cout << " IntFlat [-99,37[ : " << aFlatObj.fireInt(-99,37) << endl; cout << " Poisson (m=3.0) : " << aPoissonObj.fire(m1) << endl; cout << " Binomial(n=1,p=0.5) : " << aBinomialObj.fire() << endl; cout << " Binomial(n=-5,p=0.3): " << aBinomialObj.fire(-5,0.3) << endl; cout << " ChiSqr (a=1) : " << aChiSquareObj.fire() << endl; cout << " ChiSqr (a=-5) : " << aChiSquareObj.fire(-5) << endl; cout << " Gamma (k=1,l=1) : " << aGammaObj.fire() << endl; cout << " Gamma (k=3,l=0.5) : " << aGammaObj.fire(3,0.5) << endl; cout << " StudT (a=1) : " << aStudentTObj.fire() << endl; cout << " StudT (a=2.5) : " << aStudentTObj.fire(2.5) << endl; cout << endl; cout << " Shooting an array of 5 flat numbers ..." << endl << endl; aFlatObj.fireArray(size,vect); for ( int i=0; i to continue -----"; if ( cin.get() != '\n') exit(0); } // end dist_layout() void user_layout() { float m1=3.0; const int size=5; double vect[size]; char sel; HepRandomEngine* anEngine; cout << endl << endl; cout << "-------------------- Shooting test skeeping the generator ---------------------" << endl; cout << endl; cout << " >>> Select a Random Engine <<<" << endl << endl; cout << " a. HepJamesRandom (default)" << endl; cout << " b. Rand" << endl; cout << " c. DRand48" << endl; cout << " d. Ranlux" << endl; cout << " e. Ranlux64" << endl; cout << " f. Ranecu" << endl; cout << " g. Hurd160" << endl; cout << " h. Hurd288" << endl; cout << " i. MTwist" << endl; cout << " j. Ranshi" << endl; cout << " k. DualRand" << endl; cout << " l. TripleRand" << endl << endl; cout << " > "; cin >> sel; while ((sel!='a')&&(sel!='b')&&(sel!='c')&&(sel!='d')&&(sel!='e')&& (sel!='f')&&(sel!='g')&&(sel!='h')&&(sel!='i')&&(sel!='j')&& (sel!='k')&&(sel!='l')) { cout << endl << " >>> Choice not legal !! [a..l]<<<" << endl; cin >> sel; } switch (sel) { case 'a': anEngine = &theJamesEngine; break; case 'b': anEngine = &theRandEngine; break; case 'c': anEngine = &theDRand48Engine; break; case 'd': anEngine = &theRanluxEngine; break; case 'e': anEngine = &theRanlux64Engine; break; case 'f': anEngine = &theRanecuEngine; break; case 'g': anEngine = &theHurd160Engine; break; case 'h': anEngine = &theHurd288Engine; break; case 'i': anEngine = &theMTwistEngine; break; case 'j': anEngine = &theRanshiEngine; break; case 'k': anEngine = &theDualRandEngine; break; case 'l': anEngine = &theTripleRandEngine; break; default: anEngine = &theJamesEngine; break; } cout << endl; cout << " Flat ]0,1[ : " << RandFlat::shoot(anEngine) << endl; cout << " Flat ]0,5[ : " << RandFlat::shoot(anEngine,5) << endl; cout << " Flat ]-5,3[ : " << RandFlat::shoot(anEngine,-5,3) << endl; cout << " Exp (m=1) : " << RandExponential::shoot(anEngine) << endl; cout << " Exp (m=3) : " << RandExponential::shoot(anEngine,3) << endl; cout << " Gauss (m=1) : " << RandGauss::shoot(anEngine) << endl; cout << " Gauss (m=3,v=1) : " << RandGauss::shoot(anEngine,3,1) << endl; cout << " Wigner(1,0.2) : " << RandBreitWigner::shoot(anEngine,1,0.2) << endl; cout << " Wigner(1,0.2,1) : " << RandBreitWigner::shoot(anEngine,1,0.2,1) << endl; cout << " Wigner2(1,0.2) : " << RandBreitWigner::shootM2(anEngine,1,0.2) << endl; cout << " Wigner2(1,0.2,1) : " << RandBreitWigner::shootM2(anEngine,1,0.2,1) << endl; cout << " IntFlat [0,99[ : " << RandFlat::shootInt(anEngine,99) << endl; cout << " IntFlat [-99,37[ : " << RandFlat::shootInt(anEngine,-99,37) << endl; cout << " Poisson (m=3.0) : " << RandPoisson::shoot(anEngine,m1) << endl; cout << " Binomial(n=1,p=0.5) : " << RandBinomial::shoot(anEngine) << endl; cout << " Binomial(n=-5,p=0.3): " << RandBinomial::shoot(anEngine,-5,0.3) << endl; cout << " ChiSqr (a=1) : " << RandChiSquare::shoot(anEngine) << endl; cout << " ChiSqr (a=-5) : " << RandChiSquare::shoot(anEngine,-5) << endl; cout << " Gamma (k=1,l=1) : " << RandGamma::shoot(anEngine) << endl; cout << " Gamma (k=3,l=0.5) : " << RandGamma::shoot(anEngine,3,0.5) << endl; cout << " StudT (a=1) : " << RandStudentT::shoot(anEngine) << endl; cout << " StudT (a=2.5) : " << RandStudentT::shoot(anEngine,2.5) << endl; cout << endl; cout << " Shooting an array of 5 flat numbers ..." << endl << endl; RandFlat::shootArray(anEngine,size,vect); for ( int i=0; i to continue -----"; if ( cin.get() != '\n') exit(0); cout << endl; cout << "--------------------------- Test on RandEngine ------------------------------" << endl; cout << endl; HepRandom::setTheEngine(&theRandEngine); layout(); cout << " ----- Press to continue -----"; if ( cin.get() != '\n') exit(0); cout << endl; cout << "------------------------- Test on DRand48Engine -----------------------------" << endl; cout << endl; HepRandom::setTheEngine(&theDRand48Engine); layout(); cout << " ----- Press to continue -----"; if ( cin.get() != '\n') exit(0); cout << endl; cout << "--------------------- Test on RanluxEngine (luxury 4) ------------------------" << endl; cout << endl; HepRandom::setTheEngine(&theRanluxEngine); layout(); cout << " ----- Press to continue -----"; if ( cin.get() != '\n') exit(0); cout << endl; cout << "------------------------- Test on Ranlux64Engine -----------------------------" << endl; cout << endl; HepRandom::setTheEngine(&theRanlux64Engine); layout(); cout << " ----- Press to continue -----"; if ( cin.get() != '\n') exit(0); cout << endl; cout << "-------------------------- Test on RanecuEngine ------------------------------" << endl; cout << endl; HepRandom::setTheEngine(&theRanecuEngine); layout(); cout << " ----- Press to continue -----"; if ( cin.get() != '\n') exit(0); cout << endl; cout << "------------------------- Test on Hurd160Engine ------------------------------" << endl; cout << endl; HepRandom::setTheEngine(&theHurd160Engine); layout(); cout << " ----- Press to continue -----"; if ( cin.get() != '\n') exit(0); cout << endl; cout << "------------------------- Test on Hurd288Engine ------------------------------" << endl; cout << endl; HepRandom::setTheEngine(&theHurd288Engine); layout(); cout << " ----- Press to continue -----"; if ( cin.get() != '\n') exit(0); cout << endl; cout << "-------------------------- Test on MTwistEngine ------------------------------" << endl; cout << endl; HepRandom::setTheEngine(&theMTwistEngine); layout(); cout << " ----- Press to continue -----"; if ( cin.get() != '\n') exit(0); cout << endl; cout << "-------------------------- Test on RanshiEngine ------------------------------" << endl; cout << endl; HepRandom::setTheEngine(&theRanshiEngine); layout(); cout << " ----- Press to continue -----"; if ( cin.get() != '\n') exit(0); cout << endl; cout << "------------------------- Test on DualRandEngine -----------------------------" << endl; cout << endl; HepRandom::setTheEngine(&theDualRandEngine); layout(); cout << " ----- Press to continue -----"; if ( cin.get() != '\n') exit(0); cout << endl; cout << "------------------------ Test on TripleRandEngine ----------------------------" << endl; cout << endl; HepRandom::setTheEngine(&theTripleRandEngine); layout(); dist_layout(); user_layout(); } // end start_test() int main() { init(); start_test(); return 0; } clhep-2.1.4.1.orig/Random/test/testSaveEngineStatus.cc0000644000175000017500000003540611571253035021245 0ustar olesoles// ---------------------------------------------------------------------- #include "CLHEP/Random/Randomize.h" #include "CLHEP/Random/NonRandomEngine.h" #include "CLHEP/Random/defs.h" #include #include #include #define CLEAN_OUTPUT #ifdef CLEAN_OUTPUT std::ofstream output("testSaveEngineStatus.cout"); #else std::ostream & output = std::cout; #endif // Normally on for routine validation: #define TEST_ORIGINAL_SAVE // Normally off for routine validation: #ifdef TURNOFF #define TEST_MISSING_FILES #define CREATE_OLD_SAVES #define VERIFY_OLD_SAVES #endif #define VERBOSER #define VERBOSER2 using namespace CLHEP; double remembered_r2; double remembered_r1005; double remembered_r1006; double remembered_r1007; // Absolutely Safe Equals Without Registers Screwing Us Up bool equals01(const std::vector &ab) { return ab[1]==ab[0]; } bool equals(double a, double b) { std::vector ab(2); ab[0]=a; ab[1]=b; return (equals01(ab)); } // ------------------- The following should all FAIL ------------ int saveStepX() { double r = RandGauss::shoot(); output << "r(1) = " << r << std::endl; HepRandom::saveEngineStatus(); r = RandGauss::shoot(); output << "r(2) = " << r << std::endl; remembered_r2 = r; r = RandGauss::shoot(); output << "r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandGauss::shoot(); } r = RandGauss::shoot(); remembered_r1005 = r; output << "r1005= " << r << std::endl; r = RandGauss::shoot(); return 0; } int restoreStepX() { HepRandom::restoreEngineStatus(); double r = RandGauss::shoot(); output << "restored r(2) = " << r << std::endl; if ( ! equals(r,remembered_r2) ) { output << "THIS DOES NOT MATCH REMEMBERED VALUE BUT THAT IS EXPECTED\n"; } r = RandGauss::shoot(); output << "restored r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandGauss::shoot(); } r = RandGauss::shoot(); output << "restored r1005= " << r << std::endl; if ( !equals(r,remembered_r1005) ) { output << "THIS DOES NOT MATCH REMEMBERED VALUE BUT THAT IS EXPECTED\n"; } return 0; } int BsaveStepX() { int r = RandFlat::shootBit(); output << "r(1) = " << r << std::endl; HepRandom::saveEngineStatus(); r = RandFlat::shootBit(); output << "r(2) = " << r << std::endl; remembered_r2 = r; r = RandFlat::shootBit(); output << "r(3) = " << r << std::endl; double d; for (int i=0; i < 1001; i++) { d = RandFlat::shoot(); if (d > 1) output << "This line inserted so clever compilers don't warn about not using d\n"; } r = RandFlat::shootBit(); remembered_r1005 = r; output << "r1005= " << r << std::endl; r = RandFlat::shootBit(); return 0; } int BrestoreStepX() { HepRandom::restoreEngineStatus(); int r = RandFlat::shootBit(); output << "restored r(2) = " << r << std::endl; if ( r != remembered_r2 ) { output << "THIS DOES NOT MATCH REMEMBERED VALUE BUT THAT IS EXPECTED\n"; } r = RandFlat::shootBit(); output << "restored r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandFlat::shootBit(); } r = RandFlat::shootBit(); output << "restored r1005= " << r << std::endl; if ( r != remembered_r1005 ) { output << "THIS DOES NOT MATCH REMEMBERED VALUE BUT THAT IS EXPECTED\n"; } return 0; } // ------------------- The following should all WORK ------------ int saveStep() { int stat=0; double r = RandGauss::shoot(); output << "r(1) = " << r << std::endl; RandGauss::saveEngineStatus(); r = RandGauss::shoot(); output << "r(2) = " << r << std::endl; remembered_r2 = r; r = RandGauss::shoot(); output << "r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandGauss::shoot(); } r = RandGauss::shoot(); remembered_r1005 = r; output << "r1005= " << r << std::endl; r = RandGauss::shoot(); return stat; } int restoreStep() { int stat=0; RandGauss::restoreEngineStatus(); double r = RandGauss::shoot(); output << "restored r(2) = " << r << std::endl; if ( !equals(r,remembered_r2) ) { std::cout << "restored r(2) = " << r << std::endl; std::cout << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; #ifdef CLEAN_OUTPUT output << "restored r(2) = " << r << std::endl; output << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; #endif stat += 1; } r = RandGauss::shoot(); output << "restored r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandGauss::shoot(); } r = RandGauss::shoot(); output << "restored r1005= " << r << std::endl; if ( !equals(r,remembered_r1005) ) { std::cout << "restored r1005= " << r << std::endl; std::cout << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; #ifdef CLEAN_OUTPUT output << "restored r1005= " << r << std::endl; output << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; #endif stat += 2; } return stat; } int BsaveStep() { int stat=0; int r = RandFlat::shootBit(); output << "r(1) = " << r << std::endl; RandFlat::saveEngineStatus(); r = RandFlat::shootBit(); output << "r(2) = " << r << std::endl; remembered_r2 = r; r = RandFlat::shootBit(); output << "r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandFlat::shootBit(); } r = RandFlat::shootBit(); remembered_r1005 = r; output << "r1005 = " << r << std::endl; r = RandFlat::shootBit(); remembered_r1006 = r; output << "r1006 = " << r << std::endl; r = RandFlat::shootBit(); remembered_r1007 = r; output << "r1007 = " << r << std::endl; r = RandFlat::shootBit(); return stat; } int BrestoreStep() { int stat=0; RandFlat::restoreEngineStatus(); int r = RandFlat::shootBit(); output << "restored r(2) = " << r << std::endl; if ( r != remembered_r2 ) { stat += 4; std::cout << "restored r(2) = " << r << std::endl; std::cout << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; #ifdef CLEAN_OUTPUT output << "restored r(2) = " << r << std::endl; output << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; #endif } r = RandFlat::shootBit(); output << "restored r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandFlat::shootBit(); } r = RandFlat::shootBit(); output << "restored r1005= " << r << std::endl; if ( r != remembered_r1005 ) { stat += 8; std::cout << "restored r1005= " << r << std::endl; std::cout << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; #ifdef CLEAN_OUTPUT output << "restored r1005= " << r << std::endl; output << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; #endif } r = RandFlat::shootBit(); output << "restored r1006= " << r << std::endl; if ( r != remembered_r1006 ) { stat += 16; std::cout << "restored r1006= " << r << std::endl; std::cout << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; #ifdef CLEAN_OUTPUT output << "restored r1006= " << r << std::endl; output << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; #endif } r = RandFlat::shootBit(); output << "restored r1007= " << r << std::endl; if ( r != remembered_r1007 ) { stat += 32; std::cout << "restored r1007= " << r << std::endl; std::cout << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; #ifdef CLEAN_OUTPUT output << "restored r1007= " << r << std::endl; output << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; #endif } return stat; } // --- The following should work, by failing in an expected way ------- template int fileNotThere() { int stat = 0; HepRandomEngine * old = D::getTheEngine(); E e(123); output << "File-not-found test restoring "< int fileNotThereEngine() { int stat = 0; stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); return stat; } int missingFile() { int stat = 0; stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); return stat; } // -- The following was used to capture old-form engine states (sans name) -- template int saveEngine(const char* filename) { int stat = 0; HepRandomEngine * old = D::getTheEngine(); E e(123); D::setTheEngine(&e); double r=0; for (int i=0; i<3; i++) r += D::shoot(); D::saveEngineStatus(filename); if (r == -99999999.1) stat = 999; // This prevents clever compilers from // deducing that r is never needed D::setTheEngine(old); // If we don't do this, then the static engine shared // by every shoot() method reamins e -- which is about // to go out of scope and be destructed! return stat; } // -- The following checks on static engine restores, from old and new forms -- template int checkSaveEngine(const char* filename) { int stat = 0; HepRandomEngine * old = D::getTheEngine(); // Generate save with current format (default file name is fine) E e(123); D::setTheEngine(&e); double r=0; for (int i=0; i<3; i++) r += D::shoot(); D::saveEngineStatus(); // Figure out what the key variate value should be double keyValue = D::shoot(); // Restore state based on old file, and check for proper value D::restoreEngineStatus(filename); if (!equals(D::shoot(), keyValue)) { std::cout << "???? Value mismatch from file " << filename << "\n"; #ifdef CLEAN_OUTPUT output << "???? Value mismatch from file " << filename << "\n"; #endif stat |= 64; } // Restore state based on that save, and check for proper value D::restoreEngineStatus(); if (!equals(D::shoot(),keyValue)) { std::cout << "???? Value mismatch from new-format file \n"; #ifdef CLEAN_OUTPUT output << "???? Value mismatch from new-format file \n"; #endif stat |= 128; } D::setTheEngine(old); return stat; } // --------------------------------------------- // --------------------------------------------- // --------------------------------------------- int main() { int stat = 0; #ifdef TEST_ORIGINAL_SAVE output << "=====================================\n"; output << " Part I \n"; output << "Original tests of static save/restore\n"; output << "=====================================\n\n"; output << "Using old method or HepRandom::saveEngineStatus:\n"; output << "All these tests should have a chance of failure.\n"; output << RandGauss:: getTheEngine()->name(); output << RandGaussQ::getTheEngine()->name(); stat |= saveStepX(); stat |= restoreStepX(); stat |= BsaveStepX(); stat |= BrestoreStepX(); output << "Using the class-specific RandGauss::saveEngineStatus:\n"; output << "All these tests should work properly.\n"; stat |= saveStep(); stat |= restoreStep(); stat |= BsaveStep(); stat |= BrestoreStep(); #endif #ifdef TEST_MISSING_FILES output << "\n=======================================\n"; output << " Part Ia \n"; output << "Test of behavior when a file is missing \n"; output << "=======================================\n\n"; output << "Testing restoreEngineStatus with missing file:\n"; output << "Expect a number of messages!\n"; stat |= missingFile(); #endif #ifdef CREATE_OLD_SAVES stat |= saveEngine("DRand48Engine.oldsav"); stat |= saveEngine("DualRand.oldsav"); stat |= saveEngine("Hurd160Engine.oldsav"); stat |= saveEngine("Hurd288Engine.oldsav"); stat |= saveEngine("HepJamesRandom.oldsav"); stat |= saveEngine("MTwistEngine.oldsav"); stat |= saveEngine("RanecuEngine.oldsav"); stat |= saveEngine("Ranlux64Engine.oldsav"); stat |= saveEngine("RanluxEngine.oldsav"); stat |= saveEngine("RanshiEngine.oldsav"); stat |= saveEngine("TripleRand.oldsav"); #endif #ifdef VERIFY_OLD_SAVES output << "\n==============================================\n"; output << " Part Ib \n"; output << " Verification that changes wont invalidate \n"; output << "invalidate engine saves from previous versions \n"; output << "==============================================\n\n"; stat |= checkSaveEngine("DRand48Engine.oldsav"); stat |= checkSaveEngine("DualRand.oldsav"); stat |= checkSaveEngine("Hurd160Engine.oldsav"); stat |= checkSaveEngine("Hurd288Engine.oldsav"); stat |= checkSaveEngine("HepJamesRandom.oldsav"); stat |= checkSaveEngine("MTwistEngine.oldsav"); stat |= checkSaveEngine("Ranlux64Engine.oldsav"); stat |= checkSaveEngine("RanluxEngine.oldsav"); stat |= checkSaveEngine("RanshiEngine.oldsav"); stat |= checkSaveEngine("TripleRand.oldsav"); stat |= checkSaveEngine("RanecuEngine.oldsav"); #endif output << "\n=============================================\n\n"; if (stat != 0) { std::cout << "One or more problems detected: stat = " << stat << "\n"; output << "One or more problems detected: stat = " << stat << "\n"; } else { output << "testSaveEngineStatus passed with no problems detected.\n"; } if (stat == 0) return 0; if (stat > 0) return -(stat|1); return stat|1; } clhep-2.1.4.1.orig/Random/test/testZiggurat.cc0000644000175000017500000000270312221102474017574 0ustar olesoles////////////////////////////////////////////////////////////////////////// #include #include "CLHEP/Random/RandGauss.h" #include "CLHEP/Random/RandGaussQ.h" #include "CLHEP/Random/RandExponential.h" #include "CLHEP/Random/RandGaussZiggurat.h" #include "CLHEP/Random/RandExpZiggurat.h" //_________________________________________________________________________ int main() { std::ofstream output("testZiggurat.cout"); int ntest=10000000; output << "DEBUG: ntest="< #include #include // double abs() #include // int abs() #include // for exit() using std::cin; using std::cout; using std::cerr; using std::endl; using std::setprecision; using namespace CLHEP; //#ifndef _WIN32 //using std::exp; //#endif // Tolerance of deviation from expected results static const double REJECT = 4.0; // Mask bits to form a word indicating which if any dists were "bad" static const int GaussBAD = 1 << 0; static const int GeneralBAD = 1 << 1; static const int PoissonBAD = 1 << 2; static const int GaussQBAD = 1 << 3; static const int GaussTBAD = 1 << 4; static const int PoissonQBAD = 1 << 5; static const int PoissonTBAD = 1 << 6; static const int SkewNormalBAD = 1 << 7; // ********************** // // SECTION I - General tools for the various tests // // ********************** static double gammln(double x) { // Note: This uses the gammln algorith in Numerical Recipes. // In the "old" RandPoisson there is a slightly different algorithm, // which mathematically is identical to this one. The advantage of // the modified method is one fewer division by x (in exchange for // doing one subtraction of 1 from x). The advantage of the method // here comes when .00001 < x < .65: In this range, the alternate // method produces results which have errors 10-100 times those // of this method (though still less than 1.0E-10). If we package // either method, we should use the reflection formula (6.1.4) so // that the user can never get inaccurate results, even for x very // small. The test for x < 1 is as costly as a divide, but so be it. double y, tmp, ser; static double c[6] = { 76.18009172947146, -86.50532032941677, 24.01409824083091, -1.231739572450155, 0.001208650973866179, -0.000005395239384953 }; y = x; tmp = x + 5.5; tmp -= (x+.5)*std::log(tmp); ser = 1.000000000190015; for (int i = 0; i < 6; i++) { ser += c[i]/(++y); } double ans = (-tmp + std::log (std::sqrt(CLHEP::twopi)*ser/x)); return ans; } static double gser(double a, double x) { const int ITMAX = 100; const double EPS = 1.0E-8; double ap = a; double sum = 1/a; double del = sum; for (int n=0; n < ITMAX; n++) { ap++; del *= x/ap; sum += del; if (std::fabs(del) < std::fabs(sum)*EPS) { return sum*std::exp(-x+a*std::log(x)-gammln(a)); } } cout << "Problem - inaccurate gser " << a << ", " << x << "\n"; return sum*std::exp(-x+a*std::log(x)-gammln(a)); } static double gcf(double a, double x) { const int ITMAX = 100; const double EPS = 1.0E-8; const double VERYSMALL = 1.0E-100; double b = x+1-a; double c = 1/VERYSMALL; double d = 1/b; double h = d; for (int i = 1; i <= ITMAX; i++) { double an = -i*(i-a); b += 2; d = an*d + b; if (std::fabs(d) < VERYSMALL) d = VERYSMALL; c = b + an/c; if (std::fabs(c) < VERYSMALL) c = VERYSMALL; d = 1/d; double del = d*c; h *= del; if (std::fabs(del-1.0) < EPS) { return std::exp(-x+a*std::log(x)-gammln(a))*h; } } cout << "Problem - inaccurate gcf " << a << ", " << x << "\n"; return std::exp(-x+a*std::log(x)-gammln(a))*h; } static double gammp (double a, double x) { if (x < a+1) { return gser(a,x); } else { return 1-gcf(a,x); } } // ********************** // // SECTION II - Validation of specific distributions // // ********************** // ------------ // gaussianTest // ------------ bool gaussianTest ( HepRandom & dist, double mu, double sigma, int nNumbers ) { bool good = true; double worstSigma = 0; // We will accumulate mean and moments up to the sixth, // The second moment should be sigma**2, the fourth 3 sigma**4, // the sixth 15 sigma**6. The expected variance in these is // (for the m-th moment with m even) (2m-1)!! (m-1)!!**2 / n // (for the m-th moment with m odd) (2m-1)!! m!!**2 / n // We also do a histogram with bins every half sigma. double sumx = 0; double sumx2 = 0; double sumx3 = 0; double sumx4 = 0; double sumx5 = 0; double sumx6 = 0; int counts[11]; int ncounts[11]; int ciu; for (ciu = 0; ciu < 11; ciu++) { counts[ciu] = 0; ncounts[ciu] = 0; } int oldprecision = cout.precision(); cout.precision(5); // hack so that gcc 4.3 puts x and u into memory instead of a register volatile double x; volatile double u; int ipr = nNumbers / 10 + 1; for (int ifire = 0; ifire < nNumbers; ifire++) { x = dist(); // We avoid fire() because that is not virtual // in HepRandom. if( x < mu - 12.0*sigma ) { cout << "x = " << x << "\n"; } if ( (ifire % ipr) == 0 ) { cout << ifire << endl; } sumx += x; sumx2 += x*x; sumx3 += x*x*x; sumx4 += x*x*x*x; sumx5 += x*x*x*x*x; sumx6 += x*x*x*x*x*x; u = (x - mu) / sigma; if ( u >= 0 ) { ciu = (int)(2*u); if (ciu>10) ciu = 10; counts[ciu]++; } else { ciu = (int)(2*(-u)); if (ciu>10) ciu = 10; ncounts[ciu]++; } } double mean = sumx / nNumbers; double u2 = sumx2/nNumbers - mean*mean; double u3 = sumx3/nNumbers - 3*sumx2*mean/nNumbers + 2*mean*mean*mean; double u4 = sumx4/nNumbers - 4*sumx3*mean/nNumbers + 6*sumx2*mean*mean/nNumbers - 3*mean*mean*mean*mean; double u5 = sumx5/nNumbers - 5*sumx4*mean/nNumbers + 10*sumx3*mean*mean/nNumbers - 10*sumx2*mean*mean*mean/nNumbers + 4*mean*mean*mean*mean*mean; double u6 = sumx6/nNumbers - 6*sumx5*mean/nNumbers + 15*sumx4*mean*mean/nNumbers - 20*sumx3*mean*mean*mean/nNumbers + 15*sumx2*mean*mean*mean*mean/nNumbers - 5*mean*mean*mean*mean*mean*mean; cout << "Mean (should be close to " << mu << "): " << mean << endl; cout << "Second moment (should be close to " << sigma*sigma << "): " << u2 << endl; cout << "Third moment (should be close to zero): " << u3 << endl; cout << "Fourth moment (should be close to " << 3*sigma*sigma*sigma*sigma << "): " << u4 << endl; cout << "Fifth moment (should be close to zero): " << u5 << endl; cout << "Sixth moment (should be close to " << 15*sigma*sigma*sigma*sigma*sigma*sigma << "): " << u6 << endl; // For large N, the variance squared in the scaled 2nd, 3rd 4th 5th and // 6th moments are roughly 2/N, 6/N, 96/N, 720/N and 10170/N respectively. // Based on this, we can judge how many sigma a result represents: double del1 = std::sqrt ( (double) nNumbers ) * std::abs(mean - mu) / sigma; double del2 = std::sqrt ( nNumbers/2.0 ) * std::abs(u2 - sigma*sigma) / (sigma*sigma); double del3 = std::sqrt ( nNumbers/6.0 ) * std::abs(u3) / (sigma*sigma*sigma); double sigma4 = sigma*sigma*sigma*sigma; double del4 = std::sqrt ( nNumbers/96.0 ) * std::abs(u4 - 3 * sigma4) / sigma4; double del5 = std::sqrt ( nNumbers/720.0 ) * std::abs(u5) / (sigma*sigma4); double del6 = std::sqrt ( nNumbers/10170.0 ) * std::abs(u6 - 15*sigma4*sigma*sigma) / (sigma4*sigma*sigma); cout << " These represent " << del1 << ", " << del2 << ", " << del3 << ", \n" <<" " << del4 << ", " << del5 << ", " << del6 <<"\n standard deviations from expectations\n"; if ( del1 > worstSigma ) worstSigma = del1; if ( del2 > worstSigma ) worstSigma = del2; if ( del3 > worstSigma ) worstSigma = del3; if ( del4 > worstSigma ) worstSigma = del4; if ( del5 > worstSigma ) worstSigma = del5; if ( del6 > worstSigma ) worstSigma = del6; if ( del1 > REJECT || del2 > REJECT || del3 > REJECT || del4 > REJECT || del5 > REJECT || del6 > REJECT ) { cout << "REJECT hypothesis that this distribution is correct!!\n"; good = false; } // The variance of the bin counts is given by a Poisson estimate (std::sqrt(npq)). double table[11] = { // Table of integrated density in each range: .191462, // 0.0 - 0.5 sigma .149882, // 0.5 - 1.0 sigma .091848, // 1.0 - 1.5 sigma .044057, // 1.5 - 2.0 sigma .016540, // 2.0 - 2.5 sigma .004860, // 2.5 - 3.0 sigma .001117, // 3.0 - 3.5 sigma .000201, // 3.5 - 4.0 sigma 2.83E-5, // 4.0 - 4.5 sigma 3.11E-6, // 4.5 - 5.0 sigma 3.87E-7 // 5.0 sigma and up }; for (int m1 = 0; m1 < 11; m1++) { double expect = table[m1]*nNumbers; double sig = std::sqrt ( table[m1] * (1.0-table[m1]) * nNumbers ); cout.precision(oldprecision); cout << "Between " << m1/2.0 << " sigma and " << m1/2.0+.5 << " sigma (should be about " << expect << "):\n " << " " << ncounts[m1] << " negative and " << counts[m1] << " positive " << "\n"; cout.precision(5); double negSigs = std::abs ( ncounts[m1] - expect ) / sig; double posSigs = std::abs ( counts[m1] - expect ) / sig; cout << " These represent " << negSigs << " and " << posSigs << " sigma from expectations\n"; if ( negSigs > REJECT || posSigs > REJECT ) { cout << "REJECT hypothesis that this distribution is correct!!\n"; good = false; } if ( negSigs > worstSigma ) worstSigma = negSigs; if ( posSigs > worstSigma ) worstSigma = posSigs; } cout << "\n The worst deviation encountered (out of about 25) was " << worstSigma << " sigma \n\n"; cout.precision(oldprecision); return good; } // gaussianTest() // ------------ // skewNormalTest // ------------ bool skewNormalTest ( HepRandom & dist, double k, int nNumbers ) { bool good = true; double worstSigma = 0; // We will accumulate mean and moments up to the sixth, // The second moment should be sigma**2, the fourth 3 sigma**4. // The expected variance in these is // (for the m-th moment with m even) (2m-1)!! (m-1)!!**2 / n // (for the m-th moment with m odd) (2m-1)!! m!!**2 / n double sumx = 0; double sumx2 = 0; double sumx3 = 0; double sumx4 = 0; double sumx5 = 0; double sumx6 = 0; int oldprecision = cout.precision(); cout.precision(5); // hack so that gcc 4.3 puts x into memory instead of a register volatile double x; // calculate mean and sigma double delta = k / std::sqrt( 1 + k*k ); double mu = delta/std::sqrt(CLHEP::halfpi); double mom2 = 1.; double mom3 = 3*delta*(1-(delta*delta)/3.)/std::sqrt(CLHEP::halfpi); double mom4 = 3.; double mom5 = 15*delta*(1-2.*(delta*delta)/3.+(delta*delta*delta*delta)/5.)/std::sqrt(CLHEP::halfpi); double mom6 = 15.; int ipr = nNumbers / 10 + 1; for (int ifire = 0; ifire < nNumbers; ifire++) { x = dist(); // We avoid fire() because that is not virtual // in HepRandom. if( x < mu - 12.0 ) { cout << "x = " << x << "\n"; } if ( (ifire % ipr) == 0 ) { cout << ifire << endl; } sumx += x; sumx2 += x*x; sumx3 += x*x*x; sumx4 += x*x*x*x; sumx5 += x*x*x*x*x; sumx6 += x*x*x*x*x*x; } double mean = sumx / nNumbers; double u2 = sumx2/nNumbers; double u3 = sumx3/nNumbers; double u4 = sumx4/nNumbers; double u5 = sumx5/nNumbers; double u6 = sumx6/nNumbers; cout << "Mean (should be close to " << mu << "): " << mean << endl; cout << "Second moment (should be close to " << mom2 << "): " << u2 << endl; cout << "Third moment (should be close to " << mom3 << "): " << u3 << endl; cout << "Fourth moment (should be close to " << mom4 << "): " << u4 << endl; cout << "Fifth moment (should be close to " << mom5 << "): " << u5 << endl; cout << "Sixth moment (should be close to " << mom6 << "): " << u6 << endl; double del1 = std::sqrt ( (double) nNumbers ) * std::abs(mean - mu); double del2 = std::sqrt ( nNumbers/2.0 ) * std::abs(u2 - mom2); double del3 = std::sqrt ( nNumbers/(15.-mom3*mom3) ) * std::abs(u3 - mom3 ); double del4 = std::sqrt ( nNumbers/96.0 ) * std::abs(u4 - mom4); double del5 = std::sqrt ( nNumbers/(945.-mom5*mom5) ) * std::abs(u5 - mom5 ); double del6 = std::sqrt ( nNumbers/10170.0 ) * std::abs(u6 - mom6); cout << " These represent " << del1 << ", " << del2 << ", " << del3 << ", \n" <<" " << del4 << ", " << del5 << ", " << del6 <<"\n standard deviations from expectations\n"; if ( del1 > worstSigma ) worstSigma = del1; if ( del2 > worstSigma ) worstSigma = del2; if ( del3 > worstSigma ) worstSigma = del3; if ( del4 > worstSigma ) worstSigma = del4; if ( del5 > worstSigma ) worstSigma = del5; if ( del6 > worstSigma ) worstSigma = del6; if ( del1 > REJECT || del2 > REJECT || del3 > REJECT || del4 > REJECT || del5 > REJECT || del6 > REJECT ) { cout << "REJECT hypothesis that this distribution is correct!!\n"; good = false; } cout << "\n The worst deviation encountered (out of about 25) was " << worstSigma << " sigma \n\n"; cout.precision(oldprecision); return good; } // skewNormalTest() // ------------ // poissonTest // ------------ class poisson { double mu_; public: poisson(double mu) : mu_(mu) {} double operator()(int r) { double logAnswer = -mu_ + r*std::log(mu_) - gammln(r+1); return std::exp(logAnswer); } }; double* createRefDist ( poisson pdist, int N, int MINBIN, int MAXBINS, int clumping, int& firstBin, int& lastBin ) { // Create the reference distribution -- making sure there are more than // 20 points at each value. The entire tail will be rolled up into one // value (at each end). We shall end up with some range of bins starting // at 0 or more, and ending at MAXBINS-1 or less. double * refdist = new double [MAXBINS]; int c = 0; // c is the number of the clump, that is, the member number // of the refdist array. int ic = 0; // ic is the number within the clump; mod clumping int r = 0; // r is the value of the variate. // Determine the first bin: at least 20 entries must be at the level // of that bin (so that we won't immediately dip belpw 20) but the number // to enter is cumulative up to that bin. double start = 0; double binc; while ( c < MAXBINS ) { for ( ic=0, binc=0; ic < clumping; ic++, r++ ) { binc += pdist(r) * N; } start += binc; if (binc >= MINBIN) break; c++; if ( c > MAXBINS/3 ) { cout << "The number of samples supplied " << N << " is too small to set up a chi^2 to test this distribution.\n"; exit(-1); } } firstBin = c; refdist[firstBin] = start; c++; // Fill all the other bins until one has less than 20 items. double next = 0; while ( c < MAXBINS ) { for ( ic=0, binc=0; ic < clumping; ic++, r++ ) { binc += pdist(r) * N; } next = binc; if (next < MINBIN) break; refdist[c] = next; c++; } // Shove all the remaining items into last bin. lastBin = c-1; next += refdist[lastBin]; while ( c < MAXBINS ) { for ( ic=0, binc=0; ic < clumping; ic++, r++ ) { binc += pdist(r) * N; } next += binc; c++; } refdist[lastBin] = next; return refdist; } // createRefDist() bool poissonTest ( RandPoisson & dist, double mu, int N ) { // Three tests will be done: // // A chi-squared test will be used to test the hypothesis that the // generated distribution of N numbers matches the proper Poisson distribution. // // The same test will be applied to the distribution of numbers "clumping" // together std::sqrt(mu) bins. This will detect small deviations over several // touching bins, when mu is not small. // // The mean and second moment are checked against their theoretical values. bool good = true; int clumping = int(std::sqrt(mu)); if (clumping <= 1) clumping = 2; const int MINBIN = 20; const int MAXBINS = 1000; int firstBin; int lastBin; int firstBin2; int lastBin2; poisson pdist(mu); double* refdist = createRefDist( pdist, N, MINBIN, MAXBINS, 1, firstBin, lastBin); double* refdist2 = createRefDist( pdist, N, MINBIN, MAXBINS, clumping, firstBin2, lastBin2); // Now roll the random dists, treating the tails in the same way as we go. double sum = 0; double moment = 0; double* samples = new double [MAXBINS]; double* samples2 = new double [MAXBINS]; int r; for (r = 0; r < MAXBINS; r++) { samples[r] = 0; samples2[r] = 0; } int r1; int r2; for (int i = 0; i < N; i++) { r = dist.fire(); sum += r; moment += (r - mu)*(r - mu); r1 = r; if (r1 < firstBin) r1 = firstBin; if (r1 > lastBin) r1 = lastBin; samples[r1] += 1; r2 = r/clumping; if (r2 < firstBin2) r2 = firstBin2; if (r2 > lastBin2) r2 = lastBin2; samples2[r2] += 1; } // #ifdef DIAGNOSTIC int k; for (k = firstBin; k <= lastBin; k++) { cout << k << " " << samples[k] << " " << refdist[k] << " " << (samples[k]-refdist[k])*(samples[k]-refdist[k])/refdist[k] << "\n"; } cout << "----\n"; for (k = firstBin2; k <= lastBin2; k++) { cout << k << " " << samples2[k] << " " << refdist2[k] << "\n"; } // #endif // DIAGNOSTIC // Now find chi^2 for samples[] to apply the first test double chi2 = 0; for ( r = firstBin; r <= lastBin; r++ ) { double delta = (samples[r] - refdist[r]); chi2 += delta*delta/refdist[r]; } int degFreedom = (lastBin - firstBin + 1) - 1; // and finally, p. Since we only care about it for small values, // and never care about it past the 10% level, we can use the approximations // CL(chi^2,n) = 1/std::sqrt(CLHEP::twopi) * ErrIntC ( y ) with // y = std::sqrt(2*chi2) - std::sqrt(2*n-1) // errIntC (y) = std::exp((-y^2)/2)/(y*std::sqrt(CLHEP::twopi)) double pval; pval = 1.0 - gammp ( .5*degFreedom , .5*chi2 ); cout << "Chi^2 is " << chi2 << " on " << degFreedom << " degrees of freedom." << " p = " << pval << "\n"; delete[] refdist; delete[] samples; // Repeat the chi^2 and p for the clumped sample, to apply the second test chi2 = 0; for ( r = firstBin2; r <= lastBin2; r++ ) { double delta = (samples2[r] - refdist2[r]); chi2 += delta*delta/refdist2[r]; } degFreedom = (lastBin2 - firstBin2 + 1) - 1; double pval2; pval2 = 1.0 - gammp ( .5*degFreedom , .5*chi2 ); cout << "Clumps: Chi^2 is " << chi2 << " on " << degFreedom << " degrees of freedom." << " p = " << pval2 << "\n"; delete[] refdist2; delete[] samples2; // Check out the mean and sigma to apply the third test double mean = sum / N; double sigma = std::sqrt( moment / (N-1) ); double deviationMean = std::fabs(mean - mu)/(std::sqrt(mu/N)); double expectedSigma2Variance = (2*N*mu*mu/(N-1) + mu) / N; double deviationSigma = std::fabs(sigma*sigma-mu)/std::sqrt(expectedSigma2Variance); cout << "Mean (should be " << mu << ") is " << mean << "\n"; cout << "Sigma (should be " << std::sqrt(mu) << ") is " << sigma << "\n"; cout << "These are " << deviationMean << " and " << deviationSigma << " standard deviations from expected values\n\n"; // If either p-value for the chi-squared tests is less that .0001, or // either the mean or sigma are more than 3.5 standard deviations off, // then reject the validation. This would happen by chance one time // in 2000. Since we will be validating for several values of mu, the // net chance of false rejection remains acceptable. if ( (pval < .0001) || (pval2 < .0001) || (deviationMean > 3.5) || (deviationSigma > 3.5) ) { good = false; cout << "REJECT this distributon!!!\n"; } return good; } // poissonTest() // ********************** // // SECTION III - Tests of each distribution class // // ********************** // --------- // RandGauss // --------- int testRandGauss() { cout << "\n--------------------------------------------\n"; cout << "Test of RandGauss distribution \n\n"; long seed; cout << "Please enter an integer seed: "; cin >> seed; cout << seed << "\n"; if (seed == 0) { cout << "Moving on to next test...\n"; return 0; } int nNumbers; cout << "How many numbers should we generate: "; cin >> nNumbers; cout << nNumbers << "\n"; double mu; double sigma; cout << "Enter mu: "; cin >> mu; cout << mu << "\n"; cout << "Enter sigma: "; cin >> sigma; cout << sigma << "\n"; cout << "\nInstantiating distribution utilizing TripleRand engine...\n"; TripleRand eng (seed); RandGauss dist (eng, mu, sigma); cout << "\n Sample fire(): \n"; double x; x = dist.fire(); cout << x; cout << "\n Testing operator() ... \n"; bool good = gaussianTest ( dist, mu, sigma, nNumbers ); if (good) { return 0; } else { return GaussBAD; } } // testRandGauss() // --------- // SkewNormal // --------- int testSkewNormal() { cout << "\n--------------------------------------------\n"; cout << "Test of SkewNormal distribution \n\n"; long seed; cout << "Please enter an integer seed: "; cin >> seed; cout << seed << "\n"; if (seed == 0) { cout << "Moving on to next test...\n"; return 0; } int nNumbers; cout << "How many numbers should we generate: "; cin >> nNumbers; cout << nNumbers << "\n"; double k; cout << "Enter k: "; cin >> k; cout << k << "\n"; cout << "\nInstantiating distribution utilizing TripleRand engine...\n"; TripleRand eng (seed); RandSkewNormal dist (eng, k); cout << "\n Sample fire(): \n"; double x; x = dist.fire(); cout << x; cout << "\n Testing operator() ... \n"; bool good = skewNormalTest ( dist, k, nNumbers ); if (good) { return 0; } else { return SkewNormalBAD; } } // testSkewNormal() // --------- // RandGaussT // --------- int testRandGaussT() { cout << "\n--------------------------------------------\n"; cout << "Test of RandGaussT distribution \n\n"; long seed; cout << "Please enter an integer seed: "; cin >> seed; cout << seed << "\n"; if (seed == 0) { cout << "Moving on to next test...\n"; return 0; } int nNumbers; cout << "How many numbers should we generate: "; cin >> nNumbers; cout << nNumbers << "\n"; double mu; double sigma; cout << "Enter mu: "; cin >> mu; cout << mu << "\n"; cout << "Enter sigma: "; cin >> sigma; cout << sigma << "\n"; cout << "\nInstantiating distribution utilizing TripleRand engine...\n"; TripleRand eng (seed); RandGaussT dist (eng, mu, sigma); cout << "\n Sample fire(): \n"; double x; x = dist.fire(); cout << x; cout << "\n Testing operator() ... \n"; bool good = gaussianTest ( dist, mu, sigma, nNumbers ); if (good) { return 0; } else { return GaussTBAD; } } // testRandGaussT() // --------- // RandGaussQ // --------- int testRandGaussQ() { cout << "\n--------------------------------------------\n"; cout << "Test of RandGaussQ distribution \n\n"; long seed; cout << "Please enter an integer seed: "; cin >> seed; cout << seed << "\n"; if (seed == 0) { cout << "Moving on to next test...\n"; return 0; } int nNumbers; cout << "How many numbers should we generate: "; cin >> nNumbers; cout << nNumbers << "\n"; if (nNumbers >= 20000000) { cout << "With that many samples RandGaussQ need not pass validation...\n"; } double mu; double sigma; cout << "Enter mu: "; cin >> mu; cout << mu << "\n"; cout << "Enter sigma: "; cin >> sigma; cout << sigma << "\n"; cout << "\nInstantiating distribution utilizing DualRand engine...\n"; DualRand eng (seed); RandGaussQ dist (eng, mu, sigma); cout << "\n Sample fire(): \n"; double x; x = dist.fire(); cout << x; cout << "\n Testing operator() ... \n"; bool good = gaussianTest ( dist, mu, sigma, nNumbers ); if (good) { return 0; } else { return GaussQBAD; } } // testRandGaussQ() // --------- // RandPoisson // --------- int testRandPoisson() { cout << "\n--------------------------------------------\n"; cout << "Test of RandPoisson distribution \n\n"; long seed; cout << "Please enter an integer seed: "; cin >> seed; cout << seed << "\n"; if (seed == 0) { cout << "Moving on to next test...\n"; return 0; } cout << "\nInstantiating distribution utilizing TripleRand engine...\n"; TripleRand eng (seed); int nNumbers; cout << "How many numbers should we generate for each mu: "; cin >> nNumbers; cout << nNumbers << "\n"; bool good = true; while (true) { double mu; cout << "Enter a value for mu: "; cin >> mu; cout << mu << "\n"; if (mu == 0) break; RandPoisson dist (eng, mu); cout << "\n Sample fire(): \n"; double x; x = dist.fire(); cout << x; cout << "\n Testing operator() ... \n"; bool this_good = poissonTest ( dist, mu, nNumbers ); if (!this_good) { cout << "\n Poisson distribution for mu = " << mu << " is incorrect!!!\n"; } good &= this_good; } // end of the while(true) if (good) { return 0; } else { return PoissonBAD; } } // testRandPoisson() // --------- // RandPoissonQ // --------- int testRandPoissonQ() { cout << "\n--------------------------------------------\n"; cout << "Test of RandPoissonQ distribution \n\n"; long seed; cout << "Please enter an integer seed: "; cin >> seed; cout << seed << "\n"; if (seed == 0) { cout << "Moving on to next test...\n"; return 0; } cout << "\nInstantiating distribution utilizing TripleRand engine...\n"; TripleRand eng (seed); int nNumbers; cout << "How many numbers should we generate for each mu: "; cin >> nNumbers; cout << nNumbers << "\n"; bool good = true; while (true) { double mu; cout << "Enter a value for mu: "; cin >> mu; cout << mu << "\n"; if (mu == 0) break; RandPoissonQ dist (eng, mu); cout << "\n Sample fire(): \n"; double x; x = dist.fire(); cout << x; cout << "\n Testing operator() ... \n"; bool this_good = poissonTest ( dist, mu, nNumbers ); if (!this_good) { cout << "\n Poisson distribution for mu = " << mu << " is incorrect!!!\n"; } good &= this_good; } // end of the while(true) if (good) { return 0; } else { return PoissonQBAD; } } // testRandPoissonQ() // --------- // RandPoissonT // --------- int testRandPoissonT() { cout << "\n--------------------------------------------\n"; cout << "Test of RandPoissonT distribution \n\n"; long seed; cout << "Please enter an integer seed: "; cin >> seed; cout << seed << "\n"; if (seed == 0) { cout << "Moving on to next test...\n"; return 0; } cout << "\nInstantiating distribution utilizing TripleRand engine...\n"; TripleRand eng (seed); int nNumbers; cout << "How many numbers should we generate for each mu: "; cin >> nNumbers; cout << nNumbers << "\n"; bool good = true; while (true) { double mu; cout << "Enter a value for mu: "; cin >> mu; cout << mu << "\n"; if (mu == 0) break; RandPoissonT dist (eng, mu); cout << "\n Sample fire(): \n"; double x; x = dist.fire(); cout << x; cout << "\n Testing operator() ... \n"; bool this_good = poissonTest ( dist, mu, nNumbers ); if (!this_good) { cout << "\n Poisson distribution for mu = " << mu << " is incorrect!!!\n"; } good &= this_good; } // end of the while(true) if (good) { return 0; } else { return PoissonTBAD; } } // testRandPoissonT() // ----------- // RandGeneral // ----------- int testRandGeneral() { cout << "\n--------------------------------------------\n"; cout << "Test of RandGeneral distribution (using a Gaussian shape)\n\n"; bool good; long seed; cout << "Please enter an integer seed: "; cin >> seed; cout << seed << "\n"; if (seed == 0) { cout << "Moving on to next test...\n"; return 0; } int nNumbers; cout << "How many numbers should we generate: "; cin >> nNumbers; cout << nNumbers << "\n"; double mu; double sigma; mu = .5; // Since randGeneral always ranges from 0 to 1 sigma = .06; cout << "Enter sigma: "; cin >> sigma; cout << sigma << "\n"; // We suggest sigma be .06. This leaves room for 8 sigma // in the distribution. If it is much smaller, the number // of bins necessary to expect a good match will increase. // If sigma is much larger, the cutoff before 5 sigma can // cause the Gaussian hypothesis to be rejected. At .14, for // example, the 4th moment is 7 sigma away from expectation. int nBins; cout << "Enter nBins for stepwise pdf test: "; cin >> nBins; cout << nBins << "\n"; // We suggest at least 10000 bins; fewer would risk // false rejection because the step-function curve // does not match an actual Gaussian. At 10000 bins, // a million-hit test does not have the resolving power // to tell the boxy pdf from the true Gaussian. At 5000 // bins, it does. double xBins = nBins; double* aProbFunc = new double [nBins]; double x; for ( int iBin = 0; iBin < nBins; iBin++ ) { x = iBin / (xBins-1); aProbFunc [iBin] = std::exp ( - (x-mu)*(x-mu) / (2*sigma*sigma) ); } // Note that this pdf is not normalized; RandGeneral does that cout << "\nInstantiating distribution utilizing Ranlux64 engine...\n"; Ranlux64Engine eng (seed, 3); { // Open block for testing type 1 - step function pdf RandGeneral dist (eng, aProbFunc, nBins, 1); delete[] aProbFunc; double* garbage = new double[nBins]; // We wish to verify that deleting the pdf // after instantiating the engine is fine. for ( int gBin = 0; gBin < nBins; gBin++ ) { garbage [gBin] = 1; } cout << "\n Sample fire(): \n"; x = dist.fire(); cout << x; cout << "\n Testing operator() ... \n"; good = gaussianTest ( dist, mu, sigma, nNumbers ); delete[] garbage; } // Close block for testing type 1 - step function pdf // dist goes out of scope but eng is supposed to stick around; // by closing this block we shall verify that! cout << "Enter nBins for linearized pdf test: "; cin >> nBins; cout << nBins << "\n"; // We suggest at least 1000 bins; fewer would risk // false rejection because the non-smooth curve // does not match an actual Gaussian. At 1000 bins, // a million-hit test does not resolve the non-smoothness; // at 300 bins it does. xBins = nBins; aProbFunc = new double [nBins]; for ( int jBin = 0; jBin < nBins; jBin++ ) { x = jBin / (xBins-1); aProbFunc [jBin] = std::exp ( - (x-mu)*(x-mu) / (2*sigma*sigma) ); } // Note that this pdf is not normalized; RandGeneral does that RandGeneral dist (eng, aProbFunc, nBins, 0); cout << "\n Sample operator(): \n"; x = dist(); cout << x; cout << "\n Testing operator() ... \n"; bool good2 = gaussianTest ( dist, mu, sigma, nNumbers ); good = good && good2; if (good) { return 0; } else { return GeneralBAD; } } // testRandGeneral() // ********************** // // SECTION IV - Main // // ********************** int main() { int mask = 0; mask |= testRandGauss(); mask |= testRandGaussQ(); mask |= testRandGaussT(); mask |= testRandGeneral(); mask |= testRandPoisson(); mask |= testRandPoissonQ(); mask |= testRandPoissonT(); mask |= testSkewNormal(); // k = 0 (gaussian) mask |= testSkewNormal(); // k = -2 mask |= testSkewNormal(); // k = 1 mask |= testSkewNormal(); // k = 5 return mask > 0 ? -mask : mask; } clhep-2.1.4.1.orig/Random/test/gaussSmall.sh.in0000755000175000017500000000015407707305616017666 0ustar olesoles#! /bin/sh # @configure_input@ # gaussSmall has no comparison file ./gaussSmall@EXEEXT@ > gaussSmall.out clhep-2.1.4.1.orig/Random/test/testRanecuSequence.cc0000644000175000017500000001151311761721356020723 0ustar olesoles// ---------------------------------------------------------------------- // // testRanecuSequence // look at report that certain seeds produce identical sequences // // ---------------------------------------------------------------------- #include #include #include #include "CLHEP/Units/GlobalPhysicalConstants.h" // used to provoke shadowing warnings #include "CLHEP/Random/RanecuEngine.h" #include "CLHEP/Random/Random.h" struct Sample { int seed; std::vector case1; std::vector case2; std::vector case3; std::vector case4; std::vector case5; }; void useSeed( int, std::vector& ); bool compareSamples( Sample&, Sample&, std::ofstream& ); int main() { std::ofstream output("testRanecuSequence.output"); output << " Setting CLHEP Random Engine..." << std::endl; CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine); std::vector ranList; // the first 4 seeds once resulted in identical sequences useSeed(1275177715, ranList); useSeed(1275171265, ranList); useSeed(1275168040, ranList); useSeed(1275168040-2048*215, ranList); useSeed(4132429, ranList); useSeed(-1357924, ranList); int sd = 53208134; for ( int i = 0; i < 1000; ++i ) { ++sd; useSeed(sd, ranList); } int numbad = 0; output << std::endl; for ( unsigned int it=0; it < ranList.size(); ++it ) { for ( unsigned int jt=it+1; jt < ranList.size(); ++jt ) { if( ! compareSamples(ranList[it], ranList[jt], output ) ) { ++numbad; output << "ERROR: Seed " << ranList[it].seed << " and Seed " << ranList[jt].seed << " are " << (ranList[jt].seed - ranList[it].seed ) << " apart and result in identical sequences" << std::endl; std::cerr << "Seed " << ranList[it].seed << " and Seed " << ranList[jt].seed << " are " << (ranList[jt].seed - ranList[it].seed ) << " apart and result in identical sequences" << std::endl; } } } output << " numbad is " << numbad << std::endl; return numbad; } void useSeed( int seed, std::vector& ranList ) { Sample v; v.seed = seed; // case 1 -- default constructor CLHEP::RanecuEngine c1; for( int i = 0; i < 15; ++i ) { v.case1.push_back( c1.flat() ); } // case 2 CLHEP::RanecuEngine c2(seed); for( int i = 0; i < 15; ++i ) { v.case2.push_back( c2.flat() ); } // case 3 - use HepRandom CLHEP::HepRandom::setTheSeed(seed); for( int i = 0; i < 15; ++i ) { v.case3.push_back( CLHEP::HepRandom::getTheEngine()->flat() ); } // case 4 CLHEP::RanecuEngine c4(1); c4.setSeed(seed); for( int i = 0; i < 15; ++i ) { v.case4.push_back( c4.flat() ); } // case 5 CLHEP::RanecuEngine c5(1); long seedarray[2]; seedarray[0] = seed; seedarray[1] = 1; c5.setSeeds(seedarray,2); for( int i = 0; i < 15; ++i ) { v.case5.push_back( c5.flat() ); } // ranList.push_back(v); } bool compareSamples( Sample& s1, Sample& s2, std::ofstream& output ) { if ( s1.case1 == s2.case1 ) { output << " case1: default constructor \n" ; output << " comparing Seed " << s1.seed << " and Seed " << s2.seed << std::endl; output << " case1 sequence:" ; for( unsigned int i=0; i < s1.case1.size(); ++i ) output << " " << s1.case1[i]; output << std::endl; return false; } if ( s1.case2 == s2.case2 ) { output << " case2: construct with single seed \n" ; output << " comparing Seed " << s1.seed << " and Seed " << s2.seed << std::endl; output << " case2 sequence:" ; for( unsigned int i=0; i < s1.case2.size(); ++i ) output << " " << s1.case2[i]; output << std::endl; return false; } if ( s1.case3 == s2.case3 ) { output << " case3: construct with single seed \n" ; output << " comparing Seed " << s1.seed << " and Seed " << s2.seed << std::endl; output << " case3 sequence:" ; for( unsigned int i=0; i < s1.case3.size(); ++i ) output << " " << s1.case3[i]; output << std::endl; return false; } if ( s1.case4 == s2.case4 ) { output << " case4: use setSeed \n" ; output << " comparing Seed " << s1.seed << " and Seed " << s2.seed << std::endl; output << " case4 sequence:" ; for( unsigned int i=0; i < s1.case4.size(); ++i ) output << " " << s1.case4[i]; output << std::endl; return false; } if ( s1.case5 == s2.case5 ) { output << " case5: use setSeeds \n" ; output << " comparing Seed " << s1.seed << " and Seed " << s2.seed << std::endl; output << " case5 sequence:" ; for( unsigned int i=0; i < s1.case5.size(); ++i ) output << " " << s1.case5[i]; output << std::endl; return false; } return true; } clhep-2.1.4.1.orig/Random/test/ranRestoreTest.cc0000755000175000017500000014044011571253035020077 0ustar olesoles// -*- C++ -*- // $Id: ranRestoreTest.cc,v 1.6 2011/05/31 20:57:01 garren Exp $ // ---------------------------------------------------------------------- #include "CLHEP/Random/Randomize.h" #include "CLHEP/Random/NonRandomEngine.h" #include "CLHEP/Random/defs.h" #include #include #include #define CLEAN_OUTPUT #ifdef CLEAN_OUTPUT std::ofstream output("ranRestoreTest.cout"); #else std::ostream & output = std::cout; #endif // Normally on for routine validation: #define TEST_ORIGINAL_SAVE #ifdef TURNOFF #endif #define TEST_ENGINE_NAMES #define TEST_INSTANCE_METHODS #define TEST_SHARED_ENGINES #define TEST_STATIC_SAVE #define TEST_SAVE_STATIC_STATES #define TEST_ANONYMOUS_ENGINE_RESTORE #define TEST_ANONYMOUS_RESTORE_STATICS #define TEST_VECTOR_ENGINE_RESTORE // Normally off for routine validation: #ifdef TURNOFF #define TEST_MISSING_FILES #define CREATE_OLD_SAVES #define VERIFY_OLD_SAVES #endif //#define VERBOSER //#define VERBOSER2 using namespace CLHEP; double remembered_r2; double remembered_r1005; double remembered_r1006; double remembered_r1007; // Absolutely Safe Equals Without Registers Screwing Us Up bool equals01(const std::vector &ab) { return ab[1]==ab[0]; } bool equals(double a, double b) { std::vector ab(2); ab[0]=a; ab[1]=b; return (equals01(ab)); } // ------------------- The following should all FAIL ------------ int saveStepX() { double r = RandGauss::shoot(); output << "r(1) = " << r << std::endl; HepRandom::saveEngineStatus(); r = RandGauss::shoot(); output << "r(2) = " << r << std::endl; remembered_r2 = r; r = RandGauss::shoot(); output << "r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandGauss::shoot(); } r = RandGauss::shoot(); remembered_r1005 = r; output << "r1005= " << r << std::endl; r = RandGauss::shoot(); return 0; } int restoreStepX() { HepRandom::restoreEngineStatus(); double r = RandGauss::shoot(); output << "restored r(2) = " << r << std::endl; if ( ! equals(r,remembered_r2) ) { output << "THIS DOES NOT MATCH REMEMBERED VALUE BUT THAT IS EXPECTED\n"; } r = RandGauss::shoot(); output << "restored r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandGauss::shoot(); } r = RandGauss::shoot(); output << "restored r1005= " << r << std::endl; if ( !equals(r,remembered_r1005) ) { output << "THIS DOES NOT MATCH REMEMBERED VALUE BUT THAT IS EXPECTED\n"; } return 0; } int BsaveStepX() { int r = RandFlat::shootBit(); output << "r(1) = " << r << std::endl; HepRandom::saveEngineStatus(); r = RandFlat::shootBit(); output << "r(2) = " << r << std::endl; remembered_r2 = r; r = RandFlat::shootBit(); output << "r(3) = " << r << std::endl; double d; for (int i=0; i < 1001; i++) { d = RandFlat::shoot(); if (d > 1) output << "This line inserted so clever compilers don't warn about not using d\n"; } r = RandFlat::shootBit(); remembered_r1005 = r; output << "r1005= " << r << std::endl; r = RandFlat::shootBit(); return 0; } int BrestoreStepX() { HepRandom::restoreEngineStatus(); int r = RandFlat::shootBit(); output << "restored r(2) = " << r << std::endl; if ( r != remembered_r2 ) { output << "THIS DOES NOT MATCH REMEMBERED VALUE BUT THAT IS EXPECTED\n"; } r = RandFlat::shootBit(); output << "restored r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandFlat::shootBit(); } r = RandFlat::shootBit(); output << "restored r1005= " << r << std::endl; if ( r != remembered_r1005 ) { output << "THIS DOES NOT MATCH REMEMBERED VALUE BUT THAT IS EXPECTED\n"; } return 0; } // ------------------- The following should all WORK ------------ int saveStep() { int stat=0; double r = RandGauss::shoot(); output << "r(1) = " << r << std::endl; RandGauss::saveEngineStatus(); r = RandGauss::shoot(); output << "r(2) = " << r << std::endl; remembered_r2 = r; r = RandGauss::shoot(); output << "r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandGauss::shoot(); } r = RandGauss::shoot(); remembered_r1005 = r; output << "r1005= " << r << std::endl; r = RandGauss::shoot(); return stat; } int restoreStep() { int stat=0; RandGauss::restoreEngineStatus(); double r = RandGauss::shoot(); output << "restored r(2) = " << r << std::endl; if ( !equals(r,remembered_r2) ) { std::cout << "restored r(2) = " << r << std::endl; std::cout << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; stat += 1; } r = RandGauss::shoot(); output << "restored r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandGauss::shoot(); } r = RandGauss::shoot(); output << "restored r1005= " << r << std::endl; if ( !equals(r,remembered_r1005) ) { std::cout << "restored r1005= " << r << std::endl; std::cout << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; stat += 2; } return stat; } int BsaveStep() { int stat=0; int r = RandFlat::shootBit(); output << "r(1) = " << r << std::endl; RandFlat::saveEngineStatus(); r = RandFlat::shootBit(); output << "r(2) = " << r << std::endl; remembered_r2 = r; r = RandFlat::shootBit(); output << "r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandFlat::shootBit(); } r = RandFlat::shootBit(); remembered_r1005 = r; output << "r1005 = " << r << std::endl; r = RandFlat::shootBit(); remembered_r1006 = r; output << "r1006 = " << r << std::endl; r = RandFlat::shootBit(); remembered_r1007 = r; output << "r1007 = " << r << std::endl; r = RandFlat::shootBit(); return stat; } int BrestoreStep() { int stat=0; RandFlat::restoreEngineStatus(); int r = RandFlat::shootBit(); output << "restored r(2) = " << r << std::endl; if ( r != remembered_r2 ) { stat += 4; std::cout << "restored r(2) = " << r << std::endl; std::cout << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; } r = RandFlat::shootBit(); output << "restored r(3) = " << r << std::endl; for (int i=0; i < 1001; i++) { r = RandFlat::shootBit(); } r = RandFlat::shootBit(); output << "restored r1005= " << r << std::endl; if ( r != remembered_r1005 ) { stat += 8; std::cout << "restored r1005= " << r << std::endl; std::cout << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; } r = RandFlat::shootBit(); output << "restored r1006= " << r << std::endl; if ( r != remembered_r1006 ) { stat += 16; std::cout << "restored r1006= " << r << std::endl; std::cout << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; } r = RandFlat::shootBit(); output << "restored r1007= " << r << std::endl; if ( r != remembered_r1007 ) { stat += 32; std::cout << "restored r1007= " << r << std::endl; std::cout << "????? THIS DOES NOT MATCH REMEMBERED VALUE!\n"; } return stat; } // --- The following should work, by failing in an expected way ------- template int fileNotThere() { int stat = 0; HepRandomEngine * old = D::getTheEngine(); E e(123); output << "File-not-found test restoring "< int fileNotThereEngine() { int stat = 0; stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); stat |= fileNotThere (); return stat; } int missingFile() { int stat = 0; stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); stat |= fileNotThereEngine(); return stat; } // -- The following was used to capture old-form engine states (sans name) -- template int saveEngine(const char* filename) { int stat = 0; HepRandomEngine * old = D::getTheEngine(); E e(123); D::setTheEngine(&e); double r=0; for (int i=0; i<3; i++) r += D::shoot(); D::saveEngineStatus(filename); if (r == -99999999.1) stat = 999; // This prevents clever compilers from // deducing that r is never needed D::setTheEngine(old); // If we don't do this, then the static engine shared // by every shoot() method reamins e -- which is about // to go out of scope and be destructed! return stat; } // -- The following checks on static engine restores, from old and new forms -- template int checkSaveEngine(const char* filename) { int stat = 0; HepRandomEngine * old = D::getTheEngine(); // Generate save with current format (default file name is fine) E e(123); D::setTheEngine(&e); double r=0; for (int i=0; i<3; i++) r += D::shoot(); D::saveEngineStatus(); // Figure out what the key variate value should be double keyValue = D::shoot(); // Restore state based on old file, and check for proper value D::restoreEngineStatus(filename); if (!equals(D::shoot(), keyValue)) { std::cout << "???? Value mismatch from file " << filename << "\n"; stat |= 64; } // Restore state based on that save, and check for proper value D::restoreEngineStatus(); if (!equals(D::shoot(),keyValue)) { std::cout << "???? Value mismatch from new-format file \n"; stat |= 128; } D::setTheEngine(old); return stat; } // ----------- Tests for instance methods ----------- template int checkEngineName(const std::string & name) { int stat = 0; output << E::engineName() << "\n"; if (E::engineName() != name) { std::cout << "???? engineName mismatch for " << name << " <--> " << E::engineName() << "\n"; stat |= 256; } E e(123); if (e.name() != name) { std::cout << "???? name mismatch for " << name << " <--> " << e.name() << "\n"; stat |= 256; } return stat; } template int checkEngine() { int stat = 0; E e(1234); D d(e); if (d.engine().name() != e.name()) { std::cout << "???? Improper d.engine() \n"; stat |= 512; } return stat; } template int checkEngineInstanceSave(E & e) { int stat = 0; output << "checkEngineInstanceSave for " << e.name() << "\n"; int pr=output.precision(20); double r=0; for (int i=0; i<100; i++) r += e.flat(); {std::ofstream os ("engine.save"); os << e;} for (int i=0; i<100; i++) r += e.flat(); double keyValue1 = e.flat(); double keyValue2 = e.flat(); #ifdef VERBOSER output << keyValue1 << " " << keyValue2 << "\n"; #endif E e2; {std::ifstream is ("engine.save"); is >> e2;} for (int i=0; i<100; i++) r += e2.flat(); double k1 = e2.flat(); double k2 = e2.flat(); #ifdef VERBOSER output << k1 << " " << k2 << "\n"; #endif if ( !(equals(k1,keyValue1)) || !(equals(k2,keyValue2)) ) { std::cout << "???? checkInstanceSave failed for " << e.name() << "\n"; stat |= 1024; } output.precision(pr); return stat; } template int checkSaveDistribution(D & d, int nth) { dynamic_cast(d.engine()); int stat = 0; output << "checkSaveDistribution with " << d.engine().name() << ", " << d.name() << "\n"; double r=0; r = d(); double keyValue1, keyValue2, keyValue3, keyValue4; for (int i=0; i> e >> d2;} double k1 = d2(); double k2 = d2(); { std::ifstream is ("distribution.save2"); is >> e >> d2;} double k3 = d2(); double k4 = d2(); #ifdef VERBOSER pr = output.precision(20); output << "k1 = " << k1 << " k2 = " << k2 << "\n"; output << "k3 = " << k3 << " k4 = " << k4 << "\n"; output.precision(pr); #endif if ( !equals(k1,keyValue1) || !equals(k2,keyValue2) || !equals(k3,keyValue3) || !equals(k4,keyValue4) ) { std::cout << "???? Incorrect restored value for distribution " << d.name() << "\n"; stat |= 2048; } // if (stat) exit(-1); return stat; } template int checkRandGeneralDistribution(RandGeneral & d, int nth) { dynamic_cast(d.engine()); int stat = 0; output << "checkSaveDistribution with " << d.engine().name() << ", " << d.name() << "\n"; double r=0; r = d(); double keyValue1, keyValue2, keyValue3, keyValue4; for (int i=0; i> e >> d2;} double k1 = d2(); double k2 = d2(); { std::ifstream is ("distribution.save2"); is >> e >> d2;} double k3 = d2(); double k4 = d2(); #ifdef VERBOSER pr = output.precision(20); output << "k1 = " << k1 << " k2 = " << k2 << "\n"; output << "k3 = " << k3 << " k4 = " << k4 << "\n"; output.precision(pr); #endif if ( !equals(k1,keyValue1) || !equals(k2,keyValue2) || !equals(k3,keyValue3) || !equals(k4,keyValue4) ) { std::cout << "???? Incorrect restored value for distribution " << d.name() << "\n"; stat |= 2048; } // if (stat) exit(-1); return stat; } template int checkDistributions() { int stat = 0; {RandGauss d(new E(12561),100.0,3.0); stat |= checkSaveDistribution (d,33); } {RandGauss d(new E(12572),100.0,3.0); stat |= checkSaveDistribution (d,34); } {RandGaussQ d(new E(12563),10.0,4.0); stat |= checkSaveDistribution (d,33); } {RandGaussT d(new E(12564),5.0,2.0); stat |= checkSaveDistribution (d,33); } {RandBinomial d(new E(12565),4,0.6); stat |= checkSaveDistribution (d,33); } {RandFlat d(new E(12576),12.5,35.0); stat |= checkSaveDistribution (d,33); } {RandBit d(new E(12567)); stat |= checkSaveDistribution (d,31); } {RandBit d(new E(12578)); stat |= checkSaveDistribution (d,32); } {RandBit d(new E(12589)); stat |= checkSaveDistribution (d,33); } {RandBreitWigner d(new E(125611),50.0,15.0); stat |= checkSaveDistribution (d,33); } {RandChiSquare d(new E(125612),5.0); stat |= checkSaveDistribution (d,33); } {RandExponential d(new E(125713),8.00); stat |= checkSaveDistribution (d,33); } {RandGamma d(new E(125713),6.0,2.0); stat |= checkSaveDistribution (d,33); } {RandLandau d(new E(125714)); stat |= checkSaveDistribution (d,33); } {RandSkewNormal d(new E(125713),8.00); stat |= checkSaveDistribution (d,33); } {RandStudentT d(new E(125715),5); stat |= checkSaveDistribution (d,33); } // Multiple tests of Poisson distributions for small desired, since // the answer in each test is a small int, and coincidental agreement // is very possible. {RandPoisson d(new E(125616),2.5); stat |= checkSaveDistribution (d,33); } {RandPoisson d(new E(125617),105.0); stat |= checkSaveDistribution (d,34); } {RandPoisson d(new E(125618),2.5); stat |= checkSaveDistribution (d,35); } {RandPoisson d(new E(325618),2.5); stat |= checkSaveDistribution (d,36); } {RandPoisson d(new E(425618),2.5); stat |= checkSaveDistribution (d,37); } {RandPoisson d(new E(525618),2.5); stat |= checkSaveDistribution (d,38); } {RandPoisson d(new E(125619),110.0); stat |= checkSaveDistribution (d,39); } {RandPoissonQ d(new E(124616),2.5); stat |= checkSaveDistribution (d,33); } {RandPoissonQ d(new E(126616),2.5); stat |= checkSaveDistribution (d,32); } {RandPoissonQ d(new E(127616),2.5); stat |= checkSaveDistribution (d,31); } {RandPoissonQ d(new E(129616),2.5); stat |= checkSaveDistribution (d,30); } {RandPoissonQ d(new E(125616),110.0); stat |= checkSaveDistribution (d,33); } {RandPoissonQ d(new E(125616),2.5); stat |= checkSaveDistribution (d,34); } {RandPoissonQ d(new E(125616),110.0); stat |= checkSaveDistribution (d,34); } {RandPoissonT d(new E(125616),2.5); stat |= checkSaveDistribution (d,33); } {RandPoissonT d(new E(125616),110.0); stat |= checkSaveDistribution (d,33); } {RandPoissonT d(new E(125616),2.5); stat |= checkSaveDistribution (d,34); } {RandPoissonT d(new E(125616),110.0); stat |= checkSaveDistribution (d,34); } {RandPoissonT d(new E(125916),2.5); stat |= checkSaveDistribution (d,10); } {RandPoissonT d(new E(125816),2.5); stat |= checkSaveDistribution (d,11); } {RandPoissonT d(new E(125716),2.5); stat |= checkSaveDistribution (d,12); } {std::vector pdf; int nbins = 20; for (int i = 0; i < nbins; ++i) pdf.push_back( 5*i + (10.5-i) * (10.5-i) ); RandGeneral d(new E(125917), &pdf[0], 20); stat |= checkRandGeneralDistribution (d,33); } return stat; } template int checkSharingDistributions(D1 & d1, D2 & d2, int n1, int n2) { int stat = 0; output << "checkSharingDistribution with: \n" << d1.name() << " using " << d1.engine().name() << " and\n" << d2.name() << " using " << d2.engine().name() << "\n"; double r=0; r = d1(); r += d2(); double kv11,kv12,kv13,kv14; double kv21,kv22,kv23,kv24; for (int i=0; i> e >> d1r >> d2r;} double k11 = d1r(); double k21 = d2r(); double k12 = d1r(); double k22 = d2r(); { std::ifstream is ("shared.save2"); is >> e >> d1r >> d2r;} double k13 = d1r(); double k23 = d2r(); double k14 = d1r(); double k24 = d2r(); #ifdef VERBOSER2 pr = output.precision(20); output << "k11 = " << k11 << " k21 = " << k21 << "\n"; output << "k12 = " << k12 << " k22 = " << k22 << "\n"; output << "k13 = " << k13 << " k23 = " << k23 << "\n"; output << "k14 = " << k14 << " k24 = " << k24 << "\n"; output.precision(pr); #endif if ( !equals(k11,kv11) || !equals(k21,kv21) || !equals(k12,kv12) || !equals(k22,kv22) || !equals(k13,kv13) || !equals(k23,kv23) || !equals(k14,kv14) || !equals(k24,kv24) ) { std::cout << "???? Incorrect restored value for distributions " << d1.name() << " " << d2.name() << "\n"; stat |= 4096; } // if (stat) exit(-1); return stat; } template int checkSharing() { int stat = 0; E e1(98746); RandGauss g1(e1,50.0,4.0); RandPoissonQ p1(e1, 112.0); RandGauss g2(e1,5.0,44.0); RandPoissonQ p2(e1, 212.0); stat |= checkSharingDistributions(g1,p1,5,4); stat |= checkSharingDistributions(g1,p2,6,6); stat |= checkSharingDistributions(g2,p1,8,9); stat |= checkSharingDistributions(g1,p1,7,5); stat |= checkSharingDistributions(p1,g2,5,4); stat |= checkSharingDistributions(p2,g1,6,6); stat |= checkSharingDistributions(p1,g1,8,9); stat |= checkSharingDistributions(p2,g1,7,5); return stat; } std::vector aSequence(int n) { std::vector v; DualRand e(13542); RandFlat f(e); for (int i=0; i int staticSave(int n) { int stat = 0; int i; output << "staticSave for distribution " << D::distributionName() << "\n"; double r = 0; double v1, v2, k1, k2; for (i=0; i < n; i++) r += D::shoot(); { std::ofstream file ("distribution.save1"); D::saveFullState(file); v1 = D::shoot(); D::saveFullState(file); v2 = D::shoot(); #ifdef VERBOSER2 int pr = output.precision(20); output << "v1 = " << v1 << " v2 = " << v2 << "\n"; output.precision(pr); #endif } for (i=0; i < n; i++) r += D::shoot(); { std::ifstream file ("distribution.save1"); D::restoreFullState(file); k1 = D::shoot(); for (i=0; i < n; i++) r += D::shoot(); D::restoreFullState(file); k2 = D::shoot(); #ifdef VERBOSER2 int pr = output.precision(20); output << "k1 = " << k1 << " k2 = " << k2 << "\n"; output.precision(pr); #endif } if ( (k1 != v1) || (k2 != v2) ) { std::cout << "???? restoreFullState failed for " << D::distributionName() << "\n"; stat |= 8192; } for (i=0; i < n; i++) r += D::shoot(); { std::ofstream file ("distribution.save2"); D::saveDistState(file) << *D::getTheEngine(); v1 = D::shoot(); D::saveDistState(file) << *D::getTheEngine(); v2 = D::shoot(); #ifdef VERBOSER2 int pr = output.precision(20); output << "v1 = " << v1 << " v2 = " << v2 << "\n"; output.precision(pr); #endif } for (i=0; i < n; i++) r += D::shoot(); { std::ifstream file ("distribution.save2"); D::restoreDistState(file) >> *D::getTheEngine(); k1 = D::shoot(); for (i=0; i < n; i++) r += D::shoot(); D::restoreDistState(file) >> *D::getTheEngine(); k2 = D::shoot(); #ifdef VERBOSER2 int pr = output.precision(20); output << "k1 = " << k1 << " k2 = " << k2 << "\n"; output.precision(pr); #endif } if ( (k1 != v1) || (k2 != v2) ) { std::cout << "???? restoreDistState failed for " << D::distributionName() << "\n"; stat |= 16384; } return stat; } template int staticSaveShootBit(int n) { int stat = 0; int i; output << "staticSaveShootBit for " << D::distributionName() << "\n"; double r = 0; int bit = 0; int v1, v2, k1, k2; for (i=0; i < n; i++) r += D::shoot(); for (i=0; i < n; i++) bit |= D::shootBit(); { std::ofstream file ("distribution.save1"); D::saveFullState(file); v1=0; for (i=0; i<25; i++) { v1 <<=1; v1 += D::shootBit(); } for (i=0; i < n; i++) bit |= D::shootBit(); D::saveFullState(file); v2=0; for (i=0; i<25; i++) { v2 <<=1; v2 += D::shootBit(); } #ifdef VERBOSER2 int pr = output.precision(20); output << std::hex << "v1 = " << v1 << " v2 = " << v2 << std::dec << "\n"; output.precision(pr); #endif } for (i=0; i < n; i++) r += D::shoot(); { std::ifstream file ("distribution.save1"); D::restoreFullState(file); k1=0; for (i=0; i<25; i++) { k1 <<=1; k1 += D::shootBit(); } for (i=0; i < n; i++) r += D::shoot(); D::restoreFullState(file); k2=0; for (i=0; i<25; i++) { k2 <<=1; k2 += D::shootBit(); } #ifdef VERBOSER2 int pr = output.precision(20); output << std::hex << "k1 = " << k1 << " k2 = " << k2 << std::dec << "\n"; output.precision(pr); #endif } if ( (k1 != v1) || (k2 != v2) ) { std::cout << "???? restoreFullState failed for D shootBit()\n"; stat |= 32768; } for (i=0; i < n; i++) r += D::shoot(); for (i=0; i < n; i++) bit |= D::shootBit(); { std::ofstream file ("distribution.save2"); D::saveDistState(file) << *D::getTheEngine(); v1=0; for (i=0; i<25; i++) { v1 <<=1; v1 += D::shootBit(); } for (i=0; i < n; i++) bit |= D::shootBit(); D::saveDistState(file) << *D::getTheEngine(); v2=0; for (i=0; i<25; i++) { v2 <<=1; v2 += D::shootBit(); } #ifdef VERBOSER2 int pr = output.precision(20); output << std::hex << "v1 = " << v1 << " v2 = " << v2 << std::dec << "\n"; output.precision(pr); #endif } for (i=0; i < n; i++) r += D::shoot(); { std::ifstream file ("distribution.save2"); D::restoreDistState(file) >> *D::getTheEngine(); k1=0; for (i=0; i<25; i++) { k1 <<=1; k1 += D::shootBit(); } for (i=0; i < n; i++) r += D::shoot(); for (i=0; i < n; i++) r += D::shootBit(); D::restoreDistState(file) >> *D::getTheEngine(); k2=0; for (i=0; i<25; i++) { k2 <<=1; k2 += D::shootBit(); } #ifdef VERBOSER2 int pr = output.precision(20); output << std::hex << "k1 = " << k1 << " k2 = " << k2 << std::dec << "\n"; output.precision(pr); #endif } if ( (k1 != v1) || (k2 != v2) ) { std::cout << "???? restoreDistState failed for RnadFlat::shootBit()\n"; stat |= 65536; } return stat; } // ----------- Tests saving all statics together ----------- void randomizeStatics(int n) { for (int i=0; i captureStatics() { std::vector c; c.push_back( RandGauss::shoot() ); c.push_back( RandGaussQ::shoot() ); c.push_back( RandGaussT::shoot() ); c.push_back( RandFlat::shoot() ); c.push_back( RandBit::shoot() ); for (int i=0; i<20; i++) { c.push_back( RandFlat::shootBit() ); c.push_back( RandBit::shootBit() ); } c.push_back( RandPoisson::shoot() ); c.push_back( RandPoissonQ::shoot() ); c.push_back( RandPoissonT::shoot() ); c.push_back( RandBinomial::shoot() ); c.push_back( RandBreitWigner::shoot() ); c.push_back( RandChiSquare::shoot() ); c.push_back( RandExponential::shoot() ); c.push_back( RandGamma::shoot() ); c.push_back( RandLandau::shoot() ); c.push_back( RandSkewNormal::shoot() ); c.push_back( RandStudentT::shoot() ); return c; } void saveStatics(std::string filename) { std::ofstream os(filename.c_str()); RandGeneral::saveStaticRandomStates(os); // It should be possible to call this from HepRandom, or any distribution. // RandGeneral, which is meaningless as a static distribution, should be the // toughest test, so we use that here. } void restoreStatics(std::string filename) { std::ifstream is(filename.c_str()); RandLandau::restoreStaticRandomStates(is); } // ----------- Anonymous restore of engines ----------- template void anonymousRestore1(int n, std::vector & v) { output << "Anonymous restore for " << E::engineName() << "\n"; E e(12349876); double r=0; for (int i=0; i void anonymousRestore1 (int n, std::vector & v) { #ifdef VERBOSER output << "Anonymous restore for " << NonRandomEngine::engineName() << "\n"; #endif std::vector nonRand = aSequence(500); NonRandomEngine e; e.setRandomSequence(&nonRand[0], nonRand.size()); double r=0; for (int i=0; i int anonymousRestore2(const std::vector & v) { int stat = 0; std::vector k; std::ifstream is("anonymous.save"); HepRandomEngine * a; a = HepRandomEngine::newEngine(is); for (int j=0; j<25; j++) k.push_back(a->flat()); delete a; #ifdef VERBOSER2 output << "First four of k are: " << k[0] << ", " << k[1] << ", " << k[2] << ", " << k[3] << "\n"; #endif for (int m=0; m<25; m++) { if ( v[m] != k[m] ) { std::cout << "???? Incorrect restored value for anonymous engine" << E::engineName() << "\n"; stat |= 262144; return stat; } } return stat; } template int anonymousRestore(int n) { std::vector v; anonymousRestore1(n,v); return anonymousRestore2(v); } // ----------- Anonymous restore of all static distributions ----------- template int anonymousRestoreStatics1() { int stat = 0; HepRandomEngine *e = new E(12456); HepRandom::setTheEngine(e); randomizeStatics(15); output << "\nRandomized, with theEngine = " << e->name() << "\n"; saveStatics("distribution.save"); output << "Saved all static distributions\n"; std::vector c = captureStatics(); output << "Captured output of all static distributions\n"; randomizeStatics(11); output << "Randomized all static distributions\n"; restoreStatics("distribution.save"); output << "Restored all static distributions to saved state\n"; std::vector d = captureStatics(); output << "Captured output of all static distributions\n"; for (unsigned int iv=0; iv int anonymousRestoreStatics() { int stat = 0; if ( E1::engineName() == E2::engineName() ) { return anonymousRestoreStatics1(); } HepRandomEngine *e1 = new E1(12456); HepRandom::setTheEngine(e1); randomizeStatics(15); output << "\nRandomized, with theEngine = " << e1->name() << "\n"; saveStatics("distribution.save"); #ifdef VERBOSER2 output << "Saved all static distributions\n"; #endif std::vector c = captureStatics(); #ifdef VERBOSER2 output << "Captured output of all static distributions\n"; #endif delete e1; HepRandomEngine *e2 = new E2(24653); HepRandom::setTheEngine(e2); output << "Switched to theEngine = " << e2->name() << "\n"; randomizeStatics(19); { std::ofstream os("engine.save"); os << *e2; } double v1 = e2->flat(); double v2 = e2->flat(); { std::ifstream is("engine.save"); is >> *e2; } #ifdef VERBOSER2 output << "Saved the " << e2->name() << " engine: \n" << "Next randoms to be " << v1 << " " << v2 << "\n" << "Restored the " << e2->name() << " engine to that state\n"; #endif restoreStatics("distribution.save"); #ifdef VERBOSER2 output << "Restored all static distributions to saved state\n" << "This changes the engine type back to " << E1::engineName() << "\n"; #endif std::vector d = captureStatics(); #ifdef VERBOSER2 output << "Captured output of all static distributions\n"; #endif for (unsigned int iv=0; ivflat(); double k2 = e2->flat(); #ifdef VERBOSER2 output << "The " << e2->name() << " engine should not have been affected: \n" << "Next randoms are " << k1 << " " << k2 << "\n"; #endif if ( !equals(v1,k1) || !equals(v2,k2) ) { std::cout << "???? Engine used as theEngine was affected by restoring \n" << " static distributions to use engine of a different type.\n"; stat |= 1048576; } return stat; } // ----------- Vector restore of engines ----------- template std::vector vectorRestore1(int n, std::vector & v) { output << "Vector restore for " << E::engineName() << "\n"; E e(97538466); double r=0; for (int i=0; i state = e.put(); for (int j=0; j<25; j++) v.push_back(e.flat()); #ifdef VERBOSER2 output << "First four of v are: " << v[0] << ", " << v[1] << ", " << v[2] << ", " << v[3] << "\n"; #endif return state; } template <> std::vector vectorRestore1 (int n, std::vector & v) { #ifdef VERBOSER2 output << "Vector restore for " << NonRandomEngine::engineName() << "\n"; #endif std::vector nonRand = aSequence(500); NonRandomEngine e; e.setRandomSequence(&nonRand[0], nonRand.size()); double r=0; for (int i=0; i state = e.put(); for (int j=0; j<25; j++) v.push_back(e.flat()); #ifdef VERBOSER2 output << "First four of v are: " << v[0] << ", " << v[1] << ", " << v[2] << ", " << v[3] << "\n"; #endif return state; } template int vectorRestore2(const std::vector state, const std::vector & v) { int stat = 0; std::vector k; HepRandomEngine * a; a = HepRandomEngine::newEngine(state); if (!a) { std::cout << "???? could not restore engine state from vector for " << E::engineName() << "\n"; stat |= 1048576; return stat; } if (a->name() != E::engineName()) { std::cout << "???? restored engine state from vector for " << E::engineName() << "to different type of engine: " << a->name() << "\n" << "There is probably a clash in CRC hashes for these two names!\n"; stat |= 1048576; return stat; } for (int j=0; j<25; j++) k.push_back(a->flat()); delete a; #ifdef VERBOSER2 output << "First four of k are: " << k[0] << ", " << k[1] << ", " << k[2] << ", " << k[3] << "\n"; #endif for (int m=0; m<25; m++) { if ( v[m] != k[m] ) { std::cout << "???? Incorrect vector restored value for anonymous engine: " << E::engineName() << "\n"; stat |= 1048576; return stat; } } return stat; } template int vectorRestore(int n) { std::vector v; std::vector state = vectorRestore1(n,v); return vectorRestore2(state, v); } // --------------------------------------------- // --------------------------------------------- // --------------------------------------------- int main() { int stat = 0; #ifdef TEST_ORIGINAL_SAVE output << "=====================================\n"; output << " Part I \n"; output << "Original tests of static save/restore\n"; output << "=====================================\n\n"; output << "Using old method or HepRandom::saveEngineStatus:\n"; output << "All these tests should have a chance of failure.\n"; output << RandGauss:: getTheEngine()->name(); output << RandGaussQ::getTheEngine()->name(); stat |= saveStepX(); stat |= restoreStepX(); stat |= BsaveStepX(); stat |= BrestoreStepX(); output << "Using the class-specific RandGauss::saveEngineStatus:\n"; output << "All these tests should work properly.\n"; stat |= saveStep(); stat |= restoreStep(); stat |= BsaveStep(); stat |= BrestoreStep(); #endif #ifdef TEST_MISSING_FILES output << "\n=======================================\n"; output << " Part Ia \n"; output << "Test of behavior when a file is missing \n"; output << "=======================================\n\n"; output << "Testing restoreEngineStatus with missing file:\n"; output << "Expect a number of messages!\n"; stat |= missingFile(); #endif #ifdef CREATE_OLD_SAVES stat |= saveEngine("DRand48Engine.oldsav"); stat |= saveEngine("DualRand.oldsav"); stat |= saveEngine("Hurd160Engine.oldsav"); stat |= saveEngine("Hurd288Engine.oldsav"); stat |= saveEngine("HepJamesRandom.oldsav"); stat |= saveEngine("MTwistEngine.oldsav"); stat |= saveEngine("RanecuEngine.oldsav"); stat |= saveEngine("Ranlux64Engine.oldsav"); stat |= saveEngine("RanluxEngine.oldsav"); stat |= saveEngine("RanshiEngine.oldsav"); stat |= saveEngine("TripleRand.oldsav"); #endif #ifdef VERIFY_OLD_SAVES output << "\n==============================================\n"; output << " Part Ib \n"; output << " Verification that changes wont invalidate \n"; output << "invalidate engine saves from previous versions \n"; output << "==============================================\n\n"; stat |= checkSaveEngine("DRand48Engine.oldsav"); stat |= checkSaveEngine("DualRand.oldsav"); stat |= checkSaveEngine("Hurd160Engine.oldsav"); stat |= checkSaveEngine("Hurd288Engine.oldsav"); stat |= checkSaveEngine("HepJamesRandom.oldsav"); stat |= checkSaveEngine("MTwistEngine.oldsav"); stat |= checkSaveEngine("Ranlux64Engine.oldsav"); stat |= checkSaveEngine("RanluxEngine.oldsav"); stat |= checkSaveEngine("RanshiEngine.oldsav"); stat |= checkSaveEngine("TripleRand.oldsav"); stat |= checkSaveEngine("RanecuEngine.oldsav"); #endif #ifdef TEST_ENGINE_NAMES output << "\n=============================================\n"; output << " Part II \n"; output << "Check all engine names were entered correctly \n"; output << "=============================================\n\n"; stat |= checkEngineName("DRand48Engine"); stat |= checkEngineName("DualRand"); stat |= checkEngineName("Hurd160Engine"); stat |= checkEngineName("Hurd288Engine"); stat |= checkEngineName("HepJamesRandom"); stat |= checkEngineName("MTwistEngine"); stat |= checkEngineName("RandEngine"); stat |= checkEngineName("RanecuEngine"); stat |= checkEngineName("Ranlux64Engine"); stat |= checkEngineName("RanluxEngine"); stat |= checkEngineName("RanshiEngine"); stat |= checkEngineName("TripleRand"); #endif #ifdef TEST_INSTANCE_METHODS output << "===========================================\n\n"; output << " Part III\n"; output << "Check instance methods for specific engines \n"; output << " specific engines and distributions\n"; output << "===========================================\n\n"; {DualRand e(234); stat |= checkEngineInstanceSave(e);} {Hurd160Engine e(234); stat |= checkEngineInstanceSave(e);} {Hurd288Engine e(234); stat |= checkEngineInstanceSave(e);} {HepJamesRandom e(234); stat |= checkEngineInstanceSave(e);} {MTwistEngine e(234); stat |= checkEngineInstanceSave(e);} {RandEngine e(234); stat |= checkEngineInstanceSave(e);} {RanecuEngine e(234); stat |= checkEngineInstanceSave(e);} {Ranlux64Engine e(234); stat |= checkEngineInstanceSave(e);} {RanluxEngine e(234); stat |= checkEngineInstanceSave(e);} {RanshiEngine e(234); stat |= checkEngineInstanceSave(e);} {TripleRand e(234); stat |= checkEngineInstanceSave(e);} {std::vector nonRand = aSequence(500); NonRandomEngine e; e.setRandomSequence(&nonRand[0], nonRand.size()); stat |= checkEngineInstanceSave(e);} stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); stat |= checkDistributions(); RandGaussQ::shoot(); // Just to verify that the static engine is OK #endif #ifdef TEST_SHARED_ENGINES output << "\n=============================================\n"; output << " Part IV \n"; output << "Check behavior when engines are shared \n"; output << "=============================================\n\n"; stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); #endif #ifdef TEST_STATIC_SAVE output << "\n=========================================\n"; output << " Part V \n"; output << "Static Save/restore to/from streams \n"; output << "=========================================\n\n"; stat |= staticSave (7); stat |= staticSave (7); stat |= staticSaveShootBit (19); stat |= staticSaveShootBit (23); for (int ibinom=0; ibinom<15; ibinom++) { stat |= staticSave (7+3*ibinom); } stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); #endif #ifdef TEST_SAVE_STATIC_STATES output << "\n==============================================\n"; output << " Part VI \n"; output << "Save/restore all static states to/from streams \n"; output << "==============================================\n\n"; randomizeStatics(15); saveStatics("distribution.save"); output << "Saved all static distributions\n"; std::vector c = captureStatics(); output << "Captured output of all static distributions\n"; randomizeStatics(11); output << "Randomized all static distributions\n"; restoreStatics("distribution.save"); output << "Restored all static distributions to saved state\n"; std::vector d = captureStatics(); output << "Captured output of all static distributions\n"; for (unsigned int iv=0; iv(13); stat |= anonymousRestore(14); stat |= anonymousRestore(15); stat |= anonymousRestore(16); stat |= anonymousRestore(17); stat |= anonymousRestore(18); stat |= anonymousRestore(29); stat |= anonymousRestore(39); stat |= anonymousRestore(19); stat |= anonymousRestore(20); stat |= anonymousRestore(21); stat |= anonymousRestore(22); stat |= anonymousRestore(22); #endif #ifdef TEST_ANONYMOUS_RESTORE_STATICS output << "\n======================================\n"; output << " Part VIII \n"; output << "Anonymous restore static Distributions \n"; output << "======================================\n\n"; stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); stat |= anonymousRestoreStatics ( ); #endif #ifdef TEST_VECTOR_ENGINE_RESTORE output << "\n=================================\n"; output << " Part IX \n"; output << "Save/restore of engines to vectors\n"; output << "=================================\n\n"; stat |= vectorRestore(113); stat |= vectorRestore(114); stat |= vectorRestore(115); stat |= vectorRestore(116); stat |= vectorRestore(117); stat |= vectorRestore(118); stat |= vectorRestore(139); stat |= vectorRestore(119); stat |= vectorRestore(120); stat |= vectorRestore(121); stat |= vectorRestore(122); stat |= vectorRestore(123); stat |= vectorRestore(129); #endif output << "\n=============================================\n\n"; if (stat != 0) { std::cout << "One or more problems detected: stat = " << stat << "\n"; } else { output << "ranRestoreTest passed with no problems detected.\n"; } return stat; } clhep-2.1.4.1.orig/Random/test/testSaveSharedEngines.cc0000644000175000017500000001235312235754600021351 0ustar olesoles// ---------------------------------------------------------------------- #include "CLHEP/Random/Randomize.h" #include "CLHEP/Random/NonRandomEngine.h" #include "CLHEP/Random/defs.h" #include #include #include #define CLEAN_OUTPUT #ifdef CLEAN_OUTPUT std::ofstream output("testSaveSharedEngines.cout"); #else std::ostream & output = std::cout; #endif // Normally on for routine validation: #ifdef TURNOFF #endif #define TEST_SHARED_ENGINES // Normally off for routine validation: #define VERBOSER #define VERBOSER2 using namespace CLHEP; // Absolutely Safe Equals Without Registers Screwing Us Up bool equals01(const std::vector &ab) { return ab[1]==ab[0]; } bool equals(double a, double b) { std::vector ab(2); ab[0]=a; ab[1]=b; return (equals01(ab)); } template int checkSharingDistributions(D1 & d1, D2 & d2, int n1, int n2) { int stat = 0; output << "checkSharingDistribution with: \n" << d1.name() << " using " << d1.engine().name() << " and\n" << d2.name() << " using " << d2.engine().name() << "\n"; double r=0; r = d1(); r += d2(); double kv11,kv12,kv13,kv14; double kv21,kv22,kv23,kv24; for (int i=0; i> e >> d1r >> d2r;} double k11 = d1r(); double k21 = d2r(); double k12 = d1r(); double k22 = d2r(); { std::ifstream is ("t2_shared.save"); is >> e >> d1r >> d2r;} double k13 = d1r(); double k23 = d2r(); double k14 = d1r(); double k24 = d2r(); #ifdef VERBOSER2 pr = output.precision(20); output << "k11 = " << k11 << " k21 = " << k21 << "\n"; output << "k12 = " << k12 << " k22 = " << k22 << "\n"; output << "k13 = " << k13 << " k23 = " << k23 << "\n"; output << "k14 = " << k14 << " k24 = " << k24 << "\n"; output.precision(pr); #endif if ( !equals(k11,kv11) || !equals(k21,kv21) || !equals(k12,kv12) || !equals(k22,kv22) || !equals(k13,kv13) || !equals(k23,kv23) || !equals(k14,kv14) || !equals(k24,kv24) ) { std::cout << "???? Incorrect restored value for distributions " << d1.name() << " " << d2.name() << "\n"; #ifdef CLEAN_OUTPUT output << "???? Incorrect restored value for distributions " << d1.name() << " " << d2.name() << "\n"; #endif stat |= 4096; } // if (stat) exit(-1); return stat; } template int checkSharing() { int stat = 0; E e1(98746); RandGauss g1(e1,50.0,4.0); RandPoissonQ p1(e1, 112.0); RandGauss g2(e1,5.0,44.0); RandPoissonQ p2(e1, 212.0); stat |= checkSharingDistributions(g1,p1,5,4); stat |= checkSharingDistributions(g1,p2,6,6); stat |= checkSharingDistributions(g2,p1,8,9); stat |= checkSharingDistributions(g1,p1,7,5); stat |= checkSharingDistributions(p1,g2,5,4); stat |= checkSharingDistributions(p2,g1,6,6); stat |= checkSharingDistributions(p1,g1,8,9); stat |= checkSharingDistributions(p2,g1,7,5); return stat; } // --------------------------------------------- // --------------------------------------------- // --------------------------------------------- int main() { int stat = 0; #ifdef TEST_SHARED_ENGINES output << "\n=============================================\n"; output << " Part IV \n"; output << "Check behavior when engines are shared \n"; output << "=============================================\n\n"; stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); stat |= checkSharing(); #endif output << "\n=============================================\n\n"; if (stat != 0) { std::cout << "One or more problems detected: stat = " << stat << "\n"; output << "One or more problems detected: stat = " << stat << "\n"; } else { output << "testSaveSharedEngines passed with no problems detected.\n"; } if (stat == 0) return 0; if (stat > 0) return -(stat|1); return stat|1; return stat > 0 ? -stat : stat; } clhep-2.1.4.1.orig/Random/test/RanshiEngine.oldsav0000644000175000017500000001261110233771102020355 0ustar olesoles123 1721662306 3798517736 3805602467 3500960906 2771586057 192607597 4156184285 2170507441 2588622345 434496485 2154146178 71499174 1785567904 1958393447 2448942142 134313692 544126741 3749257476 2364794424 1096109039 1339193161 967690973 2958739713 2619764046 3189657614 562494042 4126458796 1046465547 959648151 2192316868 3960862787 1235263025 4153658259 1810746593 4030745892 3943686904 1257866442 1355587914 1516248193 2472685858 1571696990 2220667995 1690308966 4101669614 1164610599 3401010208 1152201525 2554673726 698203910 474468936 722558740 2094380101 1528787413 4139767682 3431361804 2982931407 2770546224 1432777683 4075081258 2933947512 970745065 3036655337 2482760318 778667016 1168988157 2229445594 931729687 2766694416 3382271797 697960534 1610755250 73442822 291230890 631750480 1463070614 561981141 2486538609 2455368922 1689249878 2357744431 410186887 2402973748 909199562 633607618 1007486580 1205959860 2146035077 1426929985 4241809826 1915863272 3030365305 3079925129 1194493559 375108368 4147115803 3968489781 2131840646 1938641232 795649179 3653867813 1099935766 2016615325 505585018 3807383021 1271670572 887467295 1904694987 2288406243 1374628802 2502093665 2532089208 2823135038 2047648171 2119233190 4166683913 1989987513 4203418078 1726458959 2941288329 3300929310 1905161035 1671671236 1202623045 2243559523 1959326150 392519059 2246195748 4125714753 3531902558 366142894 3944983417 333847458 1478610037 2114184976 1396616411 1302189244 88248478 1190006415 1900606415 2696333277 1608816806 577025445 1127573949 8887 4010514698 2919577036 2528448022 2764343484 612841275 2304984587 3580542913 3888526570 2123682183 1618561059 2957201979 4220341993 1994447096 1211262613 996113959 3813129859 3933619857 41830562 1177433650 3188298918 4069879253 3036179234 1328563998 897753246 4147815327 4177185655 1128020128 608225759 379313970 1705627612 1180815697 2557819966 3466177662 4278339880 910773208 3620758260 1810696725 318540698 2037362690 2235214351 1363483046 4054987066 732150371 1445017450 3121278581 249322158 3784637825 2132643334 4110058026 1174528920 960237176 356726658 3778834278 1588947734 834381737 1320288001 4111700945 1722968688 3866732606 2431014804 1565897990 4271435388 582997773 624291373 3180463835 3815539244 499791383 2589677494 2194952439 142779553 4069530159 1295519040 2261242135 1838919167 2175101907 3759263020 2229179796 1375066257 1874272001 3359279165 1451035199 2107930208 2736375648 1288287484 1115065998 1652246528 142840250 37368811 841769497 3263740257 588617339 3732432068 2336232059 3032249719 2649252615 695715856 2775505059 1524054000 3493474550 2067835186 2123444450 178796520 2312362444 1345140924 1150596169 407856868 3305184268 1471597057 2789506934 347527146 2080585174 2556781765 2266786351 2576963796 1754405676 2569259865 2632915635 3741918151 3703030516 448394659 3780472239 2092738729 3838277531 3268523780 2727677519 3667277600 338783852 3971787267 911170428 3702834657 23590292 2181516063 1041529556 406205447 1627159610 2024258047 2844714386 1311011008 2107365417 4239632063 2251994255 4264433034 925846129 1112525417 4091013981 2517119860 1046305411 3295124519 1869998919 2145434151 4177758752 2816360142 1383175579 2286536931 651657480 3850187534 3756049299 1127312725 3922870590 536099013 745675973 2045164909 434136793 518296343 1586713536 2064048586 510785497 1324081489 973767492 4205690563 2121496057 4021708998 3472629330 2580613990 4243004125 1461523297 3045987105 2063541611 1036090536 1450628684 1733377074 2222858638 628007356 1103350556 3706415657 4196047244 3866466364 775886863 1033911781 2484144088 2258323676 2109512898 651549319 2293968779 4046696579 3014119068 2805694895 1084291164 1648262818 2492937264 948915500 1607255701 4024613977 2429811726 676285287 3864105308 2716530351 274433990 2776214179 436217159 3769908435 88098608 4026615568 1106972889 1999753250 4180573967 3202107333 2975523009 1394392741 4067371778 4139939331 222815687 2650798430 2474297527 4141535136 2795047655 3783331062 2767843149 2980506040 1822891110 3858162046 2059842292 2255254078 3964522879 1901765553 2244921356 4156402885 1264511711 1074596598 481229145 1751350231 2570232235 2802078593 932708845 2549576152 3307670548 3489637919 4048885307 114182082 3720352126 88004252 624658571 4019005593 986412543 3117690788 1261909229 2244117552 153705047 3962099640 21601192 1466371344 94135703 4145018726 1280219167 709446945 745507328 4022242353 2735801614 951301029 3565964075 4280679518 444360279 1010271650 1549562247 3332403638 1146729096 3075934923 370224171 2112136117 2879533388 748141970 83852287 491636059 3315767298 1247460649 4110312598 3501501936 255060719 2267676698 1361871633 3100515346 994775239 1296300773 2811071507 78075221 2306780085 2536779214 2198667730 2886313968 427586075 1360926135 620071004 25700557 183138631 563575416 3198061349 3026019284 2562969934 1450609780 1032223954 887154543 2773239618 33547715 4174273144 3991662054 2434971048 3869800609 4225697873 3551313386 3041893263 504756740 457258933 476804972 1679527141 1506884898 4282714595 4193263770 609764251 388964003 2606487804 3850619115 4290316822 147813126 778562977 961950827 2497320236 1405557107 729999152 3905366269 2200998600 1180592099 3426819557 244529068 4120016210 60188572 3528180682 1302103668 2203167988 1163604589 474345017 3849863843 4212260568 1215169358 290340033 3745941850 1265046594 164028452 1727241857 2883615753 2855086127 1503036112 3408423594 398788873 4079234764 334448965 4033471209 488710974 393855819 1140618876 10245 256 clhep-2.1.4.1.orig/Random/test/TripleRand.oldsav0000644000175000017500000000044710233771102020053 0ustar olesoles123 Tausworthe-begin 1334704550 2527919799 3754211245 2598484123 3 Tausworthe-end IntegerCong-begin 1873412065 10749133 12341 IntegerCong-end Hurd288Engine-begin 19780503 1 4150882159 3020020132 1759504354 2260572406 2230985991 1577557712 513719549 1853925066 105626908 Hurd288Engine-end clhep-2.1.4.1.orig/Random/test/testStaticStreamSave.cc0000644000175000017500000002531612235754600021240 0ustar olesoles// ---------------------------------------------------------------------- #include "CLHEP/Random/Randomize.h" #include "CLHEP/Random/NonRandomEngine.h" #include "CLHEP/Random/defs.h" #include #include #include #define CLEAN_OUTPUT #ifdef CLEAN_OUTPUT std::ofstream output("testStaticStreamSave.cout"); #else std::ostream & output = std::cout; #endif // Normally on for routine validation: #ifdef TURNOFF #endif #define TEST_STATIC_SAVE #define TEST_SAVE_STATIC_STATES #define VERBOSER #define VERBOSER2 using namespace CLHEP; // Absolutely Safe Equals Without Registers Screwing Us Up bool equals01(const std::vector &ab) { return ab[1]==ab[0]; } bool equals(double a, double b) { std::vector ab(2); ab[0]=a; ab[1]=b; return (equals01(ab)); } // ----------- Tests for static methods ----------- template int staticSave(int n) { int stat = 0; int i; output << "staticSave for distribution " << D::distributionName() << "\n"; double r = 0; double v1, v2, k1, k2; for (i=0; i < n; i++) r += D::shoot(); { std::ofstream file ("ss1_distribution.save"); D::saveFullState(file); v1 = D::shoot(); D::saveFullState(file); v2 = D::shoot(); #ifdef VERBOSER2 int pr = output.precision(20); output << "v1 = " << v1 << " v2 = " << v2 << "\n"; output.precision(pr); #endif } for (i=0; i < n; i++) r += D::shoot(); { std::ifstream file ("ss1_distribution.save"); D::restoreFullState(file); k1 = D::shoot(); for (i=0; i < n; i++) r += D::shoot(); D::restoreFullState(file); k2 = D::shoot(); #ifdef VERBOSER2 int pr = output.precision(20); output << "k1 = " << k1 << " k2 = " << k2 << "\n"; output.precision(pr); #endif } if ( (k1 != v1) || (k2 != v2) ) { std::cout << "???? restoreFullState failed for " << D::distributionName() << "\n"; #ifdef CLEAN_OUTPUT output << "???? restoreFullState failed for " << D::distributionName() << "\n"; #endif stat |= 8192; } for (i=0; i < n; i++) r += D::shoot(); { std::ofstream file ("ss2_distribution.save"); D::saveDistState(file) << *D::getTheEngine(); v1 = D::shoot(); D::saveDistState(file) << *D::getTheEngine(); v2 = D::shoot(); #ifdef VERBOSER2 int pr = output.precision(20); output << "v1 = " << v1 << " v2 = " << v2 << "\n"; output.precision(pr); #endif } for (i=0; i < n; i++) r += D::shoot(); { std::ifstream file ("ss2_distribution.save"); D::restoreDistState(file) >> *D::getTheEngine(); k1 = D::shoot(); for (i=0; i < n; i++) r += D::shoot(); D::restoreDistState(file) >> *D::getTheEngine(); k2 = D::shoot(); #ifdef VERBOSER2 int pr = output.precision(20); output << "k1 = " << k1 << " k2 = " << k2 << "\n"; output.precision(pr); #endif } if ( (k1 != v1) || (k2 != v2) ) { std::cout << "???? restoreDistState failed for " << D::distributionName() << "\n"; #ifdef CLEAN_OUTPUT output << "???? restoreDistState failed for " << D::distributionName() << "\n"; #endif stat |= 16384; } return stat; } template int staticSaveShootBit(int n) { int stat = 0; int i; output << "staticSaveShootBit for " << D::distributionName() << "\n"; double r = 0; int bit = 0; int v1, v2, k1, k2; for (i=0; i < n; i++) r += D::shoot(); for (i=0; i < n; i++) bit |= D::shootBit(); { std::ofstream file ("ss1_distribution.save"); D::saveFullState(file); v1=0; for (i=0; i<25; i++) { v1 <<=1; v1 += D::shootBit(); } for (i=0; i < n; i++) bit |= D::shootBit(); D::saveFullState(file); v2=0; for (i=0; i<25; i++) { v2 <<=1; v2 += D::shootBit(); } #ifdef VERBOSER2 int pr = output.precision(20); output << std::hex << "v1 = " << v1 << " v2 = " << v2 << std::dec << "\n"; output.precision(pr); #endif } for (i=0; i < n; i++) r += D::shoot(); { std::ifstream file ("ss1_distribution.save"); D::restoreFullState(file); k1=0; for (i=0; i<25; i++) { k1 <<=1; k1 += D::shootBit(); } for (i=0; i < n; i++) r += D::shoot(); D::restoreFullState(file); k2=0; for (i=0; i<25; i++) { k2 <<=1; k2 += D::shootBit(); } #ifdef VERBOSER2 int pr = output.precision(20); output << std::hex << "k1 = " << k1 << " k2 = " << k2 << std::dec << "\n"; output.precision(pr); #endif } if ( (k1 != v1) || (k2 != v2) ) { std::cout << "???? restoreFullState failed for D shootBit()\n"; #ifdef CLEAN_OUTPUT output << "???? restoreFullState failed for D shootBit()\n"; #endif stat |= 32768; } for (i=0; i < n; i++) r += D::shoot(); for (i=0; i < n; i++) bit |= D::shootBit(); { std::ofstream file ("ss2_distribution.save"); D::saveDistState(file) << *D::getTheEngine(); v1=0; for (i=0; i<25; i++) { v1 <<=1; v1 += D::shootBit(); } for (i=0; i < n; i++) bit |= D::shootBit(); D::saveDistState(file) << *D::getTheEngine(); v2=0; for (i=0; i<25; i++) { v2 <<=1; v2 += D::shootBit(); } #ifdef VERBOSER2 int pr = output.precision(20); output << std::hex << "v1 = " << v1 << " v2 = " << v2 << std::dec << "\n"; output.precision(pr); #endif } for (i=0; i < n; i++) r += D::shoot(); { std::ifstream file ("ss2_distribution.save"); D::restoreDistState(file) >> *D::getTheEngine(); k1=0; for (i=0; i<25; i++) { k1 <<=1; k1 += D::shootBit(); } for (i=0; i < n; i++) r += D::shoot(); for (i=0; i < n; i++) r += D::shootBit(); D::restoreDistState(file) >> *D::getTheEngine(); k2=0; for (i=0; i<25; i++) { k2 <<=1; k2 += D::shootBit(); } #ifdef VERBOSER2 int pr = output.precision(20); output << std::hex << "k1 = " << k1 << " k2 = " << k2 << std::dec << "\n"; output.precision(pr); #endif } if ( (k1 != v1) || (k2 != v2) ) { std::cout << "???? restoreDistState failed for RnadFlat::shootBit()\n"; #ifdef CLEAN_OUTPUT output << "???? restoreDistState failed for RnadFlat::shootBit()\n"; #endif stat |= 65536; } return stat; } // ----------- Tests saving all statics together ----------- void randomizeStatics(int n) { for (int i=0; i captureStatics() { std::vector c; c.push_back( RandGauss::shoot() ); c.push_back( RandGaussQ::shoot() ); c.push_back( RandGaussT::shoot() ); c.push_back( RandFlat::shoot() ); c.push_back( RandBit::shoot() ); for (int i=0; i<20; i++) { c.push_back( RandFlat::shootBit() ); c.push_back( RandBit::shootBit() ); } c.push_back( RandPoisson::shoot() ); c.push_back( RandPoissonQ::shoot() ); c.push_back( RandPoissonT::shoot() ); c.push_back( RandBinomial::shoot() ); c.push_back( RandBreitWigner::shoot() ); c.push_back( RandChiSquare::shoot() ); c.push_back( RandExponential::shoot() ); c.push_back( RandGamma::shoot() ); c.push_back( RandLandau::shoot() ); c.push_back( RandSkewNormal::shoot() ); c.push_back( RandStudentT::shoot() ); return c; } void saveStatics(std::string filename) { std::ofstream os(filename.c_str()); RandGeneral::saveStaticRandomStates(os); // It should be possible to call this from HepRandom, or any distribution. // RandGeneral, which is meaningless as a static distribution, should be the // toughest test, so we use that here. } void restoreStatics(std::string filename) { std::ifstream is(filename.c_str()); RandLandau::restoreStaticRandomStates(is); } // --------------------------------------------- // --------------------------------------------- // --------------------------------------------- int main() { int stat = 0; #ifdef TEST_STATIC_SAVE output << "\n=========================================\n"; output << " Part V \n"; output << "Static Save/restore to/from streams \n"; output << "=========================================\n\n"; stat |= staticSave (7); stat |= staticSave (7); stat |= staticSaveShootBit (19); stat |= staticSaveShootBit (23); for (int ibinom=0; ibinom<15; ibinom++) { stat |= staticSave (7+3*ibinom); } stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); stat |= staticSave (7); #endif #ifdef TEST_SAVE_STATIC_STATES output << "\n==============================================\n"; output << " Part VI \n"; output << "Save/restore all static states to/from streams \n"; output << "==============================================\n\n"; randomizeStatics(15); saveStatics("ss_distribution.save"); output << "Saved all static distributions\n"; std::vector c = captureStatics(); output << "Captured output of all static distributions\n"; randomizeStatics(11); output << "Randomized all static distributions\n"; restoreStatics("ss_distribution.save"); output << "Restored all static distributions to saved state\n"; std::vector d = captureStatics(); output << "Captured output of all static distributions\n"; for (unsigned int iv=0; iv 0) return -(stat|1); return stat|1; } clhep-2.1.4.1.orig/Random/test/pretend.h0000644000175000017500000000061011671433005016403 0ustar olesoles//////////////////////////////////////////////////////////////////////// // // File: pretend.hh // Purpose: This is to fake out the gcc -pedantic switch // // Author: Walter Brown // //////////////////////////////////////////////////////////////////////// #ifndef PRETEND_HH #define PRETEND_HH template< class T > inline void pretend_to_use( T const & ) {} #endif // #ifndef PRETEND_HH clhep-2.1.4.1.orig/Random/ChangeLog0000755000175000017500000015104612241267303015401 0ustar olesoles============================== 14.11.13 Release CLHEP-2.1.4.1 ============================== 2013-11-14 Lynn Garren * Random/Randomize.h: include RandExpZiggurat and RandGaussZiggurat ============================== 05.11.13 Release CLHEP-2.1.4.0 ============================== 2013-11-04 Lynn Garren * Random/test: make sure all output streams have unique names * Random/RandGaussZiggurat - abs type correctness 2013-10-31 Lynn Garren * Random/src/RandGaussZiggurat.cc - fix potential shadowing issue * Random/src/RandExpZiggurat.cc - fix potential shadowing issue 2013-09-26 Lynn Garren * Random: including RandGaussZiggurat and RandExpZiggurat (code supplied by ATLAS) ============================== 14.11.12 Release CLHEP-2.1.3.1 ============================== ============================== 06.11.12 Release CLHEP-2.1.3.0 ============================== ============================== 16.08.12 Release CLHEP-2.1.2.5 ============================== ============================== 09.07.12 Release CLHEP-2.1.2.4 ============================== ============================== 31.05.12 Release CLHEP-2.1.2.3 ============================== 2012-05-31 Lynn Garren * Random: fix various shadow warnings * src/RandPoisson.cc: bug fix * test: include CLHEP/Units/GlobalSystemOfUnits.h in tests to provoke shadow warnings 2012-05-11 Lynn Garren * Random, src, test: use explicit std:: with math functions * Random/NonRandomEngine.h: use char* instead of char [] for an empty file ============================== 14.02.12 Release CLHEP-2.1.2.2 ============================== ============================== 06.02.12 Release CLHEP-2.1.2.1 ============================== 2012-02-03 Lynn Garren * src/Ranlux64Engine.cc: use a template to get rid of the warnings 2012-02-01 Lynn Garren * change the names of internal variables so -Wshadow does not complain ============================== 16.12.11 Release CLHEP-2.1.2.0 ============================== 2011-12-12 Lynn Garren * test/pretend.h, test/testBug58950.cc: pretend to use variable 2011-12-09 Mark Fischler * test/testInstanceRestore.cc: use assert so clang does not complain 2011-12-08 Lynn Garren * src/TripleRand.cc: use explicit cast to fix problem found by clang++ ============================== 29.07.11 Release CLHEP-2.1.1.0 ============================== 2011-06-09 Mark Fischler and Lynn Garren * adding RandSkewNormal to the tests 2011-05-27 Mark Fischler and Lynn Garren * Random/RandSkewNormal.h, Random/RandSkewNormal.icc, src/RandSkewNormal.cc: An implementation of the Azzalini skew-normal distribution, as requested in bug #75534 ============================== 11.11.10 Release CLHEP-2.1.0.1 ============================== 2010-10-25 Lynn Garren * Random/NonRandomEngine.h, Random/RandomEngine.h, Random/RandomEngine.icc, src/RandomEngine.cc: minor changes to avoid compilation warnings when using the -W flag 2010-10-21 Mark Fischler and Lynn Garren * src/Ranlux64Engine.cc: fix problem with random numbers when seed is greater than 32bits * test/testBug73093.cc: test for the Ranlux64Engine problem ============================== 23.07.10 Release CLHEP-2.1.0.0 ============================== 2010-06-30 Lynn Garren * src/Hurd160Engine.cc, Hurd288Engine.cc: deal with an undefined order of execution warning reported by gcc 4.5 2010-06-23 Mark Fischler and Lynn Garren * Random/RanecuEngine.h: add a private method (see below) * src/RanecuEngine.cc: Modify constructor and setSeed to utilize all info provided and avoid coincidence of same state from different seeds * test/testRanecuSequence.cc: test for repeating sequences ============================== 16.06.10 Release CLHEP-2.1.0.0.b01 ============================== ============================== 11.06.10 Release CLHEP-2.0.5.0.b01 ============================== 2010-04-29 Walter Brown * DRand48Engine: use CLHEP/Utility/noncopyable.h * RandBinomial, RandBreitWigner, RandChiSquare, RandExponential, RandFlat, RandGamma, RandGauss, RandGeneral, RandLandau, RandPoisson, RandStudentT: use shared pointer from CLHEP/Utility/memory.h * Random.h: no longer need deleteEngine * test/testDistCopy: test copy constructors (note that all copy constructors are now compiler generated) 2010-03-04 Walter Brown * DualRand, Hurd160Engine, Hurd288Engine, JamesRandom, MTwistEngine, RandEngine, RanecuEngine, RanluxEngine, Ranlux64Engine, RanshiEngine, TripleRand: Let the compiler generate the copy constructors. Use the new static functions. Also define static const int's as relevant. This produces code which is both more efficient and more compact. * RandomEngine: move static variables here and make them static functions. This streamlines the code. Affected variables are exponent_bit_32, mantissa_bit_12, mantissa_bit_24, mantissa_bit_32, twoToMinus_32, twoToMinus_48, twoToMinus_49, twoToMinus_53, and nearlyTwoToMinus_54. 2010-03-04 Mark Fischler * test/testEngineCopy.cc: test copy constructors and operator = ============================== 09.03.10 Release CLHEP-2.0.4.6 ============================== 2010-03-08 Mark Fischler and Lynn Garren * src/RandEngine.cc: Cast RAND_MAX to unsigned long to avoid gcc 4.4 warnings. * src/RanecuEngine.cc: Fix a bug introduced in 2.0.4.5/1.9.4.5 which resulted in the inability to rollback the random state. * test/testBug58950: test rolling back the random state ============================== 08.12.09 Release CLHEP-2.0.4.5 ============================== 2009-12-07 Lynn Garren * test/testBug58950.cc: test for the 64bit bug 2009-12-01 Mark Fischler and Lynn Garren * src/RanecuEngine.cc: Negative seeds are not allowed. In the past, negative seeds were ignored, resulting in a reproducable sequence. Instead, we now use the absolute value of any negative seeds. 2009-12-01 Mark Fischler and Lynn Garren * Random/RanecuEngine.h, src/RanecuEngine.cc: define maxSeq as a static const int since it contains the size of an array * src/RanecuEngine.cc: ensure that all seeds are in the expected 32bit range. ============================== 12.11.09 Release CLHEP-2.0.4.4 ============================== ============================== 03.11.09 Release CLHEP-2.0.4.4.b01 ============================== ============================== 04.07.09 Release CLHEP-2.0.4.3 ============================== 2009-06-30 Mark Fischler * src/Ranlux64Engine.cc: Fix bug #24689. setSeeds() now uses all seeds passed to it instead of only the first one. ============================== 18.11.08 Release CLHEP-2.0.4.2 ============================== 2008-11-18 Lynn Garren * test/testVectorSave.cc: Add a test for bug #44156 2008-11-13 Mark Fischler * src/engineIDulong.cc: Fix problem that caused check for proper engine type to fail where an unsigned long is 64bits. (bug #44156) * src/*Engine.cc: make sure that existing stored engine states don't break due to the change in engineIDulong.cc ============================== 04.11.08 Release CLHEP-2.0.4.1 ============================== ============================== 07.08.08 Release CLHEP-2.0.4.0 ============================== 2008-07-17 Lynn Garren * add explicit parentheses in various places to keep gcc 4.3 happy * src/RandEngine.cc: change how the compiler decides how to implement flat() * test/testRandDists.cc: force variables to be in memory so testRandGeneral() behaves the same with both gcc 4.3 and 3.4. * Random/src/DRand48Engine.cc,RandEngine.cc: Remove (incorrect) implementation of private, unused, copy constructor and operator=. * Random/src/drand48.src: The implementaton of the drand48_iterate method contained a problematic "if (sizeof (unsigned short int) == 2) { } else {}" structure. Code contained in the else portion had unintended side effects. We have retained only the code in the if portion, which should work on all machines. ============================== 01.05.08 Release CLHEP-2.0.3.3 ============================== ============================== 18.10.07 Release CLHEP-2.0.3.2 ============================== 2007-10-18 Mark Fischler * RandPoissonQ.cc: Change fire(mena) to call shoot(theLocalEngine(),mean) instead of shoot(mean), which had caused "cross-talk" between modules that should not have affected eah other. ============================== 15.11.06 Release CLHEP-2.0.3.1 ============================== 2006-11-15 Mark Fischler * Random/src/MTwistEngine.cc: improve seeding method ============================== 18.10.06 Release CLHEP-2.0.3.0 ============================== ============================== 20.06.06 Release CLHEP-2.0.2.3 ============================== ============================== 21.11.05 Release CLHEP-2.0.2.2 ============================== 2005-11-21 Lynn Garren * src/Makefile.am, test/Makefile.am: Build libraries for Windows Visual C++ without lib prefix. ============================== 22.06.05 Release CLHEP-2.0.2.1 ============================== Wed Jun 22 2005 Andreas Pfeiffer * configure.in: changed soname to install_name for darwin targets, dylibs still don't build properly on 10.3/10.4, static libs ok. 2005-06-19 Lynn Garren * configure.in, Makefile.am: Use lib when building Visual C++ libraries. Disable shared library build for Solaris CC. ============================== 22.04.05 Release CLHEP-2.0.2.0 ============================== 2005-04-14 Mark Fischler * RandFlat.cc RandGauss.cc RandBinomial.cc ... all the distributions Express states of all distributions which ave private double members as sequences of ordinary unsigned ints, to avoid precision issues and avoid issues of non-portability of hex input manipulators. 2005-04-13 Mark Fischler * DRand48Engine.cc DualRand.cc Hurd160Engine.cc Hurd288Engine.cc JamesRandom.cc MTwistEngine.cc RandFlat.cc RandGauss.cc RandomEngine.cc RandomEngine.cc RanecuEngine.cc Ranlux64Engine.cc RanluxEngine.cc TripleRand.cc (and tiny change in corresponding .h files) Express states of all engines as sequences of ordinary unsigned ints, to avoid precision issues and avoid issues of non-portability of hex input manipulators. * testAnonymousEngineRestore.cc testInstanceRestore.cc testSaveEngineStatus.cc testSaveSharedEngines.cc testStaticStreamSave.cc testVectorSave.cc * test/Makefile.am Break up the very lengthy validation of engine saves and restores. Compilation time grows worse than linearly on some systems; this split should make the check target go faster. 2005-04-11 Mark Fischler * JamesRandom.cc ranRestoreTest.cc NonRandomEngine.h Express state of this engine in hex form rather than as doubles, to avoid precision issues. 2005-04-07 Lynn Garren * configure.in: set AR and ARFLAGS Fri Mar 11 2005 Mark Fischler * engineIDulong.cc, engineIDulong.h DOubConv.cc, DoubConv.h EngineFactory.cc * DRand48Engine.cc DualRand.cc Hurd160Engine.cc Hurd288Engine.cc JamesRandom.cc MTwistEngine.cc RandFlat.cc RandGauss.cc RandomEngine.cc RandomEngine.cc RanecuEngine.cc Ranlux64Engine.cc RanluxEngine.cc TripleRand.cc * ranRestoreTest.cc Add put() and get() methods to every engine transfering state to a vector of unsigned longs. Fri Mar 11 2005 Mark Fischler * NonRandomEngine.cc Initialize (in the ctor) nextRandom and randomInterval (used if interval-style is set) because these are writtten out and read in as part of the state, and Microsooft VC++ fouls up the i/o when reading back the uninitialized number written out. 2005-02-18 Lynn Garren * configure.in, Makefile.am: Stop using libtool. The newer releases of libtool seem to have dropped support for Windows Visual C++. 2005-02-14 Lynn Garren * configure.in: Visual C++ flags are now "-EHsc -nologo -GR -GX -MD" Mon Feb 14 2005 Mark Fischler * JamesRandom.cc Check that seed is non-negative. Negative seeds give terrible sequences. Fri Feb 11 2005 Mark Fischler * RandPoissonQ.cc RandPoissonT.cc RandomEngine.cc Added missing implementations, per bug # 1806 (FireArray(), shootArray(), getTableSeeds) Check that seed is non-negative negative sees give terrible sequences. 2005-02-03 Lynn Garren * configure.in: install step creates libCLHEP.a, libCLHEP.so, and/or libCLHEP.dylib by adding a symbolic link. 2005-02-02 Andreas PFEIFFER * configure.in: modified compiler flags for windows: added "-O -GR -GX -MD" as this is needed for the multi-thread environments used. Mon Dec 27 2004 Mark Fischler * DRand48Engine.cc DualRand.cc Hurd160Engine.cc Hurd288Engine.cc JamesRandom.cc MTwistEngine.cc RandFlat.cc RandGauss.cc RandomEngine.cc RandomEngine.cc RanecuEngine.cc Ranlux64Engine.cc RanluxEngine.cc TripleRand.cc * Random.cc EngineFactory.cc StaticRandomStates.cc * Corresponding .h files * Random/test/ranRestoreTest.cc Ability to restore engines and distributions without knowing in the restoring program which type of engine was used in the saving program. Wed Dec 22 2004 Mark Fischler * Random.h StaticRandomState.h * Random.cc StaticRandomState.cc Added HepRandom::saveStaticRandomState(ostream) and restore to istream. Mon Dec 20 2004 Mark Fischler * Random.h RandGauss.h RandFlat.h RandFlat.icc RandBit.h * Random.cc RandGauss.cc RandFlat.cc Added static std::ostream& saveFullState ( std::ostream & os ) and saveDistState, and the corresponding restore methods. Thu Dec 16 2004 Mark Fischler * RandomEngine.h DRand48Engine.cc DualRand.cc Hurd160Engine.cc Hurd288Engine.cc JamesRandom.cc MTwistEngine.cc RandFlat.cc RandGauss.cc RandomEngine.cc RandomEngine.cc RanecuEngine.cc Ranlux64Engine.cc /RanluxEngine.cc TripleRand.cc * RandBinomial.cc RandBit.cc RandBreitWigner.cc RnadChiSquare.cc RandExponential.cc RandFlat.cc RandGamma.cc RandGauss.cc RandGaussQ.cc RandGaussT.cc RandGeneral.cc RandLandau.cc RandPoisson.cc RandPoissonQ.cc RandPoissonT.cc RandStudentT.cc Random.h * Random/test/ranRestoreTest.cc Added put and get methods, as well as ostream operations, so that engine and distribution instances can be saved and restored to/from streams. Wed Dec 15 2004 Mark Fischler * RandPoissonQ.cc (RandPoissonT.cc) RandPoissonQ has a path, potentially taken when mean is more than 100, where an additional gaussian random number is needed. This had been using the static RandGauss, causing subtle confusion when an engine other than that owned by the RandPoissonQ instance is affected by firing a variate. Instead we use the engine owned by the RandPoissonQ instance. This will affect in rare cases the values of random variates delivered by **instances** (not the shoot() methods) of RandPoissonQ when mean is more than 100 and, for subtle reasons, of RandPoissonT when the mean is small. Tue Dec 14 2004 Mark Fischler * RandGeneral.cc Modify local variable theIntegralPdf, using a std::vector instead of a double* pointing to a new-ed array. This makes save/restore an easier matter. Fri Dec 3 2004 Mark Fischler * RandomEngine.h DRand48Engine.cc DualRand.cc Hurd160Engine.cc Hurd288Engine.cc JamesRandom.cc MTwistEngine.cc RandFlat.cc RandGauss.cc RandomEngine.cc RandomEngine.cc RanecuEngine.cc Ranlux64Engine.cc /RanluxEngine.cc TripleRand.cc Random/test/ranRestoreTest.cc Modified engines and additional-state distributions so that restoreEngineState behaves better (error message and return instead of hang up) when file requested is not found. ============================== 30.11.04 Release CLHEP-2.0.1.2 ============================== ============================== 27.10.04 Release CLHEP-2.0.1.1 ============================== Fri Sep 24 2004 Lynn Garren * use AM_CXXFLAGS * require autoconf 2.59, automake 1.9.1, and libtool 1.9b Tue Aug 31 2004 Lynn Garren * change Solaris CC compile flags from "-O -mt" to "-O" * libtools 1.9b or later is required for Solaris CC ============================== 23.07.04 Release CLHEP-2.0.1.0 ============================== ============================== 11.05.04 Release CLHEP-2.0.0.2 ============================== ============================== 11.05.04 Release CLHEP-1.9.0.2 ============================== Tue May 11 2004 Mark Fischler * RandPoissonT.cc * RandPoissonQ.cc Repaired misbehavior when mean is precisely 100.0 in these routines. Thu Apr 29 2004 Mark Fischler * RandEngine.cc * RandEngine.h Code to accomodate possible systems where RAND_MAX is not one fo the two "expected" values of 2**15-1 or 2**31-1. Wed Apr 28 2004 Lynn Garren * make CLHEP work with Visual C++ ============================== 21.04.04 Release CLHEP-2.0.0.1 ============================== ============================== 24.10.03 Release CLHEP-2.0.0.0 ============================== ============================== 23.10.03 Release CLHEP-1.9.0.0 ============================== ============================== 01.06.02 Release CLHEP-1.8.0.0 ============================== Sat May 25 10:03:13 2002 Evgueni Tcherniaev * Random/RandStudentT.cc,RandStudentT.h: Added #include HUGE_VAL --> DBL_MAX On Apple/Darwin HUGE_VAL is defined to 1e500 and g++ compiler complains that floating point number exceeds range of `double' Fri Apr 12 16:58:58 2002 Evgueni Tcherniaev * Random/RandGeneral.cc: Bug fix in the destructor, thanks to Willy Langeveld Bug fix: delete [] (theIntegralPdf); * doxygen/README,config.doxygen,footer.html,modules.doc (Added): Files for generation of the documantation with Doxygen. * All_headers: For Doxygen: added empty documeting comments for classes. Sun Mar 31 10:54:23 2002 Evgueni Tcherniaev * Global_Clean_Up: The following macros have been removed from config/CLHEP-target.h.in (the reason is indicated). Respectively checks for them have been removed from configure.in: HEP_HAVE_STL - all supported compilers have string, vector, ... HEP_HAVE_BOOL - all supported compilers have bool HEP_HAVE_NAMESPACE - all supported compilers have namespace HEP_HAVE_EXPLICIT - all supported compilers have explicit HEP_HAVE_TYPENAME - all supported compilers have typename HEP_HAVE_EMPTY_TEMPLATE_PARAMETER_LIST - all supported compilers have template<> HEP_SQR_NEEDS_PARAMETER_WITHOUT_CONST HEP_ABS_NEEDS_PARAMETER_WITHOUT_CONST - current definition of sqr() and abs() works everywhere HEP_QSORT_NEEDS_FUNCTION_WITH_EXTERN_C_LINKAGE - qsort() is not used The following macros have been removed from config/CLHEP.h: HepStdString HepStdVector HepStdList HEP_TEMPLATE_SPECIALIZATION HEP_BEGIN_NAMESPACE HEP_END_NAMESPACE HEP_USING_NAMESPACE The following modifications have been made in the code: HepStdString --> HepSTL::string HepStdVector --> HepSTL::vector HepBoolean --> bool HepDouble --> double HepFloat --> float HepInt --> int HEP_BEGIN_NAMESPACE(xxx) --> namespace xxx { HEP_END_NAMESPACE(xxx) --> } // namespace xxx ========================================= 08.03.02 HepMC has become a part of CLHEP ========================================= Thu Feb 21 16:50:08 2002 Evgueni Tcherniaev * configure.in: Added -D_GNU_SOURCE for g++. Removed check for HEP_DIFFERENT_EXCEPTIONS. * config/CLHEP-target.h.in: Removed HEP_DIFFERENT_EXCEPTIONS * Random/DRand48Engine.cc,DRand48Engine.h: Re-declarations of drand48, srand48 and seed48 have been moved to DRand48Engine.cc Thu Nov 29 16:42:17 2001 Evgueni Tcherniaev * configure.in: Added check for the problem with different exceptions in drand48. This requires also use of -pedantic-errors instead of -pedantic. * config/CLHEP-target.h.in: * Random/DRand48Engine.h: Introduced HEP_DIFFERENT_EXCEPTIONS. * test/testVectorDists.cc: Minor changes to provide compilation with -pedantic-errors. ========================================== 09.11.01 HepPDT has become a part of CLHEP ========================================== Tue Jul 31 09:13:53 2001 Mark Fischler * Random/RandGeneral.cc: Changed from assert (above = below+1) to == This was first reported by Gregory P. Dubois-Felsmann at SLAC. Fri Jul 27 2001 Mark Fischler * Random/doc/html/ (Added): * Random/doc/html/CLHEP-random.html (Added): Added this ZOOM documentation page. ============================= 15.06.01 Release CLHEP-1.7.0.0 ============================== Wed Apr 11 13:54:51 2001 Mark Fischler * Random/DualRand.cc,Hurd160Engine.cc,Hurd288Engine.cc: * Random/RanecuEngine.cc,TripleRand.cc: Each saveState method ought to output endl after its data. * Random/DRand48Engine.h: __P replaced with __STRICT_ANSI__ (for the case g++ -ansi). Fri Apr 6 11:53:19 2001 Evgueni Tcherniaev * test/Makefile.in: Removed testRandDists and ranRestoreTest: they have been moved to Random/test. * Makefile.in,configure.in: * test/testVectorDists.cc: * RandomObjects/RandMultiGauss.cc,RandomVector.cc,RandomVector.h: "Tools" has been changed to "RandomObjects". Wed Apr 4 10:06:03 2001 Mark Fischler * Tools/Makefile.in (Removed): * Tools/RandMultiGauss.cc,RandMultiGauss.h (Removed): * Tools/RandomVector.cc,RandomVector.h (Removed): * Tools/RandomVector.icc (Removed): * RandomObjects/Makefile.in (Added): * RandomObjects/RandMultiGauss.cc,RandMultiGauss.h (Added): * RandomObjects/RandomVector.cc,RandomVector.h (Added): * RandomObjects/RandomVector.icc (Added): As agreed, we migrate the Tools involving Random and another CLHEP package into a package which I have chosen to name RandomObjects. RandomObjects in principle depends on Random, Matrix, and Vecgtor (though the tools that depend on Vector are not yet present). * Vector/AxisAngle.h,EulerAngles.h: Eliminated inconsistancy of virtual methods in no-virtual-destructor class. These classes should not be used polymorphically. * test/ranRestoreTest.cc,testRandDists.cc (Removed): * test/testRandDists.input,testRandDists.out.save (Removed): These were moved into Random/test * Random/test/GNUmakefile,gaussSmall.cc (Added): * Random/test/gaussSpeed.cc,ranRestoreTest.cc (Added): * Random/test/testRandDists.cc,testRandDists.dat (Added): * Random/test/testRandDists.input,testRandDists.input-long (Added): * Random/test/testRandDists.out.save (Added): Moved detailed and long tests into package-specific test area as agreed. * Vector/doc/VectorDefs.tex (Added): LaTeX documentation source for details of all the formulas and definitions in the Vector package. ========================================================================== 18.01.01 ZOOM PhysicsVectors Capabilities have become part of CLHEP/Vector ========================================================================== Thu Jan 18 19:45:00 2001 Mark Fischler * Random/DRand48Engine.h: Placed ifdef to repair problem which when gcc 2.95.2 is used WITHOUT -ansi, would have caused the header to fail to complie due to mismatch in prototypes of drand48() in header and . Tue Jan 9 15:50:00 2001 Mark Fischler * Random/Random.h: Modified comment for createInstance() to reflect the minor fix of Dec 5. Tue Dec 5 11:18:13 2000 Gabriele Cosmo * Random/Random.cc: Minor fix in HepRandom::createInstance() and removed useless code. Wed Nov 8 11:21:44 2000 Evgueni Tcherniaev * Random/DRand48Engine.cc,DRand48Engine.h: * Random/drand48.src (Added): More accurate code for drand48() on NT. DRand48Engine now produces exactly the same sequences on all platforms. Removed #ifdef in declaration of drand48(), srand48() and seed48(). * configure.in: Added -ansi for g++. After removing #ifdef in declaration of drand48(), srand48() and seed48() it now works fine. ====================================================================== 24.10.00 Generic Functions by Joe Boudreau have become a part of CLHEP ====================================================================== Mon Oct 23 17:54:56 2000 Evgueni Tcherniaev * config/CLHEP.h: Added definition of HepSTL. * docs/Random.html,validation.doc (Removed): * Random/doc/Random.html,validation.doc (Added): Moved docs for Random from docs/ to Random/doc/. ============================== 20.10.00 Release CLHEP-1.6.0.0 ============================== Tue Oct 17 14:55:45 2000 Evgueni Tcherniaev * Random/Randomize.h: Added distributions introduced in CLHEP-1.5. * Random/RandPoissonQ.cc,flatToGaussian.cc: * Tools/RandMultiGauss.h: * test/testRandDists.cc,testVectorDists.cc: Corrected warnings on Linux when compile with g++ -pedantic -Wall. ============================================================================== 12.10.00 Expression Evaluator by Evgueni Tcherniaev has become a part of CLHEP Alist, String and Combination have been disabled ============================================================================== Thu Sep 7 08:18:39 2000 Mark Fischler * Random/RandGauss.h,RandGauss.icc,RandGeneral.h,RandPoisson.icc: Correct warnings encountered by Yana Gaponenko. ============================== 08.05.00 Release CLHEP-1.5.0.0 ============================== Fri May 5 10:32:21 2000 Mark Fischler * Random/JamesRandom.cc,JamesRandom.h: 's mods to JamesRandom are in. * Tools/Random/RandMultiGauss.cc: Changed std:: to HepStd:: * test/ranRestoreTest.cc,testRandDists.cc: Last round of minor warning fixes (in Random package) before the 1.5 release. ============================================================ 24.04.00 StdHepC++ by Lynn Garren has become a part of CLHEP ============================================================ Sat Apr 22 11:20:22 2000 Evgueni Tcherniaev * test/Makefile.in: Removed testQuickGauss. Tue Apr 18 15:36:49 2000 Mark Fischler * test/testRandDists.input,testRandDists.out.save: Committing the re-run input and result files. * test/testQuickGauss.cc (Removed): * test/testQuickGauss.input,testQuickGauss.out.save (Removed): Mon Apr 17 18:00:55 2000 Mark Fischler * Random/RandLandau.cc,RandPoissonQ.cc,flatToGaussian.cc: Added explicit convertion from double to int. * Random/erfQ.cc,flatToGaussian.cc: Included "CLHEP/config/TemplateFunctions.h" * Random/Stat.h: Made constructor private; removed private destructor. * Random/gaussQtables.src,gaussTables.src,poissonTables.src: Changed std:: to HepStd:: Tue Apr 4 18:13:08 2000 Evgueni Tcherniaev * Random/RandFlat.cc,RandGauss.cc: restoreEngineStatus(): changed "char* inputword" to "char inputword[]" * Random/Makefile.in: added new files. * test/Makefile.in: added new tests. * test/ranRestoreTest.cc: changed std:: to HepStd:: * test/ranRestoreTest.cc: Changed for( HepInt k=0; ... to HepInt k; for(k=0; ... * test/gaussTables.cc (Removed): * Random/gaussTables.src (Added): Moved test/gaussTables.cc to Random/gaussTables.src * test/validation.doc (Removed): * docs/validation.doc (Added): moved test/validation.doc to docs/validation.doc Tue Mar 28 10:40:19 2000 Mark Fischler * Random/Stat.h (Added): Added the omitted Stat.h * Random/gaussQtables.src,gaussTables.src,poissonTables.src: These files are not run routinely but are part of the package to document how the .cdat tables are created. * Random/RandFlat.cc,RandGauss.cc,RandPoissonQ.cc: Removed use of std::string from files. Corrected bare std:: to HepStd:: * test/ranRestoreTest.cc (Added): Added a brief test of the save/restore mechanism. Mon Mar 13 11:12:41 2000 Mark Fischler * Tools/Random/RandMultiGauss.cc,RandMultiGauss.h (Added): * Tools/Random/RandomVector.cc,RandomVector.h,RandomVector.icc (Added): * test/testVectorDists.cc,testVectorDists.input (Added): * test/testVectorDists.out.save (Added): The vector distribution RandMiultiGauss, this time in its proper place in Tools/Random and with a validity test in test. Fri Mar 10 15:59:57 2000 Mark Fischler * Random/RandFlat.cc,RandFlat.h,RandFlat.icc: * Random/RandGauss.cc,Random/RandGauss.h,RandGauss.icc: Workaround for the save/restore misbehavior bug. * Random/RandPoisson.cc,RandPoisson.h,RandPoisson.icc: Provide for inheritors to have access to defaultMean and other necessities. RandPoisson.cc: gammln is removed from this file. gammln now is in the library on its own merits, via the HepStat class. However, to retain backward compatibility with codes that may incidentally use ::gammln (since it was already in the library due to RandPoisson.cc) we place that (ugly global) definition into RandPoisson.cc, pointing it to HepStat::gammln. * Random/RandBit.cc RandBit.h RandBit.icc (Added): RandBit is equivalent to (and derived from) RandFlat. The only difference is that RandBit is state-free. RandBit::shootBit() and fireBit() will always use ONE uniform random and return just one bit. That is slower than RandFlat::shootBit() but will behave correctly with respect to saving and restoring status. (Surprisingly, the static version RandBit::shootBit() (which uses a JamesRandom engine) appears to be only 2.5 times slower than RandFlat::shootBit() (which caches the word, using the engine more rarely. I would have expected a factor of 8-15.) * Random/RandGaussQ.cc,RandGaussQ.h,RandGaussQ.icc (Added): A quicker but less accurate distribution, inheriting from RandGauss so that it may be used as a drop-in replacement. Stateless. * Random/RandGaussT.cc,RandGaussT.h,RandGaussT.icc (Added): An accurate and stateless (won't exhibit save/restore bug) table-driven distribution, inheriting from RandGauss so that it may be used as a drop-in replacement. * Random/RandLandau.cc,RandLandau.h,RandLandau.icc (Added): Landau distribution, using the method in CERNLIB. * Random/RandPoissonQ.cc,RandPoissonQ.h,RandPoissonQ.icc (Added): A quicker but (for mu > 100) less accurate distribution, inheriting from RandPoisson so that it may be used as a drop-in replacement. Even at mu > 100, 6-digit accurate or better. * Random/RandPoissonT.cc,RandPoissonT.h,RandPoissonT.icc (Added): An accurate and stateless (won't exhibit save/restore bug) table-driven distribution, inheriting from RandPoisson so that it may be used as a drop-in replacement. Below mu = 100, this is 3-7 times faster than RandPoisson. Recommended as a replacement. * Random/erfQ.cc,flatToGaussian.cc,gammln.cc (Added): Various ancillary mathematical functions needed for the distributions. Users may if they wish avail themsleves of this; the list is in the header Stat.h. * Random/gaussQTables.cdat,poissonTables.cdat (Added): Tables for the table-driven forms of Gaussian and Piosson distributions. * test/testRandDists.cc,testRandDists.input,testRandDists.out.save: Include tests of the various new forms of Gaussian and Poisson dists. * test/validation.doc (Added): A file detailing the validation tests, validation levels, and approximate timings of each distribution. Thus far we have validated the gaussian, poisson, and RandGeneral distributions. Mon Oct 18 20:09:49 1999 Evgueni Tcherniaev * config/Makefile.common.in: Added installation of *.cdat files * Random/NonRandomEngine.cc,RandGauss.cc: std:: --> HepStd::, some trivial cleaning * Random/Makefile.in: Added NonRandomEngine.cc * test/Makefile.in,gaussTables.cc,testQuickGauss.cc: * test/testRandDists.out.save: * test/testQuickGauss.input testQuickGauss.out.save (Added): Modifications caused by introduction of testQuickGauss.cc and gaussTables.cc Tue Oct 12 11:13:49 1999 Mark Fischler * Random/RandGauss.cc,RandGauss.h,RandGauss.icc: RandGauss is made stateless, repairing the bug of saveEngineStatus not saving enough info to reproduce the sequence correctly. RandGauss now has a method quick() which is the same as fire() but gives deviates which are gaussian to only 6 digit precision -- it runs faster. * Random/NonRandomEngine.cc,NonRandomEngine.h (Added): * test/gaussTables.cc,testQuickGauss.cc,gaussTables.cdat (Added): gaussTables.cdat contains 30K of table data needed for RandGauss. It was generated by gaussTables.cc; that is included just to document how the table was produced. gaussTables.cdat is compiled into RandGauss.cc (by an #include) so that user codes don't have to depend on the table being present (and don't have to waste time reading in the table). A new engine, NonRandomEngine, is included primarily for the use of developers testing their code's behavior - it allows you to dictate the sequence of randoms supplied by the engine. Fri Aug 6 12:02:20 1999 Evgueni Tcherniaev * config/CLHEP.h: * Combination/Lockable.cc: * Geometry/Plane3D.cc,Plane3D.h,Transform3D.cc: * Hist/HBookFile.cc,TupleManager.cc: * Matrix/: * DiagMatrix.cc,DiagMatrix.h,GenMatrix.cc,Matrix.cc,Matrix.h: * Pile.h,SymMatrix.cc,SymMatrix.h,Vector.cc,Vector.h: * Random/: * DRand48Engine.cc,DRand48Engine.h,DualRand.cc,DualRand.h: * Hurd160Engine.cc,Hurd160Engine.h,Hurd288Engine.cc: * Hurd288Engine.h,JamesRandom.cc,JamesRandom.h,MTwistEngine.cc: * MTwistEngine.h,RandEngine.cc,RandEngine.h,RandGeneral.cc: * RanecuEngine.cc,RanecuEngine.h,Ranlux64Engine.cc: * Ranlux64Engine.h,RanluxEngine.cc,RanluxEngine.h: * RanshiEngine.cc,RanshiEngine.h,TripleRand.cc,TripleRand.h: * String/: * CmdLine.cc,CmdLine.h,Strings.cc,Strings.h,Strings.icc: * Vector/: * LorentzRotation.cc,LorentzVector.cc,LorentzVector.h: * Rotation.cc,ThreeVector.cc,ThreeVector.h,ThreeVector.icc: * test/: * testAList.cc,testCmd.cc,testComb.cc,testInversion.cc: * testLorentzVector.cc,testMatrix.cc,testRandDists.cc: * testRandom.cc,testStrings.cc,testThreeVector.cc,testUnits.cc: Changed std:: to HepStd:: to avoid problems on OSF Thu May 27 17:04:02 1999 Mark Fischler * Random/: * DualRand.cc,RandFlat.icc,Ranlux64Engine.cc,SeedTable.h: * TripleRand.cc,TripleRand.h: fixed up things that were causing warnings on pedantic compilers: * order of initialization in RandFlat * added {} around each pair of elements in seedTable * eliminated the funky private accessors in TripleRand * test/testRandDists.cc: Minor modification to work with NT. Modifications to do better validation: Moments up to 6th and pdf at intervals of .5 sigma. Fri May 21 14:37:52 1999 Evgueni Tcherniaev * Random/: * DRand48Engine.cc,DualRand.cc,Hurd160Engine.cc,Hurd288Engine.cc: * JamesRandom.cc,MTwistEngine.cc,RandEngine.cc,RanecuEngine.cc: * Ranlux64Engine.cc,RanluxEngine.cc,RanshiEngine.cc,TripleRand.cc: All char* beginMarker, char* endMarker have been changed to char beginMarker[], char endMarker[] to avoid warnings on HP-aCC * test/testRandDists.cc: Changed: #include --> #include "CLHEP/config/TemplateFunctions.h" std:exp(...) --> exp(...) bool --> HepBoolean * test/testRandDists.dat (Removed): * testRandDists.input (Added): Renamed: testRandDists.dat to testRandDists.input * test/Makefile.in: * testRandDists.out.save (Added): Modifications needed for automatic run of testRandDists Thu May 20 09:44:06 1999 Mark Fischler * Random/: * DRand48Engine.cc,DRand48Engine.h,DualRand.cc,DualRand.h: * Hurd160Engine.cc,Hurd160Engine.h,Hurd288Engine.cc,Hurd288Engine.h: * JamesRandom.cc,JamesRandom.h,MTwistEngine.cc,MTwistEngine.h: * RandBinomial.cc,RandBinomial.h,RandBinomial.icc: * RandBreitWigner.cc,RandBreitWigner.h,RandBreitWigner.icc: * RandChiSquare.cc,RandChiSquare.h,RandChiSquare.icc: * RandEngine.cc,RandEngine.h,RandExponential.cc,RandExponential.h: * RandExponential.icc,RandFlat.cc,RandFlat.h,RandFlat.icc: * RandGamma.cc,RandGamma.h,RandGamma.icc,RandGauss.cc,RandGauss.h: * RandGauss.icc,RandGeneral.cc,RandGeneral.h,RandGeneral.icc: * RandPoisson.cc,RandPoisson.h,RandPoisson.icc: * RandStudentT.cc,RandStudentT.h,RandStudentT.icc: * Random.cc,Random.h,Random.icc,RandomEngine.cc,RandomEngine.h: * RandomEngine.icc,Randomize.h,RanecuEngine.cc,RanecuEngine.h: * Ranlux64Engine.cc,Ranlux64Engine.h,RanluxEngine.cc,RanluxEngine.h: * RanshiEngine.cc,RanshiEngine.h,TripleRand.cc,TripleRand.h: * SeedTable.h: The merge of G. Cosmos January improvements with the ZOOM enhancements. Details of the modifications: * Hurd160Engine.cc,Hurd288Engine.cc: Made a mod to correct the following flaw -- given N consectutive calls to operator unsigned int() to get N random 32-bit integers, you can deduce the state of a Hurd engine and thus predict the next number. The simple expedient of discarding every Nth number plugs this flaw. Also, the earlier version was able to give identical sequences in two forms of the constructors (very unlikely, but possible). In the newer version, the only way to get the same sequence is to explicitly provide the same seeds in the same way. * Ranlux64Engine.cc: The early version was using an algorithm which differed from that intended by Luscher (though it passes our ergodicity tests). The modified one correctly implements the algorithm, so Luscher's randomness arguments hold rigorously. * RanshiEngine.cc,DualRand.cc,TripleRand.cc: In the early version, the constructor taking explicit seeds still used numEngine to affect the starting state. This was not the intention, and that has been corrected. So any program supplying explicit seeds to one of these engines will deliver a different stream than before. (The default constructor is unaffected - the dependence on numEngines is the proper behavior in that case.) Wed May 19 16:43:17 1999 Mark Fischler * test/testRandDists.cc,testRandDists.dat (Added): Added a validation program for Random distributions. ============================== 20.04.99 Release CLHEP-1.4.0.0 ============================== Tue Mar 30 20:52:58 1999 Evgueni Tcherniaev * Random/RandGeneral.cc,RandGeneral.h: Modifications provided by Stefano Magni Fri Jan 29 02:33:37 1999 Gabriele Cosmo * Random/: * RandBreitWigner.cc,RandExponential.cc,RandExponential.h: * RandExponential.icc,RandFlat.cc,RandFlat.h,RandFlat.icc: * RandGauss.cc,RandPoisson.cc,Random.cc,Random.h,Randomize.h: *** HEPRandom 2.1.1 *** - Fixes for porting on AIX 4.3.2. No functional changes. - Forced call to HepRandom::createInstance() in Randomize.h. - Minor cosmetic changes. * docs/Random.html: *** HEPRandom 2.1.1 *** - Updated doc. Wed Jan 20 23:57:01 1999 Gabriele Cosmo * Random/RandGauss.h: Methods setFlag(false) and setF(false) if invoked in the client code before shoot/fire will force generation of a new couple of values. Fri Jan 8 00:16:23 1999 Gabriele Cosmo * Random/: * RandBinomial.h,RandBinomial.icc,RandChiSquare.h: * RandChiSquare.icc,RandGamma.h,RandGamma.icc,RandGauss.cc: * RandGauss.h,RandGeneral.cc,RandPoisson.cc,RandPoisson.h: * RandStudentT.h,RandStudentT.icc,Random.cc,Random.h,Random.icc: *** HEPRandom 2.1.0 *** Random (.h.icc.cc) : relocated Gauss and Poisson data; simplified initialisation of static generator. RandGauss (.h.cc), RandPoisson (.h.cc) : relocated static data from HepRandom. RandBinomial (.h.icc), RandChiSquare (.h.icc), RandGamma (.h.icc), RandStudentT (.h.icc) : cleanup of useless data/methods. RandGeneral (.cc) : fixed bug in initialisation of theIntegralPdf[] in two constructors and added validity check (courtesy of M.G.Pia) * docs/Random.html: *** HEPRandom 2.1.0 *** - Updated version number. No functional changes. Sun Dec 20 12:05:12 1998 Evgueni Tcherniaev * Random/Randomize.h: Changed RandFlat::shoot() to HepRandom::getTheEngine()->flat() in the definition of HepUniformRand(). ========================================================================= 16.12.98 Started: merging with BaBar version of CLHEP provided by G.Cosmo ========================================================================= ed Aug 26 11:52:52 1998 Evgueni Tcherniaev * Random/ : * DualRand.cc,Hurd160Engine.cc,Hurd288Engine.cc,MTwistEngine.cc: * RanshiEngine.cc,TripleRand.cc: Some changes to avoid warnings on HP-CC Tue Aug 25 12:13:08 1998 Evgueni Tcherniaev * Random/fc.cc (Removed): * Random/Makefile.in,RandBinomial.cc,RandBinomial.h: fc() has been renamed to StrirlingCorrection() and moved to RandBinomial.cc Sun Aug 23 19:47:09 1998 Evgueni Tcherniaev * Random/: * DRand48Engine.cc,DualRand.cc,Hurd160Engine.cc,Hurd288Engine.cc: * JamesRandom.cc,MTwistEngine.cc,RandEngine.cc,RanecuEngine.cc: * Ranlux64Engine.cc,RanluxEngine.cc,RanshiEngine.cc: * TripleRand.cc: Removed #ifdef IRIX_6_2_CC_7_1. All is.setstate(ios::badbit); replaced by is.clear(ios::badbit | is.rdstate()); Sat Aug 22 16:25:47 1998 Evgueni Tcherniaev * Random/: * DualRand.cc,Hurd160Engine.cc,Hurd288Engine.cc,JamesRandom.cc: * MTwistEngine.cc,RandomEngine.h,Ranlux64Engine.cc: * RanluxEngine.cc,RanshiEngine.cc,TripleRand.cc: #include "CLHEP/config/iomanip.h" moved to RandomEngine.h Fri Aug 21 11:33:33 1998 Evgueni Tcherniaev * Random/: * DualRand.cc,Hurd160Engine.cc,Hurd288Engine.cc,RanshiEngine.cc: * TripleRand.cc: Changed order of the #include macros: config/iomanip.h should be the last. * Random/RandStudentT.cc,fc.cc: Removed #include * test/testMatrix.out.save: Output for testMatrix has been changed after modification of the Random module Fri 21 Aug 03:10:24 1998 Gabriele Cosmo * Random/: * DualRand.cc,DualRand.h,Hurd160Engine.cc,Hurd160Engine.h: * Hurd288Engine.cc,Hurd288Engine.h,MTwistEngine.cc,MTwistEngine.h: * RandBinomial.cc,RandBinomial.h,RandBinomial.icc,RandBreitWigner.icc: * RandChiSquare.cc,RandChiSquare.h,RandChiSquare.icc: * RandExponential.icc,RandGamma.cc,RandGamma.h,RandGamma.icc: * RandGauss.icc,RandGeneral.cc,RandGeneral.h,RandGeneral.icc: * RandPoisson.icc,RandStudentT.cc,RandStudentT.h,RandStudentT.icc: * Ranlux64Engine.cc,Ranlux64Engine.h,RanshiEngine.cc,RanshiEngine.h: * TripleRand.cc,TripleRand.h,fc.cc (Added): * Random/: * DRand48Engine.cc,DRand48Engine.h,JamesRandom.cc,JamesRandom.h: * Makefile.in,RandBreitWigner.cc,RandBreitWigner.h,RandEngine.cc: * RandEngine.h,RandExponential.cc,RandExponential.h,RandFlat.cc: * RandFlat.h,RandFlat.icc,RandGauss.cc,RandGauss.h,RandPoisson.cc: * RandPoisson.h,Random.cc,Random.h,Random.icc,RandomEngine.cc: * RandomEngine.h,RandomEngine.icc,Randomize.h,RanecuEngine.cc: * RanecuEngine.h,RanluxEngine.cc,RanluxEngine.h,SeedTable.h: * test/testRandom.cc,testRandom.input: * docs/Random.html: *** HEPRandom 2.0.0a *** Merged additions and new developments by FNAL-Zoom group. Added RandGeneral class, courtesy of S.Magni and G.Pieri (INFN-Milano). Needs validation on supported compilers. ========================== 28.07.98 Release CLHEP-1.3 ========================== Thu Jul 23 10:05:36 1998 Evgueni Tcherniaev * test/testFRandom.f,.cvsignore (Removed): * config/TemplateFunctions.h: CLHEP-default.h replaced by CLHEP.h Added HEP_SQR_NEEDS_PARAMETER_WITHOUT_CONST * config/iostream.h: Removed declarations for basic_ios and basic_streambuf * config/CLHEP-target.h.in: Added HEP_SQR_NEEDS_PARAMETER_WITHOUT_CONST * configure.in: Changed options for cl and f77 on NT Added HEP_SQR_NEEDS_PARAMETER_WITHOUT_CONST Tue Jul 14 09:05:20 1998 Evgueni Tcherniaev * config/TemplateFunctions.h (Added): min(), max(), abs(), sqr() moved from CLHEP.h to TemplateFunctions.h * config/CLHEP.h: * Geometry/Transform3D.cc: * Random/RandBreitWigner.cc,RanecuEngine.cc: * String/Strings.cc: * Vector/Rotation.cc: * test/: * testLorentzVector.cc,testMinMaxSqrAbs.cc,testStrings.cc: * testThreeVector.cc: min(), max(), abs(), sqr() moved from CLHEP.h to TemplateFunctions.h Wed 25 Mar 23:28:54 1998 Gabriele Cosmo * Random/Random.cc,Random.h: Some unwanted changes went in ... apologize. Tue 24 Mar 20:48:39 1998 Gabriele Cosmo * docs/Random.html: -HepRandom 1.9.2- * Random/: * DRand48Engine.cc,DRand48Engine.h,JamesRandom.h: * RandBreitWigner.cc,RandBreitWigner.h,RandEngine.cc: * RandEngine.h,RandExponential.cc,RandExponential.h,RandFlat.cc: * RandFlat.h,RandFlat.icc,RandGauss.cc,RandGauss.h,Random.cc: * Random.h,Random.icc,RandomEngine.cc,RandomEngine.h: * RandomEngine.icc,RanecuEngine.cc,RanecuEngine.h,RanluxEngine.h: * SeedTable.h: HepRandom: better encapsulation as singleton class; added static table of seeds (moved from HepRandomEngine). RanecuEngine: moved L'Ecuyer coefficients from private to protected to allow seed-skipping mechanism. RandEngine, DRand48Engine: private copy constructor and operator=. Updated documentation and comments. ========================== 05.02.98 Release CLHEP-1.2 ========================== Thu Feb 5 01:30:02 1998 Gabriele Cosmo * Random/RandPoisson.h,RandPoisson.cc: Fixed small bug occouring when "crazy" values for mean were given to the Poisson algorithm. Mon Feb 2 10:41:39 1998 Evgueni Tcherniaev * Random/RanluxEngine.cc: Changed pow(2,24) -> 0x1000000 * Random/DRand48Engine.h: Added declaration of drand48(), srand48() and seed48() for KCC * configure.in: Added KCC * Makefile.in,configure.in: * Alist/Makefile.in: * Combination/Makefile.in: * Hist/Makefile.in: * Matrix/Makefile.in: * String/Makefile.in: * Vector/Makefile.in: * test/Makefile.in: * config/CLHEP-target.h.in: Removed PersistentIO stuff Fri Jan 23 16:24:24 1998 Evgueni Tcherniaev * Random/: * DRand48Engine.cc,JamesRandom.cc,RandEngine.cc,RanecuEngine.cc: * RanluxEngine.cc: Removed ios::nocreate; KCC has no such mode * Random/RandEngine.cc: Removed 'dummy' to avoid warnings with KCC * Combination/Combiner.icc: Some corrections to avoid warnings with HP/aCC: done -> HepCombiner::done nlists -> HepCombiner::nlists * Combination/Lock.h: Some corrections to avoid warnings with HP/aCC: added void to HepLockAddList() and HepLockRemoveList() * Geometry/Plane3D.h: * Matrix/DiagMatrix.h,Matrix.h,SymMatrix.h,Vector.h: * String/CmdLine.h: * Vector/LorentzVector.h,ThreeVector.h: Declaration class ostream; changed to #include to avoid problems with KCC Thu Jan 22 10:53:42 1998 Evgueni Tcherniaev * Makefile.in: Added "rm configure Makefile.common CLHEP-*.h" for distclean: target * test/Makefile.in: Added rm *.ii for clean: target * test/testRandom.cc: Removed 'pause' to avoid warnings with KCC * config/Makefile.common.in: Added rm *.a *.ii for clean: target Fri Dec 19 02:35:57 1997 Gabriele Cosmo * Random/Randomize.h: Added missing ifdef protection to body ======================================================== 08.12.97 Release CLHEP-1.1: Geant4 has migrated to CLHEP ======================================================== Thu Oct 16 03:28:47 1997 Gabriele Cosmo * Random/Random.h,RandomEngine.h,RanecuEngine.cc,RanecuEngine.h: Fixed default argument for setSeed() and setSeeds(). * docs/Random.html: Added few notes ... Wed Oct 15 00:30:42 1997 Gabriele Cosmo * docs/Random.html: * Random/: * DRand48Engine.cc,JamesRandom.cc,RandEngine.cc, * RandFlat.icc,RanluxEngine.cc: *** HepRandom 1.9.1 *** - Fixed old bug inherited from CLHEP0.15 in the algorithm of RandFlat::shootInt(m,n) (... fireInt(m,n)). Now the method shoots values in the interval [m,n[ as correctly stated in the docs. In the old version the interval was wrongly [m,m+n[ ... Thanks to Massimo Lamanna. - Fixed minor bug still inherited from CLHEP0.15 in setSeeds() methods of concrete engines. Thanks to Peter Stamfest. Wed Oct 1 15:46:34 1997 Evgueni Tcherniaev * test/testRandom.cc: Inserted: -*- C++ -*- Tue Aug 12 02:39:05 1997 Gabriele Cosmo * Random/: * RandBreitWigner.cc,RandBreitWigner.h,RandExponential.cc: * RandExponential.h,RandFlat.cc,RandFlat.h,RandFlat.icc: * RandGauss.cc,RandGauss.h,RandPoisson.cc,RandPoisson.h: * Random.cc,Random.h,Random.icc: * docs/Random.html: Updated to release 1.9 of HepRandom. - introduced default values for shoot()/fire(); - added shootArray()/fireArray() for every distribution; - defined operator()() using default values for each distribution; - updated doc file Random.html. Tue Jul 22 03:17:08 1997 Gabriele Cosmo * Random/RandomEngine.h,RanluxEngine.h: Added missing default second argument value for setSeed() and setSeeds() in RandomEngine and RanluxEngine. If not specified, RanluxEngine luxury is set to 3 by default. Sat Jul 12 23:06:01 1997 Gabriele Cosmo * Random/: * DRand48Engine.cc,DRand48Engine.h,JamesRandom.h,RandEngine.h: * RanecuEngine.cc,RanecuEngine.h: Added abs for setting seed index in RanecuEngine. setSeed() and setSeeds() now have default dummy argument set to zero. Thu Jul 10 22:04:38 1997 Gabriele Cosmo * Random/RanecuEngine.cc: fixed bug in setSeed() and setSeeds() Tue Jul 8 16:10:30 1997 Evgueni Tcherniaev * OldRandom/: * Makefile.in,JamesRandom.cc,JamesRandom.h,Random.cc: * Random.h,Random.icc,RandomEngine.cc,RandomEngine.h (Removed): * test/testOldRandom.cc (Removed): * configure.in: Removed references to OldRandom/ Fri Mar 14 18:19:29 1997 Nobu Katayama - Vector added more functionality from Geant4 and Babar - New Random from Geant4 Wed Mar 12 13:03:47 1997 Nobu Katayama - Use HEP_USE_RANDOM instead of USE_RANDOM. Moved Matrix consturctors using HepRandom from .icc into .cc. They are not inline anymore. Wed Feb 19 16:30:14 1997 Leif Lonnblad * test/Makefile.in (SOMETESTFILES): Removed target TestRTTI in case persistent streams are disabled. * Random/RandomEngine.h: Removed dependencies on persistent IO in case of HEP_NO_PERSISTENT_STREAMS * Random/RandomEngine.cc: Removed dependencies on persistent IO in case of HEP_NO_PERSISTENT_STREAMS * Random/Random.h: Removed dependencies on persistent IO in case of HEP_NO_PERSISTENT_STREAMS * Random/Random.cc: Removed dependencies on persistent IO in case of HEP_NO_PERSISTENT_STREAMS * Random/JamesRandom.h: Removed dependencies on persistent IO in case of HEP_NO_PERSISTENT_STREAMS * Random/JamesRandom.cc: Removed dependencies on persistent IO in case of HEP_NO_PERSISTENT_STREAMS Fri Feb 14 09:38:37 1997 Leif Lonnblad * Random/Random.cc (HepRandom::breitWignerM2): Fixed serious bug. Used to be 'if ( gamma = 0.0 )' which is always false and causes floating exception in next line. clhep-2.1.4.1.orig/Random/CMakeLists.txt0000644000175000017500000000044411672427737016377 0ustar olesoles# main Random cmake instructions # automake/autoconf variables set( PACKAGE Random ) clhep_package_config() add_subdirectory(Random) add_subdirectory(src) add_subdirectory(test) if ( CLHEP_BUILD_DOCS ) message(STATUS "building documents for ${PACKAGE}" ) add_subdirectory(doc) endif() clhep-2.1.4.1.orig/Random/poissonTables.cdat0000755000175000017500000005716607705060311017320 0ustar olesoles // // mu = 10 // 0.00004539992976248, 0.00049939922738733, 0.00276939571551158, // 1 - 3 0.01033605067592572, 0.02925268807696107, 0.06708596287903178, // 4 - 6 0.13014142088248296, 0.22022064660169893, 0.33281967875071894, // 7 - 9 0.45792971447185227, 0.58303975019298560, 0.69677614630310680, // 10 - 12 0.79155647639487448, 0.86446442261931111, 0.91654152706533731, // 13 - 15 0.95125959669602145, 0.97295839021519903, 0.98572238640295051, // 16 - 18 0.99281349539614583, 0.99654565802414330, 0.99841173933814209, // 19 - 21 0.99930034948766533, 0.99970426319199401, 0.99987987784605004, // 22 - 24 0.99995305061857331, 0.99998231972758267, 0.99999357707720160, // 25 - 27 0.99999774646594941, 0.99999923553335934, 0.99999974900487998, // 28 - 30 0.99999992016205352, 0.99999997537404495, 0.99999999262779227, // 31 - 33 0.99999999785620053, 0.99999999939396766, 0.99999999983332966, // 34 - 36 0.99999999995537470, 0.99999999998835987, 0.99999999999704015, // 37 - 39 0.99999999999926581, 0.99999999999982225, 0.99999999999995792, // 40 - 42 0.99999999999999023, 0.99999999999999778, 0.99999999999999944, // 43 - 45 0.99999999999999978, 0.99999999999999989, 1.00000000000000000, // 46 - 48 1.00000000000000000, 1.00000000000000000, 1.00000000000000000, // 49 - 51 // // mu = 15 // 0.00000030590232050, 0.00000489443712803, 0.00003930844818448, // 1 - 3 0.00021137850346676, 0.00085664121077530, 0.00279242933270092, // 4 - 6 0.00763189963751496, 0.01800219314783076, 0.03744649347967288, // 7 - 9 0.06985366069940976, 0.11846441152901509, 0.18475179902393143, // 10 - 12 0.26761103339257686, 0.36321784227947540, 0.46565370894400959, // 13 - 15 0.56808957560854378, 0.66412320060654462, 0.74885875207536889, // 16 - 18 0.81947171163272237, 0.87521878496747518, 0.91702908996853982, // 19 - 21 0.94689359354072877, 0.96725575506722128, 0.98053542562797724, // 22 - 24 0.98883521972844968, 0.99381509618873320, 0.99668810183889678, // 25 - 27 0.99828421608898765, 0.99913927729439345, 0.99958155033167229, // 28 - 30 0.99980268685031171, 0.99990968839158889, 0.99995984536406257, // 31 - 33 0.99998264398791425, 0.99999270220431935, 0.99999701286849296, // 34 - 36 0.99999880897856530, 0.99999953713129730, 0.99999982456000736, // 37 - 39 0.99999993510951124, 0.99999997656557515, 0.99999999173242782, // 40 - 42 0.99999999714916088, 0.99999999903871895, 0.99999999968288644, // 43 - 45 0.99999999989760890, 0.99999999996762712, 0.99999999998997335, // 46 - 48 0.99999999999695655, 0.99999999999909428, 0.99999999999973554, // 49 - 51 // // mu = 20 // 0.00000000206115362, 0.00000004328422607, 0.00000045551495056, // 1 - 3 0.00000320371978048, 0.00001694474393007, 0.00007190884052843, // 4 - 6 0.00025512249585630, 0.00077859008250736, 0.00208725904913502, // 7 - 9 0.00499541230830759, 0.01081171882665273, 0.02138682158728025, // 10 - 12 0.03901199285499279, 0.06612764095916593, 0.10486428110798471, // 13 - 15 0.15651313463974306, 0.22107420155444102, 0.29702839792467389, // 16 - 18 0.38142194944715491, 0.47025726683924018, 0.55909258423132546, // 19 - 21 0.64369764841426380, 0.72061134312602593, 0.78749281678842775, // 22 - 24 0.84322737817376259, 0.88781502728203043, 0.92211321890377496, // 25 - 27 0.94751928677173392, 0.96566647810599027, 0.97818178247444298, // 28 - 30 0.98652531872007809, 0.99190824533016531, 0.99527257446146977, // 31 - 33 0.99731156181377556, 0.99851096613866130, 0.99919634003859603, // 34 - 36 0.99957710331633753, 0.99978292130430590, 0.99989124656113137, // 37 - 39 0.99994679797488806, 0.99997457368176634, 0.99998812280707283, // 40 - 42 0.99999457477150455, 0.99999757568519365, 0.99999893973687048, // 43 - 45 0.99999954598206020, 0.99999980956692525, 0.99999992173069763, // 46 - 48 0.99999996846560280, 0.99999998754107433, 0.99999999517126292, // 49 - 51 // // mu = 25 // 0.00000000001388794, 0.00000000036108654, 0.00000000470106900, // 1 - 3 0.00000004086758948, 0.00000026690834249, 0.00000139711210754, // 4 - 6 0.00000610629446193, 0.00002292480287045, 0.00007548264164706, // 7 - 9 0.00022147663824878, 0.00058646162975308, 0.00141597297408103, // 10 - 12 0.00314412160809759, 0.00646748436582174, 0.01240206071890058, // 13 - 15 0.02229302130736532, 0.03774764722684147, 0.06047503828489464, // 16 - 18 0.09204085919885736, 0.13357483408565043, 0.18549230269414177, // 19 - 21 0.24729881294234574, 0.31753348367894113, 0.39387551708828394, // 22 - 24 0.47339846855634937, 0.55292142002441480, 0.62938579643601622, // 25 - 27 0.70018614496527676, 0.76340074186640228, 0.81789608402254499, // 28 - 30 0.86330886915266392, 0.89993208296727589, 0.92854396875994150, // 31 - 33 0.95021963981499125, 0.96615763323782189, 0.97754191425412951, // 34 - 36 0.98544766495989866, 0.99078938840974273, 0.99430368015306114, // 37 - 39 0.99655643127057292, 0.99796440071901782, 0.99882291867538664, // 40 - 42 0.99933394126846331, 0.99963104742722886, 0.99979985774470925, // 43 - 45 0.99989364125442060, 0.99994461055317674, 0.99997172188230232, // 46 - 48 0.99998584236622190, 0.99999304669475231, 0.99999664885901751, // 49 - 51 // // mu = 30 // 0.00000000000009358, 0.00000000000290086, 0.00000000004501017, // 1 - 3 0.00000000046610320, 0.00000000362430095, 0.00000002257348746, // 4 - 6 0.00000011731942002, 0.00000052337341671, 0.00000204607590427, // 7 - 9 0.00000712175086282, 0.00002234877573845, 0.00006387702539927, // 10 - 12 0.00016769764955133, 0.00040728370528685, 0.00092068239614867, // 13 - 15 0.00194747977787231, 0.00387272486860413, 0.00727021620518971, // 16 - 18 0.01293270176616566, 0.02187346844139086, 0.03528461845422865, // 19 - 21 0.05444340418685407, 0.08056902109497963, 0.11464591271427385, // 22 - 24 0.15724202723839162, 0.20835736466733296, 0.26733660016226524, // 25 - 27 0.33286908404552334, 0.40308245963472844, 0.47571698610631996, // 28 - 30 0.54835151257791148, 0.61864298980848387, 0.68454124971214547, // 31 - 33 0.74444875871547422, 0.79730832548311725, 0.84261652556966837, // 34 - 36 0.88037335897512770, 0.91098700768225682, 0.93515567771420094, // 37 - 39 0.95374696235415790, 0.96769042583412568, 0.97789296008776061, // 40 - 42 0.98518048455464269, 0.99026480395014183, 0.99373138535616401, // 43 - 45 0.99604243962684547, 0.99754964893381159, 0.99851169742761980, // 46 - 48 0.99911297773624996, 0.99948110853745209, 0.99970198701817337, // 49 - 51 // // mu = 35 // 0.00000000004433782, 0.00000000032030161, 0.00000000193009042, // 5 - 7 0.00000000997903445, 0.00000004519316457, 0.00000018213700396, // 8 - 10 0.00000066144044180, 0.00000218649683492, 0.00000663457798154, // 11 - 13 0.00001861018106857, 0.00004854918878617, 0.00011840687346056, // 14 - 16 0.00027122055868579, 0.00058583696944361, 0.00119759110147270, // 17 - 19 0.00232450660784209, 0.00429660874398852, 0.00758344563756590, // 20 - 22 0.01281250433189355, 0.02076976756239215, 0.03237410977353594, // 23 - 25 0.04862018886913725, 0.07048991072860056, 0.09883955017605298, // 26 - 28 0.13427659948536852, 0.17704545210005967, 0.22694244681719936, // 29 - 31 0.28327776343332478, 0.34489451598221199, 0.41024561717042568, // 32 - 34 0.47751880957005743, 0.54479200196968913, 0.61019649458044223, // 35 - 37 0.67206560921223568, 0.72905032005730863, 0.78019044517468172, // 38 - 40 0.82493805465238323, 0.86313723347481131, 0.89496988249350140, // 41 - 43 0.92088017820638868, 0.94149064070527633, 0.95752100042663335, // 44 - 46 0.96971801325810070, 0.97880089515387425, 0.98542382986954247, // 47 - 49 0.99015449752359119, 0.99346596488142525, 0.99573854051915456, // 50 - 52 0.99726815873685692, 0.99827828397496232, 0.99893299477743802, // 53 - 55 // // mu = 40 // 0.00000000392593223, 0.00000001620195271, 0.00000006084202718, // 10 - 12 0.00000020964227541, 0.00000066748919306, 0.00000197562324349, // 13 - 15 0.00000546398071130, 0.00001418487438082, 0.00003470462419146, // 16 - 18 0.00008030406821511, 0.00017630289773857, 0.00036830055678549, // 19 - 21 0.00073401038354154, 0.00139893734127980, 0.00255533205038983, // 22 - 24 0.00448265656557320, 0.00756637578986661, 0.01231055921185645, // 25 - 27 0.01933897909628586, 0.02937957893118501, 0.04322868215173557, // 28 - 30 0.06169415311246963, 0.08552056725535230, 0.11530358493395564, // 31 - 33 0.15140421242317181, 0.19387553888107320, 0.24241419769010336, // 34 - 36 0.29634604081124799, 0.35465073607735026, 0.41602409951535269, // 37 - 39 0.47897113893894488, 0.54191817836253708, 0.60332992414165143, // 40 - 42 0.66181730107414127, 0.71622416333692251, 0.76568494721217817, // 43 - 45 0.80965008843462771, 0.84788064601936641, 0.88041729077233555, // 46 - 48 0.90753116139980983, 0.92966493334060518, 0.94737195089324144, // 49 - 51 0.96125980779726983, 0.97194277464652246, 0.98000539113652441, // 52 - 54 0.98597769964763704, 0.99032119674662800, 0.99342369467447866, // 55 - 57 0.99560088620279497, 0.99710239760163377, 0.99812037143135501, // 58 - 60 // // mu = 45 // 0.00000006567326820, 0.00000020321560857, 0.00000059005344086, // 15 - 17 0.00000161403593809, 0.00000417399218116, 0.00001023704644108, // 18 - 20 0.00002387891852589, 0.00005311150156478, 0.00011290542141704, // 21 - 23 0.00022989352547582, 0.00044924622058604, 0.00084408107178442, // 24 - 26 0.00152744908347393, 0.00266639576962312, 0.00449684580093431, // 27 - 29 0.00733719929779651, 0.01159772954308980, 0.01778237022174135, // 30 - 32 0.02647952117609509, 0.03833927247748656, 0.05403600214109291, // 33 - 35 0.07421751170858680, 0.09944439866795415, 0.13012574767259014, // 36 - 38 0.16645892412544852, 0.20838182003259281, 0.25554507792813014, // 39 - 41 0.30730962927689065, 0.36277164857913402, 0.42081329668613293, // 42 - 44 0.48017407315919997, 0.53953484963226706, 0.59760517444287609, // 45 - 47 0.65320442160196990, 0.70532871581362033, 0.75319796559982988, // 48 - 50 0.79628029040741855, 0.83429410641411439, 0.86719067795837046, // 51 - 53 0.89512172926953126, 0.91839760536216519, 0.93744150398341120, // 54 - 56 0.95274463680405530, 0.96482605745193217, 0.97419957347183672, // 57 - 59 0.98134886535142485, 0.98671083426111594, 0.99066638509613403, // 60 - 62 0.99353734941187288, 0.99558803820882924, 0.99702992876918917, // 63 - 65 // // mu = 50 // 0.00000047913573003, 0.00000123518722187, 0.00000303530982148, // 20 - 22 0.00000712649754788, 0.00001602038390960, 0.00003454931382985, // 23 - 25 0.00007160717367035, 0.00014287228874825, 0.00027484472407768, // 26 - 28 0.00051050978716595, 0.00091682886145608, 0.00159402731860629, // 29 - 31 0.00268628289465502, 0.00439293223223115, 0.00697876456189197, // 32 - 34 0.01078145916433434, 0.01621388002496630, 0.02375890899806624, // 35 - 37 0.03395489409684995, 0.04737066396367062, 0.06457036892113302, // 38 - 40 0.08607000011796101, 0.11228906255311710, 0.14350223211877911, // 41 - 43 0.17979661533466518, 0.22104023262544481, 0.26686647405964442, // 44 - 46 0.31667760605333961, 0.36966817200407920, 0.42486667820276625, // 47 - 49 0.48119168452795713, 0.53751669085314802, 0.59273728528960967, // 50 - 52 0.64583401070928437, 0.69592526110520381, 0.74230604850883297, // 53 - 55 0.78447040069395035, 0.82211714371637667, 0.85514060250797863, // 56 - 58 0.88360910146625615, 0.90773494804106769, 0.92783982018674394, // 59 - 61 0.94431922358483922, 0.95760906503491605, 0.96815655824926272, // 62 - 64 0.97639678732297108, 0.98273542507197753, 0.98753742336667938, // 65 - 67 0.99112100418362103, 0.99375599007843107, 0.99566540014713401, // 68 - 70 // // mu = 55 // 0.00000213352061032, 0.00000483888054397, 0.00001056175732670, // 25 - 27 0.00002221946929153, 0.00004511854636528, 0.00008854783047068, // 28 - 30 0.00016816818466391, 0.00030943010339383, 0.00055222402621089, // 31 - 33 0.00095688056423931, 0.00161147202281471, 0.00264011574343318, // 34 - 36 0.00421165476104474, 0.00654772627371058, 0.00992888241046376, // 37 - 39 0.01469717952639773, 0.02125358806080695, 0.03004877024111199, // 40 - 42 0.04156627071532098, 0.05629795736837898, 0.07471256568470150, // 43 - 45 0.09721930918242901, 0.12412954597319016, 0.15562024860067664, // 46 - 48 0.19170334536133821, 0.23220478050085630, 0.27675635915432617, // 49 - 51 0.32480217927081334, 0.37561987362479010, 0.42835521682231320, // 52 - 54 0.48206714044942006, 0.53577906407652687, 0.58853184621029253, // 55 - 57 0.63943365353234705, 0.68770260875153677, 0.73269909243044240, // 58 - 60 0.77394586913610586, 0.81113558583793366, 0.84412646355729692, // 61 - 63 0.87292802347102683, 0.89767936402188842, 0.91862280602646362, // 64 - 66 0.93607567436360961, 0.95040265583440109, 0.96199065555342367, // 67 - 69 0.97122746692365902, 0.97848496157170106, 0.98410696446807167, // 70 - 72 0.98840155001391028, 0.99163719665803529, 0.99404206916380389, // 73 - 75 // // mu = 60 // 0.00000687626496873, 0.00001417434333349, 0.00002829965629754, // 30 - 32 0.00005478461810514, 0.00010293909411895, 0.00018791758120215, // 33 - 35 0.00033359498763050, 0.00057639066501107, 0.00097011338508767, // 36 - 38 0.00159178083784020, 0.00254819230361332, 0.00398280950227300, // 39 - 41 0.00608224930518961, 0.00908144902364191, 0.01326637886334280, // 42 - 44 0.01897310137202582, 0.02658206471693651, 0.03650679951464611, // 45 - 47 0.04917667372448815, 0.06501401648679071, 0.08440668109369180, // 48 - 50 0.10767787862197310, 0.13505575806700992, 0.16664561896512933, // 51 - 53 0.20240772564224566, 0.24214339972793045, 0.28549140782140475, // 54 - 56 0.33193570220727009, 0.38082443313975994, 0.43139898238026669, // 57 - 59 0.48283072737061250, 0.53426247236095836, 0.58485107399080671, // 60 - 62 0.63380778524549863, 0.68043322453568145, 0.72414457387022779, // 63 - 65 0.76449351171750135, 0.80117436430593192, 0.83402288901198907, // 66 - 68 0.86300688139968662, 0.88821035304116269, 0.90981332873385645, // 69 - 71 0.92806936453049915, 0.94328272769436805, 0.95578686180165751, // 72 - 74 0.96592534891567605, 0.97403613860689087, 0.98043939362627097, // 75 - 77 0.98542894299202166, 0.98926705788875302, 0.99218208186095402, // 78 - 80 // // mu = 65 // 0.00001769335259280, 0.00003385901520079, 0.00006304701713189, // 35 - 37 0.00011432323674057, 0.00020203255975542, 0.00034821476478018, // 38 - 40 0.00058576084794540, 0.00096235829686589, 0.00154518768209997, // 41 - 43 0.00242620884582590, 0.00372771738314830, 0.00560767415928066, // 44 - 46 0.00826413482120682, 0.01193796339621108, 0.01691293959152935, // 47 - 49 0.02351239780980869, 0.03209169349357183, 0.04302608995326995, // 50 - 52 0.05669408552789261, 0.07345672160997699, 0.09363396874581931, // 53 - 55 0.11747980626999659, 0.14515801053913094, 0.17672087505656484, // 56 - 58 0.21209305080886146, 0.25106239697664584, 0.29327918865841229, // 59 - 61 0.33826429454881912, 0.38542609911134246, 0.43408510381870780, // 62 - 64 0.48350440547462570, 0.53292370713054360, 0.58159423148864453, // 65 - 67 0.62881190437336931, 0.67394644463082687, 0.71646448980089561, // 68 - 70 0.75594553174453083, 0.79209014760842222, 0.82472070359665750, // 71 - 73 0.85377530824371628, 0.87929624475802470, 0.90141438973709198, // 74 - 76 0.92033122425866276, 0.93629998067297571, 0.94960727768490316, // 77 - 79 0.96055631953015996, 0.96945241602943111, 0.97659125889921661, // 80 - 82 0.98225009775941241, 0.98668171855354170, 0.99011094892995122, // 83 - 85 // // mu = 70 // 0.00003863938607251, 0.00006966088646657, 0.00012262442372470, // 40 - 42 0.00021089698582160, 0.00035459650551422, 0.00058320937775248, // 43 - 45 0.00093882940123421, 0.00147999030653251, 0.00228597463357252, // 46 - 48 0.00346136844383920, 0.00514050245850589, 0.00749129007903926, // 49 - 51 0.01071786132290859, 0.01506132261273268, 0.02079796959929281, // 52 - 54 0.02823436384113001, 0.03769886560346826, 0.04952949280639107, // 55 - 57 0.06405833323103313, 0.08159314064008388, 0.10239714943048309, // 58 - 60 0.12666849301928215, 0.15452085451462536, 0.18596706910614186, // 61 - 63 0.22090730754116022, 0.25912319332946154, 0.30027876263993991, // 64 - 66 0.34392860887832605, 0.38953292584380406, 0.43647854624944321, // 67 - 69 0.48410453796530900, 0.53173052968117485, 0.57868573278132418, // 70 - 72 0.62433662468424722, 0.66811145253636517, 0.70952007347755786, // 73 - 75 0.74816811968933772, 0.78376500435808227, 0.81612580860239547, // 76 - 78 0.84516755600113813, 0.87090074989875821, 0.89341729455917573, // 79 - 81 0.91287603685830199, 0.92948715833316586, 0.94349653789027998, // 82 - 84 0.95517102085454175, 0.96478530094275738, 0.97261087775874677, // 85 - 87 0.97890731887506011, 0.98391585158121841, 0.98785514696808452, // 88 - 90 // // mu = 75 // 0.00007457087798458, 0.00012800994272557, 0.00021513885262936, // 45 - 47 0.00035417434715669, 0.00057141730735563, 0.00090393204235401, // 48 - 50 0.00140270414485158, 0.00213619253087742, 0.00319410847226085, // 51 - 53 0.00469115933270909, 0.00677039663888721, 0.00960572023822101, // 54 - 56 0.01340302863018591, 0.01839948704066605, 0.02486042464042485, // 57 - 59 0.03307348091130468, 0.04333980124990447, 0.05596232625637962, // 60 - 62 0.07123150973195440, 0.08940910910763866, 0.11071098337601866, // 63 - 65 0.13529006907030328, 0.16322084826835398, 0.19448664587811221, // 66 - 68 0.22897098147711026, 0.26645395495428204, 0.30661428367982324, // 69 - 71 0.34903716613638086, 0.39322766869529502, 0.43862886995445344, // 72 - 74 0.48464360096035725, 0.53065833196626100, 0.57606760598524498, // 75 - 77 0.62029741834139829, 0.66282608406846877, 0.70320139963214323, // 78 - 80 0.74105325797308808, 0.77610127495544434, 0.80815738804906290, // 81 - 83 0.83712375530233274, 0.86298658320703792, 0.88580672547589545, // 84 - 86 0.90570801233827114, 0.92286429411618121, 0.93748612517690000, // 87 - 89 0.94980789292469681, 0.96007603271452746, 0.96853878528856374, // 90 - 92 0.97543776836522378, 0.98100146439478830, 0.98544058356731312, // 93 - 95 // // mu = 80 // 0.00013078397659141, 0.00021548056648791, 0.00034833796240399, // 50 - 52 0.00055273395612104, 0.00086125621078829, 0.00131832621770272, // 53 - 55 0.00198315531866918, 0.00293291117719268, 0.00426590185582216, // 56 - 58 0.00610450968841455, 0.00859753725803134, 0.01192157401752040, // 59 - 61 0.01628096648898145, 0.02190598903280217, 0.02904887480273325, // 62 - 64 0.03797748201514709, 0.04896653704581028, 0.06228660374964445, // 65 - 67 0.07819116100795391, 0.09690240484125916, 0.11859660059001886, // 68 - 70 0.14338996716002994, 0.17132615484454947, 0.20236636338290451, // 71 - 73 0.23638303027425250, 0.27315780529192601, 0.31238423197744442, // 74 - 76 0.35367520743588482, 0.39657492219790086, 0.44057462964612243, // 77 - 79 0.48513129541647337, 0.52968796118682437, 0.57369454466371417, // 80 - 82 0.61662779683628965, 0.65800924471347078, 0.69742014745364322, // 83 - 85 0.73451276179733505, 0.76901751932635065, 0.80074603199670980, // 86 - 88 0.82959013442430907, 0.85551741750529720, 0.87856389135506441, // 89 - 91 0.89882452770650811, 0.91644247235993737, 0.93159769356718836, // 92 - 94 0.94449575416910414, 0.95535727888650690, 0.96440854948434251, // 95 - 97 0.97187351492585639, 0.97796736426586772, 0.98289168696486684, // 98 - 100 // // mu = 85 // 0.00021264747685098, 0.00033834572974723, 0.00052913772075048, // 55 - 57 0.00081365209329917, 0.00123061281168951, 0.00183131893140439, // 58 - 60 0.00268231926766715, 0.00386813940836116, 0.00549386056899003, // 61 - 63 0.00768729388094963, 0.01060044749839597, 0.01440995607505656, // 64 - 66 0.01931614136318006, 0.02554040628094867, 0.03332073742815944, // 67 - 69 0.04290520333414372, 0.05454348336283891, 0.06847663550986836, // 70 - 72 0.08492549568344480, 0.10407827807733518, 0.12607809569193898, // 73 - 75 0.15101122232182329, 0.17889695605261496, 0.20967990887232005, // 76 - 78 0.24322543438097305, 0.27931872132066299, 0.31766783869408355, // 79 - 81 0.35791073964150016, 0.39962594184309058, 0.44234632963990006, // 82 - 84 0.48557529348190964, 0.52880425732391922, 0.57153055879567283, // 85 - 87 0.61327464644048957, 0.65359564018832395, 0.69210445444187363, // 88 - 90 0.72847389012578168, 0.76244534103932216, 0.79383200764422368, // 91 - 93 0.82251874593902619, 0.84845888163113481, 0.87166847672407410, // 94 - 96 0.89221863904594745, 0.91022651324552717, 0.92584558780638715, // 97 - 99 0.93925590434853967, 0.95065467340936927, 0.96024769687640410, // 100 - 102 0.96824188309893311, 0.97483902706898129, 0.98023092358296304, // 103 - 105 // // mu = 90 // 0.00032528901091254, 0.00050224788470280, 0.00076333474767204, // 60 - 62 0.00114233180682093, 0.00168375617703363, 0.00244513419764524, // 63 - 65 0.00349934991849209, 0.00493691681055597, 0.00686797681482089, // 66 - 68 0.00942379152634798, 0.01275746288920941, 0.01704361178431697, // 69 - 71 0.02247675827107302, 0.02926819137951808, 0.03764119110225857, // 72 - 74 0.04782456914342945, 0.06004462279283449, 0.07451573895660363, // 75 - 77 0.09143003057659352, 0.11094652090735108, 0.13318049723353059, // 78 - 80 0.15819372060048253, 0.18598619100820693, 0.21649012194351419, // 81 - 83 0.24956667356011242, 0.28500583600646767, 0.32252965506731440, // 84 - 86 0.36179876803796795, 0.40242198835243714, 0.44396846367405335, // 87 - 89 0.48598175332512594, 0.52799504297619848, 0.56954664812561095, // 90 - 92 0.61019495751090569, 0.64953203110957802, 0.68719518668277502, // 93 - 95 0.72287607091001427, 0.75632689987305102, 0.78736375148823978, // 96 - 98 0.81586698256341317, 0.84177901081357076, 0.86509983623871256, // 99 - 101 0.88588076978586860, 0.90421688762159458, 0.92023873815766577, // 102 - 104 0.93410380112157354, 0.94598814080492311, 0.95607861789455950, // 105 - 107 0.96456593507275834, 0.97163869938792402, 0.97747859652888658, // 108 - 110 // // mu = 95 // 0.00047336010596951, 0.00071199190148983, 0.00105547706170846, // 65 - 67 0.00154250825903339, 0.00222291949059028, 0.00315971756302367, // 68 - 70 0.00443108637561185, 0.00613221366006082, 0.00837675660481988, // 71 - 73 0.01129773714936934, 0.01504764460520987, 0.01979752738260786, // 74 - 76 0.02573488085435536, 0.03306018708573214, 0.04198203441881924, // 77 - 79 0.05271083817379741, 0.06545129263283397, 0.08039380094898797, // 80 - 82 0.09770524351038590, 0.11751954523728714, 0.13992857695223498, // 83 - 85 0.16497396533952963, 0.19264038274409928, 0.22285083853069834, // 86 - 88 0.25546439875486776, 0.29027662596044190, 0.32702286578854789, // 89 - 91 0.36538432494975748, 0.40499670125752824, 0.44546095662568114, // 92 - 94 0.48635568279562291, 0.52725040896556474, 0.56771914840456961, // 95 - 97 0.60735348084483209, 0.64577451739406622, 0.68264318883019992, // 98 - 100 0.71766842669452691, 0.75061295735899292, 0.78129658886021125, // 101 - 103 0.80959702568172331, 0.83544838623983531, 0.85883771245907947, // 104 - 106 0.87979984444802473, 0.89841108312979856, 0.91478208011839590, // 107 - 109 0.92905038024607245, 0.94137300308361127, 0.95191939199862197, // 110 - 112 0.96086498973903289, 0.96838562500751990, 0.97465282106459239, // 113 - 115 clhep-2.1.4.1.orig/Random/gaussQTables.cdat0000755000175000017500000015051207705060311017056 0ustar olesoles -4.6113823623f, // 2e-06 -4.4651839156f, // 4e-06 -4.3775878467f, // 6e-06 -4.3144510218f, // 8e-06 -4.2648907939f, // 1e-05 -4.2240037997f, // 1.2e-05 -4.1891510367f, // 1.4e-05 -4.1587456337f, // 1.6e-05 -4.1317575671f, // 1.8e-05 -4.1074796546f, // 2e-05 -4.0854050037f, // 2.2e-05 -4.0651576754f, // 2.4e-05 -4.0464510151f, // 2.6e-05 -4.0290613661f, // 2.8e-05 -4.0128108111f, // 3e-05 -3.9975554567f, // 3.2e-05 -3.9831772489f, // 3.4e-05 -3.9695781159f, // 3.6e-05 -3.9566756837f, // 3.8e-05 -3.9444000842f, // 4e-05 -3.9326915371f, // 4.2e-05 -3.9214984902f, // 4.4e-05 -3.9107761701f, // 4.6e-05 -3.9004854397f, // 4.8e-05 -3.8905918864f, // 5e-05 -3.8810650888f, // 5.2e-05 -3.8718780197f, // 5.4e-05 -3.8630065578f, // 5.6e-05 -3.8544290838f, // 5.8e-05 -3.8461261445f, // 6e-05 -3.8380801721f, // 6.2e-05 -3.8302752465f, // 6.4e-05 -3.8226968956f, // 6.6e-05 -3.8153319235f, // 6.8e-05 -3.8081682645f, // 7e-05 -3.8011948567f, // 7.2e-05 -3.7944015339f, // 7.4e-05 -3.7877789304f, // 7.6e-05 -3.7813183991f, // 7.8e-05 -3.7750119394f, // 8e-05 -3.7688521341f, // 8.2e-05 -3.7628320938f, // 8.4e-05 -3.7569454079f, // 8.6e-05 -3.7511861008f, // 8.8e-05 -3.7455485932f, // 9e-05 -3.7400276683f, // 9.2e-05 -3.7346184400f, // 9.4e-05 -3.7293163263f, // 9.6e-05 -3.7241170236f, // 9.8e-05 -3.7190164855f, // 0.0001 -3.7140109015f, // 0.000102 -3.7090966800f, // 0.000104 -3.7042704310f, // 0.000106 -3.6995289516f, // 0.000108 -3.6948692123f, // 0.00011 -3.6902883448f, // 0.000112 -3.6857836303f, // 0.000114 -3.6813524899f, // 0.000116 -3.6769924745f, // 0.000118 -3.6727012567f, // 0.00012 -3.6684766222f, // 0.000122 -3.6643164633f, // 0.000124 -3.6602187717f, // 0.000126 -3.6561816322f, // 0.000128 -3.6522032175f, // 0.00013 -3.6482817824f, // 0.000132 -3.6444156591f, // 0.000134 -3.6406032527f, // 0.000136 -3.6368430372f, // 0.000138 -3.6331335509f, // 0.00014 -3.6294733938f, // 0.000142 -3.6258612232f, // 0.000144 -3.6222957511f, // 0.000146 -3.6187757415f, // 0.000148 -3.6153000069f, // 0.00015 -3.6118674065f, // 0.000152 -3.6084768432f, // 0.000154 -3.6051272620f, // 0.000156 -3.6018176471f, // 0.000158 -3.5985470207f, // 0.00016 -3.5953144407f, // 0.000162 -3.5921189991f, // 0.000164 -3.5889598203f, // 0.000166 -3.5858360597f, // 0.000168 -3.5827469021f, // 0.00017 -3.5796915604f, // 0.000172 -3.5766692745f, // 0.000174 -3.5736793095f, // 0.000176 -3.5707209555f, // 0.000178 -3.5677935256f, // 0.00018 -3.5648963555f, // 0.000182 -3.5620288020f, // 0.000184 -3.5591902428f, // 0.000186 -3.5563800750f, // 0.000188 -3.5535977144f, // 0.00019 -3.5508425950f, // 0.000192 -3.5481141681f, // 0.000194 -3.5454119014f, // 0.000196 -3.5427352788f, // 0.000198 -3.5400837992f, // 0.0002 -3.5374569764f, // 0.000202 -3.5348543383f, // 0.000204 -3.5322754262f, // 0.000206 -3.5297197946f, // 0.000208 -3.5271870107f, // 0.00021 -3.5246766534f, // 0.000212 -3.5221883136f, // 0.000214 -3.5197215934f, // 0.000216 -3.5172761054f, // 0.000218 -3.5148514730f, // 0.00022 -3.5124473294f, // 0.000222 -3.5100633175f, // 0.000224 -3.5076990897f, // 0.000226 -3.5053543074f, // 0.000228 -3.5030286405f, // 0.00023 -3.5007217675f, // 0.000232 -3.4984333751f, // 0.000234 -3.4961631577f, // 0.000236 -3.4939108173f, // 0.000238 -3.4916760634f, // 0.00024 -3.4894586125f, // 0.000242 -3.4872581879f, // 0.000244 -3.4850745196f, // 0.000246 -3.4829073442f, // 0.000248 -3.4807564043f, // 0.00025 -3.4786214488f, // 0.000252 -3.4765022321f, // 0.000254 -3.4743985145f, // 0.000256 -3.4723100619f, // 0.000258 -3.4702366452f, // 0.00026 -3.4681780408f, // 0.000262 -3.4661340299f, // 0.000264 -3.4641043987f, // 0.000266 -3.4620889379f, // 0.000268 -3.4600874430f, // 0.00027 -3.4580997140f, // 0.000272 -3.4561255549f, // 0.000274 -3.4541647741f, // 0.000276 -3.4522171842f, // 0.000278 -3.4502826015f, // 0.00028 -3.4483608463f, // 0.000282 -3.4464517426f, // 0.000284 -3.4445551180f, // 0.000286 -3.4426708038f, // 0.000288 -3.4407986346f, // 0.00029 -3.4389384482f, // 0.000292 -3.4370900860f, // 0.000294 -3.4352533924f, // 0.000296 -3.4334282148f, // 0.000298 -3.4316144036f, // 0.0003 -3.4298118124f, // 0.000302 -3.4280202974f, // 0.000304 -3.4262397175f, // 0.000306 -3.4244699347f, // 0.000308 -3.4227108131f, // 0.00031 -3.4209622198f, // 0.000312 -3.4192240242f, // 0.000314 -3.4174960981f, // 0.000316 -3.4157783160f, // 0.000318 -3.4140705542f, // 0.00032 -3.4123726918f, // 0.000322 -3.4106846097f, // 0.000324 -3.4090061911f, // 0.000326 -3.4073373214f, // 0.000328 -3.4056778880f, // 0.00033 -3.4040277801f, // 0.000332 -3.4023868892f, // 0.000334 -3.4007551085f, // 0.000336 -3.3991323330f, // 0.000338 -3.3975184598f, // 0.00034 -3.3959133874f, // 0.000342 -3.3943170164f, // 0.000344 -3.3927292489f, // 0.000346 -3.3911499887f, // 0.000348 -3.3895791411f, // 0.00035 -3.3880166133f, // 0.000352 -3.3864623138f, // 0.000354 -3.3849161527f, // 0.000356 -3.3833780414f, // 0.000358 -3.3818478931f, // 0.00036 -3.3803256222f, // 0.000362 -3.3788111444f, // 0.000364 -3.3773043770f, // 0.000366 -3.3758052385f, // 0.000368 -3.3743136486f, // 0.00037 -3.3728295284f, // 0.000372 -3.3713528003f, // 0.000374 -3.3698833878f, // 0.000376 -3.3684212156f, // 0.000378 -3.3669662096f, // 0.00038 -3.3655182970f, // 0.000382 -3.3640774057f, // 0.000384 -3.3626434652f, // 0.000386 -3.3612164058f, // 0.000388 -3.3597961588f, // 0.00039 -3.3583826566f, // 0.000392 -3.3569758328f, // 0.000394 -3.3555756218f, // 0.000396 -3.3541819589f, // 0.000398 -3.3527947805f, // 0.0004 -3.3514140239f, // 0.000402 -3.3500396274f, // 0.000404 -3.3486715300f, // 0.000406 -3.3473096717f, // 0.000408 -3.3459539933f, // 0.00041 -3.3446044366f, // 0.000412 -3.3432609441f, // 0.000414 -3.3419234590f, // 0.000416 -3.3405919257f, // 0.000418 -3.3392662890f, // 0.00042 -3.3379464945f, // 0.000422 -3.3366324888f, // 0.000424 -3.3353242190f, // 0.000426 -3.3340216330f, // 0.000428 -3.3327246795f, // 0.00043 -3.3314333079f, // 0.000432 -3.3301474681f, // 0.000434 -3.3288671108f, // 0.000436 -3.3275921875f, // 0.000438 -3.3263226501f, // 0.00044 -3.3250584513f, // 0.000442 -3.3237995443f, // 0.000444 -3.3225458831f, // 0.000446 -3.3212974222f, // 0.000448 -3.3200541167f, // 0.00045 -3.3188159223f, // 0.000452 -3.3175827952f, // 0.000454 -3.3163546923f, // 0.000456 -3.3151315709f, // 0.000458 -3.3139133891f, // 0.00046 -3.3127001052f, // 0.000462 -3.3114916783f, // 0.000464 -3.3102880679f, // 0.000466 -3.3090892340f, // 0.000468 -3.3078951372f, // 0.00047 -3.3067057384f, // 0.000472 -3.3055209992f, // 0.000474 -3.3043408816f, // 0.000476 -3.3031653480f, // 0.000478 -3.3019943613f, // 0.00048 -3.3008278849f, // 0.000482 -3.2996658826f, // 0.000484 -3.2985083187f, // 0.000486 -3.2973551578f, // 0.000488 -3.2962063651f, // 0.00049 -3.2950619061f, // 0.000492 -3.2939217466f, // 0.000494 -3.2927858532f, // 0.000496 -3.2916541924f, // 0.000498 -3.2905267315f, // 0.0005 -3.2905267315f, // 0.0005 -3.0902323062f, // 0.001 -2.9677379253f, // 0.0015 -2.8781617391f, // 0.002 -2.8070337683f, // 0.0025 -2.7477813854f, // 0.003 -2.6968442609f, // 0.0035 -2.6520698079f, // 0.004 -2.6120541412f, // 0.0045 -2.5758293035f, // 0.005 -2.5426988194f, // 0.0055 -2.5121443279f, // 0.006 -2.4837692933f, // 0.0065 -2.4572633902f, // 0.007 -2.4323790586f, // 0.0075 -2.4089155458f, // 0.008 -2.3867077345f, // 0.0085 -2.3656181269f, // 0.009 -2.3455309708f, // 0.0095 -2.3263478740f, // 0.01 -2.3079844749f, // 0.0105 -2.2903678779f, // 0.011 -2.2734346509f, // 0.0115 -2.2571292445f, // 0.012 -2.2414027276f, // 0.0125 -2.2262117693f, // 0.013 -2.2115178092f, // 0.0135 -2.1972863766f, // 0.014 -2.1834865280f, // 0.0145 -2.1700903776f, // 0.015 -2.1570727045f, // 0.0155 -2.1444106209f, // 0.016 -2.1320832908f, // 0.0165 -2.1200716897f, // 0.017 -2.1083583992f, // 0.0175 -2.0969274292f, // 0.018 -2.0857640651f, // 0.0185 -2.0748547344f, // 0.019 -2.0641868904f, // 0.0195 -2.0537489106f, // 0.02 -2.0435300074f, // 0.0205 -2.0335201493f, // 0.021 -2.0237099909f, // 0.0215 -2.0140908120f, // 0.022 -2.0046544618f, // 0.0225 -1.9953933102f, // 0.023 -1.9863002041f, // 0.0235 -1.9773684282f, // 0.024 -1.9685916692f, // 0.0245 -1.9599639845f, // 0.025 -1.9514797735f, // 0.0255 -1.9431337511f, // 0.026 -1.9349209249f, // 0.0265 -1.9268365733f, // 0.027 -1.9188762262f, // 0.0275 -1.9110356475f, // 0.028 -1.9033108187f, // 0.0285 -1.8956979240f, // 0.029 -1.8881933370f, // 0.0295 -1.8807936082f, // 0.03 -1.8734954534f, // 0.0305 -1.8662957435f, // 0.031 -1.8591914945f, // 0.0315 -1.8521798588f, // 0.032 -1.8452581168f, // 0.0325 -1.8384236692f, // 0.033 -1.8316740304f, // 0.0335 -1.8250068211f, // 0.034 -1.8184197631f, // 0.0345 -1.8119106730f, // 0.035 -1.8054774571f, // 0.0355 -1.7991181068f, // 0.036 -1.7928306938f, // 0.0365 -1.7866133655f, // 0.037 -1.7804643417f, // 0.0375 -1.7743819103f, // 0.038 -1.7683644243f, // 0.0385 -1.7624102979f, // 0.039 -1.7565180040f, // 0.0395 -1.7506860713f, // 0.04 -1.7449130811f, // 0.0405 -1.7391976653f, // 0.041 -1.7335385038f, // 0.0415 -1.7279343224f, // 0.042 -1.7223838903f, // 0.0425 -1.7168860184f, // 0.043 -1.7114395577f, // 0.0435 -1.7060433969f, // 0.044 -1.7006964611f, // 0.0445 -1.6953977103f, // 0.045 -1.6901461375f, // 0.0455 -1.6849407679f, // 0.046 -1.6797806568f, // 0.0465 -1.6746648890f, // 0.047 -1.6695925773f, // 0.0475 -1.6645628612f, // 0.048 -1.6595749062f, // 0.0485 -1.6546279024f, // 0.049 -1.6497210637f, // 0.0495 -1.6448536270f, // 0.05 -1.6400248509f, // 0.0505 -1.6352340154f, // 0.051 -1.6304804206f, // 0.0515 -1.6257633862f, // 0.052 -1.6210822509f, // 0.0525 -1.6164363711f, // 0.053 -1.6118251211f, // 0.0535 -1.6072478919f, // 0.054 -1.6027040906f, // 0.0545 -1.5981931399f, // 0.055 -1.5937144779f, // 0.0555 -1.5892675571f, // 0.056 -1.5848518438f, // 0.0565 -1.5804668184f, // 0.057 -1.5761119740f, // 0.0575 -1.5717868165f, // 0.058 -1.5674908641f, // 0.0585 -1.5632236469f, // 0.059 -1.5589847062f, // 0.0595 -1.5547735946f, // 0.06 -1.5505898754f, // 0.0605 -1.5464331223f, // 0.061 -1.5423029188f, // 0.0615 -1.5381988586f, // 0.062 -1.5341205444f, // 0.0625 -1.5300675881f, // 0.063 -1.5260396108f, // 0.0635 -1.5220362417f, // 0.064 -1.5180571187f, // 0.0645 -1.5141018876f, // 0.065 -1.5101702020f, // 0.0655 -1.5062617233f, // 0.066 -1.5023761200f, // 0.0665 -1.4985130679f, // 0.067 -1.4946722498f, // 0.0675 -1.4908533552f, // 0.068 -1.4870560803f, // 0.0685 -1.4832801273f, // 0.069 -1.4795252051f, // 0.0695 -1.4757910282f, // 0.07 -1.4720773172f, // 0.0705 -1.4683837982f, // 0.071 -1.4647102032f, // 0.0715 -1.4610562692f, // 0.072 -1.4574217386f, // 0.0725 -1.4538063589f, // 0.073 -1.4502098827f, // 0.0735 -1.4466320672f, // 0.074 -1.4430726744f, // 0.0745 -1.4395314709f, // 0.075 -1.4360082279f, // 0.0755 -1.4325027208f, // 0.076 -1.4290147293f, // 0.0765 -1.4255440371f, // 0.077 -1.4220904321f, // 0.0775 -1.4186537062f, // 0.078 -1.4152336548f, // 0.0785 -1.4118300775f, // 0.079 -1.4084427771f, // 0.0795 -1.4050715603f, // 0.08 -1.4017162371f, // 0.0805 -1.3983766208f, // 0.081 -1.3950525283f, // 0.0815 -1.3917437794f, // 0.082 -1.3884501973f, // 0.0825 -1.3851716082f, // 0.083 -1.3819078413f, // 0.0835 -1.3786587286f, // 0.084 -1.3754241053f, // 0.0845 -1.3722038090f, // 0.085 -1.3689976804f, // 0.0855 -1.3658055626f, // 0.086 -1.3626273015f, // 0.0865 -1.3594627454f, // 0.087 -1.3563117453f, // 0.0875 -1.3531741545f, // 0.088 -1.3500498288f, // 0.0885 -1.3469386261f, // 0.089 -1.3438404069f, // 0.0895 -1.3407550337f, // 0.09 -1.3376823713f, // 0.0905 -1.3346222867f, // 0.091 -1.3315746489f, // 0.0915 -1.3285393289f, // 0.092 -1.3255161998f, // 0.0925 -1.3225051367f, // 0.093 -1.3195060167f, // 0.0935 -1.3165187184f, // 0.094 -1.3135431227f, // 0.0945 -1.3105791122f, // 0.095 -1.3076265710f, // 0.0955 -1.3046853852f, // 0.096 -1.3017554426f, // 0.0965 -1.2988366326f, // 0.097 -1.2959288463f, // 0.0975 -1.2930319761f, // 0.098 -1.2901459165f, // 0.0985 -1.2872705631f, // 0.099 -1.2844058132f, // 0.0995 -1.2815515655f, // 0.1 -1.2787077203f, // 0.1005 -1.2758741791f, // 0.101 -1.2730508450f, // 0.1015 -1.2702376224f, // 0.102 -1.2674344169f, // 0.1025 -1.2646411357f, // 0.103 -1.2618576870f, // 0.1035 -1.2590839804f, // 0.104 -1.2563199269f, // 0.1045 -1.2535654385f, // 0.105 -1.2508204284f, // 0.1055 -1.2480848111f, // 0.106 -1.2453585023f, // 0.1065 -1.2426414186f, // 0.107 -1.2399334779f, // 0.1075 -1.2372345992f, // 0.108 -1.2345447024f, // 0.1085 -1.2318637087f, // 0.109 -1.2291915402f, // 0.1095 -1.2265281200f, // 0.11 -1.2238733723f, // 0.1105 -1.2212272221f, // 0.111 -1.2185895956f, // 0.1115 -1.2159604197f, // 0.112 -1.2133396225f, // 0.1125 -1.2107271328f, // 0.113 -1.2081228804f, // 0.1135 -1.2055267960f, // 0.114 -1.2029388111f, // 0.1145 -1.2003588580f, // 0.115 -1.1977868701f, // 0.1155 -1.1952227814f, // 0.116 -1.1926665268f, // 0.1165 -1.1901180419f, // 0.117 -1.1875772632f, // 0.1175 -1.1850441279f, // 0.118 -1.1825185740f, // 0.1185 -1.1800005403f, // 0.119 -1.1774899663f, // 0.1195 -1.1749867921f, // 0.12 -1.1724909586f, // 0.1205 -1.1700024075f, // 0.121 -1.1675210811f, // 0.1215 -1.1650469223f, // 0.122 -1.1625798748f, // 0.1225 -1.1601198830f, // 0.123 -1.1576668917f, // 0.1235 -1.1552208466f, // 0.124 -1.1527816939f, // 0.1245 -1.1503493804f, // 0.125 -1.1479238535f, // 0.1255 -1.1455050614f, // 0.126 -1.1430929526f, // 0.1265 -1.1406874763f, // 0.127 -1.1382885824f, // 0.1275 -1.1358962212f, // 0.128 -1.1335103435f, // 0.1285 -1.1311309008f, // 0.129 -1.1287578452f, // 0.1295 -1.1263911290f, // 0.13 -1.1240307054f, // 0.1305 -1.1216765279f, // 0.131 -1.1193285506f, // 0.1315 -1.1169867279f, // 0.132 -1.1146510149f, // 0.1325 -1.1123213672f, // 0.133 -1.1099977408f, // 0.1335 -1.1076800921f, // 0.134 -1.1053683781f, // 0.1345 -1.1030625562f, // 0.135 -1.1007625842f, // 0.1355 -1.0984684203f, // 0.136 -1.0961800234f, // 0.1365 -1.0938973526f, // 0.137 -1.0916203674f, // 0.1375 -1.0893490279f, // 0.138 -1.0870832945f, // 0.1385 -1.0848231279f, // 0.139 -1.0825684895f, // 0.1395 -1.0803193408f, // 0.14 -1.0780756439f, // 0.1405 -1.0758373610f, // 0.141 -1.0736044551f, // 0.1415 -1.0713768893f, // 0.142 -1.0691546270f, // 0.1425 -1.0669376322f, // 0.143 -1.0647258691f, // 0.1435 -1.0625193023f, // 0.144 -1.0603178967f, // 0.1445 -1.0581216177f, // 0.145 -1.0559304308f, // 0.1455 -1.0537443021f, // 0.146 -1.0515631979f, // 0.1465 -1.0493870847f, // 0.147 -1.0472159295f, // 0.1475 -1.0450496997f, // 0.148 -1.0428883627f, // 0.1485 -1.0407318865f, // 0.149 -1.0385802392f, // 0.1495 -1.0364333895f, // 0.15 -1.0342913060f, // 0.1505 -1.0321539580f, // 0.151 -1.0300213147f, // 0.1515 -1.0278933458f, // 0.152 -1.0257700214f, // 0.1525 -1.0236513116f, // 0.153 -1.0215371869f, // 0.1535 -1.0194276182f, // 0.154 -1.0173225766f, // 0.1545 -1.0152220332f, // 0.155 -1.0131259598f, // 0.1555 -1.0110343281f, // 0.156 -1.0089471104f, // 0.1565 -1.0068642788f, // 0.157 -1.0047858061f, // 0.1575 -1.0027116650f, // 0.158 -1.0006418288f, // 0.1585 -0.9985762706f, // 0.159 -0.9965149642f, // 0.1595 -0.9944578832f, // 0.16 -0.9924050018f, // 0.1605 -0.9903562942f, // 0.161 -0.9883117349f, // 0.1615 -0.9862712987f, // 0.162 -0.9842349604f, // 0.1625 -0.9822026953f, // 0.163 -0.9801744787f, // 0.1635 -0.9781502863f, // 0.164 -0.9761300937f, // 0.1645 -0.9741138771f, // 0.165 -0.9721016126f, // 0.1655 -0.9700932766f, // 0.166 -0.9680888459f, // 0.1665 -0.9660882971f, // 0.167 -0.9640916074f, // 0.1675 -0.9620987539f, // 0.168 -0.9601097141f, // 0.1685 -0.9581244654f, // 0.169 -0.9561429858f, // 0.1695 -0.9541652531f, // 0.17 -0.9521912456f, // 0.1705 -0.9502209415f, // 0.171 -0.9482543194f, // 0.1715 -0.9462913580f, // 0.172 -0.9443320360f, // 0.1725 -0.9423763326f, // 0.173 -0.9404242269f, // 0.1735 -0.9384756984f, // 0.174 -0.9365307266f, // 0.1745 -0.9345892911f, // 0.175 -0.9326513718f, // 0.1755 -0.9307169489f, // 0.176 -0.9287860024f, // 0.1765 -0.9268585128f, // 0.177 -0.9249344605f, // 0.1775 -0.9230138263f, // 0.178 -0.9210965908f, // 0.1785 -0.9191827351f, // 0.179 -0.9172722404f, // 0.1795 -0.9153650878f, // 0.18 -0.9134612589f, // 0.1805 -0.9115607351f, // 0.181 -0.9096634981f, // 0.1815 -0.9077695299f, // 0.182 -0.9058788123f, // 0.1825 -0.9039913276f, // 0.183 -0.9021070579f, // 0.1835 -0.9002259857f, // 0.184 -0.8983480935f, // 0.1845 -0.8964733640f, // 0.185 -0.8946017800f, // 0.1855 -0.8927333243f, // 0.186 -0.8908679801f, // 0.1865 -0.8890057306f, // 0.187 -0.8871465590f, // 0.1875 -0.8852904488f, // 0.188 -0.8834373836f, // 0.1885 -0.8815873470f, // 0.189 -0.8797403228f, // 0.1895 -0.8778962951f, // 0.19 -0.8760552477f, // 0.1905 -0.8742171649f, // 0.191 -0.8723820309f, // 0.1915 -0.8705498302f, // 0.192 -0.8687205472f, // 0.1925 -0.8668941666f, // 0.193 -0.8650706731f, // 0.1935 -0.8632500516f, // 0.194 -0.8614322869f, // 0.1945 -0.8596173642f, // 0.195 -0.8578052687f, // 0.1955 -0.8559959855f, // 0.196 -0.8541895001f, // 0.1965 -0.8523857980f, // 0.197 -0.8505848647f, // 0.1975 -0.8487866859f, // 0.198 -0.8469912475f, // 0.1985 -0.8451985353f, // 0.199 -0.8434085353f, // 0.1995 -0.8416212336f, // 0.2 -0.8398366163f, // 0.2005 -0.8380546699f, // 0.201 -0.8362753805f, // 0.2015 -0.8344987348f, // 0.202 -0.8327247193f, // 0.2025 -0.8309533206f, // 0.203 -0.8291845254f, // 0.2035 -0.8274183207f, // 0.204 -0.8256546933f, // 0.2045 -0.8238936303f, // 0.205 -0.8221351188f, // 0.2055 -0.8203791460f, // 0.206 -0.8186256991f, // 0.2065 -0.8168747655f, // 0.207 -0.8151263327f, // 0.2075 -0.8133803882f, // 0.208 -0.8116369197f, // 0.2085 -0.8098959147f, // 0.209 -0.8081573612f, // 0.2095 -0.8064212470f, // 0.21 -0.8046875600f, // 0.2105 -0.8029562883f, // 0.211 -0.8012274199f, // 0.2115 -0.7995009431f, // 0.212 -0.7977768461f, // 0.2125 -0.7960551173f, // 0.213 -0.7943357450f, // 0.2135 -0.7926187177f, // 0.214 -0.7909040241f, // 0.2145 -0.7891916527f, // 0.215 -0.7874815922f, // 0.2155 -0.7857738315f, // 0.216 -0.7840683594f, // 0.2165 -0.7823651649f, // 0.217 -0.7806642368f, // 0.2175 -0.7789655643f, // 0.218 -0.7772691366f, // 0.2185 -0.7755749428f, // 0.219 -0.7738829722f, // 0.2195 -0.7721932142f, // 0.22 -0.7705056581f, // 0.2205 -0.7688202935f, // 0.221 -0.7671371098f, // 0.2215 -0.7654560967f, // 0.222 -0.7637772438f, // 0.2225 -0.7621005410f, // 0.223 -0.7604259779f, // 0.2235 -0.7587535445f, // 0.224 -0.7570832307f, // 0.2245 -0.7554150264f, // 0.225 -0.7537489217f, // 0.2255 -0.7520849067f, // 0.226 -0.7504229716f, // 0.2265 -0.7487631066f, // 0.227 -0.7471053020f, // 0.2275 -0.7454495482f, // 0.228 -0.7437958355f, // 0.2285 -0.7421441544f, // 0.229 -0.7404944954f, // 0.2295 -0.7388468492f, // 0.23 -0.7372012063f, // 0.2305 -0.7355575574f, // 0.231 -0.7339158933f, // 0.2315 -0.7322762047f, // 0.232 -0.7306384826f, // 0.2325 -0.7290027178f, // 0.233 -0.7273689013f, // 0.2335 -0.7257370241f, // 0.234 -0.7241070773f, // 0.2345 -0.7224790519f, // 0.235 -0.7208529392f, // 0.2355 -0.7192287304f, // 0.236 -0.7176064168f, // 0.2365 -0.7159859896f, // 0.237 -0.7143674403f, // 0.2375 -0.7127507602f, // 0.238 -0.7111359409f, // 0.2385 -0.7095229738f, // 0.239 -0.7079118506f, // 0.2395 -0.7063025628f, // 0.24 -0.7046951022f, // 0.2405 -0.7030894603f, // 0.241 -0.7014856291f, // 0.2415 -0.6998836002f, // 0.242 -0.6982833656f, // 0.2425 -0.6966849171f, // 0.243 -0.6950882466f, // 0.2435 -0.6934933463f, // 0.244 -0.6919002080f, // 0.2445 -0.6903088239f, // 0.245 -0.6887191861f, // 0.2455 -0.6871312868f, // 0.246 -0.6855451181f, // 0.2465 -0.6839606724f, // 0.247 -0.6823779418f, // 0.2475 -0.6807969188f, // 0.248 -0.6792175957f, // 0.2485 -0.6776399649f, // 0.249 -0.6760640189f, // 0.2495 -0.6744897502f, // 0.25 -0.6729171513f, // 0.2505 -0.6713462149f, // 0.251 -0.6697769335f, // 0.2515 -0.6682092997f, // 0.252 -0.6666433064f, // 0.2525 -0.6650789462f, // 0.253 -0.6635162119f, // 0.2535 -0.6619550963f, // 0.254 -0.6603955923f, // 0.2545 -0.6588376927f, // 0.255 -0.6572813906f, // 0.2555 -0.6557266788f, // 0.256 -0.6541735504f, // 0.2565 -0.6526219983f, // 0.257 -0.6510720158f, // 0.2575 -0.6495235958f, // 0.258 -0.6479767316f, // 0.2585 -0.6464314163f, // 0.259 -0.6448876432f, // 0.2595 -0.6433454054f, // 0.26 -0.6418046963f, // 0.2605 -0.6402655092f, // 0.261 -0.6387278375f, // 0.2615 -0.6371916745f, // 0.262 -0.6356570137f, // 0.2625 -0.6341238485f, // 0.263 -0.6325921725f, // 0.2635 -0.6310619791f, // 0.264 -0.6295332619f, // 0.2645 -0.6280060144f, // 0.265 -0.6264802304f, // 0.2655 -0.6249559035f, // 0.266 -0.6234330273f, // 0.2665 -0.6219115956f, // 0.267 -0.6203916021f, // 0.2675 -0.6188730405f, // 0.268 -0.6173559048f, // 0.2685 -0.6158401887f, // 0.269 -0.6143258862f, // 0.2695 -0.6128129910f, // 0.27 -0.6113014972f, // 0.2705 -0.6097913987f, // 0.271 -0.6082826894f, // 0.2715 -0.6067753635f, // 0.272 -0.6052694149f, // 0.2725 -0.6037648378f, // 0.273 -0.6022616262f, // 0.2735 -0.6007597742f, // 0.274 -0.5992592761f, // 0.2745 -0.5977601260f, // 0.275 -0.5962623182f, // 0.2755 -0.5947658468f, // 0.276 -0.5932707062f, // 0.2765 -0.5917768906f, // 0.277 -0.5902843944f, // 0.2775 -0.5887932119f, // 0.278 -0.5873033375f, // 0.2785 -0.5858147657f, // 0.279 -0.5843274908f, // 0.2795 -0.5828415073f, // 0.28 -0.5813568097f, // 0.2805 -0.5798733924f, // 0.281 -0.5783912501f, // 0.2815 -0.5769103773f, // 0.282 -0.5754307686f, // 0.2825 -0.5739524186f, // 0.283 -0.5724753219f, // 0.2835 -0.5709994731f, // 0.284 -0.5695248670f, // 0.2845 -0.5680514983f, // 0.285 -0.5665793617f, // 0.2855 -0.5651084520f, // 0.286 -0.5636387639f, // 0.2865 -0.5621702923f, // 0.287 -0.5607030319f, // 0.2875 -0.5592369776f, // 0.288 -0.5577721243f, // 0.2885 -0.5563084670f, // 0.289 -0.5548460004f, // 0.2895 -0.5533847196f, // 0.29 -0.5519246194f, // 0.2905 -0.5504656950f, // 0.291 -0.5490079413f, // 0.2915 -0.5475513533f, // 0.292 -0.5460959261f, // 0.2925 -0.5446416548f, // 0.293 -0.5431885344f, // 0.2935 -0.5417365601f, // 0.294 -0.5402857270f, // 0.2945 -0.5388360303f, // 0.295 -0.5373874651f, // 0.2955 -0.5359400266f, // 0.296 -0.5344937102f, // 0.2965 -0.5330485109f, // 0.297 -0.5316044241f, // 0.2975 -0.5301614451f, // 0.298 -0.5287195691f, // 0.2985 -0.5272787914f, // 0.299 -0.5258391075f, // 0.2995 -0.5244005127f, // 0.3 -0.5229630023f, // 0.3005 -0.5215265718f, // 0.301 -0.5200912166f, // 0.3015 -0.5186569321f, // 0.302 -0.5172237137f, // 0.3025 -0.5157915570f, // 0.303 -0.5143604575f, // 0.3035 -0.5129304106f, // 0.304 -0.5115014119f, // 0.3045 -0.5100734570f, // 0.305 -0.5086465413f, // 0.3055 -0.5072206606f, // 0.306 -0.5057958103f, // 0.3065 -0.5043719862f, // 0.307 -0.5029491839f, // 0.3075 -0.5015273990f, // 0.308 -0.5001066272f, // 0.3085 -0.4986868641f, // 0.309 -0.4972681056f, // 0.3095 -0.4958503473f, // 0.31 -0.4944335850f, // 0.3105 -0.4930178145f, // 0.311 -0.4916030314f, // 0.3115 -0.4901892317f, // 0.312 -0.4887764111f, // 0.3125 -0.4873645655f, // 0.313 -0.4859536906f, // 0.3135 -0.4845437824f, // 0.314 -0.4831348368f, // 0.3145 -0.4817268496f, // 0.315 -0.4803198167f, // 0.3155 -0.4789137341f, // 0.316 -0.4775085977f, // 0.3165 -0.4761044035f, // 0.317 -0.4747011474f, // 0.3175 -0.4732988254f, // 0.318 -0.4718974336f, // 0.3185 -0.4704969679f, // 0.319 -0.4690974244f, // 0.3195 -0.4676987991f, // 0.32 -0.4663010881f, // 0.3205 -0.4649042875f, // 0.321 -0.4635083934f, // 0.3215 -0.4621134018f, // 0.322 -0.4607193089f, // 0.3225 -0.4593261108f, // 0.323 -0.4579338038f, // 0.3235 -0.4565423838f, // 0.324 -0.4551518472f, // 0.3245 -0.4537621902f, // 0.325 -0.4523734088f, // 0.3255 -0.4509854994f, // 0.326 -0.4495984582f, // 0.3265 -0.4482122815f, // 0.327 -0.4468269654f, // 0.3275 -0.4454425063f, // 0.328 -0.4440589005f, // 0.3285 -0.4426761442f, // 0.329 -0.4412942338f, // 0.3295 -0.4399131657f, // 0.33 -0.4385329361f, // 0.3305 -0.4371535414f, // 0.331 -0.4357749780f, // 0.3315 -0.4343972423f, // 0.332 -0.4330203306f, // 0.3325 -0.4316442394f, // 0.333 -0.4302689651f, // 0.3335 -0.4288945041f, // 0.334 -0.4275208528f, // 0.3345 -0.4261480078f, // 0.335 -0.4247759655f, // 0.3355 -0.4234047224f, // 0.336 -0.4220342749f, // 0.3365 -0.4206646196f, // 0.337 -0.4192957530f, // 0.3375 -0.4179276717f, // 0.338 -0.4165603721f, // 0.3385 -0.4151938508f, // 0.339 -0.4138281044f, // 0.3395 -0.4124631294f, // 0.34 -0.4110989226f, // 0.3405 -0.4097354803f, // 0.341 -0.4083727993f, // 0.3415 -0.4070108763f, // 0.342 -0.4056497077f, // 0.3425 -0.4042892903f, // 0.343 -0.4029296207f, // 0.3435 -0.4015706956f, // 0.344 -0.4002125117f, // 0.3445 -0.3988550656f, // 0.345 -0.3974983541f, // 0.3455 -0.3961423739f, // 0.346 -0.3947871216f, // 0.3465 -0.3934325941f, // 0.347 -0.3920787880f, // 0.3475 -0.3907257002f, // 0.348 -0.3893733273f, // 0.3485 -0.3880216662f, // 0.349 -0.3866707136f, // 0.3495 -0.3853204664f, // 0.35 -0.3839709213f, // 0.3505 -0.3826220752f, // 0.351 -0.3812739248f, // 0.3515 -0.3799264670f, // 0.352 -0.3785796987f, // 0.3525 -0.3772336168f, // 0.353 -0.3758882180f, // 0.3535 -0.3745434992f, // 0.354 -0.3731994574f, // 0.3545 -0.3718560894f, // 0.355 -0.3705133921f, // 0.3555 -0.3691713625f, // 0.356 -0.3678299974f, // 0.3565 -0.3664892939f, // 0.357 -0.3651492488f, // 0.3575 -0.3638098590f, // 0.358 -0.3624711216f, // 0.3585 -0.3611330336f, // 0.359 -0.3597955918f, // 0.3595 -0.3584587933f, // 0.36 -0.3571226350f, // 0.3605 -0.3557871140f, // 0.361 -0.3544522274f, // 0.3615 -0.3531179720f, // 0.362 -0.3517843449f, // 0.3625 -0.3504513433f, // 0.363 -0.3491189640f, // 0.3635 -0.3477872043f, // 0.364 -0.3464560611f, // 0.3645 -0.3451255315f, // 0.365 -0.3437956126f, // 0.3655 -0.3424663015f, // 0.366 -0.3411375952f, // 0.3665 -0.3398094910f, // 0.367 -0.3384819859f, // 0.3675 -0.3371550770f, // 0.368 -0.3358287615f, // 0.3685 -0.3345030364f, // 0.369 -0.3331778990f, // 0.3695 -0.3318533464f, // 0.37 -0.3305293758f, // 0.3705 -0.3292059843f, // 0.371 -0.3278831691f, // 0.3715 -0.3265609274f, // 0.372 -0.3252392564f, // 0.3725 -0.3239181533f, // 0.373 -0.3225976153f, // 0.3735 -0.3212776395f, // 0.374 -0.3199582234f, // 0.3745 -0.3186393640f, // 0.375 -0.3173210586f, // 0.3755 -0.3160033044f, // 0.376 -0.3146860988f, // 0.3765 -0.3133694389f, // 0.377 -0.3120533220f, // 0.3775 -0.3107377455f, // 0.378 -0.3094227065f, // 0.3785 -0.3081082024f, // 0.379 -0.3067942305f, // 0.3795 -0.3054807881f, // 0.38 -0.3041678724f, // 0.3805 -0.3028554809f, // 0.381 -0.3015436108f, // 0.3815 -0.3002322594f, // 0.382 -0.2989214241f, // 0.3825 -0.2976111022f, // 0.383 -0.2963012912f, // 0.3835 -0.2949919882f, // 0.384 -0.2936831908f, // 0.3845 -0.2923748962f, // 0.385 -0.2910671019f, // 0.3855 -0.2897598052f, // 0.386 -0.2884530036f, // 0.3865 -0.2871466943f, // 0.387 -0.2858408749f, // 0.3875 -0.2845355427f, // 0.388 -0.2832306951f, // 0.3885 -0.2819263296f, // 0.389 -0.2806224436f, // 0.3895 -0.2793190344f, // 0.39 -0.2780160997f, // 0.3905 -0.2767136367f, // 0.391 -0.2754116430f, // 0.3915 -0.2741101160f, // 0.392 -0.2728090532f, // 0.3925 -0.2715084520f, // 0.393 -0.2702083099f, // 0.3935 -0.2689086245f, // 0.394 -0.2676093930f, // 0.3945 -0.2663106132f, // 0.395 -0.2650122824f, // 0.3955 -0.2637143982f, // 0.396 -0.2624169581f, // 0.3965 -0.2611199595f, // 0.397 -0.2598234001f, // 0.3975 -0.2585272773f, // 0.398 -0.2572315887f, // 0.3985 -0.2559363317f, // 0.399 -0.2546415040f, // 0.3995 -0.2533471031f, // 0.4 -0.2520531266f, // 0.4005 -0.2507595719f, // 0.401 -0.2494664367f, // 0.4015 -0.2481737185f, // 0.402 -0.2468814149f, // 0.4025 -0.2455895234f, // 0.403 -0.2442980417f, // 0.4035 -0.2430069674f, // 0.404 -0.2417162980f, // 0.4045 -0.2404260311f, // 0.405 -0.2391361644f, // 0.4055 -0.2378466954f, // 0.406 -0.2365576218f, // 0.4065 -0.2352689411f, // 0.407 -0.2339806510f, // 0.4075 -0.2326927492f, // 0.408 -0.2314052332f, // 0.4085 -0.2301181007f, // 0.409 -0.2288313493f, // 0.4095 -0.2275449766f, // 0.41 -0.2262589804f, // 0.4105 -0.2249733583f, // 0.411 -0.2236881079f, // 0.4115 -0.2224032269f, // 0.412 -0.2211187130f, // 0.4125 -0.2198345638f, // 0.413 -0.2185507770f, // 0.4135 -0.2172673503f, // 0.414 -0.2159842814f, // 0.4145 -0.2147015680f, // 0.415 -0.2134192077f, // 0.4155 -0.2121371983f, // 0.416 -0.2108555375f, // 0.4165 -0.2095742229f, // 0.417 -0.2082932523f, // 0.4175 -0.2070126234f, // 0.418 -0.2057323339f, // 0.4185 -0.2044523815f, // 0.419 -0.2031727640f, // 0.4195 -0.2018934791f, // 0.42 -0.2006145246f, // 0.4205 -0.1993358981f, // 0.421 -0.1980575974f, // 0.4215 -0.1967796202f, // 0.422 -0.1955019644f, // 0.4225 -0.1942246276f, // 0.423 -0.1929476076f, // 0.4235 -0.1916709022f, // 0.424 -0.1903945092f, // 0.4245 -0.1891184263f, // 0.425 -0.1878426512f, // 0.4255 -0.1865671818f, // 0.426 -0.1852920159f, // 0.4265 -0.1840171512f, // 0.427 -0.1827425854f, // 0.4275 -0.1814683165f, // 0.428 -0.1801943422f, // 0.4285 -0.1789206603f, // 0.429 -0.1776472685f, // 0.4295 -0.1763741648f, // 0.43 -0.1751013468f, // 0.4305 -0.1738288125f, // 0.431 -0.1725565596f, // 0.4315 -0.1712845859f, // 0.432 -0.1700128893f, // 0.4325 -0.1687414676f, // 0.433 -0.1674703186f, // 0.4335 -0.1661994402f, // 0.434 -0.1649288301f, // 0.4345 -0.1636584862f, // 0.435 -0.1623884064f, // 0.4355 -0.1611185885f, // 0.436 -0.1598490303f, // 0.4365 -0.1585797298f, // 0.437 -0.1573106846f, // 0.4375 -0.1560418928f, // 0.438 -0.1547733521f, // 0.4385 -0.1535050604f, // 0.439 -0.1522370156f, // 0.4395 -0.1509692155f, // 0.44 -0.1497016580f, // 0.4405 -0.1484343411f, // 0.441 -0.1471672624f, // 0.4415 -0.1459004200f, // 0.442 -0.1446338117f, // 0.4425 -0.1433674355f, // 0.443 -0.1421012890f, // 0.4435 -0.1408353704f, // 0.444 -0.1395696774f, // 0.4445 -0.1383042080f, // 0.445 -0.1370389600f, // 0.4455 -0.1357739313f, // 0.446 -0.1345091199f, // 0.4465 -0.1332445236f, // 0.447 -0.1319801404f, // 0.4475 -0.1307159681f, // 0.448 -0.1294520047f, // 0.4485 -0.1281882481f, // 0.449 -0.1269246962f, // 0.4495 -0.1256613469f, // 0.45 -0.1243981981f, // 0.4505 -0.1231352477f, // 0.451 -0.1218724938f, // 0.4515 -0.1206099341f, // 0.452 -0.1193475667f, // 0.4525 -0.1180853894f, // 0.453 -0.1168234003f, // 0.4535 -0.1155615971f, // 0.454 -0.1142999779f, // 0.4545 -0.1130385406f, // 0.455 -0.1117772832f, // 0.4555 -0.1105162036f, // 0.456 -0.1092552996f, // 0.4565 -0.1079945694f, // 0.457 -0.1067340108f, // 0.4575 -0.1054736218f, // 0.458 -0.1042134003f, // 0.4585 -0.1029533443f, // 0.459 -0.1016934517f, // 0.4595 -0.1004337205f, // 0.46 -0.0991741487f, // 0.4605 -0.0979147342f, // 0.461 -0.0966554750f, // 0.4615 -0.0953963691f, // 0.462 -0.0941374143f, // 0.4625 -0.0928786088f, // 0.463 -0.0916199504f, // 0.4635 -0.0903614371f, // 0.464 -0.0891030670f, // 0.4645 -0.0878448379f, // 0.465 -0.0865867479f, // 0.4655 -0.0853287949f, // 0.466 -0.0840709769f, // 0.4665 -0.0828132919f, // 0.467 -0.0815557379f, // 0.4675 -0.0802983129f, // 0.468 -0.0790410148f, // 0.4685 -0.0777838416f, // 0.469 -0.0765267914f, // 0.4695 -0.0752698621f, // 0.47 -0.0740130517f, // 0.4705 -0.0727563582f, // 0.471 -0.0714997796f, // 0.4715 -0.0702433138f, // 0.472 -0.0689869590f, // 0.4725 -0.0677307130f, // 0.473 -0.0664745739f, // 0.4735 -0.0652185397f, // 0.474 -0.0639626084f, // 0.4745 -0.0627067779f, // 0.475 -0.0614510464f, // 0.4755 -0.0601954117f, // 0.476 -0.0589398720f, // 0.4765 -0.0576844251f, // 0.477 -0.0564290692f, // 0.4775 -0.0551738021f, // 0.478 -0.0539186220f, // 0.4785 -0.0526635269f, // 0.479 -0.0514085147f, // 0.4795 -0.0501535835f, // 0.48 -0.0488987312f, // 0.4805 -0.0476439560f, // 0.481 -0.0463892557f, // 0.4815 -0.0451346285f, // 0.482 -0.0438800723f, // 0.4825 -0.0426255852f, // 0.483 -0.0413711651f, // 0.4835 -0.0401168102f, // 0.484 -0.0388625184f, // 0.4845 -0.0376082877f, // 0.485 -0.0363541161f, // 0.4855 -0.0351000018f, // 0.486 -0.0338459426f, // 0.4865 -0.0325919367f, // 0.487 -0.0313379820f, // 0.4875 -0.0300840766f, // 0.488 -0.0288302185f, // 0.4885 -0.0275764057f, // 0.489 -0.0263226363f, // 0.4895 -0.0250689083f, // 0.49 -0.0238152196f, // 0.4905 -0.0225615684f, // 0.491 -0.0213079526f, // 0.4915 -0.0200543704f, // 0.492 -0.0188008196f, // 0.4925 -0.0175472984f, // 0.493 -0.0162938047f, // 0.4935 -0.0150403367f, // 0.494 -0.0137868923f, // 0.4945 -0.0125334695f, // 0.495 -0.0112800664f, // 0.4955 -0.0100266811f, // 0.496 -0.0087733115f, // 0.4965 -0.0075199557f, // 0.497 -0.0062666117f, // 0.4975 -0.0050132775f, // 0.498 -0.0037599513f, // 0.4985 -0.0025066309f, // 0.499 -0.0012533145f, // 0.4995 0.0000000000f, // 0.5 clhep-2.1.4.1.orig/Random/autotools/0000755000175000017500000000000012242515140015642 5ustar olesolesclhep-2.1.4.1.orig/Random/autotools/.cvsignore0000755000175000017500000000010107705060311017640 0ustar olesolesconfig.sub config.guess depcomp install-sh missing mkinstalldirs clhep-2.1.4.1.orig/Random/autotools/ltmain.sh0000755000175000017500000057547210233771102017511 0ustar olesoles# Generated from ltmain.in; do not edit by hand # ltmain.sh (GNU libtool) 1.9b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: powerpc-apple-darwin7.5.0 # shell: $SHELL # compiler: $LTCC # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 1.9b # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST elif test -n "${BASH_VERSION+set}${KSH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh dirname="s,/[^/]*$,," basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: PROGRAM=ltmain.sh progname=`echo "$progpath" | $SED "$basename"` # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *) progdir=`echo "$progpath" | $SED "$dirname"` progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; esac # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.9b TIMESTAMP="" package_revision=1.1571 # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $echo $progname${mode+: }$mode: warning: ${1+"$@"} 1>&2 } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } # func_version # Echo version message to standard output and exit. func_version () { $SED '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# //; s/^# *$//; s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED '/^# Usage:/,/# -h/ { s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" echo echo "run \`$progname --help | more' for full usage" exit $EXIT_SUCCESS } # func_help # Echo long help message to standard output and exit. func_help () { $SED '/^# Usage:/,/# Report bugs to/ { s/^# //; s/^# *$//; s:\$progname:'$progname':; s:\$SHELL:'"$SHELL"':; s:\$LTCC:'"$LTCC"':; s:\$LD:'"$LD"':; s/\$with_gnu_ld/'"$with_gnu_ld"'/; s/\$automake_version/'"`automake --version 2>/dev/null |$SED 1q`"'/; s/\$autoconf_version/'"`autoconf --version 2>/dev/null |$SED 1q`"'/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $EXIT_SUCCESS } # func_features # Display the features supported by this script. func_features () { $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable "`\"foo\"`", so we have to do # it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $echo \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $echo $echo "Try \`$progname --help' for more information about other modes." exit $EXIT_SUCCESS } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # sed scripts: my_sed_single_opt='1s/^\(..\).*$/\1/;q' my_sed_single_rest='1s/^..\(.*\)$/\1/;q' my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' exit_cmd=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set -- --mode clean ${1+"$@"} ;; compile|compil|compi|comp|com|co|c) shift; set -- --mode compile ${1+"$@"} ;; execute|execut|execu|exec|exe|ex|e) shift; set -- --mode execute ${1+"$@"} ;; finish|finis|fini|fin|fi|f) shift; set -- --mode finish ${1+"$@"} ;; install|instal|insta|inst|ins|in|i) shift; set -- --mode install ${1+"$@"} ;; link|lin|li|l) shift; set -- --mode link ${1+"$@"} ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set -- --mode uninstall ${1+"$@"} ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" set -x ;; --dlopen) test $# -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" ;; --dry-run | -n) run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test $# -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" show=: ;; --tag) test $# -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: --dlopen=*|--mode=*|--tag=*) arg=`echo "$opt" | $SED "$my_sed_long_arg"` opt=`echo "$opt" | $SED "$my_sed_long_opt"` set -- "$opt" "$arg" ${1+"$@"} ;; # Separate optargs to short options: # -x*|-y*) # arg=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "$arg" ${1+"$@"} # ;; # Separate non-argument short options: # -z*|-z*|-y*) # rest=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "-$rest" ${1+"$@"} # ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`echo "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$my_dlsyms" test -z "$run" && $echo > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do $show "extracting global C symbols from \`$progfile'" $run eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for dlprefile in $dlprefiles; do $show "extracting global C symbols from \`$dlprefile'" name=`$echo "$dlprefile" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ const struct { const char *originator; const struct { const char *name; void *address; } symbols[]; } lt_${my_prefix}_LTX_preloaded_symbols = {\ \"$my_originator\", { " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" $echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} } }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" status=$? if test "$status" -ne 0 && test ! -d "$my_xdir"; then exit $status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename $darwin_archive` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" # Remove the table of contents from the thin files. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" $AR -xo "${darwin_base_archive}" rm "${darwin_base_archive}" cd "$darwin_curdir" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist rm -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir (cd $my_xdir && $AR x $my_xabs) || exit $? fi # $darwin_arches fi # $run ;; *) # We will extract separately just the conflicting names and we will # no longer touch any unique names. It is faster to leave these # extract automatically by $AR in one run. $show "(cd $my_xdir && $AR x $my_xabs)" $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; renaming object files" func_warning "to ensure that they will not overwrite" $AR t "$my_xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_mode_compile arg... func_mode_compile () { # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1 || \ func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi } # func_mode_finish arg... func_mode_finish () { libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit $EXIT_SUCCESS } # func_mode_install arg... func_mode_install () { # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files test "$#" -gt 2 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. (${SED} -e '2q' $file | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1 || \ func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" $show "$relink_command" $run eval "$relink_command" || \ func_fatal_error "error: relink \`$file' with the above command before installing it" fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | $GREP "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. test -z "$notinst_deplibs" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask func_error "error: cannot create temporary directory \`$tmpdir'" continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" ${rm}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } # func_mode_link arg... func_mode_link () { case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static # See comment for -static flag below, for more details. compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" || \ func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else func_fatal_error "link input file \`$save_arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) # The effects of -all-static are defined in a previous loop. continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs $inherited_linker_flags" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *[\\/]*.la) . $lib ;; *.la) . ./$lib ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`echo "$deplib" |$SED "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$inherited_linker_flags " in *" $deplib "*) ;; * ) inherited_linker_flags="$inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $lib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not use here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib'" fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then : else func_fatal_error "\`$lib' is not a valid libtool archive" fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac case $host in *-*-darwin*) # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then inherited_linker_flags=`$echo "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` fi dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP "bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $echo "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "*** And there doesn't seem to be a static archive available" $echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs $inherited_linker_flags; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" eval darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//' | xargs` compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for archives" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath test "$#" -gt 2 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" test -n "$8" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "AGE \`$age' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | ${SED} 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null | ${SED} 10q | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` inherited_linker_flags=`$echo "X $inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$echo "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`echo "$output" | $SED $basename` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnk $echo "creating GNU ld script: $output" $echo 'INPUT (' > $output for obj in $save_libobjs do $echo \""$obj"\" >> $output done $echo ')' >> $output else $echo "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for objects" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; struct stat st; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$dlsymsobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; overriding AR_FLAGS to 'cq'" func_warning "to ensure that POSIX-compatible ar will work" AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS } # func_mode_uninstall arg... func_mode_uninstall () { rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done test -z "$rm" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 || (test -h "$file") >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status } ## ----------- ## ## Main. ## ## ----------- ## { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." case $mode in compile) func_mode_compile ${1+"$@"} ;; execute) func_mode_execute ${1+"$@"} ;; finish) func_mode_finish ${1+"$@"} ;; install) func_mode_install ${1+"$@"} ;; link|relink) func_mode_link ${1+"$@"} ;; uninstall|clean) func_mode_uninstall ${1+"$@"} ;; "") help="$generic_help" func_fatal_help "you must specify a MODE" ;; esac test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi } exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: clhep-2.1.4.1.orig/Random/gaussTables.cdat0000755000175000017500000042600707705060311016742 0ustar olesoles -7.25556115378475490, 676719273485.76428000000000000, // 2e-13 -7.16115522405928220, 342662078543.90051000000000000, // 4e-13 -7.10537070632794250, 230170222596.19803000000000000, // 6e-13 -7.06553356916514730, 173565492189.66785000000000000, // 8e-13 -7.03448382523110020, 139442738456.34875000000000000, // 1e-12 -7.00901600646432320, 116608874971.10384000000000000, // 1.2e-12 -6.98741354717000180, 100247961904.03416000000000000, // 1.4e-12 -6.96864854076339490, 87944324542.41708400000000000, // 1.6e-12 -6.95205616929998360, 78352289264.30873100000000000, // 1.8e-12 -6.93718142800073510, 70662553474.29182400000000000, // 2e-12 -6.92369910076312860, 64359034162.40090900000000000, // 2.2e-12 -6.91136860770674750, 59097032524.22539500000000000, // 2.4e-12 -6.90000693689299460, 54637505499.51339700000000000, // 2.6e-12 -6.88947160674390880, 50809442145.73740400000000000, // 2.8e-12 -6.87964950324632430, 47487254086.77066000000000000, // 3e-12 -6.87044931624041770, 44576624165.32612600000000000, // 3.2e-12 -6.86179626572231620, 42005337451.95951100000000000, // 3.4e-12 -6.85362833312122270, 39717160969.97607400000000000, // 3.6e-12 -6.84589350967138800, 37667651252.09226200000000000, // 3.8e-12 -6.83854774914997150, 35821216407.95410200000000000, // 4e-12 -6.83155341901813710, 34149015424.97944600000000000, // 4.2e-12 -6.82487811103332210, 32627428886.14421800000000000, // 4.4e-12 -6.81849371559775900, 31236927575.56636800000000000, // 4.6e-12 -6.81237569260341400, 29961223177.80575900000000000, // 4.8e-12 -6.80650249072717980, 28786622260.89023200000000000, // 5e-12 -6.80085508030571080, 27701528936.07577100000000000, // 5.2e-12 -6.79541657411931950, 26696057735.95449800000000000, // 5.4e-12 -6.79017191694090720, 25761729219.38132500000000000, // 5.6e-12 -6.78510762940121560, 24891228380.63469700000000000, // 5.8e-12 -6.78021159514541070, 24078211242.45917100000000000, // 6e-12 -6.77547288278239450, 23317148778.11848400000000000, // 6.2e-12 -6.77088159601413150, 22603200015.92247000000000000, // 6.4e-12 -6.76642874675373740, 21932108150.55845600000000000, // 6.6e-12 -6.76210614712438660, 21300114935.78297000000000000, // 6.8e-12 -6.75790631706301600, 20703889710.91144200000000000, // 7e-12 -6.75382240489741200, 20140470222.42682300000000000, // 7.2e-12 -6.74984811876929400, 19607213014.57880800000000000, // 7.4e-12 -6.74597766717226930, 19101751630.51912700000000000, // 7.6e-12 -6.74220570718745900, 18621961225.45158000000000000, // 7.8e-12 -6.73852729925065130, 18165928472.44913900000000000, // 8e-12 -6.73493786748568010, 17731925859.50196800000000000, // 8.2e-12 -6.73143316480128110, 17318389647.71016700000000000, // 8.4e-12 -6.72800924208076450, 16923900896.09685100000000000, // 8.6e-12 -6.72466242090138340, 16547169066.36433400000000000, // 8.8e-12 -6.72138926930876760, 16187017807.26313200000000000, // 9e-12 -6.71818658024451400, 15842372587.70461800000000000, // 9.2e-12 -6.71505135228568230, 15512249903.97514500000000000, // 9.4e-12 -6.71198077240480020, 15195747832.05130800000000000, // 9.6e-12 -6.70897220050112080, 14892037733.34106300000000000, // 9.8e-12 -6.70602315548909810, 14600356952.78396600000000000, // 1e-11 -6.70313130275945030, 14320002373.43371200000000000, // 1.02e-11 -6.70029444285346100, 14050324712.52931000000000000, // 1.04e-11 -6.69751050121211120, 13790723461.35594200000000000, // 1.06e-11 -6.69477751887998180, 13540642385.66624800000000000, // 1.08e-11 -6.69209364405895530, 13299565515.48425700000000000, // 1.1e-11 -6.68945712442028470, 13067013563.29047400000000000, // 1.12e-11 -6.68686630009449430, 12842540718.09298100000000000, // 1.14e-11 -6.68431959726881340, 12625731770.15562400000000000, // 1.16e-11 -6.68181552232985790, 12416199527.23865100000000000, // 1.18e-11 -6.67935265649674910, 12213582488.43080300000000000, // 1.2e-11 -6.67692965089627320, 12017542746.09756500000000000, // 1.22e-11 -6.67454522203695880, 11827764090.24588200000000000, // 1.24e-11 -6.67219814764391650, 11643950292.87542500000000000, // 1.26e-11 -6.66988726282049350, 11465823552.68429200000000000, // 1.28e-11 -6.66761145650646100, 11293123082.90648300000000000, // 1.3e-11 -6.66536966820545110, 11125603827.12495400000000000, // 1.32e-11 -6.66316088495772970, 10963035289.74765400000000000, // 1.34e-11 -6.66098413853627400, 10805200469.35129000000000000, // 1.36e-11 -6.65883850284682580, 10651894884.49755300000000000, // 1.38e-11 -6.65672309151432010, 10502925682.79530900000000000, // 1.4e-11 -6.65463705563984750, 10358110825.02005400000000000, // 1.42e-11 -6.65257958171387460, 10217278337.01301200000000000, // 1.44e-11 -6.65054988967292090, 10080265622.88295700000000000, // 1.46e-11 -6.64854723108790320, 9946918833.71930120000000000, // 1.48e-11 -6.64657088747362220, 9817092286.65237430000000000, // 1.5e-11 -6.64462016870980590, 9690647929.63659480000000000, // 1.52e-11 -6.64269441156496840, 9567454847.80935670000000000, // 1.54e-11 -6.64079297831518290, 9447388807.70670890000000000, // 1.56e-11 -6.63891525545041090, 9330331835.98222730000000000, // 1.58e-11 -6.63706065246204260, 9216171829.63330270000000000, // 1.6e-11 -6.63522860070531890, 9104802195.00049020000000000, // 1.62e-11 -6.63341855233137870, 8996121513.10547450000000000, // 1.64e-11 -6.63162997928375650, 8890033229.10397150000000000, // 1.66e-11 -6.62986237235475780, 8786445363.85213470000000000, // 1.68e-11 -6.62811524029745500, 8685270245.76890560000000000, // 1.7e-11 -6.62638810898941880, 8586424261.34766960000000000, // 1.72e-11 -6.62468052064458220, 8489827622.81814290000000000, // 1.74e-11 -6.62299203307007910, 8395404151.60657120000000000, // 1.76e-11 -6.62132221896473450, 8303081076.33797740000000000, // 1.78e-11 -6.61967066525679120, 8212788844.27392010000000000, // 1.8e-11 -6.61803697247793290, 8124460945.13497640000000000, // 1.82e-11 -6.61642075417147260, 8038033746.38202000000000000, // 1.84e-11 -6.61482163633238600, 7953446339.08978840000000000, // 1.86e-11 -6.61323925687717920, 7870640393.62743090000000000, // 1.88e-11 -6.61167326514169850, 7789560024.42528340000000000, // 1.9e-11 -6.61012332140513160, 7710151663.16712950000000000, // 1.92e-11 -6.60858909643858630, 7632363939.80159850000000000, // 1.94e-11 -6.60707027107669290, 7556147570.81407170000000000, // 1.96e-11 -6.60556653581098270, 7481455254.25398920000000000, // 1.98e-11 -6.60407759040344900, 7408241571.03207590000000000, // 2e-11 -6.60260314351943920, 7336462892.07146550000000000, // 2.02e-11 -6.60114291237840510, 7266077290.89538290000000000, // 2.04e-11 -6.59969662242176720, 7197044461.29782200000000000, // 2.06e-11 -6.59826400699665070, 7129325639.74332140000000000, // 2.08e-11 -6.59684480705475180, 7062883532.18985650000000000, // 2.1e-11 -6.59543877086541830, 6997682245.04037760000000000, // 2.12e-11 -6.59404565374213100, 6933687219.95322900000000000, // 2.14e-11 -6.59266521778167560, 6870865172.26343730000000000, // 2.16e-11 -6.59129723161528510, 6809184032.78275200000000000, // 2.18e-11 -6.58994147017109540, 6748612892.76390650000000000, // 2.2e-11 -6.58859771444730220, 6689121951.82987690000000000, // 2.22e-11 -6.58726575129546000, 6630682468.68442250000000000, // 2.24e-11 -6.58594537321341540, 6573266714.43287470000000000, // 2.26e-11 -6.58463637814723680, 6516847928.34827800000000000, // 2.28e-11 -6.58333856930183360, 6461400275.94097230000000000, // 2.3e-11 -6.58205175495973460, 6406898809.18979170000000000, // 2.32e-11 -6.58077574830757590, 6353319428.80462460000000000, // 2.34e-11 -6.57951036726997260, 6300638848.40285590000000000, // 2.36e-11 -6.57825543435040320, 6248834560.48754880000000000, // 2.38e-11 -6.57701077647863830, 6197884804.11762710000000000, // 2.4e-11 -6.57577622486455390, 6147768534.17924400000000000, // 2.42e-11 -6.57455161485792950, 6098465392.16335110000000000, // 2.44e-11 -6.57333678581390670, 6049955678.36244770000000000, // 2.46e-11 -6.57213158096390430, 6002220325.40964980000000000, // 2.48e-11 -6.57093584729169500, 5955240873.08364300000000000, // 2.5e-11 -6.56974943541437910, 5908999444.30879500000000000, // 2.52e-11 -6.56857219946808430, 5863478722.28703500000000000, // 2.54e-11 -6.56740399699808550, 5818661928.69632430000000000, // 2.56e-11 -6.56624468885322000, 5774532802.90158940000000000, // 2.58e-11 -6.56509413908434420, 5731075582.12111280000000000, // 2.6e-11 -6.56395221484668050, 5688274982.49893380000000000, // 2.62e-11 -6.56281878630582320, 5646116181.03361130000000000, // 2.64e-11 -6.56169372654732630, 5604584798.32109070000000000, // 2.66e-11 -6.56057691148967330, 5563666882.06837370000000000, // 2.68e-11 -6.55946821980037510, 5523348891.33394620000000000, // 2.7e-11 -6.55836753281529190, 5483617681.46636100000000000, // 2.72e-11 -6.55727473446076030, 5444460489.69541450000000000, // 2.74e-11 -6.55618971117867040, 5405864921.35223580000000000, // 2.76e-11 -6.55511235185409640, 5367818936.67732720000000000, // 2.78e-11 -6.55404254774567900, 5330310838.19827840000000000, // 2.8e-11 -6.55298019241829800, 5293329258.63626100000000000, // 2.82e-11 -6.55192518167824730, 5256863149.32682800000000000, // 2.84e-11 -6.55087741351064250, 5220901769.12369350000000000, // 2.86e-11 -6.54983678801894430, 5185434673.76131440000000000, // 2.88e-11 -6.54880320736663450, 5150451705.65879540000000000, // 2.9e-11 -6.54777657572086370, 5115942984.14038560000000000, // 2.92e-11 -6.54675679919801650, 5081898896.05402090000000000, // 2.94e-11 -6.54574378581109960, 5048310086.76842880000000000, // 2.96e-11 -6.54473744541893240, 5015167451.53287410000000000, // 2.98e-11 -6.54373768967697430, 4982462127.17950250000000000, // 3e-11 -6.54274443198983400, 4950185484.15613080000000000, // 3.02e-11 -6.54175758746530980, 4918329118.87158200000000000, // 3.04e-11 -6.54077707286993530, 4886884846.34037780000000000, // 3.06e-11 -6.53980280658596950, 4855844693.11293410000000000, // 3.08e-11 -6.53883470856978200, 4825200890.47916890000000000, // 3.1e-11 -6.53787270031155200, 4794945867.93172550000000000, // 3.12e-11 -6.53691670479627800, 4765072246.87926960000000000, // 3.14e-11 -6.53596664646597690, 4735572834.59631350000000000, // 3.16e-11 -6.53502245118311720, 4706440618.40208240000000000, // 3.18e-11 -6.53408404619515700, 4677668760.05586150000000000, // 3.2e-11 -6.53315136010023690, 4649250590.36203100000000000, // 3.22e-11 -6.53222432281384080, 4621179603.97170450000000000, // 3.24e-11 -6.53130286553655900, 4593449454.37751390000000000, // 3.26e-11 -6.53038692072282690, 4566053949.09056570000000000, // 3.28e-11 -6.52947642205052410, 4538987044.98983670000000000, // 3.3e-11 -6.52857130439163580, 4512242843.84337230000000000, // 3.32e-11 -6.52767150378362880, 4485815587.98508170000000000, // 3.34e-11 -6.52677695740182620, 4459699656.14983370000000000, // 3.36e-11 -6.52588760353246760, 4433889559.45200440000000000, // 3.38e-11 -6.52500338154669720, 4408379937.50950620000000000, // 3.4e-11 -6.52412423187514980, 4383165554.69875530000000000, // 3.42e-11 -6.52325009598345500, 4358241296.54487420000000000, // 3.44e-11 -6.52238091634829060, 4333602166.23237800000000000, // 3.46e-11 -6.52151663643420940, 4309243281.23801900000000000, // 3.48e-11 -6.52065720067113210, 4285159870.07896470000000000, // 3.5e-11 -6.51980255443242300, 4261347269.16991760000000000, // 3.52e-11 -6.51895264401361270, 4237800919.78705640000000000, // 3.54e-11 -6.51810741661176250, 4214516365.13544030000000000, // 3.56e-11 -6.51726682030532610, 4191489247.51204060000000000, // 3.58e-11 -6.51643080403461370, 4168715305.56436490000000000, // 3.6e-11 -6.51559931758279550, 4146190371.63954070000000000, // 3.62e-11 -6.51477231155741170, 4123910369.22023870000000000, // 3.64e-11 -6.51394973737240870, 4101871310.44486140000000000, // 3.66e-11 -6.51313154723063370, 4080069293.70762060000000000, // 3.68e-11 -6.51231769410683460, 4058500501.33698320000000000, // 3.7e-11 -6.51150813173107230, 4037161197.34774970000000000, // 3.72e-11 -6.51070281457262820, 4016047725.26616760000000000, // 3.74e-11 -6.50990169782429890, 3995156506.02345800000000000, // 3.76e-11 -6.50910473738712710, 3974484035.91626260000000000, // 3.78e-11 -6.50831188985552430, 3954026884.63126090000000000, // 3.8e-11 -6.50752311250278570, 3933781693.33160920000000000, // 3.82e-11 -6.50673836326698040, 3913745172.80295710000000000, // 3.84e-11 -6.50595760073720970, 3893914101.65703390000000000, // 3.86e-11 -6.50518078414021520, 3874285324.59044080000000000, // 3.88e-11 -6.50440787332732830, 3854855750.69691370000000000, // 3.9e-11 -6.50363882876175660, 3835622351.83107380000000000, // 3.92e-11 -6.50287361150620490, 3816582161.02223400000000000, // 3.94e-11 -6.50211218321078020, 3797732270.93539430000000000, // 3.96e-11 -6.50135450610121170, 3779069832.37874410000000000, // 3.98e-11 -6.50060054296737540, 3760592052.85611630000000000, // 4e-11 -6.50060054296646590, 3760592052.83388520000000000, // 4e-11 -6.39552181084518880, 1909845431.28780580000000000, // 8e-11 -6.33328220821810910, 1285187292.60247710000000000, // 1.2e-10 -6.28876570265243820, 970406452.24924922000000000, // 1.6e-10 -6.25402770716035140, 780441087.15631616000000000, // 2e-10 -6.22550739877425660, 653210320.79869068000000000, // 2.4e-10 -6.20129621092908150, 561979472.30678833000000000, // 2.8e-10 -6.18025042109368530, 493328661.91536200000000000, // 3.2e-10 -6.16162983848419990, 439777584.12762135000000000, // 3.6e-10 -6.14492759264014320, 396825062.37184238000000000, // 4e-10 -6.12978121762794710, 361599361.67334700000000000, // 4.4e-10 -6.11592245834980200, 332181575.48141921000000000, // 4.8e-10 -6.10314716694666170, 307240443.90511161000000000, // 5.2e-10 -6.09129634716896540, 285823237.70262080000000000, // 5.6e-10 -6.08024373037511000, 267230046.71558678000000000, // 6e-10 -6.06988735441334360, 250935070.61877871000000000, // 6.4e-10 -6.06014369026829320, 236535605.54552352000000000, // 6.8e-10 -6.05094344357709430, 223717982.94315758000000000, // 7.2e-10 -6.04222848837823890, 212234231.03348565000000000, // 7.6e-10 -6.03394958517039900, 201885715.69886097000000000, // 8e-10 -6.02606465408145730, 192511440.44121233000000000, // 8.4e-10 -6.01853744850321790, 183979526.93452701000000000, // 8.8e-10 -6.01133652260576670, 176180910.77644670000000000, // 9.2e-10 -6.00443441785359600, 169024608.10180774000000000, // 9.6e-10 -5.99780701500857470, 162434114.42871946000000000, // 1e-09 -5.99143301277212450, 156344631.75305501000000000, // 1.04e-09 -5.98529350446318990, 150700909.76245689000000000, // 1.08e-09 -5.97937163139635960, 145455548.07395411000000000, // 1.12e-09 -5.97365229685482380, 140567648.53043425000000000, // 1.16e-09 -5.96812192836703750, 136001736.10984513000000000, // 1.2e-09 -5.96276827881078210, 131726887.96750569000000000, // 1.24e-09 -5.95758025896987410, 127716025.21462335000000000, // 1.28e-09 -5.95254779575365590, 123945333.01401334000000000, // 1.32e-09 -5.94766171149634280, 120393782.65221865000000000, // 1.36e-09 -5.94291362068118900, 117042735.25296086000000000, // 1.4e-09 -5.93829584115334530, 113875611.30425829000000000, // 1.44e-09 -5.93380131744701430, 110877613.58502039000000000, // 1.48e-09 -5.92942355429465890, 108035493.68379727000000000, // 1.52e-09 -5.92515655873650720, 105337354.30896857000000000, // 1.56e-09 -5.92099478952805120, 102772481.14569138000000000, // 1.6e-09 -5.91693311276789920, 100331199.23033564000000000, // 1.64e-09 -5.91296676284960210, 98004749.76858405800000000, // 1.68e-09 -5.90909130798819060, 95785184.07922729800000000, // 1.72e-09 -5.90530261969267740, 93665271.94754071500000000, // 1.76e-09 -5.90159684565409130, 91638422.15352210400000000, // 1.8e-09 -5.89797038560026450, 89698613.32805921100000000, // 1.84e-09 -5.89441986973585230, 87840333.60356563300000000, // 1.88e-09 -5.89094213944207290, 86058527.78048229200000000, // 1.92e-09 -5.88753422995765520, 84348550.93933224700000000, // 1.96e-09 -5.88419335480160390, 82706127.59871548400000000, // 2e-09 -5.88091689173158280, 81127315.66043084900000000, // 2.04e-09 -5.87770237005969600, 79608474.49934306700000000, // 2.08e-09 -5.87454745917091170, 78146236.65221779000000000, // 2.12e-09 -5.87144995810988850, 76737482.64052830600000000, // 2.16e-09 -5.86840778611893920, 75379318.52959515200000000, // 2.2e-09 -5.86541897402464500, 74069055.88308438700000000, // 2.24e-09 -5.86248165638335370, 72804193.81964133700000000, // 2.28e-09 -5.85959406430666090, 71582402.91876061300000000, // 2.32e-09 -5.85675451889730430, 70401510.75715319800000000, // 2.36e-09 -5.85396142523430550, 69259488.88606315900000000, // 2.4e-09 -5.85121326685287530, 68154441.08461514100000000, // 2.44e-09 -5.84850860067115000, 67084592.74565458300000000, // 2.48e-09 -5.84584605232097940, 66048281.26863195000000000, // 2.52e-09 -5.84322431184462850, 65043947.34969954900000000, // 2.56e-09 -5.84064212972365660, 64070127.07277835200000000, // 2.6e-09 -5.83809831320949260, 63125444.71685300000000000, // 2.64e-09 -5.83559172292870710, 62208606.20494912600000000, // 2.68e-09 -5.83312126973851440, 61318393.12890366500000000, // 2.72e-09 -5.83068591181088090, 60453657.29177645600000000, // 2.76e-09 -5.82828465192532970, 59613315.71621947000000000, // 2.8e-09 -5.82591653495293560, 58796346.07307898300000000, // 2.84e-09 -5.82358064551543640, 58001782.48947804400000000, // 2.88e-09 -5.82127610580502710, 57228711.70010756700000000, // 2.92e-09 -5.81900207355184040, 56476269.50939146400000000, // 2.96e-09 -5.81675774012711160, 55743637.53555643600000000, // 3e-09 -5.81454232877150010, 55030040.21079235500000000, // 3.04e-09 -5.81235509293856720, 54334742.01423079500000000, // 3.08e-09 -5.81019531474468740, 53657044.91696551400000000, // 3.12e-09 -5.80806230351721010, 52996286.02036088000000000, // 3.16e-09 -5.80595539443353650, 52351835.37081205100000000, // 3.2e-09 -5.80387394724429220, 51723093.93573046500000000, // 3.24e-09 -5.80181734507449850, 51109491.72706338000000000, // 3.28e-09 -5.79978499329702760, 50510486.05992421500000000, // 3.32e-09 -5.79777631847325290, 49925559.93513780100000000, // 3.36e-09 -5.79579076735604120, 49354220.53549897700000000, // 3.4e-09 -5.79382780595078460, 48795997.82653579100000000, // 3.44e-09 -5.79188691863047640, 48250443.25340254600000000, // 3.48e-09 -5.78996760730110170, 47717128.52626808000000000, // 3.52e-09 -5.78806939061393420, 47195644.48726068400000000, // 3.56e-09 -5.78619180322169150, 46685600.05267167800000000, // 3.6e-09 -5.78433439507551750, 46186621.22460731900000000, // 3.64e-09 -5.78249673076028080, 45698350.16686905200000000, // 3.68e-09 -5.78067838886555930, 45220444.34019924700000000, // 3.72e-09 -5.77887896139014680, 44752575.69251904600000000, // 3.76e-09 -5.77709805317790440, 44294429.90010375500000000, // 3.8e-09 -5.77533528138301660, 43845705.65600039100000000, // 3.84e-09 -5.77359027496280230, 43406114.00228132300000000, // 3.88e-09 -5.77186267419642180, 42975377.70302233800000000, // 3.92e-09 -5.77015213022793900, 42553230.65514081700000000, // 3.96e-09 -5.76845830463215230, 42139417.33442437600000000, // 4e-09 -5.76678086900199730, 41733692.27435533000000000, // 4.04e-09 -5.76511950455613410, 41335819.57546242300000000, // 4.08e-09 -5.76347390176562160, 40945572.44314752500000000, // 4.12e-09 -5.76184375999850220, 40562732.75206223900000000, // 4.16e-09 -5.76022878718133220, 40187090.63528391000000000, // 4.2e-09 -5.75862869947667200, 39818444.09665167300000000, // 4.24e-09 -5.75704322097565590, 39456598.64475704700000000, // 4.28e-09 -5.75547208340476680, 39101366.94718172400000000, // 4.32e-09 -5.75391502584608890, 38752568.50369897500000000, // 4.36e-09 -5.75237179447024700, 38410029.33722396200000000, // 4.4e-09 -5.75084214228138090, 38073581.70140405700000000, // 4.44e-09 -5.74932582887351540, 37743063.80381656400000000, // 4.48e-09 -5.74782262019769250, 37418319.54379937100000000, // 4.52e-09 -5.74633228833928640, 37099198.26402198500000000, // 4.56e-09 -5.74485461130506980, 36785554.51498042000000000, // 4.6e-09 -5.74338937281936700, 36477247.83160696200000000, // 4.64e-09 -5.74193636212895960, 36174142.52129918300000000, // 4.68e-09 -5.74049537381628030, 35876107.46269010000000000, // 4.72e-09 -5.73906620762036910, 35583015.91450651700000000, // 4.76e-09 -5.73764866826537110, 35294745.33396370000000000, // 4.8e-09 -5.73624256529605600, 35011177.20411718600000000, // 4.84e-09 -5.73484771292011250, 34732196.86967937600000000, // 4.88e-09 -5.73346392985681690, 34457693.38080601400000000, // 4.92e-09 -5.73209103919182450, 34187559.34441667800000000, // 4.96e-09 -5.73072886823775280, 33921690.78262078800000000, // 5e-09 -5.72937724840028740, 33659986.99785686300000000, // 5.04e-09 -5.72803601504955130, 33402350.44437741900000000, // 5.08e-09 -5.72670500739652510, 33148686.60573927300000000, // 5.12e-09 -5.72538406837422100, 32898903.87796309200000000, // 5.16e-09 -5.72407304452340780, 32652913.45806140500000000, // 5.2e-09 -5.72277178588276140, 32410629.23766398100000000, // 5.24e-09 -5.72148014588307600, 32171967.70144155600000000, // 5.28e-09 -5.72019798124554410, 31936847.83011063900000000, // 5.32e-09 -5.71892515188373540, 31705191.00774759100000000, // 5.36e-09 -5.71766152080930110, 31476920.93322289400000000, // 5.4e-09 -5.71640695404104000, 31251963.53550902400000000, // 5.44e-09 -5.71516132051734440, 31030246.89269422700000000, // 5.48e-09 -5.71392449201180690, 30811701.15450158300000000, // 5.52e-09 -5.71269634305183870, 30596258.46813572600000000, // 5.56e-09 -5.71147675084020000, 30383852.90729596100000000, // 5.6e-09 -5.71026559517930910, 30174420.40419832200000000, // 5.64e-09 -5.70906275839821650, 29967898.68445855400000000, // 5.68e-09 -5.70786812528212200, 29764227.20469473300000000, // 5.72e-09 -5.70668158300434490, 29563347.09272196500000000, // 5.76e-09 -5.70550302106062810, 29365201.09020856000000000, // 5.8e-09 -5.70433233120568950, 29169733.49768109600000000, // 5.84e-09 -5.70316940739193430, 28976890.12176466400000000, // 5.88e-09 -5.70201414571022000, 28786618.22455155800000000, // 5.92e-09 -5.70086644433262710, 28598866.47500435300000000, // 5.96e-09 -5.69972620345713480, 28413584.90229390600000000, // 6e-09 -5.69859332525408660, 28230724.85097850100000000, // 6.04e-09 -5.69746771381445070, 28050238.93795048800000000, // 6.08e-09 -5.69634927509978530, 27872081.01106771500000000, // 6.12e-09 -5.69523791689376680, 27696206.10937960400000000, // 6.16e-09 -5.69413354875532460, 27522570.42489509700000000, // 6.2e-09 -5.69303608197327550, 27351131.26581431200000000, // 6.24e-09 -5.69194542952235860, 27181847.02115316300000000, // 6.28e-09 -5.69086150602071860, 27014677.12671529900000000, // 6.32e-09 -5.68978422768868160, 26849582.03233640300000000, // 6.36e-09 -5.68871351230881220, 26686523.17035094600000000, // 6.4e-09 -5.68764927918726130, 26525462.92523702600000000, // 6.44e-09 -5.68659144911622770, 26366364.60437016600000000, // 6.48e-09 -5.68553994433763420, 26209192.40985778300000000, // 6.52e-09 -5.68449468850788530, 26053911.41139728600000000, // 6.56e-09 -5.68345560666368050, 25900487.52011523800000000, // 6.6e-09 -5.68242262518885970, 25748887.46334878400000000, // 6.64e-09 -5.68139567178226110, 25599078.76033265900000000, // 6.68e-09 -5.68037467542650280, 25451029.69874680400000000, // 6.72e-09 -5.67935956635770370, 25304709.31209502000000000, // 6.76e-09 -5.67835027603610240, 25160087.35788065200000000, // 6.8e-09 -5.67734673711749420, 25017134.29653906800000000, // 6.84e-09 -5.67634888342554960, 24875821.27110941700000000, // 6.88e-09 -5.67535664992488890, 24736120.08760305500000000, // 6.92e-09 -5.67436997269494990, 24598003.19604839400000000, // 6.96e-09 -5.67338878890459600, 24461443.67218277600000000, // 7e-09 -5.67241303678744120, 24326415.19976519800000000, // 7.04e-09 -5.67144265561787450, 24192892.05348720800000000, // 7.08e-09 -5.67047758568775780, 24060849.08245696900000000, // 7.12e-09 -5.66951776828376720, 23930261.69423446400000000, // 7.16e-09 -5.66856314566536670, 23801105.83939675600000000, // 7.2e-09 -5.66761366104337490, 23673357.99661094000000000, // 7.24e-09 -5.66666925855915250, 23546995.15820228700000000, // 7.28e-09 -5.66572988326433440, 23421994.81618958000000000, // 7.32e-09 -5.66479548110109740, 23298334.94877276900000000, // 7.36e-09 -5.66386599888297940, 23175994.00725949600000000, // 7.4e-09 -5.66294138427623220, 23054950.90341382500000000, // 7.44e-09 -5.66202158578162160, 22935184.99720320900000000, // 7.48e-09 -5.66110655271674370, 22816676.08493861200000000, // 7.52e-09 -5.66019623519883110, 22699404.38779301600000000, // 7.56e-09 -5.65929058412791970, 22583350.54066925100000000, // 7.6e-09 -5.65838955117059860, 22468495.58143413400000000, // 7.64e-09 -5.65749308874401890, 22354820.94046724600000000, // 7.68e-09 -5.65660115000046650, 22242308.43055233000000000, // 7.72e-09 -5.65571368881220330, 22130940.23706339700000000, // 7.76e-09 -5.65483065975681320, 22020698.90846695000000000, // 7.8e-09 -5.65395201810280400, 21911567.34709857800000000, // 7.84e-09 -5.65307771979568500, 21803528.80023328600000000, // 7.88e-09 -5.65220772144431470, 21696566.85141552200000000, // 7.92e-09 -5.65134198030760790, 21590665.41205122700000000, // 7.96e-09 -5.65048045428162920, 21485808.71325837100000000, // 8e-09 -5.64962310188692380, 21381981.29794903500000000, // 8.04e-09 -5.64876988225620650, 21279168.01315162300000000, // 8.08e-09 -5.64792075512236110, 21177354.00255991500000000, // 8.12e-09 -5.64707568080671240, 21076524.69929773700000000, // 8.16e-09 -5.64623462020758820, 20976665.81889531000000000, // 8.2e-09 -5.64539753478915700, 20877763.35246892300000000, // 8.24e-09 -5.64456438657053900, 20779803.56009814500000000, // 8.28e-09 -5.64373513811518990, 20682772.96439464800000000, // 8.32e-09 -5.64290975252050760, 20586658.34425133800000000, // 8.36e-09 -5.64208819340771490, 20491446.72877264800000000, // 8.4e-09 -5.64127042491195850, 20397125.39137414100000000, // 8.44e-09 -5.64045641167265990, 20303681.84405066800000000, // 8.48e-09 -5.63964611882408830, 20211103.83180471900000000, // 8.52e-09 -5.63883951198613160, 20119379.32722801300000000, // 8.56e-09 -5.63803655725532330, 20028496.52523820100000000, // 8.6e-09 -5.63723722119603110, 19938443.83795642900000000, // 8.64e-09 -5.63644147083187620, 19849209.88972865800000000, // 8.68e-09 -5.63564927363734820, 19760783.51228366400000000, // 8.72e-09 -5.63486059752959620, 19673153.74002145600000000, // 8.76e-09 -5.63407541086041430, 19586309.80543042700000000, // 8.8e-09 -5.63329368240841260, 19500241.13462919400000000, // 8.84e-09 -5.63251538137135380, 19414937.34302703700000000, // 8.88e-09 -5.63174047735867320, 19330388.23110203100000000, // 8.92e-09 -5.63096894038414940, 19246583.78029016400000000, // 8.96e-09 -5.63020074085875330, 19163514.14898511800000000, // 9e-09 -5.62943584958364430, 19081169.66864299800000000, // 9.04e-09 -5.62867423774332740, 18999540.83998997900000000, // 9.08e-09 -5.62791587689895860, 18918618.32932941200000000, // 9.12e-09 -5.62716073898178770, 18838392.96494444500000000, // 9.16e-09 -5.62640879628674640, 18758855.73359418300000000, // 9.2e-09 -5.62566002146618520, 18679997.77710181100000000, // 9.24e-09 -5.62491438752374600, 18601810.38903071700000000, // 9.28e-09 -5.62417186780834030, 18524285.01144276200000000, // 9.32e-09 -5.62343243600827500, 18447413.23174204700000000, // 9.36e-09 -5.62269606614550900, 18371186.77959889500000000, // 9.4e-09 -5.62196273257003030, 18295597.52395200400000000, // 9.44e-09 -5.62123240995431670, 18220637.47008252100000000, // 9.48e-09 -5.62050507328795670, 18146298.75676602500000000, // 9.52e-09 -5.61978069787238080, 18072573.65349566600000000, // 9.56e-09 -5.61905925931565080, 17999454.55776900100000000, // 9.6e-09 -5.61834073352742180, 17926933.99244895200000000, // 9.64e-09 -5.61762509671397850, 17855004.60318661900000000, // 9.68e-09 -5.61691232537334350, 17783659.15590470300000000, // 9.72e-09 -5.61620239629056520, 17712890.53435041400000000, // 9.76e-09 -5.61549528653299570, 17642691.73769764600000000, // 9.8e-09 -5.61479097344578640, 17573055.87821921300000000, // 9.84e-09 -5.61408943464733310, 17503976.17900174900000000, // 9.88e-09 -5.61339064802496960, 17435445.97173084700000000, // 9.92e-09 -5.61269459173058930, 17367458.69451404700000000, // 9.96e-09 -5.61200124417650410, 17300007.88977026200000000, // 1e-08 -5.61200124417575900, 17300007.88969792100000000, // 1e-08 -5.49085175210500330, 8829995.07658605840000000, // 2e-08 -5.41880116739855570, 5960360.82969837730000000, // 3e-08 -5.36712863993124500, 4510747.55165233460000000, // 4e-08 -5.32672388638513720, 3634318.66547436130000000, // 5e-08 -5.29349579887161160, 3046449.64442066760000000, // 6e-08 -5.26524831138901740, 2624388.36617674860000000, // 7e-08 -5.24066378843172040, 2306442.85236008190000000, // 8e-08 -5.21888858185543650, 2058190.07071363650000000, // 9e-08 -5.19933758219360160, 1858897.59665733250000000, // 1e-07 -5.18159202537014530, 1695327.49393441180000000, // 1.1e-07 -5.16534175680254300, 1558627.62658112680000000, // 1.2e-07 -5.15035057903806150, 1442652.62362028910000000, // 1.3e-07 -5.13643441732545990, 1343001.77201186490000000, // 1.4e-07 -5.12344700001733070, 1256440.29031750300000000, // 1.5e-07 -5.11127014709674480, 1180536.78022878430000000, // 1.6e-07 -5.09980699328131060, 1113428.12799423440000000, // 1.7e-07 -5.08897714125751220, 1053662.45495422460000000, // 1.8e-07 -5.07871312032534930, 1000091.45870491300000000, // 1.9e-07 -5.06895774971878140, 951794.91716606985000000, // 2e-07 -5.05966214249785470, 908026.67174240528000000, // 2.1e-07 -5.05078417174525370, 868175.27934082388000000, // 2.2e-07 -5.04228727615183820, 831734.88469910854000000, // 2.3e-07 -5.03413951861014120, 798283.34283557022000000, // 2.4e-07 -5.02631283605774830, 767465.56897291250000000, // 2.5e-07 -5.01878243572407530, 738980.71371185384000000, // 2.6e-07 -5.01152630474939280, 712572.17540045746000000, // 2.7e-07 -5.00452480853024890, 688019.74305321998000000, // 2.8e-07 -4.99776035918156400, 665133.35748735606000000, // 2.9e-07 -4.99121713990882740, 643748.11452622991000000, // 3e-07 -4.98488087433450300, 623720.23087549582000000, // 3.1e-07 -4.97873863224989410, 604923.76289767120000000, // 3.2e-07 -4.97277866509485560, 587247.91919770814000000, // 3.3e-07 -4.96699026586282950, 570594.84524067945000000, // 3.4e-07 -4.96136364920092990, 554877.78596474312000000, // 3.5e-07 -4.95588984830617640, 540019.55317961250000000, // 3.6e-07 -4.95056062586864960, 525951.24031660717000000, // 3.7e-07 -4.94536839682369680, 512611.13914654875000000, // 3.8e-07 -4.94030616108085500, 499943.82235969888000000, // 3.9e-07 -4.93536744472065700, 487899.36309819442000000, // 4e-07 -4.93054624841038440, 476432.66815303051000000, // 4.1e-07 -4.92583700199974480, 465502.90595814411000000, // 4.2e-07 -4.92123452442787370, 455073.01401197759000000, // 4.3e-07 -4.91673398821247880, 445109.27314202499000000, // 4.4e-07 -4.91233088790603480, 435580.93825684756000000, // 4.5e-07 -4.90802101199836030, 426459.91702503007000000, // 4.6e-07 -4.90380041782290910, 417720.48937232280000000, // 4.7e-07 -4.89966540908914010, 409339.06186893245000000, // 4.8e-07 -4.89561251571760540, 401293.95204328001000000, // 4.9e-07 -4.89163847569990560, 393565.19844983926000000, // 5e-07 -4.88774021874416680, 386134.39297108253000000, // 5.1e-07 -4.88391485149888370, 378984.53237275302000000, // 5.2e-07 -4.88015964417569850, 372099.88658040197000000, // 5.3e-07 -4.87647201841492880, 365465.88151862164000000, // 5.4e-07 -4.87284953625769650, 359068.99466737238000000, // 5.5e-07 -4.86928989010559740, 352896.66175245214000000, // 5.6e-07 -4.86579089356356940, 346937.19320859032000000, // 5.7e-07 -4.86235047307418980, 341179.69924060098000000, // 5.8e-07 -4.85896666026272680, 335614.02246700297000000, // 5.9e-07 -4.85563758492149320, 330230.67726502212000000, // 6e-07 -4.85236146857052560, 325020.79505144944000000, // 6.1e-07 -4.84913661853857560, 319976.07483192213000000, // 6.2e-07 -4.84596142251473070, 315088.73843580578000000, // 6.3e-07 -4.84283434352640360, 310351.48992635700000000, // 6.4e-07 -4.83975391530423950, 305757.47873848607000000, // 6.5e-07 -4.83671873799868290, 301300.26615047955000000, // 6.6e-07 -4.83372747421658830, 296973.79474279337000000, // 6.7e-07 -4.83077884534962100, 292772.36053783714000000, // 6.8e-07 -4.82787162816899060, 288690.58754989580000000, // 6.9e-07 -4.82500465166366240, 284723.40450525592000000, // 7e-07 -4.82217679410136930, 280866.02351942024000000, // 7.1e-07 -4.81938698029392840, 277113.92054211110000000, // 7.2e-07 -4.81663417904992390, 273462.81740112836000000, // 7.3e-07 -4.81391740079961930, 269908.66529459273000000, // 7.4e-07 -4.81123569537827840, 266447.62959695031000000, // 7.5e-07 -4.80858814995532850, 263076.07585821528000000, // 7.6e-07 -4.80597388709806680, 259790.55688855224000000, // 7.7e-07 -4.80339206295947550, 256587.80083113103000000, // 7.8e-07 -4.80084186558072990, 253464.70013610439000000, // 7.9e-07 -4.79832251329980770, 250418.30135722406000000, // 8e-07 -4.79583325325831570, 247445.79570030517000000, // 8.1e-07 -4.79337335999931560, 244544.51025960254000000, // 8.2e-07 -4.79094213414962940, 241711.89988442569000000, // 8.3e-07 -4.78853890118052310, 238945.53962361862000000, // 8.4e-07 -4.78616301024125160, 236243.11770056302000000, // 8.5e-07 -4.78381383306039700, 233602.42897572601000000, // 8.6e-07 -4.78149076291029210, 231021.36885767250000000, // 8.7e-07 -4.77919321363027640, 228497.92762707564000000, // 8.8e-07 -4.77692061870471020, 226030.18514127922000000, // 8.9e-07 -4.77467243039226120, 223616.30589011920000000, // 9e-07 -4.77244811890290070, 221254.53437591536000000, // 9.1e-07 -4.77024717161963800, 218943.19079322365000000, // 9.2e-07 -4.76806909236202970, 216680.66698580829000000, // 9.3e-07 -4.76591340068883080, 214465.42266032248000000, // 9.4e-07 -4.76377963123729580, 212295.98183783609000000, // 9.5e-07 -4.76166733309683910, 210170.92952595797000000, // 9.6e-07 -4.75957606921497780, 208088.90859574056000000, // 9.7e-07 -4.75750541583348060, 206048.61684871904000000, // 9.8e-07 -4.75545496195301890, 204048.80426081413000000, // 9.9e-07 -4.75342430882448410, 202088.27039065992000000, // 1e-06 -4.75141306946549060, 200165.86194110569000000, // 1.01e-06 -4.74942086820053430, 198280.47046338482000000, // 1.02e-06 -4.74744734022341320, 196431.03019428023000000, // 1.03e-06 -4.74549213118067750, 194616.51601742458000000, // 1.04e-06 -4.74355489677486640, 192835.94154045984000000, // 1.05e-06 -4.74163530238642660, 191088.35728044814000000, // 1.06e-06 -4.73973302271325720, 189372.84895048389000000, // 1.07e-06 -4.73784774142694420, 187688.53584100891000000, // 1.08e-06 -4.73597915084468020, 186034.56928970129000000, // 1.09e-06 -4.73412695161611110, 184410.13123441525000000, // 1.1e-06 -4.73229085242424660, 182814.43284390366000000, // 1.11e-06 -4.73047056969967630, 181246.71322148351000000, // 1.12e-06 -4.72866582734742820, 179706.23817718084000000, // 1.13e-06 -4.72687635648577590, 178192.29906414577000000, // 1.14e-06 -4.72510189519636280, 176704.21167543452000000, // 1.15e-06 -4.72334218828508770, 175241.31519755838000000, // 1.16e-06 -4.72159698705317510, 173802.97121739737000000, // 1.17e-06 -4.71986604907791920, 172388.56277933018000000, // 1.18e-06 -4.71814913800264700, 170997.49348967188000000, // 1.19e-06 -4.71644602333537310, 169629.18666561210000000, // 1.2e-06 -4.71475648025576710, 168283.08452613602000000, // 1.21e-06 -4.71308028943002990, 166958.64742253470000000, // 1.22e-06 -4.71141723683324900, 165655.35310622340000000, // 1.23e-06 -4.70976711357891360, 164372.69603180696000000, // 1.24e-06 -4.70812971575523420, 163110.18669341967000000, // 1.25e-06 -4.70650484426792830, 161867.35099248277000000, // 1.26e-06 -4.70489230468918510, 160643.72963517540000000, // 1.27e-06 -4.70329190711251060, 159438.87755799227000000, // 1.28e-06 -4.70170346601318910, 158252.36337987540000000, // 1.29e-06 -4.70012680011409230, 157083.76887949128000000, // 1.3e-06 -4.69856173225659380, 155932.68849631929000000, // 1.31e-06 -4.69700808927636440, 154798.72885429295000000, // 1.32e-06 -4.69546570188381110, 153681.50830680778000000, // 1.33e-06 -4.69393440454898860, 152580.65650200541000000, // 1.34e-06 -4.69241403539073420, 151495.81396725433000000, // 1.35e-06 -4.69090443606986440, 150426.63171185931000000, // 1.36e-06 -4.68940545168630600, 149372.77084710993000000, // 1.37e-06 -4.68791693067986250, 148333.90222269972000000, // 1.38e-06 -4.68643872473461890, 147309.70607880922000000, // 1.39e-06 -4.68497068868669330, 146299.87171297919000000, // 1.4e-06 -4.68351268043527820, 145304.09716109972000000, // 1.41e-06 -4.68206456085679610, 144322.08889179915000000, // 1.42e-06 -4.68062619372204210, 143353.56151358117000000, // 1.43e-06 -4.67919744561620200, 142398.23749410387000000, // 1.44e-06 -4.67777818586161680, 141455.84689100634000000, // 1.45e-06 -4.67636828644317770, 140526.12709373469000000, // 1.46e-06 -4.67496762193626300, 139608.82257585370000000, // 1.47e-06 -4.67357606943709310, 138703.68465733956000000, // 1.48e-06 -4.67219350849539870, 137810.47127638146000000, // 1.49e-06 -4.67081982104936340, 136928.94677028526000000, // 1.5e-06 -4.66945489136268230, 136058.88166501280000000, // 1.51e-06 -4.66809860596368950, 135200.05247298814000000, // 1.52e-06 -4.66675085358647830, 134352.24149879563000000, // 1.53e-06 -4.66541152511391920, 133515.23665239953000000, // 1.54e-06 -4.66408051352249680, 132688.83126954761000000, // 1.55e-06 -4.66275771382894440, 131872.82393906612000000, // 1.56e-06 -4.66144302303853040, 131067.01833668994000000, // 1.57e-06 -4.66013634009499800, 130271.22306518526000000, // 1.58e-06 -4.65883756583207820, 129485.25150047228000000, // 1.59e-06 -4.65754660292648830, 128708.92164347174000000, // 1.6e-06 -4.65626335585241340, 127942.05597745995000000, // 1.61e-06 -4.65498773083736950, 127184.48133066650000000, // 1.62e-06 -4.65371963581941280, 126436.02874389853000000, // 1.63e-06 -4.65245898040567060, 125696.53334299501000000, // 1.64e-06 -4.65120567583209520, 124965.83421587710000000, // 1.65e-06 -4.64995963492444280, 124243.77429402505000000, // 1.66e-06 -4.64872077206041910, 123530.20023819388000000, // 1.67e-06 -4.64748900313294120, 122824.96232818230000000, // 1.68e-06 -4.64626424551446690, 122127.91435648518000000, // 1.69e-06 -4.64504641802240140, 121438.91352569846000000, // 1.7e-06 -4.64383544088548830, 120757.82034948659000000, // 1.71e-06 -4.64263123571117210, 120084.49855698858000000, // 1.72e-06 -4.64143372545392370, 119418.81500053089000000, // 1.73e-06 -4.64024283438443860, 118760.63956648673000000, // 1.74e-06 -4.63905848805974670, 118109.84508919538000000, // 1.75e-06 -4.63788061329413550, 117466.30726777887000000, // 1.76e-06 -4.63670913813091620, 116829.90458577835000000, // 1.77e-06 -4.63554399181497080, 116200.51823347843000000, // 1.78e-06 -4.63438510476605270, 115578.03203281556000000, // 1.79e-06 -4.63323240855284180, 114962.33236478262000000, // 1.8e-06 -4.63208583586770570, 114353.30809922366000000, // 1.81e-06 -4.63094532050216310, 113750.85052693529000000, // 1.82e-06 -4.62981079732298450, 113154.85329396675000000, // 1.83e-06 -4.62868220224896460, 112565.21233806170000000, // 1.84e-06 -4.62755947222833620, 111981.82582716008000000, // 1.85e-06 -4.62644254521673570, 111404.59409984382000000, // 1.86e-06 -4.62533136015580570, 110833.41960770867000000, // 1.87e-06 -4.62422585695234820, 110268.20685955764000000, // 1.88e-06 -4.62312597645800240, 109708.86236734192000000, // 1.89e-06 -4.62203166044950640, 109155.29459382629000000, // 1.9e-06 -4.62094285160941620, 108607.41390186072000000, // 1.91e-06 -4.61985949350737270, 108065.13250525117000000, // 1.92e-06 -4.61878153058182140, 107528.36442113479000000, // 1.93e-06 -4.61770890812220540, 106997.02542382189000000, // 1.94e-06 -4.61664157225164120, 106471.03300006303000000, // 1.95e-06 -4.61557946990998060, 105950.30630565148000000, // 1.96e-06 -4.61452254883735160, 105434.76612336625000000, // 1.97e-06 -4.61347075755810110, 104924.33482217442000000, // 1.98e-06 -4.61242404536511150, 104418.93631764449000000, // 1.99e-06 -4.61138236230453290, 103918.49603355268000000, // 2e-06 -4.61138236230341470, 103918.49603301681000000, // 2e-06 -4.46518391558548180, 53523.29363673485900000, // 4e-06 -4.37758784669368590, 36336.43409495783300000, // 6e-06 -4.31445102180943160, 27616.87679755427600000, // 8e-06 -4.26489079392365070, 22327.74323027730100000, // 1e-05 -4.22400379967290540, 18770.51530832412400000, // 1.2e-05 -4.18915103666763140, 16210.78008419793700000, // 1.4e-05 -4.15874563369469730, 14278.65660362810600000, // 1.6e-05 -4.13175756712955340, 12767.38089828110600000, // 1.8e-05 -4.10747965458730930, 11552.22212972608900000, // 2e-05 -4.08540500371110940, 10553.42314903729500000, // 2.2e-05 -4.06515767544369490, 9717.58098197578330000, // 2.4e-05 -4.04645101514951740, 9007.57746109229450000, // 2.6e-05 -4.02906136606688210, 8396.80267943087530000, // 2.8e-05 -4.01281081111947650, 7865.67658136213780000, // 3e-05 -3.99755545667090570, 7399.46772672519000000, // 3.2e-05 -3.98317724892609530, 6986.87753876051740000, // 3.4e-05 -3.96957811591209260, 6619.09374059553920000, // 3.6e-05 -3.95667568365260940, 6289.14094728336840000, // 3.8e-05 -3.94440008416078400, 5991.42491526749650000, // 4e-05 -3.93269153709750000, 5721.40621637828740000, // 4.2e-05 -3.92149849019014510, 5475.36236283062590000, // 4.4e-05 -3.91077617013231470, 5250.21160056020200000, // 4.6e-05 -3.90048543968974840, 5043.38047715217540000, // 4.8e-05 -3.89059188641449170, 4852.70299149580750000, // 5e-05 -3.88106508876392640, 4676.34286728816550000, // 5.2e-05 -3.87187801967898930, 4512.73298729285940000, // 5.4e-05 -3.86300655779951500, 4360.52772126334820000, // 5.6e-05 -3.85442908378668790, 4218.56505217330780000, // 5.8e-05 -3.84612614454412770, 4085.83622700459770000, // 6e-05 -3.83808017206010050, 3961.46124237825730000, // 6.2e-05 -3.83027524652975030, 3844.66889575389000000, // 6.4e-05 -3.82269689563276630, 3734.78043916730300000, // 6.6e-05 -3.81533192353109780, 3631.19609798781860000, // 6.8e-05 -3.80816826445049240, 3533.38388494146830000, // 7e-05 -3.80119485671728840, 3440.87026564565440000, // 7.2e-05 -3.79440153390951100, 3353.23232737921940000, // 7.4e-05 -3.78777893040175330, 3270.09117577437380000, // 7.6e-05 -3.78131839907530500, 3191.10634031244350000, // 7.8e-05 -3.77501193935785300, 3115.97101311233520000, // 8e-05 -3.76885213407257870, 3044.40797957511680000, // 8.2e-05 -3.76283209383158600, 2976.16612625467590000, // 8.4e-05 -3.75694540791569630, 2911.01743254212850000, // 8.6e-05 -3.75118610075206550, 2848.75436965118250000, // 8.8e-05 -3.74554859323996860, 2789.18764392372400000, // 9e-05 -3.74002766828987630, 2732.14423237319620000, // 9.2e-05 -3.73461844003586800, 2677.46566720187500000, // 9.4e-05 -3.72931632626066410, 2625.00653320293530000, // 9.6e-05 -3.72411702363857340, 2574.63314781880810000, // 9.8e-05 -3.71901648545720720, 2526.22239843948770000, // 0.0001 -3.71401090152551690, 2479.66071549025400000, // 0.000102 -3.70909668001526290, 2434.84316314138690000, // 0.000104 -3.70427043101650180, 2391.67263220002270000, // 0.000106 -3.69952895161623950, 2350.05912201982570000, // 0.000108 -3.69486921233379030, 2309.91910016906150000, // 0.00011 -3.69028834476719500, 2271.17493019717770000, // 0.000112 -3.68578363032304200, 2233.75435918901480000, // 0.000114 -3.68135248991744520, 2197.59005793569620000, // 0.000116 -3.67699247454932010, 2162.61920751866770000, // 0.000118 -3.67270125665860680, 2128.78312692568530000, // 0.00012 -3.66847662219220230, 2096.02693701999310000, // 0.000122 -3.66431646330902080, 2064.29925678379320000, // 0.000124 -3.66021877166332170, 2033.55192827289620000, // 0.000126 -3.65618163221203660, 2003.73976716190900000, // 0.000128 -3.65220321749774350, 1974.82033614169360000, // 0.00013 -3.64828178236400320, 1946.75373876054390000, // 0.000132 -3.64441565906438520, 1919.50243158703460000, // 0.000134 -3.64060325273039710, 1893.03105282021080000, // 0.000136 -3.63684303716717670, 1867.30626568958770000, // 0.000138 -3.63313355094880920, 1842.29661517509290000, // 0.00014 -3.62947339378799640, 1817.97239674241000000, // 0.000142 -3.62586122315721090, 1794.30553593291120000, // 0.000144 -3.62229575114069210, 1771.26947777415690000, // 0.000146 -3.61877574149858240, 1748.83908508795460000, // 0.000148 -3.61530000692622710, 1726.99054487079020000, // 0.00015 -3.61186740649329250, 1705.70128200824620000, // 0.000152 -3.60847684324864870, 1684.94987966062400000, // 0.000154 -3.60512726197832880, 1664.71600572528060000, // 0.000156 -3.60181764710493770, 1644.98034484064150000, // 0.000158 -3.59854702071789890, 1625.72453545003920000, // 0.00016 -3.59531444072490780, 1606.93111149125910000, // 0.000162 -3.59211899911568590, 1588.58344831918500000, // 0.000164 -3.58895982032996710, 1570.66571250708350000, // 0.000166 -3.58583605972226320, 1553.16281520533630000, // 0.000168 -3.58274690211661760, 1536.06036876670690000, // 0.00017 -3.57969156044504370, 1519.34464637382390000, // 0.000172 -3.57666927446392260, 1503.00254442910930000, // 0.000174 -3.57367930954303010, 1487.02154748871130000, // 0.000176 -3.57072095552233200, 1471.38969554182520000, // 0.000178 -3.56779352563201750, 1456.09555345405970000, // 0.00018 -3.56489635547161890, 1441.12818240954430000, // 0.000182 -3.56202880204439780, 1426.47711320083140000, // 0.000184 -3.55919024284338190, 1412.13232122812930000, // 0.000186 -3.55638007498583610, 1398.08420308180850000, // 0.000188 -3.55359771439306150, 1384.32355459200680000, // 0.00019 -3.55084259501272430, 1370.84155023920470000, // 0.000192 -3.54811416808108500, 1357.62972382820820000, // 0.000194 -3.54541190142269700, 1344.67995033589520000, // 0.000196 -3.54273527878527970, 1331.98442885016860000, // 0.000198 -3.54008379920772760, 1319.53566652454670000, // 0.0002 -3.53745697641921810, 1307.32646347811870000, // 0.000202 -3.53485433826764340, 1295.34989857666870000, // 0.000204 -3.53227542617564840, 1283.59931603539800000, // 0.000206 -3.52971979462268550, 1272.06831278833370000, // 0.000208 -3.52718701065160320, 1260.75072657362970000, // 0.00021 -3.52467665339839620, 1249.64062468788050000, // 0.000212 -3.52218831364381260, 1238.73229336591520000, // 0.000214 -3.51972159338559100, 1228.02022774573830000, // 0.000216 -3.51727610543025020, 1217.49912238153870000, // 0.000218 -3.51485147300330070, 1207.16386226982100000, // 0.00022 -3.51244732937693000, 1197.00951435671750000, // 0.000222 -3.51006331751422570, 1187.03131949660270000, // 0.000224 -3.50769908972903900, 1177.22468483413510000, // 0.000226 -3.50535430736069080, 1167.58517658401980000, // 0.000228 -3.50302864046273490, 1158.10851318436520000, // 0.00023 -3.50072176750506840, 1148.79055880132320000, // 0.000232 -3.49843337508869560, 1139.62731716408550000, // 0.000234 -3.49616315767249650, 1130.61492571073810000, // 0.000236 -3.49391081731142710, 1121.74965002693420000, // 0.000238 -3.49167606340555410, 1113.02787856032070000, // 0.00024 -3.48945861245938980, 1104.44611759486090000, // 0.000242 -3.48725818785104960, 1096.00098647037410000, // 0.000244 -3.48507451961072200, 1087.68921303327580000, // 0.000246 -3.48290734420802380, 1079.50762930566840000, // 0.000248 -3.48075640434780450, 1071.45316736057320000, // 0.00025 -3.47862144877400860, 1063.52285539198720000, // 0.000252 -3.47650223208120360, 1055.71381396902550000, // 0.000254 -3.47439851453344110, 1048.02325246427860000, // 0.000256 -3.47231006189007020, 1040.44846564680620000, // 0.000258 -3.47023664523823210, 1032.98683043118510000, // 0.00026 -3.46817804083168780, 1025.63580277412670000, // 0.000262 -3.46613402993572350, 1018.39291471104530000, // 0.000264 -3.46410439867784880, 1011.25577152519420000, // 0.000266 -3.46208893790401940, 1004.22204904246540000, // 0.000268 -3.46008744304016560, 997.28949104547951000, // 0.00027 -3.45809971395876130, 990.45590680074213000, // 0.000272 -3.45612555485024500, 983.71916869325241000, // 0.000274 -3.45416477409906310, 977.07720996307194000, // 0.000276 -3.45221718416413690, 970.52802253876371000, // 0.000278 -3.45028260146357810, 964.06965496293560000, // 0.00028 -3.44836084626346470, 957.70021040531344000, // 0.000282 -3.44645174257050210, 951.41784475905581000, // 0.000284 -3.44455511802840640, 945.22076481625402000, // 0.000286 -3.44267080381788220, 939.10722651888034000, // 0.000288 -3.44079863455999920, 933.07553328142717000, // 0.00029 -3.43893844822286930, 927.12403438193007000, // 0.000292 -3.43709008603148590, 921.25112341815941000, // 0.000294 -3.43525339238055730, 915.45523682576027000, // 0.000296 -3.43342821475027860, 909.73485245567986000, // 0.000298 -3.43161440362486790, 904.08848820793332000, // 0.0003 -3.42981181241379400, 898.51470071924973000, // 0.000302 -3.42802029737556910, 893.01208410205209000, // 0.000304 -3.42623971754402000, 887.57926873249062000, // 0.000306 -3.42446993465693160, 882.21492008528935000, // 0.000308 -3.42271081308697860, 876.91773761330808000, // 0.00031 -3.42096221977485370, 871.68645366984560000, // 0.000312 -3.41922402416450930, 866.51983247176395000, // 0.000314 -3.41749609814043080, 861.41666910165270000, // 0.000316 -3.41577831596688820, 856.37578854738445000, // 0.000318 -3.41407055422902990, 851.39604477725629000, // 0.00032 -3.41237269177584100, 846.47631984944940000, // 0.000322 -3.41068460966481490, 841.61552305408657000, // 0.000324 -3.40900619110832710, 836.81259008665802000, // 0.000326 -3.40733732142161740, 832.06648225138360000, // 0.000328 -3.40567788797235680, 827.37618569335655000, // 0.00033 -3.40402778013170070, 822.74071065814235000, // 0.000332 -3.40238688922681080, 818.15909077779372000, // 0.000334 -3.40075510849477340, 813.63038238212869000, // 0.000336 -3.39913233303787620, 809.15366383426431000, // 0.000338 -3.39751845978018040, 804.72803488937870000, // 0.00034 -3.39591338742536400, 800.35261607580344000, // 0.000342 -3.39431701641577370, 796.02654809750788000, // 0.000344 -3.39272924889265500, 791.74899125713205000, // 0.000346 -3.39114998865751890, 787.51912489875474000, // 0.000348 -3.38957914113459190, 783.33614686956935000, // 0.00035 -3.38801661333434100, 779.19927299980145000, // 0.000352 -3.38646231381800700, 775.10773660005702000, // 0.000354 -3.38491615266314040, 771.06078797552027000, // 0.000356 -3.38337804143007630, 767.05769395623952000, // 0.000358 -3.38184789312934250, 763.09773744296717000, // 0.00036 -3.38032562218996540, 759.18021696793096000, // 0.000362 -3.37881114442863240, 755.30444626994881000, // 0.000364 -3.37730437701968130, 751.46975388332282000, // 0.000366 -3.37580523846593120, 747.67548274011347000, // 0.000368 -3.37431364857024850, 743.92098978507420000, // 0.00037 -3.37282952840791990, 740.20564560303205000, // 0.000372 -3.37135280029971480, 736.52883405800162000, // 0.000374 -3.36988338778569530, 732.88995194382028000, // 0.000376 -3.36842121559968530, 729.28840864569736000, // 0.000378 -3.36696620964441800, 725.72362581239395000, // 0.00038 -3.36551829696733580, 722.19503703862870000, // 0.000382 -3.36407740573700260, 718.70208755729016000, // 0.000384 -3.36264346522012490, 715.24423394113808000, // 0.000386 -3.36121640575916780, 711.82094381367563000, // 0.000388 -3.35979615875053160, 708.43169556881003000, // 0.00039 -3.35838265662328530, 705.07597809904064000, // 0.000392 -3.35697583281843760, 701.75329053185237000, // 0.000394 -3.35557562176871600, 698.46314197400318000, // 0.000396 -3.35418195887886930, 695.20505126350417000, // 0.000398 -3.35279478050643260, 691.97854672890571000, // 0.0004 -3.35141402394299480, 688.78316595578144000, // 0.000402 -3.35003962739590170, 685.61845556002538000, // 0.000404 -3.34867152997042440, 682.48397096783378000, // 0.000406 -3.34730967165234670, 679.37927620207267000, // 0.000408 -3.34595399329098650, 676.30394367486838000, // 0.00041 -3.34460443658261490, 673.25755398616161000, // 0.000412 -3.34326094405427600, 670.23969572806084000, // 0.000414 -3.34192345904800230, 667.24996529480779000, // 0.000416 -3.34059192570538690, 664.28796669811459000, // 0.000418 -3.33926628895252800, 661.35331138774688000, // 0.00042 -3.33794649448533990, 658.44561807719151000, // 0.000422 -3.33663248875518240, 655.56451257416347000, // 0.000424 -3.33532421895484490, 652.70962761588260000, // 0.000426 -3.33402163300484620, 649.88060270891776000, // 0.000428 -3.33272467954005160, 647.07708397345380000, // 0.00043 -3.33143330789660390, 644.29872399187138000, // 0.000432 -3.33014746809913480, 641.54518166142793000, // 0.000434 -3.32886711084829210, 638.81612205101942000, // 0.000436 -3.32759218750852840, 636.11121626178021000, // 0.000438 -3.32632265009617490, 633.43014129147832000, // 0.00044 -3.32505845126778030, 630.77257990255123000, // 0.000442 -3.32379954430871430, 628.13822049368616000, // 0.000444 -3.32254588312201230, 625.52675697480026000, // 0.000446 -3.32129742221748490, 622.93788864537862000, // 0.000448 -3.32005411670105220, 620.37132007599212000, // 0.00045 -3.31881592226431590, 617.82676099294656000, // 0.000452 -3.31758279517436620, 615.30392616596464000, // 0.000454 -3.31635469226379960, 612.80253529877859000, // 0.000456 -3.31513157092096120, 610.32231292257541000, // 0.000458 -3.31391338908039400, 607.86298829219811000, // 0.00046 -3.31270010521349080, 605.42429528501009000, // 0.000462 -3.31149167831934800, 603.00597230235553000, // 0.000464 -3.31028806791582040, 600.60776217355021000, // 0.000466 -3.30908923403074960, 598.22941206227915000, // 0.000468 -3.30789513719339380, 595.87067337539713000, // 0.00047 -3.30670573842602790, 593.53130167400468000, // 0.000472 -3.30552099923572220, 591.21105658676447000, // 0.000474 -3.30434088160629540, 588.90970172538869000, // 0.000476 -3.30316534799042620, 586.62700460221208000, // 0.000478 -3.30199436130193650, 584.36273654982540000, // 0.00048 -3.30082788490822490, 582.11667264267487000, // 0.000482 -3.29966588262286730, 579.88859162061192000, // 0.000484 -3.29850831869835530, 577.67827581428969000, // 0.000486 -3.29735515781898950, 575.48551107238848000, // 0.000488 -3.29620636509391400, 573.31008669060805000, // 0.00049 -3.29506190605029080, 571.15179534236938000, // 0.000492 -3.29392174662661660, 569.01043301120001000, // 0.000494 -3.29278585316616600, 566.88579892472478000, // 0.000496 -3.29165419241056470, 564.77769549023378000, // 0.000498 -3.29052673149349940, 562.68592823179677000, // 0.0005 -3.29052673149242160, 562.68592822980111000, // 0.0005 -3.09023230616805700, 296.99235158945464000, // 0.001 -2.96773792534192270, 204.93087557537700000, // 0.0015 -2.87816173909556650, 157.72389926387416000, // 0.002 -2.80703376834385180, 128.85114476229833000, // 0.0025 -2.74778138544501530, 109.29927961932590000, // 0.003 -2.69684426087812980, 95.14699551283895600, // 0.0035 -2.65206980790218430, 84.40913802654958400, // 0.004 -2.61205414122925420, 75.97101998356106400, // 0.0045 -2.57582930354886660, 69.15752224215680100, // 0.005 -2.54269881939900480, 63.53539653173192600, // 0.0055 -2.51214432793041140, 58.81359851222440900, // 0.006 -2.48376929325047560, 54.78922136847867800, // 0.0065 -2.45726339020537440, 51.31639119564332000, // 0.007 -2.43237905858437830, 48.28748780896197700, // 0.0075 -2.40891554581538920, 45.62133986921990200, // 0.008 -2.38670773449217370, 43.25554521172014000, // 0.0085 -2.36561812686421160, 41.14132514296833400, // 0.009 -2.34553097080658950, 39.23998689439002900, // 0.0095 -2.32634787404075330, 37.52043615728749900, // 0.01 -2.30798447494586600, 35.95739270313605800, // 0.0105 -2.29036787785517370, 34.53008735266036700, // 0.011 -2.27343465094267880, 33.22129510936832000, // 0.0115 -2.25712924448612550, 32.01660730191369500, // 0.012 -2.24140272760484340, 30.90387643053840700, // 0.0125 -2.22621176931707110, 29.87278765521295300, // 0.013 -2.21151780918657440, 28.91452440331732300, // 0.0135 -2.19728637664094380, 28.02150479235019300, // 0.014 -2.18348652800644860, 27.18717193989429500, // 0.0145 -2.17009037758444870, 26.40582571014795800, // 0.015 -2.15707270447889550, 25.67248663280273000, // 0.0155 -2.14441062091172530, 24.98278502672787500, // 0.016 -2.13208329080638270, 24.33287003575600200, // 0.0165 -2.12007168974203260, 23.71933451859522500, // 0.017 -2.10835839916898850, 23.13915265445434600, // 0.0175 -2.09692742916422060, 22.58962781735074500, // 0.018 -2.08576406509222910, 22.06834879653368400, // 0.0185 -2.07485473439318560, 21.57315284164620200, // 0.019 -2.06418689040027830, 21.10209432055786000, // 0.0195 -2.05374891063169600, 20.65341801805059400, // 0.02 -2.04353000743972890, 20.22553629145914700, // 0.0205 -2.03352014925292180, 19.81700944732914100, // 0.021 -2.02370999093483660, 19.42652882039576700, // 0.0215 -2.01409081201800830, 19.05290212962796700, // 0.022 -2.00465446176496440, 18.69504076099008200, // 0.0225 -1.99539331016769240, 18.35194868693732700, // 0.023 -1.98630020412929320, 18.02271278156143100, // 0.0235 -1.97736842818181200, 17.70649433010711200, // 0.024 -1.96859166918645840, 17.40252156413244200, // 0.0245 -1.95996398453991790, 17.11008308032814200, // 0.025 -1.95147977347572190, 16.82852202307029200, // 0.0255 -1.94313375110492870, 16.55723092905585500, // 0.026 -1.93492092488725430, 16.29564714756600800, // 0.0265 -1.92683657326377160, 16.04324876258774100, // 0.027 -1.91887622621643580, 15.79955095365006700, // 0.0275 -1.91103564754897780, 15.56410274116432600, // 0.028 -1.90331081870885570, 15.33648406959192400, // 0.0285 -1.89569792399169580, 15.11630318813894100, // 0.029 -1.88819333698836320, 14.90319429408647200, // 0.0295 -1.88079360815110790, 14.69681540847289700, // 0.03 -1.87349545336934820, 14.49684645777617900, // 0.0305 -1.86629574345796300, 14.30298753861057800, // 0.031 -1.85919149447172340, 14.11495734534211100, // 0.0315 -1.85217985876890200, 13.93249174301378300, // 0.032 -1.84525811675535540, 13.75534247011714600, // 0.0325 -1.83842366924763030, 13.58327595760217200, // 0.033 -1.83167403040003430, 13.41607225212585200, // 0.0335 -1.82500682114625650, 13.25352403293720200, // 0.034 -1.81841976311111900, 13.09543571301348000, // 0.0345 -1.81191067295244920, 12.94162261612350800, // 0.035 -1.80547745709699960, 12.79191022242283700, // 0.0355 -1.79911810683781790, 12.64613347599826600, // 0.036 -1.79283069376360230, 12.50413614849376700, // 0.0365 -1.78661336549332030, 12.36577025357695800, // 0.037 -1.78046434169187480, 12.23089550755916500, // 0.0375 -1.77438191034480710, 12.09937883196993800, // 0.038 -1.76836442427201020, 11.97109389431869900, // 0.0385 -1.76241029786223800, 11.84592068365878200, // 0.039 -1.75651800401176320, 11.72374511790788900, // 0.0395 -1.75068607125201710, 11.60445868018074300, // 0.04 -1.74491308105233630, 11.48795808165783000, // 0.0405 -1.73919766528509890, 11.37414494875277300, // 0.041 -1.73353850384164110, 11.26292553255499500, // 0.0415 -1.72793432238826440, 11.15421043871425300, // 0.042 -1.72238389025253610, 11.04791437610465500, // 0.0425 -1.71688601843088560, 10.94395592275893700, // 0.043 -1.71143955770920280, 10.84225730770074100, // 0.0435 -1.70604339688880600, 10.74274420742621500, // 0.044 -1.70069646111075160, 10.64534555589740400, // 0.0445 -1.69539771027197990, 10.54999336700960200, // 0.045 -1.69014613752731390, 10.45662256858547700, // 0.0455 -1.68494076787175780, 10.36517084702996700, // 0.046 -1.67978065679797160, 10.27557850185376500, // 0.0465 -1.67466488902416840, 10.18778830933989700, // 0.047 -1.66959257728802980, 10.10174539468816600, // 0.0475 -1.66456286120256420, 10.01739711202748000, // 0.048 -1.65957490617010240, 9.93469293173521530, // 0.0485 -1.65462790235091960, 9.85358433454867290, // 0.049 -1.64972106368320290, 9.77402471199442860, // 0.0495 -1.64485362695131410, 9.69596927269904360, // 0.05 -1.64002485089951190, 9.61937495417882000, // 0.0505 -1.63523401538849100, 9.54420033973748620, // 0.051 -1.63048042059226090, 9.47040558012901630, // 0.0515 -1.62576338623307540, 9.39795231966931510, // 0.052 -1.62108225085224820, 9.32680362650367200, // 0.0525 -1.61643637111486170, 9.25692392675952290, // 0.053 -1.61182512114646980, 9.18827894233326780, // 0.0535 -1.60724789190005770, 9.12083563207905530, // 0.054 -1.60270409055159700, 9.05456213618364100, // 0.0545 -1.59819313992265720, 8.98942772352736870, // 0.055 -1.59371447792863410, 8.92540274184547220, // 0.0555 -1.58926755705123130, 8.86245857051687120, // 0.056 -1.58485184383392190, 8.80056757581989760, // 0.0565 -1.58046681839920100, 8.73970306850554660, // 0.057 -1.57611197398649770, 8.67983926354891720, // 0.0575 -1.57178681650969860, 8.62095124194929950, // 0.058 -1.56749086413327830, 8.56301491445779740, // 0.0585 -1.56322364686611490, 8.50600698711986780, // 0.059 -1.55898470617209450, 8.44990492852719650, // 0.0595 -1.55477359459669210, 8.39468693868079360, // 0.06 -1.55058987540872970, 8.34033191937312420, // 0.0605 -1.54643312225658570, 8.28681944600339370, // 0.061 -1.54230291883815540, 8.23412974074554600, // 0.0615 -1.53819885858390220, 8.18224364699352340, // 0.062 -1.53412054435238400, 8.13114260501332710, // 0.0625 -1.53006758813766530, 8.08080862873570640, // 0.063 -1.52603961078806360, 8.03122428362747880, // 0.0635 -1.52203624173569300, 7.98237266558315730, // 0.064 -1.51805711873633160, 7.93423738078251530, // 0.0645 -1.51410188761912010, 7.88680252646255650, // 0.065 -1.51017020204565980, 7.84005267255579510, // 0.0655 -1.50626172327808080, 7.79397284414949980, // 0.066 -1.50237611995569060, 7.74854850472334710, // 0.0665 -1.49851306787981110, 7.70376554012524210, // 0.067 -1.49467224980645600, 7.65961024324771330, // 0.0675 -1.49085335524649660, 7.61606929936915300, // 0.068 -1.48705608027300550, 7.57312977212655620, // 0.0685 -1.48328012733545590, 7.53077909008804000, // 0.069 -1.47952520508049500, 7.48900503389542660, // 0.0695 -1.47579102817900630, 7.44779572394871980, // 0.07 -1.47207731715920230, 7.40713960860601440, // 0.0705 -1.46838379824549440, 7.36702545287373490, // 0.071 -1.46471020320289670, 7.32744232756351450, // 0.0715 -1.46105626918674130, 7.28837959889337840, // 0.072 -1.45742173859748530, 7.24982691851206700, // 0.0725 -1.45380635894040950, 7.21177421392654060, // 0.073 -1.45020988268999410, 7.17421167931356510, // 0.0735 -1.44663206715881290, 7.13712976669774870, // 0.074 -1.44307267437073540, 7.10051917747874310, // 0.0745 -1.43953147093829000, 7.06437085429176910, // 0.075 -1.43600822794401610, 7.02867597318614030, // 0.0755 -1.43250272082564580, 6.99342593610731630, // 0.076 -1.42901472926497600, 6.95861236366885900, // 0.0765 -1.42554403708028540, 6.92422708820128640, // 0.077 -1.42209043212215460, 6.89026214706540770, // 0.0775 -1.41865370617257260, 6.85670977621858490, // 0.078 -1.41523365484719470, 6.82356240402266590, // 0.0785 -1.41183007750064180, 6.79081264528313260, // 0.079 -1.40844277713472190, 6.75845329550935410, // 0.0795 -1.40507156030946630, 6.72647732538643610, // 0.08 -1.40171623705688500, 6.69487787544963630, // 0.0805 -1.39837662079732960, 6.66364825095263310, // 0.081 -1.39505252825838080, 6.63278191692152940, // 0.0815 -1.39174377939615910, 6.60227249338669430, // 0.082 -1.38845019731898110, 6.57211375078507310, // 0.0825 -1.38517160821326920, 6.54229960552582220, // 0.083 -1.38190784127164390, 6.51282411571257920, // 0.0835 -1.37865872862311130, 6.48368147701585510, // 0.084 -1.37542410526528510, 6.45486601868952730, // 0.0845 -1.37220380899855980, 6.42637219972547150, // 0.085 -1.36899768036217480, 6.39819460514082290, // 0.0855 -1.36580556257210590, 6.37032794239256180, // 0.086 -1.36262730146071150, 6.34276703791424710, // 0.0865 -1.35946274541809160, 6.31550683377021920, // 0.087 -1.35631174533508100, 6.28854238442246060, // 0.0875 -1.35317415454783680, 6.26186885360581340, // 0.088 -1.35004982878396170, 6.23548151130729880, // 0.0885 -1.34693862611011310, 6.20937573084551350, // 0.089 -1.34384040688104740, 6.18354698604622130, // 0.0895 -1.34075503369005070, 6.15799084851043600, // 0.09 -1.33768237132071750, 6.13270298497155860, // 0.0905 -1.33462228670002770, 6.10767915473809970, // 0.091 -1.33157464885267940, 6.08291520721879040, // 0.0915 -1.32853932885664340, 6.05840707952702040, // 0.092 -1.32551619979989140, 6.03415079416160260, // 0.0925 -1.32250513673826960, 6.01014245676105750, // 0.093 -1.31950601665447250, 5.98637825392868630, // 0.0935 -1.31651871841809510, 5.96285445112590560, // 0.094 -1.31354312274671000, 5.93956739063119250, // 0.0945 -1.31057911216796330, 5.91651348956248490, // 0.095 -1.30762657098263000, 5.89368923796050660, // 0.0955 -1.30468538522862400, 5.87109119693102690, // 0.096 -1.30175544264591640, 5.84871599684382030, // 0.0965 -1.29883663264233970, 5.82656033558634420, // 0.097 -1.29592884626026090, 5.80462097687027700, // 0.0975 -1.29303197614407740, 5.78289474858890620, // 0.098 -1.29014591650852430, 5.76137854122368330, // 0.0985 -1.28727056310777630, 5.74006930629830060, // 0.099 -1.28440581320529650, 5.71896405487843310, // 0.0995 -1.28155156554443540, 5.69805985611579760, // 0.1 -1.27870772031973970, 5.67735383583484050, // 0.1005 -1.27587417914896450, 5.65684317516072710, // 0.101 -1.27305084504575380, 5.63652510918710270, // 0.1015 -1.27023762239298430, 5.61639692568240530, // 0.102 -1.26743441691674020, 5.59645596383332130, // 0.1025 -1.26464113566091530, 5.57669961302424790, // 0.103 -1.26185768696240790, 5.55712531165145050, // 0.1035 -1.25908398042690690, 5.53773054597086920, // 0.104 -1.25631992690524160, 5.51851284897837950, // 0.1045 -1.25356543847028610, 5.49946979932150980, // 0.105 -1.25082042839439820, 5.48059902024153000, // 0.1055 -1.24808481112738230, 5.46189817854496700, // 0.106 -1.24535850227495740, 5.44336498360357450, // 0.1065 -1.24264141857771680, 5.42499718638181960, // 0.107 -1.23993347789057310, 5.40679257849106950, // 0.1075 -1.23723459916266250, 5.38874899126954080, // 0.108 -1.23454470241770740, 5.37086429488725070, // 0.1085 -1.23186370873481850, 5.35313639747517020, // 0.109 -1.22919154022973040, 5.33556324427781090, // 0.1095 -1.22652812003644600, 5.31814281682847770, // 0.11 -1.22387337228929890, 5.30087313214656320, // 0.1105 -1.22122722210540500, 5.28375224195611090, // 0.111 -1.21858959556749970, 5.26677823192503250, // 0.1115 -1.21596041970715450, 5.24994922092435970, // 0.112 -1.21333962248835370, 5.23326336030685720, // 0.1125 -1.21072713279143330, 5.21671883320449230, // 0.113 -1.20812288039736070, 5.20031385384409270, // 0.1135 -1.20552679597235460, 5.18404666688071460, // 0.114 -1.20293881105283560, 5.16791554674816030, // 0.1145 -1.20035885803069590, 5.15191879702614400, // 0.115 -1.19778687013887790, 5.13605474982355670, // 0.1155 -1.19522278143726400, 5.12032176517744820, // 0.116 -1.19266652679885900, 5.10471823046718050, // 0.1165 -1.19011804189626050, 5.08924255984331800, // 0.117 -1.18757726318841520, 5.07389319367086510, // 0.1175 -1.18504412790764710, 5.05866859798638210, // 0.118 -1.18251857404695420, 5.04356726396860020, // 0.1185 -1.18000054034756660, 5.02858770742214390, // 0.119 -1.17748996628676260, 5.01372846827398710, // 0.1195 -1.17498679206592740, 4.99898811008224620, // 0.12 -1.17249095859886140, 4.98436521955701380, // 0.1205 -1.17000240750031680, 4.96985840609281130, // 0.121 -1.16752108107477490, 4.95546630131243230, // 0.1215 -1.16504692230544050, 4.94118755862174820, // 0.122 -1.16257987484346080, 4.92702085277525280, // 0.1225 -1.16011988299735800, 4.91296487945199440, // 0.123 -1.15766689172266800, 4.89901835484161020, // 0.1235 -1.15522084661178990, 4.88518001524022600, // 0.124 -1.15278169388403180, 4.87144861665589880, // 0.1245 -1.15034938037584710, 4.85782293442332680, // 0.125 -1.14792385353127150, 4.84430176282766210, // 0.1255 -1.14550506139253550, 4.83088391473705770, // 0.126 -1.14309295259086620, 4.81756822124381400, // 0.1265 -1.14068747633746150, 4.80435353131381770, // 0.127 -1.13828858241463780, 4.79123871144407690, // 0.1275 -1.13589622116715170, 4.77822264532817000, // 0.128 -1.13351034349368110, 4.76530423352931990, // 0.1285 -1.13113090083847270, 4.75248239316096480, // 0.129 -1.12875784518314460, 4.73975605757457430, // 0.1295 -1.12639112903864060, 4.72712417605452110, // 0.13 -1.12403070543734420, 4.71458571351989430, // 0.1305 -1.12167652792532910, 4.70213965023294640, // 0.131 -1.11932855055476450, 4.68978498151413530, // 0.1315 -1.11698672787645030, 4.67752071746345790, // 0.132 -1.11465101493250000, 4.66534588268804030, // 0.1325 -1.11232136724915250, 4.65325951603570950, // 0.133 -1.10999774082971480, 4.64126067033445540, // 0.1335 -1.10768009214764170, 4.62934841213765850, // 0.134 -1.10536837813972790, 4.61752182147480910, // 0.1345 -1.10306255619943890, 4.60577999160776660, // 0.135 -1.10076258417034880, 4.59412202879222780, // 0.1355 -1.09846842033970420, 4.58254705204440960, // 0.136 -1.09618002343210260, 4.57105419291275440, // 0.1365 -1.09389735260327910, 4.55964259525452680, // 0.137 -1.09162036743401010, 4.54831141501721700, // 0.1375 -1.08934902792411890, 4.53705982002458620, // 0.138 -1.08708329448659310, 4.52588698976728490, // 0.1385 -1.08482312794179920, 4.51479211519787160, // 0.139 -1.08256848951180530, 4.50377439853020430, // 0.1395 -1.08031934081479860, 4.49283305304300560, // 0.14 -1.07807564385959930, 4.48196730288757020, // 0.1405 -1.07583736104027450, 4.47117638289948170, // 0.141 -1.07360445513083990, 4.46045953841424140, // 0.1415 -1.07137688928005680, 4.44981602508673290, // 0.142 -1.06915462700631530, 4.43924510871439800, // 0.1425 -1.06693763219260920, 4.42874606506407620, // 0.143 -1.06472586908158950, 4.41831817970236780, // 0.1435 -1.06251930227071050, 4.40796074782949350, // 0.144 -1.06031789670745110, 4.39767307411652020, // 0.1445 -1.05812161768462070, 4.38745447254590190, // 0.145 -1.05593043083574180, 4.37730426625523530, // 0.1455 -1.05374430213051080, 4.36722178738417630, // 0.146 -1.05156319787033700, 4.35720637692444070, // 0.1465 -1.04938708468394860, 4.34725738457277360, // 0.147 -1.04721592952308270, 4.33737416858690670, // 0.1475 -1.04504969965823320, 4.32755609564432040, // 0.148 -1.04288836267448290, 4.31780254070386520, // 0.1485 -1.04073188646738910, 4.30811288687006040, // 0.149 -1.03858023923895180, 4.29848652526011770, // 0.1495 -1.03643338949363440, 4.28892285487353140, // 0.15 -1.03429130603445720, 4.27942128246424410, // 0.1505 -1.03215395795915170, 4.26998122241529820, // 0.151 -1.03002131465637440, 4.26060209661591220, // 0.1515 -1.02789334580198810, 4.25128333434096550, // 0.152 -1.02577002135539460, 4.24202437213276800, // 0.1525 -1.02365131155593380, 4.23282465368515130, // 0.153 -1.02153718691933220, 4.22368362972973270, // 0.1535 -1.01942761823421630, 4.21460075792440230, // 0.154 -1.01732257655867400, 4.20557550274389320, // 0.1545 -1.01522203321687400, 4.19660733537245710, // 0.155 -1.01312595979573740, 4.18769573359855850, // 0.1555 -1.01103432814166320, 4.17884018171156320, // 0.156 -1.00894711035729800, 4.17004017040035000, // 0.1565 -1.00686427879836900, 4.16129519665386200, // 0.157 -1.00478580607055190, 4.15260476366347580, // 0.1575 -1.00271166502639610, 4.14396838072720720, // 0.158 -1.00064182876229620, 4.13538556315570640, // 0.1585 -0.99857627061550691, 4.12685583217997020, // 0.159 -0.99651496416120522, 4.11837871486076780, // 0.1595 -0.99445788320960082, 4.10995374399974710, // 0.16 -0.99240500180308377, 4.10158045805213780, // 0.1605 -0.99035629421342242, 4.09325840104109060, // 0.161 -0.98831173493899838, 4.08498712247354060, // 0.1615 -0.98627129870208607, 4.07676617725761940, // 0.162 -0.98423496044617287, 4.06859512562156400, // 0.1625 -0.98220269533331839, 4.06047353303408000, // 0.163 -0.98017447874155372, 4.05240097012613900, // 0.1635 -0.97815028626232048, 4.04437701261419220, // 0.164 -0.97613009369794623, 4.03640124122474210, // 0.1645 -0.97411387705915820, 4.02847324162026600, // 0.165 -0.97210161256263372, 4.02059260432645880, // 0.1655 -0.97009327662858613, 4.01275892466076470, // 0.166 -0.96808884587838739, 4.00497180266216630, // 0.1665 -0.96608829713222288, 3.99723084302221650, // 0.167 -0.96409160740678412, 3.98953565501728400, // 0.1675 -0.96209875391299149, 3.98188585244197980, // 0.168 -0.96010971405375334, 3.97428105354375210, // 0.1685 -0.95812446542175289, 3.96672088095861190, // 0.169 -0.95614298579727242, 3.95920496164798140, // 0.1695 -0.95416525314604483, 3.95173292683664010, // 0.17 -0.95219124561713764, 3.94430441195172410, // 0.1705 -0.95022094154086645, 3.93691905656279490, // 0.171 -0.94825431942673866, 3.92957650432292520, // 0.1715 -0.94629135796142738, 3.92227640291079860, // 0.172 -0.94433203600677040, 3.91501840397378500, // 0.1725 -0.94237633259780229, 3.90780216307200460, // 0.173 -0.94042422694081018, 3.90062733962332020, // 0.1735 -0.93847569841142064, 3.89349359684927430, // 0.174 -0.93653072655270719, 3.88640060172192390, // 0.1745 -0.93458929107333244, 3.87934802491158860, // 0.175 -0.93265137184570945, 3.87233554073545470, // 0.1755 -0.93071694890419199, 3.86536282710705100, // 0.176 -0.92878600244328713, 3.85842956548656170, // 0.1765 -0.92685851281589682, 3.85153544083196710, // 0.177 -0.92493446053157813, 3.84468014155099350, // 0.1775 -0.92301382625483352, 3.83786335945386230, // 0.178 -0.92109659080341755, 3.83108478970680230, // 0.1785 -0.91918273514667370, 3.82434413078635100, // 0.179 -0.91727224040388766, 3.81764108443437960, // 0.1795 -0.91536508784266835, 3.81097535561387080, // 0.18 -0.91346125887734564, 3.80434665246541130, // 0.1805 -0.91156073506739499, 3.79775468626438830, // 0.181 -0.90966349811587865, 3.79119917137888770, // 0.1815 -0.90776952986791037, 3.78467982522826450, // 0.182 -0.90587881230913958, 3.77819636824238310, // 0.1825 -0.90399132756425649, 3.77174852382152230, // 0.183 -0.90210705789551804, 3.76533601829690930, // 0.1835 -0.90022598570128876, 3.75895858089189080, // 0.184 -0.89834809351460865, 3.75261594368373070, // 0.1845 -0.89647336400177169, 3.74630784156599720, // 0.185 -0.89460177996093049, 3.74003401221156920, // 0.1855 -0.89273332432071195, 3.73379419603620470, // 0.186 -0.89086798013885860, 3.72758813616270500, // 0.1865 -0.88900573060088117, 3.72141557838562600, // 0.187 -0.88714655901873285, 3.71527627113655480, // 0.1875 -0.88529044882949792, 3.70916996544991790, // 0.188 -0.88343738359410240, 3.70309641492934820, // 0.1885 -0.88158734699603203, 3.69705537571453040, // 0.189 -0.87974032284007653, 3.69104660644860960, // 0.1895 -0.87789629505108613, 3.68506986824607760, // 0.19 -0.87605524767274090, 3.67912492466115590, // 0.1905 -0.87421716486634149, 3.67321154165667660, // 0.191 -0.87238203090961008, 3.66732948757342880, // 0.1915 -0.87054983019551213, 3.66147853309999190, // 0.192 -0.86872054723108660, 3.65565845124300770, // 0.1925 -0.86689416663629637, 3.64986901729792250, // 0.193 -0.86507067314288977, 3.64411000882016900, // 0.1935 -0.86325005159327906, 3.63838120559678390, // 0.194 -0.86143228693943108, 3.63268238961845750, // 0.1945 -0.85961736424177071, 3.62701334505199750, // 0.195 -0.85780526866810280, 3.62137385821322110, // 0.1955 -0.85599598549254141, 3.61576371754023820, // 0.196 -0.85418950009445727, 3.61018271356715110, // 0.1965 -0.85238579795743497, 3.60463063889812750, // 0.197 -0.85058486466824512, 3.59910728818187800, // 0.1975 -0.84878668591582718, 3.59361245808649970, // 0.198 -0.84699124749028887, 3.58814594727470570, // 0.1985 -0.84519853528191080, 3.58270755637940350, // 0.199 -0.84340853528017079, 3.57729708797964820, // 0.1995 -0.84162123357277552, 3.57191434657694450, // 0.2 -0.83983661634470430, 3.56655913857189380, // 0.2005 -0.83805466987726807, 3.56123127224118940, // 0.201 -0.83627538054717243, 3.55593055771493690, // 0.2015 -0.83449873482560188, 3.55065680695432070, // 0.202 -0.83272471927730540, 3.54540983372957540, // 0.2025 -0.83095332055969995, 3.54018945359829650, // 0.203 -0.82918452542198107, 3.53499548388404780, // 0.2035 -0.82741832070424448, 3.52982774365528540, // 0.204 -0.82565469333662211, 3.52468605370459280, // 0.2045 -0.82389363033842022, 3.51957023652819160, // 0.205 -0.82213511881727719, 3.51448011630576750, // 0.2055 -0.82037914596832395, 3.50941551888057690, // 0.206 -0.81862569907335814, 3.50437627173982720, // 0.2065 -0.81687476550002713, 3.49936220399535800, // 0.207 -0.81512633270101942, 3.49437314636456750, // 0.2075 -0.81338038821326830, 3.48940893115163720, // 0.208 -0.81163691965716112, 3.48446939222900070, // 0.2085 -0.80989591473576250, 3.47955436501908590, // 0.209 -0.80815736123403947, 3.47466368647630080, // 0.2095 -0.80642124701810525, 3.46979719506928990, // 0.21 -0.80468756003446129, 3.46495473076341740, // 0.2105 -0.80295628830925880, 3.46013613500351850, // 0.211 -0.80122741994755753, 3.45534125069686300, // 0.2115 -0.79950094313260200, 3.45056992219637550, // 0.212 -0.79777684612510413, 3.44582199528409210, // 0.2125 -0.79605511726252853, 3.44109731715481670, // 0.213 -0.79433574495839432, 3.43639573640003790, // 0.2135 -0.79261871770157832, 3.43171710299204190, // 0.214 -0.79090402405562910, 3.42706126826825400, // 0.2145 -0.78919165265808933, 3.42242808491579490, // 0.215 -0.78748159221982195, 3.41781740695623790, // 0.2155 -0.78577383152435110, 3.41322908973059080, // 0.216 -0.78406835942720177, 3.40866298988446650, // 0.2165 -0.78236516485525454, 3.40411896535346070, // 0.217 -0.78066423680610120, 3.39959687534872530, // 0.2175 -0.77896556434741304, 3.39509658034274290, // 0.218 -0.77726913661631247, 3.39061794205528510, // 0.2185 -0.77557494281875250, 3.38616082343955860, // 0.219 -0.77388297222890523, 3.38172508866855150, // 0.2195 -0.77219321418855302, 3.37731060312153850, // 0.22 -0.77050565810649074, 3.37291723337079000, // 0.2205 -0.76882029345793101, 3.36854484716844070, // 0.221 -0.76713710978391747, 3.36419331343353800, // 0.2215 -0.76545609669074688, 3.35986250223927300, // 0.222 -0.76377724384939172, 3.35555228480035690, // 0.2225 -0.76210054099493607, 3.35126253346059190, // 0.223 -0.76042597792601074, 3.34699312168057480, // 0.2235 -0.75875354450424071, 3.34274392402559560, // 0.224 -0.75708323065369421, 3.33851481615366860, // 0.2245 -0.75541502636033930, 3.33430567480372630, // 0.225 -0.75374892167150775, 3.33011637778398040, // 0.2255 -0.75208490669536165, 3.32594680396041520, // 0.226 -0.75042297160036842, 3.32179683324544420, // 0.2265 -0.74876310661477952, 3.31766634658670780, // 0.227 -0.74710530202611614, 3.31355522595601350, // 0.2275 -0.74544954818066045, 3.30946335433843020, // 0.228 -0.74379583548294959, 3.30539061572150720, // 0.2285 -0.74214415439528103, 3.30133689508464600, // 0.229 -0.74049449543721391, 3.29730207838859580, // 0.2295 -0.73884684918508570, 3.29328605256509600, // 0.23 -0.73720120627152685, 3.28928870550663930, // 0.2305 -0.73555755738498296, 3.28530992605637230, // 0.231 -0.73391589326924356, 3.28134960399812580, // 0.2315 -0.73227620472297250, 3.27740763004656090, // 0.232 -0.73063848259924513, 3.27348389583745550, // 0.2325 -0.72900271780509196, 3.26957829391809880, // 0.233 -0.72736890130104215, 3.26569071773781650, // 0.2335 -0.72573702410067886, 3.26182106163861360, // 0.234 -0.72410707727019086, 3.25796922084592700, // 0.2345 -0.72247905192793682, 3.25413509145950690, // 0.235 -0.72085293924400773, 3.25031857044439840, // 0.2355 -0.71922873043979840, 3.24651955562204940, // 0.236 -0.71760641678758019, 3.24273794566151570, // 0.2365 -0.71598598961007998, 3.23897364007078450, // 0.237 -0.71436744028006260, 3.23522653918820250, // 0.2375 -0.71275076021991846, 3.23149654417401110, // 0.238 -0.71113594090125265, 3.22778355700198060, // 0.2385 -0.70952297384448404, 3.22408748045115920, // 0.239 -0.70791185061843998, 3.22040821809770740, // 0.2395 -0.70630256283996384, 3.21674567430684850, // 0.24 -0.70469510217351983, 3.21309975422490620, // 0.2405 -0.70308946033080510, 3.20947036377144320, // 0.241 -0.70148562907036704, 3.20585740963150070, // 0.2415 -0.69988360019721840, 3.20226079924792020, // 0.242 -0.69828336556246506, 3.19868044081377430, // 0.2425 -0.69668491706292845, 3.19511624326487230, // 0.243 -0.69508824664077828, 3.19156811627237010, // 0.2435 -0.69349334628316739, 3.18803597023546330, // 0.244 -0.69190020802186769, 3.18451971627416700, // 0.2445 -0.69030882393291226, 3.18101926622218700, // 0.245 -0.68871918613624128, 3.17753453261987140, // 0.2455 -0.68713128679534807, 3.17406542870724850, // 0.246 -0.68554511811693408, 3.17061186841715290, // 0.2465 -0.68396067235056135, 3.16717376636842470, // 0.247 -0.68237794178831279, 3.16375103785919180, // 0.2475 -0.68079691876445436, 3.16034359886024240, // 0.248 -0.67921759565509832, 3.15695136600845580, // 0.2485 -0.67763996487787570, 3.15357425660033640, // 0.249 -0.67606401889160317, 3.15021218858559670, // 0.2495 -0.67448975019596191, 3.14686508056083800, // 0.25 -0.67291715133117480, 3.14353285176329590, // 0.2505 -0.67134621487768575, 3.14021542206465700, // 0.251 -0.66977693345584721, 3.13691271196495560, // 0.2515 -0.66820929972560450, 3.13362464258653130, // 0.252 -0.66664330638618763, 3.13035113566806760, // 0.2525 -0.66507894617580499, 3.12709211355869510, // 0.253 -0.66351621187133869, 3.12384749921216140, // 0.2535 -0.66195509628804394, 3.12061721618107280, // 0.254 -0.66039559227925104, 3.11740118861119790, // 0.2545 -0.65883769273607018, 3.11419934123584060, // 0.255 -0.65728139058710011, 3.11101159937028050, // 0.2555 -0.65572667879813651, 3.10783788890626770, // 0.256 -0.65417355037188618, 3.10467813630658900, // 0.2565 -0.65262199834768431, 3.10153226859969870, // 0.257 -0.65107201580120955, 3.09840021337439800, // 0.2575 -0.64952359584420882, 3.09528189877459250, // 0.258 -0.64797673162421876, 3.09217725349409280, // 0.2585 -0.64643141632429157, 3.08908620677148350, // 0.259 -0.64488764316272762, 3.08600868838505700, // 0.2595 -0.64334540539280127, 3.08294462864778260, // 0.26 -0.64180469630250070, 3.07989395840235900, // 0.2605 -0.64026550921425895, 3.07685660901630250, // 0.261 -0.63872783748469608, 3.07383251237710110, // 0.2615 -0.63719167450436009, 3.07082160088741980, // 0.262 -0.63565701369746830, 3.06782380746036010, // 0.2625 -0.63412384852165538, 3.06483906551477190, // 0.263 -0.63259217246772304, 3.06186730897062140, // 0.2635 -0.63106197905938477, 3.05890847224440110, // 0.264 -0.62953326185302683, 3.05596249024460810, // 0.2645 -0.62800601443745641, 3.05302929836725180, // 0.265 -0.62648023043366186, 3.05010883249142810, // 0.2655 -0.62495590349457442, 3.04720102897493780, // 0.266 -0.62343302730482486, 3.04430582464994530, // 0.2665 -0.62191159558051146, 3.04142315681869890, // 0.267 -0.62039160206896538, 3.03855296324928890, // 0.2675 -0.61887304054851633, 3.03569518217145310, // 0.268 -0.61735590482826674, 3.03284975227243690, // 0.2685 -0.61584018874786006, 3.03001661269288250, // 0.269 -0.61432588617725803, 3.02719570302278070, // 0.2695 -0.61281299101651576, 3.02438696329745490, // 0.27 -0.61130149719555982, 3.02159033399359520, // 0.2705 -0.60979139867396892, 3.01880575602532990, // 0.271 -0.60828268944075659, 3.01603317074034690, // 0.2715 -0.60677536351415440, 3.01327251991605300, // 0.272 -0.60526941494139919, 3.01052374575577320, // 0.2725 -0.60376483779851986, 3.00778679088499330, // 0.273 -0.60226162619012780, 3.00506159834764300, // 0.2735 -0.60075977424920934, 3.00234811160242380, // 0.274 -0.59925927613691754, 2.99964627451916100, // 0.2745 -0.59776012604236928, 2.99695603137521570, // 0.275 -0.59626231818244124, 2.99427732685191870, // 0.2755 -0.59476584680156908, 2.99161010603104980, // 0.276 -0.59327070617154898, 2.98895431439135570, // 0.2765 -0.59177689059133842, 2.98630989780509990, // 0.277 -0.59028439438686042, 2.98367680253465030, // 0.2775 -0.58879321191081191, 2.98105497522911420, // 0.278 -0.58730333754246777, 2.97844436292098980, // 0.2785 -0.58581476568749158, 2.97584491302286570, // 0.279 -0.58432749077774715, 2.97325657332415670, // 0.2795 -0.58284150727110950, 2.97067929198786420, // 0.28 -0.58135680965127912, 2.96811301754737980, // 0.2805 -0.57987339242759828, 2.96555769890331920, // 0.281 -0.57839125013486736, 2.96301328532038650, // 0.2815 -0.57691037733316552, 2.96047972642428010, // 0.282 -0.57543076860766706, 2.95795697219861560, // 0.2825 -0.57395241856846746, 2.95544497298189860, // 0.283 -0.57247532185040440, 2.95294367946451790, // 0.2835 -0.57099947311288235, 2.95045304268577000, // 0.284 -0.56952486703969996, 2.94797301403091880, // 0.2845 -0.56805149833887814, 2.94550354522828960, // 0.285 -0.56657936174248691, 2.94304458834637740, // 0.2855 -0.56510845200647919, 2.94059609579100380, // 0.286 -0.56363876391052059, 2.93815802030249310, // 0.2865 -0.56217029225782233, 2.93573031495287440, // 0.287 -0.56070303187497961, 2.93331293314312620, // 0.2875 -0.55923697761180380, 2.93090582860043150, // 0.288 -0.55777212434116141, 2.92850895537547460, // 0.2885 -0.55630846695881564, 2.92612226783976310, // 0.289 -0.55484600038326093, 2.92374572068296780, // 0.2895 -0.55338471955557056, 2.92137926891030460, // 0.29 -0.55192461943923588, 2.91902286783993190, // 0.2905 -0.55046569502001086, 2.91667647310037650, // 0.291 -0.54900794130575958, 2.91434004062799180, // 0.2915 -0.54755135332630023, 2.91201352666443340, // 0.292 -0.54609592613325475, 2.90969688775416420, // 0.2925 -0.54464165479989812, 2.90739008074198590, // 0.293 -0.54318853442100790, 2.90509306277059490, // 0.2935 -0.54173656011271609, 2.90280579127815750, // 0.294 -0.54028572701236321, 2.90052822399591870, // 0.2945 -0.53883603027835014, 2.89826031894582760, // 0.295 -0.53738746508999546, 2.89600203443818980, // 0.2955 -0.53594002664739071, 2.89375332906934270, // 0.296 -0.53449371017125791, 2.89151416171935340, // 0.2965 -0.53304851090280969, 2.88928449154974090, // 0.297 -0.53160442410360675, 2.88706427800122080, // 0.2975 -0.53016144505542029, 2.88485348079146810, // 0.298 -0.52871956906009498, 2.88265205991291260, // 0.2985 -0.52727879143941014, 2.88045997563054310, // 0.299 -0.52583910753494423, 2.87827718847974310, // 0.2995 -0.52440051270794286, 2.87610365926414420, // 0.3 -0.52296300233918147, 2.87393934905350080, // 0.3005 -0.52152657182883444, 2.87178421918158260, // 0.301 -0.52009121659634561, 2.86963823124410040, // 0.3015 -0.51865693208029384, 2.86750134709663220, // 0.302 -0.51722371373826659, 2.86537352885258610, // 0.3025 -0.51579155704673096, 2.86325473888117980, // 0.303 -0.51436045750090442, 2.86114493980542940, // 0.3035 -0.51293041061463185, 2.85904409450017650, // 0.304 -0.51150141192025689, 2.85695216609011650, // 0.3045 -0.51007345696849871, 2.85486911794785490, // 0.305 -0.50864654132832954, 2.85279491369198370, // 0.3055 -0.50722066058685056, 2.85072951718517360, // 0.306 -0.50579581034917009, 2.84867289253228200, // 0.3065 -0.50437198623828661, 2.84662500407848730, // 0.307 -0.50294918389496324, 2.84458581640743220, // 0.3075 -0.50152739897761334, 2.84255529433938920, // 0.308 -0.50010662716218224, 2.84053340292944960, // 0.3085 -0.49868686414202812, 2.83852010746571540, // 0.309 -0.49726810562780716, 2.83651537346752170, // 0.3095 -0.49585034734735972, 2.83451916668367330, // 0.31 -0.49443358504559343, 2.83253145309069330, // 0.3105 -0.49301781448437165, 2.83055219889109200, // 0.311 -0.49160303144240070, 2.82858137051165400, // 0.3115 -0.49018923171511664, 2.82661893460173630, // 0.312 -0.48877641111457709, 2.82466485803159100, // 0.3125 -0.48736456546934864, 2.82271910789069440, // 0.313 -0.48595369062439858, 2.82078165148609640, // 0.3135 -0.48454378244098750, 2.81885245634079020, // 0.314 -0.48313483679656027, 2.81693149019208810, // 0.3145 -0.48172684958463924, 2.81501872099001820, // 0.315 -0.48031981671472035, 2.81311411689574030, // 0.3155 -0.47891373411216559, 2.81121764627996430, // 0.316 -0.47750859771809889, 2.80932927772139560, // 0.3165 -0.47610440348930483, 2.80744898000519290, // 0.317 -0.47470114739812302, 2.80557672212143180, // 0.3175 -0.47329882543234703, 2.80371247326359500, // 0.318 -0.47189743359512382, 2.80185620282706790, // 0.3185 -0.47049696790485218, 2.80000788040765290, // 0.319 -0.46909742439508234, 2.79816747580009300, // 0.3195 -0.46769879911441914, 2.79633495899661710, // 0.32 -0.46630108812642179, 2.79451030018549050, // 0.3205 -0.46490428750950580, 2.79269346974958000, // 0.321 -0.46350839335684835, 2.79088443826494180, // 0.3215 -0.46211340177628907, 2.78908317649940770, // 0.322 -0.46071930889023738, 2.78728965541119900, // 0.3225 -0.45932611083557567, 2.78550384614753850, // 0.323 -0.45793380376356474, 2.78372572004328900, // 0.3235 -0.45654238383975354, 2.78195524861959860, // 0.324 -0.45515184724388241, 2.78019240358255450, // 0.3245 -0.45376219016979302, 2.77843715682185580, // 0.325 -0.45237340882533716, 2.77668948040949500, // 0.3255 -0.45098549943228478, 2.77494934659845340, // 0.326 -0.44959845822623407, 2.77321672782140500, // 0.3265 -0.44821228145652375, 2.77149159668943890, // 0.327 -0.44682696538614086, 2.76977392599078430, // 0.3275 -0.44544250629163457, 2.76806368868955530, // 0.328 -0.44405890046302982, 2.76636085792450580, // 0.3285 -0.44267614420373702, 2.76466540700778740, // 0.329 -0.44129423383046773, 2.76297730942373130, // 0.3295 -0.43991316567314975, 2.76129653882763470, // 0.33 -0.43853293607483917, 2.75962306904455360, // 0.3305 -0.43715354139163815, 2.75795687406811660, // 0.331 -0.43577497799261067, 2.75629792805934400, // 0.3315 -0.43439724225969789, 2.75464620534547680, // 0.332 -0.43302033058763517, 2.75300168041881440, // 0.3325 -0.43164423938387292, 2.75136432793557400, // 0.333 -0.43026896506849077, 2.74973412271474520, // 0.3335 -0.42889450407411878, 2.74811103973696320, // 0.334 -0.42752085284585756, 2.74649505414339550, // 0.3345 -0.42614800784119605, 2.74488614123462730, // 0.335 -0.42477596552993352, 2.74328427646956860, // 0.3355 -0.42340472239410099, 2.74168943546436460, // 0.336 -0.42203427492788187, 2.74010159399131760, // 0.3365 -0.42066461963753410, 2.73852072797781610, // 0.337 -0.41929575304131506, 2.73694681350528150, // 0.3375 -0.41792767166940109, 2.73537982680811130, // 0.338 -0.41656037206381441, 2.73381974427264350, // 0.3385 -0.41519385077834658, 2.73226654243612590, // 0.339 -0.41382810437848200, 2.73072019798569030, // 0.3395 -0.41246312944132479, 2.72918068775734480, // 0.34 -0.41109892255552483, 2.72764798873496690, // 0.3405 -0.40973548032120155, 2.72612207804930850, // 0.341 -0.40837279934987430, 2.72460293297701290, // 0.3415 -0.40701087626438692, 2.72309053093963400, // 0.342 -0.40564970769883579, 2.72158484950266950, // 0.3425 -0.40428929029850036, 2.72008586637460280, // 0.343 -0.40292962071976923, 2.71859355940594540, // 0.3435 -0.40157069563007053, 2.71710790658830210, // 0.344 -0.40021251170780153, 2.71562888605342860, // 0.3445 -0.39885506564225925, 2.71415647607230960, // 0.345 -0.39749835413356960, 2.71269065505423780, // 0.3455 -0.39614237389262097, 2.71123140154590560, // 0.346 -0.39478712164099294, 2.70977869423050110, // 0.3465 -0.39343259411088949, 2.70833251192681420, // 0.347 -0.39207878804507290, 2.70689283358834980, // 0.3475 -0.39072570019679381, 2.70545963830244940, // 0.348 -0.38937332732972590, 2.70403290528941740, // 0.3485 -0.38802166621790113, 2.70261261390166440, // 0.349 -0.38667071364564087, 2.70119874362284170, // 0.3495 -0.38532046640749201, 2.69979127406699740, // 0.35 -0.38397092130816379, 2.69839018497774010, // 0.3505 -0.38262207516245933, 2.69699545622739520, // 0.351 -0.38127392479521416, 2.69560706781618450, // 0.3515 -0.37992646704123312, 2.69422499987140760, // 0.352 -0.37857969874522451, 2.69284923264662490, // 0.3525 -0.37723361676173783, 2.69147974652085510, // 0.353 -0.37588821795510408, 2.69011652199777940, // 0.3535 -0.37454349919936974, 2.68875953970494570, // 0.354 -0.37319945737823679, 2.68740878039298450, // 0.3545 -0.37185608938500203, 2.68606422493483570, // 0.355 -0.37051339212249529, 2.68472585432497190, // 0.3555 -0.36917136250301752, 2.68339364967863770, // 0.356 -0.36782999744828454, 2.68206759223109130, // 0.3565 -0.36648929388936230, 2.68074766333685190, // 0.357 -0.36514924876661070, 2.67943384446895600, // 0.3575 -0.36380985902962454, 2.67812611721822070, // 0.358 -0.36247112163717277, 2.67682446329250730, // 0.3585 -0.36113303355714121, 2.67552886451600000, // 0.359 -0.35979559176647613, 2.67423930282848450, // 0.3595 -0.35845879325112351, 2.67295576028463520, // 0.36 -0.35712263500597363, 2.67167821905330620, // 0.3605 -0.35578711403480517, 2.67040666141683400, // 0.361 -0.35445222735022636, 2.66914106977033900, // 0.3615 -0.35311797197361949, 2.66788142662103670, // 0.362 -0.35178434493508692, 2.66662771458755770, // 0.3625 -0.35045134327339234, 2.66537991639926600, // 0.363 -0.34911896403590775, 2.66413801489558950, // 0.3635 -0.34778720427855886, 2.66290199302535460, // 0.364 -0.34645606106576859, 2.66167183384612430, // 0.3645 -0.34512553147040448, 2.66044752052354560, // 0.365 -0.34379561257372432, 2.65922903633069920, // 0.3655 -0.34246630146532303, 2.65801636464745530, // 0.366 -0.34113759524307857, 2.65680948895983880, // 0.3665 -0.33980949101309954, 2.65560839285939340, // 0.367 -0.33848198588967288, 2.65441306004255530, // 0.3675 -0.33715507699521058, 2.65322347431003220, // 0.368 -0.33582876146019891, 2.65203961956618710, // 0.3685 -0.33450303642314594, 2.65086147981842530, // 0.369 -0.33317789903053069, 2.64968903917658900, // 0.3695 -0.33185334643675085, 2.64852228185235680, // 0.37 -0.33052937580407421, 2.64736119215864820, // 0.3705 -0.32920598430258607, 2.64620575450903050, // 0.371 -0.32788316911013987, 2.64505595341713650, // 0.3715 -0.32656092741230813, 2.64391177349607980, // 0.372 -0.32523925640233120, 2.64277319945788220, // 0.3725 -0.32391815328106899, 2.64164021611290020, // 0.373 -0.32259761525695246, 2.64051280836926110, // 0.3735 -0.32127763954593325, 2.63939096123229830, // 0.374 -0.31995822337143598, 2.63827465980399810, // 0.3745 -0.31863936396431219, 2.63716388928244650, // 0.375 -0.31732105856278808, 2.63605863496127980, // 0.3755 -0.31600330441242019, 2.63495888222914500, // 0.376 -0.31468609876604775, 2.63386461656916020, // 0.3765 -0.31336943888374408, 2.63277582355838070, // 0.377 -0.31205332203277025, 2.63169248886727130, // 0.3775 -0.31073774548753053, 2.63061459825917910, // 0.378 -0.30942270652952264, 2.62954213758981760, // 0.3785 -0.30810820244729392, 2.62847509280674660, // 0.379 -0.30679423053639604, 2.62741344994886330, // 0.3795 -0.30548078809933732, 2.62635719514589420, // 0.38 -0.30416787244553845, 2.62530631461789190, // 0.3805 -0.30285548089128961, 2.62426079467473940, // 0.381 -0.30154361075970132, 2.62322062171565080, // 0.3815 -0.30023225938066272, 2.62218578222868490, // 0.382 -0.29892142409079853, 2.62115626279025940, // 0.3825 -0.29761110223342158, 2.62013205006466520, // 0.383 -0.29630129115849063, 2.61911313080359240, // 0.3835 -0.29499198822256839, 2.61809949184565350, // 0.384 -0.29368319078877503, 2.61709112011591660, // 0.3845 -0.29237489622674673, 2.61608800262543580, // 0.385 -0.29106710191259427, 2.61509012647079240, // 0.3855 -0.28975980522885753, 2.61409747883363600, // 0.386 -0.28845300356446413, 2.61311004698022660, // 0.3865 -0.28714669431468892, 2.61212781826099150, // 0.387 -0.28584087488110943, 2.61115078011007240, // 0.3875 -0.28453554267156539, 2.61017892004488420, // 0.388 -0.28323069510011789, 2.60921222566567850, // 0.3885 -0.28192632958700625, 2.60825068465510320, // 0.389 -0.28062244355860799, 2.60729428477777650, // 0.3895 -0.27931903444739919, 2.60634301387985450, // 0.39 -0.27801609969191149, 2.60539685988860900, // 0.3905 -0.27671363673669258, 2.60445581081200480, // 0.391 -0.27541164303226640, 2.60351985473828450, // 0.3915 -0.27411011603509344, 2.60258897983555390, // 0.392 -0.27280905320752896, 2.60166317435137050, // 0.3925 -0.27150845201778523, 2.60074242661233780, // 0.393 -0.27020830993989248, 2.59982672502370390, // 0.3935 -0.26890862445365726, 2.59891605806895590, // 0.394 -0.26760939304462505, 2.59801041430942980, // 0.3945 -0.26631061320404287, 2.59710978238391420, // 0.395 -0.26501228242881741, 2.59621415100825900, // 0.3955 -0.26371439822147830, 2.59532350897499060, // 0.396 -0.26241695809014126, 2.59443784515293130, // 0.3965 -0.26111995954846734, 2.59355714848681360, // 0.397 -0.25982340011562599, 2.59268140799690630, // 0.3975 -0.25852727731625924, 2.59181061277864360, // 0.398 -0.25723158868044166, 2.59094475200224790, // 0.3985 -0.25593633174364339, 2.59008381491237080, // 0.399 -0.25464150404669578, 2.58922779082772170, // 0.3995 -0.25334710313575054, 2.58837666914071150, // 0.4 -0.25205312656224510, 2.58753043931709210, // 0.4005 -0.25075957188286702, 2.58668909089560330, // 0.401 -0.24946643665951501, 2.58585261348761900, // 0.4015 -0.24817371845926392, 2.58502099677680080, // 0.402 -0.24688141485433004, 2.58419423051874950, // 0.4025 -0.24558952342203275, 2.58337230454066450, // 0.403 -0.24429804174476019, 2.58255520874100110, // 0.4035 -0.24300696740993449, 2.58174293308913860, // 0.404 -0.24171629800997421, 2.58093546762503980, // 0.4045 -0.24042603114226072, 2.58013280245892270, // 0.405 -0.23913616440910260, 2.57933492777093360, // 0.4055 -0.23784669541770226, 2.57854183381081950, // 0.406 -0.23655762178011822, 2.57775351089760600, // 0.4065 -0.23526894111323249, 2.57696994941927620, // 0.407 -0.23398065103871749, 2.57619113983245600, // 0.4075 -0.23269274918299840, 2.57541707266209660, // 0.408 -0.23140523317722131, 2.57464773850116520, // 0.4085 -0.23011810065721960, 2.57388312801033560, // 0.409 -0.22883134926347870, 2.57312323191767960, // 0.4095 -0.22754497664110335, 2.57236804101836600, // 0.41 -0.22625898043978515, 2.57161754617435980, // 0.4105 -0.22497335831376636, 2.57087173831412000, // 0.411 -0.22368810792180904, 2.57013060843230830, // 0.4115 -0.22240322692716188, 2.56939414758949440, // 0.412 -0.22111871299752633, 2.56866234691186260, // 0.4125 -0.21983456380502436, 2.56793519759092790, // 0.413 -0.21855077702616713, 2.56721269088324930, // 0.4135 -0.21726735034181993, 2.56649481811014550, // 0.414 -0.21598428143717094, 2.56578157065741320, // 0.4145 -0.21470156800170132, 2.56507293997505360, // 0.415 -0.21341920772914968, 2.56436891757699350, // 0.4155 -0.21213719831748171, 2.56366949504081100, // 0.416 -0.21085553746885896, 2.56297466400746870, // 0.4165 -0.20957422288960725, 2.56228441618104210, // 0.417 -0.20829325229018353, 2.56159874332845530, // 0.4175 -0.20701262338514570, 2.56091763727921680, // 0.418 -0.20573233389312232, 2.56024108992515800, // 0.4185 -0.20445238153678011, 2.55956909322017670, // 0.419 -0.20317276404279228, 2.55890163917997700, // 0.4195 -0.20189347914181038, 2.55823871988181790, // 0.42 -0.20061452456843135, 2.55758032746426120, // 0.4205 -0.19933589806116683, 2.55692645412691900, // 0.421 -0.19805759736241521, 2.55627709213021110, // 0.4215 -0.19677962021842763, 2.55563223379511540, // 0.422 -0.19550196437928025, 2.55499187150292870, // 0.4225 -0.19422462759884473, 2.55435599769502280, // 0.423 -0.19294760763475535, 2.55372460487260920, // 0.4235 -0.19167090224838160, 2.55309768559650060, // 0.424 -0.19039450920479836, 2.55247523248687800, // 0.4245 -0.18911842627275455, 2.55185723822305730, // 0.425 -0.18784265122464508, 2.55124369554326250, // 0.4255 -0.18656718183648177, 2.55063459724439530, // 0.426 -0.18529201588786229, 2.55002993618181020, // 0.4265 -0.18401715116194259, 2.54942970526909200, // 0.427 -0.18274258544540711, 2.54883389747783440, // 0.4275 -0.18146831652844048, 2.54824250583742010, // 0.428 -0.18019434220469779, 2.54765552343480330, // 0.4285 -0.17892066027127598, 2.54707294341429560, // 0.429 -0.17764726852868681, 2.54649475897735390, // 0.4295 -0.17637416478082593, 2.54592096338236610, // 0.43 -0.17510134683494560, 2.54535154994444570, // 0.4305 -0.17382881250162766, 2.54478651203522290, // 0.431 -0.17255655959475211, 2.54422584308263830, // 0.4315 -0.17128458593147217, 2.54366953657074380, // 0.432 -0.17001288933218536, 2.54311758603949700, // 0.4325 -0.16874146762050438, 2.54256998508456580, // 0.433 -0.16747031862323022, 2.54202672735712910, // 0.4335 -0.16619944017032556, 2.54148780656368120, // 0.434 -0.16492883009488496, 2.54095321646584040, // 0.4345 -0.16365848623310839, 2.54042295088015630, // 0.435 -0.16238840642427477, 2.53989700367792050, // 0.4355 -0.16111858851071326, 2.53937536878497870, // 0.436 -0.15984903033777609, 2.53885804018154460, // 0.4365 -0.15857972975381171, 2.53834501190201720, // 0.437 -0.15731068461013925, 2.53783627803479870, // 0.4375 -0.15604189276101887, 2.53733183272211220, // 0.438 -0.15477335206362594, 2.53683167015982440, // 0.4385 -0.15350506037802628, 2.53633578459727140, // 0.439 -0.15223701556714608, 2.53584417033708040, // 0.4395 -0.15096921549674669, 2.53535682173499750, // 0.44 -0.14970165803540045, 2.53487373319971890, // 0.4405 -0.14843434105446005, 2.53439489919271790, // 0.441 -0.14716726242803443, 2.53392031422808110, // 0.4415 -0.14590042003296430, 2.53344997287233830, // 0.442 -0.14463381174879192, 2.53298386974430260, // 0.4425 -0.14336743545773750, 2.53252199951490380, // 0.443 -0.14210128904467401, 2.53206435690703250, // 0.4435 -0.14083537039709873, 2.53161093669537610, // 0.444 -0.13956967740510878, 2.53116173370626550, // 0.4445 -0.13830420796137652, 2.53071674281751770, // 0.445 -0.13703895996112098, 2.53027595895828130, // 0.4455 -0.13577393130208421, 2.52983937710888760, // 0.446 -0.13450911988450556, 2.52940699230069480, // 0.4465 -0.13324452361109693, 2.52897879961594500, // 0.447 -0.13198014038701467, 2.52855479418761280, // 0.4475 -0.13071596811983630, 2.52813497119926160, // 0.448 -0.12945200471953677, 2.52771932588489930, // 0.4485 -0.12818824809845938, 2.52730785352883600, // 0.449 -0.12692469617129301, 2.52690054946554370, // 0.4495 -0.12566134685504812, 2.52649740907951650, // 0.45 -0.12439819806902930, 2.52609842780513550, // 0.4505 -0.12313524773481116, 2.52570360112652860, // 0.451 -0.12187249377621520, 2.52531292457744130, // 0.4515 -0.12060993411928257, 2.52492639374110130, // 0.452 -0.11934756669225050, 2.52454400425008710, // 0.4525 -0.11808538942552850, 2.52416575178619950, // 0.453 -0.11682340025167216, 2.52379163208033400, // 0.4535 -0.11556159710535936, 2.52342164091235470, // 0.454 -0.11429997792336588, 2.52305577411096720, // 0.4545 -0.11303854064454193, 2.52269402755359760, // 0.455 -0.11177728320978512, 2.52233639716627110, // 0.4555 -0.11051620356201877, 2.52198287892348950, // 0.456 -0.10925529964616787, 2.52163346884811410, // 0.4565 -0.10799456940913220, 2.52128816301124830, // 0.457 -0.10673401079976445, 2.52094695753212240, // 0.4575 -0.10547362176884663, 2.52060984857797890, // 0.458 -0.10421340026906416, 2.52027683236395860, // 0.4585 -0.10295334425498277, 2.51994790515299230, // 0.459 -0.10169345168302624, 2.51962306325568800, // 0.4595 -0.10043372051144972, 2.51930230303022640, // 0.46 -0.09917414870031707, 2.51898562088224850, // 0.4605 -0.09791473421147932, 2.51867301326475750, // 0.461 -0.09665547500854797, 2.51836447667800820, // 0.4615 -0.09539636905687257, 2.51806000766940970, // 0.462 -0.09413741432351702, 2.51775960283342130, // 0.4625 -0.09287860877723747, 2.51746325881145380, // 0.463 -0.09161995038845623, 2.51717097229177260, // 0.4635 -0.09036143712924000, 2.51688274000939940, // 0.464 -0.08910306697327745, 2.51659855874601980, // 0.4645 -0.08784483789585380, 2.51631842532988380, // 0.465 -0.08658674787382807, 2.51604233663572070, // 0.4655 -0.08532879488561144, 2.51577028958464280, // 0.466 -0.08407097691114272, 2.51550228114405790, // 0.4665 -0.08281329193186435, 2.51523830832758040, // 0.467 -0.08155573793070192, 2.51497836819494670, // 0.4675 -0.08029831289203873, 2.51472245785192560, // 0.468 -0.07904101480169372, 2.51447057445023910, // 0.4685 -0.07778384164689936, 2.51422271518747520, // 0.469 -0.07652679141627682, 2.51397887730701180, // 0.4695 -0.07526986209981472, 2.51373905809793060, // 0.47 -0.07401305168884531, 2.51350325489494470, // 0.4705 -0.07275635817602294, 2.51327146507831770, // 0.471 -0.07149977955529960, 2.51304368607378860, // 0.4715 -0.07024331382190266, 2.51281991535249820, // 0.472 -0.06898695897231441, 2.51260015043091430, // 0.4725 -0.06773071300424600, 2.51238438887076350, // 0.473 -0.06647457391661635, 2.51217262827895560, // 0.4735 -0.06521853970953100, 2.51196486630751940, // 0.474 -0.06396260838425685, 2.51176110065353250, // 0.4745 -0.06270677794320141, 2.51156132905905420, // 0.475 -0.06145104638989062, 2.51136554931106380, // 0.4755 -0.06019541172894484, 2.51117375924139230, // 0.476 -0.05893987196605723, 2.51098595672666300, // 0.4765 -0.05768442510797285, 2.51080213968823030, // 0.477 -0.05642906916246316, 2.51062230609211840, // 0.4775 -0.05517380213830637, 2.51044645394896460, // 0.478 -0.05391862204526358, 2.51027458131396040, // 0.4785 -0.05266352689405854, 2.51010668628679580, // 0.479 -0.05140851469635255, 2.50994276701160550, // 0.4795 -0.05015358346472402, 2.50978282167691760, // 0.48 -0.04889873121264746, 2.50962684851559500, // 0.4805 -0.04764395595446792, 2.50947484580479370, // 0.481 -0.04638925570538125, 2.50932681186590440, // 0.4815 -0.04513462848141291, 2.50918274506451230, // 0.482 -0.04388007229939313, 2.50904264381034500, // 0.4825 -0.04262558517693623, 2.50890650655722690, // 0.483 -0.04137116513241997, 2.50877433180303950, // 0.4835 -0.04011681018496064, 2.50864611808967370, // 0.484 -0.03886251835439324, 2.50852186400299050, // 0.4845 -0.03760828766124905, 2.50840156817277830, // 0.485 -0.03635411612673307, 2.50828522927271670, // 0.4855 -0.03510000177270269, 2.50817284602033650, // 0.486 -0.03384594262164512, 2.50806441717698370, // 0.4865 -0.03259193669665737, 2.50795994154778250, // 0.487 -0.03133798202142113, 2.50785941798160520, // 0.4875 -0.03008407662018339, 2.50776284537103370, // 0.488 -0.02883021851773517, 2.50767022265233310, // 0.4885 -0.02757640573938674, 2.50758154880541760, // 0.489 -0.02632263631094781, 2.50749682285382300, // 0.4895 -0.02506890825870642, 2.50741604386467910, // 0.49 -0.02381521960940530, 2.50733921094868070, // 0.4905 -0.02256156839022061, 2.50726632326006760, // 0.491 -0.02130795262874144, 2.50719737999659340, // 0.4915 -0.02005437035294692, 2.50713238039950740, // 0.492 -0.01880081959118433, 2.50707132375353180, // 0.4925 -0.01754729837214734, 2.50701420938684060, // 0.493 -0.01629380472485625, 2.50696103667104220, // 0.4935 -0.01504033667863301, 2.50691180502115830, // 0.494 -0.01378689226308134, 2.50686651389561010, // 0.4945 -0.01253346950806658, 2.50682516279620280, // 0.495 -0.01128006644369089, 2.50678775126810920, // 0.4955 -0.01002668110027251, 2.50675427889985820, // 0.496 -0.00877331150832623, 2.50672474532332370, // 0.4965 -0.00751995569853920, 2.50669915021371190, // 0.497 -0.00626661170174900, 2.50667749328955520, // 0.4975 -0.00501327754892560, 2.50665977431270150, // 0.498 -0.00375995127114527, 2.50664599308830780, // 0.4985 -0.00250663089957117, 2.50663614946483550, // 0.499 -0.00125331446543215, 2.50663024333404700, // 0.4995 0.00000000000000000, 2.50662827463100020, // 0.5 clhep-2.1.4.1.orig/Random/src/0000755000175000017500000000000012242515140014400 5ustar olesolesclhep-2.1.4.1.orig/Random/src/RandEngine.cc0000755000175000017500000004660311753236267016755 0ustar olesoles// $Id: RandEngine.cc,v 1.8 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandEngine --- // class implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Minor corrections: 31st October 1996 // - Added methods for engine status: 19th November 1996 // - mx is initialised to RAND_MAX: 2nd April 1997 // - Fixed bug in setSeeds(): 15th September 1997 // - Private copy constructor and operator=: 26th Feb 1998 // J.Marraffino - Added stream operators and related constructor. // Added automatic seed selection from seed table and // engine counter. Removed RAND_MAX and replaced by // std::pow(0.5,32.). Flat() returns now 32 bits values // obtained by concatenation: 15th Feb 1998 // Ken Smith - Added conversion operators: 6th Aug 1998 // J. Marraffino - Remove dependence on hepString class 13 May 1999 // M. Fischler - Rapaired bug that in flat() that relied on rand() to // deliver 15-bit results. This bug was causing flat() // on Linux systems to yield randoms with mean of 5/8(!) // - Modified algorithm such that on systems with 31-bit rand() // it will call rand() only once instead of twice. Feb 2004 // M. Fischler - Modified the general-case template for RandEngineBuilder // such that when RAND_MAX is an unexpected value the routine // will still deliver a sensible flat() random. // M. Fischler - Methods for distrib. instance save/restore 12/8/04 // M. Fischler - split get() into tag validation and // getState() for anonymous restores 12/27/04 // M. Fischler - put/get for vectors of ulongs 3/14/05 // M. Fischler - State-saving using only ints, for portability 4/12/05 // // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandEngine.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Random/engineIDulong.h" #include // for strcmp #include // for int() namespace CLHEP { #ifdef NOTDEF // The way to test for proper behavior of the RandEngineBuilder // for arbitrary RAND_MAX, on a system where RAND_MAX is some // fixed specialized value and rand() behaves accordingly, is // to set up a fake RAND_MAX and a fake version of rand() // by enabling this block. #undef RAND_MAX #define RAND_MAX 9382956 #include "CLHEP/Random/MTwistEngine.h" #include "CLHEP/Random/RandFlat.h" MTwistEngine * fakeFlat = new MTwistEngine; RandFlat rflat (fakeFlat, 0, RAND_MAX+1); int rand() { return (int)rflat(); } #endif static const int MarkerLen = 64; // Enough room to hold a begin or end marker. // number of instances with automatic seed selection int RandEngine::numEngines = 0; // Maximum index into the seed table int RandEngine::maxIndex = 215; std::string RandEngine::name() const {return "RandEngine";} RandEngine::RandEngine(long seed) : HepRandomEngine() { setSeed(seed,0); setSeeds(&theSeed,0); seq = 0; } RandEngine::RandEngine(int rowIndex, int colIndex) : HepRandomEngine() { long seeds[2]; long seed; int cycle = std::abs(int(rowIndex/maxIndex)); int row = std::abs(int(rowIndex%maxIndex)); int col = std::abs(int(colIndex%2)); long mask = ((cycle & 0x000007ff) << 20 ); HepRandom::getTheTableSeeds( seeds, row ); seed = (seeds[col])^mask; setSeed(seed,0); setSeeds(&theSeed,0); seq = 0; } RandEngine::RandEngine() : HepRandomEngine() { long seeds[2]; long seed; int cycle,curIndex; cycle = std::abs(int(numEngines/maxIndex)); curIndex = std::abs(int(numEngines%maxIndex)); numEngines += 1; long mask = ((cycle & 0x007fffff) << 8); HepRandom::getTheTableSeeds( seeds, curIndex ); seed = seeds[0]^mask; setSeed(seed,0); setSeeds(&theSeed,0); seq = 0; } RandEngine::RandEngine(std::istream& is) : HepRandomEngine() { is >> *this; } RandEngine::~RandEngine() {} void RandEngine::setSeed(long seed, int) { theSeed = seed; srand( int(seed) ); seq = 0; } void RandEngine::setSeeds(const long* seeds, int) { setSeed(seeds ? *seeds : 19780503L, 0); theSeeds = seeds; } void RandEngine::saveStatus( const char filename[] ) const { std::ofstream outFile( filename, std::ios::out ) ; if (!outFile.bad()) { outFile << "Uvec\n"; std::vector v = put(); #ifdef TRACE_IO std::cout << "Result of v = put() is:\n"; #endif for (unsigned int i=0; i v; unsigned long xin; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { inFile >> xin; #ifdef TRACE_IO std::cout << "ivec = " << ivec << " xin = " << xin << " "; if (ivec%3 == 0) std::cout << "\n"; #endif if (!inFile) { inFile.clear(std::ios::badbit | inFile.rdstate()); std::cerr << "\nRandEngine state (vector) description improper." << "\nrestoreStatus has failed." << "\nInput stream is probably mispositioned now." << std::endl; return; } v.push_back(xin); } getState(v); return; } long count; if (!inFile.bad() && !inFile.eof()) { // inFile >> theSeed; removed -- encompased by possibleKeywordInput inFile >> count; setSeed(theSeed,0); seq = 0; while (seq < count) flat(); } } void RandEngine::showStatus() const { std::cout << std::endl; std::cout << "---------- Rand engine status ----------" << std::endl; std::cout << " Initial seed = " << theSeed << std::endl; std::cout << " Shooted sequences = " << seq << std::endl; std::cout << "----------------------------------------" << std::endl; } // ==================================================== // Implementation of flat() (along with needed helpers) // ==================================================== // Here we set up such that **at compile time**, the compiler decides based on // RAND_MAX how to form a random double with 32 leading random bits, using // one or two calls to rand(). Some of the lowest order bits of 32 are allowed // to be as weak as mere XORs of some higher bits, but not to be always fixed. // // The method decision is made at compile time, rather than using a run-time // if on the value of RAND_MAX. Although it is possible to cope with arbitrary // values of RAND_MAX of the form 2**N-1, with the same efficiency, the // template techniques needed would look mysterious and perhaps over-stress // some older compilers. We therefore only treat RAND_MAX = 2**15-1 (as on // most older systems) and 2**31-1 (as on the later Linux systems) as special // and super-efficient cases. We detect any different value, and use an // algorithm which is correct even if RAND_MAX is not one less than a power // of 2. template struct RandEngineBuilder { // RAND_MAX any arbitrary value static unsigned int thirtyTwoRandomBits(long& seq) { static bool prepared = false; static unsigned int iT; static unsigned int iK; static unsigned int iS; static int iN; static double fS; static double fT; if ( (RAND_MAX >> 31) > 0 ) { // Here, we know that integer arithmetic is 64 bits. if ( !prepared ) { iS = (unsigned long)RAND_MAX + 1; iK = 1; // int StoK = S; int StoK = iS; // The two statements below are equivalent, but some compilers // are getting too smart and complain about the first statement. //if ( (RAND_MAX >> 32) == 0) { if( (unsigned long) (RAND_MAX) <= (( (1uL) << 31 ) - 1 ) ) { iK = 2; // StoK = S*S; StoK = iS*iS; } int m; for ( m = 0; m < 64; ++m ) { StoK >>= 1; if (StoK == 0) break; } iT = 1 << m; prepared = true; } int v = 0; do { for ( int i = 0; i < iK; ++i ) { v = iS*v+rand(); ++seq; } } while (v < iT); return v & 0xFFFFFFFF; } else if ( (RAND_MAX >> 26) == 0 ) { // Here, we know it is safe to work in terms of doubles without loss // of precision, but we have no idea how many randoms we will need to // generate 32 bits. if ( !prepared ) { fS = (unsigned long)RAND_MAX + 1; double twoTo32 = std::ldexp(1.0,32); double StoK = fS; for ( iK = 1; StoK < twoTo32; StoK *= fS, iK++ ) { } int m; fT = 1.0; for ( m = 0; m < 64; ++m ) { StoK *= .5; if (StoK < 1.0) break; fT *= 2.0; } prepared = true; } double v = 0; do { for ( int i = 0; i < iK; ++i ) { v = fS*v+rand(); ++seq; } } while (v < fT); return ((unsigned int)v) & 0xFFFFFFFF; } else { // Here, we know that 16 random bits are available from each of // two random numbers. if ( !prepared ) { iS = (unsigned long)RAND_MAX + 1; int SshiftN = iS; for (iN = 0; SshiftN > 1; SshiftN >>= 1, iN++) { } iN -= 17; prepared = true; } unsigned int x1, x2; do { x1 = rand(); ++seq;} while (x1 < (1<<16) ); do { x2 = rand(); ++seq;} while (x2 < (1<<16) ); return x1 | (x2 << 16); } } }; template <> struct RandEngineBuilder<2147483647> { // RAND_MAX = 2**31 - 1 inline static unsigned int thirtyTwoRandomBits(long& seq) { unsigned int x = rand() << 1; ++seq; // bits 31-1 x ^= ( (x>>23) ^ (x>>7) ) ^1; // bit 0 (weakly pseudo-random) return x & 0xFFFFFFFF; // mask in case int is 64 bits } }; template <> struct RandEngineBuilder<32767> { // RAND_MAX = 2**15 - 1 inline static unsigned int thirtyTwoRandomBits(long& seq) { unsigned int x = rand() << 17; ++seq; // bits 31-17 x ^= rand() << 2; ++seq; // bits 16-2 x ^= ( (x>>23) ^ (x>>7) ) ^3; // bits 1-0 (weakly pseudo-random) return x & 0xFFFFFFFF; // mask in case int is 64 bits } }; double RandEngine::flat() { double r; do { r = RandEngineBuilder::thirtyTwoRandomBits(seq); } while ( r == 0 ); return r/4294967296.0; } void RandEngine::flatArray(const int size, double* vect) { int i; for (i=0; i::thirtyTwoRandomBits(seq); } std::ostream & RandEngine::put ( std::ostream& os ) const { char beginMarker[] = "RandEngine-begin"; char endMarker[] = "RandEngine-end"; os << " " << beginMarker << "\n"; os << theSeed << " " << seq << " "; os << endMarker << "\n"; return os; } std::vector RandEngine::put () const { std::vector v; v.push_back (engineIDulong()); v.push_back(static_cast(theSeed)); v.push_back(static_cast(seq)); return v; } std::istream & RandEngine::get ( std::istream& is ) { // The only way to restore the status of RandEngine is to // keep track of the number of shooted random sequences, reset // the engine and re-shoot them again. The Rand algorithm does // not provide any way of getting its internal status. char beginMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"RandEngine-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cout << "\nInput stream mispositioned or" << "\nRandEngine state description missing or" << "\nwrong engine type found." << std::endl; return is; } return getState(is); } std::string RandEngine::beginTag ( ) { return "RandEngine-begin"; } std::istream & RandEngine::getState ( std::istream& is ) { if ( possibleKeywordInput ( is, "Uvec", theSeed ) ) { std::vector v; unsigned long uu; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { is >> uu; if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nRandEngine state (vector) description improper." << "\ngetState() has failed." << "\nInput stream is probably mispositioned now." << std::endl; return is; } v.push_back(uu); } getState(v); return (is); } // is >> theSeed; Removed, encompassed by possibleKeywordInput() char endMarker [MarkerLen]; long count; is >> count; is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"RandEngine-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nRandEngine state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; return is; } setSeed(theSeed,0); while (seq < count) flat(); return is; } bool RandEngine::get (const std::vector & v) { if ((v[0] & 0xffffffffUL) != engineIDulong()) { std::cerr << "\nRandEngine get:state vector has wrong ID word - state unchanged\n"; return false; } return getState(v); } bool RandEngine::getState (const std::vector & v) { if (v.size() != VECTOR_STATE_SIZE ) { std::cerr << "\nRandEngine get:state vector has wrong length - state unchanged\n"; return false; } theSeed = v[1]; int count = v[2]; setSeed(theSeed,0); while (seq < count) flat(); return true; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandExponential.cc0000755000175000017500000000672311753236267020035 0ustar olesoles// $Id: RandExponential.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandExponential --- // class implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 17th May 1996 // - Added methods to shoot arrays: 28th July 1997 // J.Marraffino - Added default mean as attribute and // operator() with mean: 16th Feb 1998 // M Fischler - put and get to/from streams 12/15/04 // M Fischler - put/get to/from streams uses pairs of ulongs when // + storing doubles avoid problems with precision // 4/14/05 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandExponential.h" #include "CLHEP/Random/DoubConv.hh" namespace CLHEP { std::string RandExponential::name() const {return "RandExponential";} HepRandomEngine & RandExponential::engine() {return *localEngine;} RandExponential::~RandExponential() { } double RandExponential::operator()() { return fire( defaultMean ); } double RandExponential::operator()( double mean ) { return fire( mean ); } double RandExponential::shoot() { return -std::log(HepRandom::getTheEngine()->flat()); } double RandExponential::shoot(double mean) { return -std::log(HepRandom::getTheEngine()->flat())*mean; } void RandExponential::shootArray( const int size, double* vect, double mean ) { for( double* v = vect; v != vect+size; ++v ) *v = shoot(mean); } void RandExponential::shootArray(HepRandomEngine* anEngine, const int size, double* vect, double mean ) { for( double* v = vect; v != vect+size; ++v ) *v = shoot(anEngine, mean); } void RandExponential::fireArray( const int size, double* vect) { for( double* v = vect; v != vect+size; ++v ) *v = fire( defaultMean ); } void RandExponential::fireArray( const int size, double* vect, double mean ) { for( double* v = vect; v != vect+size; ++v ) *v = fire( mean ); } std::ostream & RandExponential::put ( std::ostream & os ) const { int pr=os.precision(20); std::vector t(2); os << " " << name() << "\n"; os << "Uvec" << "\n"; t = DoubConv::dto2longs(defaultMean); os << defaultMean << " " << t[0] << " " << t[1] << "\n"; os.precision(pr); return os; #ifdef REMOVED int pr=os.precision(20); os << " " << name() << "\n"; os << defaultMean << "\n"; os.precision(pr); return os; #endif } std::istream & RandExponential::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } if (possibleKeywordInput(is, "Uvec", defaultMean)) { std::vector t(2); is >> defaultMean >> t[0] >> t[1]; defaultMean = DoubConv::longs2double(t); return is; } // is >> defaultMean encompassed by possibleKeywordInput return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandPoisson.cc0000755000175000017500000002323111761721356017167 0ustar olesoles// $Id: RandPoisson.cc,v 1.7 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandPoisson --- // class implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Added not static Shoot() method: 17th May 1996 // - Algorithm now operates on doubles: 31st Oct 1996 // - Added methods to shoot arrays: 28th July 1997 // - Added check in case xm=-1: 4th February 1998 // J.Marraffino - Added default mean as attribute and // operator() with mean: 16th Feb 1998 // Gabriele Cosmo - Relocated static data from HepRandom: 5th Jan 1999 // M Fischler - put and get to/from streams 12/15/04 // M Fischler - put/get to/from streams uses pairs of ulongs when // + storing doubles avoid problems with precision // 4/14/05 // Mark Fischler - Repaired BUG - when mean > 2 billion, was returning // mean instead of the proper value. 01/13/06 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandPoisson.h" #include "CLHEP/Units/PhysicalConstants.h" #include "CLHEP/Random/DoubConv.hh" #include // for std::floor() namespace CLHEP { std::string RandPoisson::name() const {return "RandPoisson";} HepRandomEngine & RandPoisson::engine() {return *localEngine;} // Initialisation of static data double RandPoisson::status_st[3] = {0., 0., 0.}; double RandPoisson::oldm_st = -1.0; const double RandPoisson::meanMax_st = 2.0E9; RandPoisson::~RandPoisson() { } double RandPoisson::operator()() { return double(fire( defaultMean )); } double RandPoisson::operator()( double mean ) { return double(fire( mean )); } double gammln(double xx) { // Returns the value ln(Gamma(xx) for xx > 0. Full accuracy is obtained for // xx > 1. For 0 < xx < 1. the reflection formula (6.1.4) can be used first. // (Adapted from Numerical Recipes in C) static double cof[6] = {76.18009172947146,-86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5}; int j; double x = xx - 1.0; double tmp = x + 5.5; tmp -= (x + 0.5) * std::log(tmp); double ser = 1.000000000190015; for ( j = 0; j <= 5; j++ ) { x += 1.0; ser += cof[j]/x; } return -tmp + std::log(2.5066282746310005*ser); } static double normal (HepRandomEngine* eptr) // mf 1/13/06 { double r; double v1,v2,fac; do { v1 = 2.0 * eptr->flat() - 1.0; v2 = 2.0 * eptr->flat() - 1.0; r = v1*v1 + v2*v2; } while ( r > 1.0 ); fac = std::sqrt(-2.0*std::log(r)/r); return v2*fac; } long RandPoisson::shoot(double xm) { // Returns as a floating-point number an integer value that is a random // deviation drawn from a Poisson distribution of mean xm, using flat() // as a source of uniform random numbers. // (Adapted from Numerical Recipes in C) double em, t, y; double sq, alxm, g1; double om = getOldMean(); HepRandomEngine* anEngine = HepRandom::getTheEngine(); double* status = getPStatus(); sq = status[0]; alxm = status[1]; g1 = status[2]; if( xm == -1 ) return 0; if( xm < 12.0 ) { if( xm != om ) { setOldMean(xm); g1 = std::exp(-xm); } em = -1; t = 1.0; do { em += 1.0; t *= anEngine->flat(); } while( t > g1 ); } else if ( xm < getMaxMean() ) { if ( xm != om ) { setOldMean(xm); sq = std::sqrt(2.0*xm); alxm = std::log(xm); g1 = xm*alxm - gammln(xm + 1.0); } do { do { y = std::tan(CLHEP::pi*anEngine->flat()); em = sq*y + xm; } while( em < 0.0 ); em = std::floor(em); t = 0.9*(1.0 + y*y)* std::exp(em*alxm - gammln(em + 1.0) - g1); } while( anEngine->flat() > t ); } else { em = xm + std::sqrt(xm) * normal (anEngine); // mf 1/13/06 if ( static_cast(em) < 0 ) em = static_cast(xm) >= 0 ? xm : getMaxMean(); } setPStatus(sq,alxm,g1); return long(em); } void RandPoisson::shootArray(const int size, long* vect, double m1) { for( long* v = vect; v != vect + size; ++v ) *v = shoot(m1); } long RandPoisson::shoot(HepRandomEngine* anEngine, double xm) { // Returns as a floating-point number an integer value that is a random // deviation drawn from a Poisson distribution of mean xm, using flat() // of a given Random Engine as a source of uniform random numbers. // (Adapted from Numerical Recipes in C) double em, t, y; double sq, alxm, g1; double om = getOldMean(); double* status = getPStatus(); sq = status[0]; alxm = status[1]; g1 = status[2]; if( xm == -1 ) return 0; if( xm < 12.0 ) { if( xm != om ) { setOldMean(xm); g1 = std::exp(-xm); } em = -1; t = 1.0; do { em += 1.0; t *= anEngine->flat(); } while( t > g1 ); } else if ( xm < getMaxMean() ) { if ( xm != om ) { setOldMean(xm); sq = std::sqrt(2.0*xm); alxm = std::log(xm); g1 = xm*alxm - gammln(xm + 1.0); } do { do { y = std::tan(CLHEP::pi*anEngine->flat()); em = sq*y + xm; } while( em < 0.0 ); em = std::floor(em); t = 0.9*(1.0 + y*y)* std::exp(em*alxm - gammln(em + 1.0) - g1); } while( anEngine->flat() > t ); } else { em = xm + std::sqrt(xm) * normal (anEngine); // mf 1/13/06 if ( static_cast(em) < 0 ) em = static_cast(xm) >= 0 ? xm : getMaxMean(); } setPStatus(sq,alxm,g1); return long(em); } void RandPoisson::shootArray(HepRandomEngine* anEngine, const int size, long* vect, double m1) { for( long* v = vect; v != vect + size; ++v ) *v = shoot(anEngine,m1); } long RandPoisson::fire() { return long(fire( defaultMean )); } long RandPoisson::fire(double xm) { // Returns as a floating-point number an integer value that is a random // deviation drawn from a Poisson distribution of mean xm, using flat() // as a source of uniform random numbers. // (Adapted from Numerical Recipes in C) double em, t, y; double sq, alxm, g1; sq = status[0]; alxm = status[1]; g1 = status[2]; if( xm == -1 ) return 0; if( xm < 12.0 ) { if( xm != oldm ) { oldm = xm; g1 = std::exp(-xm); } em = -1; t = 1.0; do { em += 1.0; t *= localEngine->flat(); } while( t > g1 ); } else if ( xm < meanMax ) { if ( xm != oldm ) { oldm = xm; sq = std::sqrt(2.0*xm); alxm = std::log(xm); g1 = xm*alxm - gammln(xm + 1.0); } do { do { y = std::tan(CLHEP::pi*localEngine->flat()); em = sq*y + xm; } while( em < 0.0 ); em = std::floor(em); t = 0.9*(1.0 + y*y)* std::exp(em*alxm - gammln(em + 1.0) - g1); } while( localEngine->flat() > t ); } else { em = xm + std::sqrt(xm) * normal (localEngine.get()); // mf 1/13/06 if ( static_cast(em) < 0 ) em = static_cast(xm) >= 0 ? xm : getMaxMean(); } status[0] = sq; status[1] = alxm; status[2] = g1; return long(em); } void RandPoisson::fireArray(const int size, long* vect ) { for( long* v = vect; v != vect + size; ++v ) *v = fire( defaultMean ); } void RandPoisson::fireArray(const int size, long* vect, double m1) { for( long* v = vect; v != vect + size; ++v ) *v = fire( m1 ); } std::ostream & RandPoisson::put ( std::ostream & os ) const { int pr=os.precision(20); std::vector t(2); os << " " << name() << "\n"; os << "Uvec" << "\n"; t = DoubConv::dto2longs(meanMax); os << meanMax << " " << t[0] << " " << t[1] << "\n"; t = DoubConv::dto2longs(defaultMean); os << defaultMean << " " << t[0] << " " << t[1] << "\n"; t = DoubConv::dto2longs(status[0]); os << status[0] << " " << t[0] << " " << t[1] << "\n"; t = DoubConv::dto2longs(status[1]); os << status[1] << " " << t[0] << " " << t[1] << "\n"; t = DoubConv::dto2longs(status[2]); os << status[2] << " " << t[0] << " " << t[1] << "\n"; t = DoubConv::dto2longs(oldm); os << oldm << " " << t[0] << " " << t[1] << "\n"; os.precision(pr); return os; #ifdef REMOVED int pr=os.precision(20); os << " " << name() << "\n"; os << meanMax << " " << defaultMean << "\n"; os << status[0] << " " << status[1] << " " << status[2] << "\n"; os.precision(pr); return os; #endif } std::istream & RandPoisson::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } if (possibleKeywordInput(is, "Uvec", meanMax)) { std::vector t(2); is >> meanMax >> t[0] >> t[1]; meanMax = DoubConv::longs2double(t); is >> defaultMean >> t[0] >> t[1]; defaultMean = DoubConv::longs2double(t); is >> status[0] >> t[0] >> t[1]; status[0] = DoubConv::longs2double(t); is >> status[1] >> t[0] >> t[1]; status[1] = DoubConv::longs2double(t); is >> status[2] >> t[0] >> t[1]; status[2] = DoubConv::longs2double(t); is >> oldm >> t[0] >> t[1]; oldm = DoubConv::longs2double(t); return is; } // is >> meanMax encompassed by possibleKeywordInput is >> defaultMean >> status[0] >> status[1] >> status[2]; return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/DualRand.cc0000755000175000017500000004434011753236267016431 0ustar olesoles// $Id: DualRand.cc,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // Hep Random // --- DualRand --- // class implementation file // ----------------------------------------------------------------------- // Exclusive or of a feedback shift register and integer congruence // random number generator. The feedback shift register uses offsets // 127 and 97. The integer congruence generator uses a different // multiplier for each stream. The multipliers are chosen to give // full period and maximum "potency" for modulo 2^32. The period of // the combined random number generator is 2^159 - 2^32, and the // sequences are different for each stream (not just started in a // different place). // // In the original generator used on ACPMAPS: // The feedback shift register generates 24 bits at a time, and // the high order 24 bits of the integer congruence generator are // used. // // Instead, to conform with more modern engine concepts, we generate // 32 bits at a time and use the full 32 bits of the congruence // generator. // // References: // Knuth // Tausworthe // Golomb //========================================================================= // Ken Smith - Removed std::pow() from flat() method: 21 Jul 1998 // - Added conversion operators: 6 Aug 1998 // J. Marraffino - Added some explicit casts to deal with // machines where sizeof(int) != sizeof(long) 22 Aug 1998 // M. Fischler - Modified constructors taking seeds to not // depend on numEngines (same seeds should // produce same sequences). Default still // depends on numEngines. 14 Sep 1998 // - Modified use of the various exponents of 2 // to avoid per-instance space overhead and // correct the rounding procedure 15 Sep 1998 // J. Marraffino - Remove dependence on hepString class 13 May 1999 // M. Fischler - Put endl at end of a save 10 Apr 2001 // M. Fischler - In restore, checkFile for file not found 03 Dec 2004 // M. Fischler - methods for distrib. instacne save/restore 12/8/04 // M. Fischler - split get() into tag validation and // getState() for anonymous restores 12/27/04 // Mark Fischler - methods for vector save/restore 3/7/05 // M. Fischler - State-saving using only ints, for portability 4/12/05 // //========================================================================= #include "CLHEP/Random/DualRand.h" #include "CLHEP/Random/defs.h" #include "CLHEP/Random/engineIDulong.h" #include // for strcmp namespace CLHEP { static const int MarkerLen = 64; // Enough room to hold a begin or end marker. std::string DualRand::name() const {return "DualRand";} // Number of instances with automatic seed selection int DualRand::numEngines = 0; // The following constructors (excluding the istream constructor) fill // the bits of the tausworthe and the starting state of the integer // congruence based on the seed. In addition, it sets up the multiplier // for the integer congruence based on the stream number, so you have // absolutely independent streams. DualRand::DualRand() : HepRandomEngine(), tausworthe (1234567 + numEngines + 175321), integerCong(69607 * tausworthe + 54329, numEngines) { theSeed = 1234567; ++numEngines; } DualRand::DualRand(long seed) : HepRandomEngine(), tausworthe ((unsigned int)seed + 175321), integerCong(69607 * tausworthe + 54329, 8043) // MF - not numEngines { theSeed = seed; } DualRand::DualRand(std::istream & is) : HepRandomEngine() { is >> *this; } DualRand::DualRand(int rowIndex, int colIndex) : HepRandomEngine(), tausworthe (rowIndex + 1000 * colIndex + 85329), integerCong(69607 * tausworthe + 54329, 1123) // MF - not numengines { theSeed = rowIndex; } DualRand::~DualRand() { } double DualRand::flat() { unsigned int ic ( integerCong ); unsigned int t ( tausworthe ); return ( (t ^ ic) * twoToMinus_32() + // most significant part (t >> 11) * twoToMinus_53() + // fill in remaining bits nearlyTwoToMinus_54() // make sure non-zero ); } void DualRand::flatArray(const int size, double* vect) { for (int i = 0; i < size; ++i) { vect[i] = flat(); } } void DualRand::setSeed(long seed, int) { theSeed = seed; tausworthe = Tausworthe((unsigned int)seed + numEngines + 175321); integerCong = IntegerCong(69607 * tausworthe + 54329, numEngines); } void DualRand::setSeeds(const long * seeds, int) { setSeed(seeds ? *seeds : 1234567, 0); theSeeds = seeds; } void DualRand::saveStatus(const char filename[]) const { std::ofstream outFile(filename, std::ios::out); if (!outFile.bad()) { outFile << "Uvec\n"; std::vector v = put(); #ifdef TRACE_IO std::cout << "Result of v = put() is:\n"; #endif for (unsigned int i=0; i v; unsigned long xin; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { inFile >> xin; #ifdef TRACE_IO std::cout << "ivec = " << ivec << " xin = " << xin << " "; if (ivec%3 == 0) std::cout << "\n"; #endif if (!inFile) { inFile.clear(std::ios::badbit | inFile.rdstate()); std::cerr << "\nDualRand state (vector) description improper." << "\nrestoreStatus has failed." << "\nInput stream is probably mispositioned now." << std::endl; return; } v.push_back(xin); } getState(v); return; } if (!inFile.bad()) { // inFile >> theSeed; removed -- encompased by possibleKeywordInput tausworthe.get(inFile); integerCong.get(inFile); } } void DualRand::showStatus() const { int pr=std::cout.precision(20); std::cout << std::endl; std::cout << "-------- DualRand engine status ---------" << std::endl; std::cout << "Initial seed = " << theSeed << std::endl; std::cout << "Tausworthe generator = " << std::endl; tausworthe.put(std::cout); std::cout << "\nIntegerCong generator = " << std::endl; integerCong.put(std::cout); std::cout << std::endl << "-----------------------------------------" << std::endl; std::cout.precision(pr); } DualRand::operator float() { return (float) ( (integerCong ^ tausworthe) * twoToMinus_32() + nearlyTwoToMinus_54() ); // add this so that zero never happens } DualRand::operator unsigned int() { return (integerCong ^ tausworthe) & 0xffffffff; } std::ostream & DualRand::put(std::ostream & os) const { char beginMarker[] = "DualRand-begin"; os << beginMarker << "\nUvec\n"; std::vector v = put(); for (unsigned int i=0; i DualRand::put () const { std::vector v; v.push_back (engineIDulong()); tausworthe.put(v); integerCong.put(v); return v; } std::istream & DualRand::get(std::istream & is) { char beginMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"DualRand-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput mispositioned or" << "\nDualRand state description missing or" << "\nwrong engine type found." << std::endl; return is; } return getState(is); } std::string DualRand::beginTag ( ) { return "DualRand-begin"; } std::istream & DualRand::getState ( std::istream & is ) { if ( possibleKeywordInput ( is, "Uvec", theSeed ) ) { std::vector v; unsigned long uu; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { is >> uu; if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nDualRand state (vector) description improper." << "\ngetState() has failed." << "\nInput stream is probably mispositioned now." << std::endl; return is; } v.push_back(uu); } getState(v); return (is); } // is >> theSeed; Removed, encompassed by possibleKeywordInput() char endMarker [MarkerLen]; tausworthe.get(is); integerCong.get(is); is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"DualRand-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "DualRand state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; return is; } return is; } bool DualRand::get(const std::vector & v) { if ((v[0] & 0xffffffffUL) != engineIDulong()) { std::cerr << "\nDualRand get:state vector has wrong ID word - state unchanged\n"; return false; } if (v.size() != VECTOR_STATE_SIZE) { std::cerr << "\nDualRand get:state vector has wrong size: " << v.size() << " - state unchanged\n"; return false; } return getState(v); } bool DualRand::getState (const std::vector & v) { std::vector::const_iterator iv = v.begin()+1; if (!tausworthe.get(iv)) return false; if (!integerCong.get(iv)) return false; if (iv != v.end()) { std::cerr << "\nDualRand get:state vector has wrong size: " << v.size() << "\n Apparently " << iv-v.begin() << " words were consumed\n"; return false; } return true; } DualRand::Tausworthe::Tausworthe() { words[0] = 1234567; for (wordIndex = 1; wordIndex < 4; ++wordIndex) { words[wordIndex] = 69607 * words[wordIndex-1] + 54329; } } DualRand::Tausworthe::Tausworthe(unsigned int seed) { words[0] = seed; for (wordIndex = 1; wordIndex < 4; ++wordIndex) { words[wordIndex] = 69607 * words[wordIndex-1] + 54329; } } DualRand::Tausworthe::operator unsigned int() { // Mathematically: Consider a sequence of bits b[n]. Repeatedly form // b[0]' = b[127] ^ b[97]; b[n]' = b[n-1]. This sequence will have a very // long period (2**127-1 according to Tausworthe's work). // The actual method used relies on the fact that the operations needed to // form bit 0 for up to 96 iterations never depend on the results of the // previous ones. So you can actually compute many bits at once. In fact // you can compute 32 at once -- despite 127 - 97 < 32 -- but 24 was used in // the method used in Canopy, where they wanted only single-precision float // randoms. I will do 32 here. // When you do it this way, this looks disturbingly like the dread lagged XOR // Fibonacci. And indeed, it is a lagged Fibonacii, F(4,3, op) with the op // being the XOR of a combination of shifts of the two numbers. Although // Tausworthe asserted excellent properties, I would be scared to death. // However, the shifting and bit swapping really does randomize this in a // serious way. // Statements have been made to the effect that shift register sequences fail // the parking lot test because they achieve randomness by multiple foldings, // and this produces a characteristic pattern. We observe that in this // specific algorithm, which has a fairly long lever arm, the foldings become // effectively random. This is evidenced by the fact that the generator // does pass the Diehard tests, including the parking lot test. // To avoid shuffling of variables in memory, you either have to use circular // pointers (and those give you ifs, which are also costly) or compute at least // a few iterations at once. We do the latter. Although there is a possible // trade of room for more speed, by computing and saving 256 instead of 128 // bits at once, I will stop at this level of optimization. // To remind: Each (32-bit) step takes the XOR of bits [127-96] with bits // [95-64] and places it in bits [0-31]. But in the first step, we designate // word0 as bits [0-31], in the second step, word 1 (since the bits it holds // will no longer be needed), then word 2, then word 3. After this, the // stream contains 128 random bits which we will use as 4 valid 32-bit // random numbers. // Thus at the start of the first step, word[0] contains the newest (used) // 32-bit random, and word[3] the oldest. After four steps, word[0] again // contains the newest (now unused) random, and word[3] the oldest. // Bit 0 of word[0] is logically the newest bit, and bit 31 of word[3] // the oldest. if (wordIndex <= 0) { for (wordIndex = 0; wordIndex < 4; ++wordIndex) { words[wordIndex] = ( (words[(wordIndex+1) & 3] << 1 ) | (words[wordIndex] >> 31) ) ^ ( (words[(wordIndex+1) & 3] << 31) | (words[wordIndex] >> 1) ); } } return words[--wordIndex] & 0xffffffff; } void DualRand::Tausworthe::put(std::ostream & os) const { char beginMarker[] = "Tausworthe-begin"; char endMarker[] = "Tausworthe-end"; int pr=os.precision(20); os << " " << beginMarker << " "; for (int i = 0; i < 4; ++i) { os << words[i] << " "; } os << wordIndex; os << " " << endMarker << " "; os << std::endl; os.precision(pr); } void DualRand::Tausworthe::put(std::vector & v) const { for (int i = 0; i < 4; ++i) { v.push_back(static_cast(words[i])); } v.push_back(static_cast(wordIndex)); } void DualRand::Tausworthe::get(std::istream & is) { char beginMarker [MarkerLen]; char endMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"Tausworthe-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput mispositioned or" << "\nTausworthe state description missing or" << "\nwrong engine type found." << std::endl; } for (int i = 0; i < 4; ++i) { is >> words[i]; } is >> wordIndex; is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"Tausworthe-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nTausworthe state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; } } bool DualRand::Tausworthe::get(std::vector::const_iterator & iv){ for (int i = 0; i < 4; ++i) { words[i] = *iv++; } wordIndex = *iv++; return true; } DualRand::IntegerCong::IntegerCong() : state((unsigned int)3758656018U), multiplier(66565), addend(12341) { } DualRand::IntegerCong::IntegerCong(unsigned int seed, int streamNumber) : state(seed), multiplier(65536 + 1024 + 5 + (8 * 1017 * streamNumber)), addend(12341) { // As to the multiplier, the following comment was made: // We want our multipliers larger than 2^16, and equal to // 1 mod 4 (for max. period), but not equal to 1 mod 8 // (for max. potency -- the smaller and higher dimension the // stripes, the better) // All of these will have fairly long periods. Depending on the choice // of stream number, some of these will be quite decent when considered // as independent random engines, while others will be poor. Thus these // should not be used as stand-alone engines; but when combined with a // generator known to be good, they allow creation of millions of good // independent streams, without fear of two streams accidentally hitting // nearby places in the good random sequence. } DualRand::IntegerCong::operator unsigned int() { return state = (state * multiplier + addend) & 0xffffffff; } void DualRand::IntegerCong::put(std::ostream & os) const { char beginMarker[] = "IntegerCong-begin"; char endMarker[] = "IntegerCong-end"; int pr=os.precision(20); os << " " << beginMarker << " "; os << state << " " << multiplier << " " << addend; os << " " << endMarker << " "; os << std::endl; os.precision(pr); } void DualRand::IntegerCong::put(std::vector & v) const { v.push_back(static_cast(state)); v.push_back(static_cast(multiplier)); v.push_back(static_cast(addend)); } void DualRand::IntegerCong::get(std::istream & is) { char beginMarker [MarkerLen]; char endMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"IntegerCong-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput mispositioned or" << "\nIntegerCong state description missing or" << "\nwrong engine type found." << std::endl; } is >> state >> multiplier >> addend; is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"IntegerCong-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nIntegerCong state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; } } bool DualRand::IntegerCong::get(std::vector::const_iterator & iv) { state = *iv++; multiplier = *iv++; addend = *iv++; return true; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/Hurd288Engine.cc0000755000175000017500000003011411753236267017223 0ustar olesoles// $Id: Hurd288Engine.cc,v 1.7 2010/07/20 18:07:17 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- Hurd288Engine --- // class implementation file // ----------------------------------------------------------------------- // An interconnected shift register based on the paper presented by Hurd in // IEEE Transactions on Computers c23, 2 Feb 1974. // ======================================================================= // Ken Smith - Initial draft started: 23rd Jul 1998 // - Added conversion operators: 6th Aug 1998 // J. Marraffino - Added some explicit casts to deal with // machines where sizeof(int) != sizeof(long) 22 Aug 1998 // M. Fischler - Modified use of the various exponents of 2 // to avoid per-instance space overhead and // correct the rounding procedure 15 Sep 1998 // - Modified various methods to avoid any // possibility of predicting the next number // based on the last several: We skip one // 32-bit word per cycle. 15 Sep 1998 // - modify word[0] in two of the constructors // so that no sequence can ever accidentally // be produced by differnt seeds. 15 Sep 1998 // J. Marraffino - Remove dependence on hepString class 13 May 1999 // M. Fischler - Put endl at end of a save 10 Apr 2001 // M. Fischler - In restore, checkFile for file not found 03 Dec 2004 // M. Fischler - methods for distrib. instacne save/restore 12/8/04 // M. Fischler - split get() into tag validation and // getState() for anonymous restores 12/27/04 // M. Fischler - put/get for vectors of ulongs 3/14/05 // M. Fischler - State-saving using only ints, for portability 4/12/05 // // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Random/Hurd288Engine.h" #include "CLHEP/Random/engineIDulong.h" #include // for strcmp #include // for std::abs(int) using namespace std; namespace CLHEP { static const int MarkerLen = 64; // Enough room to hold a begin or end marker. std::string Hurd288Engine::name() const {return "Hurd288Engine";} // Number of instances with automatic seed selection int Hurd288Engine::numEngines = 0; // Maximum index into the seed table int Hurd288Engine::maxIndex = 215; static inline unsigned int f288(unsigned int a, unsigned int b, unsigned int c) { return ( ((b<<2) & 0x7ffc) | ((a<<2) & ~0x7ffc) | (a>>30) ) ^ ( (c<<1)|(c>>31) ); } Hurd288Engine::Hurd288Engine() : HepRandomEngine() { int cycle = std::abs(int(numEngines/maxIndex)); int curIndex = std::abs(int(numEngines%maxIndex)); long mask = ((cycle & 0x007fffff) << 8); long seedlist[2]; HepRandom::getTheTableSeeds( seedlist, curIndex ); seedlist[0] ^= mask; seedlist[1] = 0; setSeeds(seedlist, 0); words[0] ^= 0x1324abcd; // To make unique vs long or two unsigned if (words[0]==0) words[0] = 1; // ints in the constructor ++numEngines; for( int i=0; i < 100; ++i ) flat(); // warm up just a bit } Hurd288Engine::Hurd288Engine( std::istream& is ) : HepRandomEngine() { is >> *this; } Hurd288Engine::Hurd288Engine( long seed ) : HepRandomEngine() { long seedlist[2]={seed,0}; setSeeds(seedlist, 0); words[0] ^= 0xa5482134; // To make unique vs default two unsigned if (words[0]==0) words[0] = 1; // ints in the constructor for( int i=0; i < 100; ++i ) flat(); // warm up just a bit } Hurd288Engine::Hurd288Engine( int rowIndex, int colIndex ) : HepRandomEngine() { int cycle = std::abs(int(rowIndex/maxIndex)); int row = std::abs(int(rowIndex%maxIndex)); int col = colIndex & 0x1; long mask = (( cycle & 0x000007ff ) << 20 ); long seedlist[2]; HepRandom::getTheTableSeeds( seedlist, row ); seedlist[0] = (seedlist[col])^mask; seedlist[1]= 0; setSeeds(seedlist, 0); for( int i=0; i < 100; ++i ) flat(); // warm up just a bit } Hurd288Engine::~Hurd288Engine() { } void Hurd288Engine::advance() { register unsigned int W0, W1, W2, W3, W4, W5, W6, W7, W8; W0 = words[0]; W1 = words[1]; W2 = words[2]; W3 = words[3]; W4 = words[4]; W5 = words[5]; W6 = words[6]; W7 = words[7]; W8 = words[8]; W1 ^= W0; W0 = f288(W2, W3, W0); W2 ^= W1; W1 = f288(W3, W4, W1); W3 ^= W2; W2 = f288(W4, W5, W2); W4 ^= W3; W3 = f288(W5, W6, W3); W5 ^= W4; W4 = f288(W6, W7, W4); W6 ^= W5; W5 = f288(W7, W8, W5); W7 ^= W6; W6 = f288(W8, W0, W6); W8 ^= W7; W7 = f288(W0, W1, W7); W0 ^= W8; W8 = f288(W1, W2, W8); words[0] = W0 & 0xffffffff; words[1] = W1 & 0xffffffff; words[2] = W2 & 0xffffffff; words[3] = W3 & 0xffffffff; words[4] = W4 & 0xffffffff; words[5] = W5 & 0xffffffff; words[6] = W6 & 0xffffffff; words[7] = W7 & 0xffffffff; words[8] = W8 & 0xffffffff; wordIndex = 9; } // advance() double Hurd288Engine::flat() { if( wordIndex <= 2 ) { // MF 9/15/98: // skip word 0 and use two words per flat advance(); } // LG 6/30/2010 // define the order of execution for --wordIndex double x = words[--wordIndex] * twoToMinus_32() ; // most significant part double y = (words[--wordIndex]>>11) * twoToMinus_53() + // fill in rest of bits nearlyTwoToMinus_54(); // make sure non-zero return x + y; } void Hurd288Engine::flatArray( const int size, double* vect ) { for (int i = 0; i < size; ++i) { vect[i] = flat(); } } void Hurd288Engine::setSeed( long seed, int ) { words[0] = (unsigned int)seed; for (wordIndex = 1; wordIndex < 9; ++wordIndex) { words[wordIndex] = 69607 * words[wordIndex-1] + 54329; } } void Hurd288Engine::setSeeds( const long* seeds, int ) { setSeed( *seeds ? *seeds : 32767, 0 ); theSeeds = seeds; } void Hurd288Engine::saveStatus( const char filename[] ) const { std::ofstream outFile(filename, std::ios::out); if( !outFile.bad() ) { outFile << "Uvec\n"; std::vector v = put(); #ifdef TRACE_IO std::cout << "Result of v = put() is:\n"; #endif for (unsigned int i=0; i v; unsigned long xin; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { inFile >> xin; #ifdef TRACE_IO std::cout << "ivec = " << ivec << " xin = " << xin << " "; if (ivec%3 == 0) std::cout << "\n"; #endif if (!inFile) { inFile.clear(std::ios::badbit | inFile.rdstate()); std::cerr << "\nHurd288Engine state (vector) description improper." << "\nrestoreStatus has failed." << "\nInput stream is probably mispositioned now." << std::endl; return; } v.push_back(xin); } getState(v); return; } if( !inFile.bad() ) { // inFile >> theSeed; removed -- encompased by possibleKeywordInput inFile >> wordIndex; for( int i = 0; i < 9; ++i ) { inFile >> words[i]; } } } void Hurd288Engine::showStatus() const { std::cout << std::setprecision(20) << std::endl; std::cout << "----------- Hurd2 engine status ----------" << std::endl; std::cout << "Initial seed = " << theSeed << std::endl; std::cout << "Current index = " << wordIndex << std::endl; std::cout << "Current words = " << std::endl; for( int i = 0; i < 9 ; ++i ) { std::cout << " " << words[i] << std::endl; } std::cout << "-------------------------------------------" << std::endl; } Hurd288Engine::operator float() { if( wordIndex <= 1 ) { // MF 9/15/98: skip word 0 advance(); } return words[--wordIndex ] * twoToMinus_32(); } Hurd288Engine::operator unsigned int() { if( wordIndex <= 1 ) { // MF 9/15/98: skip word 0 advance(); } return words[--wordIndex]; } std::ostream& Hurd288Engine::put(std::ostream& os) const { char beginMarker[] = "Hurd288Engine-begin"; os << beginMarker << "\nUvec\n"; std::vector v = put(); for (unsigned int i=0; i Hurd288Engine::put () const { std::vector v; v.push_back (engineIDulong()); v.push_back(static_cast(wordIndex)); for (int i = 0; i < 9; ++i) { v.push_back(static_cast(words[i])); } return v; } std::istream& Hurd288Engine::get(std::istream& is) { char beginMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"Hurd288Engine-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput mispositioned or" << "\nHurd288Engine state description missing or" << "\nwrong engine type found." << std::endl; return is; } return getState(is); } std::string Hurd288Engine::beginTag ( ) { return "Hurd288Engine-begin"; } std::istream& Hurd288Engine::getState(std::istream& is) { if ( possibleKeywordInput ( is, "Uvec", theSeed ) ) { std::vector v; unsigned long uu; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { is >> uu; if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nHurd288Engine state (vector) description improper." << "\ngetState() has failed." << "\nInput stream is probably mispositioned now." << std::endl; return is; } v.push_back(uu); } getState(v); return (is); } // is >> theSeed; Removed, encompassed by possibleKeywordInput() char endMarker [MarkerLen]; is >> wordIndex; for (int i = 0; i < 9; ++i) { is >> words[i]; } is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"Hurd288Engine-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nHurd288Engine state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; return is; } return is; } bool Hurd288Engine::get (const std::vector & v) { if ((v[0] & 0xffffffffUL) != engineIDulong()) { std::cerr << "\nHurd288Engine get:state vector has wrong ID word - state unchanged\n"; std::cerr << "The correct ID would be " << engineIDulong() << "; the actual ID is " << v[0] << "\n"; return false; } return getState(v); } bool Hurd288Engine::getState (const std::vector & v) { if (v.size() != VECTOR_STATE_SIZE ) { std::cerr << "\nHurd288Engine get:state vector has wrong length - state unchanged\n"; return false; } wordIndex = v[1]; for (int i = 0; i < 9; ++i) { words[i] = v[i+2]; } return true; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/gaussTables.src0000755000175000017500000004555707716514316017427 0ustar olesoles// $Id: gaussTables.src,v 1.3 2003/08/13 20:00:12 garren Exp $ // -*- C++ -*- // // gaussTables.src // // This program creates the data tables that RandGauss will use to // interpolate from the flat random R to the gaussian unit normal G. // The tables are produced in files gaussTables.cdat. The data is // organized into values and derivatives (for a cubic spline interpolation) // at 5 ranges of values of R: // by 2.0E-13 up to 4.0E-11 // by 4.0E-11 up to 1.0E-8 // by 1.0E-8 up to 2.0E-6 // by 2.0E-6 up to 5.0E-4 // by 5.0E-4 up to .5 // // These are included from RandGauss.cc in the fire() routine, for example, // static const double gaussTables[] = { // include "gaussTables.cdat" // } // // At the end of this file is a lengthy comment describing just what is going // on mathematically. // // main - Sets up TableInstructions then opens the output file and // lets writeTabels do its thing. // writeTables - Driver to create and write the gaussTables.cdat file by // calling tabulateCDFvsX and then many calls to interpolate. // tabulateCDFvsX - Integrate the pdf to create a table of cumulative density // function (CDF) vs X with uniform spacing in X. // interpolate - Given the CDF values produced by tabulateCDFvsX, find X for // a specified value of CDF (not necessarily at a node). // pdf - The gaussian distribution probability density function. // approxErrInt - Does an approximation of the error integral. // // This file need be compiled only once at one location; the gaussTables.cdat // generated is completely portable. Therefore, one time only, gaussTables.src // has been renamed gaussTables.cc, and compiled and run to create // gaussTables.cdat. The source gaussTables.src is provided with CLHEP as a // mode of concrete documentation of how those numers were computed. // // This file is stylistically not suitable for distribution as a reusable // module. // // 9/21/99 mf Created, with traces for seeing intermediate results. // 9/24/99 mf Traces removed, the results being valid. The file // gaussTables.cc-trace still contains those traces. // 10/25/99 mf Having been used (from test area) to create gaussTables.cdat, // gaussTables.cc was renamed .src and moved to Random area. // -------------------------------------------------------------- #include "CLHEP/Random/defs.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include #include #define IOS_OK #ifdef IOS_OK #include #endif using std::cout; class TableInstructions { public: double startingX; // Value of first X in table of CDF vs X // double intervalX; // (Uniform) spacing of X's in table of CDF // int NCDFvsX; // Number of entries in table of CDF vs X // int NnextXmin; // Number of X point matching first X point // in the next table of CDF vs X double startingCDF; // Desired first CDF point to fill in table of // X vs CDF value double intervalCDF; // (Uniform) spacing in table of X vs CDF // int NCDF; // Number of entries in table of X vs CDF }; double pdf (double x); void writeTables ( std::ostream & output, int nTables, const TableInstructions tables[] ); void tabulateCDFvsX (double CDFbelow, double startingX, double intervalX, int N, double pdf(double x), double* CDFTable, int NnextXmin, double & nextCDFbelow ); double interpolate ( double yStart, double Yspacing, int N, double* xTable, double pdf(double xx), double x, int fi, int& newfi ); double approxErrInt (double v); int main() { TableInstructions tables[6]; // Set up for computing each table: // // For each table, we will have about 10000 integration steps // in the actual range, and more outside for safety. const double Xstep = .0002; const int Xints = 500; // number of steps in an interval of .1 // 5000 points per unit X is found to give // the best accuracy. // by 2.0E-13 up to 4.0E-11 200 R values tables[0].startingX = -7.5; // errInt (-7.5) ~ 3.0E-14 tables[0].intervalX = Xstep; tables[0].NCDFvsX = 12*Xints; // errInt (-6.3) ~ 1.5E-10 tables[0].NnextXmin = 9*Xints; // to place it at -6.6 tables[0].startingCDF = 2.0E-13; tables[0].intervalCDF = 2.0E-13; tables[0].NCDF = 200; // by 4.0E-11 up to 1.0E-8 250 R values tables[1].startingX = -6.6; // errInt (-6.6) ~ 2.1E-11 tables[1].intervalX = Xstep; tables[1].NCDFvsX = 12*Xints; // errInt (-5.4) ~ 3.4E-8 tables[1].NnextXmin = 9*Xints; // to place it at -5.7 tables[1].startingCDF = 4.0E-11; tables[1].intervalCDF = 4.0E-11; tables[1].NCDF = 250; // by 1.0E-8 up to 2.0E-6 200 R values tables[2].startingX = -5.7; // errInt (-5.7) ~ 6.2E-9 tables[2].intervalX = Xstep; tables[2].NCDFvsX = 12*Xints; // errInt (-4.5) ~ 4.0E-6 tables[2].NnextXmin = 9*Xints; // to place it at -4.8 tables[2].startingCDF = 1.0E-8; tables[2].intervalCDF = 1.0E-8; tables[2].NCDF = 200; // by 2.0E-6 up to 5.0E-4 250 R values tables[3].startingX = -4.8; // errInt (-4.8) ~ 8.3E-7 tables[3].intervalX = Xstep; tables[3].NCDFvsX = 16*Xints; // errInt (-3.2) ~ 7.4E-4 tables[3].NnextXmin = 12*Xints; // to place it at -3.6 tables[3].startingCDF = 2.0E-6; tables[3].intervalCDF = 2.0E-6; tables[3].NCDF = 250; // by 5.0E-4 up to .5 1000 R values tables[4].startingX = -3.6; // errInt (-3.6) ~ 1.7E-4 tables[4].intervalX = Xstep; tables[4].NCDFvsX = 37*Xints; // errInt (+0.1) > .5 tables[4].NnextXmin = 0; // arbitrary, since value won't be used tables[4].startingCDF = 5.0E-4; tables[4].intervalCDF = 5.0E-4; tables[4].NCDF = 1000; // by 5.0E-4 up to .5 (reverse) 1000 R values tables[5].startingX = 0.0; tables[5].intervalX = -Xstep; tables[5].NCDFvsX = 36*Xints; // errInt (-3.6) ~ 1.7E-4 tables[5].NnextXmin = 0; // arbitrary, since value won't be used tables[5].startingCDF = 5.0E-4; tables[5].intervalCDF = 5.0E-4; tables[5].NCDF = 1000; // Open the output file std::ofstream output ( "gaussTables.cdat", std::ios::out ); // Write the tables writeTables ( output, 5, tables ); cout << " Tables completed \n"; return 0; } double pdf (double x) { return exp(-x*x/2.0)/sqrt(CLHEP::twopi); } void writeTables ( std::ostream & output, int nTables, const TableInstructions tables[] ) { // Write nTables tables out to output, guided by the tables[] instructions. double nextCDFbelow = 0; for ( int nt = 0; nt < nTables; nt++ ) { TableInstructions insts = tables[nt]; // **** First, tabulate the integrated cdf - which will be matched to r - // vs X (the limit of integration) which will be used as the deviate. double CDFbelow; if (nt == 0) { CDFbelow = approxErrInt ( insts.startingX ); } else { CDFbelow = nextCDFbelow; cout << "approxErrInt(" << insts.startingX << ") = " << approxErrInt(insts.startingX) << " CDFbelow = " << CDFbelow << "\n"; } int NCDFvsX = insts.NCDFvsX; double * CDFtable = new double [NCDFvsX]; tabulateCDFvsX (CDFbelow, insts.startingX, insts.intervalX, NCDFvsX, pdf, CDFtable, insts.NnextXmin, nextCDFbelow ); // CDFtable now contains NCDFvsX points, each representing the CDF // at a point X in a uniformly spaced set of X's. Also, nextCDFbelow // now contains the CDF at the desired point for the next interval. // **** From this table of CDF values, fill in the values of inverse CDF // at each of the specified r points, by interpolation. // Two things could go wrong here: // 1- The r points might lie outside the range of f(r) given in the // instructions). In that case, we will report it and punt. // 2- The estimated error of interpolation may be unacceptably large. // In that case, we could go back and halve the spacing in the table. // However, we have computed in advance the necessary spacing, so // we this error will always be acceptably small. if ( (insts.startingCDF + (insts.NCDF-1)*insts.intervalCDF) > CDFtable [NCDFvsX-1] ) { cout << "Problem in table " << nt << ": r outside range tabulated\n"; exit(1); } double * Xtable = new double [insts.NCDF]; int fi = 0; int newfi; int i; double r; double f; for ( i = 0; i < insts.NCDF; i++ ) { r = insts.startingCDF + i * insts.intervalCDF; f = interpolate ( insts.startingX, insts.intervalX, insts.NCDFvsX, CDFtable, pdf, r, fi, newfi ); Xtable[i] = f; fi = newfi; } // **** For just the last table, correct the endpoint by // tabulating CDF backward from 0, re-forming the Xtable, // and takingthe appropriate linear combination of the two. if (nt == nTables-1) { insts = tables[nTables]; NCDFvsX = insts.NCDFvsX; tabulateCDFvsX (.5, insts.startingX, insts.intervalX, NCDFvsX, pdf, CDFtable, insts.NnextXmin, nextCDFbelow ); // This table is not usable for the interpolation because it is backward: // reverse it! int n1; int n2; double temp; for ( n1 = 0, n2 = NCDFvsX -1; n1 < n2; n1++, n2-- ) { temp = CDFtable[n1]; CDFtable[n1] = CDFtable[n2]; CDFtable[n2] = temp; } // Form a second Xtable, just the way you did the first double * Xtable2 = new double [insts.NCDF]; fi = 0; for ( i = 0; i < insts.NCDF; i++ ) { r = insts.startingCDF + i * insts.intervalCDF; // Note in interpolation that the MEANING of the dependent (X) // points in the CDFtable does not depend on startingX and // intervalX in the same way as before, since these values would // give the reversed table. f = interpolate ( insts.startingX+insts.intervalX*(insts.NCDFvsX-1), -insts.intervalX, insts.NCDFvsX, CDFtable, pdf, r, fi, newfi ); Xtable2[i] = f; fi = newfi; } // Finally, correct the Xtable based on Xtable2 near .5 double top = insts.startingCDF + (insts.NCDF-1) * insts.intervalCDF; double bottom = insts.startingCDF; for ( i = 0; i < insts.NCDF; i++ ) { r = insts.startingCDF + i * insts.intervalCDF; Xtable[i] = ( Xtable2[i] * (r - bottom) + Xtable[i] * (top - r) ) / ( top - bottom ); } delete Xtable2; } // End of correction for last table. // **** Write this table in the proper format // The table has value and derivative; the derivative is given by // the reciprocal of the pdf (f(r) at each point. output << "\n"; for ( i = 0; i < insts.NCDF; i++ ) { double deriv; r = insts.startingCDF + i * insts.intervalCDF; f = Xtable[i]; deriv = 1.0/pdf(f); output.setf(ios_base::fixed,ios_base::floatfield); output.precision(17); output << std::setw(25) << f << ", " << std::setw(25) << deriv; output.setf(0,ios_base::floatfield); output.precision(6); output << ", // " << r << "\n"; } output << "\n"; delete Xtable; delete CDFtable; } // Now on to the next table. } // writeTables void tabulateCDFvsX (double CDFbelow, double startingX, double intervalX, int N, double pdf(double x), double* CDFtable, int NnextXmin, double & nextCDFbelow ) { // Create a table of integral from -infinity to f of pdf(x) dx, where we // assume the integral from -infinity to the startingF is given by rBelow. double f = startingX; double integral = CDFbelow; double halfStep = intervalX/2; const double h_6 = intervalX / 6.0; double* table = CDFtable; double d1; double d_midpt; double d2; d1 = pdf(f); *table = integral; table++; for ( int i = 1; i x) { cout << "xTable[fi] too large?? \n"; cout << "fi = " << fi << " xTable[fi] = " << xTable[fi] << " x = " << x << "\n"; exit(1); } int j; for ( j = fi; j < N-1; j++ ) { if ( xTable[j] > x ) break; } j = j-1; newfi = j; // Perform the interpolation: double y0 = yStart + j *Yspacing; double y1 = yStart + (j+1)*Yspacing; double d0 = 1.0/pdf(y0); double d1 = 1.0/pdf(y1); double x0 = xTable[j]; double x1 = xTable[j+1]; double h = x1 - x0; double dx = (x - x0)/h; double x2 = dx * dx; double oneMinusX = 1 - dx; double oneMinusX2 = oneMinusX * oneMinusX; double f0 = (2. * dx + 1.) * oneMinusX2; double f1 = (3. - 2. * dx) * x2; double g0 = h * dx * oneMinusX2; double g1 = - h * oneMinusX * x2; double answer; answer = f0 * y0 + f1 * y1 + g0 * d0 + g1 * d1 ; return answer; } // interpolate double approxErrInt (double v) { // To use this routine, v MUST be negative and for accuracy should be < -4. // First approximation is e**(-v**2/2) / ( v* sqrt(2PI) ) double errInt = exp(-v*v/2); errInt = - errInt / ( v*sqrt(CLHEP::twopi) ); // correction factor of // (1 - 1/v**2 + 3/v**4 - 3*5/v**6 + ... -3*5*7*9*11*13/v**14) double correction = 1; for ( int n = 12; n >= 0; n -= 2 ) { correction = 1.0 - correction*(n+1)/(v*v); } errInt *= correction; // This is accurate to 1 part in 2000 for v < -4, and one part in // 50,000 for v < -5. Since we are using it at v = -7.5, the accuracy is // a part in 8E-8, but since this is multiplied by 3E-14, the error // introduced into our returned deviates is about a 2E-21 or less. This // of course is much less than the machine epsilon. // cout << "errInt (" << v << ") = " << errInt << "\n"; return errInt; } #ifdef STRATEGY What RandGauss will try to do is, given a value r, produce an estimate of f such that integral (-infinity, f, pdf(x)dx) = r, where pdf(x) is the gaussian distribution exp(-x**2/2)/srqt(2*PI). Excising details, the strategy is: The first step is to build up a table of integral (-infinity, x, pdf(v)dv) vs x. The table goes in steps of n*some small epsilon. (We call it CDFtable, and compute it in tabulateCDFvsX.) From this table, we can find values of x corresponding to the particular values of cdf that appear in the table. From this, we can find for a given r the hypthetical X value that would give that r as the cdf. (This is computed in interpolate().) Thus we can build a table of inverse_CDF(r) vs r, for r at our desired spaced intervals, by interpolation using each r point. We call this table Xtable, since the inverse CDF or r is the number that RandGauss needs to return as the deviate when supplied with the uniform random r. We can also place the derivatives of this function in the table; these are needed when the distribution is fired. When RandGauss is fired, we will find the appropriate realm and do cubic spline interpolation there. - - - - - The first step is to build up a table of integral (-infinity, x, pdf(v)dv) vs x. This is done by 4-th order numerical integration, using a fine spacing. How do we handle the limit at -infinity? We will start with some estimate for integral (-infinity, v, pdf(x)dx) for a fairly negative value of v, as follows: Fortuitously, for reasons of accuracy at small r, we are breaking the problem into multiplt realms anyway. For each realm of calculation other than the first, we have the integral as computed in the previous realm. For the first realm, we take our largest negative f, and apply the asymptotic formulat for the error integral, which is: integral (-infinity, v, pdf(x)dx) = exp(-x**2/2)*(1-1/v**2+3/v**4-3*5/v**6...)/srqt(2*PI*v) In the range of r this small, all we care about is a reasonable relative error, since the absolute error will be very small (and the tail will thus work properly). The table goes in steps of n*some small epsilon. For the main table, the step size has a natural limit: The integration error will go as h**4 in each step, but will never be smaller than machine_epsilon times the step contribution. What this tells us is that beyond about some number of (~8000) points, your roundoff error is the dominant factor and increasing your granularity will probably hurt more than help. The observed behavor is that the accuracy - measured by the difference between values for N and 2N points - is best at a step size of about 1/5000. From this table, we can find values of x corresponding to the particular values of cdf that appear in the table. From this, we can find for a given r the hypothetical X that would be give that r value as the cdf. The appropriate interpolation scheme is the cubic spline, since that gives us full accuracy with the spacing already present. [ This step is done in nextInterpolate ] Thus we can build a table of inverse_CDF(r) vs r, for r at our desired spaced intervals, by interpolation using each r point. We can also place the derivatives of this function in the table; these are needed when the distribution is fired. The derivatives are merely 1/pdf(that inverse_CDF). In principle, the fire() routine could calculate this; for efficiency, it is pre-tabulated. Although this is a double precision routine, for most values of r, accuracy of 2**-40 is perfectly OK (in fact, distortion at the level of one part in 2**30 would be undetectable in several year's running). However, for very small values of r, we need to do a bit better so as to have the correct shape of the distribution tail. So our realms are intervals of roughly 2**-11, -19, -27, -35 and -42. Since we will only need to tabulate up to r = .5, the total data amounts to 32K bytes. A final subtlety: We know that when 5=.5, the value of inverse CDF is exactly zero. But the integration leaves it at some small number (3E-12) instead. We can fix this without introducing discontinuities by redoing the last table starting from the top being exactly 0 and working backward, re-formulating a second table of X vs R, and then taking as our final table a linear combination which is the backward one at .5 and the forward one at .0005. When RandGauss is fired, we will find the appropriate realm and do cubic spline interpolation there. If r < 2**-42, we will instead iteratively apply the asymptotic formula to solve for v; this is time-consuming but would happen only a vanishingly small fraction of the time. #endif clhep-2.1.4.1.orig/Random/src/gaussQtables.src0000755000175000017500000003513307716514316017575 0ustar olesoles// $Id: gaussQtables.src,v 1.3 2003/08/13 20:00:12 garren Exp $ // -*- C++ -*- // // gaussTables.src // // This program creates the data tables that RandGaussQ will use to // interpolate from the flat random R to the gaussian unit normal G. // The tables are produced in files gaussQTables.cdat. The data is // organized into values at 2 ranges of values of R: // by 2.0E-6 up to 5.0E-4 // by 5.0E-4 up to .5 // This is substantially less data than is present in FlatToGaussian: // Only 1250 grid points in two tables are used, instead of 2000 in five; // single precision rather than double is used; and we do not store the // derivative separately. The total footprint is 5K bytes. // // Internally, the same tables are used as per FlatToGaussian, so that // the accuracy of the data is as good as possible. // // These are included from RandGaussQ.cc in the fire() routine, for example, // static const double gaussQTables[] = { // include "gaussQTables.cdat" // } // // At the end of gaussTables.cdat is a lengthy comment describing just what is // going on mathematically; this applies here as well. // // main - Sets up TableInstructions then opens the output file and // lets writeTabels do its thing. // writeTables - Driver to create and write the gaussTables.cdat file by // calling tabulateCDFvsX and then many calls to interpolate. // tabulateCDFvsX - Integrate the pdf to create a table of cumulative density // function (CDF) vs X with uniform spacing in X. // interpolate - Given the CDF values produced by tabulateCDFvsX, find X for // a specified value of CDF (not necessarily at a node). // pdf - The gaussian distribution probability density function. // approxErrInt - Does an approximation of the error integral. // // This file need be compiled only once at one location; the gaussQTables.cdat // generated is completely portable. Therefore, one time only, gaussQTables.src // has been renamed gaussQTables.cc, and compiled and run to create // gaussQTables.cdat. The source gaussQTables.src is provided with CLHEP as a // mode of concrete documentation of how those numers were computed. // // This file is stylistically not suitable for distribution as a reusable // module. // // 1/24/00 mf Created. // 1/ /00 mf Having been used (from test area) to create gaussQTables.cdat, // gaussQTables.cc was renamed .src and moved to Random area. // -------------------------------------------------------------- #include "CLHEP/Random/defs.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include #include #define IOS_OK #ifdef IOS_OK #include #endif using std::cout; class TableInstructions { public: double startingX; // Value of first X in table of CDF vs X // double intervalX; // (Uniform) spacing of X's in table of CDF // int NCDFvsX; // Number of entries in table of CDF vs X // int NnextXmin; // Number of X point matching first X point // in the next table of CDF vs X double startingCDF; // Desired first CDF point to fill in table of // X vs CDF value double intervalCDF; // (Uniform) spacing in table of X vs CDF // int NCDF; // Number of entries in table of X vs CDF }; double pdf (double x); void writeTables ( std::ostream & output, int nTables, const TableInstructions tables[] ); void tabulateCDFvsX (double CDFbelow, double startingX, double intervalX, int N, double pdf(double x), double* CDFTable, int NnextXmin, double & nextCDFbelow ); double interpolate ( double yStart, double Yspacing, int N, double* xTable, double pdf(double xx), double x, int fi, int& newfi ); double approxErrInt (double v); int main() { TableInstructions tables[6]; // Set up for computing each table: // // For each table, we will have about 10000 integration steps // in the actual range, and more outside for safety. const double Xstep = .0002; const int Xints = 500; // number of steps in an interval of .1 // 5000 points per unit X is found to give // the best accuracy. // by 2.0E-13 up to 4.0E-11 200 R values tables[0].startingX = -7.5; // errInt (-7.5) ~ 3.0E-14 tables[0].intervalX = Xstep; tables[0].NCDFvsX = 12*Xints; // errInt (-6.3) ~ 1.5E-10 tables[0].NnextXmin = 9*Xints; // to place it at -6.6 tables[0].startingCDF = 2.0E-13; tables[0].intervalCDF = 2.0E-13; tables[0].NCDF = 200; // by 4.0E-11 up to 1.0E-8 250 R values tables[1].startingX = -6.6; // errInt (-6.6) ~ 2.1E-11 tables[1].intervalX = Xstep; tables[1].NCDFvsX = 12*Xints; // errInt (-5.4) ~ 3.4E-8 tables[1].NnextXmin = 9*Xints; // to place it at -5.7 tables[1].startingCDF = 4.0E-11; tables[1].intervalCDF = 4.0E-11; tables[1].NCDF = 250; // by 1.0E-8 up to 2.0E-6 200 R values tables[2].startingX = -5.7; // errInt (-5.7) ~ 6.2E-9 tables[2].intervalX = Xstep; tables[2].NCDFvsX = 12*Xints; // errInt (-4.5) ~ 4.0E-6 tables[2].NnextXmin = 9*Xints; // to place it at -4.8 tables[2].startingCDF = 1.0E-8; tables[2].intervalCDF = 1.0E-8; tables[2].NCDF = 200; // by 2.0E-6 up to 5.0E-4 250 R values tables[3].startingX = -4.8; // errInt (-4.8) ~ 8.3E-7 tables[3].intervalX = Xstep; tables[3].NCDFvsX = 16*Xints; // errInt (-3.2) ~ 7.4E-4 tables[3].NnextXmin = 12*Xints; // to place it at -3.6 tables[3].startingCDF = 2.0E-6; tables[3].intervalCDF = 2.0E-6; tables[3].NCDF = 250; // by 5.0E-4 up to .5 1000 R values tables[4].startingX = -3.6; // errInt (-3.6) ~ 1.7E-4 tables[4].intervalX = Xstep; tables[4].NCDFvsX = 37*Xints; // errInt (+0.1) > .5 tables[4].NnextXmin = 0; // arbitrary, since value won't be used tables[4].startingCDF = 5.0E-4; tables[4].intervalCDF = 5.0E-4; tables[4].NCDF = 1000; // by 5.0E-4 up to .5 (reverse) 1000 R values tables[5].startingX = 0.0; tables[5].intervalX = -Xstep; tables[5].NCDFvsX = 36*Xints; // errInt (-3.6) ~ 1.7E-4 tables[5].NnextXmin = 0; // arbitrary, since value won't be used tables[5].startingCDF = 5.0E-4; tables[5].intervalCDF = 5.0E-4; tables[5].NCDF = 1000; // Open the output file std::ofstream output ( "gaussQTables.cdat", std::ios::out ); // Write the tables writeTables ( output, 5, tables ); cout << " Tables completed \n"; return 0; } double pdf (double x) { return exp(-x*x/2.0)/sqrt(CLHEP::twopi); } void writeTables ( std::ostream & output, int nTables, const TableInstructions tables[] ) { // Write nTables tables out to output, guided by the tables[] instructions. double nextCDFbelow = 0; for ( int nt = 0; nt < nTables; nt++ ) { TableInstructions insts = tables[nt]; // **** First, tabulate the integrated cdf - which will be matched to r - // vs X (the limit of integration) which will be used as the deviate. double CDFbelow; if (nt == 0) { CDFbelow = approxErrInt ( insts.startingX ); } else { CDFbelow = nextCDFbelow; cout << "approxErrInt(" << insts.startingX << ") = " << approxErrInt(insts.startingX) << " CDFbelow = " << CDFbelow << "\n"; } int NCDFvsX = insts.NCDFvsX; double * CDFtable = new double [NCDFvsX]; tabulateCDFvsX (CDFbelow, insts.startingX, insts.intervalX, NCDFvsX, pdf, CDFtable, insts.NnextXmin, nextCDFbelow ); // CDFtable now contains NCDFvsX points, each representing the CDF // at a point X in a uniformly spaced set of X's. Also, nextCDFbelow // now contains the CDF at the desired point for the next interval. // **** From this table of CDF values, fill in the values of inverse CDF // at each of the specified r points, by interpolation. // Two things could go wrong here: // 1- The r points might lie outside the range of f(r) given in the // instructions). In that case, we will report it and punt. // 2- The estimated error of interpolation may be unacceptably large. // In that case, we could go back and halve the spacing in the table. // However, we have computed in advance the necessary spacing, so // we this error will always be acceptably small. if ( (insts.startingCDF + (insts.NCDF-1)*insts.intervalCDF) > CDFtable [NCDFvsX-1] ) { cout << "Problem in table " << nt << ": r outside range tabulated\n"; exit(1); } double * Xtable = new double [insts.NCDF]; int fi = 0; int newfi; int i; double r; double f; for ( i = 0; i < insts.NCDF; i++ ) { r = insts.startingCDF + i * insts.intervalCDF; f = interpolate ( insts.startingX, insts.intervalX, insts.NCDFvsX, CDFtable, pdf, r, fi, newfi ); Xtable[i] = f; fi = newfi; } // **** For just the last table, correct the endpoint by // tabulating CDF backward from 0, re-forming the Xtable, // and takingthe appropriate linear combination of the two. if (nt == nTables-1) { insts = tables[nTables]; NCDFvsX = insts.NCDFvsX; tabulateCDFvsX (.5, insts.startingX, insts.intervalX, NCDFvsX, pdf, CDFtable, insts.NnextXmin, nextCDFbelow ); // This table is not usable for the interpolation because it is backward: // reverse it! int n1; int n2; double temp; for ( n1 = 0, n2 = NCDFvsX -1; n1 < n2; n1++, n2-- ) { temp = CDFtable[n1]; CDFtable[n1] = CDFtable[n2]; CDFtable[n2] = temp; } // Form a second Xtable, just the way you did the first double * Xtable2 = new double [insts.NCDF]; fi = 0; for ( i = 0; i < insts.NCDF; i++ ) { r = insts.startingCDF + i * insts.intervalCDF; // Note in interpolation that the MEANING of the dependent (X) // points in the CDFtable does not depend on startingX and // intervalX in the same way as before, since these values would // give the reversed table. f = interpolate ( insts.startingX+insts.intervalX*(insts.NCDFvsX-1), -insts.intervalX, insts.NCDFvsX, CDFtable, pdf, r, fi, newfi ); Xtable2[i] = f; fi = newfi; } // Finally, correct the Xtable based on Xtable2 near .5 double top = insts.startingCDF + (insts.NCDF-1) * insts.intervalCDF; double bottom = insts.startingCDF; for ( i = 0; i < insts.NCDF; i++ ) { r = insts.startingCDF + i * insts.intervalCDF; Xtable[i] = ( Xtable2[i] * (r - bottom) + Xtable[i] * (top - r) ) / ( top - bottom ); } delete Xtable2; } // End of correction for last table. // **** Write this table in the proper format // // But only the last two tables are written out for RandGaussQ. // // The tables just have the values; the derivatives will be computed // implicitly when RandGaussQ interpolates between the grid points. if ( nt < 3 ) continue; // DON'T write the first 3 tables! output << "\n"; for ( i = 0; i < insts.NCDF; i++ ) { r = insts.startingCDF + i * insts.intervalCDF; f = Xtable[i]; output.setf(ios_base::fixed,ios_base::floatfield); output.precision(10); output << std::setw(25) << f ; output.setf(0,ios_base::floatfield); output.precision(6); output << ", // " << r << "\n"; } output << "\n"; delete Xtable; delete CDFtable; } // Now on to the next table. } // writeTables // ====================== // Everything from here and below is the same as in gaussTables.cdat! // ====================== void tabulateCDFvsX (double CDFbelow, double startingX, double intervalX, int N, double pdf(double x), double* CDFtable, int NnextXmin, double & nextCDFbelow ) { // Create a table of integral from -infinity to f of pdf(x) dx, where we // assume the integral from -infinity to the startingF is given by rBelow. double f = startingX; double integral = CDFbelow; double halfStep = intervalX/2; const double h_6 = intervalX / 6.0; double* table = CDFtable; double d1; double d_midpt; double d2; d1 = pdf(f); *table = integral; table++; for ( int i = 1; i x) { cout << "xTable[fi] too large?? \n"; cout << "fi = " << fi << " xTable[fi] = " << xTable[fi] << " x = " << x << "\n"; exit(1); } int j; for ( j = fi; j < N-1; j++ ) { if ( xTable[j] > x ) break; } j = j-1; newfi = j; // Perform the interpolation: double y0 = yStart + j *Yspacing; double y1 = yStart + (j+1)*Yspacing; double d0 = 1.0/pdf(y0); double d1 = 1.0/pdf(y1); double x0 = xTable[j]; double x1 = xTable[j+1]; double h = x1 - x0; double dx = (x - x0)/h; double x2 = dx * dx; double oneMinusX = 1 - dx; double oneMinusX2 = oneMinusX * oneMinusX; double f0 = (2. * dx + 1.) * oneMinusX2; double f1 = (3. - 2. * dx) * x2; double g0 = h * dx * oneMinusX2; double g1 = - h * oneMinusX * x2; double answer; answer = f0 * y0 + f1 * y1 + g0 * d0 + g1 * d1 ; return answer; } // interpolate double approxErrInt (double v) { // To use this routine, v MUST be negative and for accuracy should be < -4. // First approximation is e**(-v**2/2) / ( v* sqrt(2PI) ) double errInt = exp(-v*v/2); errInt = - errInt / ( v*sqrt(CLHEP::twopi) ); // correction factor of // (1 - 1/v**2 + 3/v**4 - 3*5/v**6 + ... -3*5*7*9*11*13/v**14) double correction = 1; for ( int n = 12; n >= 0; n -= 2 ) { correction = 1.0 - correction*(n+1)/(v*v); } errInt *= correction; // This is accurate to 1 part in 2000 for v < -4, and one part in // 50,000 for v < -5. Since we are using it at v = -7.5, the accuracy is // a part in 8E-8, but since this is multiplied by 3E-14, the error // introduced into our returned deviates is about a 2E-21 or less. This // of course is much less than the machine epsilon. // cout << "errInt (" << v << ") = " << errInt << "\n"; return errInt; } clhep-2.1.4.1.orig/Random/src/RanshiEngine.cc0000755000175000017500000002702011753236267017305 0ustar olesoles// $Id: RanshiEngine.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RanshiEngine --- // class implementation file // ----------------------------------------------------------------------- // // This algorithm implements the random number generator as proposed by // "F. Gutbrod, Comp. Phys. Comm. 87 (1995) 291-306". // // ======================================================================= // Ken Smith - Created: 9th June 1998 // - Removed std::pow() from flat method: 21st Jul 1998 // - Added conversion operators: 6th Aug 1998 // J. Marraffino - Added some explicit casts to deal with // machines where sizeof(int) != sizeof(long) 22 Aug 1998 // M. Fischler - Modified constructors taking seeds to not // depend on numEngines (same seeds should // produce same sequences). Default still // depends on numEngines. 16 Sep 1998 // - Modified use of the various exponents of 2 // to avoid per-instance space overhead and // correct the rounding procedure 16 Sep 1998 // J. Marraffino - Remove dependence on hepString class 13 May 1999 // M. Fischler - In restore, checkFile for file not found 03 Dec 2004 // M. Fischler - Methods for instance save/restore 12/8/04 // M. Fischler - split get() into tag validation and // getState() for anonymous restores 12/27/04 // M. Fischler - State-saving using only ints, for portability 4/12/05 // // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RanshiEngine.h" #include "CLHEP/Random/engineIDulong.h" #include // for strcmp namespace CLHEP { static const int MarkerLen = 64; // Enough room to hold a begin or end marker. std::string RanshiEngine::name() const {return "RanshiEngine";} // Number of instances with automatic seed selection int RanshiEngine::numEngines = 0; RanshiEngine::RanshiEngine() : HepRandomEngine(), halfBuff(0), numFlats(0) { int i = 0; while (i < numBuff) { buffer[i] = (unsigned int)(numEngines+19780503L*(i+1)); ++i; } theSeed = numEngines+19780503L*++i; redSpin = (unsigned int)(theSeed & 0xffffffff); ++numEngines; for( i = 0; i < 10000; ++i) flat(); // Warm-up by running thorugh 10000 nums } RanshiEngine::RanshiEngine(std::istream& is) : HepRandomEngine(), halfBuff(0), numFlats(0) { is >> *this; } RanshiEngine::RanshiEngine(long seed) : HepRandomEngine(), halfBuff(0), numFlats(0) { for (int i = 0; i < numBuff; ++i) { buffer[i] = (unsigned int)seed&0xffffffff; } theSeed = seed; redSpin = (unsigned int)(theSeed & 0xffffffff); int j; for (j = 0; j < numBuff*20; ++j) { // "warm-up" for engine to hit flat(); // every ball on average 20X. } } RanshiEngine::RanshiEngine(int rowIndex, int colIndex) : HepRandomEngine(), halfBuff(0), numFlats(0) { int i = 0; while( i < numBuff ) { buffer[i] = (unsigned int)((rowIndex + (i+1)*(colIndex+8))&0xffffffff); ++i; } theSeed = rowIndex; redSpin = colIndex & 0xffffffff; for( i = 0; i < 100; ++i) flat(); // Warm-up by running thorugh 100 nums } RanshiEngine::~RanshiEngine() { } double RanshiEngine::flat() { unsigned int redAngle = (((numBuff/2) - 1) & redSpin) + halfBuff; unsigned int blkSpin = buffer[redAngle] & 0xffffffff; unsigned int boostResult = blkSpin ^ redSpin; buffer[redAngle] = ((blkSpin << 17) | (blkSpin >> (32-17))) ^ redSpin; redSpin = (blkSpin + numFlats++) & 0xffffffff; halfBuff = numBuff/2 - halfBuff; return ( blkSpin * twoToMinus_32() + // most significant part (boostResult>>11) * twoToMinus_53() + // fill in remaining bits nearlyTwoToMinus_54()); // non-zero } void RanshiEngine::flatArray(const int size, double* vect) { for (int i = 0; i < size; ++i) { vect[i] = flat(); } } void RanshiEngine::setSeed(long seed, int) { *this = RanshiEngine(seed); } void RanshiEngine::setSeeds(const long* seeds, int) { if (*seeds) { int i = 0; while (seeds[i] && i < numBuff) { buffer[i] = (unsigned int)seeds[i]; ++i; } while (i < numBuff) { buffer[i] = buffer[i-1]; ++i; } theSeed = seeds[0]; redSpin = (unsigned int)theSeed; } theSeeds = seeds; } void RanshiEngine::saveStatus(const char filename[]) const { std::ofstream outFile(filename, std::ios::out); if (!outFile.bad()) { outFile << "Uvec\n"; std::vector v = put(); #ifdef TRACE_IO std::cout << "Result of v = put() is:\n"; #endif for (unsigned int i=0; i v; unsigned long xin; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { inFile >> xin; #ifdef TRACE_IO std::cout << "ivec = " << ivec << " xin = " << xin << " "; if (ivec%3 == 0) std::cout << "\n"; #endif if (!inFile) { inFile.clear(std::ios::badbit | inFile.rdstate()); std::cerr << "\nRanshiEngine state (vector) description improper." << "\nrestoreStatus has failed." << "\nInput stream is probably mispositioned now." << std::endl; return; } v.push_back(xin); } getState(v); return; } if (!inFile.bad()) { // inFile >> theSeed; removed -- encompased by possibleKeywordInput for (int i = 0; i < numBuff; ++i) { inFile >> buffer[i]; } inFile >> redSpin >> numFlats >> halfBuff; } } void RanshiEngine::showStatus() const { std::cout << std::setprecision(20) << std::endl; std::cout << "----------- Ranshi engine status ----------" << std::endl; std::cout << "Initial seed = " << theSeed << std::endl; std::cout << "Current red spin = " << redSpin << std::endl; std::cout << "Values produced = " << numFlats << std::endl; std::cout << "Side of buffer = " << (halfBuff ? "upper" : "lower") << std::endl; std::cout << "Current buffer = " << std::endl; for (int i = 0; i < numBuff; i+=4) { std::cout << std::setw(10) << std::setiosflags(std::ios::right) << buffer[i] << std::setw(11) << buffer[i+1] << std::setw(11) << buffer[i+2] << std::setw(11) << buffer[i+3] << std::endl; } std::cout << "-------------------------------------------" << std::endl; } RanshiEngine::operator float() { unsigned int redAngle = (((numBuff/2) - 1) & redSpin) + halfBuff; unsigned int blkSpin = buffer[redAngle] & 0xffffffff; buffer[redAngle] = ((blkSpin << 17) | (blkSpin >> (32-17))) ^ redSpin; redSpin = (blkSpin + numFlats++) & 0xffffffff; halfBuff = numBuff/2 - halfBuff; return float(blkSpin * twoToMinus_32()); } RanshiEngine::operator unsigned int() { unsigned int redAngle = (((numBuff/2) - 1) & redSpin) + halfBuff; unsigned int blkSpin = buffer[redAngle] & 0xffffffff; buffer[redAngle] = ((blkSpin << 17) | (blkSpin >> (32-17))) ^ redSpin; redSpin = (blkSpin + numFlats++) & 0xffffffff; halfBuff = numBuff/2 - halfBuff; return blkSpin; } std::ostream& RanshiEngine::put (std::ostream& os ) const { char beginMarker[] = "RanshiEngine-begin"; os << beginMarker << "\nUvec\n"; std::vector v = put(); for (unsigned int i=0; i RanshiEngine::put () const { std::vector v; v.push_back (engineIDulong()); for (int i = 0; i < numBuff; ++i) { v.push_back(static_cast(buffer[i])); } v.push_back(static_cast(redSpin)); v.push_back(static_cast(numFlats)); v.push_back(static_cast(halfBuff)); return v; } std::istream& RanshiEngine::get (std::istream& is) { char beginMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"RanshiEngine-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput mispositioned or" << "\nRanshiEngine state description missing or" << "\nwrong engine type found." << std::endl; return is; } return getState(is); } std::string RanshiEngine::beginTag ( ) { return "RanshiEngine-begin"; } std::istream& RanshiEngine::getState (std::istream& is) { if ( possibleKeywordInput ( is, "Uvec", theSeed ) ) { std::vector v; unsigned long uu; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { is >> uu; if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nRanshiEngine state (vector) description improper." << "\ngetState() has failed." << "\nInput stream is probably mispositioned now." << std::endl; return is; } v.push_back(uu); } getState(v); return (is); } // is >> theSeed; Removed, encompassed by possibleKeywordInput() char endMarker [MarkerLen]; for (int i = 0; i < numBuff; ++i) { is >> buffer[i]; } is >> redSpin >> numFlats >> halfBuff; is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"RanshiEngine-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nRanshiEngine state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; return is; } return is; } bool RanshiEngine::get (const std::vector & v) { if ((v[0] & 0xffffffffUL) != engineIDulong()) { std::cerr << "\nRanshiEngine get:state vector has wrong ID word - state unchanged\n"; return false; } return getState(v); } bool RanshiEngine::getState (const std::vector & v) { if (v.size() != VECTOR_STATE_SIZE ) { std::cerr << "\nRanshiEngine get:state vector has wrong length - state unchanged\n"; return false; } for (int i = 0; i < numBuff; ++i) { buffer[i] = v[i+1]; } redSpin = v[numBuff+1]; numFlats = v[numBuff+2]; halfBuff = v[numBuff+3]; return true; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/DoubConv.cc0000644000175000017500000000641010233771102016427 0ustar olesoles#include "CLHEP/Random/DoubConv.hh" #include #include namespace CLHEP { bool DoubConv::byte_order_known = false; int DoubConv::byte_order[8]; void DoubConv::fill_byte_order () { double x = 1.0; int t30 = 1 << 30; int t22 = 1 << 22; x *= t30; x *= t22; double y = 1; double z = 1; x *= z; for (int k=0; k<6; k++) { x += y*z; y += 1; z *= 256; } // x, in IEEE format, would now be 0x4330060504030201 union DB8 { unsigned char b[8]; double d; }; DB8 xb; xb.d = x; int n; static const int UNSET = -1; for (n=0; n<8; n++) { byte_order[n] = UNSET; } int order; for (n=0; n<8; n++) { switch ( xb.b[n] ) { case 0x43: order = 0; break; case 0x30: order = 1; break; case 0x06: order = 2; break; case 0x05: order = 3; break; case 0x04: order = 4; break; case 0x03: order = 5; break; case 0x02: order = 6; break; case 0x01: order = 7; break; default: throw DoubConvException( "Cannot determine byte-ordering of doubles on this system"); } if (byte_order[n] != UNSET) { throw DoubConvException( "Confusion in byte-ordering of doubles on this system"); } byte_order[n] = order; byte_order_known = true; } return; } std::string DoubConv::d2x(double d) { if ( !byte_order_known ) fill_byte_order (); DB8 db; db.d = d; std::ostringstream ss; for (int i=0; i<8; ++i) { int k = byte_order[i]; ss << std::hex << std::setw(2) << std::setfill('0') << (int)db.b[k]; } return ss.str(); } std::vector DoubConv::dto2longs(double d) { std::vector v(2); if ( !byte_order_known ) fill_byte_order (); DB8 db; db.d = d; v[0] = ((static_cast(db.b[byte_order[0]])) << 24) | ((static_cast(db.b[byte_order[1]])) << 16) | ((static_cast(db.b[byte_order[2]])) << 8) | ((static_cast(db.b[byte_order[3]])) ); v[1] = ((static_cast(db.b[byte_order[4]])) << 24) | ((static_cast(db.b[byte_order[5]])) << 16) | ((static_cast(db.b[byte_order[6]])) << 8) | ((static_cast(db.b[byte_order[7]])) ); return v; } double DoubConv::longs2double (const std::vector & v) { DB8 db; unsigned char bytes[8]; if ( !byte_order_known ) fill_byte_order (); bytes[0] = static_cast((v[0] >> 24) & 0xFF); bytes[1] = static_cast((v[0] >> 16) & 0xFF); bytes[2] = static_cast((v[0] >> 8) & 0xFF); bytes[3] = static_cast((v[0] ) & 0xFF); bytes[4] = static_cast((v[1] >> 24) & 0xFF); bytes[5] = static_cast((v[1] >> 16) & 0xFF); bytes[6] = static_cast((v[1] >> 8) & 0xFF); bytes[7] = static_cast((v[1] ) & 0xFF); for (int i=0; i<8; ++i) { db.b[byte_order[i]] = bytes[i]; } return db.d; } } // end namespace HepMC clhep-2.1.4.1.orig/Random/src/poissonTables.src0000755000175000017500000002055607716514316017767 0ustar olesoles// $Id: poissonTables.src,v 1.2 2003/08/13 20:00:12 garren Exp $ // -*- C++ -*- // // poissonTables.src // // This program creates the data tables that RandPoisson will use to // interpolate from the flat random R to the poisson deviate N. // The tables are produced in files poissonTables.cdat. The data is // in the form of a row for each integer mu value, counting by 5's to // 100. Each row of the table presents 51 values of r, corresponding to // the lowest r such that the distribution ought to return N, for 51 // consecutive integers N. // This is exp(-mu) times sum(mu**k/k!, k=0 to N-1). // // For mu of 30 and lower, these start at N=1; // for mu of 35 and higher these start at mu-30. // // At the end of this file is a lengthy comment describing just what is going // on mathematically. // // This file need be compiled only once at one location; the poissonTables.cdat // generated is completely portable. Therefore, one time only, // poissonTables.src has been renamed poissonTables.cc, and compiled and run // to create poissonTables.cdat. The source poissonTables.src is provided // with CLHEP as a mode of concrete documentation of how those numers were // computed. // // This file is stylistically not suitable for distribution as a reusable // module. // // 11/17/99 mf Created. // 11/18/99 mf Having been used (from test area) to create poissonTables.cdat, // poissonTables.cc was renamed .src and moved to Random area. // -------------------------------------------------------------- #include "CLHEP/Random/defs.h" #include #include #include #define IOS_OK #ifdef IOS_OK #include #endif using std::cout; // // Constants dictating the nature of the table are picked up from RandPoisson.h // #include "CLHEP/Random/RandPoisson.h" int main() { // Open the output file std::ofstream output ( "poissonTables.cdat", std::ios::out ); // Write the table, one mu-value at a time double mu; for ( mu = FIRST_MU; mu <= LAST_MU; mu += S ) { output << "\n//\n// mu = " << mu << "\n//\n"; double exp_mu = exp(-mu); int Nmin = mu - BELOW; if ( Nmin < 1 ) {Nmin = 1;} int Nmax = Nmin + ENTRIES - 1; double cdf = 0; double term = exp_mu; int N; // Compute exp_mu sum (mu**m/m!, m = 0 to Nmin-1. // Leave term as the next term, mu**Nmin/Nmin! N = 1; while ( N < Nmin ) { cdf += term; term *= mu/N; N++; } // Write out the values of cdf, in groups of 3 N = Nmin; while (N <= Nmax) { int j; for ( j = 0; j < 3; j++ ) { double cdf0 = cdf; cdf += term; // The following lines handle roundoff issues: if ( (cdf == cdf0) && (cdf > (1 - 1.0E-14)) ) cdf = 1; if (cdf > 1) cdf = 1; // term *= mu/N; output.setf(ios::fixed,ios::floatfield); output.precision(17); output << std::setw(20) << cdf << ", "; N++; } output.setf(0,ios::floatfield); output.precision(4); output << " // " << N-3 << " - " << N-1 << "\n"; } } cout << " Tables completed \n"; return 0; } #ifdef STRATEGY The task is, given a value r and a mean mu, to find the smallest value of N such that cdf (mu, N) >= r. The crucial mathematical enabler is that the sum of two Poisson deviates with means u and v is distributed as a Possion with mean (u+v). The idea is to generate r, LOOK UP the Poisson N for a value of mu slightly less than the actual value, and then generate a small-mean Poisson to add to that N to reflect the differnce between the actual mu and the tabulated mu. The algorithm, then, is: 0) Generate one random, r. 1) If mu > boundary, use the Gaussian approximation. We can share the normal transform that RandGauss uses, to double the speed over a Box-Mueller. This boundary can be pushed to quite a high value, since the only cost of increasing it is table space. THe original CENRLIB used 88; we can use 100. 2) If mu is very small, simply do the direct series summation. 3) Consider row [mu/S] of the table; that is, the table contains values of r_min vs N for mu = 0, S, 2S, 3S, ... 4) In that table, find the largest Rentry below r. Note the index N1. r - Rentry[n1] 5) Form a new random, r' = ----------------------- . This is uniform on (0,1). Rentry[n1+1]-Rentry[n1] 6) Use the direct method to form Poisson deviate N2 from r'. The new random r' has fewer bits of randomness than did r, but only by about 1-7 bits (about 7 bits for selecting among 100 possible N values), Since the second Poisson is for a small mu, this distortion will harm the overall accuracy of the distribution by somewhat less than 7 bits of loss. 7) The result is N1 + N2. This method is precise to at least 46-bit accuracy, and can be made accurate to the full precision of your random engine at the cost of one extra random fired per deviate. Some wrinkles: -- When the table runs out -- The table should extend to one number more than the maximal N anticipated for most r. In rare cases, r will put you above that last r. In such cases, (r-last R) / (1-last R) will again be uniformly distributed, but it would be incorrect to simply this as the second Random because we don't know the correct value of N1. But we do know the sum of the N terms, and (from subtracting the next-to-last entry) the N-th term in the series. So we can start from that last Rentry, and continue to extend the sum out as far as is needed to get the deviate in one step. Does the table need to start from 1? There is in each mu-row an implied Rentry of 0 at N=0. For a given (assumedly fairly large) mu, it is not essential that the first Rentry in the table be 1. If r is less than that first Rentry, and the Rentry corresponds to N > 1, then the direct method can be used to compute the proper value. -- How big should the table be -- The penalty for the table not going far enough out in N for a given mu is that with some frequency r will exceed the last Rentry. Even in those cases, as long as the correct N is not very far from the end of the table, extending by the direct series is not a very serious matter. If a row of the table is to start from M > 1, the penalty is proportial to the miss frequency, times roughly M iterations of the direct series. Thus a miss by a little in this case is as bad as a miss by a lot. Thus, the table (for any given mu) ought to extend at least 2 sigma on either side of mu. So for mu = 100, you would want to go at least from 80-120. For large mu, it is more imprtant to provide coverage on the lower side, since the cost of a miss will be much bigger. For instance, at 2 sigma with mu=100, we can expect about 80 iterations of the series about 2.5% of the time, which adds .6 r-units just for the *low-miss* cases. On the high-end, the equivalent cost is about 15 times less. So 70-120 would make sense for mu = 100. We make the table 51 numbers wide. The penalty for making the spacing between mu values, S, too large is that mu is about S/2 when computing N2. My feeling is that a mu gap of 5 would be sensible, and that we could push that to 10 without serious regret. -- The size and shape of the table -- The tradeoffs can be expressed in terms of expected series iteration count: * Increasing S by a unit costs .5 iterations * Decreasing the first Rentry in one of the large mu rows 2 sigma to 2.5 sigma --> 1.3 iterations 2.5 sigma to 3 sigma --> .4 iterations 3.5 sigma to 4 sigma --> .1 iterations * Increasing the last Rentry in one of the large mu rows 2 sigma to 2.5 sigma --> .1 iterations There is some advantage in keeping the table rectangular. Since sigma goes as sqrt(mu), splitting off the lower mu values for less R entries would not gain much (perhaps 15% for a single split into two rectangular tables). We thus keep the table ractangular. Varying the starting N for each row lets us avoid a factor of Nmax/(Nmax-Nmin) which will turn out to be a factor of 2 or so; this is worthwhile since it costs almost no extra time. So the table is thus 20 by 51 doubles. -- Precomputing for default mu -- For the default mu, fire() can use precomputed N values. The trick is to prepare a table of N vs 100 r, along with =the r at which you go to the next N= and the series term at that point. This saves, fundamentally, the time needed to search for N, plus the time needed to do the N2 calculation (which includes an exp()). #endif clhep-2.1.4.1.orig/Random/src/RandGeneral.cc0000755000175000017500000002250411406204345017102 0ustar olesoles// $Id: RandGeneral.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGeneral --- // class implementation file // ----------------------------------------------------------------------- // ======================================================================= // S.Magni & G.Pieri - Created: 5th September 1995 // G.Cosmo - Added constructor using default engine from the // static generator. Simplified shoot() and // shootArray() (not needed in principle!): 20th Aug 1998 // M.G.Pia & G.Cosmo - Fixed bug in computation of theIntegralPdf in // two constructors: 5th Jan 1999 // S.Magni & G.Pieri - Added linear interpolation: 24th Mar 1999 // M. Fischler - General cleanup: 14th May 1999 // + Eliminated constructor code replication by factoring // common code into prepareTable. // + Eliminated fire/shoot code replication by factoring // out common code into mapRandom. // + A couple of methods are moved inline to avoid a // speed cost for factoring out mapRandom: fire() // and shoot(anEngine). // + Inserted checks for negative weight and zero total // weight in the bins. // + Modified the binary search loop to avoid incorrect // behavior when rand is example on a boundary. // + Moved the check of InterpolationType up into // the constructor. A type other than 0 or 1 // will give the interpolated distribution (instead of // a distribution that always returns 0). // + Modified the computation of the returned value // to use algeraic simplification to improve speed. // Eliminated two of the three divisionns, made // use of the fact that nabove-nbelow is always 1, etc. // + Inserted a check for rand hitting the boundary of a // zero-width bin, to avoid dividing 0/0. // M. Fischler - Minor correction in assert 31 July 2001 // + changed from assert (above = below+1) to == // M Fischler - put and get to/from streams 12/15/04 // + Modifications to use a vector as theIntegraPdf // M Fischler - put/get to/from streams uses pairs of ulongs when // + storing doubles avoid problems with precision // 4/14/05 // // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandGeneral.h" #include "CLHEP/Random/DoubConv.hh" #include namespace CLHEP { std::string RandGeneral::name() const {return "RandGeneral";} HepRandomEngine & RandGeneral::engine() {return *localEngine;} ////////////////// // Constructors ////////////////// RandGeneral::RandGeneral( const double* aProbFunc, int theProbSize, int IntType ) : HepRandom(), localEngine(HepRandom::getTheEngine(), do_nothing_deleter()), nBins(theProbSize), InterpolationType(IntType) { prepareTable(aProbFunc); } RandGeneral::RandGeneral(HepRandomEngine& anEngine, const double* aProbFunc, int theProbSize, int IntType ) : HepRandom(), localEngine(&anEngine, do_nothing_deleter()), nBins(theProbSize), InterpolationType(IntType) { prepareTable(aProbFunc); } RandGeneral::RandGeneral(HepRandomEngine* anEngine, const double* aProbFunc, int theProbSize, int IntType ) : HepRandom(), localEngine(anEngine), nBins(theProbSize), InterpolationType(IntType) { prepareTable(aProbFunc); } void RandGeneral::prepareTable(const double* aProbFunc) { // // Private method called only by constructors. Prepares theIntegralPdf. // if (nBins < 1) { std::cerr << "RandGeneral constructed with no bins - will use flat distribution\n"; useFlatDistribution(); return; } theIntegralPdf.resize(nBins+1); theIntegralPdf[0] = 0; register int ptn; register double weight; for ( ptn = 0; ptn rand int middle; while (nabove > nbelow+1) { middle = (nabove + nbelow+1)>>1; if (rand >= theIntegralPdf[middle]) { nbelow = middle; } else { nabove = middle; } } // after this loop, nabove is always nbelow+1 and they straddle rad: assert ( nabove == nbelow+1 ); assert ( theIntegralPdf[nbelow] <= rand ); assert ( theIntegralPdf[nabove] >= rand ); // If a defective engine produces rand=1, that will // still give sensible results so we relax the > rand assertion if ( InterpolationType == 1 ) { return nbelow * oneOverNbins; } else { double binMeasure = theIntegralPdf[nabove] - theIntegralPdf[nbelow]; // binMeasure is always aProbFunc[nbelow], // but we don't have aProbFunc any more so we subtract. if ( binMeasure == 0 ) { // rand lies right in a bin of measure 0. Simply return the center // of the range of that bin. (Any value between k/N and (k+1)/N is // equally good, in this rare case.) return (nbelow + .5) * oneOverNbins; } double binFraction = (rand - theIntegralPdf[nbelow]) / binMeasure; return (nbelow + binFraction) * oneOverNbins; } } // mapRandom(rand) void RandGeneral::shootArray( HepRandomEngine* anEngine, const int size, double* vect ) { register int i; for (i=0; i t(2); os << " " << name() << "\n"; os << "Uvec" << "\n"; os << nBins << " " << oneOverNbins << " " << InterpolationType << "\n"; t = DoubConv::dto2longs(oneOverNbins); os << t[0] << " " << t[1] << "\n"; assert (static_cast(theIntegralPdf.size())==nBins+1); for (unsigned int i=0; i(theIntegralPdf.size())==nBins+1); for (unsigned int i=0; i> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } if (possibleKeywordInput(is, "Uvec", nBins)) { std::vector t(2); is >> nBins >> oneOverNbins >> InterpolationType; is >> t[0] >> t[1]; oneOverNbins = DoubConv::longs2double(t); theIntegralPdf.resize(nBins+1); for (unsigned int i=0; i> theIntegralPdf[i] >> t[0] >> t[1]; theIntegralPdf[i] = DoubConv::longs2double(t); } return is; } // is >> nBins encompassed by possibleKeywordInput is >> oneOverNbins >> InterpolationType; theIntegralPdf.resize(nBins+1); for (unsigned int i=0; i> theIntegralPdf[i]; return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/Makefile.am0000755000175000017500000000460612221102474016444 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir) -I$(top_srcdir) libCLHEP_Random_@VERSION@_a_SOURCES = \ DoubConv.cc \ DRand48Engine.cc \ DualRand.cc \ EngineFactory.cc \ engineIDulong.cc \ erfQ.cc \ flatToGaussian.cc \ gammln.cc \ Hurd160Engine.cc \ Hurd288Engine.cc \ JamesRandom.cc \ MTwistEngine.cc \ NonRandomEngine.cc \ RandBinomial.cc \ RandBit.cc \ RandBreitWigner.cc \ RandChiSquare.cc \ RandEngine.cc \ RandExponential.cc \ RandExpZiggurat.cc \ RandFlat.cc \ RandGamma.cc \ RandGauss.cc \ RandGaussQ.cc \ RandGaussT.cc \ RandGaussZiggurat.cc \ RandGeneral.cc \ RandLandau.cc \ Random.cc \ RandomEngine.cc \ RandPoisson.cc \ RandPoissonQ.cc \ RandPoissonT.cc \ RandSkewNormal.cc \ RandStudentT.cc \ RanecuEngine.cc \ Ranlux64Engine.cc \ RanluxEngine.cc \ RanshiEngine.cc \ StaticRandomStates.cc \ TripleRand.cc libCLHEP_Random_@VERSION@_so_OBJECTS = $(patsubst %.cc,$(shareddir)/%.$(OBJEXT),$(libCLHEP_Random_@VERSION@_a_SOURCES)) # these if/else blocks will be parsed by automake and translated if BUILD_SHARED shareddir = shared if BUILD_VISUAL lib_shared = CLHEP-Random-@VERSION@.$(SHEXT) else lib_shared = libCLHEP-Random-@VERSION@.$(SHEXT) endif SHFLAGS = @MY_SHFLAGS@ SHLINK = @MY_SHLINK@ @MY_SHEXTRA@ SHNAME = @MY_SHNAME@ endif if BUILD_STATIC lib_LIBRARIES = libCLHEP-Random-@VERSION@.a endif CLEANFILES = $(lib_shared) all-local: $(shareddir) $(lib_shared) $(shareddir): test -d $(shareddir) || mkdir $(shareddir) if BUILD_VISUAL $(lib_shared): $(libCLHEP_Random_@VERSION@_so_OBJECTS) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Random_@VERSION@_so_OBJECTS) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) /c /Fo$@ $< else $(lib_shared): $(libCLHEP_Random_@VERSION@_so_OBJECTS) $(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Random_@VERSION@_so_OBJECTS) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) -c -o $@ $< endif install-exec-local: $(lib_shared) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_shared)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$p'"; \ $(INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done clean-local: -test -d $(shareddir) && rm -f $(shareddir)/*.$(OBJEXT) distclean-local: -test -d $(shareddir) && rm -rf ./$(shareddir) clhep-2.1.4.1.orig/Random/src/DRand48Engine.cc0000755000175000017500000002407611753236267017235 0ustar olesoles// -*- C++ -*- // $Id: DRand48Engine.cc,v 1.7 2010/07/29 16:50:34 garren Exp $ // ----------------------------------------------------------------------- // HEP Random // --- DRand48Engine --- // class implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // G.Cosmo - Created: 5th September 1995 // - Minor corrections: 31st October 1996 // - Added methods for engine status: 19th November 1996 // - Added srand48(), seed48(), drand48() implementations // for Windows/NT: 6th March 1997 // - Fixed bug in setSeeds(): 15th September 1997 // - Private copy constructor and operator=: 26th Feb 1998 // J.Marraffino - Added stream operators and related constructor. // Added automatic seed selection from seed table and // engine counter: 16th Feb 1998 // J.Marraffino - Remove dependence on hepString class 13 May 1999 // E.Tcherniaev - More accurate code for drand48() on NT base on // a code extracted from GNU C Library 2.1.3: 8th Nov 2000 // M. Fischler - In restore, checkFile for file not found 03 Dec 2004 // M. Fischler - Methods for distrib. instacne save/restore 12/8/04 // M. Fischler - split get() into tag validation and // getState() for anonymous restores 12/27/04 // M. Fischler - put/get for vectors of ulongs 3/8/05 // M. Fischler - State-saving using only ints, for portability 4/12/05 // // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Random/DRand48Engine.h" #include "CLHEP/Random/RandomFunc.h" #include "CLHEP/Random/engineIDulong.h" #include // for strcmp #include // for std::abs(int) //#define TRACE_IO namespace CLHEP { static const int MarkerLen = 64; // Enough room to hold a begin or end marker. // Number of instances with automatic seed selection int DRand48Engine::numEngines = 0; std::string DRand48Engine::name() const {return "DRand48Engine";} // Maximum index into the seed table int DRand48Engine::maxIndex = 215; DRand48Engine::DRand48Engine(long seed) : HepRandomEngine() { setSeed(seed,0); setSeeds(&theSeed,0); } DRand48Engine::DRand48Engine() : HepRandomEngine() { long seeds[2]; long seed; int cycle = abs(int(numEngines/maxIndex)); int curIndex = abs(int(numEngines%maxIndex)); ++numEngines; long mask = ((cycle & 0x007fffff) << 8); HepRandom::getTheTableSeeds( seeds, curIndex ); seed = seeds[0]^mask; setSeed(seed,0); setSeeds(&theSeed,0); } DRand48Engine::DRand48Engine(int rowIndex, int colIndex) : HepRandomEngine() { long seed; long seeds[2]; int cycle = abs(int(rowIndex/maxIndex)); int row = abs(int(rowIndex%maxIndex)); int col = abs(int(colIndex%2)); long mask = ((cycle & 0x000007ff) << 20); HepRandom::getTheTableSeeds( seeds, row ); seed = (seeds[col])^mask; setSeed(seed,0); setSeeds(&theSeed,0); } DRand48Engine::DRand48Engine(std::istream& is) : HepRandomEngine() { is >> *this; } DRand48Engine::~DRand48Engine() {} void DRand48Engine::setSeed(long seed, int) { srand48( seed ); theSeed = seed; } void DRand48Engine::setSeeds(const long* seeds, int) { setSeed(seeds ? *seeds : 19780503L, 0); theSeeds = seeds; } void DRand48Engine::saveStatus( const char filename[] ) const { std::ofstream outFile( filename, std::ios::out ) ; if (!outFile.bad()) { outFile << "Uvec\n"; std::vector v = put(); #ifdef TRACE_IO std::cout << "Result of v = put() is:\n"; #endif for (unsigned int i=0; i v; unsigned long xin; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { inFile >> xin; #ifdef TRACE_IO std::cout << "ivec = " << ivec << " xin = " << xin << " "; if (ivec%3 == 0) std::cout << "\n"; #endif if (!inFile) { inFile.clear(std::ios::badbit | inFile.rdstate()); std::cerr << "\nDRand48Engine state (vector) description improper." << "\nrestoreStatus has failed." << "\nInput stream is probably mispositioned now." << std::endl; return; } v.push_back(xin); } getState(v); return; } if (!inFile.bad() && !inFile.eof()) { inFile >> theSeed; for (int i=0; i<3; ++i) // inFile >> theSeed; removed -- encompased by possibleKeywordInput seed48(cseed); } } void DRand48Engine::showStatus() const { unsigned short dummy[] = { 0, 0, 0 }; unsigned short* cseed = seed48(dummy); std::cout << std::endl; std::cout << "-------- DRand48 engine status ---------" << std::endl; std::cout << " Initial seed = " << theSeed << std::endl; std::cout << " Current seeds = " << cseed[0] << ", "; std::cout << cseed[1] << ", "; std::cout << cseed[2] << std::endl; std::cout << "----------------------------------------" << std::endl; for (int i=0; i<3; ++i) dummy[i] = cseed[i]; seed48(dummy); } double DRand48Engine::flat() { double num = 0.; while (num == 0.) num = drand48(); return num; } void DRand48Engine::flatArray(const int size, double* vect) { int i; for (i=0; i v = put(); for (unsigned int i=0; i DRand48Engine::put () const { std::vector v; v.push_back (engineIDulong()); unsigned short dummy[] = { 0, 0, 0 }; unsigned short* cseed = seed48(dummy); for (int i=0; i<3; ++i) { dummy[i] = cseed[i]; v.push_back (static_cast(cseed[i])); } seed48(dummy); return v; } std::istream & DRand48Engine::get ( std::istream& is ) { char beginMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"DRand48Engine-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput stream mispositioned or" << "\nDRand48Engine state description missing or" << "\nwrong engine type found." << std::endl; return is; } return getState(is); } std::string DRand48Engine::beginTag ( ) { return "DRand48Engine-begin"; } std::istream & DRand48Engine::getState ( std::istream& is ) { unsigned short cseed[3]; if ( possibleKeywordInput ( is, "Uvec", cseed[0] ) ) { std::vector v; unsigned long uu; #ifdef TRACE_IO std::cout << "DRand48Engine::getState detected Uvec keyword\n"; uu = 999999; #endif for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { uu = 999999; is >> uu; #ifdef TRACE_IO std::cout << "ivec = " << ivec << " uu = " << uu << "\n"; #endif if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nDRand48Engine state (vector) description improper." << "\ngetState() has failed." << "\nInput stream is probably mispositioned now." << std::endl; return is; } v.push_back(uu); } getState(v); return (is); } // is >> cseed[0] was removed from loop, encompassed by possibleKeywordInput() char endMarker [MarkerLen]; is >> theSeed; for (int i=1; i<3; ++i) { is >> cseed[i]; } is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"DRand48Engine-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nDRand48Engine state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; return is; } seed48(cseed); return is; } bool DRand48Engine::get (const std::vector & v) { if ((v[0] & 0xffffffffUL) != engineIDulong()) { std::cerr << "\nDRand48Engine get:state vector has wrong ID word - state unchanged\n"; return false; } return getState(v); } bool DRand48Engine::getState (const std::vector & v) { if (v.size() != VECTOR_STATE_SIZE ) { std::cerr << "\nDRand48Engine getState:state vector has wrong length - state unchanged\n"; return false; } unsigned short cseed[3]; for (int i=0; i<3; ++i) { cseed[i] = static_cast(v[i+1]); } seed48(cseed); return true; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandPoissonT.cc0000755000175000017500000000731411406204345017305 0ustar olesoles// $Id: RandPoissonT.cc,v 1.7 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandPoissonT --- // class implementation file // ----------------------------------------------------------------------- // ======================================================================= // M. Fischler - Implemented new, much faster table-driven algorithm // applicable for mu < 100 (Nov 1999), using these as // implementation of RandPoisson. // M. Fischler - Moved the table driven algorithms into RandPoissonT (here) // 1/26/00. // M. Fischler - Removed mean=100 from the table-driven set, since it // uses a value just off the end of the table. (April 2004) // M Fischler - put and get to/from streams 12/15/04 // M Fischler - fireArray using defaultMean 2/10/05 // M Fischler - put/get to/from streams uses pairs of ulongs when // + storing doubles avoid problems with precision // -- appears not to need modification, relying on // RandPoisson::put() instead 4/14/05 // // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandPoissonT.h" #include "CLHEP/Random/RandPoissonQ.h" #include "CLHEP/Random/DoubConv.hh" // // Constructors and destructors: // namespace CLHEP { std::string RandPoissonT::name() const {return "RandPoissonT";} HepRandomEngine & RandPoissonT::engine() {return RandPoisson::engine();} RandPoissonT::RandPoissonT(HepRandomEngine & anEngine, double m ) : RandPoisson(anEngine, m) {} RandPoissonT::RandPoissonT(HepRandomEngine * anEngine, double m ) : RandPoisson(anEngine, m) {} RandPoissonT::~RandPoissonT() { } // // fire, operator(), and shoot methods: // long RandPoissonT::shoot(double xm) { HepRandomEngine* e = HepRandom::getTheEngine(); return shoot ( e, xm ); } // shoot() double RandPoissonT::operator()() { return double( fire() ); } double RandPoissonT::operator()( double mean ) { return double( fire( mean ) ); } long RandPoissonT::fire(double mean) { return shoot (getLocalEngine(), mean); } long RandPoissonT::fire() { if ( defaultMean < RandPoissonQ::tableBoundary() ) { return RandPoissonQ::shoot ( getLocalEngine(), defaultMean ); } else { return RandPoisson::shoot(getLocalEngine(), defaultMean); } } // fire() long RandPoissonT::shoot(HepRandomEngine* anEngine, double mean) { if ( mean < RandPoissonQ::tableBoundary() ) { return RandPoissonQ::shoot ( anEngine, mean ); } else { return RandPoisson::shoot( anEngine, mean ); } } // shoot (anEngine, mean) void RandPoissonT::shootArray(const int size, long* vect, double m) { int i; for (i=0; i> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } RandPoisson::get(is); return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/NonRandomEngine.cc0000755000175000017500000001744511406204345017751 0ustar olesoles// $Id: NonRandomEngine.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // Hep Random // --- NonRandomEngine --- // class implementation file // ----------------------------------------------------------------------- // M. Fischler - Created 9/30/99 // // M. Fischler - Modifications to capture sequence as a vector, which // are needed to retain sanity when put and get are involved. // Mark Fischler - Methods for distrib. instance save/restore 12/8/04 // M. Fischler - Initialization of all state data (even those parts unused) // - at ctor time, to thwart a VC++ i/o bug. // M. Fischler - put/get for vectors of ulongs 3/15/05 // M. Fischler - State-saving using only ints, for portability 4/12/05 // //========================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/NonRandomEngine.h" #include "CLHEP/Random/engineIDulong.h" #include "CLHEP/Random/DoubConv.hh" #include #include #include #include //#define TRACE_IO namespace CLHEP { std::string NonRandomEngine::name() const {return "NonRandomEngine";} NonRandomEngine::NonRandomEngine() : nextHasBeenSet(false), sequenceHasBeenSet(false), intervalHasBeenSet(false) , nextRandom(0.05), nInSeq(0), randomInterval(0.1) { } NonRandomEngine::~NonRandomEngine() { } void NonRandomEngine::setNextRandom(double r) { nextRandom = r; nextHasBeenSet=true; return; } void NonRandomEngine::setRandomSequence(double* s, int n) { sequence.clear(); for (int i=0; i= sequence.size() ) sequenceHasBeenSet = false; return v; } if ( !nextHasBeenSet ) { std::cout << "Attempt to use NonRandomEngine without setting next random!\n"; exit(1); } double a = nextRandom; nextHasBeenSet = false; if (intervalHasBeenSet) { nextRandom += randomInterval; if ( nextRandom >= 1 ) nextRandom -= 1.0; nextHasBeenSet = true; } return a; } void NonRandomEngine::flatArray(const int size, double* vect) { for (int i = 0; i < size; ++i) { vect[i] = flat(); } } std::ostream & NonRandomEngine::put (std::ostream & os) const { std::string beginMarker = "NonRandomEngine-begin"; os << beginMarker << "\nUvec\n"; std::vector v = put(); for (unsigned int i=0; i NonRandomEngine::put () const { std::vector v; v.push_back (engineIDulong()); std::vector t; v.push_back(static_cast(nextHasBeenSet)); v.push_back(static_cast(sequenceHasBeenSet)); v.push_back(static_cast(intervalHasBeenSet)); t = DoubConv::dto2longs(nextRandom); v.push_back(t[0]); v.push_back(t[1]); v.push_back(static_cast(nInSeq)); t = DoubConv::dto2longs(randomInterval); v.push_back(t[0]); v.push_back(t[1]); v.push_back(static_cast(sequence.size())); for (unsigned int i=0; i> beginMarker; if (beginMarker != "NonRandomEngine-begin") { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput mispositioned or" << "\nNonRandomEngine state description missing or" << "\nwrong engine type found.\n"; return is; } return getState(is); } std::string NonRandomEngine::beginTag ( ) { return "NonRandomEngine-begin"; } std::istream & NonRandomEngine::getState (std::istream & is) { if ( possibleKeywordInput ( is, "Uvec", nextHasBeenSet ) ) { std::vector v; unsigned long uu = 99999; unsigned long ssiz = 0; //std::string temporary; //is >> temporary; //std::cout << "*** " << temporary << "\n"; for (unsigned int istart=0; istart < 10; ++istart) { is >> uu; if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cout << "istart = " << istart << "\n"; std::cerr << "\nNonRandomEngine state (vector) description has no sequence size." << "\ngetState() has failed." << "\nInput stream is probably mispositioned now." << std::endl; return is; } v.push_back(uu); #ifdef TRACE_IO std::cout << "v[" << istart << "] = " << uu << "\n"; #endif if (istart==9) ssiz = uu; } for (unsigned int ivec=0; ivec < 2*ssiz; ++ivec) { is >> uu; if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nNonRandomEngine state (vector) description improper." << "\ngetState() has failed." << "\nInput stream is probably mispositioned now." << std::endl; return is; } v.push_back(uu); #ifdef TRACE_IO std::cout << "v[" << v.size()-1 << "] = " << uu << "\n"; #endif } getState(v); return (is); } // is >> nextHasBeenSet; Removed, encompassed by possibleKeywordInput() std::string endMarker = "NonRandomEngine-end"; is >> sequenceHasBeenSet >> intervalHasBeenSet; is >> nextRandom >> nInSeq >> randomInterval; unsigned int seqSize; is >> seqSize; sequence.clear(); double x; for (unsigned int i = 0; i < seqSize; ++i) { is >> x; sequence.push_back(x); } is >> endMarker; if (endMarker != "NonRandomEngine-end") { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\n NonRandomEngine state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; return is; } return is; } bool NonRandomEngine::get (const std::vector & v) { if ((v[0] & 0xffffffffUL) != engineIDulong()) { std::cerr << "\nNonRandomEngine get:state vector has wrong ID word - state unchanged\n"; return false; } return getState(v); } bool NonRandomEngine::getState (const std::vector & v) { unsigned int seqSize = v[9]; if (v.size() != 2*seqSize + 10 ) { std::cerr << "\nNonRandomEngine get:state vector has wrong length - state unchanged\n"; std::cerr << " (length = " << v.size() << "; expected " << 2*seqSize + 10 << ")\n"; return false; } std::vector t(2); nextHasBeenSet = (v[1]!=0); sequenceHasBeenSet = (v[2]!=0); intervalHasBeenSet = (v[3]!=0); t[0] = v[4]; t[1] = v[5]; nextRandom = DoubConv::longs2double(t); nInSeq = v[6]; t[0] = v[7]; t[1] = v[8]; randomInterval = DoubConv::longs2double(t); sequence.clear(); for (unsigned int i=0; i namespace CLHEP { double HepStat::gammln(double xx) { // Returns the value ln(Gamma(xx) for xx > 0. Full accuracy is obtained for // xx > 1. For 0 < xx < 1. the reflection formula (6.1.4) can be used first. // (Adapted from Numerical Recipes in C. Relative to that routine, this // subtracts one from x at the very start, and in exchange does not have to // divide ser by x at the end. The results are formally equal, and practically // indistinguishable.) static double cof[6] = {76.18009172947146,-86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5}; int j; double x = xx - 1.0; double tmp = x + 5.5; tmp -= (x + 0.5) * std::log(tmp); double ser = 1.000000000190015; for ( j = 0; j <= 5; j++ ) { x += 1.0; ser += cof[j]/x; } return -tmp + std::log(2.5066282746310005*ser); } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/Ranlux64Engine.cc0000755000175000017500000005276711761764734017530 0ustar olesoles// $Id: Ranlux64Engine.cc,v 1.7 2010/10/21 21:32:02 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- Ranlux64Engine --- // class implementation file // ----------------------------------------------------------------------- // A double-precision implementation of the RanluxEngine generator as // decsribed by the notes of the original ranlux author (Martin Luscher) // // See the note by Martin Luscher, December 1997, entitiled // Double-precision implementation of the random number generator ranlux // // ======================================================================= // Ken Smith - Initial draft: 14th Jul 1998 // - Removed std::pow() from flat method 14th Jul 1998 // - Added conversion operators: 6th Aug 1998 // // Mark Fischler The following were modified mostly to make the routine // exactly match the Luscher algorithm in generating 48-bit // randoms: // 9/9/98 - Substantial changes in what used to be flat() to match // algorithm in Luscher's ranlxd.c // - Added update() method for 12 numbers, making flat() trivial // - Added advance() method to hold the unrolled loop for update // - Distinction between three forms of seeding such that it // is impossible to get same sequence from different forms - // done by discarding some fraction of one macro cycle which // is different for the three cases // - Change the misnomer "seed_table" to the more accurate // "randoms" // - Removed the no longer needed count12, i_lag, j_lag, etc. // - Corrected seed procedure which had been filling bits past // 2^-48. This actually was very bad, invalidating the // number theory behind the proof that ranlxd is good. // - Addition of 2**(-49) to generated number to prevent zero // from being returned; this does not affect the sequence // itself. // - Corrected ecu seeding, which had been supplying only // numbers less than 1/2. This is probably moot. // 9/15/98 - Modified use of the various exponents of 2 // to avoid per-instance space overhead. Note that these // are initialized in setSeed, which EVERY constructor // must invoke. // J. Marraffino - Remove dependence on hepString class 13 May 1999 // M. Fischler - In restore, checkFile for file not found 03 Dec 2004 // M. Fischler - put get Methods for distrib instance save/restore 12/8/04 // M. Fischler - split get() into tag validation and // getState() for anonymous restores 12/27/04 // M. Fischler - put/get for vectors of ulongs 3/14/05 // M. Fischler - State-saving using only ints, for portability 4/12/05 // // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Random/Ranlux64Engine.h" #include "CLHEP/Random/engineIDulong.h" #include "CLHEP/Random/DoubConv.hh" #include // for strcmp #include // for std::abs(int) #include // for numeric_limits namespace CLHEP { static const int MarkerLen = 64; // Enough room to hold a begin or end marker. // Number of instances with automatic seed selection int Ranlux64Engine::numEngines = 0; // Maximum index into the seed table int Ranlux64Engine::maxIndex = 215; #ifndef USING_VISUAL namespace detail { template< std::size_t n, bool = n < std::size_t(std::numeric_limits::digits) > struct do_right_shift; template< std::size_t n > struct do_right_shift { unsigned long operator()(unsigned long value) { return value >> n; } }; template< std::size_t n > struct do_right_shift { unsigned long operator()(unsigned long) { return 0ul; } }; template< std::size_t nbits > unsigned long rshift( unsigned long value ) { return do_right_shift()(value); } } // namespace detail #endif std::string Ranlux64Engine::name() const {return "Ranlux64Engine";} Ranlux64Engine::Ranlux64Engine() : HepRandomEngine() { luxury = 1; int cycle = std::abs(int(numEngines/maxIndex)); int curIndex = std::abs(int(numEngines%maxIndex)); numEngines +=1; long mask = ((cycle & 0x007fffff) << 8); long seedlist[2]; HepRandom::getTheTableSeeds( seedlist, curIndex ); seedlist[0] ^= mask; seedlist[1] = 0; setSeeds(seedlist, luxury); advance ( 8 ); // Discard some iterations and ensure that // this sequence won't match one where seeds // were provided. } Ranlux64Engine::Ranlux64Engine(long seed, int lux) : HepRandomEngine() { luxury = lux; long seedlist[2]={seed,0}; setSeeds(seedlist, lux); advance ( 2*lux + 1 ); // Discard some iterations to use a different // point in the sequence. } Ranlux64Engine::Ranlux64Engine(int rowIndex, int, int lux) : HepRandomEngine() { luxury = lux; int cycle = std::abs(int(rowIndex/maxIndex)); int row = std::abs(int(rowIndex%maxIndex)); long mask = (( cycle & 0x000007ff ) << 20 ); long seedlist[2]; HepRandom::getTheTableSeeds( seedlist, row ); seedlist[0] ^= mask; seedlist[1]= 0; setSeeds(seedlist, lux); } Ranlux64Engine::Ranlux64Engine( std::istream& is ) : HepRandomEngine() { is >> *this; } Ranlux64Engine::~Ranlux64Engine() {} double Ranlux64Engine::flat() { // Luscher improves the speed by computing several numbers in a shot, // in a manner similar to that of the Tausworth in DualRand or the Hurd // engines. Thus, the real work is done in update(). Here we merely ensure // that zero, which the algorithm can produce, is never returned by flat(). if (index <= 0) update(); return randoms[--index] + twoToMinus_49(); } void Ranlux64Engine::update() { // Update the stash of twelve random numbers. // When this routione is entered, index is always 0. The randoms // contains the last 12 numbers in the sequents: s[0] is x[a+11], // s[1] is x[a+10] ... and s[11] is x[a] for some a. Carry contains // the last carry value (c[a+11]). // // The recursion relation (3) in Luscher's note says // delta[n] = x[n-s] = x[n-r] -c[n-1] or for n=a+12, // delta[a+12] = x[a+7] - x[a] -c[a+11] where we use r=12, s=5 per eqn. (7) // This reduces to // s[11] = s[4] - s[11] - carry. // The next number similarly will be given by s[10] = s[3] - s[10] - carry, // and so forth until s[0] is filled. // // However, we need to skip 397, 202 or 109 numbers - these are not divisible // by 12 - to "fare well in the spectral test". advance(pDozens); // Since we wish at the end to have the 12 last numbers in the order of // s[11] first, till s[0] last, we will have to do 1, 10, or 1 iterations // and then re-arrange to place to get the oldest one in s[11]. // Generically, this will imply re-arranging the s array at the end, // but we can treat the special case of endIters = 1 separately for superior // efficiency in the cases of levels 0 and 2. register double y1; if ( endIters == 1 ) { // Luxury levels 0 and 2 will go here y1 = randoms[ 4] - randoms[11] - carry; if ( y1 < 0.0 ) { y1 += 1.0; carry = twoToMinus_48(); } else { carry = 0.0; } randoms[11] = randoms[10]; randoms[10] = randoms[ 9]; randoms[ 9] = randoms[ 8]; randoms[ 8] = randoms[ 7]; randoms[ 7] = randoms[ 6]; randoms[ 6] = randoms[ 5]; randoms[ 5] = randoms[ 4]; randoms[ 4] = randoms[ 3]; randoms[ 3] = randoms[ 2]; randoms[ 2] = randoms[ 1]; randoms[ 1] = randoms[ 0]; randoms[ 0] = y1; } else { int m, nr, ns; for ( m = 0, nr = 11, ns = 4; m < endIters; ++m, --nr ) { y1 = randoms [ns] - randoms[nr] - carry; if ( y1 < 0.0 ) { y1 += 1.0; carry = twoToMinus_48(); } else { carry = 0.0; } randoms[nr] = y1; --ns; if ( ns < 0 ) { ns = 11; } } // loop on m double temp[12]; for (m=0; m<12; m++) { temp[m]=randoms[m]; } ns = 11 - endIters; for (m=11; m>=0; --m) { randoms[m] = temp[ns]; --ns; if ( ns < 0 ) { ns = 11; } } } // Now when we return, there are 12 fresh usable numbers in s[11] ... s[0] index = 11; } // update() void Ranlux64Engine::advance(int dozens) { register double y1, y2, y3; register double cValue = twoToMinus_48(); register double zero = 0.0; register double one = 1.0; // Technical note: We use Luscher's trick to only do the // carry subtraction when we really have to. Like him, we use // three registers instead of two so that we avoid sequences // like storing y1 then immediately replacing its value: // some architectures lose time when this is done. // Luscher's ranlxd.c fills the stash going // upward. We fill it downward to save a bit of time in the // flat() routine at no cost later. This means that while // Luscher's ir is jr+5, our n-r is (n-s)-5. (Note that // though ranlxd.c initializes ir and jr to 11 and 7, ir as // used is 5 more than jr because update is entered after // incrementing ir.) // // I have CAREFULLY checked that the algorithms do match // in all details. int k; for ( k = dozens; k > 0; --k ) { y1 = randoms[ 4] - randoms[11] - carry; y2 = randoms[ 3] - randoms[10]; if ( y1 < zero ) { y1 += one; y2 -= cValue; } randoms[11] = y1; y3 = randoms[ 2] - randoms[ 9]; if ( y2 < zero ) { y2 += one; y3 -= cValue; } randoms[10] = y2; y1 = randoms[ 1] - randoms[ 8]; if ( y3 < zero ) { y3 += one; y1 -= cValue; } randoms[ 9] = y3; y2 = randoms[ 0] - randoms[ 7]; if ( y1 < zero ) { y1 += one; y2 -= cValue; } randoms[ 8] = y1; y3 = randoms[11] - randoms[ 6]; if ( y2 < zero ) { y2 += one; y3 -= cValue; } randoms[ 7] = y2; y1 = randoms[10] - randoms[ 5]; if ( y3 < zero ) { y3 += one; y1 -= cValue; } randoms[ 6] = y3; y2 = randoms[ 9] - randoms[ 4]; if ( y1 < zero ) { y1 += one; y2 -= cValue; } randoms[ 5] = y1; y3 = randoms[ 8] - randoms[ 3]; if ( y2 < zero ) { y2 += one; y3 -= cValue; } randoms[ 4] = y2; y1 = randoms[ 7] - randoms[ 2]; if ( y3 < zero ) { y3 += one; y1 -= cValue; } randoms[ 3] = y3; y2 = randoms[ 6] - randoms[ 1]; if ( y1 < zero ) { y1 += one; y2 -= cValue; } randoms[ 2] = y1; y3 = randoms[ 5] - randoms[ 0]; if ( y2 < zero ) { y2 += one; y3 -= cValue; } randoms[ 1] = y2; if ( y3 < zero ) { y3 += one; carry = cValue; } randoms[ 0] = y3; } // End of major k loop doing 12 numbers at each cycle } // advance(dozens) void Ranlux64Engine::flatArray(const int size, double* vect) { for( int i=0; i < size; ++i ) { vect[i] = flat(); } } void Ranlux64Engine::setSeed(long seed, int lux) { // The initialization is carried out using a Multiplicative // Congruential generator using formula constants of L'Ecuyer // as described in "A review of pseudorandom number generators" // (Fred James) published in Computer Physics Communications 60 (1990) // pages 329-344 const int ecuyer_a(53668); const int ecuyer_b(40014); const int ecuyer_c(12211); const int ecuyer_d(2147483563); const int lux_levels[3] = {109, 202, 397}; theSeed = seed; if( (lux > 2)||(lux < 0) ){ pDiscard = (lux >= 12) ? (lux-12) : lux_levels[1]; }else{ pDiscard = lux_levels[luxury]; } pDozens = pDiscard / 12; endIters = pDiscard % 12; long init_table[24]; long next_seed = seed; long k_multiple; int i; next_seed &= 0xffffffff; while( next_seed >= ecuyer_d ) { next_seed -= ecuyer_d; } for(i = 0;i != 24;i++){ k_multiple = next_seed / ecuyer_a; next_seed = ecuyer_b * (next_seed - k_multiple * ecuyer_a) - k_multiple * ecuyer_c; if(next_seed < 0) { next_seed += ecuyer_d; } next_seed &= 0xffffffff; init_table[i] = next_seed; } // are we on a 64bit machine? if( sizeof(long) >= 8 ) { long topbits1, topbits2; #ifdef USING_VISUAL topbits1 = ( seed >> 32) & 0xffff ; topbits2 = ( seed >> 48) & 0xffff ; #else topbits1 = detail::rshift<32>(seed) & 0xffff ; topbits2 = detail::rshift<48>(seed) & 0xffff ; #endif init_table[0] ^= topbits1; init_table[2] ^= topbits2; //std::cout << " init_table[0] " << init_table[0] << " from " << topbits1 << std::endl; //std::cout << " init_table[2] " << init_table[2] << " from " << topbits2 << std::endl; } for(i = 0;i < 12; i++){ randoms[i] = (init_table[2*i ] ) * 2.0 * twoToMinus_32() + (init_table[2*i+1] >> 15) * twoToMinus_48(); //if( randoms[i] < 0. || randoms[i] > 1. ) { //std::cout << "setSeed: init_table " << init_table[2*i ] << std::endl; //std::cout << "setSeed: init_table " << init_table[2*i+1] << std::endl; //std::cout << "setSeed: random " << i << " is " << randoms[i] << std::endl; //} } carry = 0.0; if ( randoms[11] == 0. ) carry = twoToMinus_48(); index = 11; } // setSeed() void Ranlux64Engine::setSeeds(const long * seeds, int lux) { // old code only uses the first long in seeds // setSeed( *seeds ? *seeds : 32767, lux ); // theSeeds = seeds; // using code from Ranlux - even those are 32bit seeds, // that is good enough to completely differentiate the sequences const int ecuyer_a = 53668; const int ecuyer_b = 40014; const int ecuyer_c = 12211; const int ecuyer_d = 2147483563; const int lux_levels[3] = {109, 202, 397}; const long *seedptr; theSeeds = seeds; seedptr = seeds; if(seeds == 0){ setSeed(theSeed,lux); theSeeds = &theSeed; return; } theSeed = *seeds; // number of additional random numbers that need to be 'thrown away' // every 24 numbers is set using luxury level variable. if( (lux > 2)||(lux < 0) ){ pDiscard = (lux >= 12) ? (lux-12) : lux_levels[1]; }else{ pDiscard = lux_levels[luxury]; } pDozens = pDiscard / 12; endIters = pDiscard % 12; long init_table[24]; long next_seed = *seeds; long k_multiple; int i; for( i = 0;(i != 24)&&(*seedptr != 0);i++){ init_table[i] = *seedptr & 0xffffffff; seedptr++; } if(i != 24){ next_seed = init_table[i-1]; for(;i != 24;i++){ k_multiple = next_seed / ecuyer_a; next_seed = ecuyer_b * (next_seed - k_multiple * ecuyer_a) - k_multiple * ecuyer_c; if(next_seed < 0) { next_seed += ecuyer_d; } next_seed &= 0xffffffff; init_table[i] = next_seed; } } for(i = 0;i < 12; i++){ randoms[i] = (init_table[2*i ] ) * 2.0 * twoToMinus_32() + (init_table[2*i+1] >> 15) * twoToMinus_48(); } carry = 0.0; if ( randoms[11] == 0. ) carry = twoToMinus_48(); index = 11; } void Ranlux64Engine::saveStatus( const char filename[] ) const { std::ofstream outFile( filename, std::ios::out ) ; if (!outFile.bad()) { outFile << "Uvec\n"; std::vector v = put(); #ifdef TRACE_IO std::cout << "Result of v = put() is:\n"; #endif for (unsigned int i=0; i v; unsigned long xin; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { inFile >> xin; #ifdef TRACE_IO std::cout << "ivec = " << ivec << " xin = " << xin << " "; if (ivec%3 == 0) std::cout << "\n"; #endif if (!inFile) { inFile.clear(std::ios::badbit | inFile.rdstate()); std::cerr << "\nJamesRandom state (vector) description improper." << "\nrestoreStatus has failed." << "\nInput stream is probably mispositioned now." << std::endl; return; } v.push_back(xin); } getState(v); return; } if (!inFile.bad() && !inFile.eof()) { // inFile >> theSeed; removed -- encompased by possibleKeywordInput for (int i=0; i<12; ++i) { inFile >> randoms[i]; } inFile >> carry; inFile >> index; inFile >> luxury; inFile >> pDiscard; pDozens = pDiscard / 12; endIters = pDiscard % 12; } } void Ranlux64Engine::showStatus() const { std::cout << std::endl; std::cout << "--------- Ranlux engine status ---------" << std::endl; std::cout << " Initial seed = " << theSeed << std::endl; std::cout << " randoms[] = "; for (int i=0; i<12; ++i) { std::cout << randoms[i] << std::endl; } std::cout << std::endl; std::cout << " carry = " << carry << ", index = " << index << std::endl; std::cout << " luxury = " << luxury << " pDiscard = " << pDiscard << std::endl; std::cout << "----------------------------------------" << std::endl; } std::ostream & Ranlux64Engine::put( std::ostream& os ) const { char beginMarker[] = "Ranlux64Engine-begin"; os << beginMarker << "\nUvec\n"; std::vector v = put(); for (unsigned int i=0; i Ranlux64Engine::put () const { std::vector v; v.push_back (engineIDulong()); std::vector t; for (int i=0; i<12; ++i) { t = DoubConv::dto2longs(randoms[i]); v.push_back(t[0]); v.push_back(t[1]); } t = DoubConv::dto2longs(carry); v.push_back(t[0]); v.push_back(t[1]); v.push_back(static_cast(index)); v.push_back(static_cast(luxury)); v.push_back(static_cast(pDiscard)); return v; } std::istream & Ranlux64Engine::get ( std::istream& is ) { char beginMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"Ranlux64Engine-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput stream mispositioned or" << "\nRanlux64Engine state description missing or" << "\nwrong engine type found." << std::endl; return is; } return getState(is); } std::string Ranlux64Engine::beginTag ( ) { return "Ranlux64Engine-begin"; } std::istream & Ranlux64Engine::getState ( std::istream& is ) { if ( possibleKeywordInput ( is, "Uvec", theSeed ) ) { std::vector v; unsigned long uu; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { is >> uu; if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nRanlux64Engine state (vector) description improper." << "\ngetState() has failed." << "\nInput stream is probably mispositioned now." << std::endl; return is; } v.push_back(uu); } getState(v); return (is); } // is >> theSeed; Removed, encompassed by possibleKeywordInput() char endMarker [MarkerLen]; for (int i=0; i<12; ++i) { is >> randoms[i]; } is >> carry; is >> index; is >> luxury; is >> pDiscard; pDozens = pDiscard / 12; endIters = pDiscard % 12; is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"Ranlux64Engine-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nRanlux64Engine state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; return is; } return is; } bool Ranlux64Engine::get (const std::vector & v) { if ((v[0] & 0xffffffffUL) != engineIDulong()) { std::cerr << "\nRanlux64Engine get:state vector has wrong ID word - state unchanged\n"; return false; } return getState(v); } bool Ranlux64Engine::getState (const std::vector & v) { if (v.size() != VECTOR_STATE_SIZE ) { std::cerr << "\nRanlux64Engine get:state vector has wrong length - state unchanged\n"; return false; } std::vector t(2); for (int i=0; i<12; ++i) { t[0] = v[2*i+1]; t[1] = v[2*i+2]; randoms[i] = DoubConv::longs2double(t); } t[0] = v[25]; t[1] = v[26]; carry = DoubConv::longs2double(t); index = v[27]; luxury = v[28]; pDiscard = v[29]; return true; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandPoissonQ.cc0000755000175000017500000004655111753236267017325 0ustar olesoles// $Id: RandPoissonQ.cc,v 1.7 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandPoissonQ --- // class implementation file // ----------------------------------------------------------------------- // ======================================================================= // M. Fischler - Implemented new, much faster table-driven algorithm // applicable for mu < 100 // - Implemented "quick()" methods, shich are the same as the // new methods for mu < 100 and are a skew-corrected gaussian // approximation for large mu. // M. Fischler - Removed mean=100 from the table-driven set, since it // uses a value just off the end of the table. (April 2004) // M Fischler - put and get to/from streams 12/15/04 // M Fischler - Utilize RandGaussQ rather than RandGauss, as clearly // intended by the inclusion of RandGaussQ.h. Using RandGauss // introduces a subtle trap in that the state of RandPoissonQ // can never be properly captured without also saveing the // state of RandGauss! RandGaussQ is, on the other hand, // stateless except for the engine used. // M Fisculer - Modified use of wrong engine when shoot (anEngine, mean) // is called. This flaw was preventing any hope of proper // saving and restoring in the instance cases. // M Fischler - fireArray using defaultMean 2/10/05 // M Fischler - put/get to/from streams uses pairs of ulongs when // + storing doubles avoid problems with precision // 4/14/05 // M Fisculer - Modified use of shoot (mean) instead of // shoot(getLocalEngine(), mean) when fire(mean) is called. // This flaw was causing bad "cross-talk" between modules // in CMS, where one used its own engine, and the other // used the static generator. 10/18/07 // // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandPoissonQ.h" #include "CLHEP/Random/RandGaussQ.h" #include "CLHEP/Random/DoubConv.hh" #include "CLHEP/Random/Stat.h" #include // for std::pow() namespace CLHEP { std::string RandPoissonQ::name() const {return "RandPoissonQ";} HepRandomEngine & RandPoissonQ::engine() {return RandPoisson::engine();} // Initialization of static data: Note that this is all const static data, // so that saveEngineStatus properly saves all needed information. // The following MUST MATCH the corresponding values used (in // poissonTables.cc) when poissonTables.cdat was created. const double RandPoissonQ::FIRST_MU = 10;// lowest mu value in table const double RandPoissonQ::LAST_MU = 95;// highest mu value const double RandPoissonQ::S = 5; // Spacing between mu values const int RandPoissonQ::BELOW = 30; // Starting point for N is at mu - BELOW const int RandPoissonQ::ENTRIES = 51; // Number of entries in each mu row const double RandPoissonQ::MAXIMUM_POISSON_DEVIATE = 2.0E9; // Careful -- this is NOT the maximum number that can be held in // a long. It actually should be some large number of sigma below // that. // Here comes the big (9K bytes) table, kept in a file of // ENTRIES * (FIRST_MU - LAST_MU + 1)/S doubles static const double poissonTables [ 51 * ( (95-10)/5 + 1 ) ] = { #include "poissonTables.cdat" }; // // Constructors and destructors: // RandPoissonQ::~RandPoissonQ() { } void RandPoissonQ::setupForDefaultMu() { // The following are useful for quick approximation, for large mu double sig2 = defaultMean * (.9998654 - .08346/defaultMean); sigma = std::sqrt(sig2); // sigma for the Guassian which approximates the Poisson -- naively // std::sqrt (defaultMean). // // The multiplier corrects for fact that discretization of the form // [gaussian+.5] increases the second moment by a small amount. double t = 1./(sig2); a2 = t/6 + t*t/324; a1 = std::sqrt (1-2*a2*a2*sig2); a0 = defaultMean + .5 - sig2 * a2; // The formula will be a0 + a1*x + a2*x*x where x has 2nd moment of sigma. // The coeffeicients are chosen to match the first THREE moments of the // true Poisson distribution. // // Actually, if the correction for discretization were not needed, then // a2 could be taken one order higher by adding t*t*t/5832. However, // the discretization correction is not perfect, leading to inaccuracy // on the order to 1/mu**2, so adding a third term is overkill. } // setupForDefaultMu() // // fire, quick, operator(), and shoot methods: // long RandPoissonQ::shoot(double xm) { return shoot(getTheEngine(), xm); } double RandPoissonQ::operator()() { return (double) fire(); } double RandPoissonQ::operator()( double mean ) { return (double) fire(mean); } long RandPoissonQ::fire(double mean) { return shoot(getLocalEngine(), mean); } long RandPoissonQ::fire() { if ( defaultMean < LAST_MU + S ) { return poissonDeviateSmall ( getLocalEngine(), defaultMean ); } else { return poissonDeviateQuick ( getLocalEngine(), a0, a1, a2, sigma ); } } // fire() long RandPoissonQ::shoot(HepRandomEngine* anEngine, double mean) { // The following variables, static to this method, apply to the // last time a large mean was supplied; they obviate certain calculations // if consecutive calls use the same mean. static double lastLargeMean = -1.; // Mean from previous shoot // requiring poissonDeviateQuick() static double lastA0; static double lastA1; static double lastA2; static double lastSigma; if ( mean < LAST_MU + S ) { return poissonDeviateSmall ( anEngine, mean ); } else { if ( mean != lastLargeMean ) { // Compute the coefficients defining the quadratic transformation from a // Gaussian to a Poisson for this mean. Also save these for next time. double sig2 = mean * (.9998654 - .08346/mean); lastSigma = std::sqrt(sig2); double t = 1./sig2; lastA2 = t*(1./6.) + t*t*(1./324.); lastA1 = std::sqrt (1-2*lastA2*lastA2*sig2); lastA0 = mean + .5 - sig2 * lastA2; } return poissonDeviateQuick ( anEngine, lastA0, lastA1, lastA2, lastSigma ); } } // shoot (anEngine, mean) void RandPoissonQ::shootArray(const int size, long* vect, double m) { for( long* v = vect; v != vect + size; ++v ) *v = shoot(m); // Note: We could test for m > 100, and if it is, precompute a0, a1, a2, // and sigma and call the appropriate form of poissonDeviateQuick. // But since those are cached anyway, not much time would be saved. } void RandPoissonQ::fireArray(const int size, long* vect, double m) { for( long* v = vect; v != vect + size; ++v ) *v = fire( m ); } void RandPoissonQ::fireArray(const int size, long* vect) { for( long* v = vect; v != vect + size; ++v ) *v = fire( defaultMean ); } // Quick Poisson deviate algorithm used by quick for large mu: long RandPoissonQ::poissonDeviateQuick ( HepRandomEngine *e, double mu ) { // Compute the coefficients defining the quadratic transformation from a // Gaussian to a Poisson: double sig2 = mu * (.9998654 - .08346/mu); double sig = std::sqrt(sig2); // The multiplier corrects for fact that discretization of the form // [gaussian+.5] increases the second moment by a small amount. double t = 1./sig2; double sa2 = t*(1./6.) + t*t*(1./324.); double sa1 = std::sqrt (1-2*sa2*sa2*sig2); double sa0 = mu + .5 - sig2 * sa2; // The formula will be sa0 + sa1*x + sa2*x*x where x has sigma of sq. // The coeffeicients are chosen to match the first THREE moments of the // true Poisson distribution. return poissonDeviateQuick ( e, sa0, sa1, sa2, sig ); } long RandPoissonQ::poissonDeviateQuick ( HepRandomEngine *e, double A0, double A1, double A2, double sig) { // // Quick Poisson deviate algorithm used by quick for large mu: // // The principle: For very large mu, a poisson distribution can be approximated // by a gaussian: return the integer part of mu + .5 + g where g is a unit // normal. However, this yelds a miserable approximation at values as // "large" as 100. The primary problem is that the poisson distribution is // supposed to have a skew of 1/mu**2, and the zero skew of the Guassian // leads to errors of order as big as 1/mu**2. // // We substitute for the gaussian a quadratic function of that gaussian random. // The expression looks very nearly like mu + .5 - 1/6 + g + g**2/(6*mu). // The small positive quadratic term causes the resulting variate to have // a positive skew; the -1/6 constant term is there to correct for this bias // in the mean. By adjusting these two and the linear term, we can match the // first three moments to high accuracy in 1/mu. // // The sigma used is not precisely std::sqrt(mu) since a rounded-off Gaussian // has a second moment which is slightly larger than that of the Gaussian. // To compensate, sig is multiplied by a factor which is slightly less than 1. // double g = RandGauss::shootQuick( e ); // TEMPORARY MOD: double g = RandGaussQ::shoot( e ); // Unit normal g *= sig; double p = A2*g*g + A1*g + A0; if ( p < 0 ) return 0; // Shouldn't ever possibly happen since // mean should not be less than 100, but // we check due to paranoia. if ( p > MAXIMUM_POISSON_DEVIATE ) p = MAXIMUM_POISSON_DEVIATE; return long(p); } // poissonDeviateQuick () long RandPoissonQ::poissonDeviateSmall (HepRandomEngine * e, double mean) { long N1; long N2; // The following are for later use to form a secondary random s: double rRange; // This will hold the interval between cdf for the // computed N1 and cdf for N1+1. double rRemainder = 0; // This will hold the length into that interval. // Coming in, mean should not be more than LAST_MU + S. However, we will // be paranoid and test for this: if ( mean > LAST_MU + S ) { return RandPoisson::shoot(e, mean); } if (mean <= 0) { return 0; // Perhaps we ought to balk harder here! } // >>> 1 <<< // Generate the first random, which we always will need. double r = e->flat(); // >>> 2 <<< // For small mean, below the start of the tables, // do the series for cdf directly. // In this case, since we know the series will terminate relatively quickly, // almost alwaye use a precomputed 1/N array without fear of overrunning it. static const double oneOverN[50] = { 0, 1., 1/2., 1/3., 1/4., 1/5., 1/6., 1/7., 1/8., 1/9., 1/10., 1/11., 1/12., 1/13., 1/14., 1/15., 1/16., 1/17., 1/18., 1/19., 1/20., 1/21., 1/22., 1/23., 1/24., 1/25., 1/26., 1/27., 1/28., 1/29., 1/30., 1/31., 1/32., 1/33., 1/34., 1/35., 1/36., 1/37., 1/38., 1/39., 1/40., 1/41., 1/42., 1/43., 1/44., 1/45., 1/46., 1/47., 1/48., 1/49. }; if ( mean < FIRST_MU ) { long N = 0; double term = std::exp(-mean); double cdf = term; if ( r < (1 - 1.0E-9) ) { // // **** This is a normal path: **** // // Except when r is very close to 1, it is certain that we will exceed r // before the 30-th term in the series, so a simple while loop is OK. const double* oneOverNptr = oneOverN; while( cdf <= r ) { N++ ; oneOverNptr++; term *= ( mean * (*oneOverNptr) ); cdf += term; } return N; // // **** **** // } else { // r is almost 1... // For r very near to 1 we would have to check that we don't fall // off the end of the table of 1/N. Since this is very rare, we just // ignore the table and do the identical while loop, using explicit // division. double cdf0; while ( cdf <= r ) { N++ ; term *= ( mean / N ); cdf0 = cdf; cdf += term; if (cdf == cdf0) break; // Can't happen, but just in case... } return N; } // end of if ( r compared to (1 - 1.0E-9) ) } // End of the code for mean < FIRST_MU // >>> 3 <<< // Find the row of the tables corresponding to the highest tabulated mu // which is no greater than our actual mean. int rowNumber = int((mean - FIRST_MU)/S); const double * cdfs = &poissonTables [rowNumber*ENTRIES]; double mu = FIRST_MU + rowNumber*S; double deltaMu = mean - mu; int Nmin = int(mu - BELOW); if (Nmin < 1) Nmin = 1; int Nmax = Nmin + (ENTRIES - 1); // >>> 4 <<< // If r is less that the smallest entry in the row, then // generate the deviate directly from the series. if ( r < cdfs[0] ) { // In this case, we are tempted to use the actual mean, and not // generate a second deviate to account for the leftover part mean - mu. // That would be an error, generating a distribution with enough excess // at Nmin + (mean-mu)/2 to be detectable in 4,000,000 trials. // Since this case is very rare (never more than .2% of the r values) // and can happen where N will be large (up to 65 for the mu=95 row) // we use explicit division so as to avoid having to worry about running // out of oneOverN table. long N = 0; double term = std::exp(-mu); double cdf = term; double cdf0; while(cdf <= r) { N++ ; term *= ( mu / N ); cdf0 = cdf; cdf += term; if (cdf == cdf0) break; // Can't happen, but just in case... } N1 = N; // std::cout << r << " " << N << " "; // DBG_small = true; rRange = 0; // In this case there is always a second r needed } // end of small-r case // >>> 5 <<< // Assuming r lies within the scope of the row for this mu, find the // largest entry not greater than r. N1 is the N corresponding to the // index a. else if ( r < cdfs[ENTRIES-1] ) { // r is also >= cdfs[0] // // **** This is the normal code path **** // int a = 0; // Highest value of index such that cdfs[a] // is known NOT to be greater than r. int b = ENTRIES - 1; // Lowest value of index such that cdfs[b] is // known to exeed r. while (b != (a+1) ) { int c = (a+b+1)>>1; if (r > cdfs[c]) { a = c; } else { b = c; } } N1 = Nmin + a; rRange = cdfs[a+1] - cdfs[a]; rRemainder = r - cdfs[a]; // // **** **** // } // end of medium-r (normal) case // >>> 6 <<< // If r exceeds the greatest entry in the table for this mu, then start // from that cdf, and use the series to compute from there until r is // exceeded. else { // if ( r >= cdfs[ENTRIES-1] ) { // Here, division must be done explicitly, and we must also protect against // roundoff preventing termination. // //+++ cdfs[ENTRIES-1] is std::exp(-mu) sum (mu**m/m! , m=0 to Nmax) //+++ (where Nmax = mu - BELOW + ENTRIES - 1) //+++ cdfs[ENTRIES-1]-cdfs[ENTRIES-2] is std::exp(-mu) mu**(Nmax)/(Nmax)! //+++ If the sum up to k-1 <= r < sum up to k, then N = k-1 //+++ Consider k = Nmax in the above statement: //+++ If cdfs[ENTRIES-2] <= r < cdfs[ENTRIES-1], N would be Nmax-1 //+++ But here r >= cdfs[ENTRIES-1] so N >= Nmax // // Erroneous: //+++ cdfs[ENTRIES-1] is std::exp(-mu) sum (mu**m/m! , m=0 to Nmax-1) //+++ cdfs[ENTRIES-1]-cdfs[ENTRIES-2] is std::exp(-mu) mu**(Nmax-1)/(Nmax-1)! //+++ If a sum up to k-1 <= r < sum up to k, then N = k-1 //+++ So if cdfs[ENTRIES-1] were > r, N would be Nmax-1 (or less) //+++ But here r >= cdfs[ENTRIES-1] so N >= Nmax // // std::cout << "r = " << r << " mu = " << mu << "\n"; long N = Nmax -1; double cdf = cdfs[ENTRIES-1]; double term = cdf - cdfs[ENTRIES-2]; double cdf0; while(cdf <= r) { N++ ; // std::cout << " N " << N << " term " << // term << " cdf " << cdf << "\n"; term *= ( mu / N ); cdf0 = cdf; cdf += term; if (cdf == cdf0) break; // If term gets so small cdf stops increasing, // terminate using that value of N since we // would never reach r. } N1 = N; rRange = 0; // We can't validly omit the second true random // N = Nmax -1; // cdf = cdfs[ENTRIES-1]; // term = cdf - cdfs[ENTRIES-2]; // for (int isxz=0; isxz < 100; isxz++) { // N++ ; // term *= ( mu / N ); // cdf0 = cdf; // cdf += term; // } // std::cout.precision(20); // std::cout << "Final sum is " << cdf << "\n"; } // end of large-r case // >>> 7 <<< // Form a second random, s, based on the position of r within the range // of this table entry to the next entry. // However, if this range is very small, then we lose too many bits of // randomness. In that situation, we generate a second random for s. double s; static const double MINRANGE = .01; // Sacrifice up to two digits of // randomness when using r to produce // a second random s. Leads to up to // .09 extra randoms each time. if ( rRange > MINRANGE ) { // // **** This path taken 90% of the time **** // s = rRemainder / rRange; } else { s = e->flat(); // extra true random needed about one time in 10. } // >>> 8 <<< // Use the direct summation method to form a second poisson deviate N2 // from deltaMu and s. N2 = 0; double term = std::exp(-deltaMu); double cdf = term; if ( s < (1 - 1.0E-10) ) { // // This is the normal path: // const double* oneOverNptr = oneOverN; while( cdf <= s ) { N2++ ; oneOverNptr++; term *= ( deltaMu * (*oneOverNptr) ); cdf += term; } } else { // s is almost 1... while( cdf <= s ) { N2++ ; term *= ( deltaMu / N2 ); cdf += term; } } // end of if ( s compared to (1 - 1.0E-10) ) // >>> 9 <<< // The result is the sum of those two deviates // if (DBG_small) { // std::cout << N2 << " " << N1+N2 << "\n"; // DBG_small = false; // } return N1 + N2; } // poissonDeviate() std::ostream & RandPoissonQ::put ( std::ostream & os ) const { int pr=os.precision(20); std::vector t(2); os << " " << name() << "\n"; os << "Uvec" << "\n"; t = DoubConv::dto2longs(a0); os << a0 << " " << t[0] << " " << t[1] << "\n"; t = DoubConv::dto2longs(a1); os << a1 << " " << t[0] << " " << t[1] << "\n"; t = DoubConv::dto2longs(a2); os << a2 << " " << t[0] << " " << t[1] << "\n"; t = DoubConv::dto2longs(sigma); os << sigma << " " << t[0] << " " << t[1] << "\n"; RandPoisson::put(os); os.precision(pr); return os; #ifdef REMOVED int pr=os.precision(20); os << " " << name() << "\n"; os << a0 << " " << a1 << " " << a2 << "\n"; os << sigma << "\n"; RandPoisson::put(os); os.precision(pr); return os; #endif } std::istream & RandPoissonQ::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } if (possibleKeywordInput(is, "Uvec", a0)) { std::vector t(2); is >> a0 >> t[0] >> t[1]; a0 = DoubConv::longs2double(t); is >> a1 >> t[0] >> t[1]; a1 = DoubConv::longs2double(t); is >> a2 >> t[0] >> t[1]; a2 = DoubConv::longs2double(t); is >> sigma >> t[0] >> t[1]; sigma = DoubConv::longs2double(t); RandPoisson::get(is); return is; } // is >> a0 encompassed by possibleKeywordInput is >> a1 >> a2 >> sigma; RandPoisson::get(is); return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandLandau.cc0000755000175000017500000004104611753236267016750 0ustar olesoles// $Id: RandLandau.cc,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandLandau --- // class implementation file // ----------------------------------------------------------------------- // ======================================================================= // M Fischler - Created 1/6/2000. // // The key transform() method uses the algorithm in CERNLIB. // This is because I trust that RANLAN routine more than // I trust the Bukin-Grozina inverseLandau, which is not // claimed to be better than 1% accurate. // // M Fischler - put and get to/from streams 12/13/04 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandLandau.h" #include #include // for std::log() namespace CLHEP { std::string RandLandau::name() const {return "RandLandau";} HepRandomEngine & RandLandau::engine() {return *localEngine;} RandLandau::~RandLandau() { } void RandLandau::shootArray( const int size, double* vect ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot(); } void RandLandau::shootArray( HepRandomEngine* anEngine, const int size, double* vect ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot(anEngine); } void RandLandau::fireArray( const int size, double* vect) { for( double* v = vect; v != vect + size; ++v ) *v = fire(); } // // Table of values of inverse Landau, from r = .060 to .982 // // Since all these are this is static to this compilation unit only, the // info is establised a priori and not at each invocation. static const float TABLE_INTERVAL = .001f; static const int TABLE_END = 982; static const float TABLE_MULTIPLIER = 1.0f/TABLE_INTERVAL; // Here comes the big (4K bytes) table --- // // inverseLandau[ n ] = the inverse cdf at r = n*TABLE_INTERVAL = n/1000. // // Credit CERNLIB for these computations. // // This data is float because the algortihm does not benefit from further // data accuracy. The numbers below .006 or above .982 are moot since // non-table-based methods are used below r=.007 and above .980. static const float inverseLandau [TABLE_END+1] = { 0.0f, // .000 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // .001 - .005 -2.244733f, -2.204365f, -2.168163f, -2.135219f, -2.104898f, // .006 - .010 -2.076740f, -2.050397f, -2.025605f, -2.002150f, -1.979866f, -1.958612f, -1.938275f, -1.918760f, -1.899984f, -1.881879f, // .020 -1.864385f, -1.847451f, -1.831030f, -1.815083f, -1.799574f, -1.784473f, -1.769751f, -1.755383f, -1.741346f, -1.727620f, // .030 -1.714187f, -1.701029f, -1.688130f, -1.675477f, -1.663057f, -1.650858f, -1.638868f, -1.627078f, -1.615477f, -1.604058f, // .040 -1.592811f, -1.581729f, -1.570806f, -1.560034f, -1.549407f, -1.538919f, -1.528565f, -1.518339f, -1.508237f, -1.498254f, // .050 -1.488386f, -1.478628f, -1.468976f, -1.459428f, -1.449979f, -1.440626f, -1.431365f, -1.422195f, -1.413111f, -1.404112f, // .060 -1.395194f, -1.386356f, -1.377594f, -1.368906f, -1.360291f, -1.351746f, -1.343269f, -1.334859f, -1.326512f, -1.318229f, // .070 -1.310006f, -1.301843f, -1.293737f, -1.285688f, -1.277693f, -1.269752f, -1.261863f, -1.254024f, -1.246235f, -1.238494f, // .080 -1.230800f, -1.223153f, -1.215550f, -1.207990f, -1.200474f, -1.192999f, -1.185566f, -1.178172f, -1.170817f, -1.163500f, // .090 -1.156220f, -1.148977f, -1.141770f, -1.134598f, -1.127459f, -1.120354f, -1.113282f, -1.106242f, -1.099233f, -1.092255f, // .100 -1.085306f, -1.078388f, -1.071498f, -1.064636f, -1.057802f, -1.050996f, -1.044215f, -1.037461f, -1.030733f, -1.024029f, -1.017350f, -1.010695f, -1.004064f, -.997456f, -.990871f, -.984308f, -.977767f, -.971247f, -.964749f, -.958271f, -.951813f, -.945375f, -.938957f, -.932558f, -.926178f, -.919816f, -.913472f, -.907146f, -.900838f, -.894547f, -.888272f, -.882014f, -.875773f, -.869547f, -.863337f, -.857142f, -.850963f, -.844798f, -.838648f, -.832512f, -.826390f, -.820282f, -.814187f, -.808106f, -.802038f, -.795982f, -.789940f, -.783909f, -.777891f, -.771884f, // .150 -.765889f, -.759906f, -.753934f, -.747973f, -.742023f, -.736084f, -.730155f, -.724237f, -.718328f, -.712429f, -.706541f, -.700661f, -.694791f, -.688931f, -.683079f, -.677236f, -.671402f, -.665576f, -.659759f, -.653950f, -.648149f, -.642356f, -.636570f, -.630793f, -.625022f, -.619259f, -.613503f, -.607754f, -.602012f, -.596276f, -.590548f, -.584825f, -.579109f, -.573399f, -.567695f, -.561997f, -.556305f, -.550618f, -.544937f, -.539262f, -.533592f, -.527926f, -.522266f, -.516611f, -.510961f, -.505315f, -.499674f, -.494037f, -.488405f, -.482777f, // .200 -.477153f, -.471533f, -.465917f, -.460305f, -.454697f, -.449092f, -.443491f, -.437893f, -.432299f, -.426707f, -.421119f, -.415534f, -.409951f, -.404372f, -.398795f, -.393221f, -.387649f, -.382080f, -.376513f, -.370949f, -.365387f, -.359826f, -.354268f, -.348712f, -.343157f, -.337604f, -.332053f, -.326503f, -.320955f, -.315408f, -.309863f, -.304318f, -.298775f, -.293233f, -.287692f, -.282152f, -.276613f, -.271074f, -.265536f, -.259999f, -.254462f, -.248926f, -.243389f, -.237854f, -.232318f, -.226783f, -.221247f, -.215712f, -.210176f, -.204641f, // .250 -.199105f, -.193568f, -.188032f, -.182495f, -.176957f, -.171419f, -.165880f, -.160341f, -.154800f, -.149259f, -.143717f, -.138173f, -.132629f, -.127083f, -.121537f, -.115989f, -.110439f, -.104889f, -.099336f, -.093782f, -.088227f, -.082670f, -.077111f, -.071550f, -.065987f, -.060423f, -.054856f, -.049288f, -.043717f, -.038144f, -.032569f, -.026991f, -.021411f, -.015828f, -.010243f, -.004656f, .000934f, .006527f, .012123f, .017722f, .023323f, .028928f, .034535f, .040146f, .045759f, .051376f, .056997f, .062620f, .068247f, .073877f, // .300 .079511f, .085149f, .090790f, .096435f, .102083f, .107736f, .113392f, .119052f, .124716f, .130385f, .136057f, .141734f, .147414f, .153100f, .158789f, .164483f, .170181f, .175884f, .181592f, .187304f, .193021f, .198743f, .204469f, .210201f, .215937f, .221678f, .227425f, .233177f, .238933f, .244696f, .250463f, .256236f, .262014f, .267798f, .273587f, .279382f, .285183f, .290989f, .296801f, .302619f, .308443f, .314273f, .320109f, .325951f, .331799f, .337654f, .343515f, .349382f, .355255f, .361135f, // .350 .367022f, .372915f, .378815f, .384721f, .390634f, .396554f, .402481f, .408415f, .414356f, .420304f, .426260f, .432222f, .438192f, .444169f, .450153f, .456145f, .462144f, .468151f, .474166f, .480188f, .486218f, .492256f, .498302f, .504356f, .510418f, .516488f, .522566f, .528653f, .534747f, .540850f, .546962f, .553082f, .559210f, .565347f, .571493f, .577648f, .583811f, .589983f, .596164f, .602355f, .608554f, .614762f, .620980f, .627207f, .633444f, .639689f, .645945f, .652210f, .658484f, .664768f, // .400 .671062f, .677366f, .683680f, .690004f, .696338f, .702682f, .709036f, .715400f, .721775f, .728160f, .734556f, .740963f, .747379f, .753807f, .760246f, .766695f, .773155f, .779627f, .786109f, .792603f, .799107f, .805624f, .812151f, .818690f, .825241f, .831803f, .838377f, .844962f, .851560f, .858170f, .864791f, .871425f, .878071f, .884729f, .891399f, .898082f, .904778f, .911486f, .918206f, .924940f, .931686f, .938446f, .945218f, .952003f, .958802f, .965614f, .972439f, .979278f, .986130f, .992996f, // .450 .999875f, 1.006769f, 1.013676f, 1.020597f, 1.027533f, 1.034482f, 1.041446f, 1.048424f, 1.055417f, 1.062424f, 1.069446f, 1.076482f, 1.083534f, 1.090600f, 1.097681f, 1.104778f, 1.111889f, 1.119016f, 1.126159f, 1.133316f, 1.140490f, 1.147679f, 1.154884f, 1.162105f, 1.169342f, 1.176595f, 1.183864f, 1.191149f, 1.198451f, 1.205770f, 1.213105f, 1.220457f, 1.227826f, 1.235211f, 1.242614f, 1.250034f, 1.257471f, 1.264926f, 1.272398f, 1.279888f, 1.287395f, 1.294921f, 1.302464f, 1.310026f, 1.317605f, 1.325203f, 1.332819f, 1.340454f, 1.348108f, 1.355780f, // .500 1.363472f, 1.371182f, 1.378912f, 1.386660f, 1.394429f, 1.402216f, 1.410024f, 1.417851f, 1.425698f, 1.433565f, 1.441453f, 1.449360f, 1.457288f, 1.465237f, 1.473206f, 1.481196f, 1.489208f, 1.497240f, 1.505293f, 1.513368f, 1.521465f, 1.529583f, 1.537723f, 1.545885f, 1.554068f, 1.562275f, 1.570503f, 1.578754f, 1.587028f, 1.595325f, 1.603644f, 1.611987f, 1.620353f, 1.628743f, 1.637156f, 1.645593f, 1.654053f, 1.662538f, 1.671047f, 1.679581f, 1.688139f, 1.696721f, 1.705329f, 1.713961f, 1.722619f, 1.731303f, 1.740011f, 1.748746f, 1.757506f, 1.766293f, // .550 1.775106f, 1.783945f, 1.792810f, 1.801703f, 1.810623f, 1.819569f, 1.828543f, 1.837545f, 1.846574f, 1.855631f, 1.864717f, 1.873830f, 1.882972f, 1.892143f, 1.901343f, 1.910572f, 1.919830f, 1.929117f, 1.938434f, 1.947781f, 1.957158f, 1.966566f, 1.976004f, 1.985473f, 1.994972f, 2.004503f, 2.014065f, 2.023659f, 2.033285f, 2.042943f, 2.052633f, 2.062355f, 2.072110f, 2.081899f, 2.091720f, 2.101575f, 2.111464f, 2.121386f, 2.131343f, 2.141334f, 2.151360f, 2.161421f, 2.171517f, 2.181648f, 2.191815f, 2.202018f, 2.212257f, 2.222533f, 2.232845f, 2.243195f, // .600 2.253582f, 2.264006f, 2.274468f, 2.284968f, 2.295507f, 2.306084f, 2.316701f, 2.327356f, 2.338051f, 2.348786f, 2.359562f, 2.370377f, 2.381234f, 2.392131f, 2.403070f, 2.414051f, 2.425073f, 2.436138f, 2.447246f, 2.458397f, 2.469591f, 2.480828f, 2.492110f, 2.503436f, 2.514807f, 2.526222f, 2.537684f, 2.549190f, 2.560743f, 2.572343f, 2.583989f, 2.595682f, 2.607423f, 2.619212f, 2.631050f, 2.642936f, 2.654871f, 2.666855f, 2.678890f, 2.690975f, 2.703110f, 2.715297f, 2.727535f, 2.739825f, 2.752168f, 2.764563f, 2.777012f, 2.789514f, 2.802070f, 2.814681f, // .650 2.827347f, 2.840069f, 2.852846f, 2.865680f, 2.878570f, 2.891518f, 2.904524f, 2.917588f, 2.930712f, 2.943894f, 2.957136f, 2.970439f, 2.983802f, 2.997227f, 3.010714f, 3.024263f, 3.037875f, 3.051551f, 3.065290f, 3.079095f, 3.092965f, 3.106900f, 3.120902f, 3.134971f, 3.149107f, 3.163312f, 3.177585f, 3.191928f, 3.206340f, 3.220824f, 3.235378f, 3.250005f, 3.264704f, 3.279477f, 3.294323f, 3.309244f, 3.324240f, 3.339312f, 3.354461f, 3.369687f, 3.384992f, 3.400375f, 3.415838f, 3.431381f, 3.447005f, 3.462711f, 3.478500f, 3.494372f, 3.510328f, 3.526370f, // .700 3.542497f, 3.558711f, 3.575012f, 3.591402f, 3.607881f, 3.624450f, 3.641111f, 3.657863f, 3.674708f, 3.691646f, 3.708680f, 3.725809f, 3.743034f, 3.760357f, 3.777779f, 3.795300f, 3.812921f, 3.830645f, 3.848470f, 3.866400f, 3.884434f, 3.902574f, 3.920821f, 3.939176f, 3.957640f, 3.976215f, 3.994901f, 4.013699f, 4.032612f, 4.051639f, 4.070783f, 4.090045f, 4.109425f, 4.128925f, 4.148547f, 4.168292f, 4.188160f, 4.208154f, 4.228275f, 4.248524f, 4.268903f, 4.289413f, 4.310056f, 4.330832f, 4.351745f, 4.372794f, 4.393982f, 4.415310f, 4.436781f, 4.458395f, 4.480154f, 4.502060f, 4.524114f, 4.546319f, 4.568676f, // .750 4.591187f, 4.613854f, 4.636678f, 4.659662f, 4.682807f, 4.706116f, 4.729590f, 4.753231f, 4.777041f, 4.801024f, 4.825179f, 4.849511f, 4.874020f, 4.898710f, 4.923582f, 4.948639f, 4.973883f, 4.999316f, 5.024942f, 5.050761f, 5.076778f, 5.102993f, 5.129411f, 5.156034f, 5.182864f, 5.209903f, 5.237156f, 5.264625f, 5.292312f, 5.320220f, 5.348354f, 5.376714f, 5.405306f, 5.434131f, 5.463193f, 5.492496f, 5.522042f, 5.551836f, 5.581880f, 5.612178f, 5.642734f, 5.673552f, 5.704634f, 5.735986f, 5.767610f, // .800 5.799512f, 5.831694f, 5.864161f, 5.896918f, 5.929968f, 5.963316f, 5.996967f, 6.030925f, 6.065194f, 6.099780f, 6.134687f, 6.169921f, 6.205486f, 6.241387f, 6.277630f, 6.314220f, 6.351163f, 6.388465f, 6.426130f, 6.464166f, 6.502578f, 6.541371f, 6.580553f, 6.620130f, 6.660109f, 6.700495f, 6.741297f, 6.782520f, 6.824173f, 6.866262f, 6.908795f, 6.951780f, 6.995225f, 7.039137f, 7.083525f, 7.128398f, 7.173764f, 7.219632f, 7.266011f, 7.312910f, 7.360339f, 7.408308f, 7.456827f, 7.505905f, 7.555554f, 7.605785f, 7.656608f, 7.708035f, 7.760077f, 7.812747f, // .850 7.866057f, 7.920019f, 7.974647f, 8.029953f, 8.085952f, 8.142657f, 8.200083f, 8.258245f, 8.317158f, 8.376837f, 8.437300f, 8.498562f, 8.560641f, 8.623554f, 8.687319f, 8.751955f, 8.817481f, 8.883916f, 8.951282f, 9.019600f, 9.088889f, 9.159174f, 9.230477f, 9.302822f, 9.376233f, 9.450735f, 9.526355f, 9.603118f, 9.681054f, 9.760191f, 9.840558f, 9.922186f, 10.005107f, 10.089353f, 10.174959f, 10.261958f, 10.350389f, 10.440287f, 10.531693f, 10.624646f, 10.719188f, 10.815362f, 10.913214f, 11.012789f, 11.114137f, 11.217307f, 11.322352f, 11.429325f, 11.538283f, 11.649285f, // .900 11.762390f, 11.877664f, 11.995170f, 12.114979f, 12.237161f, 12.361791f, 12.488946f, 12.618708f, 12.751161f, 12.886394f, 13.024498f, 13.165570f, 13.309711f, 13.457026f, 13.607625f, 13.761625f, 13.919145f, 14.080314f, 14.245263f, 14.414134f, 14.587072f, 14.764233f, 14.945778f, 15.131877f, 15.322712f, 15.518470f, 15.719353f, 15.925570f, 16.137345f, 16.354912f, 16.578520f, 16.808433f, 17.044929f, 17.288305f, 17.538873f, 17.796967f, 18.062943f, 18.337176f, 18.620068f, 18.912049f, 19.213574f, 19.525133f, 19.847249f, 20.180480f, 20.525429f, 20.882738f, 21.253102f, 21.637266f, 22.036036f, 22.450278f, // .950 22.880933f, 23.329017f, 23.795634f, 24.281981f, 24.789364f, 25.319207f, 25.873062f, 26.452634f, 27.059789f, 27.696581f, // .960 28.365274f, 29.068370f, 29.808638f, 30.589157f, 31.413354f, 32.285060f, 33.208568f, 34.188705f, 35.230920f, 36.341388f, // .970 37.527131f, 38.796172f, 40.157721f, 41.622399f, 43.202525f, 44.912465f, 46.769077f, 48.792279f, 51.005773f, 53.437996f, // .980 56.123356f, 59.103894f, // .982 }; // End of the inverseLandau table double RandLandau::transform (double r) { double u = r * TABLE_MULTIPLIER; int index = int(u); double du = u - index; // du is scaled such that the we dont have to multiply by TABLE_INTERVAL // when interpolating. // Five cases: // A) Between .070 and .800 the function is so smooth, straight // linear interpolation is adequate. // B) Between .007 and .070, and between .800 and .980, quadratic // interpolation is used. This requires the same 4 points as // a cubic spline (thus we need .006 and .981 and .982) but // the quadratic interpolation is accurate enough and quicker. // C) Below .007 an asymptotic expansion for low negative lambda // (involving two logs) is used; there is a pade-style correction // factor. // D) Above .980, a simple pade approximation is made (asymptotic to // 1/(1-r)), but... // E) the coefficients in that pade are different above r=.999. if ( index >= 70 && index <= 800 ) { // (A) double f0 = inverseLandau [index]; double f1 = inverseLandau [index+1]; return f0 + du * (f1 - f0); } else if ( index >= 7 && index <= 980 ) { // (B) double f_1 = inverseLandau [index-1]; double f0 = inverseLandau [index]; double f1 = inverseLandau [index+1]; double f2 = inverseLandau [index+2]; return f0 + du * (f1 - f0 - .25*(1-du)* (f2 -f1 - f0 + f_1) ); } else if ( index < 7 ) { // (C) const double n0 = 0.99858950; const double n1 = 34.5213058; const double d1 = 34.1760202; const double n2 = 17.0854528; const double d2 = 4.01244582; double logr = std::log(r); double x = 1/logr; double x2 = x*x; double pade = (n0 + n1*x + n2*x2) / (1.0 + d1*x + d2*x2); return ( - std::log ( -.91893853 - logr ) -1 ) * pade; } else if ( index <= 999 ) { // (D) const double n0 = 1.00060006; const double n1 = 263.991156; const double d1 = 257.368075; const double n2 = 4373.20068; const double d2 = 3414.48018; double x = 1-r; double x2 = x*x; return (n0 + n1*x + n2*x2) / (x * (1.0 + d1*x + d2*x2)); } else { // (E) const double n0 = 1.00001538; const double n1 = 6075.14119; const double d1 = 6065.11919; const double n2 = 734266.409; const double d2 = 694021.044; double x = 1-r; double x2 = x*x; return (n0 + n1*x + n2*x2) / (x * (1.0 + d1*x + d2*x2)); } } // transform() std::ostream & RandLandau::put ( std::ostream & os ) const { int pr=os.precision(20); os << " " << name() << "\n"; os.precision(pr); return os; } std::istream & RandLandau::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/EngineFactory.cc0000644000175000017500000001041111406204345017444 0ustar olesoles// $Id: // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- EngineFactory --- // class implementation file // ----------------------------------------------------------------------- // // ======================================================================= // Mark Fischler - Created: Dec. 21, 2004 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/EngineFactory.h" #include "CLHEP/Random/DRand48Engine.h" #include "CLHEP/Random/DualRand.h" #include "CLHEP/Random/Hurd160Engine.h" #include "CLHEP/Random/Hurd288Engine.h" #include "CLHEP/Random/JamesRandom.h" #include "CLHEP/Random/JamesRandom.h" #include "CLHEP/Random/MTwistEngine.h" #include "CLHEP/Random/RandEngine.h" #include "CLHEP/Random/RanecuEngine.h" #include "CLHEP/Random/Ranlux64Engine.h" #include "CLHEP/Random/RanluxEngine.h" #include "CLHEP/Random/RanshiEngine.h" #include "CLHEP/Random/TripleRand.h" #include "CLHEP/Random/NonRandomEngine.h" #include "CLHEP/Random/engineIDulong.h" #include #include namespace CLHEP { template static HepRandomEngine* makeAnEngine (const std::string & tag, std::istream & is) { if ( tag != E::beginTag() ) return 0; HepRandomEngine* eptr = new E; eptr->getState(is); if (!is) return 0; return eptr; } template static HepRandomEngine* makeAnEngine (const std::vector & v) { if ( (v[0] & 0xffffffffUL) != engineIDulong() ) return 0; HepRandomEngine* eptr = new E; bool success = eptr->getState(v); if (!success) return 0; // std::cerr << "makeAnEngine made " << E::engineName() << "\n"; return eptr; } HepRandomEngine* EngineFactory::newEngine(std::istream& is) { HepRandomEngine* eptr; std::string tag; is >> tag; eptr = makeAnEngine (tag, is); if (eptr) return eptr; eptr = makeAnEngine (tag, is); if (eptr) return eptr; eptr = makeAnEngine (tag, is); if (eptr) return eptr; eptr = makeAnEngine (tag, is); if (eptr) return eptr; eptr = makeAnEngine (tag, is); if (eptr) return eptr; eptr = makeAnEngine (tag, is); if (eptr) return eptr; eptr = makeAnEngine (tag, is); if (eptr) return eptr; eptr = makeAnEngine (tag, is); if (eptr) return eptr; eptr = makeAnEngine (tag, is); if (eptr) return eptr; eptr = makeAnEngine (tag, is); if (eptr) return eptr; eptr = makeAnEngine (tag, is); if (eptr) return eptr; eptr = makeAnEngine (tag, is); if (eptr) return eptr; eptr = makeAnEngine (tag, is); if (eptr) return eptr; is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Input mispositioned or bad in reading anonymous engine\n" << "\nBegin-tag read was: " << tag << "\nInput stream is probably fouled up\n"; return eptr; } HepRandomEngine* EngineFactory::newEngine(std::vector const & v) { HepRandomEngine* eptr; eptr = makeAnEngine (v); if (eptr) return eptr; eptr = makeAnEngine (v); if (eptr) return eptr; eptr = makeAnEngine (v); if (eptr) return eptr; eptr = makeAnEngine (v); if (eptr) return eptr; eptr = makeAnEngine (v); if (eptr) return eptr; eptr = makeAnEngine (v); if (eptr) return eptr; eptr = makeAnEngine (v); if (eptr) return eptr; eptr = makeAnEngine (v); if (eptr) return eptr; eptr = makeAnEngine (v); if (eptr) return eptr; eptr = makeAnEngine (v); if (eptr) return eptr; eptr = makeAnEngine (v); if (eptr) return eptr; eptr = makeAnEngine (v); if (eptr) return eptr; eptr = makeAnEngine (v); if (eptr) return eptr; std::cerr << "Cannot correctly get anonymous engine from vector\n" << "First unsigned long was: " << v[0] << " Vector size was: " << v.size() <<"\n"; return eptr; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandGauss.cc0000755000175000017500000002676511753236267016641 0ustar olesoles// $Id: RandGauss.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGauss --- // class implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Added methods to shoot arrays: 28th July 1997 // J.Marraffino - Added default arguments as attributes and // operator() with arguments. Introduced method normal() // for computation in fire(): 16th Feb 1998 // Gabriele Cosmo - Relocated static data from HepRandom: 5th Jan 1999 // M Fischler - Copy constructor should supply right engine to HepRandom: // 1/26/00. // M Fischler - Workaround for problem of non-reproducing saveEngineStatus // by saving cached gaussian. March 2000. // M Fischler - Avoiding hang when file not found in restoreEngineStatus // 12/3/04 // M Fischler - put and get to/from streams 12/8/04 // M Fischler - save and restore dist to streams 12/20/04 // M Fischler - put/get to/from streams uses pairs of ulongs when // storing doubles avoid problems with precision. // Similarly for saveEngineStatus and RestoreEngineStatus // and for save/restore distState // Care was taken that old-form output can still be read back. // 4/14/05 // // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandGauss.h" #include "CLHEP/Random/DoubConv.hh" #include // for strcmp #include // for std::log() namespace CLHEP { std::string RandGauss::name() const {return "RandGauss";} HepRandomEngine & RandGauss::engine() {return *localEngine;} // Initialisation of static data bool RandGauss::set_st = false; double RandGauss::nextGauss_st = 0.0; RandGauss::~RandGauss() { } double RandGauss::operator()() { return fire( defaultMean, defaultStdDev ); } double RandGauss::operator()( double mean, double stdDev ) { return fire( mean, stdDev ); } double RandGauss::shoot() { // Gaussian random numbers are generated two at the time, so every other // time this is called we just return a number generated the time before. if ( getFlag() ) { setFlag(false); double x = getVal(); return x; // return getVal(); } double r; double v1,v2,fac,val; HepRandomEngine* anEngine = HepRandom::getTheEngine(); do { v1 = 2.0 * anEngine->flat() - 1.0; v2 = 2.0 * anEngine->flat() - 1.0; r = v1*v1 + v2*v2; } while ( r > 1.0 ); fac = std::sqrt(-2.0*std::log(r)/r); val = v1*fac; setVal(val); setFlag(true); return v2*fac; } void RandGauss::shootArray( const int size, double* vect, double mean, double stdDev ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot(mean,stdDev); } double RandGauss::shoot( HepRandomEngine* anEngine ) { // Gaussian random numbers are generated two at the time, so every other // time this is called we just return a number generated the time before. if ( getFlag() ) { setFlag(false); return getVal(); } double r; double v1,v2,fac,val; do { v1 = 2.0 * anEngine->flat() - 1.0; v2 = 2.0 * anEngine->flat() - 1.0; r = v1*v1 + v2*v2; } while ( r > 1.0 ); fac = std::sqrt( -2.0*std::log(r)/r); val = v1*fac; setVal(val); setFlag(true); return v2*fac; } void RandGauss::shootArray( HepRandomEngine* anEngine, const int size, double* vect, double mean, double stdDev ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot(anEngine,mean,stdDev); } double RandGauss::normal() { // Gaussian random numbers are generated two at the time, so every other // time this is called we just return a number generated the time before. if ( set ) { set = false; return nextGauss; } double r; double v1,v2,fac,val; do { v1 = 2.0 * localEngine->flat() - 1.0; v2 = 2.0 * localEngine->flat() - 1.0; r = v1*v1 + v2*v2; } while ( r > 1.0 ); fac = std::sqrt(-2.0*std::log(r)/r); val = v1*fac; nextGauss = val; set = true; return v2*fac; } void RandGauss::fireArray( const int size, double* vect) { for( double* v = vect; v != vect + size; ++v ) *v = fire( defaultMean, defaultStdDev ); } void RandGauss::fireArray( const int size, double* vect, double mean, double stdDev ) { for( double* v = vect; v != vect + size; ++v ) *v = fire( mean, stdDev ); } void RandGauss::saveEngineStatus ( const char filename[] ) { // First save the engine status just like the base class would do: getTheEngine()->saveStatus( filename ); // Now append the cached variate, if any: std::ofstream outfile ( filename, std::ios::app ); if ( getFlag() ) { std::vector t(2); t = DoubConv::dto2longs(getVal()); outfile << "RANDGAUSS CACHED_GAUSSIAN: Uvec " << getVal() << " " << t[0] << " " << t[1] << "\n"; } else { outfile << "RANDGAUSS NO_CACHED_GAUSSIAN: 0 \n" ; } } // saveEngineStatus void RandGauss::restoreEngineStatus( const char filename[] ) { // First restore the engine status just like the base class would do: getTheEngine()->restoreStatus( filename ); // Now find the line describing the cached variate: std::ifstream infile ( filename, std::ios::in ); if (!infile) return; char inputword[] = "NO_KEYWORD "; // leaves room for 14 characters plus \0 while (true) { infile.width(13); infile >> inputword; if (strcmp(inputword,"RANDGAUSS")==0) break; if (infile.eof()) break; // If the file ends without the RANDGAUSS line, that means this // was a file produced by an earlier version of RandGauss. We will // replicated the old behavior in that case: set_st is cleared. } // Then read and use the caching info: if (strcmp(inputword,"RANDGAUSS")==0) { char setword[40]; // the longest, staticFirstUnusedBit: has length 21 infile.width(39); infile >> setword; // setword should be CACHED_GAUSSIAN: if (strcmp(setword,"CACHED_GAUSSIAN:") ==0) { if (possibleKeywordInput(infile, "Uvec", nextGauss_st)) { std::vector t(2); infile >> nextGauss_st >> t[0] >> t[1]; nextGauss_st = DoubConv::longs2double(t); } // is >> nextGauss_st encompassed by possibleKeywordInput setFlag(true); } else { setFlag(false); infile >> nextGauss_st; // because a 0 will have been output } } else { setFlag(false); } } // restoreEngineStatus // Save and restore to/from streams std::ostream & RandGauss::put ( std::ostream & os ) const { os << name() << "\n"; int prec = os.precision(20); std::vector t(2); os << "Uvec\n"; t = DoubConv::dto2longs(defaultMean); os << defaultMean << " " << t[0] << " " << t[1] << "\n"; t = DoubConv::dto2longs(defaultStdDev); os << defaultStdDev << " " << t[0] << " " << t[1] << "\n"; if ( set ) { t = DoubConv::dto2longs(nextGauss); os << "nextGauss " << nextGauss << " " << t[0] << " " << t[1] << "\n"; #ifdef TRACE_IO std::cout << "put(): nextGauss = " << nextGauss << "\n"; #endif } else { #ifdef TRACE_IO std::cout << "put(): No nextGauss \n"; #endif os << "no_cached_nextGauss \n"; } os.precision(prec); return os; } // put std::istream & RandGauss::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } std::string c1; std::string c2; if (possibleKeywordInput(is, "Uvec", c1)) { std::vector t(2); is >> defaultMean >> t[0] >> t[1]; defaultMean = DoubConv::longs2double(t); is >> defaultStdDev>>t[0]>>t[1]; defaultStdDev = DoubConv::longs2double(t); std::string ng; is >> ng; set = false; #ifdef TRACE_IO if (ng != "nextGauss") std::cout << "get(): ng = " << ng << "\n"; #endif if (ng == "nextGauss") { is >> nextGauss >> t[0] >> t[1]; nextGauss = DoubConv::longs2double(t); #ifdef TRACE_IO std::cout << "get(): nextGauss read back as " << nextGauss << "\n"; #endif set = true; } return is; } // is >> c1 encompassed by possibleKeywordInput is >> defaultMean >> c2 >> defaultStdDev; if ( (!is) || (c1 != "Mean:") || (c2 != "Sigma:") ) { std::cerr << "i/o problem while expecting to read state of a " << name() << " distribution\n" << "default mean and/or sigma could not be read\n"; return is; } is >> c1 >> c2 >> nextGauss; if ( (!is) || (c1 != "RANDGAUSS") ) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Failure when reading caching state of RandGauss\n"; return is; } if (c2 == "CACHED_GAUSSIAN:") { set = true; } else if (c2 == "NO_CACHED_GAUSSIAN:") { set = false; } else { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Unexpected caching state keyword of RandGauss:" << c2 << "\nistream is left in the badbit state\n"; } return is; } // get // Static save and restore to/from streams std::ostream & RandGauss::saveDistState ( std::ostream & os ) { int prec = os.precision(20); std::vector t(2); os << distributionName() << "\n"; os << "Uvec\n"; if ( getFlag() ) { t = DoubConv::dto2longs(getVal()); os << "nextGauss_st " << getVal() << " " << t[0] << " " << t[1] << "\n"; } else { os << "no_cached_nextGauss_st \n"; } os.precision(prec); return os; } std::istream & RandGauss::restoreDistState ( std::istream & is ) { std::string inName; is >> inName; if (inName != distributionName()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read static state of a " << distributionName() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } std::string c1; std::string c2; if (possibleKeywordInput(is, "Uvec", c1)) { std::vector t(2); std::string ng; is >> ng; setFlag (false); if (ng == "nextGauss_st") { is >> nextGauss_st >> t[0] >> t[1]; nextGauss_st = DoubConv::longs2double(t); setFlag (true); } return is; } // is >> c1 encompassed by possibleKeywordInput is >> c2 >> nextGauss_st; if ( (!is) || (c1 != "RANDGAUSS") ) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Failure when reading caching state of static RandGauss\n"; return is; } if (c2 == "CACHED_GAUSSIAN:") { setFlag(true); } else if (c2 == "NO_CACHED_GAUSSIAN:") { setFlag(false); } else { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Unexpected caching state keyword of static RandGauss:" << c2 << "\nistream is left in the badbit state\n"; } return is; } std::ostream & RandGauss::saveFullState ( std::ostream & os ) { HepRandom::saveFullState(os); saveDistState(os); return os; } std::istream & RandGauss::restoreFullState ( std::istream & is ) { HepRandom::restoreFullState(is); restoreDistState(is); return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandBinomial.cc0000755000175000017500000003151311753236267017274 0ustar olesoles// $Id: RandBinomial.cc,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandBinomial --- // class implementation file // ----------------------------------------------------------------------- // ======================================================================= // John Marraffino - Created: 12th May 1998 // M Fischler - put and get to/from streams 12/10/04 // M Fischler - put/get to/from streams uses pairs of ulongs when // + storing doubles avoid problems with precision // 4/14/05 // // ======================================================================= #include "CLHEP/Random/RandBinomial.h" #include "CLHEP/Random/defs.h" #include "CLHEP/Random/DoubConv.hh" #include // for min() and max() #include // for exp() namespace CLHEP { std::string RandBinomial::name() const {return "RandBinomial";} HepRandomEngine & RandBinomial::engine() {return *localEngine;} RandBinomial::~RandBinomial() { } double RandBinomial::shoot( HepRandomEngine *anEngine, long n, double p ) { return genBinomial( anEngine, n, p ); } double RandBinomial::shoot( long n, double p ) { HepRandomEngine *anEngine = HepRandom::getTheEngine(); return genBinomial( anEngine, n, p ); } double RandBinomial::fire( long n, double p ) { return genBinomial( localEngine.get(), n, p ); } void RandBinomial::shootArray( const int size, double* vect, long n, double p ) { for( double* v = vect; v != vect+size; ++v ) *v = shoot(n,p); } void RandBinomial::shootArray( HepRandomEngine* anEngine, const int size, double* vect, long n, double p ) { for( double* v = vect; v != vect+size; ++v ) *v = shoot(anEngine,n,p); } void RandBinomial::fireArray( const int size, double* vect) { for( double* v = vect; v != vect+size; ++v ) *v = fire(defaultN,defaultP); } void RandBinomial::fireArray( const int size, double* vect, long n, double p ) { for( double* v = vect; v != vect+size; ++v ) *v = fire(n,p); } /************************************************************************* * * * StirlingCorrection() * * * * Correction term of the Stirling approximation for std::log(k!) * * (series in 1/k, or table values for small k) * * with long int parameter k * * * ************************************************************************* * * * log k! = (k + 1/2)log(k + 1) - (k + 1) + (1/2)log(2Pi) + * * StirlingCorrection(k + 1) * * * * log k! = (k + 1/2)log(k) - k + (1/2)log(2Pi) + * * StirlingCorrection(k) * * * *************************************************************************/ static double StirlingCorrection(long int k) { #define C1 8.33333333333333333e-02 // +1/12 #define C3 -2.77777777777777778e-03 // -1/360 #define C5 7.93650793650793651e-04 // +1/1260 #define C7 -5.95238095238095238e-04 // -1/1680 static double c[31] = { 0.0, 8.106146679532726e-02, 4.134069595540929e-02, 2.767792568499834e-02, 2.079067210376509e-02, 1.664469118982119e-02, 1.387612882307075e-02, 1.189670994589177e-02, 1.041126526197209e-02, 9.255462182712733e-03, 8.330563433362871e-03, 7.573675487951841e-03, 6.942840107209530e-03, 6.408994188004207e-03, 5.951370112758848e-03, 5.554733551962801e-03, 5.207655919609640e-03, 4.901395948434738e-03, 4.629153749334029e-03, 4.385560249232324e-03, 4.166319691996922e-03, 3.967954218640860e-03, 3.787618068444430e-03, 3.622960224683090e-03, 3.472021382978770e-03, 3.333155636728090e-03, 3.204970228055040e-03, 3.086278682608780e-03, 2.976063983550410e-03, 2.873449362352470e-03, 2.777674929752690e-03, }; double r, rr; if (k > 30L) { r = 1.0 / (double) k; rr = r * r; return(r*(C1 + rr*(C3 + rr*(C5 + rr*C7)))); } else return(c[k]); } double RandBinomial::genBinomial( HepRandomEngine *anEngine, long n, double p ) { /****************************************************************** * * * Binomial-Distribution - Acceptance Rejection/Inversion * * * ****************************************************************** * * * Acceptance Rejection method combined with Inversion for * * generating Binomial random numbers with parameters * * n (number of trials) and p (probability of success). * * For min(n*p,n*(1-p)) < 10 the Inversion method is applied: * * The random numbers are generated via sequential search, * * starting at the lowest index k=0. The cumulative probabilities * * are avoided by using the technique of chop-down. * * For min(n*p,n*(1-p)) >= 10 Acceptance Rejection is used: * * The algorithm is based on a hat-function which is uniform in * * the centre region and exponential in the tails. * * A triangular immediate acceptance region in the centre speeds * * up the generation of binomial variates. * * If candidate k is near the mode, f(k) is computed recursively * * starting at the mode m. * * The acceptance test by Stirling's formula is modified * * according to W. Hoermann (1992): The generation of binomial * * random variates, to appear in J. Statist. Comput. Simul. * * If p < .5 the algorithm is applied to parameters n, p. * * Otherwise p is replaced by 1-p, and k is replaced by n - k. * * * ****************************************************************** * * * FUNCTION: - btpec samples a random number from the binomial * * distribution with parameters n and p and is * * valid for n*min(p,1-p) > 0. * * REFERENCE: - V. Kachitvichyanukul, B.W. Schmeiser (1988): * * Binomial random variate generation, * * Communications of the ACM 31, 216-222. * * SUBPROGRAMS: - StirlingCorrection() * * ... Correction term of the Stirling * * approximation for std::log(k!) * * (series in 1/k or table values * * for small k) with long int k * * - anEngine ... Pointer to a (0,1)-Uniform * * engine * * * * Implemented by H. Zechner and P. Busswald, September 1992 * ******************************************************************/ #define C1_3 0.33333333333333333 #define C5_8 0.62500000000000000 #define C1_6 0.16666666666666667 #define DMAX_KM 20L static long int n_last = -1L, n_prev = -1L; static double par,np,p0,q,p_last = -1.0, p_prev = -1.0; static long b,m,nm; static double pq, rc, ss, xm, xl, xr, ll, lr, c, p1, p2, p3, p4, ch; long bh,i, K, Km, nK; double f, rm, U, V, X, T, E; if (n != n_last || p != p_last) // set-up { n_last = n; p_last = p; par=std::min(p,1.0-p); q=1.0-par; np = n*par; // Check for invalid input values if( np <= 0.0 ) return (-1.0); rm = np + par; m = (long int) rm; // mode, integer if (np<10) { p0=std::exp(n*std::log(q)); // Chop-down bh=(long int)(np+10.0*std::sqrt(np*q)); b=std::min(n,bh); } else { rc = (n + 1.0) * (pq = par / q); // recurr. relat. ss = np * q; // variance i = (long int) (2.195*std::sqrt(ss) - 4.6*q); // i = p1 - 0.5 xm = m + 0.5; xl = (double) (m - i); // limit left xr = (double) (m + i + 1L); // limit right f = (rm - xl) / (rm - xl*par); ll = f * (1.0 + 0.5*f); f = (xr - rm) / (xr * q); lr = f * (1.0 + 0.5*f); c = 0.134 + 20.5/(15.3 + (double) m); // parallelogram // height p1 = i + 0.5; p2 = p1 * (1.0 + c + c); // probabilities p3 = p2 + c/ll; // of regions 1-4 p4 = p3 + c/lr; } } if (np<10) //Inversion Chop-down { double pk; K=0; pk=p0; U=anEngine->flat(); while (U>pk) { ++K; if (K>b) { U=anEngine->flat(); K=0; pk=p0; } else { U-=pk; pk=(double)(((n-K+1)*par*pk)/(K*q)); } } return ((p>0.5) ? (double)(n-K):(double)K); } for (;;) { V = anEngine->flat(); if ((U = anEngine->flat() * p4) <= p1) // triangular region { K=(long int) (xm - U + p1*V); return ((p>0.5) ? (double)(n-K):(double)K); // immediate accept } if (U <= p2) // parallelogram { X = xl + (U - p1)/c; if ((V = V*c + 1.0 - std::fabs(xm - X)/p1) >= 1.0) continue; K = (long int) X; } else if (U <= p3) // left tail { if ((X = xl + std::log(V)/ll) < 0.0) continue; K = (long int) X; V *= (U - p2) * ll; } else // right tail { if ((K = (long int) (xr - std::log(V)/lr)) > n) continue; V *= (U - p3) * lr; } // acceptance test : two cases, depending on |K - m| if ((Km = labs(K - m)) <= DMAX_KM || Km + Km + 2L >= ss) { // computation of p(K) via recurrence relationship from the mode f = 1.0; // f(m) if (m < K) { for (i = m; i < K; ) { if ((f *= (rc / ++i - pq)) < V) break; // multiply f } } else { for (i = K; i < m; ) { if ((V *= (rc / ++i - pq)) > f) break; // multiply V } } if (V <= f) break; // acceptance test } else { // lower and upper squeeze tests, based on lower bounds for log p(K) V = std::log(V); T = - Km * Km / (ss + ss); E = (Km / ss) * ((Km * (Km * C1_3 + C5_8) + C1_6) / ss + 0.5); if (V <= T - E) break; if (V <= T + E) { if (n != n_prev || par != p_prev) { n_prev = n; p_prev = par; nm = n - m + 1L; ch = xm * std::log((m + 1.0)/(pq * nm)) + StirlingCorrection(m + 1L) + StirlingCorrection(nm); } nK = n - K + 1L; // computation of log f(K) via Stirling's formula // final acceptance-rejection test if (V <= ch + (n + 1.0)*std::log((double) nm / (double) nK) + (K + 0.5)*std::log(nK * pq / (K + 1.0)) - StirlingCorrection(K + 1L) - StirlingCorrection(nK)) break; } } } return ((p>0.5) ? (double)(n-K):(double)K); } std::ostream & RandBinomial::put ( std::ostream & os ) const { int pr=os.precision(20); std::vector t(2); os << " " << name() << "\n"; os << "Uvec" << "\n"; t = DoubConv::dto2longs(defaultP); os << defaultN << " " << defaultP << " " << t[0] << " " << t[1] << "\n"; os.precision(pr); return os; #ifdef REMOVED int pr=os.precision(20); os << " " << name() << "\n"; os << defaultN << " " << defaultP << "\n"; os.precision(pr); return os; #endif } std::istream & RandBinomial::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } if (possibleKeywordInput(is, "Uvec", defaultN)) { std::vector t(2); is >> defaultN >> defaultP; is >> t[0] >> t[1]; defaultP = DoubConv::longs2double(t); return is; } // is >> defaultN encompassed by possibleKeywordInput is >> defaultP; return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/engineIDulong.cc0000644000175000017500000000270611406204345017446 0ustar olesoles// $Id: // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- engineIDulong --- // function implementation file // ----------------------------------------------------------------------- // // ======================================================================= // Mark Fischler - Created: Mar. 8, 2005 // ======================================================================= #include #include namespace CLHEP { static std::vector gen_crc_table() { /* generate the table of CRC remainders for all possible bytes */ static const unsigned long POLYNOMIAL = 0x04c11db7UL; std::vector crc_table; for ( unsigned long i = 0; i < 256; ++i ) { unsigned long crc = i << 24; for ( int j = 0; j < 8; j++ ) { if ( crc & 0x80000000UL ) { crc = ( ( crc << 1 ) ^ POLYNOMIAL ) & 0xffffffffUL; } else { crc = ( crc << 1 ) & 0xffffffffUL; } } crc_table.push_back(crc); } return crc_table; } unsigned long crc32ul(const std::string & s) { static std::vector crc_table = gen_crc_table(); unsigned long crc = 0; int end = s.length(); for (int j = 0; j != end; ++j) { int i = ( (int) ( crc >> 24) ^ s[j] ) & 0xff; crc = ( ( crc << 8 ) ^ crc_table[i] ) & 0xffffffffUL; } return crc; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandGaussQ.cc0000755000175000017500000001363211753236267016747 0ustar olesoles// $Id: RandGaussQ.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGaussQ --- // class implementation file // ----------------------------------------------------------------------- // ======================================================================= // M Fischler - Created 24 Jan 2000 // M Fischler - put and get to/from streams 12/13/04 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandGaussQ.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include // for std::log() namespace CLHEP { std::string RandGaussQ::name() const {return "RandGaussQ";} HepRandomEngine & RandGaussQ::engine() {return RandGauss::engine();} RandGaussQ::~RandGaussQ() { } double RandGaussQ::operator()() { return transformQuick(localEngine->flat()) * defaultStdDev + defaultMean; } double RandGaussQ::operator()( double mean, double stdDev ) { return transformQuick(localEngine->flat()) * stdDev + mean; } void RandGaussQ::shootArray( const int size, double* vect, double mean, double stdDev ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot(mean,stdDev); } void RandGaussQ::shootArray( HepRandomEngine* anEngine, const int size, double* vect, double mean, double stdDev ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot(anEngine,mean,stdDev); } void RandGaussQ::fireArray( const int size, double* vect) { for( double* v = vect; v != vect + size; ++v ) *v = fire( defaultMean, defaultStdDev ); } void RandGaussQ::fireArray( const int size, double* vect, double mean, double stdDev ) { for( double* v = vect; v != vect + size; ++v ) *v = fire( mean, stdDev ); } // // Table of errInts, for use with transform(r) and quickTransform(r) // // Since all these are this is static to this compilation unit only, the // info is establised a priori and not at each invocation. // The main data is of course the gaussQTables table; the rest is all // bookkeeping to know what the tables mean. #define Table0size 250 #define Table1size 1000 #define TableSize (Table0size+Table1size) #define Table0step (2.0E-6) #define Table1step (5.0E-4) #define Table0scale (1.0/Table1step) #define Table0offset 0 #define Table1offset (Table0size) // Here comes the big (5K bytes) table, kept in a file --- static const float gaussTables [TableSize] = { #include "gaussQTables.cdat" }; double RandGaussQ::transformQuick (double r) { double sign = +1.0; // We always compute a negative number of // sigmas. For r > 0 we will multiply by // sign = -1 to return a positive number. if ( r > .5 ) { r = 1-r; sign = -1.0; } register int index; double dx; if ( r >= Table1step ) { index = int((Table1size<<1) * r); // 1 to Table1size if (index == Table1size) return 0.0; dx = (Table1size<<1) * r - index; // fraction of way to next bin index += Table1offset-1; } else if ( r > Table0step ) { double rr = r * Table0scale; index = int(Table0size * rr); // 1 to Table0size dx = Table0size * rr - index; // fraction of way to next bin index += Table0offset-1; } else { // r <= Table0step - not in tables return sign*transformSmall(r); } double y0 = gaussTables [index++]; double y1 = gaussTables [index]; return (float) (sign * ( y1 * dx + y0 * (1.0-dx) )); } // transformQuick() double RandGaussQ::transformSmall (double r) { // Solve for -v in the asymtotic formula // // errInt (-v) = std::exp(-v*v/2) 1 1*3 1*3*5 // ------------ * (1 - ---- + ---- - ----- + ... ) // v*std::sqrt(2*pi) v**2 v**4 v**6 // The value of r (=errInt(-v)) supplied is going to less than 2.0E-13, // which is such that v < -7.25. Since the value of r is meaningful only // to an absolute error of 1E-16 (double precision accuracy for a number // which on the high side could be of the form 1-epsilon), computing // v to more than 3-4 digits of accuracy is suspect; however, to ensure // smoothness with the table generator (which uses quite a few terms) we // also use terms up to 1*3*5* ... *13/v**14, and insist on accuracy of // solution at the level of 1.0e-7. // This routine is called less than one time in a million firings, so // speed is of no concern. As a matter of technique, we terminate the // iterations in case they would be infinite, but this should not happen. double eps = 1.0e-7; double guess = 7.5; double v; for ( int i = 1; i < 50; i++ ) { double vn2 = 1.0/(guess*guess); double s1 = -13*11*9*7*5*3 * vn2*vn2*vn2*vn2*vn2*vn2*vn2; s1 += 11*9*7*5*3 * vn2*vn2*vn2*vn2*vn2*vn2; s1 += -9*7*5*3 * vn2*vn2*vn2*vn2*vn2; s1 += 7*5*3 * vn2*vn2*vn2*vn2; s1 += -5*3 * vn2*vn2*vn2; s1 += 3 * vn2*vn2 - vn2 + 1.0; v = std::sqrt ( 2.0 * std::log ( s1 / (r*guess*std::sqrt(CLHEP::twopi)) ) ); if ( std::fabs(v-guess) < eps ) break; guess = v; } return -v; } // transformSmall() std::ostream & RandGaussQ::put ( std::ostream & os ) const { int pr=os.precision(20); os << " " << name() << "\n"; RandGauss::put(os); os.precision(pr); return os; } std::istream & RandGaussQ::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } RandGauss::get(is); return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandBreitWigner.cc0000755000175000017500000002171111753236267017762 0ustar olesoles// $Id: RandBreitWigner.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandBreitWigner --- // class implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Added methods to shoot arrays: 28th July 1997 // J.Marraffino - Added default arguments as attributes and // operator() with arguments: 16th Feb 1998 // M Fischler - put and get to/from streams 12/10/04 // M Fischler - put/get to/from streams uses pairs of ulongs when // + storing doubles avoid problems with precision // 4/14/05 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandBreitWigner.h" #include "CLHEP/Units/PhysicalConstants.h" #include "CLHEP/Random/DoubConv.hh" #include // for min() and max() #include namespace CLHEP { std::string RandBreitWigner::name() const {return "RandBreitWigner";} HepRandomEngine & RandBreitWigner::engine() {return *localEngine;} RandBreitWigner::~RandBreitWigner() { } double RandBreitWigner::operator()() { return fire( defaultA, defaultB ); } double RandBreitWigner::operator()( double a, double b ) { return fire( a, b ); } double RandBreitWigner::operator()( double a, double b, double c ) { return fire( a, b, c ); } double RandBreitWigner::shoot(double mean, double gamma) { double rval, displ; rval = 2.0*HepRandom::getTheEngine()->flat()-1.0; displ = 0.5*gamma*std::tan(rval*CLHEP::halfpi); return mean + displ; } double RandBreitWigner::shoot(double mean, double gamma, double cut) { double val, rval, displ; if ( gamma == 0.0 ) return mean; val = std::atan(2.0*cut/gamma); rval = 2.0*HepRandom::getTheEngine()->flat()-1.0; displ = 0.5*gamma*std::tan(rval*val); return mean + displ; } double RandBreitWigner::shootM2(double mean, double gamma ) { double val, rval, displ; if ( gamma == 0.0 ) return mean; val = std::atan(-mean/gamma); rval = RandFlat::shoot(val, CLHEP::halfpi); displ = gamma*std::tan(rval); return std::sqrt(mean*mean + mean*displ); } double RandBreitWigner::shootM2(double mean, double gamma, double cut ) { double rval, displ; double lower, upper, tmp; if ( gamma == 0.0 ) return mean; tmp = std::max(0.0,(mean-cut)); lower = std::atan( (tmp*tmp-mean*mean)/(mean*gamma) ); upper = std::atan( ((mean+cut)*(mean+cut)-mean*mean)/(mean*gamma) ); rval = RandFlat::shoot(lower, upper); displ = gamma*std::tan(rval); return std::sqrt(std::max(0.0, mean*mean + mean*displ)); } void RandBreitWigner::shootArray ( const int size, double* vect ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot( 1.0, 0.2 ); } void RandBreitWigner::shootArray ( const int size, double* vect, double a, double b ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot( a, b ); } void RandBreitWigner::shootArray ( const int size, double* vect, double a, double b, double c ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot( a, b, c ); } //---------------- double RandBreitWigner::shoot(HepRandomEngine* anEngine, double mean, double gamma) { double rval, displ; rval = 2.0*anEngine->flat()-1.0; displ = 0.5*gamma*std::tan(rval*CLHEP::halfpi); return mean + displ; } double RandBreitWigner::shoot(HepRandomEngine* anEngine, double mean, double gamma, double cut ) { double val, rval, displ; if ( gamma == 0.0 ) return mean; val = std::atan(2.0*cut/gamma); rval = 2.0*anEngine->flat()-1.0; displ = 0.5*gamma*std::tan(rval*val); return mean + displ; } double RandBreitWigner::shootM2(HepRandomEngine* anEngine, double mean, double gamma ) { double val, rval, displ; if ( gamma == 0.0 ) return mean; val = std::atan(-mean/gamma); rval = RandFlat::shoot(anEngine,val, CLHEP::halfpi); displ = gamma*std::tan(rval); return std::sqrt(mean*mean + mean*displ); } double RandBreitWigner::shootM2(HepRandomEngine* anEngine, double mean, double gamma, double cut ) { double rval, displ; double lower, upper, tmp; if ( gamma == 0.0 ) return mean; tmp = std::max(0.0,(mean-cut)); lower = std::atan( (tmp*tmp-mean*mean)/(mean*gamma) ); upper = std::atan( ((mean+cut)*(mean+cut)-mean*mean)/(mean*gamma) ); rval = RandFlat::shoot(anEngine, lower, upper); displ = gamma*std::tan(rval); return std::sqrt( std::max(0.0, mean*mean+mean*displ) ); } void RandBreitWigner::shootArray ( HepRandomEngine* anEngine, const int size, double* vect ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot( anEngine, 1.0, 0.2 ); } void RandBreitWigner::shootArray ( HepRandomEngine* anEngine, const int size, double* vect, double a, double b ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot( anEngine, a, b ); } void RandBreitWigner::shootArray ( HepRandomEngine* anEngine, const int size, double* vect, double a, double b, double c ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot( anEngine, a, b, c ); } //---------------- double RandBreitWigner::fire() { return fire( defaultA, defaultB ); } double RandBreitWigner::fire(double mean, double gamma) { double rval, displ; rval = 2.0*localEngine->flat()-1.0; displ = 0.5*gamma*std::tan(rval*CLHEP::halfpi); return mean + displ; } double RandBreitWigner::fire(double mean, double gamma, double cut) { double val, rval, displ; if ( gamma == 0.0 ) return mean; val = std::atan(2.0*cut/gamma); rval = 2.0*localEngine->flat()-1.0; displ = 0.5*gamma*std::tan(rval*val); return mean + displ; } double RandBreitWigner::fireM2() { return fireM2( defaultA, defaultB ); } double RandBreitWigner::fireM2(double mean, double gamma ) { double val, rval, displ; if ( gamma == 0.0 ) return mean; val = std::atan(-mean/gamma); rval = RandFlat::shoot(localEngine.get(),val, CLHEP::halfpi); displ = gamma*std::tan(rval); return std::sqrt(mean*mean + mean*displ); } double RandBreitWigner::fireM2(double mean, double gamma, double cut ) { double rval, displ; double lower, upper, tmp; if ( gamma == 0.0 ) return mean; tmp = std::max(0.0,(mean-cut)); lower = std::atan( (tmp*tmp-mean*mean)/(mean*gamma) ); upper = std::atan( ((mean+cut)*(mean+cut)-mean*mean)/(mean*gamma) ); rval = RandFlat::shoot(localEngine.get(),lower, upper); displ = gamma*std::tan(rval); return std::sqrt(std::max(0.0, mean*mean + mean*displ)); } void RandBreitWigner::fireArray ( const int size, double* vect) { for( double* v = vect; v != vect + size; ++v ) *v = fire(defaultA, defaultB ); } void RandBreitWigner::fireArray ( const int size, double* vect, double a, double b ) { for( double* v = vect; v != vect + size; ++v ) *v = fire( a, b ); } void RandBreitWigner::fireArray ( const int size, double* vect, double a, double b, double c ) { for( double* v = vect; v != vect + size; ++v ) *v = fire( a, b, c ); } std::ostream & RandBreitWigner::put ( std::ostream & os ) const { int pr=os.precision(20); std::vector t(2); os << " " << name() << "\n"; os << "Uvec" << "\n"; t = DoubConv::dto2longs(defaultA); os << defaultA << " " << t[0] << " " << t[1] << "\n"; t = DoubConv::dto2longs(defaultB); os << defaultB << " " << t[0] << " " << t[1] << "\n"; os.precision(pr); return os; #ifdef REMOVED int pr=os.precision(20); os << " " << name() << "\n"; os << defaultA << " " << defaultB << "\n"; os.precision(pr); return os; #endif } std::istream & RandBreitWigner::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } if (possibleKeywordInput(is, "Uvec", defaultA)) { std::vector t(2); is >> defaultA >> t[0] >> t[1]; defaultA = DoubConv::longs2double(t); is >> defaultB >> t[0] >> t[1]; defaultB = DoubConv::longs2double(t); return is; } // is >> defaultA encompassed by possibleKeywordInput is >> defaultB; return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/MTwistEngine.cc0000755000175000017500000002717511753236267017323 0ustar olesoles// $Id: MTwistEngine.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- MTwistEngine --- // class implementation file // ----------------------------------------------------------------------- // A "fast, compact, huge-period generator" based on M. Matsumoto and // T. Nishimura, "Mersenne Twister: A 623-dimensionally equidistributed // uniform pseudorandom number generator", to appear in ACM Trans. on // Modeling and Computer Simulation. It is a twisted GFSR generator // with a Mersenne-prime period of 2^19937-1, uniform on open interval (0,1) // ======================================================================= // Ken Smith - Started initial draft: 14th Jul 1998 // - Optimized to get std::pow() out of flat() method // - Added conversion operators: 6th Aug 1998 // J. Marraffino - Added some explicit casts to deal with // machines where sizeof(int) != sizeof(long) 22 Aug 1998 // M. Fischler - Modified constructors such that no two // seeds will match sequences, no single/double // seeds will match, explicit seeds give // determined results, and default will not // match any of the above or other defaults. // - Modified use of the various exponents of 2 // to avoid per-instance space overhead and // correct the rounding procedure 16 Sep 1998 // J. Marfaffino - Remove dependence on hepString class 13 May 1999 // M. Fischler - In restore, checkFile for file not found 03 Dec 2004 // M. Fischler - Methods for distrib. instacne save/restore 12/8/04 // M. Fischler - split get() into tag validation and // getState() for anonymous restores 12/27/04 // M. Fischler - put/get for vectors of ulongs 3/14/05 // M. Fischler - State-saving using only ints, for portability 4/12/05 // M. Fischler - Improved seeding in setSeed (Savanah bug #17479) 11/15/06 // - (Possible optimization - now that the seeding is improved, // is it still necessary for ctor to "warm up" by discarding // 2000 iterations?) // // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Random/MTwistEngine.h" #include "CLHEP/Random/engineIDulong.h" #include // for strcmp #include // for std::abs(int) namespace CLHEP { static const int MarkerLen = 64; // Enough room to hold a begin or end marker. std::string MTwistEngine::name() const {return "MTwistEngine";} int MTwistEngine::numEngines = 0; int MTwistEngine::maxIndex = 215; MTwistEngine::MTwistEngine() : HepRandomEngine() { int cycle = std::abs(int(numEngines/maxIndex)); int curIndex = std::abs(int(numEngines%maxIndex)); long mask = ((cycle & 0x007fffff) << 8); long seedlist[2]; HepRandom::getTheTableSeeds( seedlist, curIndex ); seedlist[0] = (seedlist[0])^mask; seedlist[1] = 0; setSeeds( seedlist, numEngines ); count624=0; ++numEngines; for( int i=0; i < 2000; ++i ) flat(); // Warm up just a bit } MTwistEngine::MTwistEngine(long seed) : HepRandomEngine() { long seedlist[2]={seed,17587}; setSeeds( seedlist, 0 ); count624=0; for( int i=0; i < 2000; ++i ) flat(); // Warm up just a bit } MTwistEngine::MTwistEngine(int rowIndex, int colIndex) : HepRandomEngine() { int cycle = std::abs(int(rowIndex/maxIndex)); int row = std::abs(int(rowIndex%maxIndex)); int col = std::abs(int(colIndex%2)); long mask = (( cycle & 0x000007ff ) << 20 ); long seedlist[2]; HepRandom::getTheTableSeeds( seedlist, row ); seedlist[0] = (seedlist[col])^mask; seedlist[1] = 690691; setSeeds(seedlist, 4444772); count624=0; for( int i=0; i < 2000; ++i ) flat(); // Warm up just a bit } MTwistEngine::MTwistEngine( std::istream& is ) : HepRandomEngine() { is >> *this; } MTwistEngine::~MTwistEngine() {} double MTwistEngine::flat() { unsigned int y; if( count624 >= N ) { register int i; for( i=0; i < NminusM; ++i ) { y = (mt[i] & 0x80000000) | (mt[i+1] & 0x7fffffff); mt[i] = mt[i+M] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 ); } for( ; i < N-1 ; ++i ) { y = (mt[i] & 0x80000000) | (mt[i+1] & 0x7fffffff); mt[i] = mt[i-NminusM] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 ); } y = (mt[i] & 0x80000000) | (mt[0] & 0x7fffffff); mt[i] = mt[M-1] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 ); count624 = 0; } y = mt[count624]; y ^= ( y >> 11); y ^= ((y << 7 ) & 0x9d2c5680); y ^= ((y << 15) & 0xefc60000); y ^= ( y >> 18); return y * twoToMinus_32() + // Scale to range (mt[count624++] >> 11) * twoToMinus_53() + // fill remaining bits nearlyTwoToMinus_54(); // make sure non-zero } void MTwistEngine::flatArray( const int size, double *vect ) { for( int i=0; i < size; ++i) vect[i] = flat(); } void MTwistEngine::setSeed(long seed, int k) { // MF 11/15/06 - Change seeding algorithm to a newer one recommended // by Matsumoto: The original algorithm was // mt[i] = (69069 * mt[i-1]) & 0xffffffff and this gives // problems when the seed bit pattern has lots of zeros // (for example, 0x08000000). Savanah bug #17479. theSeed = seed ? seed : 4357; int mti; const int N1=624; mt[0] = (unsigned int) (theSeed&0xffffffffUL); for (mti=1; mti> 30)) + mti); /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ /* In the previous versions, MSBs of the seed affect */ /* only MSBs of the array mt[]. */ /* 2002/01/09 modified by Makoto Matsumoto */ mt[mti] &= 0xffffffffUL; /* for >32 bit machines */ } for( int i=1; i < 624; ++i ) { mt[i] ^= k; // MF 9/16/98: distinguish starting points } // MF 11/15/06 This distinction of starting points based on values of k // is kept even though the seeding algorithm itself is improved. } void MTwistEngine::setSeeds(const long *seeds, int k) { setSeed( (*seeds ? *seeds : 43571346), k ); int i; for( i=1; i < 624; ++i ) { mt[i] = ( seeds[1] + mt[i] ) & 0xffffffff; // MF 9/16/98 } theSeeds = seeds; } void MTwistEngine::saveStatus( const char filename[] ) const { std::ofstream outFile( filename, std::ios::out ) ; if (!outFile.bad()) { outFile << theSeed << std::endl; for (int i=0; i<624; ++i) outFile <> theSeed; for (int i=0; i<624; ++i) inFile >> mt[i]; inFile >> count624; } } void MTwistEngine::showStatus() const { std::cout << std::endl; std::cout << "--------- MTwist engine status ---------" << std::endl; std::cout << std::setprecision(20); std::cout << " Initial seed = " << theSeed << std::endl; std::cout << " Current index = " << count624 << std::endl; std::cout << " Array status mt[] = " << std::endl; for (int i=0; i<624; i+=5) { std::cout << mt[i] << " " << mt[i+1] << " " << mt[i+2] << " " << mt[i+3] << " " << mt[i+4] << std::endl; } std::cout << "----------------------------------------" << std::endl; } MTwistEngine::operator float() { unsigned int y; if( count624 >= N ) { register int i; for( i=0; i < NminusM; ++i ) { y = (mt[i] & 0x80000000) | (mt[i+1] & 0x7fffffff); mt[i] = mt[i+M] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 ); } for( ; i < N-1 ; ++i ) { y = (mt[i] & 0x80000000) | (mt[i+1] & 0x7fffffff); mt[i] = mt[i-NminusM] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 ); } y = (mt[i] & 0x80000000) | (mt[0] & 0x7fffffff); mt[i] = mt[M-1] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 ); count624 = 0; } y = mt[count624++]; y ^= ( y >> 11); y ^= ((y << 7 ) & 0x9d2c5680); y ^= ((y << 15) & 0xefc60000); y ^= ( y >> 18); return (float)(y * twoToMinus_32()); } MTwistEngine::operator unsigned int() { unsigned int y; if( count624 >= N ) { register int i; for( i=0; i < NminusM; ++i ) { y = (mt[i] & 0x80000000) | (mt[i+1] & 0x7fffffff); mt[i] = mt[i+M] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 ); } for( ; i < N-1 ; ++i ) { y = (mt[i] & 0x80000000) | (mt[i+1] & 0x7fffffff); mt[i] = mt[i-NminusM] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 ); } y = (mt[i] & 0x80000000) | (mt[0] & 0x7fffffff); mt[i] = mt[M-1] ^ (y >> 1) ^ ((y & 0x1) ? 0x9908b0df : 0x0 ); count624 = 0; } y = mt[count624++]; y ^= ( y >> 11); y ^= ((y << 7 ) & 0x9d2c5680); y ^= ((y << 15) & 0xefc60000); y ^= ( y >> 18); return y; } std::ostream & MTwistEngine::put ( std::ostream& os ) const { char beginMarker[] = "MTwistEngine-begin"; char endMarker[] = "MTwistEngine-end"; int pr = os.precision(20); os << " " << beginMarker << " "; os << theSeed << " "; for (int i=0; i<624; ++i) { os << mt[i] << "\n"; } os << count624 << " "; os << endMarker << "\n"; os.precision(pr); return os; } std::vector MTwistEngine::put () const { std::vector v; v.push_back (engineIDulong()); for (int i=0; i<624; ++i) { v.push_back(static_cast(mt[i])); } v.push_back(count624); return v; } std::istream & MTwistEngine::get ( std::istream& is ) { char beginMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"MTwistEngine-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput stream mispositioned or" << "\nMTwistEngine state description missing or" << "\nwrong engine type found." << std::endl; return is; } return getState(is); } std::string MTwistEngine::beginTag ( ) { return "MTwistEngine-begin"; } std::istream & MTwistEngine::getState ( std::istream& is ) { char endMarker [MarkerLen]; is >> theSeed; for (int i=0; i<624; ++i) is >> mt[i]; is >> count624; is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"MTwistEngine-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nMTwistEngine state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; return is; } return is; } bool MTwistEngine::get (const std::vector & v) { if ((v[0] & 0xffffffffUL) != engineIDulong()) { std::cerr << "\nMTwistEngine get:state vector has wrong ID word - state unchanged\n"; return false; } return getState(v); } bool MTwistEngine::getState (const std::vector & v) { if (v.size() != VECTOR_STATE_SIZE ) { std::cerr << "\nMTwistEngine get:state vector has wrong length - state unchanged\n"; return false; } for (int i=0; i<624; ++i) { mt[i]=v[i+1]; } count624 = v[625]; return true; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/.cvsignore0000755000175000017500000000001407705453233016412 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Random/src/flatToGaussian.cc0000755000175000017500000002223411753236267017661 0ustar olesoles// $Id: flatToGaussian.cc,v 1.4 2003/08/13 20:00:12 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- flatToGaussian --- // class implementation file // ----------------------------------------------------------------------- // Contains the methods that depend on the 30K-footpring gaussTables.cdat. // // flatToGaussian (double x) // inverseErf (double x) // erf (double x) // ======================================================================= // M Fischler - Created 1/25/00. // // ======================================================================= #include "CLHEP/Random/Stat.h" #include "CLHEP/Random/defs.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include namespace CLHEP { double transformSmall (double r); // // Table of errInts, for use with transform(r) and quickTransform(r) // #ifdef Traces #define Trace1 #define Trace2 #define Trace3 #endif // Since all these are this is static to this compilation unit only, the // info is establised a priori and not at each invocation. // The main data is of course the gaussTables table; the rest is all // bookkeeping to know what the tables mean. #define Table0size 200 #define Table1size 250 #define Table2size 200 #define Table3size 250 #define Table4size 1000 #define TableSize (Table0size+Table1size+Table2size+Table3size+Table4size) static const int Tsizes[5] = { Table0size, Table1size, Table2size, Table3size, Table4size }; #define Table0step (2.0E-13) #define Table1step (4.0E-11) #define Table2step (1.0E-8) #define Table3step (2.0E-6) #define Table4step (5.0E-4) static const double Tsteps[5] = { Table0step, Table1step, Table2step, Table3step, Table4step }; #define Table0offset 0 #define Table1offset (2*(Table0size)) #define Table2offset (2*(Table0size + Table1size)) #define Table3offset (2*(Table0size + Table1size + Table2size)) #define Table4offset (2*(Table0size + Table1size + Table2size + Table3size)) static const int Toffsets[5] = { Table0offset, Table1offset, Table2offset, Table3offset, Table4offset }; // Here comes the big (30K bytes) table, kept in a file --- static const double gaussTables [2*TableSize] = { #include "gaussTables.cdat" }; double HepStat::flatToGaussian (double r) { double sign = +1.0; // We always compute a negative number of // sigmas. For r > 0 we will multiply by // sign = -1 to return a positive number. #ifdef Trace1 std::cout << "r = " << r << "\n"; #endif if ( r > .5 ) { r = 1-r; sign = -1.0; #ifdef Trace1 std::cout << "r = " << r << "sign negative \n"; #endif } else if ( r == .5 ) { return 0.0; } // Find a pointer to the proper table entries, along with the fraction // of the way in the relevant bin dx and the bin size h. // Optimize for the case of table 4 by testing for that first. // By removing that case from the for loop below, we save not only // several table lookups, but also several index calculations that // now become (compile-time) constants. // // Past the case of table 4, we need not be as concerned about speed since // this will happen only .1% of the time. const double* tptr = 0; double dx = 0; double h = 0; // The following big if block will locate tptr, h, and dx from whichever // table is applicable: register int index; if ( r >= Table4step ) { index = int((Table4size<<1) * r); // 1 to Table4size-1 if (index <= 0) index = 1; // in case of rounding problem if (index >= Table4size) index = Table4size-1; dx = (Table4size<<1) * r - index; // fraction of way to next bin h = Table4step; #ifdef Trace2 std::cout << "index = " << index << " dx = " << dx << " h = " << h << "\n"; #endif index = (index<<1) + (Table4offset-2); // at r = table4step+eps, index refers to the start of table 4 // and at r = .5 - eps, index refers to the next-to-last entry: // remember, the table has two numbers per actual entry. #ifdef Trace2 std::cout << "offset index = " << index << "\n"; #endif tptr = &gaussTables [index]; } else if (r < Tsteps[0]) { // If r is so small none of the tables apply, use the asymptotic formula. return (sign * transformSmall (r)); } else { for ( int tableN = 3; tableN >= 0; tableN-- ) { if ( r < Tsteps[tableN] ) {continue;} // can't happen when tableN==0 #ifdef Trace2 std::cout << "Using table " << tableN << "\n"; #endif double step = Tsteps[tableN]; index = int(r/step); // 1 to TableNsize-1 // The following two tests should probably never be true, but // roundoff might cause index to be outside its proper range. // In such a case, the interpolation still makes sense, but we // need to take care that tptr points to valid data in the right table. if (index == 0) index = 1; if (index >= Tsizes[tableN]) index = Tsizes[tableN] - 1; dx = r/step - index; // fraction of way to next bin h = step; #ifdef Trace2 std::cout << "index = " << index << " dx = " << dx << " h = " << h << "\n"; #endif index = (index<<1) + Toffsets[tableN] - 2; tptr = &gaussTables [index]; break; } // end of the for loop which finds tptr, dx and h in one of the tables // The code can only get to here by a break statement, having set dx etc. // It not get to here without going through one of the breaks, // because before the for loop we test for the case of r < Tsteps[0]. } // End of the big if block. // At the end of this if block, we have tptr, dx and h -- and if r is less // than the smallest step, we have already returned the proper answer. double y0 = *tptr++; double d0 = *tptr++; double y1 = *tptr++; double d1 = *tptr; #ifdef Trace3 std::cout << "y0: " << y0 << " y1: " << y1 << " d0: " << d0 << " d1: " << d1 << "\n"; #endif double x2 = dx * dx; double oneMinusX = 1 - dx; double oneMinusX2 = oneMinusX * oneMinusX; double f0 = (2. * dx + 1.) * oneMinusX2; double f1 = (3. - 2. * dx) * x2; double g0 = h * dx * oneMinusX2; double g1 = - h * oneMinusX * x2; #ifdef Trace3 std::cout << "f0: " << f0 << " f1: " << f1 << " g0: " << g0 << " g1: " << g1 << "\n"; #endif double answer = f0 * y0 + f1 * y1 + g0 * d0 + g1 * d1; #ifdef Trace1 std::cout << "variate is: " << sign*answer << "\n"; #endif return sign * answer; } // flatToGaussian double transformSmall (double r) { // Solve for -v in the asymtotic formula // // errInt (-v) = std::exp(-v*v/2) 1 1*3 1*3*5 // ------------ * (1 - ---- + ---- - ----- + ... ) // v*std::sqrt(2*pi) v**2 v**4 v**6 // The value of r (=errInt(-v)) supplied is going to less than 2.0E-13, // which is such that v < -7.25. Since the value of r is meaningful only // to an absolute error of 1E-16 (double precision accuracy for a number // which on the high side could be of the form 1-epsilon), computing // v to more than 3-4 digits of accuracy is suspect; however, to ensure // smoothness with the table generator (which uses quite a few terms) we // also use terms up to 1*3*5* ... *13/v**14, and insist on accuracy of // solution at the level of 1.0e-7. // This routine is called less than one time in a trillion firings, so // speed is of no concern. As a matter of technique, we terminate the // iterations in case they would be infinite, but this should not happen. double eps = 1.0e-7; double guess = 7.5; double v; for ( int i = 1; i < 50; i++ ) { double vn2 = 1.0/(guess*guess); double s1 = -13*11*9*7*5*3 * vn2*vn2*vn2*vn2*vn2*vn2*vn2; s1 += 11*9*7*5*3 * vn2*vn2*vn2*vn2*vn2*vn2; s1 += -9*7*5*3 * vn2*vn2*vn2*vn2*vn2; s1 += 7*5*3 * vn2*vn2*vn2*vn2; s1 += -5*3 * vn2*vn2*vn2; s1 += 3 * vn2*vn2 - vn2 + 1.0; v = std::sqrt ( 2.0 * std::log ( s1 / (r*guess*std::sqrt(CLHEP::twopi)) ) ); if ( std::abs(v-guess) < eps ) break; guess = v; } return -v; } // transformSmall() double HepStat::inverseErf (double t) { // This uses erf(x) = 2*gaussCDF(std::sqrt(2)*x) - 1 return std::sqrt(0.5) * flatToGaussian(.5*(t+1)); } double HepStat::erf (double x) { // Math: // // For any given x we can "quickly" find t0 = erfQ (x) = erf(x) + epsilon. // // Then we can find x1 = inverseErf (t0) = inverseErf (erf(x)+epsilon) // // Expanding in the small epsion, // // x1 = x + epsilon * [deriv(inverseErf(u),u) at u = t0] + O(epsilon**2) // // so epsilon is (x1-x) / [deriv(inverseErf(u),u) at u = t0] + O(epsilon**2) // // But the derivative of an inverse function is one over the derivative of the // function, so // epsilon = (x1-x) * [deriv(erf(v),v) at v = x] + O(epsilon**2) // // And the definition of the erf integral makes that derivative trivial. // Ultimately, // // erf(x) = erfQ(x) - (inverseErf(erfQ(x))-x) * std::exp(-x**2) * 2/std::sqrt(CLHEP::pi) // double t0 = erfQ(x); double deriv = std::exp(-x*x) * (2.0 / std::sqrt(CLHEP::pi)); return t0 - (inverseErf (t0) - x) * deriv; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandStudentT.cc0000755000175000017500000001304011753236267017307 0ustar olesoles// $Id: RandStudentT.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandStudentT --- // class implementation file // ----------------------------------------------------------------------- // ======================================================================= // John Marraffino - Created: 12th May 1998 // G.Cosmo - Fixed minor bug on inline definition for shoot() // methods : 20th Aug 1998 // M Fischler - put and get to/from streams 12/13/04 // M Fischler - put/get to/from streams uses pairs of ulongs when // + storing doubles avoid problems with precision // 4/14/05 // ======================================================================= #include #include // for std::log() std::exp() #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandStudentT.h" #include "CLHEP/Random/DoubConv.hh" namespace CLHEP { std::string RandStudentT::name() const {return "RandStudentT";} HepRandomEngine & RandStudentT::engine() {return *localEngine;} RandStudentT::~RandStudentT() { } double RandStudentT::operator()() { return fire( defaultA ); } double RandStudentT::operator()( double a ) { return fire( a ); } double RandStudentT::shoot( double a ) { /****************************************************************** * * * Student-t Distribution - Polar Method * * * ****************************************************************** * * * The polar method of Box/Muller for generating Normal variates * * is adapted to the Student-t distribution. The two generated * * variates are not independent and the expected no. of uniforms * * per variate is 2.5464. * * * ****************************************************************** * * * FUNCTION : - tpol samples a random number from the * * Student-t distribution with parameter a > 0. * * REFERENCE : - R.W. Bailey (1994): Polar generation of random * * variates with the t-distribution, Mathematics * * of Computation 62, 779-781. * * SUBPROGRAM : - ... (0,1)-Uniform generator * * * * * * Implemented by F. Niederl, 1994 * ******************************************************************/ double u,v,w; // Check for valid input value if( a < 0.0) return (DBL_MAX); do { u = 2.0 * HepRandom::getTheEngine()->flat() - 1.0; v = 2.0 * HepRandom::getTheEngine()->flat() - 1.0; } while ((w = u * u + v * v) > 1.0); return(u * std::sqrt( a * ( std::exp(- 2.0 / a * std::log(w)) - 1.0) / w)); } void RandStudentT::shootArray( const int size, double* vect, double a ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot(a); } void RandStudentT::shootArray( HepRandomEngine* anEngine, const int size, double* vect, double a ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot(anEngine,a); } double RandStudentT::fire( double a ) { double u,v,w; do { u = 2.0 * localEngine->flat() - 1.0; v = 2.0 * localEngine->flat() - 1.0; } while ((w = u * u + v * v) > 1.0); return(u * std::sqrt( a * ( std::exp(- 2.0 / a * std::log(w)) - 1.0) / w)); } void RandStudentT::fireArray( const int size, double* vect) { for( double* v = vect; v != vect + size; ++v ) *v = fire(defaultA); } void RandStudentT::fireArray( const int size, double* vect, double a ) { for( double* v = vect; v != vect + size; ++v ) *v = fire(a); } double RandStudentT::shoot( HepRandomEngine *anEngine, double a ) { double u,v,w; do { u = 2.0 * anEngine->flat() - 1.0; v = 2.0 * anEngine->flat() - 1.0; } while ((w = u * u + v * v) > 1.0); return(u * std::sqrt( a * ( std::exp(- 2.0 / a * std::log(w)) - 1.0) / w)); } std::ostream & RandStudentT::put ( std::ostream & os ) const { int pr=os.precision(20); std::vector t(2); os << " " << name() << "\n"; os << "Uvec" << "\n"; t = DoubConv::dto2longs(defaultA); os << defaultA << " " << t[0] << " " << t[1] << "\n"; os.precision(pr); return os; #ifdef REMOVED int pr=os.precision(20); os << " " << name() << "\n"; os << defaultA << "\n"; os.precision(pr); return os; #endif } std::istream & RandStudentT::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } if (possibleKeywordInput(is, "Uvec", defaultA)) { std::vector t(2); is >> defaultA >> t[0] >> t[1]; defaultA = DoubConv::longs2double(t); return is; } // is >> defaultA encompassed by possibleKeywordInput return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandGamma.cc0000755000175000017500000001771511753236267016574 0ustar olesoles// $Id: RandGamma.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGamma --- // class implementation file // ----------------------------------------------------------------------- // ======================================================================= // John Marraffino - Created: 12th May 1998 // M Fischler - put and get to/from streams 12/13/04 // M Fischler - put/get to/from streams uses pairs of ulongs when // + storing doubles avoid problems with precision // 4/14/05 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandGamma.h" #include "CLHEP/Random/DoubConv.hh" #include // for std::log() namespace CLHEP { std::string RandGamma::name() const {return "RandGamma";} HepRandomEngine & RandGamma::engine() {return *localEngine;} RandGamma::~RandGamma() { } double RandGamma::shoot( HepRandomEngine *anEngine, double k, double lambda ) { return genGamma( anEngine, k, lambda ); } double RandGamma::shoot( double k, double lambda ) { HepRandomEngine *anEngine = HepRandom::getTheEngine(); return genGamma( anEngine, k, lambda ); } double RandGamma::fire( double k, double lambda ) { return genGamma( localEngine.get(), k, lambda ); } void RandGamma::shootArray( const int size, double* vect, double k, double lambda ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot(k,lambda); } void RandGamma::shootArray( HepRandomEngine* anEngine, const int size, double* vect, double k, double lambda ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot(anEngine,k,lambda); } void RandGamma::fireArray( const int size, double* vect) { for( double* v = vect; v != vect + size; ++v ) *v = fire(defaultK,defaultLambda); } void RandGamma::fireArray( const int size, double* vect, double k, double lambda ) { for( double* v = vect; v != vect + size; ++v ) *v = fire(k,lambda); } double RandGamma::genGamma( HepRandomEngine *anEngine, double a, double lambda ) { /************************************************************************* * Gamma Distribution - Rejection algorithm gs combined with * * Acceptance complement method gd * *************************************************************************/ static double aa = -1.0, aaa = -1.0, b, c, d, e, r, s, si, ss, q0, q1 = 0.0416666664, q2 = 0.0208333723, q3 = 0.0079849875, q4 = 0.0015746717, q5 = -0.0003349403, q6 = 0.0003340332, q7 = 0.0006053049, q8 = -0.0004701849, q9 = 0.0001710320, a1 = 0.333333333, a2 = -0.249999949, a3 = 0.199999867, a4 =-0.166677482, a5 = 0.142873973, a6 =-0.124385581, a7 = 0.110368310, a8 = -0.112750886, a9 = 0.104089866, e1 = 1.000000000, e2 = 0.499999994, e3 = 0.166666848, e4 = 0.041664508, e5 = 0.008345522, e6 = 0.001353826, e7 = 0.000247453; double gds,p,q,t,sign_u,u,v,w,x; double v1,v2,v12; // Check for invalid input values if( a <= 0.0 ) return (-1.0); if( lambda <= 0.0 ) return (-1.0); if (a < 1.0) { // CASE A: Acceptance rejection algorithm gs b = 1.0 + 0.36788794412 * a; // Step 1 for(;;) { p = b * anEngine->flat(); if (p <= 1.0) { // Step 2. Case gds <= 1 gds = std::exp(std::log(p) / a); if (std::log(anEngine->flat()) <= -gds) return(gds/lambda); } else { // Step 3. Case gds > 1 gds = - std::log ((b - p) / a); if (std::log(anEngine->flat()) <= ((a - 1.0) * std::log(gds))) return(gds/lambda); } } } else { // CASE B: Acceptance complement algorithm gd if (a != aa) { // Step 1. Preparations aa = a; ss = a - 0.5; s = std::sqrt(ss); d = 5.656854249 - 12.0 * s; } // Step 2. Normal deviate do { v1 = 2.0 * anEngine->flat() - 1.0; v2 = 2.0 * anEngine->flat() - 1.0; v12 = v1*v1 + v2*v2; } while ( v12 > 1.0 ); t = v1*std::sqrt(-2.0*std::log(v12)/v12); x = s + 0.5 * t; gds = x * x; if (t >= 0.0) return(gds/lambda); // Immediate acceptance u = anEngine->flat(); // Step 3. Uniform random number if (d * u <= t * t * t) return(gds/lambda); // Squeeze acceptance if (a != aaa) { // Step 4. Set-up for hat case aaa = a; r = 1.0 / a; q0 = ((((((((q9 * r + q8) * r + q7) * r + q6) * r + q5) * r + q4) * r + q3) * r + q2) * r + q1) * r; if (a > 3.686) { if (a > 13.022) { b = 1.77; si = 0.75; c = 0.1515 / s; } else { b = 1.654 + 0.0076 * ss; si = 1.68 / s + 0.275; c = 0.062 / s + 0.024; } } else { b = 0.463 + s - 0.178 * ss; si = 1.235; c = 0.195 / s - 0.079 + 0.016 * s; } } if (x > 0.0) // Step 5. Calculation of q { v = t / (s + s); // Step 6. if (std::fabs(v) > 0.25) { q = q0 - s * t + 0.25 * t * t + (ss + ss) * std::log(1.0 + v); } else { q = q0 + 0.5 * t * t * ((((((((a9 * v + a8) * v + a7) * v + a6) * v + a5) * v + a4) * v + a3) * v + a2) * v + a1) * v; } // Step 7. Quotient acceptance if (std::log(1.0 - u) <= q) return(gds/lambda); } for(;;) { // Step 8. Double exponential deviate t do { e = -std::log(anEngine->flat()); u = anEngine->flat(); u = u + u - 1.0; sign_u = (u > 0)? 1.0 : -1.0; t = b + (e * si) * sign_u; } while (t <= -0.71874483771719); // Step 9. Rejection of t v = t / (s + s); // Step 10. New q(t) if (std::fabs(v) > 0.25) { q = q0 - s * t + 0.25 * t * t + (ss + ss) * std::log(1.0 + v); } else { q = q0 + 0.5 * t * t * ((((((((a9 * v + a8) * v + a7) * v + a6) * v + a5) * v + a4) * v + a3) * v + a2) * v + a1) * v; } if (q <= 0.0) continue; // Step 11. if (q > 0.5) { w = std::exp(q) - 1.0; } else { w = ((((((e7 * q + e6) * q + e5) * q + e4) * q + e3) * q + e2) * q + e1) * q; } // Step 12. Hat acceptance if ( c * u * sign_u <= w * std::exp(e - 0.5 * t * t)) { x = s + 0.5 * t; return(x*x/lambda); } } } } std::ostream & RandGamma::put ( std::ostream & os ) const { int pr=os.precision(20); std::vector t(2); os << " " << name() << "\n"; os << "Uvec" << "\n"; t = DoubConv::dto2longs(defaultK); os << defaultK << " " << t[0] << " " << t[1] << "\n"; t = DoubConv::dto2longs(defaultLambda); os << defaultLambda << " " << t[0] << " " << t[1] << "\n"; os.precision(pr); return os; #ifdef REMOVED int pr=os.precision(20); os << " " << name() << "\n"; os << defaultK << " " << defaultLambda << "\n"; os.precision(pr); return os; #endif } std::istream & RandGamma::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } if (possibleKeywordInput(is, "Uvec", defaultK)) { std::vector t(2); is >> defaultK >> t[0] >> t[1]; defaultK = DoubConv::longs2double(t); is >> defaultLambda>>t[0]>>t[1]; defaultLambda = DoubConv::longs2double(t); return is; } // is >> defaultK encompassed by possibleKeywordInput is >> defaultLambda; return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RanluxEngine.cc0000755000175000017500000004427611753236267017346 0ustar olesoles// $Id: RanluxEngine.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RanluxEngine --- // class implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // // Ranlux random number generator originally implemented in FORTRAN77 // by Fred James as part of the MATHLIB HEP library. // 'RanluxEngine' is designed to fit into the CLHEP random number // class structure. // =============================================================== // Adeyemi Adesanya - Created: 6th November 1995 // Gabriele Cosmo - Adapted & Revised: 22nd November 1995 // Adeyemi Adesanya - Added setSeeds() method: 2nd February 1996 // Gabriele Cosmo - Added flatArray() method: 8th February 1996 // - Minor corrections: 31st October 1996 // - Added methods for engine status: 19th November 1996 // - Fixed bug in setSeeds(): 15th September 1997 // J.Marraffino - Added stream operators and related constructor. // Added automatic seed selection from seed table and // engine counter: 14th Feb 1998 // - Fixed bug: setSeeds() requires a zero terminated // array of seeds: 19th Feb 1998 // Ken Smith - Added conversion operators: 6th Aug 1998 // J. Marraffino - Remove dependence on hepString class 13 May 1999 // M. Fischler - In restore, checkFile for file not found 03 Dec 2004 // M. Fischler - Methods put, getfor instance save/restore 12/8/04 // M. Fischler - split get() into tag validation and // getState() for anonymous restores 12/27/04 // M. Fischler - put/get for vectors of ulongs 3/14/05 // M. Fischler - State-saving using only ints, for portability 4/12/05 // // =============================================================== #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Random/RanluxEngine.h" #include "CLHEP/Random/engineIDulong.h" #include // for strcmp #include // for std::abs(int) #ifdef TRACE_IO #include "CLHEP/Random/DoubConv.hh" bool flat_trace = false; #endif namespace CLHEP { static const int MarkerLen = 64; // Enough room to hold a begin or end marker. std::string RanluxEngine::name() const {return "RanluxEngine";} // Number of instances with automatic seed selection int RanluxEngine::numEngines = 0; // Maximum index into the seed table int RanluxEngine::maxIndex = 215; RanluxEngine::RanluxEngine(long seed, int lux) : HepRandomEngine() { long seedlist[2]={0,0}; luxury = lux; setSeed(seed, luxury); // setSeeds() wants a zero terminated array! seedlist[0]=theSeed; seedlist[1]=0; setSeeds(seedlist, luxury); } RanluxEngine::RanluxEngine() : HepRandomEngine() { long seed; long seedlist[2]={0,0}; luxury = 3; int cycle = std::abs(int(numEngines/maxIndex)); int curIndex = std::abs(int(numEngines%maxIndex)); numEngines +=1; long mask = ((cycle & 0x007fffff) << 8); HepRandom::getTheTableSeeds( seedlist, curIndex ); seed = seedlist[0]^mask; setSeed(seed, luxury); // setSeeds() wants a zero terminated array! seedlist[0]=theSeed; seedlist[1]=0; setSeeds(seedlist, luxury); } RanluxEngine::RanluxEngine(int rowIndex, int colIndex, int lux) : HepRandomEngine() { long seed; long seedlist[2]={0,0}; luxury = lux; int cycle = std::abs(int(rowIndex/maxIndex)); int row = std::abs(int(rowIndex%maxIndex)); int col = std::abs(int(colIndex%2)); long mask = (( cycle & 0x000007ff ) << 20 ); HepRandom::getTheTableSeeds( seedlist, row ); seed = ( seedlist[col] )^mask; setSeed(seed, luxury); // setSeeds() wants a zero terminated array! seedlist[0]=theSeed; seedlist[1]=0; setSeeds(seedlist, luxury); } RanluxEngine::RanluxEngine( std::istream& is ) : HepRandomEngine() { is >> *this; } RanluxEngine::~RanluxEngine() {} void RanluxEngine::setSeed(long seed, int lux) { // The initialisation is carried out using a Multiplicative // Congruential generator using formula constants of L'Ecuyer // as described in "A review of pseudorandom number generators" // (Fred James) published in Computer Physics Communications 60 (1990) // pages 329-344 const int ecuyer_a = 53668; const int ecuyer_b = 40014; const int ecuyer_c = 12211; const int ecuyer_d = 2147483563; const int lux_levels[5] = {0,24,73,199,365}; long int_seed_table[24]; long next_seed = seed; long k_multiple; int i; // number of additional random numbers that need to be 'thrown away' // every 24 numbers is set using luxury level variable. theSeed = seed; if( (lux > 4)||(lux < 0) ){ if(lux >= 24){ nskip = lux - 24; }else{ nskip = lux_levels[3]; // corresponds to default luxury level } }else{ luxury = lux; nskip = lux_levels[luxury]; } for(i = 0;i != 24;i++){ k_multiple = next_seed / ecuyer_a; next_seed = ecuyer_b * (next_seed - k_multiple * ecuyer_a) - k_multiple * ecuyer_c ; if(next_seed < 0)next_seed += ecuyer_d; int_seed_table[i] = next_seed % int_modulus; } for(i = 0;i != 24;i++) float_seed_table[i] = int_seed_table[i] * mantissa_bit_24(); i_lag = 23; j_lag = 9; carry = 0. ; if( float_seed_table[23] == 0. ) carry = mantissa_bit_24(); count24 = 0; } void RanluxEngine::setSeeds(const long *seeds, int lux) { const int ecuyer_a = 53668; const int ecuyer_b = 40014; const int ecuyer_c = 12211; const int ecuyer_d = 2147483563; const int lux_levels[5] = {0,24,73,199,365}; int i; long int_seed_table[24]; long k_multiple,next_seed; const long *seedptr; theSeeds = seeds; seedptr = seeds; if(seeds == 0){ setSeed(theSeed,lux); theSeeds = &theSeed; return; } theSeed = *seeds; // number of additional random numbers that need to be 'thrown away' // every 24 numbers is set using luxury level variable. if( (lux > 4)||(lux < 0) ){ if(lux >= 24){ nskip = lux - 24; }else{ nskip = lux_levels[3]; // corresponds to default luxury level } }else{ luxury = lux; nskip = lux_levels[luxury]; } for( i = 0;(i != 24)&&(*seedptr != 0);i++){ int_seed_table[i] = *seedptr % int_modulus; seedptr++; } if(i != 24){ next_seed = int_seed_table[i-1]; for(;i != 24;i++){ k_multiple = next_seed / ecuyer_a; next_seed = ecuyer_b * (next_seed - k_multiple * ecuyer_a) - k_multiple * ecuyer_c ; if(next_seed < 0)next_seed += ecuyer_d; int_seed_table[i] = next_seed % int_modulus; } } for(i = 0;i != 24;i++) float_seed_table[i] = int_seed_table[i] * mantissa_bit_24(); i_lag = 23; j_lag = 9; carry = 0. ; if( float_seed_table[23] == 0. ) carry = mantissa_bit_24(); count24 = 0; } void RanluxEngine::saveStatus( const char filename[] ) const { std::ofstream outFile( filename, std::ios::out ) ; if (!outFile.bad()) { outFile << "Uvec\n"; std::vector v = put(); #ifdef TRACE_IO std::cout << "Result of v = put() is:\n"; #endif for (unsigned int i=0; i v; unsigned long xin; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { inFile >> xin; #ifdef TRACE_IO std::cout << "ivec = " << ivec << " xin = " << xin << " "; if (ivec%3 == 0) std::cout << "\n"; #endif if (!inFile) { inFile.clear(std::ios::badbit | inFile.rdstate()); std::cerr << "\nRanluxEngine state (vector) description improper." << "\nrestoreStatus has failed." << "\nInput stream is probably mispositioned now." << std::endl; return; } v.push_back(xin); } getState(v); return; } if (!inFile.bad() && !inFile.eof()) { // inFile >> theSeed; removed -- encompased by possibleKeywordInput for (int i=0; i<24; ++i) inFile >> float_seed_table[i]; inFile >> i_lag; inFile >> j_lag; inFile >> carry; inFile >> count24; inFile >> luxury; inFile >> nskip; } } void RanluxEngine::showStatus() const { std::cout << std::endl; std::cout << "--------- Ranlux engine status ---------" << std::endl; std::cout << " Initial seed = " << theSeed << std::endl; std::cout << " float_seed_table[] = "; for (int i=0; i<24; ++i) std::cout << float_seed_table[i] << " "; std::cout << std::endl; std::cout << " i_lag = " << i_lag << ", j_lag = " << j_lag << std::endl; std::cout << " carry = " << carry << ", count24 = " << count24 << std::endl; std::cout << " luxury = " << luxury << " nskip = " << nskip << std::endl; std::cout << "----------------------------------------" << std::endl; } double RanluxEngine::flat() { float next_random; float uni; int i; uni = float_seed_table[j_lag] - float_seed_table[i_lag] - carry; #ifdef TRACE_IO if (flat_trace) { std::cout << "float_seed_table[" << j_lag << "] = " << float_seed_table[j_lag] << " float_seed_table[" << i_lag << "] = " << float_seed_table[i_lag] << " uni = " << uni << "\n"; std::cout << float_seed_table[j_lag] << " - " << float_seed_table[i_lag] << " - " << carry << " = " << (double)float_seed_table[j_lag] - (double) float_seed_table[i_lag] - (double)carry << "\n"; } #endif if(uni < 0. ){ uni += 1.0; carry = mantissa_bit_24(); }else{ carry = 0.; } float_seed_table[i_lag] = uni; i_lag --; j_lag --; if(i_lag < 0) i_lag = 23; if(j_lag < 0) j_lag = 23; if( uni < mantissa_bit_12() ){ uni += mantissa_bit_24() * float_seed_table[j_lag]; if( uni == 0) uni = mantissa_bit_24() * mantissa_bit_24(); } next_random = uni; count24 ++; // every 24th number generation, several random numbers are generated // and wasted depending upon the luxury level. if(count24 == 24 ){ count24 = 0; #ifdef TRACE_IO if (flat_trace) { std::cout << "carry = " << carry << "\n"; } #endif for( i = 0; i != nskip ; i++){ uni = float_seed_table[j_lag] - float_seed_table[i_lag] - carry; if(uni < 0. ){ uni += 1.0; carry = mantissa_bit_24(); }else{ carry = 0.; } float_seed_table[i_lag] = uni; #ifdef TRACE_IO if (flat_trace) { double xfst = float_seed_table[i_lag]; std::cout << "fst[" << i_lag << "] = " << DoubConv::d2x(xfst) << "\n"; } #endif i_lag --; j_lag --; if(i_lag < 0)i_lag = 23; if(j_lag < 0) j_lag = 23; } } #ifdef TRACE_IO if (flat_trace) { std::cout << "next_random = " << next_random << "\n"; // flat_trace = false; } #endif return (double) next_random; } void RanluxEngine::flatArray(const int size, double* vect) { float next_random; float uni; int i; int index; for (index=0; index>16) & 0xff); // needed because Ranlux doesn't fill all bits of the double // which therefore doesn't fill all bits of the integer. } std::ostream & RanluxEngine::put ( std::ostream& os ) const { char beginMarker[] = "RanluxEngine-begin"; os << beginMarker << "\nUvec\n"; std::vector v = put(); for (unsigned int i=0; i RanluxEngine::put () const { std::vector v; v.push_back (engineIDulong()); #ifdef TRACE_IO std::cout << "RanluxEngine put: ID is " << v[0] << "\n"; #endif for (int i=0; i<24; ++i) { v.push_back (static_cast(float_seed_table[i]/mantissa_bit_24())); #ifdef TRACE_IO std::cout << "v[" << i+1 << "] = " << v[i+1] << " float_seed_table[" << i << "] = " << float_seed_table[i] << "\n"; #endif } v.push_back(static_cast(i_lag)); v.push_back(static_cast(j_lag)); v.push_back(static_cast(carry/mantissa_bit_24())); v.push_back(static_cast(count24)); v.push_back(static_cast(luxury)); v.push_back(static_cast(nskip)); #ifdef TRACE_IO std::cout << "i_lag: " << v[25] << " j_lag: " << v[26] << " carry: " << v[27] << "\n"; std::cout << "count24: " << v[28] << " luxury: " << v[29] << " nskip: " << v[30] << "\n"; #endif #ifdef TRACE_IO flat_trace = true; #endif return v; } std::istream & RanluxEngine::get ( std::istream& is ) { char beginMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"RanluxEngine-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput stream mispositioned or" << "\nRanluxEngine state description missing or" << "\nwrong engine type found." << std::endl; return is; } return getState(is); } std::string RanluxEngine::beginTag ( ) { return "RanluxEngine-begin"; } std::istream & RanluxEngine::getState ( std::istream& is ) { if ( possibleKeywordInput ( is, "Uvec", theSeed ) ) { std::vector v; unsigned long uu; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { is >> uu; if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nRanluxEngine state (vector) description improper." << "\ngetState() has failed." << "\nInput stream is probably mispositioned now." << std::endl; return is; } v.push_back(uu); #ifdef TRACE_IO std::cout << "RanluxEngine::getState -- v[" << v.size()-1 << "] = " << v[v.size()-1] << "\n"; #endif } getState(v); return (is); } // is >> theSeed; Removed, encompassed by possibleKeywordInput() char endMarker [MarkerLen]; for (int i=0; i<24; ++i) { is >> float_seed_table[i]; } is >> i_lag; is >> j_lag; is >> carry; is >> count24; is >> luxury; is >> nskip; is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"RanluxEngine-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nRanluxEngine state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; return is; } return is; } bool RanluxEngine::get (const std::vector & v) { if ((v[0] & 0xffffffffUL) != engineIDulong()) { std::cerr << "\nRanluxEngine get:state vector has wrong ID word - state unchanged\n"; return false; } return getState(v); } bool RanluxEngine::getState (const std::vector & v) { if (v.size() != VECTOR_STATE_SIZE ) { std::cerr << "\nRanluxEngine get:state vector has wrong length - state unchanged\n"; return false; } for (int i=0; i<24; ++i) { float_seed_table[i] = v[i+1]*mantissa_bit_24(); #ifdef TRACE_IO std::cout << "float_seed_table[" << i << "] = " << float_seed_table[i] << "\n"; #endif } i_lag = v[25]; j_lag = v[26]; carry = v[27]*mantissa_bit_24(); count24 = v[28]; luxury = v[29]; nskip = v[30]; #ifdef TRACE_IO std::cout << "i_lag: " << i_lag << " j_lag: " << j_lag << " carry: " << carry << "\n"; std::cout << "count24: " << count24 << " luxury: " << luxury << " nskip: " << nskip << "\n"; #endif #ifdef TRACE_IO flat_trace = true; #endif return true; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandGaussZiggurat.cc0000644000175000017500000001151012236214257020321 0ustar olesoles#include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandGaussZiggurat.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include // for log() namespace CLHEP { bool RandGaussZiggurat::ziggurat_is_init=RandGaussZiggurat::ziggurat_init(); //bool RandGaussZiggurat::ziggurat_is_init=false; unsigned long RandGaussZiggurat::kn[128], RandGaussZiggurat::ke[256]; float RandGaussZiggurat::wn[128],RandGaussZiggurat::fn[128],RandGaussZiggurat::we[256],RandGaussZiggurat::fe[256]; HepRandomEngine & RandGaussZiggurat::engine() {return RandGauss::engine();} RandGaussZiggurat::~RandGaussZiggurat() { } std::string RandGaussZiggurat::name() const { return "RandGaussZiggurat"; } bool RandGaussZiggurat::ziggurat_init() { const double rzm1 = 2147483648.0, rzm2 = 4294967296.; double dn=3.442619855899,tn=dn,vn=9.91256303526217e-3, q; double de=7.697117470131487, te=de, ve=3.949659822581572e-3; int i; /* Set up tables for RNOR */ q=vn/exp(-.5*dn*dn); kn[0]=(unsigned long)((dn/q)*rzm1); kn[1]=0; wn[0]=q/rzm1; wn[127]=dn/rzm1; fn[0]=1.; fn[127]=exp(-.5*dn*dn); for(i=126;i>=1;i--) { dn=sqrt(-2.*log(vn/dn+exp(-.5*dn*dn))); kn[i+1]=(unsigned long)((dn/tn)*rzm1); tn=dn; fn[i]=exp(-.5*dn*dn); wn[i]=dn/rzm1; } /* Set up tables for REXP */ q = ve/exp(-de); ke[0]=(unsigned long)((de/q)*rzm2); ke[1]=0; we[0]=q/rzm2; we[255]=de/rzm2; fe[0]=1.; fe[255]=exp(-de); for(i=254;i>=1;i--) { de=-log(ve/de+exp(-de)); ke[i+1]= (unsigned long)((de/te)*rzm2); te=de; fe[i]=exp(-de); we[i]=de/rzm2; } ziggurat_is_init=true; //std::cout<<"Done RandGaussZiggurat::ziggurat_init()"<0)? r+x : -r-x; } /* iz>0, handle the wedges of other strips */ if( fn[iz]+(1.0 - ziggurat_UNI(anEngine))*(fn[iz-1]-fn[iz]) < exp(-.5*x*x) ) return x; /* initiate, try to exit for(;;) for loop*/ hz=(signed)ziggurat_SHR3(anEngine); iz=hz&127; if((unsigned long)abs(hz)> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } RandGauss::get(is); return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/Hurd160Engine.cc0000755000175000017500000002640311753236267017216 0ustar olesoles// $Id: Hurd160Engine.cc,v 1.7 2010/07/20 18:07:17 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // Ken Smith - Initial draft started: 23rd Jul 1998 // - Added conversion operators: 6th Aug 1998 // J. Marraffino - Added some explicit casts to deal with // machines where sizeof(int) != sizeof(long) 22 Aug 1998 // M. Fischler - Modified use of the various exponents of 2 // to avoid per-instance space overhead and // correct the rounding procedure 15 Sep 1998 // - Modified various methods to avoid any // possibility of predicting the next number // based on the last several: We skip one // 32-bit word per cycle. 15 Sep 1998 // - modify word[0] in two of the constructors // so that no sequence can ever accidentally // be produced by differnt seeds. 15 Sep 1998 // J. Marraffino - Remove dependence on hepStrings class 13 May 1999 // M. Fischler - Put endl at end of a save 10 Apr 2001 // M. Fischler - In restore, checkFile for file not found 03 Dec 2004 // M. Fischler - Methods put, get for instance save/restore 12/8/04 // M. Fischler - split get() into tag validation and // getState() for anonymous restores 12/27/04 // M. Fischler - put/get for vectors of ulongs 3/14/05 // M. Fischler - State-saving using only ints, for portability 4/12/05 // // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Random/Hurd160Engine.h" #include "CLHEP/Random/engineIDulong.h" #include // for strcmp #include // for std::abs(int) namespace CLHEP { static const int MarkerLen = 64; // Enough room to hold a begin or end marker. std::string Hurd160Engine::name() const {return "Hurd160Engine";} // Number of instances with automatic seed selection int Hurd160Engine::numEngines = 0; // Maximum index into the seed table int Hurd160Engine::maxIndex = 215; static inline unsigned int f160(unsigned int a, unsigned int b, unsigned int c) { return ( ((b<<2) & 0x7c) | ((a<<2) & ~0x7c) | (a>>30) ) ^ ( (c<<1)|(c>>31) ); } Hurd160Engine::Hurd160Engine() : HepRandomEngine() { int cycle = std::abs(int(numEngines/maxIndex)); int curIndex = std::abs(int(numEngines%maxIndex)); long mask = ((cycle & 0x007fffff) << 8); long seedlist[2]; HepRandom::getTheTableSeeds( seedlist, curIndex ); seedlist[0] ^= mask; seedlist[1] = 0; setSeeds(seedlist, 0); words[0] ^= 0x1324abcd; // To make unique vs long or two unsigned if (words[0]==0) words[0] = 1; // ints in the constructor ++numEngines; for( int i=0; i < 100; ++i ) flat(); // warm-up just a bit } Hurd160Engine::Hurd160Engine( std::istream& is ) : HepRandomEngine() { is >> *this; } Hurd160Engine::Hurd160Engine( long seed ) : HepRandomEngine() { long seedlist[2]={seed,0}; setSeeds(seedlist, 0); words[0] ^= 0xa5482134; // To make unique vs default two unsigned if (words[0]==0) words[0] = 1; // ints in the constructor for( int i=0; i < 100; ++i ) flat(); // warm-up just a bit } Hurd160Engine::Hurd160Engine( int rowIndex, int colIndex ) : HepRandomEngine() { int cycle = std::abs(int(rowIndex/maxIndex)); int row = std::abs(int(rowIndex%maxIndex)); int col = colIndex & 0x1; long mask = (( cycle & 0x000007ff ) << 20 ); long seedlist[2]; HepRandom::getTheTableSeeds( seedlist, row ); // NOTE: is that really the seed wanted (PGC) ?? seedlist[0] = (seedlist[col])^mask; seedlist[1]= 0; setSeeds(seedlist, 0); for( int i=0; i < 100; ++i ) flat(); // warm-up just a bit } Hurd160Engine::~Hurd160Engine() { } void Hurd160Engine::advance() { register unsigned int W0, W1, W2, W3, W4; W0 = words[0]; W1 = words[1]; W2 = words[2]; W3 = words[3]; W4 = words[4]; W1 ^= W0; W0 = f160(W4, W3, W0); W2 ^= W1; W1 = f160(W0, W4, W1); W3 ^= W2; W2 = f160(W1, W0, W2); W4 ^= W3; W3 = f160(W2, W1, W3); W0 ^= W4; W4 = f160(W3, W2, W4); words[0] = W0 & 0xffffffff; words[1] = W1 & 0xffffffff; words[2] = W2 & 0xffffffff; words[3] = W3 & 0xffffffff; words[4] = W4 & 0xffffffff; wordIndex = 5; } // advance(); double Hurd160Engine::flat() { if( wordIndex <= 2 ) { // MF 9/15/98: // skip word 0 and use two words per flat advance(); } // LG 6/30/2010 // define the order of execution for --wordIndex double x = words[--wordIndex] * twoToMinus_32() ; // most significant part double y = (words[--wordIndex]>>11) * twoToMinus_53() + // fill in rest of bits nearlyTwoToMinus_54(); // make sure non-zero return x + y ; } void Hurd160Engine::flatArray( const int size, double* vect ) { for (int i = 0; i < size; ++i) { vect[i] = flat(); } } void Hurd160Engine::setSeed( long seed, int ) { words[0] = (unsigned int)seed; for (wordIndex = 1; wordIndex < 5; ++wordIndex) { words[wordIndex] = 69607 * words[wordIndex-1] + 54329; } } void Hurd160Engine::setSeeds( const long* seeds, int ) { setSeed( *seeds ? *seeds : 32767, 0 ); theSeeds = seeds; } void Hurd160Engine::saveStatus( const char filename[] ) const { std::ofstream outFile(filename, std::ios::out); if( !outFile.bad() ) { outFile << "Uvec\n"; std::vector v = put(); #ifdef TRACE_IO std::cout << "Result of v = put() is:\n"; #endif for (unsigned int i=0; i v; unsigned long xin; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { inFile >> xin; #ifdef TRACE_IO std::cout << "ivec = " << ivec << " xin = " << xin << " "; if (ivec%3 == 0) std::cout << "\n"; #endif if (!inFile) { inFile.clear(std::ios::badbit | inFile.rdstate()); std::cerr << "\nHurd160Engine state (vector) description improper." << "\nrestoreStatus has failed." << "\nInput stream is probably mispositioned now." << std::endl; return; } v.push_back(xin); } getState(v); return; } if( !inFile.bad() ) { // inFile >> theSeed; removed -- encompased by possibleKeywordInput inFile >> wordIndex; for( int i = 0; i < 5; ++i ) { inFile >> words[i]; } } } void Hurd160Engine::showStatus() const { int pr = std::cout.precision(20); std::cout << std::endl; std::cout << "----------- Hurd engine status ----------" << std::endl; std::cout << "Initial seed = " << theSeed << std::endl; std::cout << "Current index = " << wordIndex << std::endl; std::cout << "Current words = " << std::endl; for( int i = 0; i < 5 ; ++i ) { std::cout << " " << words[i] << std::endl; } std::cout << "------------------------------------------" << std::endl; std::cout.precision(pr); } Hurd160Engine::operator float() { if( wordIndex <= 1 ) { // MF 9/15/98: skip word 0 advance(); } return words[--wordIndex ] * twoToMinus_32(); } Hurd160Engine::operator unsigned int() { if( wordIndex <= 1 ) { // MF 9/15/98: skip word 0 advance(); } return words[--wordIndex]; } std::ostream& Hurd160Engine::put(std::ostream& os) const { char beginMarker[] = "Hurd160Engine-begin"; os << beginMarker << "\nUvec\n"; std::vector v = put(); for (unsigned int i=0; i Hurd160Engine::put () const { std::vector v; v.push_back (engineIDulong()); v.push_back(static_cast(wordIndex)); for (int i = 0; i < 5; ++i) { v.push_back(static_cast(words[i])); } return v; } std::istream& Hurd160Engine::get(std::istream& is) { char beginMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"Hurd160Engine-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput mispositioned or" << "\nHurd160Engine state description missing or" << "\nwrong engine type found." << std::endl; return is; } return getState(is); } std::string Hurd160Engine::beginTag ( ) { return "Hurd160Engine-begin"; } std::istream& Hurd160Engine::getState(std::istream& is) { if ( possibleKeywordInput ( is, "Uvec", theSeed ) ) { std::vector v; unsigned long uu; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { is >> uu; if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nHurd160Engine state (vector) description improper." << "\ngetState() has failed." << "\nInput stream is probably mispositioned now." << std::endl; return is; } v.push_back(uu); } getState(v); return (is); } // is >> theSeed; Removed, encompassed by possibleKeywordInput() char endMarker [MarkerLen]; is >> wordIndex; for (int i = 0; i < 5; ++i) { is >> words[i]; } is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"Hurd160Engine-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nHurd160Engine state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; return is; } return is; } bool Hurd160Engine::get (const std::vector & v) { if ((v[0] & 0xffffffffUL) != engineIDulong()) { std::cerr << "\nHurd160Engine get:state vector has wrong ID word - state unchanged\n"; return false; } return getState(v); } bool Hurd160Engine::getState (const std::vector & v) { if (v.size() != VECTOR_STATE_SIZE ) { std::cerr << "\nHurd160Engine get:state vector has wrong length - state unchanged\n"; return false; } wordIndex = v[1]; for (int i = 0; i < 5; ++i) { words[i] = v[i+2]; } return true; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/StaticRandomStates.cc0000644000175000017500000000455610233771102020475 0ustar olesoles// $Id: // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- StaticRandomStates --- // class implementation file // ----------------------------------------------------------------------- // // ======================================================================= // Mark Fischler - Created: Dec. 21, 2004 // Mark Fischler - Modified restore() to utilize anonymous engine input // to create anonymous restore of the static distributions // // ======================================================================= #include "CLHEP/Random/StaticRandomStates.h" #include "CLHEP/Random/RandGauss.h" #include "CLHEP/Random/RandFlat.h" #include #include //======================// // // // Maintenance warning: // // // //======================// // // Currently, only two distributions (RandFlat and RandGauss) have cached // distribution state. All such distributions must be saved below, so if // another such distribution is added, this implementation file must be // modified to reflect that. namespace CLHEP { std::ostream & StaticRandomStates::save(std::ostream & os){ RandGauss::saveFullState(os); RandFlat::saveDistState(os); return os; } #ifdef NOTYET std::istream & StaticRandomStates::restore(std::istream & is) { RandGauss::restoreFullState(is); RandFlat::restoreDistState(is); return is; } #endif std::istream & StaticRandomStates::restore(std::istream & is) { HepRandomEngine * e = HepRandom::getTheEngine(); HepRandomEngine *ne = HepRandomEngine::newEngine(is); if ( !is ) return is; if ( !ne ) return is; if (ne->name() == e->name()) { // Because e has const data members, cannot simply do *e = *ne std::ostringstream os; os << *ne; std::istringstream istst(os.str()); istst >> *e; if (!istst) { std::cerr << "???? Unexpected behavior in StaticRandomStates::restore:\n" << "The new engine, which had been input successfully from istream\n" << "has encountered a problem when used to set state of theEngine\n"; is.clear(std::ios::badbit | is.rdstate()); return is; } } else { HepRandom::setTheEngine(ne); } RandGauss::restoreDistState(is); RandFlat::restoreDistState(is); return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/CMakeLists.txt0000644000175000017500000000166212221102474017144 0ustar olesoles clhep_build_library( Random DoubConv.cc DRand48Engine.cc DualRand.cc EngineFactory.cc engineIDulong.cc erfQ.cc flatToGaussian.cc gammln.cc Hurd160Engine.cc Hurd288Engine.cc JamesRandom.cc MTwistEngine.cc NonRandomEngine.cc RandBinomial.cc RandBit.cc RandBreitWigner.cc RandChiSquare.cc RandEngine.cc RandExponential.cc RandExpZiggurat.cc RandFlat.cc RandGamma.cc RandGauss.cc RandGaussQ.cc RandGaussT.cc RandGaussZiggurat.cc RandGeneral.cc RandLandau.cc Random.cc RandomEngine.cc RandPoisson.cc RandPoissonQ.cc RandPoissonT.cc RandSkewNormal.cc RandStudentT.cc RanecuEngine.cc Ranlux64Engine.cc RanluxEngine.cc RanshiEngine.cc StaticRandomStates.cc TripleRand.cc ) clhep-2.1.4.1.orig/Random/src/drand48.src0000755000175000017500000001450211406204345016365 0ustar olesoles// -*- C++ -*- // $Id: drand48.src,v 1.3 2010/06/16 17:24:53 garren Exp $ // --------------------------------------------------------------------------- // // This code is based on a code extracted from GNU C Library 2.1.3 with // a purpose to provide drand48() on Windows NT. // #include #include #include #define __LITTLE_ENDIAN 1234 #define __BIG_ENDIAN 4321 #ifdef __BIG_ENDIAN__ #define __BYTE_ORDER __BIG_ENDIAN /* powerpc-apple is big-endian. */ #else #define __BYTE_ORDER __LITTLE_ENDIAN /* i386 is little-endian. */ #endif #define __FLOAT_WORD_ORDER __BYTE_ORDER #define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ //#ifdef WIN32 //#include //typedef ULONGLONG u_int64_t; //#else typedef unsigned long long int u_int64_t; //#endif union ieee754_double { double d; /* This is the IEEE 754 double-precision format. */ struct { #if __BYTE_ORDER == __BIG_ENDIAN unsigned int negative:1; unsigned int exponent:11; /* Together these comprise the mantissa. */ unsigned int mantissa0:20; unsigned int mantissa1:32; #endif /* Big endian. */ #if __BYTE_ORDER == __LITTLE_ENDIAN #if __FLOAT_WORD_ORDER == BIG_ENDIAN unsigned int mantissa0:20; unsigned int exponent:11; unsigned int negative:1; unsigned int mantissa1:32; #else /* Together these comprise the mantissa. */ unsigned int mantissa1:32; unsigned int mantissa0:20; unsigned int exponent:11; unsigned int negative:1; #endif #endif /* Little endian. */ } ieee; }; /* Data structure for communication with thread safe versions. */ struct drand48_data { unsigned short int x[3]; /* Current state. */ unsigned short int a[3]; /* Factor in congruential formula. */ unsigned short int c; /* Additive const. in congruential formula. */ unsigned short int old_x[3]; /* Old state. */ int init; /* Flag for initializing. */ }; extern "C" { double drand48 (); int erand48_r (unsigned short int[3], drand48_data *, double *result); int drand48_iterate (unsigned short int[3], drand48_data *); void srand48 (long int); int srand48_r (long int, drand48_data *); unsigned short int * seed48 (unsigned short int[3]); int seed48_r (unsigned short int[3], drand48_data *); } /* Global state for non-reentrant functions. */ static drand48_data libc_drand48_data; // --------------------------------------------------------------------------- double drand48 () { double result; (void) erand48_r (libc_drand48_data.x, &libc_drand48_data, &result); return result; } // --------------------------------------------------------------------------- int erand48_r (unsigned short int xsubi[3], drand48_data *buffer, double *result) { union ieee754_double temp; /* Compute next state. */ if (drand48_iterate (xsubi, buffer) < 0) return -1; /* Construct a positive double with the 48 random bits distributed over its fractional part so the resulting FP number is [0.0,1.0). */ #if USHRT_MAX == 65535 temp.ieee.negative = 0; temp.ieee.exponent = IEEE754_DOUBLE_BIAS; temp.ieee.mantissa0 = (xsubi[2] << 4) | (xsubi[1] >> 12); temp.ieee.mantissa1 = ((xsubi[1] & 0xfff) << 20) | (xsubi[0] << 4); #elif USHRT_MAX == 2147483647 temp.ieee.negative = 0; temp.ieee.exponent = IEEE754_DOUBLE_BIAS; temp.ieee.mantissa0 = (xsubi[1] << 4) | (xsubi[0] >> 28); temp.ieee.mantissa1 = ((xsubi[0] & 0xfffffff) << 4); #else # error Unsupported size of short int #endif /* Please note the lower 4 bits of mantissa1 are always 0. */ *result = temp.d - 1.0; return 0; } // --------------------------------------------------------------------------- int drand48_iterate (unsigned short int xsubi[3], drand48_data *buffer) { u_int64_t X, a, result; /* Initialize buffer, if not yet done. */ if (!buffer->init) { #if (USHRT_MAX == 0xffffU) buffer->a[2] = 0x5; buffer->a[1] = 0xdeec; buffer->a[0] = 0xe66d; #else buffer->a[2] = 0x5deecUL; buffer->a[1] = 0xe66d0000UL; buffer->a[0] = 0; #endif buffer->c = 0xb; buffer->init = 1; } /* Do the real work. We choose a data type which contains at least 48 bits. Because we compute the modulus it does not care how many bits really are computed. */ X = (u_int64_t)xsubi[2] << 32 | (u_int64_t)xsubi[1] << 16 | xsubi[0]; a = ((u_int64_t)buffer->a[2] << 32 | (u_int64_t)buffer->a[1] << 16 | buffer->a[0]); result = X * a + buffer->c; xsubi[0] = result & 0xffff; xsubi[1] = (result >> 16) & 0xffff; xsubi[2] = (result >> 32) & 0xffff; return 0; } // --------------------------------------------------------------------------- void srand48 (long int seedval) { (void) srand48_r (seedval, &libc_drand48_data); } // --------------------------------------------------------------------------- int srand48_r (long int seedval, drand48_data *buffer) { /* The standards say we only have 32 bits. */ if (sizeof (long int) > 4) seedval &= 0xffffffffl; #if USHRT_MAX == 0xffffU buffer->x[2] = seedval >> 16; buffer->x[1] = seedval & 0xffffl; buffer->x[0] = 0x330e; buffer->a[2] = 0x5; buffer->a[1] = 0xdeec; buffer->a[0] = 0xe66d; #else buffer->x[2] = seedval; buffer->x[1] = 0x330e0000UL; buffer->x[0] = 0; buffer->a[2] = 0x5deecUL; buffer->a[1] = 0xe66d0000UL; buffer->a[0] = 0; #endif buffer->c = 0xb; buffer->init = 1; return 0; } // --------------------------------------------------------------------------- unsigned short int * seed48 (unsigned short int seed16v[3]) { (void) seed48_r (seed16v, &libc_drand48_data); return libc_drand48_data.old_x; } // --------------------------------------------------------------------------- int seed48_r (unsigned short int seed16v[3], drand48_data *buffer) { /* Save old value at a private place to be used as return value. */ memcpy (buffer->old_x, buffer->x, sizeof (buffer->x)); /* Install new state. */ #if USHRT_MAX == 0xffffU buffer->x[2] = seed16v[2]; buffer->x[1] = seed16v[1]; buffer->x[0] = seed16v[0]; buffer->a[2] = 0x5; buffer->a[1] = 0xdeec; buffer->a[0] = 0xe66d; #else buffer->x[2] = (seed16v[2] << 16) | seed16v[1]; buffer->x[1] = seed16v[0] << 16; buffer->x[0] = 0; buffer->a[2] = 0x5deecUL; buffer->a[1] = 0xe66d0000UL; buffer->a[0] = 0; #endif buffer->c = 0xb; buffer->init = 1; return 0; } clhep-2.1.4.1.orig/Random/src/RandSkewNormal.cc0000644000175000017500000001033211753236267017615 0ustar olesoles// $Id: RandSkewNormal.cc,v 1.1 2011/05/27 20:36:57 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandSkewNormal --- // class implementation file // ----------------------------------------------------------------------- // ======================================================================= // M Fischler and L Garren - Created: 26 May 2011 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandSkewNormal.h" #include "CLHEP/Random/RandGaussT.h" #include "CLHEP/Random/DoubConv.hh" namespace CLHEP { std::string RandSkewNormal::name() const {return "RandSkewNormal";} HepRandomEngine & RandSkewNormal::engine() {return *localEngine;} RandSkewNormal::~RandSkewNormal() {} double RandSkewNormal::operator()() { return fire( shapeParameter ); } double RandSkewNormal::operator()( double shape ) { return fire( shape ); } //------------- double RandSkewNormal::shoot(HepRandomEngine* anEngine) { // really dumb use of RandSkewNormal double k = 1; return gaussianSkewNormal( anEngine, k ); } double RandSkewNormal::shoot(HepRandomEngine* anEngine, double shape) { return gaussianSkewNormal( anEngine, shape ); } double RandSkewNormal::shoot() { // really dumb use of RandSkewNormal HepRandomEngine* anEngine = HepRandom::getTheEngine(); double k = 1; return gaussianSkewNormal( anEngine, k ); } double RandSkewNormal::shoot(double shape) { HepRandomEngine* anEngine = HepRandom::getTheEngine(); return gaussianSkewNormal( anEngine, shape ); } void RandSkewNormal::shootArray( const int size, double* vect, double shape ) { for( double* v = vect; v != vect+size; ++v ) *v = shoot(shape); } void RandSkewNormal::shootArray(HepRandomEngine* anEngine, const int size, double* vect, double shape ) { for( double* v = vect; v != vect+size; ++v ) *v = shoot(anEngine, shape); } //------------- double RandSkewNormal::fire() { return gaussianSkewNormal( getLocalEngine(), getShapeParameter() ); } double RandSkewNormal::fire(double shape) { return gaussianSkewNormal( getLocalEngine(), shape ); } void RandSkewNormal::fireArray( const int size, double* vect) { for( double* v = vect; v != vect+size; ++v ) *v = fire( shapeParameter ); } void RandSkewNormal::fireArray( const int size, double* vect, double shape ) { for( double* v = vect; v != vect+size; ++v ) *v = fire( shape ); } //------------- double RandSkewNormal::gaussianSkewNormal ( HepRandomEngine* e, double k) { // RandSkewNormal is an implementation of Azzalini's SN generator // http://azzalini.stat.unipd.it/SN/ // K. McFarlane, June 2010. // For location parameter m = 0., scale = 1. // To get a distribution with scale parameter b and location m: // r = m + b * RandSkewNormal.fire(k); double u[2] = {0.}; RandGaussT::shootArray(e, 2, u, 0, 1); double delta = k/std::sqrt(1. + k*k); double u1 = delta*u[0] + std::sqrt(1 - delta*delta)*u[1]; double r = u[0] >= 0 ? u1 : -u1; return r; } //------------- std::ostream & RandSkewNormal::put ( std::ostream & os ) const { int pr=os.precision(20); std::vector t(2); os << " " << name() << "\n"; os << "Uvec" << "\n"; t = DoubConv::dto2longs(shapeParameter); os << shapeParameter << " " << t[0] << " " << t[1] << "\n"; os.precision(pr); return os; } std::istream & RandSkewNormal::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } if (possibleKeywordInput(is, "Uvec", shapeParameter)) { std::vector t(2); is >> shapeParameter >> t[0] >> t[1]; shapeParameter = DoubConv::longs2double(t); return is; } // is >> shapeParameter encompassed by possibleKeywordInput return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandGaussT.cc0000755000175000017500000000513611406204345016735 0ustar olesoles// $Id: RandGaussT.cc,v 1.5 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandGaussT --- // class implementation file // ----------------------------------------------------------------------- // ======================================================================= // M Fischler - Created 04 Feb 2000 // M Fischler - put and get to/from streams 12/13/04 // M Fischler - operator() modified to use localEngine 12/13/04 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandGaussT.h" #include namespace CLHEP { std::string RandGaussT::name() const {return "RandGaussT";} HepRandomEngine & RandGaussT::engine() {return RandGauss::engine();} RandGaussT::~RandGaussT() { } double RandGaussT::operator()() { return HepStat::flatToGaussian(localEngine->flat()) * defaultStdDev + defaultMean; } double RandGaussT::operator()( double mean, double stdDev ) { return HepStat::flatToGaussian(localEngine->flat()) * stdDev + mean; } void RandGaussT::shootArray( const int size, double* vect, double mean, double stdDev ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot(mean,stdDev); } void RandGaussT::shootArray( HepRandomEngine* anEngine, const int size, double* vect, double mean, double stdDev ) { for( double* v = vect; v != vect + size; ++v ) *v = shoot(anEngine,mean,stdDev); } void RandGaussT::fireArray( const int size, double* vect) { for( double* v = vect; v != vect + size; ++v ) *v = fire( defaultMean, defaultStdDev ); } void RandGaussT::fireArray( const int size, double* vect, double mean, double stdDev ) { for( double* v = vect; v != vect + size; ++v ) *v = fire( mean, stdDev ); } std::ostream & RandGaussT::put ( std::ostream & os ) const { int pr=os.precision(20); os << " " << name() << "\n"; RandGauss::put(os); os.precision(pr); return os; } std::istream & RandGaussT::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } RandGauss::get(is); return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandBit.cc0000755000175000017500000000275011406204345016244 0ustar olesoles// $Id: RandBit.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandBit --- // class implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // M Fischler - Created from RandFlat.cc, deleting almost all the content // since inheritance takes care of it. 2/15/00 // M Fischler - put and get to/from streams 12/10/04 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandBit.h" #include namespace CLHEP { std::string RandBit::name() const {return "RandBit";} RandBit::~RandBit() { } std::ostream & RandBit::put ( std::ostream & os ) const { os << " " << name() << "\n"; RandFlat::put(os); return os; } std::istream & RandBit::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } RandFlat::get(is); return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/TripleRand.cc0000755000175000017500000004466111753236267017011 0ustar olesoles// $Id: TripleRand.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // Hep Random // --- TripleRand --- // class implementation file // ----------------------------------------------------------------------- // A canopy pseudo-random number generator. Using the Tausworthe // exclusive-or shift register, a simple Integer Coungruence generator, and // the Hurd 288 total bit shift register, all XOR'd with each other, we // provide an engine that should be a fairly good "mother" generator. // ======================================================================= // Ken Smith - Initial draft started: 23rd Jul 1998 // - Added conversion operators: 6th Aug 1998 // J. Marraffino - Added some explicit casts to deal with // machines where sizeof(int) != sizeof(long) 22 Aug 1998 // M. Fischler - Modified use of the various exponents of 2 // to avoid per-instance space overhead and // correct the rounding procedure 15 Sep 1998 // - modify constructors so that no sequence can // ever accidentally be produced by differnt // seeds, and so that exxcept for the default // constructor, the seed fully determines the // sequence. 15 Sep 1998 // M. Fischler - Eliminated dependency on hepString 13 May 1999 // M. Fischler - Eliminated Taus() and Cong() which were // causing spurions warnings on SUN CC 27 May 1999 // M. Fischler - Put endl at end of puts of Tausworth and 10 Apr 2001 // integerCong // M. Fischler - In restore, checkFile for file not found 03 Dec 2004 // M. Fischler - Methods put, get for instance save/restore 12/8/04 // M. Fischler - split get() into tag validation and // getState() for anonymous restores 12/27/04 // M. Fischler - put/get for vectors of ulongs 3/14/05 // M. Fischler - State-saving using only ints, for portability 4/12/05 // // ======================================================================= #include "CLHEP/Random/TripleRand.h" #include "CLHEP/Random/defs.h" #include "CLHEP/Random/engineIDulong.h" #include // for strcmp namespace CLHEP { static const int MarkerLen = 64; // Enough room to hold a begin or end marker. //******************************************************************** // TripleRand //******************************************************************** // Number of instances with automatic seed selection int TripleRand::numEngines = 0; std::string TripleRand::name() const {return "TripleRand";} TripleRand::TripleRand() : HepRandomEngine(), tausworthe (1234567 + numEngines + 175321), integerCong(69607 * tausworthe + 54329, numEngines), hurd(19781127 + integerCong) { theSeed = 1234567; ++numEngines; } TripleRand::TripleRand(long seed) : HepRandomEngine(), tausworthe ((unsigned int)seed + 175321), integerCong(69607 * tausworthe + 54329, 1313), hurd(19781127 + integerCong) { theSeed = seed; } TripleRand::TripleRand(std::istream & is) : HepRandomEngine() { is >> *this; } TripleRand::TripleRand(int rowIndex, int colIndex) : HepRandomEngine(), tausworthe (rowIndex + numEngines * colIndex + 175321), integerCong(69607 * tausworthe + 54329, 19), hurd(19781127 + integerCong) { theSeed = rowIndex; } TripleRand::~TripleRand() { } double TripleRand::flat() { unsigned int ic ( integerCong ); unsigned int t ( tausworthe ); unsigned int h ( hurd ); return ( (t ^ ic ^ h) * twoToMinus_32() + // most significant part (h >> 11) * twoToMinus_53() + // fill in remaining bits nearlyTwoToMinus_54() // make sure non-zero ); } void TripleRand::flatArray(const int size, double* vect) { for (int i = 0; i < size; ++i) { vect[i] = flat(); } } void TripleRand::setSeed(long seed, int) { theSeed = seed; tausworthe = Tausworthe((unsigned int)seed + numEngines + 175321); integerCong = IntegerCong(69607 * tausworthe + 54329, numEngines); hurd = Hurd288Engine( 19781127 + integerCong ); } void TripleRand::setSeeds(const long * seeds, int) { setSeed(seeds ? *seeds : 1234567, 0); theSeeds = seeds; } void TripleRand::saveStatus(const char filename[]) const { std::ofstream outFile(filename, std::ios::out); if (!outFile.bad()) { outFile << "Uvec\n"; std::vector v = put(); #ifdef TRACE_IO std::cout << "Result of v = put() is:\n"; #endif for (unsigned int i=0; i v; unsigned long xin; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { inFile >> xin; #ifdef TRACE_IO std::cout << "ivec = " << ivec << " xin = " << xin << " "; if (ivec%3 == 0) std::cout << "\n"; #endif if (!inFile) { inFile.clear(std::ios::badbit | inFile.rdstate()); std::cerr << "\nTripleRand state (vector) description improper." << "\nrestoreStatus has failed." << "\nInput stream is probably mispositioned now." << std::endl; return; } v.push_back(xin); } getState(v); return; } if (!inFile.bad()) { // inFile >> theSeed; removed -- encompased by possibleKeywordInput tausworthe.get ( inFile ); integerCong.get( inFile ); inFile >> Hurd(); } } void TripleRand::showStatus() const { std::cout << std::setprecision(20) << std::endl; std::cout << "-------- TripleRand engine status ---------" << std::endl; std::cout << "Initial seed = " << theSeed << std::endl; std::cout << "Tausworthe generator = " << std::endl; tausworthe.put( std::cout ); std::cout << "IntegerCong generator = " << std::endl; integerCong.put( std::cout ); std::cout << "Hurd288Engine generator= " << std::endl << ConstHurd(); std::cout << std::endl << "-----------------------------------------" << std::endl; } TripleRand::operator float() { return (float) ( ( integerCong ^ tausworthe ^ (unsigned int)hurd ) * twoToMinus_32() + nearlyTwoToMinus_54() ); // make sure non-zero! } TripleRand::operator unsigned int() { return integerCong ^ tausworthe ^ (unsigned int)hurd; } Hurd288Engine & TripleRand::Hurd() { return hurd; } const Hurd288Engine & TripleRand::ConstHurd() const { return hurd; } std::ostream & TripleRand::put (std::ostream & os ) const { char beginMarker[] = "TripleRand-begin"; os << beginMarker << "\nUvec\n"; std::vector v = put(); for (unsigned int i=0; i TripleRand::put () const { std::vector v; v.push_back (engineIDulong()); tausworthe.put(v); integerCong.put(v); std::vector vHurd = hurd.put(); for (unsigned int i = 0; i < vHurd.size(); ++i) { v.push_back (vHurd[i]); } return v; } std::istream & TripleRand::get (std::istream & is) { char beginMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"TripleRand-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput mispositioned or" << "\nTripleRand state description missing or" << "\nwrong engine type found." << std::endl; return is; } return getState(is); } std::string TripleRand::beginTag ( ) { return "TripleRand-begin"; } std::istream & TripleRand::getState (std::istream & is) { if ( possibleKeywordInput ( is, "Uvec", theSeed ) ) { std::vector v; unsigned long uu; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { is >> uu; if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nTripleRand state (vector) description improper." << "\ngetState() has failed." << "\nInput stream is probably mispositioned now." << std::endl; return is; } v.push_back(uu); } getState(v); return (is); } // is >> theSeed; Removed, encompassed by possibleKeywordInput() char endMarker [MarkerLen]; tausworthe.get( is ); integerCong.get( is ); is >> Hurd(); is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"TripleRand-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nTripleRand state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; return is; } return is; } bool TripleRand::get (const std::vector & v) { if ((v[0] & 0xffffffffUL) != engineIDulong()) { std::cerr << "\nTripleRand get:state vector has wrong ID word - state unchanged\n"; return false; } if (v.size() != VECTOR_STATE_SIZE) { std::cerr << "\nTripleRand get:state vector has wrong size: " << v.size() << " - state unchanged\n"; return false; } return getState(v); } bool TripleRand::getState (const std::vector & v) { std::vector::const_iterator iv = v.begin()+1; if (!tausworthe.get(iv)) return false; if (!integerCong.get(iv)) return false; std::vector vHurd; while (iv != v.end()) { vHurd.push_back(*iv++); } if (!hurd.get(vHurd)) { std::cerr << "\nTripleRand get from vector: problem getting the hurd sub-engine state\n"; return false; } return true; } //******************************************************************** // Tausworthe //******************************************************************** TripleRand::Tausworthe::Tausworthe() { words[0] = 1234567; for (wordIndex = 1; wordIndex < 4; ++wordIndex) { words[wordIndex] = 69607 * words[wordIndex-1] + 54329; } } TripleRand::Tausworthe::Tausworthe(unsigned int seed) { words[0] = seed; for (wordIndex = 1; wordIndex < 4; ++wordIndex) { words[wordIndex] = 69607 * words[wordIndex-1] + 54329; } } TripleRand::Tausworthe::operator unsigned int() { // Mathematically: Consider a sequence of bits b[n]. Repeatedly form // b[0]' = b[127] ^ b[97]; b[n]' = b[n-1]. This sequence will have a very // long period (2**127-1 according to Tausworthe's work). // The actual method used relies on the fact that the operations needed to // form bit 0 for up to 96 iterations never depend on the results of the // previous ones. So you can actually compute many bits at once. In fact // you can compute 32 at once -- despite 127 - 97 < 32 -- but 24 was used in // the method used in Canopy, where they wanted only single-precision float // randoms. I will do 32 here. // When you do it this way, this looks disturbingly like the dread lagged XOR // Fibonacci. And indeed, it is a lagged Fibonacii, F(4,3, op) with the op // being the XOR of a combination of shifts of the two numbers. Although // Tausworthe asserted excellent properties, I would be scared to death. // However, the shifting and bit swapping really does randomize this in a // serious way. // Statements have been made to the effect that shift register sequences fail // the parking lot test because they achieve randomness by multiple foldings, // and this produces a characteristic pattern. We observe that in this // specific algorithm, which has a fairly long lever arm, the foldings become // effectively random. This is evidenced by the fact that the generator // does pass the Diehard tests, including the parking lot test. // To avoid shuffling of variables in memory, you either have to use circular // pointers (and those give you ifs, which are also costly) or compute at least // a few iterations at once. We do the latter. Although there is a possible // trade of room for more speed, by computing and saving 256 instead of 128 // bits at once, I will stop at this level of optimization. // To remind: Each (32-bit) step takes the XOR of bits [127-96] with bits // [95-64] and places it in bits [0-31]. But in the first step, we designate // word0 as bits [0-31], in the second step, word 1 (since the bits it holds // will no longer be needed), then word 2, then word 3. After this, the // stream contains 128 random bits which we will use as 4 valid 32-bit // random numbers. // Thus at the start of the first step, word[0] contains the newest (used) // 32-bit random, and word[3] the oldest. After four steps, word[0] again // contains the newest (now unused) random, and word[3] the oldest. // Bit 0 of word[0] is logically the newest bit, and bit 31 of word[3] // the oldest. if (wordIndex <= 0) { for (wordIndex = 0; wordIndex < 4; ++wordIndex) { words[wordIndex] = ( (words[(wordIndex+1) & 3] << 1 ) | (words[wordIndex] >> 31) ) ^ ( (words[(wordIndex+1) & 3] << 31) | (words[wordIndex] >> 1) ); } } return words[--wordIndex] & 0xffffffff; } void TripleRand::Tausworthe::put( std::ostream & os ) const { char beginMarker[] = "Tausworthe-begin"; char endMarker[] = "Tausworthe-end"; int pr=os.precision(20); os << " " << beginMarker << " "; os << std::setprecision(20); for (int i = 0; i < 4; ++i) { os << words[i] << " "; } os << wordIndex; os << " " << endMarker << " "; os << std::endl; os.precision(pr); } void TripleRand::Tausworthe::put(std::vector & v) const { for (int i = 0; i < 4; ++i) { v.push_back(static_cast(words[i])); } v.push_back(static_cast(wordIndex)); } void TripleRand::Tausworthe::get( std::istream & is ) { char beginMarker [MarkerLen]; char endMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); is >> beginMarker; if (strcmp(beginMarker,"Tausworthe-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput mispositioned or" << "\nTausworthe state description missing or" << "\nwrong engine type found." << std::endl; } for (int i = 0; i < 4; ++i) { is >> words[i]; } is >> wordIndex; is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"Tausworthe-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nTausworthe state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; } } bool TripleRand::Tausworthe::get(std::vector::const_iterator & iv){ for (int i = 0; i < 4; ++i) { words[i] = *iv++; } wordIndex = *iv++; return true; } //******************************************************************** // IntegerCong //******************************************************************** TripleRand::IntegerCong::IntegerCong() : state((unsigned int)3758656018U), multiplier(66565), addend(12341) { } TripleRand::IntegerCong::IntegerCong(unsigned int seed, int streamNumber) : state(seed), multiplier(65536 + 1024 + 5 + (8 * 1017 * streamNumber)), addend(12341) { // As to the multiplier, the following comment was made: // We want our multipliers larger than 2^16, and equal to // 1 mod 4 (for max. period), but not equal to 1 mod 8 // (for max. potency -- the smaller and higher dimension the // stripes, the better) // All of these will have fairly long periods. Depending on the choice // of stream number, some of these will be quite decent when considered // as independent random engines, while others will be poor. Thus these // should not be used as stand-alone engines; but when combined with a // generator known to be good, they allow creation of millions of good // independent streams, without fear of two streams accidentally hitting // nearby places in the good random sequence. } TripleRand::IntegerCong::operator unsigned int() { return state = (state * multiplier + addend) & 0xffffffff; } void TripleRand::IntegerCong::put( std::ostream & os ) const { char beginMarker[] = "IntegerCong-begin"; char endMarker[] = "IntegerCong-end"; int pr=os.precision(20); os << " " << beginMarker << " "; os << state << " " << multiplier << " " << addend; os << " " << endMarker << " "; os << std::endl; os.precision(pr); } void TripleRand::IntegerCong::put(std::vector & v) const { v.push_back(static_cast(state)); v.push_back(static_cast(multiplier)); v.push_back(static_cast(addend)); } void TripleRand::IntegerCong::get( std::istream & is ) { char beginMarker [MarkerLen]; char endMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); is >> beginMarker; if (strcmp(beginMarker,"IntegerCong-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput mispositioned or" << "\nIntegerCong state description missing or" << "\nwrong engine type found." << std::endl; } is >> state >> multiplier >> addend; is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"IntegerCong-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nIntegerCong state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; } } bool TripleRand::IntegerCong::get(std::vector::const_iterator & iv) { state = *iv++; multiplier = *iv++; addend = *iv++; return true; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/JamesRandom.cc0000755000175000017500000003067011753236267017140 0ustar olesoles// $Id: JamesRandom.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- HepJamesRandom --- // class implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // // This algorithm implements the original universal random number generator // as proposed by Marsaglia & Zaman in report FSU-SCRI-87-50 and coded // in FORTRAN77 by Fred James as the RANMAR generator, part of the MATHLIB // HEP library. // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Fixed a bug in setSeed(): 26th February 1996 // - Minor corrections: 31st October 1996 // - Added methods for engine status: 19th November 1996 // - Fixed bug in setSeeds(): 15th September 1997 // J.Marraffino - Added stream operators and related constructor. // Added automatic seed selection from seed table and // engine counter: 16th Feb 1998 // Ken Smith - Added conversion operators: 6th Aug 1998 // J. Marraffino - Remove dependence on hepString class 13 May 1999 // V. Innocente - changed pointers to indices 3 may 2000 // M. Fischler - In restore, checkFile for file not found 03 Dec 2004 // M. Fischler - Methods for distrib. instacne save/restore 12/8/04 // M. Fischler - split get() into tag validation and // getState() for anonymous restores 12/27/04 // M. Fischler - Enforcement that seeds be non-negative // (lest the sequence be non-random) 2/14/05 // M. Fischler - put/get for vectors of ulongs 3/14/05 // M. Fischler - State-saving using only ints, for portability 4/12/05 // // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Random/JamesRandom.h" #include "CLHEP/Random/engineIDulong.h" #include "CLHEP/Random/DoubConv.hh" #include // for strcmp #include #include //#define TRACE_IO namespace CLHEP { static const int MarkerLen = 64; // Enough room to hold a begin or end marker. std::string HepJamesRandom::name() const {return "HepJamesRandom";} // Number of instances with automatic seed selection int HepJamesRandom::numEngines = 0; // Maximum index into the seed table int HepJamesRandom::maxIndex = 215; HepJamesRandom::HepJamesRandom(long seed) : HepRandomEngine() { setSeed(seed,0); setSeeds(&theSeed,0); } HepJamesRandom::HepJamesRandom() // 15 Feb. 1998 JMM : HepRandomEngine() { long seeds[2]; long seed; int cycle = std::abs(int(numEngines/maxIndex)); int curIndex = std::abs(int(numEngines%maxIndex)); ++numEngines; long mask = ((cycle & 0x007fffff) << 8); HepRandom::getTheTableSeeds( seeds, curIndex ); seed = seeds[0]^mask; setSeed(seed,0); setSeeds(&theSeed,0); } HepJamesRandom::HepJamesRandom(int rowIndex, int colIndex) // 15 Feb. 1998 JMM : HepRandomEngine() { long seed; long seeds[2]; int cycle = std::abs(int(rowIndex/maxIndex)); int row = std::abs(int(rowIndex%maxIndex)); int col = std::abs(int(colIndex%2)); long mask = ((cycle & 0x000007ff) << 20); HepRandom::getTheTableSeeds( seeds, row ); seed = (seeds[col])^mask; setSeed(seed,0); setSeeds(&theSeed,0); } HepJamesRandom::HepJamesRandom(std::istream& is) : HepRandomEngine() { is >> *this; } HepJamesRandom::~HepJamesRandom() {} void HepJamesRandom::saveStatus( const char filename[] ) const { std::ofstream outFile( filename, std::ios::out ) ; if (!outFile.bad()) { outFile << "Uvec\n"; std::vector v = put(); #ifdef TRACE_IO std::cout << "Result of v = put() is:\n"; #endif for (unsigned int i=0; i v; unsigned long xin; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { inFile >> xin; #ifdef TRACE_IO std::cout << "ivec = " << ivec << " xin = " << xin << " "; if (ivec%3 == 0) std::cout << "\n"; #endif if (!inFile) { inFile.clear(std::ios::badbit | inFile.rdstate()); std::cerr << "\nJamesRandom state (vector) description improper." << "\nrestoreStatus has failed." << "\nInput stream is probably mispositioned now." << std::endl; return; } v.push_back(xin); } getState(v); return; } if (!inFile.bad() && !inFile.eof()) { // inFile >> theSeed; removed -- encompased by possibleKeywordInput for (int i=0; i<97; ++i) inFile >> u[i]; inFile >> c; inFile >> cd; inFile >> cm; inFile >> jpos; ipos = (64+jpos)%97; i97 = ipos; j97 = jpos; } } void HepJamesRandom::showStatus() const { std::cout << std::endl; std::cout << "----- HepJamesRandom engine status -----" << std::endl; std::cout << " Initial seed = " << theSeed << std::endl; std::cout << " u[] = "; for (int i=0; i<97; ++i) std::cout << u[i] << " "; std::cout << std::endl; std::cout << " c = " << c << ", cd = " << cd << ", cm = " << cm << std::endl; std::cout << " i97 = " << i97 << ", u[i97] = " << u[i97] << std::endl; std::cout << " j97 = " << j97 << ", u[j97] = " << u[j97] << std::endl; std::cout << "----------------------------------------" << std::endl; } void HepJamesRandom::setSeed(long seed, int) { // The input value for "seed" should be within the range [0,900000000] // // Negative seeds result in serious flaws in the randomness; // seeds above 900000000 are OK because of the %177 in the expression for i, // but may have the same effect as other seeds below 900000000. int m, n; float s, t; long mm; if (seed < 0) { std::cout << "Seed for HepJamesRandom must be non-negative\n" << "Seed value supplied was " << seed << "\nUsing its absolute value instead\n"; seed = -seed; } long ij = seed/30082; long kl = seed - 30082*ij; long i = (ij/177) % 177 + 2; long j = ij % 177 + 2; long k = (kl/169) % 178 + 1; long l = kl % 169; theSeed = seed; for ( n = 1 ; n < 98 ; n++ ) { s = 0.0; t = 0.5; for ( m = 1 ; m < 25 ; m++) { mm = ( ( (i*j) % 179 ) * k ) % 179; i = j; j = k; k = mm; l = ( 53 * l + 1 ) % 169; if ( (l*mm % 64 ) >= 32 ) s += t; t *= 0.5; } u[n-1] = s; } c = 362436.0 / 16777216.0; cd = 7654321.0 / 16777216.0; cm = 16777213.0 / 16777216.0; i97 = 96; j97 = 32; } void HepJamesRandom::setSeeds(const long* seeds, int) { setSeed(seeds ? *seeds : 19780503L, 0); theSeeds = seeds; } double HepJamesRandom::flat() { double uni; do { uni = u[i97] - u[j97]; if ( uni < 0.0 ) uni++; u[i97] = uni; if (i97 == 0) i97 = 96; else i97--; if (j97 == 0) j97 = 96; else j97--; c -= cd; if (c < 0.0) c += cm; uni -= c; if (uni < 0.0) uni += 1.0; } while ( uni <= 0.0 || uni >= 1.0 ); return uni; } void HepJamesRandom::flatArray(const int size, double* vect) { // double uni; int i; for (i=0; i>16) & 0xff); } std::ostream & HepJamesRandom::put ( std::ostream& os ) const { char beginMarker[] = "JamesRandom-begin"; os << beginMarker << "\nUvec\n"; std::vector v = put(); for (unsigned int i=0; i HepJamesRandom::put () const { std::vector v; v.push_back (engineIDulong()); std::vector t; for (int i=0; i<97; ++i) { t = DoubConv::dto2longs(u[i]); v.push_back(t[0]); v.push_back(t[1]); } t = DoubConv::dto2longs(c); v.push_back(t[0]); v.push_back(t[1]); t = DoubConv::dto2longs(cd); v.push_back(t[0]); v.push_back(t[1]); t = DoubConv::dto2longs(cm); v.push_back(t[0]); v.push_back(t[1]); v.push_back(static_cast(j97)); return v; } std::istream & HepJamesRandom::get ( std::istream& is) { char beginMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"JamesRandom-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput stream mispositioned or" << "\nJamesRandom state description missing or" << "\nwrong engine type found." << std::endl; return is; } return getState(is); } std::string HepJamesRandom::beginTag ( ) { return "JamesRandom-begin"; } std::istream & HepJamesRandom::getState ( std::istream& is) { if ( possibleKeywordInput ( is, "Uvec", theSeed ) ) { std::vector v; unsigned long uu; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { is >> uu; if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nJamesRandom state (vector) description improper." << "\ngetState() has failed." << "\nInput stream is probably mispositioned now." << std::endl; return is; } v.push_back(uu); } getState(v); return (is); } // is >> theSeed; Removed, encompassed by possibleKeywordInput() int ipos, jpos; char endMarker [MarkerLen]; for (int i=0; i<97; ++i) { is >> u[i]; } is >> c; is >> cd; is >> cm; is >> jpos; is >> std::ws; is.width(MarkerLen); is >> endMarker; if(strcmp(endMarker,"JamesRandom-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nJamesRandom state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; return is; } ipos = (64+jpos)%97; i97 = ipos; j97 = jpos; return is; } bool HepJamesRandom::get (const std::vector & v) { if ( (v[0] & 0xffffffffUL) != engineIDulong()) { std::cerr << "\nHepJamesRandom get:state vector has wrong ID word - state unchanged\n"; return false; } return getState(v); } bool HepJamesRandom::getState (const std::vector & v) { if (v.size() != VECTOR_STATE_SIZE ) { std::cerr << "\nHepJamesRandom get:state vector has wrong length - state unchanged\n"; return false; } std::vector t(2); for (int i=0; i<97; ++i) { t[0] = v[2*i+1]; t[1] = v[2*i+2]; u[i] = DoubConv::longs2double(t); } t[0] = v[195]; t[1] = v[196]; c = DoubConv::longs2double(t); t[0] = v[197]; t[1] = v[198]; cd = DoubConv::longs2double(t); t[0] = v[199]; t[1] = v[200]; cm = DoubConv::longs2double(t); j97 = v[201]; i97 = (64+j97)%97; return true; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandomEngine.cc0000755000175000017500000000614311461345007017271 0ustar olesoles// $Id: RandomEngine.cc,v 1.7 2010/10/25 18:18:47 garren Exp $ // -*- C++ -*- // // ------------------------------------------------------------------------ // HEP Random // --- HepRandomEngine --- // class implementation file // ------------------------------------------------------------------------ // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================== // Gabriele Cosmo - Created: 5th September 1995 // - Minor corrections: 31st October 1996 // - Moved table of seeds to HepRandom: 19th March 1998 // Ken Smith - Added conversion operators: 6th Aug 1998 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandomEngine.h" #include "CLHEP/Random/EngineFactory.h" //------------------------- HepRandomEngine ------------------------------ namespace CLHEP { HepRandomEngine::HepRandomEngine() : theSeed (19780503L) , theSeeds(&theSeed) { } HepRandomEngine::~HepRandomEngine() {} HepRandomEngine::operator double() { return flat(); } HepRandomEngine::operator float() { return float( flat() ); } HepRandomEngine::operator unsigned int() { return (unsigned int)( flat() * exponent_bit_32() ); } bool HepRandomEngine::checkFile (std::istream & file, const std::string & filename, const std::string & classname, const std::string & methodname) { if (!file) { std::cerr << "Failure to find or open file " << filename << " in " << classname << "::" << methodname << "()\n"; return false; } return true; } std::ostream & HepRandomEngine::put (std::ostream & os) const { std::cerr << "HepRandomEngine::put called -- no effect!\n"; return os; } std::istream & HepRandomEngine::get (std::istream & is) { std::cerr << "HepRandomEngine::get called -- no effect!\n"; return is; } std::string HepRandomEngine::beginTag ( ) { return "HepRandomEngine-begin"; } std::istream & HepRandomEngine::getState ( std::istream & is ) { std::cerr << "HepRandomEngine::getState called -- no effect!\n"; return is; } std::vector HepRandomEngine::put () const { std::cerr << "v=HepRandomEngine::put() called -- no data!\n"; std::vector v; return v; } bool HepRandomEngine::get (const std::vector & ) { std::cerr << "HepRandomEngine::get(v) called -- no effect!\n"; return false; } bool HepRandomEngine::getState (const std::vector & ) { std::cerr << "HepRandomEngine::getState(v) called -- no effect!\n"; return false; } HepRandomEngine* HepRandomEngine::newEngine(std::istream& is) { return EngineFactory::newEngine(is); } HepRandomEngine* HepRandomEngine::newEngine(const std::vector & v) { return EngineFactory::newEngine(v); } std::ostream & operator<< (std::ostream & os, const HepRandomEngine & e) { return e.put(os); } std::istream & operator>> (std::istream & is, HepRandomEngine & e) { return e.get(is); } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/erfQ.cc0000755000175000017500000000230311753236267015625 0ustar olesoles// $Id: erfQ.cc,v 1.3 2003/08/13 20:00:12 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- erfQ --- // method implementation file // ----------------------------------------------------------------------- // Contains methods that do not depend on large tables. // // erfQ (double x) // ======================================================================= // M Fischler - Created 1/26/00. // // ======================================================================= #include "CLHEP/Random/Stat.h" #include "CLHEP/Random/defs.h" #include namespace CLHEP { double HepStat::erfQ (double x) { // // erfQ is accurate to 7 places. // See Numerical Recipes P 221 // double t, z, erfc; z = std::abs(x); t = 1.0/(1.0+.5*z); erfc= t*std::exp(-z*z-1.26551223+t*(1.00002368+t*(0.37409196+t*(0.09678418+ t*(-0.18628806+t*(0.27886807+t*(-1.13520398+t*(1.48851587+ t*(-0.82215223+t*0.17087277 ))) ))) ))); // (The derivation of this formula should be obvious.) if ( x < 0 ) erfc = 2.0 - erfc; return 1 - erfc; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/Random.cc0000755000175000017500000001224611406204345016142 0ustar olesoles// $Id: Random.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- HepRandom --- // class implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 5th September 1995 // - Minor corrections: 31st October 1996 // - Added methods for engine status: 19th November 1996 // - HepRandom defined as singleton, constructors are // kept public for backward compatibility: 27th Feb 1998 // - Relocated Poisson and Gauss data and simplified // initialisation of static generator: 5th Jan 1999 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/JamesRandom.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Random/StaticRandomStates.h" #include "CLHEP/Utility/memory.h" // ----------------------------- // Static members initialisation // ----------------------------- #include "CLHEP/Random/SeedTable.h" namespace CLHEP { namespace { struct defaults { defaults( HepRandom & g, HepJamesRandom & e ) : theGenerator( &g, do_nothing_deleter() ) , theEngine ( &e, do_nothing_deleter() ) { } void resetEngine( HepRandomEngine * newEngine ) { theEngine.reset( newEngine ); } void resetEngine( HepRandomEngine & newEngine ) { theEngine.reset( &newEngine, do_nothing_deleter() ); } bool ensureInitialized() { assert( theGenerator.get() != 0 && theEngine.get() != 0 ); return true; } ~defaults() { } shared_ptr theGenerator; shared_ptr theEngine; }; // defaults inline defaults & theDefaults() { static HepRandom theDefaultGenerator; static HepJamesRandom theDefaultEngine; static defaults theDefaults(theDefaultGenerator, theDefaultEngine); return theDefaults; } } // namespace //---------------------------- HepRandom --------------------------------- HepRandom::HepRandom() { } HepRandom::HepRandom(long seed) { setTheSeed(seed); } HepRandom::HepRandom(HepRandomEngine & algorithm) { theDefaults().resetEngine( algorithm ); } HepRandom::HepRandom(HepRandomEngine * algorithm) { theDefaults().resetEngine( algorithm ); } HepRandom::~HepRandom() { } double HepRandom::flat() { return theDefaults().theEngine->flat(); } void HepRandom::flatArray(const int size, double* vect) { theDefaults().theEngine->flatArray(size,vect); } double HepRandom::operator()() { return flat(); } std::string HepRandom::name() const {return "HepRandom";} HepRandomEngine & HepRandom::engine() { std::cerr << "HepRandom::engine() called -- there is no assigned engine!\n"; return *theDefaults().theEngine.get(); } std::ostream & operator<< (std::ostream & os, const HepRandom & dist) { return dist.put(os); } std::istream & operator>> (std::istream & is, HepRandom & dist) { return dist.get(is); } std::ostream & HepRandom::put(std::ostream & os) const {return os;} std::istream & HepRandom::get(std::istream & is) {return is;} // -------------------------- // Static methods definitions // -------------------------- void HepRandom::setTheSeed(long seed, int lux) { theDefaults().theEngine->setSeed(seed,lux); } long HepRandom::getTheSeed() { return theDefaults().theEngine->getSeed(); } void HepRandom::setTheSeeds(const long* seeds, int aux) { theDefaults().theEngine->setSeeds(seeds,aux); } const long* HepRandom::getTheSeeds () { return theDefaults().theEngine->getSeeds(); } void HepRandom::getTheTableSeeds(long* seeds, int index) { if ((index >= 0) && (index < 215)) { seeds[0] = seedTable[index][0]; seeds[1] = seedTable[index][1]; } else seeds = NULL; } HepRandom * HepRandom::getTheGenerator() { return theDefaults().theGenerator.get(); } HepRandomEngine * HepRandom::getTheEngine() { return theDefaults().theEngine.get(); } void HepRandom::setTheEngine (HepRandomEngine* theNewEngine) { theDefaults().theEngine.reset( theNewEngine, do_nothing_deleter() ); } void HepRandom::saveEngineStatus( const char filename[] ) { theDefaults().theEngine->saveStatus( filename ); } void HepRandom::restoreEngineStatus( const char filename[] ) { theDefaults().theEngine->restoreStatus( filename ); } std::ostream& HepRandom::saveFullState ( std::ostream & os ) { os << *getTheEngine(); return os; } std::istream& HepRandom::restoreFullState ( std::istream & is ) { is >> *getTheEngine(); return is; } std::ostream& HepRandom::saveStaticRandomStates ( std::ostream & os ) { return StaticRandomStates::save(os); } std::istream& HepRandom::restoreStaticRandomStates ( std::istream & is ) { return StaticRandomStates::restore(is); } void HepRandom::showEngineStatus() { theDefaults().theEngine->showStatus(); } int HepRandom::createInstance() { return static_cast( theDefaults().ensureInitialized() ); } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandExpZiggurat.cc0000644000175000017500000001071512234560262017777 0ustar olesoles#include "CLHEP/Random/defs.h" #include "CLHEP/Random/DoubConv.hh" #include "CLHEP/Random/RandExpZiggurat.h" #include #include // for log() namespace CLHEP { bool RandExpZiggurat::ziggurat_is_init=RandExpZiggurat::ziggurat_init(); unsigned long RandExpZiggurat::kn[128], RandExpZiggurat::ke[256]; float RandExpZiggurat::wn[128],RandExpZiggurat::fn[128],RandExpZiggurat::we[256],RandExpZiggurat::fe[256]; std::string RandExpZiggurat::name() const {return "RandExpZiggurat";} HepRandomEngine & RandExpZiggurat::engine() {return *localEngine;} RandExpZiggurat::~RandExpZiggurat() { if ( deleteEngine ) delete localEngine; } RandExpZiggurat::RandExpZiggurat(const RandExpZiggurat& right) : HepRandom(right),defaultMean(right.defaultMean) { if(!ziggurat_is_init) ziggurat_init(); } double RandExpZiggurat::operator()() { return fire( defaultMean ); } void RandExpZiggurat::shootArray( const int size, float* vect, float mean ) { for (int i=0; i t(2); os << " " << name() << "\n"; os << "Uvec" << "\n"; t = DoubConv::dto2longs(defaultMean); os << defaultMean << " " << t[0] << " " << t[1] << "\n"; os.precision(pr); return os; #ifdef REMOVED int pr=os.precision(20); os << " " << name() << "\n"; os << defaultMean << "\n"; os.precision(pr); return os; #endif } std::istream & RandExpZiggurat::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } if (possibleKeywordInput(is, "Uvec", defaultMean)) { std::vector t(2); is >> defaultMean >> t[0] >> t[1]; defaultMean = DoubConv::longs2double(t); return is; } // is >> defaultMean encompassed by possibleKeywordInput return is; } float RandExpZiggurat::ziggurat_efix(unsigned long jz,HepRandomEngine* anEngine) { unsigned long iz=jz&255; float x; for(;;) { if(iz==0) return (7.69711-log(ziggurat_UNI(anEngine))); /* iz==0 */ x=jz*we[iz]; if( fe[iz]+ziggurat_UNI(anEngine)*(fe[iz-1]-fe[iz]) < exp(-x) ) return (x); /* initiate, try to exit for(;;) loop */ jz=ziggurat_SHR3(anEngine); iz=(jz&255); if(jz=1;i--) { dn=sqrt(-2.*log(vn/dn+exp(-.5*dn*dn))); kn[i+1]=(unsigned long)((dn/tn)*rzm1); tn=dn; fn[i]=exp(-.5*dn*dn); wn[i]=dn/rzm1; } /* Set up tables for REXP */ q = ve/exp(-de); ke[0]=(unsigned long)((de/q)*rzm2); ke[1]=0; we[0]=q/rzm2; we[255]=de/rzm2; fe[0]=1.; fe[255]=exp(-de); for(i=254;i>=1;i--) { de=-log(ve/de+exp(-de)); ke[i+1]= (unsigned long)((de/te)*rzm2); te=de; fe[i]=exp(-de); we[i]=de/rzm2; } ziggurat_is_init=true; return true; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandChiSquare.cc0000755000175000017500000001305011753236267017422 0ustar olesoles// $Id: RandChiSquare.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandChiSquare --- // class implementation file // ----------------------------------------------------------------------- // ======================================================================= // John Marraffino - Created: 12th May 1998 // M Fischler - put and get to/from streams 12/10/04 // M Fischler - put/get to/from streams uses pairs of ulongs when // + storing doubles avoid problems with precision // 4/14/05 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandChiSquare.h" #include "CLHEP/Random/DoubConv.hh" #include // for std::log() namespace CLHEP { std::string RandChiSquare::name() const {return "RandChiSquare";} HepRandomEngine & RandChiSquare::engine() {return *localEngine;} RandChiSquare::~RandChiSquare() { } double RandChiSquare::shoot( HepRandomEngine *anEngine, double a ) { return genChiSquare( anEngine, a ); } double RandChiSquare::shoot( double a ) { HepRandomEngine *anEngine = HepRandom::getTheEngine(); return genChiSquare( anEngine, a ); } double RandChiSquare::fire( double a ) { return genChiSquare( localEngine.get(), a ); } void RandChiSquare::shootArray( const int size, double* vect, double a ) { for( double* v = vect; v != vect+size; ++v ) *v = shoot(a); } void RandChiSquare::shootArray( HepRandomEngine* anEngine, const int size, double* vect, double a ) { for( double* v = vect; v != vect+size; ++v ) *v = shoot(anEngine,a); } void RandChiSquare::fireArray( const int size, double* vect) { for( double* v = vect; v != vect+size; ++v ) *v = fire(defaultA); } void RandChiSquare::fireArray( const int size, double* vect, double a ) { for( double* v = vect; v != vect+size; ++v ) *v = fire(a); } double RandChiSquare::genChiSquare( HepRandomEngine *anEngine, double a ) { /****************************************************************** * * * Chi Distribution - Ratio of Uniforms with shift * * * ****************************************************************** * * * FUNCTION : - chru samples a random number from the Chi * * distribution with parameter a > 1. * * REFERENCE : - J.F. Monahan (1987): An algorithm for * * generating chi random variables, ACM Trans. * * Math. Software 13, 168-172. * * SUBPROGRAM : - anEngine ... pointer to a (0,1)-Uniform * * engine * * * * Implemented by R. Kremer, 1990 * ******************************************************************/ static double a_in = -1.0,b,vm,vp,vd; double u,v,z,zz,r; // Check for invalid input value if( a < 1 ) return (-1.0); if (a == 1) { for(;;) { u = anEngine->flat(); v = anEngine->flat() * 0.857763884960707; z = v / u; if (z < 0) continue; zz = z * z; r = 2.5 - zz; if (z < 0.0) r = r + zz * z / (3.0 * z); if (u < r * 0.3894003915) return(z*z); if (zz > (1.036961043 / u + 1.4)) continue; if (2 * std::log(u) < (- zz * 0.5 )) return(z*z); } } else { if (a != a_in) { b = std::sqrt(a - 1.0); vm = - 0.6065306597 * (1.0 - 0.25 / (b * b + 1.0)); vm = (-b > vm)? -b : vm; vp = 0.6065306597 * (0.7071067812 + b) / (0.5 + b); vd = vp - vm; a_in = a; } for(;;) { u = anEngine->flat(); v = anEngine->flat() * vd + vm; z = v / u; if (z < -b) continue; zz = z * z; r = 2.5 - zz; if (z < 0.0) r = r + zz * z / (3.0 * (z + b)); if (u < r * 0.3894003915) return((z + b)*(z + b)); if (zz > (1.036961043 / u + 1.4)) continue; if (2 * std::log(u) < (std::log(1.0 + z / b) * b * b - zz * 0.5 - z * b)) return((z + b)*(z + b)); } } } std::ostream & RandChiSquare::put ( std::ostream & os ) const { int pr=os.precision(20); std::vector t(2); os << " " << name() << "\n"; os << "Uvec" << "\n"; t = DoubConv::dto2longs(defaultA); os << defaultA << " " << t[0] << " " << t[1] << "\n"; os.precision(pr); return os; #ifdef REMOVED int pr=os.precision(20); os << " " << name() << "\n"; os << defaultA << "\n"; os.precision(pr); return os; #endif } std::istream & RandChiSquare::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } if (possibleKeywordInput(is, "Uvec", defaultA)) { std::vector t(2); is >> defaultA >> t[0] >> t[1]; defaultA = DoubConv::longs2double(t); return is; } // is >> defaultA encompassed by possibleKeywordInput return is; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RanecuEngine.cc0000755000175000017500000002726011753236267017304 0ustar olesoles// $Id: RanecuEngine.cc,v 1.7 2010/07/20 18:06:02 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RanecuEngine --- // class implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // // RANECU Random Engine - algorithm originally written in FORTRAN77 // as part of the MATHLIB HEP library. // ======================================================================= // Gabriele Cosmo - Created - 2nd February 1996 // - Minor corrections: 31st October 1996 // - Added methods for engine status: 19th November 1996 // - Added abs for setting seed index: 11th July 1997 // - Modified setSeeds() to handle default index: 16th Oct 1997 // - setSeed() now resets the engine status to the original // values in the static table of HepRandom: 19th Mar 1998 // J.Marraffino - Added stream operators and related constructor. // Added automatic seed selection from seed table and // engine counter: 16th Feb 1998 // Ken Smith - Added conversion operators: 6th Aug 1998 // J. Marraffino - Remove dependence on hepString class 13 May 1999 // M. Fischler - Add endl to the end of saveStatus 10 Apr 2001 // M. Fischler - In restore, checkFile for file not found 03 Dec 2004 // M. Fischler - Methods for distrib. instance save/restore 12/8/04 // M. Fischler - split get() into tag validation and // getState() for anonymous restores 12/27/04 // M. Fischler - put/get for vectors of ulongs 3/14/05 // M. Fischler - State-saving using only ints, for portability 4/12/05 // M. Fischler - Modify ctor and setSeed to utilize all info provided // and avoid coincidence of same state from different // seeds 6/22/10 // // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Random/RanecuEngine.h" #include "CLHEP/Random/engineIDulong.h" #include // for strcmp #include #include namespace CLHEP { static const int MarkerLen = 64; // Enough room to hold a begin or end marker. static const double prec = 4.6566128E-10; std::string RanecuEngine::name() const {return "RanecuEngine";} void RanecuEngine::further_randomize (int seq1, int col, int index, int modulus) { table[seq1][col] -= (index&0x3FFFFFFF); while (table[seq1][col] <= 0) table[seq1][col] += (modulus-1); } // mf 6/22/10 // Number of instances with automatic seed selection int RanecuEngine::numEngines = 0; RanecuEngine::RanecuEngine() : HepRandomEngine() { int cycle = std::abs(int(numEngines/maxSeq)); seq = std::abs(int(numEngines%maxSeq)); numEngines += 1; theSeed = seq; long mask = ((cycle & 0x007fffff) << 8); for (int i=0; i<2; ++i) { for (int j=0; j> *this; } RanecuEngine::~RanecuEngine() {} void RanecuEngine::setSeed(long index, int dum) { seq = std::abs(int(index%maxSeq)); theSeed = seq; HepRandom::getTheTableSeeds(table[seq],seq); theSeeds = &table[seq][0]; further_randomize (seq, 0, index, shift1); // mf 6/22/10 further_randomize (seq, 1, dum, shift2); // mf 6/22/10 } void RanecuEngine::setSeeds(const long* seeds, int pos) { if (pos != -1) { seq = std::abs(int(pos%maxSeq)); theSeed = seq; } // only positive seeds are allowed table[seq][0] = std::abs(seeds[0])%shift1; table[seq][1] = std::abs(seeds[1])%shift2; theSeeds = &table[seq][0]; } void RanecuEngine::setIndex(long index) { seq = std::abs(int(index%maxSeq)); theSeed = seq; theSeeds = &table[seq][0]; } void RanecuEngine::saveStatus( const char filename[] ) const { std::ofstream outFile( filename, std::ios::out ) ; if (!outFile.bad()) { outFile << "Uvec\n"; std::vector v = put(); #ifdef TRACE_IO std::cout << "Result of v = put() is:\n"; #endif for (unsigned int i=0; i v; unsigned long xin; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { inFile >> xin; #ifdef TRACE_IO std::cout << "ivec = " << ivec << " xin = " << xin << " "; if (ivec%3 == 0) std::cout << "\n"; #endif if (!inFile) { inFile.clear(std::ios::badbit | inFile.rdstate()); std::cerr << "\nJamesRandom state (vector) description improper." << "\nrestoreStatus has failed." << "\nInput stream is probably mispositioned now." << std::endl; return; } v.push_back(xin); } getState(v); return; } if (!inFile.bad() && !inFile.eof()) { // inFile >> theSeed; removed -- encompased by possibleKeywordInput for (int i=0; i<2; ++i) inFile >> table[theSeed][i]; seq = int(theSeed); } } void RanecuEngine::showStatus() const { std::cout << std::endl; std::cout << "--------- Ranecu engine status ---------" << std::endl; std::cout << " Initial seed (index) = " << theSeed << std::endl; std::cout << " Current couple of seeds = " << table[theSeed][0] << ", " << table[theSeed][1] << std::endl; std::cout << "----------------------------------------" << std::endl; } double RanecuEngine::flat() { const int index = seq; long seed1 = table[index][0]; long seed2 = table[index][1]; int k1 = (int)(seed1/ecuyer_b); int k2 = (int)(seed2/ecuyer_e); seed1 = ecuyer_a*(seed1-k1*ecuyer_b)-k1*ecuyer_c; if (seed1 < 0) seed1 += shift1; seed2 = ecuyer_d*(seed2-k2*ecuyer_e)-k2*ecuyer_f; if (seed2 < 0) seed2 += shift2; table[index][0] = seed1; table[index][1] = seed2; long diff = seed1-seed2; if (diff <= 0) diff += (shift1-1); return (double)(diff*prec); } void RanecuEngine::flatArray(const int size, double* vect) { const int index = seq; long seed1 = table[index][0]; long seed2 = table[index][1]; int k1, k2; register int i; for (i=0; i v = put(); for (unsigned int i=0; i RanecuEngine::put () const { std::vector v; v.push_back (engineIDulong()); v.push_back(static_cast(theSeed)); v.push_back(static_cast(table[theSeed][0])); v.push_back(static_cast(table[theSeed][1])); return v; } std::istream & RanecuEngine::get ( std::istream& is ) { char beginMarker [MarkerLen]; is >> std::ws; is.width(MarkerLen); // causes the next read to the char* to be <= // that many bytes, INCLUDING A TERMINATION \0 // (Stroustrup, section 21.3.2) is >> beginMarker; if (strcmp(beginMarker,"RanecuEngine-begin")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nInput stream mispositioned or" << "\nRanecuEngine state description missing or" << "\nwrong engine type found." << std::endl; return is; } return getState(is); } std::string RanecuEngine::beginTag ( ) { return "RanecuEngine-begin"; } std::istream & RanecuEngine::getState ( std::istream& is ) { if ( possibleKeywordInput ( is, "Uvec", theSeed ) ) { std::vector v; unsigned long uu; for (unsigned int ivec=0; ivec < VECTOR_STATE_SIZE; ++ivec) { is >> uu; if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nRanecuEngine state (vector) description improper." << "\ngetState() has failed." << "\nInput stream is probably mispositioned now." << std::endl; return is; } v.push_back(uu); } getState(v); return (is); } // is >> theSeed; Removed, encompassed by possibleKeywordInput() char endMarker [MarkerLen]; for (int i=0; i<2; ++i) { is >> table[theSeed][i]; } is >> std::ws; is.width(MarkerLen); is >> endMarker; if (strcmp(endMarker,"RanecuEngine-end")) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nRanecuEngine state description incomplete." << "\nInput stream is probably mispositioned now." << std::endl; return is; } seq = int(theSeed); return is; } bool RanecuEngine::get (const std::vector & v) { if ((v[0] & 0xffffffffUL) != engineIDulong()) { std::cerr << "\nRanecuEngine get:state vector has wrong ID word - state unchanged\n"; return false; } return getState(v); } bool RanecuEngine::getState (const std::vector & v) { if (v.size() != VECTOR_STATE_SIZE ) { std::cerr << "\nRanecuEngine get:state vector has wrong length - state unchanged\n"; return false; } theSeed = v[1]; table[theSeed][0] = v[2]; table[theSeed][1] = v[3]; seq = int(theSeed); return true; } } // namespace CLHEP clhep-2.1.4.1.orig/Random/src/RandFlat.cc0000755000175000017500000002055011406204345016412 0ustar olesoles// $Id: RandFlat.cc,v 1.6 2010/06/16 17:24:53 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandFlat --- // class implementation file // ----------------------------------------------------------------------- // This file is part of Geant4 (simulation toolkit for HEP). // ======================================================================= // Gabriele Cosmo - Created: 17th May 1995 // - Added methods to shoot arrays: 28th July 1997 // - Added operator(): 24th Jul 1997 // J.Marraffino - Added default arguments as attributes and // operator() with arguments: 16th Feb 1998 // M Fischler - Copy constructor should supply right engine to HepRandom: // 1/26/00. // M Fischler - Semi-fix to the saveEngineStatus misbehavior causing // non-reproducing shootBit() 3/1/00. // M Fischler - Avoiding hang when file not found in restoreEngineStatus // 12/3/04 // M Fischler - put and get to/from streams 12/10/04 // M Fischler - save and restore dist to streams 12/20/04 // M Fischler - put/get to/from streams uses pairs of ulongs when // + storing doubles avoid problems with precision // 4/14/05 // ======================================================================= #include "CLHEP/Random/defs.h" #include "CLHEP/Random/RandFlat.h" #include "CLHEP/Random/DoubConv.hh" #include // for strcmp namespace CLHEP { const int RandFlat::MSBBits= 15; const unsigned long RandFlat::MSB= 1ul<flat(); } void RandFlat::shootArray(const int size, double* vect) { HepRandom::getTheEngine()->flatArray(size,vect); } void RandFlat::shootArray( const int size, double* vect, double lx, double dx ) { int i; for (i=0; isaveStatus( filename ); // Now append the cached random Int, and first unused bit: std::ofstream outfile ( filename, std::ios::app ); outfile << "RANDFLAT staticRandomInt: " << staticRandomInt << " staticFirstUnusedBit: " << staticFirstUnusedBit << "\n"; } // saveEngineStatus void RandFlat::restoreEngineStatus( const char filename[] ) { // First restore the engine status just like the base class would do: getTheEngine()->restoreStatus( filename ); // Now find the line describing the cached data: std::ifstream infile ( filename, std::ios::in ); if (!infile) return; char inputword[] = "NO_KEYWORD "; // leaves room for 14 characters plus \0 while (true) { infile.width(13); infile >> inputword; if (strcmp(inputword,"RANDFLAT")==0) break; if (infile.eof()) break; // If the file ends without the RANDFLAT line, that means this // was a file produced by an earlier version of RandFlat. We will // replicate the old behavior in that case: staticFirstUnusedBit // and staticRandomInt retain their existing values. } // Then read and use the caching info: if (strcmp(inputword,"RANDFLAT")==0) { char setword[40]; // the longest, staticFirstUnusedBit: has length 21 infile.width(39); infile >> setword; // setword should be staticRandomInt: infile >> staticRandomInt; infile.width(39); infile >> setword; // setword should be staticFirstUnusedBit: infile >> staticFirstUnusedBit; } } // restoreEngineStatus std::ostream & RandFlat::put ( std::ostream & os ) const { int pr=os.precision(20); std::vector t(2); os << " " << name() << "\n"; os << "Uvec" << "\n"; os << randomInt << " " << firstUnusedBit << "\n"; t = DoubConv::dto2longs(defaultWidth); os << defaultWidth << " " << t[0] << " " << t[1] << "\n"; t = DoubConv::dto2longs(defaultA); os << defaultA << " " << t[0] << " " << t[1] << "\n"; t = DoubConv::dto2longs(defaultB); os << defaultB << " " << t[0] << " " << t[1] << "\n"; #ifdef TRACE_IO std::cout << "RandFlat::put(): randomInt = " << randomInt << " firstUnusedBit = " << firstUnusedBit << "\ndefaultWidth = " << defaultWidth << " defaultA = " << defaultA << " defaultB = " << defaultB << "\n"; #endif os.precision(pr); return os; #ifdef REMOVED int pr=os.precision(20); os << " " << name() << "\n"; os << randomInt << " " << firstUnusedBit << "\n"; os << defaultWidth << " " << defaultA << " " << defaultB << "\n"; os.precision(pr); return os; #endif } std::istream & RandFlat::get ( std::istream & is ) { std::string inName; is >> inName; if (inName != name()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read state of a " << name() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } if (possibleKeywordInput(is, "Uvec", randomInt)) { std::vector t(2); is >> randomInt >> firstUnusedBit; is >> defaultWidth >>t[0]>>t[1]; defaultWidth = DoubConv::longs2double(t); is >> defaultA >> t[0] >> t[1]; defaultA = DoubConv::longs2double(t); is >> defaultB >> t[0] >> t[1]; defaultB = DoubConv::longs2double(t); #ifdef TRACE_IO std::cout << "RandFlat::get(): randomInt = " << randomInt << " firstUnusedBit = " << firstUnusedBit << "\ndefaultWidth = " << defaultWidth << " defaultA = " << defaultA << " defaultB = " << defaultB << "\n"; #endif if (!is) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "\nRandFlat input failed" << "\nInput stream is probably mispositioned now." << std::endl; return is; } return is; } // is >> randomInt encompassed by possibleKeywordInput is >> firstUnusedBit; is >> defaultWidth >> defaultA >> defaultB; return is; } std::ostream & RandFlat::saveDistState ( std::ostream & os ) { os << distributionName() << "\n"; int prec = os.precision(20); os << "RANDFLAT staticRandomInt: " << staticRandomInt << " staticFirstUnusedBit: " << staticFirstUnusedBit << "\n"; os.precision(prec); return os; } std::istream & RandFlat::restoreDistState ( std::istream & is ) { std::string inName; is >> inName; if (inName != distributionName()) { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read static state of a " << distributionName() << " distribution\n" << "Name found was " << inName << "\nistream is left in the badbit state\n"; return is; } std::string keyword; std::string c1; std::string c2; is >> keyword; if (keyword!="RANDFLAT") { is.clear(std::ios::badbit | is.rdstate()); std::cerr << "Mismatch when expecting to read RANDFLAT bit cache info: " << keyword << "\n"; return is; } is >> c1 >> staticRandomInt >> c2 >> staticFirstUnusedBit; return is; } std::ostream & RandFlat::saveFullState ( std::ostream & os ) { HepRandom::saveFullState(os); saveDistState(os); return os; } std::istream & RandFlat::restoreFullState ( std::istream & is ) { HepRandom::restoreFullState(is); restoreDistState(is); return is; } } // namespace CLHEP clhep-2.1.4.1.orig/doxygen.template0000755000175000017500000000215511406214373015616 0ustar olesoles CLHEP Reference Documentation
    CLHEP VERSION Reference Documentation
       
    CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

    clhep-2.1.4.1.orig/Evaluator/0000755000175000017500000000000012242515153014337 5ustar olesolesclhep-2.1.4.1.orig/Evaluator/Evaluator/0000755000175000017500000000000012242515152016300 5ustar olesolesclhep-2.1.4.1.orig/Evaluator/Evaluator/cmake-defs.h.in0000644000175000017500000000172511607115601021061 0ustar olesoles/* @PACKAGE@/defs.h Generated by cmake. */ #ifndef @UPACKAGE@_DEFS_H #define @UPACKAGE@_DEFS_H /* Name of package */ #ifndef PACKAGE #define PACKAGE "@PACKAGE@" #endif /* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #define PACKAGE_BUGREPORT "http://savannah.cern.ch/projects/clhep/" #endif /* Define to the full name of this package. */ #ifndef PACKAGE_NAME #define PACKAGE_NAME "@PROJECT_NAME@ @PACKAGE@" #endif /* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #define PACKAGE_STRING "@PROJECT_NAME@ @PACKAGE@ @VERSION@" #endif /* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #define PACKAGE_TARNAME "@PACKAGE@" #endif /* Define to the version of this package. */ #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "@VERSION@" #endif /* Version number of package */ #ifndef VERSION #define VERSION "@VERSION@" #endif #endif // @UPACKAGE@_DEFS_H clhep-2.1.4.1.orig/Evaluator/Evaluator/copy-header.pl.in0000755000175000017500000000164110043470313021443 0ustar olesoles#!/usr/bin/env perl # # copy a header into the temporary CLHEP header tree if # a) the header is not already there # b) the source is newer # if ($#ARGV != 1) { print "mungeit requires two arguments - exit\n"; exit; } else { $source_header=$ARGV[0]; $dest_header=$ARGV[1]; &check_header; } exit; sub check_header { # make sure source exists if ( ! -e $source_header ) { print "$source_header does not exist - exit\n"; exit; } # copy if not already there - otherwise, check the time stamp if ( ! -e $dest_header ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } else { $source_header_time = -M $source_header; $dest_header_time = -M $dest_header; # copy only if source is newer if( $source_header_time < $dest_header_time ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } } } clhep-2.1.4.1.orig/Evaluator/Evaluator/Makefile.am0000755000175000017500000000132610233516370020342 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@ COPY_P = @COPY_P@ pkginclude_HEADERS = \ Evaluator.h \ defs.h # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = defs.h # copy headers into $(tempincludedir) install-tmpHEADERS: @echo " install headers in $(tempincludedir) " @list='$(pkginclude_HEADERS)'; \ if test $(tempincludedir); then \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ ./copy-header.pl $$d$$p $(tempincludedir)/$$f; \ done; \ fi; test -z "$$fail" clhep-2.1.4.1.orig/Evaluator/Evaluator/.cvsignore0000755000175000017500000000002607705453233020312 0ustar olesolesMakefile.in defs.h.in clhep-2.1.4.1.orig/Evaluator/Evaluator/CMakeLists.txt0000644000175000017500000000025311606714767021060 0ustar olesoles set( pkginclude_HEADERS Evaluator.h ) # notice that defs.h is not referenced here INSTALL (FILES ${pkginclude_HEADERS} DESTINATION include/CLHEP/Evaluator ) clhep-2.1.4.1.orig/Evaluator/Evaluator/Evaluator.h0000755000175000017500000002006211421353102020407 0ustar olesoles// -*- C++ -*- // $Id: Evaluator.h,v 1.2 2010/07/20 17:00:49 garren Exp $ // --------------------------------------------------------------------------- #ifndef HEP_EVALUATOR_H #define HEP_EVALUATOR_H #include namespace HepTool { /** * Evaluator of arithmetic expressions with an extendable dictionary. * Example: * @code * #include "CLHEP/Evaluator/Evaluator.h" * HepTool::Evaluator eval; * eval.setStdMath(); * double res = eval.evaluate("sin(30*degree)"); * if (eval.status() != HepTool::Evaluator::OK) eval.print_error(); * @endcode * * @author Evgeni Chernyaev * @ingroup evaluator */ class Evaluator { public: /** * List of possible statuses. * Status of the last operation can be obtained with status(). * In case if status() is an ERROR the corresponding error message * can be printed with print_error(). * * @see status * @see error_position * @see print_error */ enum { OK, /**< Everything OK */ WARNING_EXISTING_VARIABLE, /**< Redefinition of existing variable */ WARNING_EXISTING_FUNCTION, /**< Redefinition of existing function */ WARNING_BLANK_STRING, /**< Empty input string */ ERROR_NOT_A_NAME, /**< Not allowed sysmbol in the name of variable or function */ ERROR_SYNTAX_ERROR, /**< Systax error */ ERROR_UNPAIRED_PARENTHESIS, /**< Unpaired parenthesis */ ERROR_UNEXPECTED_SYMBOL, /**< Unexpected sysbol */ ERROR_UNKNOWN_VARIABLE, /**< Non-existing variable */ ERROR_UNKNOWN_FUNCTION, /**< Non-existing function */ ERROR_EMPTY_PARAMETER, /**< Function call has empty parameter */ ERROR_CALCULATION_ERROR /**< Error during calculation */ }; /** * Constructor. */ Evaluator(); /** * Destructor. */ ~Evaluator(); /** * Evaluates the arithmetic expression given as character string. * The expression may consist of numbers, variables and functions * separated by arithmetic (+, - , /, *, ^, **) and logical * operators (==, !=, >, >=, <, <=, &&, ||). * * @param expression input expression. * @return result of the evaluation. * @see status * @see error_position * @see print_error */ double evaluate(const char * expression); /** * Returns status of the last operation with the evaluator. */ int status() const; /** * Returns position in the input string where the problem occured. */ int error_position() const; /** * Prints error message if status() is an ERROR. */ void print_error() const; /** * get a string defining the error name */ std::string error_name() const; /** * Adds to the dictionary a variable with given value. * If a variable with such a name already exist in the dictionary, * then status will be set to WARNING_EXISTING_VARIABLE. * * @param name name of the variable. * @param value value assigned to the variable. */ void setVariable(const char * name, double value); /** * Adds to the dictionary a variable with an arithmetic expression * assigned to it. * If a variable with such a name already exist in the dictionary, * then status will be set to WARNING_EXISTING_VARIABLE. * * @param name name of the variable. * @param expression arithmetic expression. */ void setVariable(const char * name, const char * expression); /** * Adds to the dictionary a function without parameters. * If such a function already exist in the dictionary, * then status will be set to WARNING_EXISTING_FUNCTION. * * @param name function name. * @param fun pointer to the real function in the user code. */ void setFunction(const char * name, double (*fun)()); /** * Adds to the dictionary a function with one parameter. * If such a function already exist in the dictionary, * then status will be set to WARNING_EXISTING_FUNCTION. * * @param name function name. * @param fun pointer to the real function in the user code. */ void setFunction(const char * name, double (*fun)(double)); /** * Adds to the dictionary a function with two parameters. * If such a function already exist in the dictionary, * then status will be set to WARNING_EXISTING_FUNCTION. * * @param name function name. * @param fun pointer to the real function in the user code. */ void setFunction(const char * name, double (*fun)(double,double)); /** * Adds to the dictionary a function with three parameters. * If such a function already exist in the dictionary, * then status will be set to WARNING_EXISTING_FUNCTION. * * @param name function name. * @param fun pointer to the real function in the user code. */ void setFunction(const char * name, double (*fun)(double,double,double)); /** * Adds to the dictionary a function with four parameters. * If such a function already exist in the dictionary, * then status will be set to WARNING_EXISTING_FUNCTION. * * @param name function name. * @param fun pointer to the real function in the user code. */ void setFunction(const char * name, double (*fun)(double,double,double,double)); /** * Adds to the dictionary a function with five parameters. * If such a function already exist in the dictionary, * then status will be set to WARNING_EXISTING_FUNCTION. * * @param name function name. * @param fun pointer to the real function in the user code. */ void setFunction(const char * name, double (*fun)(double,double,double,double,double)); /** * Finds the variable in the dictionary. * * @param name name of the variable. * @return true if such a variable exists, false otherwise. */ bool findVariable(const char * name) const; /** * Finds the function in the dictionary. * * @param name name of the function to be unset. * @param npar number of parameters of the function. * @return true if such a function exists, false otherwise. */ bool findFunction(const char * name, int npar) const; /** * Removes the variable from the dictionary. * * @param name name of the variable. */ void removeVariable(const char * name); /** * Removes the function from the dictionary. * * @param name name of the function to be unset. * @param npar number of parameters of the function. */ void removeFunction(const char * name, int npar); /** * Clear all settings. */ void clear(); /** * Sets standard mathematical functions and constants. */ void setStdMath(); /** * Sets system of units. Default is the SI system of units. * To set the CGS (Centimeter-Gram-Second) system of units * one should call: * setSystemOfUnits(100., 1000., 1.0, 1.0, 1.0, 1.0, 1.0); * * To set system of units accepted in the GEANT4 simulation toolkit * one should call: * @code * setSystemOfUnits(1.e+3, 1./1.60217733e-25, 1.e+9, 1./1.60217733e-10, * 1.0, 1.0, 1.0); * @endcode * * The basic units in GEANT4 are: * @code * millimeter (millimeter = 1.) * nanosecond (nanosecond = 1.) * Mega electron Volt (MeV = 1.) * positron charge (eplus = 1.) * degree Kelvin (kelvin = 1.) * the amount of substance (mole = 1.) * luminous intensity (candela = 1.) * radian (radian = 1.) * steradian (steradian = 1.) * @endcode */ void setSystemOfUnits(double meter = 1.0, double kilogram = 1.0, double second = 1.0, double ampere = 1.0, double kelvin = 1.0, double mole = 1.0, double candela = 1.0); private: void * p; // private data Evaluator(const Evaluator &); // copy constructor is not allowed Evaluator & operator=(const Evaluator &); // assignment is not allowed }; } // namespace HepTool #endif /* HEP_EVALUATOR_H */ clhep-2.1.4.1.orig/Evaluator/Evaluator-deps.in0000755000175000017500000000006507720431750017573 0ustar olesolesCLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ clhep-2.1.4.1.orig/Evaluator/INSTALL0000755000175000017500000000772111406161732015403 0ustar olesoles#------------------------------------------------------------- # platform specific issues #------------------------------------------------------------- This package requires autoconf 2.59 or later and automake 1.9.1 or later. If you bootstrap, you will probably have to build these yourself. See "building autotools" below. The new libtool no longer properly supports shared libraries for gcc 2.95.2. If you build CLHEP with gcc 2.95.2, you must configure --disable-shared. To build for Solaris CC, configure with CXX=CC CC=cc and use gmake. On MacOSX, you need to define MACOSX_DEPLOYMENT_TARGET appropriately. For instance, set MACOSX_DEPLOYMENT_TARGET to "10.4" if you have MacOS 10.4 installed on your system. #------------------------------------------------------------- # installing from a source code tar ball #------------------------------------------------------------- Unwind the source code tar ball in some relevant directory. Autoconf and automake will aready have been run. Determine where the files will be installed. Create a build directory that is NOT in the source code directory tree. cd /configure --prefix= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make check (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # configure options #------------------------------------------------------------- A variety of options can be given to configure. Below is a list of the options that you are likely to find most useful. --help provides a partial list of options --prefix=PREFIX install architecture-independent files in PREFIX [default is /usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [default is the same as PREFIX] --disable-shared build only static libraries --disable-static build only shared libraries --enable-exceptions use the CLHEP/Exceptions package --disable-exceptions DO NOT use the CLHEP/Exceptions package [--disable-exceptions is the default] #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are neither built nor installed automatically. Use the following commands to build and install documents: make docs make install-docs #------------------------------------------------------------- # building from cvs #------------------------------------------------------------- You will need current versions of automake, autoconf, and libtool. See building autotools below. cvs co CLHEP/package OR cvs co package cd [CLHEP/]package ./bootstrap Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building autotools #------------------------------------------------------------- If you do not have at least autoconf 2.59 and automake 1.9.1, you will need to build autoconf, automake, and libtool. On some platforms, you may also need to build m4 and texinfo. Download the relevant tarballs from gnu.org (http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/, and http://www.gnu.org/software/libtool/) Untar them in a common source code tree. Decide whether you want to install them in /usr/local or your own install directory. If you use your own install directory, use --prefix= with configure. For each autotool package: /configure [--prefix=] make make install Make sure that /bin is at the front of your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/Evaluator/Makefile.am0000755000175000017500000000447710233516370016412 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP # put . first so that CLHEP directory is built before anything else SUBDIRS = Evaluator . src test # list all subdirectories - for distribution and cleaning DIST_SUBDIRS = Evaluator . src test bin_SCRIPTS = Evaluator-config all-local: $(top_builddir)/CLHEP # create temporary CLHEP header tree # we only copy headers for packages listed in @PACKAGE@-deps # search for header directories in the following order: # 1. $(top_builddir)/this-package # 2. $(top_builddir)/../other-packages # 3. $(CLHEPSOURCE_DIR)/CLHEP # 4. $(CLHEP_DIR)/include/CLHEP # # abs_ => absolute path abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ COPY_P = @COPY_P@ $(top_builddir)/CLHEP: temp-package-dirs @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ if test -d "$$pkg" ; then \ (cd $$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d ../"$$pkg"/"$$pkg" ; then \ (cd ../$$pkg/$$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg"; then \ hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ else \ if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/include/CLHEP; then \ if test -d $(CLHEP_DIR)/include/CLHEP/"$$pkg"; then \ hdrs=`ls $(CLHEP_DIR)/include/CLHEP/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEP_DIR)/include/CLHEP/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ fi; \ fi; \ fi; \ fi; \ fi; \ done; temp-package-dirs: $(mkinstalldirs) $(abs_top_builddir)/CLHEP; @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ $(mkinstalldirs) $(abs_top_builddir)/CLHEP/$$pkg; \ done; docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs # extra clean rule clean-local: rm -rf $(top_builddir)/CLHEP clhep-2.1.4.1.orig/Evaluator/bootstrap0000755000175000017500000000071510233516370016305 0ustar olesoles#! /bin/sh set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 rm -f Makefile.in */Makefile.in */defs.h.in rm -f autotools/config* autotools/depcomp autotools/install-sh autotools/m* rm -f configure config.* # run autotool commands aclocal -I autotools autoheader automake --add-missing --copy autoconf # ready to make a source code distribution tarball clhep-2.1.4.1.orig/Evaluator/configure.ac0000755000175000017500000002723612241267303016642 0ustar olesoles# ====================================================================== # This is the Evaluator configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.59) AC_INIT(CLHEP Evaluator, 2.1.4.1, http://savannah.cern.ch/projects/clhep/, Evaluator) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([src/Evaluator.cc]) AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # ---------------------------------------------------------------------- # --enable-shared and --enable-static # both shared and static libraries are built by default # ---------------------------------------------------------------------- AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Header containing #defines: AM_CONFIG_HEADER([Evaluator/defs.h]) # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Evaluator/Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([Evaluator-deps]) AC_CONFIG_FILES([Evaluator/copy-header.pl], [chmod +x Evaluator/copy-header.pl]) # Configuration inquiry program/script: AC_CONFIG_FILES([Evaluator-config], [chmod +x Evaluator-config]) # Test driver program/script: AC_CONFIG_FILES([test/testEvaluator.sh], [chmod +x test/testEvaluator.sh]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- Evaluator_CPPFLAGS="-I$includedir" Evaluator_LDFLAGS="-L$libdir" Evaluator_LIBS="-lCLHEP-$PACKAGE-$VERSION" AC_SUBST(Evaluator_CPPFLAGS) AC_SUBST(Evaluator_LIBS) AC_SUBST(Evaluator_LDFLAGS) # ---------------------------------------------------------------------- # Supply boilerplate for Evaluator/defs.h source header: # ---------------------------------------------------------------------- AH_TOP([#ifndef EVALUATOR_DEFS_H #define EVALUATOR_DEFS_H]) ## the undefs are converted by configure AH_VERBATIM([PACKAGE],[/* Name of package */ #ifndef PACKAGE #undef PACKAGE #endif]) AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif]) AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */ #ifndef PACKAGE_NAME #undef PACKAGE_NAME #endif]) AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #undef PACKAGE_STRING #endif]) AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif]) AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */ #ifndef PACKAGE_VERSION #undef PACKAGE_VERSION #endif]) AH_VERBATIM([VERSION],[/* Version number of package */ #ifndef VERSION #undef VERSION #endif]) AH_BOTTOM([#endif // EVALUATOR_DEFS_H]) # ---------------------------------------------------------------------- # Account for any user configuration options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; icc) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Set system-dependent options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed libraries: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed header files: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed typedefs, structures, and compiler characteristics: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed library functions: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/Evaluator/COPYING.LESSER0000644000175000017500000001674311406161732016402 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/Evaluator/Evaluator-config.in0000755000175000017500000000406512234340066020104 0ustar olesoles#! /bin/sh # @configure_input@ # we include the paths of the original install directories for reference orig_prefix="@prefix@" orig_exec_prefix="@exec_prefix@" orig_includedir="@includedir@" # use the full name of this script to get the current path configpath=`dirname ${0}` # check for a leading slash to determine if this is a relative path firstc=`expr ${configpath} : "\/"` calldir=`pwd` if [ ${firstc} -eq 0 ] then cd "${calldir}/${configpath}"; newpath=`pwd` binpath=${newpath} else binpath=${configpath} fi # OK - now we have to strip the trailing "/bin" out of the path prefix=`dirname "${binpath}"` includedir=${prefix}/include libdir=${prefix}/lib usage() { cat < Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/Evaluator/test/0000755000175000017500000000000012242515152015315 5ustar olesolesclhep-2.1.4.1.orig/Evaluator/test/testEvaluator.input0000755000175000017500000000017307705343760021260 0ustar olesolessin(30*deg) atmosphere atm bar Gs kGs mm cm km liter L dpt gram ms mA kHz MHz kbar mbar kJ MJ GJ PeV exit kW MW GW mF exit clhep-2.1.4.1.orig/Evaluator/test/testEvaluator.sh.in0000755000175000017500000000022711776622027021137 0ustar olesoles#! /bin/sh # @configure_input@ ./testEvaluator@EXEEXT@ < "@srcdir@/testEvaluator.input" \ | @DIFF_Q@ - "@srcdir@/testEvaluator.output" > /dev/null clhep-2.1.4.1.orig/Evaluator/test/Makefile.am0000755000175000017500000000343011712053775017365 0ustar olesoles# Applicable to each test program: if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir)/ # libraries to link, and whence if BUILD_STATIC LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.a OUTFLAG = -o $@ else if BUILD_VISUAL LDADD = $(top_builddir)/src/CLHEP-@PACKAGE@-@VERSION@.$(SHEXT) OUTFLAG = /Fo$@ else LIBS += $(MY_LD)$(top_builddir)/src LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.$(SHEXT) OUTFLAG = -o $@ endif endif # normally, CXXLINK is supplied by automake, but we need to use /Fo instead # of -o when compiling with Visual C++ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ $(OUTFLAG) # Identify executables needed during testing: check_PROGRAMS = \ testEvaluator testBug66214 testBug90848 check_SCRIPTS = \ testEvaluator.sh # Identify test(s) to run when 'make check' is requested: TESTS = \ testEvaluator.sh testBug66214 testBug90848 # Identify the test(s) for which failure is the intended outcome: XFAIL_TESTS = # Identify the dependencies on a per-test basis: testEvaluator_SOURCES = testEvaluator.cc testBug66214_SOURCES = testBug66214.cc testBug90848_SOURCES = testBug90848.cc # Identify input data file(s) and prototype output file(s): EXTRA_DIST = \ testEvaluator.input testEvaluator.output # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = testEvaluator.sh testBug66214.cout # supply our own suffix rule .cc.obj: if BUILD_VISUAL source='$<' object='$@' libtool=no \ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ $(CXXCOMPILE) -c $(OUTFLAG) `$(CYGPATH_W) '$<'` else if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c $(OUTFLAG) `$(CYGPATH_W) '$<'`; \ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi endif clhep-2.1.4.1.orig/Evaluator/test/testBug66214.cc0000644000175000017500000000507711712053775017666 0ustar olesoles// --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is a test for bug report 66214 in the Evaluator class. // #include #include #include double eval( std::string expr, int& numbad, std::ofstream& os) { static HepTool::Evaluator *ev=0; if(ev == 0) ev = new HepTool::Evaluator(); ev->setStdMath(); // set standard constants and functions ev->setSystemOfUnits(); // set SI units double v = ev->evaluate(expr.data()); os << "CALC> " << expr << ": "; if(ev->status() != HepTool::Evaluator::OK) { os << ev->error_name() << std::endl; ++numbad; } else { os << v << std::endl; } return v; } int main() { int numbad = 0; double result; // many of these expressions fail in releases prior to 2.0.4.7 std::string exp[43] = { " +1", " -1", "1 + 1", "1 + -1","1 + (-1)", "1 + +1","1 + (+1)", "1 * -1","1 * (-1)", "-1 * 1", "10^-1", "10^(-1)", "9*4", "9 * -4","9 * (-4)", "4*---2","4*(---2)","4*(-(--2))","4*(--(-2))","4*(-(-(-2)))", "4*--2", "4*(--2)", "4*(-(-2))", "-5^2", "9*4+2", "231/-11","231/-11+10","231/-11/3","(231/-11)+10", "100/5^2","100/+5^2","100/-5^2", "9*4+30", "9*4+-30", "100/(5^2)","100/(+5^2)","100/(-5^2)", "100/(-5)^2", "100/((-5)^2)", "-9*4+30","9*-4+30","9*(-4)+30","(9*-4)+30" }; double res[43] = { 1., -1., 2., 0., 0., 2., 2., -1., -1., -1., 0.1, 0.1, 36., -36., -36., -8., -8., -8., -8., -8., 8., 8., 8., -25., 38., -21., -11., -7., -11., 4., 4., -4., 66., 6., 4., 4., -4., 4., 4., -6., -6., -6., -6. }; std::string exp2[3] = { "sin(45*deg)", "sin(45*pi/-180)", "232/22" }; std::ofstream os("testBug66214.cout"); for(int i=0; i<43; ++i ) { result=eval(exp[i],numbad,os); if( result != res[i] ) { ++numbad; os << "ERROR: expected " << res[i] << " got " << result << std::endl; os << std::endl; } } // inspect these by hand // return values: 0.707107, -0.707107, 10.5455 for(int i=0; i<3; ++i ) { eval(exp2[i],numbad,os); } return numbad; } clhep-2.1.4.1.orig/Evaluator/test/.cvsignore0000755000175000017500000000001407714461020017315 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Evaluator/test/testBug90848.cc0000644000175000017500000000504311761764734017701 0ustar olesoles// test Bug #90848 in CLHEP::Evaluator // Author: Tom Roberts #include #include #include #include #include "CLHEP/Evaluator/Evaluator.h" class MyEvaluator : public HepTool::Evaluator { public: MyEvaluator() : HepTool::Evaluator() { setStdMath(); } bool isOK() { return status() == OK; } double evaluate(const char *e) { double v = HepTool::Evaluator::evaluate(e); if(status() != OK) v = std::numeric_limits::quiet_NaN(); return v; } }; struct Test { const char *expr; double value1; // x=1, y=2, z=3 double value2; // x=10, y=-20 z=-30 }; Test tests[] = { { "x", 1.0, 10.0}, { "y", 2.0, -20.0}, { "z", 3.0, -30.0}, { "x+y", 3.0, -10.0}, { "-z", -3.0, 30.0}, { "0-z", -3.0, 30.0}, { "0 - -z", 3.0, -30.0}, { "10/-x", -10.0, -1.0}, { "exp(-y)*exp(y)", 1.0, 1.0}, { "exp(-y^2)*exp(y^2)", 1.0, 1.0}, { "-5*x", -5.0, -50.0}, { "5+-x", 4.0, -5.0}, { "5+(-x)", 4.0, -5.0}, { "5*-x", -5.0, -50.0}, { "5*(-x)", -5.0, -50.0}, { "-z^2", -9.0, -900.0}, { "0-z^2", -9.0, -900.0}, { "exp(-0.2*z^2)*exp(0.2*z^2)", 1.0, 1.0}, { "exp(0.2*-z^2)*exp(0.2*z^2)", 1.0, 1.0}, { "exp(-z^2*0.2)*exp(0.2*z^2)", 1.0, 1.0}, { "exp(0.2*-(z^2))*exp(0.2*z^2)", 1.0, 1.0}, { "exp(-(z^2)*0.2)*exp(0.2*z^2)", 1.0, 1.0}, { "exp(-0.2*z)*exp(0.2*z)", 1.0, 1.0}, { "exp(0.2*-z)*exp(0.2*z)", 1.0, 1.0}, { "exp(-z*0.2)*exp(0.2*z)", 1.0, 1.0}, }; int main() { MyEvaluator e; e.setVariable("x",1.0); e.setVariable("y",2.0); e.setVariable("z",3.0); //printf("x=1.0 y=2.0 z=3.0\n"); int err=0; for(unsigned i=0; i 1E-12 || !e.isOK()) { printf("%s = %.6f should be %.6f\n",tests[i].expr, e.evaluate(tests[i].expr),tests[i].value1); err = 1; } } e.setVariable("x",10.0); e.setVariable("y",-20.0); e.setVariable("z",-30.0); //printf("x=10.0 y=-20.0 z=-30.0\n"); for(unsigned i=0; i 1E-12 || !e.isOK()) { printf("%s = %.6f should be %.6f\n",tests[i].expr, e.evaluate(tests[i].expr),tests[i].value2); err = 1; } } double v=e.evaluate("unknown(0.0)"); if(!std::isnan(v) || e.isOK()) { printf("%s succeeded\n","unknown(0.0)"); err=1; } v = e.evaluate("unknown+0.0"); if(!std::isnan(v) || e.isOK()) { printf("%s succeeded\n","unknown+0.0"); err=1; } exit(err); } clhep-2.1.4.1.orig/Evaluator/test/testEvaluator.cc0000755000175000017500000000332307705343760020506 0ustar olesoles// -*- C++ -*- // $Id: testEvaluator.cc,v 1.1 2003/07/16 21:47:28 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is a test for the Evaluator class. // It can be also used as a scientific caculator. // #include "CLHEP/Evaluator/Evaluator.h" #include #include #include int main() { char exp[240]; HepTool::Evaluator eval; eval.setVariable(" dummy ", 0.); // these three lines have been assert( eval.findVariable(" dummy ") ); // included just for test eval.clear(); // =========================== eval.setStdMath(); // set standard constants and functions eval.setSystemOfUnits(); // set SI units std::cout.precision(15); for(;;) { std::cout << "CALC> "; // In principle, next two lines could be replaced with just // std::cin.getline(exp, 240); but that does not work on DEC // because of bug in the cxx V6.1-027 compiler. std::cin.get(exp, 240); std::cin.ignore(); if ( !std::cin || strcmp(exp,"exit") == 0 || strcmp(exp,"quit") == 0) { std::cout << std::endl; break; // exit } double value = eval.evaluate(exp); switch(eval.status()) { case HepTool::Evaluator::OK: std::cout << value << std::endl; break; case HepTool::Evaluator::WARNING_BLANK_STRING: continue; default: std::cout << "------"; for (int i=0; i 0.5 CALC> 101325 CALC> 101325 CALC> 100000 CALC> 0.0001 CALC> 0.1 CALC> 0.001 CALC> 0.01 CALC> 1000 CALC> 0.001 CALC> 0.001 CALC> 1 CALC> 0.001 CALC> 0.001 CALC> 0.001 CALC> 1000 CALC> 1000000 CALC> 100000000 CALC> 100 CALC> 1000 CALC> 1000000 CALC> 1000000000 CALC> 0.000160217733 CALC> clhep-2.1.4.1.orig/Evaluator/ChangeLog0000755000175000017500000002540612242515016016121 0ustar olesoles============================== 18.11.13 Release CLHEP-2.1.4.1 ============================== 2013-11-18 Lynn Garren * src/setSystemOfUnits.cc: additional units to match Units ============================== 05.11.13 Release CLHEP-2.1.4.0 ============================== ============================== 14.11.12 Release CLHEP-2.1.3.1 ============================== ============================== 06.11.12 Release CLHEP-2.1.3.0 ============================== ============================== 16.08.12 Release CLHEP-2.1.2.5 ============================== ============================== 09.07.12 Release CLHEP-2.1.2.4 ============================== ============================== 31.05.12 Release CLHEP-2.1.2.3 ============================== 2012-05-31 Lynn Garren * test/testBug90848.cc: remove unused variables 2012-05-11 Lynn Garren * src/setStdMath.cc, src/Evaluator.cc, test/testBug90848.cc: use explicit std:: with math functions ============================== 14.02.12 Release CLHEP-2.1.2.2 ============================== ============================== 06.02.12 Release CLHEP-2.1.2.1 ============================== 2012-01-31 Lynn Garren and Mark Fischler * src/Evaluator.cc: fix a problem with unary +/- and exponentials * test/testBug90848.cc: new test for bug #90848 ============================== 16.12.11 Release CLHEP-2.1.2.0 ============================== ============================== 29.07.11 Release CLHEP-2.1.1.0 ============================== ============================== 11.11.10 Release CLHEP-2.1.0.1 ============================== ============================== 23.07.10 Release CLHEP-2.1.0.0 ============================== 2010-06-29 * src/Evaluator.cc: Improve the logic so that unary plus and minus work as expected. See bug report #66214. 2010-06-28 Lynn Garren * Evaluator/Evaluator.h: Add error_name() method to return the error as a string * test/testBug66214.cc: Test unary operator bug (report #66214) ============================== 16.06.10 Release CLHEP-2.1.0.0.b01 ============================== ============================== 11.06.10 Release CLHEP-2.0.5.0.b01 ============================== ============================== 09.03.10 Release CLHEP-2.0.4.6 ============================== ============================== 08.12.09 Release CLHEP-2.0.4.5 ============================== ============================== 12.11.09 Release CLHEP-2.0.4.4 ============================== ============================== 03.11.09 Release CLHEP-2.0.4.4.b01 ============================== ============================== 04.07.09 Release CLHEP-2.0.4.3 ============================== ============================== 18.11.08 Release CLHEP-2.0.4.2 ============================== ============================== 04.11.08 Release CLHEP-2.0.4.1 ============================== ============================== 07.08.08 Release CLHEP-2.0.4.0 ============================== 2008-07-16 Lynn Garren * src/Evaluator.cc: Fix non ISO C++ compliant cast from pointer to function to void*, which is a pointer to an object. ============================== 01.05.08 Release CLHEP-2.0.3.3 ============================== ============================== 18.10.07 Release CLHEP-2.0.3.2 ============================== ============================== 15.11.06 Release CLHEP-2.0.3.1 ============================== ============================== 18.10.06 Release CLHEP-2.0.3.0 ============================== ============================== 20.06.06 Release CLHEP-2.0.2.3 ============================== ============================== 21.11.05 Release CLHEP-2.0.2.2 ============================== 2005-11-21 Lynn Garren * src/Makefile.am, test/Makefile.am: Build libraries for Windows Visual C++ without lib prefix. ============================== 22.06.05 Release CLHEP-2.0.2.1 ============================== Wed Jun 22 2005 Andreas Pfeiffer * configure.in: changed soname to install_name for darwin targets, dylibs still don't build properly on 10.3/10.4, static libs ok. 2005-06-19 Lynn Garren * configure.in, Makefile.am: Use lib when building Visual C++ libraries. Disable shared library build for Solaris CC. ============================== 22.04.05 Release CLHEP-2.0.2.0 ============================== 2005-04-07 Lynn Garren * configure.in: set AR and ARFLAGS 2005-02-18 Lynn Garren * configure.in, Makefile.am: Stop using libtool. The newer releases of libtool seem to have dropped support for Windows Visual C++. 2005-02-14 Lynn Garren * configure.in: Visual C++ flags are now "-EHsc -nologo -GR -GX -MD" 2005-02-03 Lynn Garren * configure.in: install step creates libCLHEP.a, libCLHEP.so, and/or libCLHEP.dylib by adding a symbolic link. 2005-02-02 Andreas PFEIFFER * configure.in: modified compiler flags for windows: added "-O -GR -GX -MD" as this is needed for the multi-thread environments used. ============================== 30.11.04 Release CLHEP-2.0.1.2 ============================== ============================== 27.10.04 Release CLHEP-2.0.1.1 ============================== Fri Sep 24 2004 Lynn Garren * use AM_CXXFLAGS * require autoconf 2.59, automake 1.9.1, and libtool 1.9b Tue Aug 31 2004 Lynn Garren * change Solaris CC compile flags from "-O -mt" to "-O" * libtools 1.9b or later is required for Solaris CC ============================== 23.07.04 Release CLHEP-2.0.1.0 ============================== ============================== 11.05.04 Release CLHEP-2.0.0.2 ============================== ============================== 11.05.04 Release CLHEP-1.9.0.2 ============================== ============================== 21.04.04 Release CLHEP-2.0.0.1 ============================== ============================== 24.10.03 Release CLHEP-2.0.0.0 ============================== ============================== 23.10.03 Release CLHEP-1.9.0.0 ============================== Fri Aug 9 14:55:05 2002 Evgueni Tcherniaev * Evaluator/Evaluator.cc: Fixed memory leak. Thanks to ============================== 01.06.02 Release CLHEP-1.8.0.0 ============================== ========================================= 25.04.02 revised StdHep uses HepMC ========================================= ========================================= 08.03.02 HepMC has become a part of CLHEP ========================================= ========================================== 09.11.01 HepPDT has become a part of CLHEP ========================================== ============================== 15.06.01 Release CLHEP-1.7.0.0 ============================== Fri Jun 15 09:30:42 2001 Evgueni Tcherniaev * Geometry/Transform3D.cc,Transform3D.h: Disabled m^-1. * configure.in: Set default options for MS VC++ to "-DWIN32 -O -GX -GR -MD" * test/testEvaluator.cc: Added "return 0" to avoid problems with "make -check" on NT. Added header comments. * test/testBasicVector3D.cc: Changed endl to HepStd::endl Thu Jun 14 11:27:44 2001 Evgueni Tcherniaev * Geometry/BasicVector3D.h (Added): * Geometry/Point3D.h,Vector3D.h,Normal3D.h: * test/testBasicVector3D.cc (Added): * test/testBasicVector3D.input,testBasicVector3D.out.save (Added): * test/testTransform3D.cc,Makefile.in: Added BasicVector3D.h to decouple functionality of Point3D, Vector3D and Normal3D from functionality of Hep3Vector. * test/testEvaluator.in (Removed): * test/testEvaluator.input (Added): * test/Makefile.in: testEvaluator.in has been renamed to testEvaluator.input Wed May 30 15:51:33 2001 Evgueni Tcherniaev * Evaluator/Evaluator.cc,string.src: * test/testEvaluator.cc: Added code to ignore leading and trailing spaces in names. Fri May 18 09:32:21 2001 Evgueni Tcherniaev * Evaluator/hash_map.src,utility.src: removed "using HepSTL::pair", because it does not compile on HP. Thu Apr 5 10:58:07 2001 Evgueni Tcherniaev * Evaluator/utility.src: Avoidance of clashes with ::pair in GCC. Thu Mar 15 17:42:19 2001 Evgueni Tcherniaev * Evaluator/hash_map.src: Bug fix in clear(): added table[i] = 0; ========================================================================== 18.01.01 ZOOM PhysicsVectors Capabilities have become part of CLHEP/Vector ========================================================================== Mon Nov 6 16:25:21 2000 Evgueni Tcherniaev * Evaluator/Evaluator.cc,Evaluator.h: More accurate usage of const. ====================================================================== 24.10.00 Generic Functions by Joe Boudreau have become a part of CLHEP ====================================================================== ============================== 20.10.00 Release CLHEP-1.6.0.0 ============================== ============================================================================== 12.10.00 Expression Evaluator by Evgueni Tcherniaev has become a part of CLHEP Alist, String and Combination have been disabled ============================================================================== Thu Oct 12 11:28:06 2000 Evgueni Tcherniaev * Makefile.in,configure.in: * test/Makefile.in: Disabled Alist, String and Combination. * Makefile.in,configure.in: * Evaluator/Makefile.in,Evaluator.cc,Evaluator.h (Added): * Evaluator/setStdMath.cc setSystemOfUnits.cc (Added): * Evaluator/hash_map.src,stack.src,string.src,utility.src (Added): * test/Makefile.in: * test/testEvaluator.cc (Added): * test/testEvaluator.in,testEvaluator.out.save (Added): Added new package - Evaluator. ============================== 08.05.00 Release CLHEP-1.5.0.0 ============================== ============================================================ 24.04.00 StdHepC++ by Lynn Garren has become a part of CLHEP ============================================================ ============================== 20.04.99 Release CLHEP-1.4.0.0 ============================== ========================================================================= 16.12.98 Started: merging with BaBar version of CLHEP provided by G.Cosmo ========================================================================= ========================== 28.07.98 Release CLHEP-1.3 ========================== ========================== 05.02.98 Release CLHEP-1.2 ========================== ======================================================== 08.12.97 Release CLHEP-1.1: Geant4 has migrated to CLHEP ======================================================== clhep-2.1.4.1.orig/Evaluator/CMakeLists.txt0000644000175000017500000000027611607417635017116 0ustar olesoles# main Evaluator cmake instructions # automake/autoconf variables set( PACKAGE Evaluator ) clhep_package_config() add_subdirectory(Evaluator) add_subdirectory(src) add_subdirectory(test) clhep-2.1.4.1.orig/Evaluator/autotools/0000755000175000017500000000000012242515153016370 5ustar olesolesclhep-2.1.4.1.orig/Evaluator/autotools/.cvsignore0000755000175000017500000000010107705060311020362 0ustar olesolesconfig.sub config.guess depcomp install-sh missing mkinstalldirs clhep-2.1.4.1.orig/Evaluator/autotools/ltmain.sh0000755000175000017500000057547210233516370020237 0ustar olesoles# Generated from ltmain.in; do not edit by hand # ltmain.sh (GNU libtool) 1.9b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: powerpc-apple-darwin7.5.0 # shell: $SHELL # compiler: $LTCC # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 1.9b # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST elif test -n "${BASH_VERSION+set}${KSH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh dirname="s,/[^/]*$,," basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: PROGRAM=ltmain.sh progname=`echo "$progpath" | $SED "$basename"` # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *) progdir=`echo "$progpath" | $SED "$dirname"` progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; esac # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.9b TIMESTAMP="" package_revision=1.1571 # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $echo $progname${mode+: }$mode: warning: ${1+"$@"} 1>&2 } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } # func_version # Echo version message to standard output and exit. func_version () { $SED '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# //; s/^# *$//; s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED '/^# Usage:/,/# -h/ { s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" echo echo "run \`$progname --help | more' for full usage" exit $EXIT_SUCCESS } # func_help # Echo long help message to standard output and exit. func_help () { $SED '/^# Usage:/,/# Report bugs to/ { s/^# //; s/^# *$//; s:\$progname:'$progname':; s:\$SHELL:'"$SHELL"':; s:\$LTCC:'"$LTCC"':; s:\$LD:'"$LD"':; s/\$with_gnu_ld/'"$with_gnu_ld"'/; s/\$automake_version/'"`automake --version 2>/dev/null |$SED 1q`"'/; s/\$autoconf_version/'"`autoconf --version 2>/dev/null |$SED 1q`"'/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $EXIT_SUCCESS } # func_features # Display the features supported by this script. func_features () { $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable "`\"foo\"`", so we have to do # it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $echo \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $echo $echo "Try \`$progname --help' for more information about other modes." exit $EXIT_SUCCESS } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # sed scripts: my_sed_single_opt='1s/^\(..\).*$/\1/;q' my_sed_single_rest='1s/^..\(.*\)$/\1/;q' my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' exit_cmd=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set -- --mode clean ${1+"$@"} ;; compile|compil|compi|comp|com|co|c) shift; set -- --mode compile ${1+"$@"} ;; execute|execut|execu|exec|exe|ex|e) shift; set -- --mode execute ${1+"$@"} ;; finish|finis|fini|fin|fi|f) shift; set -- --mode finish ${1+"$@"} ;; install|instal|insta|inst|ins|in|i) shift; set -- --mode install ${1+"$@"} ;; link|lin|li|l) shift; set -- --mode link ${1+"$@"} ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set -- --mode uninstall ${1+"$@"} ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" set -x ;; --dlopen) test $# -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" ;; --dry-run | -n) run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test $# -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" show=: ;; --tag) test $# -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: --dlopen=*|--mode=*|--tag=*) arg=`echo "$opt" | $SED "$my_sed_long_arg"` opt=`echo "$opt" | $SED "$my_sed_long_opt"` set -- "$opt" "$arg" ${1+"$@"} ;; # Separate optargs to short options: # -x*|-y*) # arg=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "$arg" ${1+"$@"} # ;; # Separate non-argument short options: # -z*|-z*|-y*) # rest=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "-$rest" ${1+"$@"} # ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`echo "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$my_dlsyms" test -z "$run" && $echo > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do $show "extracting global C symbols from \`$progfile'" $run eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for dlprefile in $dlprefiles; do $show "extracting global C symbols from \`$dlprefile'" name=`$echo "$dlprefile" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ const struct { const char *originator; const struct { const char *name; void *address; } symbols[]; } lt_${my_prefix}_LTX_preloaded_symbols = {\ \"$my_originator\", { " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" $echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} } }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" status=$? if test "$status" -ne 0 && test ! -d "$my_xdir"; then exit $status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename $darwin_archive` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" # Remove the table of contents from the thin files. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" $AR -xo "${darwin_base_archive}" rm "${darwin_base_archive}" cd "$darwin_curdir" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist rm -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir (cd $my_xdir && $AR x $my_xabs) || exit $? fi # $darwin_arches fi # $run ;; *) # We will extract separately just the conflicting names and we will # no longer touch any unique names. It is faster to leave these # extract automatically by $AR in one run. $show "(cd $my_xdir && $AR x $my_xabs)" $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; renaming object files" func_warning "to ensure that they will not overwrite" $AR t "$my_xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_mode_compile arg... func_mode_compile () { # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1 || \ func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi } # func_mode_finish arg... func_mode_finish () { libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit $EXIT_SUCCESS } # func_mode_install arg... func_mode_install () { # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files test "$#" -gt 2 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. (${SED} -e '2q' $file | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1 || \ func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" $show "$relink_command" $run eval "$relink_command" || \ func_fatal_error "error: relink \`$file' with the above command before installing it" fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | $GREP "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. test -z "$notinst_deplibs" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask func_error "error: cannot create temporary directory \`$tmpdir'" continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" ${rm}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } # func_mode_link arg... func_mode_link () { case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static # See comment for -static flag below, for more details. compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" || \ func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else func_fatal_error "link input file \`$save_arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) # The effects of -all-static are defined in a previous loop. continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs $inherited_linker_flags" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *[\\/]*.la) . $lib ;; *.la) . ./$lib ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`echo "$deplib" |$SED "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$inherited_linker_flags " in *" $deplib "*) ;; * ) inherited_linker_flags="$inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $lib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not use here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib'" fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then : else func_fatal_error "\`$lib' is not a valid libtool archive" fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac case $host in *-*-darwin*) # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then inherited_linker_flags=`$echo "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` fi dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP "bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $echo "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "*** And there doesn't seem to be a static archive available" $echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs $inherited_linker_flags; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" eval darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//' | xargs` compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for archives" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath test "$#" -gt 2 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" test -n "$8" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "AGE \`$age' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | ${SED} 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null | ${SED} 10q | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` inherited_linker_flags=`$echo "X $inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$echo "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`echo "$output" | $SED $basename` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnk $echo "creating GNU ld script: $output" $echo 'INPUT (' > $output for obj in $save_libobjs do $echo \""$obj"\" >> $output done $echo ')' >> $output else $echo "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for objects" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; struct stat st; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$dlsymsobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; overriding AR_FLAGS to 'cq'" func_warning "to ensure that POSIX-compatible ar will work" AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS } # func_mode_uninstall arg... func_mode_uninstall () { rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done test -z "$rm" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 || (test -h "$file") >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status } ## ----------- ## ## Main. ## ## ----------- ## { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." case $mode in compile) func_mode_compile ${1+"$@"} ;; execute) func_mode_execute ${1+"$@"} ;; finish) func_mode_finish ${1+"$@"} ;; install) func_mode_install ${1+"$@"} ;; link|relink) func_mode_link ${1+"$@"} ;; uninstall|clean) func_mode_uninstall ${1+"$@"} ;; "") help="$generic_help" func_fatal_help "you must specify a MODE" ;; esac test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi } exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: clhep-2.1.4.1.orig/Evaluator/src/0000755000175000017500000000000012242515153015126 5ustar olesolesclhep-2.1.4.1.orig/Evaluator/src/string.src0000755000175000017500000000643007705060311017152 0ustar olesoles// -*- C++ -*- // $Id: string.src,v 1.1.1.1 2003/07/15 20:15:05 garren Exp $ // --------------------------------------------------------------------------- #ifndef HEP_STRING_SRC #define HEP_STRING_SRC #include #include /* * Simplified string class. * It provides only few basic functions of the standard and * is intended to be used as a replacement of the standard class where * full functionality of is not required, but it is essential * to have highly portable and effective code. * * This file should be used exclusively inside *.cc files. * Usage inside header files can result to a clash with standard . */ struct string { struct srep { char* s; // pointer to data int n; // reference count srep() : n(1) {} } *p; // Default constructor. string() { p = new srep; p->s = 0; } // Constructor from character string. string(const char* s) { p = new srep; p->s = new char[strlen(s)+1]; strcpy(p->s, s); } // Constructor from character substring. string(const char* s, unsigned int n) { p = new srep; p->s = new char[n+1]; strncpy(p->s, s, n); *(p->s+n) = '\0'; } // Copy constructor from string. string(const string& x) { x.p->n++; p = x.p; } // Destructor. ~string() { if (--p->n == 0) { delete [] p->s; delete p; } } // Assignment from character string. string& operator=(const char* s) { if (p->n > 1) { // disconnect self p->n--; p = new srep; }else{ delete [] p->s; // free old string } p->s = new char[strlen(s)+1]; strcpy(p->s, s); return *this; } // Assignment from string. string& operator=(const string & x) { x.p->n++; // protect against "st = st" if (--p->n == 0) { delete [] p->s; delete p; } p = x.p; return *this; } // Returns C-style character string. const char* c_str() const { return p->s; } }; // // Concatinations. // inline string operator+(char a, const string & b) { string s; s.p->s = new char[strlen(b.c_str())+2]; s.p->s[0] = a; strcpy(s.p->s+1, b.c_str()); return s; } inline string operator+(const char * a, const string & b) { int lena = strlen(a); string s; s.p->s = new char[lena+strlen(b.c_str())+1]; strcpy(s.p->s, a); strcpy(s.p->s+lena, b.c_str()); return s; } inline string operator+(const string & a, const char * b) { int lena = strlen(a.c_str()); string s; s.p->s = new char[lena+strlen(b)+1]; strcpy(s.p->s, a.c_str()); strcpy(s.p->s+lena, b); return s; } inline string operator+(const string & a, const string & b) { int lena = strlen(a.c_str()); string s; s.p->s = new char[lena+strlen(b.c_str())+1]; strcpy(s.p->s, a.c_str()); strcpy(s.p->s+lena, b.c_str()); return s; } // // Comparisons. // inline bool operator==(const string & x, const char* s) { return strcmp(x.p->s, s) == 0; } inline bool operator==(const string & x, const string & y) { return strcmp(x.p->s, y.p->s) == 0; } inline bool operator!=(const string & x, const char* s) { return strcmp(x.p->s, s) != 0; } inline bool operator!=(const string & x, const string & y) { return strcmp(x.p->s, y.p->s) != 0; } // // Output to a stream. // std::ostream & operator<<(std::ostream & s, const string & x) { return s << x.p->s; } #endif /* HEP_STRING_SRC */ clhep-2.1.4.1.orig/Evaluator/src/setStdMath.cc0000755000175000017500000000516111753230053017522 0ustar olesoles// -*- C++ -*- // $Id: setStdMath.cc,v 1.2 2003/08/13 20:00:10 garren Exp $ // ---------------------------------------------------------------------- #include "CLHEP/Evaluator/defs.h" #include "CLHEP/Evaluator/Evaluator.h" #include // for sqrt and pow static double eval_abs (double a) { return (a < 0) ? -a : a; } static double eval_min (double a, double b) { return (a < b) ? a : b; } static double eval_max (double a, double b) { return (a > b) ? a : b; } static double eval_sqrt (double a) { return std::sqrt(a); } static double eval_pow (double a, double b) { return std::pow(a,b); } static double eval_sin (double a) { return std::sin(a); } static double eval_cos (double a) { return std::cos(a); } static double eval_tan (double a) { return std::tan(a); } static double eval_asin (double a) { return std::asin(a); } static double eval_acos (double a) { return std::acos(a); } static double eval_atan (double a) { return std::atan(a); } static double eval_atan2(double a, double b) { return std::atan2(a,b); } static double eval_sinh (double a) { return std::sinh(a); } static double eval_cosh (double a) { return std::cosh(a); } static double eval_tanh (double a) { return std::tanh(a); } static double eval_exp (double a) { return std::exp(a); } static double eval_log (double a) { return std::log(a); } static double eval_log10(double a) { return std::log10(a); } namespace HepTool { void Evaluator::setStdMath() { // S E T S T A N D A R D C O N S T A N T S setVariable("pi", 3.14159265358979323846); setVariable("e", 2.7182818284590452354); setVariable("gamma", 0.577215664901532861); setVariable("radian", 1.0); setVariable("rad", 1.0); setVariable("degree", 3.14159265358979323846/180.); setVariable("deg", 3.14159265358979323846/180.); // S E T S T A N D A R D F U N C T I O N S setFunction("abs", eval_abs); setFunction("min", eval_min); setFunction("max", eval_max); setFunction("sqrt", eval_sqrt); setFunction("pow", eval_pow); setFunction("sin", eval_sin); setFunction("cos", eval_cos); setFunction("tan", eval_tan); setFunction("asin", eval_asin); setFunction("acos", eval_acos); setFunction("atan", eval_atan); setFunction("atan2", eval_atan2); setFunction("sinh", eval_sinh); setFunction("cosh", eval_cosh); setFunction("tanh", eval_tanh); setFunction("exp", eval_exp); setFunction("log", eval_log); setFunction("log10", eval_log10); } } // namespace HepTool clhep-2.1.4.1.orig/Evaluator/src/Makefile.am0000755000175000017500000000334311406161732017171 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir) libCLHEP_Evaluator_@VERSION@_a_SOURCES = \ Evaluator.cc \ setStdMath.cc \ setSystemOfUnits.cc libCLHEP_Evaluator_@VERSION@_so_OBJECTS = $(patsubst %.cc,$(shareddir)/%.$(OBJEXT),$(libCLHEP_Evaluator_@VERSION@_a_SOURCES)) # these if/else blocks will be parsed by automake and translated if BUILD_SHARED shareddir = shared if BUILD_VISUAL lib_shared = CLHEP-Evaluator-@VERSION@.$(SHEXT) else lib_shared = libCLHEP-Evaluator-@VERSION@.$(SHEXT) endif SHFLAGS = @MY_SHFLAGS@ SHLINK = @MY_SHLINK@ @MY_SHEXTRA@ SHNAME = @MY_SHNAME@ endif if BUILD_STATIC lib_LIBRARIES = libCLHEP-Evaluator-@VERSION@.a endif CLEANFILES = $(lib_shared) all-local: $(shareddir) $(lib_shared) $(shareddir): test -d $(shareddir) || mkdir $(shareddir) if BUILD_VISUAL $(lib_shared): $(libCLHEP_Evaluator_@VERSION@_so_OBJECTS) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Evaluator_@VERSION@_so_OBJECTS) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) /c /Fo$@ $< else $(lib_shared): $(libCLHEP_Evaluator_@VERSION@_so_OBJECTS) $(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Evaluator_@VERSION@_so_OBJECTS) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) -c -o $@ $< endif install-exec-local: $(lib_shared) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_shared)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$p'"; \ $(INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done clean-local: -test -d $(shareddir) && rm -f $(shareddir)/*.$(OBJEXT) distclean-local: -test -d $(shareddir) && rm -rf ./$(shareddir) clhep-2.1.4.1.orig/Evaluator/src/.cvsignore0000755000175000017500000000001407705453233017134 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Evaluator/src/stack.src0000755000175000017500000000224207705060311016746 0ustar olesoles// -*- C++ -*- // $Id: stack.src,v 1.1.1.1 2003/07/15 20:15:05 garren Exp $ // --------------------------------------------------------------------------- #ifndef HEP_STACK_SRC #define HEP_STACK_SRC /* * Simplified stack class. * It is intended to be used as a replacement of the standard class where * full functionality of is not required, but it is essential * to have highly portable and effective code. * * This file should be used exclusively inside *.cc files. * Usage inside header files can result to a clash with standard . * * @author Evgeni Chernyaev */ template class stack { private: int k, max_size; T * v; public: stack() : k(0), max_size(20), v(new T[20]) {} ~stack() { delete [] v; } int size() const { return k; } T top () const { return v[k-1]; } T & top () { return v[k-1]; } void pop () { k--; } void push(T a) { if (k == max_size) { T * w = v; max_size *= 2; v = new T[max_size]; for (int i=0; i #endif #ifndef HEP_HASH_MAP_SRC #define HEP_HASH_MAP_SRC #include #include #include "string.src" /* * Simplified hash_map class. * It provides only basic functions of the standard and * is intended to be used as a replacement of the standard class where * full functionality of is not required, but it is essential * to have highly portable and effective code. * * This file should be used exclusively inside *.cc files. * Usage inside header files can result to a clash with standard . * * @author Evgeni Chernyaev */ template class hash_map { public: struct Entry { // Hash_map entry std::pair data; Entry* next; Entry(K k, T v, Entry* n) : data(k,v), next(n) {} }; class hash_map_iterator { // Hash_map iterator Entry* entry; public: hash_map_iterator() : entry(0) {} hash_map_iterator(Entry & e) : entry(&e) {} std::pair & operator * () const { return entry->data; } std::pair * operator ->() const { return &(operator*()); } bool operator==(hash_map_iterator i) const { return (entry == i.entry); } bool operator!=(hash_map_iterator i) const { return (entry != i.entry); } }; public: typedef unsigned int size_type; typedef std::pair value_type; typedef hash_map_iterator iterator; typedef hash_map_iterator const_iterator; private: Entry** table; // Hash table: pointers to entries size_type cur_size; // Number of entries size_type max_size; // Bucket_count - current size of the table float max_load; // Keep (n) <= (max_size * max_load) float grow; // When necessary, resize(max_size * grow) const T default_value; // Default value used by [] size_type hash(const char * key) const { size_type res = 0; while(*key) { res = res*31 + *key++; } return res; } size_type hash(const string & key) const { return hash(key.c_str()); } bool eq(const char * a, const char * b) const { return (strcmp(a, b) == 0); } bool eq(const string & a, const string & b) const { return (a == b); } public: // Constructor. hash_map(const T & dv = T(), size_type n = 107) : table(0), cur_size(0), max_size(0), default_value(dv) { set_load(); resize(n); } // Destructor. ~hash_map() { for(size_type i=0; inext; delete p; } } delete [] table; } // Sets load and grow parameters. void set_load(float m = 0.7, float g = 1.7) { max_load = m; grow = g; } // Returns number of elements. size_type size() const { return cur_size; } // Returns size of the hash table. size_type bucket_count() const { return max_size; } // Resizes the hash table. void resize(size_type s) { if (s <= max_size) return; Entry** tmp = table; table = new Entry* [s]; for (size_type k=0; knext; size_type ii = hash(p->data.first) % s; p->next = table[ii]; table[ii] = p; } } max_size = s; delete [] tmp; } // Subscripting. T & operator[](const K & key) { size_type i = hash(key) % max_size; for (Entry* p=table[hash(key) % max_size]; p; p=p->next) { if (eq(key,p->data.first)) return p->data.second; } if (cur_size++ >= max_size*max_load) { resize(size_type(max_size*grow)); i = hash(key) % max_size; } table[i] = new Entry(key, default_value, table[i]); return table[i]->data.second; } // Finds element with given key. iterator find(const K & key) const { size_type i = hash(key) % max_size; for (Entry* p=table[i]; p; p=p->next) { if (eq(key,p->data.first)) return iterator(*p); } return end(); } // Erases element with given key. size_type erase(const K & key) { size_type i = hash(key) % max_size; Entry* p = table[i]; if (p == 0) return 0; if (eq(key,p->data.first)) { table[i] = p->next; delete p; cur_size--; return 1; } Entry** pp = &table[i]; for (p=p->next; p; p=p->next) { if (eq(key,p->data.first)) { *pp = p->next; delete p; cur_size--; return 1; }else{ pp = &(p->next); } } return 0; } // Clears the hash table. void clear() { for(size_type i=0; inext; delete pp; } table[i] = 0; } cur_size = 0; } // Returns end iterator. iterator end() const { return iterator(); } #ifdef DEBUG_MODE // Prints content of the hash table. void print() { std::cout << endl; for(size_type i=0; inext) { std::cout << '"' << p->data.first << '"' << " " << p->data.second << std::endl; } } } #endif }; #endif /* HEP_HASH_MAP_SRC */ clhep-2.1.4.1.orig/Evaluator/src/Evaluator.cc0000755000175000017500000007034111753230053017406 0ustar olesoles// -*- C++ -*- // $Id: Evaluator.cc,v 1.4 2010/07/20 17:00:49 garren Exp $ // --------------------------------------------------------------------------- #include "CLHEP/Evaluator/defs.h" #include "CLHEP/Evaluator/Evaluator.h" #include #include #include // for std::pow() #include "stack.src" #include "string.src" #include "hash_map.src" #include #include #include #include // for strtod() //--------------------------------------------------------------------------- // Fix non ISO C++ compliant cast from pointer to function // to void*, which is a pointer to an object typedef void (*voidfuncptr)(); struct Item { enum { UNKNOWN, VARIABLE, EXPRESSION, FUNCTION } what; double variable; string expression; // Fix non ISO C++ compliant cast from pointer to function // to void*, which is a pointer to an object //void *function; voidfuncptr function; Item() : what(UNKNOWN), variable(0),expression(), function(0) {} Item(double x) : what(VARIABLE), variable(x),expression(), function(0) {} Item(string x) : what(EXPRESSION),variable(0),expression(x),function(0) {} Item(voidfuncptr x) : what(FUNCTION), variable(0),expression(), function(x) {} }; typedef char * pchar; typedef hash_map dic_type; struct Struct { dic_type theDictionary; pchar theExpression; pchar thePosition; int theStatus; double theResult; }; //--------------------------------------------------------------------------- #define EVAL HepTool::Evaluator #define REMOVE_BLANKS \ for(pointer=name;;pointer++) if (!isspace(*pointer)) break; \ for(n=strlen(pointer);n>0;n--) if (!isspace(*(pointer+n-1))) break #define SKIP_BLANKS \ for(;;pointer++) { \ c = (pointer > end) ? '\0' : *pointer; \ if (!isspace(c)) break; \ } #define EVAL_EXIT(STATUS,POSITION) endp = POSITION; return STATUS #define MAX_N_PAR 5 static const char sss[MAX_N_PAR+2] = "012345"; enum { ENDL, LBRA, OR, AND, EQ, NE, GE, GT, LE, LT, PLUS, MINUS, UNARY_PLUS, UNARY_MINUS, MULT, DIV, POW, RBRA, VALUE }; static int engine(pchar, pchar, double &, pchar &, const dic_type &); static int variable(const string & name, double & result, const dic_type & dictionary) /*********************************************************************** * * * Name: variable Date: 03.10.00 * * Author: Evgeni Chernyaev Revised: * * * * Function: Finds value of the variable. * * This function is used by operand(). * * * * Parameters: * * name - name of the variable. * * result - value of the variable. * * dictionary - dictionary of available variables and functions. * * * ***********************************************************************/ { dic_type::const_iterator iter = dictionary.find(name); if (iter == dictionary.end()) return EVAL::ERROR_UNKNOWN_VARIABLE; Item item = iter->second; switch (item.what) { case Item::VARIABLE: result = item.variable; return EVAL::OK; case Item::EXPRESSION: { pchar exp_begin = (char *)(item.expression.c_str()); pchar exp_end = exp_begin + strlen(exp_begin) - 1; if (engine(exp_begin, exp_end, result, exp_end, dictionary) == EVAL::OK) return EVAL::OK; } default: return EVAL::ERROR_CALCULATION_ERROR; } } static int function(const string & name, stack & par, double & result, const dic_type & dictionary) /*********************************************************************** * * * Name: function Date: 03.10.00 * * Author: Evgeni Chernyaev Revised: * * * * Function: Finds value of the function. * * This function is used by operand(). * * * * Parameters: * * name - name of the function. * * par - stack of parameters. * * result - value of the function. * * dictionary - dictionary of available variables and functions. * * * ***********************************************************************/ { int npar = par.size(); if (npar > MAX_N_PAR) return EVAL::ERROR_UNKNOWN_FUNCTION; dic_type::const_iterator iter = dictionary.find(sss[npar]+name); if (iter == dictionary.end()) return EVAL::ERROR_UNKNOWN_FUNCTION; Item item = iter->second; double pp[MAX_N_PAR]; for(int i=0; i pos; // position stack stack par; // parameter stack double value; pchar par_begin = pointer+1, par_end; for(;;pointer++) { c = (pointer > end) ? '\0' : *pointer; switch (c) { case '\0': EVAL_EXIT( EVAL::ERROR_UNPAIRED_PARENTHESIS, pos.top() ); case '(': pos.push(pointer); break; case ',': if (pos.size() == 1) { par_end = pointer-1; EVAL_STATUS = engine(par_begin, par_end, value, par_end, dictionary); if (EVAL_STATUS == EVAL::WARNING_BLANK_STRING) { EVAL_EXIT( EVAL::ERROR_EMPTY_PARAMETER, --par_end ); } if (EVAL_STATUS != EVAL::OK) { EVAL_EXIT( EVAL_STATUS, par_end ); } par.push(value); par_begin = pointer + 1; } break; case ')': if (pos.size() > 1) { pos.pop(); break; }else{ par_end = pointer-1; EVAL_STATUS = engine(par_begin, par_end, value, par_end, dictionary); switch (EVAL_STATUS) { case EVAL::OK: par.push(value); break; case EVAL::WARNING_BLANK_STRING: if (par.size() != 0) { EVAL_EXIT( EVAL::ERROR_EMPTY_PARAMETER, --par_end ); } break; default: EVAL_EXIT( EVAL_STATUS, par_end ); } EVAL_STATUS = function(name, par, result, dictionary); EVAL_EXIT( EVAL_STATUS, (EVAL_STATUS == EVAL::OK) ? pointer : begin); } } } } /*********************************************************************** * * * Name: maker Date: 28.09.00 * * Author: Evgeni Chernyaev Revised: * * * * Function: Executes basic arithmetic operations on values in the top * * of the stack. Result is placed back into the stack. * * This function is used by engine(). * * * * Parameters: * * op - code of the operation. * * val - stack of values. * * * ***********************************************************************/ static int maker(int op, stack & val) { if (val.size() < 2) return EVAL::ERROR_SYNTAX_ERROR; double val2 = val.top(); val.pop(); double val1 = val.top(); switch (op) { case OR: // operator || val.top() = (val1 || val2) ? 1. : 0.; return EVAL::OK; case AND: // operator && val.top() = (val1 && val2) ? 1. : 0.; return EVAL::OK; case EQ: // operator == val.top() = (val1 == val2) ? 1. : 0.; return EVAL::OK; case NE: // operator != val.top() = (val1 != val2) ? 1. : 0.; return EVAL::OK; case GE: // operator >= val.top() = (val1 >= val2) ? 1. : 0.; return EVAL::OK; case GT: // operator > val.top() = (val1 > val2) ? 1. : 0.; return EVAL::OK; case LE: // operator <= val.top() = (val1 <= val2) ? 1. : 0.; return EVAL::OK; case LT: // operator < val.top() = (val1 < val2) ? 1. : 0.; return EVAL::OK; case PLUS: // operator '+' val.top() = val1 + val2; return EVAL::OK; case MINUS: // operator '-' val.top() = val1 - val2; return EVAL::OK; case MULT: // operator '*' val.top() = val1 * val2; return EVAL::OK; case DIV: // operator '/' if (val2 == 0.0) return EVAL::ERROR_CALCULATION_ERROR; val.top() = val1 / val2; return EVAL::OK; case POW: // operator '^' (or '**') errno = 0; val.top() = std::pow(val1,val2); if (errno == 0) return EVAL::OK; case UNARY_PLUS: // unary operator '+' val.top() = val1 + val2; // val1 is zero return EVAL::OK; case UNARY_MINUS: // unary operator '-' val.top() = val1 - val2; // val1 is zero return EVAL::OK; default: return EVAL::ERROR_CALCULATION_ERROR; } } /*********************************************************************** * * * Name: engine Date: 28.09.00 * * Author: Evgeni Chernyaev Revised: * * * * Function: Evaluates arithmetic expression. * * * * Parameters: * * begin - pointer to the character string with expression. * * end - pointer to the end of the character string (it is needed * * for recursive call of engine(), when there is no '\0'). * * result - result of the evaluation. * * endp - pointer to the character where the evaluation stoped. * * dictionary - dictionary of available variables and functions. * * * ***********************************************************************/ static int engine(pchar begin, pchar end, double & result, pchar & endp, const dic_type & dictionary) { enum SyntaxTableEntry { SyntaxError = 0, NumberVariableOrFunction = 1, UnaryPlusOrMinus = 2, AnyOperator = 3 }; static const int SyntaxTable[19][19] = { //E ( || && == != >= > <= < + - u+ u- * / ^ ) V - current token { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // E - previous { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // ( token { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // || { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // && { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // == { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // != { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // >= { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // > { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // <= { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // < { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // + { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // - { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // unary + { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // unary - { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // * { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // / { 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 1 }, // ^ { 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0 }, // ) { 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0 } // V = {.,N,C} }; enum ActionTableEntry { UnbalancedParentheses = -1, ExpressionCompleted = 0, HigherPrecedenceOperator = 1, SamePrecedenceOperator = 2, CloseProcessedParenthesesOrExpression = 3, LowerPrecedenceOperator = 4 }; static const int ActionTable[17][18] = { //E ( || && == != >= > <= < + - u+ u- * / ^ ) - current operator { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,-1 }, // E - top operator {-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 }, // ( in stack { 4, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4 }, // || { 4, 1, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4 }, // && { 4, 1, 4, 4, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4 }, // == { 4, 1, 4, 4, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4 }, // != { 4, 1, 4, 4, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 4 }, // >= { 4, 1, 4, 4, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 4 }, // > { 4, 1, 4, 4, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 4 }, // <= { 4, 1, 4, 4, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 4 }, // < { 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 1, 1, 1, 1, 1, 4 }, // + { 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 1, 1, 1, 1, 1, 4 }, // - { 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 1, 4 }, // unary + { 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 1, 4 }, // unary - { 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 2, 2, 1, 4 }, // * { 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 2, 2, 1, 4 }, // / { 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, 4 } // ^ }; stack op; // operator stack stack pos; // position stack stack val; // value stack double value; pchar pointer = begin; int iWhat, iCur, iPrev = 0, iTop, EVAL_STATUS; char c; op.push(0); pos.push(pointer); // push EOL to the stack SKIP_BLANKS; if (c == '\0') { EVAL_EXIT( EVAL::WARNING_BLANK_STRING, begin ); } for(;;pointer++) { // N E X T T O K E N c = (pointer > end) ? '\0' : *pointer; if (isspace(c)) continue; // skip space, tab etc. switch (c) { case '\0': iCur = ENDL; break; case '(': iCur = LBRA; break; case '|': if (*(pointer+1) == '|') { pointer++; iCur = OR; break; }else{ EVAL_EXIT( EVAL::ERROR_UNEXPECTED_SYMBOL, pointer ); } case '&': if (*(pointer+1) == '&') { pointer++; iCur = AND; break; }else{ EVAL_EXIT( EVAL::ERROR_UNEXPECTED_SYMBOL, pointer ); } case '=': if (*(pointer+1) == '=') { pointer++; iCur = EQ; break; }else{ EVAL_EXIT( EVAL::ERROR_UNEXPECTED_SYMBOL, pointer ); } case '!': if (*(pointer+1) == '=') { pointer++; iCur = NE; break; }else{ EVAL_EXIT( EVAL::ERROR_UNEXPECTED_SYMBOL, pointer ); } case '>': if (*(pointer+1) == '=') { pointer++; iCur = GE; } else { iCur = GT; } break; case '<': if (*(pointer+1) == '=') { pointer++; iCur = LE; } else { iCur = LT; } break; case '+': iCur = PLUS; break; case '-': iCur = MINUS; break; case '*': if (*(pointer+1) == '*') { pointer++; iCur = POW; }else{ iCur = MULT; } break; case '/': iCur = DIV; break; case '^': iCur = POW; break; case ')': iCur = RBRA; break; default: if (c == '.' || isalnum(c)) { iCur = VALUE; break; }else{ EVAL_EXIT( EVAL::ERROR_UNEXPECTED_SYMBOL, pointer ); } } // S Y N T A X A N A L I S Y S iWhat = SyntaxTable[iPrev][iCur]; iPrev = iCur; switch (iWhat) { case 0: // syntax error EVAL_EXIT( EVAL::ERROR_SYNTAX_ERROR, pointer ); case 1: // operand: number, variable, function EVAL_STATUS = operand(pointer, end, value, pointer, dictionary); if (EVAL_STATUS != EVAL::OK) { EVAL_EXIT( EVAL_STATUS, pointer ); } val.push(value); continue; case 2: // unary + or unary - val.push(0.0); if (iCur == PLUS) iCur = UNARY_PLUS; if (iCur == MINUS) iCur = UNARY_MINUS; // Note that for syntax purposes, ordinary + or - are fine. // Thus iPrev need not change when we encounter a unary minus or plus. case 3: default: // next operator break; } // N E X T O P E R A T O R for(;;) { if (op.size() == 0) { EVAL_EXIT( EVAL::ERROR_SYNTAX_ERROR, pointer ); } iTop = op.top(); switch (ActionTable[iTop][iCur]) { case -1: // syntax error if (op.size() > 1) pointer = pos.top(); EVAL_EXIT( EVAL::ERROR_UNPAIRED_PARENTHESIS, pointer ); case 0: // last operation (assignment) if (val.size() == 1) { result = val.top(); EVAL_EXIT( EVAL::OK, pointer ); }else{ EVAL_EXIT( EVAL::ERROR_SYNTAX_ERROR, pointer ); } case 1: // push current operator in stack op.push(iCur); pos.push(pointer); break; case 2: // execute top operator EVAL_STATUS = maker(iTop, val); // put current operator in stack if (EVAL_STATUS != EVAL::OK) { EVAL_EXIT( EVAL_STATUS, pos.top() ); } op.top() = iCur; pos.top() = pointer; break; case 3: // delete '(' from stack op.pop(); pos.pop(); break; case 4: default: // execute top operator and EVAL_STATUS = maker(iTop, val); // delete it from stack if (EVAL_STATUS != EVAL::OK) { // repete with the same iCur EVAL_EXIT( EVAL_STATUS, pos.top() ); } op.pop(); pos.pop(); continue; } break; } } } //--------------------------------------------------------------------------- static void setItem(const char * prefix, const char * name, const Item & item, Struct * s) { if (name == 0 || *name == '\0') { s->theStatus = EVAL::ERROR_NOT_A_NAME; return; } // R E M O V E L E A D I N G A N D T R A I L I N G S P A C E S const char * pointer; int n; REMOVE_BLANKS; // C H E C K N A M E if (n == 0) { s->theStatus = EVAL::ERROR_NOT_A_NAME; return; } for(int i=0; itheStatus = EVAL::ERROR_NOT_A_NAME; return; } } // A D D I T E M T O T H E D I C T I O N A R Y string item_name = prefix + string(pointer,n); dic_type::iterator iter = (s->theDictionary).find(item_name); if (iter != (s->theDictionary).end()) { iter->second = item; if (item_name == name) { s->theStatus = EVAL::WARNING_EXISTING_VARIABLE; }else{ s->theStatus = EVAL::WARNING_EXISTING_FUNCTION; } }else{ (s->theDictionary)[item_name] = item; s->theStatus = EVAL::OK; } } //--------------------------------------------------------------------------- namespace HepTool { //--------------------------------------------------------------------------- Evaluator::Evaluator() { Struct * s = new Struct(); p = (void *) s; s->theExpression = 0; s->thePosition = 0; s->theStatus = OK; s->theResult = 0.0; } //--------------------------------------------------------------------------- Evaluator::~Evaluator() { delete (Struct *)(p); } //--------------------------------------------------------------------------- double Evaluator::evaluate(const char * expression) { Struct * s = (Struct *)(p); if (s->theExpression != 0) { delete[] s->theExpression; } s->theExpression = 0; s->thePosition = 0; s->theStatus = WARNING_BLANK_STRING; s->theResult = 0.0; if (expression != 0) { s->theExpression = new char[strlen(expression)+1]; strcpy(s->theExpression, expression); s->theStatus = engine(s->theExpression, s->theExpression+strlen(expression)-1, s->theResult, s->thePosition, s->theDictionary); } return s->theResult; } //--------------------------------------------------------------------------- int Evaluator::status() const { return ((Struct *)(p))->theStatus; } //--------------------------------------------------------------------------- int Evaluator::error_position() const { return ((Struct *)(p))->thePosition - ((Struct *)(p))->theExpression; } //--------------------------------------------------------------------------- void Evaluator::print_error() const { Struct * s = (Struct *) p; if(s->theStatus != OK) { std::cerr << error_name() << std::endl; } return; } //--------------------------------------------------------------------------- std::string Evaluator::error_name() const { char prefix[] = "Evaluator : "; std::ostringstream errn; Struct * s = (Struct *) p; switch (s->theStatus) { case ERROR_NOT_A_NAME: errn << prefix << "invalid name"; break; case ERROR_SYNTAX_ERROR: errn << prefix << "syntax error"; break; case ERROR_UNPAIRED_PARENTHESIS: errn << prefix << "unpaired parenthesis"; break; case ERROR_UNEXPECTED_SYMBOL: errn << prefix << "unexpected symbol"; break; case ERROR_UNKNOWN_VARIABLE: errn << prefix << "unknown variable"; break; case ERROR_UNKNOWN_FUNCTION: errn << prefix << "unknown function"; break; case ERROR_EMPTY_PARAMETER: errn << prefix << "empty parameter in function call"; break; case ERROR_CALCULATION_ERROR: errn << prefix << "calculation error"; break; default: errn << " "; } return errn.str(); } //--------------------------------------------------------------------------- void Evaluator::setVariable(const char * name, double value) { setItem("", name, Item(value), (Struct *)p); } void Evaluator::setVariable(const char * name, const char * expression) { setItem("", name, Item(expression), (Struct *)p); } //--------------------------------------------------------------------------- // Fix non ISO C++ compliant cast from pointer to function // to void*, which is a pointer to an object void Evaluator::setFunction(const char * name, double (*fun)()) { setItem("0", name, Item(reinterpret_cast(fun)), (Struct *)p); } void Evaluator::setFunction(const char * name, double (*fun)(double)) { setItem("1", name, Item(reinterpret_cast(fun)), (Struct *)p); } void Evaluator::setFunction(const char * name, double (*fun)(double,double)) { setItem("2", name, Item(reinterpret_cast(fun)), (Struct *)p); } void Evaluator::setFunction(const char * name, double (*fun)(double,double,double)) { setItem("3", name, Item(reinterpret_cast(fun)), (Struct *)p); } void Evaluator::setFunction(const char * name, double (*fun)(double,double,double,double)) { setItem("4", name, Item(reinterpret_cast(fun)), (Struct *)p); } void Evaluator::setFunction(const char * name, double (*fun)(double,double,double,double,double)) { setItem("5", name, Item(reinterpret_cast(fun)), (Struct *)p); } //--------------------------------------------------------------------------- bool Evaluator::findVariable(const char * name) const { if (name == 0 || *name == '\0') return false; const char * pointer; int n; REMOVE_BLANKS; if (n == 0) return false; Struct * s = (Struct *)(p); return ((s->theDictionary).find(string(pointer,n)) == (s->theDictionary).end()) ? false : true; } //--------------------------------------------------------------------------- bool Evaluator::findFunction(const char * name, int npar) const { if (name == 0 || *name == '\0') return false; if (npar < 0 || npar > MAX_N_PAR) return false; const char * pointer; int n; REMOVE_BLANKS; if (n == 0) return false; Struct * s = (Struct *)(p); return ((s->theDictionary).find(sss[npar]+string(pointer,n)) == (s->theDictionary).end()) ? false : true; } //--------------------------------------------------------------------------- void Evaluator::removeVariable(const char * name) { if (name == 0 || *name == '\0') return; const char * pointer; int n; REMOVE_BLANKS; if (n == 0) return; Struct * s = (Struct *)(p); (s->theDictionary).erase(string(pointer,n)); } //--------------------------------------------------------------------------- void Evaluator::removeFunction(const char * name, int npar) { if (name == 0 || *name == '\0') return; if (npar < 0 || npar > MAX_N_PAR) return; const char * pointer; int n; REMOVE_BLANKS; if (n == 0) return; Struct * s = (Struct *)(p); (s->theDictionary).erase(sss[npar]+string(pointer,n)); } //--------------------------------------------------------------------------- void Evaluator::clear() { Struct * s = (Struct *) p; s->theDictionary.clear(); s->theExpression = 0; s->thePosition = 0; s->theStatus = OK; s->theResult = 0.0; } //--------------------------------------------------------------------------- } // namespace HepTool clhep-2.1.4.1.orig/Evaluator/src/CMakeLists.txt0000644000175000017500000000013211606714767017701 0ustar olesoles clhep_build_library ( Evaluator Evaluator.cc setStdMath.cc setSystemOfUnits.cc ) clhep-2.1.4.1.orig/doxygen.conf0000644000175000017500000002043412241267303014724 0ustar olesoles# Doxyfile 1.4.7 #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = CLHEP PROJECT_NUMBER = 2.1.4.1 OUTPUT_DIRECTORY = CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = NO BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ABBREVIATE_BRIEF = ALWAYS_DETAILED_SEC = NO INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO STRIP_FROM_PATH = STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = YES DETAILS_AT_TOP = NO INHERIT_DOCS = YES SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 8 ALIASES = OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_JAVA = NO BUILTIN_STL_SUPPORT = YES DISTRIBUTE_GROUP_DOC = NO SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- EXTRACT_ALL = YES EXTRACT_PRIVATE = NO EXTRACT_STATIC = NO EXTRACT_LOCAL_CLASSES = YES EXTRACT_LOCAL_METHODS = NO HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO HIDE_FRIEND_COMPOUNDS = NO HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO CASE_SENSE_NAMES = YES HIDE_SCOPE_NAMES = NO SHOW_INCLUDE_FILES = YES INLINE_INFO = YES SORT_MEMBER_DOCS = YES SORT_BRIEF_DOCS = NO SORT_BY_SCOPE_NAME = NO GENERATE_TODOLIST = YES GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES GENERATE_DEPRECATEDLIST= YES ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = YES SHOW_DIRECTORIES = YES FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = YES WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = NO WARN_FORMAT = "$file:$line: $text" WARN_LOGFILE = doxygen.warnings #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = FILE_PATTERNS = RECURSIVE = YES EXCLUDE = */doc EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXAMPLE_PATH = EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = NO IMAGE_PATH = INPUT_FILTER = FILTER_PATTERNS = FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = YES INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES REFERENCES_LINK_SOURCE = YES USE_HTAGS = NO VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO COLS_IN_ALPHA_INDEX = 5 IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = html HTML_FILE_EXTENSION = .html HTML_HEADER = doxygen.template HTML_FOOTER = HTML_STYLESHEET = HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = GENERATE_CHI = NO BINARY_TOC = NO TOC_EXPAND = NO DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 GENERATE_TREEVIEW = NO TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- GENERATE_LATEX = NO LATEX_OUTPUT = latex LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex COMPACT_LATEX = NO PAPER_TYPE = a4wide EXTRA_PACKAGES = LATEX_HEADER = PDF_HYPERLINKS = NO USE_PDFLATEX = NO LATEX_BATCHMODE = YES LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- GENERATE_RTF = NO RTF_OUTPUT = rtf COMPACT_RTF = NO RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- GENERATE_MAN = NO MAN_OUTPUT = man MAN_EXTENSION = .3 MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- GENERATE_XML = NO XML_OUTPUT = xml XML_SCHEMA = XML_DTD = XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- GENERATE_PERLMOD = NO PERLMOD_LATEX = NO PERLMOD_PRETTY = YES PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES INCLUDE_PATH = Random Random/src INCLUDE_FILE_PATTERNS = PREDEFINED = EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- TAGFILES = GENERATE_TAGFILE = ALLEXTERNALS = NO EXTERNAL_GROUPS = YES PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = YES HIDE_UNDOC_RELATIONS = YES HAVE_DOT = NO CLASS_GRAPH = YES COLLABORATION_GRAPH = YES GROUP_GRAPHS = YES UML_LOOK = YES TEMPLATE_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO CALLER_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_HEIGHT = 1024 MAX_DOT_GRAPH_DEPTH = 0 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO clhep-2.1.4.1.orig/Vector/0000755000175000017500000000000012242515216013637 5ustar olesolesclhep-2.1.4.1.orig/Vector/Vector/0000755000175000017500000000000012242515215015100 5ustar olesolesclhep-2.1.4.1.orig/Vector/Vector/Boost.h0000755000175000017500000001713507746044120016356 0ustar olesoles// -*- C++ -*- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definition of the HepBoost class for performing specialized // Lorentz transformations which are pure boosts on objects of the // HepLorentzVector class. // // HepBoost is a concrete implementation of Hep4RotationInterface. // // .SS See Also // RotationInterfaces.h // LorentzVector.h LorentzRotation.h // BoostX.h BoostY.h BoostZ.h // // .SS Author // Mark Fischler #ifndef HEP_BOOST_H #define HEP_BOOST_H #ifdef GNUPRAGMA #pragma interface #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/RotationInterfaces.h" #include "CLHEP/Vector/BoostX.h" #include "CLHEP/Vector/BoostY.h" #include "CLHEP/Vector/BoostZ.h" #include "CLHEP/Vector/LorentzVector.h" namespace CLHEP { // Declarations of classes and global methods class HepBoost; inline HepBoost inverseOf ( const HepBoost & lt ); /** * @author * @ingroup vector */ class HepBoost { public: // ---------- Constructors and Assignment: inline HepBoost(); // Default constructor. Gives a boost of 0. inline HepBoost(const HepBoost & m); // Copy constructor. inline HepBoost & operator = (const HepBoost & m); // Assignment. HepBoost & set (double betaX, double betaY, double betaZ); inline HepBoost (double betaX, double betaY, double betaZ); // Constructor from three components of beta vector HepBoost & set (const HepRep4x4Symmetric & m); inline HepBoost (const HepRep4x4Symmetric & m); // Constructor from symmetric HepRep4x4 HepBoost & set (Hep3Vector direction, double beta); inline HepBoost (Hep3Vector direction, double beta); // Constructor from a three vector direction and the magnitude of beta HepBoost & set (const Hep3Vector & boost); inline HepBoost (const Hep3Vector & boost); // Constructor from a 3-vector of less than unit length inline HepBoost & set (const HepBoostX & boost); inline HepBoost & set (const HepBoostY & boost); inline HepBoost & set (const HepBoostZ & boost); inline HepBoost (const HepBoostX & boost); inline HepBoost (const HepBoostY & boost); inline HepBoost (const HepBoostZ & boost); // ---------- Accessors: inline double beta() const; inline double gamma() const; inline Hep3Vector boostVector() const; inline Hep3Vector getDirection() const; inline Hep3Vector direction() const; inline double xx() const; inline double xy() const; inline double xz() const; inline double xt() const; inline double yx() const; inline double yy() const; inline double yz() const; inline double yt() const; inline double zx() const; inline double zy() const; inline double zz() const; inline double zt() const; inline double tx() const; inline double ty() const; inline double tz() const; inline double tt() const; // Elements of the matrix. inline HepLorentzVector col1() const; inline HepLorentzVector col2() const; inline HepLorentzVector col3() const; inline HepLorentzVector col4() const; // orthosymplectic column vectors inline HepLorentzVector row1() const; inline HepLorentzVector row2() const; inline HepLorentzVector row3() const; inline HepLorentzVector row4() const; // orthosymplectic row vectors inline HepRep4x4 rep4x4() const; // 4x4 representation. inline HepRep4x4Symmetric rep4x4Symmetric() const; // Symmetric 4x4 representation. // ---------- Decomposition: void decompose (HepRotation & rotation, HepBoost & boost) const; void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const; // Find R and B such that L = R*B -- trivial, since R is identity void decompose (HepBoost & boost, HepRotation & rotation) const; void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const; // Find R and B such that L = B*R -- trivial, since R is identity // ---------- Comparisons: inline int compare( const HepBoost & b ) const; // Dictionary-order comparison, in order tt,zt,zz,yt,yz,yy,xt,xz,xy,xx // Used in operator<, >, <=, >= inline bool operator == (const HepBoost & b) const; inline bool operator != (const HepBoost & b) const; inline bool operator <= (const HepBoost & b) const; inline bool operator >= (const HepBoost & b) const; inline bool operator < (const HepBoost & b) const; inline bool operator > (const HepBoost & b) const; // Comparisons. inline bool isIdentity() const; // Returns true if a null boost. inline double distance2( const HepBoost & b ) const; inline double distance2( const HepBoostX & bx ) const; inline double distance2( const HepBoostY & by ) const; inline double distance2( const HepBoostZ & bz ) const; // Defined as the distance2 between the vectors (gamma*betaVector) double distance2( const HepRotation & r ) const; double distance2( const HepLorentzRotation & lt ) const; // Distance between this and other sorts of transformations inline double howNear( const HepBoost & b ) const; inline bool isNear( const HepBoost & b, double epsilon=Hep4RotationInterface::tolerance) const; double howNear( const HepRotation & r ) const; double howNear( const HepLorentzRotation & lt ) const; bool isNear( const HepRotation & r, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepLorentzRotation & lt, double epsilon=Hep4RotationInterface::tolerance) const; // ---------- Properties: double norm2() const; // (beta*gamma)^2 void rectify(); // set as an exact boost, based on the timelike part of the boost matrix. // ---------- Application: inline HepLorentzVector operator()( const HepLorentzVector & p ) const; // Transform a Lorentz Vector. inline HepLorentzVector operator* ( const HepLorentzVector & p ) const; // Multiplication with a Lorentz Vector. // ---------- Operations in the group of 4-Rotations HepLorentzRotation operator * (const HepBoost & b) const; HepLorentzRotation operator * (const HepRotation & r) const; HepLorentzRotation operator * (const HepLorentzRotation & lt) const; // Product of two Lorentz Rotations (this) * lt - matrix multiplication // Notice that the product of two pure boosts is no longer a pure boost inline HepBoost inverse() const; // Return the inverse. inline friend HepBoost inverseOf ( const HepBoost & lt ); // global methods to invert. inline HepBoost & invert(); // Inverts the Boost matrix. // ---------- I/O: std::ostream & print( std::ostream & os ) const; // Output form is (bx, by, bz) // ---------- Tolerance static inline double getTolerance(); static inline double setTolerance(double tol); protected: inline HepLorentzVector vectorMultiplication ( const HepLorentzVector & w ) const; // Multiplication with a Lorentz Vector. HepLorentzRotation matrixMultiplication (const HepRep4x4 & m) const; HepLorentzRotation matrixMultiplication (const HepRep4x4Symmetric & m) const; inline HepBoost (double xx, double xy, double xz, double xt, double yy, double yz, double yt, double zz, double zt, double tt); // Protected constructor. // DOES NOT CHECK FOR VALIDITY AS A LORENTZ BOOST. inline void setBoost(double bx, double by, double bz); HepRep4x4Symmetric rep_; }; // HepBoost inline std::ostream & operator << ( std::ostream & os, const HepBoost& b ) {return b.print(os);} } // namespace CLHEP #include "CLHEP/Vector/Boost.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_BOOST_H */ clhep-2.1.4.1.orig/Vector/Vector/RotationInterfaces.icc0000755000175000017500000001111107705060311021361 0ustar olesoles// -*- C++ -*- // $Id: RotationInterfaces.icc,v 1.1.1.1 2003/07/15 20:15:05 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This contains the definitions of the inline member functions of the // Hep4RotationInterface and Hep3RotationInterface classes, and of the // HepRep3x3 and HepRep4x4 structs. // namespace CLHEP { //-********* // HepRep3x3 //-********* inline HepRep3x3::HepRep3x3() : xx_(1.0), xy_(0.0), xz_(0.0) , yx_(0.0), yy_(1.0), yz_(0.0) , zx_(0.0), zy_(0.0), zz_(1.0) {} inline HepRep3x3::HepRep3x3( double xx, double xy, double xz , double yx, double yy, double yz , double zx, double zy, double zz ) : xx_(xx), xy_(xy), xz_(xz) , yx_(yx), yy_(yy), yz_(yz) , zx_(zx), zy_(zy), zz_(zz) {} inline HepRep3x3::HepRep3x3( const double * array ) { const double * a = array; double * r = &xx_; for ( int i = 0; i < 9; i++ ) { *r++ = *a++; } } inline void HepRep3x3::setToIdentity() { xx_ = 1.0; xy_ = 0.0; xz_ = 0.0; yx_ = 0.0; yy_ = 1.0; yz_ = 0.0; zx_ = 0.0; zy_ = 0.0; zz_ = 1.0; } inline void HepRep3x3::getArray( double * array ) const { double * a = array; const double * r = &xx_; for ( int i = 0; i < 9; i++ ) { *a++ = *r++; } } //-********* // HepRep4x4 //-********* inline HepRep4x4::HepRep4x4() : xx_(1.0), xy_(0.0), xz_(0.0), xt_(0.0) , yx_(0.0), yy_(1.0), yz_(0.0), yt_(0.0) , zx_(0.0), zy_(0.0), zz_(1.0), zt_(0.0) , tx_(0.0), ty_(0.0), tz_(0.0), tt_(1.0) {} inline HepRep4x4::HepRep4x4( double xx, double xy, double xz, double xt , double yx, double yy, double yz, double yt , double zx, double zy, double zz, double zt , double tx, double ty, double tz, double tt ) : xx_(xx), xy_(xy), xz_(xz), xt_(xt) , yx_(yx), yy_(yy), yz_(yz), yt_(yt) , zx_(zx), zy_(zy), zz_(zz), zt_(zt) , tx_(tx), ty_(ty), tz_(tz), tt_(tt) {} inline HepRep4x4::HepRep4x4( const HepRep4x4Symmetric & rep ) : xx_(rep.xx_), xy_(rep.xy_), xz_(rep.xz_), xt_(rep.xt_) , yx_(rep.xy_), yy_(rep.yy_), yz_(rep.yz_), yt_(rep.yt_) , zx_(rep.xz_), zy_(rep.yz_), zz_(rep.zz_), zt_(rep.zt_) , tx_(rep.xt_), ty_(rep.yt_), tz_(rep.zt_), tt_(rep.tt_) {} inline HepRep4x4::HepRep4x4( const double * array ) { const double * a = array; double * r = &xx_; for ( int i = 0; i < 16; i++ ) { *r++ = *a++; } } inline void HepRep4x4::setToIdentity() { xx_ = 1.0; xy_ = 0.0; xz_ = 0.0; xt_ = 0.0; yx_ = 0.0; yy_ = 1.0; yz_ = 0.0; yt_ = 0.0; zx_ = 0.0; zy_ = 0.0; zz_ = 1.0; zt_ = 0.0; tx_ = 0.0; ty_ = 0.0; tz_ = 0.0; tt_ = 1.0; } inline void HepRep4x4::getArray( double * array ) const { double * a = array; const double * r = &xx_; for ( int i = 0; i < 16; i++ ) { *a++ = *r++; } } inline bool HepRep4x4::operator == (const HepRep4x4 & r) const { return( xx_ == r.xx_ && xy_ == r.xy_ && xz_ == r.xz_ && xt_ == r.xt_ && yx_ == r.yx_ && yy_ == r.yy_ && yz_ == r.yz_ && yt_ == r.yt_ && zx_ == r.zx_ && zy_ == r.zy_ && zz_ == r.zz_ && zt_ == r.zt_ && tx_ == r.tx_ && ty_ == r.ty_ && tz_ == r.tz_ && tt_ == r.tt_ ); } inline bool HepRep4x4::operator != (const HepRep4x4 & r) const { return !(operator== (r)); } //-****************** // HepRep4x4Symmetric //-****************** inline HepRep4x4Symmetric::HepRep4x4Symmetric() : xx_(1.0), xy_(0.0), xz_(0.0), xt_(0.0) , yy_(1.0), yz_(0.0), yt_(0.0) , zz_(1.0), zt_(0.0) , tt_(1.0) {} inline HepRep4x4Symmetric::HepRep4x4Symmetric ( double xx, double xy, double xz, double xt , double yy, double yz, double yt , double zz, double zt , double tt ) : xx_(xx), xy_(xy), xz_(xz), xt_(xt) , yy_(yy), yz_(yz), yt_(yt) , zz_(zz), zt_(zt) , tt_(tt) {} inline HepRep4x4Symmetric::HepRep4x4Symmetric( const double * array ) { const double * a = array; double * r = &xx_; for ( int i = 0; i < 10; i++ ) { *r++ = *a++; } } inline void HepRep4x4Symmetric::setToIdentity() { xx_ = 1.0; xy_ = 0.0; xz_ = 0.0; xt_ = 0.0; yy_ = 1.0; yz_ = 0.0; yt_ = 0.0; zz_ = 1.0; zt_ = 0.0; tt_ = 1.0; } inline void HepRep4x4Symmetric::getArray( double * array ) const { double * a = array; const double * r = &xx_; for ( int i = 0; i < 10; i++ ) { *a++ = *r++; } } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/BoostY.icc0000755000175000017500000001267411712321422017010 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definitions of the inline member functions of the // HepBoostY class // #include namespace CLHEP { // ---------- Constructors and Assignment: inline HepBoostY::HepBoostY() : beta_(0.0), gamma_(1.0) {} inline HepBoostY::HepBoostY(const HepBoostY & b) : beta_ (b.beta_), gamma_(b.gamma_) {} inline HepBoostY & HepBoostY::operator = (const HepBoostY & b) { beta_ = b.beta_; gamma_ = b.gamma_; return *this; } inline HepBoostY::HepBoostY(double bbeta) { set(bbeta); } // - Protected method: inline HepBoostY::HepBoostY( double bbeta, double ggamma ) : beta_(bbeta), gamma_(ggamma) {} // ---------- Accessors: inline double HepBoostY::beta() const { return beta_; } inline double HepBoostY::gamma() const { return gamma_; } inline Hep3Vector HepBoostY::boostVector() const { return Hep3Vector( 0, beta_, 0 ); } inline Hep3Vector HepBoostY::getDirection() const { return Hep3Vector( 0.0, 1.0, 0.0 ); } inline double HepBoostY::xx() const { return 1.0;} inline double HepBoostY::xy() const { return 0.0;} inline double HepBoostY::xz() const { return 0.0;} inline double HepBoostY::xt() const { return 0.0;} inline double HepBoostY::yx() const { return 0.0;} inline double HepBoostY::yy() const { return gamma();} inline double HepBoostY::yz() const { return 0.0;} inline double HepBoostY::yt() const { return beta()*gamma();} inline double HepBoostY::zx() const { return 0.0;} inline double HepBoostY::zy() const { return 0.0;} inline double HepBoostY::zz() const { return 1.0;} inline double HepBoostY::zt() const { return 0.0;} inline double HepBoostY::tx() const { return 0.0;} inline double HepBoostY::ty() const { return beta()*gamma();} inline double HepBoostY::tz() const { return 0.0;} inline double HepBoostY::tt() const { return gamma();} inline HepLorentzVector HepBoostY::col1() const { return HepLorentzVector ( 1, 0, 0, 0 ); } inline HepLorentzVector HepBoostY::col2() const { return HepLorentzVector ( 0, gamma(), 0, beta()*gamma() ); } inline HepLorentzVector HepBoostY::col3() const { return HepLorentzVector ( 0, 0, 1, 0 ); } inline HepLorentzVector HepBoostY::col4() const { return HepLorentzVector ( 0, beta()*gamma(), 0, gamma() ); } inline HepLorentzVector HepBoostY::row1() const { return HepLorentzVector ( col1() ); } inline HepLorentzVector HepBoostY::row2() const { return HepLorentzVector ( col2() ); } inline HepLorentzVector HepBoostY::row3() const { return HepLorentzVector ( col3() ); } inline HepLorentzVector HepBoostY::row4() const { return HepLorentzVector ( col4() ); } // ---------- Comparisons: inline int HepBoostY::compare( const HepBoostY & b ) const { if (beta() < b.beta()) { return -1; } else if (beta() > b.beta()) { return 1; } else { return 0; } } inline bool HepBoostY::operator == ( const HepBoostY & b ) const { return beta_ == b.beta_; } inline bool HepBoostY::operator != ( const HepBoostY & b ) const { return beta_ != b.beta_; } inline bool HepBoostY::operator <= ( const HepBoostY & b ) const { return beta_ <= b.beta_; } inline bool HepBoostY::operator >= ( const HepBoostY & b ) const { return beta_ >= b.beta_; } inline bool HepBoostY::operator < ( const HepBoostY & b ) const { return beta_ < b.beta_; } inline bool HepBoostY::operator > ( const HepBoostY & b ) const { return beta_ > b.beta_; } inline bool HepBoostY::isIdentity() const { return ( beta() == 0 ); } inline double HepBoostY::distance2( const HepBoostY & b ) const { double d = beta()*gamma() - b.beta()*b.gamma(); return d*d; } inline double HepBoostY::howNear(const HepBoostY & b) const { return std::sqrt(distance2(b)); } inline double HepBoostY::howNear(const HepBoost & b) const { return std::sqrt(distance2(b)); } inline double HepBoostY::howNear(const HepRotation & r) const { return std::sqrt(distance2(r)); } inline double HepBoostY::howNear(const HepLorentzRotation & lt) const { return std::sqrt(distance2(lt)); } inline bool HepBoostY::isNear(const HepBoostY & b, double epsilon) const { return (distance2(b) <= epsilon*epsilon); } inline bool HepBoostY::isNear(const HepBoost & b, double epsilon) const { return (distance2(b) <= epsilon*epsilon); } // ---------- Properties: double HepBoostY::norm2() const { register double bg = beta_*gamma_; return bg*bg; } // ---------- Application: inline HepLorentzVector HepBoostY::operator * (const HepLorentzVector & p) const { double bg = beta_*gamma_; return HepLorentzVector( p.x(), gamma_*p.y() + bg*p.t(), p.z(), gamma_*p.t() + bg*p.y()); } HepLorentzVector HepBoostY::operator() (const HepLorentzVector & w) const { return operator*(w); } // ---------- Operations in the group of 4-Rotations inline HepBoostY HepBoostY::inverse() const { return HepBoostY( -beta(), gamma() ); } inline HepBoostY inverseOf ( const HepBoostY & b ) { return HepBoostY( -b.beta(), b.gamma()); } inline HepBoostY & HepBoostY::invert() { beta_ = -beta_; return *this; } // ---------- Tolerance: inline double HepBoostY::getTolerance() { return Hep4RotationInterface::tolerance; } inline double HepBoostY::setTolerance(double tol) { return Hep4RotationInterface::setTolerance(tol); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/cmake-defs.h.in0000644000175000017500000000201711607115601017654 0ustar olesoles/* @PACKAGE@/defs.h Generated by cmake. */ #ifndef @UPACKAGE@_DEFS_H #define @UPACKAGE@_DEFS_H /* Name of package */ #ifndef PACKAGE #define PACKAGE "@PACKAGE@" #endif /* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #define PACKAGE_BUGREPORT "http://savannah.cern.ch/projects/clhep/" #endif /* Define to the full name of this package. */ #ifndef PACKAGE_NAME #define PACKAGE_NAME "@PROJECT_NAME@ @PACKAGE@" #endif /* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #define PACKAGE_STRING "@PROJECT_NAME@ @PACKAGE@ @VERSION@" #endif /* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #define PACKAGE_TARNAME "@PACKAGE@" #endif /* Define to the version of this package. */ #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "@VERSION@" #endif /* building with Visual C++ */ /* #undef USING_VISUAL */ /* Version number of package */ #ifndef VERSION #define VERSION "@VERSION@" #endif #endif // @UPACKAGE@_DEFS_H clhep-2.1.4.1.orig/Vector/Vector/AxisAngle.h0000755000175000017500000000563007746044120017140 0ustar olesoles#ifndef HEP_AXISANGLE_H #define HEP_AXISANGLE_H // ---------------------------------------------------------------------- // // AxisAngle.h - provide HepAxisAngle class // // History: // 23-Jan-1998 WEB Initial draft // 15-Jun-1998 WEB Added namespace support // 02-May-2000 WEB No global using // 27-Jul-2000 MF CLHEP version // // ---------------------------------------------------------------------- #ifndef HEP_THREEVECTOR_H #include "CLHEP/Vector/ThreeVector.h" #endif #include #include "CLHEP/Vector/defs.h" namespace CLHEP { // Declarations of classes and global methods class HepAxisAngle; std::ostream & operator<<( std::ostream & os, const HepAxisAngle & aa ); std::istream & operator>>( std::istream & is, HepAxisAngle & aa ); /** * @author * @ingroup vector */ class HepAxisAngle { public: typedef double Scalar; protected: typedef HepAxisAngle AA; // just an abbreviation static Scalar tolerance; // to determine relative nearness public: // ---------- Constructors: inline HepAxisAngle(); inline HepAxisAngle( const Hep3Vector axis, Scalar delta ); // ---------- Destructor, copy constructor, assignment: // use C++ defaults // ---------- Accessors: public: inline Hep3Vector getAxis() const; inline Hep3Vector axis() const; inline AA & setAxis( const Hep3Vector axis ); inline double getDelta() const; inline double delta() const ; inline AA & setDelta( Scalar delta ); inline AA & set( const Hep3Vector axis, Scalar delta ); // ---------- Operations: // comparisons: inline int compare ( const AA & aa ) const; inline bool operator==( const AA & aa ) const; inline bool operator!=( const AA & aa ) const; inline bool operator< ( const AA & aa ) const; inline bool operator<=( const AA & aa ) const; inline bool operator> ( const AA & aa ) const; inline bool operator>=( const AA & aa ) const; // relative comparison: inline static double getTolerance(); inline static double setTolerance( Scalar tol ); protected: double distance( const HepAxisAngle & aa ) const; public: bool isNear ( const AA & aa, Scalar epsilon = tolerance ) const; double howNear( const AA & aa ) const; // ---------- I/O: friend std::ostream & operator<<( std::ostream & os, const AA & aa ); friend std::istream & operator>>( std::istream & is, AA & aa ); private: Hep3Vector axis_; // Note: After construction, this is always of mag 1 double delta_; }; // HepAxisAngle } // namespace CLHEP namespace zmpv { typedef CLHEP::HepAxisAngle AxisAngle; } // namespace zmpv #define AXISANGLE_ICC #include "CLHEP/Vector/AxisAngle.icc" #undef AXISANGLE_ICC #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif // HEP_AXISANGLE_H clhep-2.1.4.1.orig/Vector/Vector/LorentzRotation.icc0000755000175000017500000003026711712321422020744 0ustar olesoles// -*- C++ -*- // $Id: LorentzRotation.icc,v 1.2 2003/10/10 21:42:35 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definitions of the inline member functions of the // HepLorentzRotation class // namespace CLHEP { // ---------- Constructors and Assignment: inline HepLorentzRotation::HepLorentzRotation() : mxx(1.0), mxy(0.0), mxz(0.0), mxt(0.0), myx(0.0), myy(1.0), myz(0.0), myt(0.0), mzx(0.0), mzy(0.0), mzz(1.0), mzt(0.0), mtx(0.0), mty(0.0), mtz(0.0), mtt(1.0) {} inline HepLorentzRotation::HepLorentzRotation(const HepLorentzRotation & r) : mxx(r.mxx), mxy(r.mxy), mxz(r.mxz), mxt(r.mxt), myx(r.myx), myy(r.myy), myz(r.myz), myt(r.myt), mzx(r.mzx), mzy(r.mzy), mzz(r.mzz), mzt(r.mzt), mtx(r.mtx), mty(r.mty), mtz(r.mtz), mtt(r.mtt) {} inline HepLorentzRotation::HepLorentzRotation(const HepRotation & r) { set (r.rep4x4()); } inline HepLorentzRotation::HepLorentzRotation(const HepRotationX & r) { set (r.rep4x4()); } inline HepLorentzRotation::HepLorentzRotation(const HepRotationY & r) { set (r.rep4x4()); } inline HepLorentzRotation::HepLorentzRotation(const HepRotationZ & r) { set (r.rep4x4()); } inline HepLorentzRotation::HepLorentzRotation(const HepBoost & b) { set (b.rep4x4()); } inline HepLorentzRotation::HepLorentzRotation(const HepBoostX & b) { set (b.rep4x4()); } inline HepLorentzRotation::HepLorentzRotation(const HepBoostY & b) { set (b.rep4x4()); } inline HepLorentzRotation::HepLorentzRotation(const HepBoostZ & b) { set (b.rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::operator = (const HepLorentzRotation & r) { mxx = r.mxx; mxy = r.mxy; mxz = r.mxz; mxt = r.mxt; myx = r.myx; myy = r.myy; myz = r.myz; myt = r.myt; mzx = r.mzx; mzy = r.mzy; mzz = r.mzz; mzt = r.mzt; mtx = r.mtx; mty = r.mty; mtz = r.mtz; mtt = r.mtt; return *this; } inline HepLorentzRotation & HepLorentzRotation::operator = (const HepRotation & m1) { return set (m1.rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::operator = (const HepBoost & m1) { return set (m1.rep4x4()); } HepLorentzRotation & HepLorentzRotation::set (const Hep3Vector & p) { return set (p.x(), p.y(), p.z()); } inline HepLorentzRotation & HepLorentzRotation::set (const HepRotation & r) { return set (r.rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationX & r) { return set (r.rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationY & r) { return set (r.rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::set (const HepRotationZ & r) { return set (r.rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::set (const HepBoost & bboost) { return set (bboost.rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostX & bboost) { return set (bboost.rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostY & bboost) { return set (bboost.rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::set (const HepBoostZ & bboost) { return set (bboost.rep4x4()); } inline HepLorentzRotation::HepLorentzRotation(double bx, double by, double bz) { set(bx, by, bz); } inline HepLorentzRotation::HepLorentzRotation(const Hep3Vector & p) { set(p.x(), p.y(), p.z()); } inline HepLorentzRotation::HepLorentzRotation( const HepBoost & B, const HepRotation & R) { set(B, R); } inline HepLorentzRotation::HepLorentzRotation( const HepRotation & R, const HepBoost & B) { set(R, B); } inline HepLorentzRotation & HepLorentzRotation::set( const HepRep4x4 & rep ) { mxx=rep.xx_; mxy=rep.xy_; mxz=rep.xz_; mxt=rep.xt_; myx=rep.yx_; myy=rep.yy_; myz=rep.yz_; myt=rep.yt_; mzx=rep.zx_; mzy=rep.zy_; mzz=rep.zz_; mzt=rep.zt_; mtx=rep.tx_; mty=rep.ty_; mtz=rep.tz_; mtt=rep.tt_; return *this; } inline HepLorentzRotation ::HepLorentzRotation ( const HepRep4x4 & rep ) : mxx(rep.xx_), mxy(rep.xy_), mxz(rep.xz_), mxt(rep.xt_), myx(rep.yx_), myy(rep.yy_), myz(rep.yz_), myt(rep.yt_), mzx(rep.zx_), mzy(rep.zy_), mzz(rep.zz_), mzt(rep.zt_), mtx(rep.tx_), mty(rep.ty_), mtz(rep.tz_), mtt(rep.tt_) {} // - Protected methods inline HepLorentzRotation::HepLorentzRotation( double rxx, double rxy, double rxz, double rxt, double ryx, double ryy, double ryz, double ryt, double rzx, double rzy, double rzz, double rzt, double rtx, double rty, double rtz, double rtt) : mxx(rxx), mxy(rxy), mxz(rxz), mxt(rxt), myx(ryx), myy(ryy), myz(ryz), myt(ryt), mzx(rzx), mzy(rzy), mzz(rzz), mzt(rzt), mtx(rtx), mty(rty), mtz(rtz), mtt(rtt) {} inline void HepLorentzRotation::setBoost (double bx, double by, double bz) { set(bx, by, bz); } // ---------- Accessors: inline double HepLorentzRotation::xx() const { return mxx; } inline double HepLorentzRotation::xy() const { return mxy; } inline double HepLorentzRotation::xz() const { return mxz; } inline double HepLorentzRotation::xt() const { return mxt; } inline double HepLorentzRotation::yx() const { return myx; } inline double HepLorentzRotation::yy() const { return myy; } inline double HepLorentzRotation::yz() const { return myz; } inline double HepLorentzRotation::yt() const { return myt; } inline double HepLorentzRotation::zx() const { return mzx; } inline double HepLorentzRotation::zy() const { return mzy; } inline double HepLorentzRotation::zz() const { return mzz; } inline double HepLorentzRotation::zt() const { return mzt; } inline double HepLorentzRotation::tx() const { return mtx; } inline double HepLorentzRotation::ty() const { return mty; } inline double HepLorentzRotation::tz() const { return mtz; } inline double HepLorentzRotation::tt() const { return mtt; } inline HepLorentzVector HepLorentzRotation::col1() const { return HepLorentzVector ( mxx, myx, mzx, mtx ); } inline HepLorentzVector HepLorentzRotation::col2() const { return HepLorentzVector ( mxy, myy, mzy, mty ); } inline HepLorentzVector HepLorentzRotation::col3() const { return HepLorentzVector ( mxz, myz, mzz, mtz ); } inline HepLorentzVector HepLorentzRotation::col4() const { return HepLorentzVector ( mxt, myt, mzt, mtt ); } inline HepLorentzVector HepLorentzRotation::row1() const { return HepLorentzVector ( mxx, mxy, mxz, mxt ); } inline HepLorentzVector HepLorentzRotation::row2() const { return HepLorentzVector ( myx, myy, myz, myt ); } inline HepLorentzVector HepLorentzRotation::row3() const { return HepLorentzVector ( mzx, mzy, mzz, mzt ); } inline HepLorentzVector HepLorentzRotation::row4() const { return HepLorentzVector ( mtx, mty, mtz, mtt ); } inline HepRep4x4 HepLorentzRotation::rep4x4() const { return HepRep4x4( mxx, mxy, mxz, mxt, myx, myy, myz, myt, mzx, mzy, mzz, mzt, mtx, mty, mtz, mtt ); } // ------------ Subscripting: inline HepLorentzRotation::HepLorentzRotation_row::HepLorentzRotation_row (const HepLorentzRotation & r, int i) : rr(r), ii(i) {} inline double HepLorentzRotation::HepLorentzRotation_row::operator [] (int jj) const { return rr(ii,jj); } inline const HepLorentzRotation::HepLorentzRotation_row HepLorentzRotation::operator [] (int i) const { return HepLorentzRotation_row(*this, i); } // ---------- Comparisons: inline bool HepLorentzRotation::operator == (const HepLorentzRotation & r) const { return (mxx == r.xx() && mxy == r.xy() && mxz == r.xz() && mxt == r.xt() && myx == r.yx() && myy == r.yy() && myz == r.yz() && myt == r.yt() && mzx == r.zx() && mzy == r.zy() && mzz == r.zz() && mzt == r.zt() && mtx == r.tx() && mty == r.ty() && mtz == r.tz() && mtt == r.tt()); } inline bool HepLorentzRotation::operator != (const HepLorentzRotation & r) const { return ! operator==(r); } inline bool HepLorentzRotation::operator < ( const HepLorentzRotation & r ) const { return compare(r)< 0; } inline bool HepLorentzRotation::operator <= ( const HepLorentzRotation & r ) const { return compare(r)<=0; } inline bool HepLorentzRotation::operator >= ( const HepLorentzRotation & r ) const { return compare(r)>=0; } inline bool HepLorentzRotation::operator > ( const HepLorentzRotation & r ) const { return compare(r)> 0; } inline bool HepLorentzRotation::isIdentity() const { return (mxx == 1.0 && mxy == 0.0 && mxz == 0.0 && mxt == 0.0 && myx == 0.0 && myy == 1.0 && myz == 0.0 && myt == 0.0 && mzx == 0.0 && mzy == 0.0 && mzz == 1.0 && mzt == 0.0 && mtx == 0.0 && mty == 0.0 && mtz == 0.0 && mtt == 1.0); } // ---------- Properties: // ---------- Application: inline HepLorentzVector HepLorentzRotation::vectorMultiplication(const HepLorentzVector & p) const { register double x(p.x()); register double y(p.y()); register double z(p.z()); register double t(p.t()); return HepLorentzVector(mxx*x + mxy*y + mxz*z + mxt*t, myx*x + myy*y + myz*z + myt*t, mzx*x + mzy*y + mzz*z + mzt*t, mtx*x + mty*y + mtz*z + mtt*t); } inline HepLorentzVector HepLorentzRotation::operator() (const HepLorentzVector & w) const { return vectorMultiplication(w); } inline HepLorentzVector HepLorentzRotation::operator * (const HepLorentzVector & p) const { return vectorMultiplication(p); } // ---------- Operations in the group of 4-Rotations inline HepLorentzRotation HepLorentzRotation::operator * (const HepBoost & b) const { return matrixMultiplication(b.rep4x4()); } inline HepLorentzRotation HepLorentzRotation::operator * (const HepRotation & r) const { return matrixMultiplication(r.rep4x4()); } inline HepLorentzRotation HepLorentzRotation::operator * (const HepLorentzRotation & lt) const { return matrixMultiplication(lt.rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::operator *= (const HepBoost & b) { return *this = matrixMultiplication(b.rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::operator *= (const HepRotation & r) { return *this = matrixMultiplication(r.rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::operator *= (const HepLorentzRotation & lt) { return *this = matrixMultiplication(lt.rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::transform (const HepBoost & b) { return *this = HepLorentzRotation(b).matrixMultiplication(rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::transform (const HepRotation & r) { return *this = HepLorentzRotation(r).matrixMultiplication(rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::transform (const HepLorentzRotation & lt) { return *this = lt.matrixMultiplication(rep4x4()); } inline HepLorentzRotation & HepLorentzRotation::rotate(double angle, const Hep3Vector & axis) { return transform(HepRotation().rotate(angle, axis)); } inline HepLorentzRotation & HepLorentzRotation::rotate(double angle, const Hep3Vector * axis) { return transform(HepRotation().rotate(angle, axis)); } inline HepLorentzRotation & HepLorentzRotation::boost(double bx, double by, double bz) { return transform(HepLorentzRotation(bx, by, bz)); } inline HepLorentzRotation & HepLorentzRotation::boost(const Hep3Vector & b) { return transform(HepLorentzRotation(b)); } inline HepLorentzRotation HepLorentzRotation::inverse() const { return HepLorentzRotation( mxx, myx, mzx, -mtx, mxy, myy, mzy, -mty, mxz, myz, mzz, -mtz, -mxt, -myt, -mzt, mtt ); } inline HepLorentzRotation & HepLorentzRotation::invert() { return *this = inverse(); } inline HepLorentzRotation inverseOf ( const HepLorentzRotation & lt ) { return HepLorentzRotation( HepRep4x4( lt.mxx, lt.myx, lt.mzx, -lt.mtx, lt.mxy, lt.myy, lt.mzy, -lt.mty, lt.mxz, lt.myz, lt.mzz, -lt.mtz, -lt.mxt, -lt.myt, -lt.mzt, lt.mtt ) ); } inline double HepLorentzRotation::getTolerance() { return Hep4RotationInterface::tolerance; } inline double HepLorentzRotation::setTolerance(double tol) { return Hep4RotationInterface::setTolerance(tol); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/EulerAngles.icc0000755000175000017500000000704311712321422017771 0ustar olesoles#ifndef EULERANGLES_ICC #error "EulerAngles.icc included without EulerAngles.h" #endif // ---------------------------------------------------------------------- // // EulerAngles.icc - Inline methods for EulerAngles class. // // History: // 9-Apr-1997 MF Split off from original angles.hh. Content-free. // 26-Jan-1998 WEB Fleshed out. // 12-Mar-1998 WEB Gave default constructor proper default values // 13-Mar-1998 WEB Simplified compare() // 17-Jun-1998 WEB Added namespace support // 27-Jul-2000 MF CLHEP version // // ---------------------------------------------------------------------- namespace CLHEP { inline HepEulerAngles::HepEulerAngles() : phi_( 0.0 ), theta_( 0.0 ), psi_( 0.0 ) {} // HepEulerAngles::HepEulerAngles() inline HepEulerAngles::HepEulerAngles ( double phi1, double ttheta, double psi1 ) : phi_( phi1 ), theta_( ttheta ), psi_( psi1 ) {} // HepEulerAngles::HepEulerAngles() inline double HepEulerAngles::getPhi() const { return phi_; } // HepEulerAngles::getPhi() inline double HepEulerAngles::phi() const { return phi_; } // HepEulerAngles::phi() inline HepEulerAngles & HepEulerAngles::setPhi( double phi1 ) { phi_ = phi1; return *this; } // HepEulerAngles::setPhi() inline double HepEulerAngles::getTheta() const { return theta_; } // HepEulerAngles::getTheta() inline double HepEulerAngles::theta() const { return theta_; } // HepEulerAngles::theta() inline HepEulerAngles & HepEulerAngles::setTheta( double ttheta ) { theta_ = ttheta; return *this; } // HepEulerAngles::setTheta() inline double HepEulerAngles::getPsi() const { return psi_; } // HepEulerAngles::getPsi() inline double HepEulerAngles::psi() const { return psi_; } // HepEulerAngles::psi() inline HepEulerAngles & HepEulerAngles::setPsi( double psi1 ) { psi_ = psi1; return *this; } // HepEulerAngles::setPsi() inline HepEulerAngles & HepEulerAngles::set( double phi1, double ttheta, double psi1 ) { phi_ = phi1, theta_ = ttheta, psi_ = psi1; return *this; } // HepEulerAngles::set() inline int HepEulerAngles::compare( const HepEulerAngles & ea ) const { return phi_ < ea.phi_ ? -1 : phi_ > ea.phi_ ? +1 : theta_ < ea.theta_ ? -1 : theta_ > ea.theta_ ? +1 : psi_ < ea.psi_ ? -1 : psi_ > ea.psi_ ? +1 : 0; } // HepEulerAngles::compare() inline bool HepEulerAngles::operator==( const HepEulerAngles & ea ) const { return ( compare( ea ) == 0 ); } // HepEulerAngles::operator==() inline bool HepEulerAngles::operator!=( const HepEulerAngles & ea ) const { return ( compare( ea ) != 0 ); } // HepEulerAngles::operator!=() inline bool HepEulerAngles::operator<( const HepEulerAngles & ea ) const { return ( compare( ea ) < 0 ); } // HepEulerAngles::operator<() inline bool HepEulerAngles::operator<=( const HepEulerAngles & ea ) const { return ( compare( ea ) <= 0 ); } // HepEulerAngles::operator<=() inline bool HepEulerAngles::operator>( const HepEulerAngles & ea ) const { return ( compare( ea ) > 0 ); } // HepEulerAngles::operator>() inline bool HepEulerAngles::operator>=( const HepEulerAngles & ea ) const { return ( compare( ea ) >= 0 ); } // HepEulerAngles::operator>=() inline double HepEulerAngles::getTolerance() { return tolerance; } // HepEulerAngles::getTolerance() inline double HepEulerAngles::setTolerance( double tol ) { double oldTolerance( tolerance ); tolerance = tol; return oldTolerance; } // HepEulerAngles::setTolerance() } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/RotationX.icc0000755000175000017500000001560012050774211017514 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definitions of the inline member functions of the // HepRotationX class // #include #include "CLHEP/Units/PhysicalConstants.h" namespace CLHEP { inline double HepRotationX::yy() const { return its_c; } inline double HepRotationX::yz() const { return -its_s; } inline double HepRotationX::zy() const { return its_s; } inline double HepRotationX::zz() const { return its_c; } inline double HepRotationX::xx() const { return 1.0; } inline double HepRotationX::xy() const { return 0.0; } inline double HepRotationX::xz() const { return 0.0; } inline double HepRotationX::yx() const { return 0.0; } inline double HepRotationX::zx() const { return 0.0; } inline HepRep3x3 HepRotationX::rep3x3() const { return HepRep3x3 ( 1.0, 0.0, 0.0, 0.0, its_c, -its_s, 0.0, its_s, its_c ); } inline HepRotationX::HepRotationX() : its_d(0.0), its_s(0.0), its_c(1.0) {} inline HepRotationX::HepRotationX(const HepRotationX & orig) : its_d(orig.its_d), its_s(orig.its_s), its_c(orig.its_c) {} inline HepRotationX::HepRotationX(double dd, double ss, double cc) : its_d(dd), its_s(ss), its_c(cc) {} inline HepRotationX & HepRotationX::operator= (const HepRotationX & orig) { its_d = orig.its_d; its_s = orig.its_s; its_c = orig.its_c; return *this; } inline HepRotationX::~HepRotationX() {} inline Hep3Vector HepRotationX::colX() const { return Hep3Vector ( 1.0, 0.0, 0.0 ); } inline Hep3Vector HepRotationX::colY() const { return Hep3Vector ( 0.0, its_c, its_s ); } inline Hep3Vector HepRotationX::colZ() const { return Hep3Vector ( 0.0, -its_s, its_c ); } inline Hep3Vector HepRotationX::rowX() const { return Hep3Vector ( 1.0, 0.0, 0.0 ); } inline Hep3Vector HepRotationX::rowY() const { return Hep3Vector ( 0.0, its_c, -its_s ); } inline Hep3Vector HepRotationX::rowZ() const { return Hep3Vector ( 0.0, its_s, its_c ); } inline double HepRotationX::getPhi () const { return phi(); } inline double HepRotationX::getTheta() const { return theta(); } inline double HepRotationX::getPsi () const { return psi(); } inline double HepRotationX::getDelta() const { return its_d; } inline Hep3Vector HepRotationX::getAxis () const { return axis(); } inline double HepRotationX::delta() const { return its_d; } inline Hep3Vector HepRotationX::axis() const { return Hep3Vector(1,0,0); } inline HepAxisAngle HepRotationX::axisAngle() const { return HepAxisAngle ( axis(), delta() ); } inline void HepRotationX::getAngleAxis (double & ddelta, Hep3Vector & aaxis) const { ddelta = its_d; aaxis = getAxis(); } inline HepLorentzVector HepRotationX::col1() const { return HepLorentzVector (colX(), 0); } inline HepLorentzVector HepRotationX::col2() const { return HepLorentzVector (colY(), 0); } inline HepLorentzVector HepRotationX::col3() const { return HepLorentzVector (colZ(), 0); } inline HepLorentzVector HepRotationX::col4() const { return HepLorentzVector (0,0,0,1); } inline HepLorentzVector HepRotationX::row1() const { return HepLorentzVector (rowX(), 0); } inline HepLorentzVector HepRotationX::row2() const { return HepLorentzVector (rowY(), 0); } inline HepLorentzVector HepRotationX::row3() const { return HepLorentzVector (rowZ(), 0); } inline HepLorentzVector HepRotationX::row4() const { return HepLorentzVector (0,0,0,1); } inline double HepRotationX::xt() const { return 0.0; } inline double HepRotationX::yt() const { return 0.0; } inline double HepRotationX::zt() const { return 0.0; } inline double HepRotationX::tx() const { return 0.0; } inline double HepRotationX::ty() const { return 0.0; } inline double HepRotationX::tz() const { return 0.0; } inline double HepRotationX::tt() const { return 1.0; } inline HepRep4x4 HepRotationX::rep4x4() const { return HepRep4x4 ( 1.0, 0.0, 0.0, 0.0, 0.0, its_c, -its_s, 0.0, 0.0, its_s, its_c, 0.0, 0.0, 0.0, 0.0, 1.0 ); } inline bool HepRotationX::isIdentity() const { return ( its_d==0 ); } inline int HepRotationX::compare ( const HepRotationX & r ) const { if (its_d > r.its_d) return 1; else if (its_d < r.its_d) return -1; else return 0; } inline bool HepRotationX::operator==(const HepRotationX & r) const { return (its_d==r.its_d); } inline bool HepRotationX::operator!=(const HepRotationX & r) const { return (its_d!=r.its_d); } inline bool HepRotationX::operator>=(const HepRotationX & r) const { return (its_d>=r.its_d); } inline bool HepRotationX::operator<=(const HepRotationX & r) const { return (its_d<=r.its_d); } inline bool HepRotationX::operator> (const HepRotationX & r) const { return (its_d> r.its_d); } inline bool HepRotationX::operator< (const HepRotationX & r) const { return (its_d< r.its_d); } inline void HepRotationX::rectify() { its_d = proper(its_d); // Just in case! its_s = std::sin(its_d); its_c = std::cos(its_d); } inline Hep3Vector HepRotationX::operator() (const Hep3Vector & p) const { double x = p.x(); double y = p.y(); double z = p.z(); return Hep3Vector( x, y * its_c - z * its_s, z * its_c + y * its_s ); } inline Hep3Vector HepRotationX::operator * (const Hep3Vector & p) const { return operator()(p); } inline HepLorentzVector HepRotationX::operator() ( const HepLorentzVector & w ) const { return HepLorentzVector( operator() (w.vect()) , w.t() ); } inline HepLorentzVector HepRotationX::operator * (const HepLorentzVector & p) const { return operator()(p); } inline HepRotationX & HepRotationX::operator *= (const HepRotationX & m1) { return *this = (*this) * (m1); } inline HepRotationX & HepRotationX::transform(const HepRotationX & m1) { return *this = m1 * (*this); } inline double HepRotationX::proper( double ddelta ) { // -PI < d <= PI if ( std::fabs(ddelta) < CLHEP::pi ) { return ddelta; } else { register double x = ddelta / (CLHEP::twopi); return (CLHEP::twopi) * ( x + std::floor(.5-x) ); } } // proper() inline HepRotationX HepRotationX::operator * ( const HepRotationX & rx ) const { return HepRotationX ( HepRotationX::proper(its_d+rx.its_d), its_s*rx.its_c + its_c*rx.its_s, its_c*rx.its_c - its_s*rx.its_s ); } inline HepRotationX HepRotationX::inverse() const { return HepRotationX( proper(-its_d), -its_s, its_c ); } inline HepRotationX inverseOf(const HepRotationX & r) { return r.inverse(); } inline HepRotationX & HepRotationX::invert() { return *this=inverse(); } inline double HepRotationX::getTolerance() { return Hep4RotationInterface::tolerance; } inline double HepRotationX::setTolerance(double tol) { return Hep4RotationInterface::setTolerance(tol); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/Rotation.icc0000755000175000017500000002717212050774211017373 0ustar olesoles// -*- C++ -*- // $Id: Rotation.icc,v 1.2 2003/10/10 21:42:35 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definitions of the inline member functions of the // HepRotation class // namespace CLHEP { // Put commonly used accessors as early as possible to avoid inlining misses: inline double HepRotation::xx() const { return rxx; } inline double HepRotation::xy() const { return rxy; } inline double HepRotation::xz() const { return rxz; } inline double HepRotation::yx() const { return ryx; } inline double HepRotation::yy() const { return ryy; } inline double HepRotation::yz() const { return ryz; } inline double HepRotation::zx() const { return rzx; } inline double HepRotation::zy() const { return rzy; } inline double HepRotation::zz() const { return rzz; } inline HepRep3x3 HepRotation::rep3x3() const { return HepRep3x3 ( rxx, rxy, rxz, ryx, ryy, ryz, rzx, rzy, rzz ); } inline double HepRotation::xt() const { return 0.0; } inline double HepRotation::yt() const { return 0.0; } inline double HepRotation::zt() const { return 0.0; } inline double HepRotation::tx() const { return 0.0; } inline double HepRotation::ty() const { return 0.0; } inline double HepRotation::tz() const { return 0.0; } inline double HepRotation::tt() const { return 1.0; } inline HepRep4x4 HepRotation::rep4x4() const { return HepRep4x4 ( rxx, rxy, rxz, 0.0, ryx, ryy, ryz, 0.0, rzx, rzy, rzz, 0.0, 0.0, 0.0, 0.0, 1.0 ); } // Ctors etc: inline HepRotation::HepRotation() : rxx(1.0), rxy(0.0), rxz(0.0), ryx(0.0), ryy(1.0), ryz(0.0), rzx(0.0), rzy(0.0), rzz(1.0) {} inline HepRotation::HepRotation(const HepRotation & m1) : rxx(m1.rxx), rxy(m1.rxy), rxz(m1.rxz), ryx(m1.ryx), ryy(m1.ryy), ryz(m1.ryz), rzx(m1.rzx), rzy(m1.rzy), rzz(m1.rzz) {} inline HepRotation::HepRotation (double mxx, double mxy, double mxz, double myx, double myy, double myz, double mzx, double mzy, double mzz) : rxx(mxx), rxy(mxy), rxz(mxz), ryx(myx), ryy(myy), ryz(myz), rzx(mzx), rzy(mzy), rzz(mzz) {} inline HepRotation::HepRotation ( const HepRep3x3 & m1 ) : rxx(m1.xx_), rxy(m1.xy_), rxz(m1.xz_), ryx(m1.yx_), ryy(m1.yy_), ryz(m1.yz_), rzx(m1.zx_), rzy(m1.zy_), rzz(m1.zz_) {} inline HepRotation::HepRotation(const HepRotationX & rx) : rxx(1.0), rxy(0.0), rxz(0.0), ryx(0.0), ryy(rx.yy()), ryz(rx.yz()), rzx(0.0), rzy(rx.zy()), rzz(rx.zz()) {} inline HepRotation::HepRotation(const HepRotationY & ry) : rxx(ry.xx()), rxy(0.0), rxz(ry.xz()), ryx(0.0), ryy(1.0), ryz(0.0), rzx(ry.zx()), rzy(0.0), rzz(ry.zz()) {} inline HepRotation::HepRotation(const HepRotationZ & rz) : rxx(rz.xx()), rxy(rz.xy()), rxz(0.0), ryx(rz.yx()), ryy(rz.yy()), ryz(0.0), rzx(0.0), rzy(0.0), rzz(1.0) {} inline HepRotation::~HepRotation() {} // More accessors: inline HepRotation::HepRotation_row::HepRotation_row (const HepRotation & r, int i) : rr(r), ii(i) {} inline double HepRotation::HepRotation_row::operator [] (int jj) const { return rr(ii,jj); } inline const HepRotation::HepRotation_row HepRotation::operator [] (int i) const { return HepRotation_row(*this, i); } inline Hep3Vector HepRotation::colX() const { return Hep3Vector ( rxx, ryx, rzx ); } inline Hep3Vector HepRotation::colY() const { return Hep3Vector ( rxy, ryy, rzy ); } inline Hep3Vector HepRotation::colZ() const { return Hep3Vector ( rxz, ryz, rzz ); } inline Hep3Vector HepRotation::rowX() const { return Hep3Vector ( rxx, rxy, rxz ); } inline Hep3Vector HepRotation::rowY() const { return Hep3Vector ( ryx, ryy, ryz ); } inline Hep3Vector HepRotation::rowZ() const { return Hep3Vector ( rzx, rzy, rzz ); } inline HepLorentzVector HepRotation::col1() const { return HepLorentzVector (colX(), 0); } inline HepLorentzVector HepRotation::col2() const { return HepLorentzVector (colY(), 0); } inline HepLorentzVector HepRotation::col3() const { return HepLorentzVector (colZ(), 0); } inline HepLorentzVector HepRotation::col4() const { return HepLorentzVector (0,0,0,1); } inline HepLorentzVector HepRotation::row1() const { return HepLorentzVector (rowX(), 0); } inline HepLorentzVector HepRotation::row2() const { return HepLorentzVector (rowY(), 0); } inline HepLorentzVector HepRotation::row3() const { return HepLorentzVector (rowZ(), 0); } inline HepLorentzVector HepRotation::row4() const { return HepLorentzVector (0,0,0,1); } inline double HepRotation::getPhi () const { return phi(); } inline double HepRotation::getTheta() const { return theta(); } inline double HepRotation::getPsi () const { return psi(); } inline double HepRotation::getDelta() const { return delta(); } inline Hep3Vector HepRotation::getAxis () const { return axis(); } inline HepRotation & HepRotation::operator = (const HepRotation & m1) { rxx = m1.rxx; rxy = m1.rxy; rxz = m1.rxz; ryx = m1.ryx; ryy = m1.ryy; ryz = m1.ryz; rzx = m1.rzx; rzy = m1.rzy; rzz = m1.rzz; return *this; } inline HepRotation & HepRotation::set(const HepRep3x3 & m1) { rxx = m1.xx_; rxy = m1.xy_; rxz = m1.xz_; ryx = m1.yx_; ryy = m1.yy_; ryz = m1.yz_; rzx = m1.zx_; rzy = m1.zy_; rzz = m1.zz_; return *this; } inline HepRotation & HepRotation::set(const HepRotationX & r) { return (set (r.rep3x3())); } inline HepRotation & HepRotation::set(const HepRotationY & r) { return (set (r.rep3x3())); } inline HepRotation & HepRotation::set(const HepRotationZ & r) { return (set (r.rep3x3())); } inline HepRotation & HepRotation::operator= (const HepRotationX & r) { return (set (r.rep3x3())); } inline HepRotation & HepRotation::operator= (const HepRotationY & r) { return (set (r.rep3x3())); } inline HepRotation & HepRotation::operator= (const HepRotationZ & r) { return (set (r.rep3x3())); } inline Hep3Vector HepRotation::operator * (const Hep3Vector & p) const { return Hep3Vector(rxx*p.x() + rxy*p.y() + rxz*p.z(), ryx*p.x() + ryy*p.y() + ryz*p.z(), rzx*p.x() + rzy*p.y() + rzz*p.z()); // This is identical to the code in the CLHEP 1.6 version } inline Hep3Vector HepRotation::operator () (const Hep3Vector & p) const { register double x = p.x(); register double y = p.y(); register double z = p.z(); return Hep3Vector(rxx*x + rxy*y + rxz*z, ryx*x + ryy*y + ryz*z, rzx*x + rzy*y + rzz*z); } inline HepLorentzVector HepRotation::operator () (const HepLorentzVector & w) const { return HepLorentzVector( operator() (w.vect()), w.t() ); } inline HepLorentzVector HepRotation::operator * (const HepLorentzVector & p) const { return operator()(p); } inline HepRotation HepRotation::operator* (const HepRotation & r) const { return HepRotation(rxx*r.rxx + rxy*r.ryx + rxz*r.rzx, rxx*r.rxy + rxy*r.ryy + rxz*r.rzy, rxx*r.rxz + rxy*r.ryz + rxz*r.rzz, ryx*r.rxx + ryy*r.ryx + ryz*r.rzx, ryx*r.rxy + ryy*r.ryy + ryz*r.rzy, ryx*r.rxz + ryy*r.ryz + ryz*r.rzz, rzx*r.rxx + rzy*r.ryx + rzz*r.rzx, rzx*r.rxy + rzy*r.ryy + rzz*r.rzy, rzx*r.rxz + rzy*r.ryz + rzz*r.rzz ); } inline HepRotation HepRotation::operator * (const HepRotationX & rx) const { double yy1 = rx.yy(); double yz1 = rx.yz(); double zy1 = -yz1; double zz1 = yy1; return HepRotation( rxx, rxy*yy1 + rxz*zy1, rxy*yz1 + rxz*zz1, ryx, ryy*yy1 + ryz*zy1, ryy*yz1 + ryz*zz1, rzx, rzy*yy1 + rzz*zy1, rzy*yz1 + rzz*zz1 ); } inline HepRotation HepRotation::operator * (const HepRotationY & ry) const { double xx1 = ry.xx(); double xz1 = ry.xz(); double zx1 = -xz1; double zz1 = xx1; return HepRotation( rxx*xx1 + rxz*zx1, rxy, rxx*xz1 + rxz*zz1, ryx*xx1 + ryz*zx1, ryy, ryx*xz1 + ryz*zz1, rzx*xx1 + rzz*zx1, rzy, rzx*xz1 + rzz*zz1 ); } inline HepRotation HepRotation::operator * (const HepRotationZ & rz) const { double xx1 = rz.xx(); double xy1 = rz.xy(); double yx1 = -xy1; double yy1 = xx1; return HepRotation( rxx*xx1 + rxy*yx1, rxx*xy1 + rxy*yy1, rxz, ryx*xx1 + ryy*yx1, ryx*xy1 + ryy*yy1, ryz, rzx*xx1 + rzy*yx1, rzx*xy1 + rzy*yy1, rzz ); } inline HepRotation & HepRotation::operator *= (const HepRotation & r) { return *this = (*this) * (r); } inline HepRotation & HepRotation::operator *= (const HepRotationX & r) { return *this = (*this) * (r); } inline HepRotation & HepRotation::operator *= (const HepRotationY & r) { return *this = (*this) * (r); } inline HepRotation & HepRotation::operator *= (const HepRotationZ & r) { return *this = (*this) * (r); } inline HepRotation & HepRotation::transform(const HepRotation & r) { return *this = r * (*this); } inline HepRotation & HepRotation::transform(const HepRotationX & r) { return *this = r * (*this); } inline HepRotation & HepRotation::transform(const HepRotationY & r) { return *this = r * (*this); } inline HepRotation & HepRotation::transform(const HepRotationZ & r) { return *this = r * (*this); } inline HepRotation HepRotation::inverse() const { return HepRotation( rxx, ryx, rzx, rxy, ryy, rzy, rxz, ryz, rzz ); } inline HepRotation inverseOf (const HepRotation & r) { return r.inverse(); } inline HepRotation & HepRotation::invert() { return *this=inverse(); } inline HepRotation & HepRotation::rotate (double ddelta, const Hep3Vector * p) { return rotate(ddelta, *p); } inline bool HepRotation::operator== ( const HepRotation & r ) const { return ( rxx==r.rxx && rxy==r.rxy && rxz==r.rxz && ryx==r.ryx && ryy==r.ryy && ryz==r.ryz && rzx==r.rzx && rzy==r.rzy && rzz==r.rzz ); } inline bool HepRotation::operator!= ( const HepRotation & r ) const { return ! operator==(r); } inline bool HepRotation::operator< ( const HepRotation & r ) const { return compare(r)< 0; } inline bool HepRotation::operator<=( const HepRotation & r ) const { return compare(r)<=0; } inline bool HepRotation::operator>=( const HepRotation & r ) const { return compare(r)>=0; } inline bool HepRotation::operator> ( const HepRotation & r ) const { return compare(r)> 0; } inline double HepRotation::getTolerance() { return Hep4RotationInterface::tolerance; } inline double HepRotation::setTolerance(double tol) { return Hep4RotationInterface::setTolerance(tol); } inline HepRotation operator * (const HepRotationX & rx, const HepRotation & r){ HepRep3x3 mmm = r.rep3x3(); double c = rx.yy(); double ss = rx.zy(); return HepRotation ( mmm.xx_, mmm.xy_, mmm.xz_, c*mmm.yx_-ss*mmm.zx_, c*mmm.yy_-ss*mmm.zy_, c*mmm.yz_-ss*mmm.zz_, ss*mmm.yx_+c*mmm.zx_, ss*mmm.yy_+c*mmm.zy_, ss*mmm.yz_+c*mmm.zz_ ); } inline HepRotation operator * (const HepRotationY & ry, const HepRotation & r){ HepRep3x3 mmm = r.rep3x3(); double c = ry.xx(); double ss = ry.xz(); return HepRotation ( c*mmm.xx_+ss*mmm.zx_, c*mmm.xy_+ss*mmm.zy_, c*mmm.xz_+ss*mmm.zz_, mmm.yx_, mmm.yy_, mmm.yz_, -ss*mmm.xx_+c*mmm.zx_,-ss*mmm.xy_+c*mmm.zy_,-ss*mmm.xz_+c*mmm.zz_ ); } inline HepRotation operator * (const HepRotationZ & rz, const HepRotation & r){ HepRep3x3 mmm = r.rep3x3(); double c = rz.xx(); double ss = rz.yx(); return HepRotation ( c*mmm.xx_-ss*mmm.yx_, c*mmm.xy_-ss*mmm.yy_, c*mmm.xz_-ss*mmm.yz_, ss*mmm.xx_+c*mmm.yx_, ss*mmm.xy_+c*mmm.yy_, ss*mmm.xz_+c*mmm.yz_, mmm.zx_, mmm.zy_, mmm.zz_ ); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/LorentzVector.icc0000755000175000017500000002774411761714041020424 0ustar olesoles// -*- C++ -*- // $Id: LorentzVector.icc,v 1.3 2010/06/16 17:15:57 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definitions of the inline member functions of the // HepLorentzVector class. // #include "CLHEP/Vector/ZMxpv.h" #include namespace CLHEP { inline double HepLorentzVector::x() const { return pp.x(); } inline double HepLorentzVector::y() const { return pp.y(); } inline double HepLorentzVector::z() const { return pp.z(); } inline double HepLorentzVector::t() const { return ee; } inline HepLorentzVector:: HepLorentzVector(double x1, double y1, double z1, double t1) : pp(x1, y1, z1), ee(t1) {} inline HepLorentzVector:: HepLorentzVector(double x1, double y1, double z1) : pp(x1, y1, z1), ee(0) {} inline HepLorentzVector:: HepLorentzVector(double t1) : pp(0, 0, 0), ee(t1) {} inline HepLorentzVector:: HepLorentzVector() : pp(0, 0, 0), ee(0) {} inline HepLorentzVector::HepLorentzVector(const Hep3Vector & p, double e1) : pp(p), ee(e1) {} inline HepLorentzVector::HepLorentzVector(double e1, const Hep3Vector & p) : pp(p), ee(e1) {} inline HepLorentzVector::HepLorentzVector(const HepLorentzVector & p) : pp(p.x(), p.y(), p.z()), ee(p.t()) {} inline HepLorentzVector::~HepLorentzVector() {} inline HepLorentzVector::operator const Hep3Vector & () const {return pp;} inline HepLorentzVector::operator Hep3Vector & () { return pp; } inline void HepLorentzVector::setX(double a) { pp.setX(a); } inline void HepLorentzVector::setY(double a) { pp.setY(a); } inline void HepLorentzVector::setZ(double a) { pp.setZ(a); } inline void HepLorentzVector::setT(double a) { ee = a;} inline double HepLorentzVector::px() const { return pp.x(); } inline double HepLorentzVector::py() const { return pp.y(); } inline double HepLorentzVector::pz() const { return pp.z(); } inline double HepLorentzVector::e() const { return ee; } inline void HepLorentzVector::setPx(double a) { pp.setX(a); } inline void HepLorentzVector::setPy(double a) { pp.setY(a); } inline void HepLorentzVector::setPz(double a) { pp.setZ(a); } inline void HepLorentzVector::setE(double a) { ee = a;} inline Hep3Vector HepLorentzVector::vect() const { return pp; } inline void HepLorentzVector::setVect(const Hep3Vector &p) { pp = p; } inline double HepLorentzVector::theta() const { return pp.theta(); } inline double HepLorentzVector::cosTheta() const { return pp.cosTheta(); } inline double HepLorentzVector::phi() const { return pp.phi(); } inline double HepLorentzVector::rho() const { return pp.mag(); } inline void HepLorentzVector::setTheta(double a) { pp.setTheta(a); } inline void HepLorentzVector::setPhi(double a) { pp.setPhi(a); } inline void HepLorentzVector::setRho(double a) { pp.setMag(a); } double & HepLorentzVector::operator [] (int i) { return (*this)(i); } double HepLorentzVector::operator [] (int i) const { return (*this)(i); } inline HepLorentzVector & HepLorentzVector::operator = (const HepLorentzVector & q) { pp = q.vect(); ee = q.t(); return *this; } inline HepLorentzVector HepLorentzVector::operator + (const HepLorentzVector & q) const { return HepLorentzVector(x()+q.x(), y()+q.y(), z()+q.z(), t()+q.t()); } inline HepLorentzVector & HepLorentzVector::operator += (const HepLorentzVector & q) { pp += q.vect(); ee += q.t(); return *this; } inline HepLorentzVector HepLorentzVector::operator - (const HepLorentzVector & q) const { return HepLorentzVector(x()-q.x(), y()-q.y(), z()-q.z(), t()-q.t()); } inline HepLorentzVector & HepLorentzVector::operator -= (const HepLorentzVector & q) { pp -= q.vect(); ee -= q.t(); return *this; } inline HepLorentzVector HepLorentzVector::operator - () const { return HepLorentzVector(-x(), -y(), -z(), -t()); } inline HepLorentzVector& HepLorentzVector::operator *= (double a) { pp *= a; ee *= a; return *this; } inline bool HepLorentzVector::operator == (const HepLorentzVector & q) const { return (vect()==q.vect() && t()==q.t()); } inline bool HepLorentzVector::operator != (const HepLorentzVector & q) const { return (vect()!=q.vect() || t()!=q.t()); } inline double HepLorentzVector::perp2() const { return pp.perp2(); } inline double HepLorentzVector::perp() const { return pp.perp(); } inline void HepLorentzVector::setPerp(double a) { pp.setPerp(a); } inline double HepLorentzVector::perp2(const Hep3Vector &v1) const { return pp.perp2(v1); } inline double HepLorentzVector::perp(const Hep3Vector &v1) const { return pp.perp(v1); } inline double HepLorentzVector::angle(const Hep3Vector &v1) const { return pp.angle(v1); } inline double HepLorentzVector::mag2() const { return metric*(t()*t() - pp.mag2()); } inline double HepLorentzVector::mag() const { double mmm = m2(); return mmm < 0.0 ? -std::sqrt(-mmm) : std::sqrt(mmm); } inline double HepLorentzVector::m2() const { return t()*t() - pp.mag2(); } inline double HepLorentzVector::m() const { return mag(); } inline double HepLorentzVector::mt2() const { return e()*e() - pz()*pz(); } inline double HepLorentzVector::mt() const { double mmm = mt2(); return mmm < 0.0 ? -std::sqrt(-mmm) : std::sqrt(mmm); } inline double HepLorentzVector::et2() const { double pt2 = pp.perp2(); return pt2 == 0 ? 0 : e()*e() * pt2/(pt2+z()*z()); } inline double HepLorentzVector::et() const { double etet = et2(); return e() < 0.0 ? -std::sqrt(etet) : std::sqrt(etet); } inline double HepLorentzVector::et2(const Hep3Vector & v1) const { double pt2 = pp.perp2(v1); double pv = pp.dot(v1.unit()); return pt2 == 0 ? 0 : e()*e() * pt2/(pt2+pv*pv); } inline double HepLorentzVector::et(const Hep3Vector & v1) const { double etet = et2(v1); return e() < 0.0 ? -std::sqrt(etet) : std::sqrt(etet); } inline void HepLorentzVector::setVectMag(const Hep3Vector & spatial, double magnitude) { setVect(spatial); setT(std::sqrt(magnitude * magnitude + spatial * spatial)); } inline void HepLorentzVector::setVectM(const Hep3Vector & spatial, double mass) { setVectMag(spatial, mass); } inline double HepLorentzVector::dot(const HepLorentzVector & q) const { return metric*(t()*q.t() - z()*q.z() - y()*q.y() - x()*q.x()); } inline double HepLorentzVector::operator * (const HepLorentzVector & q) const { return dot(q); } inline double HepLorentzVector::plus() const { return t() + z(); } inline double HepLorentzVector::minus() const { return t() - z(); } inline HepLorentzVector & HepLorentzVector::boost(const Hep3Vector & b) { return boost(b.x(), b.y(), b.z()); } inline double HepLorentzVector::pseudoRapidity() const { return pp.pseudoRapidity(); } inline double HepLorentzVector::eta() const { return pp.pseudoRapidity(); } inline double HepLorentzVector::eta( const Hep3Vector & ref ) const { return pp.eta( ref ); } inline HepLorentzVector & HepLorentzVector::operator *= (const HepRotation & m1) { pp.transform(m1); return *this; } inline HepLorentzVector & HepLorentzVector::transform(const HepRotation & m1) { pp.transform(m1); return *this; } inline HepLorentzVector operator * (const HepLorentzVector & p, double a) { return HepLorentzVector(a*p.x(), a*p.y(), a*p.z(), a*p.t()); } inline HepLorentzVector operator * (double a, const HepLorentzVector & p) { return HepLorentzVector(a*p.x(), a*p.y(), a*p.z(), a*p.t()); } // The following were added when ZOOM PhysicsVectors was merged in: inline HepLorentzVector::HepLorentzVector( double x1, double y1, double z1, Tcomponent t1 ) : pp(x1, y1, z1), ee(t1) {} inline void HepLorentzVector::set( double x1, double y1, double z1, Tcomponent t1 ) { pp.set(x1,y1,z1); ee = t1; } inline void HepLorentzVector::set( double x1, double y1, double z1, double t1 ) { set (x1,y1,z1,Tcomponent(t1)); } inline HepLorentzVector::HepLorentzVector( Tcomponent t1, double x1, double y1, double z1 ) : pp(x1, y1, z1), ee(t1) {} inline void HepLorentzVector::set( Tcomponent t1, double x1, double y1, double z1 ) { pp.set(x1,y1,z1); ee = t1; } inline void HepLorentzVector::set( Tcomponent t1 ) { pp.set(0, 0, 0); ee = t1; } inline void HepLorentzVector::set( double t1 ) { pp.set(0, 0, 0); ee = t1; } inline HepLorentzVector::HepLorentzVector( Tcomponent t1 ) : pp(0, 0, 0), ee(t1) {} inline void HepLorentzVector::set( const Hep3Vector & v1 ) { pp = v1; ee = 0; } inline HepLorentzVector::HepLorentzVector( const Hep3Vector & v1 ) : pp(v1), ee(0) {} inline void HepLorentzVector::setV(const Hep3Vector & v1) { pp = v1; } inline HepLorentzVector & HepLorentzVector::operator=(const Hep3Vector & v1) { pp = v1; ee = 0; return *this; } inline double HepLorentzVector::getX() const { return pp.x(); } inline double HepLorentzVector::getY() const { return pp.y(); } inline double HepLorentzVector::getZ() const { return pp.z(); } inline double HepLorentzVector::getT() const { return ee; } inline Hep3Vector HepLorentzVector::getV() const { return pp; } inline Hep3Vector HepLorentzVector::v() const { return pp; } inline void HepLorentzVector::set(double t1, const Hep3Vector & v1) { pp = v1; ee = t1; } inline void HepLorentzVector::set(const Hep3Vector & v1, double t1) { pp = v1; ee = t1; } inline void HepLorentzVector::setV( double x1, double y1, double z1 ) { pp.set(x1, y1, z1); } inline void HepLorentzVector::setRThetaPhi ( double r, double ttheta, double phi1 ) { pp.setRThetaPhi( r, ttheta, phi1 ); } inline void HepLorentzVector::setREtaPhi ( double r, double eta1, double phi1 ) { pp.setREtaPhi( r, eta1, phi1 ); } inline void HepLorentzVector::setRhoPhiZ ( double rho1, double phi1, double z1 ) { pp.setRhoPhiZ ( rho1, phi1, z1 ); } inline bool HepLorentzVector::isTimelike() const { return restMass2() > 0; } inline bool HepLorentzVector::isSpacelike() const { return restMass2() < 0; } inline bool HepLorentzVector::isLightlike(double epsilon) const { return std::fabs(restMass2()) < 2.0 * epsilon * ee * ee; } inline double HepLorentzVector::diff2( const HepLorentzVector & w ) const { return metric*( (ee-w.ee)*(ee-w.ee) - (pp-w.pp).mag2() ); } inline double HepLorentzVector::delta2Euclidean ( const HepLorentzVector & w ) const { return (ee-w.ee)*(ee-w.ee) + (pp-w.pp).mag2(); } inline double HepLorentzVector::euclideanNorm2() const { return ee*ee + pp.mag2(); } inline double HepLorentzVector::euclideanNorm() const { return std::sqrt(euclideanNorm2()); } inline double HepLorentzVector::restMass2() const { return m2(); } inline double HepLorentzVector::invariantMass2() const { return m2(); } inline double HepLorentzVector::restMass() const { if( t() < 0.0 ) ZMthrowC(ZMxpvNegativeMass( "E^2-p^2 < 0 for this particle. Magnitude returned.")); return t() < 0.0 ? -m() : m(); } inline double HepLorentzVector::invariantMass() const { if( t() < 0.0 ) ZMthrowC(ZMxpvNegativeMass( "E^2-p^2 < 0 for this particle. Magnitude returned.")); return t() < 0.0 ? -m() : m(); } inline double HepLorentzVector::invariantMass2 (const HepLorentzVector & w) const { return (*this + w).m2(); } /* invariantMass2 */ //-********* // boostOf() //-********* // Each of these is a shell over a boost method. inline HepLorentzVector boostXOf (const HepLorentzVector & vec, double bbeta) { HepLorentzVector vv (vec); return vv.boostX (bbeta); } inline HepLorentzVector boostYOf (const HepLorentzVector & vec, double bbeta) { HepLorentzVector vv (vec); return vv.boostY (bbeta); } inline HepLorentzVector boostZOf (const HepLorentzVector & vec, double bbeta) { HepLorentzVector vv (vec); return vv.boostZ (bbeta); } inline HepLorentzVector boostOf (const HepLorentzVector & vec, const Hep3Vector & betaVector ) { HepLorentzVector vv (vec); return vv.boost (betaVector); } inline HepLorentzVector boostOf (const HepLorentzVector & vec, const Hep3Vector & aaxis, double bbeta) { HepLorentzVector vv (vec); return vv.boost (aaxis, bbeta); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/Sqr.h0000755000175000017500000000111707707326250016032 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // $Id: Sqr.h,v 1.1 2003/07/22 21:29:12 garren Exp $ // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This file contains a template definition of sqr() // sqr() is used only by Vector/test/testLorentzVector.cc // #ifndef HEP_SQR_H #define HEP_SQR_H #ifndef CLHEP_SQR_DEFINED #define CLHEP_SQR_DEFINED #ifdef sqr #undef sqr #endif template inline T sqr(const T& x) { return x*x; } #endif #endif /* HEP_SQR_H */ clhep-2.1.4.1.orig/Vector/Vector/RotationY.icc0000755000175000017500000001622212050774211017516 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definitions of the inline member functions of the // HepRotationY class // #include #include "CLHEP/Units/PhysicalConstants.h" namespace CLHEP { inline double HepRotationY::xx() const { return its_c; } inline double HepRotationY::xz() const { return its_s; } inline double HepRotationY::zx() const { return -its_s; } inline double HepRotationY::zz() const { return its_c; } inline double HepRotationY::yy() const { return 1.0; } inline double HepRotationY::yx() const { return 0.0; } inline double HepRotationY::yz() const { return 0.0; } inline double HepRotationY::xy() const { return 0.0; } inline double HepRotationY::zy() const { return 0.0; } inline HepRep3x3 HepRotationY::rep3x3() const { return HepRep3x3 ( its_c , 0.0, its_s, 0.0, 1.0, 0.0, -its_s , 0.0, its_c ); } inline HepRotationY::HepRotationY() : its_d(0.0), its_s(0.0), its_c(1.0) {} inline HepRotationY::HepRotationY(const HepRotationY & orig) : its_d(orig.its_d), its_s(orig.its_s), its_c(orig.its_c) {} inline HepRotationY::HepRotationY(double dd, double ss, double cc) : its_d(dd), its_s(ss), its_c(cc) {} inline HepRotationY & HepRotationY::operator= (const HepRotationY & orig) { its_d = orig.its_d; its_s = orig.its_s; its_c = orig.its_c; return *this; } inline HepRotationY::~HepRotationY() {} inline Hep3Vector HepRotationY::colX() const { return Hep3Vector ( its_c, 0.0, -its_s ); } inline Hep3Vector HepRotationY::colY() const { return Hep3Vector ( 0.0, 1.0, 0.0 ); } inline Hep3Vector HepRotationY::colZ() const { return Hep3Vector ( its_s, 0.0, its_c ); } inline Hep3Vector HepRotationY::rowX() const { return Hep3Vector ( its_c, 0.0, its_s ); } inline Hep3Vector HepRotationY::rowY() const { return Hep3Vector ( 0.0, 1.0, 0.0 ); } inline Hep3Vector HepRotationY::rowZ() const { return Hep3Vector ( -its_s, 0.0, its_c ); } inline double HepRotationY::getPhi () const { return phi(); } inline double HepRotationY::getTheta() const { return theta(); } inline double HepRotationY::getPsi () const { return psi(); } inline double HepRotationY::getDelta() const { return its_d; } inline Hep3Vector HepRotationY::getAxis () const { return axis(); } inline double HepRotationY::delta() const { return its_d; } inline Hep3Vector HepRotationY::axis() const { return Hep3Vector(0,1,0); } inline HepAxisAngle HepRotationY::axisAngle() const { return HepAxisAngle ( axis(), delta() ); } inline void HepRotationY::getAngleAxis (double & ddelta, Hep3Vector & aaxis) const { ddelta = its_d; aaxis = getAxis(); } inline bool HepRotationY::isIdentity() const { return ( its_d==0 ); } inline int HepRotationY::compare ( const HepRotationY & r ) const { if (its_d > r.its_d) return 1; else if (its_d < r.its_d) return -1; else return 0; } inline bool HepRotationY::operator==(const HepRotationY & r) const { return (its_d==r.its_d); } inline bool HepRotationY::operator!=(const HepRotationY & r) const { return (its_d!=r.its_d); } inline bool HepRotationY::operator>=(const HepRotationY & r) const { return (its_d>=r.its_d); } inline bool HepRotationY::operator<=(const HepRotationY & r) const { return (its_d<=r.its_d); } inline bool HepRotationY::operator> (const HepRotationY & r) const { return (its_d> r.its_d); } inline bool HepRotationY::operator< (const HepRotationY & r) const { return (its_d< r.its_d); } inline void HepRotationY::rectify() { its_d = proper(its_d); // Just in case! its_s = std::sin(its_d); its_c = std::cos(its_d); } inline Hep3Vector HepRotationY::operator() (const Hep3Vector & p) const { double x = p.x(); double y = p.y(); double z = p.z(); return Hep3Vector( x * its_c + z * its_s, y, z * its_c - x * its_s ); } inline Hep3Vector HepRotationY::operator * (const Hep3Vector & p) const { return operator()(p); } inline HepLorentzVector HepRotationY::operator() ( const HepLorentzVector & w ) const { return HepLorentzVector( operator() (w.vect()) , w.t() ); } inline HepLorentzVector HepRotationY::operator * (const HepLorentzVector & p) const { return operator()(p); } inline HepRotationY & HepRotationY::operator *= (const HepRotationY & m1) { return *this = (*this) * (m1); } inline HepRotationY & HepRotationY::transform(const HepRotationY & m1) { return *this = m1 * (*this); } inline double HepRotationY::proper( double ddelta ) { // -PI < its_d <= PI if ( std::fabs(ddelta) < CLHEP::pi ) { return ddelta; } else { register double x = ddelta / (CLHEP::twopi); return (CLHEP::twopi) * ( x + std::floor(.5-x) ); } } // proper() inline HepRotationY HepRotationY::operator * ( const HepRotationY & ry ) const { return HepRotationY ( HepRotationY::proper(its_d+ry.its_d), its_s*ry.its_c + its_c*ry.its_s, its_c*ry.its_c - its_s*ry.its_s ); } inline HepRotationY HepRotationY::inverse() const { return HepRotationY( proper(-its_d), -its_s, its_c ); } inline HepRotationY inverseOf(const HepRotationY & r) { return r.inverse(); } inline HepRotationY & HepRotationY::invert() { return *this=inverse(); } inline HepLorentzVector HepRotationY::col1() const { return HepLorentzVector (colX(), 0); } inline HepLorentzVector HepRotationY::col2() const { return HepLorentzVector (colY(), 0); } inline HepLorentzVector HepRotationY::col3() const { return HepLorentzVector (colZ(), 0); } inline HepLorentzVector HepRotationY::col4() const { return HepLorentzVector (0,0,0,1); } inline HepLorentzVector HepRotationY::row1() const { return HepLorentzVector (rowX(), 0); } inline HepLorentzVector HepRotationY::row2() const { return HepLorentzVector (rowY(), 0); } inline HepLorentzVector HepRotationY::row3() const { return HepLorentzVector (rowZ(), 0); } inline HepLorentzVector HepRotationY::row4() const { return HepLorentzVector (0,0,0,1); } inline double HepRotationY::xt() const { return 0.0; } inline double HepRotationY::yt() const { return 0.0; } inline double HepRotationY::zt() const { return 0.0; } inline double HepRotationY::tx() const { return 0.0; } inline double HepRotationY::ty() const { return 0.0; } inline double HepRotationY::tz() const { return 0.0; } inline double HepRotationY::tt() const { return 1.0; } inline HepRep4x4 HepRotationY::rep4x4() const { return HepRep4x4 ( its_c , 0.0, its_s, 0.0, 0.0, 1.0, 0.0, 0.0, -its_s, 0.0, its_c, 0.0, 0.0, 0.0, 0.0, 1.0 ); } inline double HepRotationY::getTolerance() { return Hep4RotationInterface::tolerance; } inline double HepRotationY::setTolerance(double tol) { return Hep4RotationInterface::setTolerance(tol); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/ThreeVector.icc0000755000175000017500000001660511712321422020021 0ustar olesoles// -*- C++ -*- // $Id: ThreeVector.icc,v 1.2 2010/06/16 17:15:57 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definitions of the inline member functions of the // Hep3Vector class. // #include namespace CLHEP { // ------------------ // Access to elements // ------------------ // x, y, z inline double & Hep3Vector::operator[] (int i) { return operator()(i); } inline double Hep3Vector::operator[] (int i) const { return operator()(i); } inline double Hep3Vector::x() const { return dx; } inline double Hep3Vector::y() const { return dy; } inline double Hep3Vector::z() const { return dz; } inline double Hep3Vector::getX() const { return dx; } inline double Hep3Vector::getY() const { return dy; } inline double Hep3Vector::getZ() const { return dz; } inline void Hep3Vector::setX(double x1) { dx = x1; } inline void Hep3Vector::setY(double y1) { dy = y1; } inline void Hep3Vector::setZ(double z1) { dz = z1; } inline void Hep3Vector::set(double x1, double y1, double z1) { dx = x1; dy = y1; dz = z1; } // -------------- // Global methods // -------------- inline Hep3Vector operator + (const Hep3Vector & a, const Hep3Vector & b) { return Hep3Vector(a.x() + b.x(), a.y() + b.y(), a.z() + b.z()); } inline Hep3Vector operator - (const Hep3Vector & a, const Hep3Vector & b) { return Hep3Vector(a.x() - b.x(), a.y() - b.y(), a.z() - b.z()); } inline Hep3Vector operator * (const Hep3Vector & p, double a) { return Hep3Vector(a*p.x(), a*p.y(), a*p.z()); } inline Hep3Vector operator * (double a, const Hep3Vector & p) { return Hep3Vector(a*p.x(), a*p.y(), a*p.z()); } inline double operator * (const Hep3Vector & a, const Hep3Vector & b) { return a.dot(b); } // -------------------------- // Set in various coordinates // -------------------------- inline void Hep3Vector::setRThetaPhi ( double r1, double theta1, double phi1 ) { setSpherical (r1, theta1, phi1); } inline void Hep3Vector::setREtaPhi ( double r1, double eta1, double phi1 ) { setSpherical (r1, 2*std::atan(std::exp(-eta1)), phi1); } inline void Hep3Vector::setRhoPhiZ ( double rho1, double phi1, double z1) { setCylindrical (rho1, phi1, z1); } // ------------ // Constructors // ------------ inline Hep3Vector::Hep3Vector() : dx(0.), dy(0.), dz(0.) {} inline Hep3Vector::Hep3Vector(double x1) : dx(x1), dy(0.), dz(0.) {} inline Hep3Vector::Hep3Vector(double x1, double y1) : dx(x1), dy(y1), dz(0.) {} inline Hep3Vector::Hep3Vector(double x1, double y1, double z1) : dx(x1), dy(y1), dz(z1) {} inline Hep3Vector::Hep3Vector(const Hep3Vector & p) : dx(p.dx), dy(p.dy), dz(p.dz) {} inline Hep3Vector::~Hep3Vector() {} inline Hep3Vector & Hep3Vector::operator = (const Hep3Vector & p) { dx = p.dx; dy = p.dy; dz = p.dz; return *this; } // ------------------ // Access to elements // ------------------ // r, theta, phi inline double Hep3Vector::mag2() const { return dx*dx + dy*dy + dz*dz; } inline double Hep3Vector::mag() const { return std::sqrt(mag2()); } inline double Hep3Vector::r() const { return mag(); } inline double Hep3Vector::theta() const { return dx == 0.0 && dy == 0.0 && dz == 0.0 ? 0.0 : std::atan2(perp(),dz); } inline double Hep3Vector::phi() const { return dx == 0.0 && dy == 0.0 ? 0.0 : std::atan2(dy,dx); } inline double Hep3Vector::getR() const { return mag(); } inline double Hep3Vector::getTheta() const { return theta(); } inline double Hep3Vector::getPhi() const { return phi(); } inline double Hep3Vector::angle() const { return theta(); } inline double Hep3Vector::cosTheta() const { double ptot = mag(); return ptot == 0.0 ? 1.0 : dz/ptot; } inline double Hep3Vector::cos2Theta() const { double ptot2 = mag2(); return ptot2 == 0.0 ? 1.0 : dz*dz/ptot2; } inline void Hep3Vector::setR(double r1) { setMag(r1); } inline void Hep3Vector::setTheta(double th) { double ma = mag(); double ph = phi(); setX(ma*std::sin(th)*std::cos(ph)); setY(ma*std::sin(th)*std::sin(ph)); setZ(ma*std::cos(th)); } inline void Hep3Vector::setPhi(double ph) { double xy = perp(); setX(xy*std::cos(ph)); setY(xy*std::sin(ph)); } // perp, eta, inline double Hep3Vector::perp2() const { return dx*dx + dy*dy; } inline double Hep3Vector::perp() const { return std::sqrt(perp2()); } inline double Hep3Vector::rho() const { return perp(); } inline double Hep3Vector::eta() const { return pseudoRapidity();} inline double Hep3Vector::getRho() const { return perp(); } inline double Hep3Vector::getEta() const { return pseudoRapidity();} inline void Hep3Vector::setPerp(double r1) { double p = perp(); if (p != 0.0) { dx *= r1/p; dy *= r1/p; } } inline void Hep3Vector::setRho(double rho1) { setPerp (rho1); } // ---------- // Comparison // ---------- inline bool Hep3Vector::operator == (const Hep3Vector& v) const { return (v.x()==x() && v.y()==y() && v.z()==z()) ? true : false; } inline bool Hep3Vector::operator != (const Hep3Vector& v) const { return (v.x()!=x() || v.y()!=y() || v.z()!=z()) ? true : false; } inline double Hep3Vector::getTolerance () { return tolerance; } // ---------- // Arithmetic // ---------- inline Hep3Vector& Hep3Vector::operator += (const Hep3Vector & p) { dx += p.x(); dy += p.y(); dz += p.z(); return *this; } inline Hep3Vector& Hep3Vector::operator -= (const Hep3Vector & p) { dx -= p.x(); dy -= p.y(); dz -= p.z(); return *this; } inline Hep3Vector Hep3Vector::operator - () const { return Hep3Vector(-dx, -dy, -dz); } inline Hep3Vector& Hep3Vector::operator *= (double a) { dx *= a; dy *= a; dz *= a; return *this; } // ------------------- // Combine two Vectors // ------------------- inline double Hep3Vector::diff2(const Hep3Vector & p) const { return (*this-p).mag2(); } inline double Hep3Vector::dot(const Hep3Vector & p) const { return dx*p.x() + dy*p.y() + dz*p.z(); } inline Hep3Vector Hep3Vector::cross(const Hep3Vector & p) const { return Hep3Vector(dy*p.z()-p.y()*dz, dz*p.x()-p.z()*dx, dx*p.y()-p.x()*dy); } inline double Hep3Vector::perp2(const Hep3Vector & p) const { double tot = p.mag2(); double ss = dot(p); return tot > 0.0 ? mag2()-ss*ss/tot : mag2(); } inline double Hep3Vector::perp(const Hep3Vector & p) const { return std::sqrt(perp2(p)); } inline Hep3Vector Hep3Vector::perpPart () const { return Hep3Vector (dx, dy, 0); } inline Hep3Vector Hep3Vector::project () const { return Hep3Vector (0, 0, dz); } inline Hep3Vector Hep3Vector::perpPart (const Hep3Vector & v2) const { return ( *this - project(v2) ); } inline double Hep3Vector::angle(const Hep3Vector & q) const { return std::acos(cosTheta(q)); } inline double Hep3Vector::theta(const Hep3Vector & q) const { return angle(q); } inline double Hep3Vector::azimAngle(const Hep3Vector & v2) const { return deltaPhi(v2); } // ---------- // Properties // ---------- inline Hep3Vector Hep3Vector::unit() const { double tot = mag2(); Hep3Vector p(x(),y(),z()); return tot > 0.0 ? p *= (1.0/std::sqrt(tot)) : p; } inline Hep3Vector Hep3Vector::orthogonal() const { double xx = dx < 0.0 ? -dx : dx; double yy = dy < 0.0 ? -dy : dy; double zz = dz < 0.0 ? -dz : dz; if (xx < yy) { return xx < zz ? Hep3Vector(0,dz,-dy) : Hep3Vector(dy,-dx,0); }else{ return yy < zz ? Hep3Vector(-dz,0,dx) : Hep3Vector(dy,-dx,0); } } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/copy-header.pl.in0000755000175000017500000000164110043350425020244 0ustar olesoles#!/usr/bin/env perl # # copy a header into the temporary CLHEP header tree if # a) the header is not already there # b) the source is newer # if ($#ARGV != 1) { print "mungeit requires two arguments - exit\n"; exit; } else { $source_header=$ARGV[0]; $dest_header=$ARGV[1]; &check_header; } exit; sub check_header { # make sure source exists if ( ! -e $source_header ) { print "$source_header does not exist - exit\n"; exit; } # copy if not already there - otherwise, check the time stamp if ( ! -e $dest_header ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } else { $source_header_time = -M $source_header; $dest_header_time = -M $dest_header; # copy only if source is newer if( $source_header_time < $dest_header_time ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } } } clhep-2.1.4.1.orig/Vector/Vector/Makefile.am0000755000175000017500000000235310234000243017127 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@ COPY_P = @COPY_P@ pkginclude_HEADERS = \ AxisAngle.h \ AxisAngle.icc \ Boost.h \ Boost.icc \ BoostX.h \ BoostX.icc \ BoostY.h \ BoostY.icc \ BoostZ.h \ BoostZ.icc \ EulerAngles.h \ EulerAngles.icc \ LorentzRotation.h \ LorentzRotation.icc \ LorentzVector.h \ LorentzVector.icc \ Rotation.h \ Rotation.icc \ RotationInterfaces.h \ RotationInterfaces.icc \ RotationX.h \ RotationX.icc \ RotationY.h \ RotationY.icc \ RotationZ.h \ RotationZ.icc \ Sqr.h \ ThreeVector.h \ ThreeVector.icc \ TwoVector.h \ TwoVector.icc \ ZMxpv.h \ defs.h # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = defs.h # copy headers into $(tempincludedir) install-tmpHEADERS: @echo " install headers in $(tempincludedir) " @list='$(pkginclude_HEADERS)'; \ if test $(tempincludedir); then \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ ./copy-header.pl $$d$$p $(tempincludedir)/$$f; \ done; \ fi; test -z "$$fail" clhep-2.1.4.1.orig/Vector/Vector/Rotation.h0000755000175000017500000003405007746044120017062 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // $Id: Rotation.h,v 1.3 2003/10/23 21:29:52 garren Exp $ // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definition of the HepRotation class for performing rotations // on objects of the Hep3Vector (and HepLorentzVector) class. // // HepRotation is a concrete implementation of Hep3RotationInterface. // // .SS See Also // RotationInterfaces.h // ThreeVector.h, LorentzVector.h, LorentzRotation.h // // .SS Author // Leif Lonnblad, Mark Fischler #ifndef HEP_ROTATION_H #define HEP_ROTATION_H #ifdef GNUPRAGMA #pragma interface #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/RotationInterfaces.h" #include "CLHEP/Vector/RotationX.h" #include "CLHEP/Vector/RotationY.h" #include "CLHEP/Vector/RotationZ.h" #include "CLHEP/Vector/LorentzVector.h" namespace CLHEP { // Declarations of classes and global methods class HepRotation; inline HepRotation inverseOf ( const HepRotation & r ); inline HepRotation operator * (const HepRotationX & rx, const HepRotation & r); inline HepRotation operator * (const HepRotationY & ry, const HepRotation & r); inline HepRotation operator * (const HepRotationZ & rz, const HepRotation & r); /** * @author * @ingroup vector */ class HepRotation { public: // ---------- Constructors and Assignment: inline HepRotation(); // Default constructor. Gives a unit matrix. inline HepRotation(const HepRotation & m); // Copy constructor. inline HepRotation(const HepRotationX & m); inline HepRotation(const HepRotationY & m); inline HepRotation(const HepRotationZ & m); // Construct from specialized rotation. HepRotation & set( const Hep3Vector & axis, double delta ); HepRotation ( const Hep3Vector & axis, double delta ); // Construct from axis and angle. HepRotation & set( const HepAxisAngle & ax ); HepRotation ( const HepAxisAngle & ax ); // Construct from AxisAngle structure. HepRotation & set( double phi, double theta, double psi ); HepRotation ( double phi, double theta, double psi ); // Construct from three Euler angles (in radians). HepRotation & set( const HepEulerAngles & e ); HepRotation ( const HepEulerAngles & e ); // Construct from EulerAngles structure. HepRotation ( const Hep3Vector & colX, const Hep3Vector & colY, const Hep3Vector & colZ ); // Construct from three *orthogonal* unit vector columns. // NOTE: // This constructor, and the two set methods below, // will check that the columns (or rows) form an orthonormal // matrix, and will adjust values so that this relation is // as exact as possible. HepRotation & set( const Hep3Vector & colX, const Hep3Vector & colY, const Hep3Vector & colZ ); // supply three *orthogonal* unit vectors for the columns. HepRotation & setRows( const Hep3Vector & rowX, const Hep3Vector & rowY, const Hep3Vector & rowZ ); // supply three *orthogonal* unit vectors for the rows. inline HepRotation & set(const HepRotationX & r); inline HepRotation & set(const HepRotationY & r); inline HepRotation & set(const HepRotationZ & r); // set from specialized rotation. inline HepRotation & operator = (const HepRotation & r); // Assignment. inline HepRotation & operator = (const HepRotationX & r); inline HepRotation & operator = (const HepRotationY & r); inline HepRotation & operator = (const HepRotationZ & r); // Assignment from specialized rotation. inline HepRotation &set( const HepRep3x3 & m ); inline HepRotation ( const HepRep3x3 & m ); // WARNING - NO CHECKING IS DONE! // Constructon directly from from a 3x3 representation, // which is required to be an orthogonal matrix. inline ~HepRotation(); // Trivial destructor. // ---------- Accessors: inline Hep3Vector colX() const; inline Hep3Vector colY() const; inline Hep3Vector colZ() const; // orthogonal unit-length column vectors inline Hep3Vector rowX() const; inline Hep3Vector rowY() const; inline Hep3Vector rowZ() const; // orthogonal unit-length row vectors inline double xx() const; inline double xy() const; inline double xz() const; inline double yx() const; inline double yy() const; inline double yz() const; inline double zx() const; inline double zy() const; inline double zz() const; // Elements of the rotation matrix (Geant4). inline HepRep3x3 rep3x3() const; // 3x3 representation: // ------------ Subscripting: class HepRotation_row { public: inline HepRotation_row(const HepRotation &, int); inline double operator [] (int) const; private: const HepRotation & rr; int ii; }; // Helper class for implemention of C-style subscripting r[i][j] inline const HepRotation_row operator [] (int) const; // Returns object of the helper class for C-style subscripting r[i][j] // i and j range from 0 to 2. double operator () (int, int) const; // Fortran-style subscripting: returns (i,j) element of the rotation matrix. // Note: i and j still range from 0 to 2. [Rotation.cc] // ------------ Euler angles: inline double getPhi () const; inline double getTheta() const; inline double getPsi () const; double phi () const; double theta() const; double psi () const; HepEulerAngles eulerAngles() const; // ------------ axis & angle of rotation: inline double getDelta() const; inline Hep3Vector getAxis () const; double delta() const; Hep3Vector axis () const; HepAxisAngle axisAngle() const; void getAngleAxis(double & delta, Hep3Vector & axis) const; // Returns the rotation angle and rotation axis (Geant4). [Rotation.cc] // ------------- Angles of rotated axes double phiX() const; double phiY() const; double phiZ() const; double thetaX() const; double thetaY() const; double thetaZ() const; // Return angles (RADS) made by rotated axes against original axes (Geant4). // [Rotation.cc] // ---------- Other accessors treating pure rotation as a 4-rotation inline HepLorentzVector col1() const; inline HepLorentzVector col2() const; inline HepLorentzVector col3() const; // orthosymplectic 4-vector columns - T component will be zero inline HepLorentzVector col4() const; // Will be (0,0,0,1) for this pure Rotation. inline HepLorentzVector row1() const; inline HepLorentzVector row2() const; inline HepLorentzVector row3() const; // orthosymplectic 4-vector rows - T component will be zero inline HepLorentzVector row4() const; // Will be (0,0,0,1) for this pure Rotation. inline double xt() const; inline double yt() const; inline double zt() const; inline double tx() const; inline double ty() const; inline double tz() const; // Will be zero for this pure Rotation inline double tt() const; // Will be one for this pure Rotation inline HepRep4x4 rep4x4() const; // 4x4 representation. // --------- Mutators void setPhi (double phi); // change Euler angle phi, leaving theta and psi unchanged. void setTheta (double theta); // change Euler angle theta, leaving phi and psi unchanged. void setPsi (double psi); // change Euler angle psi, leaving theta and phi unchanged. void setAxis (const Hep3Vector & axis); // change rotation axis, leaving delta unchanged. void setDelta (double delta); // change angle of rotation, leaving rotation axis unchanged. // ---------- Decomposition: void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const; void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const; // These are trivial, as the boost vector is 0. [RotationP.cc] // ---------- Comparisons: bool isIdentity() const; // Returns true if the identity matrix (Geant4). [Rotation.cc] int compare( const HepRotation & r ) const; // Dictionary-order comparison, in order zz, zy, zx, yz, ... xx // Used in operator<, >, <=, >= inline bool operator== ( const HepRotation & r ) const; inline bool operator!= ( const HepRotation & r ) const; inline bool operator< ( const HepRotation & r ) const; inline bool operator> ( const HepRotation & r ) const; inline bool operator<= ( const HepRotation & r ) const; inline bool operator>= ( const HepRotation & r ) const; double distance2( const HepRotation & r ) const; // 3 - Tr ( this/r ) -- This works with RotationX, Y or Z also double howNear( const HepRotation & r ) const; bool isNear( const HepRotation & r, double epsilon=Hep4RotationInterface::tolerance) const; double distance2( const HepBoost & lt ) const; // 3 - Tr ( this ) + |b|^2 / (1-|b|^2) double distance2( const HepLorentzRotation & lt ) const; // 3 - Tr ( this/r ) + |b|^2 / (1-|b|^2) where b is the boost vector of lt double howNear( const HepBoost & lt ) const; double howNear( const HepLorentzRotation & lt ) const; bool isNear( const HepBoost & lt, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepLorentzRotation & lt, double epsilon=Hep4RotationInterface::tolerance) const; // ---------- Properties: double norm2() const; // distance2 (IDENTITY), which is 3 - Tr ( *this ) void rectify(); // non-const but logically moot correction for accumulated roundoff errors // rectify averages the matrix with the transpose of its actual // inverse (absent accumulated roundoff errors, the transpose IS // the inverse)); this removes to first order those errors. // Then it formally extracts axis and delta, and forms a true // HepRotation with those values of axis and delta. // ---------- Application: inline Hep3Vector operator() (const Hep3Vector & p) const; // Rotate a Hep3Vector. inline Hep3Vector operator * (const Hep3Vector & p) const; // Multiplication with a Hep3Vector. inline HepLorentzVector operator()( const HepLorentzVector & w ) const; // Rotate (the space part of) a HepLorentzVector. inline HepLorentzVector operator* ( const HepLorentzVector & w ) const; // Multiplication with a HepLorentzVector. // ---------- Operations in the group of Rotations inline HepRotation operator * (const HepRotation & r) const; // Product of two rotations (this) * r - matrix multiplication inline HepRotation operator * (const HepRotationX & rx) const; inline HepRotation operator * (const HepRotationY & ry) const; inline HepRotation operator * (const HepRotationZ & rz) const; // Product of two rotations (this) * r - faster when specialized type inline HepRotation & operator *= (const HepRotation & r); inline HepRotation & transform (const HepRotation & r); // Matrix multiplication. // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a; inline HepRotation & operator *= (const HepRotationX & r); inline HepRotation & operator *= (const HepRotationY & r); inline HepRotation & operator *= (const HepRotationZ & r); inline HepRotation & transform (const HepRotationX & r); inline HepRotation & transform (const HepRotationY & r); inline HepRotation & transform (const HepRotationZ & r); // Matrix multiplication by specialized matrices HepRotation & rotateX(double delta); // Rotation around the x-axis; equivalent to R = RotationX(delta) * R HepRotation & rotateY(double delta); // Rotation around the y-axis; equivalent to R = RotationY(delta) * R HepRotation & rotateZ(double delta); // Rotation around the z-axis; equivalent to R = RotationZ(delta) * R HepRotation & rotate(double delta, const Hep3Vector & axis); inline HepRotation & rotate(double delta, const Hep3Vector * axis); // Rotation around a specified vector. // r.rotate(d,a) is equivalent to r = Rotation(d,a) * r HepRotation & rotateAxes(const Hep3Vector & newX, const Hep3Vector & newY, const Hep3Vector & newZ); // Rotation of local axes defined by 3 orthonormal vectors (Geant4). // Equivalent to r = Rotation (newX, newY, newZ) * r inline HepRotation inverse() const; // Returns the inverse. inline HepRotation & invert(); // Inverts the Rotation matrix. // ---------- I/O: std::ostream & print( std::ostream & os ) const; // Aligned six-digit-accurate output of the rotation matrix. [RotationIO.cc] // ---------- Identity Rotation: static const HepRotation IDENTITY; // ---------- Tolerance static inline double getTolerance(); static inline double setTolerance(double tol); protected: inline HepRotation(double mxx, double mxy, double mxz, double myx, double myy, double myz, double mzx, double mzy, double mzz); // Protected constructor. // DOES NOT CHECK FOR VALIDITY AS A ROTATION. friend HepRotation operator* (const HepRotationX & rx, const HepRotation & r); friend HepRotation operator* (const HepRotationY & ry, const HepRotation & r); friend HepRotation operator* (const HepRotationZ & rz, const HepRotation & r); double rxx, rxy, rxz, ryx, ryy, ryz, rzx, rzy, rzz; // The matrix elements. private: bool setCols ( const Hep3Vector & u1, // Vectors assume to be of unit length const Hep3Vector & u2, const Hep3Vector & u3, double u1u2, Hep3Vector & v1, // Returned vectors Hep3Vector & v2, Hep3Vector & v3 ) const; void setArbitrarily (const Hep3Vector & colX, // assumed to be of unit length Hep3Vector & v1, Hep3Vector & v2, Hep3Vector & v3) const; }; // HepRotation inline std::ostream & operator << ( std::ostream & os, const HepRotation & r ) {return r.print(os);} } // namespace CLHEP #include "CLHEP/Vector/Rotation.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_ROTATION_H */ clhep-2.1.4.1.orig/Vector/Vector/EulerAngles.h0000755000175000017500000000575507746044120017503 0ustar olesoles#ifndef HEP_EULERANGLES_H #define HEP_EULERANGLES_H // ---------------------------------------------------------------------- // // EulerAngles.h EulerAngles class -- // Support class for PhysicsVectors classes // // History: // 09-Jan-1998 WEB FixedTypes is now found in ZMutility // 12-Jan-1998 WEB PI is now found in ZMutility // 15-Jun-1998 WEB Added namespace support // 02-May-2000 WEB No global using // 26-Jul-2000 MF CLHEP version // // ---------------------------------------------------------------------- #include #include "CLHEP/Vector/defs.h" namespace CLHEP { // Declarations of classes and global methods class HepEulerAngles; std::ostream & operator<<(std::ostream & os, const HepEulerAngles & aa); std::istream & operator>>(std::istream & is, HepEulerAngles & aa); /** * @author * @ingroup vector */ class HepEulerAngles { protected: typedef HepEulerAngles EA; // just an abbreviation static double tolerance; // to determine relative nearness public: // ---------- Constructors: inline HepEulerAngles(); inline HepEulerAngles( double phi, double theta, double psi ); // ---------- Destructor, copy constructor, assignment: // use C++ defaults // ---------- Accessors: public: inline double getPhi() const; inline double phi() const; inline EA & setPhi( double phi ); inline double getTheta() const; inline double theta() const; inline EA & setTheta( double theta ); inline double getPsi() const; inline double psi() const; inline EA & setPsi( double psi ); inline EA & set( double phi, double theta, double psi ); // ---------- Operations: // comparisons: inline int compare ( const EA & ea ) const; inline bool operator==( const EA & ea ) const; inline bool operator!=( const EA & ea ) const; inline bool operator< ( const EA & ea ) const; inline bool operator<=( const EA & ea ) const; inline bool operator> ( const EA & ea ) const; inline bool operator>=( const EA & ea ) const; // relative comparison: inline static double getTolerance(); inline static double setTolerance( double tol ); bool isNear ( const EA & ea, double epsilon = tolerance ) const; double howNear( const EA & ea ) const; // ---------- I/O: friend std::ostream & operator<<( std::ostream & os, const EA & ea ); friend std::istream & operator>>( std::istream & is, EA & ea ); // ---------- Helper methods: protected: double distance( const HepEulerAngles & ex ) const; // ---------- Data members: protected: double phi_; double theta_; double psi_; }; // HepEulerAngles } // namespace CLHEP namespace zmpv { typedef CLHEP::HepEulerAngles EulerAngles; } // end of namespace zmpv #define EULERANGLES_ICC #include "CLHEP/Vector/EulerAngles.icc" #undef EULERANGLES_ICC #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif // EULERANGLES_H clhep-2.1.4.1.orig/Vector/Vector/RotationZ.h0000755000175000017500000002115412050774211017210 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definition of the HepRotationZ class for performing rotations // around the X axis on objects of the Hep3Vector (and HepLorentzVector) class. // // HepRotationZ is a concrete implementation of Hep3RotationInterface. // // .SS See Also // RotationInterfaces.h // ThreeVector.h, LorentzVector.h, LorentzRotation.h // // .SS Author // Mark Fischler #ifndef HEP_ROTATIONZ_H #define HEP_ROTATIONZ_H #ifdef GNUPRAGMA #pragma interface #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/RotationInterfaces.h" namespace CLHEP { class HepRotationZ; class HepRotation; class HepBoost; inline HepRotationZ inverseOf(const HepRotationZ & r); // Returns the inverse of a RotationZ. /** * @author * @ingroup vector */ class HepRotationZ { public: // ---------- Constructors and Assignment: inline HepRotationZ(); // Default constructor. Gives an identity rotation. HepRotationZ(double delta); // supply angle of rotation inline HepRotationZ(const HepRotationZ & orig); // Copy constructor. inline HepRotationZ & operator = (const HepRotationZ & r); // Assignment from a Rotation, which must be RotationZ HepRotationZ & set ( double delta ); // set angle of rotation inline ~HepRotationZ(); // Trivial destructor. // ---------- Accessors: inline Hep3Vector colX() const; inline Hep3Vector colY() const; inline Hep3Vector colZ() const; // orthogonal unit-length column vectors inline Hep3Vector rowX() const; inline Hep3Vector rowY() const; inline Hep3Vector rowZ() const; // orthogonal unit-length row vectors inline double xx() const; inline double xy() const; inline double xz() const; inline double yx() const; inline double yy() const; inline double yz() const; inline double zx() const; inline double zy() const; inline double zz() const; // Elements of the rotation matrix (Geant4). inline HepRep3x3 rep3x3() const; // 3x3 representation: // ------------ Euler angles: inline double getPhi () const; inline double getTheta() const; inline double getPsi () const; double phi () const; double theta() const; double psi () const; HepEulerAngles eulerAngles() const; // ------------ axis & angle of rotation: inline double getDelta() const; inline Hep3Vector getAxis () const; inline double delta() const; inline Hep3Vector axis () const; inline HepAxisAngle axisAngle() const; inline void getAngleAxis(double & delta, Hep3Vector & axis) const; // Returns the rotation angle and rotation axis (Geant4). // ------------- Angles of rotated axes double phiX() const; double phiY() const; double phiZ() const; double thetaX() const; double thetaY() const; double thetaZ() const; // Return angles (RADS) made by rotated axes against original axes (Geant4). // ---------- Other accessors treating pure rotation as a 4-rotation inline HepLorentzVector col1() const; inline HepLorentzVector col2() const; inline HepLorentzVector col3() const; // orthosymplectic 4-vector columns - T component will be zero inline HepLorentzVector col4() const; // Will be (0,0,0,1) for this pure Rotation. inline HepLorentzVector row1() const; inline HepLorentzVector row2() const; inline HepLorentzVector row3() const; // orthosymplectic 4-vector rows - T component will be zero inline HepLorentzVector row4() const; // Will be (0,0,0,1) for this pure Rotation. inline double xt() const; inline double yt() const; inline double zt() const; inline double tx() const; inline double ty() const; inline double tz() const; // Will be zero for this pure Rotation inline double tt() const; // Will be one for this pure Rotation inline HepRep4x4 rep4x4() const; // 4x4 representation. // --------- Mutators void setDelta (double delta); // change angle of rotation, leaving rotation axis unchanged. // ---------- Decomposition: void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const; void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const; void decompose (HepRotation & rotation, HepBoost & boost) const; void decompose (HepBoost & boost, HepRotation & rotation) const; // These are trivial, as the boost vector is 0. // ---------- Comparisons: inline bool isIdentity() const; // Returns true if the identity matrix (Geant4). inline int compare( const HepRotationZ & r ) const; // Dictionary-order comparison, in order of delta // Used in operator<, >, <=, >= inline bool operator== ( const HepRotationZ & r ) const; inline bool operator!= ( const HepRotationZ & r ) const; inline bool operator< ( const HepRotationZ & r ) const; inline bool operator> ( const HepRotationZ & r ) const; inline bool operator<= ( const HepRotationZ & r ) const; inline bool operator>= ( const HepRotationZ & r ) const; double distance2( const HepRotationZ & r ) const; // 3 - Tr ( this/r ) double distance2( const HepRotation & r ) const; // 3 - Tr ( this/r ) -- This works with RotationY or Z also double howNear( const HepRotationZ & r ) const; double howNear( const HepRotation & r ) const; bool isNear( const HepRotationZ & r, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepRotation & r, double epsilon=Hep4RotationInterface::tolerance) const; double distance2( const HepBoost & lt ) const; // 3 - Tr ( this ) + |b|^2 / (1-|b|^2) double distance2( const HepLorentzRotation & lt ) const; // 3 - Tr ( this/r ) + |b|^2 / (1-|b|^2) where b is the boost vector of lt double howNear( const HepBoost & lt ) const; double howNear( const HepLorentzRotation & lt ) const; bool isNear( const HepBoost & lt, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepLorentzRotation & lt, double epsilon=Hep4RotationInterface::tolerance) const; // ---------- Properties: double norm2() const; // distance2 (IDENTITY), which is 3 - Tr ( *this ) inline void rectify(); // non-const but logically moot correction for accumulated roundoff errors // ---------- Application: inline Hep3Vector operator() (const Hep3Vector & p) const; // Rotate a Hep3Vector. inline Hep3Vector operator * (const Hep3Vector & p) const; // Multiplication with a Hep3Vector. inline HepLorentzVector operator()( const HepLorentzVector & w ) const; // Rotate (the space part of) a HepLorentzVector. inline HepLorentzVector operator* ( const HepLorentzVector & w ) const; // Multiplication with a HepLorentzVector. // ---------- Operations in the group of Rotations inline HepRotationZ operator * (const HepRotationZ & rz) const; // Product of two Z rotations: (this) * rz is known to be RotationZ. // Product of two rotations (this) * b - matrix multiplication inline HepRotationZ & operator *= (const HepRotationZ & r); inline HepRotationZ & transform (const HepRotationZ & r); // Matrix multiplication. // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a; // However, in this special case, they commute: Both just add deltas. inline HepRotationZ inverse() const; // Returns the inverse. friend HepRotationZ inverseOf(const HepRotationZ & r); // Returns the inverse of a RotationZ. inline HepRotationZ & invert(); // Inverts the Rotation matrix (be negating delta). // ---------- I/O: std::ostream & print( std::ostream & os ) const; // Output, identifying type of rotation and delta. // ---------- Tolerance static inline double getTolerance(); static inline double setTolerance(double tol); protected: double its_d; // The angle of rotation. double its_s; double its_c; // Cache the trig functions, for rapid operations. inline HepRotationZ ( double dd, double ss, double cc ); // Unchecked load-the-data-members static inline double proper (double delta); // Put an angle into the range of (-PI, PI]. Useful helper method. }; // HepRotationZ inline std::ostream & operator << ( std::ostream & os, const HepRotationZ & r ) {return r.print(os);} // ---------- Free-function operations in the group of Rotations } // namespace CLHEP #include "CLHEP/Vector/RotationZ.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_ROTATIONZ_H */ clhep-2.1.4.1.orig/Vector/Vector/RotationX.h0000755000175000017500000002102312050774211017201 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definition of the HepRotationX class for performing rotations // around the X axis on objects of the Hep3Vector (and HepLorentzVector) class. // // HepRotationX is a concrete implementation of Hep3RotationInterface. // // .SS See Also // RotationInterfaces.h // ThreeVector.h, LorentzVector.h, LorentzRotation.h // // .SS Author // Mark Fischler #ifndef HEP_ROTATIONX_H #define HEP_ROTATIONX_H #ifdef GNUPRAGMA #pragma interface #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/RotationInterfaces.h" namespace CLHEP { class HepRotationX; class HepRotation; class HepBoost; inline HepRotationX inverseOf(const HepRotationX & r); // Returns the inverse of a RotationX. /** * @author * @ingroup vector */ class HepRotationX { public: // ---------- Constructors and Assignment: inline HepRotationX(); // Default constructor. Gives an identity rotation. HepRotationX(double delta); // supply angle of rotation inline HepRotationX(const HepRotationX & orig); // Copy constructor. inline HepRotationX & operator = (const HepRotationX & r); // Assignment from a Rotation, which must be RotationX HepRotationX & set ( double delta ); // set angle of rotation inline ~HepRotationX(); // Trivial destructor. // ---------- Accessors: inline Hep3Vector colX() const; inline Hep3Vector colY() const; inline Hep3Vector colZ() const; // orthogonal unit-length column vectors inline Hep3Vector rowX() const; inline Hep3Vector rowY() const; inline Hep3Vector rowZ() const; // orthogonal unit-length row vectors inline double xx() const; inline double xy() const; inline double xz() const; inline double yx() const; inline double yy() const; inline double yz() const; inline double zx() const; inline double zy() const; inline double zz() const; // Elements of the rotation matrix (Geant4). inline HepRep3x3 rep3x3() const; // 3x3 representation: // ------------ Euler angles: inline double getPhi () const; inline double getTheta() const; inline double getPsi () const; double phi () const; double theta() const; double psi () const; HepEulerAngles eulerAngles() const; // ------------ axis & angle of rotation: inline double getDelta() const; inline Hep3Vector getAxis () const; inline double delta() const; inline Hep3Vector axis () const; inline HepAxisAngle axisAngle() const; inline void getAngleAxis(double & delta, Hep3Vector & axis) const; // Returns the rotation angle and rotation axis (Geant4). // ------------- Angles of rotated axes double phiX() const; double phiY() const; double phiZ() const; double thetaX() const; double thetaY() const; double thetaZ() const; // Return angles (RADS) made by rotated axes against original axes (Geant4). // ---------- Other accessors treating pure rotation as a 4-rotation inline HepLorentzVector col1() const; inline HepLorentzVector col2() const; inline HepLorentzVector col3() const; // orthosymplectic 4-vector columns - T component will be zero inline HepLorentzVector col4() const; // Will be (0,0,0,1) for this pure Rotation. inline HepLorentzVector row1() const; inline HepLorentzVector row2() const; inline HepLorentzVector row3() const; // orthosymplectic 4-vector rows - T component will be zero inline HepLorentzVector row4() const; // Will be (0,0,0,1) for this pure Rotation. inline double xt() const; inline double yt() const; inline double zt() const; inline double tx() const; inline double ty() const; inline double tz() const; // Will be zero for this pure Rotation inline double tt() const; // Will be one for this pure Rotation inline HepRep4x4 rep4x4() const; // 4x4 representation. // --------- Mutators void setDelta (double delta); // change angle of rotation, leaving rotation axis unchanged. // ---------- Decomposition: void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const; void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const; void decompose (HepRotation & rotation, HepBoost & boost) const; void decompose (HepBoost & boost, HepRotation & rotation) const; // These are trivial, as the boost vector is 0. // ---------- Comparisons: inline bool isIdentity() const; // Returns true if the identity matrix (Geant4). inline int compare( const HepRotationX & r ) const; // Dictionary-order comparison, in order of delta // Used in operator<, >, <=, >= inline bool operator== ( const HepRotationX & r ) const; inline bool operator!= ( const HepRotationX & r ) const; inline bool operator< ( const HepRotationX & r ) const; inline bool operator> ( const HepRotationX & r ) const; inline bool operator<= ( const HepRotationX & r ) const; inline bool operator>= ( const HepRotationX & r ) const; double distance2( const HepRotationX & r ) const; // 3 - Tr ( this/r ) double distance2( const HepRotation & r ) const; // 3 - Tr ( this/r ) -- This works with RotationY or Z also double howNear( const HepRotationX & r ) const; double howNear( const HepRotation & r ) const; bool isNear( const HepRotationX & r, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepRotation & r, double epsilon=Hep4RotationInterface::tolerance) const; double distance2( const HepBoost & lt ) const; // 3 - Tr ( this ) + |b|^2 / (1-|b|^2) double distance2( const HepLorentzRotation & lt ) const; // 3 - Tr ( this/r ) + |b|^2 / (1-|b|^2) where b is the boost vector of lt double howNear( const HepBoost & lt ) const; double howNear( const HepLorentzRotation & lt ) const; bool isNear( const HepBoost & lt, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepLorentzRotation & lt, double epsilon=Hep4RotationInterface::tolerance) const; // ---------- Properties: double norm2() const; // distance2 (IDENTITY), which is 3 - Tr ( *this ) inline void rectify(); // non-const but logically moot correction for accumulated roundoff errors // ---------- Application: inline Hep3Vector operator() (const Hep3Vector & p) const; // Rotate a Hep3Vector. inline Hep3Vector operator * (const Hep3Vector & p) const; // Multiplication with a Hep3Vector. inline HepLorentzVector operator()( const HepLorentzVector & w ) const; // Rotate (the space part of) a HepLorentzVector. inline HepLorentzVector operator* ( const HepLorentzVector & w ) const; // Multiplication with a HepLorentzVector. // ---------- Operations in the group of Rotations inline HepRotationX operator * (const HepRotationX & rx) const; // Product of two X rotations: (this) * rx is known to be RotationX. inline HepRotationX & operator *= (const HepRotationX & r); inline HepRotationX & transform (const HepRotationX & r); // Matrix multiplication. // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a; // However, in this special case, they commute: Both just add deltas. inline HepRotationX inverse() const; // Returns the inverse. friend HepRotationX inverseOf(const HepRotationX & r); // Returns the inverse of a RotationX. inline HepRotationX & invert(); // Inverts the Rotation matrix (be negating delta). // ---------- I/O: std::ostream & print( std::ostream & os ) const; // Output, identifying type of rotation and delta. // ---------- Tolerance static inline double getTolerance(); static inline double setTolerance(double tol); protected: double its_d; // The angle of rotation. double its_s; double its_c; // Cache the trig functions, for rapid operations. inline HepRotationX ( double dd, double ss, double cc ); // Unchecked load-the-data-members static inline double proper (double delta); // Put an angle into the range of (-PI, PI]. Useful helper method. }; // HepRotationX // ---------- Free-function operations in the group of Rotations inline std::ostream & operator << ( std::ostream & os, const HepRotationX & r ) {return r.print(os);} } // namespace CLHEP #include "CLHEP/Vector/RotationX.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_ROTATIONX_H */ clhep-2.1.4.1.orig/Vector/Vector/TwoVector.icc0000755000175000017500000000734311761714041017531 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definitions of the inline member functions of the // Hep2Vector class. // #include namespace CLHEP { inline double Hep2Vector::x() const { return dx; } inline double Hep2Vector::y() const { return dy; } inline Hep2Vector::Hep2Vector(double x1, double y1) : dx(x1), dy(y1) {} inline Hep2Vector::Hep2Vector( const Hep3Vector & v3) : dx(v3.x()), dy(v3.y()) {} inline void Hep2Vector::setX(double x1) { dx = x1; } inline void Hep2Vector::setY(double y1) { dy = y1; } inline void Hep2Vector::set(double x1, double y1) { dx = x1; dy = y1; } double & Hep2Vector::operator[] (int i) { return operator()(i); } double Hep2Vector::operator[] (int i) const { return operator()(i); } inline Hep2Vector::Hep2Vector(const Hep2Vector & p) : dx(p.x()), dy(p.y()) {} inline Hep2Vector::~Hep2Vector() {} inline Hep2Vector & Hep2Vector::operator = (const Hep2Vector & p) { dx = p.x(); dy = p.y(); return *this; } inline bool Hep2Vector::operator == (const Hep2Vector& v) const { return (v.x()==x() && v.y()==y()) ? true : false; } inline bool Hep2Vector::operator != (const Hep2Vector& v) const { return (v.x()!=x() || v.y()!=y()) ? true : false; } inline Hep2Vector& Hep2Vector::operator += (const Hep2Vector & p) { dx += p.x(); dy += p.y(); return *this; } inline Hep2Vector& Hep2Vector::operator -= (const Hep2Vector & p) { dx -= p.x(); dy -= p.y(); return *this; } inline Hep2Vector Hep2Vector::operator - () const { return Hep2Vector(-dx, -dy); } inline Hep2Vector& Hep2Vector::operator *= (double a) { dx *= a; dy *= a; return *this; } inline double Hep2Vector::dot(const Hep2Vector & p) const { return dx*p.x() + dy*p.y(); } inline double Hep2Vector::mag2() const { return dx*dx + dy*dy; } inline double Hep2Vector::mag() const { return std::sqrt(mag2()); } inline double Hep2Vector::r() const { return std::sqrt(mag2()); } inline Hep2Vector Hep2Vector::unit() const { double tot = mag2(); Hep2Vector p(*this); return tot > 0.0 ? p *= (1.0/std::sqrt(tot)) : Hep2Vector(1,0); } inline Hep2Vector Hep2Vector::orthogonal() const { double x1 = std::fabs(dx), y1 = std::fabs(dy); if (x1 < y1) { return Hep2Vector(dy,-dx); }else{ return Hep2Vector(-dy,dx); } } inline double Hep2Vector::phi() const { return dx == 0.0 && dy == 0.0 ? 0.0 : std::atan2(dy,dx); } inline double Hep2Vector::angle(const Hep2Vector & q) const { double ptot2 = mag2()*q.mag2(); return ptot2 <= 0.0 ? 0.0 : std::acos(dot(q)/std::sqrt(ptot2)); } inline void Hep2Vector::setMag(double r1){ double ph = phi(); setX( r1 * std::cos(ph) ); setY( r1 * std::sin(ph) ); } inline void Hep2Vector::setR(double r1){ setMag(r1); } inline void Hep2Vector::setPhi(double phi1){ double ma = mag(); setX( ma * std::cos(phi1) ); setY( ma * std::sin(phi1) ); } inline void Hep2Vector::setPolar(double r1, double phi1){ setX( r1 * std::cos(phi1) ); setY( r1 * std::sin(phi1) ); } inline Hep2Vector operator + (const Hep2Vector & a, const Hep2Vector & b) { return Hep2Vector(a.x() + b.x(), a.y() + b.y()); } inline Hep2Vector operator - (const Hep2Vector & a, const Hep2Vector & b) { return Hep2Vector(a.x() - b.x(), a.y() - b.y()); } inline Hep2Vector operator * (const Hep2Vector & p, double a) { return Hep2Vector(a*p.x(), a*p.y()); } inline Hep2Vector operator * (double a, const Hep2Vector & p) { return Hep2Vector(a*p.x(), a*p.y()); } inline double operator * (const Hep2Vector & a, const Hep2Vector & b) { return a.dot(b); } inline double Hep2Vector::getTolerance () { return tolerance; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/Boost.icc0000755000175000017500000002170711712321422016654 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definitions of the inline member functions of the // HepBoost class // #include namespace CLHEP { // ---------- Constructors and Assignment: inline HepBoost::HepBoost() : rep_() {} inline HepBoost::HepBoost(const HepBoost & m1) : rep_(m1.rep_) {} inline HepBoost & HepBoost::operator = (const HepBoost & m1) { rep_ = m1.rep_; return *this; } inline HepBoost::HepBoost(double betaX, double betaY, double betaZ) { set(betaX, betaY, betaZ); } inline HepBoost::HepBoost(const HepRep4x4Symmetric & m1) : rep_(m1) {} inline HepBoost::HepBoost(Hep3Vector ddirection, double bbeta) { double length = ddirection.mag(); if (length==0) { ZMthrowC ( ZMxpvZeroVector("HepBoost constructed using a zero vector as direction") ); set(0,0,0); } set(bbeta*ddirection.x()/length, bbeta*ddirection.y()/length, bbeta*ddirection.z()/length); } inline HepBoost::HepBoost(const Hep3Vector & boost) { set(boost.x(), boost.y(), boost.z()); } inline HepBoost::HepBoost(const HepBoostX & boost) {set(boost.boostVector());} inline HepBoost::HepBoost(const HepBoostY & boost) {set(boost.boostVector());} inline HepBoost::HepBoost(const HepBoostZ & boost) {set(boost.boostVector());} inline HepBoost & HepBoost::set(const HepBoostX & boost) {return set(boost.boostVector());} inline HepBoost & HepBoost::set(const HepBoostY & boost) {return set(boost.boostVector());} inline HepBoost & HepBoost::set(const HepBoostZ & boost) {return set(boost.boostVector());} // - Protected method: inline HepBoost::HepBoost ( double xx1, double xy1, double xz1, double xt1, double yy1, double yz1, double yt1, double zz1, double zt1, double tt1) : rep_ ( xx1, xy1, xz1, xt1, yy1, yz1, yt1, zz1, zt1, tt1 ) {} // ---------- Accessors: inline double HepBoost::beta() const { return std::sqrt( 1.0 - 1.0 / (rep_.tt_ * rep_.tt_) ); } inline double HepBoost::gamma() const { return rep_.tt_; } inline Hep3Vector HepBoost::boostVector() const { return (1.0/rep_.tt_) * Hep3Vector( rep_.xt_, rep_.yt_, rep_.zt_ ); } inline Hep3Vector HepBoost::getDirection() const { double norm = 1.0/beta(); return (norm*boostVector()); } inline Hep3Vector HepBoost::direction() const { return getDirection(); } inline double HepBoost::xx() const { return rep_.xx_; } inline double HepBoost::xy() const { return rep_.xy_; } inline double HepBoost::xz() const { return rep_.xz_; } inline double HepBoost::xt() const { return rep_.xt_; } inline double HepBoost::yx() const { return rep_.xy_; } inline double HepBoost::yy() const { return rep_.yy_; } inline double HepBoost::yz() const { return rep_.yz_; } inline double HepBoost::yt() const { return rep_.yt_; } inline double HepBoost::zx() const { return rep_.xz_; } inline double HepBoost::zy() const { return rep_.yz_; } inline double HepBoost::zz() const { return rep_.zz_; } inline double HepBoost::zt() const { return rep_.zt_; } inline double HepBoost::tx() const { return rep_.xt_; } inline double HepBoost::ty() const { return rep_.yt_; } inline double HepBoost::tz() const { return rep_.zt_; } inline double HepBoost::tt() const { return rep_.tt_; } inline HepLorentzVector HepBoost::col1() const { return HepLorentzVector ( xx(), yx(), zx(), tx() ); } inline HepLorentzVector HepBoost::col2() const { return HepLorentzVector ( xy(), yy(), zy(), ty() ); } inline HepLorentzVector HepBoost::col3() const { return HepLorentzVector ( xz(), yz(), zz(), tz() ); } inline HepLorentzVector HepBoost::col4() const { return HepLorentzVector ( xt(), yt(), zt(), tt() ); } inline HepLorentzVector HepBoost::row1() const { return HepLorentzVector ( col1() ); } inline HepLorentzVector HepBoost::row2() const { return HepLorentzVector ( col2() ); } inline HepLorentzVector HepBoost::row3() const { return HepLorentzVector ( col3() ); } inline HepLorentzVector HepBoost::row4() const { return HepLorentzVector ( col4() ); } inline HepRep4x4 HepBoost::rep4x4() const { return HepRep4x4( rep_ ); } inline HepRep4x4Symmetric HepBoost::rep4x4Symmetric() const { return rep_; } inline void HepBoost::setBoost(double bx, double by, double bz) { set(bx, by, bz); } // ---------- Comparisons: int HepBoost::compare ( const HepBoost & b ) const { const HepRep4x4Symmetric & s1 = b.rep4x4Symmetric(); if (rep_.tt_ < s1.tt_) return -1; else if (rep_.tt_ > s1.tt_) return 1; else if (rep_.zt_ < s1.zt_) return -1; else if (rep_.zt_ > s1.zt_) return 1; else if (rep_.zz_ < s1.zz_) return -1; else if (rep_.zz_ > s1.zz_) return 1; else if (rep_.yt_ < s1.yt_) return -1; else if (rep_.yt_ > s1.yt_) return 1; else if (rep_.yz_ < s1.yz_) return -1; else if (rep_.yz_ > s1.yz_) return 1; else if (rep_.yy_ < s1.yy_) return -1; else if (rep_.yy_ > s1.yy_) return 1; else if (rep_.xt_ < s1.xt_) return -1; else if (rep_.xt_ > s1.xt_) return 1; else if (rep_.xz_ < s1.xz_) return -1; else if (rep_.xz_ > s1.xz_) return 1; else if (rep_.xy_ < s1.xy_) return -1; else if (rep_.xy_ > s1.xy_) return 1; else if (rep_.xx_ < s1.xx_) return -1; else if (rep_.xx_ > s1.xx_) return 1; else return 0; } inline bool HepBoost::operator == (const HepBoost & b) const { const HepRep4x4Symmetric & s1 = b.rep4x4Symmetric(); return ( rep_.xx_==s1.xx_ && rep_.xy_==s1.xy_ && rep_.xz_==s1.xz_ && rep_.xt_==s1.xt_ && rep_.yy_==s1.yy_ && rep_.yz_==s1.yz_ && rep_.yt_==s1.yt_ && rep_.zz_==s1.zz_ && rep_.zt_==s1.zt_ && rep_.tt_==s1.tt_ ); } inline bool HepBoost::operator != (const HepBoost & r) const { return ( !(operator==(r)) ); } inline bool HepBoost::operator <= ( const HepBoost & b ) const { return compare(b)<= 0; } inline bool HepBoost::operator >= ( const HepBoost & b ) const { return compare(b)>= 0; } inline bool HepBoost::operator < ( const HepBoost & b ) const { return compare(b)< 0; } inline bool HepBoost::operator > ( const HepBoost & b ) const { return compare(b)> 0; } inline bool HepBoost::isIdentity() const { return (xx() == 1.0 && xy() == 0.0 && xz() == 0.0 && xt() == 0.0 && yy() == 1.0 && yz() == 0.0 && yt() == 0.0 && zz() == 1.0 && zt() == 0.0 && tt() == 1.0); } inline double HepBoost::distance2( const HepBoost & b ) const { double bgx = rep_.xt_ - b.rep_.xt_; double bgy = rep_.yt_ - b.rep_.yt_; double bgz = rep_.zt_ - b.rep_.zt_; return bgx*bgx+bgy*bgy+bgz*bgz; } inline double HepBoost::distance2( const HepBoostX & bx ) const { double bgx = rep_.xt_ - bx.beta()*bx.gamma(); double bgy = rep_.yt_; double bgz = rep_.zt_; return bgx*bgx+bgy*bgy+bgz*bgz; } inline double HepBoost::distance2( const HepBoostY & by ) const { double bgy = rep_.xt_; double bgx = rep_.yt_ - by.beta()*by.gamma(); double bgz = rep_.zt_; return bgx*bgx+bgy*bgy+bgz*bgz; } inline double HepBoost::distance2( const HepBoostZ & bz ) const { double bgz = rep_.xt_; double bgy = rep_.yt_; double bgx = rep_.zt_ - bz.beta()*bz.gamma(); return bgx*bgx+bgy*bgy+bgz*bgz; } inline double HepBoost::howNear ( const HepBoost & b ) const { return std::sqrt(distance2(b)); } inline bool HepBoost::isNear(const HepBoost & b, double epsilon) const{ return (distance2(b) <= epsilon*epsilon); } // ---------- Application: // - Protected method: inline HepLorentzVector HepBoost::vectorMultiplication(const HepLorentzVector & p) const { register double x = p.x(); register double y = p.y(); register double z = p.z(); register double t = p.t(); return HepLorentzVector( rep_.xx_*x + rep_.xy_*y + rep_.xz_*z + rep_.xt_*t, rep_.xy_*x + rep_.yy_*y + rep_.yz_*z + rep_.yt_*t, rep_.xz_*x + rep_.yz_*y + rep_.zz_*z + rep_.zt_*t, rep_.xt_*x + rep_.yt_*y + rep_.zt_*z + rep_.tt_*t); } inline HepLorentzVector HepBoost::operator () (const HepLorentzVector & p) const { return vectorMultiplication(p); } inline HepLorentzVector HepBoost::operator * (const HepLorentzVector & p) const { return vectorMultiplication(p); } // ---------- Operations in the group of 4-Rotations inline HepBoost HepBoost::inverse() const { return HepBoost( xx(), yx(), zx(), -tx(), yy(), zy(), -ty(), zz(), -tz(), tt()); } inline HepBoost inverseOf ( const HepBoost & lt ) { return HepBoost( lt.xx(), lt.yx(), lt.zx(), -lt.tx(), lt.yy(), lt.zy(), -lt.ty(), lt.zz(), -lt.tz(), lt.tt()); } inline HepBoost & HepBoost::invert() { rep_.xt_ = -rep_.xt_; rep_.yt_ = -rep_.yt_; rep_.zt_ = -rep_.zt_; return *this; } // ---------- Tolerance: inline double HepBoost::getTolerance() { return Hep4RotationInterface::tolerance; } inline double HepBoost::setTolerance(double tol) { return Hep4RotationInterface::setTolerance(tol); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/RotationZ.icc0000755000175000017500000001624012050774211017517 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definitions of the inline member functions of the // HepRotationZ class // #include #include "CLHEP/Units/PhysicalConstants.h" namespace CLHEP { inline double HepRotationZ::xx() const { return its_c; } inline double HepRotationZ::xy() const { return -its_s; } inline double HepRotationZ::yx() const { return its_s; } inline double HepRotationZ::yy() const { return its_c; } inline double HepRotationZ::zz() const { return 1.0; } inline double HepRotationZ::zy() const { return 0.0; } inline double HepRotationZ::zx() const { return 0.0; } inline double HepRotationZ::yz() const { return 0.0; } inline double HepRotationZ::xz() const { return 0.0; } inline HepRep3x3 HepRotationZ::rep3x3() const { return HepRep3x3 ( its_c, -its_s, 0.0, its_s, its_c, 0.0, 0.0, 0.0, 1.0 ); } inline HepRotationZ::HepRotationZ() : its_d(0.0), its_s(0.0), its_c(1.0) {} inline HepRotationZ::HepRotationZ(const HepRotationZ & orig) : its_d(orig.its_d), its_s(orig.its_s), its_c(orig.its_c) {} inline HepRotationZ::HepRotationZ(double dd, double ss, double cc) : its_d(dd), its_s(ss), its_c(cc) {} inline HepRotationZ & HepRotationZ::operator= (const HepRotationZ & orig) { its_d = orig.its_d; its_s = orig.its_s; its_c = orig.its_c; return *this; } inline HepRotationZ::~HepRotationZ() {} inline Hep3Vector HepRotationZ::colX() const { return Hep3Vector ( its_c, its_s, 0.0 ); } inline Hep3Vector HepRotationZ::colY() const { return Hep3Vector ( -its_s, its_c, 0.0 ); } inline Hep3Vector HepRotationZ::colZ() const { return Hep3Vector ( 0.0, 0.0, 1.0 ); } inline Hep3Vector HepRotationZ::rowX() const { return Hep3Vector ( its_c, -its_s, 0.0 ); } inline Hep3Vector HepRotationZ::rowY() const { return Hep3Vector ( its_s, its_c, 0.0 ); } inline Hep3Vector HepRotationZ::rowZ() const { return Hep3Vector ( 0.0, 0.0, 1.0 ); } inline double HepRotationZ::getPhi () const { return phi(); } inline double HepRotationZ::getTheta() const { return theta(); } inline double HepRotationZ::getPsi () const { return psi(); } inline double HepRotationZ::getDelta() const { return its_d; } inline Hep3Vector HepRotationZ::getAxis () const { return axis(); } inline double HepRotationZ::delta() const { return its_d; } inline Hep3Vector HepRotationZ::axis() const { return Hep3Vector(0,0,1); } inline HepAxisAngle HepRotationZ::axisAngle() const { return HepAxisAngle ( axis(), delta() ); } inline void HepRotationZ::getAngleAxis (double & ddelta, Hep3Vector & aaxis) const { ddelta = its_d; aaxis = getAxis(); } inline bool HepRotationZ::isIdentity() const { return ( its_d==0 ); } inline int HepRotationZ::compare ( const HepRotationZ & r ) const { if (its_d > r.its_d) return 1; else if (its_d < r.its_d) return -1; else return 0; } inline bool HepRotationZ::operator==(const HepRotationZ & r) const { return (its_d==r.its_d); } inline bool HepRotationZ::operator!=(const HepRotationZ & r) const { return (its_d!=r.its_d); } inline bool HepRotationZ::operator>=(const HepRotationZ & r) const { return (its_d>=r.its_d); } inline bool HepRotationZ::operator<=(const HepRotationZ & r) const { return (its_d<=r.its_d); } inline bool HepRotationZ::operator> (const HepRotationZ & r) const { return (its_d> r.its_d); } inline bool HepRotationZ::operator< (const HepRotationZ & r) const { return (its_d< r.its_d); } inline void HepRotationZ::rectify() { its_d = proper(its_d); // Just in case! its_s = std::sin(its_d); its_c = std::cos(its_d); } inline Hep3Vector HepRotationZ::operator() (const Hep3Vector & p) const { double x = p.x(); double y = p.y(); double z = p.z(); return Hep3Vector( x * its_c - y * its_s, x * its_s + y * its_c, z ); } inline Hep3Vector HepRotationZ::operator * (const Hep3Vector & p) const { return operator()(p); } inline HepLorentzVector HepRotationZ::operator() ( const HepLorentzVector & w ) const { return HepLorentzVector( operator() (w.vect()) , w.t() ); } inline HepLorentzVector HepRotationZ::operator * (const HepLorentzVector & p) const { return operator()(p); } inline HepRotationZ & HepRotationZ::operator *= (const HepRotationZ & m1) { return *this = (*this) * (m1); } inline HepRotationZ & HepRotationZ::transform(const HepRotationZ & m1) { return *this = m1 * (*this); } inline double HepRotationZ::proper( double ddelta ) { // -PI < d <= PI if ( std::fabs(ddelta) < CLHEP::pi ) { return ddelta; } else { register double x = ddelta / (CLHEP::twopi); return (CLHEP::twopi) * ( x + std::floor(.5-x) ); } } // proper() inline HepRotationZ HepRotationZ::operator * ( const HepRotationZ & rz ) const { return HepRotationZ ( HepRotationZ::proper(its_d+rz.its_d), its_s*rz.its_c + its_c*rz.its_s, its_c*rz.its_c - its_s*rz.its_s ); } inline HepRotationZ HepRotationZ::inverse() const { return HepRotationZ( proper(-its_d), -its_s, its_c ); } inline HepRotationZ inverseOf(const HepRotationZ & r) { return r.inverse(); } inline HepRotationZ & HepRotationZ::invert() { return *this=inverse(); } inline HepLorentzVector HepRotationZ::col1() const { return HepLorentzVector (colX(), 0); } inline HepLorentzVector HepRotationZ::col2() const { return HepLorentzVector (colY(), 0); } inline HepLorentzVector HepRotationZ::col3() const { return HepLorentzVector (colZ(), 0); } inline HepLorentzVector HepRotationZ::col4() const { return HepLorentzVector (0,0,0,1); } inline HepLorentzVector HepRotationZ::row1() const { return HepLorentzVector (rowX(), 0); } inline HepLorentzVector HepRotationZ::row2() const { return HepLorentzVector (rowY(), 0); } inline HepLorentzVector HepRotationZ::row3() const { return HepLorentzVector (rowZ(), 0); } inline HepLorentzVector HepRotationZ::row4() const { return HepLorentzVector (0,0,0,1); } inline double HepRotationZ::xt() const { return 0.0; } inline double HepRotationZ::yt() const { return 0.0; } inline double HepRotationZ::zt() const { return 0.0; } inline double HepRotationZ::tx() const { return 0.0; } inline double HepRotationZ::ty() const { return 0.0; } inline double HepRotationZ::tz() const { return 0.0; } inline double HepRotationZ::tt() const { return 1.0; } inline HepRep4x4 HepRotationZ::rep4x4() const { return HepRep4x4 ( its_c, -its_s, 0.0, 0.0, its_s, its_c, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ); } inline double HepRotationZ::getTolerance() { return Hep4RotationInterface::tolerance; } inline double HepRotationZ::setTolerance(double tol) { return Hep4RotationInterface::setTolerance(tol); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/RotationInterfaces.h0000755000175000017500000002555411406203315021066 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // --------------------------------------------------------------------------- // CLASSDOC ON #ifndef HEP_ROTATION_INTERFACES_H #define HEP_ROTATION_INTERFACES_H // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This contains the definition of two abstract interface classes: // Hep4RotationInterface // Hep3RotationInterface. // However, these are mostly for defining methods which should be present in // any 4- or 3-rotation class, however specialized. The actual classes do // not inherit from these. The virtual function overhead turns out // to be too steep for that to be practical. // // It may be desirable in the future to turn these classes into constraints // in the Stroustrup sense, so as to enforce this interface, still without // inheritance. However, they do contain an important static: // static double tolerance to set criteria for relative nearness. // // This file also defines structs // HepRep3x3; // HepRep4x4; // HepRep4x4Symmetric; // which are used by various Rotation classes. // // Hep4RotationInterface // contains all the methods to get attributes of either a // HepLorentzRotation or a HepRotation -- any information // that pertains to a LorentzRotation can also be defined // for a HepRotation.(For example, the 4x4 representation // would just have 0's in the space-time entries and 1 in // the time-time entry.) // // Hep3RotationInterface // inherits from Hep4RotationInterface, and adds methods // which are well-defined only in the case of a Rotation. // For example, a 3x3 representation is an attribute only // if the generic LorentzRotation involves no boost. // // In terms of classes in the ZOOM PhysicsVectors package, // Hep4RotationInterface <--> LorentzTransformationInterface // Hep3RotationInterface <--> RotationInterface // // Hep4RotationInterface defines the required methods for: // HepLorentzRotation // HepBoost // HepBoostX // HepBoostY // HepBoostZ // // Hep3RotationInterface defines the required methods for: // HepRotation // HepRotationX // HepRotationY // HepRotationZ // // .SS See Also // Rotation.h, LorentzRotation.h // // .SS Author // Mark Fischler // #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Vector/AxisAngle.h" namespace CLHEP { struct HepRep3x3; struct HepRep4x4; struct HepRep4x4Symmetric; class HepRotation; class HepRotationX; class HepRotationY; class HepRotationZ; class HepLorentzRotation; class HepBoost; class HepBoostX; class HepBoostY; class HepBoostZ; //-****************************** // // Hep4RotationInterface // //-****************************** /** * @author * @ingroup vector */ class Hep4RotationInterface { // All attributes of shared by HepLorentzRotation, HepBoost, // HepBoostX, HepBoostY, HepBoostZ. HepRotation, HepRotationX, // HepRotationY, HepRotationZ also share this attribute interface. friend class HepRotation; friend class HepRotationX; friend class HepRotationY; friend class HepRotationZ; friend class HepLorentzRotation; friend class HepBoost; friend class HepBoostX; friend class HepBoostY; friend class HepBoostZ; public: static double tolerance; // to determine relative nearness // ---------- Accessors: #ifdef ONLY_IN_CONCRETE_CLASSES // orthosymplectic 4-vectors: HepLorentzVector col1() const; HepLorentzVector col2() const; HepLorentzVector col3() const; HepLorentzVector col4() const; HepLorentzVector row1() const; HepLorentzVector row2() const; HepLorentzVector row3() const; HepLorentzVector row4() const; // individual elements: double xx() const ; double xy() const ; double xz() const ; double xt() const ; double yx() const ; double yy() const ; double yz() const ; double yt() const ; double zx() const ; double zy() const ; double zz() const ; double zt() const ; double tx() const ; double ty() const ; double tz() const ; double tt() const ; // 4x4 representation: //HepRep4x4 rep4x4() const; JMM Declared here but not defined anywhere! // ---------- Operations: // comparisons: inline int compare( const Hep4RotationInterface & lt ) const; // Dictionary-order comparisons, utilizing the decompose(b,r) method // decomposition: void decompose (HepAxisAngle & rotation, Hep3Vector & boost)const; // Decompose as T= R * B, where R is pure rotation, B is pure boost. void decompose (Hep3Vector & boost, HepAxisAngle & rotation)const; // Decompose as T= B * R, where R is pure rotation, B is pure boost. bool operator == (const Hep4RotationInterface & r) const; bool operator != (const Hep4RotationInterface & r) const; // relative comparison: double norm2() const ; double distance2( const Hep4RotationInterface & lt ) const ; double howNear( const Hep4RotationInterface & lt ) const ; bool isNear (const Hep4RotationInterface & lt, double epsilon=tolerance) const ; void rectify() ; // non-const but logically const correction for accumulated roundoff errors // ---------- Apply LorentzTransformations: HepLorentzVector operator* ( const HepLorentzVector & w ) const ; HepLorentzVector operator()( const HepLorentzVector & w ) const ; // Apply to a 4-vector // ---------- I/O: std::ostream & print( std::ostream & os ) const; #endif /* ONLY_IN_CONCRETE_CLASSES */ static double getTolerance(); static double setTolerance( double tol ); enum { ToleranceTicks = 100 }; protected: ~Hep4RotationInterface() {} // protect destructor to forbid instatiation }; // Hep4RotationInterface //-****************************** // // Hep3RotationInterface // //-****************************** /** * @author * @ingroup vector */ class Hep3RotationInterface : public Hep4RotationInterface { // All attributes of HepRotation, HepRotationX, HepRotationY, HepRotationZ // beyond those available by virtue of being a Hep3RotationInterface. friend class HepRotation; friend class HepRotationX; friend class HepRotationY; friend class HepRotationZ; public: #ifdef ONLY_IN_CONCRETE_CLASSES // Euler angles: double getPhi () const ; double getTheta() const ; double getPsi () const ; double phi () const ; double theta() const ; double psi () const ; HepEulerAngles eulerAngles() const ; // axis & angle of rotation: double getDelta() const ; Hep3Vector getAxis () const ; double delta() const ; Hep3Vector axis () const ; HepAxisAngle axisAngle() const ; // orthogonal unit-length vectors: Hep3Vector rowX() const; Hep3Vector rowY() const; Hep3Vector rowZ() const; Hep3Vector colX() const; Hep3Vector colY() const; Hep3Vector colZ() const; //HepRep3x3 rep3x3() const; JMM Declared here but not defined anywhere! // 3x3 representation // orthosymplectic 4-vectors treating this as a 4-rotation: HepLorentzVector col1() const; HepLorentzVector col2() const; HepLorentzVector col3() const; HepLorentzVector col4() const; HepLorentzVector row1() const; HepLorentzVector row2() const; HepLorentzVector row3() const; HepLorentzVector row4() const; // individual elements treating this as a 4-rotation: double xt() const; double yt() const; double zt() const; double tx() const; double ty() const; double tz() const; double tt() const; // ---------- Operations in the Rotation group HepRotation operator * ( const Hep3RotationInterface & r ) const ; // ---------- Application HepLorentzVector operator* ( const HepLorentzVector & w ) const ; HepLorentzVector operator()( const HepLorentzVector & w ) const ; // apply to HepLorentzVector Hep3Vector operator* ( const Hep3Vector & v ) const ; Hep3Vector operator()( const Hep3Vector & v ) const ; // apply to Hep3Vector // ---------- I/O and a helper method std::ostream & print( std::ostream & os ) const; #endif /* ONLY_IN_CONCRETE_CLASSES */ private: ~Hep3RotationInterface() {} // private destructor to forbid instatiation }; // Hep3RotationInterface //-*************************** // 3x3 and 4x4 representations //-*************************** struct HepRep3x3 { // ----- Constructors: inline HepRep3x3(); inline HepRep3x3( double xx, double xy, double xz , double yx, double yy, double yz , double zx, double zy, double zz ); inline HepRep3x3( const double * array ); // construct from an array of doubles, holding the rotation matrix // in ROW order (xx, xy, ...) inline void setToIdentity(); // ----- The data members are public: double xx_, xy_, xz_, yx_, yy_, yz_, zx_, zy_, zz_; inline void getArray ( double * array ) const; // fill array with the NINE doubles xx, xy, xz ... zz }; // HepRep3x3 struct HepRep4x4 { // ----- Constructors: inline HepRep4x4(); inline HepRep4x4( double xx, double xy, double xz, double xt , double yx, double yy, double yz, double yt , double zx, double zy, double zz, double zt , double tx, double ty, double tz, double tt ); inline HepRep4x4( const HepRep4x4Symmetric & rep ); inline HepRep4x4( const double * array ); // construct from an array of doubles, holding the transformation matrix // in ROW order xx, xy, ... inline void setToIdentity(); // ----- The data members are public: double xx_, xy_, xz_, xt_, yx_, yy_, yz_, yt_, zx_, zy_, zz_, zt_, tx_, ty_, tz_, tt_; inline void getArray ( double * array ) const; // fill array with the SIXTEEN doubles xx, xy, xz ... tz, tt inline bool operator==(HepRep4x4 const & r) const; inline bool operator!=(HepRep4x4 const & r) const; }; // HepRep4x4 struct HepRep4x4Symmetric { // ----- Constructors: inline HepRep4x4Symmetric(); inline HepRep4x4Symmetric ( double xx, double xy, double xz, double xt , double yy, double yz, double yt , double zz, double zt , double tt ); inline HepRep4x4Symmetric( const double * array ); // construct from an array of doubles, holding the transformation matrix // elements in this order: xx, xy, xz, xt, yy, yz, yt, zz, zt, tt inline void setToIdentity(); // ----- The data members are public: double xx_, xy_, xz_, xt_, yy_, yz_, yt_, zz_, zt_, tt_; inline void getArray ( double * array ) const; // fill array with the TEN doubles xx, xy, xz, xt, yy, yz, yt, zz, zt, tt }; } // namespace CLHEP #include "CLHEP/Vector/RotationInterfaces.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif // ROTATION_INTERFACES_H clhep-2.1.4.1.orig/Vector/Vector/BoostY.h0000755000175000017500000001514607746044120016507 0ustar olesoles// -*- C++ -*- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definition of the HepBoostY class for performing specialized // Lorentz transformations which are pure boosts in the Y direction, on // objects of the HepLorentzVector class. // // HepLorentzRotation is a concrete implementation of Hep4RotationInterface. // // .SS See Also // RotationInterfaces.h // LorentzVector.h LorentzRotation.h // Boost.h // // .SS Author // Mark Fischler #ifndef HEP_BOOSTY_H #define HEP_BOOSTY_H #ifdef GNUPRAGMA #pragma interface #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/RotationInterfaces.h" #include "CLHEP/Vector/LorentzVector.h" namespace CLHEP { // Declarations of classes and global methods class HepBoostY; inline HepBoostY inverseOf ( const HepBoostY & b ); class HepBoost; class HepRotation; /** * @author * @ingroup vector */ class HepBoostY { public: // ---------- Constructors and Assignment: inline HepBoostY(); // Default constructor. Gives a boost of 0. inline HepBoostY(const HepBoostY & b); // Copy constructor. inline HepBoostY & operator = (const HepBoostY & m); // Assignment. HepBoostY & set (double beta); inline HepBoostY (double beta); // Constructor from beta // ---------- Accessors: inline double beta() const; inline double gamma() const; inline Hep3Vector boostVector() const; inline Hep3Vector getDirection() const; inline double xx() const; inline double xy() const; inline double xz() const; inline double xt() const; inline double yx() const; inline double yy() const; inline double yz() const; inline double yt() const; inline double zx() const; inline double zy() const; inline double zz() const; inline double zt() const; inline double tx() const; inline double ty() const; inline double tz() const; inline double tt() const; // Elements of the matrix. inline HepLorentzVector col1() const; inline HepLorentzVector col2() const; inline HepLorentzVector col3() const; inline HepLorentzVector col4() const; // orthosymplectic column vectors inline HepLorentzVector row1() const; inline HepLorentzVector row2() const; inline HepLorentzVector row3() const; inline HepLorentzVector row4() const; // orthosymplectic row vectors HepRep4x4 rep4x4() const; // 4x4 representation: HepRep4x4Symmetric rep4x4Symmetric() const; // Symmetric 4x4 representation. // ---------- Decomposition: void decompose (HepRotation & rotation, HepBoost & boost) const; void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const; // Find R and B such that L = R*B -- trivial, since R is identity void decompose (HepBoost & boost, HepRotation & rotation) const; void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const; // Find R and B such that L = B*R -- trivial, since R is identity // ---------- Comparisons: inline int compare( const HepBoostY & b ) const; // Dictionary-order comparison, in order of beta. // Used in operator<, >, <=, >= inline bool operator == (const HepBoostY & b) const; inline bool operator != (const HepBoostY & b) const; inline bool operator <= (const HepBoostY & b) const; inline bool operator >= (const HepBoostY & b) const; inline bool operator < (const HepBoostY & b) const; inline bool operator > (const HepBoostY & b) const; // Comparisons. inline bool isIdentity() const; // Returns true if a null boost. inline double distance2( const HepBoostY & b ) const; double distance2( const HepBoost & b ) const; // Defined as the distance2 between the vectors (gamma*betaVector) double distance2( const HepRotation & r ) const; double distance2( const HepLorentzRotation & lt ) const; // Decompose lt = B*R; add norm2 to distance2 to between boosts. inline double howNear( const HepBoostY & b ) const; inline double howNear( const HepBoost & b ) const; inline double howNear( const HepRotation & r ) const; inline double howNear( const HepLorentzRotation & lt ) const; inline bool isNear( const HepBoostY & b, double epsilon=Hep4RotationInterface::tolerance) const; inline bool isNear( const HepBoost & b, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepRotation & r, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepLorentzRotation & lt, double epsilon=Hep4RotationInterface::tolerance) const; // ---------- Properties: inline double norm2() const; // distance2 (IDENTITY), which is beta^2 * gamma^2 void rectify(); // sets according to the stored beta // ---------- Application: inline HepLorentzVector operator()( const HepLorentzVector & w ) const; // Transform a Lorentz Vector. inline HepLorentzVector operator* ( const HepLorentzVector & w ) const; // Multiplication with a Lorentz Vector. // ---------- Operations in the group of 4-Rotations HepBoostY operator * (const HepBoostY & b) const; HepLorentzRotation operator * (const HepBoost & b) const; HepLorentzRotation operator * (const HepRotation & r) const; HepLorentzRotation operator * (const HepLorentzRotation & lt) const; // Product of two Lorentz Rotations (this) * lt - matrix multiplication // Notice that the product of two pure boosts in different directions // is no longer a pure boost. inline HepBoostY inverse() const; // Return the inverse. inline friend HepBoostY inverseOf ( const HepBoostY & b ); // global methods to invert. inline HepBoostY & invert(); // Inverts the Boost matrix. // ---------- I/O: std::ostream & print( std::ostream & os ) const; // Output form is BOOSTY (beta=..., gamma=...); // ---------- Tolerance static inline double getTolerance(); static inline double setTolerance(double tol); protected: inline HepLorentzVector vectorMultiplication ( const HepLorentzVector & w ) const; // Multiplication with a Lorentz Vector. HepLorentzRotation matrixMultiplication (const HepRep4x4 & m) const; HepLorentzRotation matrixMultiplication (const HepRep4x4Symmetric & m) const; inline HepBoostY (double beta, double gamma); double beta_; double gamma_; }; // HepBoostY inline std::ostream & operator << ( std::ostream & os, const HepBoostY& b ) {return b.print(os);} } // namespace CLHEP #include "CLHEP/Vector/BoostY.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_BOOSTY_H */ clhep-2.1.4.1.orig/Vector/Vector/LorentzVector.h0000755000175000017500000004614012010476513020101 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // $Id: LorentzVector.h,v 1.2 2003/10/23 21:29:52 garren Exp $ // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // HepLorentzVector is a Lorentz vector consisting of Hep3Vector and // double components. Lorentz transformations (rotations and boosts) // of these vectors are perfomed by multiplying with objects of // the HepLorenzRotation class. // // .SS See Also // ThreeVector.h, Rotation.h, LorentzRotation.h // // .SS Authors // Leif Lonnblad and Anders Nilsson. Modified by Evgueni Tcherniaev, Mark Fischler // #ifndef HEP_LORENTZVECTOR_H #define HEP_LORENTZVECTOR_H #ifdef GNUPRAGMA #pragma interface #endif #include #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/ThreeVector.h" namespace CLHEP { // Declarations of classes and global methods class HepLorentzVector; class HepLorentzRotation; class HepRotation; class HepAxisAngle; class HepEulerAngles; class Tcomponent; HepLorentzVector rotationXOf( const HepLorentzVector & vec, double delta ); HepLorentzVector rotationYOf( const HepLorentzVector & vec, double delta ); HepLorentzVector rotationZOf( const HepLorentzVector & vec, double delta ); HepLorentzVector rotationOf ( const HepLorentzVector & vec, const Hep3Vector & axis, double delta ); HepLorentzVector rotationOf ( const HepLorentzVector & vec, const HepAxisAngle & ax ); HepLorentzVector rotationOf ( const HepLorentzVector & vec, const HepEulerAngles & e1 ); HepLorentzVector rotationOf ( const HepLorentzVector & vec, double phi, double theta, double psi ); inline HepLorentzVector boostXOf( const HepLorentzVector & vec, double beta ); inline HepLorentzVector boostYOf( const HepLorentzVector & vec, double beta ); inline HepLorentzVector boostZOf( const HepLorentzVector & vec, double beta ); inline HepLorentzVector boostOf ( const HepLorentzVector & vec, const Hep3Vector & betaVector ); inline HepLorentzVector boostOf ( const HepLorentzVector & vec, const Hep3Vector & axis, double beta ); enum ZMpvMetric_t { TimePositive, TimeNegative }; /** * @author * @ingroup vector */ class HepLorentzVector { public: enum { X=0, Y=1, Z=2, T=3, NUM_COORDINATES=4, SIZE=NUM_COORDINATES }; // Safe indexing of the coordinates when using with matrices, arrays, etc. // (BaBar) inline HepLorentzVector(double x, double y, double z, double t); // Constructor giving the components x, y, z, t. inline HepLorentzVector(double x, double y, double z); // Constructor giving the components x, y, z with t-component set to 0.0. explicit HepLorentzVector(double t); // Constructor giving the t-component with x, y and z set to 0.0. inline HepLorentzVector(); // Default constructor with x, y, z and t set to 0.0. inline HepLorentzVector(const Hep3Vector & p, double e); inline HepLorentzVector(double e, const Hep3Vector & p); // Constructor giving a 3-Vector and a time component. inline HepLorentzVector(const HepLorentzVector &); // Copy constructor. inline ~HepLorentzVector(); // The destructor. inline operator const Hep3Vector & () const; inline operator Hep3Vector & (); // Conversion (cast) to Hep3Vector. inline double x() const; inline double y() const; inline double z() const; inline double t() const; // Get position and time. inline void setX(double); inline void setY(double); inline void setZ(double); inline void setT(double); // Set position and time. inline double px() const; inline double py() const; inline double pz() const; inline double e() const; // Get momentum and energy. inline void setPx(double); inline void setPy(double); inline void setPz(double); inline void setE(double); // Set momentum and energy. inline Hep3Vector vect() const; // Get spatial component. inline void setVect(const Hep3Vector &); // Set spatial component. inline double theta() const; inline double cosTheta() const; inline double phi() const; inline double rho() const; // Get spatial vector components in spherical coordinate system. inline void setTheta(double); inline void setPhi(double); inline void setRho(double); // Set spatial vector components in spherical coordinate system. double operator () (int) const; inline double operator [] (int) const; // Get components by index. double & operator () (int); inline double & operator [] (int); // Set components by index. inline HepLorentzVector & operator = (const HepLorentzVector &); // Assignment. inline HepLorentzVector operator + (const HepLorentzVector &) const; inline HepLorentzVector & operator += (const HepLorentzVector &); // Additions. inline HepLorentzVector operator - (const HepLorentzVector &) const; inline HepLorentzVector & operator -= (const HepLorentzVector &); // Subtractions. inline HepLorentzVector operator - () const; // Unary minus. inline HepLorentzVector & operator *= (double); HepLorentzVector & operator /= (double); // Scaling with real numbers. inline bool operator == (const HepLorentzVector &) const; inline bool operator != (const HepLorentzVector &) const; // Comparisons. inline double perp2() const; // Transverse component of the spatial vector squared. inline double perp() const; // Transverse component of the spatial vector (R in cylindrical system). inline void setPerp(double); // Set the transverse component of the spatial vector. inline double perp2(const Hep3Vector &) const; // Transverse component of the spatial vector w.r.t. given axis squared. inline double perp(const Hep3Vector &) const; // Transverse component of the spatial vector w.r.t. given axis. inline double angle(const Hep3Vector &) const; // Angle wrt. another vector. inline double mag2() const; // Dot product of 4-vector with itself. // By default the metric is TimePositive, and mag2() is the same as m2(). inline double m2() const; // Invariant mass squared. inline double mag() const; inline double m() const; // Invariant mass. If m2() is negative then -sqrt(-m2()) is returned. inline double mt2() const; // Transverse mass squared. inline double mt() const; // Transverse mass. inline double et2() const; // Transverse energy squared. inline double et() const; // Transverse energy. inline double dot(const HepLorentzVector &) const; inline double operator * (const HepLorentzVector &) const; // Scalar product. inline double invariantMass2( const HepLorentzVector & w ) const; // Invariant mass squared of pair of 4-vectors double invariantMass ( const HepLorentzVector & w ) const; // Invariant mass of pair of 4-vectors inline void setVectMag(const Hep3Vector & spatial, double magnitude); inline void setVectM(const Hep3Vector & spatial, double mass); // Copy spatial coordinates, and set energy = sqrt(mass^2 + spatial^2) inline double plus() const; inline double minus() const; // Returns the positive/negative light-cone component t +/- z. Hep3Vector boostVector() const; // Boost needed from rest4Vector in rest frame to form this 4-vector // Returns the spatial components divided by the time component. HepLorentzVector & boost(double, double, double); inline HepLorentzVector & boost(const Hep3Vector &); // Lorentz boost. HepLorentzVector & boostX( double beta ); HepLorentzVector & boostY( double beta ); HepLorentzVector & boostZ( double beta ); // Boost along an axis, by magnitue beta (fraction of speed of light) double rapidity() const; // Returns the rapidity, i.e. 0.5*ln((E+pz)/(E-pz)) inline double pseudoRapidity() const; // Returns the pseudo-rapidity, i.e. -ln(tan(theta/2)) inline bool isTimelike() const; // Test if the 4-vector is timelike inline bool isSpacelike() const; // Test if the 4-vector is spacelike inline bool isLightlike(double epsilon=tolerance) const; // Test for lightlike is within tolerance epsilon HepLorentzVector & rotateX(double); // Rotate the spatial component around the x-axis. HepLorentzVector & rotateY(double); // Rotate the spatial component around the y-axis. HepLorentzVector & rotateZ(double); // Rotate the spatial component around the z-axis. HepLorentzVector & rotateUz(const Hep3Vector &); // Rotates the reference frame from Uz to newUz (unit vector). HepLorentzVector & rotate(double, const Hep3Vector &); // Rotate the spatial component around specified axis. inline HepLorentzVector & operator *= (const HepRotation &); inline HepLorentzVector & transform(const HepRotation &); // Transformation with HepRotation. HepLorentzVector & operator *= (const HepLorentzRotation &); HepLorentzVector & transform(const HepLorentzRotation &); // Transformation with HepLorenzRotation. // = = = = = = = = = = = = = = = = = = = = = = = = // // Esoteric properties and operations on 4-vectors: // // 0 - Flexible metric convention and axial unit 4-vectors // 1 - Construct and set 4-vectors in various ways // 2 - Synonyms for accessing coordinates and properties // 2a - Setting space coordinates in different ways // 3 - Comparisions (dictionary, near-ness, and geometric) // 4 - Intrinsic properties // 4a - Releativistic kinematic properties // 4b - Methods combining two 4-vectors // 5 - Properties releative to z axis and to arbitrary directions // 7 - Rotations and Boosts // // = = = = = = = = = = = = = = = = = = = = = = = = // 0 - Flexible metric convention static ZMpvMetric_t setMetric( ZMpvMetric_t a1 ); static ZMpvMetric_t getMetric(); // 1 - Construct and set 4-vectors in various ways inline void set (double x, double y, double z, double t); inline void set (double x, double y, double z, Tcomponent t); inline HepLorentzVector(double x, double y, double z, Tcomponent t); // Form 4-vector by supplying cartesian coordinate components inline void set (Tcomponent t, double x, double y, double z); inline HepLorentzVector(Tcomponent t, double x, double y, double z); // Deprecated because the 4-doubles form uses x,y,z,t, not t,x,y,z. inline void set ( double t ); inline void set ( Tcomponent t ); inline explicit HepLorentzVector( Tcomponent t ); // Form 4-vector with zero space components, by supplying t component inline void set ( const Hep3Vector & v ); inline explicit HepLorentzVector( const Hep3Vector & v ); // Form 4-vector with zero time component, by supplying space 3-vector inline HepLorentzVector & operator=( const Hep3Vector & v ); // Form 4-vector with zero time component, equal to space 3-vector inline void set ( const Hep3Vector & v, double t ); inline void set ( double t, const Hep3Vector & v ); // Set using specified space vector and time component // 2 - Synonyms for accessing coordinates and properties inline double getX() const; inline double getY() const; inline double getZ() const; inline double getT() const; // Get position and time. inline Hep3Vector v() const; inline Hep3Vector getV() const; // Get spatial component. Same as vect. inline void setV(const Hep3Vector &); // Set spatial component. Same as setVect. // 2a - Setting space coordinates in different ways inline void setV( double x, double y, double z ); inline void setRThetaPhi( double r, double theta, double phi); inline void setREtaPhi( double r, double eta, double phi); inline void setRhoPhiZ( double rho, double phi, double z ); // 3 - Comparisions (dictionary, near-ness, and geometric) int compare( const HepLorentzVector & w ) const; bool operator >( const HepLorentzVector & w ) const; bool operator <( const HepLorentzVector & w ) const; bool operator>=( const HepLorentzVector & w ) const; bool operator<=( const HepLorentzVector & w ) const; bool isNear ( const HepLorentzVector & w, double epsilon=tolerance ) const; double howNear( const HepLorentzVector & w ) const; // Is near using Euclidean measure t**2 + v**2 bool isNearCM ( const HepLorentzVector & w, double epsilon=tolerance ) const; double howNearCM( const HepLorentzVector & w ) const; // Is near in CM frame: Applicable only for two timelike HepLorentzVectors // If w1 and w2 are already in their CM frame, then w1.isNearCM(w2) // is exactly equivalent to w1.isNear(w2). // If w1 and w2 have T components of zero, w1.isNear(w2) is exactly // equivalent to w1.getV().isNear(w2.v()). bool isParallel( const HepLorentzVector & w, double epsilon=tolerance ) const; // Test for isParallel is within tolerance epsilon double howParallel (const HepLorentzVector & w) const; static double getTolerance(); static double setTolerance( double tol ); // Set the tolerance for HepLorentzVectors to be considered near // The same tolerance is used for determining isLightlike, and isParallel double deltaR(const HepLorentzVector & v) const; // sqrt ( (delta eta)^2 + (delta phi)^2 ) of space part // 4 - Intrinsic properties double howLightlike() const; // Close to zero for almost lightlike 4-vectors; up to 1. inline double euclideanNorm2() const; // Sum of the squares of time and space components; not Lorentz invariant. inline double euclideanNorm() const; // Length considering the metric as (+ + + +); not Lorentz invariant. // 4a - Relativistic kinematic properties // All Relativistic kinematic properties are independent of the sense of metric inline double restMass2() const; inline double invariantMass2() const; // Rest mass squared -- same as m2() inline double restMass() const; inline double invariantMass() const; // Same as m(). If m2() is negative then -sqrt(-m2()) is returned. // The following properties are rest-frame related, // and are applicable only to non-spacelike 4-vectors HepLorentzVector rest4Vector() const; // This 4-vector, boosted into its own rest frame: (0, 0, 0, m()) // The following relation holds by definition: // w.rest4Vector().boost(w.boostVector()) == w // Beta and gamma of the boost vector double beta() const; // Relativistic beta of the boost vector double gamma() const; // Relativistic gamma of the boost vector inline double eta() const; // Pseudorapidity (of the space part) inline double eta(const Hep3Vector & ref) const; // Pseudorapidity (of the space part) w.r.t. specified direction double rapidity(const Hep3Vector & ref) const; // Rapidity in specified direction double coLinearRapidity() const; // Rapidity, in the relativity textbook sense: atanh (|P|/E) Hep3Vector findBoostToCM() const; // Boost needed to get to center-of-mass frame: // w.findBoostToCM() == - w.boostVector() // w.boost(w.findBoostToCM()) == w.rest4Vector() Hep3Vector findBoostToCM( const HepLorentzVector & w ) const; // Boost needed to get to combined center-of-mass frame: // w1.findBoostToCM(w2) == w2.findBoostToCM(w1) // w.findBoostToCM(w) == w.findBoostToCM() inline double et2(const Hep3Vector &) const; // Transverse energy w.r.t. given axis squared. inline double et(const Hep3Vector &) const; // Transverse energy w.r.t. given axis. // 4b - Methods combining two 4-vectors inline double diff2( const HepLorentzVector & w ) const; // (this - w).dot(this-w); sign depends on metric choice inline double delta2Euclidean ( const HepLorentzVector & w ) const; // Euclidean norm of differnce: (delta_T)^2 + (delta_V)^2 // 5 - Properties releative to z axis and to arbitrary directions double plus( const Hep3Vector & ref ) const; // t + projection in reference direction double minus( const Hep3Vector & ref ) const; // t - projection in reference direction // 7 - Rotations and boosts HepLorentzVector & rotate ( const Hep3Vector & axis, double delta ); // Same as rotate (delta, axis) HepLorentzVector & rotate ( const HepAxisAngle & ax ); HepLorentzVector & rotate ( const HepEulerAngles & e ); HepLorentzVector & rotate ( double phi, double theta, double psi ); // Rotate using these HepEuler angles - see Goldstein page 107 for conventions HepLorentzVector & boost ( const Hep3Vector & axis, double beta ); // Normalizes the Hep3Vector to define a direction, and uses beta to // define the magnitude of the boost. friend HepLorentzVector rotationXOf ( const HepLorentzVector & vec, double delta ); friend HepLorentzVector rotationYOf ( const HepLorentzVector & vec, double delta ); friend HepLorentzVector rotationZOf ( const HepLorentzVector & vec, double delta ); friend HepLorentzVector rotationOf ( const HepLorentzVector & vec, const Hep3Vector & axis, double delta ); friend HepLorentzVector rotationOf ( const HepLorentzVector & vec, const HepAxisAngle & ax ); friend HepLorentzVector rotationOf ( const HepLorentzVector & vec, const HepEulerAngles & e ); friend HepLorentzVector rotationOf ( const HepLorentzVector & vec, double phi, double theta, double psi ); inline friend HepLorentzVector boostXOf ( const HepLorentzVector & vec, double beta ); inline friend HepLorentzVector boostYOf ( const HepLorentzVector & vec, double beta ); inline friend HepLorentzVector boostZOf ( const HepLorentzVector & vec, double beta ); inline friend HepLorentzVector boostOf ( const HepLorentzVector & vec, const Hep3Vector & betaVector ); inline friend HepLorentzVector boostOf ( const HepLorentzVector & vec, const Hep3Vector & axis, double beta ); private: Hep3Vector pp; double ee; static double tolerance; static double metric; }; // HepLorentzVector // 8 - Axial Unit 4-vectors static const HepLorentzVector X_HAT4 = HepLorentzVector( 1, 0, 0, 0 ); static const HepLorentzVector Y_HAT4 = HepLorentzVector( 0, 1, 0, 0 ); static const HepLorentzVector Z_HAT4 = HepLorentzVector( 0, 0, 1, 0 ); static const HepLorentzVector T_HAT4 = HepLorentzVector( 0, 0, 0, 1 ); // Global methods std::ostream & operator << (std::ostream &, const HepLorentzVector &); // Output to a stream. std::istream & operator >> (std::istream &, HepLorentzVector &); // Input from a stream. typedef HepLorentzVector HepLorentzVectorD; typedef HepLorentzVector HepLorentzVectorF; inline HepLorentzVector operator * (const HepLorentzVector &, double a); inline HepLorentzVector operator * (double a, const HepLorentzVector &); // Scaling LorentzVector with a real number HepLorentzVector operator / (const HepLorentzVector &, double a); // Dividing LorentzVector by a real number // Tcomponent definition: // Signature protection for 4-vector constructors taking 4 components class Tcomponent { private: double t_; public: explicit Tcomponent(double t) : t_(t) {} operator double() const { return t_; } }; // Tcomponent } // namespace CLHEP #include "CLHEP/Vector/LorentzVector.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_LORENTZVECTOR_H */ clhep-2.1.4.1.orig/Vector/Vector/ZMxpv.h0000755000175000017500000002352511761726606016364 0ustar olesoles#ifndef HEP_ZMXPV_H #define HEP_ZMXPV_H // ---------------------------------------------------------------------- // // ZMxpv.h ZMexception's ZMthrown by classes in the PhysicsVectors // package. To avoid name clashes, these start with ZMxpv. // // THIS FILE CONTAINS TWO VERSIONS OF THE NECESSARY CODE: // // With no special defines, this file will produce code for pure CLHEP // building -- no ZOOM Exceptions are involved. // // To force a build using ZOOM Exceptions where the ZMthrow macros appear, // compile with ENABLE_ZOOM_EXCEPTIONS defined. // // ---------------------------------------------------------------------- //#undef ENABLE_ZOOM_EXCEPTIONS // For CLHEP builds //#define ENABLE_ZOOM_EXCEPTIONS // For ZOOM builds // There should be some external way to control this. We haven't found it yet. // Right now, this must be changed by hand when going between CLHEP and ZOOM. #undef ENABLE_ZOOM_EXCEPTIONS // Member functions of the Vector classes are capable of ZMthrow-ing the // following ZMexception's: // // ZMxPhysicsVectors Severe Parent exception of all ZMexceptions // particular to classes in the package. // // ZMxpvInfiniteVector Error // Mathematical operation will lead // to infinity or NAN in a component // of a result vector. // ZMxpvZeroVector Error // A zero vector was used to specify // a direction based on vector.unit(). // ZMxpvTachyonic Error // A relativistic kinematic function was // taken, involving a vector representing // a speed at or beyond that of light (=1). // ZMxpvSpacelike Error // A spacelike 4-vector was used in a // context where its restMass or gamma // needs to be computed: The result is // formally imaginary (a zero result is // supplied). // ZMxpvInfinity Error // Mathematical operation will lead // to infinity as a Scalar result. // ZMxpvNegativeMass Error // Kinematic operation, e.g. invariant // mass, rendered meaningless by an input // with negative time component. // ZMxpvVectorInputFails Error // Input to a SpaceVector or Lorentz // Vector failed due to bad format or EOF. // ZMxpvParallelCols Error // Purportedly orthogonal col's supplied // to form a Rotation are exactly // parallel instead. // ZMxpvImproperRotation Error // Orthogonal col's supplied form a // refection (determinant -1) more // nearly than rather than a rotation. // ZMxpvImproperTransformation Error // Orthogonalized rows supplied form a // tachyonic boost, a reflection, or // a combination of those flaws, // more nearly than a proper Lorentz // transformation. // ZMxpvFixedAxis Error // Attempt to change a RotationX, // RotationY, or RotationZ in such a way // that the axis might no longer be X, // Y, or Z respectively. // ZMxpvIndexRange Error // When using the syntax of v(i) to get // a vector component, i is out of range. // ZMxpvNotOrthogonal Warning // Purportedly orthogonal col's supplied // to form a Rotation or LT are not // orthogonal within the tolerance. // ZMxpvNotSymplectic Warning // A row supplied to form a Lorentz // transformation has a value of restmass // incorrect by more than the tolerance: // It should be -1 for rows 1-3, // +1 for row 4. // ZMxpvAmbiguousAngle Warning // Method involves taking an angle against // a reference vector of zero length, or // phi in polar coordinates of a vector // along the Z axis. // ZMxpvNegativeR Warning // R of a supplied vector is negative. // The mathematical operation done is // still formally valid. // ZMxpvUnusualTheta Warning // Theta supplied to construct or set // a vector is outside the range [0,PI]. // The mathematical operation done is // still formally valid. But note that // when sin(theta) < 0, phi becomes an // angle against the -X axis. //______________________________________________________________________ #ifndef ENABLE_ZOOM_EXCEPTIONS // This is the CLHEP version. When compiled for CLHEP, the basic CLHEP // Vector classes will not (at least for now) depend on ZOOM Exceptions. // Though this header lists the various sorts of Exceptions that could be // thrown, ZMthrow.h in the pure CLHEP context will make ZMthrowC // do what CLHEP has always done: whine to cerr about the problem // and continue. // ZMthrowA will whine to cerr and throw an exception; by catching the // exception as a std::exception, the outside code can call e.what() to // find the message string. // // If CLHEP ever embraces the ZOOM Exceptions mechanism, we will simply // modify this file. #include #include #define ZMthrowA(A) do { std::cerr << A.name() << " thrown:\n" \ << A.what() << "\n" \ << "at line " << __LINE__ << " in file " << __FILE__ << "\n"; \ throw A;} while (0) #define ZMthrowC(A) do { std::cerr << A.name() << ":\n" \ << A.what() << "\n" \ << "at line " << __LINE__ << " in file " << __FILE__ << "\n"; \ } while (0) class CLHEP_vector_exception : public std::exception { public: CLHEP_vector_exception ( const std::string & s1 ) throw(); virtual const char* what() const throw(); virtual const char* name() const throw() = 0; virtual ~CLHEP_vector_exception() throw() {} private: std::string message; }; #define CLHEP_vector_exception_header(NAME) \ class NAME : public CLHEP_vector_exception { \ public: \ NAME ( const std::string & s ) throw(); \ virtual const char* name() const throw(); \ virtual ~NAME() throw() {} \ }; // The following exceptions might be encountered via ZMtrhowA CLHEP_vector_exception_header( ZMxPhysicsVectors ) CLHEP_vector_exception_header( ZMxpvSpacelike ) CLHEP_vector_exception_header( ZMxpvNegativeMass ) CLHEP_vector_exception_header( ZMxpvVectorInputFails ) CLHEP_vector_exception_header( ZMxpvIndexRange ) CLHEP_vector_exception_header( ZMxpvFixedAxis ) // The following are sometimes ZMthrowA and sometimes ZMthrowC CLHEP_vector_exception_header( ZMxpvTachyonic ) CLHEP_vector_exception_header( ZMxpvZeroVector ) CLHEP_vector_exception_header( ZMxpvImproperTransformation ) CLHEP_vector_exception_header( ZMxpvInfiniteVector ) CLHEP_vector_exception_header( ZMxpvInfinity ) CLHEP_vector_exception_header( ZMxpvImproperRotation ) CLHEP_vector_exception_header( ZMxpvAmbiguousAngle ) // THe following won't throw; they are encountered via ZMthrowC CLHEP_vector_exception_header( ZMxpvNegativeR ) CLHEP_vector_exception_header( ZMxpvUnusualTheta ) CLHEP_vector_exception_header( ZMxpvParallelCols ) CLHEP_vector_exception_header( ZMxpvNotOrthogonal ) CLHEP_vector_exception_header( ZMxpvNotSymplectic ) #endif // endif for ifndef ENABLE_ZOOM_EXCEPTIONS // ============================================================= // ============================================================= // ============================================================= #ifdef ENABLE_ZOOM_EXCEPTIONS // This is the ZOOM version. When compiled for ZOOM, even the basic CLHEP // Vector classes will depend on ZOOM Exceptions. // Though in the CLHEP context methods use ZMthrowA and ZMthrowC, these // in the ZOOM context become ZMthrow. // // Either this file or ZMxpvCLHEP.h is copied to become ZMxpv.h, depending // on whether this is a ZOOM or a CLHEP build. // #ifndef ZMEXCEPTIONS_H #include "Exceptions/ZMexception.h" #include "Exceptions/ZMthrow.h" #endif using namespace zmex; namespace zmpv { ZMexStandardDefinition (ZMexception, ZMxPhysicsVectors); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvInfiniteVector); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvZeroVector); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvTachyonic); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvSpacelike); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvInfinity); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvNegativeMass); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvAmbiguousAngle); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvNegativeR); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvUnusualTheta); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvVectorInputFails); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvParallelCols); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvImproperRotation); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvImproperTransformation); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvIndexRange); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvNotOrthogonal); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvNotSymplectic); ZMexStandardDefinition (ZMxPhysicsVectors, ZMxpvFixedAxis); #define ZMthrowA(A) ZMthrow(A) #define ZMthrowC(A) ZMthrow(A) } // namespace zmpv #endif // ENABLE_ZOOM_EXCEPTIONS #endif // HEP_ZMXPV_H clhep-2.1.4.1.orig/Vector/Vector/.cvsignore0000755000175000017500000000002607705452574017121 0ustar olesolesMakefile.in defs.h.in clhep-2.1.4.1.orig/Vector/Vector/RotationY.h0000755000175000017500000002104712050774211017210 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definition of the HepRotationY class for performing rotations // around the X axis on objects of the Hep3Vector (and HepLorentzVector) class. // // HepRotationY is a concrete implementation of Hep3RotationInterface. // // .SS See Also // RotationInterfaces.h // ThreeVector.h, LorentzVector.h, LorentzRotation.h // // .SS Author // Mark Fischler #ifndef HEP_ROTATIONY_H #define HEP_ROTATIONY_H #ifdef GNUPRAGMA #pragma interface #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/RotationInterfaces.h" namespace CLHEP { class HepRotationY; class HepRotation; class HepBoost; inline HepRotationY inverseOf(const HepRotationY & r); // Returns the inverse of a RotationY. /** * @author * @ingroup vector */ class HepRotationY { public: // ---------- Constructors and Assignment: inline HepRotationY(); // Default constructor. Gives an identity rotation. HepRotationY(double delta); // supply angle of rotation inline HepRotationY(const HepRotationY & orig); // Copy constructor. inline HepRotationY & operator = (const HepRotationY & r); // Assignment from a Rotation, which must be RotationY HepRotationY & set ( double delta ); // set angle of rotation inline ~HepRotationY(); // Trivial destructor. // ---------- Accessors: inline Hep3Vector colX() const; inline Hep3Vector colY() const; inline Hep3Vector colZ() const; // orthogonal unit-length column vectors inline Hep3Vector rowX() const; inline Hep3Vector rowY() const; inline Hep3Vector rowZ() const; // orthogonal unit-length row vectors inline double xx() const; inline double xy() const; inline double xz() const; inline double yx() const; inline double yy() const; inline double yz() const; inline double zx() const; inline double zy() const; inline double zz() const; // Elements of the rotation matrix (Geant4). inline HepRep3x3 rep3x3() const; // 3x3 representation: // ------------ Euler angles: inline double getPhi () const; inline double getTheta() const; inline double getPsi () const; double phi () const; double theta() const; double psi () const; HepEulerAngles eulerAngles() const; // ------------ axis & angle of rotation: inline double getDelta() const; inline Hep3Vector getAxis () const; inline double delta() const; inline Hep3Vector axis () const; inline HepAxisAngle axisAngle() const; inline void getAngleAxis(double & delta, Hep3Vector & axis) const; // Returns the rotation angle and rotation axis (Geant4). // ------------- Angles of rotated axes double phiX() const; double phiY() const; double phiZ() const; double thetaX() const; double thetaY() const; double thetaZ() const; // Return angles (RADS) made by rotated axes against original axes (Geant4). // ---------- Other accessors treating pure rotation as a 4-rotation inline HepLorentzVector col1() const; inline HepLorentzVector col2() const; inline HepLorentzVector col3() const; // orthosymplectic 4-vector columns - T component will be zero inline HepLorentzVector col4() const; // Will be (0,0,0,1) for this pure Rotation. inline HepLorentzVector row1() const; inline HepLorentzVector row2() const; inline HepLorentzVector row3() const; // orthosymplectic 4-vector rows - T component will be zero inline HepLorentzVector row4() const; // Will be (0,0,0,1) for this pure Rotation. inline double xt() const; inline double yt() const; inline double zt() const; inline double tx() const; inline double ty() const; inline double tz() const; // Will be zero for this pure Rotation inline double tt() const; // Will be one for this pure Rotation inline HepRep4x4 rep4x4() const; // 4x4 representation. // --------- Mutators void setDelta (double delta); // change angle of rotation, leaving rotation axis unchanged. // ---------- Decomposition: void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const; void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const; void decompose (HepRotation & rotation, HepBoost & boost) const; void decompose (HepBoost & boost, HepRotation & rotation) const; // These are trivial, as the boost vector is 0. // ---------- Comparisons: inline bool isIdentity() const; // Returns true if the identity matrix (Geant4). inline int compare( const HepRotationY & r ) const; // Dictionary-order comparison, in order of delta // Used in operator<, >, <=, >= inline bool operator== ( const HepRotationY & r ) const; inline bool operator!= ( const HepRotationY & r ) const; inline bool operator< ( const HepRotationY & r ) const; inline bool operator> ( const HepRotationY & r ) const; inline bool operator<= ( const HepRotationY & r ) const; inline bool operator>= ( const HepRotationY & r ) const; double distance2( const HepRotationY & r ) const; // 3 - Tr ( this/r ) double distance2( const HepRotation & r ) const; // 3 - Tr ( this/r ) -- This works with RotationY or Z also double howNear( const HepRotationY & r ) const; double howNear( const HepRotation & r ) const; bool isNear( const HepRotationY & r, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepRotation & r, double epsilon=Hep4RotationInterface::tolerance) const; double distance2( const HepBoost & lt ) const; // 3 - Tr ( this ) + |b|^2 / (1-|b|^2) double distance2( const HepLorentzRotation & lt ) const; // 3 - Tr ( this/r ) + |b|^2 / (1-|b|^2) where b is the boost vector of lt double howNear( const HepBoost & lt ) const; double howNear( const HepLorentzRotation & lt ) const; bool isNear( const HepBoost & lt, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepLorentzRotation & lt, double epsilon=Hep4RotationInterface::tolerance) const; // ---------- Properties: double norm2() const; // distance2 (IDENTITY), which is 3 - Tr ( *this ) inline void rectify(); // non-const but logically moot correction for accumulated roundoff errors // ---------- Application: inline Hep3Vector operator() (const Hep3Vector & p) const; // Rotate a Hep3Vector. inline Hep3Vector operator * (const Hep3Vector & p) const; // Multiplication with a Hep3Vector. inline HepLorentzVector operator()( const HepLorentzVector & w ) const; // Rotate (the space part of) a HepLorentzVector. inline HepLorentzVector operator* ( const HepLorentzVector & w ) const; // Multiplication with a HepLorentzVector. // ---------- Operations in the group of Rotations inline HepRotationY operator * (const HepRotationY & ry) const; // Product of two Y rotations (this) * ry is known to be RotationY. inline HepRotationY & operator *= (const HepRotationY & r); inline HepRotationY & transform (const HepRotationY & r); // Matrix multiplication. // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a; // However, in this special case, they commute: Both just add deltas. inline HepRotationY inverse() const; // Returns the inverse. friend HepRotationY inverseOf(const HepRotationY & r); // Returns the inverse of a RotationY. inline HepRotationY & invert(); // Inverts the Rotation matrix (be negating delta). // ---------- I/O: std::ostream & print( std::ostream & os ) const; // Output, identifying type of rotation and delta. // ---------- Tolerance static inline double getTolerance(); static inline double setTolerance(double tol); protected: double its_d; // The angle of rotation. double its_s; double its_c; // Cache the trig functions, for rapid operations. inline HepRotationY ( double dd, double ss, double cc ); // Unchecked load-the-data-members static inline double proper (double delta); // Put an angle into the range of (-PI, PI]. Useful helper method. }; // HepRotationY // ---------- Free-function operations in the group of Rotations inline std::ostream & operator << ( std::ostream & os, const HepRotationY & r ) {return r.print(os);} } // namespace CLHEP #include "CLHEP/Vector/RotationY.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_ROTATIONY_H */ clhep-2.1.4.1.orig/Vector/Vector/LorentzRotation.h0000755000175000017500000003510107746044120020436 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // $Id: LorentzRotation.h,v 1.3 2003/10/23 21:29:52 garren Exp $ // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definition of the HepLorentzRotation class for performing // Lorentz transformations (rotations and boosts) on objects of the // HepLorentzVector class. // // HepLorentzRotation is a concrete implementation of Hep4RotationInterface. // // .SS See Also // RotationInterfaces.h // ThreeVector.h, LorentzVector.h // Rotation.h, Boost.h // // .SS Author // Leif Lonnblad, Mark Fischler #ifndef HEP_LORENTZROTATION_H #define HEP_LORENTZROTATION_H #ifdef GNUPRAGMA #pragma interface #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/RotationInterfaces.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Vector/Boost.h" #include "CLHEP/Vector/LorentzVector.h" namespace CLHEP { // Global methods inline HepLorentzRotation inverseOf ( const HepLorentzRotation & lt ); HepLorentzRotation operator * (const HepRotation & r, const HepLorentzRotation & lt); HepLorentzRotation operator * (const HepRotationX & r, const HepLorentzRotation & lt); HepLorentzRotation operator * (const HepRotationY & r, const HepLorentzRotation & lt); HepLorentzRotation operator * (const HepRotationZ & r, const HepLorentzRotation & lt); /** * @author * @ingroup vector */ class HepLorentzRotation { public: // ---------- Identity HepLorentzRotation: static const HepLorentzRotation IDENTITY; // ---------- Constructors and Assignment: inline HepLorentzRotation(); // Default constructor. Gives a unit matrix. inline HepLorentzRotation (const HepLorentzRotation & r); // Copy constructor. inline HepLorentzRotation (const HepRotation & r); inline explicit HepLorentzRotation (const HepRotationX & r); inline explicit HepLorentzRotation (const HepRotationY & r); inline explicit HepLorentzRotation (const HepRotationZ & r); inline HepLorentzRotation (const HepBoost & b); inline explicit HepLorentzRotation (const HepBoostX & b); inline explicit HepLorentzRotation (const HepBoostY & b); inline explicit HepLorentzRotation (const HepBoostZ & b); // Constructors from special cases. inline HepLorentzRotation & operator = (const HepLorentzRotation & m); inline HepLorentzRotation & operator = (const HepRotation & m); inline HepLorentzRotation & operator = (const HepBoost & m); // Assignment. HepLorentzRotation & set (double bx, double by, double bz); inline HepLorentzRotation & set (const Hep3Vector & p); inline HepLorentzRotation & set (const HepRotation & r); inline HepLorentzRotation & set (const HepRotationX & r); inline HepLorentzRotation & set (const HepRotationY & r); inline HepLorentzRotation & set (const HepRotationZ & r); inline HepLorentzRotation & set (const HepBoost & boost); inline HepLorentzRotation & set (const HepBoostX & boost); inline HepLorentzRotation & set (const HepBoostY & boost); inline HepLorentzRotation & set (const HepBoostZ & boost); inline HepLorentzRotation (double bx, double by, double bz); inline HepLorentzRotation (const Hep3Vector & p); // Other Constructors giving a Lorentz-boost. HepLorentzRotation & set( const HepBoost & B, const HepRotation & R ); inline HepLorentzRotation ( const HepBoost & B, const HepRotation & R ); // supply B and R: T = B R: HepLorentzRotation & set( const HepRotation & R, const HepBoost & B ); inline HepLorentzRotation ( const HepRotation & R, const HepBoost & B ); // supply R and B: T = R B: HepLorentzRotation ( const HepLorentzVector & col1, const HepLorentzVector & col2, const HepLorentzVector & col3, const HepLorentzVector & col4 ); // Construct from four *orthosymplectic* LorentzVectors for the columns: // NOTE: // This constructor, and the two set methods below, // will check that the columns (or rows) form an orthosymplectic // matrix, and will adjust values so that this relation is // as exact as possible. // Orthosymplectic means the dot product USING THE METRIC // of two different coumns will be 0, and of a column with // itself will be one. HepLorentzRotation & set( const HepLorentzVector & col1, const HepLorentzVector & col2, const HepLorentzVector & col3, const HepLorentzVector & col4 ); // supply four *orthosymplectic* HepLorentzVectors for the columns HepLorentzRotation & setRows( const HepLorentzVector & row1, const HepLorentzVector & row2, const HepLorentzVector & row3, const HepLorentzVector & row4 ); // supply four *orthosymplectic* HepLorentzVectors for the columns inline HepLorentzRotation & set( const HepRep4x4 & rep ); inline HepLorentzRotation ( const HepRep4x4 & rep ); // supply a HepRep4x4 structure (16 numbers) // WARNING: // This constructor and set method will assume the // HepRep4x4 supplied is in fact an orthosymplectic matrix. // No checking or correction is done. If you are // not certain the matrix is orthosymplectic, break it // into four HepLorentzVector columns and use the form // HepLorentzRotation (col1, col2, col3, col4) // ---------- Accessors: inline double xx() const; inline double xy() const; inline double xz() const; inline double xt() const; inline double yx() const; inline double yy() const; inline double yz() const; inline double yt() const; inline double zx() const; inline double zy() const; inline double zz() const; inline double zt() const; inline double tx() const; inline double ty() const; inline double tz() const; inline double tt() const; // Elements of the matrix. inline HepLorentzVector col1() const; inline HepLorentzVector col2() const; inline HepLorentzVector col3() const; inline HepLorentzVector col4() const; // orthosymplectic column vectors inline HepLorentzVector row1() const; inline HepLorentzVector row2() const; inline HepLorentzVector row3() const; inline HepLorentzVector row4() const; // orthosymplectic row vectors inline HepRep4x4 rep4x4() const; // 4x4 representation: // ------------ Subscripting: class HepLorentzRotation_row { public: inline HepLorentzRotation_row(const HepLorentzRotation &, int); inline double operator [] (int) const; private: const HepLorentzRotation & rr; int ii; }; // Helper class for implemention of C-style subscripting r[i][j] inline const HepLorentzRotation_row operator [] (int) const; // Returns object of the helper class for C-style subscripting r[i][j] double operator () (int, int) const; // Fortran-style subscripting: returns (i,j) element of the matrix. // ---------- Decomposition: void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const; void decompose (HepBoost & boost, HepRotation & rotation) const; // Find B and R such that L = B*R void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const; void decompose (HepRotation & rotation, HepBoost & boost) const; // Find R and B such that L = R*B // ---------- Comparisons: int compare( const HepLorentzRotation & m ) const; // Dictionary-order comparison, in order tt,tz,...zt,zz,zy,zx,yt,yz,...,xx // Used in operator<, >, <=, >= inline bool operator == (const HepLorentzRotation &) const; inline bool operator != (const HepLorentzRotation &) const; inline bool operator <= (const HepLorentzRotation &) const; inline bool operator >= (const HepLorentzRotation &) const; inline bool operator < (const HepLorentzRotation &) const; inline bool operator > (const HepLorentzRotation &) const; inline bool isIdentity() const; // Returns true if the Identity matrix. double distance2( const HepBoost & b ) const; double distance2( const HepRotation & r ) const; double distance2( const HepLorentzRotation & lt ) const; // Decomposes L = B*R, returns the sum of distance2 for B and R. double howNear( const HepBoost & b ) const; double howNear( const HepRotation & r) const; double howNear( const HepLorentzRotation & lt ) const; bool isNear(const HepBoost & b, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear(const HepRotation & r, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear(const HepLorentzRotation & lt, double epsilon=Hep4RotationInterface::tolerance) const; // ---------- Properties: double norm2() const; // distance2 (IDENTITY), which involves decomposing into B and R and summing // norm2 for the individual B and R parts. void rectify(); // non-const but logically moot correction for accumulated roundoff errors // rectify averages the matrix with the orthotranspose of its actual // inverse (absent accumulated roundoff errors, the orthotranspose IS // the inverse)); this removes to first order those errors. // Then it formally decomposes that, extracts axis and delta for its // Rotation part, forms a LorentzRotation from a true HepRotation // with those values of axis and delta, times the true Boost // with that boost vector. // ---------- Application: inline HepLorentzVector vectorMultiplication(const HepLorentzVector&) const; inline HepLorentzVector operator()( const HepLorentzVector & w ) const; inline HepLorentzVector operator* ( const HepLorentzVector & p ) const; // Multiplication with a Lorentz Vector. // ---------- Operations in the group of 4-Rotations HepLorentzRotation matrixMultiplication(const HepRep4x4 & m) const; inline HepLorentzRotation operator * (const HepBoost & b) const; inline HepLorentzRotation operator * (const HepRotation & r) const; inline HepLorentzRotation operator * (const HepLorentzRotation & lt) const; // Product of two Lorentz Rotations (this) * lt - matrix multiplication inline HepLorentzRotation & operator *= (const HepBoost & b); inline HepLorentzRotation & operator *= (const HepRotation & r); inline HepLorentzRotation & operator *= (const HepLorentzRotation & lt); inline HepLorentzRotation & transform (const HepBoost & b); inline HepLorentzRotation & transform (const HepRotation & r); inline HepLorentzRotation & transform (const HepLorentzRotation & lt); // Matrix multiplication. // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a; // Here there is an opportunity for speedup by providing specialized forms // of lt * r and lt * b where r is a RotationX Y or Z or b is a BoostX Y or Z // These are, in fact, provided below for the transform() methods. HepLorentzRotation & rotateX(double delta); // Rotation around the x-axis; equivalent to LT = RotationX(delta) * LT HepLorentzRotation & rotateY(double delta); // Rotation around the y-axis; equivalent to LT = RotationY(delta) * LT HepLorentzRotation & rotateZ(double delta); // Rotation around the z-axis; equivalent to LT = RotationZ(delta) * LT inline HepLorentzRotation & rotate(double delta, const Hep3Vector& axis); inline HepLorentzRotation & rotate(double delta, const Hep3Vector *axis); // Rotation around specified vector - LT = Rotation(delta,axis)*LT HepLorentzRotation & boostX(double beta); // Pure boost along the x-axis; equivalent to LT = BoostX(beta) * LT HepLorentzRotation & boostY(double beta); // Pure boost along the y-axis; equivalent to LT = BoostX(beta) * LT HepLorentzRotation & boostZ(double beta); // Pure boost along the z-axis; equivalent to LT = BoostX(beta) * LT inline HepLorentzRotation & boost(double, double, double); inline HepLorentzRotation & boost(const Hep3Vector &); // Lorenz boost. inline HepLorentzRotation inverse() const; // Return the inverse. inline HepLorentzRotation & invert(); // Inverts the LorentzRotation matrix. // ---------- I/O: std::ostream & print( std::ostream & os ) const; // Aligned six-digit-accurate output of the transformation matrix. // ---------- Tolerance static inline double getTolerance(); static inline double setTolerance(double tol); friend HepLorentzRotation inverseOf ( const HepLorentzRotation & lt ); protected: inline HepLorentzRotation (double mxx, double mxy, double mxz, double mxt, double myx, double myy, double myz, double myt, double mzx, double mzy, double mzz, double mzt, double mtx, double mty, double mtz, double mtt); // Protected constructor. // DOES NOT CHECK FOR VALIDITY AS A LORENTZ TRANSFORMATION. inline void setBoost(double, double, double); // Set elements according to a boost vector. double mxx, mxy, mxz, mxt, myx, myy, myz, myt, mzx, mzy, mzz, mzt, mtx, mty, mtz, mtt; // The matrix elements. }; // HepLorentzRotation inline std::ostream & operator<< ( std::ostream & os, const HepLorentzRotation& lt ) {return lt.print(os);} inline bool operator==(const HepRotation &r, const HepLorentzRotation & lt) { return lt==r; } inline bool operator!=(const HepRotation &r, const HepLorentzRotation & lt) { return lt!=r; } inline bool operator<=(const HepRotation &r, const HepLorentzRotation & lt) { return lt<=r; } inline bool operator>=(const HepRotation &r, const HepLorentzRotation & lt) { return lt>=r; } inline bool operator<(const HepRotation &r, const HepLorentzRotation & lt) { return lt(const HepRotation &r, const HepLorentzRotation & lt) { return lt>r; } inline bool operator==(const HepBoost &b, const HepLorentzRotation & lt) { return lt==b; } inline bool operator!=(const HepBoost &b, const HepLorentzRotation & lt) { return lt!=b; } inline bool operator<=(const HepBoost &b, const HepLorentzRotation & lt) { return lt<=b; } inline bool operator>=(const HepBoost &b, const HepLorentzRotation & lt) { return lt>=b; } inline bool operator<(const HepBoost &b, const HepLorentzRotation & lt) { return lt(const HepBoost &b, const HepLorentzRotation & lt) { return lt>b; } } // namespace CLHEP #include "CLHEP/Vector/LorentzRotation.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_LORENTZROTATION_H */ clhep-2.1.4.1.orig/Vector/Vector/AxisAngle.icc0000755000175000017500000000566511712321422017446 0ustar olesoles#ifndef AXISANGLE_ICC #error "AxisAngle.icc included without AxisAngle.h" #endif // ---------------------------------------------------------------------- // // AxisAngle.icc // // History: // 23-Jan-1998 WEB Initial draft // 12-Mar-1998 WEB Gave default constructor proper default values // 13-Mar-1998 WEB Corrected setDelta; simplified compare() // 17-Jun-1998 WEB Added namespace support // 26-Jul-2000 MF CLHEP version // // ---------------------------------------------------------------------- namespace CLHEP { inline HepAxisAngle::HepAxisAngle() : axis_( Hep3Vector(0,0,1) ), delta_( 0.0 ) {} // HepAxisAngle::HepAxisAngle() inline HepAxisAngle::HepAxisAngle( const Hep3Vector aaxis, Scalar ddelta ) : axis_( aaxis.unit() ), delta_( ddelta ) {} // HepAxisAngle::HepAxisAngle() inline Hep3Vector HepAxisAngle::getAxis() const { return axis_; } // HepAxisAngle::getAxis() inline Hep3Vector HepAxisAngle::axis() const { return axis_; } // HepAxisAngle::axis() inline HepAxisAngle & HepAxisAngle::setAxis( const Hep3Vector aaxis ) { axis_ = aaxis.unit(); return *this; } // HepAxisAngle::setAxis() inline double HepAxisAngle::getDelta() const { return delta_; } // HepAxisAngle::getDelta() inline double HepAxisAngle::delta() const { return delta_; } // HepAxisAngle::delta() inline HepAxisAngle & HepAxisAngle::setDelta( Scalar ddelta ) { delta_ = ddelta; return *this; } // HepAxisAngle::setDelta() inline HepAxisAngle & HepAxisAngle::set( const Hep3Vector aaxis, Scalar ddelta ) { axis_ = aaxis.unit(); delta_ = ddelta; return *this; } // HepAxisAngle::set() inline int HepAxisAngle::compare( const AA & aa ) const { return delta_ < aa.delta_ ? -1 : delta_ > aa.delta_ ? +1 : axis_ < aa.axis_ ? -1 : axis_ > aa.axis_ ? +1 : 0; } // HepAxisAngle::compare() inline bool HepAxisAngle::operator==( const AA & aa ) const { return ( compare( aa ) == 0 ); } // HepAxisAngle::operator==() inline bool HepAxisAngle::operator!=( const AA & aa ) const { return ( compare( aa ) != 0 ); } // HepAxisAngle::operator!=() inline bool HepAxisAngle::operator<( const AA & aa ) const { return ( compare( aa ) < 0 ); } // HepAxisAngle::operator<() inline bool HepAxisAngle::operator<=( const AA & aa ) const { return ( compare( aa ) <= 0 ); } // HepAxisAngle::operator<=() inline bool HepAxisAngle::operator>( const AA & aa ) const { return ( compare( aa ) > 0 ); } // HepAxisAngle::operator>() inline bool HepAxisAngle::operator>=( const AA & aa ) const { return ( compare( aa ) >= 0 ); } // HepAxisAngle::operator>=() inline double HepAxisAngle::getTolerance() { return tolerance; } // HepAxisAngle::getTolerance() inline double HepAxisAngle::setTolerance( Scalar tol ) { Scalar oldTolerance( tolerance ); tolerance = tol; return oldTolerance; } // HepAxisAngle::setTolerance() } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/BoostZ.h0000755000175000017500000001514507746044120016507 0ustar olesoles// -*- C++ -*- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definition of the HepBoostZ class for performing specialized // Lorentz transformations which are pure boosts in the Z direction, on // objects of the HepLorentzVector class. // // HepLorentzRotation is a concrete implementation of Hep4RotationInterface. // // .SS See Also // RotationInterfaces.h // LorentzVector.h LorentzRotation.h // Boost.h // // .SS Author // Mark Fischler #ifndef HEP_BOOSTZ_H #define HEP_BOOSTZ_H #ifdef GNUPRAGMA #pragma interface #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/RotationInterfaces.h" #include "CLHEP/Vector/LorentzVector.h" namespace CLHEP { // Declarations of classes and global methods class HepBoostZ; inline HepBoostZ inverseOf ( const HepBoostZ & b ); class HepBoost; class HepRotation; /** * @author * @ingroup vector */ class HepBoostZ { public: // ---------- Constructors and Assignment: inline HepBoostZ(); // Default constructor. Gives a boost of 0. inline HepBoostZ(const HepBoostZ & b); // Copy constructor. inline HepBoostZ & operator = (const HepBoostZ & m); // Assignment. HepBoostZ & set (double beta); inline HepBoostZ (double beta); // Constructor from beta // ---------- Accessors: inline double beta() const; inline double gamma() const; inline Hep3Vector boostVector() const; inline Hep3Vector getDirection() const; inline double xx() const; inline double xy() const; inline double xz() const; inline double xt() const; inline double yx() const; inline double yy() const; inline double yz() const; inline double yt() const; inline double zx() const; inline double zy() const; inline double zz() const; inline double zt() const; inline double tx() const; inline double ty() const; inline double tz() const; inline double tt() const; // Elements of the matrix. inline HepLorentzVector col1() const; inline HepLorentzVector col2() const; inline HepLorentzVector col3() const; inline HepLorentzVector col4() const; // orthosymplectic column vectors inline HepLorentzVector row1() const; inline HepLorentzVector row2() const; inline HepLorentzVector row3() const; inline HepLorentzVector row4() const; // orthosymplectic row vectors HepRep4x4 rep4x4() const; // 4x4 representation: HepRep4x4Symmetric rep4x4Symmetric() const; // Symmetric 4x4 representation. // ---------- Decomposition: void decompose (HepRotation & rotation, HepBoost & boost) const; void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const; // Find R and B such that L = R*B -- trivial, since R is identity void decompose (HepBoost & boost, HepRotation & rotation) const; void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const; // Find R and B such that L = B*R -- trivial, since R is identity // ---------- Comparisons: inline int compare( const HepBoostZ & b ) const; // Dictionary-order comparison, in order of beta. // Used in operator<, >, <=, >= inline bool operator == (const HepBoostZ & b) const; inline bool operator != (const HepBoostZ & b) const; inline bool operator <= (const HepBoostZ & b) const; inline bool operator >= (const HepBoostZ & b) const; inline bool operator < (const HepBoostZ & b) const; inline bool operator > (const HepBoostZ & b) const; // Comparisons. inline bool isIdentity() const; // Returns true if a null boost. inline double distance2( const HepBoostZ & b ) const; double distance2( const HepBoost & b ) const; // Defined as the distance2 between the vectors (gamma*betaVector) double distance2( const HepRotation & r ) const; double distance2( const HepLorentzRotation & lt ) const; // Decompose lt = B*R; add norm2 to distance2 to between boosts. inline double howNear( const HepBoostZ & b ) const; inline double howNear( const HepBoost & b ) const; inline double howNear( const HepRotation & r ) const; inline double howNear( const HepLorentzRotation & lt ) const; inline bool isNear( const HepBoostZ & b, double epsilon=Hep4RotationInterface::tolerance) const; inline bool isNear( const HepBoost & b, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepRotation & r, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepLorentzRotation & lt, double epsilon=Hep4RotationInterface::tolerance) const; // ---------- Properties: inline double norm2() const; // distance2 (IDENTITY), which is beta^2 * gamma^2 void rectify(); // sets according to the stored beta // ---------- Application: inline HepLorentzVector operator()( const HepLorentzVector & w ) const; // Transform a Lorentz Vector. inline HepLorentzVector operator* ( const HepLorentzVector & w ) const; // Multiplication with a Lorentz Vector. // ---------- Operations in the group of 4-Rotations HepBoostZ operator * (const HepBoostZ & b) const; HepLorentzRotation operator * (const HepBoost & b) const; HepLorentzRotation operator * (const HepRotation & r) const; HepLorentzRotation operator * (const HepLorentzRotation & lt) const; // Product of two Lorentz Rotations (this) * lt - matrix multiplication // Notice that the product of two pure boosts in different directions // is no longer a pure boost. inline HepBoostZ inverse() const; // Return the inverse. inline friend HepBoostZ inverseOf ( const HepBoostZ & b ); // global methods to invert. inline HepBoostZ & invert(); // Inverts the Boost matrix. // ---------- I/O: std::ostream & print( std::ostream & os ) const; // Output form is BOOSTZ (beta=..., gamma=...); // ---------- Tolerance static inline double getTolerance(); static inline double setTolerance(double tol); protected: inline HepLorentzVector vectorMultiplication ( const HepLorentzVector & w ) const; // Multiplication with a Lorentz Vector. HepLorentzRotation matrixMultiplication (const HepRep4x4 & m) const; HepLorentzRotation matrixMultiplication (const HepRep4x4Symmetric & m) const; inline HepBoostZ (double beta, double gamma); double beta_; double gamma_; }; // HepBoostZ inline std::ostream & operator << ( std::ostream & os, const HepBoostZ& b ) {return b.print(os);} } // namespace CLHEP #include "CLHEP/Vector/BoostZ.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_BOOSTZ_H */ clhep-2.1.4.1.orig/Vector/Vector/BoostX.icc0000755000175000017500000001260211712321422016776 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definitions of the inline member functions of the // HepBoostX class // #include namespace CLHEP { // ---------- Constructors and Assignment: inline HepBoostX::HepBoostX() : beta_(0.0), gamma_(1.0) {} inline HepBoostX::HepBoostX(const HepBoostX & b) : beta_ (b.beta_), gamma_(b.gamma_) {} inline HepBoostX & HepBoostX::operator = (const HepBoostX & b) { beta_ = b.beta_; gamma_ = b.gamma_; return *this; } inline HepBoostX::HepBoostX(double bbeta) { set(bbeta); } // - Protected method: inline HepBoostX::HepBoostX( double bbeta, double ggamma ) : beta_(bbeta), gamma_(ggamma) {} // ---------- Accessors: inline double HepBoostX::beta() const { return beta_; } inline double HepBoostX::gamma() const { return gamma_; } inline Hep3Vector HepBoostX::boostVector() const { return Hep3Vector( beta_, 0, 0 ); } inline Hep3Vector HepBoostX::getDirection() const { return Hep3Vector(1.0, 0.0, 0.0); } inline double HepBoostX::xx() const { return gamma();} inline double HepBoostX::xy() const { return 0.0;} inline double HepBoostX::xz() const { return 0.0;} inline double HepBoostX::xt() const { return beta()*gamma();} inline double HepBoostX::yx() const { return 0.0;} inline double HepBoostX::yy() const { return 1.0;} inline double HepBoostX::yz() const { return 0.0;} inline double HepBoostX::yt() const { return 0.0;} inline double HepBoostX::zx() const { return 0.0;} inline double HepBoostX::zy() const { return 0.0;} inline double HepBoostX::zz() const { return 1.0;} inline double HepBoostX::zt() const { return 0.0;} inline double HepBoostX::tx() const { return beta()*gamma();} inline double HepBoostX::ty() const { return 0.0;} inline double HepBoostX::tz() const { return 0.0;} inline double HepBoostX::tt() const { return gamma();} inline HepLorentzVector HepBoostX::col1() const { return HepLorentzVector ( gamma(), 0, 0, beta()*gamma() ); } inline HepLorentzVector HepBoostX::col2() const { return HepLorentzVector ( 0, 1, 0, 0 ); } inline HepLorentzVector HepBoostX::col3() const { return HepLorentzVector ( 0, 0, 1, 0 ); } inline HepLorentzVector HepBoostX::col4() const { return HepLorentzVector ( beta()*gamma(), 0, 0, gamma() ); } inline HepLorentzVector HepBoostX::row1() const { return HepLorentzVector ( col1() ); } inline HepLorentzVector HepBoostX::row2() const { return HepLorentzVector ( col2() ); } inline HepLorentzVector HepBoostX::row3() const { return HepLorentzVector ( col3() ); } inline HepLorentzVector HepBoostX::row4() const { return HepLorentzVector ( col4() ); } // ---------- Comparisons: inline int HepBoostX::compare( const HepBoostX & b ) const { if (beta() < b.beta()) { return -1; } else if (beta() > b.beta()) { return 1; } else { return 0; } } inline bool HepBoostX::operator == ( const HepBoostX & b ) const { return beta_ == b.beta_; } inline bool HepBoostX::operator != ( const HepBoostX & b ) const { return beta_ != b.beta_; } inline bool HepBoostX::operator <= ( const HepBoostX & b ) const { return beta_ <= b.beta_; } inline bool HepBoostX::operator >= ( const HepBoostX & b ) const { return beta_ >= b.beta_; } inline bool HepBoostX::operator < ( const HepBoostX & b ) const { return beta_ < b.beta_; } inline bool HepBoostX::operator > ( const HepBoostX & b ) const { return beta_ > b.beta_; } inline bool HepBoostX::isIdentity() const { return ( beta() == 0 ); } inline double HepBoostX::distance2( const HepBoostX & b ) const { double d = beta()*gamma() - b.beta()*b.gamma(); return d*d; } inline double HepBoostX::howNear(const HepBoostX & b) const { return std::sqrt(distance2(b)); } inline double HepBoostX::howNear(const HepBoost & b) const { return std::sqrt(distance2(b)); } inline double HepBoostX::howNear(const HepRotation & r) const { return std::sqrt(distance2(r)); } inline double HepBoostX::howNear(const HepLorentzRotation & lt) const { return std::sqrt(distance2(lt)); } inline bool HepBoostX::isNear(const HepBoostX & b, double epsilon) const { return (distance2(b) <= epsilon*epsilon); } inline bool HepBoostX::isNear(const HepBoost & b, double epsilon) const { return (distance2(b) <= epsilon*epsilon); } // ---------- Properties: inline double HepBoostX::norm2() const { register double bg = beta_*gamma_; return bg*bg; } // ---------- Application: inline HepLorentzVector HepBoostX::operator * (const HepLorentzVector & p) const { double bg = beta_*gamma_; return HepLorentzVector(gamma_*p.x() + bg*p.t(), p.y(), p.z(), gamma_*p.t() + bg*p.x()); } inline HepLorentzVector HepBoostX::operator() (const HepLorentzVector & w) const { return operator*(w); } // ---------- Operations in the group of 4-Rotations inline HepBoostX HepBoostX::inverse() const { return HepBoostX( -beta(), gamma() ); } inline HepBoostX inverseOf ( const HepBoostX & b ) { return HepBoostX( -b.beta(), b.gamma()); } inline HepBoostX & HepBoostX::invert() { beta_ = -beta_; return *this; } // ---------- Tolerance: inline double HepBoostX::getTolerance() { return Hep4RotationInterface::tolerance; } inline double HepBoostX::setTolerance(double tol) { return Hep4RotationInterface::setTolerance(tol); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/Vector/CMakeLists.txt0000644000175000017500000000124111606714767017656 0ustar olesoles set( pkginclude_HEADERS AxisAngle.h AxisAngle.icc Boost.h Boost.icc BoostX.h BoostX.icc BoostY.h BoostY.icc BoostZ.h BoostZ.icc EulerAngles.h EulerAngles.icc LorentzRotation.h LorentzRotation.icc LorentzVector.h LorentzVector.icc Rotation.h Rotation.icc RotationInterfaces.h RotationInterfaces.icc RotationX.h RotationX.icc RotationY.h RotationY.icc RotationZ.h RotationZ.icc Sqr.h ThreeVector.h ThreeVector.icc TwoVector.h TwoVector.icc ZMxpv.h ) # notice that defs.h is not referenced here INSTALL (FILES ${pkginclude_HEADERS} DESTINATION include/CLHEP/Vector ) clhep-2.1.4.1.orig/Vector/Vector/TwoVector.h0000755000175000017500000001354411761714041017222 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // Hep2Vector is a general 2-vector class defining vectors in two // dimension using double components. It comes from the ZOOM // PlaneVector class (the PhysicsVectors PlaneVector.h will typedef // PlaneVector to Hep2Vector). // // .SS See Also // ThreeVector.h // // .SS Authors // John Marraffino and Mark Fischler // #ifndef HEP_TWOVECTOR_H #define HEP_TWOVECTOR_H #ifdef GNUPRAGMA #pragma interface #endif #include #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/ThreeVector.h" namespace CLHEP { // Declarations of classes and global methods class Hep2Vector; std::ostream & operator << (std::ostream &, const Hep2Vector &); std::istream & operator >> (std::istream &, Hep2Vector &); inline double operator * (const Hep2Vector & a,const Hep2Vector & b); inline Hep2Vector operator * (const Hep2Vector & p, double a); inline Hep2Vector operator * (double a, const Hep2Vector & p); Hep2Vector operator / (const Hep2Vector & p, double a); inline Hep2Vector operator + (const Hep2Vector & a, const Hep2Vector & b); inline Hep2Vector operator - (const Hep2Vector & a, const Hep2Vector & b); /** * @author * @ingroup vector */ class Hep2Vector { public: enum { X=0, Y=1, NUM_COORDINATES=2, SIZE=NUM_COORDINATES }; // Safe indexing of the coordinates when using with matrices, arrays, etc. inline Hep2Vector( double x = 0.0, double y = 0.0 ); // The constructor. inline Hep2Vector(const Hep2Vector & p); // The copy constructor. explicit Hep2Vector( const Hep3Vector & ); // "demotion" constructor" // WARNING -- THIS IGNORES THE Z COMPONENT OF THE Hep3Vector. // SO IN GENERAL, Hep2Vector(v)==v WILL NOT HOLD! inline ~Hep2Vector(); // The destructor. inline double x() const; inline double y() const; // The components in cartesian coordinate system. double operator () (int i) const; inline double operator [] (int i) const; // Get components by index. 0-based. double & operator () (int i); inline double & operator [] (int i); // Set components by index. 0-based. inline void setX(double x); inline void setY(double y); inline void set (double x, double y); // Set the components in cartesian coordinate system. inline double phi() const; // The azimuth angle. inline double mag2() const; // The magnitude squared. inline double mag() const; // The magnitude. inline double r() const; // r in polar coordinates (r, phi): equal to mag(). inline void setPhi(double phi); // Set phi keeping mag constant. inline void setMag(double r); // Set magnitude keeping phi constant. inline void setR(double r); // Set R keeping phi constant. Same as setMag. inline void setPolar(double r, double phi); // Set by polar coordinates. inline Hep2Vector & operator = (const Hep2Vector & p); // Assignment. inline bool operator == (const Hep2Vector & v) const; inline bool operator != (const Hep2Vector & v) const; // Comparisons. int compare (const Hep2Vector & v) const; bool operator > (const Hep2Vector & v) const; bool operator < (const Hep2Vector & v) const; bool operator>= (const Hep2Vector & v) const; bool operator<= (const Hep2Vector & v) const; // dictionary ordering according to y, then x component static inline double getTolerance(); static double setTolerance(double tol); double howNear (const Hep2Vector &p) const; bool isNear (const Hep2Vector & p, double epsilon=tolerance) const; double howParallel (const Hep2Vector &p) const; bool isParallel (const Hep2Vector & p, double epsilon=tolerance) const; double howOrthogonal (const Hep2Vector &p) const; bool isOrthogonal (const Hep2Vector & p, double epsilon=tolerance) const; inline Hep2Vector & operator += (const Hep2Vector &p); // Addition. inline Hep2Vector & operator -= (const Hep2Vector &p); // Subtraction. inline Hep2Vector operator - () const; // Unary minus. inline Hep2Vector & operator *= (double a); // Scaling with real numbers. inline Hep2Vector unit() const; // Unit vector parallel to this. inline Hep2Vector orthogonal() const; // Vector orthogonal to this. inline double dot(const Hep2Vector &p) const; // Scalar product. inline double angle(const Hep2Vector &) const; // The angle w.r.t. another 2-vector. void rotate(double); // Rotates the Hep2Vector. operator Hep3Vector () const; // Cast a Hep2Vector as a Hep3Vector. // The remaining methods are friends, thus defined at global scope: // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - friend std::ostream & operator<< (std::ostream &, const Hep2Vector &); // Output to a stream. inline friend double operator * (const Hep2Vector & a, const Hep2Vector & b); // Scalar product. inline friend Hep2Vector operator * (const Hep2Vector & p, double a); // v*c inline friend Hep2Vector operator * (double a, const Hep2Vector & p); // c*v friend Hep2Vector operator / (const Hep2Vector & p, double a); // v/c inline friend Hep2Vector operator + (const Hep2Vector & a, const Hep2Vector & b); // v1+v2 inline friend Hep2Vector operator - (const Hep2Vector & a, const Hep2Vector & b); // v1-v2 enum { ZMpvToleranceTicks = 100 }; private: double dx; double dy; // The components. static double tolerance; // default tolerance criterion for isNear() to return true. }; // Hep2Vector static const Hep2Vector X_HAT2(1.0, 0.0); static const Hep2Vector Y_HAT2(0.0, 1.0); } // namespace CLHEP #include "CLHEP/Vector/TwoVector.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_TWOVECTOR_H */ clhep-2.1.4.1.orig/Vector/Vector/ThreeVector.h0000755000175000017500000003336011406203315017507 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // $Id: ThreeVector.h,v 1.4 2010/06/16 17:15:57 garren Exp $ // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // Hep3Vector is a general 3-vector class defining vectors in three // dimension using double components. Rotations of these vectors are // performed by multiplying with an object of the HepRotation class. // // .SS See Also // LorentzVector.h, Rotation.h, LorentzRotation.h // // .SS Authors // Leif Lonnblad and Anders Nilsson; Modified by Evgueni Tcherniaev; // ZOOM additions by Mark Fischler // #ifndef HEP_THREEVECTOR_H #define HEP_THREEVECTOR_H #ifdef GNUPRAGMA #pragma interface #endif #include #include "CLHEP/Vector/defs.h" namespace CLHEP { class HepRotation; class HepEulerAngles; class HepAxisAngle; /** * @author * @ingroup vector */ class Hep3Vector { public: // Basic properties and operations on 3-vectors: enum { X=0, Y=1, Z=2, NUM_COORDINATES=3, SIZE=NUM_COORDINATES }; // Safe indexing of the coordinates when using with matrices, arrays, etc. // (BaBar) Hep3Vector(); explicit Hep3Vector(double x); Hep3Vector(double x, double y); Hep3Vector(double x, double y, double z); // The constructor. inline Hep3Vector(const Hep3Vector &); // The copy constructor. inline ~Hep3Vector(); // The destructor. Not virtual - inheritance from this class is dangerous. double operator () (int) const; // Get components by index -- 0-based (Geant4) inline double operator [] (int) const; // Get components by index -- 0-based (Geant4) double & operator () (int); // Set components by index. 0-based. inline double & operator [] (int); // Set components by index. 0-based. inline double x() const; inline double y() const; inline double z() const; // The components in cartesian coordinate system. Same as getX() etc. inline void setX(double); inline void setY(double); inline void setZ(double); // Set the components in cartesian coordinate system. inline void set( double x, double y, double z); // Set all three components in cartesian coordinate system. inline double phi() const; // The azimuth angle. inline double theta() const; // The polar angle. inline double cosTheta() const; // Cosine of the polar angle. inline double cos2Theta() const; // Cosine squared of the polar angle - faster than cosTheta(). (ZOOM) inline double mag2() const; // The magnitude squared (r^2 in spherical coordinate system). inline double mag() const; // The magnitude (r in spherical coordinate system). inline void setPhi(double); // Set phi keeping mag and theta constant (BaBar). inline void setTheta(double); // Set theta keeping mag and phi constant (BaBar). void setMag(double); // Set magnitude keeping theta and phi constant (BaBar). inline double perp2() const; // The transverse component squared (rho^2 in cylindrical coordinate system). inline double perp() const; // The transverse component (rho in cylindrical coordinate system). inline void setPerp(double); // Set the transverse component keeping phi and z constant. void setCylTheta(double); // Set theta while keeping transvers component and phi fixed inline double perp2(const Hep3Vector &) const; // The transverse component w.r.t. given axis squared. inline double perp(const Hep3Vector &) const; // The transverse component w.r.t. given axis. inline Hep3Vector & operator = (const Hep3Vector &); // Assignment. inline bool operator == (const Hep3Vector &) const; inline bool operator != (const Hep3Vector &) const; // Comparisons (Geant4). bool isNear (const Hep3Vector &, double epsilon=tolerance) const; // Check for equality within RELATIVE tolerance (default 2.2E-14). (ZOOM) // |v1 - v2|**2 <= epsilon**2 * |v1.dot(v2)| double howNear(const Hep3Vector & v ) const; // sqrt ( |v1-v2|**2 / v1.dot(v2) ) with a maximum of 1. // If v1.dot(v2) is negative, will return 1. double deltaR(const Hep3Vector & v) const; // sqrt( pseudorapity_difference**2 + deltaPhi **2 ) inline Hep3Vector & operator += (const Hep3Vector &); // Addition. inline Hep3Vector & operator -= (const Hep3Vector &); // Subtraction. inline Hep3Vector operator - () const; // Unary minus. inline Hep3Vector & operator *= (double); // Scaling with real numbers. Hep3Vector & operator /= (double); // Division by (non-zero) real number. inline Hep3Vector unit() const; // Vector parallel to this, but of length 1. inline Hep3Vector orthogonal() const; // Vector orthogonal to this (Geant4). inline double dot(const Hep3Vector &) const; // double product. inline Hep3Vector cross(const Hep3Vector &) const; // Cross product. double angle(const Hep3Vector &) const; // The angle w.r.t. another 3-vector. double pseudoRapidity() const; // Returns the pseudo-rapidity, i.e. -ln(tan(theta/2)) void setEta ( double p ); // Set pseudo-rapidity, keeping magnitude and phi fixed. (ZOOM) void setCylEta ( double p ); // Set pseudo-rapidity, keeping transverse component and phi fixed. (ZOOM) Hep3Vector & rotateX(double); // Rotates the Hep3Vector around the x-axis. Hep3Vector & rotateY(double); // Rotates the Hep3Vector around the y-axis. Hep3Vector & rotateZ(double); // Rotates the Hep3Vector around the z-axis. Hep3Vector & rotateUz(const Hep3Vector&); // Rotates reference frame from Uz to newUz (unit vector) (Geant4). Hep3Vector & rotate(double, const Hep3Vector &); // Rotates around the axis specified by another Hep3Vector. // (Uses methods of HepRotation, forcing linking in of Rotation.cc.) Hep3Vector & operator *= (const HepRotation &); Hep3Vector & transform(const HepRotation &); // Transformation with a Rotation matrix. // = = = = = = = = = = = = = = = = = = = = = = = = // // Esoteric properties and operations on 3-vectors: // // 1 - Set vectors in various coordinate systems // 2 - Synonyms for accessing coordinates and properties // 3 - Comparisions (dictionary, near-ness, and geometric) // 4 - Intrinsic properties // 5 - Properties releative to z axis and arbitrary directions // 6 - Polar and azimuthal angle decomposition and deltaPhi // 7 - Rotations // // = = = = = = = = = = = = = = = = = = = = = = = = // 1 - Set vectors in various coordinate systems inline void setRThetaPhi (double r, double theta, double phi); // Set in spherical coordinates: Angles are measured in RADIANS inline void setREtaPhi ( double r, double eta, double phi ); // Set in spherical coordinates, but specify peudorapidiy to determine theta. inline void setRhoPhiZ (double rho, double phi, double z); // Set in cylindrical coordinates: Phi angle is measured in RADIANS void setRhoPhiTheta ( double rho, double phi, double theta); // Set in cylindrical coordinates, but specify theta to determine z. void setRhoPhiEta ( double rho, double phi, double eta); // Set in cylindrical coordinates, but specify pseudorapidity to determine z. // 2 - Synonyms for accessing coordinates and properties inline double getX() const; inline double getY() const; inline double getZ() const; // x(), y(), and z() inline double getR () const; inline double getTheta() const; inline double getPhi () const; // mag(), theta(), and phi() inline double r () const; // mag() inline double rho () const; inline double getRho () const; // perp() double eta () const; double getEta () const; // pseudoRapidity() inline void setR ( double s ); // setMag() inline void setRho ( double s ); // setPerp() // 3 - Comparisions (dictionary, near-ness, and geometric) int compare (const Hep3Vector & v) const; bool operator > (const Hep3Vector & v) const; bool operator < (const Hep3Vector & v) const; bool operator>= (const Hep3Vector & v) const; bool operator<= (const Hep3Vector & v) const; // dictionary ordering according to z, then y, then x component inline double diff2 (const Hep3Vector & v) const; // |v1-v2|**2 static double setTolerance (double tol); static inline double getTolerance (); // Set the tolerance used in isNear() for Hep3Vectors bool isParallel (const Hep3Vector & v, double epsilon=tolerance) const; // Are the vectors parallel, within the given tolerance? bool isOrthogonal (const Hep3Vector & v, double epsilon=tolerance) const; // Are the vectors orthogonal, within the given tolerance? double howParallel (const Hep3Vector & v) const; // | v1.cross(v2) / v1.dot(v2) |, to a maximum of 1. double howOrthogonal (const Hep3Vector & v) const; // | v1.dot(v2) / v1.cross(v2) |, to a maximum of 1. enum { ToleranceTicks = 100 }; // 4 - Intrinsic properties double beta () const; // relativistic beta (considering v as a velocity vector with c=1) // Same as mag() but will object if >= 1 double gamma() const; // relativistic gamma (considering v as a velocity vector with c=1) double coLinearRapidity() const; // inverse tanh (beta) // 5 - Properties relative to Z axis and to an arbitrary direction // Note that the non-esoteric CLHEP provides // theta(), cosTheta(), cos2Theta, and angle(const Hep3Vector&) inline double angle() const; // angle against the Z axis -- synonym for theta() inline double theta(const Hep3Vector & v2) const; // synonym for angle(v2) double cosTheta (const Hep3Vector & v2) const; double cos2Theta(const Hep3Vector & v2) const; // cos and cos^2 of the angle between two vectors inline Hep3Vector project () const; Hep3Vector project (const Hep3Vector & v2) const; // projection of a vector along a direction. inline Hep3Vector perpPart() const; inline Hep3Vector perpPart (const Hep3Vector & v2) const; // vector minus its projection along a direction. double rapidity () const; // inverse tanh(v.z()) double rapidity (const Hep3Vector & v2) const; // rapidity with respect to specified direction: // inverse tanh (v.dot(u)) where u is a unit in the direction of v2 double eta(const Hep3Vector & v2) const; // - ln tan of the angle beween the vector and the ref direction. // 6 - Polar and azimuthal angle decomposition and deltaPhi // Decomposition of an angle within reference defined by a direction: double polarAngle (const Hep3Vector & v2) const; // The reference direction is Z: the polarAngle is abs(v.theta()-v2.theta()). double deltaPhi (const Hep3Vector & v2) const; // v.phi()-v2.phi(), brought into the range (-PI,PI] double azimAngle (const Hep3Vector & v2) const; // The reference direction is Z: the azimAngle is the same as deltaPhi double polarAngle (const Hep3Vector & v2, const Hep3Vector & ref) const; // For arbitrary reference direction, // polarAngle is abs(v.angle(ref) - v2.angle(ref)). double azimAngle (const Hep3Vector & v2, const Hep3Vector & ref) const; // To compute azimangle, project v and v2 into the plane normal to // the reference direction. Then in that plane take the angle going // clockwise around the direction from projection of v to that of v2. // 7 - Rotations // These mehtods **DO NOT** use anything in the HepRotation class. // Thus, use of v.rotate(axis,delta) does not force linking in Rotation.cc. Hep3Vector & rotate (const Hep3Vector & axis, double delta); // Synonym for rotate (delta, axis) Hep3Vector & rotate (const HepAxisAngle & ax); // HepAxisAngle is a struct holding an axis direction and an angle. Hep3Vector & rotate (const HepEulerAngles & e); Hep3Vector & rotate (double phi, double theta, double psi); // Rotate via Euler Angles. Our Euler Angles conventions are // those of Goldstein Classical Mechanics page 107. protected: void setSpherical (double r, double theta, double phi); void setCylindrical (double r, double phi, double z); double negativeInfinity() const; protected: double dx; double dy; double dz; // The components. static double tolerance; // default tolerance criterion for isNear() to return true. }; // Hep3Vector // Global Methods Hep3Vector rotationXOf (const Hep3Vector & vec, double delta); Hep3Vector rotationYOf (const Hep3Vector & vec, double delta); Hep3Vector rotationZOf (const Hep3Vector & vec, double delta); Hep3Vector rotationOf (const Hep3Vector & vec, const Hep3Vector & axis, double delta); Hep3Vector rotationOf (const Hep3Vector & vec, const HepAxisAngle & ax); Hep3Vector rotationOf (const Hep3Vector & vec, double phi, double theta, double psi); Hep3Vector rotationOf (const Hep3Vector & vec, const HepEulerAngles & e); // Return a new vector based on a rotation of the supplied vector std::ostream & operator << (std::ostream &, const Hep3Vector &); // Output to a stream. std::istream & operator >> (std::istream &, Hep3Vector &); // Input from a stream. extern const Hep3Vector HepXHat, HepYHat, HepZHat; typedef Hep3Vector HepThreeVectorD; typedef Hep3Vector HepThreeVectorF; Hep3Vector operator / (const Hep3Vector &, double a); // Division of 3-vectors by non-zero real number inline Hep3Vector operator + (const Hep3Vector &, const Hep3Vector &); // Addition of 3-vectors. inline Hep3Vector operator - (const Hep3Vector &, const Hep3Vector &); // Subtraction of 3-vectors. inline double operator * (const Hep3Vector &, const Hep3Vector &); // double product of 3-vectors. inline Hep3Vector operator * (const Hep3Vector &, double a); inline Hep3Vector operator * (double a, const Hep3Vector &); // Scaling of 3-vectors with a real number } // namespace CLHEP #include "CLHEP/Vector/ThreeVector.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_THREEVECTOR_H */ clhep-2.1.4.1.orig/Vector/Vector/BoostX.h0000755000175000017500000001513007746044120016477 0ustar olesoles// -*- C++ -*- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definition of the HepBoostX class for performing specialized // Lorentz transformations which are pure boosts in the X direction, on // objects of the HepLorentzVector class. // // HepLorentzRotation is a concrete implementation of Hep4RotationInterface. // // .SS See Also // RotationInterfaces.h // LorentzVector.h LorentzRotation.h // Boost.h // // .SS Author // Mark Fischler #ifndef HEP_BOOSTX_H #define HEP_BOOSTX_H #ifdef GNUPRAGMA #pragma interface #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/RotationInterfaces.h" #include "CLHEP/Vector/LorentzVector.h" namespace CLHEP { // Declarations of classes and global methods class HepBoostX; inline HepBoostX inverseOf ( const HepBoostX & b ); class HepBoost; class HepRotation; /** * @author * @ingroup vector */ class HepBoostX { public: // ---------- Constructors and Assignment: inline HepBoostX(); // Default constructor. Gives a boost of 0. inline HepBoostX(const HepBoostX & b); // Copy constructor. inline HepBoostX & operator = (const HepBoostX & m); // Assignment. HepBoostX & set (double beta); inline HepBoostX (double beta); // Constructor from beta // ---------- Accessors: inline double beta() const; inline double gamma() const; inline Hep3Vector boostVector() const; inline Hep3Vector getDirection() const; inline double xx() const; inline double xy() const; inline double xz() const; inline double xt() const; inline double yx() const; inline double yy() const; inline double yz() const; inline double yt() const; inline double zx() const; inline double zy() const; inline double zz() const; inline double zt() const; inline double tx() const; inline double ty() const; inline double tz() const; inline double tt() const; // Elements of the matrix. inline HepLorentzVector col1() const; inline HepLorentzVector col2() const; inline HepLorentzVector col3() const; inline HepLorentzVector col4() const; // orthosymplectic column vectors inline HepLorentzVector row1() const; inline HepLorentzVector row2() const; inline HepLorentzVector row3() const; inline HepLorentzVector row4() const; // orthosymplectic row vectors HepRep4x4 rep4x4() const; // 4x4 representation: HepRep4x4Symmetric rep4x4Symmetric() const; // Symmetric 4x4 representation. // ---------- Decomposition: void decompose (HepRotation & rotation, HepBoost & boost) const; void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const; // Find R and B such that L = R*B -- trivial, since R is identity void decompose ( HepBoost & boost, HepRotation & rotation) const; void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const; // Find R and B such that L = B*R -- trivial, since R is identity // ---------- Comparisons: inline int compare( const HepBoostX & b ) const; // Dictionary-order comparison, in order of beta. // Used in operator<, >, <=, >= inline bool operator == (const HepBoostX & b) const; inline bool operator != (const HepBoostX & b) const; inline bool operator <= (const HepBoostX & b) const; inline bool operator >= (const HepBoostX & b) const; inline bool operator < (const HepBoostX & b) const; inline bool operator > (const HepBoostX & b) const; // Comparisons. inline bool isIdentity() const; // Returns true if a null boost. inline double distance2( const HepBoostX & b ) const; double distance2( const HepBoost & b ) const; // Defined as the distance2 between the vectors (gamma*betaVector) double distance2( const HepRotation & r ) const; double distance2( const HepLorentzRotation & lt ) const; // Decompose lt = B*R; add norm2 to distance2 to between boosts. inline double howNear( const HepBoostX & b ) const; inline double howNear( const HepBoost & b ) const; inline double howNear( const HepRotation & r ) const; inline double howNear( const HepLorentzRotation & lt ) const; inline bool isNear( const HepBoostX & b, double epsilon=Hep4RotationInterface::tolerance) const; inline bool isNear( const HepBoost & b, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepRotation & r, double epsilon=Hep4RotationInterface::tolerance) const; bool isNear( const HepLorentzRotation & lt, double epsilon=Hep4RotationInterface::tolerance) const; // ---------- Properties: inline double norm2() const; // distance2 (IDENTITY), which is beta^2 * gamma^2 void rectify(); // sets according to the stored beta // ---------- Application: inline HepLorentzVector operator()( const HepLorentzVector & w ) const; // Transform a Lorentz Vector. inline HepLorentzVector operator* ( const HepLorentzVector & w ) const; // Multiplication with a Lorentz Vector. // ---------- Operations in the group of 4-Rotations HepBoostX operator * (const HepBoostX & b) const; HepLorentzRotation operator * (const HepBoost & b) const; HepLorentzRotation operator * (const HepRotation & r) const; HepLorentzRotation operator * (const HepLorentzRotation & lt) const; // Product of two Lorentz Rotations (this) * lt - matrix multiplication // Notice that the product of two pure boosts in different directions // is no longer a pure boost. inline HepBoostX inverse() const; // Return the inverse. inline friend HepBoostX inverseOf ( const HepBoostX & b ); // global methods to invert. inline HepBoostX & invert(); // Inverts the Boost matrix. // ---------- I/O: std::ostream & print( std::ostream & os ) const; // Output form is BOOSTX (beta=..., gamma=...); // ---------- Tolerance static inline double getTolerance(); static inline double setTolerance(double tol); protected: inline HepLorentzVector vectorMultiplication ( const HepLorentzVector & w ) const; // Multiplication with a Lorentz Vector. HepLorentzRotation matrixMultiplication (const HepRep4x4 & m) const; HepLorentzRotation matrixMultiplication (const HepRep4x4Symmetric & m) const; inline HepBoostX (double beta, double gamma); double beta_; double gamma_; }; // HepBoostX inline std::ostream & operator << ( std::ostream & os, const HepBoostX& b ) {return b.print(os);} } // namespace CLHEP #include "CLHEP/Vector/BoostX.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_BOOSTX_H */ clhep-2.1.4.1.orig/Vector/Vector/BoostZ.icc0000755000175000017500000001263311712321422017004 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definitions of the inline member functions of the // HepBoostZ class // #include namespace CLHEP { // ---------- Constructors and Assignment: inline HepBoostZ::HepBoostZ() : beta_(0.0), gamma_(1.0) {} inline HepBoostZ::HepBoostZ(const HepBoostZ & b) : beta_ (b.beta_), gamma_(b.gamma_) {} inline HepBoostZ & HepBoostZ::operator = (const HepBoostZ & b) { beta_ = b.beta_; gamma_ = b.gamma_; return *this; } inline HepBoostZ::HepBoostZ(double bbeta) { set(bbeta); } // - Protected method: inline HepBoostZ::HepBoostZ( double bbeta, double ggamma ) : beta_(bbeta), gamma_(ggamma) {} // ---------- Accessors: inline double HepBoostZ::beta() const { return beta_; } inline double HepBoostZ::gamma() const { return gamma_; } inline Hep3Vector HepBoostZ::boostVector() const { return Hep3Vector( 0, 0, beta_ ); } inline Hep3Vector HepBoostZ::getDirection() const { return Hep3Vector( 0.0, 0.0, 1.0 ); } inline double HepBoostZ::xx() const { return 1.0;} inline double HepBoostZ::xy() const { return 0.0;} inline double HepBoostZ::xz() const { return 0.0;} inline double HepBoostZ::xt() const { return 0.0;} inline double HepBoostZ::yx() const { return 0.0;} inline double HepBoostZ::yy() const { return 1.0;} inline double HepBoostZ::yz() const { return 0.0;} inline double HepBoostZ::yt() const { return 0.0;} inline double HepBoostZ::zx() const { return 0.0;} inline double HepBoostZ::zy() const { return 0.0;} inline double HepBoostZ::zz() const { return gamma();} inline double HepBoostZ::zt() const { return beta()*gamma();} inline double HepBoostZ::tx() const { return 0.0;} inline double HepBoostZ::ty() const { return 0.0;} inline double HepBoostZ::tz() const { return beta()*gamma();} inline double HepBoostZ::tt() const { return gamma();} inline HepLorentzVector HepBoostZ::col1() const { return HepLorentzVector ( 1, 0, 0, 0 ); } inline HepLorentzVector HepBoostZ::col2() const { return HepLorentzVector ( 0, 1, 0, 0 ); } inline HepLorentzVector HepBoostZ::col3() const { return HepLorentzVector ( 0, 0, gamma(), beta()*gamma() ); } inline HepLorentzVector HepBoostZ::col4() const { return HepLorentzVector ( 0, 0, beta()*gamma(), gamma() ); } inline HepLorentzVector HepBoostZ::row1() const { return HepLorentzVector ( col1() ); } inline HepLorentzVector HepBoostZ::row2() const { return HepLorentzVector ( col2() ); } inline HepLorentzVector HepBoostZ::row3() const { return HepLorentzVector ( col3() ); } inline HepLorentzVector HepBoostZ::row4() const { return HepLorentzVector ( col4() ); } // ---------- Comparisons: inline int HepBoostZ::compare( const HepBoostZ & b ) const { if (beta() < b.beta()) { return -1; } else if (beta() > b.beta()) { return 1; } else { return 0; } } inline bool HepBoostZ::operator == ( const HepBoostZ & b ) const { return beta_ == b.beta_; } inline bool HepBoostZ::operator != ( const HepBoostZ & b ) const { return beta_ != b.beta_; } inline bool HepBoostZ::operator <= ( const HepBoostZ & b ) const { return beta_ <= b.beta_; } inline bool HepBoostZ::operator >= ( const HepBoostZ & b ) const { return beta_ >= b.beta_; } inline bool HepBoostZ::operator < ( const HepBoostZ & b ) const { return beta_ < b.beta_; } inline bool HepBoostZ::operator > ( const HepBoostZ & b ) const { return beta_ > b.beta_; } inline bool HepBoostZ::isIdentity() const { return ( beta() == 0 ); } inline double HepBoostZ::distance2( const HepBoostZ & b ) const { double d = beta()*gamma() - b.beta()*b.gamma(); return d*d; } inline double HepBoostZ::howNear(const HepBoostZ & b) const { return std::sqrt(distance2(b)); } inline double HepBoostZ::howNear(const HepBoost & b) const { return std::sqrt(distance2(b)); } inline double HepBoostZ::howNear(const HepRotation & r) const { return std::sqrt(distance2(r)); } inline double HepBoostZ::howNear(const HepLorentzRotation & lt) const { return std::sqrt(distance2(lt)); } inline bool HepBoostZ::isNear(const HepBoostZ & b, double epsilon) const { return (distance2(b) <= epsilon*epsilon); } inline bool HepBoostZ::isNear(const HepBoost & b, double epsilon) const { return (distance2(b) <= epsilon*epsilon); } // ---------- Properties: double HepBoostZ::norm2() const { register double bg = beta_*gamma_; return bg*bg; } // ---------- Application: inline HepLorentzVector HepBoostZ::operator * (const HepLorentzVector & p) const { double bg = beta_*gamma_; return HepLorentzVector( p.x(), p.y(), gamma_*p.z() + bg*p.t(), gamma_*p.t() + bg*p.z()); } HepLorentzVector HepBoostZ::operator() (const HepLorentzVector & w) const { return operator*(w); } // ---------- Operations in the group of 4-Rotations inline HepBoostZ HepBoostZ::inverse() const { return HepBoostZ( -beta(), gamma() ); } inline HepBoostZ & HepBoostZ::invert() { beta_ = -beta_; return *this; } inline HepBoostZ inverseOf ( const HepBoostZ & b ) { return HepBoostZ( -b.beta(), b.gamma()); } // ---------- Tolerance: inline double HepBoostZ::getTolerance() { return Hep4RotationInterface::tolerance; } inline double HepBoostZ::setTolerance(double tol) { return Hep4RotationInterface::setTolerance(tol); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/INSTALL0000755000175000017500000000772111406203315014675 0ustar olesoles#------------------------------------------------------------- # platform specific issues #------------------------------------------------------------- This package requires autoconf 2.59 or later and automake 1.9.1 or later. If you bootstrap, you will probably have to build these yourself. See "building autotools" below. The new libtool no longer properly supports shared libraries for gcc 2.95.2. If you build CLHEP with gcc 2.95.2, you must configure --disable-shared. To build for Solaris CC, configure with CXX=CC CC=cc and use gmake. On MacOSX, you need to define MACOSX_DEPLOYMENT_TARGET appropriately. For instance, set MACOSX_DEPLOYMENT_TARGET to "10.4" if you have MacOS 10.4 installed on your system. #------------------------------------------------------------- # installing from a source code tar ball #------------------------------------------------------------- Unwind the source code tar ball in some relevant directory. Autoconf and automake will aready have been run. Determine where the files will be installed. Create a build directory that is NOT in the source code directory tree. cd /configure --prefix= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make check (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # configure options #------------------------------------------------------------- A variety of options can be given to configure. Below is a list of the options that you are likely to find most useful. --help provides a partial list of options --prefix=PREFIX install architecture-independent files in PREFIX [default is /usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [default is the same as PREFIX] --disable-shared build only static libraries --disable-static build only shared libraries --enable-exceptions use the CLHEP/Exceptions package --disable-exceptions DO NOT use the CLHEP/Exceptions package [--disable-exceptions is the default] #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are neither built nor installed automatically. Use the following commands to build and install documents: make docs make install-docs #------------------------------------------------------------- # building from cvs #------------------------------------------------------------- You will need current versions of automake, autoconf, and libtool. See building autotools below. cvs co CLHEP/package OR cvs co package cd [CLHEP/]package ./bootstrap Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building autotools #------------------------------------------------------------- If you do not have at least autoconf 2.59 and automake 1.9.1, you will need to build autoconf, automake, and libtool. On some platforms, you may also need to build m4 and texinfo. Download the relevant tarballs from gnu.org (http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/, and http://www.gnu.org/software/libtool/) Untar them in a common source code tree. Decide whether you want to install them in /usr/local or your own install directory. If you use your own install directory, use --prefix= with configure. For each autotool package: /configure [--prefix=] make make install Make sure that /bin is at the front of your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/Vector/Makefile.am0000755000175000017500000000447210234000243015671 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP # put . first so that CLHEP directory is built before anything else SUBDIRS = Vector . src test # list all subdirectories - for distribution and cleaning DIST_SUBDIRS = Vector . src test doc bin_SCRIPTS = Vector-config all-local: $(top_builddir)/CLHEP # create temporary CLHEP header tree # we only copy headers for packages listed in @PACKAGE@-deps # search for header directories in the following order: # 1. $(top_builddir)/this-package # 2. $(top_builddir)/../other-packages # 3. $(CLHEPSOURCE_DIR)/CLHEP # 4. $(CLHEP_DIR)/include/CLHEP # # abs_ => absolute path abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ COPY_P = @COPY_P@ $(top_builddir)/CLHEP: temp-package-dirs @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ if test -d "$$pkg" ; then \ (cd $$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d ../"$$pkg"/"$$pkg" ; then \ (cd ../$$pkg/$$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg"; then \ hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ else \ if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/include/CLHEP; then \ if test -d $(CLHEP_DIR)/include/CLHEP/"$$pkg"; then \ hdrs=`ls $(CLHEP_DIR)/include/CLHEP/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEP_DIR)/include/CLHEP/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ fi; \ fi; \ fi; \ fi; \ fi; \ done; temp-package-dirs: $(mkinstalldirs) $(abs_top_builddir)/CLHEP; @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ $(mkinstalldirs) $(abs_top_builddir)/CLHEP/$$pkg; \ done; docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs # extra clean rule clean-local: rm -rf $(top_builddir)/CLHEP clhep-2.1.4.1.orig/Vector/bootstrap0000755000175000017500000000071510234000243015571 0ustar olesoles#! /bin/sh set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 rm -f Makefile.in */Makefile.in */defs.h.in rm -f autotools/config* autotools/depcomp autotools/install-sh autotools/m* rm -f configure config.* # run autotool commands aclocal -I autotools autoheader automake --add-missing --copy autoconf # ready to make a source code distribution tarball clhep-2.1.4.1.orig/Vector/configure.ac0000755000175000017500000002751112241267303016136 0ustar olesoles# ====================================================================== # This is the Vector configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.59) AC_INIT(CLHEP Vector, 2.1.4.1, http://savannah.cern.ch/projects/clhep/, Vector) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([src/AxisAngle.cc]) AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # ---------------------------------------------------------------------- # --enable-shared and --enable-static # both shared and static libraries are built by default # ---------------------------------------------------------------------- AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Header containing #defines: AM_CONFIG_HEADER([Vector/defs.h]) # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Vector/Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([doc/Makefile]) AC_CONFIG_FILES([Vector-deps]) AC_CONFIG_FILES([Vector/copy-header.pl], [chmod +x Vector/copy-header.pl]) # Configuration inquiry program/script: AC_CONFIG_FILES([Vector-config], [chmod +x Vector-config]) # Test driver program/script: AC_CONFIG_FILES([test/testThreeVector.sh], [chmod +x test/testThreeVector.sh]) AC_CONFIG_FILES([test/testLorentzVector.sh], [chmod +x test/testLorentzVector.sh]) AC_CONFIG_FILES([test/testRotation.sh], [chmod +x test/testRotation.sh]) AC_CONFIG_FILES([test/testSubscripts.sh], [chmod +x test/testSubscripts.sh]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- Vector_CPPFLAGS="-I$includedir" Vector_LDFLAGS="-L$libdir" Vector_LIBS="-lCLHEP-$PACKAGE-$VERSION" AC_SUBST(Vector_CPPFLAGS) AC_SUBST(Vector_LIBS) AC_SUBST(Vector_LDFLAGS) # ---------------------------------------------------------------------- # Supply boilerplate for Vector/defs.h source header: # ---------------------------------------------------------------------- AH_TOP([#ifndef VECTOR_DEFS_H #define VECTOR_DEFS_H]) ## the undefs are converted by configure AH_VERBATIM([PACKAGE],[/* Name of package */ #ifndef PACKAGE #undef PACKAGE #endif]) AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif]) AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */ #ifndef PACKAGE_NAME #undef PACKAGE_NAME #endif]) AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #undef PACKAGE_STRING #endif]) AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif]) AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */ #ifndef PACKAGE_VERSION #undef PACKAGE_VERSION #endif]) AH_VERBATIM([VERSION],[/* Version number of package */ #ifndef VERSION #undef VERSION #endif]) AH_BOTTOM([#endif // VECTOR_DEFS_H]) # ---------------------------------------------------------------------- # Account for any user configuration options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; icc) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" MY_SHFLAGS="-fPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Set system-dependent options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed libraries: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed header files: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed typedefs, structures, and compiler characteristics: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed library functions: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/Vector/COPYING.LESSER0000644000175000017500000001674311406203315015674 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/Vector/Vector-config.in0000755000175000017500000000404612234340066016703 0ustar olesoles#! /bin/sh # @configure_input@ # we include the paths of the original install directories for reference orig_prefix="@prefix@" orig_exec_prefix="@exec_prefix@" orig_includedir="@includedir@" # use the full name of this script to get the current path configpath=`dirname ${0}` # check for a leading slash to determine if this is a relative path firstc=`expr ${configpath} : "\/"` calldir=`pwd` if [ ${firstc} -eq 0 ] then cd "${calldir}/${configpath}"; newpath=`pwd` binpath=${newpath} else binpath=${configpath} fi # OK - now we have to strip the trailing "/bin" out of the path prefix=`dirname "${binpath}"` includedir=${prefix}/include libdir=${prefix}/lib usage() { cat <$, $>=$) are provided (see eqn. \ref{eq:compSV}). Further, the following member functions are useful to check for equality within a relative tolerance. \begin{shortlist} \item bool isNear( v, epsilon ) \see{\ref{eq:isNear}} \item Scalar howNear( v ) \see{\ref{eq:howNear}, \ref{eq:howNear:2}, \ref{eq:howNear:3}} \item Scalar deltaR( v ) \see{\ref{eq:deltaR}} \end{shortlist} \noindent The tolerance epsilon may be omitted. The following class-wide (static) functions are used to obtain and set the default tolerance for nearness. \begin{shortlist} \item HepDouble setTolerance( tol ) \see{\ref{eq:epsildef}} \item HepDouble getTolerance(~) \end{shortlist} \subsubsection{Methods} \begin{shortlist} \item ostream \& operator$<<$( ostream \& os, v ) \item istream \& operator$>>$( istream \& is, Hep3Vector \& v ) \end{shortlist} \begin{shortlist} \item HepDouble dot( v ) \see{\ref{eq:dot}} \item Hep3Vector cross( v ) \see{\ref{eq:cross}} \item HepDouble diff2( v ) \see{\ref{eq:diff2}} \item bool isParallel( v, epsilon ) \see{\ref{eq:isPar}} \item bool isOrthogonal( v, epsilon ) \see{\ref{eq:isOrtho}} \item HepDouble howParallel( v ) \see{\ref{eq:howPar}, \ref{eq:howPar:2}} \item HepDouble howOrthogonal( v ) \see{\ref{eq:howOrtho}, \ref{eq:howOrtho:2}} \end{shortlist} \begin{shortlist} \item HepDouble mag2(~) \see{\ref{eq:mag2}} \item HepDouble mag(~) \see{\ref{eq:mag}, \ref{eq:mag:2}} \item HepDouble beta(~) \see{\ref{eq:beta}} \item HepDouble gamma(~) \see{\ref{eq:gamma}} \item HepDouble pseudoRapidity(~) \see{\ref{eq:spherical}} \item HepDouble coLinearRapidity(~) \see{\ref{eq:coLinRap}} \item Hep3Vector unit(~) \see{\ref{eq:svunit}} \item Hep3Vector orthogonal(~) \see{\ref{eq:orthogonal}} \end{shortlist} \noindent The following methods depend on a reference direction (specified by a \SV\ u). Signatures omitting the reference direction are also supplied---$\hat{z}$ is implied in these cases and the methods take advantage of the simpler form. \begin{shortlist} \item HepDouble perp( u ) \see{\ref{eq:perp}} \item HepDouble perp2( u ) \see{\ref{eq:perp2}} \item SpaceVector perpPart( u ) \see{\ref{eq:perpPart}} \item SpaceVector project( u ) \see{\ref{eq:project}} \item HepDouble angle( u ) \see{\ref{eq:angle}} \item HepDouble theta( u ) \see{\ref{eq:theta}} \item HepDouble cosTheta( u ) \see{\ref{eq:cosTheta}} \item HepDouble cos2Theta( u ) \see{\ref{eq:cos2Theta}} \item HepDouble eta( u ) \see{\ref{eq:eta}, \ref{eq:eta:2}, \ref{eq:eta:3}, \ref{eq:eta:4}} \item HepDouble polarAngle( v2, u ) \see{\ref{eq:polarA}, \ref{eq:polarA:2}} \item HepDouble deltaPhi( v2 ) \see{\ref{eq:azim}} \item HepDouble azimAngle( v2, u ) \see{\ref{eq:azim}, \ref{eq:azim:2}} \item HepDouble rapidity( u ) \see{\ref{eq:rap}, \ref{eq:rap:2}} \end{shortlist} \subsubsection{Rotations} \noindent These methods change the vector: \begin{shortlist} \item Hep3Vector \& rotateX( delta ) \see{\ref{eq:rotX}} \item Hep3Vector \& rotateY( delta ) \see{\ref{eq:rotY}} \item Hep3Vector \& rotateZ( delta ) \see{\ref{eq:rotZ}, \ref{eq:rotZ:2}} \item Hep3Vector \& rotateUZ( Hep3Vector ) \see{\ref{eq:rotUz}} \end{shortlist} \begin{shortlist} \item Hep3Vector \& rotate( axis, delta ) \see{\ref{eq:axisrot}} \item Hep3Vector \& rotate( const AxisAngle \& ax ) \see{\ref{eq:axisrot}} \item Hep3Vector \& rotate( phi, theta, psi ) \see{\ref{eq:eulerrot}} \item Hep3Vector \& rotate( const EulerAngles \& e ) \see{\ref{eq:eulerrot}} \end{shortlist} \noindent The following methods both do $\vec{v} \Longleftarrow R v$. (Notice the order of multiplication for {\tt v *= R}.) \begin{shortlist} \item Hep3Vector transform (const HepRotation \& R) \see{\ref{eq:opstareq}} \item Hep3Vector operator *= (const HepRotation \& R) \see{\ref{eq:opstareq}} \end{shortlist} \noindent These global functions do not change the \SV\ v: \begin{shortlist} \item Hep3Vector rotationXOf( v, delta ) \see{\ref{eq:rotX}} \item Hep3Vector rotationYOf( v, delta ) \see{\ref{eq:rotY}} \item Hep3Vector rotationZOf( v, delta ) \see{\ref{eq:rotZ}, \ref{eq:rotZ:2}} \end{shortlist} \begin{shortlist} \item Hep3Vector rotationOf( v, axis, delta ) \see{\ref{eq:axisrot}} \item Hep3Vector rotationOf( v, const AxisAngle \& ax ) \see{\ref{eq:axisrot}} \item Hep3Vector rotationOf( v, phi, theta, psi ) \see{\ref{eq:eulerrot}} \item Hep3Vector rotationOf( v, const EulerAngles \& e ) \see{\ref{eq:eulerrot}} \end{shortlist} \subsection{\protect\SVz\ Class --- Derived from \SV } The \SVz\ class provides backward compatibility with the original ZOOM PhysicsVectors package. It is publicly derived from \SV . It would simply be a typedef off \SV , in the appropriate namespace, but for one set of features which were felt to be overkill in the CLHEP context. This is the ability to construct a \SVz\ providing spherical or cylindrical coordinates. Associated with these constructors are a set of defined keywords which allow disambiguation of the various forms of constructors. These keywords are {\tt RADIANS}, {\tt DEGREES}, and {\tt ETA}, Throughout this section, we will illustrate using {\tt RADIANS}, but this may be replaced by {\tt DEGREES} to indicate the corresponding angle's units. For theta, this may also be replaced by {\tt ETA}, to indicate that the pseudorapidity is being supplied. \begin{shortlist} \item SpaceVector(~) \item SpaceVector( x, y, z ) \item SpaceVector( r, theta, RADIANS, phi, RADIANS ) \see{\ref{eq:polar}} \item SpaceVector( rho, phi, RADIANS, z ) \see{\ref{eq:cylindrical}} \end{shortlist} \subsection{\protect\UV\ Class} It was found useful in the ZOOM package to express the concept of a \UV, that is, a vector known to be inherently of unit length. CLHEP neither has such a class, and it is felt (at this time) that it should not. In the merged package, \UV\ is provided as a header file which appears only in the PhysicsVectors area. Since \UV\ depends on no non-header implementation code, issues of where to place the library containing non-CLHEP code do not arise. Although the \UV\ class is not derived from the \SVz\ class, all const methods (except for three relativistic kinematic methods which only make sense for a vector of length less than one) are provided for \UV . Thos non-const methods of \SV\ which do not risk violating the unit-length property, such as rotation, are also provided. In this section, therefore, only the differences in the classes are described. \subsubsection{Constructors and Accessors} \UV\ constructors (and \verb|set()| methods) have the same signatures as do the corresponding \SVz\ methods, but normalize before returning. The default \UV\ constructor yields $\hat{z}$. In addition, we have the conversion constructor \begin{shortlist} \item UnitVector( Hep3Vector v ) \end{shortlist} \noindent Unlike the case for \SV , \UV\ disallows setting a single Cartesian coordinate. Also, of course, modifying the radius of a \UV\ is forbidden. \subsubsection{Operators} \UV s are treated as \SV s for purposes of arithmetic and comparisons, except that unary minus returns a \UV . Modify-assignment (e.g., +=) is forbidden on \UV s. \subsubsection{Methods} \label{unitMethods} Most \UV\ methods match those of the \SV\ class; some are modified, however, to take advantage of the r~=~1 property. Forbidden methods include \verb|beta()|, \verb|gamma()|, and \verb|rapidity()|. \subsubsection{Rotations} All methods and functions in this category apply equally to \UV s as they do to \SV s. \subsection{\protect\LV\ Class --- Vector of real quantities in 4-space} Throughout this section, arguments named p, p1, p2, etc., are of type \LV , arguments named v, v1, v2, etc., are of type \SV , and an argument named t will refer to a scalar meant as a time component. \subsubsection{Constructors and Accessors} \begin{shortlist} \item HepLorentzVector(~) \item HepLorentzVector( x, y, z, t ) \item HepLorentzVector( v, t ) \item HepLorentzVector( t, v ) \item HepLorentzVector( t ) \item HepLorentzVector( x, y, z ) \item HepLorentzVector( v ) \end{shortlist} \noindent The following accessor methods are used to obtain the named coordinate components, as in \verb|double s = p.t();|. \begin{shortlist} \item x(~) \/\/\/ y(~) \/\/\/ z(~) \/\/\/ t(~) \item px(~) \/\/\/ py(~) \/\/\/ pz(~) \/\/\/ e(~) \item getX(~) \/\/\/ getY(~) \/\/\/ getZ(~) \/\/\/ getT(~) \item v(~) or getV(~) or vect(~) \end{shortlist} \noindent The Cartesian components may also be accessed by the index syntax, using either square braces or parentheses. In either case, the meaning of the index is 0-based, {\em with the time component last}. An enum is nested in the {\tt HepLorentzVector} class to help clarify this: {\tt X=0}, {\tt Y=1}, {\tt Z=2}, {\tt T=3}. The spatial components can also be accessed in spherical coordinates: \begin{shortlist} \item HepDouble theta() const; \item HepDouble cosTheta() const; \item HepDouble phi() const; \item HepDouble rho() const; \end{shortlist} \noindent There is a family of methods of the form {\tt set}{\it Component}{\tt ()} which may be used to set one component in Cartesian or spherical coordinates, or the $\rho$ cylindrical coordinate, keeping the other components in that system constant. \begin{shortlist} \item setX(HepDouble); \/\/\/ setPx(HepDouble); \item setY(HepDouble); \/\/\/ setPy(HepDouble); \item setZ(HepDouble); \/\/\/ setPz(HepDouble); \item setT(HepDouble); \/\/\/ setE(HepDouble); \item setTheta(HepDouble); \see{\ref{eq:polar}} \item setPhi(HepDouble); \see{\ref{eq:polar}} \item setRho(HepDouble); \/\/\/ setPerp(HepDouble); \see{\ref{eq:cylindrical}} \end{shortlist} The entire spatial component can be set at once, keeping the time component constant. \begin{shortlist} \item setVect(HepDouble); \/\/\/ setV(HepDouble); \end{shortlist} \noindent And there is a family of {\tt set()} methods, corresponding to the constructors, that may be used to update all four of a \LV 's coordinates at once. \begin{shortlist} \item set (x, y, z, t); \item set (v, t); \item set (t, x); \end{shortlist} \noindent Assignment from a \SV\ is supported, as in \verb|p = v;|. \noindent Finally, there are conversion operators to const and non-const Hep3Vector; these were present in the original CLHEP classes. They ignore the time component. \subsubsection{Operators} For \LV s p, p1, and p2, and for a scalar c, the following arithmetic operations are provided, in each case resulting in a \LV . \begin{shortlist} \item p1 + p2 and p1 $-$ p2 \item p $*$ c and c $*$ p \item p / c \item $-$ p \end{shortlist} \noindent In addition, the following arithmetic modify-assignment operations are provided. \begin{shortlist} \item p1 += p2 and p1 $-$= p2 \item p $*$= c and p /= c \end{shortlist} The usual six relational operations (==, !=, $<$, $<=$, $>$, $>=$) are provided (see eqn. \ref{eq:wcomp}). Further, the following member functions are useful to check for equality, etc., within a relative tolerance. \begin{shortlist} \item bool isNear( p, epsilon ) \see{\ref{eq:wisNear}} \item HepDouble howNear( p ) \see{\ref{eq:whowNear}, \ref{eq:whowNear:2}} \item bool isNearCM( p, epsilon ) \see{\ref{eq:wisNearCM}, \ref{eq:wisNearCM:2}} \item HepDouble howNearCM( p ) \see{\ref{eq:whowNearCM}, \ref{eq:whowNearCM:2}} \item bool isParallel( p, epsilon ) \see{\ref{eq:wisPar}, \ref{eq:wisPar:2}} \item HepDouble howParallel( p) \see{\ref{eq:whowPar}, \ref{eq:whowPar:2}} \item HepDouble deltaR( p ) \see{\ref{eq:deltaR}} \end{shortlist} \noindent The tolerance epsilon may be omitted. The following class-wide (static) functions are used to obtain and set the default tolerance for nearness. \begin{shortlist} \item HepDouble setTolerance( HepDouble tol ) \item HepDouble getTolerance(~) \end{shortlist} \subsubsection{Methods} \noindent Establishing a metric convention (static): \begin{shortlist} \item ZMpvMetric\_t setMetric( ZMpvMetric\_t m ) \item ZMpvMetric\_t getMetric(~) \end{shortlist} \noindent Metric-independent properties and methods of this 4-vector (the results of these methods do not change sign if you go from the TimePositive to the TimeNegative metric): \begin{shortlist} \item ostream \& operator$<<$( ostream \& os, p ) \item istream \& operator$>>$( istream \& is, LorentzVector \& p ) \item bool isSpacelike(~) \see{\ref{eq:wisSl}} \item bool isTimelike(~) \see{\ref{eq:wisTl}} \item bool isLightlike( epsilon ) \see{\ref{eq:wisLl}} \item HepDouble howLightlike(~) \see{\ref{eq:whowLl}, \ref{eq:whowLl:2}} \item HepDouble plus(~) \see{\ref{eq:wplus}} \item HepDouble minus(~) \see{\ref{eq:wminus}} \item HepDouble euclideanNorm2(~) \see{\ref{eq:wENorm2}} \item HepDouble euclideanNorm(~) \see{\ref{eq:wENorm}} \item HepDouble restMass2(~) \see{\ref{eq:wrestM2}} \item HepDouble restMass(~) \see{\ref{eq:wrestM}} \item HepDouble m2(~) \see{\ref{eq:winvMass2}} \item HepDouble invariantMass2(~) \see{\ref{eq:winvMass2}} \item HepDouble m(~) \/\/\/ mag(~) \see{\ref{eq:wmag}} \item HepDouble invariantMass(~) \see{\ref{eq:winvMass}} \item HepDouble mt2(~) \see{\ref{eq:wmt2}} \item HepDouble mt(~) \see{\ref{eq:wmt}} \item HepDouble et2(~) \see{\ref{eq:wet2}} \item HepDouble et(~) \see{\ref{eq:wet}} \item LorentzVector rest4Vector(~) \see{\ref{eq:wrest4V}} \item SpaceVector boostVector(~) \see{\ref{boostvector}} \item HepDouble beta(~) \see{\ref{eq:wbeta}} \item HepDouble gamma(~) \see{\ref{eq:wgamma}} \item HepDouble eta(~) \see{\ref{eq:weta}, \ref{eq:weta:2}, \ref{eq:weta:3}} \item HepDouble rapidity(~) \see{\ref{eq:wrapid}, \ref{eq:wrapid:2}} \item HepDouble coLinearRapidity(~) \see{\ref{eq:wcoLinRap}, \ref{eq:wcoLinRap:2}} \item SpaceVector findBoostToCM(~) \see{\ref{eq:wfindBoost}} \end{shortlist} \noindent Metric-dependent properties of this 4-vector: (the results of these methods change sign if you go from the TimePositive to the TimeNegative metric): \begin{shortlist} \item HepDouble mag2(~) \see{\ref{eq:wmag2}} \end{shortlist} \noindent Metric-independent methods combining two 4-vectors: \begin{shortlist} \item HepDouble delta2Euclidean( p ) \see{\ref{eq:wdelta2E}} \item HepDouble plus( p ) \see{\ref{eq:wplus:2}} \item HepDouble minus( p ) \see{\ref{eq:wminus:2}} \item HepDouble eta( p ) \see{\ref{eq:weta}, \ref{eq:weta:2}, \ref{eq:weta:3}, \ref{eq:weta:4}} \item HepDouble rapidity( p ) \see{\ref{eq:wrapid}, \ref{eq:wrapid:2}, \ref{eq:wrapid:3}, \ref{eq:wrapid:4}} \item HepDouble invariantMass2( p ) \see{\ref{eq:winvMass2}} \item HepDouble invariantMass( p ) \see{\ref{eq:winvMass}} \item SpaceVector findBoostToCM( p ) \see{\ref{eq:wfindBoost}} \end{shortlist} \noindent Metric-dependent methods combining two 4-vectors: \begin{shortlist} \item HepDouble dot( p ) \see{\ref{eq:wdot}, \ref{eq:wdot:2}} \item HepDouble operator*( p ) \see{\ref{eq:wdot}, \ref{eq:wdot:2}} \item HepDouble diff2( p ) \see{\ref{eq:wdiff2}} \end{shortlist} \noindent Methods involving properties of the spatial part of the 4-vector (these could be invoked as p.v().whatever() but the p.whatever() syntax is shorter). Most of these take a reference direction v; if v is omitted, $\hat{z}$ is implied and the methods take advantage of the simpler form. \begin{shortlist} \item HepDouble perp( v ) \see{\ref{eq:perp}} \item HepDouble perp2( v ) \see{\ref{eq:perp2}} \item HepDouble angle(~) \see{\ref{eq:angle}} \item setVectM(HepDouble); \/\/\/ setVectMag(HepDouble); \see{\ref{eq:polar}} \item setRho(HepDouble); \/\/\/ setPerp(HepDouble); \see{\ref{eq:cylindrical}} \item HepDouble pseudoRapidity(~) \see{\ref{eq:spherical}} \end{shortlist} \subsubsection{Rotations and Boosts} These methods change the 4-vector. \begin{shortlist} \item LorentzVector \& rotateX( delta ) \see{\ref{eq:rotX}} \item LorentzVector \& rotateY( delta ) \see{\ref{eq:rotY}} \item LorentzVector \& rotateZ( delta ) \see{\ref{eq:rotZ}} \item LorentzVector \& rotate( v, delta ) \see{\ref{eq:axisrot}} \item LorentzVector \& rotate( delta, v ) \see{\ref{eq:axisrot}} \item LorentzVector \& rotate( phi, theta, psi ) \see{\ref{eq:eulerrot}} \item LorentzVector \& rotate( EulerAngles \& e ) \see{\ref{eq:eulerrot}} \item LorentzVector \& rotateUz( v ) \see{\ref{eq:rotUz}} \item LorentzVector \& boostX( beta ) \see{\ref{eq:wbX}} \item LorentzVector \& boostY( beta ) \see{\ref{eq:wbY}} \item LorentzVector \& boostZ( beta ) \see{\ref{eq:wbZ}} \item LorentzVector \& boost( v ) \see{\ref{eq:wboostvec}} \item LorentzVector \& boost( v, beta ) \see{\ref{eq:pureboost}} \end{shortlist} \noindent The following methods all do $\vec{p} \Longleftarrow R p$ where $R$ is either a \Ro or a \LT . (Notice the order of multiplication for {\tt p *= R}.) \begin{shortlist} \item HepLorentzVector transform (const HepRotation \& R) \see{\ref{eq:wopstareq}} \item HepLorentzVector operator *= (const HepRotation \& R) \see{\ref{eq:wopstareq}} \item HepLorentzVector transform (const HepLorentzRotation \& R) \see{\ref{eq:wopstareq}} \item HepLorentzVector operator *= (const HepLorentzRotation \& R) \see{\ref{eq:wopstareq}} \end{shortlist} \noindent These functions return a new 4-vector. \begin{shortlist} \item LorentzVector rotationXOf( p, delta ) \see{\ref{eq:rotX}} \item LorentzVector rotationYOf( p, delta ) \see{\ref{eq:rotY}} \item LorentzVector rotationZOf( p, delta ) \see{\ref{eq:rotZ}} \item LorentzVector rotationOf( p, v, delta ) \see{\ref{eq:axisrot}} \item LorentzVector rotationOf( p, phi, theta, psi ) \see{\ref{eq:eulerrot}} \item LorentzVector rotationOf( p, const EulerAngles \& e ) \see{\ref{eq:eulerrot}} \item LorentzVector boostXOf( p, beta ) \see{\ref{eq:wbX}} \item LorentzVector boostYOf( p, beta ) \see{\ref{eq:wbY}} \item LorentzVector boostZOf( p, beta ) \see{\ref{eq:wbZ}} \item LorentzVector boostOf( p, betaVector ) \see{\ref{eq:wboostvec}} \item LorentzVector boostOf( p, v, beta ) \see{\ref{eq:pureboost}} \end{shortlist} \subsection{\protect\LVz\ Class --- Typedefed from \LV } The \LVz\ class provides backward compatibility with the original ZOOM PhysicsVectors package. It is simply a typedef off \LV , in the appropriate namespace. This is because there were no features or constructors in the ZOOM product which were felt to be overkill in the CLHEP context. \subsection{{\tt Hep2Vector} Class} The {\tt Hep2Vector} class is a simple plane vector. Throughout this section, arguments named s, s1, s2, etc., are of type {\tt Hep2Vector}. \subsubsection{Constructors and Accessors} \begin{shortlist} \item Hep2Vector(~) \item Hep2Vector( x, y ) \item Hep2Vector( Hep3Vector v ) \end{shortlist} \noindent That last constructor will supress the Z component of $\vec{v}$. Cartesian and polar coordinates may be accessed; these are identical to those of a \SV, with the Z component fixed at zero. \begin{shortlist} \item x(~) \/\/\/ y(~) \item r(~) \see{\ref{eq:polar}} \item phi(~) \see{\ref{eq:polar}} \end{shortlist} \noindent The Cartesian components may also be accessed by the index syntax, using either square braces or parentheses. In either case, the meaning of the index is 0-based, and an enum is provided to help clarify this: {\tt Hep2Vector::X=0}, {\tt Hep2Vector::Y=1}. \noindent There is a family of methods of the form {\tt set}{\it Component}{\tt ()} which may be used to set one component in Cartesian or Polar coordinates, keeping the other component constant. \begin{shortlist} \item setX(x) \/\/\/ setY(y) \item setR(r) \/\/\/ setMag(r) \see{\ref{eq:polar}} \item setPhi(phi) \see{\ref{eq:polar}} \end{shortlist} \noindent Finally, there is also a family of {\tt set()} methods that may be used to update all of a \SV 's three coordinates at once. These {\tt set()} methods' signatures are in one-to-one correspondence with the non-default constructors listed above. \subsubsection{Operators} For {\tt Hep2Vector}s s, s1, and s2, and for a scalar c, the following arithmetic operations are provided, in each case resulting in a {\tt Hep2Vector}. \begin{shortlist} \item s1 + s2 and s1 $-$ s2 \item s $*$ c and c $*$ s \item s / c \item $-$ s \end{shortlist} \noindent In addition, the following arithmetic modify-assignment operations are provided. \begin{shortlist} \item s1 += s2 and v1 $-$= s2 \item s $*$= c and v /= c \end{shortlist} \noindent The usual six relational operations (==, !=, $<$, $<=$, $>$, $>=$) are provided (see eqn. \ref{eq:compSV}). Further, the following member functions are useful to check for equality within a relative tolerance. (Again, these match the corresponding methods for \SV, with Z-component pinned at zero.) \begin{shortlist} \item bool isNear( v, epsilon ) \see{\ref{eq:isNear}} \item Scalar howNear( v ) \see{\ref{eq:howNear}, \ref{eq:howNear:2}, \ref{eq:howNear:3}} \item Scalar deltaR( v ) \see{\ref{eq:deltaR}} \end{shortlist} \noindent The tolerance epsilon may be omitted. The following class-wide (static) functions are used to obtain and set the default tolerance for nearness. \begin{shortlist} \item HepDouble setTolerance( tol ) \see{\ref{eq:epsildef}} \item HepDouble getTolerance(~) \end{shortlist} \subsubsection{Methods} The set of methods is somewhat simpler that for \SV, but in all applicable cases the definitions match those for \SV: \begin{shortlist} \item ostream \& operator$<<$( ostream \& os, s ) \end{shortlist} \begin{shortlist} \item HepDouble dot( v ) \see{\ref{eq:dot}} \item bool isParallel( v, epsilon ) \see{\ref{eq:isPar}} \item bool isOrthogonal( v, epsilon ) \see{\ref{eq:isOrtho}} \item HepDouble howParallel( v ) \see{\ref{eq:howPar}, \ref{eq:howPar:2}} \item HepDouble howOrthogonal( v ) \see{\ref{eq:howOrtho}, \ref{eq:howOrtho:2}} \item HepDouble angle( s2 ) \see{\ref{eq:angle}} \end{shortlist} \begin{shortlist} \item HepDouble mag2(~) \see{\ref{eq:mag2}} \item HepDouble mag(~) \see{\ref{eq:mag}, \ref{eq:mag:2}} \item Hep2Vector unit(~) \see{\ref{eq:svunit}} \end{shortlist} \noindent There is one method which is applicable for {\tt Hep2Vector} but which does not match the definition for \SV: \begin{shortlist} \item Hep2Vector orthogonal(~) \end{shortlist} \noindent \verb$s.orthogonal()$ is $s$ rotated clockwise by $90^\circ$ if $|s_x| < |s_y|$, and counterclockwise by $90^\circ$ if $|s_x| \geq |s_y|$, and counterclockwise. \vspace{.16 in} In the ZOOM area, the class {\tt PlaneVector} is typedefed to {\tt Hep2Vector}. \subsection{\protect\Ro\ Classes} Throughout this section, arguments named r, r1, r2, etc., are of type \Ro. Also, rowX, rowY, rowZ, colX, colY, colZ will represent \SV\ arguments. \subsubsection{Constructors and Accessors} \begin{shortlist} % // construct an identity rotation by default: \item Rotation(~) % // copy/assign any rotation: \item Rotation( r ) \item Rotation \& operator=( r ) \item Rotation \& set( r ) % // supply three Euler angles(in radians): \item Rotation( phi, theta, psi ) \see{\ref{eq:eulerrot}} \item Rotation \& set( phi, theta, psi ) \see{\ref{eq:eulerrot}} % // supply EulerAngles structure: \item Rotation( const EulerAngles \& e ) \see{\ref{eq:eulerrot}} \item Rotation \& set( const EulerAngles \& e ) \see{\ref{eq:eulerrot}} % // supply axis and angle: \item Rotation( const Hep3Vector \& axis, delta ) \see{\ref{eq:axisrot}} \item Rotation \& set( const Hep3Vector \& axis, delta ) \see{\ref{eq:axisrot}} % // supply AxisAngle structure: \item Rotation( const AxisAngle \& ax ) \see{\ref{eq:axisrot}} \item Rotation \& set( const AxisAngle \& ax ) \see{\ref{eq:axisrot}} % // supply three *orthogonal* UnitVectors for the columns: \item Rotation( colX, colY, colZ ) \item Rotation \& set( colX, colY, colZ ) \item Rotation \& setRows( rowX, rowY, rowZ ) % // NOTE: % // This constructor and set method will check that the % // cols form an orthonormal matrix, and adjust so that % // relation is as exact as possible. % // supply ZMpvRep3x3 structure: \item Rotation( const ZMpvRep3x3 \& rep ) \item Rotation \& set( const ZMpvRep3x3 \& rep ) % // WARNING: % // This constructor and set method will assume the % // ZMpvRep3x3 supplied is infact an orthogonal matrix. % // No checking or correction is done. If you are % // not certain the matrix is orthogonal, break it % // into three SpaceVector cols and use the form % // Rotation(UnitVector, UnitVector, UnitVector) \end{shortlist} \begin{shortlist} \item phi(~) \/\/\/ theta(~) \/\/\/ psi(~) \see{\ref{eq:eulerrot},\ref{eq:phipsiconv},\ref{eq:thetaconv}} \item eulerAngles(~) \see{\ref{eq:eulerrot},\ref{eq:phipsiconv},\ref{eq:thetaconv}} \item axis(~) \/\/\/ delta(~) \item axisAngle(~) \see{\ref{eq:axisrot},\ref{eq:deltaconv}} %// for orthogonal unit vectors \item colX(~) \/\/\/ colY(~) \/\/\/ colZ(~) \item rowX(~) \/\/\/ rowY(~) \/\/\/ rowZ(~) % // for individual elements: \item xx(~) \/\/\/ xy(~) \/\/\/ xz(~) \item yx(~) \/\/\/ yy(~) \/\/\/ yz(~) \item zx(~) \/\/\/ zy(~) \/\/\/ zz(~) % // for all 9 elements: \item HepRep3x3 rep3x3(~) % // for a 16-element xyzt matrix: \item HepRep4x4 rep4x4(~) \end{shortlist} And the matrix elements of a \Ro\ may be accessed using two integer indices in parentheses or square brackets, with indices running from 0 to 2. The following methods alter one component of a \Ro, in some way of viewing that rotation: \begin{shortlist} \item setPhi(HepDouble) \/\/\/ setTheta(HepDouble) \/\/\/ setPsi(HepDouble) \see{\ref{eq:eulerrotR}} \item setAxis(Hep3Vector) \/\/\/ setDelta(Hep3Vector) \see{\ref{eq:axisrotR}} \end{shortlist} \subsubsection{Use of \protect\Ro\ as a 4-Rotation} The \Ro\ may be considered to be a 4-rotation. Thus, other accessors applicable to \LT\ (see section (\ref{ltmethods})) may be applied to \Ro\ as well. \subsubsection{Operators and Methods} % // arithmetic: \begin{shortlist} \item Rotation \& operator\verb$*=$( r ) \item friend Rotation operator$*$( r1, r2 ) \end{shortlist} % // relative comparison: \begin{shortlist} \item static HepDouble getTolerance(~) \see{\ref{eq:epsildefR}} \item static HepDouble setTolerance( tol ) \item bool isNear( r, epsilon ) \see{\ref{eq:nearrot}} \item HepDouble howNear( r ) \see{\ref{eq:nearrot}} \item HepDouble distance2( r ) \see{\ref{eq:dist2rot}} \end{shortlist} % // ordering comparison: \begin{shortlist} \item r1 == r2 \/\/\/ r1 != r2 \item r1 $>$ r2 \/\/\/ r1 $>=$ r2 \/\/\/ r1 $<$ r2 \/\/\/ r1 $<=$ r2 \see{\ref{eq:ordrot}} \end{shortlist} % // ---------- Apply rotations: \begin{shortlist} \item Hep3Vector operator(~)~( const Hep3Vector \& v ) \see{\ref{eq:Rv}} \item Hep3Vector operator* ~ ( const Hep3Vector \& v ) \see{\ref{eq:Rv}} \item LorentzVector operator(~)~( const LorentzVector \& p ) \see{\ref{eq:Rv}} \item LorentzVector operator* ~ ( const LorentzVector \& p ) \see{\ref{eq:Rv}} \end{shortlist} \begin{shortlist} \item HepDouble norm2(~) \see{\ref{eq:norm2rot}} \item HepDouble isIdentity(~) \item ostream \& print ( ostream \& os ) \item ostream \& operator$<<$( ostream \& os, const RotationInterface \& r ) \item rectify(~) \see{\ref{eq:rectRot}} \end{shortlist} \subsubsection{The Rotation Group} The following methods use \Ro s as a group, that is, they invert, multiply, and so forth: \begin{shortlist} % // multiplication \item Hep3Rotation operator* ~ ( const Hep3Rotation \& r ) \see{\ref{eq:opmulrot}} \item operator*= ~ ( const Hep3Rotation \& r ) \see{\ref{eq:opstrot}} \item transform ~ ( const Hep3Rotation \& r ) \see{\ref{eq:transrot}} \item RotateX (delta) \/\/\/ RotateY (delta) \/\/\/ RotateZ (delta) \see{\ref{eq:xyzrot}} \item RotateAxes (newX, newY, newZ) \see{\ref{eq:rotaxes}} % // inversion: \item invert(~) \item HepRotation inverse(~) \item HepRotation inverseOf( r ) \end{shortlist} \subsubsection{Axial Rotations} There are threee specialized rotation classes, {\tt HepRotationX}, {\tt HepRotationZ}, and {\tt HepRotationZ}. These use substantially less storage than the general \Ro, and for some methods it is quicker to work with a specialized axial rotation rather than the general case. All information which can be obtained from a general \Ro\ can be obtained from any of these specialized axial rotations. However, the set of methods which modify the rotations are very restricted for the specialized cases: \begin{shortlist} % // supply angle of rotation(an identity rotation by default): \item RotationX(~) \item RotationX( delta ) \see{\ref{eq:rotX}} \item RotationX \& set( delta ) \see{\ref{eq:rotX}} \item RotationY(~) \item RotationY( delta ) \see{\ref{eq:rotY}} \item RotationY \& set( delta ) \see{\ref{eq:rotY}} \item RotationZ(~) \item RotationZ( delta ) \see{\ref{eq:rotZ}} \item RotationZ \& set( delta ) \see{\ref{eq:rotZ}} \end{shortlist} \subsection{\protect\Ros\ Class --- Derived from \Ro } The \Ros\ classes (which also include {\tt RotationX}, {\tt RotationY}, and {\tt RotationZ}) provide backward compatibility with the original ZOOM PhysicsVectors package. These are simply typedefs the corresponding CLHEP classes, in the appropriate namespace. This is because there were no features or constructors in the ZOOM product which were felt to be overkill in the CLHEP context. The {\tt Rotation.h} header in the ZOOM area also defines {\tt ZMpvRep3x3}, {\tt ZMpvRep3x3}, and {\tt ZMpvRep3x3} which are typedefs for the corresponding CLHEP structs. \subsection{\protect\LT\ Classes} \label{ltmethods} There are three sorts of Lorentz transformation objects suppoprted: General \LT s, pure Lorentz boosts {\tt HepBoost}, and pure boosts along axes {\tt HepBoostX}, {\tt HepBoostY}, {\tt HepBoostZ}. (Technically, ordinary \Ro s and axial rotations can also be considered as Lorentz transformations, and indeed one of those classes can be used wherever a general Lorentz transformation is called for. The class {\tt Hep4RotationInterface} represents the abstract concept. But the rotation classes have been defined above, so we will restrict this section to discussing transformations involving the time component.) Throughout this section, arguments named lt, lt1, lt2, etc., are of type \LT, arguments named b, b1, b2, etc., are of type \LB, and arguments named r, r1, r2, etc., are of type \Ro . Arguments named R can be any sort of {\tt Hep4RotationInterface} including \LT s, boosts, rotations, and axial boosts and rotations. Also, row1, row2, row3, row4, col1, col2, col3, col4 will represent \LV\ arguments. \subsubsection{Constructors and Accessors---HepLorentzRotation} \begin{shortlist} % // construct an identity transformation by default: \item HepLorentzRotation(~) % // copy/assign \item HepLorentzRotation ( lt ) \item HepLorentzRotation ( r ) \item HepLorentzRotation ( R ) \item HepLorentzRotation \& operator=( lt ) \item HepLorentzRotation \& operator=( r ) \item HepLorentzRotation \& operator=( R ) \item HepLorentzRotation \& set( lt ) \item HepLorentzRotation \& set( r ) \item HepLorentzRotation \& set( R ) % // supply boost \item HepLorentzRotation ( Hep3Vector boostVector ) \item HepLorentzRotation ( HepBoost boost ) \item HepLorentzRotation ( boostX, boostY, boostZ ) \item HepLorentzRotation \& set ( Hep3Vector boostVector ) \item HepLorentzRotation \& set ( HepBoost boost ) \item HepLorentzRotation \& set ( boostX, boostY, boostZ ) % // supply R and B \item HepLorentzRotation ( b, r ) \see{\ref{eq:decomBR}} \item HepLorentzRotation \& set( b, r ) \item HepLorentzRotation ( r, b ) \see{\ref{eq:decomRB}} \item HepLorentzRotation \& set( b, r ) % // supply LorentzVectors for the cols: \item HepLorentzRotation( col1, col2, col3, col4 ) \item HepLorentzRotation \& set( col1, col2, col3, col4 ) \item HepLorentzRotation \& setRows( row1, row2, row3, row4 ) % // NOTE: % // This constructor and set method will check that the % // cols form an orthonormal matrix, and adjust so that % // relation is as exact as possible. % // supply HepRep4x4 structure: \item HepLorentzRotation( const HepRep4x4 \& rep ) \item HepLorentzRotation \& set( const HepRep4x4 \& rep ) % // output \item print ( ostream \& os ) \end{shortlist} \subsubsection{Constructors and Accessors---HepBoost} \begin{shortlist} \item HepBoost(~) \item HepBoost( b ) \item HepBoost \& set( b ) % // supply axis and beta; \item HepBoost ( const Hep3Vector \& direction, beta ) \see{\ref{eq:boostform}} \item HepBoost \& set( const Hep3Vector \& direction, beta ) \item HepBoost ( const Hep3Vector \& betaVector ) \see{\ref{eq:boostform}} \item HepBoost \& set( const Hep3Vector \& betaVector ) \item HepBoost ( betaX, betaY, betaZ ) \see{\ref{eq:boostform}} \item HepBoost \& set( betaX, betaY, betaZ ) \item HepBoost( const HepRep4x4Symmetric \& rep ) \item HepBoost \& set( const HepRep4x4Symmetric \& rep ) \subsubsection{Constructors and Accessors---Axial Boosts} % // supply beta \item HepBoostX(~) \item HepBoostX( beta ) \see{\ref{eq:boostx}} \item HepBoostX \& set( beta ) \item HepBoostY(~) \item HepBoostY( beta ) \item HepBoostY \& set( beta ) \item HepBoostZ(~) \item HepBoostZ( beta ) \item HepBoostZ \& set( beta ) \end{shortlist} \subsubsection{Components and Decomposition} \begin{shortlist} \item decompose(HepBoost \& b, HepRotation \& r) \see{\ref{eq:decomBR}} \item decompose(HepRotation \& r, HepBoost \& b) \see{\ref{eq:decomRB}} %// for orthosymplectic Lorentz vectors \item col1(~) \/\/\/ col2(~) \/\/\/ col3(~) \/\/\/ col4(~) \item row1(~) \/\/\/ row2(~) \/\/\/ row3(~) \/\/\/ row4(~) % // for individual elements: \item xx(~) \/\/\/ xy(~) \/\/\/ xz(~) \/\/\/ xt(~) \item yx(~) \/\/\/ yy(~) \/\/\/ yz(~) \/\/\/ yt(~) \item zx(~) \/\/\/ zy(~) \/\/\/ zz(~) \/\/\/ zt(~) \item tx(~) \/\/\/ ty(~) \/\/\/ tz(~) \/\/\/ tt(~) % // for all 16 elements: \item HepRep4x4 rep4x4(~) \end{shortlist} \begin{shortlist} \item ostream \& operator$<<$( ostream \& os, const Hep4RotationInterface \& lt ) \end{shortlist} \noindent Also, components can be accessed by C-style and array-style subscripting: \begin{shortlist} \item lt[i][j] \see{\ref{eq:ltsubscript}} \item lt(i,j) \see{\ref{eq:ltsubscript}} \end{shortlist} The following are applicable to \LB\ but not to \LT: \begin{shortlist} \item Hep3vector direction(~) \/\/\/ beta(~) \/\/\/ gamma(~) \item Hep3Vector boostVector(~) \item HepRep4x4Symmetric rep4x4Symmetric(~) \end{shortlist} \subsubsection{Application to 4-vectors} % // ---------- Apply \begin{shortlist} \item LorentzVector operator*~( const LorentzVector \& w ) \item LorentzVector operator(~)~( const LorentzVector \& w ) \end{shortlist} \subsubsection{Comparisons and Nearness} % // intolerant comparison: \begin{shortlist} \item lt1 == lt2 \/\/\/ lt1 != lt2 \see{\ref{eq:ltexact}} \item lt1 $>$ lt2 \/\/\/ lt1 $>=$ lt2 \/\/\/ lt1 $<$ lt2 \/\/\/ lt1 $<=$ lt2 \see{\ref{eq:ltorder}} \item isIdentity() \end{shortlist} % // tolerant comparison: \begin{shortlist} \item getTolerance(~) \see{\ref{eq:epsildefR}} \item setTolerance( tol ) \item int compare(lt) \see{\ref{eq:ltorder}} \item bool isNear( lt, epsilon ) \see{\ref{eq:nearboost}, \ref{eq:isnearLT}} \item double distance2( lt ) \see{\ref{eq:hownearboost}, \ref{eq:isnearLT}} \item double howNear( lt ) \see{\ref{eq:hownearboost}, \ref{eq:isnearLT}} \item double norm2() \see{\ref{eq:boostnorm2}, \ref{eq:ltnorm2}} \end{shortlist} \subsubsection{Arithmetic in the Lorentz Group} % // arithmetic: \begin{shortlist} \item lt1 * lt2 \item HepLorentzRotation \& operator\verb$*=$( lt ) \item HepLorentzRotation \& operator\verb$*=$( b ) \item HepLorentzRotation \& operator\verb$*=$( r ) \item HepLorentzRotation \& transform ( lt ) \see{\ref{eq:lttrans}} \end{shortlist} % // inversion: \begin{shortlist} \item invert(~) \item HepLorentzRotation inverseOf( lt ) \end{shortlist} % // boosts and rotations \begin{shortlist} \item HepLorentzRotation \& rotate ( delta, axis ) \see{\ref{eq:ltrot}} \item HepLorentzRotation \& rotateX ( delta ) \item HepLorentzRotation \& rotateY ( delta ) \item HepLorentzRotation \& rotateZ ( delta ) \item HepLorentzRotation \& boost ( betaX, betaY, betaZ) \see{\ref{eq:ltboost}} \item HepLorentzRotation \& boost ( v ) \see{\ref{eq:ltboost}} \item HepLorentzRotation \& boostX ( beta ) \item HepLorentzRotation \& boostY ( beta ) \item HepLorentzRotation \& boostZ ( beta ) \end{shortlist} % // rectify \begin{shortlist} \item rectify(~) \see{\ref{eq:rectLT}} \end{shortlist} \subsubsection{Arithmetic on Boosts} The pure boosts do not form a group, since the product of two boosts is a Lorentz transformation which in general involves a rotation. The pure boosts along an axial direction do form groups. \begin{shortlist} \item LorentzBoost inverseOf( b ) \item LorentzBoostX inverseOf( LorentzBoostX bx ) \item LorentzBoostY inverseOf( LorentzBoostY by ) \item LorentzBoostZ inverseOf( LorentzBoostZ bz ) \end{shortlist} \begin{shortlist} \item bx = bx1 * bx2 \item by = by1 * by2 \item bz = bz1 * bz2 \end{shortlist} \subsection{\protect\LTs\ Class --- Derived from \LT } The \LT\ classes provides backward compatibility with the original ZOOM PhysicsVectors package. It is defined in {\tt LorentzTransformation.h} in the ZOOM area, and is a typedef for \LT, in the appropriate namespace. This is because there were no features or constructors in the ZOOM product which were felt to be overkill in the CLHEP context. Similarly, that files establishes typedefs {\tt LorentzBoost} for {\tt HepBoost}, {\tt LorentzBoostX} for {\tt HepBoostX}, {\tt LorentzBoostY} for {\tt HepBoostY}, and {\tt LorentzBoostZ} for {\tt HepBoostZ}. Also, for any ZOOM users using {\tt LorentzTransformationInterface}, this is typedefed in {\tt LorentzTransformation.h} as {\tt Hep4RotationInterface}. \newpage \section{\protect\SV\ and \protect\SVz\ Classes} \SV s may be expressed as Cartesian coordinates, Spherical coordinates, or Cylindrical coordinates. \begin{eqnarray} ( x, y, z ) \label{eq:cartesian}\\ ( r, \theta, \phi ) \nonumber \\ \left\{ \begin{array}{r} x = r \sin \theta \cos \phi \\ y = r \sin \theta \sin \phi \\ z = r \cos \theta \label{eq:polar} \end{array} \right. \\ ( \rho, \phi, z ) \nonumber \\ \left\{ \begin{array}{r} x = \rho \cos \phi \\ y = \rho \sin \phi \\ z = z \label{eq:cylindrical} \end{array} \right. \end{eqnarray} For Spherical coordinates one may optionally specify the pseudorapidity $\eta$ instead of $\theta$. \begin{eqnarray} \left( \rho, \phi, \eta = - \ln { \tan { \frac {\theta}{2} } } \right) \label{eq:spherical} \end{eqnarray} When accessing the angles in Sperical coordinates, the values obtained will always be in the range $0 \leq \theta \leq \pi$ and $-\pi < \phi \leq +\pi$. \subsection {Dot and Cross Products} \noindent Let $\vec{v}_{1}$ and $\vec{v}_{2}$ be \SV s. Then: \begin{eqnarray} \vec{v}_{1}.\mbox{dot} (\vec{v}_{2}) \equiv \vec{v}_{1} \cdot \vec{v}_{2} = \sum_{i} \vec{v}_{1i} \vec{v}_{2i} \label{eq:dot} \\ \vec{v}_{1}.\mbox{cross} (\vec{v}_{2}) \equiv \vec{v}_{1} \times \vec{v}_{2} = \stackrel{\longrightarrow} { {\textstyle \left( \sum_{jk} \epsilon_{ijk} \vec{v}_{1j} \vec{v}_{2k} \right) } } \label{eq:cross} \\ \vec{v}_{1}.\mbox{diff2} (\vec{v}_{2}) = \left| \vec{v}_{1} - \vec{v}_{2} \right| ^ 2 \label{eq:diff2} \end{eqnarray} \noindent Here, $\epsilon_{ijk}$ is the three-index anti-symmetric symbol. \subsection {Near Equality and isOrthogonal/isParallel} \noindent We structure the definitions of near equality and orthogonal/parallel such that they are commutative (order of vectors makes no difference), rotationally invariant, and scale invariant (multiplying both vectors by the same non-zero constant makes no difference). They also match the definitions of relative equality (or perpendicularity or parallelism) within $\epsilon$ for the case where each vector is along or near an axis. This fixes the definitions, up to order $\epsilon$. \noindent Let the method {\tt isNear()} be represented by the symbol $\approx$, and let $\vec{v}_{1}, \vec{v}_{2}$ be \SV s. Then: \begin{equation} \label{vecisnear} \vec{v}_{1} \approx \vec{v}_{2} \mbox{ if } \left| \vec{v}_{1} - \vec{v}_{2} \right| ^ 2 \leq \epsilon^2 \vec{v}_{1} \cdot \vec{v}_{2} \label{eq:isNear} \end{equation} \noindent However, if $\vec{v}_{1}$ and/or $\vec{v}_2$ is known to be a UnitVector (designated as $\hat{u}_{1}$), this sets a meaningful scale---if the vectors are nearly equal, they are both of magnitude near unity. In that case a simpler absolute formula, which is which is equivalent to order $\epsilon$ to the relative criterion \ref{vecisnear}, is used: \begin{equation} \hat{u}_{1} \approx \vec{v}_{2} \mbox{ if } \left| \hat{u}_{1} - \vec{v}_{2} \right| ^ 2 \leq \epsilon^2 \end{equation} \noindent Tests for {\tt v1.isParallel(v2)} and {\tt v1.isOrthogonal(v2)} utilize the dot and cross products: \begin{eqnarray} \vec{v}_{1} \parallel \vec{v}_{2} \mbox{ if } \left| \frac{\vec{v}_{1} \times \vec{v}_{2}} {\vec{v}_{1} \cdot \vec{v}_{2}} \right| ^2 \le \epsilon^2 \label{eq:isPar} \\ \vec{v}_{1} \perp \vec{v}_{2} \mbox{ if } \left| \frac{\vec{v}_{1} \cdot \vec{v}_{2}} {\vec{v}_{1} \times \vec{v}_{2}} \right| ^2 \le \epsilon^2 \label{eq:isOrtho} \end{eqnarray} \noindent Care is taken to avoid taking products of more than two potentially large quantities in evaluating these. Thus these tests can be done on any vectors which could safely be squared. \noindent $\epsilon$ is assumed to be small; in some cases, short cuts are taken to determine the result without potentially generating large quantities. These techniques are not necessarily faithful to the above formulae when $\epsilon \ge 1$. \noindent The definition of {\tt v1.isParallel(v2)} is equivalent, to order $\epsilon$, to a simple (but computationally more expensive) definition involving normalizing the vectors: \begin{displaymath} \vec{v}_{1} \parallel \vec{v}_{2} \mbox{ if } \left| \hat{v}_{1} - \hat{v}_{2} \right| ^2 \le \epsilon^2 \end{displaymath} \noindent If one of the vectors is the zero vector, the above relations may be ambiguous instead the following hold: ($\vec{v}$ here is any non-zero vector): \begin{eqnarray} \vec{v} \approx \vec{0} \mbox{ iff } \vec{v} = \vec{0} \\ \vec{v} \perp \vec{0} \mbox{ for all } \vec{v} \\ \vec{v} \parallel \vec{0} \mbox{ iff } \vec{v} = \vec{0} \end{eqnarray} \noindent The default tolerance (which may be modified by the class static method {\tt setTolerance()}) for vectors and Lorentz vectors is 100 times the double precision epsilon. \begin{equation} \epsilon_{\mbox{default}} \approx 2.2 \cdot 10^{-14} \label{eq:epsildef} \end{equation} \subsection {Measures of Near-ness} Each boolean tolerance comparison method is accompanied by a method returning the measure used to compare to the tolerance $\epsilon$. The formulae can be deduced from those above: \begin{eqnarray} \vec{v}_{1} \mbox{.howNear} (\vec{v}_{2}) = \max \left( \sqrt{ \frac {\left| \vec{v}_{1} - \vec{v}_{2} \right| ^ 2} {\vec{v}_{1} \cdot \vec{v}_{2}} } , 1 \right) \label{eq:howNear} \\ \vec{v}_{1} \mbox{.howParallel} (\vec{v}_{2}) = \max \left( \left| \frac{\vec{v}_{1} \times \vec{v}_{2}} {\vec{v}_{1} \cdot \vec{v}_{2}} \right| , 1 \right) \label{eq:howPar} \\ \vec{v}_{1} \mbox{.howOrthogonal} (\vec{v}_{2}) = \max \left( \left| \frac{\vec{v}_{1} \cdot \vec{v}_{2}} {\vec{v}_{1} \times \vec{v}_{2}} \right| , 1 \right) \label{eq:howOrtho} \end{eqnarray} \noindent The above relative measures are limited to a maximum of 1; cases where the denominator would be zero may safely be done without overflow. (Of course, {\tt howParallel()} and {\tt howOrthogonal()} are close to zero for nearly parallel and perpendicular vectors, respectively). Note that since a UnitVector has a natural absolute scale, the {\tt Unitvector::howNear()} method is absolute, not relative. When a comparison method involves absolute tolerance, the measure returned is not truncated at 1: \begin{eqnarray} \hat{u}_{1} \mbox{.howNear} (\vec{v}_{2}) = \vec{v}_{2} \mbox{.howNear} (\hat{u}_{1}) = \left| \hat{u}_{1} - \vec{v}_{2} \right| \label{eq:howNear:2} \end{eqnarray} In addition, we provide \verb$deltaR()$, a measure of nearness useful in collider physics analysis. It is defined by \begin{equation} \vec{v}_{1} \mbox{deltaR} (\vec{v}_{2}) = \sqrt{ (\Delta \phi)^2 + (\Delta \eta)^2) } = \sqrt{ \left( \vec{v}_{1}\mbox{.phi} - \vec{v}_{2}\mbox{.phi} \right)^2 + \left( \vec{v}_{1}\mbox{.eta} - \vec{v}_{1}\mbox{.eta} \right)^2 } \label{eq:deltaR} \end{equation} \noindent where of course the angular $\phi$ difference is corrected to lie in the range $(-\pi, \pi]$ (the {\tt deltaPhi()} method is used). When one vector or the other is zero, \begin{eqnarray} \vec{v} \mbox{.howNear} (\vec{0}) = \vec{0} \mbox{.howNear} (\vec{v}) = 1 \label{eq:howNear:3} \\ \vec{v} \mbox{.howParallel} (\vec{0}) = \vec{0} \mbox{.howParallel} (\vec{v}) = 1 \label{eq:howPar:2} \\ \vec{v} \mbox{.howOrthogonal} (\vec{0}) = \vec{0} \mbox{.howOrthogonal} (\vec{v}) = 0 \label{eq:howOrtho:2} \\ \vec{v} \mbox{.deltaR} (\vec{0}) = \vec{0} \mbox{.deltaR} (\vec{v}) = \left| \Delta \eta \right| = \left| \vec{v}\mbox{.eta()} \right| \label{eq:deltaR:2} \end{eqnarray} When both vectors are zero, all these measures will return zero. \subsubsection{Ordering Comparisons for \protect\SV s} The comparison operators \verb$ ( >, >=, <, <= )$ for \SV\ (and for \UV) use a ``dictionary ordering'', comparing first the Z, then the Y, then the X components: \begin{eqnarray} \vec{v}_1 > \vec{v}_2 \mbox{ if } \nonumber \\ z_1 > z_2 \mbox { or } \nonumber \\ \left[ z_1 = z_2 \mbox { and } y_1 > y_2 \right] \mbox { or } \nonumber \\ \left[ z_1 = z_2 \mbox { and } y_1 = y_2 \mbox { and } x_1 > x_2 \right] \label{eq:compSV} \end{eqnarray} \subsection{Intrinsic Properties and Relativistic Quantities} A \SV\ does not have much in the way of intrinsic properties---just its magnitude. We can also talk about the pseudorapidity, which depends only on the angle against the Z axis. \begin{eqnarray} \vec{v1}\mbox{.mag() } = \sqrt { \vec{v}_{1} \cdot \vec{v}_{1} } \label{eq:mag} \\ \vec{v1}\mbox{.mag2() } = \vec{v}_{1} \cdot \vec{v}_{1} \label{eq:mag2} \\ \vec{v1}\mbox{.eta() } = -\ln \tan \frac {\theta_{\vec{v}_1,\hat{z}}}{2} = -\ln \tan \frac {\hat{v}_1 \cdot \hat{z}}{2} \label{eq:eta} \end{eqnarray} Another intrinsic is the unit vector in the direction of $\vec{v}$: \begin{eqnarray} \vec{v}\mbox{.unit() } = \frac{\vec{v}}{|v|} \label{eq:svunit} \end{eqnarray} A somewhat contrived intrinsic property, useful for Geant4, is a special vector orthognal to $\vec{v}$, lying in a plane defined by two coordinate axes. The plane is chosen so as to supress the smallest component of $\vec{v}$. \begin{eqnarray} \min( v_x, v_y, v_z ) = v_z \Longrightarrow \vec{v}\mbox{.orthogonal() } = \left\{ v_y, -v_x, 0 \right\} \label{eq:orthogonal} \\ \min( v_x, v_y, v_z ) = v_y \Longrightarrow \vec{v}\mbox{.orthogonal() } = \left\{ -v_z, 0, v_x \right\} \nonumber \\ \min( v_x, v_y, v_z ) = v_z \Longrightarrow \vec{v}\mbox{.orthogonal() } = \left\{ 0, v_z, -v_y \right\} \nonumber \end{eqnarray} (In the case of equal components, $v_z$ is considered smallest, then $v_y$.) \noindent A \SV\ of length less than 1 may be considered as defining a Lorentz boost; in that sense, we can discuss $\beta$ and $\gamma$ of the \SV, and the rapidity associated with that boost. \begin{eqnarray} \vec{v1}\mbox{.beta() } = \vec{v1}\mbox{ .mag() } = \beta \label{eq:mag:2} \label{eq:beta} \\ \vec{v1}\mbox{.gamma() } = \frac{1} {\sqrt {1-\beta^2 } } = \gamma \label{eq:gamma} \\ \vec{v1}\mbox{.rapidity() } = \tanh^{-1} (\vec{v}_{1} \cdot \hat{z}) \label{eq:rap} \\ \vec{v1}\mbox{.coLinearRapidity() } = \tanh^{-1} \beta = \tanh^{-1} (\vec{v}_{1} \cdot \hat{v}_1) \label{eq:coLinRap} \end{eqnarray} The rapidity and pseudorapidity are discussed further in section \S{\ref{rapidity}}. \subsection{Properties Involving Vectors and Directions} Let a reference direction be represented by a unit vector $\hat{u}$ in that direction. In all the following methods, the reference direction may be omitted, defaulting to $\hat{\bf z}$. And in these methods, a {\em non-zero} second vector may be substituted for $\hat{u}$; the unit vector in the direction of $\vec{v}_2$ will be used in that case. Then the following definitions of methods relative to the reference direction apply: \begin{eqnarray} \vec{v}\mbox{.angle} (\hat{u}) = \theta_{\vec{v},\hat{u}} = \cos^{-1} \left( \frac{ \vec{v} \cdot \hat{u} } { \left| \vec{v} \right| } \right) \label{eq:angle} \label{eq:theta} \\ \vec{v}\mbox{.cosTheta} (\hat{u}) = \cos \theta_{\vec{v},\hat{u}} \label{eq:cosTheta} \\ \vec{v}\mbox{.cos2Theta} (\hat{u}) = \cos^2 \theta_{\vec{v},\hat{u}} \label{eq:cos2Theta} \\ \vec{v}\mbox{.eta} (\hat{u}) = -\ln \tan \frac {\theta_{\vec{v},\hat{u}}}{2} \label{eq:eta:2} \\ \vec{v}\mbox{.rapidity} (\hat{u}) = \tanh^{-1} (\vec{v}_{1} \cdot \hat{u}) \label{eq:rap:2} \\ \vec{v}\mbox{.perp} (\hat{u}) = \left| \vec{v} - (\vec{v} \cdot \hat{u}) \hat{u} \right| \label{eq:perp} \\ \vec{v}\mbox{.perp2} (\hat{u}) = \left| \vec{v} - (\vec{v} \cdot \hat{u}) \hat{u} \right| ^2 \label{eq:perp2} \\ \vec{v}\mbox{.perpPart} (\hat{u}) = \vec{v} - \hat{u} \cos \theta_{\vec{v},\hat{u}} \left| \vec{v} \right| = \vec{v} - (\vec{v} \cdot \hat{u}) \hat{u} \label{eq:perpPart} \\ \vec{v}\mbox{.project} (\hat{u}) = \hat{u} \cos \theta_{\vec{v},\hat{u}} \left| \vec{v} \right| = (\vec{v} \cdot \hat{u}) \hat{u} \label{eq:project} \\ \vec{v}\mbox{.polarAngle} (\vec{v_2}) \equiv \vec{v}\mbox{.polarAngle} (\vec{v_2}, \hat{z}) = \vec{v_2}\mbox{.theta()} - \vec{v}\mbox{.theta()} \label{eq:polarA} \\ \vec{v}\mbox{.polarEta} (\vec{v_2}) \equiv \vec{v}\mbox{.polarEta} (\vec{v_2}, \hat{z}) = \vec{v_2}\mbox{.eta()} - \vec{v}\mbox{.eta()} \label{eq:polarEta} \\ \vec{v}\mbox{.polarAngle} (\vec{v_2}, \hat{u}) = \vec{v_2}\mbox{.eta}(\hat{u}) - \vec{v}\mbox{.eta}(\hat{u}) \label{eq:polarA:2} \\ \vec{v}\mbox{.azimAngle} (\vec{v_2}) \equiv \vec{v}\mbox{.azimAngle} (\vec{v_2}, \hat{z}) = \vec{v_2}\mbox{.phi()} - \vec{v}\mbox{.phi()} ^* \label{eq:azim} \\ \vec{v}\mbox{.deltaPhi} (\vec{v_2}) \equiv \vec{v}\mbox{.azimAngle} (\vec{v_2}) \label{eq:deltaPhi} \\ \vec{v}\mbox{.azimAngle} (\vec{v_2}, \hat{u}) = \theta_{\vec{v_2}\mbox{.perpPart}(\hat{u}), \vec{v}\mbox{.perpPart}(\hat{u})} \mbox{ sign} \left( \hat{u} \cdot (\vec{v} \times \vec{v_2}) \right) \label{eq:azim:2} \end{eqnarray} \noindent * Equation (\ref{eq:azim}) is not quite definitive: The azimuthal angle between two vectors (or delta phi) will always be translated into an equivalent angle in the range $(-\pi,\pi]$. The azimuthal angle between two vectors with respect to a reference direction, as shown in equation (\ref{eq:azim:2}) above, is found by projecting both vectors into the plane defined by the reference direction, and taking the angle between those projections, in the clockwise sense about the reference axis. Again, this will be in the range $(-\pi,\pi]$. \subsection{Direct Vector Rotations} \label{rotations} Direct vector rotations are methods of \SV\ or \LV\ which modify the vector being acted upon---{\tt v.rotate}$(\phi, \theta, \psi)$---or global functions which form a new vector---{\tt rotationOf}$(\vec{v}, \phi, \theta, \psi)$. \noindent Rotations about the X, Y, or Z axis are defined in the counter-clockwise sense. Thus for rotations about the Z axis, if $\vec{v}$ has representation in polar coordinates $( v_r, v_\theta, v_\phi )$ \begin{equation} \vec{v}.\mbox{rotateZ} ( \delta ) \mbox{ is equivalent to } \vec{v}_\phi \Longrightarrow \vec{v}_\phi + \delta \label{eq:rotZ:2} \end{equation} \noindent The axis rotations are implemented taking advantage of their simple form. When $\vec{v} = (x, y, z)$ is rotated by angle $\delta$, \begin{eqnarray} \vec{v}.\mbox{rotateZ} (\delta) \Longrightarrow ( x \cos\delta - y \sin\delta, x \sin\delta + y \cos\delta, z ) \label{eq:rotZ} \\ \vec{v}.\mbox{rotateY} (\delta) \Longrightarrow ( z \sin\delta + x \cos\delta, y, z \cos\delta - x \sin\delta ) \label{eq:rotY} \\ \vec{v}.\mbox{rotateX} (\delta) \Longrightarrow ( x, y \cos\delta - z \sin\delta, y \sin\delta + z \cos\delta ) \label{eq:rotX} \end{eqnarray} \noindent More general rotations may be expressed in terms of an angle $\delta$ (counter-clockwise) about an axis given as a \UV\ $\hat{u}$, or in terms of Euler Angles $(\phi, \theta, \psi)$: \[ \vec{v}.\mbox{rotate}(\hat{u},\delta) \Longrightarrow \] \begin{equation} \label{eq:axisrot} \left( \begin{array}{ccc} \cos \delta + (1 - \cos \delta ) u_x^2 & (1 - \cos \delta ) u_x u_y - \sin \delta u_z & (1 - \cos \delta ) u_x u_z + \sin \delta u_y \\ (1 - \cos \delta ) u_y u_x + \sin \delta u_z & \cos \delta + (1 - \cos \delta ) u_y^2 & (1 - \cos \delta ) u_y u_z - \sin \delta u_x \\ (1 - \cos \delta ) u_z u_x - \sin \delta u_y & (1 - \cos \delta ) u_z u_y + \sin \delta u_x & \cos \delta + (1 - \cos \delta ) u_z^2 \end{array} \right) \left( \begin{array}{c} v_x\\ v_y\\ v_z \end{array} \right) \end{equation} \[ \vec{v}.\mbox{rotate}(\phi, \theta, \psi) \Longrightarrow \] \begin{equation} \label{eq:eulerrot} \left( \begin{array}{ccc} \cos \psi \cos \phi - \sin \psi \cos \theta \sin \phi & \cos \psi \sin \phi + \sin \psi \cos \theta \cos \phi & \sin \psi \sin \theta \\ - \sin \psi \cos \phi - \cos \psi \cos \theta \sin \phi & - \sin \psi \sin \phi + \cos \psi \cos \theta \cos \phi & \cos \psi \sin \theta \\ \sin \theta \sin \phi & - \sin \theta \cos \phi & \cos \theta \end{array} \right) \left( \begin{array}{c} v_x\\ v_y\\ v_z \end{array} \right) \end{equation} \noindent The Euler angles definition matches that found in found in {\em Classical Mechanics} (Goldstein), page 109. This treats the Euler angles as a sequence of counter-clockwise {\bf passive} rotations; that is, the vector remains fixed while the coordinate axes are rotated---new vector components are computed in new coordinate frame. It is unnatural (though possible) to view an Euler angles transformation as as sequence of active rotations. HEP computations ordinarily use the active rotation viewpoint. Therefore, rotations about an axis imply {\bf active} counter-clockwise rotation in this package. Consequently, a rotation by angle $\delta$ around the X axis is equivalent to a rotation with Euler angles $(\phi=\psi=0, \mbox{ } \theta = - \delta)$ and a rotation about the Z axis is equivalent to a rotation with Euler angles $(\theta = 0, \mbox{ } \phi=\psi= - \delta/2)$. \subsubsection{RotateUz} Another way to specify a direct rotation is via {\tt v.rotateUz(u)} where u is required to be a unit \SV . This rotates the reference frame such that the original Z-axis will lie in the direction of $\hat{u}$. Many rotations would accomplish this; the one selected uses $u$ as its third column and is given by: \[ \vec{v}.\mbox{rotateUz}(u_x, u_y, u_z)\Longrightarrow \] \begin{equation} \label{eq:rotUz} \left( \begin{array}{ccc} u_x u_z / u_\perp & - u_y / u_\perp & u_x \\ u_y u_z / u_\perp & u_x / u_\perp & u_y \\ - u_\perp & 0 & u_z \end{array} \right) \left( \begin{array}{c} v_x\\ v_y\\ v_z \end{array} \right) \end{equation} \noindent Here, $u_\perp \equiv \sqrt{u_x^2 + u_y^2}$. Using $u$ as the third column of the rotation removes the ambiguity except if $u$ is parallel to $\hat{z}$. In that case, if $u = \hat{z}$ the vector $\vec{v}$ is left untouched, while if $u = - \hat{z}$, If u is $-\hat{z}$, $\vec{v}$ is rotated by 180 degrees about the Y axis. \subsubsection{Applying \protect\Ro s to \protect\SV s} In CLHEP, the \SV\ class is aware of the existence of the \Ro\ class. This is reflected in two routines to apply a \Ro\ to the \SV : \begin{equation} \label{eq:opstareq} \left. \begin{array} {r} \vec{v} \mbox{ *= } R \\ \vec{v} \mbox{.transform} (R) \end{array} \right\} \Longleftrightarrow \vec{v} \leftarrow R \vec{v} \end{equation} \noindent Notice that these are identical. In contrast to the usual {\tt operator *=} semantics, {\tt v *= R } {\it left} multiplies the matrix representing {\tt v} by the matrix representing {\tt R}. \subsection{Overflow for Large Vectors} When vector components are near the limits of floating point representation, there are cases where operations have mathematical results which can be represented, but intermediate steps give too large a result. An extreme example is that testing whether two vectors are nearly orthogonal should give a result of type \verb$bool$, yet the intermediate steps may involve a dot product adding three huge terms. \noindent Although each of the vector operations described above can be performed protecting against overflow (by judicious re-scaling) this generally leads to unacceptable inefficiency in the overwhelming majority of cases where the vectors are not so large. The compromise used in this package is: \begin{itemize} \item All vectors are assumed to be ``squarable,'' that is, the algorithms may freely take a dot product of a vector with itself. For \verb$double$ numbers, this implies that components are limited to about $10^{153}$ in magnitude. \item Care is taken that any operation, applied to squarable vectors, gives the proper result. This implies that we never take products of more than two powers of components without checking for size and potentially re-scaling. In particular, {\tt isParallel()} and {\tt isOrthogonal()} do extra work to avoid trouble when vectors have components on the order of $10^{76}$ to $10^{152}$. \end{itemize} \section{\protect\LV\ Class} We always take the time component to be the `4' index, and $c = 1$. For these equations, let the sense of the metric be $ {\cal M} = \pm 1$ and the metric be represented as $g_{ij}$ where $g_{44} = {\cal M}$, $g_{ii} = -{\cal M}$, and all other $g_{ij} = 0$. \noindent Let ${\bf w}_{1}$ and ${\bf w}_{2}$ be \LV s. Then ${\bf w}_{1}$.dot(${\bf w}_{2}$) is defined by: \begin{equation} \label{eq:wdot} {\bf w}_{1} \cdot {\bf w}_{2} = \sum_{ij} g{_ij} {\bf w}_{1}^{i} {\bf w}_{2}^{j} \\ \end{equation} \noindent The sign of this dot product is dependent on $\cal M$. For the remainder of these definitions we will take the metric to be (-- -- -- +) and point out any definitions which change sign when the (+ + + --) metric is chosen. \subsection{Combinations and Properties of \protect\LV s} The dot product, and Lorentz-invariant magnitude squared and squared norm of the difference between two 4-vectors, are metric-dependent. Let $w_i = ( \vec{v}_i, t_i )$: \begin{eqnarray} \label{eq:wdot:2} w_1\mbox{.dot}(w_2) = w_1 \cdot w_2 = t_1 t_2 - \vec{v}_1 \cdot \vec{v}_2 \\ \label{eq:wmag2} w_1\mbox{.mag2}() = w_1 \cdot w_1 = t_1^2 - |\vec{v}_1|^2 \\ \label{eq:wdiff2} w_1\mbox{.diff2}(w_2) = (w_1-w_2) \cdot (w_1-w_2) = (t_1 - t_2)^2 - \left| \vec{v}_1 - \vec{v}_2 \right| ^2 \\ \label{eq:wmag} w_1\mbox{.mag(~)} = w_1\mbox{.m(~)} = \mbox{sign}(t_1^2 - \vec{v}_1^2) \sqrt{\left|t_1^2 - \vec{v}_1^2\right|} \end{eqnarray} The Euclidean-norm, and Euclidean-norm difference squared, are given by \begin{eqnarray} \label{eq:wENorm2} w_1\mbox{.EuclideanNorm2}() = t_1^2 + |\vec{v}_1|^2 \\ \label{eq:wENorm} w_1\mbox{.EuclideanNorm}() = \sqrt{t_1^2 + |\vec{v}_1|^2} \\ \label{eq:wdelta2E} w_1\mbox{.delta2Euclidean}(w_2) = t_1 t_2 + \vec{v}_1 \cdot \vec{v}_2 \end{eqnarray} It is convenient to have methods returning $t \pm z$; for completeness we also provide the plus() and minus() methods relative to an arbitrary direction $\hat{u}$: \begin{eqnarray} \label{eq:wplus} w_1\mbox{.plus}() = t_1 + z_1 \\ \label{eq:wminus} w_1\mbox{.minus}() = t_1 - z_1 \\ \label{eq:wplus:2} w_1\mbox{.plus}(\hat{u}) = t_1 + \vec{v}_1 \cdot \hat{u} \\ \label{eq:wminus:2} w_1\mbox{.minus}(\hat{u}) = t_1 - \vec{v}_1 \cdot \hat{u} \end{eqnarray} \subsection{Kinematics of \protect\LV s} The rest mass and its square are independent of metric. Note that {\tt restMass2()} differs from {\tt mag2()} in that no matter which metric is selected, {\tt restMass2()} remains $t^2-v^2$. The sign of the rest mass is set to match the time component; thus the rest mass of $(0,0,0,-m)$ will return as $-m$. The method {\tt rest4Vector()} will return a 4-vector equal to this vector in its rest frame. \begin{eqnarray} \label{eq:wrestM2} p\mbox{.restMass2}() = p\mbox{.invariantMass2}() = E^2 - |\vec{p}|^2 \\ \label{eq:wrestM} p\mbox{.restMass}() = p\mbox{.invariantMass}() = \sqrt {E^2 - |\vec{p}|^2} \times \mbox{sign}(t_1) \\ \label{eq:wrest4V} p\mbox{.rest4Vector}() = \left( 0, 0, 0, p\mbox{.restMass}() \right) \end{eqnarray} \noindent Taking the rest mass of a spacelike 4-vector will ZMthrow the exception {\tt ZMxpvSpacelike}. \noindent The boost which if applied to {\tt w.rest4Vector()} would give the result {\tt w} is {\tt w.boostVector()}. A pure boost can be expressed as a \SV: \begin{eqnarray} \label{boostvector} w_1\mbox{.boostVector}() = \frac{\vec{v}_1}{t_1} \\ \left(w_1\mbox{.rest4Vector}()\right)\mbox{.boosted} \left(w_1.\mbox{.boostVector}() \right) \equiv w_1 \nonumber \end{eqnarray} \noindent The boostVector for a zero 4-vector will return as zero. {\tt boostVector()} will return $v/t$ even if the 4-vector is spacelike, but will ZMthrow a {\tt ZMxpvTachyonic} error. If $ t=0 $ it will throw {\tt ZMxpvInfiniteVector} and do the divisions, returning an infinite vector if ignored. Beta and gamma refer to this boost vector: \begin{eqnarray} \label{eq:wbeta} w_1\mbox{.beta}() = \beta = \left| w_1\mbox{.boostVector}() \right | = \frac{\left| \vec{v}_1 \right|} {| t_1 |} \\ \label{eq:wgamma} w_1\mbox{.gamma}() = \gamma = \frac{1}{\sqrt{1-\beta^2}} \end{eqnarray} Psuedorapidity and rapidity are discussed below (\S\ref{rapidity}): \begin{eqnarray} \label{eq:weta} w_1\mbox{.eta()} = - \ln \tan \frac{\theta}{2} \\ \label{eq:weta:2} w_1\mbox{.eta(u)} = - \ln \tan \frac{\hat{p} \cdot \hat{u}}{2} \\ \label{eq:wrapid} w_1\mbox{.rapidity() } = \frac{1}{2} \ln \left( \frac{E + p_z}{E - p_z} \right) = \tanh^{-1} \frac {z}{t} \\ \label{eq:wrapid:2} w_1\mbox{.rapidity(u) } = \frac{1}{2} \ln \left( \frac{E + \vec{p} \cdot \hat{u}} {E - \vec{p} \cdot \hat{u}} \right) = \tanh^{-1} \frac {\vec{v} \cdot \hat{u}} {t} \\ \label{eq:wcoLinRap} w_1\mbox{.coLinearRapidity() } = \frac{1}{2} \ln \left( \frac{E + |p|}{E - |p|} \right) = \tanh^{-1} \frac {|v|}{t} \end{eqnarray} \noindent The ``transverse mass'' is found by neglecting the x- and y-components of the 4-vector. This is the square root of the sum of the rest mass squared and the transverse momentum squared: \begin{eqnarray} \label{eq:wmt2} p\mbox{.mt2}() = E^2 - p_z^2 \\ \label{eq:wmt} p\mbox{.mt}() = \sqrt { \left| E^2 - |\vec{p}|^2 \right| } \times \mbox{sign}(E^2 - |\vec{p}|^2) \end{eqnarray} \noindent Note that $m_t \ge m$. {\it Warning:} Although this definition for $m_t$ matches that of equation (34.36) in the Review of Particle Physics and this definition has always been in CLHEP, some experimenters have indicated that various experiments may use different definitions, which are of more use to their applications. \noindent The ``transverse energy'' is defined as $E \sin \theta$. This quantity is invariant, to order $m/E$, under boosts in the Z direction. It is most easily expressed in terms of the energy, momentum, and transverse momentum: \begin{eqnarray} \label{eq:wet2} p\mbox{.et2}() = \frac {E^2 p_\perp^2}{|p|^2} \\ \label{eq:wet} p\mbox{.et}() = \sqrt { \left| \frac {E^2 p_\perp^2}{|p|^2} \right| } \times \mbox{sign}(E) \end{eqnarray} \noindent For completeness, the transverse mass and energy are also defined with respect to a direction specified by a \SV $\vec{v}$: \begin{eqnarray} p\mbox{.mt2}(\vec{v}) = E^2 - ( \vec{p} \cdot \hat{v} )^2 \\ p\mbox{.mt}(\vec{v}) = \sqrt {\left| E^2 - (\vec{p} \cdot \hat{v})^2\right|} \times \mbox{sign}(E^2 - ( \vec{p} \cdot \hat{v} )^2 ) \\ p\mbox{.et2}(\vec{v}) = \frac {E^2 p.\mbox{perp}(\hat{v})^2} {|p|^2} \\ p\mbox{.et}(\vec{v}) = \sqrt { \left| \frac {E^2 p.\mbox{perp}(\hat{v})^2} {|p|^2} \right| } \times \mbox{sign}(E) \end{eqnarray} \subsection{Invariant Mass and the Center-of-Mass Frame} The invariant mass of a pair of \LV s is given by: \begin{eqnarray} \label{eq:winvMass2} w_1\mbox{.invariantMass2}(w_2) = \left(t_1+t_2\right)^2 - \left| \vec{v}_1 - \vec{v}_2 \right| ^2 \\ \label{eq:winvMass} w_1\mbox{.invariantMass}(w_2) = \left(t_1+t_2\right)^2 - \left| \vec{v}_1 - \vec{v}_2 \right| ^2 \times \mbox{sign}(t_1 + t_2) \end{eqnarray} The boost necessary top bring a pair of vectors into their Center-of-Mass frame is given by \begin{eqnarray} \label{eq:wfindBoost} w_1\mbox{.findBoostToCM}(w_2) = - \frac{\vec{v}_1 + \vec{v}_2}{t_1+t_2} \end{eqnarray} \noindent If the sum of the two 4-vectors is spacelike, this makes analytic sense but is physically meaningless; a {\tt ZMxpvTachyonic} error will be ZMthrown. If the sum of the time components is zero, a {\tt ZMxpvInfiniteVector} error will be ZMthrown. \subsection{Various Forms of Masses and Magnitudes} The \LV\ class combines the features of the CLHEP and ZOOM 4-vectors. Each of these deal with several concepts related to the magnitude or ``mass'' associated with the 4-vector. This is further complicated by the possibility that the metric, normally taken to be (-- -- -- +) which we designate as $\cal M$ $= +1$, can be set to (+ + + --) which we will designate as $\cal M$ $= -1$. So some of the definitions below will involve $\cal M$. In the CLHEP original package, of course, $\cal M$ would always be $+1$. These methods are defined above, but perhaps it will be helpful to provide them all in one place. In the below definitions, since we are conceptually dealing with energy-momentum 4-vectors, we will use $(\vec{p},e)$ for the 4-vector components. % orig PV CLHEP Merge %mag2(~) M * (t^2-v^2) (t^2-v^2) PV %m2(~) --- (t^2-v^2) CLHEP %mag(~) --- sign(m2)*sqrt|m2| CLHEP %m(~) --- sign(m2)*sqrt|m2| CLHEP %mt2(~) --- e^2 - pz^2 CLHEP %mt(~) --- sign(mt2)*sqrt|mt2| CLHEP %w.dot(w) M * (t^2-v^2) (t^2-v^2) PV %w.invariantMass2(~) --- --- (t^2-v^2) %w.invariantMass(~) --- --- sign(t)*sqrt(t^2-v^2) %restMass2(~) (t^2-v^2) --- (t^2-v^2) %restMass(~) sign(t)*sqrt(t^2-v^2),# --- % sign(t)*sign(t^2-v^2)*sqrt|t^2-v^2| \begin{eqnarray} w\mbox{.mag2()} = w\mbox{.dot(w)} = {\cal M} (E^2 - \vec{p}^2) \\ w\mbox{.m2(~)} = E^2 - \vec{p}^2 \\ w\mbox{.mag(~)} = w\mbox{.m(~)} = \mbox{sign}(E^2 - \vec{p}^2) \sqrt{\left|E^2 - |\vec{p}|^2\right|} \\ w\mbox{.invariantMass2(~)} = w\mbox{.restMass2(~)} = E^2 - |\vec{p}|^2 \\ w\mbox{.w.invariantMass(~)} = w\mbox{.restMass(~)} = \mbox{sign}(E) \sqrt{E^2 - |\vec{p}|^2} \\ w\mbox{.mt2(~)} = E^2 - p_z^2 \\ w\mbox{.mt(~)} = \mbox{sign}(E^2 - p_z^2) \sqrt{\left|E^2 - p_z^2\right|} \\ w\mbox{.et2}() = \frac {E^2 p_\perp^2}{|p|^2} \\ w\mbox{.et}() = \sqrt { \left| \frac {E^2 p_\perp^2}{|p|^2} \right| } \times \mbox{sign}(E) \end{eqnarray} Thus a tachyonic particle (for which $t^2-v^2 < 0$) is assigned a negative mass m(), but a positive restMass(). \subsection{Direct \protect\LV\ Boosts and Rotations} Direct boosts and rotations are methods of \LV\ which modify the 4-vector being acted upon--- {\it e.g.}, {\tt w.boost}$(\hat{u}, \beta)$---or global functions which form a new vector--- {\it e.g.}, {\tt boostOf}$(w, \hat{u}, \beta)$. Rotations act in the obvious manner, affecting only the $\vec{v}$ component of the 4-vector---see \S\ref{rotations}. In analogy with our ``active'' rotation viewpoint, boosts are treated as ``active'' transformations rather than transformations of the coordinate system. That is, if you take a 4-vector at rest, with positive mass ($t$), and boost it by a positive amount in the X direction, the resulting 4-vector will have positive $x$. Boosts along the X, Y, or Z axis are simpler than the general case. Let $w = (\vec{v}, t) = (x, y, z, t)$: \begin{eqnarray} \label{eq:wbX} w.\mbox{boostX} (\beta) \Longrightarrow ( \gamma x + \beta \gamma t, y, z, \gamma t + \beta \gamma x ) \\ \label{eq:wbY} w.\mbox{boostY} (\beta) \Longrightarrow ( x, \gamma y + \beta \gamma t, z, \gamma t + \beta \gamma y ) \\ \label{eq:wbZ} w.\mbox{boostZ} (\beta) \Longrightarrow ( x, y, \gamma z + \beta \gamma t, \gamma t + \beta \gamma z ) \\ \gamma \equiv \frac{1}{\sqrt{1-\beta^2}} \nonumber \end{eqnarray} More general rotations boosts may be expressed in terms of $\beta$ along an axis given as a \SV\ $\hat{u}$ (which will be normalized), or in terms of a \SV\ boost $\vec{\beta}$, which must obey $|\vec{\beta}|<1$. (Boosts beyond the speed of light ZMthrow a {\tt ZMxpvTachyonic} error, and leave the 4-vector unchanged if this is ignored.) For the axis $(\hat{u}, \beta)$ form, \begin{eqnarray} \label{eq:pureboost} \left\{ \begin{array}{lcl} t & \longleftarrow & \gamma t + \beta \gamma \vec{v} \cdot \hat{u} \\ \vec{v} & \longleftarrow & \vec{v} + \left[ \frac{\gamma-1}{\beta^2} \beta \vec{v} \cdot \hat{u} + \beta \gamma t \right] \hat{u} \end{array} \right. \\ \gamma \equiv \frac{1}{\sqrt{1-\beta^2}} \nonumber \end{eqnarray} For the boost vector $(\vec{\beta})$ form, \begin{eqnarray} \label{eq:wboostvec} \left\{ \begin{array}{lcl} t & \longleftarrow & \gamma t + \gamma \vec{v} \cdot \vec{\beta} \\ \vec{v} & \longleftarrow & \vec{v} + \left[ \frac{\gamma-1}{|\vec{\beta}|^2} \vec{v} \cdot \vec{\beta} + \gamma t \right] \vec{\beta} \end{array} \right. \\ \gamma \equiv \frac{1}{\sqrt{1-|\vec{\beta}|^2}} \nonumber \end{eqnarray} \subsubsection{Applying \protect\Ro s and \protect\LT s to \protect\SV s} In CLHEP, the \LV\ class is aware of the existence of the \Ro\ and \LT\ classes. This is reflected in routines to apply these the \LV : \begin{equation} \label{eq:wopstareq} \left. \begin{array} {r} p \mbox{ *= } R \\ p \mbox{.transform} (R) \end{array} \right\} \Longleftrightarrow p \leftarrow R p \end{equation} \noindent Notice that these are identical. In contrast to the usual {\tt operator *=} semantics, {\tt p *= R } {\it left} multiplies the matrix representing {\tt p} by the matrix representing {\tt R}. \subsection{Near-equality of \protect\LV s} We keep in mind that the prime utility of {\tt isNear()} and related methods is to see whether two vectors, which have been created along two computational paths or from two sets of fuzzy quantities, ought mathematically to be taken as equal. {\em Relative} tolerance is needed, and this is more involved than just checking for approximate equality in the time and space sectors respectively. For example, though no non-zero vector can be near the zero vector, $(\vec{\epsilon},t=1)$ with $\vec{\epsilon}$ a very small vector should be considered close to $(\vec{0},t=1)$. The temptation is to use, as the normaliztion to determine relative nearness, the length $|\vec{v}|^2 + t^2$. Let us call this the Euclidean norm, since it is the norm in complex 4-space $(\vec{v}, i t)$. This is not Lorentz invariant, but for many purposes is a good criteria for calling two 4-vectors close. We use the Euclidean norm to define {\tt isNear()} for {\tt LorentzVectors}; it has the virtue of simplicity and can be applied to any 4-vectors. Let the method {\tt isNear()} be represented by the symbol $\approx$: \begin{equation} \label{eq:wisNear} w_1 \approx w_2 \Longleftrightarrow \left| \vec{v}_1 - \vec{v}_2 \right| ^2 + (t_1 - t_2)^2 \leq \epsilon^2 \left[ \left| \vec{v}_1 \cdot \vec{v}_2 \right| + \left( \frac{t_1 + t_2}{2} \right)^2 \right] \end{equation} This definition not Lorentz invariant, but it is (to order $\epsilon \times \gamma$) independent of frame within the space of {\em small} Lorentz transformations. It turns out to be impossible to find a definition which is Lorentz invariant for all possible 4-vectors, under arbitrarily large boosts, and still behaves like a measure of near-ness. A second useful definition, which is Lorentz invariant, but is sensibly applicable only to timelike 4-vectors, is to look at the Euclidean norm of the difference of two vectors {\em in their Center-of-Mass frame}. This is intuitively appealing to HEP practitioners; we make this method available as well, calling it {\tt isNearCM()}. Let the method {\tt isNear()} be represented by the symbol $\approx$, and the method {\tt isNearCM()} be represented by the symbol $\stackrel{\mbox{\tiny CM}}{\approx}$. Let ${\bf w}_{1}$, ${\bf w}_{2}$ be LorentzVectors. Also, let $\vec{v}_i, t_i$ be the space vector and time components of ${\bf w}_{i}$. Then using the boost vector to the joint center of mass frame \begin{equation} \vec{b} = - \frac { \left| \vec{v}_1 + \vec{v}_2 \right| } { t_1 + t_2 } \end{equation} \noindent and assuming that $|\vec{b}| < 1$ so we can take \begin{eqnarray} \beta = |\vec{b}| \\ \gamma = \frac{1} {\sqrt {1-\beta^2 } } \end{eqnarray} \noindent we define the condition \begin{eqnarray} \label{eq:wisNearCM} w_1 \stackrel{\mbox{\tiny CM}}{\approx} w_2 \Longleftrightarrow \left( w_1\mbox{.boost}(\vec{b}) \right) \approx \left( w_2\mbox{.boost}(\vec{b}) \right) \end{eqnarray} As mentioned earlier, this criterion makes sense only for timelike 4-vectors. If applied to 4-vectors whose sum is not timelike, the {\tt isNearCM()} method will return a test for exact equality. \begin{eqnarray} \label{eq:wisNearCM:2} \mbox{if } | \vec{v}_1 + \vec{v}_1 | \geq | t_1 + t_2 | \mbox{ then } w_1 \stackrel{\mbox{\tiny CM}}{\approx} w|2 \Longleftrightarrow w_1 = v_2 \end{eqnarray} \subsubsection{DeltaR for \protect\LV s} Another method to compare two \LV s is {\tt w1.deltaR(w2)}, which acts only on the 3-vector components of the \LV s and applies {\tt deltaR} as defined by equation (\ref{eq:deltaR}). \subsubsection{Ordering Comparisons for \protect\LV s} The comparison operators \verb$ ( >, >=, <, <= )$ for \LV\ act by comparing first the time component, then the \SV\ part. The latter comparison is done using definition (\ref{eq:compSV}). \begin{equation} \label{eq:wcomp} w_1 > w_2 \mbox{ if } t_1 > t_2 \mbox { or } \left[ t_1 = t_2 \mbox { and } \vec{v}_1 > \vec{v}_2 \right] \end{equation} \subsection{Other Boolean Methods for \protect\LV s} The {\tt w1.isParallel(w2)} method works with a relative tolerance. If the difference of the normalized 4-vectors is small, then those 4-vectors are considered nearly parallel. For this purpose, we use the Euclidean norm to define the normalization and size of difference. Let \begin{eqnarray} \overline{w}_1 \equiv \frac{w_1}{|\vec{v}_1|^2 + t_1^2} \nonumber \\ \overline{w}_2 \equiv \frac{w_1}{|\vec{v}_2|^2 + t_2^2} \nonumber \end{eqnarray} \noindent and \begin{eqnarray} \overline{w}_1 - \overline{w_2} \equiv ( \overline{v}_{12} , \overline{t}_{12} ) \nonumber \end{eqnarray} \noindent then \begin{equation} \label{eq:wisPar} w_1 \parallel w_2 \mbox{ iff } \left| \overline{v}_{12} \right| ^2 + \overline{t}_{12}^2 \leq \epsilon^2 \end{equation} As in the case of \SV s, only the zero 4-vector is considered parallel to the zero 4-vector. \begin{equation} \label{eq:wisPar:2} w \parallel (0, 0, 0, 0) \mbox{ iff } w = (0, 0, 0, 0) \end{equation} The {\tt w1.howParallel(w2)} method, applied to two non-zero \LV s, returns the Euclidean norm of the differnce. This can range from zero (if {\tt w2} is a positive multiple of {\tt w1}) to 2 (if {\tt w2} is a negative multiple of {\tt w1}). If both \LV s are zero, {\tt w1.howParallel(w2)} returns zero; if one is zero, it returns 1. \vspace{.25 in} The boolean tests {\tt isSpacelike()}, {\tt isTimelike()}, and {\tt isLightlike()}, work with the {\tt restMass2()} function, which returns $t^2 - |\vec{v}|^2$. \begin{eqnarray} \label{eq:wisSl} w\mbox{.isSpacelike}() \Longleftrightarrow t^2 - |\vec{v}|^2 < 0 \\ \label{eq:wisTl} w\mbox{.isTimelike}() \Longleftrightarrow t^2 - |\vec{v}|^2 > 0 \end{eqnarray} The test for {\tt isLightlike()} uses a tolerance relative to the time component of the vector. It determines if, starting from an exactly lightlike vector, you can perturb $t$ and $v$ by a small relative amount to reach the actual vector. \begin{equation} \label{eq:wisLl} w\mbox{.isLightlike}() \Longleftrightarrow \left| t^2 - |\vec{v}|^2 \right| <= 2 \epsilon t^2 \end{equation} \noindent The $2 \epsilon t^2$ limit is chosen such that $(0, 0, (1\pm\epsilon)t, t)$ is just on the boundary of being considered lightlike. Since the {\tt isLightlike()} method is tolerant of small perturbations, these three methods are not mutually exclusive: A 4-vector can test true for {\tt isLightlike()} and either {\tt isSpacelike()} or {\tt isTimelike()} as well. By these definitions, the zero 4-vector is considered lightlike. \subsection{Nearness measures for \protect\LV s} Since both {\tt isNear()} and {\tt isNearCM()} for \LV s use relative tolerance, the corresponding nearness measures are truncated at a maximum of 1: \begin{eqnarray} \label{eq:whowNear} w_1 \mbox{.howNear} (w_2) = \max \left( \sqrt { \frac {\left| \vec{v}_1 - \vec{v}_2 \right| ^2 + (t_1 - t_2)^2 } { \left| \vec{v}_1 \cdot \vec{v}_2 \right| + \left( \frac{t_1 + t_2}{2} \right)^2 } } \;, \; 1 \right) \\ \label{eq:whowNearCM} w_1 \mbox{.howNearCM} (w_2) = \left( w_1\mbox{.boost}(\vec{b}) \right)\mbox{.howNear} \left( w_1\mbox{.boost}(\vec{b}) \right) \end{eqnarray} \noindent with, as before, the boost vector $\vec{b}$ given by \[ \vec{b} = - \frac { \left| \vec{v}_1 + \vec{v}_2 \right| } { t_1 + t_2 } \] \noindent For two unequal \LV s, {\tt w1.howNearCM(w2)} will return 1 if the boost to the rest frame is tachyonic. The {\tt w1.isParallel(w2)} and {\tt w.isLightlike()} methods also work with a relative tolerance. The corresponding measures are defined by: \begin{eqnarray} \label{eq:whowPar} w_1\mbox{.howParallel}(w_2) = \max \left( \sqrt { \left| \overline{v}_{12} \right| ^2 + \overline{t}_{12}^2 } \; , \; 1 \right) \end{eqnarray} \noindent (where the notation used is that use for equation \ref{eq:wisPar}). \noindent If $w = (v,t)$ \begin{eqnarray} \label{eq:whowLl} w\mbox{.howLightlike}() = \max \left( \frac { \left| t^2 - |\vec{v}|^2 \right| } { 2 t^2 } \; , \; 1 \right) \end{eqnarray} \noindent As before, if this measure is very nearly zero, the 4-vectors are nearly parallel or the 4-vector is nearly lightlike. When one of the 4-vectors (but not the other) is zero, \begin{eqnarray} \label{eq:whowNear:2} w \mbox{.howNear}(\mbox{{\it 0}}) = \mbox{{\it 0}} \mbox{.howNear} (w) = 1 \\ \label{eq:whowNearCM:2} w \mbox{.howNearCM}(\mbox{{\it 0}}) = \mbox{{\it 0}} \mbox{.howNearCM} (w) = 1 \\ \label{eq:whowPar:2} w \mbox{.howParallel}(\mbox{{\it 0}}) = \mbox{{\it 0}} \mbox{.howParallel} (w) = 1 \\ \label{eq:whowLl:2} \mbox{{\it 0}} \mbox{.howLightlike()} = 0 \end{eqnarray} When both 4-vectors are zero, the nearness measures will all return zero. \section {Pseudorapidity, Rapidity and CoLinearRapidity} \label{rapidity} \noindent Pseudorapidity (conventionally labelled $\eta$) and rapidity are properties which apply to both \SV s and \LV s. Pseudorapidity and rapidity are defined relative to the $z$ direction. The pseudorapidity {\tt eta} of either a \LV\ or a \SV\ is defined in terms of the angle the 3-vector part forms with the Z axis: This can be found knowing nothing of the mass of a particle, and in the limit of large momentum is approximately the same as the true rapidity. Unlike the case for rapidity(), eta() makes mathematical sense for any vector---it a simple function of the tangent of the angle between the vector and the Z axis. The pseudorapidity of a zero vector will be assigned the value zero. Let $\vec{v_1}$ be a \SV, and $w_1$ be a \LV\ with decomposition $(t, \vec{v})$. And let the angle formed between the Z axis and $\vec{v_1}$ or $\vec{v}$ be $\theta$. Then: \begin{eqnarray} \label{eq:eta:3} v_1 \mbox{.eta()} = - \ln \tan \frac{\theta}{2} \\ \label{eq:weta:3} w_1 \mbox{.eta()} = - \ln \tan \frac{\theta}{2} \end{eqnarray} \noindent The true rapidity of a LorentzVector is defined (see the Kinematics section of the Review of Particle Properties, page 177 in the 1997 version) such that the rapidity transforms under a boost {\em along the Z axis} by adding the rapidity of the boost: This treats the LorentzVector as a timelike 4-momentum (using the $t$ and $z$ components as $E$ and $p_z$). In analogy with the familiar definition for \LV, the rapidity of a \SV\ is defined with respect to the $z$ direction. Mathematically, this is the same as the rapidity of a 4-vector $(\vec{v}, 1)$. Letting $w_1$ be $(x, y, z, t)$ or $(p_x, p_y, p_z, E)$, \begin{eqnarray} \label{eq:wrapid:3} w_1 \mbox{.rapidity() } = \frac{1}{2} \ln \left( \frac{E + p_z}{E - p_z} \right) = \tanh^{-1} \frac {z}{t} \\ v_1 \mbox{.rapidity() } = \tanh^{-1} (\vec{v}_1 \cdot \hat{z}) \end{eqnarray} \noindent The shape of a rapidity distribution is a invariant under boosts in the $z$ direction. Pseudorapidity can always be determined from direction information alone, and when $ p^2 \gg m^2 $ {\em and the time component is positive} pseudorapidity matches rapidity to order $m^2$/$p^2$. \vspace{.2 in} Although the $z$ direction is special for many HEP uses, rapidity and pseudorapidity can be defined with respect to an arbitrary direction $\hat{u}$. Letting $w_1$ be $(\vec{v}, t)$: \begin{eqnarray} \label{eq:weta:4} w_1 \mbox{.eta(u)} = - \ln \tan \frac{\hat{p} \cdot {u}}{2} \\ \label{eq:eta:4} v_1 \mbox{.eta(u)} = - \ln \tan \frac{\hat{v}_1 \cdot \hat{u}} {2} \\ \label{eq:wrapid:4} w_1 \mbox{.rapidity(u) } = \frac{1}{2} \ln \left( \frac{E + \vec{p} \cdot \hat{u}} {E - \vec{p} \cdot \hat{u}} \right) = \tanh^{-1} \frac {\vec{v} \cdot \hat{u}} {t} \\ v_1 \mbox{.rapidity(u) } = \tanh^{-1} (\vec{v}_{1} \cdot \hat{u}) \end{eqnarray} \noindent Relativity texts discuss rapidity along the direction of the vector. This concept can apply to \SV s or \LV s. This function adds when you compbine two boosts in the same direction. Such a method may not be needed for typical HEP calculations but is provided for completeness. To distinguish this from the rapidity with respect to a specific direction---or a default rapidity, which is with respect to $\hat{z}$---the package names the rapidity along the direction of the vector {\tt coLinearRapidity()}. \begin{eqnarray} v_1 \mbox{.coLinearRapidity() } = \tanh^{-1} \beta = \tanh^{-1} \left|\vec{v_1}\right| \\ \label{eq:wcoLinRap:2} w_1 \mbox{.coLinearRapidity() } = \frac{1}{2} \ln \left( \frac{E + |p|}{E - |p|} \right) = \tanh^{-1} \frac {|v|}{t} \end{eqnarray} \noindent The co-linear rapidity of a 3-vector is inherently non-negative; for a 4-vector it will have the same sign as the time component of the 4-vector. \section{\protect\Ro\ Class} \Ro s may be expressed in terms of an axis $\hat{u}$ and angle $\delta$ of counter-clockwise rotation, or as a set of three Euler Angles $(\phi, \theta, \psi)$. Definitions and conventions for these classes match those described in \S \ref{rotations} for directly rotating a \SV: \[ \mbox{HepRotation}(\hat{u},\delta) \Longrightarrow \] \begin{equation} \label{eq:axisrotR} \left( \begin{array}{ccc} \cos \delta + (1 - \cos \delta ) u_x^2 & (1 - \cos \delta ) u_x u_y - \sin \delta u_z & (1 - \cos \delta ) u_x u_z + \sin \delta u_y \\ (1 - \cos \delta ) u_y u_x + \sin \delta u_z & \cos \delta + (1 - \cos \delta ) u_y^2 & (1 - \cos \delta ) u_y u_z - \sin \delta u_x \\ (1 - \cos \delta ) u_z u_x - \sin \delta u_y & (1 - \cos \delta ) u_z u_y + \sin \delta u_x & \cos \delta + (1 - \cos \delta ) u_z^2 \end{array} \right) \end{equation} \[ \mbox{HepRotation}(\phi, \theta, \psi) \Longrightarrow \] \begin{equation} \label{eq:eulerrotR} \left( \begin{array}{ccc} \cos \psi \cos \phi - \sin \psi \cos \theta \sin \phi & \cos \psi \sin \phi + \sin \psi \cos \theta \cos \phi & \sin \psi \sin \theta \\ - \sin \psi \cos \phi - \cos \psi \cos \theta \sin \phi & - \sin \psi \sin \phi + \cos \psi \cos \theta \cos \phi & \cos \psi \sin \theta \\ \sin \theta \sin \phi & - \sin \theta \cos \phi & \cos \theta \end{array} \right) \end{equation} \noindent The Euler angles definition matches that found in found in {\em Classical Mechanics} (Goldstein), page 109. This treats the Euler angles as a sequence of counter-clockwise {\bf passive} rotations; that is, the vector remains fixed while the coordinate axes are rotated---new vector components are computed in new coordinate frame. HEP computations ordinarily use the active rotation viewpoint. Therefore, rotations about an axis imply {\bf active} counter-clockwise rotation in this package. Consequently, a rotation by angle $\delta$ around the X axis is equivalent to a rotation with Euler angles $(\phi=\psi=0, \mbox{ } \theta = - \delta)$ and a rotation about the Z axis is equivalent to a rotation with Euler angles $(\theta = 0, \mbox{ } \phi=\psi= - \delta/2)$. \subsection{Applying Rotations to Vectors and 4-Vectors} A \Ro may be applied to a \SV using either of two notations: \begin{equation} \label{eq:Rv} \mbox{R * v} \equiv \mbox{R(v)} \equiv {\boldmath R} \vec{v} \end{equation} \noindent where ${\boldmath R}$ is the matrix representing R, as in equation \ref{eq:eulerrotR} or \ref{eq:axisrotR}. The same syntaxes may be used to apply a \Ro to a \LV ---the rotation matrix acts on the space components of the 4-vector. Note that {\tt R *= v} is meaningless and not supported. Also note the warning given earlier: $ \vec{v} \mbox{*=} R \Longleftrightarrow \vec{v} = R \mbox{*} \vec{v} $ \subsection{Axial Rotations} The special case rotations along the X, Y, and Z axes will often be specified by just the rotation angle $\delta$. Thus a {\tt HepRotationX}, {\tt HepRotationY}, or {\tt HepRotationZ} with angle $\delta$ would be represented by the matrix \begin{eqnarray} \label{eq:rotx} \mbox{HepRotationX}(\delta) = \left( \begin{array}{ccc} 1 & 0 & 0 \\ 0 & \cos \delta & - \sin \delta \\ 0 & \sin \delta & \cos \delta \end{array} \right) \\ \label{eq:roty} \mbox{HepRotationY}(\delta) = \left( \begin{array}{ccc} \cos \delta & 0 & \sin \delta \\ 0 & 1 & 0 \\ - \sin \delta & 0 & \cos \delta \end{array} \right) \\ \label{eq:rotz} \mbox{HepRotationZ}(\delta) = \left( \begin{array}{ccc} \cos \delta & - \sin \delta & 0 \\ \sin \delta & \cos \delta & 0 \\ 0 & 0 & 1 \end{array} \right) \\ \end{eqnarray} A \Ro\ is an object in its own right; two \Ro s may be multiplied, tested for near equality, and so forth. Multiplication is done by multiplying the matrix representations of two \Ro s (though for matching axis rotations, simplifications are done to effciently compute this product). The matrix representing a \Ro\ is orthonormal: Each row, considered as a vector, has length 1, and the dot product of any two distinct rows is zero. This leads to a trivial inversion method---simply transpose the matrix. When dealing with structures holding an axis and angle, or Euler angles, we do not provide direct analogues of all rotation methods. For example, we do not provide for multiplication of two \Ax objects to form a third \Ax. We do provide comparison and nearness methods for these classes, and this document specifies whether the criteria match the corresponding \Rotation\ criteria. \subsection{Expressing a \protect\Ro\ as \protect\Ax\ or \protect\Es\ } It is worth noting that equations (\ref{eq:axisrot}) and (\ref{eq:eulerrot}) are not single-valued when extracting $ ( \hat{u}, \delta) $ or $ ( \phi, \theta, \psi ) $ from a \Rotation\ matrix. We adhere to the following conventions to resolve that ambiguity whenever forming an \Ax\ from a \Rotation\ $R$: \begin{eqnarray} R = {\bf I} \Longrightarrow \delta = 0, \; \hat{u} = \hat{z} \\ \label{eq:deltaconv} R \longrightarrow ( \hat{u}, \delta ) \Longrightarrow 0 \leq \delta \leq \pi \end{eqnarray} And we adhere to the following conventions to resolve that ambiguity whenever forming an \Es\ from a \Rotation\ $R$: \begin{eqnarray} \label{eq:thetaconv} R \longrightarrow ( \phi, \theta, \psi ) \Longrightarrow 0 \leq \theta \leq \pi \\ \label{eq:tphiconv} R \longrightarrow ( \phi, \theta, \psi ) \Longrightarrow -\pi < \phi \leq \pi \\ \label{eq:psiconv} R \longrightarrow ( \phi, \theta, \psi ) \Longrightarrow -\pi < \psi \leq \pi \\ \label{eq:phipsiconv} R \longrightarrow ( \phi, \; \theta = 0, \; \psi ) \Longrightarrow -\pi/2 < \phi = \psi \leq \pi/2 \\ R \longrightarrow ( \phi, \; \theta = \pi, \; \psi ) \Longrightarrow -\pi/2 < \phi = -\psi \leq \pi/2 \end{eqnarray} \noindent Thus when supplying values for Euler angles, we return $(0, 0, 0)$ whenever the rotation is equivalent to the identity, and return $(0, \pi, 0)$ in preference to the equivalent $(\pi, \pi, \pi)$. In particular, special case rotations such as {\tt HepRotationX} with $\delta$ supplied as zero or $\pi$ obey these conventions: even though for $\delta = \pi - |\epsilon|$ a {\tt RotationX} would have Euler angles $( \pi, \delta, \pi, )$, when $\delta = \pi$ exactly, the Euler angles are $(0, \delta=\pi, 0)$. These conventions for how methods return values for Euler angles do not affect the user's right to supply explicit values for or $ ( \phi, \theta, \psi ) $ which may not obey the conventions, when defining an \Es\ structure or a \Rotation--it is just that when such a \Rotation\ is read back as Euler angles, the values will not be the ones originally supplied. Similarly, the conventions for reading axis and angle do not affect the user's ability to supply arbitrary $ ( \hat{u}, \delta) $ values. Obeying the above rules, Euler angles returned for rotations about coordinate axes behave as follows: \begin{equation} \mbox{HepRotationX}(\delta) \longrightarrow \left\{ \begin{array}{ccc} ( 0, -\delta, 0 ) & \mbox{ if } & \delta \leq 0 \\ ( \pi, \delta, \pi ) & \mbox{ if } & 0 < \delta < \pi \\ ( 0, \pi, 0 ) & \mbox{ if } & \delta = \pi \end{array} \right. \label{eq:rotXconv} \end{equation} \begin{equation} \mbox{HepRotationY}(\delta) \longrightarrow \left\{ \begin{array}{ccc} ( +\pi/2, -\delta, -\pi/2 ) & \mbox{ if } & \delta < 0 \\ ( 0, 0, 0) & \mbox{ if } & \delta = 0 \\ ( -\pi/2, \delta, +\pi/2 ) & \mbox{ if } & 0 < \delta < \pi \\ ( \pi/2, \delta, -\pi/2 ) & \mbox{ if } & \delta = \pi \end{array} \right. \label{eq:rotYconv} \end{equation} \begin{equation} \mbox{HepRotationZ}(\delta) \longrightarrow ( -\delta/2, 0, -\delta/2 ) \label{eq:rotZconv} \end{equation} \noindent always assuming that $\delta$ represents an angle of active rotation between $-\pi$ and $\pi$. \subsection{Nearness Measure for \protect\Ro s, \protect\Ax s, and \protect\Es\ } The definition used for {\tt isNear()} and {\tt howNear()} on \Rotation s has the following properties: \begin{enumerate} \item {\tt isNear()} and {\tt howNear()} use the same measure: Two rotations are considered near if their {\tt howNear()} measure is less that $\epsilon$. \item Transitivity: $r_1 \approx r_2$ and {\tt r1.howNear(r2)} are exactly equivalent to $r_2 \approx r_1$ and {\tt r2.howNear(r1)}. \item Rotational invariance to order $\epsilon$: If $x = ${\tt r1.howNear(r2)} is small, then for any third rotation {\tt r3} {\tt (r3*r1).howNear(r3*r2)} $ x + O(x^2)$. \item For the special case of rotations that happen to be around the same axis, the measure agrees with a natural definition for measure of rotation about an axis (\S\ref{rotsame}). \end{enumerate} Although it is possible to formulate a measure definition with exact rotational in\-var\-i\-ance---based on $ \sup_{\hat{u}} \left\{ \left| R_1(\hat{u}) - R_2(\hat{u}) \right| \right\} $---this definition would require finding the 2-norm (or the largest eigenvalue) of the matrix $r_1 r_2^{-1}$, which is computationally difficult. The measure we use is the same for small answers, and has the above desirable properties. \begin{eqnarray} \label{eq:nearrot} r_1 \mbox{.howNear}(r_2) = \sqrt{ 3 - \mbox{Tr}(r_1 r_2^{-1}) } = \sqrt {3 - \sum_{ij} r_{1_{ij}} r_{2_{ij}} } \\ \label{eq:dist2rot} r_1 \mbox{.distance2}(r_2) = 3 - \mbox{Tr}(r_1 r_2^{-1}) = 3 - \sum_{ij} r_{1_{ij}} r_{2_{ij}} \\ r_1 \approx r_2 \Longleftrightarrow 3 - \mbox{Tr}(r_1 r_2^{-1}) \leq \epsilon^2 \end{eqnarray} And a norm is provided: \begin{eqnarray} \label{eq:norm2rot} r_1 \mbox{.norm2}(~) = 3 - \mbox{Tr}(r_1) \end{eqnarray} \Ax s have the property that two apparently unequal forms may be equivalent, for example if the axes are in opposite directions and one angle is the negative of the other. Similarly, two different-looking \Es\ can represent the same rotation. To avoid a whole spectrum of special cases, we adapt the rule that, letting $\Upsilon$ be an \Ax and $\Xi$ be an \Es\ structure, and $R(\Upsilon), R(\Xi)$ be the corresponding \Ro s, \begin{eqnarray} \Upsilon_1 \mbox{.howNear} (\Upsilon_2) \equiv R \left( \Upsilon_1 \right) \mbox{.howNear} \left( R \left( \Upsilon_2 \right) \right) \\ \Xi_1 \mbox{.howNear} (\Xi_2) \equiv R \left( \Xi_1 \right) \mbox{.howNear} \left( R \left( \Xi_2 \right) \right) \end{eqnarray} Since for double precision computations these nearness measures cannot count on precision to better than $10^{-8}$, the default tolerance for Rotations (which may be modified by the class static method {\tt setTolerance()}) is set to 100 times that. \begin{equation} \epsilon_{\mbox{default}} = 10^{-6} \label{eq:epsildefR} \end{equation} \subsubsection{Nearness for \protect\Ro s About the Same Axis} \label{rotsame} The above definition of {\tt howNear()} for two general \Rotation s reduces, when both \Rotation s are around the same axis by angles $\delta_1$ and $\delta_2$, to \begin{equation} r_1 \mbox{.howNear} (r_2) = \sqrt{ 2 - 2 \cos (\delta_1 - \delta_2) } = | \delta_1 - \delta_2 | + O \left( (\delta_1 - \delta_2)^3 \right) \end{equation} \noindent (Note that when the two rotations are special-case coordinate axis rotations, computing the cosine of that angle difference is trivial, given that the structures already hold the sine and cosine of $\delta_i$.) Although equivalent for most small angular differences to the simpler concept of $ | \delta_1 - \delta_2 | $, the definition above also properly handles the case where one $\delta$ is near $\pi$ and the other near $-\pi$. \subsection{Comparison for \protect\Ro s, \protect\Ax s, and \protect\Es\ } It is useful to have definitions of the various comparison operators so that \Ro s, \Ax s, and \Es\ can be placed into {\tt std::} containers. Of the three classes, \Ax\ has a natural meaning for ordering comparisons, taking advantage of the ordering relation already available for the \UV\ axes: \begin{equation} \label{eq:ordrot} ( \hat{u}_1 , \delta_1 ) > ( \hat{u}_2 , \delta_2 ) \mbox{ if } \hat{u}_1 > \hat{u}_2 \mbox { or } \left[ \hat{u}_1 = \hat{u}_2 \mbox { and } \delta_1 > \delta_2 \right] \end{equation} For \Rotation, we could use the ordering induced by its \Ax\ expression; extracting the \Ax\ corresponding to a \Ro\ is a fairly simple task. But that is unnecessarily complex--instead, we use dictionary ordering, starting with $zz, zy, zx, yz, \ldots, xx$. This agrees with the definition used in the orignal CLHEP Vector package. For \Es, rather than laboriously going over to \Ro s and then using the induced dictionary ordering comparison, we adapt simple dictionary ordering: \begin{eqnarray} ( \phi_1 , \theta_1, \psi_1 ) > ( \phi_2 , \theta_2, \psi_2 ) \mbox{ if } \nonumber \\ \phi_1 > \phi_2 \mbox { or } \nonumber \\ \left[ \phi_1 = \phi_2 \mbox { and } \theta_1 > \theta_2 \right] \mbox { or } \nonumber \\ \left[ \phi_1 = \phi_2 \mbox { and } \theta_1 = \theta_2 \mbox { and } \psi_1 > \psi_2 \right] \end{eqnarray} Because we use dictionary ordering comparisons, one \Ro\ may be considered greater than another, but if you take may Euler angles (or for that matter their \Ax\ structures), the comparison may have the opposite sense. \subsection{The Rotation Group} Inversion of a \Ro\ is supported. Since the matrix is orthogonal, the inverse matches the transpose: \[ R\mbox{.inverse()} \equiv R^{-1} = R^T \] Multiplication is available in three syntaxes: \begin{eqnarray} \label{eq:opmulrot} \mbox{ R = R1 * R2} \Longrightarrow {\boldmath R = R_1 R_2} \label{eq:opstrot} \\ \mbox{ R *= R1 } \Longrightarrow {\boldmath R = R R_1 } \\ \label{eq:transrot} \mbox{ R.transform(R1) } \Longrightarrow {\boldmath R = R_1 R } \end{eqnarray} To complete the group concept, the identity \Ro\ can easily be obtained; the default constructor for \Ro\ gives the identity. Two sorts of specialized transformations are available. The first transforms by a rotation around an axis: \begin{eqnarray} \label{eq:xyzrot} R\mbox{.rotateX}(\delta) \Longrightarrow R = \mbox{RotationX}(\delta) R \\ \nonumber R\mbox{.rotateY}(\delta) \Longrightarrow R = \mbox{RotationY}(\delta) R \\ \nonumber R\mbox{.rotateZ}(\delta) \Longrightarrow R = \mbox{RotationZ}(\delta) R \end{eqnarray} \noindent The other specialized transformation rotates such that the original X axis becomes a specified new X axis, and similarly for the Y and Z axes. In the specified new axes are labeled $\vec{X}^\prime$, $\vec{Y}^\prime$, $\vec{Z}^\prime$, this transformation is equivalent to: \begin{equation} \label{eq:rotaxes} \mbox{R.rotateAxes}(X^\prime, Y^\prime, Z^\prime) \Longrightarrow {\boldmath R} = \left( \begin{array}{ccc} X^\prime_x & Y^\prime_x & Z^\prime_x \\ X^\prime_y & Y^\prime_y & Z^\prime_y \\ X^\prime_z & Y^\prime_z & Z^\prime_z \end{array} \right) {\boldmath R} \end{equation} \noindent The supplied $\vec{X}^\prime$, $\vec{Y}^\prime$ and $\vec{Z}^\prime$ must be orthonormal; no checking is done, and if the supplied new axes are not orthonormal, the result will be an ill-formed (non-orthogonal) rotation matrix. \subsection{Rectifying Rotations} The operations on \Ro s are such that mathematically, the orthonormality of the representation is always preserved. And methods take advantage of this property. However, a long series of operations could, due to round-off, produce a \Ro\ object with a representation that slightly deviates from the mathematical ideal. This deviation can be repaired by extracting the axis and delta for the \Ro, and freshly setting the axis and delta to those values. \begin{equation} \label{eq:rectRot} \mbox{R.rectify()} \rightarrow \mbox{R.set (R.axis(), R.delta())} \end{equation} A technical point: If the rotation has strayed significantly from a true orthonormal matrix, then extracting the axis is not necessarily an accurate process. To minimze such effects, before performing the formal algorithm to extract the axis, the rectify() method averages the purported rotation with the transpose of its inverse. (A true rotaion is identical to the transpose of its inverse). This in principle eliminates errors to lowest order. \section{\protect\LT\ Class} A \LT\ may be expressed in terms of a \Rotation\ in the space sector, followed by a pure \LB\ along some direction. Alternatively, it may be expressed as a pure boost followed by a rotation. In any event, just as for rotations, we use the convention of active transformations changing 4-vectors (rather than transformations of a reference frame). So a boost by $\beta$ along the in the X direction, for example, would be represented by the matrix \begin{equation} \label{eq:boostx} \mbox{LorentzBoost}(\beta) = \left( \begin{array}{cccc} \gamma & 0 & 0 & \beta \gamma \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ \beta \gamma & 0 & 0 & \gamma \end{array} \right) \end{equation} A \LT\ is an object in its own right; two \LT s may be multiplied, tested for near equality, and so forth. Multiplication is done by multiplying the matrix representations of two \LT s. The matrix representing a \LT\ is orthosymplectic: The last (T) row, constdered as a 4-vector, has $ t^2 - |\vec{v}|^2 = 1 $, each of rows X, Y, and Z have $ t^2 - |\vec{v}|^2 = -1$, and the Minkowski space dot product of any two distinct rows is zero. This leads to a trivial inversion method---simply transpose the matrix and negate any elment with just one of its two indices refering to a space direction. \subsection{Pure Lorentz Boosts} Definitions and and conventions for a pure boost classes match those described in equation (\ref{eq:pureboost}). Here we will write out the matrix in detail, for a boost specified by $\vec{b}$, a \SV\ with magnitude $0 < \beta < 1$ (here we write $\vec{b} = \beta \hat{u} $ and $\gamma \equiv \frac{1}{\sqrt{1-\beta^2}}$): \begin{eqnarray} \label{eq:boostform} \mbox{LorentzBoost}(\beta \hat{u}) = \left( \begin{array}{cccc} (\gamma - 1) u_x^2 + 1 & (\gamma - 1) u_x u_y & (\gamma - 1) u_x u_z & \beta \gamma u_x \\ (\gamma - 1) u_y u_x & (\gamma - 1) u_y^2 + 1 & (\gamma - 1) u_y u_z & \beta \gamma u_y \\ (\gamma - 1) u_z u_x & (\gamma - 1) u_z u_y & (\gamma - 1) u_z^2 + 1 & \beta \gamma u_z \\ \beta \gamma u_x & \beta \gamma u_y & \beta \gamma u_z & \gamma \end{array} \right) \end{eqnarray} \subsubsection{isNear() and howNear() for LorentzBoost} Though a pure boosts may be specified by a \SV\ of magnitude less than one, we do not define a nearness measure as the (relative) measure that induced by those \SV s. This is because two \LB s in the same direction with large but quite different values of $\gamma$ should be viewed as quite different transformations. The \SV s representing two such boosts would both be very close to the same unit vector. That is, (.9999, 0, 0) and (.999999, 0, 0) are not very similar: The former would boost a muon to 10 GeV, while the latter would boost it to 200 GeV; yet as \SV s, (.9999, 0, 0) is equal to (.999999, 0, 0) within a relative tolerance $10^{-4}$. LorentzBoosts have a natural scale, set by the speed of light, so absolute rather than relative tolerances are appropriate. The correct way to measure nearness is to find the difference between the values of $\gamma b$. If $\vec{\beta}_1$ and $\vec{\beta}_2$ specify two pure boosts $B_1$ and $B_2$ and $\gamma_i \equiv \frac{1}{\sqrt{1 - |\vec{\beta}_i|^2}}$ then \begin{eqnarray} \label{eq:nearboost} B_1 \mbox{.isNear} (B_2) \Longleftrightarrow \left| \gamma_1 \vec{\beta}_1 - \gamma_2 \vec{\beta}_2 \right|^2 \leq \epsilon^2 \\ \label{eq:hownearboost} B_1 \mbox{.howNear} (B_2) = \left| \gamma_1 \vec{\beta}_1 - \gamma_2 \vec{\beta}_2 \right| \\ B_1 \mbox{.distance2} (B_2) = \left| \gamma_1 \vec{\beta}_1 - \gamma_2 \vec{\beta}_2 \right|^2 \\ \label{eq:boostnorm2} B\mbox{.norm2}( ) \equiv B\mbox{.distance2} (I) = \gamma^2 \beta^2 = 1 - \gamma^2 \end{eqnarray} \subsubsection{Ordering Comparisons of LorentzBoosts} Any pure boost can be viewed as having a non-negative $\beta$, and s direction. For pure boosts in the same direction both with positive $\beta$, we wish to order LorentzBoosts according $\beta$: \begin{equation} \label{ordboost} \mbox{LorentzBoost}( \beta_1 > 0, \hat{u} ) > \mbox{LorentzBoost}( \beta_2 > 0, \hat{u} ) \Longleftrightarrow \beta_1 > \beta_2 \end{equation} For pure boosts which may be in different directions, we use a comparison condition induced by the \SV s specifying the two boosts. But in order to match the above ordering for identical directions, we must reverse the sense of the naive induced ordering when both vectors are negative. That is, we want to say that the boost (-.2, -.2, -.2) is ``more than'' the boost (-.1, -.1, -.1). \begin{eqnarray} \mbox{LorentzBoost}( \vec{\beta}_1 ) > \mbox{LorentzBoost}( \vec{\beta}_2 ) \mbox{ if } \left\{ \begin{array}{ccc} ( \vec{\beta}_1 \geq \vec{0} & \mbox{ and } & \vec{\beta}_1 > \vec{\beta}_2 ) \\ & \mbox{or} \\ ( \vec{\beta}_2 < \vec{0} & \mbox{ and } & \vec{\beta}_1 < \vec{\beta}_2 ) \end{array} \right. \end{eqnarray} \subsection{Components of HepLorentzRotations} Beyond the obvious methods returning single components, such as {\tt lt.yt()} there is also the method {\tt rep4x4()}, which returns a struct of type {\tt HepRep4x4}---this has publicly visible data members {\tt xx\_, xy\_, $\ldots$, tz\_, tt\_}. These methods may also be used for pure {\tt HepBoost} boosts. For those classes, there is also a method {\tt rep4x4Symmetric()}, which returns a ten-element struct {\tt HepRep4x4Symmetric}. For \LT, there are also indexing methods with syntax {\tt lt[i][j]} and {\tt lt(i,j)}. In this syntax, the indices range from 0 to 3, with the time component last. That is, 0 refers to an X component, 1 to Y, 2 to Z, and 3 to T. If R is the four by four representation of a \LT\ L, then: \begin{eqnarray} \label{eq:ltsubscript} \begin{array}{llll} L [0] [0] = R_{xx} & L [0] [1] = R_{xy} & L [0] [2] = R_{xz} & L [0] [3] = R_{xt} \\ \nonumber L [1] [0] = R_{yx} & L [1] [1] = R_{yy} & L [1] [2] = R_{yz} & L [1] [3] = R_{yt} \\ \nonumber L [2] [0] = R_{zx} & L [2] [1] = R_{zy} & L [2] [2] = R_{zz} & L [2] [3] = R_{zt} \\ \nonumber L [3] [0] = R_{tx} & L [3] [1] = R_{ty} & L [3] [2] = R_{tz} & L [3] [3] = R_{tt} \end{array} \end{eqnarray} \subsection{Decomposition of Transformations into Boost and Rotation} A \LT\ $T$ may be decomposed either into the form $ B R $ or the form $ R B $. Here we will refer to the first form as $T = \acute{B}(T) \grave{R}(T)$ and the second as $T = \acute{R}(T) \grave{B}(T)$. When decomposing into the product $ B R $, the boost will have the same last column as the \LT\ $T$. Using the value of $\gamma$ read off $T_{tt}$, one can apply equation (\ref{eq:boostform}) to find the matrix $\acute{B}(T)$ for that boost. Then \begin{equation} \label{eq:decomBR} \grave{R}(T) = \left[ \acute{B}(T) \right] ^{-1} T \end{equation} When decomposing into the product $ R B $, the boost will have the same last row as the \LT\ $T$. Again one can apply equation (\ref{eq:boostform}) to find the matrix (this time $\grave{B}(T)$) for that boost. Then \begin{equation} \label{eq:decomRB} \acute{R}(T) = T \left[ \grave{B}(T) \right] ^{-1} \end{equation} Naively applying the above equations leads to non-neglible round-off errors in the components of the Rotation---of order $3 \cdot 10^{-14}$ if the boost has $\beta = .95$. Since a Rotation representation which is non-orthogonal on that scale would lead to errors in distance measures of more than one part in $10^{-7}$, the decompose() method rectifies the Rotation before returning. \subsection{isNear() and howNear() for \protect\LT s} For \LT s, the analog of the the \Rotation measure (\ref{eq:nearrot}) would be \[ T_1 \mbox{.howNear}(T_2) = \sqrt{ 4 - \mbox{Tr}(T_1 T_2^{-1}) } \] This, however, would be a horrible definitition of distance since that trace can equal 4 for very different $T_1$ and $T_2$. Instead, we use a definition which matches the definitions (\ref{eq:nearrot}) and (\ref{eq:hownearboost}) for \LT s which happen to be pure boosts or pure rotations: \begin{eqnarray} \label{eq:isnearLT} \mbox{if } T_1 = B_1 R_1 \mbox{ and } T_2 = B_2 R_2 \nonumber \\ \mbox{then } T_1\mbox{.distance2}(T_2) = B_1\mbox{.distance2}(B_2) + R_1\mbox{.distance2}(R_2) \\ \nonumber T_1\mbox{.howNear}(T_2) = \sqrt {T_1\mbox{.distance2}(T_2)} \end{eqnarray} \noindent The {\tt isNear()} relationship uses this same measure, but when the transformations have boosts that differ by more that $\epsilon$, {\tt isNear()} will be quite a bit quicker since the boost portion of this formula is trivial to compute. And, as usual, {\tt norm2()} is the squared distance from the identity: \begin{equation} \label{eq:ltnorm2} T = B R \Longrightarrow T\mbox{.norm2}() = B.\mbox{.norm2}() + R\mbox{.norm2}() \end{equation} \subsection{Ordering Comparisons of \protect\LT s} The \verb$ ( >, >=, <, <= )$ comparisons of \LT s are defined as those induced by the decomposition $ T = \acute{B} \grave{R} $, comparing the pure boost part (using (\ref{ordboost})) and then, if those are equal, comparing the rotation part (using (\ref{eq:ordrot})). \begin{eqnarray} \label{eq:ltorder} T_1\mbox{.compare}(T_2) = 1 \mbox{ if } \acute{B}_1 > \acute{B}_2 \mbox { or } \left[ \acute{B}_1 = \acute{B}_2 \mbox { and } \grave{R}_1 > \grave{R}_2 \right] \\ \nonumber T_1\mbox{.compare}(T_2) = -1 \mbox{ if } \acute{B}_1 < \acute{B}_2 \mbox { or } \left[ \acute{B}_1 = \acute{B}_2 \mbox { and } \grave{R}_1 < \grave{R}_2 \right] \\ \nonumber T_1\mbox{.compare}(T_2) = 0 \mbox{ if } \acute{B}_1 = \acute{B}_2 \mbox { and } \grave{R}_1 = \grave{R}_2 \\ T_1 > T_2 \mbox{ if } T_1\mbox{.compare}(T_2) = 1 \\ \nonumber T_1 < T_2 \mbox{ if } T_1\mbox{.compare}(T_2) = -1 \end{eqnarray} Although \verb$==$ and \verb$!=$ comparisons could use this same comparison algorithm, decomposition is expensive and unnecessary. Instead, \begin{eqnarray} \label{eq:ltexact} T == S \Longleftrightarrow \left\{ \begin{array}{cccc} T_{xx} = S_{xx} \wedge & T_{xy} = S_{xy} \wedge & T_{xz} = S_{xz} \wedge & T_{xt} = S_{xt} \wedge \\ T_{yx} = S_{yx} \wedge & T_{yy} = S_{yy} \wedge & T_{yz} = S_{yz} \wedge & T_{yt} = S_{yt} \wedge \\ T_{zx} = S_{zx} \wedge & T_{zy} = S_{zy} \wedge & T_{zz} = S_{zz} \wedge & T_{zt} = S_{zt} \wedge \\ T_{tx} = S_{tx} \wedge & T_{ty} = S_{ty} \wedge & T_{tz} = S_{tz} \wedge & T_{tt} = S_{tt} \end{array} \right. \end{eqnarray} \subsection{The Lorentz Group} Inversion of a \LT\ is supported. Since the matrix is orthosymplectic, the inverse matches the transpose, but with the signs of all components with mixed space and time indices reversed. Multiplication is available in three syntaxes: \begin{eqnarray} \mbox{ T = T1 * T2} \Longrightarrow {\boldmath T = T_1 T_2} \\ \mbox{ T *= T1 } \Longrightarrow {\boldmath T = T T_1 } \\ \label{eq:lttrans} \mbox{ T.transform(T1) } \Longrightarrow {\boldmath T = T_1 T } \end{eqnarray} To complete the group concept, the identity \LT\ can easily be obtained; the default constructor for \LT\ gives the identity. Specialized transformations based on pure rotations and pure boosts are available. \begin{eqnarray} \label{eq:ltrot} T\mbox{.rotate}(\delta, \vec{v}) \Longrightarrow T = \mbox{Rotation}(\delta, \vec{v}) T \\ \nonumber T\mbox{.rotateX}(\delta) \Longrightarrow T = \mbox{RotationX}(\delta) T \\ \nonumber T\mbox{.rotateY}(\delta) \Longrightarrow T = \mbox{RotationY}(\delta) T \\ \nonumber T\mbox{.rotateZ}(\delta) \Longrightarrow T = \mbox{RotationZ}(\delta) T \end{eqnarray} \begin{eqnarray} \label{eq:ltboost} T\mbox{.boost}(\vec{\beta}) \Longrightarrow T = \mbox{HepBoost}(\vec{\beta}) T \\ \nonumber T\mbox{.boost}(\beta_x, \beta_y, \beta_z) \Longrightarrow T = \mbox{HepBoost}(\beta_x, \beta_y, \beta_z) T \\ \nonumber T\mbox{.boostX}(\beta) \Longrightarrow T = \mbox{HepBoostX}(\beta) T \\ \nonumber T\mbox{.boostY}(\beta) \Longrightarrow T = \mbox{HepBoostY}(\beta) T \\ \nonumber T\mbox{.boostZ}(\beta) \Longrightarrow T = \mbox{HepBoostZ}(\beta) T \end{eqnarray} \subsection{Rectifying HepLorentzRotations} The operations on \LT s are such that mathematically, the ortosymplectic property of the representation is always preserved. And methods take advantage of this property. However, a long series of operations could, due to round-off, produce a \LT\ object with a representation that slightly deviates from the mathematical ideal. This deviation can be repaired by extracting the boost vector based on row 4, multiplying by the inverse of that boost to form what should ideally be a rotation, rectifying that rotation, and setting the \LT\ ,based on that boost and rotation. \begin{eqnarray} \label{eq:rectLT} \mbox{T.rectify()} \rightarrow \nonumber \\ \vec{\beta} = \mbox {T.row4()} \nonumber \\ R = T \mbox{ Boost}(-\vec{\beta}) \nonumber \\ \mbox {drop time components of R} \nonumber \\ \mbox {R.rectify()} \nonumber \\ T = R \mbox{ Boost}(\beta) \end{eqnarray} \newpage \section{When Exceptions Occur} Although this section is not about mathematical definitions, it may be useful to understand what will happen if the user code sends a method data which does not make physical or mathematical sense. For example, a user may supply a vector of magnitude greater than one, to a method which will use that data to form a Boost. The resulting tachyonic boost is unlikely to be the result the user had intended. \subsection{How Problems Are Dealt With} In general, the package is configurable in one of three ways: \begin{enumerate} \item If {\tt ENABLE\_ZOOM\_EXCEPTIONS} is defined, then the Zoom Exceptions package is used. This allows the user code to control the behaviour to a considerable extent, including ignoring versus handling specific types of exceptional conditions and checking a stack of prior potential throws. Ultimately, an unhandled exception which is deemed or serious severity will throw a C++ exception, which if un-caught will cause the program to terminate. \item If {\tt ENABLE\_ZOOM\_EXCEPTIONS} is defined, but C++ exceptions are not enabled (some compilers have a switch to do this; some experiments choose to use this switch in an effort to improve performance) then the behavior for an unhandled serios exception is to explicitly abort. \item If {\tt ENABLE\_ZOOM\_EXCEPTIONS} is defined, then this compilation is designed for CLHEP, which currently does not use the Zoom Exception package. In that case, each problem will cause a message to be emitted on {\em cerr}. In addition, the various problems which were deemed too severe to ignore will throw actual C++ exceptions. These are all derived from a class {\tt CLHEP\_vector\_exception} which is in turn derived from the {\tt std::exception} class - see section 14.10 in Stroustrup. User code catching a general {\tt CLHEP\_vector\_exception} can call the virtual method {\em what()} to get a complete text message, or {\em name()} to just get the exception name. \end{enumerate} \subsection{Possible Exceptions} The following sorts of problems may be detected (and reported to {\em cerr} by the Vector package, and may in some circumstances be non-ignorable. If the problem can't be ignored, then the corresponding exception (derived from {\tt CLHEP\_vector\_exception} is thrown. \begin{description} \item [ZMxPhysicsVectors] Parent exception of all ZMexceptions particular to classes in the package. \item [ZMxpvInfiniteVector] Mathematical operation will lead to infinity or NAN in a component of a result vector. \item [ZMxpvZeroVector] A zero vector was used to specify a direction based on vector.unit(). \item [ZMxpvTachyonic] A relativistic kinematic function was taken, involving a vector representing a speed at or beyond that of light (=1). \item [ZMxpvSpacelike] A spacelike 4-vector was used in a context where its restMass or gamma needs to be computed: The result is formally imaginary (a zero result is supplied). \item [ZMxpvInfinity] Mathematical operation will lead to infinity as a Scalar result. \item [ZMxpvNegativeMass] Kinematic operation, e.g. invariant mass, rendered meaningless by an input with negative time component. \item [ZMxpvVectorInputFails] Input to a SpaceVector or Lorentz Vector failed due to bad format or EOF. \item [ZMxpvParallelCols] Purportedly orthogonal col's supplied to form a Rotation are exactly parallel instead. \item [ZMxpvImproperRotation] Orthogonal col's supplied form a refection (determinant -1) more nearly than rather than a rotation. \item [ZMxpvImproperTransformation] Orthogonalized rows supplied form a tachyonic boost, a reflection, or a combination of those flaws, more nearly than a proper Lorentz transformation. \item [ZMxpvFixedAxis] Attempt to change a RotationX, RotationY, or RotationZ in such a way that the axis might no longer be X, Y, or Z respectively. \item [ZMxpvIndexRange] When using the syntax of v(i) to get a vector component, i is out of range. \end{description} The following sorts of problems may be detected (and reported to {\em cerr} by the Vector package, as warnings. In these cases, the methdos have sensible behaviors avaialble, and will continue processing after reporting the warning. \begin{description} \item [ZMxpvNotOrthogonal] Purportedly orthogonal col's supplied to form a Rotation or LT are not orthogonal within the tolerance. \item [ZMxpvNotSymplectic] A row supplied to form a Lorentz transformation has a value of restmass incorrect by more than the tolerance: It should be -1 for rows 1-3, +1 for row 4. \item [ZMxpvAmbiguousAngle] Method involves taking an angle against a reference vector of zero length, or phi in polar coordinates of a vector along the Z axis. \item [ZMxpvNegativeR] R of a supplied vector is negative. The mathematical operation done is still formally valid. \item [ZMxpvUnusualTheta] Theta supplied to construct or set a vector is outside the range [0,PI]. The mathematical operation done is still formally valid. But note that when sin(theta) < 0, phi becomes an angle against the -X axis. \end{description} \newpage \section{Names and Keywords} \subsection {Symbols in the CLHEP Vector Package} Here we list the keywords that the user may need to be aware are used by the CLHEP Vectors package. Some symbols not listed here are: \begin{itemize} \item All symbols particular to the ZOOM PhysicsVectors package are listed in the next section. Pure CLHEP users who do not include files fro a ZOOM area need not be concerned with these. \item Method names in class scope, and names accessible only in the scope of a class (such as Rotation::IDENTITY) cannot clash with user names. \end{itemize} Names of functions defined at global scope do not actually pollute the user namespace, as long as one or more of their arguments involves a class defined in this package. These are therefore listed separately here. \begin{verbatim} File Defines Class Names ------------ -------------------------------------------- HEP_THREEVEVCTOR_H Hep3Vector HEP_LORENTZVECTOR_H HepLorentzVector HEP_ROTATION_H HepRotation HepRotationX HepRotationY HepRotationZ HEP_LORENTZ_ROTATION_H HepLorentzRotation HepBoost HepBoostX HepBoostY HepBoostZ HEP_ROTATION_INTERFACES_H Hep4RotationInterface Hep3RotationInterface HepRep3x3 HepRep4x4 HepRep4x4Symmetric HEP_EULERANGLES_H HepEulerAngles HEP_AXISANGLE_H HepAxisAngle \end{verbatim} \begin{verbatim} Keywords and Types Constants Global Functions ------------------ --------- ---------------- Tcomponent X_HAT4 rotationOf TimePositive Y_HAT4 rotationXOf TimeNegative Z_HAT4 rotationYOf T_HAT4 rotationZOf X_HAT2 boostOf Y_HAT2 boostXOf HepXHat boostYOf HepYHat boostZOf HepZHat inverseOf \end{verbatim} \subsection {Further Symbols Defined in ZOOM Headers} For backward compatibility, ZOOM headers are made available. These typedef classes to the corresponding CLHEP versions, and in the two cases of features which were in ZOOM but are not in CLHEP---{\tt UnitVector} and construction of vectors from spherical coordinates---provide the appropriate features. These ZOOM features are implemented purely at the header level; there is no separate ZOOM PhysicsVectors library beyond the CLHEP library. Note that for users including these headers, all symbols starting with {\tt ZMpv} are to be considered as reserved. These therefore do not appear in this list of keywords. \begin{verbatim} File Defines Class Names ------------ -------------------------------------------- PHYSICSVECTORS_H SPACEVECTOR_H SpaceVector UNITVECTOR_H UnitVector LORENTZVECTOR_H LorentzVector ROTATION_H Rotation RotationX RotationY RotationZ LORENTZ_TRANSFORMATION_H LorentzTransformation LorentzBoost LorentzBoostX LorentzBoostY LorentzBoostZ EULERANGLES_H EulerAngles AXISANGLE_H AxisAngle \end{verbatim} \begin{verbatim} Keywords and Types Constants ------------------ --------- DEGREES X_HAT RADIANS Y_HAT ETA Z_HAT \end{verbatim} \end{document} clhep-2.1.4.1.orig/Vector/doc/Makefile.am0000755000175000017500000000251611406203315016442 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif TEX = latex doc_srcdir = $(top_srcdir)/doc doc_builddir = $(top_builddir)/doc doc_installdir = $(prefix)/doc/@PACKAGE@ DOC_POSTSCRIPT = VectorDefs.ps eulerAngleComputation.ps \ VectorDefs.pdf eulerAngleComputation.pdf SUFFIXES = .dvi .tex .ps .pdf .dvi.ps: dvips -o $@ $(@:.ps=.dvi) .dvi.pdf: dvipdf $(@:.pdf=.dvi) all: docs docs: $(DOC_POSTSCRIPT) install-docs: $(mkinstalldirs) $(DESTDIR)$(doc_installdir) $(INSTALL_DATA) $(doc_builddir)/VectorDefs.ps $(DESTDIR)$(doc_installdir)/VectorDefs.ps $(INSTALL_DATA) $(doc_builddir)/eulerAngleComputation.ps $(DESTDIR)$(doc_installdir)/eulerAngleComputation.ps $(INSTALL_DATA) $(doc_builddir)/VectorDefs.pdf $(DESTDIR)$(doc_installdir)/VectorDefs.pdf $(INSTALL_DATA) $(doc_builddir)/eulerAngleComputation.pdf $(DESTDIR)$(doc_installdir)/eulerAngleComputation.pdf $(INSTALL_DATA) $(doc_srcdir)/keyMergeIssues.doc $(DESTDIR)$(doc_installdir)/keyMergeIssues.doc $(INSTALL_DATA) $(doc_srcdir)/merge-details.doc $(DESTDIR)$(doc_installdir)/merge-details.doc $(INSTALL_DATA) $(doc_srcdir)/minorMergeIssues.doc $(DESTDIR)$(doc_installdir)/minorMergeIssues.doc # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = $(DOC_POSTSCRIPT) *.aux *.log *.toc *.dvi clhep-2.1.4.1.orig/Vector/doc/eulerAngleComputation.tex0000755000175000017500000003757011406203315021446 0ustar olesoles% CLHEP/ZOOM Vector Package Euler Angle Computation \documentclass[twoside,12pt]{article} \flushbottom \pagestyle{headings} \setlength{\topmargin}{0.0in} \setlength{\textwidth}{5.5in} \setlength{\oddsidemargin}{.5in} \setlength{\evensidemargin}{.5in} \setlength{\textheight}{8.5in} \addtolength{\parskip}{2pt} \newcommand{\fpcl}{{\sc fpcl}} \def \Point {{\tt Point3D}} \def \Line {{\tt Line3D}} \def \Direction {{\tt Direction}} \def \UnitVector {{\tt UnitVector}} \def \Plane {{\tt Plane3D}} \def \SpaceVector {{\tt SpaceVector}} \def \SV {{\tt Hep3Vector}} \def \SVz {{\tt SpaceVector}} \def \UV {{\tt UnitVector}} \def \TangentVector {{\tt TangentVector}} \def \TV {{\tt TangentVector}} \def \Ro {{\tt HepRotation}} \def \Ros {{\tt Rotation}} \def \Rotation {{\tt Rotation}} \def \RotationZ {{\tt HepRotationZ}} \def \Transformation {{\tt Transformation}} \def \Euclidean {{\tt EuclideanTransformation}} \def \Angle {{\tt Angle}} \def \LorentzVector {{\tt LorentzVector}} \def \LorentzTransformation {{\tt LorentzTransformation}} \def \LV {{\tt HepLorentzVector}} \def \LVz {{\tt LorentzVector}} \def \LT {{\tt HepLorentzRotation}} \def \LTs {{\tt LorentzTransformation}} \def \LB {{\tt HepBoost}} \def \LBs {{\tt LorentzBoost}} \def \PolarAngle {{\tt PolarAngle}} \def \PAngle {{\tt PAngle}} \def \AzimuthalAngle {{\tt AzimuthalAngle}} \def \AAngle {{\tt AAngle}} \def \EB {{\tt EBvector}} \def \AV {{\tt Adjoint3Vector}} \def \ALV {{\tt Adjoint4Vector}} \def \Scalar {{\tt Scalar}} \def \Ax {{\tt HepAxisAngle}} \def \Es {{\tt HepEulerAngles}} \newcommand {\see}[1] {\hfill$\triangleright$ see eqn.~#1} \newenvironment{shortlist}{% \begin{itemize} \setlength{\itemsep}{0pt} \setlength{\parskip}{0pt} }{% \end{itemize} } \setcounter{secnumdepth}{2} % Number sub- but not subsubsections \setcounter{tocdepth}{2} % Only numbered section headings go in contents \begin{document} \title{Euler Angle Computation in the CLHEP {\bf Vector} Package} \author{Mark Fischler} \date{Version 1.0, April 24, 2003} \maketitle The naive (though algebraically sound) technique for extracting \Es\ from a \Ro\ is flawed when the \Ro\ represents a rotation very nearly around the Z axis, in the presence of small round-off induced errors in the values of the rotation matrix components. By flawed, we mean that when the resulting Euler angles are used to reconstruct the \Ro, that reconstructed \Ro\ may be quite different from the original. This document will illustrate the mechanism by which this flaw comes up, and will derive and justify a superior algorithm for calculationg the proper euler angles. \tableofcontents \section{The Naive Algorithm} The relation between the Eueler Angles and a \Ro\ $R$ is given by: \[ \vec{v}.\mbox{rotate}(\phi, \theta, \psi) \Longrightarrow \] \begin{equation} \label{eq:eulerrot} \left( \begin{array}{ccc} \cos \psi \cos \phi - \sin \psi \cos \theta \sin \phi & \cos \psi \sin \phi + \sin \psi \cos \theta \cos \phi & \sin \psi \sin \theta \\ - \sin \psi \cos \phi - \cos \psi \cos \theta \sin \phi & - \sin \psi \sin \phi + \cos \psi \cos \theta \cos \phi & \cos \psi \sin \theta \\ \sin \theta \sin \phi & - \sin \theta \cos \phi & \cos \theta \end{array} \right) \left( \begin{array}{c} v_x\\ v_y\\ v_z \end{array} \right) \end{equation} As of CLHEP 1.8, the algorithm for comupting Euler angles $(\psi, \theta, \phi)$, glossing over special cases, was as follows: \begin{enumerate} \item Find $\theta$ by taking $\cos^{-1} R_{zz}$ and $\sin \theta = \sqrt{1-R_{zz}^2}$. By definition, $\theta$ is in quadrant I or II, and $\sin \theta \geq 0$. \item Knowing the form of $R_{zy} = - \sin \theta \cos \phi$, extract $\cos | \phi | = - R_{zy} / \sin \theta$. \item Similarly, $\cos | \psi | = + R_{yz} / \sin \theta$. \item Taking the arc cosine of the expressions just computed gives $|\phi|$ and $|\psi|$. The signs of $\psi$ and $\phi$ are assigned so as to yield proper signs for $R_{zx}$ and $R_{xz}$ respectively; if one or both of those is zero then demand instead the proper sign for $R_{zy}$ and/or $R_{yz}$. \item The case where $R_{zz} = \pm 1$ is treated specially. In that case, there is a freedom to tradeoff values of $\psi$ and $\phi$, and an arbitrary rule is imposed: $\psi = R_{zz} \phi$. \end{enumerate} \section{The Potential Flaw} The above algorithm is analytically correct, but if one perturbs $R_{ij} \rightarrow R_{ij}+\epsilon_{ij}$ for some set of $\epsilon_{ij} << 1$, then $\psi \rightarrow \psi + \delta \psi$ and $\phi \rightarrow \phi + \delta \phi$ where, if $\sin \theta << 1$ then $\delta \psi$ and $\delta \phi$ need not be small. To illustrate: Say $R$ represents a rotation by angle $\mu$ about the Z axis, but $R_{zz}$ is perturbed to be $1 - \epsilon$ while none of the other components in the Z row or column--the components with value 0 for a Z rotation--are perturbed. Now a rotation by angle $\mu$ about the Z axis falls into the ambiguous case, where any answer with $\theta << 1$ and $\psi + \phi \sim \mu$ would be acceptable. However, the algorithm described above will assign a tiny {\em but non-zero} value to $\sin \theta$. So it will decide that the divisions in $\cos | \psi | = - R_{zy} / \sin \theta$ and $\cos | \phi | = + R_{yz} / \sin \theta$ are valid operations. Of course, since the numerators are exactly zero, it does not matter that the denominators are small; these will say that $ |\psi| = \pi /2$ and $ |\phi| = \pi /2$. Then the algorithm attempts to determine the signs of $\psi$ and $\phi$; and the actual code gets into futher trouble since it knows that $\sin \theta$ is non-zero, thus it is ``impossible'' (yet true) to have all four of $R_{xz}, R_{yz}, R_{zx}, R_{zy} = 0$. But no matter how clever the algorithm at that point, once it is decided that $ |\psi| = |\phi| = \pi /2$ there is no way to recover the proper relationship $\psi + \phi \sim \mu$. And in fact, if you form a \Ro\ from the computed Euler angles, you will either get something close to the identity matrix, or something close to a 180 degree rotation about the Z axis--neither of which resembles the original matrix in the least! In general, if the \Ro\ represents any rotation about some axis making an angle with the Z axis which is smaller than or comparable to the uncertainty in the matrix elements, then the algorithm used in CLHEP 1.8 and earlier is flawed in this way. \section{Deriving The New Algorithm} It is true that for $1 - |R_{zz}|$ small, the exact values of Euler angles depend sensitively on the values of all the matrix components. Thus the problem of extracting Euler angles for such cases is numerically unstable. But this is not fatal; what we want is a set of Euler angles that comes very close to properly representing the rotation matrix, and if other sets of Euler angles would also come close, we don't mind not finding them. Fortunately, the problem of extracting Euler angles in the presence of perturbations of the matrix elements, such that the reconstructed matrix will match the original up to differences of the same order as those perturbations, is tractable and numerically stable, as we now show. We start with the observations that \begin{eqnarray} R_{xx} + R_{yy} = + \cos ( \psi + \phi ) (1 + \cos \theta) \\ R_{xx} - R_{yy} = + \cos ( \psi - \phi ) (1 - \cos \theta) \end{eqnarray} If $R_{zz}$ is non-negative, $(1 + \cos \theta) \geq 1$, while if $R_{zz}$ is negative, $(1 - \cos \theta) > 1$; so one of the above equations can always be used to determine $|\psi \pm \phi|$ with no risk of division by a small quantity. And if $|R_{zz}|$ is not close to 1, both equations are numerically stable so both combinations can be found. Still working in the X-Y sector, \begin{eqnarray} R_{xy} - R_{yx} = + \sin ( \psi + \phi ) (1 + \cos \theta) \\ R_{xy} + R_{yx} = - \sin ( \psi - \phi ) (1 - \cos \theta) \end{eqnarray} We also observe, in the Z sector, that \begin{eqnarray} R_{xz} R_{zx} - R_{yz} R_{zy} = + \cos ( \psi - \phi ) (\sin^2 \theta) \\ R_{xz} R_{zx} + R_{yz} R_{zy} = - \cos ( \psi + \phi ) (\sin^2 \theta) \end{eqnarray} And \begin{eqnarray} R_{xz} R_{zy} + R_{yz} R_{zx} = - \sin ( \psi - \phi ) (\sin^2 \theta) \\ R_{xz} R_{zy} - R_{yz} R_{zx} = - \sin ( \psi + \phi ) (\sin^2 \theta) \end{eqnarray} Finally, we note that if we can determine cosine and sine of the sum and the difference of $\psi$ and $\phi$ in a numerically stable manner, then that determines $\psi$ and $\phi$ in a stable manner. All the above relations are all stable except when $1- |R_{zz}| \sim 0$. So except when $1- |R_{zz}| \sim 0$ we can use either the Z sector, or the X-Y sector, or for that matter the simple $R_{xz}/\sin \theta$ and $R_{yz}/\sin \theta$ forms used by the naive algortihm. When $R_{zz} \sim 1$, the entire Z sector becomes numerically unstable, as do the relations determining $\cos ( \psi - \phi )$ and $\sin ( \psi - \phi )$ in the X-Y sector. That is not so terrible, since at $R_{zz} = 1$ only the value of $\psi + \phi$ is relevant; $\psi - \phi$ is moot. Similarly, when $R_{zz} \sim -1$, the Z sector is numerically unstable, and the relations determining $\cos ( \psi + \phi )$ and $\sin ( \psi + \phi )$ in the X-Y sector are useless, but only the value of $\psi - \phi$ is relevant; $\psi + \phi$ is moot. So what is needed is some method which always gives the correct values for meaningful quantities, and sensible values for the moot quantities. The way to accomplish this is to combine the relations determining $\sin$ and $\cos$ of the ``moot'' quantities, so as to find (for the $R_{zz} \sim 1$ case) $\psi - \phi = \tan^{-1} \frac{ -(R_{xy} + R_{yx}) }{ R_{xx} - R_{yy} }$. In this fraction, the factors of $1 - \cos \theta$ cancel one another. Computing $\psi - \phi $ as an $\arctan$ would force it to lie between $-\pi/2$ and $\pi/2$. How can we detect when the correct value is outside that range? We could look at the sign of $\sin (\psi - \phi)$, that is to say, the sign of $-(R_{xy} + R_{yx})$. This would tell us whether to use the result of $\arctan$ directly or to add or subtract $\pi$. On the other hand, it is much easier to use the function {\em atan2(s/c)}, which does this work for you. One would expect from the above reasoning that when $R$ is slightly perturbed in a pseudo-random manner, the formulae given would reproduce the original Euler angles more closely than the ``naive'' formulae described earlier. A bit of mathematical experimentation verifies that this is so--the new formulae are about an order of magnitude less sensitive to fluctuations which violate the orthogonality of $R$. Two improvements are tempting, but turn out to be harmful. Both address the issue of attempting to morph smoothly to the action taken when $|R_{zz}| = 1$ precisely (in which case we by fiat choose $\psi = R_{zz} \phi$). Sometimes in computing the potentially moot combination of $\psi$ and $\phi$, the magnitude of the value computed for $\cos (\psi \pm \phi) (1 \mp \cos \theta)$ exceeds $(1 \mp \cos \theta)$. It may then be thought that the arithmetic is telling you to consider that denominator as illogically large, and just treat the arctan of that combination as zero (that is, force $\psi = \pm \phi$). This turns out to introduce a flaw in the result (in the sense discussed above) most times that this ``improvement'' is applied. Similarly, one can check that the sign of the X-Y sector expression for $\sin(\psi \pm \phi)$ matches the sign of the expression for the same $\sin(\psi \pm \phi)$ computed from components in the Z sector, and if they do not match, treat this as an indication that the combination is moot and set $\psi = \pm \phi$. Again, most times this opportunity presents itself, setting $\psi = \pm \phi$ introduces a flaw into the answer. However, one correction of significance must be applied: The algorithm described will always impute values for $\psi \pm \phi$ which are in the range $(-\pi,\pi]$. But clearly the actual values of $\psi$ and $\phi$ can can have a sum or difference anywhere in $(-2\pi,2\pi]$. Getting this wrong will manifest itself as an error by $\pi$ in the computed values of $\psi$ and $\phi$. This can be dealt with by bringing in information in the Z-sector: If $\psi$ (or $\phi$) has the wrong sign relative to that which can be read off the last column or row, then one should add or subtract $\pi$ from {\em both} $\psi$ and $\phi$. Here, when $|R_{zz}| \sim 1$, there is the potential for numerical instability; fortunately, in such cases only the value of one combination $\psi \pm \phi$ is relevant when re-expressing the rotation matrix. So as long as the correction is applied to both $\psi$ and $\phi$ or neither, the result (in such a case) is not truly flawed. There are, of course, four possible terms in the Z-sector to use to ask whether we have the wrong value for $\psi$ and $\phi$: \begin{enumerate} \item $R_{xz}$: If $\sin \psi > 0$ then $\psi > 0$. \item $R_{yz}$: If $\cos \psi > 0$ then $|\psi| < \pi/2$. \item $R_{zx}$: If $\sin \phi > 0$ then $\phi > 0$. \item $R_{yz}$: If $-\cos \phi < 0$ then $|\psi| < \pi/2$. \end{enumerate} The most stable algorithm will use that quantity among those four which is largest in absolute value. \section{The New Algorithm} The algorithm uses only the X-Y sector and $R_{zz}$. $\cos \theta = R_{zz}$ and this determines $\theta$. \noindent If $ R_{zz} \geq 0$ the primary stable quantity is $\psi + \phi$: \begin{enumerate} \item Compute $\psi + \phi = \tan^{-1} \frac{R_{xy} - R_{yx}}{R_{xx} + R_{yy}}$. With the numerator and denominator in this form we can get the proper value of $\psi + \phi$ (including the proper quadrant) by using the {\em atan2(s/c)} function. \item Compute $\psi - \phi = \tan^{-1} \frac{-(R_{xy} + R_{yx})}{R_{xx} - R_{yy}}$. \end{enumerate} \noindent If $ R_{zz} < 0$ the primary stable quantity is $\psi - \phi$: \begin{enumerate} \item Compute $\psi - \phi = \tan^{-1} \frac{-(R_{xy} + R_{yx})}{R_{xx} - R_{yy}}$. We put the numerator and denominator in this form so that we can get the proper value of $\psi - \phi$ (including the proper quadrant) by using the {\em atan2(s/c)} function. \item Compute $\psi + \phi = \tan^{-1} \frac{R_{xy} - R_{yx}}{R_{xx} + R_{yy}}$. \end{enumerate} \noindent Then, in either case, compute $\psi = \frac{1}{2} \left[ ( (\psi + \phi) + (\psi - \phi) \right]$ and $\phi = \frac{1}{2} \left[ ( (\psi + \phi) - (\psi - \phi) \right]$. \noindent Finally, apply the potential $\pm \pi$ corrections, based on the largest of $|R_{xz}|,|R_{yz}|,|R_{zx}|,|R_{zy}|$: \begin{enumerate} \item $If R_{xz} > 0$ and $\psi < 0$ then correct $\psi$ and $\phi$. \item $If R_{yz} > 0$ and $|\psi| > \pi/2$ then correct $\psi$ and $\phi$. \item $If R_{zx} > 0$ and $\phi < 0$ then correct $\psi$ and $\phi$. \item $If R_{zy} < 0$ and $|\psi| > \pi/2$ then correct $\psi$ and $\phi$. \end{enumerate} \noindent In each case, to ``correct'' a quantity means to add $\pi$ if negative, or to subtract $\pi$ if positive. \section{Accuracy of a Reconstricted R} Ultimately,if one perturbs $R_{ij} \rightarrow R_{ij}+\epsilon_{ij}$ for some set of $\epsilon_{ij}$ each of which is of order $\epsilon << 1$, then one has a non-orthogonal matrix. There is no reason to believe that one can perfectly extract Euler angles from such a matrix, and in fact, any manner of approximating the Euler angles will have the following property: A matrix reconstructed from those Euler angles will be perfectly orthogonal (to within achine roundoff errors) and therefore {\em cannot precisely match the original matrix}. The naive size of the resulting unavoidable ``flaw'' is of order $\epsilon$, but in fact (except in special cases such as $\theta \sim \pi/2$) in general the flaw goes as $\sqrt{\epsilon}$. This can easily be seen from the fact that when $R_{zz} = \cos \theta $ is perturbed by $\epsilon$, unless $R_{zz}$ is very small, $\sin \theta$ is perturbed by $O(\sqrt{\epsilon})$. And $\sin \theta$ does appear multiplying terms in the Z row and column, so at least these terms are vulnerable to errors of order $O(\sqrt{\epsilon})$. \end{document} clhep-2.1.4.1.orig/Vector/doc/.cvsignore0000755000175000017500000000001407746044120016406 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Vector/doc/merge-details.doc0000755000175000017500000010741707714724735017652 0ustar olesoles------------ ZOOM classes ------------ Symbol pollution: It is undesirable to pollute the CLHEP namespace with the following symbols: DEGREES RADIANS ETA. So these are placed purely into the ZMpv namespace, which is defined in the SpaceVector.h backward-compatibility header. This has the consequence that ThreeVector.h is considerably simplified, since the plethora of constructors is greatly reduced. Spherical coordinate setting: Even though the direct spherical coordinate constructors are no longer in the main Hep3Vector class, the user can still use the set() methods in spherical coordinates. Except that again the keywords DERGREES RADIANS ETA are not available. Instead, we provide a few new methods, for example, setRThetaPhi(double r, double theta, double phi); In these, alll angles are always treated as measured in RADIANS. Spherical coordinate setting mof V in LorentzVector: We again eliminate the keywords DEGREES RADIANS and ETA from the CLHEP class. THe same new methods are provided. This time, however, we feel no need to put the old methods in the PhysicsVectors class because nobody is using them. X_HAT Y_HAT Z_HAT: These were in the original physicsVectors package as UnitVectors. They remain so. Pure CLHEP users do have the Hep3Vectors HepXHat, HepYHat, HepZHat. Note, by the way, that X_HAT, Y_HAT, Z_HAT are static to each code unit that includes UnitVector.h. This is safer from the viewpoint of subtle order-of-initialization issues. Coders should not use HepXHat in initialization code that will execute prior to main() because it is not guaranteed that they will be initialized before they are used. -------------------- LorentzTransformation -------------------- set from (bx,by,bz): The merged classes have to contain a constructor from three boost components because CLHEP does. They must contain set taking a boost vector because ZOOM does. There need not, a priori, be LorentzRotation::set(double,double,Hepdouble) but we include that to be a bit orthogonal. transform (Rotation r): While CLHEP has a separate method for transform taking a HepRotation, this is not strictly needed since HepRotation is a Hep3RotationInterface which in turn is a Hep4RotationInterface. If you know the argument is 3x3 you could do 3x3 times 4x4 (in principle faster) and for transform, the original CLHEP would do this. On the other hand, for multiplication this "efficiency" was not done; there is no operator* (HepRotation). In reallity, the time needed for 3x3 times 4x4 is not significantly less, certainly not enough to warrant the additional complication. So we simple provide the transform method taking a 4 rotation interface, which will break no code. But for pure rotations around coordinate axes and boosts along axes, we do provide such methods as rotateZ and boostZ. Here the efficiency difference is marked. Besides, CLHEP has these explicitly. We also must keep the technically superfluous rotate(delta,axis) and boost(3 doubles or 3-vector) methods. Split of .cc files: Outside the main LorentzRotation.cc is LorentzRotationC.cc set(col1, col2, col3, col4) and related constructors LorentzRotationD.cc all the decompose methods rectify compare distance2 (uses decompose) rotateX, Y and Z: Although these are inline in CLHEP, we make them normal now. The reason is that we can thus take advantage of rather big savings in algorithm (by utilizing the fact that the rotation only involves an X rotation or whatever). ZMxpv in LorentzRotation.cc As a reminder, the ZMthrow macro is defined as outputting its argument and aborting. (ZMthrowC does not abort). That said, should we use ZMthrow (defined in ZMxpv.h) in the basic LorentzRotation class? I think we have to: the method set (double, double, double) -- which was present in CLHEP -- had a flaw in that it would take sqrt of a negative number if the arguments supplied had mag2 > 1. We really should behave more sensibly here ahd ZMthrow is the best we can do. Physical coupling: Currently, BoostX needs LorentzRotation.h and so forth, because the product of a boost times an Hep4RotationInterface is a LorentzRotation. We could probably lessen this sort of coupling but maybe not without sacrificing speed. At any rate, I short-circuited design though on this issue in favor of getting the merge done! Efficiency of distance2 for boosts: We can, by providing distance2(HepLorentzRotation) and the other concrete classes, significantly speed up this computation, because we don't have to go back and forth through HepAxisAngle for the rotation decompositin and Hep3Vector for the boost. However, this would add another 15 methods to each header (assuming we would want these gains in isNear and HowNear also); I decided it might not be worth it. TODO: Test rotateX, Y, Z; boostX, Y, Z -- these are I think new. Just check against the equivalent form by instantiating a general Lor. Rot based on a ROtationX and so forth. -------- Rotation -------- Classes: ZOOM has the concepts of RotationX, RotationY, RotationZ, LorentzBoost, LorentzBoostX, LorentzBoostY, LorentzBoostZ. These are useful and will become part of CLHEP. THe boost classes may be in their own header file. Inheritance structure: I am telescoping a lot of thought into a few words here. ZOOM has RotationInterface and LorentzTransformationInterface, which provide those methods available for GETTING INFORMATION ABOUT generic Rotations and LorentzTransformations. We should keep these. The proper inheritance is that RI derives from LTI, because anything you wish to ask about a LT you could equally well ask about a R. From LTI, one derives LT, and each of the boosts. From RI, one derives Rotation and its special cases. We then can derive RotationX from Rotation, being careful to supply private throwing methods when attempting to do an illegal mutation. (Private so that the compiler will catch the error whenever possible; but implemented so that if a RotationX is passed to a routine expecting a Rotation &, and the user tries to change it in an illegal way, he won't get an invalid RotationX in a continuing program. Also, RotationAboutCoordinateAxis and BoostAlongCoordinateAxis are gone; they were not useful enought to be worth their complexity cost. Virtual destructor: Since the classes have to inherit from a virtual interface (to match ZOOM compatibility) they have Vtables anyway. For various technical reasons, the virtual mechanism is useful. By the way, UNLIKE the case for 3-vectors and 4-vectors, the overhead cost is small, and the number of distinct Rotation objects in our key jobs is not in the millions, so the virtual mechanism is not at all costly. Names of interface classes: Since CLHEP users will see these classes, and may well use them (as in the case of passing a generic interface for a Rotation and letting the code select the efficient operator() if it is specialized to an axial rotation), the names should be CHLEP-like. Thus Hep3RotationInterface and Hep4RotationInterface. As usual, the ZOOM names are placed in a separate header and will be namespace-guarded. Header file completeness: It is necessary (so that CLHEP users can continue to rely on the header for finding out what methods are available) that all the methods available for HepRotation appear in that class'es definition. No problem, since most are pure virtual in the base class anyway (and thus had to be present anyway.) There may be a few exceptions which we will have to be sure are present. tolerance sharing: It is right to use the same tolerance for RotationInterface that it gets by inheritance from LTI. This avoids some thorny dynamic-vs-static behavior differences. decompose method: There is a method (actually a pair of signatures) to decompose a LT into a pure rotation times a pure boost (and also boost times rotation). This does not really belong in the interface, even though it is a matter of getting information about a LT, and even though they can be defined for any sort of specialized LT. The reason is that the interface class should not need to know about two of its concrete descendants! Instead, decompose(R,B) will be a method of HepLorentzRotation (= LorentzTransformation). This is a subtle change from the ZOOM things but I think it VERY unlikely that anybody was doing decompose on an anonymous LorentzTransformationInterface &. Meanwhile, however, the compare() method really needs decompose! And if I take compare() out of the interface, then all the dictionary-ordering comparisons will need to be repeated in derived classes. Solution: There is an ADDITIONAL method decompose (Hep3Vector& boost, AxisAngle& rotation). The interface does know about these, so that is fine. And comparison is of course just as valid using these (in fact, that is how it was being done anyway). Now compare() becomes inline in the base class, and decompose is the virtual method it utilizes. Where should the RotationX header be: I will go with the obvious: RotationX.h etc. Operator() and [][]: ZOOM did not have these. Since these are not easy to implement with the same semantics as in CLHEP, for an arbitrary Hep3RotationInterface, and since they do not have to be there, we won't try to put them there. Similarly, they are absent from RotationX etc. Only HepRotation has these methods. Commonality in RotationX, RotationY, RotationZ: We repeat a lot of trival routines like xt() for these classes. Since they are identical it is tempting to factor them out, having RotationX etc inherit from RACA (RotationAboutCoordinateAxis). However, for code simplification and to avoid subtle using issues we have just eliminated that trick from PhysicsVectors. So we eat the extra code. inverseOf: This method, declared in the RotationInterface class as a friend, introduces bad coupling between the interface and Rotation (which the method returns). Instead, we put it into the concrete classes. PhiX, thetaX, etc for RotationX, RotationY, RotationZ: We could fairly easily avoid taking an atan2 or acos. For example, RotationX::thetaZ can just do return d. In some of the other cases you have to branch according to the qudrant of delta, but in no case do you need an inverse trig taken. However, for maximal safety, I just use the same code as was in CLHEP originally. The only mod made is that IN COMMENTS I put some faster implementations; later we can decide to use these but I believe the frequency of cuse of RotationX::phiX etc. will be negligible anyway. Equivalent methods: In principle you don't want to repeat code. So for example, the rotateX method could be implemented as *this= RotationX(delta)* *this. However, except for absolutely trivial cases, I feel it unacceptable to take any risk of existing CLHEP methods yielding different results (similarly for ZOOM methods that have no exact CLHEP match. So for instance I leave the implementatoin of getAngleAxis(double &, Hep3Vector &) even though it could be written as simply as { HepAxisAngle z = axisAngle(); delta=a.delta; axis=a.axis; } (Given the split into several .cc files, the total code pulled in for a typical application will shrink, anyway.) Careful note will be made of all such "dual-implementation" situations, and we will take advantage by testing for equivalence in our test suites. Private data: ZOOM declares a rep3x3 struct which is very usreful for people who "just want the damn matrix." This is useful enough that we add it to CLHEP in RotationInterfaces.h . But also, the concrete class Rotation uses a Rep3x3 as its private data. In CLHEP the private data is just rxx, rxy ... rzz. In the spirit of decided close things in favor of cooperation, we use the CLHEP form. To inline or not to inline: Several inline methods of HepRotation FAR exceed sensible standards for inlining. I have moved these to the .cc file: operator==(), isIdentity(), operator>>: It might be nice to have an input method such that if you take the output of operator<< you get the original. However, that was not present in either ZOOM or CLHEP and I am not coding it at this time. HEP_SHORT_NAMES: It looks like if HEP_SHORT_NAMES is defined, then Rotation will collide with the ZOOM Rotation class. We will (for now) just say that you can't have both. We could do something fancier like have the ZOOM header check for and undef HEP_SHORT_NAMES when including the CLHEP Rotation.h but I will leave that for future consideration. Split into code units: Rotation.cc Original CLHEP Rotation, plus RotationIO.cc IO (just put() - why pull in iomanip.h if not needed RotationA.cc Axis-angle routines RotationE.cc Euler angle routines RotationC.cc Long routines involving rectifying near-rotations (for example, constructor from 3 column vectors) RotationL.cc 3-Rotation routines involving 4-rotation arguments, thus requiring linking 4-rotation code units. RotationP.cc All other methods originating in PhysicsVectors "Clash-table": operator * (v) I unified to return operator() (v). I use the CLHEP implementation of (the equivalent) operator*(v) - but as discussed, this is moved into the .cc, not .icc. operator == I left the CLHEP code for Rotation rather than using the base class method which would return (compare(v)==0) (which is a lot more work). getaxisAngle and getAngleAxis Multiplicatoin in Rotation Group: In principle one might like to have all Rotation*Rotation operations as free methods. However, the "double-dispatch" issue rears its ugly head, and the bottom line is that if we do it that way then we are forced to have ambiguous signatures. We instead provide multiplication as a member function. It can't be virtual in the base Hep3RotationInterface class, however, since it is "not good" for Hep3RotationInterface to have to know about Hep3Rotation. In short, we are using the simplest and least sophisticated way to implement these, so that things will compile everywhere. - - - operator() (LrentzVector) HepRotation (AxisAngle) and corresponding set() HepRotation (EulerAngles) and corresponding set() colX, colY, colZ, rowX, rowY, rowZ phi(), theta(), psi() axis(), delta() setPhi, setAxis, and so forth. setRows() compare, operator>, operator<, operator>=, operator<= distance2(), howNear(), isnNear() norm2() rectify() a static Rotation::IDENTITY methods treating the Rotation as a Hep4RotationInterface: col1 ... col4; row1 ... row4 - - - operator== etc inline: Since compare() will be virtual, all these comparison operators can be inline in the interface class. Inlining col1 etc: These should be inline, just like operator==, in the interface classes since everytihing is written in terms of xx(), xy()... which are virtual. However, in the individual spcialized classes we may profitably override these anyway. decompose: You don't want the interface class to know about its derived classes. So decompose(R,B) is not a good idea. A right way would be virtual void decomposeBR ( Hep4RotationInterface & b, Hep4RotationInterface & r ) const = 0; virtual void decomposeRB ( Hep4RotationInterface & r, Hep4RotationInterface & b ) const = 0; and the signatures of decompose invoving a Rotation and a boost appear in the concrete classes. But the decomposeRB and BR methods should NEVER be used since it does not pay to return a whold LT when a Rotation or boost is called for. Plus, you get a dangerous object: A LT with known extra properties. I eliminate decompose from the generic interface altogether -- decompose becomes purely a method of the concrete LorentzTransformation class. Forbenius: eliminate it. Things moved from CLHEP into RotationInterfaces: HepRotation_row: Is R[i][j] 1 or 0 based in CLHEP? NOte that for Hep3Vector, v[i] is 0-based. So I can surely use the trick of returning a Hep3Vector as a row. I should try it, but I would think I can eliminate class HepRotation_row and have inline const Hep3Vector operator [] (int) const; because a = r[i][j] would then have the same behavior -- and because nobody is using things like HepRotation HepRotation_row myrow; myrow = ... in real code. We must be careful, however: the return type of operator[] should not be Hep3Vector, because in the Hep4RotationINterface, the same reasoning says it should be a HepLorentzVector!!, And at that point the 0-based choice comes back to bite us: X,Y,Z,T = 0,1,2,3 seems very unnatural. Nonetheless, that is indeed the choice made in CLHEP (see LorentzVector.h where enum { X=0, Y=1, Z=2, T=3, NUM_COORDINATES=4, SIZE=NUM_COORDINATES }; If we do return a HepLorentzVector, how does the behavior change? All the correct suages, e.g. r[2][2], are still correct and unchanged. And if one does r[3][2] that does not have to change at all: operator[] on a HepRotation can point out an error if the argument is > 2. However, if somebody does r[2][3] that will come back 0 without an error, since it is perfectly acceptable to take w[3] where w is a HepLorentzVector. So either I should have a HepRot_row helper (as CLHEP does) or I must live with that non-catch. By the way, if a helper, it can be shared between classes, but what is the best way to do that... private data: ZOOM uses a Rep3x3 rep_; we go with the CLHEP data instead. setRows: Rather than replicate all that code, I will use setCOls and then invert! R.compare (Hep4RotationInterface & lt ): This is very awkward because we don't wish to pull in all of the LT stuff. But note that Rotation in ZOOM does NOT have these. SO we can drop them altogether. ----------- PlaneVector ----------- New methods when placing in CLHEP: These are inserted just for similarity with the other Vector classes... Operator[] L-value operator() and [] isParallel, isOrthogonal, howParallel, howOrthogonal compare, operator < > <= >= setPolar Physical Coupling to Hep3Vector: We forward declare Hep3Vector, and any methods involving Hep3Vector are implemented in the .cc file, so a user using Hep2Vector need not pull in Hep3Vector.h. CMATH_NAMESPACE:: This is liberally used to prepare for ISOcxx portability, which handles all the of places where things like sqrt are found. CLHEP has its own congfigure mechanism, and till ISOcxx is in place, it is best to just remove this accomodation. (Later we may want to put it back in when ISOcxx is there. At that point, the whole package, includeing the old CLHEP implementations, should do have this change.) --------- UnitVector ---------- Where does the UnitVector code go: Main issue is the fact that though this is not in CLHEP, we will not end up having a library in PhysicsVectors. Fortunately, we can mkae UnitVector.h completely self-contained: Every routine is either trivial or casts (*this) to a Hep3Vector and uses the implementation for that. So the UnitVector class leads to no library code of its own! C-style or modern casts: We have gone with old C-style casts for the purposes of using the Hep3Vector implementations. And to avoid any chance of a compiler actually copying the object (after all, we do have operator Hep3Vector()), we cast this as a Hep3vector* and use ->. Thus: double phi() const {return ((Hep3Vector*)this)->phi();} We could instead have used a static_cast but that is really not any safer for us, and adds some risk of the some compilers not having that syntax, or of some compiler using our cast operator to create a temporary copy, which we don't want. Name of UnitVector class: Since UnitVector is not in CLHEP (for now) we could just retain the name UnitVector. However, it may eventually become part of CLHEP, so I chose to parallel the situation for SpaceVector w.r.t. Hep3Vector. Thus, the header defines HepUnit3Vector in the global namespace, and inside the potential zmpv namespace typedefes UnitVector to be that. UnitVector as an argument: The conversion operator to Hep3Vector makes it trivial to use UnitVector as an argument to any routine that takes a Hep3Vector. There will be cases where it would be beneficial to have a special method taking advantage of the knowledge that a UnitVector need not be normalized. For the present, we will not attempt to obtain this advantage. In most cases the UnitVector is originally based on a Hep3Vector; there, the work of normalizing the vector twice can easily be avoided. rotationOf global methods: Since there is a conversion operator from UnitVector to Hep3Vector, we could have omitted the global rotationOf(UnitVector, ...) methods. But because when such a method is applied the answer is known to be a UnitVector, we chose to provide methods with those signatures, returning HepUnit3Vector instead of Hep3Vector. These simply treat the UnitVector as a Hep3Vector, perform the rotation, and return the result as a unit vector. -------------- LorentzVector -------------- ** Et ** Et is E Pperp/p. ** Metric selector: ** ZOOM allows the user to set metric as TimePositive or TimeNegative; ** the default is TimePositive. CLHEP always does TimePositive. The ** cost of the flexibility is small: Roughly 10% in dot, diff2, and mag2 ** and no other routines altered. Because of this, I am keeping metric ** flexibility in the package. ** XYZT or TXYZ in constructor: ** ZOOM prevented ambguity by having a type Tcomponent. The quote from ** the .h file is "We do not support forming a LorentzVector from 4 ** undistiguished Scalars, which could lead to uncaught mistakes of ** putting t first. CLHEP chose to provide this ordinary 4-doubles ** signature, with T assumed to be last. We of course must keep all ** three. The possibility of user error does exist but was already ** there in CLHEP and nobody was getting burnt. ** "explicit" keyword: ** ZOOM allows constcuting a LorentzVector from just p (with e = 0) ** and from just e (with p=0). ZOOM uses the "explicit" keyword to ** protect against possible mishaps with such consturcutions. Since ** CLHEP already uses the "explicit" keyword (in the Matrix package) ** we will retain it here. ** mag2() and m2(): ** CLHEP treats mag2() as the same as restMass2(). This is the only possible ** meaning when the metric is fixed as ---+. However, if there is flexibility ** in the sense of the metric, it is most natural to consider mag2() to be ** defined as w.dot(w). This is how ZOOM treats it. Since CLHEP users will ** not have altered the choice of metric, they will not be affected if the ** ZOOM definition is used, so we go that way. On the other hand, m2() really ** sounds like it should mean the physics mass squared; what we call in ZOOM ** restMass2(). ZOOM does not have a method m2(). So we leave m2 as metric ** independant, and identical to restMass2(). ** boostVector: ** In CLHEP there is no checking, either for 0 or for tachyonic ** case. In ZOOM there is checking, which takes very little time. ** I think the zoom routine is therefore better, even though it is no longer ** appropriate to inline it. CHANGELOG ** Rotation methods: ** Again we should separate methods that force the load of the Rotation class. ** For practical purposes, that implies that methods like rotate() are no ** longer inline, and that as in the ThreeVector class we separate the .cc ** files. Also, again we have the rotation methods returning ** HepLorentzVector& rather than void, so things can be chained. ** Boost methods: ** We have the rotation methods returning HepLorentzVector& rather than void, ** so things can be chained. Also, we feel the boost methods along an axis, ** boostZ in particular, reall ought to be in the main part of the header. ** ZOOM does several checks to see that the bosot vector is not tachyonic. ** Here, we will forego these and use the CLHEP implementations. ** Methods acting on containers of LorentzVectors: ** This is present in ZOOM, for example, ** list s; double m = s.invariantMass(); ** At least for now, we will omit this, so as not to introduce template ** complications into CLHEP. If necessary, we can put this back in the ** LorentzVector.h file in the ZOOM area that typedefs LorentzVector from ** HepLorentzVector. ** Physical design to avoid unnecessary loading of Rotation modules: ** As per the Hep3Vector class, we split off almost all the implementations ** of the new ZOOM features so a "pure" CLHEP user gets no more code loaded ** that previously. And as in that case, we split the ZOOM implementations ** among several .cc files. Also, we split out the implementations of features ** originally in CLHEP which would "drag in" Rotation.cc, and which would ** force loading of LorentzRotation.cc. Thus the implementation files are: ** LorentzVector.cc original CLHEP ** LorentzVectorR.cc methods possibly involving HepRotation ** LorentzVectorL.cc original CLHEP involving HepLorentzRotation ** LorentzVectorC.cc comparison operations from ZOOM ** LorentzVectorK.cc relativistic kinematics from ZOOM ** LorentzVectorB.cc boosts and rotations from ZOOM, not involving ** HepRotation or HepLorentzRotation ** Unit axial 4-vectors: ** We provide X_HAT4, Y_HAT4, Z_HAT4, T_HAT4 as statics, in the header. ** We use the inline constructor in original CLHEP to avoid the need to pull ** in additional code. - - - inline HepLorentzVector(double, const Hep3Vector &); operator /= (Hepdouble c) operator / (const LorentzVector & v, Hepdouble c) inline bool isSpacelike() const; inline bool isTimelike() const; inline bool isLightlike(Scalar epsilon=tolerance) const; - - - ------------ SpaceVector ------------ ** Namespace: ** Hep3Vector is not enclosed in a namespace. SpaceVector is; but most of our ** users currently disable namespaces at this point. I enclose the typedef ** defining SpaceVector in namespace zmpv, and leave Hep3Vector bare. I would ** like to use that as the pattern: Any new concept is placed in zmpv, all ** existing ones remain in ::. That would be awkward, for example ** ZMpvDEGREES_t is used directly now in Hep3Vector. But I do go the ** necessary distance: Possibly conflicting symbols such as DEGREES are put ** in the zmpv namespace. Needs further correction: See "ZOOM classes" above. ** R, rho confusion: ** CLHEP, --IN COMMENTS ONLY-- refers to the radius in spherical ** coordinates as rho, and the distance from the Z axis in ** cylindrical coordinates as R. ZOOM uses the oppopsite names, and ** in fact uses these names in method names. I have altered the CLHEP ** comments to make the nomenclature consistent; the meanings are still ** clear from the comments. For example: inline double perp() const; // The transverse component (R in cylindrical coordinate system). CHANGELOG ** Use of UnitVector: ** At first, I thought that we should keep UnitVector for its efficiency ** benefits. On further inspection, I noticed that these benefits are ** small, and that having UnitVector inherit from SpaceVector (with non- ** virtual methods) is unwise. So I will eliminate UnitVector, which ** has the benefit of reducing interface bloat as well. If any Fermilab ** users rely on UnitVector, I may have to add a UnitVector class; but ** Hep3Vector (and HepRotation) will not rely on UnitVector. ** The name angle and theta: ** These are synonmous. So why not drop one? Well, even if I said let's ** use the CLHEP form, CLHEP has theta for angle wrt z axis, and angle for ** angle wrt an arbitrary direction. ** Use of AxisAngle and EulerAngles: ** These class are very useful and simple structures for holding the result ** of a nice intuituve decomposition of a rotation: Axis, and how far to ** rotate, or the three EUler angles. They are worth retaining. ** EulerAngles conventions: ** ZOOM Rotations know about EulerAngles. CLHEP does not. We are faced with ** some options: (1) set up a static variable to indicate choice of EA ** convention -- HORRIBLE. (2) Change to some other convention and strand ** any existing ZOOM users -- Unacceptable. (3) Leave things the way they ** are, and later we can provide conversion routines to go to other EA ** conventions. (3) looks right. Later, we could define HepAeroEAs for ** example, with conversion constructors to/from HepEulerAngles. ** Hep3Vector knows about HepRotation: ** In PhysicsVectors, there is a heirarchy in which vectors do not know about ** rotations. The methods transform(const HepRotation &) and ** *=(const HepRotation &) break this heirarchy. Thus ANY CLHEP PROGRAM ** THAT USES Hep3Vector MUST LINK IN hepRotation!! This is not desirable. ** I shouldn't "fix" this by eliminating transform from CLHEP. Instead I ** will break apart ThreeVector.cc, putting the Rotation methods in their ** own little file. ThreeVectorR.cc If the user uses Hep3Vectors but not ** rotations, he then won't pull everything in. CHANGELOG ** Hep3Vector::rotate signatures: ** For equivalent rotate() methods, ZOOM takes (axis, delta) where ** CLHEP takes (delta, axis). THere is no harm in leaving this alone. ** Return types for rotateX, rotateY, rotateZ (void in CLHEP) ** CLHEP and PhysicsVectors each have these three methods, and they are ** identical except that the ZOOM version returns a reference to *this. ** This is convenient for certain chained operations, and costs nothing; ** I don't wish to break ZOOM user code for zero reason, so I have made ** the CLHEP method conform to this convention. There are a couple of other ** methods, rotate and rotateUz, whith the same void return type but since ** these methods or signatures don't appear in the original ZOOM classes, ** I leave the return type alone. ** Hep3Vector::rotate inefficient: ** CLHEP has implemented a rotate() method on a 3-vector in a very ** inefficent way, first forming an identity Rotation, then rotating that ** by axis and angle (in itself quite a task) then douing vector *= rotation. ** For now, I leave this alone -- people are of course free to use the ZOOM ** signature axis, delta which I believe will be much faster. The speed ** advantage of the ZOOM routines is decreased a bit because we no longer ** provide the form where axis is a known UnitVector. ** Additional methods and physical coupling: ** Were we to merely put all the new SpaceVector methods into ThreeVector.h, ** then anybody using the class would pull in all that additional code. ** instead, we break the implementations up into several new files: ** The polar/azimuthal decomposition methods SpaceVectorD.cc ** All new methods involving rotation SpaceVectorR.cc ** Other new intrinsic and relative properties SpaceVectorP.cc ** All other new methods (constructors, nearness, ...) SpaceVector.cc ** operator *= with a Rotation: ** Another case where ZOOM decided it was too ambiguous, and CLHEP has ** just decided which way to read it. Here, things are not that bad: ** C++ semantics leads you to expect v = M*v and that is what is done. OK. OOPS, NOT OK. C++ semantics leads you to expect v = v*M but the code does v = M*v (which is what physics would lead you to expect!! ** ZMthrow: ** PhsyicsVectors is set up for use of the Exceptions package. Though we ** are directed not to use it wuite yet, I am not giving up on it eventually ** being in use; it has advantages. For now, I leave the ZMthrows in, but ** substitute for ZMthrow.h and ZMxpv.h macros which turn these into cerr<< ** lines like the others in Vector. Also, I introduce a macro ZMthrowC which ** I use wherever it seems exiting is too strong an action after reporting ** the problem, and a sensible Continuation is possible. Once Exceptions ** are incorporated into Vector (if ever) ZMthrowC may eventually be #defined ** as ZMthrow since the Exceptions mechanism can do the ignoring for us. ** Ambiguous angles: ** CLHEP often, when faced with an ambiguous angle such as the cosing of the ** angle between vector v and a zero vector, simply returns 1. ZOOM had ** issued a ZMthrow, and returns 1. This was OK because a user could set ** up to ignore the ZMthorw. We can live with the CLHEP choice on those ** routines already in CLHEP. For some that are not originally in CLHEP, ** such as cos2Theta, we leave the ZOOM behavior intact. ** SetTheta inline: ** I disagree with setTheta and setMag() etc. being inline (too much logic) ** but I won't press the issue. ** Names of AxisAngle and EulerAngles ** Should I change these to HepAxisAngle etc? I have decided to do so: ** the names are unique enough that I am not too worried about clashes, ** but I would have trouble getting the namespace placement right if ** there were no version in the global namespace. The AxisAngle and ** EulerAngles classes are also placed in the zmpv namespace. - - - Items added to the "main" part of the interface (above the esoteric area): set (x,y,x): Moved into main part. CHANGELOG setEta, setCylTheta, setCylEta: NO synonyms; I put these up into main part. CHANGELOG operator / (double) : Added to main part. CHANGELOG operator /= : Added to main part. CHANGELOG isNear: I have put isNear in the main section, because it is quite useful at least to our users. I use the simplest and quickest forms for isNear and all related routines; contortions to account for the possibility of components being greater than 10**75 are silly. Similarly, I put HowNear and DeltaR into the main section. CHANGELOG cos2Theta: against the z axis, placed in main part next to cosTheta(). CHANGELOG et2, et: I have included transverse energy/ - - - Polar constructors: We add the 8 varieties of polar and cylindrical constructors. We keep the microtypes.h file to be able to distinguish these. getX getY getZ: Synonyms. getR: Synonym for mag. Inline in CLHEP, and we go that way too. getTheta getPhi: not quite Synonnyms: CLHEP Checks for invalid cases in a different way. However, behavior of atan2 is adequate for CLHEP check to be OK. Therefore make synonymous. getRho(), rho: Synonym for perp() getEta, eta: Synonym for pseuoRapidity. setR: Synonym for setMag(). I disagree with setR, setTHeta, etc being inline, but I won't press the issue. Triple setters: Put among the new constructors. setCyl and setCyl using Eta: Put into the esoteric constructors area even though no constructor corresponds to these. operator+, -, scalar *: These are done as non-friends, in the .icc file, utilizing the inline access methods. That is fine, except it would be nice to be able to see them when looking at the header. I would add those declarations, but because of the HEP_DEBUG_INLINE complication that is awkward, and less necessary. operator scalar /: Not present; I will add to the header, as a non-inline only. compare, operator>, etc: Added to esoteric section howNear, deltaR, get and set tolerance: added to Esoteric section. I have put isNear in the main section, because it is quite useful at least to our users. isParallell, howOrthogonal, etc.: added to Esoteric section. v1*v2: ZOOM decided this was too ambiguous. However, given that CLHEP mad a choice, we can embrace that choice. CLHEP already has v1.dot(v2) so we need not add that synonym. beta: Synonym for mag. gamma, collinearRapidity: rapidity: Put these into the section with reference direction. angle: Synonym for theta() in the z form. angle(v) is already present in main part. So is theta(). SpaceVector and UnitVector are separate in principle, bit for angle(u) the improvement in speed iss too small to be worth it, so we eliminate the Unit signature. cosTheta: against the z axis, already present in main part. cos2Theta: against the z axis, placed in main part. project, perp, perpPart: Missing ones are in esoteric. The following already had 3-vector forms in CLHEP: perp(v) perp2(v) polar decompostion: In the form relative to a reference direction, since the direction is now supplied as a 3-vector (not a UnitVector) we needed to modify that code. TODO: Modify decomposition code. rotationOf and related friends: These need not be friends. Nor, given the time taken to rotate, need they be inline. Move to global methods section. How do I get PI? I use CLHEP::pi which is available in CLHEP/Units/PhysicalConstants.h X_HAT, Y_HAT, Z_HAT: put as static const Hep3Vector in the .h file. TODO: Rotation TODO: LorentzTransformation clhep-2.1.4.1.orig/Vector/doc/CMakeLists.txt0000644000175000017500000000041011607661650017147 0ustar olesoles# build Vector documentation include(ClhepBuildTex) clhep_latex( Vector eulerAngleComputation ) clhep_latex( Vector VectorDefs ) INSTALL (FILES keyMergeIssues.doc merge-details.doc minorMergeIssues.doc DESTINATION doc/Vector ) clhep-2.1.4.1.orig/Vector/doc/keyMergeIssues.doc0000755000175000017500000005017607705060311020052 0ustar olesoles Issues Concerning the PhysicsVectors/CLHEP Vector Merge ------------------------------------------------------- The merge of ZOOM PhysicsVdectors and the CLHEP Vector package is completed. The purpose of this document is to list the major issues that affected the merge of these packages, and where relevant describe the resolutions. More detailed documents describe more minor issues. ---------------- General Approach ----------------- As agreed at the June 2000 CLHEP workshop, the approach is to combine the features of each ZOOM class with the corresponding CLHEP class, expanding the interface to create a single "lingua franca" of what a Hep3Vector (for example) means. We are not forming SpaceVector as an class derived from Hep3Vector and enhancing it in that way. Another rule imposed by the agreement is to avoid using the Exceptions package (even though that will later go into CLHEP for other uses). A desirable goal is to avoid cluttering the interface and enlarging the code linked in when ordinary CLHEP Vector functionallity is used. To this end, I have placed almost all the new features in a separate, second section of the header, and have created separate .cc files for sensible subsets of the methods. In particular, if a program uses only the methods found in the original CLHEP classes, very little additional code is linked in. ------- Classes ------- The corresponding classes are: Hep3Vector SpaceVector HepLorentzVector LorentzVector HepLorentzRotation LorentzTransformation HepRotation Rotation Classes new to CLHEP are: HepAxisAngle AxisAngle HepEulerAngles EulerAngles Hep2Vector PlaneVector HepRotationX RotationX HepRotationY RotationY HepRotationZ RotationZ HepBoost LorentzBoost HepBoostX LorentzBoostX HepBoostY LorentzBoostY HepBoostZ LorentzBoostZ ----------------------------- Exceptional cases and ZMthrow ----------------------------- PhsyicsVectors is set up for use of the Exceptions package. Though we are directed not to use it quite yet, I am not giving up on it eventually being in use; it has advantages. For now, I leave the ZMthrows in, but substitute macros (in ZMxpv.h) which turn usage of ZXMthrow into cerr<< message lines. (Issuing of messages to cerr is done elsewhere in Vectors.) To avoid clashes with other ZOOM packages in the definition of the ZMthrow macro, I replaced ZMthrow with ZMthrowA in this package. ZMthrowA, when used, will issue its message and exit (-1). Also, I introduce a macro ZMthrowC which I use wherever it seems there is a sensible way to continue processing after reporting the problem. When (if ever) the actual ZOOM exceptions package is incorporated into Vector ZMthrowC may eventually be #defined as ZMthrow since the Exceptions mechanism can handle the selective continuiing. However, we don't want to change the functionallity when this is used in the ZOOM context. To retain true ZOOM Exception features, we provide in ZMxpv.h a define of ENABLE_ZOOM_EXCEPTIONS. In CLEHP this is not defined, and ZMthrowA and ZMthrowC become macros that behave as above. When we build for ZOOM, we use a version with the #define turned on, and this pulls in the ZOOM Exception behaviour. Thus in our ZOOM builds, people still get the ZOOM Exceptions behaviour they are used to (an absolute requirement for us) -- but pure CLHEP users do not see the Exceptions package at all. The only slight annoyance is that now for ZOOM users CLHEP will depend on Exceptions (and ZMutility) -- where a minimalist would note that only the CLHEP/Vector subpackage needed to depend on these even in ZOOM. The linker is such a minimalist: It warns ZOOM applications which use CLHEP packages other Vectors about the fact that the Exceptions library is not used to resolve any symbol. When we in ZOOM break up CLHEP into packages the way it is in the official version of CLHEP, this annoyance will go away. -------------------------------------------- Additions to the "original" CLHEP interface -------------------------------------------- In order not to burden CLHEP users who may not care about PhysicsVectors, I have placed almost all the features not originally in CLHEP in separate, second sections of the header, and have created separate .cc files for sensible subsets of the methods. I felt that the following small set of methods were useful enough to belong in the main part of the headers, and to be implemented (if not inline) in the main .cc files for each class (e.g., ThreeVector.cc): ThreeVector: set (x,y,z) setRThetaPhi(r, theta, phi) setREtaPhi(r, eta, phi) setRhoPhiZ(rho, phi, z) setRhoPhiTheta(rho, phi, theta) setRhoPhiEta(rho, phi, eta) setEta (eta), setCylTheta (theta), setCylEta (theta) operator / (double) operator /= (double) isNear, HowNear, and DeltaR cos2Theta LorentzVector: inline HepLorentzVector(double, const Hep3Vector &); setRThetaPhi(r, theta, phi) setREtaPhi(r, eta, phi) setRhoPhiZ(rho, phi, z) operator /= (Hepdouble c) operator / (const LorentzVector & v, Hepdouble c) inline bool isSpacelike() const; inline bool isTimelike() const; inline bool isLightlike(Scalar epsilon=tolerance) const; HepLorentzVector & boostX( double beta ); HepLorentzVector & boostY( double beta ); HepLorentzVector & boostZ( double beta ); double et(); double et2(); HepRotation: operator() (LrentzVector) HepRotation (AxisAngle) and corresponding set() HepRotation (EulerAngles) and corresponding set() colX(), colY(), colZ(), rowX(), rowY(), rowZ() phi(), theta(), psi() axis(), delta() setPhi(), setAxis(), and so forth. setRows() compare(), operator>, operator<, operator>=, operator<= distance2(), howNear(), isNear() norm2() rectify() static Rotation::IDENTITY methods treating the Rotation as a Hep4RotationInterface: col1 ... col4; row1 ... row4 (To avoid bloat in the code pulled in for programs which don't use all these features, we split the implementation .cc files. Only isNear() goes into the original Rotation.cc) --------------------------------------- HepAxisAngle and HepEulerAngles classes --------------------------------------- These classes are very useful and simple structures for holding the result of a nice intuituve decomposition of a rotation: Axis, and how far to rotate, or the three Euler angles. They are worth retaining. In the global namespace these are called HepEulerAngles and HepAxisAngle. The Euler angle conventions used are those from ZOOM: The Goldstein (p. 109) conventions. Euler angles were not in the original CLHEP. We reject the horrible option of setting up a static variable to indicate which choice of EulerAngles conventions to use. And it would break user code if we were to change to some other convention and strand existing ZOOM users. ------------------- Splits of .cc files ------------------- ThreeVector: The original methods requiring loading HepRotation ThreeVectorR.cc The polar/azimuthal decomposition methods SpaceVectorD.cc All new methods involving rotation SpaceVectorR.cc Other new intrinsic and relative properties SpaceVectorP.cc All other new methods (constructors, nearness, ...) SpaceVector.cc The original methods not pulling in HepRotation ThreeVector.cc LorentzVector: The original methods not pulling in HepRotation LorentzVector.cc Methods involving HepRotation LorentzVectorR.cc Original methods involving HepLorentzRotation LorentzVectorL.cc Comparison operations from ZOOM LorentzVectorC.cc relativistic kinematics from ZOOM LorentzVectorK.cc boosts and rotations from ZOOM LorentzVectorB.cc (Note that these do not bring in HepRotation or HepLorentzRotation) Rotation: IO RotationIO.cc Axis-angle routines RotationA.cc Euler angle routines RotationE.cc Long routines involving rectifying near-rotations RotationC.cc (for example, constructor from 3 column vectors) 3-Rotation routines involving 4-rotation arguments RotationL.cc (thus requiring linking 4-rotation code units) Original CLHEP Rotation, plus isNear() Rotation.cc All other methods originating in PhysicsVectors RotationP.cc LorentzRotation: set(col1, col2, col3, col4) and related constructors LorentzRotationC.cc all the decompose methods, and mthodes than use them LorentzRotationD.cc everything else, including all CLHEP methods LorentzRotation.cc ----------------------- ZOOM Back Compatibility ----------------------- The classes with old ZOOM names (like SpaceVector) are implemented as small wrappers, in headers that live in the old ZOOM PhysicsVectors package. These are of course not part of CLHEP. The ZOOM area obeys the following rules: - It is kept as a ZOOM package as before. - The headers are found exactly as before, so as not to break user code. - All ZOOM classes for which there are corresponding CLHEP Vector classes are either typedefed to those or derived from those. - All code in the ZOOM area is implemented in the headers; there is no longer much content in the distinct ZOOM PhysicsVectors library. The only content left in the library is the object files representing the various Exception objects. When we build the CLHEP classes for the ZOOM repository, we will set up so as to use ZOOM excpetions. (The version placed into the official CLHEP, however, will not use ZOOM Exceptions at this point.) Hep3Vector (similarly HepLorentzVector etc.) is not enclosed in a namespace. In ZOOM, SpaceVector is (but we can disable namespace usage and most of our users do so at this point). What I do is leave Hep3Vector in the global namespace, and in the ZOOM headers I put SpaceVector namespace zmpv. ----------------- Symbol pollution: ----------------- The SpaceVectors class defines symbols DEGREES RADIANS and ETA, It is undesirable to pollute the global namespace in CLHEP usage with those symbols, since users may well use the same words. So these are restricted to the ZOOM area, and placed purely into the ZMpv namespace, which is defined in the SpaceVector.h backward-compatibility header. This has the side consequence that the plethora of SpaceVector constructors involving these symbols is moved out of ThreeVector.h, greatly simplifying that header. ---------- UnitVector ---------- Some code at Fermilab uses UnitVector, and I have also found some situations where the efficiency can make a significant difference. I provide UnitVector as a class for ZOOM users, in the zmpv namespace, via a file UnitVector.h. This no longer inherits from SpaceVector; that avoids the design flaw of "specialization by non-virtual inheritance." The entire implementation is inline (by casting to Hep3Vector to get its implementations) so no additional code need go into the CLHEP library. Since UnitVector is not in CLHEP, of necessity no CLHEP classes (in particular not Hep3Vector and not HepRotation) will be aware of the existance of UnitVector. Note that although UnitVector does not inherit from Hep3Vector, EVERY const method of Hep3Vector is present for UnitVector. Some, like unit() and mag(), become quite trivial; most use the Hep3Vector implementations. Since UnitVector is not in CLHEP (for now) we just retain the name UnitVector. However, it may eventually become part of CLHEP, so I chose to parallel the situation for SpaceVector w.r.t. Hep3Vector. Thus, the header defines HepUnit3Vector in the global namespace, and inside the zmpv namespace it typedef's UnitVector to be HepUnit3Vector. The conversion operator to Hep3Vector makes it trivial to use UnitVector as an argument to any routine that takes a Hep3Vector. There will be cases where it would be beneficial to have a special method taking advantage of the knowledge that a UnitVector need not be normalized. For the present, we will not attempt to obtain this advantage. --------------------------------------- Rotation classes inheritance structure: --------------------------------------- I am telescoping a lot of thought into a few words here. ZOOM has RotationInterface and LorentzTransformationInterface (for short, RI and LTI), which provide those methods available for GETTING INFORMATION ABOUT (but not modifying) generic Rotations and LorentzTransformations. For example, if an object might be either a Rotation or a RotationZ, since RI has methods axis() and delta(), a routine can be passed a RI& and take axis() and delta(). We need to keep this interface. What is the proper inheritance structure? Clearly RI derives from LTI, because anything you wish to ask about a LT you could equally well ask about a Rotation. From RI, one derives Rotation and its special cases RotationX etc. We can't derive RotationX from Rotation (that would introduce a bunch of inapplicable methods, plus greatly increase the size of member data for RotationX). Similarly, from LTI, one derives HepLorentzRotation along with HepBoost, HepBoostX, and so forth. The Hep classes expressing RI and LTI are Hep3RotationInterface and Hep4RotationInterface; these appear together in RotationInterfaces.h As usual, the ZOOM names are placed in a separate wrapper in the ZOOM package and will be namespace-guarded. In ZOOM we had in the inheritance tree classes RotationAboutCoordinateAxis and BoostAlongCoordinateAxis. These mainly let us avoid duplication of code but were not useful enought to be worth their complexity cost; they are gone. -------------------------- ZOOM Features Discontinued -------------------------- The following features of the ZOOM package were felt to be extreme overkill. These have been discontinued, after checking that no existing user code was utilizing them: - Direct use of non-trivial accessors as L-values, as in SpaceVector v; v.phi() = myAngle; - Methods applicble to containers of 4-vectors, as in std::list s; double m = s.invariantMass(); - Application of Rotations and LorentzTransformations to containers of 3- and 4-vectors, as in Rotation R; std::vector vv; std::vector Rvv = R(vv); We retained the feature of using ZOOM Exceptions: + Problematic cases are still caught, and in the version in the ZOOM repository, they do still go through the ZOOM Exceptions mechanism. If you use the code in the CLHEP repository, then instead of ZOOM exceptions you would get "write to cerr and exit(-1)" behavior. --------- Testing: --------- All existing CLHEP tests (testThreeVector and testRotation) have been applied and they pass in the merged product. This deomnstrates that no (tested) CLHEP functionallity has been compromised. All the PhysicsVectors tests have been vetted to remove the few features no longer supported (e.g. syntax like v.r() = 4.), and have been applied and pass. This deomnstrates that no ZOOM functionallity other than the few identified cutbacks has been compromised. Also, since the ZOOM classes other than UnitVector directly utilize the CHEP classes (mostly by typedef), the very extensive ZOOM test suite heavily excercises 90% of the methods of all the CLHEP classes. The exceptions are such methods as v.orthogonal() and R.rotateAxes(vx,vy,vz) which were not in the original ZOOM package. Since the ZOOM area is not being checked back into the original CLHEP, these extensive tests are not going to be part of CLHEP. If somebody feels it worthwhile to place these tests into CLHEP/Vector/tests and change the names of the classes to the Hep names, this would be reasonable, but I will not give any priority for myself to do it. ======================================================================== ======================================================================== ... And a few less major issues: ------------------------------------------- Coupling between Hep3Vector and HepRotation ------------------------------------------- In PhysicsVectors, there was a heirarchy in which vectors do not know about rotations. The methods Hep3Vector::transform(const HepRotation &) and Hep3Vector*=(const HepRotation &) break this heirarchy. Thus in the opriginal CLHEP, **any clhep program that used Hep3Vector would link in hepRotation.cc. This is not desirable. As part of the merge, I broke apart ThreeVector.cc, putting the HepRotation dependent methods in their own little file, ThreeVectorR.cc. If the user uses Hep3Vectors but not HepRotations, he won't pull everything in. Similarly for HepLorentzVector, with regards to uses HepRotation and HepLorentzRotation. ----------------------------- R, rho nomenclature confusion ----------------------------- In ThreeVector, CLHEP, --IN COMMENTS ONLY-- refers to the radius in spherical coordinates as "rho", and the distance from the Z axis in cylindrical coordinates as R. ZOOM uses the oppopsite names, and in fact uses these names in method names. I did not change the ZOOM method names. I have altered the CLHEP comments to make the nomenclature consistent; the meanings are still clear from the comments. For example: inline double perp() const; // The transverse component (rho in cylindrical coordinate system). -------------- Metric selector -------------- ZOOM allows the user to set metric as TimePositive or TimeNegative; the default is TimePositive. CLHEP always does TimePositive. The cost of the flexibility is small: Roughly 10% in dot, diff2, and mag2 and no other routines are altered. Because of this, I am keeping metric flexibility in the package. "Pure" CLHEP users need never see this. ------------------------------------------------ mag2(), m2(), and restMass2() for LorentzVector: ------------------------------------------------ CLHEP treats mag2() as the same as restMass2(). This is the only possible meaning when the metric is fixed as ---+. However, if there is flexibility in the sense of the metric, it is most natural to consider mag2() to be defined as w.dot(w). This is how ZOOM treats it. Since CLHEP users will not have altered the choice of metric, they will not be affected if the ZOOM definition is used, so we go that way. On the other hand, m2() really sounds like it should mean the physics mass squared; what we call in ZOOM restMass2(). ZOOM does not have a method m2(). So we leave m2 as metric independant, and identical to ZOOM's restMass2(). --------------- New Method: et() --------------- We provide a new method, et() which is the transverse energy. This is defined as E sin theta, or E Pperp/P. For completeness, we also have et(v) the transverse energy with respect to a given direction: p.et(v) = p.t() * p.V().perp(v) / p.V().mag(). ---------------------------- 3x3 and 4x4 representations: ---------------------------- ZOOM declares a Rep3x3 struct which is very usreful for people who "just want the damn matrix." This is useful enough that we add it to CLHEP in RotationInterfaces.h. Thus we have HepRep3x3 and HepRep4x4. Note that using HepMatrix for this purpose would violate CLHEP coupling and dependency rules. --------------------- Rotation operator>> --------------------- It might be nice to have an input method such that if you take the output of operator<< you get the original. However, that was not present in either ZOOM or CLHEP and I am not coding it at this time. This something that I feel ought to be done but is not a part of the merge process. -------------------------- To inline or not to inline -------------------------- Several inline methods of HepRotation FAR exceed sensible standards for inlining. I have moved these to the .cc file. Some examples are: operator==(), isIdentity(). --------------------------------------------------------- Operator *= with a 3- or 4-vector and a 3- or 4-rotation: --------------------------------------------------------- For example, v *= R where v is a Hep3Vector and R a HepRotation. In C++ semantics, z *= b usually means a = a * b, so this leads you to expect the behaviour v = v*R. But physicists know that they would rarely apply a rotation on the right like that, and thus CLHEP defined v *= R as v = R*v. This is a case where ZOOM decided there was no misleading way to treat the operator and thus omitted it, while CLHEP has just decided which way to treat it. We must retain this meaning for compatibility. We will point out the unnatural syntax in both the header file and the documentation, to warn users that they will get the useful physics operation rather than the expected meaning of operator *=. clhep-2.1.4.1.orig/Vector/doc/minorMergeIssues.doc0000755000175000017500000004734107705060311020406 0ustar olesoles============================================================================ Minor Issues arising when merging ZOOM PhysicsVectors into CLHEP/Vector (and their resolution) ---------- Hep3Vector ---------- 6 - Spherical coordinate setting: Even though the direct spherical coordinate constructors are no longer in the main Hep3Vector class, we want to make it possible for the user to use the set() methods in spherical coordinates. But (see item 4.1) the keywords DERGREES RADIANS ETA are not available in Hep3Vector, so instead, we provide a few new methods, for example: setRThetaPhi(double r, double theta, double phi); In these, alll angles are always treated as measured in RADIANS. The full set of original signatures for set are still implemented via the SpaceVector.h header for compatibility with ZOOM use. 7 - Use of UnitVector Some code at Fermilab uses UnitVector, and I have also found some situations where the efficiency can make a significant difference. I provide UnitVector as a class for ZOOM users, in the zmpv namespace, via a file UnitVector.h. This no longer inherits from SpaceVector; that avoids the design flaw of "specialization by non-virtual inheritance." The entire implementation is inline (by casting to Hep3Vector to get its implementations) so no additional code need go into the CLHEP library. Since UnitVector is not in CLHEP, of necessity no CLHEP classes (in particular not Hep3Vector and not HepRotation) will be aware of the existance of UnitVector. 5.1 X_HAT Y_HAT Z_HAT: These were in the original physicsVectors package as UnitVectors. They remain so. Pure CLHEP users do have the Hep3Vectors HepXHat, HepYHat, HepZHat if they need such vectors. Note, by the way, that X_HAT, Y_HAT, Z_HAT are static to each code unit that includes UnitVector.h. This is safer from the viewpoint of subtle order-of-initialization issues. Coders should not use HepXHat in initialization code that will execute prior to main() because it is not guaranteed that they will be initialized before they are used. (This "should not" applies equally to original CLHEP.) 11 - Treatment of ambiguous angles CLHEP often, when faced with an ambiguous angle such as the cosine of the angle between vector v and a zero vector, simply returns 1. ZOOM had issued a ZMthrow, and returned 1. This was OK because a user could set up to ignore the ZMthorw. I retain the original CLHEP behavior on those routines already in CLHEP. For some that are not originally in CLHEP, such as cos2Theta, we leave the ZOOM behavior intact. 12 - The names angle and theta These are synonmous. So why not drop one? Well, even if I said let's use the CLHEP form, CLHEP uses "theta" for the angle with respect to the Z axis, and "angle" for angle wrt an arbitrary direction. Since in ZOOM these concepts are somewhat unified, we we simply stick with angle and theta both being accepted. 13 - R, rho nomenclature confusion In ThreeVector, CLHEP, --IN COMMENTS ONLY-- refers to the radius in spherical coordinates as "rho", and the distance from the Z axis in cylindrical coordinates as R. ZOOM uses the oppopsite names, and in fact uses these names in method names. I did not change the ZOOM method names. I have altered the CLHEP comments to make the nomenclature consistent; the meanings are still clear from the comments. For example: inline double perp() const; // The transverse component (rho in cylindrical coordinate system). 14 - Signatures of Hep3Vector::rotate For equivalent rotate() methods, ZOOM takes (axis, delta) where CLHEP takes (delta, axis). There is no harm in leaving this alone: both signatures will be accepted. It is amazing that there were not more cases of identical routiens be with different choices for order ofthe arguments. 15 - An inefficiency in Hep3Vector::rotate(delta, axis) CLHEP has implemented a rotate(delta, axis) method on a 3-vector in a very inefficent way, first forming an identity Rotation, then rotating that by axis and angle (in itself quite a task) then douing vector *= rotation. For now, I leave the CLHEP code alone -- people are of course free to use the ZOOM-originated method with signature rotate(axis,delta), which I believe will be faster. 16 - Return types for rotateX, rotateY, rotateZ CLHEP and PhysicsVectors each have these three methods, and they are identical except that the ZOOM version returns a reference to *this, while in CLHEP they return void. Having methods that alter an object return a reference to that object is convenient for certain chained operations, and costs nothing. I don't wish to potentially break ZOOM user code for no good reason, so I have made these CLHEP method conform to this convention. There are a couple of other CLHEP methods, rotate and rotateUz, which use the void return type, but since these methods or signatures don't appear in the original ZOOM classes, this can't break any code, so I leave the void return type alone for those. After discussion with A.P. and others, I have modified the return types of other CLHEP methods which return void and would by the same reasoning be better returning *this. These include rotate and boost methods in LorentzVector.h. ---------------- HepLorentzVector ---------------- 20 - "explicit" keyword: ZOOM allows constcuting a LorentzVector from just p (with e = 0) and from just e (with p=0). ZOOM uses the "explicit" keyword to protect against possible mishaps with such construcutions. Will that give some compilers trouble? No: CLHEP already uses the "explicit" keyword (in the Matrix package). So we will retain it here. 22 - boostVector In CLHEP there is no checking on whether it makes sense. It does not make sense if this vector is non-timelike, and leads to division by zero if this vector has ee=0. The ZOOM routine does check, which takes very little time. I think the zoom implementation is therefore better. This, by the way, puts boostVector into the .cc file rather than the .icc. 23 - Rotation methods: We should separate methods that force the load of the Rotation class. For practical purposes, that implies that methods like rotate() are no longer inline, and that as in the ThreeVector class we separate the .cc files. Also, again we have the rotation methods returning HepLorentzVector& rather than void, so things can be chained. 24 - Boost methods: We have the boost methods returning HepLorentzVector& rather than void, so things can be chained. Also, we feel the boost methods along an axis, boostZ in particular, really ought to be in the main part of the header. ZOOM does several checks to see that the boost vector is not tachyonic. However, we will forego these and use the CLHEP implementations. 25 - Methods acting on containers of LorentzVectors: These are present in ZOOM, for example, list s; double m = s.invariantMass(); At least for now, we will omit this, so as not to introduce template complications into CLHEP. If necessary, we can put this back in the LorentzVector.h file in the ZOOM area that typedefs LorentzVector from HepLorentzVector. And if there is a tremendous desire for this from the CLHEP crowd, we can provide this capability be suppying a header file which users can optionally include. (Since these are templated global methods, all information can naturally go into a header file which need not be included if these methods are not called.) 26 - Unit 4-Vectors along each axis: We provide X_HAT4, Y_HAT4, Z_HAT4, T_HAT4 as statics, in the header. We use the inline constructor in original CLHEP to avoid the need to pull in any additional code. 26.5 - Et We provide a new methode, et() which is the transverse energy. This is defined as E sin theta, or E Pperp/P. For completeness, we also have et(v) the transverse energy with respect to a given direction: p.et(v) = p.t() * p.V().perp(v) / p.V().mag(). ---------- Hep2Vector ---------- 27 - New methods relative to PlaneVector: Mostly, we have taken the PlaneVector class from ZOOM, intact, as the Hep2Vector class in CLHEP. As usual, Hep2Vector is in the global namespace, while PlaneVector is (if namespaces are enabled) placed in the zmpv space. For the sake of similarity with the CLHEP Hep3Vector and HepLorentzVector classes, we have added several simple methods to the PlaneVector class: Operator[] L-value operator() and [] isParallel, isOrthogonal, howParallel, howOrthogonal compare(), operator < > <= >= setPolar(r, phi) 28 - Physical Coupling of Hep2Vector to Hep3Vector: A couple of methods of PlaneVector take SpaceVector arguments. We forward declare Hep3Vector, and any methods involving Hep3Vector are implemented in the .cc file, so a user using Hep2Vector need not pull in Hep3Vector.h. 29 - Use of CMATH_NAMESPACE:: In PlaneVector.h there were many instances of code like y = CMATH_NAMESPACE::sqrt(x); This takes advantage of ISOcxx portability, which handles all the of places where things like sqrt are found. CLHEP has its own congfigure mechanism, for this, and till ISOcxx is in place, it is best to just remove the CMATH_NAMESPACE accomodation. (Later we may want to put it back in when ISOcxx is in CLHEP.) ---------- UnitVector ---------- 31 - C-style or modern casts: We have gone with old C-style casts for the purposes of using the Hep3Vector implementations, where needed, in the UnitVector class. In particular we use syntax like double phi() const {return ((Hep3Vector*)this)->phi();} This maximizes the number of compilers which will handle the code, and minimizes the chance of some compilers using the conversion operator and doing an unnecessary temporary copy. 34 - rotationOf global methods with UnitVector: Since there is a conversion operator from UnitVector to Hep3Vector, we could have omitted the global rotationOf(UnitVector, ...) methods. But because when such a method is applied the answer is known to be a UnitVector, we chose to provide methods with those signatures, returning HepUnit3Vector instead of Hep3Vector. These simply treat the UnitVector as a Hep3Vector, perform the rotation, and return the result as a unit vector. The only advantage is that you end up with a known UnitVector rather than a Hep3Vector which might later be normalized. ------------ Hep3Rotation ------------ 35 - Rotation Classes: Along with Rotation, ZOOM has the concepts of RotationX, RotationY, RotationZ. Along with LorentzTransformation, ZOOM has LorentzBoost, LorentzBoostX, LorentzBoostY, LorentzBoostZ. These are useful (particularly the pure LorentzBoost concept) and will become part of CLHEP. To keep LorentzRotation.h small, the boost classes will be in their own header files. 37 - HEP_SHORT_NAMES: It looks like if HEP_SHORT_NAMES is defined, then Rotation will collide with the ZOOM Rotation class. (That is, the Rotaion.h wrapper in the PhysicsVectors package normally says class Rotation : public HepRotation { but with HEP_SHORT_NAMES defined, this becomes class Rotation : public Rotation { which won't compile. We will (for now) just say that you can't have both. We could do something fancier like have the ZOOM header check for and undef HEP_SHORT_NAMES when including the CLHEP Rotation.h but I will leave that for future consideration. 39 - Header file completeness: It is necessary (so that CLHEP users can continue to rely on the header for finding out what methods are available) that all the methods available for HepRotation appear in that class' definition. No problem, since most are pure virtual in the base class anyway (and thus had to be present anyway.) 40 - Virtual destructor in Rotation classes The Rotation and LorentzRotations classes will have virtual destructors. Since the classes have to inherit from a virtual interface (for ZOOM compatibility) they have Vtables anyway. For various technical reasons, the virtual mechanism is useful. By the way, UNLIKE the case for 3-vectors and 4-vectors, the overhead cost is small, and the number of distinct Rotation objects in our key jobs is not in the millions, so the virtual mechanism is not at all costly. 42 - The tolerance member in Rotation and LorentzRotation: The variable tolerance is used as a default for isNear. It is shared by all Rotation and LorentzRotation classes. It is right to use the same tolerance for RotationInterface that it gets by inheritance from LTI. Providing distinct instances of this class static in a base and a derived class would lead to thorny dynamic-vs-static behavior differences. 43 - LTI::decompose() method: There is a method in ZOOM to decompose a LT into a pure rotation times a pure boost; this needs to go into CLHEP. The decompose() method does not really belong in the LTI interface, even though it is a matter of getting information about a LT, and even though they can be defined for any sort of specialized LT. The reason is that the interface class should not need to know about two of its concrete descendants! Instead, decompose(R,B) will be a method of HepLorentzRotation. This is a subtle change from the ZOOM structure but I think it VERY unlikely that anybody was doing decompose() on an anonymous LTI. 44 - Dictionary ordering: compare() for Rotations and LorentzRotations The compare() method belongs in LTI and RI. However, compare() really needs decompose! And if I take compare() out of the interface, then all the dictionary-ordering comparisons will need to be repeated in each derived class. Solution: There is an ADDITIONAL method decompose (Hep3Vector& boost, HepAxisAngle& rotation). The LTI and RI interfaces do know about Hep3Vector and HepAxisAngle, so that is fine. And comparison is of course just as valid using these (in fact, that is how it was being done anyway in ZOOM, deep down). Now compare() becomes inline in the base class, and decompose() is the virtual method it utilizes. 45 - Operator() and [][]: ZOOM did not have these. CLHEP does, so they must be present in HepRotation. Since these are not easy to implement with the same semantics as in CLHEP, for an arbitrary Hep3RotationInterface, and since no compatibility or use case agruments tell us they must be in RI, we will keep these only in HepRotation. Similarly, they will appear in HepLorentzRotation but not in HepBoost. 48 - PhiX, thetaX, etc for RotationX, RotationY, RotationZ: These routines were added for Geant4, and that code won't be using the specialized rotations. Still, for completeness we should provide these. In these special cases, we could fairly easily avoid taking an atan2 or acos. For example, RotationX::thetaZ can just do return d. In some of the other cases you have to branch according to the quadrant of delta, but in no case do you need an inverse trig function. However, for maximal safety, I simply use the same code as was in CLHEP originally. Why introduce a chance for error to creep in? That begs the question of why not put these up into Hep3RotationInterface? I think eventually we may want to use the much simpler equivalent algorithms. By putting the methods into each class, I have been able to add comments containing the improved code. Plus, these methods are not so fundamental that I would like to see them in the interface. I'm not so sure my decision here is best, but I don't think it is worththe time to re-think it since it is such a minor point. 49 - CLHEP/ZOOM "equivalent" methods for Rotations: In principle you don't want to repeat code. So for example, the rotateX method (in CLHEP) could be implemented as *this= RotationX(delta)* *this. However, except for absolutely trivial cases, I feel it unacceptable to take any risk of "breaking" existing CLHEP methods (in the sense of altering them such that they yield different results). Similarly for ZOOM methods - unless they have an exact CLHEP match, I prefer to use the existing ZOOM code. So for instance I leave the implementation of getAngleAxis(double &, Hep3Vector &) even though it could be written as simply as { HepAxisAngle z = axisAngle(); delta=a.delta; axis=a.axis; } Careful note will be made of all such "dual-implementation" situations, and we should take advantage by testing for equivalence in our test suites. 50 - Operator *+ with a 3- or 4-vector and a 3- or 4-rotation: For example, v *= R where v is a Hep3Vector and R a HepRotation. In C++ semantics, z *= b usually means a = a * b, so this leads you to expect the behaviour v = v*R. But physicists know that they would rarely apply a rotation on the right like that, and thus CLHEP defined v *= R as v = R*v. This is a case where ZOOM decided there was no misleading way to treat the operator and thus omitted it, while CLHEP has just decided which way to treat it. We must retain this meaning for compatibility. We will point out the unnatural syntax in both the header file and the documentation, to warn users that they will get the useful physics operation rather than the expected meaning of operator *=. -------------------- LorentzTransformation -------------------- 52 - set from (bx,by,bz): The merged classes have to contain a constructor of LorentzRotation from three boost components because CLHEP does. They must contain a set() method taking a boost vector because ZOOM does. They need not, a contain LorentzRotation::set(double,double,Hepdouble), but we include that because we have the constructor from three doubles. 53 - transform (Rotation r): While CLHEP has a separate method for transform taking a HepRotation, this is not strictly needed since HepRotation is a Hep3RotationInterface which in turn is a Hep4RotationInterface. If you know the argument is 3x3 you could do 3x3 times 4x4 (in principle faster) and for transform, the original CLHEP would do this. On the other hand, for multiplication this "efficiency" was not done; there is no operator* (HepRotation). In reallity, the time needed for 3x3 times 4x4 is not significantly less, certainly not enough to warrant the additional complication. So we simply provide the transform method taking a 4 rotation interface, which will break no code. But for pure rotations around coordinate axes and boosts along axes, we do provide such methods as rotateZ and boostZ. Here the efficiency difference is marked. Besides, CLHEP has these explicitly. We also must keep the technically superfluous rotate(delta,axis) and boost(3 doubles or 3-vector) methods. 54 - rotateX, Y and Z: Although these are inline in CLHEP, we make them normal now. The reason is that we can thus take advantage of rather big savings in algorithm (by utilizing the fact that the rotation only involves an X rotation or whatever). 55 - ZMxpv in LorentzRotation.cc As a reminder, the ZMthrow macro is defined as outputting its argument and aborting. (ZMthrowC does not abort). That said, should we use ZMthrow (defined in ZMxpv.h) in the basic LorentzRotation class? I think we have to: the method set (double, double, double) -- which was present in CLHEP -- had a flaw in that it would take sqrt of a negative number if the arguments supplied had mag2 > 1. We really should behave more sensibly here ahd ZMthrow is the best we can do. 56 - Physical coupling: BoostX needs LorentzRotation.h and so forth, because the product of a boost times an Hep4RotationInterface is a LorentzRotation. We could probably have lessened this sort of coupling but maybe not without sacrificing speed. At any rate, I short-circuited design though on this issue in favor of getting the merge done! 57 - Efficiency of distance2 for boosts: We could, by providing distance2(HepLorentzRotation) and the other concrete classes, significantly speed up this computation, because we don't have to go back and forth through HepAxisAngle for the rotation decompositin and Hep3Vector for the boost. However, this would add another 15 methods to each header (assuming we would want these gains in isNear and HowNear also); I decided it would not be worth it. clhep-2.1.4.1.orig/Vector/.cvsignore0000755000175000017500000000007407746044120015647 0ustar olesolesMakefile.in configure aclocal.m4 autom4te.cache config.h.in clhep-2.1.4.1.orig/Vector/COPYING0000644000175000017500000010451311406203315014671 0ustar olesoles GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/Vector/test/0000755000175000017500000000000012242515154014617 5ustar olesolesclhep-2.1.4.1.orig/Vector/test/testThreeVector.output0000755000175000017500000000002607705060311021232 0ustar olesoles(1.1,2.2,3.3) (3,2,1) clhep-2.1.4.1.orig/Vector/test/testSubscripts.cc0000755000175000017500000000516411761714041020201 0ustar olesoles// -*- C++ -*- // $Id: testSubscripts.cc,v 1.2 2003/08/13 20:00:14 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is a small program for testing of subscriping in the Vector module. // #include #include "CLHEP/Units/GlobalSystemOfUnits.h" // to see shadowing problems #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Vector/LorentzRotation.h" using namespace CLHEP; typedef Hep3Vector Vec3; typedef HepLorentzVector Vec4; class Rot3 : public HepRotation { public: void setMatrix(double xx1, double xy1, double xz1, double yx1, double yy1, double yz1, double zx1, double zy1, double zz1) { rxx = xx1; rxy = xy1; rxz = xz1; ryx = yx1; ryy = yy1; ryz = yz1; rzx = zx1; rzy = zy1; rzz = zz1; } }; class Rot4 : public HepLorentzRotation { public: void setMatrix(double xx1, double xy1, double xz1, double xt1, double yx1, double yy1, double yz1, double yt1, double zx1, double zy1, double zz1, double zt1, double tx1, double ty1, double tz1, double tt1) { mxx = xx1; mxy = xy1; mxz = xz1; mxt = xt1; myx = yx1; myy = yy1; myz = yz1; myt = yt1; mzx = zx1; mzy = zy1; mzz = zz1; mzt = zt1; mtx = tx1; mty = ty1; mtz = tz1; mtt = tt1; } }; int main() { // Test ThreeVector subscripting Vec3 V3; const Vec3 ConstV3(1.,2.,3.); V3[0] = ConstV3[0]; V3[1] = ConstV3[1]; V3[2] = ConstV3[2]; assert(V3 == ConstV3); V3(0) = ConstV3(2); V3(1) = ConstV3(1); V3(2) = ConstV3(0); assert(V3 == Hep3Vector(3.,2.,1.)); // Test LorentzVector subscripting Vec4 V4; const Vec4 ConstV4(1.,2.,3.,4); V4[0] = ConstV4[0]; V4[1] = ConstV4[1]; V4[2] = ConstV4[2]; V4[3] = ConstV4[3]; assert(V4 == ConstV4); V4(0) = ConstV4(3); V4(1) = ConstV4(2); V4(2) = ConstV4(1); V4(3) = ConstV4(0); assert(V4 == HepLorentzVector(4.,3.,2.,1.)); // Test Rotation subscripting int i, j, k; Rot3 R3; R3.setMatrix(1.,2.,3.,4.,5.,6.,7.,8.,9.); k = 1; for(i=0; i<3; i++) { for(j=0; j<3; j++) { assert(R3(i,j) == double(k)); assert(R3[i][j] == double(k)); k++; } } // Test LorentzRotation subscripting Rot4 R4; R4.setMatrix(1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.); k = 1; for(i=0; i<4; i++) { for(j=0; j<4; j++) { assert(R4(i,j) == double(k)); assert(R4[i][j] == double(k)); k++; } } return 0; } clhep-2.1.4.1.orig/Vector/test/Makefile.am0000755000175000017500000000437111606714767016701 0ustar olesoles# Applicable to each test program: if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir)/ # libraries to link, and whence if BUILD_STATIC LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.a OUTFLAG = -o $@ else if BUILD_VISUAL LDADD = $(top_builddir)/src/CLHEP-@PACKAGE@-@VERSION@.$(SHEXT) OUTFLAG = /Fo$@ else LIBS += $(MY_LD)$(top_builddir)/src LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.$(SHEXT) OUTFLAG = -o $@ endif endif # normally, CXXLINK is supplied by automake, but we need to use /Fo instead # of -o when compiling with Visual C++ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ $(OUTFLAG) # Identify executables needed during testing: check_PROGRAMS = \ testThreeVector testLorentzVector testRotation testSubscripts check_SCRIPTS = \ testThreeVector.sh testLorentzVector.sh # Identify test(s) to run when 'make check' is requested: TESTS = \ testThreeVector.sh testLorentzVector.sh testRotation testSubscripts # Identify the test(s) for which failure is the intended outcome: XFAIL_TESTS = # Identify the dependencies on a per-test basis: testThreeVector_SOURCES = testThreeVector.cc testLorentzVector_SOURCES = testLorentzVector.cc testRotation_SOURCES = testRotation.cc testSubscripts_SOURCES = testSubscripts.cc # Identify input data file(s) and prototype output file(s): EXTRA_DIST = \ testThreeVector.input testThreeVector.output \ testLorentzVector.input testLorentzVector.output # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = testThreeVector.sh testLorentzVector.sh testRotation.sh testSubscripts.sh # supply our own suffix rule .cc.obj: if BUILD_VISUAL # $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c $(OUTFLAG) `$(CYGPATH_W) '$<'` # mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po source='$<' object='$@' libtool=no \ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ $(CXXCOMPILE) -c $(OUTFLAG) `$(CYGPATH_W) '$<'` else if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c $(OUTFLAG) `$(CYGPATH_W) '$<'`; \ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi # source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ # $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` endif clhep-2.1.4.1.orig/Vector/test/testLorentzVector.cc0000755000175000017500000002053711761714041020661 0ustar olesoles// -*- C++ -*- // $Id: testLorentzVector.cc,v 1.2 2003/08/13 20:00:14 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of what might become CLHEP - // a Class Library for High Energy Physics. // // This is a small program for testing the HepLorentzVector class // and the interaction with the HepLorentzRotation class. // #include "CLHEP/Units/GlobalSystemOfUnits.h" // to see shadowing problems #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Vector/LorentzRotation.h" #include "CLHEP/Vector/Sqr.h" #include #include #include #include using namespace CLHEP; #define DEPS 1.0e-14 #define FEPS 1.0e-6 bool approx(double a, double b, double eps) { return bool( std::abs(a-b) < eps ); } bool test(const HepLorentzVector & p, double x, double y, double z, double e, double eps) { bool t = bool( approx(p.x(), x, eps) && approx(p.y(), y, eps) && approx(p.z(), z, eps) && approx(p.t(), e, eps)); if ( !t ) std::cerr << p << std::endl << x << '\t' << y << '\t' << z << '\t' << e << std::endl; return t; } void conversion_test(Hep3Vector & v3, HepLorentzVector & v4) { v3 = Hep3Vector(3.,2.,1.); assert (v3.x() == v4.x() && v3.y() == v4.y() && v3.z() == v4.z()); } void conversion_test(const Hep3Vector & v3, const HepLorentzVector & v4) { assert (v3.x() == v4.x() && v3.y() == v4.y() && v3.z() == v4.z()); } bool test(const HepLorentzVector & p, const HepLorentzVector & q, double eps) { bool t = bool( approx(p.x(), q.x(), eps) && approx(p.y(), q.y(), eps) && approx(p.z(), q.z(), eps) && approx(p.t(), q.t(), eps)); if ( !t ) std::cerr << p << std::endl << q << std::endl; return t; } int main () { HepLorentzVector v4(1.,2.,3.,4.); const HepLorentzVector v4const(1.,2.,3.,4); conversion_test(v4,v4); conversion_test(v4const, v4const); Hep3Vector f3x(1.0), f3y(0.0, 1.0), f3z(0.0, 0.0, 1.0); Hep3Vector d30, d3x(1.0), d3y(0.0, 1.0), d3z(0.0, 0.0, 1.0); // test constructors: HepLorentzVector d0; if ( !test(d0, 0.0, 0.0, 0.0, 0.0, DEPS) ) exit(1); HepLorentzVector d1(d3x, 1.0); if ( !test(d1, 1.0, 0.0, 0.0, 1.0, DEPS) ) exit(1); HepLorentzVector d2(d3x + d3y, std::sqrt(2.0)); if ( !test(d2, 1.0, 1.0, 0.0, std::sqrt(2.0), DEPS) ) exit(1); HepLorentzVector d3(d3z + d2, std::sqrt(3.0)); if ( !test(d3, 1.0, 1.0, 1.0, std::sqrt(3.0), DEPS) ) exit(1); HepLorentzVector d4(0.0, 0.0, 0.0, 1.0); if ( !test(d4,0.0, 0.0, 0.0, 1.0, DEPS) ) exit(1); HepLorentzVector d5(f3x, f3x.mag()); if ( !test(d5, d1, FEPS) ) exit(1); HepLorentzVector d6(d3x+f3y, (d3x+f3y).mag()); if ( !test(d6, d2, FEPS) ) exit(1); HepLorentzVector d7(f3x+f3y+f3z, (f3x+f3y+f3z).mag()); if ( !test(d7, d3, FEPS) ) exit(1); HepLorentzVector f0; if ( !test(f0, 0.0, 0.0, 0.0, 0.0, FEPS) ) exit(1); HepLorentzVector f1(f3x, 1.0); if ( !test(f1, 1.0, 0.0, 0.0, 1.0, FEPS) ) exit(1); HepLorentzVector f2(f3x + f3y, std::sqrt(2.0)); if ( !test(f2, 1.0, 1.0, 0.0, std::sqrt(2.0), FEPS) ) exit(1); HepLorentzVector f3(f3z + f2, std::sqrt(3.0)); if ( !test(f3, 1.0, 1.0, 1.0, std::sqrt(3.0), FEPS) ) exit(1); HepLorentzVector f4(0.0, 0.0, 0.0, 1.0); if ( !test(f4,0.0, 0.0, 0.0, 1.0, FEPS) ) exit(1); HepLorentzVector f5(d3x, d3x.mag()); if ( !test(f5, f1, FEPS) ) exit(1); HepLorentzVector f6(f3x+d3y, (f3x+d3y).mag()); if ( !test(f6, f2, FEPS) ) exit(1); HepLorentzVector f7(d3x+d3y+d3z, (d3x+d3y+d3z).mag()); if ( !test(f7, f3, FEPS) ) exit(1); HepLorentzVector d8(f7); if ( !test(d8, d7, FEPS) ) exit(1); HepLorentzVector d9(d7); if ( !test(d9, d7, DEPS) ) exit(1); HepLorentzVector f8(f7); if ( !test(f8, d7, FEPS) ) exit(1); HepLorentzVector f9(d7); if ( !test(f9, d7, FEPS) ) exit(1); HepLorentzVector d10(1.0, 1.0, 1.0, std::sqrt(3.0)); if ( !test(d10, d7, FEPS) ) exit(1); HepLorentzVector f10(1.0, 1.0, 1.0, std::sqrt(3.0)); if ( !test(f10, f7, FEPS) ) exit(1); HepLorentzVector d11(d3x+d3y+d3z, 1.0); if ( !test(d11, 1.0, 1.0, 1.0, 1.0, DEPS) ) exit(1); HepLorentzVector f11(d3x+d3y+d3z, 1.0); if ( !test(f11, 1.0, 1.0, 1.0, 1.0, FEPS) ) exit(1); // test input/output from a stream std::cin >> d0; if ( !test(d0, 1.1, 2.2, 3.3, 4.4, DEPS) ) exit(1); std::cin >> f0; if ( !test(f0, 4.0, 3.0, 2.0, 1.0, FEPS) ) exit(1); std::cout << d0 << std::endl; std::cout << f0 << std::endl; // testing assignment d6 = d7; if ( !test(d6, d7, DEPS) ) exit(2); d6 = f7; if ( !test(d6, d7, FEPS) ) exit(2); f6 = d7; if ( !test(f6, f7, FEPS) ) exit(2); f6 = f7; if ( !test(f6, f7, FEPS) ) exit(2); //testing addition and subtraction: d11 = d3 + d7 + f3; if ( !test(d11, 3.0, 3.0, 3.0, std::sqrt(27.0), FEPS) ) exit(4); f11 = d3 + d7 + f3; if ( !test(f11, 3.0, 3.0, 3.0, std::sqrt(27.0), FEPS) ) exit(4); d11 += d3; if ( !test(d11, 4.0, 4.0, 4.0, std::sqrt(48.0), FEPS) ) exit(4); f11 += f3; if ( !test(f11, 4.0, 4.0, 4.0, std::sqrt(48.0), FEPS) ) exit(4); d11 = d3 + d7 - f3; if ( !test(d11, 1.0, 1.0, 1.0, std::sqrt(3.0), FEPS) ) exit(4); if ( !test(-d11, -1.0, -1.0, -1.0, -std::sqrt(3.0), FEPS) ) exit(4); f11 = d3 + f7 - d3; if ( !test(f11, 1.0, 1.0, 1.0, std::sqrt(3.0), FEPS) ) exit(4); if ( !test(-f11, -1.0, -1.0, -1.0, -std::sqrt(3.0), FEPS) ) exit(4); d11 -= d3; if ( !test(d11, 0.0, 0.0, 0.0, 0.0, FEPS) ) exit(4); f11 -= f3; if ( !test(f11, 0.0, 0.0, 0.0, 0.0, FEPS) ) exit(4); d11 = HepLorentzVector(1.0, 2.0, 3.0, 4.0); d11 *= 2.; if ( !test(d11, 2.0, 4.0, 6.0, 8.0, DEPS) ) exit(4); d11 = 2.*HepLorentzVector(1.0, 2.0, 3.0, 4.0); if ( !test(d11, 2.0, 4.0, 6.0, 8.0, DEPS) ) exit(4); d11 = HepLorentzVector(1.0, 2.0, 3.0, 4.0)*2.; if ( !test(d11, 2.0, 4.0, 6.0, 8.0, DEPS) ) exit(4); // testing scalar products: if ( !approx(d1 * d2, std::sqrt(2.0)-1.0, DEPS) ) exit(5); if ( !approx(d3.dot(d7), 0.0, FEPS) ) exit(5); if ( !approx(d2 * f1, std::sqrt(2.0)-1.0, FEPS) ) exit(5); if ( !approx(f3.dot(d7), 0.0, FEPS) ) exit(5); // testing components: d11 = HepLorentzVector(1.0, 1.0, 1.0, std::sqrt(7.0)); if ( !approx(d11.mag2(), 4.0, DEPS) ) exit(6); if ( !approx(d11.mag(), 2.0, DEPS) ) exit(6); if ( !approx(Hep3Vector(d11).mag2(), 3.0, DEPS) ) exit(6); if ( !approx(Hep3Vector(d11).mag(), std::sqrt(3.0), DEPS) ) exit(6); if ( !approx(d11.perp2(), 2.0, DEPS) ) exit(6); if ( !approx(d11.perp(), std::sqrt(2.0), DEPS) ) exit(6); f11 = HepLorentzVector(1.0, 1.0, 1.0, std::sqrt(7.0)); if ( !approx(f11.mag2(), 4.0, FEPS) ) exit(6); if ( !approx(f11.mag(), 2.0, FEPS) ) exit(6); if ( !approx(f11.vect().mag2(), 3.0, FEPS) ) exit(6); if ( !approx(f11.vect().mag(), std::sqrt(3.0), FEPS) ) exit(6); if ( !approx(f11.perp2(), 2.0, FEPS) ) exit(6); if ( !approx(f11.perp(), std::sqrt(2.0), FEPS) ) exit(6); // testing boosts: d5 = d3 = d1 = HepLorentzVector(1.0, 2.0, -1.0, 3.0); d6 = d4 = d2 = HepLorentzVector(-1.0, 1.0, 2.0, 4.0); double M = (d1 + d2).mag(); double dm1 = d1.mag(); double dm2 = d2.mag(); double p2 = (sqr(M)-sqr(dm1+dm2))*(sqr(M)-sqr(dm1-dm2))/(4.0*sqr(M)); d30 = -(d1 + d2).boostVector(); d1.boost(d30); double phi = d1.phi(); double theta = d1.theta(); d1.rotateZ(-phi); d1.rotateY(-theta); HepRotation r; r.rotateZ(-phi); HepLorentzRotation r1(d30), r2(r), r3, r4, r5; r3.rotateY(-theta); r4 = r3 * r2 * r1; d2 *= r4; if ( !test(d1, 0.0, 0.0, std::sqrt(p2), std::sqrt(p2 + sqr(dm1)), DEPS) ) exit(7); if ( !test(d2, 0.0, 0.0, -std::sqrt(p2), std::sqrt(p2 + sqr(dm2)), DEPS) ) exit(7); d1.transform(r4.inverse()); if ( !test(d1, d3, DEPS) ) exit(7); r5 *= r3; r5 *= r; r5 *= r1; r5.invert(); d2 *= r5; if ( !test(d2, d4, DEPS) ) exit(7); r4 = r1; r4.rotateZ(-phi); r4.rotateY(-theta); d3 *= r4; d4 = r4 * d6; if ( !test(d3, 0.0, 0.0, std::sqrt(p2), std::sqrt(p2 + sqr(dm1)), DEPS) ) exit(7); if ( !test(d4, 0.0, 0.0, -std::sqrt(p2), std::sqrt(p2 + sqr(dm2)), DEPS) ) exit(7); r5 = r1.inverse(); r5 *= r.inverse(); r5 *= r3.inverse(); d4.transform(r5); d3.transform(r5); if ( !test(d4, d6, DEPS) ) exit(7); if ( !test(d3, d5, DEPS) ) exit(7); r5 = r1; r5.transform(r); r5.transform(r3); d4.transform(r5); d3.transform(r5); if ( !test(d3, 0.0, 0.0, std::sqrt(p2), std::sqrt(p2 + sqr(dm1)), DEPS) ) exit(7); if ( !test(d4, 0.0, 0.0, -std::sqrt(p2), std::sqrt(p2 + sqr(dm2)), DEPS) ) exit(7); return 0; } clhep-2.1.4.1.orig/Vector/test/testLorentzVector.input0000755000175000017500000000004407707326250021430 0ustar olesoles(1.1,2.2,3.3;4.4) ( 4 , 3 , 2 ; 1 ) clhep-2.1.4.1.orig/Vector/test/testRotation.cc0000755000175000017500000001531311761714041017634 0ustar olesoles// -*- C++ -*- // $Id: testRotation.cc,v 1.3 2003/08/13 20:00:14 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is a test for HepRotation class. // #include "CLHEP/Units/GlobalSystemOfUnits.h" // to see shadowing problems #include "CLHEP/Units/GlobalPhysicalConstants.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Vector/ThreeVector.h" #include #include #include using namespace CLHEP; typedef HepRotation Rotation; typedef Hep3Vector Vector; #define DEL 10.e-16 int main() { int i,k; double angA=CLHEP::pi/3, angB=CLHEP::pi/4, angC=CLHEP::pi/6; double cosA=std::cos(angA), sinA=std::sin(angA); double cosB=std::cos(angB), sinB=std::sin(angB); double cosC=std::cos(angC), sinC=std::sin(angC); Rotation R; // default constructor assert ( R.xx() == 1 ); assert ( R.xy() == 0 ); assert ( R.xz() == 0 ); assert ( R.yx() == 0 ); assert ( R.yy() == 1 ); assert ( R.yz() == 0 ); assert ( R.zx() == 0 ); assert ( R.zy() == 0 ); assert ( R.zz() == 1 ); assert( R.isIdentity() ); // isIdentity() R = Rotation(); // rotateX() R.rotateX(angA); assert ( R.xx() == 1 ); assert ( R.xy() == 0 ); assert ( R.xz() == 0 ); assert ( R.yx() == 0 ); assert ( R.yy() == cosA ); assert ( R.yz() ==-sinA ); assert ( R.zx() == 0 ); assert ( R.zy() == sinA ); assert ( R.zz() == cosA ); R = Rotation(); // rotateY() R.rotateY(angB); assert ( R.xx() == cosB ); assert ( R.xy() == 0 ); assert ( R.xz() == sinB ); assert ( R.yx() == 0 ); assert ( R.yy() == 1 ); assert ( R.yz() == 0 ); assert ( R.zx() ==-sinB ); assert ( R.zy() == 0 ); assert ( R.zz() == cosB ); R = Rotation(); // rotateZ() R.rotateZ(angC); assert ( R.xx() == cosC ); assert ( R.xy() ==-sinC ); assert ( R.xz() == 0 ); assert ( R.yx() == sinC ); assert ( R.yy() == cosC ); assert ( R.yz() == 0 ); assert ( R.zx() == 0 ); assert ( R.zy() == 0 ); assert ( R.zz() == 1 ); R = Rotation(); // copy constructor R.rotateZ(angC); R.rotateY(angB); R.rotateZ(angA); Rotation RR(R); assert ( std::abs(RR.xx() - cosA*cosB*cosC + sinA*sinC) < DEL ); assert ( std::abs(RR.xy() + cosA*cosB*sinC + sinA*cosC) < DEL ); assert ( std::abs(RR.xz() - cosA*sinB) < DEL ); assert ( std::abs(RR.yx() - sinA*cosB*cosC - cosA*sinC) < DEL ); assert ( std::abs(RR.yy() + sinA*cosB*sinC - cosA*cosC) < DEL ); assert ( std::abs(RR.yz() - sinA*sinB) < DEL ); assert ( std::abs(RR.zx() + sinB*cosC) < DEL ); assert ( std::abs(RR.zy() - sinB*sinC) < DEL ); assert ( std::abs(RR.zz() - cosB) < DEL ); RR = Rotation(); // operator=, operator!=, operator== assert ( RR != R ); RR = R; assert ( RR == R ); assert ( R(0,0) == R.xx() ); // operator(i,j), operator[i][j] assert ( R(0,1) == R.xy() ); assert ( R(0,2) == R.xz() ); assert ( R(1,0) == R.yx() ); assert ( R(1,1) == R.yy() ); assert ( R(1,2) == R.yz() ); assert ( R(2,0) == R.zx() ); assert ( R(2,1) == R.zy() ); assert ( R(2,2) == R.zz() ); for(i=0; i<3; i++) { for(k=0; k<3; k++) { assert ( RR(i,k) == R[i][k] ); } } Rotation A, B ,C; // operator*= A.rotateZ(angA); B.rotateY(angB); C.rotateZ(angC); R = A; R *= B; R *= C; Vector V(1,2,3); // operator* (Vector) V = R * V; assert ( std::abs(V.x()-R.xx()-2.*R.xy()-3.*R.xz()) < DEL ); assert ( std::abs(V.y()-R.yx()-2.*R.yy()-3.*R.yz()) < DEL ); assert ( std::abs(V.z()-R.zx()-2.*R.zy()-3.*R.zz()) < DEL ); R = A * B * C; // operator*(Matrix) assert ( std::abs(RR.xx() - R.xx()) < DEL ); assert ( std::abs(RR.xy() - R.xy()) < DEL ); assert ( std::abs(RR.xz() - R.xz()) < DEL ); assert ( std::abs(RR.yx() - R.yx()) < DEL ); assert ( std::abs(RR.yy() - R.yy()) < DEL ); assert ( std::abs(RR.yz() - R.yz()) < DEL ); assert ( std::abs(RR.zx() - R.zx()) < DEL ); assert ( std::abs(RR.zy() - R.zy()) < DEL ); assert ( std::abs(RR.zz() - R.zz()) < DEL ); R = C; // transform() R.transform(B); R.transform(A); assert ( std::abs(RR.xx() - R.xx()) < DEL ); assert ( std::abs(RR.xy() - R.xy()) < DEL ); assert ( std::abs(RR.xz() - R.xz()) < DEL ); assert ( std::abs(RR.yx() - R.yx()) < DEL ); assert ( std::abs(RR.yy() - R.yy()) < DEL ); assert ( std::abs(RR.yz() - R.yz()) < DEL ); assert ( std::abs(RR.zx() - R.zx()) < DEL ); assert ( std::abs(RR.zy() - R.zy()) < DEL ); assert ( std::abs(RR.zz() - R.zz()) < DEL ); R = RR.inverse(); // inverse() for(i=0; i<3; i++) { for(k=0; k<3; k++) { assert ( RR(i,k) == R[k][i] ); } } R.invert(); // invert() assert ( RR == R ); R = Rotation(); // rotateAxes() R.rotateAxes( Vector(RR.xx(), RR.yx(), RR.zx()), Vector(RR.xy(), RR.yy(), RR.zy()), Vector(RR.xz(), RR.yz(), RR.zz()) ); assert ( RR == R ); double ang=CLHEP::twopi/9.; // rotate() R = Rotation(); R.rotate(ang, V); RR = Rotation(); RR.rotateZ(-(V.phi())); RR.rotateY(-(V.theta())); RR.rotateZ(ang); RR.rotateY(V.theta()); RR.rotateZ(V.phi()); assert ( std::abs(RR.xx() - R.xx()) < DEL ); assert ( std::abs(RR.xy() - R.xy()) < DEL ); assert ( std::abs(RR.xz() - R.xz()) < DEL ); assert ( std::abs(RR.yx() - R.yx()) < DEL ); assert ( std::abs(RR.yy() - R.yy()) < DEL ); assert ( std::abs(RR.yz() - R.yz()) < DEL ); assert ( std::abs(RR.zx() - R.zx()) < DEL ); assert ( std::abs(RR.zy() - R.zy()) < DEL ); assert ( std::abs(RR.zz() - R.zz()) < DEL ); Vector Vu = V.unit(); // getAngleAxis R.getAngleAxis(ang, V); assert ( std::abs(ang - CLHEP::twopi/9.) < DEL ); assert ( std::abs(V.x() - Vu.x()) < DEL ); assert ( std::abs(V.y() - Vu.y()) < DEL ); assert ( std::abs(V.z() - Vu.z()) < DEL ); assert ( std::abs(RR.phiX()-std::atan2(RR.yx(),RR.xx())) < DEL ); // phiX() assert ( std::abs(RR.phiY()-std::atan2(RR.yy(),RR.xy())) < DEL ); // phiY() assert ( std::abs(RR.phiZ()-std::atan2(RR.yz(),RR.xz())) < DEL ); // phiZ() assert ( std::abs(RR.thetaX()-std::acos(RR.zx())) < DEL ); // thetaX() assert ( std::abs(RR.thetaY()-std::acos(RR.zy())) < DEL ); // thetaY() assert ( std::abs(RR.thetaZ()-std::acos(RR.zz())) < DEL ); // thetaZ() return 0; } clhep-2.1.4.1.orig/Vector/test/.cvsignore0000755000175000017500000000001407705452574016633 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Vector/test/testSubscripts.sh.in0000755000175000017500000000007307707326250020633 0ustar olesoles#! /bin/sh # @configure_input@ ./testSubscripts@EXEEXT@ clhep-2.1.4.1.orig/Vector/test/eulerTest.cc0000755000175000017500000001605011753232637017117 0ustar olesoles// eulerTest.cc // Test extreme cases for Euler angles -- // We perturb the matrix slightly before taking Euler angles. // A test will have failed if the Rotation resulting from taking euler angles // and forming a rotation from them, is ever significantly different than the // origninal rotation. #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Vector/EulerAngles.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include using std::cout; using namespace CLHEP; const int Nperturbs = 24; void perturb ( int i, const HepRotation & r, HepRotation & rp, double & del ); bool compareR ( const HepRotation & r1, const HepRotation & r2, double tol ); bool test (double phi, double theta, double psi) { HepRotation r (phi, theta, psi); HepRotation rp; HepRotation rpe; HepEulerAngles e; bool retval = true; double del; cout << "\n\n -------------------------------- \n\n"; for ( int i = 0; i < Nperturbs; ++i ) { perturb ( i, r, rp, del ); e = rp.eulerAngles(); cout << "(" << phi <<", " << theta << ", " << psi << ") --> "<< e << "\n"; cout << " e.phi() = " << e.phi() << " rp.phi() = " << rp.phi() << " difference is " << (e.phi() - rp.phi())/del << " * del\n"; if ( std::fabs (e.phi() - rp.phi()) > 200*del ) { cout << "phi discrepancy in " << rp << "\n"; cout << " e.phi() = " << e.phi() << " rp.phi() = " << rp.phi() << " difference is " << e.phi() - rp.phi() << "\n"; if (del < 1.0e-4) cout << "??????????\n"; retval = false; } if ( std::fabs (e.theta() - rp.theta()) > 200*del ) { cout << "theta discrepancy in " << rp << "\n"; cout << " e.theta() = " << e.theta() << " rp.theta() = " << rp.theta() << " difference is " << e.theta() - rp.theta() << "\n"; if (del < 1.0e-4) cout << "??????????\n"; retval = false; } cout << " e.psi() = " << e.psi() << " rp.psi() = " << rp.psi() << " difference is " << (e.psi() - rp.psi())/del << " * del\n"; if ( std::fabs (e.psi() - rp.psi()) > 200*del ) { cout << "psi discrepancy in " << rp << "\n"; cout << " e.psi() = " << e.psi() << " rp.psi() = " << rp.psi() << " difference is " << e.psi() - rp.psi() << "\n"; if (del < 1.0e-4) cout << "??????????\n"; retval = false; } rpe.set(e); retval &= compareR (rpe, rp, del); } return retval; } int main () { bool res = true; double PI = CLHEP::pi; // Some cases not in the potentially unstable region: res &= test ( .05, PI/5, .1 ); res &= test ( .4, PI/7, -.35 ); res &= test ( PI/3, PI/6, -PI/3 ); res &= test ( PI/5, PI/2, -PI/2.5 ); res &= test ( -PI/5, PI/2, PI/3 ); res &= test ( -4*PI/5, PI/2, PI/2.5 ); res &= test ( 4*PI/5, PI/2, 2*PI/3 ); res &= test ( -3*PI/4, PI/2, -PI/3 ); res &= test ( 5*PI/6, PI/2, -4*PI/5 ); res &= test ( 5*PI/6, PI/2, -PI/3 ); // Specialized cases res &= test ( .05, 0, .1 ); res &= test ( .2, 0, 1.1 ); res &= test ( -.4, 0, .4 ); res &= test ( -2.4, 0, 2.0 ); res &= test ( -2.4, 0, -2.0 ); res &= test ( -2.2, 0, 1.8 ); res &= test ( -2.2, 0, -1.8 ); res &= test ( .05, PI, .1 ); res &= test ( .2, PI, 1.1 ); res &= test ( -.4, PI, .4 ); res &= test ( -2.4, PI, 2.0 ); res &= test ( -2.4, PI, -2.0 ); res &= test ( -2.2, PI, 1.8 ); res &= test ( -2.2, PI, -1.8 ); // Cases near zero res &= test ( .1, .0000000004, .5 ); res &= test ( -1.2, .0000000004, .5 ); res &= test ( .7, .0000000004, -.6 ); res &= test ( 1.5, .0000000004, -1.1 ); res &= test ( 1.4, .0000000004, -1.5 ); res &= test ( -.1, .0000000000028, .5 ); res &= test ( -1.2, .0000000000028, -.5 ); res &= test ( .7, .0000000000028, -.6 ); res &= test ( -1.5, .0000000000028, -1.1 ); res &= test ( 1.4, .0000000000028, 1.5 ); // Cases near PI double nearPI = PI - .00000002; res &= test ( .1, nearPI, .5 ); res &= test ( -1.2, nearPI, .5 ); res &= test ( .7, nearPI, -.6 ); res &= test ( 1.5, nearPI, -1.1 ); res &= test ( 1.4, nearPI, -1.5 ); res &= test ( 2.4, nearPI, -1.6 ); res &= test ( 2.3, nearPI, 1.9 ); res &= test ( -2.8, nearPI, .6 ); res &= test ( -.4, nearPI, -3.1 ); nearPI = PI - .000000000009; res &= test ( .1, nearPI, -.5 ); res &= test ( 1.2, nearPI, .5 ); res &= test ( .7, nearPI, -.6 ); res &= test ( 1.5, nearPI, 1.1 ); res &= test ( -1.4, nearPI, -1.5 ); res &= test ( 2.1, nearPI, -1.2 ); res &= test ( 2.9, nearPI, .9 ); res &= test ( -2.8, nearPI, 1.6 ); res &= test ( -.4, nearPI, -3.0 ); if (!res) return -1; return 0; } bool compareR ( const HepRotation & r1, const HepRotation & r2, double tol ) { HepRep3x3 m1 = r1.rep3x3(); HepRep3x3 m2 = r2.rep3x3(); double flaw = 0; flaw = max (flaw, (m1.xx_ - m2.xx_)); flaw = max (flaw, (m1.xy_ - m2.xy_)); flaw = max (flaw, (m1.xz_ - m2.xz_)); flaw = max (flaw, (m1.yx_ - m2.yx_)); flaw = max (flaw, (m1.yy_ - m2.yy_)); flaw = max (flaw, (m1.yz_ - m2.yz_)); flaw = max (flaw, (m1.zx_ - m2.zx_)); flaw = max (flaw, (m1.zy_ - m2.zy_)); flaw = max (flaw, (m1.zz_ - m2.zz_)); if (flaw > 20*std::sqrt(tol)) { cout << "???????? comparison flaw at level of " << flaw << "\n" << r1 << r2; } cout << "flaw size is " << flaw << " (" << flaw/std::sqrt(tol) << ")\n\n"; return (flaw <= tol); } void perturb ( int i, const HepRotation & r, HepRotation & rp, double & del ) { HepRep3x3 p0 ( 1, 3, -2, -1, -2, 4, 2, -1, -1 ); HepRep3x3 p1 ( 1, -1, -2, 1, 3, -1, 2, -1, -3 ); HepRep3x3 p2 ( 5, 1, -5, -3, -2, 3, -1, 4, -1 ); HepRep3x3 p3 ( -2, -2, 1, -1, -2, -4, 4, 2, -2 ); HepRep3x3 p[4]; p[0] = p0; p[1] = p1; p[2] = p2; p[3] = p3; int cycle = i/4; double q; switch (cycle){ case 0: q = 1.0e-14; break; case 1: q = 1.0e-12; break; case 2: q = 1.0e-10; break; case 3: q = 1.0e-8; break; case 4: q = 1.0e-6; break; case 5: q = 1.0e-4; break; } HepRep3x3 d = p[i%4]; HepRep3x3 m = r.rep3x3(); if ((m.zz_ + q*d.zz_) < -1) { d.zz_ = -d.zz_; } cout << "i = " << i << " q is " << q << "\n"; rp.set (HepRep3x3 ( m.xx_ + q*d.xx_ , m.xy_ + q*d.xy_ , m.xz_ + q*d.xz_ , m.yx_ + q*d.yx_ , m.yy_ + q*d.yy_ , m.yz_ + q*d.yz_ , m.zx_ + q*d.zx_ , m.zy_ + q*d.zy_ , m.zz_ + q*d.zz_ ) ); del = q; } clhep-2.1.4.1.orig/Vector/test/testThreeVector.input0000755000175000017500000000003407705060311021030 0ustar olesoles(1.1,2.2,3.3) ( 3 , 2 , 1 ) clhep-2.1.4.1.orig/Vector/test/testThreeVector.sh.in0000755000175000017500000000023511776622027020726 0ustar olesoles#! /bin/sh # @configure_input@ ./testThreeVector@EXEEXT@ < "@srcdir@/testThreeVector.input" \ | @DIFF_Q@ - "@srcdir@/testThreeVector.output" > /dev/null clhep-2.1.4.1.orig/Vector/test/CMakeLists.txt0000644000175000017500000000053611606714767017401 0ustar olesoles set( Vector_tests testThreeVector testLorentzVector ) set( Vector_simple_tests testRotation testSubscripts ) foreach ( test ${Vector_tests} ) clhep_test( ${test} ) endforeach ( test ${Vector_tests} ) foreach ( test ${Vector_simple_tests} ) clhep_test( ${test} SIMPLE ) endforeach ( test ${Vector_simple_tests} ) clhep-2.1.4.1.orig/Vector/test/testRotation.sh.in0000755000175000017500000000007107707326250020267 0ustar olesoles#! /bin/sh # @configure_input@ ./testRotation@EXEEXT@ clhep-2.1.4.1.orig/Vector/test/testThreeVector.cc0000755000175000017500000002534111761714041020271 0ustar olesoles// -*- C++ -*- // $Id: testThreeVector.cc,v 1.3 2003/08/08 13:47:09 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is a small program for testing the Hep3Vector class // and the interaction with the HepRotation class. // #include "CLHEP/Units/GlobalSystemOfUnits.h" // to see shadowing problems #include "CLHEP/Units/GlobalPhysicalConstants.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Vector/TwoVector.h" #include "CLHEP/Vector/Rotation.h" #include #include #include // for exit using namespace CLHEP; #define DEPS 1.0e-14 #define FEPS 1.0e-6 bool approx(double a, double b, double eps) { return bool( std::abs(a-b) < eps ); } bool test(const Hep3Vector & p, double x, double y, double z, double eps) { return bool( approx(p.x(), x, eps) && approx(p.y(), y, eps) && approx(p.z(), z, eps) ); } bool test2(const Hep2Vector & p, double x, double y, double eps) { return bool( approx(p.x(), x, eps) && approx(p.y(), y, eps) ); } int main () { // test constructors: Hep3Vector d0; if ( !test(d0, 0.0, 0.0, 0.0, DEPS) ) exit(1); Hep3Vector f0; if ( !test(f0, 0.0, 0.0, 0.0, FEPS) ) exit(1); Hep3Vector d1(1.0); if ( !test(d1, 1.0, 0.0, 0.0, DEPS) ) exit(1); Hep3Vector f1(1.0); if ( !test(f1, 1.0, 0.0, 0.0, FEPS) ) exit(1); Hep3Vector d2(1.0, 1.0); if ( !test(d2, 1.0, 1.0, 0.0, DEPS) ) exit(1); Hep3Vector f2(1.0, 1.0); if ( !test(f2, 1.0, 1.0, 0.0, FEPS) ) exit(1); Hep3Vector d3(1.0, 1.0, 1.0); if ( !test(d3, 1.0, 1.0, 1.0, DEPS) ) exit(1); Hep3Vector f3(1.0, 1.0, 1.0); if ( !test(f3, 1.0, 1.0, 1.0, FEPS) ) exit(1); Hep3Vector d4(f3); if ( !test(d4, 1.0, 1.0, 1.0, DEPS) ) exit(1); Hep3Vector f4(d3); if ( !test(f4, 1.0, 1.0, 1.0, FEPS) ) exit(1); Hep2Vector t3(d4); if ( !test2(t3, 1.0, 1.0, DEPS) ) exit(1); // test input/output from a stream std::cin >> d0; if ( !test(d0, 1.1, 2.2, 3.3, DEPS) ) exit(1); std::cin >> f0; if ( !test(f0, 3.0, 2.0, 1.0, FEPS) ) exit(1); std::cout << d0 << std::endl; std::cout << f0 << std::endl; // test assignment: d4 = d1; if ( !test(d4, 1.0, 0.0, 0.0, DEPS) ) exit(2); f4 = f1; if ( !test(f4, 1.0, 0.0, 0.0, FEPS) ) exit(2); d4 = f1; if ( !test(d4, 1.0, 0.0, 0.0, FEPS) ) exit(2); f4 = d1; if ( !test(f4, 1.0, 0.0, 0.0, FEPS) ) exit(2); // test addition: d4 = d1 + d2; if ( !test(d4, 2.0, 1.0, 0.0, DEPS) ) exit(3); d4 = f1 + d2; if ( !test(d4, 2.0, 1.0, 0.0, FEPS) ) exit(3); d4 = d1 + f2; if ( !test(d4, 2.0, 1.0, 0.0, FEPS) ) exit(3); d4 = f1 + f2; if ( !test(d4, 2.0, 1.0, 0.0, FEPS) ) exit(3); d4 += d3; if ( !test(d4, 3.0, 2.0, 1.0, FEPS) ) exit(3); d4 += f3; if ( !test(d4, 4.0, 3.0, 2.0, FEPS) ) exit(3); f4 = d1 + d2; if ( !test(f4, 2.0, 1.0, 0.0, FEPS) ) exit(3); f4 = f1 + d2; if ( !test(f4, 2.0, 1.0, 0.0, FEPS) ) exit(3); f4 = d1 + f2; if ( !test(f4, 2.0, 1.0, 0.0, FEPS) ) exit(3); f4 = f1 + f2; if ( !test(f4, 2.0, 1.0, 0.0, FEPS) ) exit(3); f4 += d3; if ( !test(f4, 3.0, 2.0, 1.0, FEPS) ) exit(3); f4 += f3; if ( !test(f4, 4.0, 3.0, 2.0, FEPS) ) exit(3); // test subtraction d4 -= d3; if ( !test(d4, 3.0, 2.0, 1.0, FEPS) ) exit(4); d4 -= f3; if ( !test(d4, 2.0, 1.0, 0.0, FEPS) ) exit(4); f4 -= d3; if ( !test(f4, 3.0, 2.0, 1.0, FEPS) ) exit(4); f4 -= f3; if ( !test(f4, 2.0, 1.0, 0.0, FEPS) ) exit(4); d4 = d1 - d2; if ( !test(d4, 0.0, -1.0, 0.0, DEPS) ) exit(4); d4 = f1 - d2; if ( !test(d4, 0.0, -1.0, 0.0, FEPS) ) exit(4); d4 = d1 - f2; if ( !test(d4, 0.0, -1.0, 0.0, FEPS) ) exit(4); d4 = f1 - f2; if ( !test(d4, 0.0, -1.0, 0.0, FEPS) ) exit(4); f4 = d1 - d2; if ( !test(f4, 0.0, -1.0, 0.0, FEPS) ) exit(4); f4 = f1 - d2; if ( !test(f4, 0.0, -1.0, 0.0, FEPS) ) exit(4); f4 = d1 - f2; if ( !test(f4, 0.0, -1.0, 0.0, FEPS) ) exit(4); f4 = f1 - f2; if ( !test(f4, 0.0, -1.0, 0.0, FEPS) ) exit(4); // test unary minus: if ( !test(-d3, -1.0, -1.0, -1.0, DEPS) ) exit(5); if ( !test(-f3, -1.0, -1.0, -1.0, FEPS) ) exit(5); if ( !test(-d1, -1.0, 0.0, 0.0, DEPS) ) exit(5); if ( !test(-f1, -1.0, 0.0, 0.0, FEPS) ) exit(5); // test scaling: if ( !test(d3*2.0, 2.0, 2.0, 2.0, DEPS) ) exit(6); if ( !test(2.0*d3, 2.0, 2.0, 2.0, DEPS) ) exit(6); if ( !test(d1*2.0, 2.0, 0.0, 0.0, DEPS) ) exit(6); if ( !test(2.0*d1, 2.0, 0.0, 0.0, DEPS) ) exit(6); if ( !test(f3*2.0f, 2.0, 2.0, 2.0, FEPS) ) exit(6); if ( !test(2.0f*f3, 2.0, 2.0, 2.0, FEPS) ) exit(6); if ( !test(f1*2.0f, 2.0, 0.0, 0.0, FEPS) ) exit(6); if ( !test(2.0f*f1, 2.0, 0.0, 0.0, FEPS) ) exit(6); if ( !test(d4*=2.0, 0.0, -2.0, 0.0, FEPS) ) exit(6); if ( !test(f4*=2.0, 0.0, -2.0, 0.0, FEPS) ) exit(6); // testing scalar and vector product: if ( !approx(d4*d1, 0.0, DEPS) ) exit(7); if ( !approx(d4*f1, 0.0, FEPS) ) exit(7); if ( !approx(f4*d1, 0.0, FEPS) ) exit(7); if ( !approx(f4*f1, 0.0, FEPS) ) exit(7); if ( !approx(d4.dot(d1), 0.0, DEPS) ) exit(7); if ( !approx(d4.dot(f1), 0.0, FEPS) ) exit(7); if ( !approx(f4.dot(d1), 0.0, FEPS) ) exit(7); if ( !approx(f4.dot(f1), 0.0, FEPS) ) exit(7); if ( !approx(d4*d2, -2.0, DEPS) ) exit(7); if ( !approx(d4*f2, -2.0, FEPS) ) exit(7); if ( !approx(f4*d2, -2.0, FEPS) ) exit(7); if ( !approx(f4*f2, -2.0, FEPS) ) exit(7); if ( !approx(d4.dot(d2), -2.0, DEPS) ) exit(7); if ( !approx(d4.dot(f2), -2.0, FEPS) ) exit(7); if ( !approx(f4.dot(d2), -2.0, FEPS) ) exit(7); if ( !approx(f4.dot(f2), -2.0, FEPS) ) exit(7); d4 = d1.cross(d2); if ( !test(d4, 0.0, 0.0, 1.0, DEPS) ) exit(7); d4 = d2.cross(d1); if ( !test(d4, 0.0, 0.0, -1.0, DEPS) ) exit(7); f4 = f1.cross(d2); if ( !test(f4, 0.0, 0.0, 1.0, FEPS) ) exit(7); f4 = d2.cross(f1); if ( !test(f4, 0.0, 0.0, -1.0, FEPS) ) exit(7); // testing ptot and pt: d4 = d1 + f2 + d3; f4 = d1 + f2 + d3; if ( !approx(d4.mag2(), 14.0, FEPS) ) exit(8); if ( !approx(d4.mag(), std::sqrt(14.0), FEPS) ) exit(8); if ( !approx(d4.perp2(), 13.0, FEPS) ) exit(8); if ( !approx(d4.perp(), std::sqrt(13.0), FEPS) ) exit(8); if ( !approx(f4.mag2(), 14.0, FEPS) ) exit(8); if ( !approx(f4.mag(), std::sqrt(14.0), FEPS) ) exit(8); if ( !approx(f4.perp2(), 13.0, FEPS) ) exit(8); if ( !approx(f4.perp(), std::sqrt(13.0), FEPS) ) exit(8); // testing angles: d4 = d2 - 2.0 * d1; f4 = d2 - 2.0f * f1; if ( !approx(d1.phi(), 0.0, DEPS) ) exit(9); if ( !approx(d1.theta(), CLHEP::halfpi, DEPS) ) exit(9); if ( !approx(d1.cosTheta(), 0.0, DEPS) ) exit(9); if ( !approx(d2.phi(), CLHEP::halfpi*0.5, DEPS) ) exit(9); if ( !approx(d2.theta(), CLHEP::halfpi, DEPS) ) exit(9); if ( !approx(d2.cosTheta(), 0.0, DEPS) ) exit(9); if ( !approx((-d2).phi(), -3.0*CLHEP::halfpi*0.5, DEPS) ) exit(9); if ( !approx(d4.phi(), 3.0*CLHEP::halfpi*0.5, DEPS) ) exit(9); if ( !approx(f1.phi(), 0.0, FEPS) ) exit(9); if ( !approx(f1.theta(), CLHEP::halfpi, FEPS) ) exit(9); if ( !approx(f1.cosTheta(), 0.0, FEPS) ) exit(9); if ( !approx(f2.phi(), CLHEP::halfpi*0.5, FEPS) ) exit(9); if ( !approx(f2.theta(), CLHEP::halfpi, FEPS) ) exit(9); if ( !approx(f2.cosTheta(), 0.0, FEPS) ) exit(9); if ( !approx((-f2).phi(), -3.0*CLHEP::halfpi*0.5, FEPS) ) exit(9); if ( !approx(f4.phi(), 3.0*CLHEP::halfpi*0.5, FEPS) ) exit(9); d4 = d3 - d1; if ( !approx(d4.theta(), CLHEP::halfpi*0.5, DEPS) ) exit(9); if ( !approx((-d4).theta(), 3.0*CLHEP::halfpi*0.5, DEPS) ) exit(9); if ( !approx((-d4).cosTheta(), -std::sqrt(0.5), DEPS) ) exit(9); d4 = d3 - d2; if ( !approx(d4.theta(), 0.0, DEPS) ) exit(9); if ( !approx(d4.cosTheta(), 1.0, DEPS) ) exit(9); if ( !approx((-d4).theta(), CLHEP::pi, DEPS) ) exit(9); if ( !approx((-d4).cosTheta(), -1.0, DEPS) ) exit(9); f4 = d3 - d1; if ( !approx(f4.theta(), CLHEP::halfpi*0.5, FEPS) ) exit(9); if ( !approx((-f4).theta(), 3.0*CLHEP::halfpi*0.5, FEPS) ) exit(9); if ( !approx((-f4).cosTheta(), -std::sqrt(0.5), FEPS) ) exit(9); f4 = d3 - d2; if ( !approx(f4.theta(), 0.0, FEPS) ) exit(9); if ( !approx(f4.cosTheta(), 1.0, FEPS) ) exit(9); if ( !approx((-f4).theta(), CLHEP::pi, FEPS) ) exit(9); if ( !approx((-f4).cosTheta(), -1.0, FEPS) ) exit(9); d4 = d2 - 2.0*d1; if ( !approx(d4.angle(d2), CLHEP::halfpi, DEPS) ) exit(9); f4 = d2 - 2.0*d1; if ( !approx(f4.angle(f2), CLHEP::halfpi, FEPS) ) exit(9); // testing rotations d4 = d1; d4.rotateZ(CLHEP::halfpi); if ( !test(d4, 0.0, 1.0, 0.0, DEPS) ) exit(10); d4.rotateY(25.3); if ( !test(d4, 0.0, 1.0, 0.0, DEPS) ) exit(10); d4.rotateZ(CLHEP::halfpi); if ( !test(d4, -1.0, 0.0, 0.0, DEPS) ) exit(10); d4.rotateY(CLHEP::halfpi); if ( !test(d4, 0.0, 0.0, 1.0, DEPS) ) exit(10); d4.rotateZ(2.6); if ( !test(d4, 0.0, 0.0, 1.0, DEPS) ) exit(10); d4.rotateY(CLHEP::pi*0.25); if ( !test(d4, std::sqrt(0.5), 0.0, std::sqrt(0.5), DEPS) ) exit(10); f4 = f1; f4.rotateZ(CLHEP::halfpi); if ( !test(f4, 0.0, 1.0, 0.0, FEPS) ) exit(10); f4.rotateY(25.3); if ( !test(f4, 0.0, 1.0, 0.0, FEPS) ) exit(10); f4.rotateZ(CLHEP::halfpi); if ( !test(f4, -1.0, 0.0, 0.0, FEPS) ) exit(10); f4.rotateY(CLHEP::halfpi); if ( !test(f4, 0.0, 0.0, 1.0, FEPS) ) exit(10); f4.rotateZ(2.6); if ( !test(f4, 0.0, 0.0, 1.0, FEPS) ) exit(10); f4.rotateY(CLHEP::pi*0.25); if ( !test(f4, std::sqrt(0.5), 0.0, std::sqrt(0.5), FEPS) ) exit(10); d4 = d1; d4.rotate(d4.angle(d3), d4.cross(d3)); d4 *= d3.mag(); if ( !test(d4, 1.0, 1.0, 1.0, DEPS) ) exit(10); d4 = d1; d4.rotate(0.23, d4.cross(d3)); if ( !approx(d4.angle(d1), 0.23, DEPS) ) exit(10); f4 = d1; f4.rotate(f4.angle(d3), f4.cross(d3)); f4 *= f3.mag(); if ( !test(f4, 1.0, 1.0, 1.0, FEPS) ) exit(10); f4 = f1; f4.rotate(0.23, f4.cross(d3)); if ( !approx(f4.angle(f1), 0.23, FEPS) ) exit(10); if ( !approx(f4.angle(d3), f1.angle(d3) - 0.23, FEPS) ) exit(10); // test rotation maticies: d4 = d1; HepRotation r0, r1, r2, r3, r4, r5; r1.rotateZ(CLHEP::halfpi); r2.rotateY(CLHEP::halfpi); r4.rotate(d4.angle(d3), d4.cross(d3)); r5.rotate(0.23, d4.cross(d3)); d4 = r4.inverse() * d3; if ( !test(d4, d3.mag(), 0.0, 0.0, DEPS) ) exit(11); d4 = r5 * d3; if ( !approx(d1.angle(d4), d1.angle(d3)+0.23, DEPS) ) exit(11); f4 = r4.inverse() * f3; if ( !test(f4, f3.mag(), 0.0, 0.0, FEPS) ) exit(11); f4 = r5 * d3; if ( !approx(d1.angle(f4), f1.angle(f3)+0.23, FEPS) ) exit(11); r5 = r2 * r1 * r3.inverse() * r0 * r0.inverse(); d4 = d3; d4 *= r3.inverse(); d4 *= r1; d4 *= r2; if ( !test(d4, 1.0, 1.0, 1.0, DEPS) ) exit(11); r5.invert(); d4 = r5 * d4; if ( !test(d4, 1.0, 1.0, 1.0, DEPS) ) exit(11); d1 = d2 = Hep3Vector(1.0, -0.5, 2.1); d3 = Hep3Vector(-0.3, 1.1, 1.5); d4 = d3.unit(); d4 *= d3.mag(); if ( !test(d4, d3.x(), d3.y(), d3.z(), DEPS) ) exit(11); r0.rotate(0.10, d1.cross(d3)); d1 *= r0; if ( !approx(d1.angle(d3), d2.angle(d3)-0.1, DEPS) ) exit(12); if ( !approx(d1.angle(d2), 0.1, DEPS) ) exit(12); return 0; } clhep-2.1.4.1.orig/Vector/test/testLorentzVector.sh.in0000755000175000017500000000024311776622027021313 0ustar olesoles#! /bin/sh # @configure_input@ ./testLorentzVector@EXEEXT@ < "@srcdir@/testLorentzVector.input" \ | @DIFF_Q@ - "@srcdir@/testLorentzVector.output" > /dev/null clhep-2.1.4.1.orig/Vector/test/eulerProb.cc0000755000175000017500000000353711753232637017110 0ustar olesoles// HepRotatonTest.cc #include #include "CLHEP/Units/SystemOfUnits.h" #include "CLHEP/Vector/Rotation.h" using std::cout; using std::endl; using namespace CLHEP; class myRotClass: public HepRotation { public: myRotClass (const HepRotationZ& rot): HepRotation (rot) {;}; void setXX (const double& v) {rxx = v;}; void setXY (const double& v) {rxy = v;}; void setXZ (const double& v) {rxz = v;}; void setYX (const double& v) {ryx = v;}; void setYY (const double& v) {ryy = v;}; void setYZ (const double& v) {ryz = v;}; void setZX (const double& v) {rzx = v;}; void setZY (const double& v) {rzy = v;}; void setZZ (const double& v) {rzz = v;}; }; int main () { HepRotationZ az (120*deg); // az.set (120*degree); // HepRotation rot (az); myRotClass rot(az); const double corr = 0.9999999999999999; rot.setZZ (corr); // Make sure that det(rot)=1, so that its still a valid rotation // (in principal I would expect that HepRotation should be robust // enough to give reasonable results even without this step since // round off errors in floating point operations could also cause // such a loss of precision). rot.setXX (rot.xx()/std::sqrt(corr)); rot.setXY (rot.xy()/std::sqrt(corr)); rot.setYX (rot.yx()/std::sqrt(corr)); rot.setYY (rot.yy()/std::sqrt(corr)); cout.setf (std::ios::scientific, std::ios::floatfield); rot.print (cout); cout << "\n"; cout.precision (30); cout << rot.xx() << "\t" << rot.xy() << "\t" << rot.xz() << "\n" << rot.yx() << "\t" << rot.yy() << "\t" << rot.yz() << "\n" << rot.zx() << "\t" << rot.zy() << "\t" << rot.zz() << endl; cout << "\nEuler angles:" << "\nphi = " << rot.phi() << "\ttheta = " << rot.theta() << "\tpsi = " << rot.psi() << endl; HepRotation newrot (rot.phi(), rot.theta(), rot.psi()); newrot.print(cout); return 0; } clhep-2.1.4.1.orig/Vector/test/testLorentzVector.output0000755000175000017500000000003407707326250021630 0ustar olesoles(1.1,2.2,3.3;4.4) (4,3,2;1) clhep-2.1.4.1.orig/Vector/ChangeLog0000755000175000017500000007247012241267303015426 0ustar olesoles============================== 14.11.13 Release CLHEP-2.1.4.1 ============================== ============================== 05.11.13 Release CLHEP-2.1.4.0 ============================== ============================== 14.11.12 Release CLHEP-2.1.3.1 ============================== 2012-11-14 Lynn Garren * Vector/Rotation.icc: fix a bug introduced when trying to stop shadowing complaints * RotationX, RotationY, RotationZ: change the names of internal variables to avoid possible confusion with Units (tested in a controlled environment to avoid introducing any bugs) ============================== 06.11.12 Release CLHEP-2.1.3.0 ============================== ============================== 16.08.12 Release CLHEP-2.1.2.5 ============================== 2012-08-07 Lynn Garren * LorentzVector.h: make the HepLorentzVector(double t) constructor explicit ============================== 09.07.12 Release CLHEP-2.1.2.4 ============================== ============================== 31.05.12 Release CLHEP-2.1.2.3 ============================== 2012-05-31 Lynn Garren * Vector, src: fix for shadowing when global units used * Vector/LorentzVector.icc: USING_VISUAL code blocks are no longer needed * test: include CLHEP/Units/GlobalSystemOfUnits.h in tests 2012-05-11 Lynn Garren * src, test: use explicit std:: with math functions ============================== 14.02.12 Release CLHEP-2.1.2.2 ============================== ============================== 06.02.12 Release CLHEP-2.1.2.1 ============================== 2012-01-31 Lynn Garren * change the names of internal variables so -Wshadow does not complain ============================== 16.12.11 Release CLHEP-2.1.2.0 ============================== ============================== 29.07.11 Release CLHEP-2.1.1.0 ============================== ============================== 11.11.10 Release CLHEP-2.1.0.1 ============================== ============================== 23.07.10 Release CLHEP-2.1.0.0 ============================== ============================== 16.06.10 Release CLHEP-2.1.0.0.b01 ============================== ============================== 11.06.10 Release CLHEP-2.0.5.0.b01 ============================== 2009-08-25 Lynn Garren * Vector/ThreeVector.h, Vector/ThreeVector.icc: Each constructor possibility is now a separate instance to avoid confusion if Hep3Vector is in the constructor of another function. ============================== 09.03.10 Release CLHEP-2.0.4.6 ============================== ============================== 08.12.09 Release CLHEP-2.0.4.5 ============================== ============================== 12.11.09 Release CLHEP-2.0.4.4 ============================== ============================== 03.11.09 Release CLHEP-2.0.4.4.b01 ============================== ============================== 04.07.09 Release CLHEP-2.0.4.3 ============================== ============================== 18.11.08 Release CLHEP-2.0.4.2 ============================== ============================== 04.11.08 Release CLHEP-2.0.4.1 ============================== ============================== 07.08.08 Release CLHEP-2.0.4.0 ============================== ============================== 01.05.08 Release CLHEP-2.0.3.3 ============================== ============================== 18.10.07 Release CLHEP-2.0.3.2 ============================== ============================== 15.11.06 Release CLHEP-2.0.3.1 ============================== ============================== 18.10.06 Release CLHEP-2.0.3.0 ============================== ============================== 20.06.06 Release CLHEP-2.0.2.3 ============================== ============================== 21.11.05 Release CLHEP-2.0.2.2 ============================== 2005-11-21 Lynn Garren * src/Makefile.am, test/Makefile.am: Build libraries for Windows Visual C++ without lib prefix. 2005-11-14 Lynn Garren * RotationInterfaces.h: Instantiate private destructors so that dictionary builders will not complain. 2005-11-03 Lynn Garren * configure.in, LorentzVector.icc Provide a flag to enable code differences when compiling with Visual C++. ============================== 22.06.05 Release CLHEP-2.0.2.1 ============================== Wed Jun 22 2005 Andreas Pfeiffer * configure.in: changed soname to install_name for darwin targets, dylibs still don't build properly on 10.3/10.4, static libs ok. 2005-06-19 Lynn Garren * configure.in, Makefile.am: Use lib when building Visual C++ libraries. Disable shared library build for Solaris CC. ============================== 22.04.05 Release CLHEP-2.0.2.0 ============================== 2005-04-07 Lynn Garren * configure.in: set AR and ARFLAGS 2005-02-18 Lynn Garren * configure.in, Makefile.am: Stop using libtool. The newer releases of libtool seem to have dropped support for Windows Visual C++. 2005-02-14 Lynn Garren * configure.in: Visual C++ flags are now "-EHsc -nologo -GR -GX -MD" 2005-02-03 Lynn Garren * configure.in: install step creates libCLHEP.a, libCLHEP.so, and/or libCLHEP.dylib by adding a symbolic link. 2005-02-02 Andreas PFEIFFER * configure.in: modified compiler flags for windows: added "-O -GR -GX -MD" as this is needed for the multi-thread environments used. ============================== 30.11.04 Release CLHEP-2.0.1.2 ============================== Mon Nov 29 2004 Mark Fischler * In LorentzVectorC.cc, in deltaR, replaced the direct subtraction pp.phi() - w.getV().phi() with pp.deltaRPhi(w.getV()) which behaves correctly across the 2pi boundary. This correction had been in CLHEP 1.8.2 for some time. Mon Nov 29 2004 Lynn Garren * add missing implemetations to BoostX.cc, BoostY.cc, BoostZ.cc, RotationY.cc, and RotationZ.cc ============================== 27.10.04 Release CLHEP-2.0.1.1 ============================== Fri Sep 24 2004 Lynn Garren * use AM_CXXFLAGS * require autoconf 2.59, automake 1.9.1, and libtool 1.9b Tue Aug 31 2004 Lynn Garren * change Solaris CC compile flags from "-O -mt" to "-O" * libtools 1.9b or later is required for Solaris CC ============================== 23.07.04 Release CLHEP-2.0.1.0 ============================== ============================== 11.05.04 Release CLHEP-2.0.0.2 ============================== ============================== 11.05.04 Release CLHEP-1.9.0.2 ============================== Thu Apr 29 2004 Mark Fischler * LorentzVectorK.cc Modified behavior when rapidity of a light-like vector moving in the -z direction is taken. Previously, would have tried to take log(0.0). ============================== 21.04.04 Release CLHEP-2.0.0.1 ============================== Thu Nov 06 2003 Lynn Garren * adding ZOOM Exceptions package for FNAL * adding supporting RefCount and Cast packages ============================== 24.10.03 Release CLHEP-2.0.0.0 ============================== ============================== 23.10.03 Release CLHEP-1.9.0.0 ============================== Fri Oct 10 2003 Mark Fischler * ZMxpv.h and ZMxpv.cc Modified the ZZMthrowA and ZMthrowC macros such that the package never calls exit(), throwing an exception instead. Existing code in entire package was already instrumented to throw the various exceptions. * Boost.h and Boost.icc and Boost.cc Correct a typo in Boost::vectorMutiplication() [that is, boost*4vector]. This affected off-axis boosts applied to a LorentzVector when the x- and/or y- components of both the Boost and the LorentzVector are not small. Boosts in the z-direction are unaffected and Boosts dominantly in the z-direction suffered only second-order effects. Repair a bug in LorentzVector::deltaR() which could return large values when the phi values are close to + and - pi respectively, for two vectors which are actually near each other. Rectify misbehaviour when isNear() is taken between a specialized or general Boost and a general LorentzRotation. Supply output operator. * BoostX.cc, BoostY.cc, BoostZ.cc Rectify misbehaviour when isNear() is taken between a specialized or general Boost and a general LorentzRotation. Supply output operators. * LorentzRotation.cc Multiplication by specialized rotations More efficient multiplicatio by a rotation *LorentzVectorC.cc Correction in isNear for two vectors both close to -Z axis. * RotationE.cc Methods to find EUler angles phi() and psi() now forgiving of cos phi apparently slightly above 1 due to roundoff error. Thu May 1 11:18:49 2003 Mark Fischler * Vector/RotationE.cc: This modifies the eulerAngles() method to address a flaw pointed out by A. Skiba: When the rotation matrix for a HepRotation was slightly perturbed due to accumulated roud-off error, and the rotation was very nearly but not exactly about the Z axis, the Euler angles computed could be incorrect in the sense that reconstructing a HepRotation from them would give a significantly different rotation. The new algorithm is much more numerically stable, and handles these cases better. * Vector/doc/eulerAngleComputation.tex: This file gives mathematical detail of the problem and the algorithm used to improve the numerical stability. * Vector/test/eulerProb.cc,eulerTest.cc (Added): The original program submitted by Skiba to exhibit numerical instability in eulerAngles() method, and a program to significantly excercise many different cases to verify that the improved method does give accurate results in the difficult and easy cases. ============================== 01.06.02 Release CLHEP-1.8.0.0 ============================== Fri May 24 14:44:32 2002 Mark Fischler * Vector/Rotation.cc,RotationA.cc,RotationE.cc,RotationX.cc: * Vector/RotationY.cc,RotationZ.cc: Protection against taking acos(>1.0000) in cases where roundoff has caused a matrix element to become greater than 1. ========================================= 25.04.02 revised StdHep uses HepMC ========================================= Sun Mar 31 10:54:23 2002 Evgueni Tcherniaev * Global_Clean_Up: The following macros have been removed from config/CLHEP-target.h.in (the reason is indicated). Respectively checks for them have been removed from configure.in: HEP_HAVE_STL - all supported compilers have string, vector, ... HEP_HAVE_BOOL - all supported compilers have bool HEP_HAVE_NAMESPACE - all supported compilers have namespace HEP_HAVE_EXPLICIT - all supported compilers have explicit HEP_HAVE_TYPENAME - all supported compilers have typename HEP_HAVE_EMPTY_TEMPLATE_PARAMETER_LIST - all supported compilers have template<> HEP_SQR_NEEDS_PARAMETER_WITHOUT_CONST HEP_ABS_NEEDS_PARAMETER_WITHOUT_CONST - current definition of sqr() and abs() works everywhere HEP_QSORT_NEEDS_FUNCTION_WITH_EXTERN_C_LINKAGE - qsort() is not used The following macros have been removed from config/CLHEP.h: HepStdString HepStdVector HepStdList HEP_TEMPLATE_SPECIALIZATION HEP_BEGIN_NAMESPACE HEP_END_NAMESPACE HEP_USING_NAMESPACE The following modifications have been made in the code: HepStdString --> HepSTL::string HepStdVector --> HepSTL::vector HepBoolean --> bool HepDouble --> double HepFloat --> float HepInt --> int HEP_BEGIN_NAMESPACE(xxx) --> namespace xxx { HEP_END_NAMESPACE(xxx) --> } // namespace xxx ========================================= 08.03.02 HepMC has become a part of CLHEP ========================================= Wed Mar 6 09:37:58 2002 Mark Fischler * Vector/Boost.cc,Boost.h,Boost.icc,BoostX.cc,BoostX.h,BoostX.icc: * Vector/BoostY.cc,BoostY.h,BoostY.icc,BoostZ.cc,BoostZ.h,BoostZ.icc: * Vector/LorentzRotation.cc,LorentzRotation.h,LorentzRotation.icc: * Vector/LorentzRotationC.cc,LorentzRotationD.cc: * Vector/Rotation.cc,Rotation.h,Rotation.icc,RotationA.cc: * Vector/RotationC.cc,RotationE.cc,RotationInterfaces.cc: * Vector/RotationInterfaces.h,RotationInterfaces.icc,RotationL.cc: * Vector/RotationP.cc,RotationX.cc,RotationX.h,RotationX.icc: * Vector/RotationXYZ.cc,RotationY.cc,RotationY.h,RotationY.icc: * Vector/RotationZ.cc,RotationZ.h,RotationZ.icc,ThreeVector.icc: * Vector/TwoVector.icc: Speeed enhancements by making Rotation completely non-polymorphic, inlining everything that remotely seems appropriate, ordering appearance of inline definitions such that the inlining is ot defeated, and so forth. This addresses the issue that R*v in CLHEP 1.7 was 3.5 times slower than in CLHEP 1.6. They are now the same speed. Tue Dec 4 08:31:13 2001 Mark Fischler * Vector/ZMinput.cc: Helper methods to support flexible input formats. Mon Dec 3 11:55:35 2001 Mark Fischler * Vector/ThreeVector.h,ThreeVector.icc: Declaration of deltaPhi() and implementation of azimAngle in terms of it. Fri Nov 30 11:32:56 2001 Mark Fischler * Vector/AxisAngle.cc,Boost.icc,BoostX.icc,BoostY.icc,BoostZ.icc: * Vector/EulerAngles.cc,LorentzRotation.icc,LorentzRotationC.cc: * Vector/Rotation.icc,RotationA.cc,RotationC.cc,RotationE.cc: * Vector/SpaceVectorD.cc,ThreeVector.cc,TwoVector.cc,TwoVector.h: * Vector/TwoVector.icc: - fix warnings about uninitialized base classes; - correct behavior of deltaR() for vectors near but on opposite sides of phi = - pi; - correct azimangle and provide deltaPhi() method; - set(x,y) for Hep2Vector; - all classes that have operator>> can now accept input in same form as operator<< generates output; - return value if you take eta(zero vector) is zero rather than 10^72; ========================================== 09.11.01 HepPDT has become a part of CLHEP ========================================== Thu Aug 2 2001 Mark Fischler * Vector/Boost.icc: Repair incorrect syntax in new error message code. Fri Jul 27 2001 Mark Fischler * Vector/ThreeVector.h,ThreeVector.icc,ThreeVector.cc: * Vector/AxisAngle.cc,Boost.cc,BoostX.cc,BoostY.cc,BoostZ.cc: * Vector/EulerAngles.cc,LorentzRotationD.cc,LorentzVectorC.cc: * Vetor/Rotation.cc,RotationE.cc,SpaceVectorP.cc,SpaceVectorR.cc: NaN-proofed the package: At every place where there is a potential division by zero or a function that could return a memeaningless result or Not-A-Number, it is checked and an error message (via ZMthrowA or ZMthrowC) is done if there is a problem. No silent NaN generation. * Vector/Boost.icc: Rectify a misleading error message if ctor is supplied a 0 direction. ============================== 15.06.01 Release CLHEP-1.7.0.0 ============================== Mon Jun 11 10:20:35 2001 Evgueni Tcherniaev * configure.in,Makefile.in: * configure/Makefile.common.in: * test/Makefile.in: Added $(VERSION) to the name of the library * GenericFunctions/FunctionNumDeriv.cc: Replaced max() by if() * GenericFunctions/Variable.hh: Removed const from parameters of the constructor Variable(unsigned int selectionIndex=0); * Geometry/Transform3D.cc,Transform3D.h: Added getDecomposition(Scale &, Rotation &, Translation &) * test/Makefile.in: * test/testTransform3D.cc (Added): Added test for Transform3D. * test/testAList.cc,testCmd.cc,testCmd.out.save (Removed): * test/testComb.cc,testStrings.cc (Removed): Removed obsolete tests. Wed Apr 4 10:06:03 2001 Mark Fischler * Tools/Makefile.in (Removed): * Tools/RandMultiGauss.cc,RandMultiGauss.h (Removed): * Tools/RandomVector.cc,RandomVector.h (Removed): * Tools/RandomVector.icc (Removed): * RandomObjects/Makefile.in (Added): * RandomObjects/RandMultiGauss.cc,RandMultiGauss.h (Added): * RandomObjects/RandomVector.cc,RandomVector.h (Added): * RandomObjects/RandomVector.icc (Added): As agreed, we migrate the Tools involving Random and another CLHEP package into a package which I have chosen to name RandomObjects. RandomObjects in principle depends on Random, Matrix, and Vecgtor (though the tools that depend on Vector are not yet present). * Vector/AxisAngle.h,EulerAngles.h: Eliminated inconsistancy of virtual methods in no-virtual-destructor class. These classes should not be used polymorphically. * test/ranRestoreTest.cc,testRandDists.cc (Removed): * test/testRandDists.input,testRandDists.out.save (Removed): These were moved into Random/test * Random/test/GNUmakefile,gaussSmall.cc (Added): * Random/test/gaussSpeed.cc,ranRestoreTest.cc (Added): * Random/test/testRandDists.cc,testRandDists.dat (Added): * Random/test/testRandDists.input,testRandDists.input-long (Added): * Random/test/testRandDists.out.save (Added): Moved detailed and long tests into package-specific test area as agreed. * Vector/doc/VectorDefs.tex (Added): LaTeX documentation source for details of all the formulas and definitions in the Vector package. Tue Apr 3 11:36:23 2001 Mark Fischler * Vector/LorentzVector.h,LorentzVector.icc: inline operator const Hep3Vector & () const; to avoid errors on solaris CC 4.2 Fri Jan 19 16:07:15 2001 Evgueni Tcherniaev * Vector/Makefile.in: Added new *.cc files. * Vector/EulerAngles.h: Included "CLHEP/config/iostream.h" * Vector/AxisAngle.cc,AxisAngle.h,EulerAngles.h,EulerAngles.cc: * Vector/RotationInterfaces.h,RotationX.cc,RotationY.cc: * Vector/RotationZ.cc,TwoVector.cc,TwoVector.h: Changed std:: to HepStd:: * Vector/LorentzRotation.cc: Removed operators "using"; setw(), setprecision() changed to HepStd::setw(), HepStd::setprecision() ========================================================================== 18.01.01 ZOOM PhysicsVectors Capabilities have become part of CLHEP/Vector ========================================================================== Thu Jan 18 20:30:00 2001 Mark Fischler * ENTIRE_Vector_Package: Code for merge with capabilities of ZOOM PhysicsVectors. Mon Nov 6 16:25:21 2000 Evgueni Tcherniaev * Vector/LorentzVector.h,LorentzVector.icc: * test/testLorentzVector.cc: Correction in const conversion operator. Thanks to Leif.Lonnblad@thep.lu.se. * Evaluator/Evaluator.cc,Evaluator.h: More accurate usage of const. ====================================================================== 24.10.00 Generic Functions by Joe Boudreau have become a part of CLHEP ====================================================================== ============================== 20.10.00 Release CLHEP-1.6.0.0 ============================== ============================================================================== 12.10.00 Expression Evaluator by Evgueni Tcherniaev has become a part of CLHEP Alist, String and Combination have been disabled ============================================================================== ============================== 08.05.00 Release CLHEP-1.5.0.0 ============================== Sat May 6 08:48:17 2000 Evgueni Tcherniaev * Tools/Random/*.* (Removed): * Tools/Makefile.in,RandMultiGauss.cc,RandMultiGauss.h (Added): * Tools/RandomVector.cc,RandomVector.h,RandomVector.icc (Added): * test/testVectorDists.cc: RandMultiGauss and RandomVector have been moved to CLHEP/Tools. * Random/JamesRandom.cc: Commented unused "HepDouble uni;" * test/testVectorDists.cc: Added #include "CLHEP/config/TemplateFunctions.h" to ensure correct abs(double). * test/ranRestoreTest.cc: Changed std:: to HepStd:: * Makefile.in: * config/Makefile.common.in: Removed call of RANLIB. ============================================================ 24.04.00 StdHepC++ by Lynn Garren has become a part of CLHEP ============================================================ Wed Apr 5 10:16:40 2000 Evgueni Tcherniaev * Vector/LorentzVector.cc,ThreeVector.cc: operator(): removed "rdummy" - unnecessary reference to a static variable "dummy" * String/Strings.cc,Strings.h: HepString::operator+() has been declared as const. Thanks to Abi Soffer for the problem report. Added check for whether char* passed to operator= is "this" or not. Fix provided by Stephen J. Gowdy * test/testAList.cc,testComb.cc,testStrings.cc: Fixes of memory leaks provided by BaBar. * test/testCmd.cc: Output bool as with "true" or "false". Mon Mar 13 11:12:41 2000 Mark Fischler * Tools/Random/RandMultiGauss.cc,RandMultiGauss.h (Added): * Tools/Random/RandomVector.cc,RandomVector.h,RandomVector.icc (Added): * test/testVectorDists.cc,testVectorDists.input (Added): * test/testVectorDists.out.save (Added): The vector distribution RandMiultiGauss, this time in its proper place in Tools/Random and with a validity test in test. Thu Jan 27 15:21:27 2000 Evgueni Tcherniaev * Vector/ThreeVector.cc: rotateUz(): fix proposed by the Geant4 team to avoid accuracy problems noticed on DEC-cxx. Mon Oct 25 10:41:20 1999 Evgueni Tcherniaev * Vector/LorentzVector.cc,ThreeVector.cc: Added static in declaration of dummy in operator() * Vector/Rotation.cc: getAngleAxis(): added test for cos(a) < -1 Mon Jul 5 21:15:56 1999 Evgueni Tcherniaev * Vector/LorentzVector.h,LorentzVector.icc: Added 'const' to the parameter of rotateUz() Tue May 11 17:17:43 1999 Evgueni Tcherniaev * Vector/LorentzVector.cc,ThreeVector.cc: Simplified input from a stream. Removed coupling with HepString * test/testLorentzVector.input,testLorentzVector.out.save (Added): * testThreeVector.input testThreeVector.out.save (Added): * test/Makefile.in,testLorentzVector.cc,testThreeVector.cc: Added tests for input/output from/to a stream ============================== 20.04.99 Release CLHEP-1.4.0.0 ============================== Tue Feb 23 19:02:32 1999 Evgueni Tcherniaev * Vector/Rotation.cc: More efficient implementation of rotateX(), rotateY(), rotateZ() Mon Feb 22 15:56:41 1999 Evgueni Tcherniaev * Vector/Rotation.cc: More efficient implementation of rotate(angle, axis) * test/testRotation.cc (Added): * test/Makefile.in: Added test for HepRotation Thu Feb 18 12:19:13 1999 Evgueni Tcherniaev * Vector/ThreeVector.icc: More efficient implementation of setPhi(). Mon Feb 15 19:01:54 1999 Evgueni Tcherniaev * Vector/ThreeVector.cc,ThreeVector.h: Added const in the parameter list Wed Jan 27 17:14:28 1999 Evgueni Tcherniaev * Vector/LorentzVector.h,LorentzVector.icc: * test/testLorentzVector.cc: Added operator*= and operator* for scaling with HepDouble Thu Jan 14 15:14:40 1999 Evgueni Tcherniaev * Vector/: * LorentzRotation.h,LorentzRotation.icc,Rotation.h,Rotation.icc: Added missing const in operator[] * config/Makefile.common.in,test/Makefile.in: Removed -DCLHEP_TARGET_H=<...> to avoid problem on Linux Wed Jan 13 09:59:26 1999 Evgueni Tcherniaev * Vector/: * LorentzVector.cc,LorentzVector.h,ThreeVector.cc,ThreeVector.h: Added streaming operator >> * Vector/LorentzVector.h,LorentzVector.icc: Introduced setVectMag() and setVectM() functions. * Matrix/SymMatrix.cc,test/testInversion.cc: Removed declaration of unused variables Tue Jan 12 15:36:41 1999 Evgueni Tcherniaev * Vector/Rotation.h,LorentzRotation.h: Helper classes HepRotation_row and HepLorentzRotation_row moved to public to avoid warnings on SUN. * Vector/: * LorentzVector.cc,LorentzVector.h,ThreeVector.cc,ThreeVector.h: Introduced enum for save indexing of the coordinates. Thu Jan 7 15:20:22 1999 Evgueni Tcherniaev * Vector/ThreeVector.icc: More efficient implementation of setMag(). Fixed bug in angle() to protect from acos() of number greater than 1. * Vector/LorentzRotation.h,LorentzRotation.icc: Introduced transform(const HepRotation &) for pure spacelike rotation. ========================================================================= 16.12.98 Started: merging with BaBar version of CLHEP provided by G.Cosmo ========================================================================= Fri Dec 11 11:58:09 1998 Evgueni Tcherniaev * config/CLHEP.h: * Matrix/Matrix.cc,Matrix.h,Vector.cc,Vector.h: * tests/testMatrix.cc: Introduced HEP_USE_VECTOR_MODULE flag to facilitate disabling dependence between the Matrix and Vector modules * Utilities/CLHEP.h: Added config/TemplateFuntions.h by request of G.Cosmo Fri Oct 9 10:43:33 1998 Evgueni Tcherniaev * Vector/LorentzVector.h,LorentzVector.icc,ThreeVector.cc: Added transverse mass mt=sqrt(perp2()+m2()) Thu Oct 8 15:47:44 1998 Evgueni Tcherniaev * Vector/ThreeVector.h,ThreeVector.cc: Added pseudoRapidity() * Vector/LorentzVector.cc,LorentzVector.h,LorentzVector.icc: Added rapidity() and pseudoRapidity() Sun Sep 27 19:58:43 1998 Evgueni Tcherniaev * Vector/: * ThreeVector.h,ThreeVector.icc,ThreeVector.cc: * LorentzVector.h,LorentzVector.icc,LorentzVector.cc: Added operator[] to read/write the vector components by index * Vector/: * LorentzRotation.cc,LorentzRotation.h,LorentzRotation.icc: * Rotation.cc,Rotation.h,Rotation.icc: Added C-style subscripts r[i][j] * test/Makefile.in: * test/testSubscripts.cc (Added): Test for subscripts for the classes from the Vector module Mon Sep 14 15:24:00 1998 Evgueni Tcherniaev * config/TemplateFunctions.h: Included #undef for possible existing min/max/sqr/abs macros * Units/SystemOfUnits.h: Added angstrom, picobarn, microsecond, picosecond, petaelectronvolt * Vector/: * ThreeVector.h,ThreeVector.icc,LorentzVector.h,LorentzVector.icc: Added setPerp() by request of LHCB. ========================== 28.07.98 Release CLHEP-1.3 ========================== Tue Jul 14 09:05:20 1998 Evgueni Tcherniaev * config/TemplateFunctions.h (Added): min(), max(), abs(), sqr() moved from CLHEP.h to TemplateFunctions.h * config/CLHEP.h: * Geometry/Transform3D.cc: * Random/RandBreitWigner.cc,RanecuEngine.cc: * String/Strings.cc: * Vector/Rotation.cc: * test/: * testLorentzVector.cc,testMinMaxSqrAbs.cc,testStrings.cc: * testThreeVector.cc: min(), max(), abs(), sqr() moved from CLHEP.h to TemplateFunctions.h Thu Apr 9 15:47:33 1998 Evgueni Tcherniaev * Geometry/Plane3D.h: Rewritten operator ==, added operator != * Vector/ThreeVector.icc: Removed call of abs() and sqr() * Makefile.in: "distclean" target now does not erase "configure" ========================== 05.02.98 Release CLHEP-1.2 ========================== Tue Dec 16 11:24:16 1997 Evgueni Tcherniaev * Vector/LorentzVector.h,LorentzVector.icc: Added another cast operator; bug fix in m() * Geometry/Point3D.h: Added const for distance() and distance2() ======================================================== 08.12.97 Release CLHEP-1.1: Geant4 has migrated to CLHEP ======================================================== Fri Dec 5 09:28:25 1997 Evgueni Tcherniaev * Units/PhysicalConstants.h,SystemOfUnits.h: Removed all HepUnitOf... Redefined pascal Replaced pasc to pascal Added km, km2, km3 and mg * Vector/: * LorentzRotation.cc,LorentzRotation.h,LorentzRotation.icc: * LorentzVector.cc,LorentzVector.h,LorentzVector.icc: New implementation without inheritance from Hep3Vector and HepRotation * test/testLorentzVector.cc: Corrections caused by new implementation of HepLorentzVector and HepLorentzRotation Tue Nov 18 10:03:37 1997 Evgueni Tcherniaev * Vector/Rotation.cc: Bug fix in phiX(), phiY() and phiZ() * Vector/: * Rotation.cc,Rotation.h,Rotation.icc,ThreeVector.cc: * ThreeVector.h,ThreeVector.icc: Changes in comments Mon Oct 6 18:04:21 1997 Evgueni Tcherniaev * test/testThreeVector.cc,testMatrix.cc: Changes in comments Fri Sep 26 16:35:31 1997 Evgueni Tcherniaev * Vector/Rotation.h,Rotation.icc,Rotation.cc: Added operator(int,int) Removed inline from *.cc Bug fix in getAngleAxis() - Thanks to Joe Boudreau * Vector/ThreeVector.h,ThreeVector.icc,ThreeVector.cc: Removed friend classes HepPOStream, HepPIStream * Geometry/Transform3D.cc: Bug fix in HepTransform3D(double,...,double) Thanks to Brian Heltsley Small optimization in HepTransform3D(Point3D,...,Point3D) Wed Aug 20 16:28:15 1997 Evgueni Tcherniaev * Vector/LorentzRotation.h,LorentzVector.h,Rotation.h,ThreeVector.h: Removed friend HepPOStream & friend HepPIStream Fri Mar 14 18:19:29 1997 Nobu Katayama - Vector added more functionality from Geant4 and Babar - New Random from Geant4 clhep-2.1.4.1.orig/Vector/CMakeLists.txt0000644000175000017500000000044411672427737016421 0ustar olesoles# main Vector cmake instructions # automake/autoconf variables set( PACKAGE Vector ) clhep_package_config() add_subdirectory(Vector) add_subdirectory(src) add_subdirectory(test) if ( CLHEP_BUILD_DOCS ) message(STATUS "building documents for ${PACKAGE}" ) add_subdirectory(doc) endif() clhep-2.1.4.1.orig/Vector/Vector-deps.in0000755000175000017500000000014510043350425016361 0ustar olesolesCLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Units-@VERSION@ clhep-2.1.4.1.orig/Vector/autotools/0000755000175000017500000000000012242515214015666 5ustar olesolesclhep-2.1.4.1.orig/Vector/autotools/.cvsignore0000755000175000017500000000010107705060311017662 0ustar olesolesconfig.sub config.guess depcomp install-sh missing mkinstalldirs clhep-2.1.4.1.orig/Vector/autotools/ltmain.sh0000755000175000017500000057547210234000243017523 0ustar olesoles# Generated from ltmain.in; do not edit by hand # ltmain.sh (GNU libtool) 1.9b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: powerpc-apple-darwin7.5.0 # shell: $SHELL # compiler: $LTCC # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 1.9b # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST elif test -n "${BASH_VERSION+set}${KSH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh dirname="s,/[^/]*$,," basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: PROGRAM=ltmain.sh progname=`echo "$progpath" | $SED "$basename"` # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *) progdir=`echo "$progpath" | $SED "$dirname"` progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; esac # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.9b TIMESTAMP="" package_revision=1.1571 # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $echo $progname${mode+: }$mode: warning: ${1+"$@"} 1>&2 } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } # func_version # Echo version message to standard output and exit. func_version () { $SED '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# //; s/^# *$//; s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED '/^# Usage:/,/# -h/ { s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" echo echo "run \`$progname --help | more' for full usage" exit $EXIT_SUCCESS } # func_help # Echo long help message to standard output and exit. func_help () { $SED '/^# Usage:/,/# Report bugs to/ { s/^# //; s/^# *$//; s:\$progname:'$progname':; s:\$SHELL:'"$SHELL"':; s:\$LTCC:'"$LTCC"':; s:\$LD:'"$LD"':; s/\$with_gnu_ld/'"$with_gnu_ld"'/; s/\$automake_version/'"`automake --version 2>/dev/null |$SED 1q`"'/; s/\$autoconf_version/'"`autoconf --version 2>/dev/null |$SED 1q`"'/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $EXIT_SUCCESS } # func_features # Display the features supported by this script. func_features () { $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable "`\"foo\"`", so we have to do # it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $echo \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $echo $echo "Try \`$progname --help' for more information about other modes." exit $EXIT_SUCCESS } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # sed scripts: my_sed_single_opt='1s/^\(..\).*$/\1/;q' my_sed_single_rest='1s/^..\(.*\)$/\1/;q' my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' exit_cmd=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set -- --mode clean ${1+"$@"} ;; compile|compil|compi|comp|com|co|c) shift; set -- --mode compile ${1+"$@"} ;; execute|execut|execu|exec|exe|ex|e) shift; set -- --mode execute ${1+"$@"} ;; finish|finis|fini|fin|fi|f) shift; set -- --mode finish ${1+"$@"} ;; install|instal|insta|inst|ins|in|i) shift; set -- --mode install ${1+"$@"} ;; link|lin|li|l) shift; set -- --mode link ${1+"$@"} ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set -- --mode uninstall ${1+"$@"} ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" set -x ;; --dlopen) test $# -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" ;; --dry-run | -n) run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test $# -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" show=: ;; --tag) test $# -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: --dlopen=*|--mode=*|--tag=*) arg=`echo "$opt" | $SED "$my_sed_long_arg"` opt=`echo "$opt" | $SED "$my_sed_long_opt"` set -- "$opt" "$arg" ${1+"$@"} ;; # Separate optargs to short options: # -x*|-y*) # arg=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "$arg" ${1+"$@"} # ;; # Separate non-argument short options: # -z*|-z*|-y*) # rest=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "-$rest" ${1+"$@"} # ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`echo "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$my_dlsyms" test -z "$run" && $echo > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do $show "extracting global C symbols from \`$progfile'" $run eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for dlprefile in $dlprefiles; do $show "extracting global C symbols from \`$dlprefile'" name=`$echo "$dlprefile" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ const struct { const char *originator; const struct { const char *name; void *address; } symbols[]; } lt_${my_prefix}_LTX_preloaded_symbols = {\ \"$my_originator\", { " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" $echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} } }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" status=$? if test "$status" -ne 0 && test ! -d "$my_xdir"; then exit $status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename $darwin_archive` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" # Remove the table of contents from the thin files. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" $AR -xo "${darwin_base_archive}" rm "${darwin_base_archive}" cd "$darwin_curdir" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist rm -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir (cd $my_xdir && $AR x $my_xabs) || exit $? fi # $darwin_arches fi # $run ;; *) # We will extract separately just the conflicting names and we will # no longer touch any unique names. It is faster to leave these # extract automatically by $AR in one run. $show "(cd $my_xdir && $AR x $my_xabs)" $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; renaming object files" func_warning "to ensure that they will not overwrite" $AR t "$my_xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_mode_compile arg... func_mode_compile () { # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1 || \ func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi } # func_mode_finish arg... func_mode_finish () { libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit $EXIT_SUCCESS } # func_mode_install arg... func_mode_install () { # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files test "$#" -gt 2 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. (${SED} -e '2q' $file | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1 || \ func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" $show "$relink_command" $run eval "$relink_command" || \ func_fatal_error "error: relink \`$file' with the above command before installing it" fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | $GREP "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. test -z "$notinst_deplibs" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask func_error "error: cannot create temporary directory \`$tmpdir'" continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" ${rm}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } # func_mode_link arg... func_mode_link () { case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static # See comment for -static flag below, for more details. compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" || \ func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else func_fatal_error "link input file \`$save_arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) # The effects of -all-static are defined in a previous loop. continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs $inherited_linker_flags" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *[\\/]*.la) . $lib ;; *.la) . ./$lib ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`echo "$deplib" |$SED "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$inherited_linker_flags " in *" $deplib "*) ;; * ) inherited_linker_flags="$inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $lib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not use here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib'" fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then : else func_fatal_error "\`$lib' is not a valid libtool archive" fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac case $host in *-*-darwin*) # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then inherited_linker_flags=`$echo "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` fi dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP "bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $echo "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "*** And there doesn't seem to be a static archive available" $echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs $inherited_linker_flags; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" eval darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//' | xargs` compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for archives" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath test "$#" -gt 2 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" test -n "$8" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "AGE \`$age' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | ${SED} 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null | ${SED} 10q | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` inherited_linker_flags=`$echo "X $inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$echo "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`echo "$output" | $SED $basename` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnk $echo "creating GNU ld script: $output" $echo 'INPUT (' > $output for obj in $save_libobjs do $echo \""$obj"\" >> $output done $echo ')' >> $output else $echo "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for objects" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; struct stat st; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$dlsymsobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; overriding AR_FLAGS to 'cq'" func_warning "to ensure that POSIX-compatible ar will work" AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS } # func_mode_uninstall arg... func_mode_uninstall () { rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done test -z "$rm" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 || (test -h "$file") >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status } ## ----------- ## ## Main. ## ## ----------- ## { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." case $mode in compile) func_mode_compile ${1+"$@"} ;; execute) func_mode_execute ${1+"$@"} ;; finish) func_mode_finish ${1+"$@"} ;; install) func_mode_install ${1+"$@"} ;; link|relink) func_mode_link ${1+"$@"} ;; uninstall|clean) func_mode_uninstall ${1+"$@"} ;; "") help="$generic_help" func_fatal_help "you must specify a MODE" ;; esac test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi } exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: clhep-2.1.4.1.orig/Vector/src/0000755000175000017500000000000012242515214014424 5ustar olesolesclhep-2.1.4.1.orig/Vector/src/RotationXYZ.cc0000755000175000017500000000130507716514316017163 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of global methods involving HepRotationX, Y, or Z // along with HepRotation. // #ifdef GNUPRAGMA #pragma implementation #endif #if 0 #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Vector/RotationX.h" #include "CLHEP/Vector/RotationY.h" #include "CLHEP/Vector/RotationZ.h" #endif // 0 namespace CLHEP { // RotationX related // ----------------- // RotationY related // ----------------- // RotationZ related // ----------------- } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/RotationIO.cc0000755000175000017500000000234507716514316017005 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of the output method of the HepRotation class, // which was introduced when ZOOM PhysicsVectors was merged in. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/Rotation.h" #include #include namespace CLHEP { std::ostream & HepRotation::print( std::ostream & os ) const { os << "\n [ ( " << std::setw(11) << std::setprecision(6) << xx() << " " << std::setw(11) << std::setprecision(6) << xy() << " " << std::setw(11) << std::setprecision(6) << xz() << ")\n" << " ( " << std::setw(11) << std::setprecision(6) << yx() << " " << std::setw(11) << std::setprecision(6) << yy() << " " << std::setw(11) << std::setprecision(6) << yz() << ")\n" << " ( " << std::setw(11) << std::setprecision(6) << zx() << " " << std::setw(11) << std::setprecision(6) << zy() << " " << std::setw(11) << std::setprecision(6) << zz() << ") ]\n"; return os; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/ThreeVectorR.cc0000755000175000017500000000162611761726606017335 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of those methods of the Hep3Vector class which // require linking of the HepRotation class. These methods have been broken // out of ThreeVector.cc. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Vector/Rotation.h" namespace CLHEP { Hep3Vector & Hep3Vector::operator *= (const HepRotation & m1) { return *this = m1 * (*this); } Hep3Vector & Hep3Vector::transform(const HepRotation & m1) { return *this = m1 * (*this); } Hep3Vector & Hep3Vector::rotate(double angle1, const Hep3Vector & aaxis){ HepRotation trans; trans.rotate(angle1, aaxis); operator*=(trans); return *this; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/ThreeVector.cc0000755000175000017500000002204411753232637017205 0ustar olesoles// -*- C++ -*- // $Id: ThreeVector.cc,v 1.3 2003/08/13 20:00:14 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of the Hep3Vector class. // // See also ThreeVectorR.cc for implementation of Hep3Vector methods which // would couple in all the HepRotation methods. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Vector/ZMxpv.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include namespace CLHEP { void Hep3Vector::setMag(double ma) { double factor = mag(); if (factor == 0) { ZMthrowA ( ZMxpvZeroVector ( "Hep3Vector::setMag : zero vector can't be stretched")); }else{ factor = ma/factor; setX(x()*factor); setY(y()*factor); setZ(z()*factor); } } double Hep3Vector::operator () (int i) const { switch(i) { case X: return x(); case Y: return y(); case Z: return z(); default: std::cerr << "Hep3Vector subscripting: bad index (" << i << ")" << std::endl; } return 0.; } double & Hep3Vector::operator () (int i) { static double dummy; switch(i) { case X: return dx; case Y: return dy; case Z: return dz; default: std::cerr << "Hep3Vector subscripting: bad index (" << i << ")" << std::endl; return dummy; } } Hep3Vector & Hep3Vector::rotateUz(const Hep3Vector& NewUzVector) { // NewUzVector must be normalized ! double u1 = NewUzVector.x(); double u2 = NewUzVector.y(); double u3 = NewUzVector.z(); double up = u1*u1 + u2*u2; if (up>0) { up = std::sqrt(up); double px = dx, py = dy, pz = dz; dx = (u1*u3*px - u2*py)/up + u1*pz; dy = (u2*u3*px + u1*py)/up + u2*pz; dz = -up*px + u3*pz; } else if (u3 < 0.) { dx = -dx; dz = -dz; } // phi=0 teta=pi else {}; return *this; } double Hep3Vector::pseudoRapidity() const { double m1 = mag(); if ( m1== 0 ) return 0.0; if ( m1== z() ) return 1.0E72; if ( m1== -z() ) return -1.0E72; return 0.5*std::log( (m1+z())/(m1-z()) ); } std::ostream & operator<< (std::ostream & os, const Hep3Vector & v) { return os << "(" << v.x() << "," << v.y() << "," << v.z() << ")"; } void ZMinput3doubles ( std::istream & is, const char * type, double & x, double & y, double & z ); std::istream & operator>>(std::istream & is, Hep3Vector & v) { double x, y, z; ZMinput3doubles ( is, "Hep3Vector", x, y, z ); v.set(x, y, z); return is; } // operator>>() const Hep3Vector HepXHat(1.0, 0.0, 0.0); const Hep3Vector HepYHat(0.0, 1.0, 0.0); const Hep3Vector HepZHat(0.0, 0.0, 1.0); //------------------- // // New methods introduced when ZOOM PhysicsVectors was merged in: // //------------------- Hep3Vector & Hep3Vector::rotateX (double phi1) { double sinphi = std::sin(phi1); double cosphi = std::cos(phi1); double ty; ty = dy * cosphi - dz * sinphi; dz = dz * cosphi + dy * sinphi; dy = ty; return *this; } /* rotateX */ Hep3Vector & Hep3Vector::rotateY (double phi1) { double sinphi = std::sin(phi1); double cosphi = std::cos(phi1); double tz; tz = dz * cosphi - dx * sinphi; dx = dx * cosphi + dz * sinphi; dz = tz; return *this; } /* rotateY */ Hep3Vector & Hep3Vector::rotateZ (double phi1) { double sinphi = std::sin(phi1); double cosphi = std::cos(phi1); double tx; tx = dx * cosphi - dy * sinphi; dy = dy * cosphi + dx * sinphi; dx = tx; return *this; } /* rotateZ */ bool Hep3Vector::isNear(const Hep3Vector & v, double epsilon) const { double limit = dot(v)*epsilon*epsilon; return ( (*this - v).mag2() <= limit ); } /* isNear() */ double Hep3Vector::howNear(const Hep3Vector & v ) const { // | V1 - V2 | **2 / V1 dot V2, up to 1 double d = (*this - v).mag2(); double vdv = dot(v); if ( (vdv > 0) && (d < vdv) ) { return std::sqrt (d/vdv); } else if ( (vdv == 0) && (d == 0) ) { return 0; } else { return 1; } } /* howNear */ double Hep3Vector::deltaPhi (const Hep3Vector & v2) const { double dphi = v2.getPhi() - getPhi(); if ( dphi > CLHEP::pi ) { dphi -= CLHEP::twopi; } else if ( dphi <= -CLHEP::pi ) { dphi += CLHEP::twopi; } return dphi; } /* deltaPhi */ double Hep3Vector::deltaR ( const Hep3Vector & v ) const { double a = eta() - v.eta(); double b = deltaPhi(v); return std::sqrt ( a*a + b*b ); } /* deltaR */ double Hep3Vector::cosTheta(const Hep3Vector & q) const { double arg; double ptot2 = mag2()*q.mag2(); if(ptot2 <= 0) { arg = 0.0; }else{ arg = dot(q)/std::sqrt(ptot2); if(arg > 1.0) arg = 1.0; if(arg < -1.0) arg = -1.0; } return arg; } double Hep3Vector::cos2Theta(const Hep3Vector & q) const { double arg; double ptot2 = mag2(); double qtot2 = q.mag2(); if ( ptot2 == 0 || qtot2 == 0 ) { arg = 1.0; }else{ double pdq = dot(q); arg = (pdq/ptot2) * (pdq/qtot2); // More naive methods overflow on vectors which can be squared // but can't be raised to the 4th power. if(arg > 1.0) arg = 1.0; } return arg; } void Hep3Vector::setEta (double eta1) { double phi1 = 0; double r1; if ( (dx == 0) && (dy == 0) ) { if (dz == 0) { ZMthrowC (ZMxpvZeroVector( "Attempt to set eta of zero vector -- vector is unchanged")); return; } ZMthrowC (ZMxpvZeroVector( "Attempt to set eta of vector along Z axis -- will use phi = 0")); r1 = std::fabs(dz); } else { r1 = getR(); phi1 = getPhi(); } double tanHalfTheta = std::exp ( -eta1 ); double cosTheta1 = (1 - tanHalfTheta*tanHalfTheta) / (1 + tanHalfTheta*tanHalfTheta); dz = r1 * cosTheta1; double rho1 = r1*std::sqrt(1 - cosTheta1*cosTheta1); dy = rho1 * std::sin (phi1); dx = rho1 * std::cos (phi1); return; } void Hep3Vector::setCylTheta (double theta1) { // In cylindrical coords, set theta while keeping rho and phi fixed if ( (dx == 0) && (dy == 0) ) { if (dz == 0) { ZMthrowC (ZMxpvZeroVector( "Attempt to set cylTheta of zero vector -- vector is unchanged")); return; } if (theta1 == 0) { dz = std::fabs(dz); return; } if (theta1 == CLHEP::pi) { dz = -std::fabs(dz); return; } ZMthrowC (ZMxpvZeroVector( "Attempt set cylindrical theta of vector along Z axis " "to a non-trivial value, while keeping rho fixed -- " "will return zero vector")); dz = 0; return; } if ( (theta1 < 0) || (theta1 > CLHEP::pi) ) { ZMthrowC (ZMxpvUnusualTheta( "Setting Cyl theta of a vector based on a value not in [0, PI]")); // No special return needed if warning is ignored. } double phi1 (getPhi()); double rho1 = getRho(); if ( (theta1 == 0) || (theta1 == CLHEP::pi) ) { ZMthrowC (ZMxpvInfiniteVector( "Attempt to set cylindrical theta to 0 or PI " "while keeping rho fixed -- infinite Z will be computed")); dz = (theta1==0) ? 1.0E72 : -1.0E72; return; } dz = rho1 / std::tan (theta1); dy = rho1 * std::sin (phi1); dx = rho1 * std::cos (phi1); } /* setCylTheta */ void Hep3Vector::setCylEta (double eta1) { // In cylindrical coords, set eta while keeping rho and phi fixed double theta1 = 2 * std::atan ( std::exp (-eta1) ); //-| The remaining code is similar to setCylTheta, The reason for //-| using a copy is so as to be able to change the messages in the //-| ZMthrows to say eta rather than theta. Besides, we assumedly //-| need not check for theta of 0 or PI. if ( (dx == 0) && (dy == 0) ) { if (dz == 0) { ZMthrowC (ZMxpvZeroVector( "Attempt to set cylEta of zero vector -- vector is unchanged")); return; } if (theta1 == 0) { dz = std::fabs(dz); return; } if (theta1 == CLHEP::pi) { dz = -std::fabs(dz); return; } ZMthrowC (ZMxpvZeroVector( "Attempt set cylindrical eta of vector along Z axis " "to a non-trivial value, while keeping rho fixed -- " "will return zero vector")); dz = 0; return; } double phi1 (getPhi()); double rho1 = getRho(); dz = rho1 / std::tan (theta1); dy = rho1 * std::sin (phi1); dx = rho1 * std::cos (phi1); } /* setCylEta */ Hep3Vector operator/ ( const Hep3Vector & v1, double c ) { if (c == 0) { ZMthrowA ( ZMxpvInfiniteVector ( "Attempt to divide vector by 0 -- " "will produce infinities and/or NANs")); } double oneOverC = 1.0/c; return Hep3Vector ( v1.x() * oneOverC, v1.y() * oneOverC, v1.z() * oneOverC ); } /* v / c */ Hep3Vector & Hep3Vector::operator/= (double c) { if (c == 0) { ZMthrowA (ZMxpvInfiniteVector( "Attempt to do vector /= 0 -- " "division by zero would produce infinite or NAN components")); } double oneOverC = 1.0/c; dx *= oneOverC; dy *= oneOverC; dz *= oneOverC; return *this; } double Hep3Vector::tolerance = Hep3Vector::ToleranceTicks * 2.22045e-16; } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/LorentzVectorB.cc0000755000175000017500000000443011753232637017674 0ustar olesoles// -*- C++ -*- // $Id: LorentzVectorB.cc,v 1.2 2003/08/13 20:00:14 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of the HepLorentzVector class: // Those methods originating in ZOOM dealing with simple boosts and rotations. // Use of one of these methods will not force loading of the HepRotation or // HepLorentzRotation class. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Vector/ZMxpv.h" namespace CLHEP { //-********* // rotationOf() //-********* // Each of these is a shell over a rotate method. HepLorentzVector rotationXOf (const HepLorentzVector & vec, double phi){ HepLorentzVector vv (vec); return vv.rotateX (phi); } HepLorentzVector rotationYOf (const HepLorentzVector & vec, double phi){ HepLorentzVector vv (vec); return vv.rotateY (phi); } HepLorentzVector rotationZOf (const HepLorentzVector & vec, double phi){ HepLorentzVector vv (vec); return vv.rotateZ (phi); } //-******** // boost //-******** HepLorentzVector & HepLorentzVector::boost ( const Hep3Vector & aaxis, double bbeta ) { if (bbeta==0) { return *this; // do nothing for a 0 boost } double r2 = aaxis.mag2(); if ( r2 == 0 ) { ZMthrowA (ZMxpvZeroVector( "A zero vector used as axis defining a boost -- no boost done")); return *this; } double b2 = bbeta*bbeta; if (b2 >= 1) { ZMthrowA (ZMxpvTachyonic( "LorentzVector boosted with beta >= 1 (speed of light) -- \n" "no boost done")); } else { Hep3Vector u = aaxis.unit(); register double ggamma = std::sqrt(1./(1.-b2)); register double betaDotV = u.dot(pp)*bbeta; register double tt = ee; ee = ggamma * (tt + betaDotV); pp += ( ((ggamma-1)/b2)*betaDotV*bbeta + ggamma*bbeta*tt ) * u; // Note: I have verified the behavior of this even when beta is very // small -- (gamma-1)/b2 becomes inaccurate by O(1), but it is then // multiplied by O(beta**2) and added to an O(beta) term, so the // inaccuracy does not affect the final result. } return *this; } /* boost (axis, beta) */ } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/ZMinput.cc0000755000175000017500000002020507716514316016357 0ustar olesoles#include "CLHEP/Vector/defs.h" #include #include namespace { bool eatwhitespace ( std::istream & is ) { // Will discard whitespace until it either encounters EOF or bad input // (in which case it will return false) or it hits a non-whitespace. // Will put that non whitespace character back so that after this routine // returns true, is.get(c) should always work. // If eatwhitespace returns false, is will always be in a fail or bad state. char c; bool avail = false; // avail stays false until we know there is a nonwhite // character available. while ( is.get(c) ) { if ( !isspace(c) ) { is.putback(c); avail = true; break; } } return avail; } void fouledup() { std::cerr << "istream mysteriously lost a putback character!\n"; } } // end of unnamed namespace namespace CLHEP { void ZMinput3doubles ( std::istream & is, const char * type, double & x, double & y, double & z ) { // Accepted formats are // x y z // x, y, z (each comma is optional, and whitespace ignored if comma present) // ( x, y, z ) (commas optional) char c; bool parenthesis = false; if ( !eatwhitespace(is) ) { std::cerr << "istream ended before trying to input " << type << "\n"; return; } if ( !is.get(c) ) { fouledup(); return; } if ( c == '(' ) { parenthesis = true; if ( !eatwhitespace(is) ) { std::cerr << "istream ended after ( trying to input " << type << "\n"; return; } } else { is.putback(c); } // At this point, parenthesis or not, the next item read is supposed to // be the number x. if (!(is >> x)) { std::cerr << "Could not read first value in input of " << type << "\n"; return; } if ( !eatwhitespace(is) ) { std::cerr << "istream ended before second value of " << type << "\n"; return; } if ( !is.get(c) ) { fouledup(); return; } if ( c == ',' ) { if ( !eatwhitespace(is) ) { std::cerr << "istream ended ater one value and comma in " << type << "\n"; return; } } else { is.putback(c); } // At this point, comma or not, the next item read is supposed to // be the number y. if (!(is >> y)) { std::cerr << "Could not read second value in input of " << type << "\n"; return; } if ( !eatwhitespace(is) ) { std::cerr << "istream ended before third value of " << type << "\n"; return; } if ( !is.get(c) ) { fouledup(); return; } if ( c == ',' ) { if ( !eatwhitespace(is) ) { std::cerr << "istream ended ater two values and comma in " << type << "\n"; return; } } else { is.putback(c); } // At this point, comma or not, the next item read is supposed to // be the number z. if (!(is >> z)) { std::cerr << "Could not read third value in input of " << type << "\n"; return; } // Finally, check for the closing parenthesis if there was an open paren. if (parenthesis) { if ( !eatwhitespace(is) ) { std::cerr << "No closing parenthesis in input of " << type << "\n"; return; } if ( !is.get(c) ) { fouledup(); return; } if ( c != ')' ) { std::cerr << "Missing closing parenthesis in input of " << type << "\n"; // Now a trick to do (as nearly as we can) what // is.putback(c); is.setstate(std::ios_base::failbit); // would do (because using ios_base will confuse old CLHEP compilers): if ( isdigit(c) || (c=='-') || (c=='+') ) { is.putback('@'); } else { is.putback('c'); } int m; is >> m; // This fails, leaving the state bad, and the istream // otherwise unchanged, except if the next char might // have started a valid int, it turns to @ return; } } return; } void ZMinputAxisAngle ( std::istream & is, double & x, double & y, double & z, double & delta ) { // Accepted formats are // parenthesis optional, then // any acceptable format for a Hep3Vector, then // optional comma, then // delta, then // close parenthesis if opened at start. // // But if there is an open parenthesis, it must be for the overall // object. That is, if the axis has parentheses, the form must be // ( (x,y,z) , delta ) char c; bool parenthesis = false; if ( !eatwhitespace(is) ) { std::cerr << "istream ended before trying to input AxisAngle \n"; return; } if ( !is.get(c) ) { fouledup(); return; } if ( c == '(' ) { parenthesis = true; if ( !eatwhitespace(is) ) { std::cerr << "istream ended after ( trying to input AxisAngle \n"; return; } } else { is.putback(c); } // At this point, parenthesis or not, the next item read is supposed to // be a valid Hep3Vector axis. ZMinput3doubles ( is, "axis of AxisAngle", x, y, z ); if (!is) return; if ( !eatwhitespace(is) ) { std::cerr << "istream ended before delta of AxisAngle \n"; return; } if ( !is.get(c) ) { fouledup(); return; } if ( c == ',' ) { if ( !eatwhitespace(is) ) { std::cerr << "istream ended ater axis and comma in AxisAngle \n"; return; } } else { is.putback(c); } // At this point, comma or not, the next item read is supposed to // be the number delta. if (!(is >> delta)) { std::cerr << "Could not delta value in input of AxisAngle \n"; return; } // Finally, check for the closing parenthesis if there was an open paren. if (parenthesis) { if ( !eatwhitespace(is) ) { std::cerr << "No closing parenthesis in input of AxisAngle \n"; return; } if ( !is.get(c) ) { fouledup(); return; } if ( c != ')' ) { std::cerr << "Missing closing parenthesis in input of AxisAngle \n"; if ( isdigit(c) || (c=='-') || (c=='+') ) { is.putback('@'); } else { is.putback('c'); } int m; is >> m; // This fails, leaving the state bad. return; } } return; } void ZMinput2doubles ( std::istream & is, const char * type, double & x, double & y ) { // Accepted formats are // x y // x, y (comma is optional, and whitespace ignored if comma present) // ( x, y ) (comma optional) char c; bool parenthesis = false; if ( !eatwhitespace(is) ) { std::cerr << "istream ended before trying to input " << type << "\n"; return; } if ( !is.get(c) ) { fouledup(); return; } if ( c == '(' ) { parenthesis = true; if ( !eatwhitespace(is) ) { std::cerr << "istream ended after ( trying to input " << type << "\n"; return; } } else { is.putback(c); } // At this point, parenthesis or not, the next item read is supposed to // be the number x. if (!(is >> x)) { std::cerr << "Could not read first value in input of " << type << "\n"; return; } if ( !eatwhitespace(is) ) { std::cerr << "istream ended before second value of " << type << "\n"; return; } if ( !is.get(c) ) { fouledup(); return; } if ( c == ',' ) { if ( !eatwhitespace(is) ) { std::cerr << "istream ended ater one value and comma in " << type << "\n"; return; } } else { is.putback(c); } // At this point, comma or not, the next item read is supposed to // be the number y. if (!(is >> y)) { std::cerr << "Could not read second value in input of " << type << "\n"; return; } // Finally, check for the closing parenthesis if there was an open paren. if (parenthesis) { if ( !eatwhitespace(is) ) { std::cerr << "No closing parenthesis in input of " << type << "\n"; return; } if ( !is.get(c) ) { fouledup(); return; } if ( c != ')' ) { std::cerr << "Missing closing parenthesis in input of " << type << "\n"; // Now a trick to do (as nearly as we can) what // is.putback(c); is.setstate(std::ios_base::failbit); // would do (because using ios_base will confuse old CLHEP compilers): if ( isdigit(c) || (c=='-') || (c=='+') ) { is.putback('@'); } else { is.putback('c'); } int m; is >> m; // This fails, leaving the state bad, and the istream // otherwise unchanged, except if the next char might // have started a valid int, it turns to @ return; } } return; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/LorentzVectorC.cc0000755000175000017500000001645411753232637017706 0ustar olesoles// -*- C++ -*- // $Id: LorentzVectorC.cc,v 1.4 2010/06/16 17:15:57 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of the HepLorentzVector class: // Those methods originating with ZOOM dealing with comparison (other than // isSpaceLike, isLightlike, isTimelike, which are in the main part.) // // 11/29/05 mf in deltaR, replaced the direct subtraction // pp.phi() - w.getV().phi() with pp.deltaRPhi(w.getV()) which behaves // correctly across the 2pi boundary. #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/LorentzVector.h" #include namespace CLHEP { //-*********** // Comparisons //-*********** int HepLorentzVector::compare (const HepLorentzVector & w) const { if ( ee > w.ee ) { return 1; } else if ( ee < w.ee ) { return -1; } else { return ( pp.compare(w.pp) ); } } /* Compare */ bool HepLorentzVector::operator > (const HepLorentzVector & w) const { return (compare(w) > 0); } bool HepLorentzVector::operator < (const HepLorentzVector & w) const { return (compare(w) < 0); } bool HepLorentzVector::operator>= (const HepLorentzVector & w) const { return (compare(w) >= 0); } bool HepLorentzVector::operator<= (const HepLorentzVector & w) const { return (compare(w) <= 0); } //-******** // isNear // howNear //-******** bool HepLorentzVector::isNear(const HepLorentzVector & w, double epsilon) const { double limit = std::fabs(pp.dot(w.pp)); limit += .25*((ee+w.ee)*(ee+w.ee)); limit *= epsilon*epsilon; double delta = (pp - w.pp).mag2(); delta += (ee-w.ee)*(ee-w.ee); return (delta <= limit ); } /* isNear() */ double HepLorentzVector::howNear(const HepLorentzVector & w) const { double wdw = std::fabs(pp.dot(w.pp)) + .25*((ee+w.ee)*(ee+w.ee)); double delta = (pp - w.pp).mag2() + (ee-w.ee)*(ee-w.ee); if ( (wdw > 0) && (delta < wdw) ) { return std::sqrt (delta/wdw); } else if ( (wdw == 0) && (delta == 0) ) { return 0; } else { return 1; } } /* howNear() */ //-********* // isNearCM // howNearCM //-********* bool HepLorentzVector::isNearCM (const HepLorentzVector & w, double epsilon) const { double tTotal = (ee + w.ee); Hep3Vector vTotal (pp + w.pp); double vTotal2 = vTotal.mag2(); if ( vTotal2 >= tTotal*tTotal ) { // Either one or both vectors are spacelike, or the dominant T components // are in opposite directions. So boosting and testing makes no sense; // but we do consider two exactly equal vectors to be equal in any frame, // even if they are spacelike and can't be boosted to a CM frame. return (*this == w); } if ( vTotal2 == 0 ) { // no boost needed! return (isNear(w, epsilon)); } // Find the boost to the CM frame. We know that the total vector is timelike. double tRecip = 1./tTotal; Hep3Vector bboost ( vTotal * (-tRecip) ); //-| Note that you could do pp/t and not be terribly inefficient since //-| SpaceVector/t itself takes 1/t and multiplies. The code here saves //-| a redundant check for t=0. // Boost both vectors. Since we have the same boost, there is no need // to repeat the beta and gamma calculation; and there is no question // about beta >= 1. That is why we don't just call w.boosted(). double b2 = vTotal2*tRecip*tRecip; register double ggamma = std::sqrt(1./(1.-b2)); register double boostDotV1 = bboost.dot(pp); register double gm1_b2 = (ggamma-1)/b2; HepLorentzVector w1 ( pp + ((gm1_b2)*boostDotV1+ggamma*ee) * bboost, ggamma * (ee + boostDotV1) ); register double boostDotV2 = bboost.dot(w.pp); HepLorentzVector w2 ( w.pp + ((gm1_b2)*boostDotV2+ggamma*w.ee) * bboost, ggamma * (w.ee + boostDotV2) ); return (w1.isNear(w2, epsilon)); } /* isNearCM() */ double HepLorentzVector::howNearCM(const HepLorentzVector & w) const { double tTotal = (ee + w.ee); Hep3Vector vTotal (pp + w.pp); double vTotal2 = vTotal.mag2(); if ( vTotal2 >= tTotal*tTotal ) { // Either one or both vectors are spacelike, or the dominant T components // are in opposite directions. So boosting and testing makes no sense; // but we do consider two exactly equal vectors to be equal in any frame, // even if they are spacelike and can't be boosted to a CM frame. if (*this == w) { return 0; } else { return 1; } } if ( vTotal2 == 0 ) { // no boost needed! return (howNear(w)); } // Find the boost to the CM frame. We know that the total vector is timelike. double tRecip = 1./tTotal; Hep3Vector bboost ( vTotal * (-tRecip) ); //-| Note that you could do pp/t and not be terribly inefficient since //-| SpaceVector/t itself takes 1/t and multiplies. The code here saves //-| a redundant check for t=0. // Boost both vectors. Since we have the same boost, there is no need // to repeat the beta and gamma calculation; and there is no question // about beta >= 1. That is why we don't just call w.boosted(). double b2 = vTotal2*tRecip*tRecip; if ( b2 >= 1 ) { // NaN-proofing ZMthrowC ( ZMxpvTachyonic ( "boost vector in howNearCM appears to be tachyonic")); } register double ggamma = std::sqrt(1./(1.-b2)); register double boostDotV1 = bboost.dot(pp); register double gm1_b2 = (ggamma-1)/b2; HepLorentzVector w1 ( pp + ((gm1_b2)*boostDotV1+ggamma*ee) * bboost, ggamma * (ee + boostDotV1) ); register double boostDotV2 = bboost.dot(w.pp); HepLorentzVector w2 ( w.pp + ((gm1_b2)*boostDotV2+ggamma*w.ee) * bboost, ggamma * (w.ee + boostDotV2) ); return (w1.howNear(w2)); } /* howNearCM() */ //-************ // deltaR // isParallel // howParallel // howLightlike //-************ double HepLorentzVector::deltaR ( const HepLorentzVector & w ) const { double a = eta() - w.eta(); double b = pp.deltaPhi(w.getV()); return std::sqrt ( a*a + b*b ); } /* deltaR */ // If the difference (in the Euclidean norm) of the normalized (in Euclidean // norm) 4-vectors is small, then those 4-vectors are considered nearly // parallel. bool HepLorentzVector::isParallel (const HepLorentzVector & w, double epsilon) const { double norm = euclideanNorm(); double wnorm = w.euclideanNorm(); if ( norm == 0 ) { if ( wnorm == 0 ) { return true; } else { return false; } } if ( wnorm == 0 ) { return false; } HepLorentzVector w1 = *this / norm; HepLorentzVector w2 = w / wnorm; return ( (w1-w2).euclideanNorm2() <= epsilon*epsilon ); } /* isParallel */ double HepLorentzVector::howParallel (const HepLorentzVector & w) const { double norm = euclideanNorm(); double wnorm = w.euclideanNorm(); if ( norm == 0 ) { if ( wnorm == 0 ) { return 0; } else { return 1; } } if ( wnorm == 0 ) { return 1; } HepLorentzVector w1 = *this / norm; HepLorentzVector w2 = w / wnorm; double x1 = (w1-w2).euclideanNorm(); return (x1 < 1) ? x1 : 1; } /* howParallel */ double HepLorentzVector::howLightlike() const { double m1 = std::fabs(restMass2()); double twoT2 = 2*ee*ee; if (m1 < twoT2) { return m1/twoT2; } else { return 1; } } /* HowLightlike */ } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/AxisAngle.cc0000755000175000017500000000534611753232637016634 0ustar olesoles// ---------------------------------------------------------------------- // // AxisAngle.cc // // History: // 23-Jan-1998 WEB Initial draft // 13-Mar-1998 WEB Corrected ZMpvAxisAngleRep // 15-Jun-1998 WEB Added namespace support // 26-Jul-2000 MF CLHEP version // 12-Apr-2001 MF NaN-proofing // // ---------------------------------------------------------------------- #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/AxisAngle.h" namespace CLHEP { double HepAxisAngle::tolerance = Hep3Vector::ToleranceTicks * 1.0e-08; static void ZMpvAxisAngleRep( const HepAxisAngle & aa, double array[] ) { register double sinDelta = std::sin( aa.delta() ); register double cosDelta = std::cos( aa.delta() ); register double oneMinusCosDelta = 1.0 - cosDelta; register double uX = aa.getAxis().getX(); register double uY = aa.getAxis().getY(); register double uZ = aa.getAxis().getZ(); array[0] = oneMinusCosDelta * uX * uX + cosDelta; array[1] = oneMinusCosDelta * uX * uY - sinDelta * uZ; array[2] = oneMinusCosDelta * uX * uZ + sinDelta * uY; array[3] = oneMinusCosDelta * uY * uX + sinDelta * uZ; array[4] = oneMinusCosDelta * uY * uY + cosDelta; array[5] = oneMinusCosDelta * uY * uZ - sinDelta * uX; array[6] = oneMinusCosDelta * uZ * uX - sinDelta * uY; array[7] = oneMinusCosDelta * uZ * uY + sinDelta * uX; array[8] = oneMinusCosDelta * uZ * uZ + cosDelta; } // ZMpvAxisAngleRep double HepAxisAngle::distance( const AA & aa ) const { double thisRep[9]; double aaRep[9]; ZMpvAxisAngleRep( *this, thisRep ); ZMpvAxisAngleRep( aa, aaRep ); double sum = 0.0; for ( int i = 0; i < 9; i++ ) { sum += thisRep[i] * aaRep[i]; } double d = 3.0 - sum; // NaN-proofing: return (d >= 0) ? d : 0; // std::sqrt(distance) is used in howNear() } // HepAxisAngle::distance() bool HepAxisAngle::isNear( const AA & aa, Scalar epsilon ) const { return distance( aa ) <= epsilon * epsilon; } // HepAxisAngle::isNear() double HepAxisAngle::howNear( const AA & aa ) const { return std::sqrt( distance( aa ) ); } // HepAxisAngle::howNear() //-******************** // // Global methods // //-******************** std::ostream & operator<<(std::ostream & os, const HepAxisAngle & aa) { os << '(' << aa.axis() << ", " << aa.delta() << ')'; return os; } // operator<<() void ZMinputAxisAngle ( std::istream & is, double & x, double & y, double & z, double & delta ); std::istream & operator>>(std::istream & is, HepAxisAngle & aa) { Hep3Vector axis; double delta; double x,y,z; ZMinputAxisAngle ( is, x, y, z, delta ); axis.set(x,y,z); aa.set ( axis, delta ); return is; } // operator>>() } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/LorentzVectorR.cc0000755000175000017500000000355411761726606017725 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is part of the implementation of the HepLorentzVector class: // Those methods which might, if coded in LorentzVector.cc, force loading // of the Rotation.cc code module. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/LorentzVector.h" namespace CLHEP { HepLorentzVector & HepLorentzVector::rotate(double a, const Hep3Vector &v1) { pp.rotate(a,v1); return *this; } HepLorentzVector & HepLorentzVector::rotate ( const Hep3Vector & aaxis, double ddelta ) { pp.rotate (aaxis, ddelta); return *this; } HepLorentzVector & HepLorentzVector::rotate ( const HepAxisAngle & ax ) { pp.rotate (ax); return *this; } HepLorentzVector & HepLorentzVector::rotate ( const HepEulerAngles & e1 ) { pp.rotate (e1); return *this; } HepLorentzVector & HepLorentzVector::rotate ( double phi1, double theta1, double psi1 ) { pp.rotate (phi1, theta1, psi1); return *this; } HepLorentzVector rotationOf (const HepLorentzVector & vec, const Hep3Vector & aaxis, double ddelta) { HepLorentzVector vv (vec); return vv.rotate (aaxis, ddelta); } HepLorentzVector rotationOf (const HepLorentzVector & vec, const HepAxisAngle &ax ) { HepLorentzVector vv (vec); return vv.rotate (ax); } HepLorentzVector rotationOf (const HepLorentzVector & vec, const HepEulerAngles &e1 ) { HepLorentzVector vv (vec); return vv.rotate (e1); } HepLorentzVector rotationOf (const HepLorentzVector & vec, double phi1, double theta1, double psi1) { HepLorentzVector vv (vec); return vv.rotate (phi1, theta1, psi1); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/Makefile.am0000755000175000017500000000442411406203315016464 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir) libCLHEP_Vector_@VERSION@_a_SOURCES = \ AxisAngle.cc \ Boost.cc \ BoostX.cc \ BoostY.cc \ BoostZ.cc \ EulerAngles.cc \ LorentzRotation.cc \ LorentzRotationC.cc \ LorentzRotationD.cc \ LorentzVector.cc \ LorentzVectorB.cc \ LorentzVectorC.cc \ LorentzVectorK.cc \ LorentzVectorL.cc \ LorentzVectorR.cc \ Rotation.cc \ RotationA.cc \ RotationC.cc \ RotationE.cc \ RotationIO.cc \ RotationInterfaces.cc \ RotationL.cc \ RotationP.cc \ RotationX.cc \ RotationXYZ.cc \ RotationY.cc \ RotationZ.cc \ SpaceVector.cc \ SpaceVectorD.cc \ SpaceVectorP.cc \ SpaceVectorR.cc \ ThreeVector.cc \ ThreeVectorR.cc \ TwoVector.cc \ ZMinput.cc \ ZMxpv.cc libCLHEP_Vector_@VERSION@_so_OBJECTS = $(patsubst %.cc,$(shareddir)/%.$(OBJEXT),$(libCLHEP_Vector_@VERSION@_a_SOURCES)) # these if/else blocks will be parsed by automake and translated if BUILD_SHARED shareddir = shared if BUILD_VISUAL lib_shared = CLHEP-Vector-@VERSION@.$(SHEXT) else lib_shared = libCLHEP-Vector-@VERSION@.$(SHEXT) endif SHFLAGS = @MY_SHFLAGS@ SHLINK = @MY_SHLINK@ @MY_SHEXTRA@ SHNAME = @MY_SHNAME@ endif if BUILD_STATIC lib_LIBRARIES = libCLHEP-Vector-@VERSION@.a endif CLEANFILES = $(lib_shared) all-local: $(shareddir) $(lib_shared) $(shareddir): test -d $(shareddir) || mkdir $(shareddir) if BUILD_VISUAL $(lib_shared): $(libCLHEP_Vector_@VERSION@_so_OBJECTS) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Vector_@VERSION@_so_OBJECTS) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) /c /Fo$@ $< else $(lib_shared): $(libCLHEP_Vector_@VERSION@_so_OBJECTS) $(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Vector_@VERSION@_so_OBJECTS) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) -c -o $@ $< endif install-exec-local: $(lib_shared) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_shared)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$p'"; \ $(INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done clean-local: -test -d $(shareddir) && rm -f $(shareddir)/*.$(OBJEXT) distclean-local: -test -d $(shareddir) && rm -rf ./$(shareddir) clhep-2.1.4.1.orig/Vector/src/EulerAngles.cc0000755000175000017500000000630511753232637017163 0ustar olesoles// ---------------------------------------------------------------------- // // EulerAngles.cc // // Methods for classes, and instances of globals, declared in EulerAngles.h // // History: // // 04-Dec-1997 MF Stub with just PI // 12-Jan-1998 WEB PI now found in ZMutility; used ZMutility headers // where available // 16-Mar-1998 WEB Corrected ZMpvEulerAnglesRep // 15-Jun-1998 WEB Added namespace support // 26-Jul-2000 MF CLHEP version // 12-Apr-2001 MF NaN-proofing // 19-Nov-2001 MF Correction to ZMpvEulerAnglesRep, which was affecting // .isNear(). array[3] had been incorrect. // Note - the correct form was used in all other places // including Rotation.set(phi, theta, psi). // // ---------------------------------------------------------------------- #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/EulerAngles.h" #include "CLHEP/Vector/ThreeVector.h" #include namespace CLHEP { //-************* // static consts //-************* double HepEulerAngles::tolerance = Hep3Vector::ToleranceTicks * 1.0e-8; //-******************* // measure of distance //-******************* static void ZMpvEulerAnglesRep ( const HepEulerAngles & ex, double array[] ) { register double sinPhi = std::sin( ex.phi() ) , cosPhi = std::cos( ex.phi() ); register double sinTheta = std::sin( ex.theta() ), cosTheta = std::cos( ex.theta() ); register double sinPsi = std::sin( ex.psi() ) , cosPsi = std::cos( ex.psi() ); array[0] = cosPsi * cosPhi - sinPsi * cosTheta * sinPhi; array[1] = cosPsi * sinPhi + sinPsi * cosTheta * cosPhi; array[2] = sinPsi * sinTheta; array[3] = - sinPsi * cosPhi - cosPsi * cosTheta * sinPhi; array[4] = - sinPsi * sinPhi + cosPsi * cosTheta * cosPhi; array[5] = cosPsi * sinTheta; array[6] = sinTheta * sinPhi; array[7] = - sinTheta * cosPhi; array[8] = cosTheta; } // ZMpvEulerAnglesRep double HepEulerAngles::distance( const EA & ex ) const { double thisRep[9]; double exRep[9]; ZMpvEulerAnglesRep ( *this, thisRep ); ZMpvEulerAnglesRep ( ex, exRep ); double sum = 0.0; for (int i = 0; i < 9; i++) { sum += thisRep[i] * exRep[i]; } double d = 3.0 - sum; // NaN-proofing: return (d >= 0) ? d : 0; // std::sqrt(distance) is used in howNear() } // HepEulerAngles::distance() bool HepEulerAngles::isNear( const EA & ex, double epsilon ) const { return distance( ex ) <= epsilon*epsilon ; } // HepEulerAngles::isNear() double HepEulerAngles::howNear( const EA & ex ) const { return std::sqrt( distance( ex ) ); } // HepEulerAngles::howNear() //-************** // Global Methods //-************** std::ostream & operator<<(std::ostream & os, const HepEulerAngles & ea) { os << "(" << ea.phi() << ", " << ea.theta() << ", " << ea.psi() << ")"; return os; } // operator<<() void ZMinput3doubles ( std::istream & is, const char * type, double & x, double & y, double & z ); std::istream & operator>>(std::istream & is, HepEulerAngles & ea) { double thePhi; double theTheta; double thePsi; ZMinput3doubles ( is, "HepEulerAngle", thePhi , theTheta , thePsi ); ea.set ( thePhi , theTheta , thePsi ); return is; } // operator>>() } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/RotationL.cc0000755000175000017500000000347711753232637016677 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of methods of the HepRotation class which // were introduced when ZOOM PhysicsVectors was merged in, which might cause // pulling in of LorentzTransformation related code units. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Vector/LorentzRotation.h" #include namespace CLHEP { // ---------- distance2 and related member functions: // // WHy do we have forms for HepLorentzRotation and HepBoost but not for // HepBoostX, HepBoostY, HepBoostZ? Because the latter can be gotten by // implicit conversion to HepBoost; but if we just had HepLorentzRotation // then this would involve double conversion when HepBoostX was used. double HepRotation::distance2( const HepLorentzRotation & lt ) const { HepAxisAngle a; Hep3Vector b; lt.decompose(b, a); double bet = b.beta(); double bet2 = bet*bet; HepRotation r(a); return bet2/(1-bet2) + distance2(r); } double HepRotation::distance2( const HepBoost & lt ) const { return distance2( HepLorentzRotation(lt)); } double HepRotation::howNear( const HepLorentzRotation & lt ) const { return std::sqrt( distance2( lt ) ); } double HepRotation::howNear( const HepBoost & lt ) const { return std::sqrt( distance2( lt ) ); } bool HepRotation::isNear( const HepLorentzRotation & lt, double epsilon) const { return distance2( lt ) <= epsilon*epsilon; } bool HepRotation::isNear( const HepBoost & lt, double epsilon) const { return distance2( lt ) <= epsilon*epsilon; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/SpaceVector.cc0000755000175000017500000002022111753232637017164 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // SpaceVector // // This is the implementation of those methods of the Hep3Vector class which // originated from the ZOOM SpaceVector class. Several groups of these methods // have been separated off into the following code units: // // SpaceVectorR.cc All methods involving rotation // SpaceVectorD.cc All methods involving angle decomposition // SpaceVectorP.cc Intrinsic properties and methods involving second vector // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Vector/ZMxpv.h" #include "CLHEP/Units/PhysicalConstants.h" #include namespace CLHEP { //-***************************** // - 1 - // set (multiple components) // in various coordinate systems // //-***************************** void Hep3Vector::setSpherical ( double r1, double theta1, double phi1) { if ( r1 < 0 ) { ZMthrowC (ZMxpvNegativeR( "Spherical coordinates set with negative R")); // No special return needed if warning is ignored. } if ( (theta1 < 0) || (theta1 > CLHEP::pi) ) { ZMthrowC (ZMxpvUnusualTheta( "Spherical coordinates set with theta not in [0, PI]")); // No special return needed if warning is ignored. } dz = r1 * std::cos(theta1); double rho1 ( r1*std::sin(theta1)); dy = rho1 * std::sin (phi1); dx = rho1 * std::cos (phi1); return; } /* setSpherical (r, theta1, phi) */ void Hep3Vector::setCylindrical ( double rho1, double phi1, double z1) { if ( rho1 < 0 ) { ZMthrowC (ZMxpvNegativeR( "Cylindrical coordinates supplied with negative Rho")); // No special return needed if warning is ignored. } dz = z1; dy = rho1 * std::sin (phi1); dx = rho1 * std::cos (phi1); return; } /* setCylindrical (r, phi, z) */ void Hep3Vector::setRhoPhiTheta ( double rho1, double phi1, double theta1) { if (rho1 == 0) { ZMthrowC (ZMxpvZeroVector( "Attempt set vector components rho, phi, theta with zero rho -- " "zero vector is returned, ignoring theta and phi")); dx = 0; dy = 0; dz = 0; return; } if ( (theta1 == 0) || (theta1 == CLHEP::pi) ) { ZMthrowA (ZMxpvInfiniteVector( "Attempt set cylindrical vector vector with finite rho and " "theta along the Z axis: infinite Z would be computed")); } if ( (theta1 < 0) || (theta1 > CLHEP::pi) ) { ZMthrowC (ZMxpvUnusualTheta( "Rho, phi, theta set with theta not in [0, PI]")); // No special return needed if warning is ignored. } dz = rho1 / std::tan (theta1); dy = rho1 * std::sin (phi1); dx = rho1 * std::cos (phi1); return; } /* setCyl (rho, phi, theta) */ void Hep3Vector::setRhoPhiEta ( double rho1, double phi1, double eta1 ) { if (rho1 == 0) { ZMthrowC (ZMxpvZeroVector( "Attempt set vector components rho, phi, eta with zero rho -- " "zero vector is returned, ignoring eta and phi")); dx = 0; dy = 0; dz = 0; return; } double theta1 (2 * std::atan ( std::exp (-eta1) )); dz = rho1 / std::tan (theta1); dy = rho1 * std::sin (phi1); dx = rho1 * std::cos (phi1); return; } /* setCyl (rho, phi, eta) */ //************ // - 3 - // Comparisons // //************ int Hep3Vector::compare (const Hep3Vector & v) const { if ( dz > v.dz ) { return 1; } else if ( dz < v.dz ) { return -1; } else if ( dy > v.dy ) { return 1; } else if ( dy < v.dy ) { return -1; } else if ( dx > v.dx ) { return 1; } else if ( dx < v.dx ) { return -1; } else { return 0; } } /* Compare */ bool Hep3Vector::operator > (const Hep3Vector & v) const { return (compare(v) > 0); } bool Hep3Vector::operator < (const Hep3Vector & v) const { return (compare(v) < 0); } bool Hep3Vector::operator>= (const Hep3Vector & v) const { return (compare(v) >= 0); } bool Hep3Vector::operator<= (const Hep3Vector & v) const { return (compare(v) <= 0); } //-******** // Nearness //-******** // These methods all assume you can safely take mag2() of each vector. // Absolutely safe but slower and much uglier alternatives were // provided as build-time options in ZOOM SpaceVectors. // Also, much smaller codes were provided tht assume you can square // mag2() of each vector; but those return bad answers without warning // when components exceed 10**90. // // IsNear, HowNear, and DeltaR are found in ThreeVector.cc double Hep3Vector::howParallel (const Hep3Vector & v) const { // | V1 x V2 | / | V1 dot V2 | double v1v2 = std::fabs(dot(v)); if ( v1v2 == 0 ) { // Zero is parallel to no other vector except for zero. return ( (mag2() == 0) && (v.mag2() == 0) ) ? 0 : 1; } Hep3Vector v1Xv2 ( cross(v) ); double abscross = v1Xv2.mag(); if ( abscross >= v1v2 ) { return 1; } else { return abscross/v1v2; } } /* howParallel() */ bool Hep3Vector::isParallel (const Hep3Vector & v, double epsilon) const { // | V1 x V2 | **2 <= epsilon **2 | V1 dot V2 | **2 // V1 is *this, V2 is v static const double TOOBIG = std::pow(2.0,507); static const double SCALE = std::pow(2.0,-507); double v1v2 = std::fabs(dot(v)); if ( v1v2 == 0 ) { return ( (mag2() == 0) && (v.mag2() == 0) ); } if ( v1v2 >= TOOBIG ) { Hep3Vector sv1 ( *this * SCALE ); Hep3Vector sv2 ( v * SCALE ); Hep3Vector sv1Xsv2 = sv1.cross(sv2); double x2 = sv1Xsv2.mag2(); double limit = v1v2*SCALE*SCALE; limit = epsilon*epsilon*limit*limit; return ( x2 <= limit ); } // At this point we know v1v2 can be squared. Hep3Vector v1Xv2 ( cross(v) ); if ( (std::fabs (v1Xv2.dx) > TOOBIG) || (std::fabs (v1Xv2.dy) > TOOBIG) || (std::fabs (v1Xv2.dz) > TOOBIG) ) { return false; } return ( (v1Xv2.mag2()) <= ((epsilon * v1v2) * (epsilon * v1v2)) ); } /* isParallel() */ double Hep3Vector::howOrthogonal (const Hep3Vector & v) const { // | V1 dot V2 | / | V1 x V2 | double v1v2 = std::fabs(dot(v)); //-| Safe because both v1 and v2 can be squared if ( v1v2 == 0 ) { return 0; // Even if one or both are 0, they are considered orthogonal } Hep3Vector v1Xv2 ( cross(v) ); double abscross = v1Xv2.mag(); if ( v1v2 >= abscross ) { return 1; } else { return v1v2/abscross; } } /* howOrthogonal() */ bool Hep3Vector::isOrthogonal (const Hep3Vector & v, double epsilon) const { // | V1 x V2 | **2 <= epsilon **2 | V1 dot V2 | **2 // V1 is *this, V2 is v static const double TOOBIG = std::pow(2.0,507); static const double SCALE = std::pow(2.0,-507); double v1v2 = std::fabs(dot(v)); //-| Safe because both v1 and v2 can be squared if ( v1v2 >= TOOBIG ) { Hep3Vector sv1 ( *this * SCALE ); Hep3Vector sv2 ( v * SCALE ); Hep3Vector sv1Xsv2 = sv1.cross(sv2); double x2 = sv1Xsv2.mag2(); double limit = epsilon*epsilon*x2; double y2 = v1v2*SCALE*SCALE; return ( y2*y2 <= limit ); } // At this point we know v1v2 can be squared. Hep3Vector eps_v1Xv2 ( cross(epsilon*v) ); if ( (std::fabs (eps_v1Xv2.dx) > TOOBIG) || (std::fabs (eps_v1Xv2.dy) > TOOBIG) || (std::fabs (eps_v1Xv2.dz) > TOOBIG) ) { return true; } // At this point we know all the math we need can be done. return ( v1v2*v1v2 <= eps_v1Xv2.mag2() ); } /* isOrthogonal() */ double Hep3Vector::setTolerance (double tol) { // Set the tolerance for Hep3Vectors to be considered near one another double oldTolerance (tolerance); tolerance = tol; return oldTolerance; } //-*********************** // Helper Methods: // negativeInfinity() //-*********************** double Hep3Vector::negativeInfinity() const { // A byte-order-independent way to return -Infinity struct Dib { union { double d; unsigned char i[8]; } u; }; Dib negOne; Dib posTwo; negOne.u.d = -1.0; posTwo.u.d = 2.0; Dib value; int k; for (k=0; k<8; k++) { value.u.i[k] = negOne.u.i[k] | posTwo.u.i[k]; } return value.u.d; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/LorentzVectorL.cc0000755000175000017500000000150411712321422017667 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is part of the implementation of the HepLorentzVector class: // Those methods which might, if coded in other modules, force loading // of the LorentzRotation.cc code module. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Vector/LorentzRotation.h" namespace CLHEP { HepLorentzVector & HepLorentzVector::operator *= (const HepLorentzRotation & m1) { return *this = m1.vectorMultiplication(*this); } HepLorentzVector & HepLorentzVector::transform(const HepLorentzRotation & m1){ return *this = m1.vectorMultiplication(*this); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/RotationX.cc0000755000175000017500000001235012050774211016667 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of methods of the HepRotationX class which // were introduced when ZOOM PhysicsVectors was merged in. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/RotationX.h" #include "CLHEP/Vector/AxisAngle.h" #include "CLHEP/Vector/EulerAngles.h" #include "CLHEP/Vector/LorentzRotation.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include #include namespace CLHEP { static inline double safe_acos (double x) { if (std::abs(x) <= 1.0) return std::acos(x); return ( (x>0) ? 0 : CLHEP::pi ); } HepRotationX::HepRotationX(double ddelta) : its_d(proper(ddelta)), its_s(std::sin(ddelta)), its_c(std::cos(ddelta)) {} HepRotationX & HepRotationX::set ( double ddelta ) { its_d = proper(ddelta); its_s = std::sin(its_d); its_c = std::cos(its_d); return *this; } double HepRotationX::phi() const { if ( (its_d > 0) && (its_d < CLHEP::pi) ) { return CLHEP::pi; } else { return 0.0; } } // HepRotationX::phi() double HepRotationX::theta() const { return std::fabs( its_d ); } // HepRotationX::theta() double HepRotationX::psi() const { if ( (its_d > 0) && (its_d < CLHEP::pi) ) { return CLHEP::pi; } else { return 0.0; } } // HepRotationX::psi() HepEulerAngles HepRotationX::eulerAngles() const { return HepEulerAngles( phi(), theta(), psi() ); } // HepRotationX::eulerAngles() // From the defining code in the implementation of CLHEP (in Rotation.cc) // it is clear that thetaX, phiX form the polar angles in the original // coordinate system of the new X axis (and similarly for phiY and phiZ). // // This code is taken directly from the original CLHEP. However, there are as // shown opportunities for significant speed improvement. double HepRotationX::phiX() const { return (yx() == 0.0 && xx() == 0.0) ? 0.0 : std::atan2(yx(),xx()); // or ---- return 0; } double HepRotationX::phiY() const { return (yy() == 0.0 && xy() == 0.0) ? 0.0 : std::atan2(yy(),xy()); // or ---- return (yy() == 0.0) ? 0.0 : std::atan2(yy(),xy()); } double HepRotationX::phiZ() const { return (yz() == 0.0 && xz() == 0.0) ? 0.0 : std::atan2(yz(),xz()); // or ---- return (yz() == 0.0) ? 0.0 : std::atan2(yz(),xz()); } double HepRotationX::thetaX() const { return safe_acos(zx()); // or ---- return CLHEP::halfpi; } double HepRotationX::thetaY() const { return safe_acos(zy()); } double HepRotationX::thetaZ() const { return safe_acos(zz()); // or ---- return d; } void HepRotationX::setDelta ( double ddelta ) { set(ddelta); } void HepRotationX::decompose (HepAxisAngle & rotation, Hep3Vector & boost) const { boost.set(0,0,0); rotation = axisAngle(); } void HepRotationX::decompose (Hep3Vector & boost, HepAxisAngle & rotation) const { boost.set(0,0,0); rotation = axisAngle(); } void HepRotationX::decompose (HepRotation & rotation, HepBoost & boost) const { boost.set(0,0,0); rotation = HepRotation(*this); } void HepRotationX::decompose (HepBoost & boost, HepRotation & rotation) const { boost.set(0,0,0); rotation = HepRotation(*this); } double HepRotationX::distance2( const HepRotationX & r ) const { double answer = 2.0 * ( 1.0 - ( its_s * r.its_s + its_c * r.its_c ) ) ; return (answer >= 0) ? answer : 0; } double HepRotationX::distance2( const HepRotation & r ) const { double sum = r.xx() + yy() * r.yy() + yz() * r.yz() + zy() * r.zy() + zz() * r.zz(); double answer = 3.0 - sum; return (answer >= 0 ) ? answer : 0; } double HepRotationX::distance2( const HepLorentzRotation & lt ) const { HepAxisAngle a; Hep3Vector b; lt.decompose(b, a); double bet = b.beta(); double bet2 = bet*bet; HepRotation r(a); return bet2/(1-bet2) + distance2(r); } double HepRotationX::distance2( const HepBoost & lt ) const { return distance2( HepLorentzRotation(lt)); } double HepRotationX::howNear( const HepRotationX & r ) const { return std::sqrt(distance2(r)); } double HepRotationX::howNear( const HepRotation & r ) const { return std::sqrt(distance2(r)); } double HepRotationX::howNear( const HepBoost & b ) const { return std::sqrt(distance2(b)); } double HepRotationX::howNear( const HepLorentzRotation & lt ) const { return std::sqrt(distance2(lt)); } bool HepRotationX::isNear(const HepRotationX & r,double epsilon)const{ return (distance2(r) <= epsilon*epsilon); } bool HepRotationX::isNear(const HepRotation & r,double epsilon) const{ return (distance2(r) <= epsilon*epsilon); } bool HepRotationX::isNear( const HepBoost & lt,double epsilon) const { return (distance2(lt) <= epsilon*epsilon); } bool HepRotationX::isNear( const HepLorentzRotation & lt, double epsilon ) const { return (distance2(lt) <= epsilon*epsilon); } double HepRotationX::norm2() const { return 2.0 - 2.0 * its_c; } std::ostream & HepRotationX::print( std::ostream & os ) const { os << "\nRotation about X (" << its_d << ") [cos d = " << its_c << " sin d = " << its_s << "]\n"; return os; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/RotationE.cc0000755000175000017500000001704311761726606016665 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of methods of the HepRotation class which // were introduced when ZOOM PhysicsVectors was merged in, and which involve // Euler Angles representation. // // Apr 28, 2003 mf Modified way of computing Euler angles to avoid flawed // answers in the case where theta is near 0 of pi, and // the matrix is not a perfect rotation (due to roundoff). #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Vector/EulerAngles.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include namespace CLHEP { static inline double safe_acos (double x) { if (std::abs(x) <= 1.0) return std::acos(x); return ( (x>0) ? 0 : CLHEP::pi ); } // ---------- Constructors and Assignment: // Euler angles HepRotation & HepRotation::set(double phi1, double theta1, double psi1) { register double sinPhi = std::sin( phi1 ), cosPhi = std::cos( phi1 ); register double sinTheta = std::sin( theta1 ), cosTheta = std::cos( theta1 ); register double sinPsi = std::sin( psi1 ), cosPsi = std::cos( psi1 ); rxx = cosPsi * cosPhi - cosTheta * sinPhi * sinPsi; rxy = cosPsi * sinPhi + cosTheta * cosPhi * sinPsi; rxz = sinPsi * sinTheta; ryx = - sinPsi * cosPhi - cosTheta * sinPhi * cosPsi; ryy = - sinPsi * sinPhi + cosTheta * cosPhi * cosPsi; ryz = cosPsi * sinTheta; rzx = sinTheta * sinPhi; rzy = - sinTheta * cosPhi; rzz = cosTheta; return *this; } // Rotation::set(phi, theta, psi) HepRotation::HepRotation( double phi1, double theta1, double psi1 ) { set (phi1, theta1, psi1); } HepRotation & HepRotation::set( const HepEulerAngles & e ) { return set(e.phi(), e.theta(), e.psi()); } HepRotation::HepRotation ( const HepEulerAngles & e ) { set(e.phi(), e.theta(), e.psi()); } double HepRotation::phi () const { double s2 = 1.0 - rzz*rzz; if (s2 < 0) { ZMthrowC ( ZMxpvImproperRotation ( "HepRotation::phi() finds | rzz | > 1 ")); s2 = 0; } const double sinTheta = std::sqrt( s2 ); if (sinTheta < .01) { // For theta close to 0 or PI, use the more stable // algorithm to get all three Euler angles HepEulerAngles ea = eulerAngles(); return ea.phi(); } const double cscTheta = 1/sinTheta; double cosabsphi = - rzy * cscTheta; if ( std::fabs(cosabsphi) > 1 ) { // NaN-proofing ZMthrowC ( ZMxpvImproperRotation ( "HepRotation::phi() finds | cos phi | > 1 ")); cosabsphi = 1; } const double absPhi = std::acos ( cosabsphi ); if (rzx > 0) { return absPhi; } else if (rzx < 0) { return -absPhi; } else { return (rzy < 0) ? 0 : CLHEP::pi; } } // phi() double HepRotation::theta() const { return safe_acos( rzz ); } // theta() double HepRotation::psi () const { double sinTheta; if ( std::fabs(rzz) > 1 ) { // NaN-proofing ZMthrowC ( ZMxpvImproperRotation ( "HepRotation::psi() finds | rzz | > 1")); sinTheta = 0; } else { sinTheta = std::sqrt( 1.0 - rzz*rzz ); } if (sinTheta < .01) { // For theta close to 0 or PI, use the more stable // algorithm to get all three Euler angles HepEulerAngles ea = eulerAngles(); return ea.psi(); } const double cscTheta = 1/sinTheta; double cosabspsi = ryz * cscTheta; if ( std::fabs(cosabspsi) > 1 ) { // NaN-proofing ZMthrowC ( ZMxpvImproperRotation ( "HepRotation::psi() finds | cos psi | > 1")); cosabspsi = 1; } const double absPsi = std::acos ( cosabspsi ); if (rxz > 0) { return absPsi; } else if (rxz < 0) { return -absPsi; } else { return (ryz > 0) ? 0 : CLHEP::pi; } } // psi() // Helpers for eulerAngles(): static void correctByPi ( double& psi1, double& phi1 ) { if (psi1 > 0) { psi1 -= CLHEP::pi; } else { psi1 += CLHEP::pi; } if (phi1 > 0) { phi1 -= CLHEP::pi; } else { phi1 += CLHEP::pi; } } static void correctPsiPhi ( double rxz, double rzx, double ryz, double rzy, double& psi1, double& phi1 ) { // set up quatities which would be positive if sin and cosine of // psi1 and phi1 were positive: double w[4]; w[0] = rxz; w[1] = rzx; w[2] = ryz; w[3] = -rzy; // find biggest relevant term, which is the best one to use in correcting. double maxw = std::abs(w[0]); int imax = 0; for (int i = 1; i < 4; ++i) { if (std::abs(w[i]) > maxw) { maxw = std::abs(w[i]); imax = i; } } // Determine if the correction needs to be applied: The criteria are // different depending on whether a sine or cosine was the determinor: switch (imax) { case 0: if (w[0] > 0 && psi1 < 0) correctByPi ( psi1, phi1 ); if (w[0] < 0 && psi1 > 0) correctByPi ( psi1, phi1 ); break; case 1: if (w[1] > 0 && phi1 < 0) correctByPi ( psi1, phi1 ); if (w[1] < 0 && phi1 > 0) correctByPi ( psi1, phi1 ); break; case 2: if (w[2] > 0 && std::abs(psi1) > CLHEP::halfpi) correctByPi ( psi1, phi1 ); if (w[2] < 0 && std::abs(psi1) < CLHEP::halfpi) correctByPi ( psi1, phi1 ); break; case 3: if (w[3] > 0 && std::abs(phi1) > CLHEP::halfpi) correctByPi ( psi1, phi1 ); if (w[3] < 0 && std::abs(phi1) < CLHEP::halfpi) correctByPi ( psi1, phi1 ); break; } } HepEulerAngles HepRotation::eulerAngles() const { // Please see the mathematical justification in eulerAngleComputations.ps double phi1, theta1, psi1; double psiPlusPhi, psiMinusPhi; theta1 = safe_acos( rzz ); if (rzz > 1 || rzz < -1) { ZMthrowC ( ZMxpvImproperRotation ( "HepRotation::eulerAngles() finds | rzz | > 1 ")); } double cosTheta = rzz; if (cosTheta > 1) cosTheta = 1; if (cosTheta < -1) cosTheta = -1; if (cosTheta == 1) { psiPlusPhi = std::atan2 ( rxy - ryx, rxx + ryy ); psiMinusPhi = 0; } else if (cosTheta >= 0) { // In this realm, the atan2 expression for psi + phi is numerically stable psiPlusPhi = std::atan2 ( rxy - ryx, rxx + ryy ); // psi - phi is potentially more subtle, but when unstable it is moot double s1 = -rxy - ryx; // std::sin (psi-phi) * (1 - cos theta) double c = rxx - ryy; // std::cos (psi-phi) * (1 - cos theta) psiMinusPhi = std::atan2 ( s1, c ); } else if (cosTheta > -1) { // In this realm, the atan2 expression for psi - phi is numerically stable psiMinusPhi = std::atan2 ( -rxy - ryx, rxx - ryy ); // psi + phi is potentially more subtle, but when unstable it is moot double s1 = rxy - ryx; // std::sin (psi+phi) * (1 + cos theta) double c = rxx + ryy; // std::cos (psi+phi) * (1 + cos theta) psiPlusPhi = std::atan2 ( s1, c ); } else { // cosTheta == -1 psiMinusPhi = std::atan2 ( -rxy - ryx, rxx - ryy ); psiPlusPhi = 0; } psi1 = .5 * (psiPlusPhi + psiMinusPhi); phi1 = .5 * (psiPlusPhi - psiMinusPhi); // Now correct by pi if we have managed to get a value of psiPlusPhi // or psiMinusPhi that was off by 2 pi: correctPsiPhi ( rxz, rzx, ryz, rzy, psi1, phi1 ); return HepEulerAngles( phi1, theta1, psi1 ); } // eulerAngles() void HepRotation::setPhi (double phi1) { set ( phi1, theta(), psi() ); } void HepRotation::setTheta (double theta1) { set ( phi(), theta1, psi() ); } void HepRotation::setPsi (double psi1) { set ( phi(), theta(), psi1 ); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/Boost.cc0000755000175000017500000002000211753232637016031 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of the HepBoost class. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/Boost.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Vector/LorentzRotation.h" #include "CLHEP/Vector/ZMxpv.h" namespace CLHEP { // ---------- Constructors and Assignment: HepBoost & HepBoost::set (double bx, double by, double bz) { double bp2 = bx*bx + by*by + bz*bz; if (bp2 >= 1) { ZMthrowA (ZMxpvTachyonic( "Boost Vector supplied to set HepBoost represents speed >= c.")); } double ggamma = 1.0 / std::sqrt(1.0 - bp2); double bgamma = ggamma * ggamma / (1.0 + ggamma); rep_.xx_ = 1.0 + bgamma * bx * bx; rep_.yy_ = 1.0 + bgamma * by * by; rep_.zz_ = 1.0 + bgamma * bz * bz; rep_.xy_ = bgamma * bx * by; rep_.xz_ = bgamma * bx * bz; rep_.yz_ = bgamma * by * bz; rep_.xt_ = ggamma * bx; rep_.yt_ = ggamma * by; rep_.zt_ = ggamma * bz; rep_.tt_ = ggamma; return *this; } HepBoost & HepBoost::set (const HepRep4x4Symmetric & m1) { rep_ = m1; return *this; } HepBoost & HepBoost::set (Hep3Vector ddirection, double bbeta) { double length = ddirection.mag(); if (length <= 0) { // Nan-proofing ZMthrowA (ZMxpvZeroVector( "Direction supplied to set HepBoost is zero.")); set (0,0,0); return *this; } set(bbeta*ddirection.x()/length, bbeta*ddirection.y()/length, bbeta*ddirection.z()/length); return *this; } HepBoost & HepBoost::set (const Hep3Vector & bboost) { return set (bboost.x(), bboost.y(), bboost.z()); } // ---------- Accessors: // ---------- Decomposition: void HepBoost::decompose (HepRotation & rotation, HepBoost & boost) const { HepAxisAngle vdelta = HepAxisAngle(); rotation = HepRotation(vdelta); Hep3Vector bbeta = boostVector(); boost = HepBoost(bbeta); } void HepBoost::decompose (HepAxisAngle & rotation, Hep3Vector & boost) const { rotation = HepAxisAngle(); boost = boostVector(); } void HepBoost::decompose (HepBoost & boost, HepRotation & rotation) const { HepAxisAngle vdelta = HepAxisAngle(); rotation = HepRotation(vdelta); Hep3Vector bbeta = boostVector(); boost = HepBoost(bbeta); } void HepBoost::decompose (Hep3Vector & boost, HepAxisAngle & rotation) const { rotation = HepAxisAngle(); boost = boostVector(); } // ---------- Comparisons: double HepBoost::distance2( const HepRotation & r ) const { double db2 = norm2(); double dr2 = r.norm2(); return (db2 + dr2); } double HepBoost::distance2( const HepLorentzRotation & lt ) const { HepBoost b1; HepRotation r1; lt.decompose(b1,r1); double db2 = distance2(b1); double dr2 = r1.norm2(); return (db2 + dr2); } double HepBoost::howNear ( const HepRotation & r ) const { return std::sqrt(distance2(r)); } double HepBoost::howNear ( const HepLorentzRotation & lt ) const { return std::sqrt(distance2(lt)); } bool HepBoost::isNear (const HepRotation & r, double epsilon) const { double db2 = norm2(); if (db2 > epsilon*epsilon) return false; double dr2 = r.norm2(); return (db2+dr2 <= epsilon*epsilon); } bool HepBoost::isNear (const HepLorentzRotation & lt, double epsilon) const { HepBoost b1; HepRotation r1; double db2 = distance2(b1); lt.decompose(b1,r1); if (db2 > epsilon*epsilon) return false; double dr2 = r1.norm2(); return (db2 + dr2); } // ---------- Properties: double HepBoost::norm2() const { register double bgx = rep_.xt_; register double bgy = rep_.yt_; register double bgz = rep_.zt_; return bgx*bgx+bgy*bgy+bgz*bgz; } void HepBoost::rectify() { // Assuming the representation of this is close to a true pure boost, // but may have drifted due to round-off error from many operations, // this forms an "exact" pure boost matrix for the LT again. // The natural way to do this is to use the t column as a boost and set // based on that boost vector. // There is perhaps danger that this boost vector will appear equal to or // greater than a unit vector; the best we can do for such a case is use // a boost in that direction but rescaled to just less than one. // There is in principle no way that gamma could have become negative, // but if that happens, we ZMthrow and (if continuing) just rescale, which // will change the sign of the last column when computing the boost. double gam = tt(); if (gam <= 0) { // 4/12/01 mf // ZMthrowA (ZMxpvTachyonic( ZMthrowC (ZMxpvTachyonic( "Attempt to rectify a boost with non-positive gamma.")); if (gam==0) return; // NaN-proofing } Hep3Vector boost (xt(), yt(), zt()); boost /= tt(); if ( boost.mag2() >= 1 ) { // NaN-proofing: boost /= ( boost.mag() * ( 1.0 + 1.0e-16 ) ); // used to just check > 1 } set ( boost ); } // ---------- Application is all in .icc // ---------- Operations in the group of 4-Rotations HepLorentzRotation HepBoost::matrixMultiplication(const HepRep4x4 & m1) const { HepRep4x4Symmetric r = rep4x4Symmetric(); return HepLorentzRotation( HepRep4x4 ( r.xx_*m1.xx_ + r.xy_*m1.yx_ + r.xz_*m1.zx_ + r.xt_*m1.tx_, r.xx_*m1.xy_ + r.xy_*m1.yy_ + r.xz_*m1.zy_ + r.xt_*m1.ty_, r.xx_*m1.xz_ + r.xy_*m1.yz_ + r.xz_*m1.zz_ + r.xt_*m1.tz_, r.xx_*m1.xt_ + r.xy_*m1.yt_ + r.xz_*m1.zt_ + r.xt_*m1.tt_, r.xy_*m1.xx_ + r.yy_*m1.yx_ + r.yz_*m1.zx_ + r.yt_*m1.tx_, r.xy_*m1.xy_ + r.yy_*m1.yy_ + r.yz_*m1.zy_ + r.yt_*m1.ty_, r.xy_*m1.xz_ + r.yy_*m1.yz_ + r.yz_*m1.zz_ + r.yt_*m1.tz_, r.xy_*m1.xt_ + r.yy_*m1.yt_ + r.yz_*m1.zt_ + r.yt_*m1.tt_, r.xz_*m1.xx_ + r.yz_*m1.yx_ + r.zz_*m1.zx_ + r.zt_*m1.tx_, r.xz_*m1.xy_ + r.yz_*m1.yy_ + r.zz_*m1.zy_ + r.zt_*m1.ty_, r.xz_*m1.xz_ + r.yz_*m1.yz_ + r.zz_*m1.zz_ + r.zt_*m1.tz_, r.xz_*m1.xt_ + r.yz_*m1.yt_ + r.zz_*m1.zt_ + r.zt_*m1.tt_, r.xt_*m1.xx_ + r.yt_*m1.yx_ + r.zt_*m1.zx_ + r.tt_*m1.tx_, r.xt_*m1.xy_ + r.yt_*m1.yy_ + r.zt_*m1.zy_ + r.tt_*m1.ty_, r.xt_*m1.xz_ + r.yt_*m1.yz_ + r.zt_*m1.zz_ + r.tt_*m1.tz_, r.xt_*m1.xt_ + r.yt_*m1.yt_ + r.zt_*m1.zt_ + r.tt_*m1.tt_) ); } HepLorentzRotation HepBoost::matrixMultiplication(const HepRep4x4Symmetric & m1) const { HepRep4x4Symmetric r = rep4x4Symmetric(); return HepLorentzRotation( HepRep4x4 ( r.xx_*m1.xx_ + r.xy_*m1.xy_ + r.xz_*m1.xz_ + r.xt_*m1.xt_, r.xx_*m1.xy_ + r.xy_*m1.yy_ + r.xz_*m1.yz_ + r.xt_*m1.yt_, r.xx_*m1.xz_ + r.xy_*m1.yz_ + r.xz_*m1.zz_ + r.xt_*m1.zt_, r.xx_*m1.xt_ + r.xy_*m1.yt_ + r.xz_*m1.zt_ + r.xt_*m1.tt_, r.xy_*m1.xx_ + r.yy_*m1.xy_ + r.yz_*m1.xz_ + r.yt_*m1.xt_, r.xy_*m1.xy_ + r.yy_*m1.yy_ + r.yz_*m1.yz_ + r.yt_*m1.yt_, r.xy_*m1.xz_ + r.yy_*m1.yz_ + r.yz_*m1.zz_ + r.yt_*m1.zt_, r.xy_*m1.xt_ + r.yy_*m1.yt_ + r.yz_*m1.zt_ + r.yt_*m1.tt_, r.xz_*m1.xx_ + r.yz_*m1.xy_ + r.zz_*m1.xz_ + r.zt_*m1.xt_, r.xz_*m1.xy_ + r.yz_*m1.yy_ + r.zz_*m1.yz_ + r.zt_*m1.yt_, r.xz_*m1.xz_ + r.yz_*m1.yz_ + r.zz_*m1.zz_ + r.zt_*m1.zt_, r.xz_*m1.xt_ + r.yz_*m1.yt_ + r.zz_*m1.zt_ + r.zt_*m1.tt_, r.xt_*m1.xx_ + r.yt_*m1.xy_ + r.zt_*m1.xz_ + r.tt_*m1.xt_, r.xt_*m1.xy_ + r.yt_*m1.yy_ + r.zt_*m1.yz_ + r.tt_*m1.yt_, r.xt_*m1.xz_ + r.yt_*m1.yz_ + r.zt_*m1.zz_ + r.tt_*m1.zt_, r.xt_*m1.xt_ + r.yt_*m1.yt_ + r.zt_*m1.zt_ + r.tt_*m1.tt_) ); } HepLorentzRotation HepBoost::operator* (const HepLorentzRotation & lt) const { return matrixMultiplication(lt.rep4x4()); } HepLorentzRotation HepBoost::operator* (const HepBoost & b) const { return matrixMultiplication(b.rep_); } HepLorentzRotation HepBoost::operator* (const HepRotation & r) const { return matrixMultiplication(r.rep4x4()); } // ---------- I/O: std::ostream & HepBoost::print( std::ostream & os ) const { if ( rep_.tt_ <= 1 ) { os << "Lorentz Boost( IDENTITY )"; } else { double norm = boostVector().mag(); os << "\nLorentz Boost " << boostVector()/norm << "\n{beta = " << beta() << " gamma = " << gamma() << "}\n"; } return os; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/LorentzVector.cc0000755000175000017500000001530211753232637017572 0ustar olesoles// -*- C++ -*- // $Id: LorentzVector.cc,v 1.2 2003/08/13 20:00:14 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of that portion of the HepLorentzVector class // which was in the original CLHEP and which does not force loading of either // Rotation.cc or LorentzRotation.cc // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Vector/ZMxpv.h" #include namespace CLHEP { double HepLorentzVector::operator () (int i) const { switch(i) { case X: case Y: case Z: return pp(i); case T: return e(); default: std::cerr << "HepLorentzVector subscripting: bad index (" << i << ")" << std::endl; } return 0.; } double & HepLorentzVector::operator () (int i) { static double dummy; switch(i) { case X: case Y: case Z: return pp(i); case T: return ee; default: std::cerr << "HepLorentzVector subscripting: bad index (" << i << ")" << std::endl; return dummy; } } HepLorentzVector & HepLorentzVector::boost (double bx, double by, double bz){ double b2 = bx*bx + by*by + bz*bz; register double ggamma = 1.0 / std::sqrt(1.0 - b2); register double bp = bx*x() + by*y() + bz*z(); register double gamma2 = b2 > 0 ? (ggamma - 1.0)/b2 : 0.0; setX(x() + gamma2*bp*bx + ggamma*bx*t()); setY(y() + gamma2*bp*by + ggamma*by*t()); setZ(z() + gamma2*bp*bz + ggamma*bz*t()); setT(ggamma*(t() + bp)); return *this; } HepLorentzVector & HepLorentzVector::rotateX(double a) { pp.rotateX(a); return *this; } HepLorentzVector & HepLorentzVector::rotateY(double a) { pp.rotateY(a); return *this; } HepLorentzVector & HepLorentzVector::rotateZ(double a) { pp.rotateZ(a); return *this; } HepLorentzVector & HepLorentzVector::rotateUz(const Hep3Vector &v1) { pp.rotateUz(v1); return *this; } std::ostream & operator<< (std::ostream & os, const HepLorentzVector & v1) { return os << "(" << v1.x() << "," << v1.y() << "," << v1.z() << ";" << v1.t() << ")"; } std::istream & operator>> (std::istream & is, HepLorentzVector & v1) { // Required format is ( a, b, c; d ) that is, four numbers, preceded by // (, followed by ), components of the spatial vector separated by commas, // time component separated by semicolon. The four numbers are taken // as x, y, z, t. double x, y, z, t; char c; is >> std::ws >> c; // ws is defined to invoke eatwhite(istream & ) // see (Stroustrup gray book) page 333 and 345. if (is.fail() || c != '(' ) { std::cerr << "Could not find required opening parenthesis " << "in input of a HepLorentzVector" << std::endl; return is; } is >> x >> std::ws >> c; if (is.fail() || c != ',' ) { std::cerr << "Could not find x value and required trailing comma " << "in input of a HepLorentzVector" << std::endl; return is; } is >> y >> std::ws >> c; if (is.fail() || c != ',' ) { std::cerr << "Could not find y value and required trailing comma " << "in input of a HepLorentzVector" << std::endl; return is; } is >> z >> std::ws >> c; if (is.fail() || c != ';' ) { std::cerr << "Could not find z value and required trailing semicolon " << "in input of a HepLorentzVector" << std::endl; return is; } is >> t >> std::ws >> c; if (is.fail() || c != ')' ) { std::cerr << "Could not find t value and required close parenthesis " << "in input of a HepLorentzVector" << std::endl; return is; } v1.setX(x); v1.setY(y); v1.setZ(z); v1.setT(t); return is; } // The following were added when ZOOM classes were merged in: HepLorentzVector & HepLorentzVector::operator /= (double c) { if (c == 0) { ZMthrowA (ZMxpvInfiniteVector( "Attempt to do LorentzVector /= 0 -- \n" "division by zero would produce infinite or NAN components")); } double oneOverC = 1.0/c; pp *= oneOverC; ee *= oneOverC; return *this; } /* w /= c */ HepLorentzVector operator / (const HepLorentzVector & w, double c) { if (c == 0) { ZMthrowA (ZMxpvInfiniteVector( "Attempt to do LorentzVector / 0 -- \n" "division by zero would produce infinite or NAN components")); } double oneOverC = 1.0/c; return HepLorentzVector (w.getV() * oneOverC, w.getT() * oneOverC); } /* LV = w / c */ Hep3Vector HepLorentzVector::boostVector() const { if (ee == 0) { if (pp.mag2() == 0) { return Hep3Vector(0,0,0); } else { ZMthrowA (ZMxpvInfiniteVector( "boostVector computed for LorentzVector with t=0 -- infinite result")); return pp/ee; } } if (restMass2() <= 0) { ZMthrowC (ZMxpvTachyonic( "boostVector computed for a non-timelike LorentzVector ")); // result will make analytic sense but is physically meaningless } return pp * (1./ee); } /* boostVector */ HepLorentzVector & HepLorentzVector::boostX (double bbeta){ register double b2 = bbeta*bbeta; if (b2 >= 1) { ZMthrowA (ZMxpvTachyonic( "boost along X with beta >= 1 (speed of light) -- no boost done")); } else { register double ggamma = std::sqrt(1./(1-b2)); register double tt = ee; ee = ggamma*(ee + bbeta*pp.getX()); pp.setX(ggamma*(pp.getX() + bbeta*tt)); } return *this; } /* boostX */ HepLorentzVector & HepLorentzVector::boostY (double bbeta){ register double b2 = bbeta*bbeta; if (b2 >= 1) { ZMthrowA (ZMxpvTachyonic( "boost along Y with beta >= 1 (speed of light) -- \nno boost done")); } else { register double ggamma = std::sqrt(1./(1-b2)); register double tt = ee; ee = ggamma*(ee + bbeta*pp.getY()); pp.setY(ggamma*(pp.getY() + bbeta*tt)); } return *this; } /* boostY */ HepLorentzVector & HepLorentzVector::boostZ (double bbeta){ register double b2 = bbeta*bbeta; if (b2 >= 1) { ZMthrowA (ZMxpvTachyonic( "boost along Z with beta >= 1 (speed of light) -- \nno boost done")); } else { register double ggamma = std::sqrt(1./(1-b2)); register double tt = ee; ee = ggamma*(ee + bbeta*pp.getZ()); pp.setZ(ggamma*(pp.getZ() + bbeta*tt)); } return *this; } /* boostZ */ double HepLorentzVector::setTolerance ( double tol ) { // Set the tolerance for two LorentzVectors to be considered near each other double oldTolerance (tolerance); tolerance = tol; return oldTolerance; } double HepLorentzVector::getTolerance ( ) { // Get the tolerance for two LorentzVectors to be considered near each other return tolerance; } double HepLorentzVector::tolerance = Hep3Vector::ToleranceTicks * 2.22045e-16; double HepLorentzVector::metric = 1.0; } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/Rotation.cc0000755000175000017500000001311211753232637016546 0ustar olesoles// -*- C++ -*- // $Id: Rotation.cc,v 1.4 2003/08/13 20:00:14 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of the parts of the the HepRotation class which // were present in the original CLHEP before the merge with ZOOM PhysicsVectors. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include namespace CLHEP { static inline double safe_acos (double x) { if (std::abs(x) <= 1.0) return std::acos(x); return ( (x>0) ? 0 : CLHEP::pi ); } double HepRotation::operator() (int i, int j) const { if (i == 0) { if (j == 0) { return xx(); } if (j == 1) { return xy(); } if (j == 2) { return xz(); } } else if (i == 1) { if (j == 0) { return yx(); } if (j == 1) { return yy(); } if (j == 2) { return yz(); } } else if (i == 2) { if (j == 0) { return zx(); } if (j == 1) { return zy(); } if (j == 2) { return zz(); } } std::cerr << "HepRotation subscripting: bad indices " << "(" << i << "," << j << ")" << std::endl; return 0.0; } HepRotation & HepRotation::rotate(double a, const Hep3Vector& aaxis) { if (a != 0.0) { double ll = aaxis.mag(); if (ll == 0.0) { ZMthrowC (ZMxpvZeroVector("HepRotation: zero axis")); }else{ double sa = std::sin(a), ca = std::cos(a); double dx = aaxis.x()/ll, dy = aaxis.y()/ll, dz = aaxis.z()/ll; HepRotation m1( ca+(1-ca)*dx*dx, (1-ca)*dx*dy-sa*dz, (1-ca)*dx*dz+sa*dy, (1-ca)*dy*dx+sa*dz, ca+(1-ca)*dy*dy, (1-ca)*dy*dz-sa*dx, (1-ca)*dz*dx-sa*dy, (1-ca)*dz*dy+sa*dx, ca+(1-ca)*dz*dz ); transform(m1); } } return *this; } HepRotation & HepRotation::rotateX(double a) { double c1 = std::cos(a); double s1 = std::sin(a); double x1 = ryx, y1 = ryy, z1 = ryz; ryx = c1*x1 - s1*rzx; ryy = c1*y1 - s1*rzy; ryz = c1*z1 - s1*rzz; rzx = s1*x1 + c1*rzx; rzy = s1*y1 + c1*rzy; rzz = s1*z1 + c1*rzz; return *this; } HepRotation & HepRotation::rotateY(double a){ double c1 = std::cos(a); double s1 = std::sin(a); double x1 = rzx, y1 = rzy, z1 = rzz; rzx = c1*x1 - s1*rxx; rzy = c1*y1 - s1*rxy; rzz = c1*z1 - s1*rxz; rxx = s1*x1 + c1*rxx; rxy = s1*y1 + c1*rxy; rxz = s1*z1 + c1*rxz; return *this; } HepRotation & HepRotation::rotateZ(double a) { double c1 = std::cos(a); double s1 = std::sin(a); double x1 = rxx, y1 = rxy, z1 = rxz; rxx = c1*x1 - s1*ryx; rxy = c1*y1 - s1*ryy; rxz = c1*z1 - s1*ryz; ryx = s1*x1 + c1*ryx; ryy = s1*y1 + c1*ryy; ryz = s1*z1 + c1*ryz; return *this; } HepRotation & HepRotation::rotateAxes(const Hep3Vector &newX, const Hep3Vector &newY, const Hep3Vector &newZ) { double del = 0.001; Hep3Vector w = newX.cross(newY); if (std::abs(newZ.x()-w.x()) > del || std::abs(newZ.y()-w.y()) > del || std::abs(newZ.z()-w.z()) > del || std::abs(newX.mag2()-1.) > del || std::abs(newY.mag2()-1.) > del || std::abs(newZ.mag2()-1.) > del || std::abs(newX.dot(newY)) > del || std::abs(newY.dot(newZ)) > del || std::abs(newZ.dot(newX)) > del) { std::cerr << "HepRotation::rotateAxes: bad axis vectors" << std::endl; return *this; }else{ return transform(HepRotation(newX.x(), newY.x(), newZ.x(), newX.y(), newY.y(), newZ.y(), newX.z(), newY.z(), newZ.z())); } } double HepRotation::phiX() const { return (yx() == 0.0 && xx() == 0.0) ? 0.0 : std::atan2(yx(),xx()); } double HepRotation::phiY() const { return (yy() == 0.0 && xy() == 0.0) ? 0.0 : std::atan2(yy(),xy()); } double HepRotation::phiZ() const { return (yz() == 0.0 && xz() == 0.0) ? 0.0 : std::atan2(yz(),xz()); } double HepRotation::thetaX() const { return safe_acos(zx()); } double HepRotation::thetaY() const { return safe_acos(zy()); } double HepRotation::thetaZ() const { return safe_acos(zz()); } void HepRotation::getAngleAxis(double &angle, Hep3Vector &aaxis) const { double cosa = 0.5*(xx()+yy()+zz()-1); double cosa1 = 1-cosa; if (cosa1 <= 0) { angle = 0; aaxis = Hep3Vector(0,0,1); }else{ double x=0, y=0, z=0; if (xx() > cosa) x = std::sqrt((xx()-cosa)/cosa1); if (yy() > cosa) y = std::sqrt((yy()-cosa)/cosa1); if (zz() > cosa) z = std::sqrt((zz()-cosa)/cosa1); if (zy() < yz()) x = -x; if (xz() < zx()) y = -y; if (yx() < xy()) z = -z; angle = (cosa < -1.) ? std::acos(-1.) : std::acos(cosa); aaxis = Hep3Vector(x,y,z); } } bool HepRotation::isIdentity() const { return (rxx == 1.0 && rxy == 0.0 && rxz == 0.0 && ryx == 0.0 && ryy == 1.0 && ryz == 0.0 && rzx == 0.0 && rzy == 0.0 && rzz == 1.0) ? true : false; } int HepRotation::compare ( const HepRotation & r ) const { if (rzzr.rzz) return 1; else if (rzyr.rzy) return 1; else if (rzxr.rzx) return 1; else if (ryzr.ryz) return 1; else if (ryyr.ryy) return 1; else if (ryxr.ryx) return 1; else if (rxzr.rxz) return 1; else if (rxyr.rxy) return 1; else if (rxxr.rxx) return 1; else return 0; } const HepRotation HepRotation::IDENTITY; } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/RotationY.cc0000755000175000017500000001247112050774211016674 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of methods of the HepRotationY class which // were introduced when ZOOM PhysicsVectors was merged in. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/RotationY.h" #include "CLHEP/Vector/AxisAngle.h" #include "CLHEP/Vector/EulerAngles.h" #include "CLHEP/Vector/LorentzRotation.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include #include namespace CLHEP { static inline double safe_acos (double x) { if (std::abs(x) <= 1.0) return std::acos(x); return ( (x>0) ? 0 : CLHEP::pi ); } HepRotationY::HepRotationY(double ddelta) : its_d(proper(ddelta)), its_s(std::sin(ddelta)), its_c(std::cos(ddelta)) {} HepRotationY & HepRotationY::set ( double ddelta ) { its_d = proper(ddelta); its_s = std::sin(its_d); its_c = std::cos(its_d); return *this; } double HepRotationY::phi() const { if ( its_d == 0 ) { return 0; } else if ( (its_d < 0) || (its_d == CLHEP::pi) ) { return +CLHEP::halfpi; } else { return -CLHEP::halfpi; } } // HepRotationY::phi() double HepRotationY::theta() const { return std::fabs( its_d ); } // HepRotationY::theta() double HepRotationY::psi() const { if ( its_d == 0 ) { return 0; } else if ( (its_d < 0) || (its_d == CLHEP::pi) ) { return -CLHEP::halfpi; } else { return +CLHEP::halfpi; } } // HepRotationY::psi() HepEulerAngles HepRotationY::eulerAngles() const { return HepEulerAngles( phi(), theta(), psi() ); } // HepRotationY::eulerAngles() // From the defining code in the implementation of CLHEP (in Rotation.cc) // it is clear that thetaX, phiX form the polar angles in the original // coordinate system of the new X axis (and similarly for phiY and phiZ). // // This code is taken directly from the original CLHEP. However, there are as // shown opportunities for significant speed improvement. double HepRotationY::phiX() const { return (yx() == 0.0 && xx() == 0.0) ? 0.0 : std::atan2(yx(),xx()); // or ---- return 0; } double HepRotationY::phiY() const { return (yy() == 0.0 && xy() == 0.0) ? 0.0 : std::atan2(yy(),xy()); // or ---- return CLHEP::halfpi; } double HepRotationY::phiZ() const { return (yz() == 0.0 && xz() == 0.0) ? 0.0 : std::atan2(yz(),xz()); // or ---- return 0; } double HepRotationY::thetaX() const { return safe_acos(zx()); } double HepRotationY::thetaY() const { return safe_acos(zy()); // or ---- return CLHEP::halfpi; } double HepRotationY::thetaZ() const { return safe_acos(zz()); // or ---- return d; } void HepRotationY::setDelta ( double ddelta ) { set(ddelta); } void HepRotationY::decompose (HepAxisAngle & rotation, Hep3Vector & boost) const { boost.set(0,0,0); rotation = axisAngle(); } void HepRotationY::decompose (Hep3Vector & boost, HepAxisAngle & rotation) const { boost.set(0,0,0); rotation = axisAngle(); } void HepRotationY::decompose (HepRotation & rotation, HepBoost & boost) const { boost.set(0,0,0); rotation = HepRotation(*this); } void HepRotationY::decompose (HepBoost & boost, HepRotation & rotation) const { boost.set(0,0,0); rotation = HepRotation(*this); } double HepRotationY::distance2( const HepRotationY & r ) const { double answer = 2.0 * ( 1.0 - ( its_s * r.its_s + its_c * r.its_c ) ) ; return (answer >= 0) ? answer : 0; } double HepRotationY::distance2( const HepRotation & r ) const { double sum = xx() * r.xx() + xz() * r.xz() + r.yy() + zx() * r.zx() + zz() * r.zz(); double answer = 3.0 - sum; return (answer >= 0 ) ? answer : 0; } double HepRotationY::distance2( const HepLorentzRotation & lt ) const { HepAxisAngle a; Hep3Vector b; lt.decompose(b, a); double bet = b.beta(); double bet2 = bet*bet; HepRotation r(a); return bet2/(1-bet2) + distance2(r); } double HepRotationY::distance2( const HepBoost & lt ) const { return distance2( HepLorentzRotation(lt)); } double HepRotationY::howNear( const HepRotationY & r ) const { return std::sqrt(distance2(r)); } double HepRotationY::howNear( const HepRotation & r ) const { return std::sqrt(distance2(r)); } double HepRotationY::howNear( const HepBoost & lt ) const { return std::sqrt(distance2(lt)); } double HepRotationY::howNear( const HepLorentzRotation & lt ) const { return std::sqrt(distance2(lt)); } bool HepRotationY::isNear(const HepRotationY & r,double epsilon)const{ return (distance2(r) <= epsilon*epsilon); } bool HepRotationY::isNear(const HepRotation & r,double epsilon)const { return (distance2(r) <= epsilon*epsilon); } bool HepRotationY::isNear( const HepBoost & lt,double epsilon) const { return (distance2(lt) <= epsilon*epsilon); } bool HepRotationY::isNear( const HepLorentzRotation & lt, double epsilon) const { return (distance2(lt) <= epsilon*epsilon); } double HepRotationY::norm2() const { return 2.0 - 2.0 * its_c; } std::ostream & HepRotationY::print( std::ostream & os ) const { os << "\nRotation about Y (" << its_d << ") [cos d = " << its_c << " sin d = " << its_s << "]\n"; return os; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/LorentzRotationD.cc0000755000175000017500000001320511753232637020233 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of those parts of the HepLorentzRotation class // which involve decomposition into Boost*Rotation. #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/LorentzRotation.h" namespace CLHEP { // ---------- Decomposition: void HepLorentzRotation::decompose (HepBoost & bboost, HepRotation & rotation) const { // The boost will be the pure boost based on column 4 of the transformation // matrix. Since the constructor takes the beta vector, and not beta*gamma, // we first divide through by gamma = the tt element. This of course can // never be zero since the last row has t**2 - v**2 = +1. Hep3Vector betaVec ( xt(), yt(), zt() ); betaVec *= 1.0 / tt(); bboost.set( betaVec ); // The rotation will be inverse of B times T. HepBoost B( -betaVec ); HepLorentzRotation R( B * *this ); HepRep3x3 m1 ( R.xx(), R.xy(), R.xz(), R.yx(), R.yy(), R.yz(), R.zx(), R.zy(), R.zz() ); rotation.set( m1 ); rotation.rectify(); return; } void HepLorentzRotation::decompose (Hep3Vector & bboost, HepAxisAngle & rotation) const { HepRotation r; HepBoost b; decompose(b,r); bboost = b.boostVector(); rotation = r.axisAngle(); return; } void HepLorentzRotation::decompose (HepRotation & rotation, HepBoost & bboost) const { // In this case the pure boost is based on row 4 of the matrix. Hep3Vector betaVec( tx(), ty(), tz() ); betaVec *= 1.0 / tt(); bboost.set( betaVec ); // The rotation will be T times the inverse of B. HepBoost B( -betaVec ); HepLorentzRotation R( *this * B ); HepRep3x3 m1 ( R.xx(), R.xy(), R.xz(), R.yx(), R.yy(), R.yz(), R.zx(), R.zy(), R.zz() ); rotation.set( m1 ); rotation.rectify(); return; } void HepLorentzRotation::decompose (HepAxisAngle & rotation, Hep3Vector & bboost) const { HepRotation r; HepBoost b; decompose(r,b); rotation = r.axisAngle(); bboost = b.boostVector(); return; } double HepLorentzRotation::distance2( const HepBoost & b ) const { HepBoost b1; HepRotation r1; decompose( b1, r1 ); double db2 = b1.distance2( b ); double dr2 = r1.norm2(); return ( db2 + dr2 ); } double HepLorentzRotation::distance2( const HepRotation & r ) const { HepBoost b1; HepRotation r1; decompose( b1, r1 ); double db2 = b1.norm2( ); double dr2 = r1.distance2( r ); return ( db2 + dr2 ); } double HepLorentzRotation::distance2( const HepLorentzRotation & lt ) const { HepBoost b1; HepRotation r1; decompose( b1, r1 ); HepBoost b2; HepRotation r2; lt.decompose (b2, r2); double db2 = b1.distance2( b2 ); double dr2 = r1.distance2( r2 ); return ( db2 + dr2 ); } double HepLorentzRotation::howNear( const HepBoost & b ) const { return std::sqrt( distance2( b ) ); } double HepLorentzRotation::howNear( const HepRotation & r ) const { return std::sqrt( distance2( r ) ); } double HepLorentzRotation::howNear( const HepLorentzRotation & lt )const { return std::sqrt( distance2( lt ) ); } bool HepLorentzRotation::isNear( const HepBoost & b, double epsilon ) const { HepBoost b1; HepRotation r1; decompose( b1, r1 ); double db2 = b1.distance2(b); if ( db2 > epsilon*epsilon ) { return false; // Saves the time-consuming Rotation::norm2 } double dr2 = r1.norm2(); return ( (db2 + dr2) <= epsilon*epsilon ); } bool HepLorentzRotation::isNear( const HepRotation & r, double epsilon ) const { HepBoost b1; HepRotation r1; decompose( b1, r1 ); double db2 = b1.norm2(); if ( db2 > epsilon*epsilon ) { return false; // Saves the time-consuming Rotation::distance2 } double dr2 = r1.distance2(r); return ( (db2 + dr2) <= epsilon*epsilon ); } bool HepLorentzRotation::isNear( const HepLorentzRotation & lt, double epsilon ) const { HepBoost b1; HepRotation r1; decompose( b1, r1 ); HepBoost b2; HepRotation r2; lt.decompose (b2, r2); double db2 = b1.distance2(b2); if ( db2 > epsilon*epsilon ) { return false; // Saves the time-consuming Rotation::distance2 } double dr2 = r1.distance2(r2); return ( (db2 + dr2) <= epsilon*epsilon ); } double HepLorentzRotation::norm2() const { HepBoost b; HepRotation r; decompose( b, r ); return b.norm2() + r.norm2(); } void HepLorentzRotation::rectify() { // Assuming the representation of this is close to a true LT, // but may have drifted due to round-off error from many operations, // this forms an "exact" orthosymplectic matrix for the LT again. // There are several ways to do this, all equivalent to lowest order in // the corrected error. We choose to form an LT based on the inverse boost // extracted from row 4, and left-multiply by LT to form what would be // a rotation if the LT were kosher. We drop the possibly non-zero t // components of that, rectify that rotation and multiply back by the boost. Hep3Vector beta (tx(), ty(), tz()); double gam = tt(); // NaN-proofing if ( gam <= 0 ) { ZMthrowA ( ZMxpvImproperTransformation ( "rectify() on a transformation with tt() <= 0 - will not help!" )); gam = 1; } beta *= 1.0/gam; HepLorentzRotation R = (*this) * HepBoost(-beta); HepRep3x3 m1 ( R.xx(), R.xy(), R.xz(), R.yx(), R.yy(), R.yz(), R.zx(), R.zy(), R.zz() ); HepRotation Rgood (m1); Rgood.rectify(); set ( Rgood, HepBoost(beta) ); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/.cvsignore0000755000175000017500000000001407705452574016443 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Vector/src/SpaceVectorR.cc0000755000175000017500000001025311753232637017312 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of the subset of those methods of the Hep3Vector // class which originated from the ZOOM SpaceVector class *and* which involve // the concepts of rotation. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Vector/AxisAngle.h" #include "CLHEP/Vector/EulerAngles.h" #include "CLHEP/Vector/ZMxpv.h" namespace CLHEP { //-************************ // rotate about axis //-************************ Hep3Vector & Hep3Vector::rotate (const Hep3Vector & axis, double ddelta) { double r1 = axis.mag(); if ( r1 == 0 ) { ZMthrowA (ZMxpvZeroVector( "Attempt to rotate around a zero vector axis! ")); return *this; } register double scale=1.0/r1; register double ux = scale*axis.getX(); register double uy = scale*axis.getY(); register double uz = scale*axis.getZ(); double cd = std::cos(ddelta); double sd = std::sin(ddelta); register double ocd = 1 - cd; double rx; double ry; double rz; { register double ocdux = ocd * ux; rx = dx * ( cd + ocdux * ux ) + dy * ( ocdux * uy - sd * uz ) + dz * ( ocdux * uz + sd * uy ) ; } { register double ocduy = ocd * uy; ry = dy * ( cd + ocduy * uy ) + dz * ( ocduy * uz - sd * ux ) + dx * ( ocduy * ux + sd * uz ) ; } { register double ocduz = ocd * uz; rz = dz * ( cd + ocduz * uz ) + dx * ( ocduz * ux - sd * uy ) + dy * ( ocduz * uy + sd * ux ) ; } dx = rx; dy = ry; dz = rz; return *this; } /* rotate */ //-**************************** // rotate by three euler angles //-**************************** Hep3Vector & Hep3Vector::rotate (double phi1, double theta1, double psi1) { double rx; double ry; double rz; register double sinPhi = std::sin( phi1 ), cosPhi = std::cos( phi1 ); register double sinTheta = std::sin( theta1 ), cosTheta1 = std::cos( theta1 ); register double sinPsi = std::sin( psi1 ), cosPsi = std::cos( psi1 ); rx = (cosPsi * cosPhi - cosTheta1 * sinPsi * sinPhi) * dx + (cosPsi * sinPhi + cosTheta1 * sinPsi * cosPhi) * dy + (sinPsi * sinTheta) * dz ; ry = (- sinPsi * cosPhi - cosTheta1 * cosPsi * sinPhi) * dx + (- sinPsi * sinPhi + cosTheta1 * cosPsi * cosPhi) * dy + (cosPsi * sinTheta) * dz ; rz = (sinTheta * sinPhi) * dx + (- sinTheta * cosPhi) * dy + (cosTheta1) * dz ; dx = rx; dy = ry; dz = rz; return *this; } /* rotate */ //-******************* // rotate(HepAxisAngle) // rotate(HepEulerAngles) //-******************* Hep3Vector & Hep3Vector::rotate (const HepAxisAngle & ax ) { return rotate( ax.getAxis(), ax.delta() ); } Hep3Vector & Hep3Vector::rotate (const HepEulerAngles & ex ) { return rotate( ex.phi(), ex.theta(), ex.psi() ); } //-*********************** // rotationOf(HepAxisAngle) // rotationOf(HepEulerAngles) // and coordinate axis rotations //-*********************** Hep3Vector rotationOf (const Hep3Vector & vec, const HepAxisAngle & ax) { Hep3Vector vv(vec); return vv.rotate (ax); } Hep3Vector rotationOf (const Hep3Vector & vec, const Hep3Vector & axis, double ddelta) { Hep3Vector vv(vec); return vv.rotate(axis, ddelta); } Hep3Vector rotationOf (const Hep3Vector & vec, const HepEulerAngles & ex) { Hep3Vector vv(vec); return vv.rotate (ex); } Hep3Vector rotationOf (const Hep3Vector & vec, double phi, double theta, double psi) { Hep3Vector vv(vec); return vv.rotate(phi, theta, psi); } Hep3Vector rotationXOf (const Hep3Vector & vec, double ddelta) { Hep3Vector vv(vec); return vv.rotateX (ddelta); } Hep3Vector rotationYOf (const Hep3Vector & vec, double ddelta) { Hep3Vector vv(vec); return vv.rotateY (ddelta); } Hep3Vector rotationZOf (const Hep3Vector & vec, double ddelta) { Hep3Vector vv(vec); return vv.rotateZ (ddelta); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/TwoVector.cc0000755000175000017500000001163011761726606016711 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of the Hep2Vector class. // //------------------------------------------------------------- #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/TwoVector.h" #include "CLHEP/Vector/ZMxpv.h" #include "CLHEP/Vector/ThreeVector.h" #include #include namespace CLHEP { double Hep2Vector::tolerance = Hep2Vector::ZMpvToleranceTicks * 2.22045e-16; double Hep2Vector::setTolerance (double tol) { // Set the tolerance for Hep2Vectors to be considered near one another double oldTolerance (tolerance); tolerance = tol; return oldTolerance; } double Hep2Vector::operator () (int i) const { if (i == 0) { return x(); }else if (i == 1) { return y(); }else{ ZMthrowA(ZMxpvIndexRange( "Hep2Vector::operator(): bad index")); return 0.0; } } double & Hep2Vector::operator () (int i) { static double dummy; switch(i) { case X: return dx; case Y: return dy; default: ZMthrowA (ZMxpvIndexRange( "Hep2Vector::operator() : bad index")); return dummy; } } void Hep2Vector::rotate(double angler) { double s1 = std::sin(angler); double c = std::cos(angler); double xx = dx; dx = c*xx - s1*dy; dy = s1*xx + c*dy; } Hep2Vector operator/ (const Hep2Vector & p, double a) { if (a==0) { ZMthrowA(ZMxpvInfiniteVector( "Division of Hep2Vector by zero")); } return Hep2Vector(p.x()/a, p.y()/a); } std::ostream & operator << (std::ostream & os, const Hep2Vector & q) { os << "(" << q.x() << ", " << q.y() << ")"; return os; } void ZMinput2doubles ( std::istream & is, const char * type, double & x, double & y ); std::istream & operator>>(std::istream & is, Hep2Vector & p) { double x, y; ZMinput2doubles ( is, "Hep2Vector", x, y ); p.set(x, y); return is; } // operator>>() Hep2Vector::operator Hep3Vector () const { return Hep3Vector ( dx, dy, 0.0 ); } int Hep2Vector::compare (const Hep2Vector & v) const { if ( dy > v.dy ) { return 1; } else if ( dy < v.dy ) { return -1; } else if ( dx > v.dx ) { return 1; } else if ( dx < v.dx ) { return -1; } else { return 0; } } /* Compare */ bool Hep2Vector::operator > (const Hep2Vector & v) const { return (compare(v) > 0); } bool Hep2Vector::operator < (const Hep2Vector & v) const { return (compare(v) < 0); } bool Hep2Vector::operator>= (const Hep2Vector & v) const { return (compare(v) >= 0); } bool Hep2Vector::operator<= (const Hep2Vector & v) const { return (compare(v) <= 0); } bool Hep2Vector::isNear(const Hep2Vector & p, double epsilon) const { double limit = dot(p)*epsilon*epsilon; return ( (*this - p).mag2() <= limit ); } /* isNear() */ double Hep2Vector::howNear(const Hep2Vector & p ) const { double d = (*this - p).mag2(); double pdp = dot(p); if ( (pdp > 0) && (d < pdp) ) { return std::sqrt (d/pdp); } else if ( (pdp == 0) && (d == 0) ) { return 0; } else { return 1; } } /* howNear */ double Hep2Vector::howParallel (const Hep2Vector & v) const { // | V1 x V2 | / | V1 dot V2 | // Of course, the "cross product" is fictitious but the math is valid double v1v2 = std::fabs(dot(v)); if ( v1v2 == 0 ) { // Zero is parallel to no other vector except for zero. return ( (mag2() == 0) && (v.mag2() == 0) ) ? 0 : 1; } double abscross = std::fabs ( dx * v.y() - dy - v.x() ); if ( abscross >= v1v2 ) { return 1; } else { return abscross/v1v2; } } /* howParallel() */ bool Hep2Vector::isParallel (const Hep2Vector & v, double epsilon) const { // | V1 x V2 | <= epsilon * | V1 dot V2 | // Of course, the "cross product" is fictitious but the math is valid double v1v2 = std::fabs(dot(v)); if ( v1v2 == 0 ) { // Zero is parallel to no other vector except for zero. return ( (mag2() == 0) && (v.mag2() == 0) ); } double abscross = std::fabs ( dx * v.y() - dy - v.x() ); return ( abscross <= epsilon * v1v2 ); } /* isParallel() */ double Hep2Vector::howOrthogonal (const Hep2Vector & v) const { // | V1 dot V2 | / | V1 x V2 | // Of course, the "cross product" is fictitious but the math is valid double v1v2 = std::fabs(dot(v)); if ( v1v2 == 0 ) { return 0; // Even if one or both are 0, they are considered orthogonal } double abscross = std::fabs ( dx * v.y() - dy - v.x() ); if ( v1v2 >= abscross ) { return 1; } else { return v1v2/abscross; } } /* howOrthogonal() */ bool Hep2Vector::isOrthogonal (const Hep2Vector & v, double epsilon) const { // | V1 dot V2 | <= epsilon * | V1 x V2 | // Of course, the "cross product" is fictitious but the math is valid double v1v2 = std::fabs(dot(v)); double abscross = std::fabs ( dx * v.y() - dy - v.x() ); return ( v1v2 <= epsilon * abscross ); } /* isOrthogonal() */ } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/SpaceVectorP.cc0000755000175000017500000001101711753232637017307 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // SpaceVector // // This is the implementation of the subset of those methods of the Hep3Vector // class which originated from the ZOOM SpaceVector class *and* which involve // intrinsic properties or propeties relative to a second vector. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Vector/ZMxpv.h" #include namespace CLHEP { //-******************************** // - 5 - // Intrinsic properties of a vector // and properties relative to a direction // //-******************************** double Hep3Vector::beta() const { double b = std::sqrt(mag2()); if (b >= 1) { ZMthrowA (ZMxpvTachyonic( "Beta taken for Hep3Vector of at least unit length")); } return b; } double Hep3Vector::gamma() const { double bbeta = std::sqrt(mag2()); if (bbeta == 1) { ZMthrowA (ZMxpvTachyonic( "Gamma taken for Hep3Vector of unit magnitude -- infinite result")); } if (bbeta > 1) { ZMthrowA (ZMxpvTachyonic( "Gamma taken for Hep3Vector of more than unit magnitude -- " "the sqrt function would return NAN" )); } return 1/std::sqrt(1-bbeta*bbeta); } double Hep3Vector::rapidity() const { if (std::fabs(dz) == 1) { ZMthrowC (ZMxpvTachyonic( "Rapidity in Z direction taken for Hep3Vector with |Z| = 1 -- \n" "the log should return infinity")); } if (std::fabs(dz) > 1) { ZMthrowA (ZMxpvTachyonic( "Rapidity in Z direction taken for Hep3Vector with |Z| > 1 -- \n" "the log would return a NAN" )); } // Want inverse std::tanh(dz): return (.5 * std::log((1+dz)/(1-dz)) ); } double Hep3Vector::coLinearRapidity() const { double b = beta(); if (b == 1) { ZMthrowA (ZMxpvTachyonic( "Co-linear Rapidity taken for Hep3Vector of unit length -- " "the log should return infinity")); } if (b > 1) { ZMthrowA (ZMxpvTachyonic( "Co-linear Rapidity taken for Hep3Vector of more than unit length -- " "the log would return a NAN" )); } // Want inverse std::tanh(b): return (.5 * std::log((1+b)/(1-b)) ); } //-*********************************************** // Other properties relative to a reference vector //-*********************************************** Hep3Vector Hep3Vector::project (const Hep3Vector & v2) const { double mag2v2 = v2.mag2(); if (mag2v2 == 0) { ZMthrowA (ZMxpvZeroVector( "Attempt to take projection of vector against zero reference vector ")); return project(); } return ( v2 * (dot(v2)/mag2v2) ); } double Hep3Vector::rapidity(const Hep3Vector & v2) const { double vmag = v2.mag(); if ( vmag == 0 ) { ZMthrowA (ZMxpvZeroVector( "Rapidity taken with respect to zero vector" )); return 0; } double z1 = dot(v2)/vmag; if (std::fabs(z1) >= 1) { ZMthrowA (ZMxpvTachyonic( "Rapidity taken for too large a Hep3Vector " "-- would return infinity or NAN")); } // Want inverse std::tanh(z1): return (.5 * std::log((1+z1)/(1-z1)) ); } double Hep3Vector::eta(const Hep3Vector & v2) const { // Defined as -std::log ( std::tan ( .5* theta(u) ) ); // // Quicker is to use cosTheta: // std::tan (theta/2) = std::sin(theta)/(1 + std::cos(theta)) double r1 = getR(); double v2r = v2.mag(); if ( (r1 == 0) || (v2r == 0) ) { ZMthrowA (ZMxpvAmbiguousAngle( "Cannot find pseudorapidity of a zero vector relative to a vector")); return 0.; } double c = dot(v2)/(r1*v2r); if ( c >= 1 ) { c = 1; //-| We don't want to return NAN because of roundoff ZMthrowC (ZMxpvInfinity( "Pseudorapidity of vector relative to parallel vector -- " "will give infinite result")); // We can just go on; tangent will be 0, so // std::log (tangent) will be -INFINITY, so result // will be +INFINITY. } if ( c <= -1 ) { ZMthrowC (ZMxpvInfinity( "Pseudorapidity of vector relative to anti-parallel vector -- " "will give negative infinite result")); //-| We don't want to return NAN because of roundoff return ( negativeInfinity() ); // If we just went on, the tangent would be NAN // so return would be NAN. But the proper limit // of tan is +Infinity, so the return should be // -INFINITY. } double tangent = std::sqrt (1-c*c) / ( 1 + c ); return (- std::log (tangent)); } /* eta (u) */ } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/BoostZ.cc0000755000175000017500000001034311753232637016172 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of the HepBoostZ class. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/BoostZ.h" #include "CLHEP/Vector/Boost.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Vector/LorentzRotation.h" #include "CLHEP/Vector/ZMxpv.h" namespace CLHEP { // ---------- Constructors and Assignment: HepBoostZ & HepBoostZ::set (double bbeta) { double b2 = bbeta*bbeta; if (b2 >= 1) { ZMthrowA (ZMxpvTachyonic( "Beta supplied to set HepBoostZ represents speed >= c.")); beta_ = 1.0 - 1.0E-8; // NaN-proofing gamma_ = 1.0 / std::sqrt(1.0 - b2); return *this; } beta_ = bbeta; gamma_ = 1.0 / std::sqrt(1.0 - b2); return *this; } // ---------- Accessors: HepRep4x4 HepBoostZ::rep4x4() const { double bg = beta_*gamma_; return HepRep4x4( 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, gamma_, bg, 0, 0, bg, gamma_ ); } HepRep4x4Symmetric HepBoostZ::rep4x4Symmetric() const { double bg = beta_*gamma_; return HepRep4x4Symmetric( 1, 0, 0, 0, 1, 0, 0, gamma_, bg, gamma_ ); } // ---------- Decomposition: void HepBoostZ::decompose (HepRotation & rotation, HepBoost & boost) const { HepAxisAngle vdelta = HepAxisAngle(); rotation = HepRotation(vdelta); Hep3Vector bbeta = boostVector(); boost = HepBoost(bbeta); } void HepBoostZ::decompose (HepAxisAngle & rotation, Hep3Vector & boost) const { rotation = HepAxisAngle(); boost = boostVector(); } void HepBoostZ::decompose (HepBoost & boost, HepRotation & rotation) const { HepAxisAngle vdelta = HepAxisAngle(); rotation = HepRotation(vdelta); Hep3Vector bbeta = boostVector(); boost = HepBoost(bbeta); } void HepBoostZ::decompose (Hep3Vector & boost, HepAxisAngle & rotation) const { rotation = HepAxisAngle(); boost = boostVector(); } // ---------- Comparisons: double HepBoostZ::distance2( const HepBoost & b ) const { return b.distance2(*this); } double HepBoostZ::distance2( const HepRotation & r ) const { double db2 = norm2(); double dr2 = r.norm2(); return (db2 + dr2); } double HepBoostZ::distance2( const HepLorentzRotation & lt ) const { HepBoost b1; HepRotation r1; lt.decompose(b1,r1); double db2 = distance2(b1); double dr2 = r1.norm2(); return (db2 + dr2); } bool HepBoostZ::isNear (const HepRotation & r, double epsilon) const { double db2 = norm2(); if (db2 > epsilon*epsilon) return false; double dr2 = r.norm2(); return (db2+dr2 <= epsilon*epsilon); } bool HepBoostZ::isNear ( const HepLorentzRotation & lt, double epsilon ) const { HepBoost b1; HepRotation r1; double db2 = distance2(b1); lt.decompose(b1,r1); if (db2 > epsilon*epsilon) return false; double dr2 = r1.norm2(); return (db2 + dr2); } // ---------- Properties: void HepBoostZ::rectify() { // Assuming the representation of this is close to a true pure boost, // but may have drifted due to round-off error from many operations, // this forms an "exact" pure BoostZ matrix for again. double b2 = beta_*beta_; if (b2 >= 1) { beta_ = 1.0 - 1.0e-8; // NaN-proofing b2 = beta_*beta_; } gamma_ = 1.0 / std::sqrt(1.0 - b2); } // ---------- Application: // ---------- Operations in the group of 4-Rotations HepBoostZ HepBoostZ::operator * (const HepBoostZ & b) const { return HepBoostZ ( (beta()+b.beta()) / (1+beta()*b.beta()) ); } HepLorentzRotation HepBoostZ::operator * (const HepBoost & b) const { HepLorentzRotation me (*this); return me*b; } HepLorentzRotation HepBoostZ::operator * (const HepRotation & r) const { HepLorentzRotation me (*this); return me*r; } HepLorentzRotation HepBoostZ::operator * (const HepLorentzRotation & lt) const { HepLorentzRotation me (*this); return me*lt; } // ---------- I/O std::ostream & HepBoostZ::print( std::ostream & os ) const { os << "Boost in Z direction (beta = " << beta_ << ", gamma = " << gamma_ << ") "; return os; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/BoostX.cc0000755000175000017500000001044611753232637016174 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of the HepBoostX class. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/BoostX.h" #include "CLHEP/Vector/Boost.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Vector/LorentzRotation.h" #include "CLHEP/Vector/ZMxpv.h" namespace CLHEP { // ---------- Constructors and Assignment: HepBoostX & HepBoostX::set (double bbeta) { double b2 = bbeta*bbeta; if (b2 >= 1) { ZMthrowA (ZMxpvTachyonic( "Beta supplied to set HepBoostX represents speed >= c.")); beta_ = 1.0 - 1.0E-8; // NaN-proofing gamma_ = 1.0 / std::sqrt(1.0 - b2); return *this; } beta_ = bbeta; gamma_ = 1.0 / std::sqrt(1.0 - b2); return *this; } // ---------- Accessors: HepRep4x4 HepBoostX::rep4x4() const { double bg = beta_*gamma_; return HepRep4x4( gamma_, 0, 0, bg, 0, 1, 0, 0, 0, 0, 1, 0, bg, 0, 0, gamma_ ); } HepRep4x4Symmetric HepBoostX::rep4x4Symmetric() const { double bg = beta_*gamma_; return HepRep4x4Symmetric( gamma_, 0, 0, bg, 1, 0, 0, 1, 0, gamma_ ); } // ---------- Decomposition: void HepBoostX::decompose (HepRotation & rotation, HepBoost & boost) const { HepAxisAngle vdelta = HepAxisAngle(); rotation = HepRotation(vdelta); Hep3Vector bbeta = boostVector(); boost = HepBoost(bbeta); } void HepBoostX::decompose (HepAxisAngle & rotation, Hep3Vector & boost) const { rotation = HepAxisAngle(); boost = boostVector(); } void HepBoostX::decompose (HepBoost & boost, HepRotation & rotation) const { HepAxisAngle vdelta = HepAxisAngle(); rotation = HepRotation(vdelta); Hep3Vector bbeta = boostVector(); boost = HepBoost(bbeta); } void HepBoostX::decompose (Hep3Vector & boost, HepAxisAngle & rotation) const { rotation = HepAxisAngle(); boost = boostVector(); } // ---------- Comparisons: double HepBoostX::distance2( const HepBoost & b ) const { return b.distance2(*this); } double HepBoostX::distance2( const HepRotation & r ) const { double db2 = norm2(); double dr2 = r.norm2(); return (db2 + dr2); } double HepBoostX::distance2( const HepLorentzRotation & lt ) const { HepBoost b1; HepRotation r1; lt.decompose(b1,r1); double db2 = distance2(b1); double dr2 = r1.norm2(); return (db2 + dr2); } bool HepBoostX::isNear (const HepRotation & r, double epsilon) const { double db2 = norm2(); if (db2 > epsilon*epsilon) return false; double dr2 = r.norm2(); return (db2+dr2 <= epsilon*epsilon); } bool HepBoostX::isNear ( const HepLorentzRotation & lt, double epsilon) const { HepBoost b1; HepRotation r1; double db2 = distance2(b1); lt.decompose(b1,r1); if (db2 > epsilon*epsilon) return false; double dr2 = r1.norm2(); return (db2 + dr2); } // ---------- Properties: void HepBoostX::rectify() { // Assuming the representation of this is close to a true pure boost, // but may have drifted due to round-off error from many operations, // this forms an "exact" pure boostX matrix for again. double b2 = beta_*beta_; if (b2 >= 1) { beta_ = 1.0 - 1.0e-8; // NaN-proofing b2 = beta_*beta_; } gamma_ = 1.0 / std::sqrt(1.0 - b2); } // ---------- Application: // ---------- Operations in the group of 4-Rotations HepBoostX HepBoostX::operator * (const HepBoostX & b) const { return HepBoostX ( (beta()+b.beta()) / (1+beta()*b.beta()) ); } HepLorentzRotation HepBoostX::operator * (const HepBoost & b) const { HepLorentzRotation me (*this); return me*b; } HepLorentzRotation HepBoostX::operator * (const HepRotation & r) const { HepLorentzRotation me (*this); return me*r; } HepLorentzRotation HepBoostX::operator * (const HepLorentzRotation & lt) const { HepLorentzRotation me (*this); return me*lt; } // ---------- I/O: std::ostream & HepBoostX::print( std::ostream & os ) const { os << "Boost in X direction (beta = " << beta_ << ", gamma = " << gamma_ << ") "; return os; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/LorentzVectorK.cc0000755000175000017500000001475611761726606017724 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is part of the implementation of the HepLorentzVector class: // Those methods which originated from ZOOM and which deal with relativistic // kinematic properties. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Vector/ZMxpv.h" #include namespace CLHEP { //-****************** // Metric flexibility //-****************** ZMpvMetric_t HepLorentzVector::setMetric( ZMpvMetric_t a1 ) { ZMpvMetric_t oldMetric = (metric > 0) ? TimePositive : TimeNegative; if ( a1 == TimeNegative ) { metric = -1.0; } else { metric = 1.0; } return oldMetric; } ZMpvMetric_t HepLorentzVector::getMetric() { return ( (metric > 0) ? TimePositive : TimeNegative ); } //-******** // plus // minus //-******** double HepLorentzVector::plus (const Hep3Vector & ref) const { double r = ref.mag(); if (r == 0) { ZMthrowA (ZMxpvZeroVector( "A zero vector used as reference to LorentzVector plus-part")); return ee; } return ee + pp.dot(ref)/r; } /* plus */ double HepLorentzVector::minus (const Hep3Vector & ref) const { double r = ref.mag(); if (r == 0) { ZMthrowA (ZMxpvZeroVector( "A zero vector used as reference to LorentzVector minus-part")); return ee; } return ee - pp.dot(ref)/r; } /* plus */ HepLorentzVector HepLorentzVector::rest4Vector() const { return HepLorentzVector (0, 0, 0, (t() < 0.0 ? -m() : m())); } //-******** // beta // gamma //-******** double HepLorentzVector::beta() const { if (ee == 0) { if (pp.mag2() == 0) { return 0; } else { ZMthrowA (ZMxpvInfiniteVector( "beta computed for HepLorentzVector with t=0 -- infinite result")); return 1./ee; } } if (restMass2() <= 0) { ZMthrowC (ZMxpvTachyonic( "beta computed for a non-timelike HepLorentzVector")); // result will make analytic sense but is physically meaningless } return std::sqrt (pp.mag2() / (ee*ee)) ; } /* beta */ double HepLorentzVector::gamma() const { double v2 = pp.mag2(); double t2 = ee*ee; if (ee == 0) { if (pp.mag2() == 0) { return 1; } else { ZMthrowC (ZMxpvInfiniteVector( "gamma computed for HepLorentzVector with t=0 -- zero result")); return 0; } } if (t2 < v2) { ZMthrowA (ZMxpvSpacelike( "gamma computed for a spacelike HepLorentzVector -- imaginary result")); // analytic result would be imaginary. return 0; } else if ( t2 == v2 ) { ZMthrowA (ZMxpvInfinity( "gamma computed for a lightlike HepLorentzVector -- infinite result")); } return 1./std::sqrt(1. - v2/t2 ); } /* gamma */ //-*************** // rapidity // pseudorapidity // eta //-*************** double HepLorentzVector::rapidity() const { register double z1 = pp.getZ(); if (std::fabs(ee) == std::fabs(z1)) { ZMthrowA (ZMxpvInfinity( "rapidity for 4-vector with |E| = |Pz| -- infinite result")); } if (std::fabs(ee) < std::fabs(z1)) { ZMthrowA (ZMxpvSpacelike( "rapidity for spacelike 4-vector with |E| < |Pz| -- undefined")); return 0; } double q = (ee + z1) / (ee - z1); //-| This cannot be negative now, since both numerator //-| and denominator have the same sign as ee. return .5 * std::log(q); } /* rapidity */ double HepLorentzVector::rapidity(const Hep3Vector & ref) const { register double r = ref.mag2(); if (r == 0) { ZMthrowA (ZMxpvZeroVector( "A zero vector used as reference to LorentzVector rapidity")); return 0; } register double vdotu = pp.dot(ref)/std::sqrt(r); if (std::fabs(ee) == std::fabs(vdotu)) { ZMthrowA (ZMxpvInfinity( "rapidity for 4-vector with |E| = |Pu| -- infinite result")); } if (std::fabs(ee) < std::fabs(vdotu)) { ZMthrowA (ZMxpvSpacelike( "rapidity for spacelike 4-vector with |E| < |P*ref| -- undefined ")); return 0; } double q = (ee + vdotu) / (ee - vdotu); return .5 * std::log(q); } /* rapidity(ref) */ double HepLorentzVector::coLinearRapidity() const { register double v1 = pp.mag(); if (std::fabs(ee) == std::fabs(v1)) { ZMthrowA (ZMxpvInfinity( "co-Linear rapidity for 4-vector with |E| = |P| -- infinite result")); } if (std::fabs(ee) < std::fabs(v1)) { ZMthrowA (ZMxpvSpacelike( "co-linear rapidity for spacelike 4-vector -- undefined")); return 0; } double q = (ee + v1) / (ee - v1); return .5 * std::log(q); } /* rapidity */ //-************* // invariantMass //-************* double HepLorentzVector::invariantMass(const HepLorentzVector & w) const { double m1 = invariantMass2(w); if (m1 < 0) { // We should find out why: if ( ee * w.ee < 0 ) { ZMthrowA (ZMxpvNegativeMass( "invariant mass meaningless: \n" "a negative-mass input led to spacelike 4-vector sum" )); return 0; } else if ( (isSpacelike() && !isLightlike()) || (w.isSpacelike() && !w.isLightlike()) ) { ZMthrowA (ZMxpvSpacelike( "invariant mass meaningless because of spacelike input")); return 0; } else { // Invariant mass squared for a pair of timelike or lightlike vectors // mathematically cannot be negative. If the vectors are within the // tolerance of being lightlike or timelike, we can assume that prior // or current roundoffs have caused the negative result, and return 0 // without comment. return 0; } } return (ee+w.ee >=0 ) ? std::sqrt(m1) : - std::sqrt(m1); } /* invariantMass */ //-*************** // findBoostToCM //-*************** Hep3Vector HepLorentzVector::findBoostToCM() const { return -boostVector(); } /* boostToCM() */ Hep3Vector HepLorentzVector::findBoostToCM (const HepLorentzVector & w) const { double t1 = ee + w.ee; Hep3Vector v1 = pp + w.pp; if (t1 == 0) { if (v1.mag2() == 0) { return Hep3Vector(0,0,0); } else { ZMthrowA (ZMxpvInfiniteVector( "boostToCM computed for two 4-vectors with combined t=0 -- " "infinite result")); return Hep3Vector(v1*(1./t1)); // Yup, 1/0 -- that is how we return infinity } } if (t1*t1 - v1.mag2() <= 0) { ZMthrowC (ZMxpvTachyonic( "boostToCM computed for pair of HepLorentzVectors with non-timelike sum")); // result will make analytic sense but is physically meaningless } return Hep3Vector(v1 * (-1./t1)); } /* boostToCM(w) */ } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/RotationC.cc0000755000175000017500000001452111753232637016656 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of methods of the HepRotation class which // were introduced when ZOOM PhysicsVectors was merged in, which involve // correcting user-supplied data which is supposed to form a Rotation, or // rectifying a rotation matrix which may have drifted due to roundoff. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Vector/ZMxpv.h" #include namespace CLHEP { // --------- Helper methods (private) for setting from 3 columns: bool HepRotation::setCols ( const Hep3Vector & u1, const Hep3Vector & u2, const Hep3Vector & u3, double u1u2, Hep3Vector & v1, Hep3Vector & v2, Hep3Vector & v3 ) const { if ( (1-std::fabs(u1u2)) <= Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvParallelCols( "All three cols supplied for a Rotation are parallel --" "\n an arbitrary rotation will be returned")); setArbitrarily (u1, v1, v2, v3); return true; } v1 = u1; v2 = Hep3Vector(u2 - u1u2 * u1).unit(); v3 = v1.cross(v2); if ( v3.dot(u3) >= 0 ) { return true; } else { return false; // looks more like a reflection in this case! } } // HepRotation::setCols void HepRotation::setArbitrarily (const Hep3Vector & ccolX, Hep3Vector & v1, Hep3Vector & v2, Hep3Vector & v3) const { // We have all three col's parallel. Warnings already been given; // this just supplies a result which is a valid rotation. v1 = ccolX.unit(); v2 = v1.cross(Hep3Vector(0,0,1)); if (v2.mag2() != 0) { v2 = v2.unit(); } else { v2 = Hep3Vector(1,0,0); } v3 = v1.cross(v2); return; } // HepRotation::setArbitrarily // ---------- Constructors and Assignment: // 3 orthogonal columns or rows HepRotation & HepRotation::set( const Hep3Vector & ccolX, const Hep3Vector & ccolY, const Hep3Vector & ccolZ ) { Hep3Vector ucolX = ccolX.unit(); Hep3Vector ucolY = ccolY.unit(); Hep3Vector ucolZ = ccolZ.unit(); double u1u2 = ucolX.dot(ucolY); double f12 = std::fabs(u1u2); if ( f12 > Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvNotOrthogonal( "col's X and Y supplied for Rotation are not close to orthogonal")); } double u1u3 = ucolX.dot(ucolZ); double f13 = std::fabs(u1u3); if ( f13 > Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvNotOrthogonal( "col's X and Z supplied for Rotation are not close to orthogonal")); } double u2u3 = ucolY.dot(ucolZ); double f23 = std::fabs(u2u3); if ( f23 > Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvNotOrthogonal( "col's Y and Z supplied for Rotation are not close to orthogonal")); } Hep3Vector v1, v2, v3; bool isRotation; if ( (f12 <= f13) && (f12 <= f23) ) { isRotation = setCols ( ucolX, ucolY, ucolZ, u1u2, v1, v2, v3 ); if ( !isRotation ) { ZMthrowC (ZMxpvImproperRotation( "col's X Y and Z supplied form closer to a reflection than a Rotation " "\n col Z is set to col X cross col Y")); } } else if ( f13 <= f23 ) { isRotation = setCols ( ucolZ, ucolX, ucolY, u1u3, v3, v1, v2 ); if ( !isRotation ) { ZMthrowC (ZMxpvImproperRotation( "col's X Y and Z supplied form closer to a reflection than a Rotation " "\n col Y is set to col Z cross col X")); } } else { isRotation = setCols ( ucolY, ucolZ, ucolX, u2u3, v2, v3, v1 ); if ( !isRotation ) { ZMthrowC (ZMxpvImproperRotation( "col's X Y and Z supplied form closer to a reflection than a Rotation " "\n col X is set to col Y cross col Z")); } } rxx = v1.x(); ryx = v1.y(); rzx = v1.z(); rxy = v2.x(); ryy = v2.y(); rzy = v2.z(); rxz = v3.x(); ryz = v3.y(); rzz = v3.z(); return *this; } // HepRotation::set(colX, colY, colZ) HepRotation::HepRotation ( const Hep3Vector & ccolX, const Hep3Vector & ccolY, const Hep3Vector & ccolZ ) { set (ccolX, ccolY, ccolZ); } HepRotation & HepRotation::setRows( const Hep3Vector & rrowX, const Hep3Vector & rrowY, const Hep3Vector & rrowZ ) { set (rrowX, rrowY, rrowZ); invert(); return *this; } // ------- Rectify a near-rotation void HepRotation::rectify() { // Assuming the representation of this is close to a true Rotation, // but may have drifted due to round-off error from many operations, // this forms an "exact" orthonormal matrix for the rotation again. // The first step is to average with the transposed inverse. This // will correct for small errors such as those occuring when decomposing // a LorentzTransformation. Then we take the bull by the horns and // formally extract the axis and delta (assuming the Rotation were true) // and re-setting the rotation according to those. double det = rxx * ryy * rzz + rxy * ryz * rzx + rxz * ryx * rzy - rxx * ryz * rzy - rxy * ryx * rzz - rxz * ryy * rzx ; if (det <= 0) { ZMthrowA(ZMxpvImproperRotation( "Attempt to rectify a Rotation with determinant <= 0\n")); return; } double di = 1.0 / det; // xx, xy, ... are components of inverse matrix: double xx1 = (ryy * rzz - ryz * rzy) * di; double xy1 = (rzy * rxz - rzz * rxy) * di; double xz1 = (rxy * ryz - rxz * ryy) * di; double yx1 = (ryz * rzx - ryx * rzz) * di; double yy1 = (rzz * rxx - rzx * rxz) * di; double yz1 = (rxz * ryx - rxx * ryz) * di; double zx1 = (ryx * rzy - ryy * rzx) * di; double zy1 = (rzx * rxy - rzy * rxx) * di; double zz1 = (rxx * ryy - rxy * ryx) * di; // Now average with the TRANSPOSE of that: rxx = .5*(rxx + xx1); rxy = .5*(rxy + yx1); rxz = .5*(rxz + zx1); ryx = .5*(ryx + xy1); ryy = .5*(ryy + yy1); ryz = .5*(ryz + zy1); rzx = .5*(rzx + xz1); rzy = .5*(rzy + yz1); rzz = .5*(rzz + zz1); // Now force feed this improved rotation double del = delta(); Hep3Vector u = axis(); u = u.unit(); // Because if the rotation is inexact, then the // axis() returned will not have length 1! set(u, del); } // rectify() } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/CMakeLists.txt0000644000175000017500000000204711607632404017174 0ustar olesoles set ( Vector_source_list AxisAngle.cc Boost.cc BoostX.cc BoostY.cc BoostZ.cc EulerAngles.cc LorentzRotation.cc LorentzRotationC.cc LorentzRotationD.cc LorentzVector.cc LorentzVectorB.cc LorentzVectorC.cc LorentzVectorK.cc LorentzVectorL.cc LorentzVectorR.cc Rotation.cc RotationA.cc RotationC.cc RotationE.cc RotationIO.cc RotationInterfaces.cc RotationL.cc RotationP.cc RotationX.cc RotationY.cc RotationZ.cc SpaceVector.cc SpaceVectorD.cc SpaceVectorP.cc SpaceVectorR.cc ThreeVector.cc ThreeVectorR.cc TwoVector.cc ZMinput.cc ZMxpv.cc ) # RotationXYZ is empty # Skip it on MacOSX so ranlib won't complain if( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" ) else() set ( Vector_source_list ${Vector_source_list} RotationXYZ.cc ) endif() clhep_build_library ( Vector ${Vector_source_list} ) clhep-2.1.4.1.orig/Vector/src/BoostY.cc0000755000175000017500000001037511753232637016176 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of the HepBoostY class. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/BoostY.h" #include "CLHEP/Vector/Boost.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Vector/LorentzRotation.h" #include "CLHEP/Vector/ZMxpv.h" namespace CLHEP { // ---------- Constructors and Assignment: HepBoostY & HepBoostY::set (double bbeta) { double b2 = bbeta*bbeta; if (b2 >= 1) { ZMthrowA (ZMxpvTachyonic( "Beta supplied to set HepBoostY represents speed >= c.")); beta_ = 1.0 - 1.0E-8; // NaN-proofing gamma_ = 1.0 / std::sqrt(1.0 - b2); return *this; } beta_ = bbeta; gamma_ = 1.0 / std::sqrt(1.0 - b2); return *this; } // ---------- Accessors: HepRep4x4 HepBoostY::rep4x4() const { double bg = beta_*gamma_; return HepRep4x4( 1, 0, 0, 0, 0, gamma_, 0, bg, 0, 0, 1, 0, 0, bg, 0, gamma_ ); } HepRep4x4Symmetric HepBoostY::rep4x4Symmetric() const { double bg = beta_*gamma_; return HepRep4x4Symmetric ( 1, 0, 0, 0, gamma_, 0, bg, 1, 0, gamma_ ); } // ---------- Decomposition: void HepBoostY::decompose (HepRotation & rotation, HepBoost & boost) const { HepAxisAngle vdelta = HepAxisAngle(); rotation = HepRotation(vdelta); Hep3Vector bbeta = boostVector(); boost = HepBoost(bbeta); } void HepBoostY::decompose (HepAxisAngle & rotation, Hep3Vector & boost) const { rotation = HepAxisAngle(); boost = boostVector(); } void HepBoostY::decompose (HepBoost & boost, HepRotation & rotation) const { HepAxisAngle vdelta = HepAxisAngle(); rotation = HepRotation(vdelta); Hep3Vector bbeta = boostVector(); boost = HepBoost(bbeta); } void HepBoostY::decompose (Hep3Vector & boost, HepAxisAngle & rotation) const { rotation = HepAxisAngle(); boost = boostVector(); } // ---------- Comparisons: double HepBoostY::distance2( const HepBoost & b ) const { return b.distance2(*this); } double HepBoostY::distance2( const HepRotation & r ) const { double db2 = norm2(); double dr2 = r.norm2(); return (db2 + dr2); } double HepBoostY::distance2( const HepLorentzRotation & lt ) const { HepBoost b1; HepRotation r1; lt.decompose(b1,r1); double db2 = distance2(b1); double dr2 = r1.norm2(); return (db2 + dr2); } bool HepBoostY::isNear (const HepRotation & r, double epsilon) const { double db2 = norm2(); if (db2 > epsilon*epsilon) return false; double dr2 = r.norm2(); return (db2+dr2 <= epsilon*epsilon); } bool HepBoostY::isNear ( const HepLorentzRotation & lt, double epsilon ) const { HepBoost b1; HepRotation r1; double db2 = distance2(b1); lt.decompose(b1,r1); if (db2 > epsilon*epsilon) return false; double dr2 = r1.norm2(); return (db2 + dr2); } // ---------- Properties: void HepBoostY::rectify() { // Assuming the representation of this is close to a true pure boost, // but may have drifted due to round-off error from many operations, // this forms an "exact" pure BoostY matrix for again. double b2 = beta_*beta_; if (b2 >= 1) { beta_ = 1.0 - 1.0e-8; // Nan-proofing b2 = beta_*beta_; } gamma_ = 1.0 / std::sqrt(1.0 - b2); } // ---------- Application: // ---------- Operations in the group of 4-Rotations HepBoostY HepBoostY::operator * (const HepBoostY & b) const { return HepBoostY ( (beta()+b.beta()) / (1+beta()*b.beta()) ); } HepLorentzRotation HepBoostY::operator * (const HepBoost & b) const { HepLorentzRotation me (*this); return me*b; } HepLorentzRotation HepBoostY::operator * (const HepRotation & r) const { HepLorentzRotation me (*this); return me*r; } HepLorentzRotation HepBoostY::operator * (const HepLorentzRotation & lt) const { HepLorentzRotation me (*this); return me*lt; } // ---------- I/O std::ostream & HepBoostY::print( std::ostream & os ) const { os << "Boost in Y direction (beta = " << beta_ << ", gamma = " << gamma_ << ") "; return os; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/RotationA.cc0000755000175000017500000000564111753232637016657 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of those methods of the HepRotation class which // were introduced when ZOOM PhysicsVectors was merged in, and which involve // the angle/axis representation of a Rotation. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include namespace CLHEP { // ---------- Constructors and Assignment: // axis and angle HepRotation & HepRotation::set( const Hep3Vector & aaxis, double ddelta ) { register double sinDelta = std::sin(ddelta), cosDelta = std::cos(ddelta); register double oneMinusCosDelta = 1.0 - cosDelta; Hep3Vector u = aaxis.unit(); register double uX = u.getX(); register double uY = u.getY(); register double uZ = u.getZ(); rxx = oneMinusCosDelta * uX * uX + cosDelta; rxy = oneMinusCosDelta * uX * uY - sinDelta * uZ; rxz = oneMinusCosDelta * uX * uZ + sinDelta * uY; ryx = oneMinusCosDelta * uY * uX + sinDelta * uZ; ryy = oneMinusCosDelta * uY * uY + cosDelta; ryz = oneMinusCosDelta * uY * uZ - sinDelta * uX; rzx = oneMinusCosDelta * uZ * uX - sinDelta * uY; rzy = oneMinusCosDelta * uZ * uY + sinDelta * uX; rzz = oneMinusCosDelta * uZ * uZ + cosDelta; return *this; } // HepRotation::set(axis, delta) HepRotation::HepRotation ( const Hep3Vector & aaxis, double ddelta ) { set( aaxis, ddelta ); } HepRotation & HepRotation::set( const HepAxisAngle & ax ) { return set ( ax.axis(), ax.delta() ); } HepRotation::HepRotation ( const HepAxisAngle & ax ) { set ( ax.axis(), ax.delta() ); } double HepRotation::delta() const { double cosdelta = (rxx + ryy + rzz - 1.0) / 2.0; if (cosdelta > 1.0) { return 0; } else if (cosdelta < -1.0) { return CLHEP::pi; } else { return std::acos( cosdelta ); // Already safe due to the cosdelta > 1 check } } // delta() Hep3Vector HepRotation::axis () const { // Determine 2*std::sin(delta) times the u components (I call this uX, uY, Uz) // Normalization is not needed; it will be done when returning the 3-Vector double Uz = ryx - rxy; double Uy = rxz - rzx; double Ux = rzy - ryz; if ( (Uz==0) && (Uy==0) && (Ux==0) ) { if ( rzz>0 ) { return Hep3Vector(0,0,1); } else if ( ryy>0 ) { return Hep3Vector(0,1,0); } else { return Hep3Vector(1,0,0); } } else { return Hep3Vector( Ux, Uy, Uz ).unit(); } } // axis() HepAxisAngle HepRotation::axisAngle() const { return HepAxisAngle (axis(), delta()); } // axisAngle() void HepRotation::setAxis (const Hep3Vector & aaxis) { set ( aaxis, delta() ); } void HepRotation::setDelta (double ddelta) { set ( axis(), ddelta ); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/LorentzRotation.cc0000755000175000017500000002464711753232637020143 0ustar olesoles// -*- C++ -*- // $Id: LorentzRotation.cc,v 1.2 2003/08/13 20:00:14 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation basic parts of the HepLorentzRotation class. // // Some ZOOM methods involving construction from columns and decomposition // into boost*rotation are split off into LorentzRotationC and LorentzRotationD #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/LorentzRotation.h" #include "CLHEP/Vector/ZMxpv.h" #include #include namespace CLHEP { // ---------- Constructors and Assignment: HepLorentzRotation & HepLorentzRotation::set (double bx, double by, double bz) { double bp2 = bx*bx + by*by + bz*bz; if (bp2 >= 1) { ZMthrowA (ZMxpvTachyonic( "Boost Vector supplied to set HepLorentzRotation represents speed >= c.")); } double gamma = 1.0 / std::sqrt(1.0 - bp2); double bgamma = gamma * gamma / (1.0 + gamma); mxx = 1.0 + bgamma * bx * bx; myy = 1.0 + bgamma * by * by; mzz = 1.0 + bgamma * bz * bz; mxy = myx = bgamma * bx * by; mxz = mzx = bgamma * bx * bz; myz = mzy = bgamma * by * bz; mxt = mtx = gamma * bx; myt = mty = gamma * by; mzt = mtz = gamma * bz; mtt = gamma; return *this; } HepLorentzRotation & HepLorentzRotation::set (const HepBoost & B, const HepRotation & R) { set (B.rep4x4()); *this = matrixMultiplication ( R.rep4x4() ); return *this; } HepLorentzRotation & HepLorentzRotation::set (const HepRotation & R, const HepBoost & B) { set (R.rep4x4()); *this = matrixMultiplication ( B.rep4x4() ); return *this; } // ---------- Accessors: // ------------ Subscripting: double HepLorentzRotation::operator () (int i, int j) const { if (i == 0) { if (j == 0) { return xx(); } if (j == 1) { return xy(); } if (j == 2) { return xz(); } if (j == 3) { return xt(); } } else if (i == 1) { if (j == 0) { return yx(); } if (j == 1) { return yy(); } if (j == 2) { return yz(); } if (j == 3) { return yt(); } } else if (i == 2) { if (j == 0) { return zx(); } if (j == 1) { return zy(); } if (j == 2) { return zz(); } if (j == 3) { return zt(); } } else if (i == 3) { if (j == 0) { return tx(); } if (j == 1) { return ty(); } if (j == 2) { return tz(); } if (j == 3) { return tt(); } } std::cerr << "HepLorentzRotation subscripting: bad indeces " << "(" << i << "," << j << ")\n"; return 0.0; } // ---------- Application: // ---------- Comparison: int HepLorentzRotation::compare( const HepLorentzRotation & m1 ) const { if (mttm1.mtt) return 1; else if (mtzm1.mtz) return 1; else if (mtym1.mty) return 1; else if (mtxm1.mtx) return 1; else if (mztm1.mzt) return 1; else if (mzzm1.mzz) return 1; else if (mzym1.mzy) return 1; else if (mzxm1.mzx) return 1; else if (mytm1.myt) return 1; else if (myzm1.myz) return 1; else if (myym1.myy) return 1; else if (myxm1.myx) return 1; else if (mxtm1.mxt) return 1; else if (mxzm1.mxz) return 1; else if (mxym1.mxy) return 1; else if (mxxm1.mxx) return 1; else return 0; } // ---------- Operations in the group of 4-Rotations HepLorentzRotation HepLorentzRotation::matrixMultiplication(const HepRep4x4 & m1) const { return HepLorentzRotation( mxx*m1.xx_ + mxy*m1.yx_ + mxz*m1.zx_ + mxt*m1.tx_, mxx*m1.xy_ + mxy*m1.yy_ + mxz*m1.zy_ + mxt*m1.ty_, mxx*m1.xz_ + mxy*m1.yz_ + mxz*m1.zz_ + mxt*m1.tz_, mxx*m1.xt_ + mxy*m1.yt_ + mxz*m1.zt_ + mxt*m1.tt_, myx*m1.xx_ + myy*m1.yx_ + myz*m1.zx_ + myt*m1.tx_, myx*m1.xy_ + myy*m1.yy_ + myz*m1.zy_ + myt*m1.ty_, myx*m1.xz_ + myy*m1.yz_ + myz*m1.zz_ + myt*m1.tz_, myx*m1.xt_ + myy*m1.yt_ + myz*m1.zt_ + myt*m1.tt_, mzx*m1.xx_ + mzy*m1.yx_ + mzz*m1.zx_ + mzt*m1.tx_, mzx*m1.xy_ + mzy*m1.yy_ + mzz*m1.zy_ + mzt*m1.ty_, mzx*m1.xz_ + mzy*m1.yz_ + mzz*m1.zz_ + mzt*m1.tz_, mzx*m1.xt_ + mzy*m1.yt_ + mzz*m1.zt_ + mzt*m1.tt_, mtx*m1.xx_ + mty*m1.yx_ + mtz*m1.zx_ + mtt*m1.tx_, mtx*m1.xy_ + mty*m1.yy_ + mtz*m1.zy_ + mtt*m1.ty_, mtx*m1.xz_ + mty*m1.yz_ + mtz*m1.zz_ + mtt*m1.tz_, mtx*m1.xt_ + mty*m1.yt_ + mtz*m1.zt_ + mtt*m1.tt_ ); } HepLorentzRotation & HepLorentzRotation::rotateX(double delta) { double c1 = std::cos (delta); double s1 = std::sin (delta); HepLorentzVector rowy = row2(); HepLorentzVector rowz = row3(); HepLorentzVector r2 = c1 * rowy - s1 * rowz; HepLorentzVector r3 = s1 * rowy + c1 * rowz; myx = r2.x(); myy = r2.y(); myz = r2.z(); myt = r2.t(); mzx = r3.x(); mzy = r3.y(); mzz = r3.z(); mzt = r3.t(); return *this; } HepLorentzRotation & HepLorentzRotation::rotateY(double delta) { double c1 = std::cos (delta); double s1 = std::sin (delta); HepLorentzVector rowx = row1(); HepLorentzVector rowz = row3(); HepLorentzVector r1 = c1 * rowx + s1 * rowz; HepLorentzVector r3 = -s1 * rowx + c1 * rowz; mxx = r1.x(); mxy = r1.y(); mxz = r1.z(); mxt = r1.t(); mzx = r3.x(); mzy = r3.y(); mzz = r3.z(); mzt = r3.t(); return *this; } HepLorentzRotation & HepLorentzRotation::rotateZ(double delta) { double c1 = std::cos (delta); double s1 = std::sin (delta); HepLorentzVector rowx = row1(); HepLorentzVector rowy = row2(); HepLorentzVector r1 = c1 * rowx - s1 * rowy; HepLorentzVector r2 = s1 * rowx + c1 * rowy; mxx = r1.x(); mxy = r1.y(); mxz = r1.z(); mxt = r1.t(); myx = r2.x(); myy = r2.y(); myz = r2.z(); myt = r2.t(); return *this; } HepLorentzRotation & HepLorentzRotation::boostX(double beta) { double b2 = beta*beta; if (b2 >= 1) { ZMthrowA (ZMxpvTachyonic( "Beta supplied to HepLorentzRotation::boostX represents speed >= c.")); } double g1 = 1.0/std::sqrt(1.0-b2); double bg = beta*g1; HepLorentzVector rowx = row1(); HepLorentzVector rowt = row4(); HepLorentzVector r1 = g1 * rowx + bg * rowt; HepLorentzVector r4 = bg * rowx + g1 * rowt; mxx = r1.x(); mxy = r1.y(); mxz = r1.z(); mxt = r1.t(); mtx = r4.x(); mty = r4.y(); mtz = r4.z(); mtt = r4.t(); return *this; } HepLorentzRotation & HepLorentzRotation::boostY(double beta) { double b2 = beta*beta; if (b2 >= 1) { ZMthrowA (ZMxpvTachyonic( "Beta supplied to HepLorentzRotation::boostY represents speed >= c.")); } double g1 = 1.0/std::sqrt(1.0-b2); double bg = beta*g1; HepLorentzVector rowy = row2(); HepLorentzVector rowt = row4(); HepLorentzVector r2 = g1 * rowy + bg * rowt; HepLorentzVector r4 = bg * rowy + g1 * rowt; myx = r2.x(); myy = r2.y(); myz = r2.z(); myt = r2.t(); mtx = r4.x(); mty = r4.y(); mtz = r4.z(); mtt = r4.t(); return *this; } HepLorentzRotation & HepLorentzRotation::boostZ(double beta) { double b2 = beta*beta; if (b2 >= 1) { ZMthrowA (ZMxpvTachyonic( "Beta supplied to HepLorentzRotation::boostZ represents speed >= c.")); } double g1 = 1.0/std::sqrt(1.0-b2); double bg = beta*g1; HepLorentzVector rowz = row3(); HepLorentzVector rowt = row4(); HepLorentzVector r3 = g1 * rowz + bg * rowt; HepLorentzVector r4 = bg * rowz + g1 * rowt; mtx = r4.x(); mty = r4.y(); mtz = r4.z(); mtt = r4.t(); mzx = r3.x(); mzy = r3.y(); mzz = r3.z(); mzt = r3.t(); return *this; } std::ostream & HepLorentzRotation::print( std::ostream & os ) const { os << "\n [ ( " << std::setw(11) << std::setprecision(6) << xx() << " " << std::setw(11) << std::setprecision(6) << xy() << " " << std::setw(11) << std::setprecision(6) << xz() << " " << std::setw(11) << std::setprecision(6) << xt() << ")\n" << " ( " << std::setw(11) << std::setprecision(6) << yx() << " " << std::setw(11) << std::setprecision(6) << yy() << " " << std::setw(11) << std::setprecision(6) << yz() << " " << std::setw(11) << std::setprecision(6) << yt() << ")\n" << " ( " << std::setw(11) << std::setprecision(6) << zx() << " " << std::setw(11) << std::setprecision(6) << zy() << " " << std::setw(11) << std::setprecision(6) << zz() << " " << std::setw(11) << std::setprecision(6) << zt() << ")\n" << " ( " << std::setw(11) << std::setprecision(6) << tx() << " " << std::setw(11) << std::setprecision(6) << ty() << " " << std::setw(11) << std::setprecision(6) << tz() << " " << std::setw(11) << std::setprecision(6) << tt() << ") ]\n"; return os; } HepLorentzRotation operator* ( const HepRotation & r, const HepLorentzRotation & lt) { r.rep4x4(); lt.rep4x4(); return HepLorentzRotation( HepRep4x4( r.xx()*lt.xx() + r.xy()*lt.yx() + r.xz()*lt.zx() + r.xt()*lt.tx(), r.xx()*lt.xy() + r.xy()*lt.yy() + r.xz()*lt.zy() + r.xt()*lt.ty(), r.xx()*lt.xz() + r.xy()*lt.yz() + r.xz()*lt.zz() + r.xt()*lt.tz(), r.xx()*lt.xt() + r.xy()*lt.yt() + r.xz()*lt.zt() + r.xt()*lt.tt(), r.yx()*lt.xx() + r.yy()*lt.yx() + r.yz()*lt.zx() + r.yt()*lt.tx(), r.yx()*lt.xy() + r.yy()*lt.yy() + r.yz()*lt.zy() + r.yt()*lt.ty(), r.yx()*lt.xz() + r.yy()*lt.yz() + r.yz()*lt.zz() + r.yt()*lt.tz(), r.yx()*lt.xt() + r.yy()*lt.yt() + r.yz()*lt.zt() + r.yt()*lt.tt(), r.zx()*lt.xx() + r.zy()*lt.yx() + r.zz()*lt.zx() + r.zt()*lt.tx(), r.zx()*lt.xy() + r.zy()*lt.yy() + r.zz()*lt.zy() + r.zt()*lt.ty(), r.zx()*lt.xz() + r.zy()*lt.yz() + r.zz()*lt.zz() + r.zt()*lt.tz(), r.zx()*lt.xt() + r.zy()*lt.yt() + r.zz()*lt.zt() + r.zt()*lt.tt(), r.tx()*lt.xx() + r.ty()*lt.yx() + r.tz()*lt.zx() + r.tt()*lt.tx(), r.tx()*lt.xy() + r.ty()*lt.yy() + r.tz()*lt.zy() + r.tt()*lt.ty(), r.tx()*lt.xz() + r.ty()*lt.yz() + r.tz()*lt.zz() + r.tt()*lt.tz(), r.tx()*lt.xt() + r.ty()*lt.yt() + r.tz()*lt.zt() + r.tt()*lt.tt() ) ); } const HepLorentzRotation HepLorentzRotation::IDENTITY; } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/LorentzRotationC.cc0000755000175000017500000001465011753232637020237 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of that part of the HepLorentzRotation class // which is concerned with setting or constructing the transformation based // on 4 supplied columns or rows. #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/LorentzRotation.h" #include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Vector/ZMxpv.h" #include namespace CLHEP { // ---------- Constructors and Assignment: HepLorentzRotation & HepLorentzRotation::set (const HepLorentzVector & ccol1, const HepLorentzVector & ccol2, const HepLorentzVector & ccol3, const HepLorentzVector & ccol4) { // First, test that the four cols do represent something close to a // true LT: ZMpvMetric_t savedMetric = HepLorentzVector::setMetric (TimePositive); if ( ccol4.getT() < 0 ) { ZMthrowC (ZMxpvImproperTransformation( "column 4 supplied to define transformation has negative T component")); *this = HepLorentzRotation(); return *this; } double u1u1 = ccol1.dot(ccol1); double f11 = std::fabs(u1u1 + 1.0); if ( f11 > Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvNotSymplectic( "column 1 supplied for HepLorentzRotation has w*w != -1")); } double u2u2 = ccol2.dot(ccol2); double f22 = std::fabs(u2u2 + 1.0); if ( f22 > Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvNotSymplectic( "column 2 supplied for HepLorentzRotation has w*w != -1")); } double u3u3 = ccol3.dot(ccol3); double f33 = std::fabs(u3u3 + 1.0); if ( f33 > Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvNotSymplectic( "column 3 supplied for HepLorentzRotation has w*w != -1")); } double u4u4 = ccol4.dot(ccol4); double f44 = std::fabs(u4u4 - 1.0); if ( f44 > Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvNotSymplectic( "column 4 supplied for HepLorentzRotation has w*w != +1")); } double u1u2 = ccol1.dot(ccol2); double f12 = std::fabs(u1u2); if ( f12 > Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvNotOrthogonal( "columns 1 and 2 supplied for HepLorentzRotation have non-zero dot")); } double u1u3 = ccol1.dot(ccol3); double f13 = std::fabs(u1u3); if ( f13 > Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvNotOrthogonal( "columns 1 and 3 supplied for HepLorentzRotation have non-zero dot")); } double u1u4 = ccol1.dot(ccol4); double f14 = std::fabs(u1u4); if ( f14 > Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvNotOrthogonal( "columns 1 and 4 supplied for HepLorentzRotation have non-zero dot")); } double u2u3 = ccol2.dot(ccol3); double f23 = std::fabs(u2u3); if ( f23 > Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvNotOrthogonal( "columns 2 and 3 supplied for HepLorentzRotation have non-zero dot")); } double u2u4 = ccol2.dot(ccol4); double f24 = std::fabs(u2u4); if ( f24 > Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvNotOrthogonal( "columns 2 and 4 supplied for HepLorentzRotation have non-zero dot")); } double u3u4 = ccol3.dot(ccol4); double f34 = std::fabs(u3u4); if ( f34 > Hep4RotationInterface::tolerance ) { ZMthrowC (ZMxpvNotOrthogonal( "columns 3 and 4 supplied for HepLorentzRotation have non-zero dot")); } // Our strategy will be to order the cols, then do gram-schmidt on them // (that is, remove the components of col d that make it non-orthogonal to // col c, normalize that, then remove the components of b that make it // non-orthogonal to d and to c, normalize that, etc. // Because col4, the time col, is most likely to be computed directly, we // will start from there and work left-ward. HepLorentzVector a, b, c, d; bool isLorentzTransformation = true; double norm; d = ccol4; norm = d.dot(d); if (norm <= 0.0) { isLorentzTransformation = false; if (norm == 0.0) { d = T_HAT4; // Moot, but let's keep going... norm = 1.0; } } d /= norm; c = ccol3 - ccol3.dot(d) * d; norm = -c.dot(c); if (norm <= 0.0) { isLorentzTransformation = false; if (norm == 0.0) { c = Z_HAT4; // Moot norm = 1.0; } } c /= norm; b = ccol2 + ccol2.dot(c) * c - ccol2.dot(d) * d; norm = -b.dot(b); if (norm <= 0.0) { isLorentzTransformation = false; if (norm == 0.0) { b = Y_HAT4; // Moot norm = 1.0; } } b /= norm; a = ccol1 + ccol1.dot(b) * b + ccol1.dot(c) * c - ccol1.dot(d) * d; norm = -a.dot(a); if (norm <= 0.0) { isLorentzTransformation = false; if (norm == 0.0) { a = X_HAT4; // Moot norm = 1.0; } } a /= norm; if ( !isLorentzTransformation ) { ZMthrowC (ZMxpvImproperTransformation( "cols 1-4 supplied to define transformation form either \n" " a boosted reflection or a tachyonic transformation -- \n" " transformation will be set to Identity ")); *this = HepLorentzRotation(); } if ( isLorentzTransformation ) { mxx = a.x(); myx = a.y(); mzx = a.z(); mtx = a.t(); mxy = b.x(); myy = b.y(); mzy = b.z(); mty = b.t(); mxz = c.x(); myz = c.y(); mzz = c.z(); mtz = c.t(); mxt = d.x(); myt = d.y(); mzt = d.z(); mtt = d.t(); } HepLorentzVector::setMetric (savedMetric); return *this; } // set ( col1, col2, col3, col4 ) HepLorentzRotation & HepLorentzRotation::setRows (const HepLorentzVector & rrow1, const HepLorentzVector & rrow2, const HepLorentzVector & rrow3, const HepLorentzVector & rrow4) { // Set based on using those rows as columns: set (rrow1, rrow2, rrow3, rrow4); // Now transpose in place: register double q1, q2, q3; q1 = mxy; q2 = mxz; q3 = mxt; mxy = myx; mxz = mzx; mxt = mtx; myx = q1; mzx = q2; mtx = q3; q1 = myz; q2 = myt; q3 = mzt; myz = mzy; myt = mty; mzt = mtz; mzy = q1; mty = q2; mtz = q3; return *this; } // LorentzTransformation::setRows(row1 ... row4) HepLorentzRotation::HepLorentzRotation ( const HepLorentzVector & ccol1, const HepLorentzVector & ccol2, const HepLorentzVector & ccol3, const HepLorentzVector & ccol4 ) { set ( ccol1, ccol2, ccol3, ccol4 ); } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/ZMxpv.cc0000755000175000017500000001333311761726606016043 0ustar olesoles// ---------------------------------------------------------------------- // // ZMxpv.cc Support for Vector package in the ZOOM context, where // probelmatic conditions are handled via ZOOM Exceptions. // // In the CLHEP context (that is, unless ENABLE_ZOOM_EXCEPTIONS // is defined) this file is content-free. // // ZMexception's are ZMthrown by classes in the PhysicsVectors // package. (To avoid name clashes, these start with ZMxpv.) // Each possible such exception must be provided with some // defining properties: thowe are in this file. // // History: // 19-Nov-1997 MF Initial version, to enable the ZMthrow exceptions // in SpaceVector. // 15-Jun-1998 WEB Added namespace support // 08-Jan-2001 MF Moved into CLHEP // 09-Oct-2003 MF Major addition: Exception class defs for CLHEP case // // ---------------------------------------------------------------------- #include "CLHEP/Vector/ZMxpv.h" #ifndef ENABLE_ZOOM_EXCEPTIONS CLHEP_vector_exception::CLHEP_vector_exception ( const std::string & s1 ) throw() : message(s1) {} const char* CLHEP_vector_exception::what() const throw() { static std::string answer; answer = name(); answer += ": "; answer += message; return answer.c_str(); } #define CLHEP_vector_exception_methods(NAME) \ NAME::NAME(const std::string & s1) throw() : CLHEP_vector_exception(s1) {} \ const char* NAME::name() const throw() { \ return #NAME; \ } CLHEP_vector_exception_methods( ZMxPhysicsVectors ) CLHEP_vector_exception_methods( ZMxpvSpacelike ) CLHEP_vector_exception_methods( ZMxpvNegativeMass ) CLHEP_vector_exception_methods( ZMxpvVectorInputFails ) CLHEP_vector_exception_methods( ZMxpvIndexRange ) CLHEP_vector_exception_methods( ZMxpvFixedAxis ) CLHEP_vector_exception_methods( ZMxpvTachyonic ) CLHEP_vector_exception_methods( ZMxpvZeroVector ) CLHEP_vector_exception_methods( ZMxpvImproperTransformation ) CLHEP_vector_exception_methods( ZMxpvInfiniteVector ) CLHEP_vector_exception_methods( ZMxpvInfinity ) CLHEP_vector_exception_methods( ZMxpvImproperRotation ) CLHEP_vector_exception_methods( ZMxpvAmbiguousAngle ) CLHEP_vector_exception_methods( ZMxpvNegativeR ) CLHEP_vector_exception_methods( ZMxpvUnusualTheta ) CLHEP_vector_exception_methods( ZMxpvParallelCols ) CLHEP_vector_exception_methods( ZMxpvNotOrthogonal ) CLHEP_vector_exception_methods( ZMxpvNotSymplectic ) #endif // endif for ifndef ENABLE_ZOOM_EXCEPTIONS // ======================================================================== // ======================================================================== // ======================================================================== #ifdef ENABLE_ZOOM_EXCEPTIONS ZM_BEGIN_NAMESPACE( zmpv ) /* namespace zmpv { */ ZMexClassInfo ZMxPhysicsVectors::_classInfo ( "ZMxPhysicsVectors", "PhysicsVectors", ZMexSEVERE ); // General Exception in a PhysicsVectors routine ZMexClassInfo ZMxpvInfiniteVector::_classInfo ( "InfiniteVector", "PhysicsVectors", ZMexERROR ); // Infinite vector component ZMexClassInfo ZMxpvZeroVector::_classInfo ( "ZeroVector", "PhysicsVectors", ZMexERROR ); // Zero Vector cannot be converted to Unit Vector ZMexClassInfo ZMxpvTachyonic::_classInfo ( "Tachyonic", "PhysicsVectors", ZMexERROR ); // Relativistic method using vector representing speed greater than light ZMexClassInfo ZMxpvSpacelike::_classInfo ( "Spacelike", "PhysicsVectors", ZMexERROR ); // Spacelike 4-vector used in context where rest mass or gamma needs computing ZMexClassInfo ZMxpvInfinity::_classInfo ( "Infinity", "PhysicsVectors", ZMexERROR ); // Mathematical operation will lead to infinity as a Scalar result ZMexClassInfo ZMxpvNegativeMass::_classInfo ( "NegativeMass", "PhysicsVectors", ZMexERROR ); // Kinematic operation was rendered meaningless by an input with negative t ZMexClassInfo ZMxpvAmbiguousAngle::_classInfo ( "AmbiguousAngle", "PhysicsVectors", ZMexWARNING ); // Angle requested ill-defined, due to null or collinear vectors ZMexClassInfo ZMxpvNegativeR::_classInfo ( "NegativeR", "PhysicsVectors", ZMexWARNING ); // Negative value supplied for vector magnitude ZMexClassInfo ZMxpvUnusualTheta::_classInfo ( "UnusualTheta", "PhysicsVectors", ZMexWARNING ); // Theta supplied for polar coordinates outside of [0,PI] ZMexClassInfo ZMxpvVectorInputFails::_classInfo ( "VectorInputFails", "PhysicsVectors", ZMexERROR ); // Theta supplied for polar coordinates outside of [0,PI] ZMexClassInfo ZMxpvParallelCols::_classInfo ( "ParallelCols", "PhysicsVectors", ZMexERROR ); // Col's supplied to form a Rotation are parallel instead of orthogonal ZMexClassInfo ZMxpvImproperRotation::_classInfo ( "ImproperRotation", "PhysicsVectors", ZMexERROR ); // Col's supplied to form a Rotation form a (rotation+reflection) instead ZMexClassInfo ZMxpvImproperTransformation::_classInfo ( "ImproperRotation", "PhysicsVectors", ZMexERROR ); // Rows supplied to form a LorentzTransformation form tachyonic or reflection ZMexClassInfo ZMxpvNotOrthogonal::_classInfo ( "NotOrthogonal", "PhysicsVectors", ZMexWARNING ); // Col's supplied to form a Rotation or LorentzTransformation are not orthogonal ZMexClassInfo ZMxpvNotSymplectic::_classInfo ( "NotSymplectic", "PhysicsVectors", ZMexWARNING ); // A row supplied as part of a LorentzTransformation has wrong restmass() ZMexClassInfo ZMxpvFixedAxis::_classInfo ( "FixedAxis", "PhysicsVectors", ZMexERROR ); // An attempt to change the axis is of a rotation fixed to be about X Y or Z. ZMexClassInfo ZMxpvIndexRange::_classInfo ( "IndexRange", "PhysicsVectors", ZMexERROR ); // An attempt to access a vector in the p(i) notation, where i is out of range. ZM_END_NAMESPACE( zmpv ) /* } // namespace zmpv */ #endif // endif for ifdef ENAMBLE_ZOOM_EXCEPTIONS clhep-2.1.4.1.orig/Vector/src/RotationZ.cc0000755000175000017500000001211712050774211016672 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of methods of the HepRotationZ class which // were introduced when ZOOM PhysicsVectors was merged in. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/RotationZ.h" #include "CLHEP/Vector/AxisAngle.h" #include "CLHEP/Vector/EulerAngles.h" #include "CLHEP/Vector/LorentzRotation.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include #include namespace CLHEP { static inline double safe_acos (double x) { if (std::abs(x) <= 1.0) return std::acos(x); return ( (x>0) ? 0 : CLHEP::pi ); } HepRotationZ::HepRotationZ(double dddelta) : its_d(proper(dddelta)), its_s(std::sin(dddelta)), its_c(std::cos(dddelta)) {} HepRotationZ & HepRotationZ::set ( double dddelta ) { its_d = proper(dddelta); its_s = std::sin(its_d); its_c = std::cos(its_d); return *this; } double HepRotationZ::phi() const { return - its_d/2.0; } // HepRotationZ::phi() double HepRotationZ::theta() const { return 0.0 ; } // HepRotationZ::theta() double HepRotationZ::psi() const { return - its_d/2.0; } // HepRotationZ::psi() HepEulerAngles HepRotationZ::eulerAngles() const { return HepEulerAngles( phi(), theta(), psi() ); } // HepRotationZ::eulerAngles() // From the defining code in the implementation of CLHEP (in Rotation.cc) // it is clear that thetaX, phiX form the polar angles in the original // coordinate system of the new X axis (and similarly for phiY and phiZ). // // This code is take directly from CLHEP original. However, there are as // shown opportunities for significant speed improvement. double HepRotationZ::phiX() const { return (yx() == 0.0 && xx() == 0.0) ? 0.0 : std::atan2(yx(),xx()); // or ---- return d; } double HepRotationZ::phiY() const { return (yy() == 0.0 && xy() == 0.0) ? 0.0 : std::atan2(yy(),xy()); } double HepRotationZ::phiZ() const { return (yz() == 0.0 && xz() == 0.0) ? 0.0 : std::atan2(yz(),xz()); // or ---- return 0.0; } double HepRotationZ::thetaX() const { return safe_acos(zx()); // or ---- return CLHEP::halfpi; } double HepRotationZ::thetaY() const { return safe_acos(zy()); // or ---- return CLHEP::halfpi; } double HepRotationZ::thetaZ() const { return safe_acos(zz()); // or ---- return 0.0; } void HepRotationZ::setDelta ( double ddelta ) { set(ddelta); } void HepRotationZ::decompose (HepAxisAngle & rotation, Hep3Vector & boost) const { boost.set(0,0,0); rotation = axisAngle(); } void HepRotationZ::decompose (Hep3Vector & boost, HepAxisAngle & rotation) const { boost.set(0,0,0); rotation = axisAngle(); } void HepRotationZ::decompose (HepRotation & rotation, HepBoost & boost) const { boost.set(0,0,0); rotation = HepRotation(*this); } void HepRotationZ::decompose (HepBoost & boost, HepRotation & rotation) const { boost.set(0,0,0); rotation = HepRotation(*this); } double HepRotationZ::distance2( const HepRotationZ & r ) const { double answer = 2.0 * ( 1.0 - ( its_s * r.its_s + its_c * r.its_c ) ) ; return (answer >= 0) ? answer : 0; } double HepRotationZ::distance2( const HepRotation & r ) const { double sum = xx() * r.xx() + xy() * r.xy() + yx() * r.yx() + yy() * r.yy() + r.zz(); double answer = 3.0 - sum; return (answer >= 0 ) ? answer : 0; } double HepRotationZ::distance2( const HepLorentzRotation & lt ) const { HepAxisAngle a; Hep3Vector b; lt.decompose(b, a); double bet = b.beta(); double bet2 = bet*bet; HepRotation r(a); return bet2/(1-bet2) + distance2(r); } double HepRotationZ::distance2( const HepBoost & lt ) const { return distance2( HepLorentzRotation(lt)); } double HepRotationZ::howNear( const HepRotationZ & r ) const { return std::sqrt(distance2(r)); } double HepRotationZ::howNear( const HepRotation & r ) const { return std::sqrt(distance2(r)); } double HepRotationZ::howNear( const HepBoost & lt ) const { return std::sqrt(distance2(lt)); } double HepRotationZ::howNear( const HepLorentzRotation & lt ) const { return std::sqrt(distance2(lt)); } bool HepRotationZ::isNear(const HepRotationZ & r,double epsilon)const { return (distance2(r) <= epsilon*epsilon); } bool HepRotationZ::isNear(const HepRotation & r,double epsilon)const { return (distance2(r) <= epsilon*epsilon); } bool HepRotationZ::isNear( const HepBoost & lt,double epsilon) const { return (distance2(lt) <= epsilon*epsilon); } bool HepRotationZ::isNear( const HepLorentzRotation & lt, double epsilon) const { return (distance2(lt) <= epsilon*epsilon); } double HepRotationZ::norm2() const { return 2.0 - 2.0 * its_c; } std::ostream & HepRotationZ::print( std::ostream & os ) const { os << "\nRotation about Z (" << its_d << ") [cos d = " << its_c << " sin d = " << its_s << "]\n"; return os; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/RotationInterfaces.cc0000755000175000017500000000203507716514316020555 0ustar olesoles// -*- C++ -*- // $Id: RotationInterfaces.cc,v 1.2 2003/08/13 20:00:14 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of those few parts of the Hep4RotationInterface // and Hep3RotationInterface classes which are neither inline nor pure virtual. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/RotationInterfaces.h" namespace CLHEP { //-****************************** // // Hep4RotationInterface // //-****************************** double Hep4RotationInterface::getTolerance() {return tolerance;} double Hep4RotationInterface::setTolerance( double tol ) { double t = tolerance; tolerance = tol; return t; } double Hep4RotationInterface::tolerance = Hep4RotationInterface::ToleranceTicks * 1.0e-08; //-****************************** // // Hep3RotationInterface // //-****************************** } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/RotationP.cc0000755000175000017500000000303111753232637016665 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of methods of the HepRotation class which // were introduced when ZOOM PhysicsVectors was merged in, other than those // involving Euler or axis/angle representations, lengthy corrections of // the rotation matrix, or I/O. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/Rotation.h" #include namespace CLHEP { void HepRotation::decompose(HepAxisAngle & rotation, Hep3Vector & boost)const { boost.set(0,0,0); rotation = axisAngle(); } void HepRotation::decompose(Hep3Vector & boost, HepAxisAngle & rotation)const { boost.set(0,0,0); rotation = axisAngle(); } double HepRotation::distance2( const HepRotation & r ) const { double sum = rxx * r.rxx + rxy * r.rxy + rxz * r.rxz + ryx * r.ryx + ryy * r.ryy + ryz * r.ryz + rzx * r.rzx + rzy * r.rzy + rzz * r.rzz; double answer = 3.0 - sum; return (answer >= 0 ) ? answer : 0; } double HepRotation::howNear( const HepRotation & r ) const { return std::sqrt( distance2( r ) ); } bool HepRotation::isNear( const HepRotation & r, double epsilon) const { return distance2( r ) <= epsilon*epsilon; } double HepRotation::norm2() const { double answer = 3.0 - rxx - ryy - rzz; return (answer >= 0 ) ? answer : 0; } } // namespace CLHEP clhep-2.1.4.1.orig/Vector/src/SpaceVectorD.cc0000755000175000017500000000423211753232637017274 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of the subset of those methods of the Hep3Vector // class which originated from the ZOOM SpaceVector class *and* which involve // the esoteric concepts of polar/azimuthal angular decomposition. // #ifdef GNUPRAGMA #pragma implementation #endif #include "CLHEP/Vector/defs.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Vector/ZMxpv.h" #include namespace CLHEP { //-********************************************* // - 6 - // Decomposition of an angle between two vectors // //-********************************************* double Hep3Vector::polarAngle (const Hep3Vector & v2) const { return std::fabs(v2.getTheta() - getTheta()); } /* polarAngle */ double Hep3Vector::polarAngle (const Hep3Vector & v2, const Hep3Vector & ref) const { return std::fabs( v2.angle(ref) - angle(ref) ); } /* polarAngle (v2, ref) */ // double Hep3Vector::azimAngle (const Hep3Vector & v2) const // is now in the .icc file as deltaPhi(v2) double Hep3Vector::azimAngle (const Hep3Vector & v2, const Hep3Vector & ref) const { Hep3Vector vperp ( perpPart(ref) ); if ( vperp.mag2() == 0 ) { ZMthrowC (ZMxpvAmbiguousAngle( "Cannot find azimuthal angle with reference direction parallel to " "vector 1 -- will return zero")); return 0; } Hep3Vector v2perp ( v2.perpPart(ref) ); if ( v2perp.mag2() == 0 ) { ZMthrowC (ZMxpvAmbiguousAngle( "Cannot find azimuthal angle with reference direction parallel to " "vector 2 -- will return zero")); return 0; } double ang = vperp.angle(v2perp); // Now compute the sign of the answer: that of U*(VxV2) or // the equivalent expression V*(V2xU). if ( dot(v2.cross(ref)) >= 0 ) { return ang; } else { return -ang; } //-| Note that if V*(V2xU) is zero, we want to return 0 or PI //-| depending on whether vperp is aligned or antialigned with v2perp. //-| The computed angle() expression does this properly. } /* azimAngle (v2, ref) */ } // namespace CLHEP clhep-2.1.4.1.orig/Cast/0000755000175000017500000000000012242515143013266 5ustar olesolesclhep-2.1.4.1.orig/Cast/Cast/0000755000175000017500000000000012242515143014160 5ustar olesolesclhep-2.1.4.1.orig/Cast/Cast/cmake-defs.h.in0000644000175000017500000000172511607115601016741 0ustar olesoles/* @PACKAGE@/defs.h Generated by cmake. */ #ifndef @UPACKAGE@_DEFS_H #define @UPACKAGE@_DEFS_H /* Name of package */ #ifndef PACKAGE #define PACKAGE "@PACKAGE@" #endif /* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #define PACKAGE_BUGREPORT "http://savannah.cern.ch/projects/clhep/" #endif /* Define to the full name of this package. */ #ifndef PACKAGE_NAME #define PACKAGE_NAME "@PROJECT_NAME@ @PACKAGE@" #endif /* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #define PACKAGE_STRING "@PROJECT_NAME@ @PACKAGE@ @VERSION@" #endif /* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #define PACKAGE_TARNAME "@PACKAGE@" #endif /* Define to the version of this package. */ #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "@VERSION@" #endif /* Version number of package */ #ifndef VERSION #define VERSION "@VERSION@" #endif #endif // @UPACKAGE@_DEFS_H clhep-2.1.4.1.orig/Cast/Cast/copy-header.pl.in0000755000175000017500000000164110043507732017331 0ustar olesoles#!/usr/bin/env perl # # copy a header into the temporary CLHEP header tree if # a) the header is not already there # b) the source is newer # if ($#ARGV != 1) { print "mungeit requires two arguments - exit\n"; exit; } else { $source_header=$ARGV[0]; $dest_header=$ARGV[1]; &check_header; } exit; sub check_header { # make sure source exists if ( ! -e $source_header ) { print "$source_header does not exist - exit\n"; exit; } # copy if not already there - otherwise, check the time stamp if ( ! -e $dest_header ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } else { $source_header_time = -M $source_header; $dest_header_time = -M $dest_header; # copy only if source is newer if( $source_header_time < $dest_header_time ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } } } clhep-2.1.4.1.orig/Cast/Cast/Makefile.am0000755000175000017500000000132210230024342016204 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@ COPY_P = @COPY_P@ pkginclude_HEADERS = \ itos.h \ defs.h # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = defs.h # copy headers into $(tempincludedir) install-tmpHEADERS: @echo " install headers in $(tempincludedir) " @list='$(pkginclude_HEADERS)'; \ if test $(tempincludedir); then \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ ./copy-header.pl $$d$$p $(tempincludedir)/$$f; \ done; \ fi; test -z "$$fail" clhep-2.1.4.1.orig/Cast/Cast/itos.h0000755000175000017500000000063007767704770015337 0ustar olesoles// ---------------------------------------------------------------------- // // itos - convert (long) integer to string // // History: // 19-Dec-1997 WEB Initial draft // 14-Feb-2000 WEB Improve C++ Standard compliance // // ---------------------------------------------------------------------- #ifndef STRING_INCLUDED #define STRING_INCLUDED #include #endif std::string itos( long i ); clhep-2.1.4.1.orig/Cast/Cast/.cvsignore0000755000175000017500000000002607767704770016207 0ustar olesolesMakefile.in defs.h.in clhep-2.1.4.1.orig/Cast/Cast/CMakeLists.txt0000644000175000017500000000024111606714767016735 0ustar olesoles set( pkginclude_HEADERS itos.h ) # notice that defs.h is not referenced here INSTALL (FILES ${pkginclude_HEADERS} DESTINATION include/CLHEP/Cast ) clhep-2.1.4.1.orig/Cast/Cast-deps.in0000755000175000017500000000006507767704770015473 0ustar olesolesCLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ clhep-2.1.4.1.orig/Cast/INSTALL0000755000175000017500000000772111406160701014326 0ustar olesoles#------------------------------------------------------------- # platform specific issues #------------------------------------------------------------- This package requires autoconf 2.59 or later and automake 1.9.1 or later. If you bootstrap, you will probably have to build these yourself. See "building autotools" below. The new libtool no longer properly supports shared libraries for gcc 2.95.2. If you build CLHEP with gcc 2.95.2, you must configure --disable-shared. To build for Solaris CC, configure with CXX=CC CC=cc and use gmake. On MacOSX, you need to define MACOSX_DEPLOYMENT_TARGET appropriately. For instance, set MACOSX_DEPLOYMENT_TARGET to "10.4" if you have MacOS 10.4 installed on your system. #------------------------------------------------------------- # installing from a source code tar ball #------------------------------------------------------------- Unwind the source code tar ball in some relevant directory. Autoconf and automake will aready have been run. Determine where the files will be installed. Create a build directory that is NOT in the source code directory tree. cd /configure --prefix= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make check (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # configure options #------------------------------------------------------------- A variety of options can be given to configure. Below is a list of the options that you are likely to find most useful. --help provides a partial list of options --prefix=PREFIX install architecture-independent files in PREFIX [default is /usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [default is the same as PREFIX] --disable-shared build only static libraries --disable-static build only shared libraries --enable-exceptions use the CLHEP/Exceptions package --disable-exceptions DO NOT use the CLHEP/Exceptions package [--disable-exceptions is the default] #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are neither built nor installed automatically. Use the following commands to build and install documents: make docs make install-docs #------------------------------------------------------------- # building from cvs #------------------------------------------------------------- You will need current versions of automake, autoconf, and libtool. See building autotools below. cvs co CLHEP/package OR cvs co package cd [CLHEP/]package ./bootstrap Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building autotools #------------------------------------------------------------- If you do not have at least autoconf 2.59 and automake 1.9.1, you will need to build autoconf, automake, and libtool. On some platforms, you may also need to build m4 and texinfo. Download the relevant tarballs from gnu.org (http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/, and http://www.gnu.org/software/libtool/) Untar them in a common source code tree. Decide whether you want to install them in /usr/local or your own install directory. If you use your own install directory, use --prefix= with configure. For each autotool package: /configure [--prefix=] make make install Make sure that /bin is at the front of your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/Cast/Makefile.am0000755000175000017500000000444610230024342015324 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP # put . first so that CLHEP directory is built before anything else SUBDIRS = Cast . src # list all subdirectories - for distribution and cleaning DIST_SUBDIRS = Cast . src bin_SCRIPTS = Cast-config all-local: $(top_builddir)/CLHEP # create temporary CLHEP header tree # we only copy headers for packages listed in @PACKAGE@-deps # search for header directories in the following order: # 1. $(top_builddir)/this-package # 2. $(top_builddir)/../other-packages # 3. $(CLHEPSOURCE_DIR)/CLHEP # 4. $(CLHEP_DIR)/include/CLHEP # # abs_ => absolute path abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ COPY_P = @COPY_P@ $(top_builddir)/CLHEP: temp-package-dirs @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ if test -d "$$pkg" ; then \ (cd $$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d ../"$$pkg"/"$$pkg" ; then \ (cd ../$$pkg/$$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg"; then \ hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ else \ if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/include/CLHEP; then \ if test -d $(CLHEP_DIR)/include/CLHEP/"$$pkg"; then \ hdrs=`ls $(CLHEP_DIR)/include/CLHEP/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEP_DIR)/include/CLHEP/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ fi; \ fi; \ fi; \ fi; \ fi; \ done; temp-package-dirs: $(mkinstalldirs) $(abs_top_builddir)/CLHEP; @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ $(mkinstalldirs) $(abs_top_builddir)/CLHEP/$$pkg; \ done; docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs # extra clean rule clean-local: rm -rf $(top_builddir)/CLHEP clhep-2.1.4.1.orig/Cast/bootstrap0000755000175000017500000000071510230024342015223 0ustar olesoles#! /bin/sh set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 rm -f Makefile.in */Makefile.in */defs.h.in rm -f autotools/config* autotools/depcomp autotools/install-sh autotools/m* rm -f configure config.* # run autotool commands aclocal -I autotools autoheader automake --add-missing --copy autoconf # ready to make a source code distribution tarball clhep-2.1.4.1.orig/Cast/configure.ac0000755000175000017500000002702412241267303015565 0ustar olesoles# ====================================================================== # This is the Cast configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.59) AC_INIT(CLHEP Cast, 2.1.4.1, http://savannah.cern.ch/projects/clhep/, Cast) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([src/itos.cc]) AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # ---------------------------------------------------------------------- # --enable-shared and --enable-static # both shared and static libraries are built by default # ---------------------------------------------------------------------- AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Header containing #defines: AM_CONFIG_HEADER([Cast/defs.h]) # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Cast/Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([Cast-deps]) AC_CONFIG_FILES([Cast/copy-header.pl], [chmod +x Cast/copy-header.pl]) # Configuration inquiry program/script: AC_CONFIG_FILES([Cast-config], [chmod +x Cast-config]) # Test driver program/script: ##AC_CONFIG_FILES([test/sizeFixedTypes.sh], [chmod +x test/sizeFixedTypes.sh]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- Cast_CPPFLAGS="-I$includedir" Cast_LDFLAGS="-L$libdir" Cast_LIBS="-lCLHEP-$PACKAGE-$VERSION" AC_SUBST(Cast_CPPFLAGS) AC_SUBST(Cast_LIBS) AC_SUBST(Cast_LDFLAGS) # ---------------------------------------------------------------------- # Supply boilerplate for Cast/defs.h source header: # ---------------------------------------------------------------------- AH_TOP([#ifndef CAST_DEFS_H #define CAST_DEFS_H]) ## the undefs are converted by configure AH_VERBATIM([PACKAGE],[/* Name of package */ #ifndef PACKAGE #undef PACKAGE #endif]) AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif]) AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */ #ifndef PACKAGE_NAME #undef PACKAGE_NAME #endif]) AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #undef PACKAGE_STRING #endif]) AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif]) AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */ #ifndef PACKAGE_VERSION #undef PACKAGE_VERSION #endif]) AH_VERBATIM([VERSION],[/* Version number of package */ #ifndef VERSION #undef VERSION #endif]) AH_BOTTOM([#endif // CAST_DEFS_H]) # ---------------------------------------------------------------------- # Account for any user configuration options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; icc) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Set system-dependent options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed libraries: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed header files: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed typedefs, structures, and compiler characteristics: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed library functions: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/Cast/COPYING.LESSER0000644000175000017500000001674311406160701015325 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/Cast/.cvsignore0000755000175000017500000000007407767704770015320 0ustar olesolesMakefile.in configure aclocal.m4 autom4te.cache config.h.in clhep-2.1.4.1.orig/Cast/COPYING0000644000175000017500000010451311406160701014322 0ustar olesoles GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/Cast/CMakeLists.txt0000644000175000017500000000023011607417635016034 0ustar olesoles# main Cast cmake instructions # automake/autoconf variables set( PACKAGE Cast ) clhep_package_config() add_subdirectory(Cast) add_subdirectory(src) clhep-2.1.4.1.orig/Cast/autotools/0000755000175000017500000000000012242515143015317 5ustar olesolesclhep-2.1.4.1.orig/Cast/autotools/.cvsignore0000755000175000017500000000010107767704770017340 0ustar olesolesconfig.sub config.guess depcomp install-sh missing mkinstalldirs clhep-2.1.4.1.orig/Cast/autotools/ltmain.sh0000755000175000017500000057547210230024342017155 0ustar olesoles# Generated from ltmain.in; do not edit by hand # ltmain.sh (GNU libtool) 1.9b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: powerpc-apple-darwin7.5.0 # shell: $SHELL # compiler: $LTCC # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 1.9b # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST elif test -n "${BASH_VERSION+set}${KSH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh dirname="s,/[^/]*$,," basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: PROGRAM=ltmain.sh progname=`echo "$progpath" | $SED "$basename"` # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *) progdir=`echo "$progpath" | $SED "$dirname"` progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; esac # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.9b TIMESTAMP="" package_revision=1.1571 # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $echo $progname${mode+: }$mode: warning: ${1+"$@"} 1>&2 } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } # func_version # Echo version message to standard output and exit. func_version () { $SED '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# //; s/^# *$//; s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED '/^# Usage:/,/# -h/ { s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" echo echo "run \`$progname --help | more' for full usage" exit $EXIT_SUCCESS } # func_help # Echo long help message to standard output and exit. func_help () { $SED '/^# Usage:/,/# Report bugs to/ { s/^# //; s/^# *$//; s:\$progname:'$progname':; s:\$SHELL:'"$SHELL"':; s:\$LTCC:'"$LTCC"':; s:\$LD:'"$LD"':; s/\$with_gnu_ld/'"$with_gnu_ld"'/; s/\$automake_version/'"`automake --version 2>/dev/null |$SED 1q`"'/; s/\$autoconf_version/'"`autoconf --version 2>/dev/null |$SED 1q`"'/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $EXIT_SUCCESS } # func_features # Display the features supported by this script. func_features () { $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable "`\"foo\"`", so we have to do # it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $echo \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $echo $echo "Try \`$progname --help' for more information about other modes." exit $EXIT_SUCCESS } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # sed scripts: my_sed_single_opt='1s/^\(..\).*$/\1/;q' my_sed_single_rest='1s/^..\(.*\)$/\1/;q' my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' exit_cmd=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set -- --mode clean ${1+"$@"} ;; compile|compil|compi|comp|com|co|c) shift; set -- --mode compile ${1+"$@"} ;; execute|execut|execu|exec|exe|ex|e) shift; set -- --mode execute ${1+"$@"} ;; finish|finis|fini|fin|fi|f) shift; set -- --mode finish ${1+"$@"} ;; install|instal|insta|inst|ins|in|i) shift; set -- --mode install ${1+"$@"} ;; link|lin|li|l) shift; set -- --mode link ${1+"$@"} ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set -- --mode uninstall ${1+"$@"} ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" set -x ;; --dlopen) test $# -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" ;; --dry-run | -n) run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test $# -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" show=: ;; --tag) test $# -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: --dlopen=*|--mode=*|--tag=*) arg=`echo "$opt" | $SED "$my_sed_long_arg"` opt=`echo "$opt" | $SED "$my_sed_long_opt"` set -- "$opt" "$arg" ${1+"$@"} ;; # Separate optargs to short options: # -x*|-y*) # arg=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "$arg" ${1+"$@"} # ;; # Separate non-argument short options: # -z*|-z*|-y*) # rest=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "-$rest" ${1+"$@"} # ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`echo "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$my_dlsyms" test -z "$run" && $echo > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do $show "extracting global C symbols from \`$progfile'" $run eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for dlprefile in $dlprefiles; do $show "extracting global C symbols from \`$dlprefile'" name=`$echo "$dlprefile" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ const struct { const char *originator; const struct { const char *name; void *address; } symbols[]; } lt_${my_prefix}_LTX_preloaded_symbols = {\ \"$my_originator\", { " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" $echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} } }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" status=$? if test "$status" -ne 0 && test ! -d "$my_xdir"; then exit $status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename $darwin_archive` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" # Remove the table of contents from the thin files. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" $AR -xo "${darwin_base_archive}" rm "${darwin_base_archive}" cd "$darwin_curdir" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist rm -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir (cd $my_xdir && $AR x $my_xabs) || exit $? fi # $darwin_arches fi # $run ;; *) # We will extract separately just the conflicting names and we will # no longer touch any unique names. It is faster to leave these # extract automatically by $AR in one run. $show "(cd $my_xdir && $AR x $my_xabs)" $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; renaming object files" func_warning "to ensure that they will not overwrite" $AR t "$my_xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_mode_compile arg... func_mode_compile () { # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1 || \ func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi } # func_mode_finish arg... func_mode_finish () { libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit $EXIT_SUCCESS } # func_mode_install arg... func_mode_install () { # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files test "$#" -gt 2 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. (${SED} -e '2q' $file | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1 || \ func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" $show "$relink_command" $run eval "$relink_command" || \ func_fatal_error "error: relink \`$file' with the above command before installing it" fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | $GREP "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. test -z "$notinst_deplibs" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask func_error "error: cannot create temporary directory \`$tmpdir'" continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" ${rm}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } # func_mode_link arg... func_mode_link () { case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static # See comment for -static flag below, for more details. compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" || \ func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else func_fatal_error "link input file \`$save_arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) # The effects of -all-static are defined in a previous loop. continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs $inherited_linker_flags" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *[\\/]*.la) . $lib ;; *.la) . ./$lib ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`echo "$deplib" |$SED "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$inherited_linker_flags " in *" $deplib "*) ;; * ) inherited_linker_flags="$inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $lib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not use here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib'" fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then : else func_fatal_error "\`$lib' is not a valid libtool archive" fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac case $host in *-*-darwin*) # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then inherited_linker_flags=`$echo "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` fi dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP "bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $echo "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "*** And there doesn't seem to be a static archive available" $echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs $inherited_linker_flags; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" eval darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//' | xargs` compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for archives" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath test "$#" -gt 2 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" test -n "$8" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "AGE \`$age' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | ${SED} 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null | ${SED} 10q | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` inherited_linker_flags=`$echo "X $inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$echo "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`echo "$output" | $SED $basename` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnk $echo "creating GNU ld script: $output" $echo 'INPUT (' > $output for obj in $save_libobjs do $echo \""$obj"\" >> $output done $echo ')' >> $output else $echo "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for objects" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; struct stat st; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$dlsymsobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; overriding AR_FLAGS to 'cq'" func_warning "to ensure that POSIX-compatible ar will work" AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS } # func_mode_uninstall arg... func_mode_uninstall () { rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done test -z "$rm" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 || (test -h "$file") >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status } ## ----------- ## ## Main. ## ## ----------- ## { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." case $mode in compile) func_mode_compile ${1+"$@"} ;; execute) func_mode_execute ${1+"$@"} ;; finish) func_mode_finish ${1+"$@"} ;; install) func_mode_install ${1+"$@"} ;; link|relink) func_mode_link ${1+"$@"} ;; uninstall|clean) func_mode_uninstall ${1+"$@"} ;; "") help="$generic_help" func_fatal_help "you must specify a MODE" ;; esac test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi } exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: clhep-2.1.4.1.orig/Cast/src/0000755000175000017500000000000012242515143014055 5ustar olesolesclhep-2.1.4.1.orig/Cast/src/Makefile.am0000755000175000017500000000316711406160701016120 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir) libCLHEP_Cast_@VERSION@_a_SOURCES = \ itos.cc libCLHEP_Cast_@VERSION@_so_OBJECTS = $(patsubst %.cc,$(shareddir)/%.$(OBJEXT),$(libCLHEP_Cast_@VERSION@_a_SOURCES)) # these if/else blocks will be parsed by automake and translated if BUILD_SHARED shareddir = shared if BUILD_VISUAL lib_shared = CLHEP-Cast-@VERSION@.$(SHEXT) else lib_shared = libCLHEP-Cast-@VERSION@.$(SHEXT) endif SHFLAGS = @MY_SHFLAGS@ SHLINK = @MY_SHLINK@ @MY_SHEXTRA@ SHNAME = @MY_SHNAME@ endif if BUILD_STATIC lib_LIBRARIES = libCLHEP-Cast-@VERSION@.a endif CLEANFILES = $(lib_shared) all-local: $(shareddir) $(lib_shared) $(shareddir): test -d $(shareddir) || mkdir $(shareddir) if BUILD_VISUAL $(lib_shared): $(libCLHEP_Cast_@VERSION@_so_OBJECTS) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Cast_@VERSION@_so_OBJECTS) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) /c /Fo$@ $< else $(lib_shared): $(libCLHEP_Cast_@VERSION@_so_OBJECTS) $(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Cast_@VERSION@_so_OBJECTS) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) -c -o $@ $< endif install-exec-local: $(lib_shared) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_shared)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$p'"; \ $(INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done clean-local: -test -d $(shareddir) && rm -f $(shareddir)/*.$(OBJEXT) distclean-local: -test -d $(shareddir) && rm -rf ./$(shareddir) clhep-2.1.4.1.orig/Cast/src/.cvsignore0000755000175000017500000000001407767704770016101 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Cast/src/CMakeLists.txt0000644000175000017500000000004511606714767016634 0ustar olesoles clhep_build_library( Cast itos.cc ) clhep-2.1.4.1.orig/Cast/src/itos.cc0000755000175000017500000000102211406160701015335 0ustar olesoles// ---------------------------------------------------------------------- // // itos - convert (long) integer to string // // History: // 19-Dec-1997 WEB Initial draft // 05-Dec-1998 WEB Added "using" statement // 14-Feb-2000 WEB Improve C++ Standard compliance // // ---------------------------------------------------------------------- #include #include "CLHEP/Cast/defs.h" #include "CLHEP/Cast/itos.h" std::string itos( long i ) { std::ostringstream s; s << i; return s.str(); } // itos() clhep-2.1.4.1.orig/Cast/Cast-config.in0000755000175000017500000000403012234340066015754 0ustar olesoles#! /bin/sh # @configure_input@ # we include the paths of the original install directories for reference orig_prefix="@prefix@" orig_exec_prefix="@exec_prefix@" orig_includedir="@includedir@" # use the full name of this script to get the current path configpath=`dirname ${0}` # check for a leading slash to determine if this is a relative path firstc=`expr ${configpath} : "\/"` calldir=`pwd` if [ ${firstc} -eq 0 ] then cd "${calldir}/${configpath}"; newpath=`pwd` binpath=${newpath} else binpath=${configpath} fi # OK - now we have to strip the trailing "/bin" out of the path prefix=`dirname "${binpath}"` includedir=${prefix}/include libdir=${prefix}/lib usage() { cat <-config scripts which gives the list of libraries to link, in the correct order. The script can be embedded in a makefile. clhep-config --libs - link list of ALL CLHEP libraries -config --libs - link list of ONLY those libraries needed to use #------------------------------------------------------------- clhep-2.1.4.1.orig/Makefile.am0000755000175000017500000000751111421415000014424 0ustar olesoles## Process this file with automake to produce Makefile.in ## Special note: Run buildDoxy.sh here to generate the html reference documentation. ## Then copy or move the html directory to the appropriate place. if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP SUBDIRS = Units Utility Vector Evaluator GenericFunctions Geometry \ Random Matrix RandomObjects Cast RefCount Exceptions bin_SCRIPTS = clheplib clhep-config LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ CXXFLAGS = @CXXFLAGS@ CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ # these if/else blocks will be parsed by automake and translated if BUILD_SHARED shareddir = shared if BUILD_VISUAL lib_shared = CLHEP-@VERSION@.$(SHEXT) else lib_shared = libCLHEP-@VERSION@.$(SHEXT) endif SHFLAGS = @MY_SHFLAGS@ SHLINK = @MY_SHLINK@ SHNAME = @MY_SHNAME@ endif if BUILD_STATIC CLHEPLIB = libCLHEP-@VERSION@.a endif if BUILD_VISUAL MAKE_STATIC_CLHEP = $(COPY_P) libCLHEP-@VERSION@.a libCLHEP.a MAKE_SHARED_CLHEP = $(COPY_P) CLHEP-@VERSION@.$(SHEXT) CLHEP.$(SHEXT) else MAKE_STATIC_CLHEP = $(LN_S) libCLHEP-@VERSION@.a libCLHEP.a MAKE_SHARED_CLHEP = $(LN_S) libCLHEP-@VERSION@.$(SHEXT) libCLHEP.$(SHEXT) endif CLEANFILES = clheplib library-list $(CLHEPLIB) $(lib_shared) ClhepVersion.h all-local: $(CLHEPLIB) $(lib_shared) versionheader $(CLHEPLIB): -rm -f $@ liblist=`$(top_builddir)/getObjectList -static $(SUBDIRS)`; \ $(AR) $(ARFLAGS) $@ $$liblist; $(RANLIB) $@ if BUILD_VISUAL $(lib_shared): -rm -f $@ liblist=`$(top_builddir)/getObjectList -shared $(SUBDIRS)`; \ $(SHLINK) $(SHNAME)$@ $$liblist else $(lib_shared): -rm -f $@ liblist=`$(top_builddir)/getObjectList -shared $(SUBDIRS)`; \ $(CXXLINK) $(SHLINK) $(SHNAME)$@ $$liblist -o $@ endif docs: list='$(SUBDIRS)'; for subdir in $$list; do \ if test -d "$$subdir"/doc; then (cd $$subdir; $(MAKE) $(AM_MAKEFLAGS) docs; cd .. ); fi; \ done install-docs: list='$(SUBDIRS)'; for subdir in $$list; do \ if test -d "$$subdir"/doc; then (cd $$subdir; $(MAKE) $(AM_MAKEFLAGS) install-docs; cd .. ); fi; \ done clheplib: build-clheplib ./build-clheplib $(SUBDIRS) versionheader: build-header ./build-header install-exec-local: install-CLHEPLIB install-versionheader install-CLHEPLIB: $(CLHEPLIB) $(lib_shared) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(CLHEPLIB)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL_DATA) '$$p' '$(DESTDIR)$(libdir)/$$p'"; \ $(INSTALL_DATA) "$$p" "$(DESTDIR)$(libdir)/$$p"; \ else :; fi; \ done @$(POST_INSTALL) @list='$(CLHEPLIB)'; for p in $$list; do \ if test -f $$p; then \ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ if test -f $(DESTDIR)$(libdir)/libCLHEP.a; then \ (rm -f $(DESTDIR)$(libdir)/libCLHEP.a); fi; \ (cd $(DESTDIR)$(libdir) && $(MAKE_STATIC_CLHEP) ); \ else :; fi; \ done @$(NORMAL_INSTALL) @list='$(lib_shared)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$p'"; \ $(INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done @$(POST_INSTALL) @list='$(lib_shared)'; for p in $$list; do \ if test -f $$p; then \ if test -f $(DESTDIR)$(libdir)/libCLHEP.a; then \ (rm -f $(DESTDIR)$(libdir)/libCLHEP.$(SHEXT)); fi; \ (cd $(DESTDIR)$(libdir) && $(MAKE_SHARED_CLHEP) ); \ else :; fi; \ done install-versionheader: versionheader @$(NORMAL_INSTALL) test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" if test -f ClhepVersion.h; then \ echo " $(INSTALL_DATA) 'ClhepVersion.h' '$(DESTDIR)$(includedir)/ClhepVersion.h'"; \ $(INSTALL_DATA) "ClhepVersion.h" "$(DESTDIR)$(includedir)/ClhepVersion.h"; \ else :; fi @$(POST_INSTALL) clean-local: rm -f *-dep-list rm -f *-library-list clhep-2.1.4.1.orig/bootstrap0000755000175000017500000000102611422340617014337 0ustar olesoles#! /bin/sh # turn on echo set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 Makefile.in rm -f configure config.* depcomp install-sh missing mk* # run autotool commands aclocal automake --add-missing --copy autoconf #run autotool commands in each subdirectory for pkg in `ls` do if [ -e $pkg/configure.ac ] then cd $pkg ./bootstrap cd .. fi done # ready to make a source code distribution tarball clhep-2.1.4.1.orig/ReadMe.win0000644000175000017500000000202612012777433014257 0ustar olesoles#------------------------------------------------------------- You MUST use cmake and nmake to build on a Windows machine. Work in a DOS window. You may also have success using the cmake and VC gui interfaces. #------------------------------------------------------------- # setup the compiler #------------------------------------------------------------- call "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat" #------------------------------------------------------------- # building CLHEP #------------------------------------------------------------- Work from a separate build directory. cmake -DCMAKE_INSTALL_PREFIX=C:\.... -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo C:\full\path\to\CLHEP nmake nmake test nmake install #------------------------------------------------------------- # trouble reports #------------------------------------------------------------- Please report problems using the bug-tracker of the savannah portal at: http://savannah.cern.ch/projects/clhep clhep-2.1.4.1.orig/configure.ac0000755000175000017500000002342712241267303014676 0ustar olesoles# ====================================================================== # This is the CLHEP configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.59) AC_INIT(CLHEP, 2.1.4.1, http://savannah.cern.ch/projects/clhep/ ) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([Vector/src/AxisAngle.cc]) AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # ---------------------------------------------------------------------- # subpackages # ---------------------------------------------------------------------- AC_CONFIG_SUBDIRS(Units Utility Vector Evaluator GenericFunctions Geometry Random Matrix RandomObjects RefCount Cast Exceptions) # ---------------------------------------------------------------------- # --enable-exceptions or --disable-exceptions # --disable-exceptions is the default # ---------------------------------------------------------------------- AC_ARG_ENABLE(exceptions, AC_HELP_STRING([--enable-exceptions],[use CLHEP/Exceptions (off by default)]), [case "${enableval}" in yes) AC_SUBST(use_exceptions,["#define ENABLE_ZOOM_EXCEPTIONS"]) ;; no) AC_SUBST(use_exceptions,["#undef ENABLE_ZOOM_EXCEPTIONS"]) ;; *) AC_SUBST(use_exceptions,["#define ENABLE_ZOOM_EXCEPTIONS"]) ;; esac], [AC_SUBST(use_exceptions,["#undef ENABLE_ZOOM_EXCEPTIONS"])]) AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([getObjectList], [chmod +x getObjectList]) # tarball scripts AC_CONFIG_FILES([makeSourceDist], [chmod +x makeSourceDist]) AC_CONFIG_FILES([makeBinaryTar], [chmod +x makeBinaryTar]) # build clheplib AC_CONFIG_FILES([build-clheplib], [chmod +x build-clheplib]) # build ClhepVersion.h AC_CONFIG_FILES([build-header], [chmod +x build-header]) # Configuration inquiry program/script: AC_CONFIG_FILES([clhep-config], [chmod +x clhep-config]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; icc) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/COPYING.LESSER0000644000175000017500000001674311406214373014440 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/Geometry/0000755000175000017500000000000012242515152014167 5ustar olesolesclhep-2.1.4.1.orig/Geometry/Geometry-deps.in0000755000175000017500000000023010043471537017246 0ustar olesolesCLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Vector-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Units-@VERSION@ clhep-2.1.4.1.orig/Geometry/INSTALL0000755000175000017500000000772111406175007015234 0ustar olesoles#------------------------------------------------------------- # platform specific issues #------------------------------------------------------------- This package requires autoconf 2.59 or later and automake 1.9.1 or later. If you bootstrap, you will probably have to build these yourself. See "building autotools" below. The new libtool no longer properly supports shared libraries for gcc 2.95.2. If you build CLHEP with gcc 2.95.2, you must configure --disable-shared. To build for Solaris CC, configure with CXX=CC CC=cc and use gmake. On MacOSX, you need to define MACOSX_DEPLOYMENT_TARGET appropriately. For instance, set MACOSX_DEPLOYMENT_TARGET to "10.4" if you have MacOS 10.4 installed on your system. #------------------------------------------------------------- # installing from a source code tar ball #------------------------------------------------------------- Unwind the source code tar ball in some relevant directory. Autoconf and automake will aready have been run. Determine where the files will be installed. Create a build directory that is NOT in the source code directory tree. cd /configure --prefix= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make check (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # configure options #------------------------------------------------------------- A variety of options can be given to configure. Below is a list of the options that you are likely to find most useful. --help provides a partial list of options --prefix=PREFIX install architecture-independent files in PREFIX [default is /usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [default is the same as PREFIX] --disable-shared build only static libraries --disable-static build only shared libraries --enable-exceptions use the CLHEP/Exceptions package --disable-exceptions DO NOT use the CLHEP/Exceptions package [--disable-exceptions is the default] #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are neither built nor installed automatically. Use the following commands to build and install documents: make docs make install-docs #------------------------------------------------------------- # building from cvs #------------------------------------------------------------- You will need current versions of automake, autoconf, and libtool. See building autotools below. cvs co CLHEP/package OR cvs co package cd [CLHEP/]package ./bootstrap Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building autotools #------------------------------------------------------------- If you do not have at least autoconf 2.59 and automake 1.9.1, you will need to build autoconf, automake, and libtool. On some platforms, you may also need to build m4 and texinfo. Download the relevant tarballs from gnu.org (http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/, and http://www.gnu.org/software/libtool/) Untar them in a common source code tree. Decide whether you want to install them in /usr/local or your own install directory. If you use your own install directory, use --prefix= with configure. For each autotool package: /configure [--prefix=] make make install Make sure that /bin is at the front of your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/Geometry/Geometry-config.in0000755000175000017500000000406012234340066017561 0ustar olesoles#! /bin/sh # @configure_input@ # we include the paths of the original install directories for reference orig_prefix="@prefix@" orig_exec_prefix="@exec_prefix@" orig_includedir="@includedir@" # use the full name of this script to get the current path configpath=`dirname ${0}` # check for a leading slash to determine if this is a relative path firstc=`expr ${configpath} : "\/"` calldir=`pwd` if [ ${firstc} -eq 0 ] then cd "${calldir}/${configpath}"; newpath=`pwd` binpath=${newpath} else binpath=${configpath} fi # OK - now we have to strip the trailing "/bin" out of the path prefix=`dirname "${binpath}"` includedir=${prefix}/include libdir=${prefix}/lib usage() { cat < absolute path abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ COPY_P = @COPY_P@ $(top_builddir)/CLHEP: temp-package-dirs @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ if test -d "$$pkg" ; then \ (cd $$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d ../"$$pkg"/"$$pkg" ; then \ (cd ../$$pkg/$$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg"; then \ hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ else \ if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/include/CLHEP; then \ if test -d $(CLHEP_DIR)/include/CLHEP/"$$pkg"; then \ hdrs=`ls $(CLHEP_DIR)/include/CLHEP/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEP_DIR)/include/CLHEP/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ fi; \ fi; \ fi; \ fi; \ fi; \ done; temp-package-dirs: $(mkinstalldirs) $(abs_top_builddir)/CLHEP; @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ $(mkinstalldirs) $(abs_top_builddir)/CLHEP/$$pkg; \ done; docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs # extra clean rule clean-local: rm -rf $(top_builddir)/CLHEP clhep-2.1.4.1.orig/Geometry/bootstrap0000755000175000017500000000071510233731142016132 0ustar olesoles#! /bin/sh set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 rm -f Makefile.in */Makefile.in */defs.h.in rm -f autotools/config* autotools/depcomp autotools/install-sh autotools/m* rm -f configure config.* # run autotool commands aclocal -I autotools autoheader automake --add-missing --copy autoconf # ready to make a source code distribution tarball clhep-2.1.4.1.orig/Geometry/configure.ac0000755000175000017500000002724612241267303016474 0ustar olesoles# ====================================================================== # This is the Geometry configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.59) AC_INIT(CLHEP Geometry, 2.1.4.1, http://savannah.cern.ch/projects/clhep/, Geometry) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([src/Plane3D.cc]) AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # ---------------------------------------------------------------------- # --enable-shared and --enable-static # both shared and static libraries are built by default # ---------------------------------------------------------------------- AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Header containing #defines: AM_CONFIG_HEADER([Geometry/defs.h]) # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Geometry/Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([Geometry-deps]) AC_CONFIG_FILES([Geometry/copy-header.pl], [chmod +x Geometry/copy-header.pl]) # Configuration inquiry program/script: AC_CONFIG_FILES([Geometry-config], [chmod +x Geometry-config]) # Test driver program/script: AC_CONFIG_FILES([test/testBasicVector3D.sh], [chmod +x test/testBasicVector3D.sh]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- Geometry_CPPFLAGS="-I$includedir" Geometry_LDFLAGS="-L$libdir" Geometry_LIBS="-lCLHEP-$PACKAGE-$VERSION -lCLHEP-Vector-$VERSION" AC_SUBST(Geometry_CPPFLAGS) AC_SUBST(Geometry_LIBS) AC_SUBST(Geometry_LDFLAGS) # ---------------------------------------------------------------------- # Supply boilerplate for Geometry/defs.h source header: # ---------------------------------------------------------------------- AH_TOP([#ifndef GEOMETRY_DEFS_H #define GEOMETRY_DEFS_H]) ## the undefs are converted by configure AH_VERBATIM([PACKAGE],[/* Name of package */ #ifndef PACKAGE #undef PACKAGE #endif]) AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif]) AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */ #ifndef PACKAGE_NAME #undef PACKAGE_NAME #endif]) AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #undef PACKAGE_STRING #endif]) AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif]) AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */ #ifndef PACKAGE_VERSION #undef PACKAGE_VERSION #endif]) AH_VERBATIM([VERSION],[/* Version number of package */ #ifndef VERSION #undef VERSION #endif]) AH_BOTTOM([#endif // GEOMETRY_DEFS_H]) # ---------------------------------------------------------------------- # Account for any user configuration options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; icc) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Set system-dependent options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed libraries: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed header files: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed typedefs, structures, and compiler characteristics: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed library functions: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/Geometry/COPYING.LESSER0000644000175000017500000001674311406175007016233 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/Geometry/Geometry/0000755000175000017500000000000012242515152015762 5ustar olesolesclhep-2.1.4.1.orig/Geometry/Geometry/cmake-defs.h.in0000644000175000017500000000172511607115601020543 0ustar olesoles/* @PACKAGE@/defs.h Generated by cmake. */ #ifndef @UPACKAGE@_DEFS_H #define @UPACKAGE@_DEFS_H /* Name of package */ #ifndef PACKAGE #define PACKAGE "@PACKAGE@" #endif /* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #define PACKAGE_BUGREPORT "http://savannah.cern.ch/projects/clhep/" #endif /* Define to the full name of this package. */ #ifndef PACKAGE_NAME #define PACKAGE_NAME "@PROJECT_NAME@ @PACKAGE@" #endif /* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #define PACKAGE_STRING "@PROJECT_NAME@ @PACKAGE@ @VERSION@" #endif /* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #define PACKAGE_TARNAME "@PACKAGE@" #endif /* Define to the version of this package. */ #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "@VERSION@" #endif /* Version number of package */ #ifndef VERSION #define VERSION "@VERSION@" #endif #endif // @UPACKAGE@_DEFS_H clhep-2.1.4.1.orig/Geometry/Geometry/Vector3D.h0000755000175000017500000001200511712344401017563 0ustar olesoles// -*- C++ -*- // $Id: Vector3D.h,v 1.3 2003/10/23 21:29:50 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // History: // 09.09.96 E.Chernyaev - initial version // 12.06.01 E.Chernyaev - CLHEP-1.7: introduction of BasicVector3D to decouple // the functionality from CLHEP::Hep3Vector // 01.04.03 E.Chernyaev - CLHEP-1.9: template version // #ifndef HEP_VECTOR3D_H #define HEP_VECTOR3D_H #include #include "CLHEP/Geometry/defs.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Geometry/BasicVector3D.h" namespace HepGeom { class Transform3D; /** * Geometrical 3D Vector. * This is just a declaration of the class needed to define * specializations Vector3D and Vector3D. * * @ingroup geometry * @author Evgeni Chernyaev */ template class Vector3D : public BasicVector3D {}; /** * Geometrical 3D Vector with components of float type. * * @author Evgeni Chernyaev * @ingroup geometry */ template<> class Vector3D : public BasicVector3D { public: /** * Default constructor. */ Vector3D() {} /** * Constructor from three numbers. */ Vector3D(float x1, float y1, float z1) : BasicVector3D(x1,y1,z1) {} /** * Constructor from array of floats. */ explicit Vector3D(const float * a) : BasicVector3D(a[0],a[1],a[2]) {} /** * Copy constructor. */ Vector3D(const Vector3D & v) : BasicVector3D(v) {} /** * Constructor from BasicVector3D. */ Vector3D(const BasicVector3D & v) : BasicVector3D(v) {} /** * Destructor. */ ~Vector3D() {} /** * Assignment. */ Vector3D & operator=(const Vector3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Assignment from BasicVector3D. */ Vector3D & operator=(const BasicVector3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Transformation by Transform3D. */ Vector3D & transform(const Transform3D & m); }; /** * Transformation of Vector by Transform3D. * @relates Vector3D */ Vector3D operator*(const Transform3D & m, const Vector3D & v); /** * Geometrical 3D Vector with components of double type. * * @author Evgeni Chernyaev * @ingroup geometry */ template<> class Vector3D : public BasicVector3D { public: /** * Default constructor. */ Vector3D() {} /** * Constructor from three numbers. */ Vector3D(double x1, double y1, double z1) : BasicVector3D(x1,y1,z1) {} /** * Constructor from array of floats. */ explicit Vector3D(const float * a) : BasicVector3D(a[0],a[1],a[2]) {} /** * Constructor from array of doubles. */ explicit Vector3D(const double * a) : BasicVector3D(a[0],a[1],a[2]) {} /** * Copy constructor. */ Vector3D(const Vector3D & v) : BasicVector3D(v) {} /** * Constructor from BasicVector3D. */ Vector3D(const BasicVector3D & v) : BasicVector3D(v) {} /** * Constructor from BasicVector3D. */ Vector3D(const BasicVector3D & v) : BasicVector3D(v) {} /** * Destructor. */ ~Vector3D() {} /** * Constructor from CLHEP::Hep3Vector. * This constructor is needed only for backward compatibility and * in principle should be absent. */ Vector3D(const CLHEP::Hep3Vector & v) : BasicVector3D(v.x(),v.y(),v.z()) {} /** * Conversion (cast) to CLHEP::Hep3Vector. * This operator is needed only for backward compatibility and * in principle should not exit. */ operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); } /** * Assignment. */ Vector3D & operator=(const Vector3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Assignment from BasicVector3D. */ Vector3D & operator=(const BasicVector3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Assignment from BasicVector3D. */ Vector3D & operator=(const BasicVector3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Transformation by Transform3D. */ Vector3D & transform(const Transform3D & m); }; /** * Transformation of Vector by Transform3D. * @relates Vector3D */ Vector3D operator*(const Transform3D & m, const Vector3D & v); } /* namespace HepGeom */ #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 typedef HepGeom::Vector3D HepVector3D; #endif #endif /* HEP_VECTOR3D_H */ clhep-2.1.4.1.orig/Geometry/Geometry/Transform3D.h0000755000175000017500000006136611753240470020320 0ustar olesoles// -*- C++ -*- // $Id: Transform3D.h,v 1.5 2010/06/16 16:21:27 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // Hep geometrical 3D Transformation class // // Author: Evgeni Chernyaev // // ****************************************** // * * // * Transform * // * / / \ \ * // * -------- / \ -------- * // * / / \ \ * // * Rotate Translate Reflect Scale * // * / | \ / | \ / | \ / | \ * // * X Y Z X Y Z X Y Z X Y Z * // * * // ****************************************** // // Identity transformation: // Transform3D::Identity - global identity transformation; // any constructor without parameters, e.g. Transform3D(); // m.setIdentity() - set "m" to identity; // // General transformations: // Transform3D(m,v) - transformation given by Rotation "m" // and CLHEP::Hep3Vector "v"; // Transform3D(a0,a1,a2, b0,b1,b2) - transformation given by initial // and transformed positions of three points; // Rotations: // Rotate3D(m) - rotation given by CLHEP::HepRotation "m"; // Rotate3D(ang,v) - rotation through the angle "ang" around // vector "v"; // Rotate3D(ang,p1,p2) - rotation through the angle "ang" // counterclockwise around the axis given by // two points p1->p2; // Rotate3D(a1,a2, b1,b2) - rotation around the origin defined by initial // and transformed positions of two points; // RotateX3D(ang) - rotation around X-axis; // RotateY3D(ang) - rotation around Y-axis; // RotateZ3D(ang) - rotation around Z-axis; // // Translations: // Translate3D(v) - translation given by CLHEP::Hep3Vector "v"; // Translate3D(dx,dy,dz) - translation on vector (dx,dy,dz); // TraslateX3D(dx) - translation along X-axis; // TraslateY3D(dy) - translation along Y-axis; // TraslateZ3D(dz) - translation along Z-axis; // // Reflections: // Reflect3D(a,b,c,d) - reflection in the plane a*x+b*y+c*z+d=0; // Reflect3D(normal,p) - reflection in the plane going through "p" // and whose normal is equal to "normal"; // ReflectX3D(a) - reflect X in the plane x=a (default a=0); // ReflectY3D(a) - reflect Y in the plane y=a (default a=0); // ReflectZ3D(a) - reflect Z in the plane z=a (default a=0); // // Scalings: // Scale3D(sx,sy,sz) - general scaling with factors "sx","sy","sz" // along X, Y and Z; // Scale3D(s) - scaling with constant factor "s" along all // directions; // ScaleX3D(sx) - scale X; // ScaleY3D(sy) - scale Y; // ScaleZ3D(sz) - scale Z; // // Inverse transformation: // m.inverse() or - returns inverse transformation; // // Compound transformation: // m3 = m2 * m1 - it is relatively slow in comparison with // transformation of a vector. Use parenthesis // to avoid this operation (see example below); // Transformation of point: // p2 = m * p1 // // Transformation of vector: // v2 = m * v1 // // Transformation of normal: // n2 = m * n1 // // The following table explains how different transformations affect // point, vector and normal. "+" means affect, "-" means do not affect, // "*" meas affect but in different way than "+" // // Point Vector Normal // -------------+-------+-------+------- // Rotation ! + ! + ! + // Translation ! + ! - ! - // Reflection ! + ! + ! * // Scaling ! + ! + ! * // -------------+-------+-------+------- // // Example of the usage: // // Transform3D m1, m2, m3; // HepVector3D v2, v1(0,0,0); // // m1 = Rotate3D(angle, Vector3D(1,1,1)); // m2 = Translate3D(dx,dy,dz); // m3 = m1.inverse(); // // v2 = m3*(m2*(m1*v1)); // // History: // 24.09.96 E.Chernyaev - initial version // // 26.02.97 E.Chernyaev // - added global Identity by request of John Allison // (to avoid problems with compilation on HP) // - added getRotation and getTranslation // // 29.01.01 E.Chernyaev - added subscripting // 11.06.01 E.Chernyaev - added getDecomposition #ifndef HEP_TRANSFROM3D_H #define HEP_TRANSFROM3D_H #include "CLHEP/Geometry/defs.h" #include "CLHEP/Vector/ThreeVector.h" namespace HepGeom { template class Point3D; template class Vector3D; template class Normal3D; class Translate3D; class Rotate3D; class Scale3D; /** * Class for transformation of 3D geometrical objects. * It allows different translations, rotations, scalings and reflections. * Several specialized classes are derived from it: * * TranslateX3D, TranslateY3D, TranslateZ3D, Translate3D,
    * RotateX3D, RotateY3D, RotateZ3D, Rotate3D,
    * ScaleX3D, ScaleY3D, ScaleZ3D, Scale3D,
    * ReflectX3D, ReflectY3D, ReflectZ3D, Reflect3D. * * The idea behind these classes is to provide some additional constructors * for Transform3D, they normally should not be used as separate classes. * * Example: * @code * HepGeom::Transform3D m; * m = HepGeom::TranslateX3D(10.*cm); * @endcode * * Remark: * For the reason that the operator* is left associative, the notation * @code * v2 = m3*(m2*(m1*v1)); * @endcode * is much more effective then the notation * @code * v2 = m3*m2*m1*v1; * @endcode * In the first case three operations Transform3D*Vector3D are executed, * in the second case two operations Transform3D*Transform3D and one * Transform3D*Vector3D are performed. Transform3D*Transform3D is * roughly three times slower than Transform3D*Vector3D. * * @author * @ingroup geometry */ class Transform3D { protected: double xx_, xy_, xz_, dx_, // 4x3 Transformation Matrix yx_, yy_, yz_, dy_, zx_, zy_, zz_, dz_; // Protected constructor Transform3D(double XX, double XY, double XZ, double DX, double YX, double YY, double YZ, double DY, double ZX, double ZY, double ZZ, double DZ) : xx_(XX), xy_(XY), xz_(XZ), dx_(DX), yx_(YX), yy_(YY), yz_(YZ), dy_(DY), zx_(ZX), zy_(ZY), zz_(ZZ), dz_(DZ) {} // Set transformation matrix void setTransform(double XX, double XY, double XZ, double DX, double YX, double YY, double YZ, double DY, double ZX, double ZY, double ZZ, double DZ) { xx_ = XX; xy_ = XY; xz_ = XZ; dx_ = DX; yx_ = YX; yy_ = YY; yz_ = YZ; dy_ = DY; zx_ = ZX; zy_ = ZY; zz_ = ZZ; dz_ = DZ; } public: /** * Global identity transformation. */ static const Transform3D Identity; // Helper class for implemention of C-style subscripting r[i][j] class Transform3D_row { public: inline Transform3D_row(const Transform3D &, int); inline double operator [] (int) const; private: const Transform3D & rr; int ii; }; /** * Default constructor - sets the Identity transformation. */ Transform3D() : xx_(1), xy_(0), xz_(0), dx_(0), yx_(0), yy_(1), yz_(0), dy_(0), zx_(0), zy_(0), zz_(1), dz_(0) {} /** * Constructor: rotation and then translation. */ inline Transform3D(const CLHEP::HepRotation & m, const CLHEP::Hep3Vector & v); /** * Constructor: transformation of basis (assumed - no reflection). */ Transform3D(const Point3D & fr0, const Point3D & fr1, const Point3D & fr2, const Point3D & to0, const Point3D & to1, const Point3D & to2); /** * Copy constructor. */ Transform3D(const Transform3D & m) : xx_(m.xx_), xy_(m.xy_), xz_(m.xz_), dx_(m.dx_), yx_(m.yx_), yy_(m.yy_), yz_(m.yz_), dy_(m.dy_), zx_(m.zx_), zy_(m.zy_), zz_(m.zz_), dz_(m.dz_) {} /** * Destructor. * Virtual for now as some persistency mechanism needs that, * in future releases this might go away again. */ ~Transform3D() { /* nop */ } /** * Returns object of the helper class for C-style subscripting r[i][j] */ inline const Transform3D_row operator [] (int) const; /** Fortran-style subscripting: returns (i,j) element of the matrix. */ double operator () (int, int) const; /** * Gets xx-element of the transformation matrix. */ double xx() const { return xx_; } /** * Gets xy-element of the transformation matrix. */ double xy() const { return xy_; } /** * Gets xz-element of the transformation matrix. */ double xz() const { return xz_; } /** * Gets yx-element of the transformation matrix. */ double yx() const { return yx_; } /** * Gets yy-element of the transformation matrix. */ double yy() const { return yy_; } /** * Gets yz-element of the transformation matrix. */ double yz() const { return yz_; } /** * Gets zx-element of the transformation matrix. */ double zx() const { return zx_; } /** * Gets zy-element of the transformation matrix. */ double zy() const { return zy_; } /** * Gets zz-element of the transformation matrix. */ double zz() const { return zz_; } /** * Gets dx-element of the transformation matrix. */ double dx() const { return dx_; } /** * Gets dy-element of the transformation matrix. */ double dy() const { return dy_; } /** * Gets dz-element of the transformation matrix. */ double dz() const { return dz_; } /** * Assignment. */ Transform3D & operator=(const Transform3D &m) { xx_= m.xx_; xy_= m.xy_; xz_= m.xz_; dx_= m.dx_; yx_= m.yx_; yy_= m.yy_; yz_= m.yz_; dy_= m.dy_; zx_= m.zx_; zy_= m.zy_; zz_= m.zz_; dz_= m.dz_; return *this; } /** * Sets the Identity transformation. */ void setIdentity() { xy_= xz_= dx_= yx_= yz_= dy_= zx_= zy_= dz_= 0; xx_= yy_= zz_= 1; } /** * Returns the inverse transformation. */ Transform3D inverse() const; /** * Transformation by another Transform3D. */ Transform3D operator*(const Transform3D & b) const; /** * Decomposition of general transformation. * This function gets decomposition of the transformation * in three consequentive specific transformations: Scale3D, * then Rotate3D, then Translate3, i.e. * @code * Transform3D = Translate3D * Rotate3D * Scale3D * @endcode * * @param scale output: scaling transformation; * if there was a reflection, then scale factor for * z-component (scale(2,2)) will be negative. * @param rotation output: rotation transformaion. * @param translation output: translation transformaion. */ void getDecomposition(Scale3D & scale, Rotate3D & rotation, Translate3D & translation) const; /** * Returns true if the difference between corresponding * matrix elements is less than the tolerance. */ bool isNear(const Transform3D & t, double tolerance = 2.2E-14 ) const; /** * Extracts the rotation matrix. * This functions is obsolete - use getDecomposition() instead. */ inline CLHEP::HepRotation getRotation() const; /** * Extracts the translation vector. * This functions is obsolete - use getDecomposition() instead. */ inline CLHEP::Hep3Vector getTranslation() const; /** * Test for equality. */ bool operator == (const Transform3D & transform) const; /** * Test for inequality. */ bool operator != (const Transform3D & transform) const { return ! operator==(transform); } }; // R O T A T I O N S /** * Constructs a rotation transformation. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = Rotate3D(30.*deg, HepVector3D(1.,1.,1.)); * @endcode * * @author * @ingroup geometry */ class Rotate3D : public Transform3D { public: /** * Default constructor: sets the Identity transformation. */ Rotate3D() : Transform3D() {} /** * Constructor from CLHEP::HepRotation. */ inline Rotate3D(const CLHEP::HepRotation &m); /** * Constructor from angle and axis given by two points. * @param a angle of rotation * @param p1 begin point of the axis * @param p2 end point of the axis */ Rotate3D(double a, const Point3D & p1, const Point3D & p2); /** * Constructor from angle and axis. * @param a angle of rotation * @param v axis of rotation */ inline Rotate3D(double a, const Vector3D & v); /** * Constructor for rotation given by original and rotated position of * two points. It is assumed that there is no reflection. * @param fr1 original position of 1st point * @param fr2 original position of 2nd point * @param to1 rotated position of 1st point * @param to2 rotated position of 2nd point */ inline Rotate3D(const Point3D & fr1, const Point3D & fr2, const Point3D & to1, const Point3D & to2); }; /** * Constructs a rotation around x-axis. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = RotateX3D(30.*deg); * @endcode * * @author * @ingroup geometry */ class RotateX3D : public Rotate3D { public: /** * Default constructor: sets the Identity transformation. */ RotateX3D() : Rotate3D() {} /** * Constructs a rotation around x-axis by angle a. */ RotateX3D(double a) { double cosa = std::cos(a), sina = std::sin(a); setTransform(1,0,0,0, 0,cosa,-sina,0, 0,sina,cosa,0); } }; /** * Constructs a rotation around y-axis. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = RotateY3D(30.*deg); * @endcode * * @author * @ingroup geometry */ class RotateY3D : public Rotate3D { public: /** * Default constructor: sets the Identity transformation. */ RotateY3D() : Rotate3D() {} /** * Constructs a rotation around y-axis by angle a. */ RotateY3D(double a) { double cosa = std::cos(a), sina = std::sin(a); setTransform(cosa,0,sina,0, 0,1,0,0, -sina,0,cosa,0); } }; /** * Constructs a rotation around z-axis. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = RotateZ3D(30.*deg); * @endcode * * @author * @ingroup geometry */ class RotateZ3D : public Rotate3D { public: /** * Default constructor: sets the Identity transformation. */ RotateZ3D() : Rotate3D() {} /** * Constructs a rotation around z-axis by angle a. */ RotateZ3D(double a) { double cosa = std::cos(a), sina = std::sin(a); setTransform(cosa,-sina,0,0, sina,cosa,0,0, 0,0,1,0); } }; // T R A N S L A T I O N S /** * Constructs a translation transformation. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = Translate3D(10.,20.,30.); * @endcode * * @author * @ingroup geometry */ class Translate3D : public Transform3D { public: /** * Default constructor: sets the Identity transformation. */ Translate3D() : Transform3D() {} /** * Constructor from CLHEP::Hep3Vector. */ inline Translate3D(const CLHEP::Hep3Vector &v); /** * Constructor from three numbers. */ Translate3D(double x, double y, double z) : Transform3D(1,0,0,x, 0,1,0,y, 0,0,1,z) {} }; /** * Constructs a translation along x-axis. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = TranslateX3D(10.); * @endcode * * @author * @ingroup geometry */ class TranslateX3D : public Translate3D { public: /** * Default constructor: sets the Identity transformation. */ TranslateX3D() : Translate3D() {} /** * Constructor from a number. */ TranslateX3D(double x) : Translate3D(x, 0, 0) {} }; /** * Constructs a translation along y-axis. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = TranslateY3D(10.); * @endcode * * @author * @ingroup geometry */ class TranslateY3D : public Translate3D { public: /** * Default constructor: sets the Identity transformation. */ TranslateY3D() : Translate3D() {} /** * Constructor from a number. */ TranslateY3D(double y) : Translate3D(0, y, 0) {} }; /** * Constructs a translation along z-axis. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = TranslateZ3D(10.); * @endcode * * @author * @ingroup geometry */ class TranslateZ3D : public Translate3D { public: /** * Default constructor: sets the Identity transformation. */ TranslateZ3D() : Translate3D() {} /** * Constructor from a number. */ TranslateZ3D(double z) : Translate3D(0, 0, z) {} }; // R E F L E C T I O N S /** * Constructs a reflection transformation. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = Reflect3D(1.,1.,1.,0.); * @endcode * * @author * @ingroup geometry */ class Reflect3D : public Transform3D { protected: Reflect3D(double XX, double XY, double XZ, double DX, double YX, double YY, double YZ, double DY, double ZX, double ZY, double ZZ, double DZ) : Transform3D(XX,XY,XZ,DX, YX,YY,YZ,DY, ZX,ZY,ZZ,DZ) {} public: /** * Default constructor: sets the Identity transformation. */ Reflect3D() : Transform3D() {} /** * Constructor from four numbers. * Sets reflection in a plane a*x+b*y+c*z+d=0 */ Reflect3D(double a, double b, double c, double d); /** * Constructor from a plane given by its normal and origin. */ inline Reflect3D(const Normal3D & normal, const Point3D & point); }; /** * Constructs reflection in a plane x=const. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = ReflectX3D(1.); * @endcode * * @author * @ingroup geometry */ class ReflectX3D : public Reflect3D { public: /** * Constructor from a number. */ ReflectX3D(double x=0) : Reflect3D(-1,0,0,x+x, 0,1,0,0, 0,0,1,0) {} }; /** * Constructs reflection in a plane y=const. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = ReflectY3D(1.); * @endcode * * @author * @ingroup geometry */ class ReflectY3D : public Reflect3D { public: /** * Constructor from a number. */ ReflectY3D(double y=0) : Reflect3D(1,0,0,0, 0,-1,0,y+y, 0,0,1,0) {} }; /** * Constructs reflection in a plane z=const. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = ReflectZ3D(1.); * @endcode * * @author * @ingroup geometry */ class ReflectZ3D : public Reflect3D { public: /** * Constructor from a number. */ ReflectZ3D(double z=0) : Reflect3D(1,0,0,0, 0,1,0,0, 0,0,-1,z+z) {} }; // S C A L I N G S /** * Constructs a scaling transformation. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = Scale3D(2.); * @endcode * * @author * @ingroup geometry */ class Scale3D : public Transform3D { public: /** * Default constructor: sets the Identity transformation. */ Scale3D() : Transform3D() {} /** * Constructor from three numbers - scale factors in different directions. */ Scale3D(double x, double y, double z) : Transform3D(x,0,0,0, 0,y,0,0, 0,0,z,0) {} /** * Constructor from a number: sets uniform scaling in all directions. */ Scale3D(double s) : Transform3D(s,0,0,0, 0,s,0,0, 0,0,s,0) {} }; /** * Constructs a scaling transformation in x-direction. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = ScaleX3D(2.); * @endcode * * @author * @ingroup geometry */ class ScaleX3D : public Scale3D { public: /** * Default constructor: sets the Identity transformation. */ ScaleX3D() : Scale3D() {} /** * Constructor from a number (scale factor in x-direction). */ ScaleX3D(double x) : Scale3D(x, 1, 1) {} }; /** * Constructs a scaling transformation in y-direction. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = ScaleY3D(2.); * @endcode * * @author * @ingroup geometry */ class ScaleY3D : public Scale3D { public: /** * Default constructor: sets the Identity transformation. */ ScaleY3D() : Scale3D() {} /** * Constructor from a number (scale factor in y-direction). */ ScaleY3D(double y) : Scale3D(1, y, 1) {} }; /** * Constructs a scaling transformation in z-direction. * This class provides additional constructors for Transform3D * and should not be used as a separate class. * * Example of use: * @code * Transform3D m; * m = ScaleZ3D(2.); * @endcode * * @author * @ingroup geometry */ class ScaleZ3D : public Scale3D { public: /** * Default constructor: sets the Identity transformation. */ ScaleZ3D() : Scale3D() {} /** * Constructor from a number (scale factor in z-direction). */ ScaleZ3D(double z) : Scale3D(1, 1, z) {} }; } /* namespace HepGeom */ #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 typedef HepGeom::Transform3D HepTransform3D; typedef HepGeom::Rotate3D HepRotate3D; typedef HepGeom::RotateX3D HepRotateX3D; typedef HepGeom::RotateY3D HepRotateY3D; typedef HepGeom::RotateZ3D HepRotateZ3D; typedef HepGeom::Translate3D HepTranslate3D; typedef HepGeom::TranslateX3D HepTranslateX3D; typedef HepGeom::TranslateY3D HepTranslateY3D; typedef HepGeom::TranslateZ3D HepTranslateZ3D; typedef HepGeom::Reflect3D HepReflect3D; typedef HepGeom::ReflectX3D HepReflectX3D; typedef HepGeom::ReflectY3D HepReflectY3D; typedef HepGeom::ReflectZ3D HepReflectZ3D; typedef HepGeom::Scale3D HepScale3D; typedef HepGeom::ScaleX3D HepScaleX3D; typedef HepGeom::ScaleY3D HepScaleY3D; typedef HepGeom::ScaleZ3D HepScaleZ3D; #endif #include "CLHEP/Geometry/Transform3D.icc" #endif /* HEP_TRANSFROM3D_H */ clhep-2.1.4.1.orig/Geometry/Geometry/copy-header.pl.in0000755000175000017500000000164110043471537021136 0ustar olesoles#!/usr/bin/env perl # # copy a header into the temporary CLHEP header tree if # a) the header is not already there # b) the source is newer # if ($#ARGV != 1) { print "mungeit requires two arguments - exit\n"; exit; } else { $source_header=$ARGV[0]; $dest_header=$ARGV[1]; &check_header; } exit; sub check_header { # make sure source exists if ( ! -e $source_header ) { print "$source_header does not exist - exit\n"; exit; } # copy if not already there - otherwise, check the time stamp if ( ! -e $dest_header ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } else { $source_header_time = -M $source_header; $dest_header_time = -M $dest_header; # copy only if source is newer if( $source_header_time < $dest_header_time ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } } } clhep-2.1.4.1.orig/Geometry/Geometry/Makefile.am0000755000175000017500000000146410233731142020023 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@ COPY_P = @COPY_P@ pkginclude_HEADERS = \ BasicVector3D.h \ Normal3D.h \ Plane3D.h \ Point3D.h \ Transform3D.h \ Transform3D.icc \ Vector3D.h \ defs.h # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = defs.h # copy headers into $(tempincludedir) install-tmpHEADERS: @echo " install headers in $(tempincludedir) " @list='$(pkginclude_HEADERS)'; \ if test $(tempincludedir); then \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ ./copy-header.pl $$d$$p $(tempincludedir)/$$f; \ done; \ fi; test -z "$$fail" clhep-2.1.4.1.orig/Geometry/Geometry/Plane3D.h0000755000175000017500000001060011753240470017365 0ustar olesoles// -*- C++ -*- // $Id: Plane3D.h,v 1.5 2010/06/16 16:21:27 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // History: // 22.09.96 E.Chernyaev - initial version // 19.10.96 J.Allison - added == and <<. // 15.04.03 E.Chernyaev - CLHEP-1.9: template version #ifndef HEP_PLANE3D_H #define HEP_PLANE3D_H #include #include "CLHEP/Geometry/defs.h" #include "CLHEP/Geometry/Point3D.h" #include "CLHEP/Geometry/Normal3D.h" #include "CLHEP/Geometry/Transform3D.h" namespace HepGeom { /** * Template class for geometrical plane in 3D. * * @author Evgeni Chernyaev * @ingroup geometry */ template class Plane3D { protected: T a_, b_, c_, d_; public: /** * Default constructor - creates plane z=0. */ Plane3D() : a_(0.), b_(0.), c_(1.), d_(0.) {} /** * Constructor from four numbers - creates plane a*x+b*y+c*z+d=0. */ Plane3D(T a1, T b1, T c1, T d1) : a_(a1), b_(b1), c_(c1), d_(d1) {} /** * Constructor from normal and point. */ Plane3D(const Normal3D & n, const Point3D & p) : a_(n.x()), b_(n.y()), c_(n.z()), d_(-n*p) {} /** * Constructor from three points. */ Plane3D(const Point3D & p1, const Point3D & p2, const Point3D & p3) { Normal3D n = (p2-p1).cross(p3-p1); a_ = n.x(); b_ = n.y(); c_ = n.z(); d_ = -n*p1; } /** Copy constructor. * Plane3D has two constructors: * from Plane3D (provided by compiler) and * from Plane3D (defined in this file). * Plane3D has only the last one. */ Plane3D(const Plane3D & p) : a_(p.a_), b_(p.b_), c_(p.c_), d_(p.d_) {} /** * Destructor. */ ~Plane3D() {}; /** * Assignment. */ Plane3D & operator=(const Plane3D & p) { a_ = p.a_; b_ = p.b_; c_ = p.c_; d_ = p.d_; return *this; } /** * Returns the a-coefficient in the plane equation: a*x+b*y+c*z+d=0. */ T a() const { return a_; } /** * Returns the b-coefficient in the plane equation: a*x+b*y+c*z+d=0. */ T b() const { return b_; } /** * Returns the c-coefficient in the plane equation: a*x+b*y+c*z+d=0. */ T c() const { return c_; } /** * Returns the free member of the plane equation: a*x+b*y+c*z+d=0. */ T d() const { return d_; } /** * Returns normal. */ Normal3D normal() const { return Normal3D(a_,b_,c_); } /** * Normalization. */ Plane3D & normalize() { double ll = std::sqrt(a_*a_ + b_*b_ + c_*c_); if (ll > 0.) { a_ /= ll; b_ /= ll; c_ /= ll, d_ /= ll; } return *this; } /** * Returns distance to the point. */ T distance(const Point3D & p) const { return a()*p.x() + b()*p.y() + c()*p.z() + d(); } /** * Returns projection of the point to the plane. */ Point3D point(const Point3D & p) const { T k = distance(p)/(a()*a()+b()*b()+c()*c()); return Point3D(p.x()-a()*k, p.y()-b()*k, p.z()-c()*k); } /** * Returns projection of the origin to the plane. */ Point3D point() const { T k = -d()/(a()*a()+b()*b()+c()*c()); return Point3D(a()*k, b()*k, c()*k); } /** * Test for equality. */ bool operator == (const Plane3D & p) const { return a() == p.a() && b() == p.b() && c() == p.c() && d() == p.d(); } /** * Test for inequality. */ bool operator != (const Plane3D & p) const { return a() != p.a() || b() != p.b() || c() != p.c() || d() != p.d(); } /** * Transformation by Transform3D. */ Plane3D & transform(const Transform3D & m) { Normal3D n = normal(); n.transform(m); d_ = -n*point().transform(m); a_ = n.x(); b_ = n.y(); c_ = n.z(); return *this; } }; /** * Output to the stream. * @relates Plane3D */ std::ostream & operator<<(std::ostream & os, const Plane3D & p); /** * Output to the stream. * @relates Plane3D */ std::ostream & operator<<(std::ostream & os, const Plane3D & p); } /* namespace HepGeom */ #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 typedef HepGeom::Plane3D HepPlane3D; #endif #endif /* HEP_PLANE3D_H */ clhep-2.1.4.1.orig/Geometry/Geometry/.cvsignore0000755000175000017500000000002607705453233017774 0ustar olesolesMakefile.in defs.h.in clhep-2.1.4.1.orig/Geometry/Geometry/BasicVector3D.h0000755000175000017500000003714011753240470020542 0ustar olesoles// -*- C++ -*- // $Id: BasicVector3D.h,v 1.5 2010/06/16 16:21:27 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // History: // 12.06.01 E.Chernyaev - CLHEP-1.7: initial version // 14.03.03 E.Chernyaev - CLHEP-1.9: template version // #ifndef BASIC_VECTOR3D_H #define BASIC_VECTOR3D_H #include #include "CLHEP/Geometry/defs.h" #include "CLHEP/Vector/ThreeVector.h" namespace HepGeom { /** * Base class for Point3D, Vector3D and Normal3D. * It defines only common functionality for those classes and * should not be used as separate class. * * @author Evgeni Chernyaev * @ingroup geometry */ template class BasicVector3D { protected: T v_[3]; /** * Default constructor. * It is protected - this class should not be instantiated directly. */ BasicVector3D() { v_[0] = 0; v_[1] = 0; v_[2] = 0; } public: /** * Safe indexing of the coordinates when using with matrices, arrays, etc. */ enum { X = 0, /**< index for x-component */ Y = 1, /**< index for y-component */ Z = 2, /**< index for z-component */ NUM_COORDINATES = 3, /**< number of components */ SIZE = NUM_COORDINATES /**< number of components */ }; /** * Constructor from three numbers. */ BasicVector3D(T x1, T y1, T z1) { v_[0] = x1; v_[1] = y1; v_[2] = z1; } /** * Copy constructor. * Note: BasicVector3D has constructors * from BasicVector3D (provided by compiler) and * from BasicVector3D (defined in this file); * BasicVector3D has only the last one. */ BasicVector3D(const BasicVector3D & v) { v_[0] = v.x(); v_[1] = v.y(); v_[2] = v.z(); } /** * Destructor. */ virtual ~BasicVector3D() {} // ------------------------- // Interface to "good old C" // ------------------------- /** * Conversion (cast) to ordinary array. */ operator T * () { return v_; } /** * Conversion (cast) to ordinary const array. */ operator const T * () const { return v_; } /** * Conversion (cast) to CLHEP::Hep3Vector. * This operator is needed only for backward compatibility and * in principle should not exit. */ operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); } // ----------------------------- // General arithmetic operations // ----------------------------- /** * Assignment. */ BasicVector3D & operator= (const BasicVector3D & v) { v_[0] = v.v_[0]; v_[1] = v.v_[1]; v_[2] = v.v_[2]; return *this; } /** * Addition. */ BasicVector3D & operator+=(const BasicVector3D & v) { v_[0] += v.v_[0]; v_[1] += v.v_[1]; v_[2] += v.v_[2]; return *this; } /** * Subtraction. */ BasicVector3D & operator-=(const BasicVector3D & v) { v_[0] -= v.v_[0]; v_[1] -= v.v_[1]; v_[2] -= v.v_[2]; return *this; } /** * Multiplication by scalar. */ BasicVector3D & operator*=(double a) { v_[0] *= a; v_[1] *= a; v_[2] *= a; return *this; } /** * Division by scalar. */ BasicVector3D & operator/=(double a) { v_[0] /= a; v_[1] /= a; v_[2] /= a; return *this; } // ------------ // Subscripting // ------------ /** * Gets components by index. */ T operator()(int i) const { return v_[i]; } /** * Gets components by index. */ T operator[](int i) const { return v_[i]; } /** * Sets components by index. */ T & operator()(int i) { return v_[i]; } /** * Sets components by index. */ T & operator[](int i) { return v_[i]; } // ------------------------------------ // Cartesian coordinate system: x, y, z // ------------------------------------ /** * Gets x-component in cartesian coordinate system. */ T x() const { return v_[0]; } /** * Gets y-component in cartesian coordinate system. */ T y() const { return v_[1]; } /** * Gets z-component in cartesian coordinate system. */ T z() const { return v_[2]; } /** * Sets x-component in cartesian coordinate system. */ void setX(T a) { v_[0] = a; } /** * Sets y-component in cartesian coordinate system. */ void setY(T a) { v_[1] = a; } /** * Sets z-component in cartesian coordinate system. */ void setZ(T a) { v_[2] = a; } /** * Sets components in cartesian coordinate system. */ void set(T x1, T y1, T z1) { v_[0] = x1; v_[1] = y1; v_[2] = z1; } // ------------------------------------------ // Cylindrical coordinate system: rho, phi, z // ------------------------------------------ /** * Gets transverse component squared. */ T perp2() const { return x()*x()+y()*y(); } /** * Gets transverse component. */ T perp() const { return std::sqrt(perp2()); } /** * Gets rho-component in cylindrical coordinate system */ T rho() const { return perp(); } /** * Sets transverse component keeping phi and z constant. */ void setPerp(T rh) { T factor = perp(); if (factor > 0) { factor = rh/factor; v_[0] *= factor; v_[1] *= factor; } } // ------------------------------------------ // Spherical coordinate system: r, phi, theta // ------------------------------------------ /** * Gets magnitude squared of the vector. */ T mag2() const { return x()*x()+y()*y()+z()*z(); } /** * Gets magnitude of the vector. */ T mag() const { return std::sqrt(mag2()); } /** * Gets r-component in spherical coordinate system */ T r() const { return mag(); } /** * Gets azimuth angle. */ T phi() const { return x() == 0 && y() == 0 ? 0 : std::atan2(y(),x()); } /** * Gets polar angle. */ T theta() const { return x() == 0 && y() == 0 && z() == 0 ? 0 : std::atan2(perp(),z()); } /** * Gets cosine of polar angle. */ T cosTheta() const { T ma = mag(); return ma == 0 ? 1 : z()/ma; } /** * Gets r-component in spherical coordinate system */ T getR() const { return r(); } /** * Gets phi-component in spherical coordinate system */ T getPhi() const { return phi(); } /** * Gets theta-component in spherical coordinate system */ T getTheta() const { return theta(); } /** * Sets magnitude. */ void setMag(T ma) { T factor = mag(); if (factor > 0) { factor = ma/factor; v_[0] *= factor; v_[1] *= factor; v_[2] *= factor; } } /** * Sets r-component in spherical coordinate system. */ void setR(T ma) { setMag(ma); } /** * Sets phi-component in spherical coordinate system. */ void setPhi(T ph) { T xy = perp(); setX(xy*std::cos(ph)); setY(xy*std::sin(ph)); } /** * Sets theta-component in spherical coordinate system. */ void setTheta(T th) { T ma = mag(); T ph = phi(); set(ma*std::sin(th)*std::cos(ph), ma*std::sin(th)*std::sin(ph), ma*std::cos(th)); } // --------------- // Pseudo rapidity // --------------- /** * Gets pseudo-rapidity: -ln(std::tan(theta/2)) */ T pseudoRapidity() const; /** * Gets pseudo-rapidity. */ T eta() const { return pseudoRapidity(); } /** * Gets pseudo-rapidity. */ T getEta() const { return pseudoRapidity(); } /** * Sets pseudo-rapidity, keeping magnitude and phi fixed. */ void setEta(T a); // ------------------- // Combine two vectors // ------------------- /** * Scalar product. */ T dot(const BasicVector3D & v) const { return x()*v.x()+y()*v.y()+z()*v.z(); } /** * Vector product. */ BasicVector3D cross(const BasicVector3D & v) const { return BasicVector3D(y()*v.z()-v.y()*z(), z()*v.x()-v.z()*x(), x()*v.y()-v.x()*y()); } /** * Returns transverse component w.r.t. given axis squared. */ T perp2(const BasicVector3D & v) const { T tot = v.mag2(), s = dot(v); return tot > 0 ? mag2()-s*s/tot : mag2(); } /** * Returns transverse component w.r.t. given axis. */ T perp(const BasicVector3D & v) const { return std::sqrt(perp2(v)); } /** * Returns angle w.r.t. another vector. */ T angle(const BasicVector3D & v) const; // --------------- // Related vectors // --------------- /** * Returns unit vector parallel to this. */ BasicVector3D unit() const { T len = mag(); return (len > 0) ? BasicVector3D(x()/len, y()/len, z()/len) : BasicVector3D(); } /** * Returns orthogonal vector. */ BasicVector3D orthogonal() const { T dx = x() < 0 ? -x() : x(); T dy = y() < 0 ? -y() : y(); T dz = z() < 0 ? -z() : z(); if (dx < dy) { return dx < dz ? BasicVector3D(0,z(),-y()) : BasicVector3D(y(),-x(),0); }else{ return dy < dz ? BasicVector3D(-z(),0,x()) : BasicVector3D(y(),-x(),0); } } // --------- // Rotations // --------- /** * Rotates around x-axis. */ BasicVector3D & rotateX(T a); /** * Rotates around y-axis. */ BasicVector3D & rotateY(T a); /** * Rotates around z-axis. */ BasicVector3D & rotateZ(T a); /** * Rotates around the axis specified by another vector. */ BasicVector3D & rotate(T a, const BasicVector3D & v); }; /************************************************************************* * * * Non-member functions for BasicVector3D * * * *************************************************************************/ /** * Output to stream. * @relates BasicVector3D */ std::ostream & operator<<(std::ostream &, const BasicVector3D &); /** * Input from stream. * @relates BasicVector3D */ std::istream & operator>>(std::istream &, BasicVector3D &); /** * Unary plus. * @relates BasicVector3D */ inline BasicVector3D operator+(const BasicVector3D & v) { return v; } /** * Addition of two vectors. * @relates BasicVector3D */ inline BasicVector3D operator+(const BasicVector3D & a, const BasicVector3D & b) { return BasicVector3D(a.x()+b.x(), a.y()+b.y(), a.z()+b.z()); } /** * Unary minus. * @relates BasicVector3D */ inline BasicVector3D operator-(const BasicVector3D & v) { return BasicVector3D(-v.x(), -v.y(), -v.z()); } /** * Subtraction of two vectors. * @relates BasicVector3D */ inline BasicVector3D operator-(const BasicVector3D & a, const BasicVector3D & b) { return BasicVector3D(a.x()-b.x(), a.y()-b.y(), a.z()-b.z()); } /** * Multiplication vector by scalar. * @relates BasicVector3D */ inline BasicVector3D operator*(const BasicVector3D & v, double a) { return BasicVector3D(v.x()*static_cast(a), v.y()*static_cast(a), v.z()*static_cast(a)); } /** * Scalar product of two vectors. * @relates BasicVector3D */ inline float operator*(const BasicVector3D & a, const BasicVector3D & b) { return a.dot(b); } /** * Multiplication scalar by vector. * @relates BasicVector3D */ inline BasicVector3D operator*(double a, const BasicVector3D & v) { return BasicVector3D(static_cast(a)*v.x(), static_cast(a)*v.y(), static_cast(a)*v.z()); } /** * Division vector by scalar. * @relates BasicVector3D */ inline BasicVector3D operator/(const BasicVector3D & v, double a) { return BasicVector3D(v.x()/static_cast(a), v.y()/static_cast(a), v.z()/static_cast(a)); } /** * Comparison of two vectors for equality. * @relates BasicVector3D */ inline bool operator==(const BasicVector3D & a, const BasicVector3D & b) { return (a.x()==b.x() && a.y()==b.y() && a.z()==b.z()); } /** * Comparison of two vectors for inequality. * @relates BasicVector3D */ inline bool operator!=(const BasicVector3D & a, const BasicVector3D & b) { return (a.x()!=b.x() || a.y()!=b.y() || a.z()!=b.z()); } /************************************************************************* * * * Non-member functions for BasicVector3D * * * *************************************************************************/ /** * Output to stream. * @relates BasicVector3D */ std::ostream & operator<<(std::ostream &, const BasicVector3D &); /** * Input from stream. * @relates BasicVector3D */ std::istream & operator>>(std::istream &, BasicVector3D &); /** * Unary plus. * @relates BasicVector3D */ inline BasicVector3D operator+(const BasicVector3D & v) { return v; } /** * Addition of two vectors. * @relates BasicVector3D */ inline BasicVector3D operator+(const BasicVector3D & a,const BasicVector3D & b) { return BasicVector3D(a.x()+b.x(), a.y()+b.y(), a.z()+b.z()); } /** * Unary minus. * @relates BasicVector3D */ inline BasicVector3D operator-(const BasicVector3D & v) { return BasicVector3D(-v.x(), -v.y(), -v.z()); } /** * Subtraction of two vectors. * @relates BasicVector3D */ inline BasicVector3D operator-(const BasicVector3D & a,const BasicVector3D & b) { return BasicVector3D(a.x()-b.x(), a.y()-b.y(), a.z()-b.z()); } /** * Multiplication vector by scalar. * @relates BasicVector3D */ inline BasicVector3D operator*(const BasicVector3D & v, double a) { return BasicVector3D(v.x()*a, v.y()*a, v.z()*a); } /** * Scalar product of two vectors. * @relates BasicVector3D */ inline double operator*(const BasicVector3D & a,const BasicVector3D & b) { return a.dot(b); } /** * Multiplication scalar by vector. * @relates BasicVector3D */ inline BasicVector3D operator*(double a, const BasicVector3D & v) { return BasicVector3D(a*v.x(), a*v.y(), a*v.z()); } /** * Division vector by scalar. * @relates BasicVector3D */ inline BasicVector3D operator/(const BasicVector3D & v, double a) { return BasicVector3D(v.x()/a, v.y()/a, v.z()/a); } /** * Comparison of two vectors for equality. * @relates BasicVector3D */ inline bool operator==(const BasicVector3D & a, const BasicVector3D & b) { return (a.x()==b.x() && a.y()==b.y() && a.z()==b.z()); } /** * Comparison of two vectors for inequality. * @relates BasicVector3D */ inline bool operator!=(const BasicVector3D & a, const BasicVector3D & b) { return (a.x()!=b.x() || a.y()!=b.y() || a.z()!=b.z()); } } /* namespace HepGeom */ #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace HepGeom; #endif #endif /* BASIC_VECTOR3D_H */ clhep-2.1.4.1.orig/Geometry/Geometry/Normal3D.h0000755000175000017500000001200511712344401017551 0ustar olesoles// -*- C++ -*- // $Id: Normal3D.h,v 1.3 2003/10/23 21:29:50 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // History: // 09.09.96 E.Chernyaev - initial version // 12.06.01 E.Chernyaev - CLHEP-1.7: introduction of BasicVector3D to decouple // the functionality from CLHEP::Hep3Vector // 01.04.03 E.Chernyaev - CLHEP-1.9: template version // #ifndef HEP_NORMAL3D_H #define HEP_NORMAL3D_H #include #include "CLHEP/Geometry/defs.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Geometry/BasicVector3D.h" namespace HepGeom { class Transform3D; /** * Geometrical 3D Normal. * This is just a declaration of the class needed to define * specializations Normal3D and Normal3D. * * @ingroup geometry * @author Evgeni Chernyaev */ template class Normal3D : public BasicVector3D {}; /** * Geometrical 3D Normal with components of float type. * * @author Evgeni Chernyaev * @ingroup geometry */ template<> class Normal3D : public BasicVector3D { public: /** * Default constructor. */ Normal3D() {} /** * Constructor from three numbers. */ Normal3D(float x1, float y1, float z1) : BasicVector3D(x1,y1,z1) {} /** * Constructor from array of floats. */ explicit Normal3D(const float * a) : BasicVector3D(a[0],a[1],a[2]) {} /** * Copy constructor. */ Normal3D(const Normal3D & v) : BasicVector3D(v) {} /** * Constructor from BasicVector3D. */ Normal3D(const BasicVector3D & v) : BasicVector3D(v) {} /** * Destructor. */ ~Normal3D() {} /** * Assignment. */ Normal3D & operator=(const Normal3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Assignment from BasicVector3D. */ Normal3D & operator=(const BasicVector3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Transformation by Transform3D. */ Normal3D & transform(const Transform3D & m); }; /** * Transformation of Normal by Transform3D. * @relates Normal3D */ Normal3D operator*(const Transform3D & m, const Normal3D & n); /** * Geometrical 3D Normal with components of double type. * * @author Evgeni Chernyaev * @ingroup geometry */ template<> class Normal3D : public BasicVector3D { public: /** * Default constructor. */ Normal3D() {} /** * Constructor from three numbers. */ Normal3D(double x1, double y1, double z1) : BasicVector3D(x1,y1,z1) {} /** * Constructor from array of floats. */ explicit Normal3D(const float * a) : BasicVector3D(a[0],a[1],a[2]) {} /** * Constructor from array of doubles. */ explicit Normal3D(const double * a) : BasicVector3D(a[0],a[1],a[2]) {} /** * Copy constructor. */ Normal3D(const Normal3D & v) : BasicVector3D(v) {} /** * Constructor from BasicVector3D. */ Normal3D(const BasicVector3D & v) : BasicVector3D(v) {} /** * Constructor from BasicVector3D. */ Normal3D(const BasicVector3D & v) : BasicVector3D(v) {} /** * Destructor. */ ~Normal3D() {} /** * Constructor from CLHEP::Hep3Vector. * This constructor is needed only for backward compatibility and * in principle should be absent. */ Normal3D(const CLHEP::Hep3Vector & v) : BasicVector3D(v.x(),v.y(),v.z()) {} /** * Conversion (cast) to CLHEP::Hep3Vector. * This operator is needed only for backward compatibility and * in principle should not exit. */ operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); } /** * Assignment. */ Normal3D & operator=(const Normal3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Assignment from BasicVector3D. */ Normal3D & operator=(const BasicVector3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Assignment from BasicVector3D. */ Normal3D & operator=(const BasicVector3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Transformation by Transform3D. */ Normal3D & transform(const Transform3D & m); }; /** * Transformation of Normal by Transform3D. * @relates Normal3D */ Normal3D operator*(const Transform3D & m, const Normal3D & n); } /* namespace HepGeom */ #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 typedef HepGeom::Normal3D HepNormal3D; #endif #endif /* HEP_NORMAL3D_H */ clhep-2.1.4.1.orig/Geometry/Geometry/CMakeLists.txt0000644000175000017500000000050511606714767020542 0ustar olesoles set( pkginclude_HEADERS BasicVector3D.h Normal3D.h Plane3D.h Point3D.h Transform3D.h Transform3D.icc Vector3D.h ) # notice that defs.h is not referenced here INSTALL (FILES ${pkginclude_HEADERS} DESTINATION include/CLHEP/Geometry ) clhep-2.1.4.1.orig/Geometry/Geometry/Transform3D.icc0000755000175000017500000000451507705463330020624 0ustar olesoles// -*- C++ -*- // $Id: Transform3D.icc,v 1.1 2003/07/17 09:05:28 garren Exp $ // --------------------------------------------------------------------------- #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Geometry/Point3D.h" #include "CLHEP/Geometry/Vector3D.h" #include "CLHEP/Geometry/Normal3D.h" namespace HepGeom { // I N L I N E S F O R T R A N S F O R M A T I O N inline Transform3D::Transform3D_row::Transform3D_row (const Transform3D & r, int i) : rr(r), ii(i) {} inline double Transform3D::Transform3D_row::operator[](int jj) const { return rr(ii,jj); } inline const Transform3D::Transform3D_row Transform3D::operator[](int i) const { return Transform3D_row(*this, i); } inline Transform3D::Transform3D(const CLHEP::HepRotation & m, const CLHEP::Hep3Vector & v) { xx_= m.xx(); xy_= m.xy(); xz_= m.xz(); yx_= m.yx(); yy_= m.yy(); yz_= m.yz(); zx_= m.zx(); zy_= m.zy(); zz_= m.zz(); dx_= v.x(); dy_= v.y(); dz_= v.z(); } inline CLHEP::HepRotation Transform3D::getRotation() const { CLHEP::HepRotation m; return m.rotateAxes(CLHEP::Hep3Vector(xx_,yx_,zx_), CLHEP::Hep3Vector(xy_,yy_,zy_), CLHEP::Hep3Vector(xz_,yz_,zz_)); } inline CLHEP::Hep3Vector Transform3D::getTranslation() const { return CLHEP::Hep3Vector(dx_,dy_,dz_); } // I N L I N E S F O R R O T A T I O N inline Rotate3D::Rotate3D(const CLHEP::HepRotation & m) { xx_= m.xx(); xy_= m.xy(); xz_= m.xz(); yx_= m.yx(); yy_= m.yy(); yz_= m.yz(); zx_= m.zx(); zy_= m.zy(); zz_= m.zz(); dx_= 0; dy_= 0; dz_= 0; } inline Rotate3D::Rotate3D(double a, const Vector3D & v) { *this = Rotate3D(a, Point3D(0,0,0), Point3D(v.x(),v.y(),v.z())); } inline Rotate3D::Rotate3D(const Point3D & fr1, const Point3D & fr2, const Point3D & to1, const Point3D & to2) : Transform3D(Point3D(0,0,0),fr1,fr2, Point3D(0,0,0),to1,to2) {} // I N L I N E S F O R T R A N S L A T I O N inline Translate3D::Translate3D(const CLHEP::Hep3Vector & v) : Transform3D(1,0,0,v.x(), 0,1,0,v.y(), 0,0,1,v.z()) {} // I N L I N E S F O R R E F L E C T I O N inline Reflect3D::Reflect3D(const Normal3D & n, const Point3D & p) { *this = Reflect3D(n.x(), n.y(), n.z(), -n*p); } } /* namespace HepGeom */ clhep-2.1.4.1.orig/Geometry/Geometry/Point3D.h0000755000175000017500000001432611753240470017430 0ustar olesoles// -*- C++ -*- // $Id: Point3D.h,v 1.5 2010/06/16 16:21:27 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // History: // 09.09.96 E.Chernyaev - initial version // 12.06.01 E.Chernyaev - CLHEP-1.7: introduction of BasicVector3D to decouple // the functionality from CLHEP::Hep3Vector // 01.04.03 E.Chernyaev - CLHEP-1.9: template version // #ifndef HEP_POINT3D_H #define HEP_POINT3D_H #include #include "CLHEP/Geometry/defs.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Geometry/BasicVector3D.h" namespace HepGeom { class Transform3D; /** * Geometrical 3D Point. * This is just a declaration of the class needed to define * specializations Point3D and Point3D. * * @ingroup geometry * @author Evgeni Chernyaev */ template class Point3D : public BasicVector3D {}; /** * Geometrical 3D Point with components of float type. * * @author Evgeni Chernyaev * @ingroup geometry */ template<> class Point3D : public BasicVector3D { public: /** * Default constructor. */ Point3D() {} /** * Constructor from three numbers. */ Point3D(float x1, float y1, float z1) : BasicVector3D(x1,y1,z1) {} /** * Constructor from array of floats. */ explicit Point3D(const float * a) : BasicVector3D(a[0],a[1],a[2]) {} /** * Copy constructor. */ Point3D(const Point3D & v) : BasicVector3D(v) {} /** * Constructor from BasicVector3D. */ Point3D(const BasicVector3D & v) : BasicVector3D(v) {} /** * Destructor. */ ~Point3D() {} /** * Assignment. */ Point3D & operator=(const Point3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Assignment from BasicVector3D. */ Point3D & operator=(const BasicVector3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Returns distance to the origin squared. */ float distance2() const { return mag2(); } /** * Returns distance to the point squared. */ float distance2(const Point3D & p) const { float dx = p.x()-x(), dy = p.y()-y(), dz = p.z()-z(); return dx*dx + dy*dy + dz*dz; } /** * Returns distance to the origin. */ float distance() const { return std::sqrt(distance2()); } /** * Returns distance to the point. */ float distance(const Point3D & p) const { return std::sqrt(distance2(p)); } /** * Transformation by Transform3D. */ Point3D & transform(const Transform3D & m); }; /** * Transformation of Point3D by Transform3D. * @relates Point3D */ Point3D operator*(const Transform3D & m, const Point3D & p); /** * Geometrical 3D Point with components of double type. * * @author Evgeni Chernyaev * @ingroup geometry */ template<> class Point3D : public BasicVector3D { public: /** * Default constructor. */ Point3D() {} /** * Constructor from three numbers. */ Point3D(double x1, double y1, double z1) : BasicVector3D(x1,y1,z1) {} /** * Constructor from array of floats. */ explicit Point3D(const float * a) : BasicVector3D(a[0],a[1],a[2]) {} /** * Constructor from array of doubles. */ explicit Point3D(const double * a) : BasicVector3D(a[0],a[1],a[2]) {} /** * Copy constructor. */ Point3D(const Point3D & v) : BasicVector3D(v) {} /** * Constructor from BasicVector3D. */ Point3D(const BasicVector3D & v) : BasicVector3D(v) {} /** * Constructor from BasicVector3D. */ Point3D(const BasicVector3D & v) : BasicVector3D(v) {} /** * Destructor. */ ~Point3D() {} /** * Constructor from CLHEP::Hep3Vector. * This constructor is needed only for backward compatibility and * in principle should be absent. */ Point3D(const CLHEP::Hep3Vector & v) : BasicVector3D(v.x(),v.y(),v.z()) {} /** * Conversion (cast) to CLHEP::Hep3Vector. * This operator is needed only for backward compatibility and * in principle should not exit. */ operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); } /** * Assignment. */ Point3D & operator=(const Point3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Assignment from BasicVector3D. */ Point3D & operator=(const BasicVector3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Assignment from BasicVector3D. */ Point3D & operator=(const BasicVector3D & v) { set(v.x(),v.y(),v.z()); return *this; } /** * Returns distance to the origin squared. */ double distance2() const { return mag2(); } /** * Returns distance to the point squared. */ double distance2(const Point3D & p) const { double dx = p.x()-x(), dy = p.y()-y(), dz = p.z()-z(); return dx*dx + dy*dy + dz*dz; } /** * Returns distance to the origin. */ double distance() const { return std::sqrt(distance2()); } /** * Returns distance to the point. */ double distance(const Point3D & p) const { return std::sqrt(distance2(p)); } /** * Transformation by Transform3D. */ Point3D & transform(const Transform3D & m); }; /** * Transformation of Point3D by Transform3D. * @relates Point3D */ Point3D operator*(const Transform3D & m, const Point3D & p); } /* namespace HepGeom */ #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 #include "CLHEP/config/CLHEP.h" #include "CLHEP/Geometry/Normal3D.h" #include "CLHEP/Geometry/Transform3D.h" typedef HepGeom::Point3D HepPoint3D; #endif #endif /* HEP_POINT3D_H */ clhep-2.1.4.1.orig/Geometry/.cvsignore0000755000175000017500000000007407746044120016200 0ustar olesolesMakefile.in configure aclocal.m4 autom4te.cache config.h.in clhep-2.1.4.1.orig/Geometry/COPYING0000644000175000017500000010451311406175007015230 0ustar olesoles GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/Geometry/test/0000755000175000017500000000000012242515151015145 5ustar olesolesclhep-2.1.4.1.orig/Geometry/test/testBasicVector3D.output0000755000175000017500000000006007705463330021732 0ustar olesoles(1,2,3) (1,2,3) (1,2,3) (1,2,3) (1,2,3) (1,2,3) clhep-2.1.4.1.orig/Geometry/test/testBasicVector3D.input0000755000175000017500000000014707705463330021537 0ustar olesoles(1,2,3) (1.,2.,3.) (1.0,2.0,3.0) (1e+00,2e+00,3e+00) (1.e+00,2.e+00,3.e+00) (1.0e+00,2.0e+00,3.0e+00) clhep-2.1.4.1.orig/Geometry/test/Makefile.am0000755000175000017500000000437111712344306017214 0ustar olesoles# Applicable to each test program: if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir)/ # libraries to link, and whence if BUILD_STATIC LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.a \ ${top_builddir}/../Vector/src/libCLHEP-Vector-@VERSION@.a OUTFLAG = -o $@ else if BUILD_VISUAL LDADD = $(top_builddir)/src/CLHEP-@PACKAGE@-@VERSION@.$(SHEXT) \ ${top_builddir}/../Vector/src/CLHEP-Vector-@VERSION@.$(SHEXT) OUTFLAG = /Fo$@ else LIBS += $(MY_LD)$(top_builddir)/src \ $(MY_LD)${top_builddir}/../Vector/src LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.$(SHEXT) \ ${top_builddir}/../Vector/src/libCLHEP-Vector-@VERSION@.$(SHEXT) OUTFLAG = -o $@ endif endif # normally, CXXLINK is supplied by automake, but we need to use /Fo instead # of -o when compiling with Visual C++ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ $(OUTFLAG) # Identify executables needed during testing: check_PROGRAMS = \ testBasicVector3D \ testBug6740 check_SCRIPTS = \ testBasicVector3D.sh # Identify test(s) to run when 'make check' is requested: TESTS = \ testBasicVector3D.sh \ testBug6740 # Identify the test(s) for which failure is the intended outcome: XFAIL_TESTS = # Identify the dependencies on a per-test basis: testBasicVector3D_SOURCES = testBasicVector3D.cc testBug6740_SOURCES = testBug6740.cc # Identify input data file(s) and prototype output file(s): EXTRA_DIST = \ testBasicVector3D.input testBasicVector3D.output # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = \ testBasicVector3D.sh # supply our own suffix rule .cc.obj: if BUILD_VISUAL # $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c $(OUTFLAG) `$(CYGPATH_W) '$<'` # mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po source='$<' object='$@' libtool=no \ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ $(CXXCOMPILE) -c $(OUTFLAG) `$(CYGPATH_W) '$<'` else if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c $(OUTFLAG) `$(CYGPATH_W) '$<'`; \ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi # source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ # $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` endif clhep-2.1.4.1.orig/Geometry/test/testTransform3D.cc0000755000175000017500000001000111753240470020516 0ustar olesoles// -*- C++ -*- // $Id: testTransform3D.cc,v 1.3 2003/10/24 21:39:45 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is a test for the HepGeom::Transform3D class. // #include #include "CLHEP/Geometry/Transform3D.h" #include "CLHEP/Vector/Rotation.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Units/PhysicalConstants.h" typedef HepGeom::Scale3D Scale; typedef HepGeom::Rotate3D Rotation; typedef HepGeom::Translate3D Translation; typedef HepGeom::Transform3D Transformation; typedef HepGeom::Point3D Point; typedef HepGeom::Vector3D Vector; typedef HepGeom::Normal3D Normal; #define DEL 10.e-16 int main() { int i,k; double E[4][4] = { { 1, 0, 0, 0}, { 0, 1, 0, 0}, { 0, 0, 1, 0}, { 0, 0, 0, 1} }; // Default constructor Transformation M; for (i=0; i<4; i++) { for (k=0; k<4; k++) { assert ( M[i][k] == E[i][k] ); } } assert ( M == Transformation::Identity ); // Rotation + Translation HepRotation R; double angA=CLHEP::pi/3, angB=CLHEP::pi/4, angC=CLHEP::pi/6; R.rotateX(angA); R.rotateY(angB); R.rotateZ(angC); const Hep3Vector D(1, 2, 3); M = Transformation(R,D); for (i=0; i<3; i++) { for (k=0; k<3; k++) { assert ( M[i][k] == R[i][k] ); } } assert ( M(0,3) == D.x() ); assert ( M(1,3) == D.y() ); assert ( M(2,3) == D.z() ); // Transformation of point, vector, normal const Point p0(1,1,1); const Vector v0(1,1,1); const Normal n0(1,1,1); Point p1 = M * p0; Point p2 = R*Hep3Vector(1,1,1) + D; assert( std::abs(p1.x()-p2.x()) < DEL ); assert( std::abs(p1.y()-p2.y()) < DEL ); assert( std::abs(p1.z()-p2.z()) < DEL ); Vector v1 = M * v0; Normal n1 = M * n0; assert( std::abs(v1.x()-n1.x()) < DEL ); assert( std::abs(v1.y()-n1.y()) < DEL ); assert( std::abs(v1.z()-n1.z()) < DEL ); // Transformation of basis p1 = Point(M[0][0]+D.x(), M[1][0]+D.y(), M[2][0]+D.z()); p2 = Point(M[0][1]+D.x(), M[1][1]+D.y(), M[2][1]+D.z()); Transformation T(Point(0,0,0), Point(1,0,0), Point(0,1,0), D, p1, p2); for (i=0; i<4; i++) { for (k=0; k<4; k++) { assert ( std::abs(M[i][k] - T[i][k]) < DEL ); } } // Set Identity T.setIdentity(); for (i=0; i<4; i++) { for (k=0; k<4; k++) { assert ( T[i][k] == E[i][k] ); } } // Assignment, fortran-style subscripting T = M; assert (T == M); for (i=0; i<4; i++) { for (k=0; k<4; k++) { assert ( T(i,k) == M[i][k] ); } } // Inversion T = M.inverse(); assert (T != M); T = M * T; for (i=0; i<4; i++) { for (k=0; k<4; k++) { assert ( std::abs(T[i][k] - E[i][k]) < DEL ); } } T = M.inverse(); T = T * M; for (i=0; i<4; i++) { for (k=0; k<4; k++) { assert ( std::abs(T[i][k] - E[i][k]) < DEL ); } } // Get Rotation HepRotation Q; Q = M.getRotation(); for (i=0; i<3; i++) { for (k=0; k<3; k++) { assert ( R[i][k] == Q[i][k] ); } } // Get Translation Hep3Vector C; C = M.getTranslation(); assert ( C.x() == D.x() ); assert ( C.y() == D.y() ); assert ( C.z() == D.z() ); // Compound transformation // Get Decomposition Scale S(-2,3,4); M = Transformation(R,D)*S; Scale SS; Rotation RR; Translation TT; M.getDecomposition(SS,RR,TT); S = HepGeom::Scale3D(2,3,-4); T = TT*RR*SS; for (i=0; i<4; i++) { for (k=0; k<4; k++) { assert ( std::abs(S[i][k] - SS[i][k]) < DEL ); assert ( std::abs(M[i][k] - T[i][k]) < DEL ); } } // test for isNear() assert ( T.isNear(M, DEL) ); S = HepGeom::Scale3D(2.01,3,-4); T = TT*RR*S; assert ( !T.isNear(M) ); // Different conversions Hep3Vector www(1,2,3); Vector vvv; Point ppp(3,2,1); Normal nnn; vvv = www; www = vvv; nnn = ppp; assert (vvv.x() == nnn.z()); assert (vvv.y() == nnn.y()); assert (vvv.z() == nnn.x()); nnn = Normal(ppp); www = Hep3Vector(vvv); return 0; } clhep-2.1.4.1.orig/Geometry/test/testBug6740.sh.in0000755000175000017500000000016211776622027020062 0ustar olesoles#! /bin/sh # @configure_input@ ./testBug6740@EXEEXT@ \ | @DIFF_Q@ - "@srcdir@/testBug6740.output" > /dev/null clhep-2.1.4.1.orig/Geometry/test/.cvsignore0000755000175000017500000000001407705463330017154 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Geometry/test/testBug6740.cc0000644000175000017500000000130311753240470017414 0ustar olesoles #include #include #include #include "CLHEP/Geometry/Point3D.h" #include "CLHEP/Vector/ThreeVector.h" typedef HepGeom::Point3D HepPoint3D; int main(int, char **) { CLHEP::Hep3Vector d(10,0,0); HepPoint3D a(0,0,0); HepPoint3D pv(1,1,1); float expected = 1.41421; int numbad = 0; CLHEP::Hep3Vector dist = a-pv; // this does not compile anymore CLHEP::Hep3Vector Cross = dist.cross(d.unit()); std::cout << Cross.mag() << std::endl; float result = Cross.mag(); float eps = 1.0e-5; if( std::fabs(result - expected) > eps ) { ++numbad; std::cout << "Expected " << expected << " got " << result << std::endl; } return numbad; } clhep-2.1.4.1.orig/Geometry/test/testBug6740.output0000644000175000017500000000001010233731142020352 0ustar olesoles1.41421 clhep-2.1.4.1.orig/Geometry/test/testBasicVector3D.cc0000755000175000017500000003515011753240470020763 0ustar olesoles// -*- C++ -*- // $Id: testBasicVector3D.cc,v 1.5 2010/06/16 16:21:27 garren Exp $ // --------------------------------------------------------------------------- #include #include #include "CLHEP/Geometry/Point3D.h" #include "CLHEP/Geometry/Vector3D.h" #include "CLHEP/Geometry/Normal3D.h" #include "CLHEP/Geometry/Transform3D.h" #include "CLHEP/Units/PhysicalConstants.h" bool EQUAL(double a, double b) { double del = a - b; if (del < 0) del = -del; return del < 0.000001; } using namespace HepGeom; #define CHECK(point,type) \ /* Check default constructor */ \ point p00; \ assert(p00.x() == 0 && p00.y() == 0 && p00.z() == 0); \ \ /* Check constructor from three numbers */ \ point p01(1,2,3); \ point p02(4.,5.,6.); \ assert(p01.x() == 1 && p01.y() == 2 && p01.z() == 3); \ assert(p02.x() == 4 && p02.y() == 5 && p02.z() == 6); \ \ /* Check constructor from array */ \ float farray[] = {1,2,3}; \ type darray[] = {4,5,6}; \ point p03(farray); assert(p03 == point(1,2,3)); \ point p04(darray); assert(p04 == point(4,5,6)); \ \ /* Check conversion to array */ \ const point p05(1,2,3); \ const type * a = p05; \ assert(a[0] == 1 && a[1] == 2 && a[2] == 3); \ point p06(4,5,6); \ a = p06; \ assert(a[0] == 4 && a[1] == 5 && a[2] == 6); \ type * b = p06; \ b[0] = 7; \ b[1] = 8; \ b[2] = 9; assert(p06 == point(7,8,9)); \ \ /* Check copy constructor */ \ point p10(p01); assert(p10 == point(1,2,3)); \ point p11(Point3D (1,2,3)); assert(p11 == point(1,2,3)); \ point p12(Vector3D(4,5,6)); assert(p12 == point(4,5,6)); \ point p13(Normal3D(7,8,9)); assert(p13 == point(7,8,9)); \ point p14(Point3D (1,2,3)); assert(p14 == point(1,2,3)); \ point p15(Vector3D (4,5,6)); assert(p15 == point(4,5,6)); \ point p16(Normal3D (7,8,9)); assert(p16 == point(7,8,9)); \ \ /* Check assignment */ \ point p20; \ p20 = Point3D (1,2,3); assert(p20 == point(1,2,3)); \ p20 = Vector3D(4,5,6); assert(p20 == point(4,5,6)); \ p20 = Normal3D(7,8,9); assert(p20 == point(7,8,9)); \ p20 = Point3D (1,2,3); assert(p20 == point(1,2,3)); \ p20 = Vector3D (4,5,6); assert(p20 == point(4,5,6)); \ p20 = Normal3D (7,8,9); assert(p20 == point(7,8,9)); \ \ /* Check arithmetic operations */ \ point p21(1,2,3); \ p21 += point(1,2,3); assert(p21 == point(2,4,6)); \ p21 += Point3D (1,1,1); assert(p21 == point(3,5,7)); \ p21 += Vector3D(1,1,1); assert(p21 == point(4,6,8)); \ p21 += Normal3D(1,1,1); assert(p21 == point(5,7,9)); \ p21 -= point(1,2,3); assert(p21 == point(4,5,6)); \ p21 -= Point3D (1,1,1); assert(p21 == point(3,4,5)); \ p21 -= Vector3D(1,1,1); assert(p21 == point(2,3,4)); \ p21 -= Normal3D(1,1,1); assert(p21 == point(1,2,3)); \ p21 *= 2; assert(p21 == point(2,4,6)); \ p21 /= 2; assert(p21 == point(1,2,3)); \ p21 *= 2.0f; assert(p21 == point(2,4,6)); \ p21 /= 2.0f; assert(p21 == point(1,2,3)); \ p21 *= 2.0; assert(p21 == point(2,4,6)); \ p21 /= 2.0; assert(p21 == point(1,2,3)); \ \ /* Check subscripting */ \ point p22(1,2,3); \ assert(p22(0) == 1 && p22(1) == 2 && p22(2) == 3); \ assert(p22[0] == 1 && p22[1] == 2 && p22[2] == 3); \ p22(0) = 4; \ p22(1) = 5; \ p22(2) = 6; assert(p22 == point(4,5,6)); \ p22[0] = 7; \ p22[1] = 8; \ p22[2] = 9; assert(p22 == point(7,8,9)); \ \ /* Check carthesian coordinate system */ \ point p30; \ p30.setX(1); \ p30.setY(2); \ p30.setZ(3); assert(p30 == point(1,2,3)); \ p30.set(4,5,6); \ assert(p30.x() == 4 && p30.y() == 5 && p30.z() == 6); \ \ /* Check cylindrical coordinate system */ \ point p40(12,16,1); assert(p40.perp2() == 400); \ assert(p40.perp() == 20); \ assert(p40.rho() == 20); \ p40.setPerp(5); assert(p40 == point(3,4,1)); \ p40.set(0,0,1); \ p40.setPerp(5); assert(p40 == point(0,0,1)); \ \ /* Check spherical coordinate system */ \ point p50(2,3,6); assert(p50.mag2() == 49); \ assert(p50.mag() == 7); \ assert(p50.r() == 7); \ assert(p50.getR() == 7); \ point p51(0,0,1); assert(p51.phi() == 0); \ point p52(2,4,5); assert(EQUAL(p52.phi() ,std::atan2(2.,1.))); \ assert(EQUAL(p52.getPhi() ,std::atan2(2.,1.))); \ point p53(0,0,0); assert(p53.theta() == 0); \ assert(p53.cosTheta() == 1); \ point p54(3,4,10); assert(EQUAL(p54.theta() ,std::atan2(1.,2.))); \ assert(EQUAL(p54.getTheta(),std::atan2(1.,2.))); \ assert(EQUAL(p54.cosTheta(),std::sqrt(0.8))); \ point p55(2,3,6); \ p55.setMag(14); assert(p55 == point(4,6,12)); \ p55.setR(7); assert(p55 == point(2,3,6)); \ point p56 = p55; \ p56.setPhi(CLHEP::pi/6); assert(EQUAL(p56.getPhi(),CLHEP::pi/6)); \ assert(EQUAL(p56.mag() ,p55.mag())); \ assert(EQUAL(p56.theta() ,p55.theta())); \ point p57 = p55; \ p57.setTheta(CLHEP::pi/3); assert(EQUAL(p57.cosTheta(),0.5)); \ assert(EQUAL(p57.mag() ,p55.mag())); \ assert(EQUAL(p57.phi() ,p55.phi())); \ \ /* Check pseudo-rapidity */ \ point p60(2,3,6); \ point p61 = p60; \ p61.setEta(2); assert(EQUAL(p61.pseudoRapidity(),2)); \ assert(EQUAL(p61.getEta() ,2)); \ assert(EQUAL(p61.eta() ,2)); \ assert(EQUAL(p61.mag() ,7)); \ assert(EQUAL(p61.phi(),p60.phi())); \ \ /* Check combination of two vectors */ \ point p70(1,2,3); assert(p70.dot(p70) == p70.mag2()); \ point p71( 1,2, 3); \ point p72(-3,2,-1); assert(p71.cross(p72) == point(-8,-8,8)); \ point p73(3,4,0); assert(p73.perp2(point(0,1,0)) == 9); \ assert(p73.perp (point(1,0,0)) == 4); \ point p74(1,0,0); \ point p75(1,1,0); assert(EQUAL(p74.angle(p75),CLHEP::pi/4)); \ assert(EQUAL(p75.angle(p00),CLHEP::pi/2)); \ \ /* Check related vectors */ \ point p80(1,2,3); \ point p81 = p80.unit(); assert(EQUAL(p81.mag() ,1)); \ point p82 = p80.orthogonal(); assert(EQUAL(p82.dot(p81),0)); \ \ /* Check rotations */ \ point p90(2,0.5,std::sqrt(3.)/2); \ p90.rotateX(CLHEP::pi/6); assert(p90.x() == 2); \ assert(EQUAL(p90.y(),0)); \ assert(EQUAL(p90.z(),1)); \ point p91(std::sqrt(3.)/2,2,0.5); \ p91.rotateY(CLHEP::pi/6); assert(EQUAL(p91.x(),1)); \ assert(p91.y() == 2); \ assert(EQUAL(p91.z(),0)); \ point p92(0.5,std::sqrt(3.)/2,2); \ p92.rotateZ(CLHEP::pi/6); assert(EQUAL(p92.x(),0)); \ assert(EQUAL(p92.y(),1)); \ assert(p92.z() == 2); \ point p93(1,1,std::sqrt(2.)); \ p93.rotate(CLHEP::pi,Vector3D(-1,-1,std::sqrt(2.))); \ assert(EQUAL(p93.x(),-1)); \ assert(EQUAL(p93.y(),-1)); \ assert(EQUAL(p93.z(),-std::sqrt(2.))); \ \ /* Check transformations */ \ point p100(1,1,std::sqrt(2.)); \ Transform3D m; \ m = Rotate3D(CLHEP::pi,Vector3D(-1,-1,std::sqrt(2.))); \ p100.transform(m); assert(EQUAL(p100.x(),-1)); \ assert(EQUAL(p100.y(),-1)); \ assert(EQUAL(p100.z(),-std::sqrt(2.))); \ \ /* Check input/output */ \ point p110; \ std::cin >> p110; \ std::cout << p110 << std::endl; \ \ /* Check non-member arithmetics */ \ point p120(-1,-2,-3); \ p120 = +p120; assert(p120 == point(-1,-2,-3)); \ p120 = -p120; assert(p120 == point(1,2,3)); \ point p121(1,2,3); \ p121 = p121 + Point3D (1,1,1); assert(p121 == point(2,3,4));\ p121 = p121 + Vector3D(1,1,1); assert(p121 == point(3,4,5));\ p121 = p121 + Normal3D(1,1,1); assert(p121 == point(4,5,6));\ p121 = p121 - Point3D (1,1,1); assert(p121 == point(3,4,5));\ p121 = p121 - Vector3D (1,1,1); assert(p121 == point(2,3,4));\ p121 = p121 - Normal3D (1,1,1); assert(p121 == point(1,2,3));\ p121 = p121 * 2; assert(p121 == point(2,4,6)); \ p121 = p121 / 2; assert(p121 == point(1,2,3)); \ p121 = p121 * 2.0f; assert(p121 == point(2,4,6)); \ p121 = p121 / 2.0f; assert(p121 == point(1,2,3)); \ p121 = p121 * 2.0; assert(p121 == point(2,4,6)); \ p121 = p121 / 2.0; assert(p121 == point(1,2,3)); \ p121 = 2 * p121; assert(p121 == point(2,4,6)); \ p121 = 0.5f * p121; assert(p121 == point(1,2,3)); \ p121 = 2.0 * p121; assert(p121 == point(2,4,6)); \ assert(p121 * p121 == p121.mag2()); \ assert(p121 * Point3D (1,1,1) == 12); \ assert(p121 * Vector3D(1,1,1) == 12); \ assert(p121 * Normal3D(1,1,1) == 12); \ assert(p121 == Point3D (2,4,6)); \ assert(p121 == Vector3D(2,4,6)); \ assert(p121 == Normal3D(2,4,6)); \ assert(p121 != Point3D (3,4,6)); \ assert(p121 != Vector3D (2,5,6)); \ assert(p121 != Normal3D (2,4,7)); \ void CheckPointFloat() { CHECK(Point3D , float) } void CheckVectorFloat() { CHECK(Vector3D , float) } void CheckNormalFloat() { CHECK(Normal3D , float) } void CheckPointDouble() { CHECK(Point3D , double) } void CheckVectorDouble() { CHECK(Vector3D, double) } void CheckNormalDouble() { CHECK(Normal3D, double) } int main() { CheckPointFloat(); CheckVectorFloat(); CheckNormalFloat(); CheckPointDouble(); CheckVectorDouble(); CheckNormalDouble(); return 0; } clhep-2.1.4.1.orig/Geometry/test/CMakeLists.txt0000644000175000017500000000010211712344306017701 0ustar olesoles clhep_test( testBasicVector3D ) clhep_test( testBug6740 SIMPLE ) clhep-2.1.4.1.orig/Geometry/test/testBasicVector3D.sh.in0000755000175000017500000000024311776622027021417 0ustar olesoles#! /bin/sh # @configure_input@ ./testBasicVector3D@EXEEXT@ < "@srcdir@/testBasicVector3D.input" \ | @DIFF_Q@ - "@srcdir@/testBasicVector3D.output" > /dev/null clhep-2.1.4.1.orig/Geometry/ChangeLog0000755000175000017500000003311512241267303015750 0ustar olesoles============================== 14.11.13 Release CLHEP-2.1.4.1 ============================== ============================== 05.11.13 Release CLHEP-2.1.4.0 ============================== ============================== 14.11.12 Release CLHEP-2.1.3.1 ============================== ============================== 06.11.12 Release CLHEP-2.1.3.0 ============================== ============================== 16.08.12 Release CLHEP-2.1.2.5 ============================== ============================== 09.07.12 Release CLHEP-2.1.2.4 ============================== ============================== 31.05.12 Release CLHEP-2.1.2.3 ============================== 2012-05-11 Lynn Garren * Geometry, src, test: use explicit std:: with math functions ============================== 14.02.12 Release CLHEP-2.1.2.2 ============================== ============================== 06.02.12 Release CLHEP-2.1.2.1 ============================== 2012-02-01 Lynn Garren * change the names of internal variables so -Wshadow does not complain ============================== 16.12.11 Release CLHEP-2.1.2.0 ============================== ============================== 29.07.11 Release CLHEP-2.1.1.0 ============================== ============================== 11.11.10 Release CLHEP-2.1.0.1 ============================== ============================== 23.07.10 Release CLHEP-2.1.0.0 ============================== ============================== 16.06.10 Release CLHEP-2.1.0.0.b01 ============================== ============================== 11.06.10 Release CLHEP-2.0.5.0.b01 ============================== ============================== 09.03.10 Release CLHEP-2.0.4.6 ============================== ============================== 08.12.09 Release CLHEP-2.0.4.5 ============================== ============================== 12.11.09 Release CLHEP-2.0.4.4 ============================== ============================== 03.11.09 Release CLHEP-2.0.4.4.b01 ============================== ============================== 04.07.09 Release CLHEP-2.0.4.3 ============================== ============================== 18.11.08 Release CLHEP-2.0.4.2 ============================== ============================== 04.11.08 Release CLHEP-2.0.4.1 ============================== ============================== 07.08.08 Release CLHEP-2.0.4.0 ============================== ============================== 01.05.08 Release CLHEP-2.0.3.3 ============================== ============================== 18.10.07 Release CLHEP-2.0.3.2 ============================== ============================== 15.11.06 Release CLHEP-2.0.3.1 ============================== ============================== 18.10.06 Release CLHEP-2.0.3.0 ============================== ============================== 20.06.06 Release CLHEP-2.0.2.3 ============================== ============================== 21.11.05 Release CLHEP-2.0.2.2 ============================== 2005-11-21 Lynn Garren * src/Makefile.am, test/Makefile.am: Build libraries for Windows Visual C++ without lib prefix. ============================== 22.06.05 Release CLHEP-2.0.2.1 ============================== Wed Jun 22 2005 Andreas Pfeiffer * configure.in: changed soname to install_name for darwin targets, dylibs still don't build properly on 10.3/10.4, static libs ok. 2005-06-19 Lynn Garren * configure.in, Makefile.am: Use lib when building Visual C++ libraries. Disable shared library build for Solaris CC. ============================== 22.04.05 Release CLHEP-2.0.2.0 ============================== 2005-04-07 Lynn Garren * configure.in: set AR and ARFLAGS Thu Mar 10 2005 Andreas Pfeiffer * Geometry/BasicVector3D.h : added operator to convert to Hep3Vector for backward compatibility (savannah bug id 6740) * Geometry/config.in, Geometry/test/testBug6740.cc, Geometry/test/testBug6740.sh, Geometry/test/testBug6740.output, Geometry/test/Makefile.am: added test for bug ID 6740 2005-02-18 Lynn Garren * configure.in, Makefile.am: Stop using libtool. The newer releases of libtool seem to have dropped support for Windows Visual C++. 2005-02-14 Lynn Garren * configure.in: Visual C++ flags are now "-EHsc -nologo -GR -GX -MD" 2005-02-03 Lynn Garren * configure.in: install step creates libCLHEP.a, libCLHEP.so, and/or libCLHEP.dylib by adding a symbolic link. 2005-02-02 Andreas PFEIFFER * configure.in: modified compiler flags for windows: added "-O -GR -GX -MD" as this is needed for the multi-thread environments used. 2005-02-01 Andreas PFEIFFER * Geometry/BasicVector3D.h : changed template specialisations for multiplication of vector with scalar and division of vector by scalar to use float scalars instead of double (savannah bug id 6523) ============================== 30.11.04 Release CLHEP-2.0.1.2 ============================== Tue Nov 30 2004 Andreas Pfeiffer * Geometry/Plane3D.h: replaced wrong by in Point3D point(const Point3D & p) const { ============================== 27.10.04 Release CLHEP-2.0.1.1 ============================== Wed Oct 27 2004 Andreas Pfeiffer * Geometry/BasicVector3D.h: made dtor virtual as this is a base class * Geometry/Transform3D.h: added virtual dtor for persistency. This may go away in later releases. Fri Sep 24 2004 Lynn Garren * use AM_CXXFLAGS * require autoconf 2.59, automake 1.9.1, and libtool 1.9b Tue Aug 31 2004 Lynn Garren * change Solaris CC compile flags from "-O -mt" to "-O" * libtools 1.9b or later is required for Solaris CC ============================== 23.07.04 Release CLHEP-2.0.1.0 ============================== ============================== 11.05.04 Release CLHEP-2.0.0.2 ============================== ============================== 11.05.04 Release CLHEP-1.9.0.2 ============================== ============================== 21.04.04 Release CLHEP-2.0.0.1 ============================== ============================== 24.10.03 Release CLHEP-2.0.0.0 ============================== ============================== 23.10.03 Release CLHEP-1.9.0.0 ============================== Mon May 5 10:32:18 2003 Evgueni Tcherniaev * Geometry/BasicVector3D.h,Normal3D.h,Plane3D.cc,Plane3D.h,Point3D.h: * Geometry/Transform3D.cc,Transform3D.h,Vector3D.h: * Geometry/BasicVector3D.cc,Normal3D.cc,Point3D.cc (Added): * Geometry/Transform3D.icc,Vector3D.cc (Added): Template implementation of Point3D, Vector3D and Normal3D. * test/testBasicVector3D.cc: * test/testBasicVector3D.input,testBasicVector3D.out.save: New (rather complete) test for basic geometrical classes. * test/Makefile.in: Use diff -w to avoid problems on Windows. Wed Jul 31 18:29:05 2002 Evgueni Tcherniaev * Geometry/Transform3D.cc,Transform3D.h: * test/testTransform3D.cc: Rewritten test for equality Mon Jul 29 18:24:13 2002 Evgueni Tcherniaev * Geometry/Transform3D.cc,Transform3D.h: * test/testTransform3D.cc: Added isNear() function ============================== 01.06.02 Release CLHEP-1.8.0.0 ============================== ========================================= 25.04.02 revised StdHep uses HepMC ========================================= Fri Apr 19 18:33:41 2002 Evgueni Tcherniaev * Geometry/BasicVector3D.h,Normal3D.h,Plane3D.h,Point3D.h: * Geometry/Transform3D.h,Vector3D.h: Added documenting comments. ========================================= 08.03.02 HepMC has become a part of CLHEP ========================================= ========================================== 09.11.01 HepPDT has become a part of CLHEP ========================================== Mon Aug 13 11:21:31 2001 Evgueni Tcherniaev * Geometry/BasicVector3D.h: Corrected operator>> Tue Jul 31 18:54:39 2001 Evgueni Tcherniaev * Geometry/BasicVector3D.h: Constructor from Hep3Vector is now protected. Changed the signature of the conversion operator to Hep3Vector. Thu Jul 26 18:51:47 2001 Evgueni Tcherniaev * Geometry/BasicVector3D.h: Added r(), getR(), SetR(), getPhi(), getTheta(), eta(), getEta(), setEta(). ============================== 15.06.01 Release CLHEP-1.7.0.0 ============================== Fri Jun 15 09:30:42 2001 Evgueni Tcherniaev * Geometry/Transform3D.cc,Transform3D.h: Disabled m^-1. * configure.in: Set default options for MS VC++ to "-DWIN32 -O -GX -GR -MD" * test/testEvaluator.cc: Added "return 0" to avoid problems with "make -check" on NT. Added header comments. * test/testBasicVector3D.cc: Changed endl to HepStd::endl Thu Jun 14 11:27:44 2001 Evgueni Tcherniaev * Geometry/BasicVector3D.h (Added): * Geometry/Point3D.h,Vector3D.h,Normal3D.h: * test/testBasicVector3D.cc (Added): * test/testBasicVector3D.input,testBasicVector3D.out.save (Added): * test/testTransform3D.cc,Makefile.in: Added BasicVector3D.h to decouple functionality of Point3D, Vector3D and Normal3D from functionality of Hep3Vector. * test/testEvaluator.in (Removed): * test/testEvaluator.input (Added): * test/Makefile.in: testEvaluator.in has been renamed to testEvaluator.input Mon Jun 11 10:20:35 2001 Evgueni Tcherniaev * Geometry/Transform3D.cc,Transform3D.h: Added getDecomposition(Scale &, Rotation &, Translation &) * test/Makefile.in: * test/testTransform3D.cc (Added): Added test for Transform3D. * test/testAList.cc,testCmd.cc,testCmd.out.save (Removed): * test/testComb.cc,testStrings.cc (Removed): Removed obsolete tests. Fri May 18 09:32:21 2001 Evgueni Tcherniaev * Evaluator/hash_map.src,utility.src: removed "using HepSTL::pair", because it does not compile on HP. Mon Jan 29 16:59:00 2001 Evgueni Tcherniaev * Geometry/Transform3D.cc,Transform3D.h: Added subscripting ========================================================================== 18.01.01 ZOOM PhysicsVectors Capabilities have become part of CLHEP/Vector ========================================================================== ====================================================================== 24.10.00 Generic Functions by Joe Boudreau have become a part of CLHEP ====================================================================== ============================== 20.10.00 Release CLHEP-1.6.0.0 ============================== Sun Oct 15 18:26:12 2000 Evgueni Tcherniaev * Geometry/Plane3D.h: Bug correction in transform(). Thanks to Helge.Voss@cern.ch. ============================================================================== 12.10.00 Expression Evaluator by Evgueni Tcherniaev has become a part of CLHEP Alist, String and Combination have been disabled ============================================================================== ============================== 08.05.00 Release CLHEP-1.5.0.0 ============================== ============================================================ 24.04.00 StdHepC++ by Lynn Garren has become a part of CLHEP ============================================================ ============================== 20.04.99 Release CLHEP-1.4.0.0 ============================== Sun Apr 18 15:36:46 1999 Evgueni Tcherniaev * Geometry/Transform3D.h: Changes in comments to avoid warnings when compile with g++ -Wall -pedantic Tue Apr 6 19:13:35 1999 Evgueni Tcherniaev * Geometry/Normal3D.h,Plane3D.h,Point3D.h,Vector3D.h: Added explicit destructor by request of S.Giani ========================================================================= 16.12.98 Started: merging with BaBar version of CLHEP provided by G.Cosmo ========================================================================= Fri Oct 23 14:14:07 1998 Evgueni Tcherniaev * Geometry/Point3D.h: Added const in arguments of distance() and distance2() ========================== 28.07.98 Release CLHEP-1.3 ========================== Wed May 13 18:02:38 1998 Evgueni Tcherniaev * Geometry/Normal3D.h,Plane3D.h,Vector3D.h (transform): In transform() the non-const argument changed to const Thu Apr 9 15:47:33 1998 Evgueni Tcherniaev * Geometry/Plane3D.h: Rewritten operator ==, added operator != * Makefile.in: "distclean" target now does not erase "configure" ========================== 05.02.98 Release CLHEP-1.2 ========================== Fri Jan 23 16:24:24 1998 Evgueni Tcherniaev * Geometry/Plane3D.h: * Matrix/DiagMatrix.h,Matrix.h,SymMatrix.h,Vector.h: * String/CmdLine.h: * Vector/LorentzVector.h,ThreeVector.h: Declaration class ostream; changed to #include to avoid problems with KCC Tue Dec 16 11:24:16 1997 Evgueni Tcherniaev * Geometry/Point3D.h: Added const for distance() and distance2() ======================================================== 08.12.97 Release CLHEP-1.1: Geant4 has migrated to CLHEP ======================================================== Fri Oct 10 12:10:57 1997 Evgueni Tcherniaev * Geometry/: * Normal3D.h,Plane3D.cc,Plane3D.h,Point3D.h,Transform3D.cc: * Transform3D.h,Vector3D.h: Changes in comments clhep-2.1.4.1.orig/Geometry/CMakeLists.txt0000644000175000017500000000043511607417635016744 0ustar olesoles# main Geometry cmake instructions # automake/autoconf variables set( PACKAGE Geometry ) # define dependency list that will be used in several places list(APPEND ${PACKAGE}_DEPS Vector ) clhep_package_config() add_subdirectory(Geometry) add_subdirectory(src) add_subdirectory(test) clhep-2.1.4.1.orig/Geometry/autotools/0000755000175000017500000000000012242515152016220 5ustar olesolesclhep-2.1.4.1.orig/Geometry/autotools/.cvsignore0000755000175000017500000000010107705060311020213 0ustar olesolesconfig.sub config.guess depcomp install-sh missing mkinstalldirs clhep-2.1.4.1.orig/Geometry/autotools/ltmain.sh0000755000175000017500000057547210233731142020064 0ustar olesoles# Generated from ltmain.in; do not edit by hand # ltmain.sh (GNU libtool) 1.9b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: powerpc-apple-darwin7.5.0 # shell: $SHELL # compiler: $LTCC # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 1.9b # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST elif test -n "${BASH_VERSION+set}${KSH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh dirname="s,/[^/]*$,," basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: PROGRAM=ltmain.sh progname=`echo "$progpath" | $SED "$basename"` # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *) progdir=`echo "$progpath" | $SED "$dirname"` progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; esac # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.9b TIMESTAMP="" package_revision=1.1571 # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $echo $progname${mode+: }$mode: warning: ${1+"$@"} 1>&2 } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } # func_version # Echo version message to standard output and exit. func_version () { $SED '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# //; s/^# *$//; s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED '/^# Usage:/,/# -h/ { s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" echo echo "run \`$progname --help | more' for full usage" exit $EXIT_SUCCESS } # func_help # Echo long help message to standard output and exit. func_help () { $SED '/^# Usage:/,/# Report bugs to/ { s/^# //; s/^# *$//; s:\$progname:'$progname':; s:\$SHELL:'"$SHELL"':; s:\$LTCC:'"$LTCC"':; s:\$LD:'"$LD"':; s/\$with_gnu_ld/'"$with_gnu_ld"'/; s/\$automake_version/'"`automake --version 2>/dev/null |$SED 1q`"'/; s/\$autoconf_version/'"`autoconf --version 2>/dev/null |$SED 1q`"'/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $EXIT_SUCCESS } # func_features # Display the features supported by this script. func_features () { $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable "`\"foo\"`", so we have to do # it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $echo \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $echo $echo "Try \`$progname --help' for more information about other modes." exit $EXIT_SUCCESS } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # sed scripts: my_sed_single_opt='1s/^\(..\).*$/\1/;q' my_sed_single_rest='1s/^..\(.*\)$/\1/;q' my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' exit_cmd=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set -- --mode clean ${1+"$@"} ;; compile|compil|compi|comp|com|co|c) shift; set -- --mode compile ${1+"$@"} ;; execute|execut|execu|exec|exe|ex|e) shift; set -- --mode execute ${1+"$@"} ;; finish|finis|fini|fin|fi|f) shift; set -- --mode finish ${1+"$@"} ;; install|instal|insta|inst|ins|in|i) shift; set -- --mode install ${1+"$@"} ;; link|lin|li|l) shift; set -- --mode link ${1+"$@"} ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set -- --mode uninstall ${1+"$@"} ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" set -x ;; --dlopen) test $# -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" ;; --dry-run | -n) run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test $# -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" show=: ;; --tag) test $# -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: --dlopen=*|--mode=*|--tag=*) arg=`echo "$opt" | $SED "$my_sed_long_arg"` opt=`echo "$opt" | $SED "$my_sed_long_opt"` set -- "$opt" "$arg" ${1+"$@"} ;; # Separate optargs to short options: # -x*|-y*) # arg=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "$arg" ${1+"$@"} # ;; # Separate non-argument short options: # -z*|-z*|-y*) # rest=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "-$rest" ${1+"$@"} # ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`echo "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$my_dlsyms" test -z "$run" && $echo > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do $show "extracting global C symbols from \`$progfile'" $run eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for dlprefile in $dlprefiles; do $show "extracting global C symbols from \`$dlprefile'" name=`$echo "$dlprefile" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ const struct { const char *originator; const struct { const char *name; void *address; } symbols[]; } lt_${my_prefix}_LTX_preloaded_symbols = {\ \"$my_originator\", { " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" $echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} } }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" status=$? if test "$status" -ne 0 && test ! -d "$my_xdir"; then exit $status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename $darwin_archive` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" # Remove the table of contents from the thin files. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" $AR -xo "${darwin_base_archive}" rm "${darwin_base_archive}" cd "$darwin_curdir" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist rm -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir (cd $my_xdir && $AR x $my_xabs) || exit $? fi # $darwin_arches fi # $run ;; *) # We will extract separately just the conflicting names and we will # no longer touch any unique names. It is faster to leave these # extract automatically by $AR in one run. $show "(cd $my_xdir && $AR x $my_xabs)" $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; renaming object files" func_warning "to ensure that they will not overwrite" $AR t "$my_xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_mode_compile arg... func_mode_compile () { # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1 || \ func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi } # func_mode_finish arg... func_mode_finish () { libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit $EXIT_SUCCESS } # func_mode_install arg... func_mode_install () { # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files test "$#" -gt 2 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. (${SED} -e '2q' $file | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1 || \ func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" $show "$relink_command" $run eval "$relink_command" || \ func_fatal_error "error: relink \`$file' with the above command before installing it" fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | $GREP "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. test -z "$notinst_deplibs" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask func_error "error: cannot create temporary directory \`$tmpdir'" continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" ${rm}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } # func_mode_link arg... func_mode_link () { case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static # See comment for -static flag below, for more details. compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" || \ func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else func_fatal_error "link input file \`$save_arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) # The effects of -all-static are defined in a previous loop. continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs $inherited_linker_flags" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *[\\/]*.la) . $lib ;; *.la) . ./$lib ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`echo "$deplib" |$SED "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$inherited_linker_flags " in *" $deplib "*) ;; * ) inherited_linker_flags="$inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $lib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not use here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib'" fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then : else func_fatal_error "\`$lib' is not a valid libtool archive" fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac case $host in *-*-darwin*) # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then inherited_linker_flags=`$echo "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` fi dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP "bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $echo "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "*** And there doesn't seem to be a static archive available" $echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs $inherited_linker_flags; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" eval darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//' | xargs` compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for archives" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath test "$#" -gt 2 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" test -n "$8" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "AGE \`$age' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | ${SED} 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null | ${SED} 10q | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` inherited_linker_flags=`$echo "X $inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$echo "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`echo "$output" | $SED $basename` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnk $echo "creating GNU ld script: $output" $echo 'INPUT (' > $output for obj in $save_libobjs do $echo \""$obj"\" >> $output done $echo ')' >> $output else $echo "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for objects" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; struct stat st; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$dlsymsobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; overriding AR_FLAGS to 'cq'" func_warning "to ensure that POSIX-compatible ar will work" AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS } # func_mode_uninstall arg... func_mode_uninstall () { rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done test -z "$rm" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 || (test -h "$file") >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status } ## ----------- ## ## Main. ## ## ----------- ## { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." case $mode in compile) func_mode_compile ${1+"$@"} ;; execute) func_mode_execute ${1+"$@"} ;; finish) func_mode_finish ${1+"$@"} ;; install) func_mode_install ${1+"$@"} ;; link|relink) func_mode_link ${1+"$@"} ;; uninstall|clean) func_mode_uninstall ${1+"$@"} ;; "") help="$generic_help" func_fatal_help "you must specify a MODE" ;; esac test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi } exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: clhep-2.1.4.1.orig/Geometry/src/0000755000175000017500000000000012242515152014756 5ustar olesolesclhep-2.1.4.1.orig/Geometry/src/Makefile.am0000755000175000017500000000351111406175007017017 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir) libCLHEP_Geometry_@VERSION@_a_SOURCES = \ BasicVector3D.cc \ Normal3D.cc \ Plane3D.cc \ Point3D.cc \ Transform3D.cc \ Vector3D.cc libCLHEP_Geometry_@VERSION@_so_OBJECTS = $(patsubst %.cc,$(shareddir)/%.$(OBJEXT),$(libCLHEP_Geometry_@VERSION@_a_SOURCES)) # these if/else blocks will be parsed by automake and translated if BUILD_SHARED shareddir = shared if BUILD_VISUAL lib_shared = CLHEP-Geometry-@VERSION@.$(SHEXT) else lib_shared = libCLHEP-Geometry-@VERSION@.$(SHEXT) LDADD = -L${top_builddir}/../Vector/src -lCLHEP-Vector-@VERSION@ endif SHFLAGS = @MY_SHFLAGS@ SHLINK = @MY_SHLINK@ @MY_SHEXTRA@ SHNAME = @MY_SHNAME@ endif if BUILD_STATIC lib_LIBRARIES = libCLHEP-Geometry-@VERSION@.a endif CLEANFILES = $(lib_shared) all-local: $(shareddir) $(lib_shared) $(shareddir): test -d $(shareddir) || mkdir $(shareddir) if BUILD_VISUAL $(lib_shared): $(libCLHEP_Geometry_@VERSION@_so_OBJECTS) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Geometry_@VERSION@_so_OBJECTS) $(LDADD) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) /c /Fo$@ $< else $(lib_shared): $(libCLHEP_Geometry_@VERSION@_so_OBJECTS) $(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Geometry_@VERSION@_so_OBJECTS) $(LDADD) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) -c -o $@ $< endif install-exec-local: $(lib_shared) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_shared)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$p'"; \ $(INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done clean-local: -test -d $(shareddir) && rm -f $(shareddir)/*.$(OBJEXT) distclean-local: -test -d $(shareddir) && rm -rf ./$(shareddir) clhep-2.1.4.1.orig/Geometry/src/Normal3D.cc0000755000175000017500000000474707716514316016736 0ustar olesoles// -*- C++ -*- // $Id: Normal3D.cc,v 1.3 2003/08/13 20:00:11 garren Exp $ // --------------------------------------------------------------------------- #include "CLHEP/Geometry/defs.h" #include "CLHEP/Geometry/Normal3D.h" #include "CLHEP/Geometry/Transform3D.h" namespace HepGeom { //-------------------------------------------------------------------------- Normal3D & Normal3D::transform(const Transform3D & m) { double vx = x(), vy = y(), vz = z(); double xx = m.xx(), xy = m.xy(), xz = m.xz(); double yx = m.yx(), yy = m.yy(), yz = m.yz(); double zx = m.zx(), zy = m.zy(), zz = m.zz(); set((yy*zz-yz*zy)*vx+(yz*zx-yx*zz)*vy+(yx*zy-yy*zx)*vz, (zy*xz-zz*xy)*vx+(zz*xx-zx*xz)*vy+(zx*xy-zy*xx)*vz, (xy*yz-xz*yy)*vx+(xz*yx-xx*yz)*vy+(xx*yy-xy*yx)*vz); return *this; } //-------------------------------------------------------------------------- Normal3D operator*(const Transform3D & m, const Normal3D & v) { double vx = v.x(), vy = v.y(), vz = v.z(); double xx = m.xx(), xy = m.xy(), xz = m.xz(); double yx = m.yx(), yy = m.yy(), yz = m.yz(); double zx = m.zx(), zy = m.zy(), zz = m.zz(); return Normal3D ((yy*zz-yz*zy)*vx+(yz*zx-yx*zz)*vy+(yx*zy-yy*zx)*vz, (zy*xz-zz*xy)*vx+(zz*xx-zx*xz)*vy+(zx*xy-zy*xx)*vz, (xy*yz-xz*yy)*vx+(xz*yx-xx*yz)*vy+(xx*yy-xy*yx)*vz); } //-------------------------------------------------------------------------- Normal3D & Normal3D::transform(const Transform3D & m) { double vx = x(), vy = y(), vz = z(); double xx = m.xx(), xy = m.xy(), xz = m.xz(); double yx = m.yx(), yy = m.yy(), yz = m.yz(); double zx = m.zx(), zy = m.zy(), zz = m.zz(); set((yy*zz-yz*zy)*vx+(yz*zx-yx*zz)*vy+(yx*zy-yy*zx)*vz, (zy*xz-zz*xy)*vx+(zz*xx-zx*xz)*vy+(zx*xy-zy*xx)*vz, (xy*yz-xz*yy)*vx+(xz*yx-xx*yz)*vy+(xx*yy-xy*yx)*vz); return *this; } //-------------------------------------------------------------------------- Normal3D operator*(const Transform3D & m, const Normal3D & v) { double vx = v.x(), vy = v.y(), vz = v.z(); double xx = m.xx(), xy = m.xy(), xz = m.xz(); double yx = m.yx(), yy = m.yy(), yz = m.yz(); double zx = m.zx(), zy = m.zy(), zz = m.zz(); return Normal3D ((yy*zz-yz*zy)*vx+(yz*zx-yx*zz)*vy+(yx*zy-yy*zx)*vz, (zy*xz-zz*xy)*vx+(zz*xx-zx*xz)*vy+(zx*xy-zy*xx)*vz, (xy*yz-xz*yy)*vx+(xz*yx-xx*yz)*vy+(xx*yy-xy*yx)*vz); } } /* namespace HepGeom */ clhep-2.1.4.1.orig/Geometry/src/Vector3D.cc0000755000175000017500000000326307716514316016740 0ustar olesoles// -*- C++ -*- // $Id: Vector3D.cc,v 1.3 2003/08/13 20:00:11 garren Exp $ // --------------------------------------------------------------------------- #include "CLHEP/Geometry/defs.h" #include "CLHEP/Geometry/Vector3D.h" #include "CLHEP/Geometry/Transform3D.h" namespace HepGeom { //-------------------------------------------------------------------------- Vector3D & Vector3D::transform(const Transform3D & m) { double vx = x(), vy = y(), vz = z(); set(m.xx()*vx + m.xy()*vy + m.xz()*vz, m.yx()*vx + m.yy()*vy + m.yz()*vz, m.zx()*vx + m.zy()*vy + m.zz()*vz); return *this; } //-------------------------------------------------------------------------- Vector3D operator*(const Transform3D & m, const Vector3D & v) { double vx = v.x(), vy = v.y(), vz = v.z(); return Vector3D (m.xx()*vx + m.xy()*vy + m.xz()*vz, m.yx()*vx + m.yy()*vy + m.yz()*vz, m.zx()*vx + m.zy()*vy + m.zz()*vz); } //-------------------------------------------------------------------------- Vector3D & Vector3D::transform(const Transform3D & m) { double vx = x(), vy = y(), vz = z(); set(m.xx()*vx + m.xy()*vy + m.xz()*vz, m.yx()*vx + m.yy()*vy + m.yz()*vz, m.zx()*vx + m.zy()*vy + m.zz()*vz); return *this; } //-------------------------------------------------------------------------- Vector3D operator*(const Transform3D & m, const Vector3D & v) { double vx = v.x(), vy = v.y(), vz = v.z(); return Vector3D (m.xx()*vx + m.xy()*vy + m.xz()*vz, m.yx()*vx + m.yy()*vy + m.yz()*vz, m.zx()*vx + m.zy()*vy + m.zz()*vz); } } /* namespace HepGeom */ clhep-2.1.4.1.orig/Geometry/src/Transform3D.cc0000755000175000017500000003103511753240470017440 0ustar olesoles// -*- C++ -*- // $Id: Transform3D.cc,v 1.6 2003/10/24 21:39:45 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // Hep geometrical 3D Transformation library // // Author: Evgeni Chernyaev // // History: // 24.09.96 E.Chernyaev - initial version #include #include // double std::abs() #include // int std::abs() #include "CLHEP/Geometry/defs.h" #include "CLHEP/Geometry/Transform3D.h" using std::abs; namespace HepGeom { const Transform3D Transform3D::Identity = Transform3D (); // T R A N S F O R M A T I O N ------------------------------------------- double Transform3D::operator () (int i, int j) const { if (i == 0) { if (j == 0) { return xx_; } if (j == 1) { return xy_; } if (j == 2) { return xz_; } if (j == 3) { return dx_; } } else if (i == 1) { if (j == 0) { return yx_; } if (j == 1) { return yy_; } if (j == 2) { return yz_; } if (j == 3) { return dy_; } } else if (i == 2) { if (j == 0) { return zx_; } if (j == 1) { return zy_; } if (j == 2) { return zz_; } if (j == 3) { return dz_; } } else if (i == 3) { if (j == 0) { return 0.0; } if (j == 1) { return 0.0; } if (j == 2) { return 0.0; } if (j == 3) { return 1.0; } } std::cerr << "Transform3D subscripting: bad indeces " << "(" << i << "," << j << ")" << std::endl; return 0.0; } //-------------------------------------------------------------------------- Transform3D Transform3D::operator*(const Transform3D & b) const { return Transform3D (xx_*b.xx_+xy_*b.yx_+xz_*b.zx_, xx_*b.xy_+xy_*b.yy_+xz_*b.zy_, xx_*b.xz_+xy_*b.yz_+xz_*b.zz_, xx_*b.dx_+xy_*b.dy_+xz_*b.dz_+dx_, yx_*b.xx_+yy_*b.yx_+yz_*b.zx_, yx_*b.xy_+yy_*b.yy_+yz_*b.zy_, yx_*b.xz_+yy_*b.yz_+yz_*b.zz_, yx_*b.dx_+yy_*b.dy_+yz_*b.dz_+dy_, zx_*b.xx_+zy_*b.yx_+zz_*b.zx_, zx_*b.xy_+zy_*b.yy_+zz_*b.zy_, zx_*b.xz_+zy_*b.yz_+zz_*b.zz_, zx_*b.dx_+zy_*b.dy_+zz_*b.dz_+dz_); } // ------------------------------------------------------------------------- Transform3D::Transform3D(const Point3D & fr0, const Point3D & fr1, const Point3D & fr2, const Point3D & to0, const Point3D & to1, const Point3D & to2) /*********************************************************************** * * * Name: Transform3D::Transform3D Date: 24.09.96 * * Author: E.Chernyaev (IHEP/Protvino) Revised: * * * * Function: Create 3D Transformation from one coordinate system * * defined by its origin "fr0" and two axes "fr0->fr1", * * "fr0->fr2" to another coordinate system "to0", "to0->to1" * * and "to0->to2" * * * ***********************************************************************/ { Vector3D x1,y1,z1, x2,y2,z2; x1 = (fr1 - fr0).unit(); y1 = (fr2 - fr0).unit(); x2 = (to1 - to0).unit(); y2 = (to2 - to0).unit(); // C H E C K A N G L E S double cos1, cos2; cos1 = x1*y1; cos2 = x2*y2; if (std::abs(1.0-cos1) <= 0.000001 || std::abs(1.0-cos2) <= 0.000001) { std::cerr << "Transform3D: zero angle between axes" << std::endl; setIdentity(); }else{ if (std::abs(cos1-cos2) > 0.000001) { std::cerr << "Transform3D: angles between axes are not equal" << std::endl; } // F I N D R O T A T I O N M A T R I X z1 = (x1.cross(y1)).unit(); y1 = z1.cross(x1); z2 = (x2.cross(y2)).unit(); y2 = z2.cross(x2); double detxx = (y1.y()*z1.z() - z1.y()*y1.z()); double detxy = -(y1.x()*z1.z() - z1.x()*y1.z()); double detxz = (y1.x()*z1.y() - z1.x()*y1.y()); double detyx = -(x1.y()*z1.z() - z1.y()*x1.z()); double detyy = (x1.x()*z1.z() - z1.x()*x1.z()); double detyz = -(x1.x()*z1.y() - z1.x()*x1.y()); double detzx = (x1.y()*y1.z() - y1.y()*x1.z()); double detzy = -(x1.x()*y1.z() - y1.x()*x1.z()); double detzz = (x1.x()*y1.y() - y1.x()*x1.y()); double txx = x2.x()*detxx + y2.x()*detyx + z2.x()*detzx; double txy = x2.x()*detxy + y2.x()*detyy + z2.x()*detzy; double txz = x2.x()*detxz + y2.x()*detyz + z2.x()*detzz; double tyx = x2.y()*detxx + y2.y()*detyx + z2.y()*detzx; double tyy = x2.y()*detxy + y2.y()*detyy + z2.y()*detzy; double tyz = x2.y()*detxz + y2.y()*detyz + z2.y()*detzz; double tzx = x2.z()*detxx + y2.z()*detyx + z2.z()*detzx; double tzy = x2.z()*detxy + y2.z()*detyy + z2.z()*detzy; double tzz = x2.z()*detxz + y2.z()*detyz + z2.z()*detzz; // S E T T R A N S F O R M A T I O N double dx1 = fr0.x(), dy1 = fr0.y(), dz1 = fr0.z(); double dx2 = to0.x(), dy2 = to0.y(), dz2 = to0.z(); setTransform(txx, txy, txz, dx2-txx*dx1-txy*dy1-txz*dz1, tyx, tyy, tyz, dy2-tyx*dx1-tyy*dy1-tyz*dz1, tzx, tzy, tzz, dz2-tzx*dx1-tzy*dy1-tzz*dz1); } } // ------------------------------------------------------------------------- Transform3D Transform3D::inverse() const /*********************************************************************** * * * Name: Transform3D::inverse Date: 24.09.96 * * Author: E.Chernyaev (IHEP/Protvino) Revised: * * * * Function: Find inverse affine transformation * * * ***********************************************************************/ { double detxx = yy_*zz_-yz_*zy_; double detxy = yx_*zz_-yz_*zx_; double detxz = yx_*zy_-yy_*zx_; double det = xx_*detxx - xy_*detxy + xz_*detxz; if (det == 0) { std::cerr << "Transform3D::inverse error: zero determinant" << std::endl; return Transform3D(); } det = 1./det; detxx *= det; detxy *= det; detxz *= det; double detyx = (xy_*zz_ - xz_*zy_)*det; double detyy = (xx_*zz_ - xz_*zx_)*det; double detyz = (xx_*zy_ - xy_*zx_)*det; double detzx = (xy_*yz_ - xz_*yy_)*det; double detzy = (xx_*yz_ - xz_*yx_)*det; double detzz = (xx_*yy_ - xy_*yx_)*det; return Transform3D (detxx, -detyx, detzx, -detxx*dx_+detyx*dy_-detzx*dz_, -detxy, detyy, -detzy, detxy*dx_-detyy*dy_+detzy*dz_, detxz, -detyz, detzz, -detxz*dx_+detyz*dy_-detzz*dz_); } // ------------------------------------------------------------------------- void Transform3D::getDecomposition(Scale3D & scale, Rotate3D & rotation, Translate3D & translation) const /*********************************************************************** * CLHEP-1.7 * * Name: Transform3D::getDecomposition Date: 09.06.01 * * Author: E.Chernyaev (IHEP/Protvino) Revised: * * * * Function: Gets decomposition of general transformation on * * three consequentive specific transformations: * * Scale, then Rotation, then Translation. * * If there was a reflection, then ScaleZ will be negative. * * * ***********************************************************************/ { double sx = std::sqrt(xx_*xx_ + yx_*yx_ + zx_*zx_); double sy = std::sqrt(xy_*xy_ + yy_*yy_ + zy_*zy_); double sz = std::sqrt(xz_*xz_ + yz_*yz_ + zz_*zz_); if (xx_*(yy_*zz_-yz_*zy_) - xy_*(yx_*zz_-yz_*zx_) + xz_*(yx_*zy_-yy_*zx_) < 0) sz = -sz; scale.setTransform(sx,0,0,0, 0,sy,0,0, 0,0,sz,0); rotation.setTransform(xx_/sx,xy_/sy,xz_/sz,0, yx_/sx,yy_/sy,yz_/sz,0, zx_/sx,zy_/sy,zz_/sz,0); translation.setTransform(1,0,0,dx_, 0,1,0,dy_, 0,0,1,dz_); } // ------------------------------------------------------------------------- bool Transform3D::isNear(const Transform3D & t, double tolerance) const { return ( (std::abs(xx_ - t.xx_) <= tolerance) && (std::abs(xy_ - t.xy_) <= tolerance) && (std::abs(xz_ - t.xz_) <= tolerance) && (std::abs(dx_ - t.dx_) <= tolerance) && (std::abs(yx_ - t.yx_) <= tolerance) && (std::abs(yy_ - t.yy_) <= tolerance) && (std::abs(yz_ - t.yz_) <= tolerance) && (std::abs(dy_ - t.dy_) <= tolerance) && (std::abs(zx_ - t.zx_) <= tolerance) && (std::abs(zy_ - t.zy_) <= tolerance) && (std::abs(zz_ - t.zz_) <= tolerance) && (std::abs(dz_ - t.dz_) <= tolerance) ); } // ------------------------------------------------------------------------- bool Transform3D::operator==(const Transform3D & t) const { return (this == &t) ? true : (xx_==t.xx_ && xy_==t.xy_ && xz_==t.xz_ && dx_==t.dx_ && yx_==t.yx_ && yy_==t.yy_ && yz_==t.yz_ && dy_==t.dy_ && zx_==t.zx_ && zy_==t.zy_ && zz_==t.zz_ && dz_==t.dz_ ); } // 3 D R O T A T I O N ------------------------------------------------- Rotate3D::Rotate3D(double a, const Point3D & p1, const Point3D & p2) : Transform3D() /*********************************************************************** * * * Name: Rotate3D::Rotate3D Date: 24.09.96 * * Author: E.Chernyaev (IHEP/Protvino) Revised: * * * * Function: Create 3D Rotation through angle "a" (counterclockwise) * * around the axis p1->p2 * * * ***********************************************************************/ { if (a == 0) return; double cx = p2.x()-p1.x(), cy = p2.y()-p1.y(), cz = p2.z()-p1.z(); double ll = std::sqrt(cx*cx + cy*cy + cz*cz); if (ll == 0) { std::cerr << "Rotate3D: zero axis" << std::endl; }else{ double cosa = std::cos(a), sina = std::sin(a); cx /= ll; cy /= ll; cz /= ll; double txx = cosa + (1-cosa)*cx*cx; double txy = (1-cosa)*cx*cy - sina*cz; double txz = (1-cosa)*cx*cz + sina*cy; double tyx = (1-cosa)*cy*cx + sina*cz; double tyy = cosa + (1-cosa)*cy*cy; double tyz = (1-cosa)*cy*cz - sina*cx; double tzx = (1-cosa)*cz*cx - sina*cy; double tzy = (1-cosa)*cz*cy + sina*cx; double tzz = cosa + (1-cosa)*cz*cz; double tdx = p1.x(), tdy = p1.y(), tdz = p1.z(); setTransform(txx, txy, txz, tdx-txx*tdx-txy*tdy-txz*tdz, tyx, tyy, tyz, tdy-tyx*tdx-tyy*tdy-tyz*tdz, tzx, tzy, tzz, tdz-tzx*tdx-tzy*tdy-tzz*tdz); } } // 3 D R E F L E C T I O N --------------------------------------------- Reflect3D::Reflect3D(double a, double b, double c, double d) /*********************************************************************** * * * Name: Reflect3D::Reflect3D Date: 24.09.96 * * Author: E.Chernyaev (IHEP/Protvino) Revised: * * * * Function: Create 3D Reflection in a plane a*x + b*y + c*z + d = 0 * * * ***********************************************************************/ { double ll = a*a+b*b+c*c; if (ll == 0) { std::cerr << "Reflect3D: zero normal" << std::endl; setIdentity(); }else{ ll = 1/ll; double aa = a*a*ll, ab = a*b*ll, ac = a*c*ll, ad = a*d*ll, bb = b*b*ll, bc = b*c*ll, bd = b*d*ll, cc = c*c*ll, cd = c*d*ll; setTransform(-aa+bb+cc, -ab-ab, -ac-ac, -ad-ad, -ab-ab, aa-bb+cc, -bc-bc, -bd-bd, -ac-ac, -bc-bc, aa+bb-cc, -cd-cd); } } } /* namespace HepGeom */ clhep-2.1.4.1.orig/Geometry/src/.cvsignore0000755000175000017500000000001407705453233016765 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Geometry/src/Plane3D.cc0000755000175000017500000000214607716514316016534 0ustar olesoles// -*- C++ -*- // $Id: Plane3D.cc,v 1.4 2003/08/13 20:00:11 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // Hep geometrical 3D Plane class // // Author: Evgeni Chernyaev // // History: // 22.09.96 E.Chernyaev - initial version // 19.10.96 J.Allison - added == and <<. // 15.04.03 E.Chernyaev - CLHEP-1.9: template version #include #include "CLHEP/Geometry/defs.h" #include "CLHEP/Geometry/Plane3D.h" namespace HepGeom { //-------------------------------------------------------------------------- std::ostream & operator<<(std::ostream & os, const Plane3D & p) { return os << '(' << p.a() << ',' << p.b() << ',' << p.c() << ',' << p.d() << ')'; } //-------------------------------------------------------------------------- std::ostream & operator<<(std::ostream & os, const Plane3D & p) { return os << '(' << p.a() << ',' << p.b() << ',' << p.c() << ',' << p.d() << ')'; } } /* namespace HepGeom */ clhep-2.1.4.1.orig/Geometry/src/CMakeLists.txt0000644000175000017500000000023511606714767017536 0ustar olesoles clhep_build_library( Geometry BasicVector3D.cc Normal3D.cc Plane3D.cc Point3D.cc Transform3D.cc Vector3D.cc ) clhep-2.1.4.1.orig/Geometry/src/Point3D.cc0000755000175000017500000000342307716514316016565 0ustar olesoles// -*- C++ -*- // $Id: Point3D.cc,v 1.3 2003/08/13 20:00:11 garren Exp $ // --------------------------------------------------------------------------- #include "CLHEP/Geometry/defs.h" #include "CLHEP/Geometry/Point3D.h" #include "CLHEP/Geometry/Transform3D.h" namespace HepGeom { //-------------------------------------------------------------------------- Point3D & Point3D::transform(const Transform3D & m) { double vx = x(), vy = y(), vz = z(); set(m.xx()*vx + m.xy()*vy + m.xz()*vz + m.dx(), m.yx()*vx + m.yy()*vy + m.yz()*vz + m.dy(), m.zx()*vx + m.zy()*vy + m.zz()*vz + m.dz()); return *this; } //-------------------------------------------------------------------------- Point3D operator*(const Transform3D & m, const Point3D & v) { double vx = v.x(), vy = v.y(), vz = v.z(); return Point3D (m.xx()*vx + m.xy()*vy + m.xz()*vz + m.dx(), m.yx()*vx + m.yy()*vy + m.yz()*vz + m.dy(), m.zx()*vx + m.zy()*vy + m.zz()*vz + m.dz()); } //-------------------------------------------------------------------------- Point3D & Point3D::transform(const Transform3D & m) { double vx = x(), vy = y(), vz = z(); set(m.xx()*vx + m.xy()*vy + m.xz()*vz + m.dx(), m.yx()*vx + m.yy()*vy + m.yz()*vz + m.dy(), m.zx()*vx + m.zy()*vy + m.zz()*vz + m.dz()); return *this; } //-------------------------------------------------------------------------- Point3D operator*(const Transform3D & m, const Point3D & v) { double vx = v.x(), vy = v.y(), vz = v.z(); return Point3D (m.xx()*vx + m.xy()*vy + m.xz()*vz + m.dx(), m.yx()*vx + m.yy()*vy + m.yz()*vz + m.dy(), m.zx()*vx + m.zy()*vy + m.zz()*vz + m.dz()); } } /* namespace HepGeom */ clhep-2.1.4.1.orig/Geometry/src/BasicVector3D.cc0000755000175000017500000002352311753240470017674 0ustar olesoles// -*- C++ -*- // $Id: BasicVector3D.cc,v 1.3 2003/08/13 20:00:11 garren Exp $ // --------------------------------------------------------------------------- #include #include #include #include "CLHEP/Geometry/defs.h" #include "CLHEP/Geometry/BasicVector3D.h" namespace HepGeom { //-------------------------------------------------------------------------- template<> float BasicVector3D::pseudoRapidity() const { float ma = mag(), dz = z(); if (ma == 0) return 0; if (ma == dz) return FLT_MAX; if (ma == -dz) return -FLT_MAX; return 0.5*std::log((ma+dz)/(ma-dz)); } //-------------------------------------------------------------------------- template<> void BasicVector3D::setEta(float a) { double ma = mag(); if (ma == 0) return; double tanHalfTheta = std::exp(-a); double tanHalfTheta2 = tanHalfTheta * tanHalfTheta; double cosTheta1 = (1 - tanHalfTheta2) / (1 + tanHalfTheta2); double rh = ma * std::sqrt(1 - cosTheta1*cosTheta1); double ph = phi(); set(rh*std::cos(ph), rh*std::sin(ph), ma*cosTheta1); } //-------------------------------------------------------------------------- template<> float BasicVector3D::angle(const BasicVector3D & v) const { double cosa = 0; double ptot = mag()*v.mag(); if(ptot > 0) { cosa = dot(v)/ptot; if(cosa > 1) cosa = 1; if(cosa < -1) cosa = -1; } return std::acos(cosa); } //-------------------------------------------------------------------------- template<> BasicVector3D & BasicVector3D::rotateX(float a) { double sina = std::sin(a), cosa = std::cos(a), dy = y(), dz = z(); setY(dy*cosa-dz*sina); setZ(dz*cosa+dy*sina); return *this; } //-------------------------------------------------------------------------- template<> BasicVector3D & BasicVector3D::rotateY(float a) { double sina = std::sin(a), cosa = std::cos(a), dz = z(), dx = x(); setZ(dz*cosa-dx*sina); setX(dx*cosa+dz*sina); return *this; } //-------------------------------------------------------------------------- template<> BasicVector3D & BasicVector3D::rotateZ(float a) { double sina = std::sin(a), cosa = std::cos(a), dx = x(), dy = y(); setX(dx*cosa-dy*sina); setY(dy*cosa+dx*sina); return *this; } //-------------------------------------------------------------------------- template<> BasicVector3D & BasicVector3D::rotate(float a, const BasicVector3D & v) { if (a == 0) return *this; double cx = v.x(), cy = v.y(), cz = v.z(); double ll = std::sqrt(cx*cx + cy*cy + cz*cz); if (ll == 0) { std::cerr << "BasicVector::rotate() : zero axis" << std::endl; return *this; } double cosa = std::cos(a), sina = std::sin(a); cx /= ll; cy /= ll; cz /= ll; double xx = cosa + (1-cosa)*cx*cx; double xy = (1-cosa)*cx*cy - sina*cz; double xz = (1-cosa)*cx*cz + sina*cy; double yx = (1-cosa)*cy*cx + sina*cz; double yy = cosa + (1-cosa)*cy*cy; double yz = (1-cosa)*cy*cz - sina*cx; double zx = (1-cosa)*cz*cx - sina*cy; double zy = (1-cosa)*cz*cy + sina*cx; double zz = cosa + (1-cosa)*cz*cz; cx = x(); cy = y(); cz = z(); set(xx*cx+xy*cy+xz*cz, yx*cx+yy*cy+yz*cz, zx*cx+zy*cy+zz*cz); return *this; } //-------------------------------------------------------------------------- std::ostream & operator<<(std::ostream & os, const BasicVector3D & a) { return os << "(" << a.x() << "," << a.y() << "," << a.z() << ")"; } //-------------------------------------------------------------------------- std::istream & operator>> (std::istream & is, BasicVector3D & a) { // Required format is ( a, b, c ) that is, three numbers, preceded by // (, followed by ), and separated by commas. The three numbers are // taken as x, y, z. float x, y, z; char c; is >> std::ws >> c; // ws is defined to invoke eatwhite(istream & ) // see (Stroustrup gray book) page 333 and 345. if (is.fail() || c != '(' ) { std::cerr << "Could not find required opening parenthesis " << "in input of a BasicVector3D" << std::endl; return is; } is >> x >> std::ws >> c; if (is.fail() || c != ',' ) { std::cerr << "Could not find x value and required trailing comma " << "in input of a BasicVector3D" << std::endl; return is; } is >> y >> std::ws >> c; if (is.fail() || c != ',' ) { std::cerr << "Could not find y value and required trailing comma " << "in input of a BasicVector3D" << std::endl; return is; } is >> z >> std::ws >> c; if (is.fail() || c != ')' ) { std::cerr << "Could not find z value and required close parenthesis " << "in input of a BasicVector3D" << std::endl; return is; } a.setX(x); a.setY(y); a.setZ(z); return is; } //-------------------------------------------------------------------------- template<> double BasicVector3D::pseudoRapidity() const { double ma = mag(), dz = z(); if (ma == 0) return 0; if (ma == dz) return DBL_MAX; if (ma == -dz) return -DBL_MAX; return 0.5*std::log((ma+dz)/(ma-dz)); } //-------------------------------------------------------------------------- template<> void BasicVector3D::setEta(double a) { double ma = mag(); if (ma == 0) return; double tanHalfTheta = std::exp(-a); double tanHalfTheta2 = tanHalfTheta * tanHalfTheta; double cosTheta1 = (1 - tanHalfTheta2) / (1 + tanHalfTheta2); double rh = ma * std::sqrt(1 - cosTheta1*cosTheta1); double ph = phi(); set(rh*std::cos(ph), rh*std::sin(ph), ma*cosTheta1); } //-------------------------------------------------------------------------- template<> double BasicVector3D::angle(const BasicVector3D & v) const { double cosa = 0; double ptot = mag()*v.mag(); if(ptot > 0) { cosa = dot(v)/ptot; if(cosa > 1) cosa = 1; if(cosa < -1) cosa = -1; } return std::acos(cosa); } //-------------------------------------------------------------------------- template<> BasicVector3D & BasicVector3D::rotateX(double a) { double sina = std::sin(a), cosa = std::cos(a), dy = y(), dz = z(); setY(dy*cosa-dz*sina); setZ(dz*cosa+dy*sina); return *this; } //-------------------------------------------------------------------------- template<> BasicVector3D & BasicVector3D::rotateY(double a) { double sina = std::sin(a), cosa = std::cos(a), dz = z(), dx = x(); setZ(dz*cosa-dx*sina); setX(dx*cosa+dz*sina); return *this; } //-------------------------------------------------------------------------- template<> BasicVector3D & BasicVector3D::rotateZ(double a) { double sina = std::sin(a), cosa = std::cos(a), dx = x(), dy = y(); setX(dx*cosa-dy*sina); setY(dy*cosa+dx*sina); return *this; } //-------------------------------------------------------------------------- template<> BasicVector3D & BasicVector3D::rotate(double a, const BasicVector3D & v) { if (a == 0) return *this; double cx = v.x(), cy = v.y(), cz = v.z(); double ll = std::sqrt(cx*cx + cy*cy + cz*cz); if (ll == 0) { std::cerr << "BasicVector::rotate() : zero axis" << std::endl; return *this; } double cosa = std::cos(a), sina = std::sin(a); cx /= ll; cy /= ll; cz /= ll; double xx = cosa + (1-cosa)*cx*cx; double xy = (1-cosa)*cx*cy - sina*cz; double xz = (1-cosa)*cx*cz + sina*cy; double yx = (1-cosa)*cy*cx + sina*cz; double yy = cosa + (1-cosa)*cy*cy; double yz = (1-cosa)*cy*cz - sina*cx; double zx = (1-cosa)*cz*cx - sina*cy; double zy = (1-cosa)*cz*cy + sina*cx; double zz = cosa + (1-cosa)*cz*cz; cx = x(); cy = y(); cz = z(); set(xx*cx+xy*cy+xz*cz, yx*cx+yy*cy+yz*cz, zx*cx+zy*cy+zz*cz); return *this; } //-------------------------------------------------------------------------- std::ostream & operator<< (std::ostream & os, const BasicVector3D & a) { return os << "(" << a.x() << "," << a.y() << "," << a.z() << ")"; } //-------------------------------------------------------------------------- std::istream & operator>> (std::istream & is, BasicVector3D & a) { // Required format is ( a, b, c ) that is, three numbers, preceded by // (, followed by ), and separated by commas. The three numbers are // taken as x, y, z. double x, y, z; char c; is >> std::ws >> c; // ws is defined to invoke eatwhite(istream & ) // see (Stroustrup gray book) page 333 and 345. if (is.fail() || c != '(' ) { std::cerr << "Could not find required opening parenthesis " << "in input of a BasicVector3D" << std::endl; return is; } is >> x >> std::ws >> c; if (is.fail() || c != ',' ) { std::cerr << "Could not find x value and required trailing comma " << "in input of a BasicVector3D" << std::endl; return is; } is >> y >> std::ws >> c; if (is.fail() || c != ',' ) { std::cerr << "Could not find y value and required trailing comma " << "in input of a BasicVector3D" << std::endl; return is; } is >> z >> std::ws >> c; if (is.fail() || c != ')' ) { std::cerr << "Could not find z value and required close parenthesis " << "in input of a BasicVector3D" << std::endl; return is; } a.setX(x); a.setY(y); a.setZ(z); return is; } } /* namespace HepGeom */ clhep-2.1.4.1.orig/makeSourceDist.in0000755000175000017500000000130007714500247015652 0ustar olesoles#!/bin/sh # make source code tarballs # This script assumes that the bootstrap script has already been run successfully. # makeSourceDist if [ ! -d @top_srcdir@ ] then echo "@top_srcdir@ does not exist" exit 1 fi if [ ! -d $1 ] then echo "$1 does not exist" exit 1 fi ##set -x # make sure we have the full paths thisdir=`pwd` cd @top_srcdir@/..; srccodedir=`pwd` cd $thisdir cd $1; tardir=`pwd` cd $srccodedir; tar -zcf $tardir/clhep-@VERSION@-src.tgz CLHEP for pkg in `ls $srccodedir/CLHEP` do if [ -e $srccodedir/CLHEP/$pkg/configure.in ] then cd $srccodedir; tar -zcf $tardir/clhep-$pkg-@VERSION@-src.tgz CLHEP/$pkg fi done clhep-2.1.4.1.orig/INSTALL.autoconf0000644000175000017500000001042211761764734015262 0ustar olesoles#------------------------------------------------------------- # building CLHEP with configure #------------------------------------------------------------- Although it may be possible to build the HepMC libraries from this directory, we recommend that you create a separate build directory and work from there. Cmake is now the preferred build option - see INSTALL.cmake You MUST use cmake when building with clang and other exotic compilers. The instructions below are for the autoconf/automake build system. #------------------------------------------------------------- # platform specific issues #------------------------------------------------------------- This package requires autoconf 2.59 or later and automake 1.9.1 or later. #------------------------------------------------------------- # installing from a source code tar ball #------------------------------------------------------------- Unwind the source code tar ball in some relevant directory. If you see only configure.ac, and not configure, you need to run autoconf and automake: cd CLHEP ./bootstrap Determine where the files will be installed. Create a build directory that is NOT in the source code directory tree. cd /configure --prefix= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make check (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # configure options #------------------------------------------------------------- A variety of options can be given to configure. Below is a list of the options that you are likely to find most useful. --help provides a partial list of options --prefix=PREFIX install architecture-independent files in PREFIX [default is /usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [default is the same as PREFIX] --disable-shared build only static libraries --disable-static build only shared libraries --enable-exceptions use the CLHEP/Exceptions package --disable-exceptions DO NOT use the CLHEP/Exceptions package [--disable-exceptions is the default] #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are neither built nor installed automatically. Use the following commands to build and install documents: make docs make install-docs #------------------------------------------------------------- # building from svn #------------------------------------------------------------- You will need current versions of automake, autoconf, and libtool. On some machines, you will need to build them. See building autotools below. To work with a tagged branch: svn co svn+ssh://svn.cern.ch/reps/clhep/tags/CLHEP_2_1_2_2 To work with the head: svn co svn+ssh://svn.cern.ch/reps/clhep/trunk CLHEP You may also download directly from the online browser http://svnweb.cern.ch/world/wsvn/clhep/ Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building autotools #------------------------------------------------------------- If you do not have at least autoconf 2.59 and automake 1.9.1, you will need to build autoconf, automake, and libtool. On some platforms, you may also need to build m4 and texinfo. Download the relevant tarballs from gnu.org (http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/, and http://www.gnu.org/software/libtool/) Untar them in a common source code tree. Decide whether you want to install them in /usr/local or your own install directory. If you use your own install directory, use --prefix= with configure. For each autotool package: /configure [--prefix=] make make install Make sure that /bin is at the front of your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/build-clheplib.in0000755000175000017500000000623710234001037015605 0ustar olesoles#! /bin/sh # @configure_input@ # # This script creates clheplib, which provides a list of libararies to link # prefix=@prefix@ exec_prefix=@exec_prefix@ uselibdir=$exec_prefix/lib usage() { echo "Usage: ./build-clheplib " exit $1 } getdeplist() { # recursive check for library dependencies # packages are listed multiple times, but tsort takes care of this dpkg=$1 dfile=$2 oldlist=`cat $dfile` if test -f $dpkg/$dpkg-deps; then # strip out the package name and add it to $dfile newlist=`tsort $dpkg/$dpkg-deps | sed 's/CLHEP-//' | sed 's/-@VERSION@//'` echo $newlist >> $dfile # this is the recursive part for x in $newlist; do if test "$x" != "$dpkg"; then getdeplist $x $dfile fi done fi } makeliblist() { pkg=$1 pkgfile="$pkg-library-list" rm -f $pkgfile touch $pkgfile depfile="$pkg-dep-list" rm -f $depfile touch $depfile # get relevant lists if test -f $pkg/$pkg-deps; then getdeplist $pkg $depfile list=`cat $depfile` for entry in $list; do if test -f $entry/$entry-deps; then cat $entry/$entry-deps >> $pkgfile fi done fi } if test $# -eq 0; then usage 1 fi while test $# -gt 0; do sublist="$sublist $1" shift done # create the concatenated library list libfile="library-list" rm -f $libfile touch $libfile for subdir in $sublist; do if test -f $subdir/$subdir-deps; then cat $subdir/$subdir-deps >> $libfile fi done rm -f clheplib echo "#! /bin/sh" > clheplib echo "# " >> clheplib echo "# " >> clheplib echo " " >> clheplib echo "usage() " >> clheplib echo "{ " >> clheplib echo " echo \"Usage: clhepib [package]\" " >> clheplib echo " exit 1 " >> clheplib echo "} " >> clheplib echo " " >> clheplib echo "if test \$# -eq 0; then " >> clheplib echo " pkg="all" " >> clheplib echo "else " >> clheplib echo " pkg=\$1 " >> clheplib echo "fi " >> clheplib echo " " >> clheplib echo "libdir=\"$uselibdir\" " >> clheplib echo "if test -n \"\$CLHEP_DIR\"; then " >> clheplib echo " libdir=\"\$CLHEP_DIR/lib\" " >> clheplib echo "fi " >> clheplib echo " " >> clheplib echo "case "\$pkg" in " >> clheplib clibs=" " tlist=`tsort $libfile` for lib in $tlist; do clibs="$clibs -l$lib" done echo "all) " >> clheplib echo " if test -f \$libdir/libCLHEP-@VERSION@.a || test -f \$libdir/libCLHEP-@VERSION@.so " >> clheplib echo " then " >> clheplib echo " echo -L\$libdir -lCLHEP-@VERSION@ " >> clheplib echo " else " >> clheplib echo " echo -L\$libdir $clibs" >> clheplib echo " fi " >> clheplib echo " ;; " >> clheplib for sub in $sublist; do if test -f $sub/$sub-deps; then makeliblist $sub tlist=`tsort $pkg-library-list` clibs=" " for lib in $tlist; do clibs="$clibs -l$lib" done echo "$sub) " >> clheplib echo " echo -L\$libdir $clibs" >> clheplib echo " ;; " >> clheplib else echo "$sub) " >> clheplib echo " echo -L\$libdir " >> clheplib echo " ;; " >> clheplib fi done echo "*) " >> clheplib echo " echo unknown package \$pkg " >> clheplib echo " ;; " >> clheplib echo "esac " >> clheplib echo " " >> clheplib echo "exit 0 " >> clheplib chmod +x clheplib exit 0 clhep-2.1.4.1.orig/build-header.in0000644000175000017500000000304711607115601015254 0ustar olesoles#! /bin/sh # @configure_input@ # # This script creates ClhepVersion.h # rm -f ClhepVersion.h VERSION="@VERSION@" # decode the version number v1=`echo $VERSION | awk -F\. '{ print $1 }'` v2=`echo $VERSION | awk -F\. '{ print $2 }'` v3=`echo $VERSION | awk -F\. '{ print $3 }'` v4=`echo $VERSION | awk -F\. '{ print $4 }'` rm -f ClhepVersion.h echo "#ifndef CLHEP_VERSION_H" >> ClhepVersion.h echo "#define CLHEP_VERSION_H 1" >> ClhepVersion.h echo "//" >> ClhepVersion.h echo "// ClhepVersion.h" >> ClhepVersion.h echo "//" >> ClhepVersion.h echo "// Sample Usage:" >> ClhepVersion.h echo "// std::string version = CLHEP::Version::String()" >> ClhepVersion.h echo "// int mjr = CLHEP::Version::Major();" >> ClhepVersion.h echo "//" >> ClhepVersion.h echo "" >> ClhepVersion.h echo "#include " >> ClhepVersion.h echo "" >> ClhepVersion.h echo "namespace CLHEP {" >> ClhepVersion.h echo "" >> ClhepVersion.h echo " struct Version {" >> ClhepVersion.h echo "" >> ClhepVersion.h echo " static std::string String() { return \"$VERSION\"; }" >> ClhepVersion.h echo " static int Major() { return $v1; }" >> ClhepVersion.h echo " static int SubMajor() { return $v2; }" >> ClhepVersion.h echo " static int Minor() { return $v3; }" >> ClhepVersion.h echo " static int SubMinor() { return $v4; }" >> ClhepVersion.h echo "" >> ClhepVersion.h echo " };" >> ClhepVersion.h echo "" >> ClhepVersion.h echo "} // namespace" >> ClhepVersion.h echo "" >> ClhepVersion.h echo "#endif // CLHEP_VERSION_H" >> ClhepVersion.h exit 0 clhep-2.1.4.1.orig/README0000755000175000017500000000140411761764734013277 0ustar olesolesFull information on CLHEP is available on the WEB: http://cern.ch/clhep #------------------------------------------------------------- # about linking #------------------------------------------------------------- CLHEP builds libraries for each package in addition to a single CLHEP library. This alllows you to link with only the necessary parts of CLHEP. We provide a set of -config scripts which gives the list of libraries to link, in the correct order. The script can be embedded in a makefile. clhep-config --libs - link list of ALL CLHEP libraries -config --libs - link list of ONLY those libraries needed to use #------------------------------------------------------------- clhep-2.1.4.1.orig/Units/0000755000175000017500000000000012242515144013477 5ustar olesolesclhep-2.1.4.1.orig/Units/INSTALL0000755000175000017500000000772111406203315014535 0ustar olesoles#------------------------------------------------------------- # platform specific issues #------------------------------------------------------------- This package requires autoconf 2.59 or later and automake 1.9.1 or later. If you bootstrap, you will probably have to build these yourself. See "building autotools" below. The new libtool no longer properly supports shared libraries for gcc 2.95.2. If you build CLHEP with gcc 2.95.2, you must configure --disable-shared. To build for Solaris CC, configure with CXX=CC CC=cc and use gmake. On MacOSX, you need to define MACOSX_DEPLOYMENT_TARGET appropriately. For instance, set MACOSX_DEPLOYMENT_TARGET to "10.4" if you have MacOS 10.4 installed on your system. #------------------------------------------------------------- # installing from a source code tar ball #------------------------------------------------------------- Unwind the source code tar ball in some relevant directory. Autoconf and automake will aready have been run. Determine where the files will be installed. Create a build directory that is NOT in the source code directory tree. cd /configure --prefix= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make check (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # configure options #------------------------------------------------------------- A variety of options can be given to configure. Below is a list of the options that you are likely to find most useful. --help provides a partial list of options --prefix=PREFIX install architecture-independent files in PREFIX [default is /usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [default is the same as PREFIX] --disable-shared build only static libraries --disable-static build only shared libraries --enable-exceptions use the CLHEP/Exceptions package --disable-exceptions DO NOT use the CLHEP/Exceptions package [--disable-exceptions is the default] #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are neither built nor installed automatically. Use the following commands to build and install documents: make docs make install-docs #------------------------------------------------------------- # building from cvs #------------------------------------------------------------- You will need current versions of automake, autoconf, and libtool. See building autotools below. cvs co CLHEP/package OR cvs co package cd [CLHEP/]package ./bootstrap Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building autotools #------------------------------------------------------------- If you do not have at least autoconf 2.59 and automake 1.9.1, you will need to build autoconf, automake, and libtool. On some platforms, you may also need to build m4 and texinfo. Download the relevant tarballs from gnu.org (http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/, and http://www.gnu.org/software/libtool/) Untar them in a common source code tree. Decide whether you want to install them in /usr/local or your own install directory. If you use your own install directory, use --prefix= with configure. For each autotool package: /configure [--prefix=] make make install Make sure that /bin is at the front of your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/Units/Makefile.am0000755000175000017500000000445710233777060015555 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP # put . first so that CLHEP directory is built before anything else SUBDIRS = Units . test # list all subdirectories - for distribution and cleaning DIST_SUBDIRS = Units . test doc bin_SCRIPTS = Units-config all-local: $(top_builddir)/CLHEP # create temporary CLHEP header tree # we only copy headers for packages listed in @PACKAGE@-deps # search for header directories in the following order: # 1. $(top_builddir)/this-package # 2. $(top_builddir)/../other-packages # 3. $(CLHEPSOURCE_DIR)/CLHEP # 4. $(CLHEP_DIR)/include/CLHEP # # abs_ => absolute path abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ COPY_P = @COPY_P@ $(top_builddir)/CLHEP: temp-package-dirs @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ if test -d "$$pkg" ; then \ (cd $$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d ../"$$pkg"/"$$pkg" ; then \ (cd ../$$pkg/$$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg"; then \ hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ else \ if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/include/CLHEP; then \ if test -d $(CLHEP_DIR)/include/CLHEP/"$$pkg"; then \ hdrs=`ls $(CLHEP_DIR)/include/CLHEP/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEP_DIR)/include/CLHEP/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ fi; \ fi; \ fi; \ fi; \ fi; \ done; temp-package-dirs: $(mkinstalldirs) $(abs_top_builddir)/CLHEP; @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ $(mkinstalldirs) $(abs_top_builddir)/CLHEP/$$pkg; \ done; docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs # extra clean rule clean-local: rm -rf $(top_builddir)/CLHEP clhep-2.1.4.1.orig/Units/bootstrap0000755000175000017500000000071510233777060015452 0ustar olesoles#! /bin/sh set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 rm -f Makefile.in */Makefile.in */defs.h.in rm -f autotools/config* autotools/depcomp autotools/install-sh autotools/m* rm -f configure config.* # run autotool commands aclocal -I autotools autoheader automake --add-missing --copy autoconf # ready to make a source code distribution tarball clhep-2.1.4.1.orig/Units/configure.ac0000755000175000017500000002657112241267303016003 0ustar olesoles# ====================================================================== # This is the Units configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.59) AC_INIT(CLHEP Units, 2.1.4.1, http://savannah.cern.ch/projects/clhep/, Units) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # ---------------------------------------------------------------------- # --enable-shared and --enable-static # both shared and static libraries are built by default # ---------------------------------------------------------------------- AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Header containing #defines: AM_CONFIG_HEADER([Units/defs.h]) # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Units/Makefile]) AC_CONFIG_FILES([doc/Makefile]) AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([Units-deps]) AC_CONFIG_FILES([Units/copy-header.pl], [chmod +x Units/copy-header.pl]) # Configuration inquiry program/script: AC_CONFIG_FILES([Units-config], [chmod +x Units-config]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- Units_CPPFLAGS="-I$includedir" Units_LDFLAGS=" " Units_LIBS=" " AC_SUBST(Units_CPPFLAGS) AC_SUBST(Units_LIBS) AC_SUBST(Units_LDFLAGS) # ---------------------------------------------------------------------- # Supply boilerplate for Units/defs.h source header: # ---------------------------------------------------------------------- AH_TOP([#ifndef UNITS_DEFS_H #define UNITS_DEFS_H]) ## the undefs are converted by configure AH_VERBATIM([PACKAGE],[/* Name of package */ #ifndef PACKAGE #undef PACKAGE #endif]) AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif]) AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */ #ifndef PACKAGE_NAME #undef PACKAGE_NAME #endif]) AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #undef PACKAGE_STRING #endif]) AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif]) AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */ #ifndef PACKAGE_VERSION #undef PACKAGE_VERSION #endif]) AH_VERBATIM([VERSION],[/* Version number of package */ #ifndef VERSION #undef VERSION #endif]) AH_BOTTOM([#endif // UNITS_DEFS_H]) # ---------------------------------------------------------------------- # Account for any user configuration options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; icc) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" MY_SHFLAGS="-fPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Set system-dependent options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed libraries: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed header files: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed typedefs, structures, and compiler characteristics: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed library functions: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/Units/COPYING.LESSER0000644000175000017500000001674311406203315015534 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/Units/Units/0000755000175000017500000000000012242515143014600 5ustar olesolesclhep-2.1.4.1.orig/Units/Units/cmake-defs.h.in0000644000175000017500000000172511607115601017361 0ustar olesoles/* @PACKAGE@/defs.h Generated by cmake. */ #ifndef @UPACKAGE@_DEFS_H #define @UPACKAGE@_DEFS_H /* Name of package */ #ifndef PACKAGE #define PACKAGE "@PACKAGE@" #endif /* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #define PACKAGE_BUGREPORT "http://savannah.cern.ch/projects/clhep/" #endif /* Define to the full name of this package. */ #ifndef PACKAGE_NAME #define PACKAGE_NAME "@PROJECT_NAME@ @PACKAGE@" #endif /* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #define PACKAGE_STRING "@PROJECT_NAME@ @PACKAGE@ @VERSION@" #endif /* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #define PACKAGE_TARNAME "@PACKAGE@" #endif /* Define to the version of this package. */ #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "@VERSION@" #endif /* Version number of package */ #ifndef VERSION #define VERSION "@VERSION@" #endif #endif // @UPACKAGE@_DEFS_H clhep-2.1.4.1.orig/Units/Units/copy-header.pl.in0000755000175000017500000000164110043345767017761 0ustar olesoles#!/usr/bin/env perl # # copy a header into the temporary CLHEP header tree if # a) the header is not already there # b) the source is newer # if ($#ARGV != 1) { print "mungeit requires two arguments - exit\n"; exit; } else { $source_header=$ARGV[0]; $dest_header=$ARGV[1]; &check_header; } exit; sub check_header { # make sure source exists if ( ! -e $source_header ) { print "$source_header does not exist - exit\n"; exit; } # copy if not already there - otherwise, check the time stamp if ( ! -e $dest_header ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } else { $source_header_time = -M $source_header; $dest_header_time = -M $dest_header; # copy only if source is newer if( $source_header_time < $dest_header_time ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } } } clhep-2.1.4.1.orig/Units/Units/Makefile.am0000755000175000017500000000142710233777060016651 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@ pkginclude_HEADERS = \ GlobalPhysicalConstants.h \ GlobalSystemOfUnits.h \ PhysicalConstants.h \ SystemOfUnits.h \ defs.h # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = defs.h # copy headers into $(tempincludedir) install-tmpHEADERS: @echo " install headers in $(tempincludedir) " @list='$(pkginclude_HEADERS)'; \ if test $(tempincludedir); then \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ ./copy-header.pl $$d$$p $(tempincludedir)/$$f; \ done; \ fi; test -z "$$fail" clhep-2.1.4.1.orig/Units/Units/GlobalPhysicalConstants.h0000644000175000017500000000155310233777060021555 0ustar olesoles #include "CLHEP/Units/PhysicalConstants.h" using CLHEP::pi; using CLHEP::twopi; using CLHEP::halfpi; using CLHEP::pi2; using CLHEP::Avogadro; using CLHEP::c_light; using CLHEP::c_squared; using CLHEP::h_Planck; using CLHEP::hbar_Planck; using CLHEP::hbarc; using CLHEP::hbarc_squared; using CLHEP::electron_charge; using CLHEP::e_squared; using CLHEP::electron_mass_c2; using CLHEP::proton_mass_c2; using CLHEP::neutron_mass_c2; using CLHEP::amu_c2; using CLHEP::amu; using CLHEP::mu0; using CLHEP::epsilon0; using CLHEP::elm_coupling; using CLHEP::fine_structure_const; using CLHEP::classic_electr_radius; using CLHEP::electron_Compton_length; using CLHEP::Bohr_radius; using CLHEP::alpha_rcl2; using CLHEP::twopi_mc2_rcl2; using CLHEP::k_Boltzmann; using CLHEP::STP_Temperature; using CLHEP::STP_Pressure; using CLHEP::kGasThreshold; using CLHEP::universe_mean_density; clhep-2.1.4.1.orig/Units/Units/PhysicalConstants.h0000755000175000017500000000772311406203315020432 0ustar olesoles// -*- C++ -*- // $Id: PhysicalConstants.h,v 1.4 2010/06/16 17:12:28 garren Exp $ // ---------------------------------------------------------------------- // HEP coherent Physical Constants // // This file has been provided by Geant4 (simulation toolkit for HEP). // // The basic units are : // millimeter // nanosecond // Mega electron Volt // positon charge // degree Kelvin // amount of substance (mole) // luminous intensity (candela) // radian // steradian // // Below is a non exhaustive list of Physical CONSTANTS, // computed in the Internal HEP System Of Units. // // Most of them are extracted from the Particle Data Book : // Phys. Rev. D volume 50 3-1 (1994) page 1233 // // ...with a meaningful (?) name ... // // You can add your own constants. // // Author: M.Maire // // History: // // 23.02.96 Created // 26.03.96 Added constants for standard conditions of temperature // and pressure; also added Gas threshold. // 29.04.08 use PDG 2006 values // 03.11.08 use PDG 2008 values #ifndef HEP_PHYSICAL_CONSTANTS_H #define HEP_PHYSICAL_CONSTANTS_H #include "CLHEP/Units/defs.h" #include "CLHEP/Units/SystemOfUnits.h" namespace CLHEP { // // // static const double pi = 3.14159265358979323846; static const double twopi = 2*pi; static const double halfpi = pi/2; static const double pi2 = pi*pi; // // // static const double Avogadro = 6.02214179e+23/mole; // // c = 299.792458 mm/ns // c^2 = 898.7404 (mm/ns)^2 // static const double c_light = 2.99792458e+8 * m/s; static const double c_squared = c_light * c_light; // // h = 4.13566e-12 MeV*ns // hbar = 6.58212e-13 MeV*ns // hbarc = 197.32705e-12 MeV*mm // static const double h_Planck = 6.62606896e-34 * joule*s; static const double hbar_Planck = h_Planck/twopi; static const double hbarc = hbar_Planck * c_light; static const double hbarc_squared = hbarc * hbarc; // // // static const double electron_charge = - eplus; // see SystemOfUnits.h static const double e_squared = eplus * eplus; // // amu_c2 - atomic equivalent mass unit // - AKA, unified atomic mass unit (u) // amu - atomic mass unit // static const double electron_mass_c2 = 0.510998910 * MeV; static const double proton_mass_c2 = 938.272013 * MeV; static const double neutron_mass_c2 = 939.56536 * MeV; static const double amu_c2 = 931.494028 * MeV; static const double amu = amu_c2/c_squared; // // permeability of free space mu0 = 2.01334e-16 Mev*(ns*eplus)^2/mm // permittivity of free space epsil0 = 5.52636e+10 eplus^2/(MeV*mm) // static const double mu0 = 4*pi*1.e-7 * henry/m; static const double epsilon0 = 1./(c_squared*mu0); // // electromagnetic coupling = 1.43996e-12 MeV*mm/(eplus^2) // static const double elm_coupling = e_squared/(4*pi*epsilon0); static const double fine_structure_const = elm_coupling/hbarc; static const double classic_electr_radius = elm_coupling/electron_mass_c2; static const double electron_Compton_length = hbarc/electron_mass_c2; static const double Bohr_radius = electron_Compton_length/fine_structure_const; static const double alpha_rcl2 = fine_structure_const *classic_electr_radius *classic_electr_radius; static const double twopi_mc2_rcl2 = twopi*electron_mass_c2 *classic_electr_radius *classic_electr_radius; // // // static const double k_Boltzmann = 8.617343e-11 * MeV/kelvin; // // // static const double STP_Temperature = 273.15*kelvin; static const double STP_Pressure = 1.*atmosphere; static const double kGasThreshold = 10.*mg/cm3; // // // static const double universe_mean_density = 1.e-25*g/cm3; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_PHYSICAL_CONSTANTS_H */ clhep-2.1.4.1.orig/Units/Units/.cvsignore0000755000175000017500000000002607705453233016612 0ustar olesolesMakefile.in defs.h.in clhep-2.1.4.1.orig/Units/Units/SystemOfUnits.h0000755000175000017500000002246112234521273017557 0ustar olesoles// -*- C++ -*- // $Id: SystemOfUnits.h,v 1.4 2010/06/16 17:12:28 garren Exp $ // ---------------------------------------------------------------------- // HEP coherent system of Units // // This file has been provided to CLHEP by Geant4 (simulation toolkit for HEP). // // The basic units are : // millimeter (millimeter) // nanosecond (nanosecond) // Mega electron Volt (MeV) // positron charge (eplus) // degree Kelvin (kelvin) // the amount of substance (mole) // luminous intensity (candela) // radian (radian) // steradian (steradian) // // Below is a non exhaustive list of derived and pratical units // (i.e. mostly the SI units). // You can add your own units. // // The SI numerical value of the positron charge is defined here, // as it is needed for conversion factor : positron charge = e_SI (coulomb) // // The others physical constants are defined in the header file : //PhysicalConstants.h // // Authors: M.Maire, S.Giani // // History: // // 06.02.96 Created. // 28.03.96 Added miscellaneous constants. // 05.12.97 E.Tcherniaev: Redefined pascal (to avoid warnings on WinNT) // 20.05.98 names: meter, second, gram, radian, degree // (from Brian.Lasiuk@yale.edu (STAR)). Added luminous units. // 05.08.98 angstrom, picobarn, microsecond, picosecond, petaelectronvolt // 01.03.01 parsec // 31.01.06 kilogray, milligray, microgray // 29.04.08 use PDG 2006 value of e_SI // 03.11.08 use PDG 2008 value of e_SI #ifndef HEP_SYSTEM_OF_UNITS_H #define HEP_SYSTEM_OF_UNITS_H #include "CLHEP/Units/defs.h" namespace CLHEP { // // Length [L] // static const double millimeter = 1.; static const double millimeter2 = millimeter*millimeter; static const double millimeter3 = millimeter*millimeter*millimeter; static const double centimeter = 10.*millimeter; static const double centimeter2 = centimeter*centimeter; static const double centimeter3 = centimeter*centimeter*centimeter; static const double meter = 1000.*millimeter; static const double meter2 = meter*meter; static const double meter3 = meter*meter*meter; static const double kilometer = 1000.*meter; static const double kilometer2 = kilometer*kilometer; static const double kilometer3 = kilometer*kilometer*kilometer; static const double parsec = 3.0856775807e+16*meter; static const double micrometer = 1.e-6 *meter; static const double nanometer = 1.e-9 *meter; static const double angstrom = 1.e-10*meter; static const double fermi = 1.e-15*meter; static const double barn = 1.e-28*meter2; static const double millibarn = 1.e-3 *barn; static const double microbarn = 1.e-6 *barn; static const double nanobarn = 1.e-9 *barn; static const double picobarn = 1.e-12*barn; // symbols static const double nm = nanometer; static const double um = micrometer; static const double mm = millimeter; static const double mm2 = millimeter2; static const double mm3 = millimeter3; static const double cm = centimeter; static const double cm2 = centimeter2; static const double cm3 = centimeter3; static const double m = meter; static const double m2 = meter2; static const double m3 = meter3; static const double km = kilometer; static const double km2 = kilometer2; static const double km3 = kilometer3; static const double pc = parsec; // // Angle // static const double radian = 1.; static const double milliradian = 1.e-3*radian; static const double degree = (3.14159265358979323846/180.0)*radian; static const double steradian = 1.; // symbols static const double rad = radian; static const double mrad = milliradian; static const double sr = steradian; static const double deg = degree; // // Time [T] // static const double nanosecond = 1.; static const double second = 1.e+9 *nanosecond; static const double millisecond = 1.e-3 *second; static const double microsecond = 1.e-6 *second; static const double picosecond = 1.e-12*second; static const double hertz = 1./second; static const double kilohertz = 1.e+3*hertz; static const double megahertz = 1.e+6*hertz; // symbols static const double ns = nanosecond; static const double s = second; static const double ms = millisecond; // // Electric charge [Q] // static const double eplus = 1. ;// positron charge static const double e_SI = 1.602176487e-19;// positron charge in coulomb static const double coulomb = eplus/e_SI;// coulomb = 6.24150 e+18 * eplus // // Energy [E] // static const double megaelectronvolt = 1. ; static const double electronvolt = 1.e-6*megaelectronvolt; static const double kiloelectronvolt = 1.e-3*megaelectronvolt; static const double gigaelectronvolt = 1.e+3*megaelectronvolt; static const double teraelectronvolt = 1.e+6*megaelectronvolt; static const double petaelectronvolt = 1.e+9*megaelectronvolt; static const double joule = electronvolt/e_SI;// joule = 6.24150 e+12 * MeV // symbols static const double MeV = megaelectronvolt; static const double eV = electronvolt; static const double keV = kiloelectronvolt; static const double GeV = gigaelectronvolt; static const double TeV = teraelectronvolt; static const double PeV = petaelectronvolt; // // Mass [E][T^2][L^-2] // static const double kilogram = joule*second*second/(meter*meter); static const double gram = 1.e-3*kilogram; static const double milligram = 1.e-3*gram; // symbols static const double kg = kilogram; static const double g = gram; static const double mg = milligram; // // Power [E][T^-1] // static const double watt = joule/second;// watt = 6.24150 e+3 * MeV/ns // // Force [E][L^-1] // static const double newton = joule/meter;// newton = 6.24150 e+9 * MeV/mm // // Pressure [E][L^-3] // #define pascal hep_pascal // a trick to avoid warnings static const double hep_pascal = newton/m2; // pascal = 6.24150 e+3 * MeV/mm3 static const double bar = 100000*pascal; // bar = 6.24150 e+8 * MeV/mm3 static const double atmosphere = 101325*pascal; // atm = 6.32420 e+8 * MeV/mm3 // // Electric current [Q][T^-1] // static const double ampere = coulomb/second; // ampere = 6.24150 e+9 * eplus/ns static const double milliampere = 1.e-3*ampere; static const double microampere = 1.e-6*ampere; static const double nanoampere = 1.e-9*ampere; // // Electric potential [E][Q^-1] // static const double megavolt = megaelectronvolt/eplus; static const double kilovolt = 1.e-3*megavolt; static const double volt = 1.e-6*megavolt; // // Electric resistance [E][T][Q^-2] // static const double ohm = volt/ampere;// ohm = 1.60217e-16*(MeV/eplus)/(eplus/ns) // // Electric capacitance [Q^2][E^-1] // static const double farad = coulomb/volt;// farad = 6.24150e+24 * eplus/Megavolt static const double millifarad = 1.e-3*farad; static const double microfarad = 1.e-6*farad; static const double nanofarad = 1.e-9*farad; static const double picofarad = 1.e-12*farad; // // Magnetic Flux [T][E][Q^-1] // static const double weber = volt*second;// weber = 1000*megavolt*ns // // Magnetic Field [T][E][Q^-1][L^-2] // static const double tesla = volt*second/meter2;// tesla =0.001*megavolt*ns/mm2 static const double gauss = 1.e-4*tesla; static const double kilogauss = 1.e-1*tesla; // // Inductance [T^2][E][Q^-2] // static const double henry = weber/ampere;// henry = 1.60217e-7*MeV*(ns/eplus)**2 // // Temperature // static const double kelvin = 1.; // // Amount of substance // static const double mole = 1.; // // Activity [T^-1] // static const double becquerel = 1./second ; static const double curie = 3.7e+10 * becquerel; static const double kilobecquerel = 1.e+3*becquerel; static const double megabecquerel = 1.e+6*becquerel; static const double gigabecquerel = 1.e+9*becquerel; static const double millicurie = 1.e-3*curie; static const double microcurie = 1.e-6*curie; static const double Bq = becquerel; static const double kBq = kilobecquerel; static const double MBq = megabecquerel; static const double GBq = gigabecquerel; static const double Ci = curie; static const double mCi = millicurie; static const double uCi = microcurie; // // Absorbed dose [L^2][T^-2] // static const double gray = joule/kilogram ; static const double kilogray = 1.e+3*gray; static const double milligray = 1.e-3*gray; static const double microgray = 1.e-6*gray; // // Luminous intensity [I] // static const double candela = 1.; // // Luminous flux [I] // static const double lumen = candela*steradian; // // Illuminance [I][L^-2] // static const double lux = lumen/meter2; // // Miscellaneous // static const double perCent = 0.01 ; static const double perThousand = 0.001; static const double perMillion = 0.000001; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /* HEP_SYSTEM_OF_UNITS_H */ clhep-2.1.4.1.orig/Units/Units/GlobalSystemOfUnits.h0000644000175000017500000000473611406203315020674 0ustar olesoles #include "CLHEP/Units/SystemOfUnits.h" using CLHEP::millimeter; using CLHEP::millimeter2; using CLHEP::millimeter3; using CLHEP::centimeter; using CLHEP::centimeter2; using CLHEP::centimeter3; using CLHEP::meter; using CLHEP::meter2; using CLHEP::meter3; using CLHEP::kilometer; using CLHEP::kilometer2; using CLHEP::kilometer3; using CLHEP::parsec; using CLHEP::micrometer; using CLHEP::nanometer; using CLHEP::angstrom; using CLHEP::fermi; using CLHEP::barn; using CLHEP::millibarn; using CLHEP::microbarn; using CLHEP::nanobarn; using CLHEP::picobarn; using CLHEP::mm; using CLHEP::um; using CLHEP::nm; using CLHEP::mm2; using CLHEP::mm3; using CLHEP::cm; using CLHEP::cm2; using CLHEP::cm3; using CLHEP::m; using CLHEP::m2; using CLHEP::m3; using CLHEP::km; using CLHEP::km2; using CLHEP::km3; using CLHEP::pc; using CLHEP::radian; using CLHEP::milliradian; using CLHEP::degree; using CLHEP::steradian; using CLHEP::rad; using CLHEP::mrad; using CLHEP::sr; using CLHEP::deg; using CLHEP::nanosecond; using CLHEP::second; using CLHEP::millisecond; using CLHEP::microsecond; using CLHEP::picosecond; using CLHEP::hertz; using CLHEP::kilohertz; using CLHEP::megahertz; using CLHEP::ns; using CLHEP::s; using CLHEP::ms; using CLHEP::eplus; using CLHEP::e_SI; using CLHEP::coulomb; using CLHEP::megaelectronvolt; using CLHEP::electronvolt; using CLHEP::kiloelectronvolt; using CLHEP::gigaelectronvolt; using CLHEP::teraelectronvolt; using CLHEP::petaelectronvolt; using CLHEP::joule; using CLHEP::MeV; using CLHEP::eV; using CLHEP::keV; using CLHEP::GeV; using CLHEP::TeV; using CLHEP::PeV; using CLHEP::kilogram; using CLHEP::gram; using CLHEP::milligram; using CLHEP::kg; using CLHEP::g; using CLHEP::mg; using CLHEP::watt; using CLHEP::newton; using CLHEP::hep_pascal; using CLHEP::bar; using CLHEP::atmosphere; using CLHEP::ampere; using CLHEP::milliampere; using CLHEP::microampere; using CLHEP::nanoampere; using CLHEP::megavolt; using CLHEP::kilovolt; using CLHEP::volt; using CLHEP::ohm; using CLHEP::farad; using CLHEP::millifarad; using CLHEP::microfarad; using CLHEP::nanofarad; using CLHEP::picofarad; using CLHEP::weber; using CLHEP::tesla; using CLHEP::gauss; using CLHEP::kilogauss; using CLHEP::henry; using CLHEP::kelvin; using CLHEP::mole; using CLHEP::becquerel; using CLHEP::curie; using CLHEP::gray; using CLHEP::kilogray; using CLHEP::milligray; using CLHEP::microgray; using CLHEP::candela; using CLHEP::lumen; using CLHEP::lux; using CLHEP::perCent; using CLHEP::perThousand; using CLHEP::perMillion; clhep-2.1.4.1.orig/Units/Units/CMakeLists.txt0000644000175000017500000000036711606714767017366 0ustar olesoles set( pkginclude_HEADERS GlobalPhysicalConstants.h GlobalSystemOfUnits.h PhysicalConstants.h SystemOfUnits.h ) # notice that defs.h is not referenced here INSTALL (FILES ${pkginclude_HEADERS} DESTINATION include/CLHEP/Units ) clhep-2.1.4.1.orig/Units/doc/0000755000175000017500000000000012242515144014244 5ustar olesolesclhep-2.1.4.1.orig/Units/doc/Makefile.am0000755000175000017500000000164411406203315016303 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif TEX = latex doc_srcdir = $(top_srcdir)/doc doc_builddir = $(top_builddir)/doc doc_installdir = $(prefix)/doc/@PACKAGE@ DOC_POSTSCRIPT = Units.ps Units.pdf DOC_INCLUDES = html.sty SUFFIXES = .ps .pdf .dvi .tex .dvi.ps: dvips -o $@ $(@:.ps=.dvi) .dvi.pdf: dvipdf $(@:.pdf=.dvi) all: docs docs: get-includes $(DOC_POSTSCRIPT) get-includes: list='$(DOC_INCLUDES)'; for file in $$list; do \ if test ! -f $$file; then \ (cp $(srcdir)/$$file $(doc_builddir)/$$file); fi; done install-docs: $(mkinstalldirs) $(DESTDIR)$(doc_installdir) $(INSTALL_DATA) $(doc_builddir)/Units.ps $(DESTDIR)$(doc_installdir)/Units.ps $(INSTALL_DATA) $(doc_builddir)/Units.pdf $(DESTDIR)$(doc_installdir)/Units.pdf # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = $(DOC_POSTSCRIPT) *.aux *.log *.toc *.dvi clhep-2.1.4.1.orig/Units/doc/Units.tex0000755000175000017500000002340711406203315016074 0ustar olesoles% this is latex \documentclass{article} \usepackage{html} \setlength{\textheight}{230mm} \setlength{\topmargin}{0mm} %define page size: \setlength{\headheight}{0mm} \setlength{\headsep}{0mm} \setlength{\footskip}{12mm} \setlength{\textwidth}{160mm} \setlength{\oddsidemargin}{0mm} \setlength{\evensidemargin}{0mm} \newcommand{\lbar} {\makebox[0mm][l]{\hspace{.1em}\rule[.9ex]{.4em}{.4pt}}\lambda} \begin{document} \section*{CLHEP Units} The {\it CLHEP Units} module has been supplied by \latexonly{\tt GEANT4.} \begin{rawhtml} GEANT4. \end{rawhtml} It consists of two header files which contain definitions of some frequently used physical constants and units: \begin{latexonly} \begin{verbatim} CLHEP/Units/SystemOfUnits.h CLHEP/Units/PhysicalConstants.h \end{verbatim} \end{latexonly} \begin{rawhtml}

       CLHEP/Units/SystemOfUnits.h
       CLHEP/Units/PhysicalConstants.h
    
    \end{rawhtml} To make them available it is enough to insert in your program the following line: \begin{verbatim} #include "CLHEP/Units/PhysicalConstants.h" \end{verbatim} All constants and units are defined via few so called {\it basic} units. The following units have been choosen as {\it basic}: \begin{itemize} \item {\it millimeter} for legth \item {\it nanosecond} for time \item {\it MeV} for energy \item {\it positon charge} for electric charge \item {\it Kelvin} for temperature \item {\it mole} for amount of substance \item {\it radian} for plane angles \item {\it steradian} for solid angles \end{itemize} The {\it CLHEP Units} module can be considered as an attempt to provide a practical System of Units for HEP applications. Many standard HEP classes, for example in {\tt GEANT4} and {\tt CLHEP}, assume that data are given in the System of Units defined in the {\it CLHEP Units} module. For this reason it is recommended to define any physical data with its units, e.g. \begin{verbatim} crossection = 3.5 * barn density = 10. * g/cm3 \end{verbatim} Tables \ref{tab1} and \ref{tab2} represent physical units and physical constants defined in the {\it CLHEP Units} module. Most of the physical constants were initially taken from the Particle Data Book: {\it "Phys. Rev. D volume 50 3-1 (1994) page 1233"}. As of release 1.9.4.1/2.0.4.1, the constants have been updated to reflect the 2008 PDG values: {\it "Physics Letters B667 (2008) page 103"}. \begin{table} \centering \begin{tabular}{|l|l|l|l|} \hline \bf{Physical quantity}& \bf{{\it CLHEP Units} name}& \bf{Name of unit}&\bf{Symbol, equation}\\ \hline Length, area, volume&{\tt mm,mm2,mm3} & millimeter &$ mm,mm^2,mm^3 $\\ &{\tt cm,cm2,cm3} & centimeter &$ cm,cm^2,cm^3 $\\ &{\tt m,m2,m3} & meter &$ m,m^2,m^3 $\\ &{\tt km,km2,km3} & kilometer &$ km,km^2,km^3 $\\ &{\tt parsec} & &$pc=3.0856775807\times 10^{16}\,m$\\ &{\tt microm} & micro meter &$ $\\ &{\tt nanom} & nano meter &$ $\\ &{\tt fermi} & &$ 10^{-15}\,m $\\ &{\tt barn} & &$ 10^{-28}\,m^2 $\\ &{\tt millibarn} & &$ $\\ &{\tt microbarn} & &$ $\\ &{\tt nanobarn} & &$ $\\ Angle &{\tt rad} & radian &$ rad $\\ &{\tt mrad} & milli radian &$ $\\ &{\tt deg} & degree &$ (\pi/180)\,rad $\\ &{\tt st} & steradian &$ sr $\\ Time &{\tt s} & second &$ s $\\ &{\tt ms} & milli second &$ ms $\\ &{\tt ns} & nano second &$ ns $\\ Frequency &{\tt Hz,kHz,MHz} & hertz &$ Hz,kHz,MHz $\\ Energy &{\tt eV,keV,MeV,GeV,TeV} & electron volt&$eV,keV,MeV,GeV,TeV$\\ &{\tt joule} & &$ J=6.24150\times 10^{12}\,MeV$\\ Mass &{\tt kg} & kilogram &$ kg=J\,s^2/m^2 $\\ &{\tt g} & gram &$ g $\\ &{\tt mg} & milli gram &$ mg $\\ Force &{\tt newton} & &$ N $\\ Power &{\tt watt} & &$ W $\\ Pressure &{\tt pascal} & pascal &$ Pa $\\ &{\tt bar} & &$ 10^5 \, Pa $\\ &{\tt atmosphere} & &$ 1.01325\times 10^5\,Pa $\\ Electric charge &{\tt eplus} &positon charge&$ e $\\ &{\tt coulomb} & &$ C=6.24150\times10^{18}\,e $\\ Electric current &{\tt ampere} & &$ A $\\ Electric potential &{\tt volt} & &$ V $\\ &{\tt kilovolt} & &$ kV $\\ &{\tt Megavolt} & &$ MV $\\ Electric resistence&{\tt ohm} & &$ \Omega $\\ Electric capacitance&{\tt farad} & &$ F $\\ &{\tt millifarad} & &$ mF $\\ &{\tt microfarad} & &$ \mu F $\\ &{\tt nanofarad} & &$ nF $\\ &{\tt picofarad} & &$ pF $\\ Magnetic flux &{\tt weber} & &$ Wb $\\ Magnetic field &{\tt tesla} & &$ T $\\ &{\tt gauss} & &$ G=10^{-4}\,T $\\ &{\tt kilogauss} & &$ kG $\\ Inductance &{\tt henry} & &$ H $\\ Temperature &{\tt kelvin} & &$ K $\\ Amount of substance&{\tt mole} & &$ mol $\\ Activity &{\tt becquerel} & &$ Bq $\\ &{\tt curie} & &$ 3.7\times10^{10}\,Bq $\\ Absorbed Dose &{\tt gray} & &$ Gy $\\ \hline \end {tabular} \caption{Physical units defined in the {\it CLHEP Units} module} \label{tab1} \end{table} \begin{table} \centering \begin{tabular}{|l|l|l|} \hline \bf{Physical quantity} &\bf{{\it CLHEP Units} name}&\bf{Symbol, equation} \\ \hline positon charge in coulomb &{\tt e\_{}SI} &$ 1.602176487\times10^{-19}$\\ speed of light in vacuum &{\tt c\_{}light} &$ c $\\ &{\tt c\_{}squared} &$ c^2 $\\ Plank constant &{\tt h\_{}Planck} &$ h $\\ Plank constant, reduced &{\tt hbar\_{}Planck} &$ \hbar $\\ &{\tt hbarc} &$ \hbar\,c $\\ &{\tt hbarc\_{}squared}&$ (\hbar\,c)^2 $\\ electron charge &{\tt electron\_{}charge}&$ -e $\\ &{\tt e\_{}squared} &$ e^2 $\\ atomic equivalent mass unit&{\tt amu\_{}c2} &$ 931.494028\,MeV $\\ atomic mass unit &{\tt amu} & \\ electron mass &{\tt electron\_{}mass\_{}c2}&$ m_e\,c^2 $\\ proton mass &{\tt proton\_{}mass\_{}c2} &$ m_p\,c^2 $\\ neutron mass &{\tt neutron\_{}mass\_{}c2} &$ m_n\,c^2 $\\ permeability of free space&{\tt mu0} &$ \mu_0 $\\ permittivity of free space&{\tt epsilon0} &$ \epsilon_0 $\\ electromagnetic coupling &{\tt elm\_{}coupling} &$ e^2/4\pi\epsilon_0 $\\ fine-structure constant &{\tt fine\_{}structure\_{}const} &$ \alpha $\\ classical electron radius &{\tt classic\_{}electr\_{}radius}&$ r_e $\\ electron Compton wavelength&{\tt electron\_{}Compton\_{}length}&$ \lbar_e $\\ Bohr\_{}radius &{\tt Bohr\_{}radius} &$ a_\infty $\\ &{\tt alpha\_{}rcl2} &$ \alpha\,r_e^2 $\\ &{\tt twopi\_{}mc2\_{}rcl2}&$ 2\pi\,m_e\,c^2\,r_e^2$\\ Avogadro constant &{\tt Avogadro} &$ N_A $\\ Boltzmann constant &{\tt k\_Boltzmann} &$ k $\\ &{\tt STP\_{}Temperature}&$ 273.15\,K $\\ &{\tt STP\_{}Pressure} &$ 1\,atmosphere $\\ &{\tt kGasThreshold} &$ 10^{-2}\,g/cm^3 $\\ \hline &{\tt pi} &$ \pi $\\ &{\tt twopi} &$ 2\pi $\\ &{\tt halfpi} &$ \pi/2 $\\ &{\tt pi2} &$ \pi^2 $\\ &{\tt perCent} &$ 10^{-2} $\\ &{\tt perThousand} &$ 10^{-3} $\\ &{\tt perMillion} &$ 10^{-6} $\\ \hline \end {tabular} \caption{Physical constants defined in the {\it CLHEP Units} module} \label{tab2} \end{table} \end{document} clhep-2.1.4.1.orig/Units/doc/.cvsignore0000755000175000017500000000004311406203315016237 0ustar olesolesMakefile.in *.dvi *.aux *.log *.ps clhep-2.1.4.1.orig/Units/doc/CMakeLists.txt0000644000175000017500000000013111607661650017007 0ustar olesoles# build Units documentation include(ClhepBuildTex) clhep_latex( Units Units html.sty ) clhep-2.1.4.1.orig/Units/doc/html.sty0000644000175000017500000006755211406203315015763 0ustar olesoles% % $Id: html.sty,v 1.2 2010/06/16 17:12:28 garren Exp $ % LaTeX2HTML Version 96.2 : html.sty % % This file contains definitions of LaTeX commands which are % processed in a special way by the translator. % For example, there are commands for embedding external hypertext links, % for cross-references between documents or for including raw HTML. % This file includes the comments.sty file v2.0 by Victor Eijkhout % In most cases these commands do nothing when processed by LaTeX. % % Place this file in a directory accessible to LaTeX (i.e., somewhere % in the TEXINPUTS path.) % % NOTE: This file works with LaTeX 2.09 or (the newer) LaTeX2e. % If you only have LaTeX 2.09, some complex LaTeX2HTML features % like support for segmented documents are not available. % Changes: % See the change log at end of file. % Exit if the style file is already loaded % (suggested by Lee Shombert \ifx \htmlstyloaded\relax \endinput\else\let\htmlstyloaded\relax\fi \makeatletter \newcommand{\latextohtml}{\LaTeX2\texttt{HTML}} %%% LINKS TO EXTERNAL DOCUMENTS % % This can be used to provide links to arbitrary documents. % The first argumment should be the text that is going to be % highlighted and the second argument a URL. % The hyperlink will appear as a hyperlink in the HTML % document and as a footnote in the dvi or ps files. % \newcommand{\htmladdnormallinkfoot}[2]{#1\footnote{#2}} % This is an alternative definition of the command above which % will ignore the URL in the dvi or ps files. \newcommand{\htmladdnormallink}[2]{#1} % This command takes as argument a URL pointing to an image. % The image will be embedded in the HTML document but will % be ignored in the dvi and ps files. % \newcommand{\htmladdimg}[1]{} %%% CROSS-REFERENCES BETWEEN (LOCAL OR REMOTE) DOCUMENTS % % This can be used to refer to symbolic labels in other Latex % documents that have already been processed by the translator. % The arguments should be: % #1 : the URL to the directory containing the external document % #2 : the path to the labels.pl file of the external document. % If the external document lives on a remote machine then labels.pl % must be copied on the local machine. % %e.g. \externallabels{http://cbl.leeds.ac.uk/nikos/WWW/doc/tex2html/latex2html} % {/usr/cblelca/nikos/tmp/labels.pl} % The arguments are ignored in the dvi and ps files. % \newcommand{\externallabels}[2]{} % This complements the \externallabels command above. The argument % should be a label defined in another latex document and will be % ignored in the dvi and ps files. % \newcommand{\externalref}[1]{} % Suggested by Uffe Engberg (http://www.brics.dk/~engberg/) % This allows the same effect for citations in external bibliographies. % An \externallabels command must be given, locating a labels.pl file % which defines the location and keys used in the external .html file. % \newcommand{\externalcite}{\nocite} %%% HTMLRULE % This command adds a horizontal rule and is valid even within % a figure caption. % Here we introduce a stub for compatibility. \newcommand{\htmlrule}{\protect\HTMLrule} \newcommand{\HTMLrule}{\@ifstar\@htmlrule\@htmlrule} \newcommand{\@htmlrule}[1]{} % This command adds information within the ... tag % \newcommand{\bodytext}[1]{} \newcommand{\htmlbody}{} %%% HYPERREF % Suggested by Eric M. Carol % Similar to \ref but accepts conditional text. % The first argument is HTML text which will become ``hyperized'' % (underlined). % The second and third arguments are text which will appear only in the paper % version (DVI file), enclosing the fourth argument which is a reference to a label. % %e.g. \hyperref{using the tracer}{using the tracer (see Section}{)}{trace} % where there is a corresponding \label{trace} % \newcommand{\hyperref}{\hyperrefx[ref]} \def\hyperrefx[#1]{{\def\next{#1}% \def\tmp{ref}\ifx\next\tmp\aftergroup\hyperrefref \else\def\tmp{pageref}\ifx\next\tmp\aftergroup\hyperpageref \else\def\tmp{page}\ifx\next\tmp\aftergroup\hyperpageref \else\def\tmp{noref}\ifx\next\tmp\aftergroup\hypernoref \else\def\tmp{no}\ifx\next\tmp\aftergroup\hypernoref \else\typeout{*** unknown option \next\space to hyperref ***}% \fi\fi\fi\fi\fi}} \newcommand{\hyperrefref}[4]{#2\ref{#4}#3} \newcommand{\hyperpageref}[4]{#2\pageref{#4}#3} \newcommand{\hypernoref}[3]{#2} %%% HYPERCITE --- added by RRM % Suggested by Stephen Simpson % effects the same ideas as in \hyperref, but for citations. % It does not allow an optional argument to the \cite, in LaTeX. % % \hypercite{}{}{}{} % % uses the pre/post-texts in LaTeX, with a \cite{} % % \hypercite[ext]{}{}{} % % uses the pre/post-texts in LaTeX, with a \nocite{} % the actual reference comes from an \externallabels file. % \newcommand{\hypercite}{\hypercitex[int]} \def\hypercitex[#1]{{\def\next{#1}% \def\tmp{int}\ifx\next\tmp\aftergroup\hyperciteint \else\def\tmp{cite}\ifx\next\tmp\aftergroup\hyperciteint \else\def\tmp{ext}\ifx\next\tmp\aftergroup\hyperciteext \else\def\tmp{nocite}\ifx\next\tmp\aftergroup\hyperciteext \else\def\tmp{no}\ifx\next\tmp\aftergroup\hyperciteext \else\typeout{*** unknown option \next\space to hypercite ***}% \fi\fi\fi\fi\fi}} \newcommand{\hyperciteint}[4]{#2{\def\tmp{#3}\def\emptyopt{}% \ifx\tmp\emptyopt\cite{#4}\else\cite[#3]{#4}\fi}} \newcommand{\hyperciteext}[3]{#2\nocite{#3}} %%% HTMLREF % Reference in HTML version only. % Mix between \htmladdnormallink and \hyperref. % First arg is text for in both versions, second is label for use in HTML % version. \newcommand{\htmlref}[2]{#1} %%% HTMLCITE % Reference in HTML version only. % Mix between \htmladdnormallink and \hypercite. % First arg is text for in both versions, second is citation for use in HTML % version. \newcommand{\htmlcite}[2]{#1} %%% HTMLIMAGE % This command can be used inside any environment that is converted % into an inlined image (eg a "figure" environment) in order to change % the way the image will be translated. The argument of \htmlimage % is really a string of options separated by commas ie % [scale=],[external],[thumbnail= % The scale option allows control over the size of the final image. % The ``external'' option will cause the image not to be inlined % (images are inlined by default). External images will be accessible % via a hypertext link. % The ``thumbnail'' option will cause a small inlined image to be % placed in the caption. The size of the thumbnail depends on the % reduction factor. The use of the ``thumbnail'' option implies % the ``external'' option. % % Example: % \htmlimage{scale=1.5,external,thumbnail=0.2} % will cause a small thumbnail image 1/5th of the original size to be % placed in the final document, pointing to an external image 1.5 % times bigger than the original. % \newcommand{\htmlimage}[1]{} % \htmlborder causes a border to be placed around an image or table % when the image is placed within a cell. \newcommand{\htmlborder}[1]{} % Put \begin{makeimage}, \end{makeimage} around LaTeX to ensure its % translation into an image. % This shields sensitive text from being translated. \newenvironment{makeimage}{}{} %%% HTMLADDTONAVIGATION % This command appends its argument to the buttons in the navigation % panel. It is ignored by LaTeX. % % Example: % \htmladdtonavigation{\htmladdnormallink % {\htmladdimg{http://server/path/to/gif}} % {http://server/path}} \newcommand{\htmladdtonavigation}[1]{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Comment.sty version 2.0, 19 June 1992 % selectively in/exclude pieces of text: the user can define new % comment versions, and each is controlled separately. % This style can be used with plain TeX or LaTeX, and probably % most other packages too. % % Examples of use in LaTeX and TeX follow \endinput % % Author % Victor Eijkhout % Department of Computer Science % University Tennessee at Knoxville % 104 Ayres Hall % Knoxville, TN 37996 % USA % % eijkhout@cs.utk.edu % % Usage: all text included in between % \comment ... \endcomment % or \begin{comment} ... \end{comment} % is discarded. The closing command should appear on a line % of its own. No starting spaces, nothing after it. % This environment should work with arbitrary amounts % of comment. % % Other 'comment' environments are defined by % and are selected/deselected with % \includecomment{versiona} % \excludecoment{versionb} % % These environments are used as % \versiona ... \endversiona % or \begin{versiona} ... \end{versiona} % with the closing command again on a line of its own. % % Basic approach: % to comment something out, scoop up every line in verbatim mode % as macro argument, then throw it away. % For inclusions, both the opening and closing comands % are defined as noop % % Changed \next to \html@next to prevent clashes with other sty files % (mike@emn.fr) % Changed \html@next to \htmlnext so the \makeatletter and % \makeatother commands could be removed (they were causing other % style files - changebar.sty - to crash) (nikos@cbl.leeds.ac.uk) % Changed \htmlnext back to \html@next... \def\makeinnocent#1{\catcode`#1=12 } \def\csarg#1#2{\expandafter#1\csname#2\endcsname} \def\ThrowAwayComment#1{\begingroup \def\CurrentComment{#1}% \let\do\makeinnocent \dospecials \makeinnocent\^^L% and whatever other special cases \endlinechar`\^^M \catcode`\^^M=12 \xComment} {\catcode`\^^M=12 \endlinechar=-1 % \gdef\xComment#1^^M{\def\test{#1}\edef\test{\meaning\test} \csarg\ifx{PlainEnd\CurrentComment Test}\test \let\html@next\endgroup \else \csarg\ifx{LaLaEnd\CurrentComment Test}\test \edef\html@next{\endgroup\noexpand\end{\CurrentComment}} \else \csarg\ifx{LaInnEnd\CurrentComment Test}\test \edef\html@next{\endgroup\noexpand\end{\CurrentComment}} \else \let\html@next\xComment \fi \fi \fi \html@next} } \def\includecomment #1{\expandafter\def\csname#1\endcsname{}% \expandafter\def\csname end#1\endcsname{}} \def\excludecomment #1{\expandafter\def\csname#1\endcsname{\ThrowAwayComment{#1}}% {\escapechar=-1\relax \edef\tmp{\string\\end#1}% \csarg\xdef{PlainEnd#1Test}{\meaning\tmp}% \edef\tmp{\string\\end\string\{#1\string\}}% \csarg\xdef{LaLaEnd#1Test}{\meaning\tmp}% \edef\tmp{\string\\end \string\{#1\string\}}% \csarg\xdef{LaInnEnd#1Test}{\meaning\tmp}% }} \excludecomment{comment} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % end Comment.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% RAW HTML % % Enclose raw HTML between a \begin{rawhtml} and \end{rawhtml}. % The html environment ignores its body % \excludecomment{rawhtml} %%% HTML ONLY % % Enclose LaTeX constructs which will only appear in the % HTML output and will be ignored by LaTeX with % \begin{htmlonly} and \end{htmlonly} % \excludecomment{htmlonly} % Shorter version \newcommand{\html}[1]{} % for images.tex only \excludecomment{imagesonly} %%% LaTeX ONLY % Enclose LaTeX constructs which will only appear in the % DVI output and will be ignored by latex2html with %\begin{latexonly} and \end{latexonly} % \newenvironment{latexonly}{}{} % Shorter version \newcommand{\latex}[1]{#1} %%% LaTeX or HTML % Combination of \latex and \html. % Say \latexhtml{this should be latex text}{this html text} % %\newcommand{\latexhtml}[2]{#1} \long\def\latexhtml#1#2{#1} %%% tracing the HTML conversions % This alters the tracing-level within the processing % performed by latex2html by adjusting $VERBOSITY % (see latex2html.config for the appropriate values) % \newcommand{\htmltracing}[1]{} \newcommand{\htmltracenv}[1]{} %%% \strikeout for HTML only % uses ... tags on the argument % LaTeX just gobbles it up. \newcommand{\strikeout}[1]{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% JCL - stop input here if LaTeX2e is not present %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ifx\if@compatibility\undefined %LaTeX209 \makeatother\relax\expandafter\endinput \fi \if@compatibility %LaTeX2e in LaTeX209 compatibility mode \makeatother\relax\expandafter\endinput \fi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Start providing LaTeX2e extension: % This is currently: % - additional optional argument for \htmladdimg % - support for segmented documents % \ProvidesPackage{html} [1996/12/22 v1.1 hypertext commands for latex2html (nd, hws, rrm)] %%%%MG % This command takes as argument a URL pointing to an image. % The image will be embedded in the HTML document but will % be ignored in the dvi and ps files. The optional argument % denotes additional HTML tags. % % Example: \htmladdimg[ALT="portrait" ALIGN=CENTER]{portrait.gif} % \renewcommand{\htmladdimg}[2][]{} %%% HTMLRULE for LaTeX2e % This command adds a horizontal rule and is valid even within % a figure caption. % % This command is best used with LaTeX2e and HTML 3.2 support. % It is like \hrule, but allows for options via key--value pairs % as follows: \htmlrule[key1=value1, key2=value2, ...] . % Use \htmlrule* to suppress the
    tag. % Eg. \htmlrule[left, 15, 5pt, "none", NOSHADE] produces %

    . % Renew the necessary part. \renewcommand{\@htmlrule}[1][all]{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % renew some definitions to allow optional arguments % % The description of the options is missing, as yet. % \renewcommand{\latextohtml}{\textup{\LaTeX2\texttt{HTML}}} \renewcommand{\htmladdnormallinkfoot}[3][]{#2\footnote{#3}} \renewcommand{\htmladdnormallink}[3][]{#2} \renewcommand{\htmlbody}[1][]{} \renewcommand{\hyperref}[1][ref]{\hyperrefx[#1]} \renewcommand{\hypercite}[1][int]{\hypercitex[#1]} \renewcommand{\htmlref}[3][]{#2} \renewcommand{\htmlcite}[1]{#1\htmlcitex} \newcommand{\htmlcitex}[2][]{{\def\tmp{#1}\ifx\tmp\@empty\else~[#1]\fi}} \renewcommand{\htmlimage}[2][]{} \renewcommand{\htmlborder}[2][]{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % HTML HTMLset HTMLsetenv % % These commands do nothing in LaTeX, but can be used to place % HTML tags or set Perl variables during the LaTeX2HTML processing; % They are intended for expert use only. \newcommand{\HTML}[2][]{} \newcommand{\HTMLset}[3][]{} \newcommand{\HTMLsetenv}[3][]{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % The following commands pertain to document segmentation, and % were added by Herbert Swan (with help from % Michel Goossens ): % % % This command inputs internal latex2html tables so that large % documents can to partitioned into smaller (more manageable) % segments. % \newcommand{\internal}[2][internals]{} % % Define a dummy stub \htmlhead{}. This command causes latex2html % to define the title of the start of a new segment. It is not % normally placed in the user's document. Rather, it is passed to % latex2html via a .ptr file written by \segment. % \newcommand{\htmlhead}[3][]{} % In the LaTeX2HTML version this will eliminate the title line % generated by a \segment command, but retains the title string % for use in other places. % \newcommand{\htmlnohead}{} % In the LaTeX2HTML version this put a URL into a tag % within the ... portion of a document. % \newcommand{\htmlbase}[1]{} % % % The dummy command \endpreamble is needed by latex2html to % mark the end of the preamble in document segments that do % not contain a \begin{document} % \newcommand{\startdocument}{} % % These do nothing in LaTeX but for LaTeX2HTML % they mark where the table of child-links and info-page % should be placed, when the user wants other than the default. % The *-versions omit the preceding
    tag. % \newcommand{\tableofchildlinks}{\@ifstar\@tochildlinks\@tochildlinks} \newcommand{\@tochildlinks}{} \newcommand{\htmlinfo}{\@ifstar\@htmlinfo\@htmlinfo} \newcommand{\@htmlinfo}{} % % Allocate a new set of section counters, which will get incremented % for "*" forms of sectioning commands, and for a few miscellaneous % commands. % \newcounter{lpart} \newcounter{lchapter}[part] \@ifundefined{chapter}{\newcounter{lsection}[part]}{\newcounter{lsection}[chapter]} \newcounter{lsubsection}[section] \newcounter{lsubsubsection}[subsection] \newcounter{lparagraph}[subsubsection] \newcounter{lsubparagraph}[paragraph] \newcounter{lequation} % % Redefine "*" forms of sectioning commands to increment their % respective counters. % \let\Hpart=\part \let\Hchapter=\chapter \let\Hsection=\section \let\Hsubsection=\subsection \let\Hsubsubsection=\subsubsection \let\Hparagraph=\paragraph \let\Hsubparagraph=\subparagraph \let\Hsubsubparagraph=\subsubparagraph \ifx\c@subparagraph\undefined \newcounter{lsubsubparagraph}[lsubparagraph] \else \newcounter{lsubsubparagraph}[subparagraph] \fi % % The following definitions are specific to LaTeX2e: % (They must be commented out for LaTeX 2.09) % \renewcommand{\part}{\@ifstar{\stepcounter{lpart}% \bgroup\def\tmp{*}\H@part}{\bgroup\def\tmp{}\H@part}} \newcommand{\H@part}[1][]{% \expandafter\egroup\expandafter\Hpart\tmp} \ifx\Hchapter\relax\else\@ifundefined{chapter}{}{% \def\chapter{\resetsections \@ifstar{\stepcounter{lchapter}% \bgroup\def\tmp{*}\H@chapter}{\bgroup\def\tmp{}\H@chapter}}}\fi \newcommand{\H@chapter}[1][]{% \expandafter\egroup\expandafter\Hchapter\tmp} \renewcommand{\section}{\resetsubsections \@ifstar{\stepcounter{lsection}\bgroup\def\tmp{*}% \H@section}{\bgroup\def\tmp{}\H@section}} \newcommand{\H@section}[1][]{% \expandafter\egroup\expandafter\Hsection\tmp} \renewcommand{\subsection}{\resetsubsubsections \@ifstar{\stepcounter{lsubsection}\bgroup\def\tmp{*}% \H@subsection}{\bgroup\def\tmp{}\H@subsection}} \newcommand{\H@subsection}[1][]{% \expandafter\egroup\expandafter\Hsubsection\tmp} \renewcommand{\subsubsection}{\resetparagraphs \@ifstar{\stepcounter{lsubsubsection}\bgroup\def\tmp{*}% \H@subsubsection}{\bgroup\def\tmp{}\H@subsubsection}} \newcommand{\H@subsubsection}[1][]{% \expandafter\egroup\expandafter\Hsubsubsection\tmp} \renewcommand{\paragraph}{\resetsubparagraphs \@ifstar{\stepcounter{lparagraph}\bgroup\def\tmp{*}% \H@paragraph}{\bgroup\def\tmp{}\H@paragraph}} \newcommand\H@paragraph[1][]{% \expandafter\egroup\expandafter\Hparagraph\tmp} \renewcommand{\subparagraph}{\resetsubsubparagraphs \@ifstar{\stepcounter{lsubparagraph}\bgroup\def\tmp{*}% \H@subparagraph}{\bgroup\def\tmp{}\H@subparagraph}} \newcommand\H@subparagraph[1][]{% \expandafter\egroup\expandafter\Hsubparagraph\tmp} \ifx\Hsubsubparagraph\relax\else\@ifundefined{subsubparagraph}{}{% \def\subsubparagraph{% \@ifstar{\stepcounter{lsubsubparagraph}\bgroup\def\tmp{*}% \H@subsubparagraph}{\bgroup\def\tmp{}\H@subsubparagraph}}}\fi \newcommand\H@subsubparagraph[1][]{% \expandafter\egroup\expandafter\Hsubsubparagraph\tmp} % \def\resetsections{\setcounter{section}{0}\setcounter{lsection}{0}% \reset@dependents{section}\resetsubsections } \def\resetsubsections{\setcounter{subsection}{0}\setcounter{lsubsection}{0}% \reset@dependents{subsection}\resetsubsubsections } \def\resetsubsubsections{\setcounter{subsubsection}{0}\setcounter{lsubsubsection}{0}% \reset@dependents{subsubsection}\resetparagraphs } % \def\resetparagraphs{\setcounter{lparagraph}{0}\setcounter{lparagraph}{0}% \reset@dependents{paragraph}\resetsubparagraphs } \def\resetsubparagraphs{\ifx\c@subparagraph\undefined\else \setcounter{subparagraph}{0}\fi \setcounter{lsubparagraph}{0}% \reset@dependents{subparagraph}\resetsubsubparagraphs } \def\resetsubsubparagraphs{\ifx\c@subsubparagraph\undefined\else \setcounter{subsubparagraph}{0}\fi \setcounter{lsubsubparagraph}{0}} % \def\reset@dependents#1{\begingroup\let \@elt \@stpelt \csname cl@#1\endcsname\endgroup} % % % Define a helper macro to dump a single \secounter command to a file. % \newcommand{\DumpPtr}[2]{% \count255=\arabic{#1}\def\dummy{dummy}\def\tmp{#2}% \ifx\tmp\dummy\else\advance\count255 by \arabic{#2}\fi \immediate\write\ptrfile{% \noexpand\setcounter{#1}{\number\count255}}} % % Define a helper macro to dump all counters to the file. % The value for each counter will be the sum of the l-counter % actual LaTeX section counter. % Also dump an \htmlhead{section-command}{section title} command % to the file. % \newwrite\ptrfile \def\DumpCounters#1#2#3#4{% \begingroup\let\protect=\noexpand \immediate\openout\ptrfile = #1.ptr \DumpPtr{part}{lpart}% \ifx\Hchapter\relax\else\DumpPtr{chapter}{lchapter}\fi \DumpPtr{section}{lsection}% \DumpPtr{subsection}{lsubsection}% \DumpPtr{subsubsection}{lsubsubsection}% \DumpPtr{paragraph}{lparagraph}% \DumpPtr{subparagraph}{lsubparagraph}% \DumpPtr{equation}{lequation}% \DumpPtr{footnote}{dummy}% \def\tmp{#4}\ifx\tmp\@empty \immediate\write\ptrfile{\noexpand\htmlhead{#2}{#3}}\else \immediate\write\ptrfile{\noexpand\htmlhead[#4]{#2}{#3}}\fi \dumpcitestatus \dumpcurrentcolor \immediate\closeout\ptrfile \endgroup } %% interface to natbib.sty \def\dumpcitestatus{} \def\loadcitestatus{\def\dumpcitestatus{% \ifciteindex\immediate\write\ptrfile{\noexpand\citeindextrue}% \else\immediate\write\ptrfile{\noexpand\citeindexfalse}\fi }% } \@ifpackageloaded{natbib}{\loadcitestatus}{% \AtBeginDocument{\@ifpackageloaded{natbib}{\loadcitestatus}{}}} %% interface to color.sty \def\dumpcurrentcolor{} \def\loadsegmentcolors{% \let\real@pagecolor=\pagecolor \let\pagecolor\segmentpagecolor \let\segmentcolor\color \ifx\current@page@color\undefined \def\current@page@color{{}}\fi \def\dumpcurrentcolor{\bgroup\def\@empty@{{}}% \expandafter\def\expandafter\tmp\space####1@{\def\thiscol{####1}}% \ifx\current@color\@empty@\def\thiscol{}\else \expandafter\tmp\current@color @\fi \immediate\write\ptrfile{\noexpand\segmentcolor{\thiscol}}% \ifx\current@page@color\@empty@\def\thiscol{}\else \expandafter\tmp\current@page@color @\fi \immediate\write\ptrfile{\noexpand\segmentpagecolor{\thiscol}}% \egroup}% \global\let\loadsegmentcolors=\relax } % These macros are needed within images.tex since this inputs % the .ptr files for a segment, so that counters are % colors are synchronised. % \newcommand{\segmentpagecolor}[1][]{% \@ifpackageloaded{color}{\loadsegmentcolors\bgroup \def\tmp{#1}\ifx\@empty\tmp\def\next{[]}\else\def\next{[#1]}\fi \expandafter\segmentpagecolor@\next}% {\@gobble}} \def\segmentpagecolor@[#1]#2{\def\tmp{#1}\def\tmpB{#2}% \ifx\tmpB\@empty\let\next=\egroup \else \let\realendgroup=\endgroup \def\endgroup{\edef\next{\noexpand\realendgroup \def\noexpand\current@page@color{\current@color}}\next}% \ifx\tmp\@empty\real@pagecolor{#2}\def\model{}% \else\real@pagecolor[#1]{#2}\def\model{[#1]}% \fi \edef\next{\egroup\def\noexpand\current@page@color{\current@page@color}% \noexpand\real@pagecolor\model{#2}}% \fi\next} % \newcommand{\segmentcolor}[2][named]{\@ifpackageloaded{color}% {\loadsegmentcolors\segmentcolor[#1]{#2}}{}} \@ifpackageloaded{color}{\loadsegmentcolors}{\let\real@pagecolor=\@gobble \AtBeginDocument{\@ifpackageloaded{color}{\loadsegmentcolors}{}}} % Define the \segment[align]{file}{section-command}{section-title} command, % and its helper macros. This command does four things: % 1) Begins a new LaTeX section; % 2) Writes a list of section counters to file.ptr, each % of which represents the sum of the LaTeX section % counters, and the l-counters, defined above; % 3) Write an \htmlhead{section-title} command to file.ptr; % 4) Inputs file.tex. \def\segment{\@ifstar{\@@htmls}{\@@html}} \newcommand{\@@htmls}[1][]{\@@htmlsx{#1}} \newcommand{\@@html}[1][]{\@@htmlx{#1}} \def\@@htmlsx#1#2#3#4{\csname #3\endcsname* {#4}% \DumpCounters{#2}{#3*}{#4}{#1}\input{#2}} \def\@@htmlx#1#2#3#4{\csname #3\endcsname {#4}% \DumpCounters{#2}{#3}{#4}{#1}\input{#2}} \makeatother \endinput % Modifications: % % (The listing of Initiales see Changes) % $Log: html.sty,v $ % Revision 1.2 2010/06/16 17:12:28 garren % merging changes from 2.0.5.0.b01 % % Revision 1.1.6.2 2009/11/13 20:29:42 garren % get the changes from 2.0.4.4 % % Revision 1.1.2.1 2009/11/12 19:52:56 garren % make pdf documents % % Revision 1.2 1997/07/10 06:16:42 RRM % LaTeX styles, used in the v97.1 manual % % Revision 1.17 1997/07/08 11:23:39 RRM % include value of footnote counter in .ptr files for segments % % Revision 1.16 1997/07/03 08:56:34 RRM % use \textup within the \latextohtml macro % % Revision 1.15 1997/06/15 10:24:58 RRM % new command \htmltracenv as environment-ordered \htmltracing % % Revision 1.14 1997/06/06 10:30:37 RRM % - new command: \htmlborder puts environment into a
    cell % with a border of specified width, + other attributes. % - new commands: \HTML for setting arbitrary HTML tags, with attributes % \HTMLset for setting Perl variables, while processing % \HTMLsetenv same as \HTMLset , but it gets processed % as if it were an environment. % - new command: \latextohtml --- to set the LaTeX2HTML name/logo % - fixed some remaining problems with \segmentcolor & \segmentpagecolor % % Revision 1.13 1997/05/19 13:55:46 RRM % alterations and extra options to \hypercite % % Revision 1.12 1997/05/09 12:28:39 RRM % - Added the optional argument to \htmlhead, also in \DumpCounters % - Implemented \HTMLset as a no-op in LaTeX. % - Fixed a bug in accessing the page@color settings. % % Revision 1.11 1997/03/26 09:32:40 RRM % - Implements LaTeX versions of \externalcite and \hypercite commands. % Thanks to Uffe Engberg and Stephen Simpson for the suggestions. % % Revision 1.10 1997/03/06 07:37:58 RRM % Added the \htmltracing command, for altering $VERBOSITY . % % Revision 1.9 1997/02/17 02:26:26 RRM % - changes to counter handling (RRM) % - shuffled around some definitions % - changed \htmlrule of 209 mode % % Revision 1.8 1997/01/26 09:04:12 RRM % RRM: added optional argument to sectioning commands % \htmlbase sets the tag % \htmlinfo and \htmlinfo* allow the document info to be positioned % % Revision 1.7 1997/01/03 12:15:44 L2HADMIN % % - fixes to the color and natbib interfaces % % - extended usage of \hyperref, via an optional argument. % % - extended use comment environments to allow shifting expansions % % e.g. within \multicolumn (`bug' reported by Luc De Coninck). % % - allow optional argument to: \htmlimage, \htmlhead, % % \htmladdimg, \htmladdnormallink, \htmladdnormallinkfoot % % - added new commands: \htmlbody, \htmlnohead % % - added new command: \tableofchildlinks % % Revision 1.6 1996/12/25 03:04:54 JCL % added patches to segment feature from Martin Wilck % % Revision 1.5 1996/12/23 01:48:06 JCL % o introduced the environment makeimage, which may be used to force % LaTeX2HTML to generate an image from the contents. % There's no magic, all what we have now is a defined empty environment % which LaTeX2HTML will not recognize and thus pass it to images.tex. % o provided \protect to the \htmlrule commands to allow for usage % within captions. % % Revision 1.4 1996/12/21 19:59:22 JCL % - shuffled some entries % - added \latexhtml command % % Revision 1.3 1996/12/21 12:22:59 JCL % removed duplicate \htmlrule, changed \htmlrule back not to create a \hrule % to allow occurrence in caption % % Revision 1.2 1996/12/20 04:03:41 JCL % changed occurrence of \makeatletter, \makeatother % added new \htmlrule command both for the LaTeX2.09 and LaTeX2e % sections % % % jcl 30-SEP-96 % - Stuck the commands commonly used by both LaTeX versions to the top, % added a check which stops input or reads further if the document % makes use of LaTeX2e. % - Introduced rrm's \dumpcurrentcolor and \bodytext % hws 31-JAN-96 - Added support for document segmentation % hws 10-OCT-95 - Added \htmlrule command % jz 22-APR-94 - Added support for htmlref % nd - Created clhep-2.1.4.1.orig/Units/.cvsignore0000755000175000017500000000007407746044120015507 0ustar olesolesMakefile.in configure aclocal.m4 autom4te.cache config.h.in clhep-2.1.4.1.orig/Units/Units-deps.in0000755000175000017500000000006510043347544016072 0ustar olesolesCLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ clhep-2.1.4.1.orig/Units/COPYING0000644000175000017500000010451311406203315014531 0ustar olesoles GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/Units/test/0000755000175000017500000000000012242515143014455 5ustar olesolesclhep-2.1.4.1.orig/Units/test/testUnits.cc0000755000175000017500000000306712234462476017012 0ustar olesoles// -*- C++ -*- // $Id: testUnits.cc,v 1.4 2011/07/20 23:00:04 garren Exp $ // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is a small program for testing the Units module // #include #include "CLHEP/Units/defs.h" #include "CLHEP/Units/PhysicalConstants.h" #include #include #include #include #if (defined __STRICT_ANSI__) || (defined _WIN32) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif // M_PI #endif // __STRICT_ANSI__ int main() { int nbad=0; // Check that local m does not interfere with global m double m=0; for (int i=0; i<7; i++, m++) { assert(m == double(i)); } assert(m != CLHEP::meter); //std::cout << "Speed of light is " << std::setw(10) << std::setprecision(8) // << CLHEP::c_light << std::endl; //output: Speed of light is 299.79246 std::ostringstream os1, os2, os3, os4; os1 << std::setprecision(8) << CLHEP::c_light; os2 << "299.79246"; if( os1.str() != os2.str() ) { std::cout << "compare --" << os1.str() << "-- to --" << os2.str() << "--" << std::endl; nbad++; } os3 << std::setprecision(16) << CLHEP::pi ; os4 << "3.141592653589793"; if( os3.str() != os4.str() ) { nbad++; std::cout << "compare --" << os3.str() << "--" << std::endl; std::cout << " to --" << os4.str() << "--" << std::endl; std::cout << "M_PI --" << std::setprecision(16) << M_PI << "--" << std::endl; } return nbad; } clhep-2.1.4.1.orig/Units/test/Makefile.am0000755000175000017500000000304711611656765016537 0ustar olesoles# Applicable to each test program: if USE_GMAKE MAKE = gmake endif INCLUDES = -I../ LDADD = @Units_LDFLAGS@ @Units_LIBS@ # libraries to link, and whence if BUILD_VISUAL OUTFLAG = /Fo$@ else OUTFLAG = -o $@ endif # normally, CXXLINK is supplied by automake, but we need to use /Fo instead # of -o when compiling with Visual C++ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ $(OUTFLAG) # Identify executables needed during testing: check_PROGRAMS = \ testUnits check_SCRIPTS = # Identify test(s) to run when 'make check' is requested: TESTS = \ testUnits # Identify the test(s) for which failure is the intended outcome: XFAIL_TESTS = # Identify the dependencies on a per-test basis: testUnits_SOURCES = testUnits.cc # Identify input data file(s) and prototype output file(s): EXTRA_DIST = # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = # supply our own suffix rule .cc.obj: if BUILD_VISUAL # $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c $(OUTFLAG) `$(CYGPATH_W) '$<'` # mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po source='$<' object='$@' libtool=no \ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ $(CXXCOMPILE) -c $(OUTFLAG) `$(CYGPATH_W) '$<'` else if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c $(OUTFLAG) `$(CYGPATH_W) '$<'`; \ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi # source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ # $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` endif clhep-2.1.4.1.orig/Units/test/.cvsignore0000755000175000017500000000001407707264154016470 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Units/test/CMakeLists.txt0000644000175000017500000000004611611656765017234 0ustar olesoles clhep_test( testUnits SIMPLE NOLIB ) clhep-2.1.4.1.orig/Units/Units-config.in0000755000175000017500000000404112234340066016376 0ustar olesoles#! /bin/sh # @configure_input@ # we include the paths of the original install directories for reference orig_prefix="@prefix@" orig_exec_prefix="@exec_prefix@" orig_includedir="@includedir@" # use the full name of this script to get the current path configpath=`dirname ${0}` # check for a leading slash to determine if this is a relative path firstc=`expr ${configpath} : "\/"` calldir=`pwd` if [ ${firstc} -eq 0 ] then cd "${calldir}/${configpath}"; newpath=`pwd` binpath=${newpath} else binpath=${configpath} fi # OK - now we have to strip the trailing "/bin" out of the path prefix=`dirname "${binpath}"` includedir=${prefix}/include libdir=${prefix}/lib usage() { cat < * Units/SystemOfUnits.h: adding definitions for curies * test/testUnits.cc: use the same M_PI logic as found elsewhere ============================== 14.11.12 Release CLHEP-2.1.3.1 ============================== ============================== 06.11.12 Release CLHEP-2.1.3.0 ============================== ============================== 16.08.12 Release CLHEP-2.1.2.5 ============================== ============================== 09.07.12 Release CLHEP-2.1.2.4 ============================== ============================== 31.05.12 Release CLHEP-2.1.2.3 ============================== ============================== 14.02.12 Release CLHEP-2.1.2.2 ============================== 2012-02-14 L. Garren * CMakeLists.txt: use clhep_package_config_no_lib ============================== 06.02.12 Release CLHEP-2.1.2.1 ============================== ============================== 16.12.11 Release CLHEP-2.1.2.0 ============================== ============================== 29.07.11 Release CLHEP-2.1.1.0 ============================== 2011-07-20 Lynn Garren * testUnits: convert from shell script to executable ============================== 11.11.10 Release CLHEP-2.1.0.1 ============================== ============================== 23.07.10 Release CLHEP-2.1.0.0 ============================== ============================== 16.06.10 Release CLHEP-2.1.0.0.b01 ============================== ============================== 11.06.10 Release CLHEP-2.0.5.0.b01 ============================== ============================== 09.03.10 Release CLHEP-2.0.4.6 ============================== ============================== 08.12.09 Release CLHEP-2.0.4.5 ============================== ============================== 12.11.09 Release CLHEP-2.0.4.4 ============================== ============================== 03.11.09 Release CLHEP-2.0.4.4.b01 ============================== ============================== 04.07.09 Release CLHEP-2.0.4.3 ============================== ============================== 18.11.08 Release CLHEP-2.0.4.2 ============================== ============================== 04.11.08 Release CLHEP-2.0.4.1 ============================== 2008-11-04 Lynn Garren * PhysicalConstants.h: update Avogadro, h_Planck, electron_mass_c2, proton_mass_c2, amu_c2, and k_Boltzmann to PDG 2008 values * SystemOfUnits.h: update e_SI to PDG 2008 value * Units.tex: update for modern LaTeX ============================== 07.08.08 Release CLHEP-2.0.4.0 ============================== ============================== 01.05.08 Release CLHEP-2.0.3.3 ============================== 2008-04-29 Lynn Garren * PhysicalConstants.h: update h_Planck, electron_mass_c2, proton_mass_c2, neutron_mass_c2, and amu_c2 to PDG 2006 values * SystemOfUnits.h: update e_SI to PDG 2006 value ============================== 18.10.07 Release CLHEP-2.0.3.2 ============================== ============================== 15.11.06 Release CLHEP-2.0.3.1 ============================== ============================== 18.10.06 Release CLHEP-2.0.3.0 ============================== ============================== 20.06.06 Release CLHEP-2.0.2.3 ============================== ============================== 21.11.05 Release CLHEP-2.0.2.2 ============================== ============================== 22.06.05 Release CLHEP-2.0.2.1 ============================== Wed Jun 22 2005 Andreas Pfeiffer * configure.in: changed soname to install_name for darwin targets, dylibs still don't build properly on 10.3/10.4, static libs ok. 2005-06-19 Lynn Garren * configure.in, Makefile.am: Use lib when building Visual C++ libraries. Disable shared library build for Solaris CC. Wed Jun 1 2005 Andreas Pfeiffer * Units/SystemOfUnits.h: added symbols for um and nm to fix backward compatibility issue with 1.8.x version ============================== 22.04.05 Release CLHEP-2.0.2.0 ============================== 2005-04-07 Lynn Garren * configure.in: set AR and ARFLAGS Tue Apr 05 2005 Andreas Pfeiffer * configure.in, Makefile.am: Stop using libtool. The newer releases of libtool seem to have dropped support for Windows Visual C++. 2005-02-14 Lynn Garren * configure.in: Visual C++ flags are now "-EHsc -nologo -GR -GX -MD" 2005-02-03 Lynn Garren * configure.in: install step creates libCLHEP.a, libCLHEP.so, and/or libCLHEP.dylib by adding a symbolic link. 2005-02-02 Andreas PFEIFFER * configure.in: modified compiler flags for windows: added "-O -GR -GX -MD" as this is needed for the multi-thread environments used. ============================== 30.11.04 Release CLHEP-2.0.1.2 ============================== ============================== 27.10.04 Release CLHEP-2.0.1.1 ============================== Fri Sep 24 2004 Lynn Garren * use AM_CXXFLAGS * require autoconf 2.59, automake 1.9.1, and libtool 1.9b Tue Aug 31 2004 Lynn Garren * change Solaris CC compile flags from "-O -mt" to "-O" * libtools 1.9b or later is required for Solaris CC ============================== 23.07.04 Release CLHEP-2.0.1.0 ============================== ============================== 11.05.04 Release CLHEP-2.0.0.2 ============================== ============================== 11.05.04 Release CLHEP-1.9.0.2 ============================== ============================== 21.04.04 Release CLHEP-2.0.0.1 ============================== ============================== 24.10.03 Release CLHEP-2.0.0.0 ============================== ============================== 23.10.03 Release CLHEP-1.9.0.0 ============================== ============================== 01.06.02 Release CLHEP-1.8.0.0 ============================== ========================================= 25.04.02 revised StdHep uses HepMC ========================================= ========================================= 08.03.02 HepMC has become a part of CLHEP ========================================= ========================================== 09.11.01 HepPDT has become a part of CLHEP ========================================== Mon Jun 18 13:58:16 2001 Evgueni Tcherniaev * Units/doc (Added): * Units/doc/Units.tex (Added): Added documentation for Units. ============================== 15.06.01 Release CLHEP-1.7.0.0 ============================== Mon Mar 5 17:09:31 2001 Evgueni Tcherniaev * Units/SystemOfUnits.h: Added 'parsec'. It corresponds to the latest developments going on in Geant4. ========================================================================== 18.01.01 ZOOM PhysicsVectors Capabilities have become part of CLHEP/Vector ========================================================================== ====================================================================== 24.10.00 Generic Functions by Joe Boudreau have become a part of CLHEP ====================================================================== ============================== 20.10.00 Release CLHEP-1.6.0.0 ============================== ============================================================================== 12.10.00 Expression Evaluator by Evgueni Tcherniaev has become a part of CLHEP Alist, String and Combination have been disabled ============================================================================== ============================== 08.05.00 Release CLHEP-1.5.0.0 ============================== ============================================================ 24.04.00 StdHepC++ by Lynn Garren has become a part of CLHEP ============================================================ ============================== 20.04.99 Release CLHEP-1.4.0.0 ============================== Fri Feb 12 11:37:21 1999 Evgueni Tcherniaev * configure.in: Added +DAportable option for CC * test/testUnits.cc: Added check that local variables do not interfere with global ones ========================================================================= 16.12.98 Started: merging with BaBar version of CLHEP provided by G.Cosmo ========================================================================= Mon Sep 14 15:24:00 1998 Evgueni Tcherniaev * Units/SystemOfUnits.h: Added angstrom, picobarn, microsecond, picosecond, petaelectronvolt ========================== 28.07.98 Release CLHEP-1.3 ========================== Fri Jul 3 15:44:38 1998 Evgueni Tcherniaev * Units/PhysicalConstants.h,SystemOfUnits.h: Modifications provided by Michel Maire taking into account comments from the STAR group * PersistenIO/: * ClassDescription.cc,ClassDescription.h,ClassDescription.icc: * DescriptionList.cc,DescriptionList.h,GenericLoader.cc: * GenericLoader.h,Makefile.in,PIBinStream.cc,PIBinStream.h: * PICharStream.cc,PICharStream.h,PICharStream.icc,PIOStream.cc: * PIOStream.h,PIStream.cc,PIStream.h,PIStream.icc,PIXdrStream.cc: * PIXdrStream.h,PIXdrStream.icc,POBinStream.cc,POBinStream.h: * POCharStream.cc,POCharStream.h,POCharStream.icc,POStream.cc: * POStream.h,POStream.icc,POXdrStream.cc,POXdrStream.h: * POXdrStream.icc,PersistentBase.cc,PersistentBase.h: * RTTIBase.cc,RTTIBase.h,RTTIBase.icc,TypeInfo.cc,TypeInfo.h: * TypeInfo.icc (Removed): * Combination/: * DecayChannel.h,FloatWithError.h,HepBaseParticle.cc: * HepBaseParticle.h,HepBaseParticle.icc,InterfaceParticle.cc: * InterfaceParticle.h,InterfaceParticle.icc,ParticleData.h (Removed): * test/: * A.cc,A.h,B.cc,B.h,C.cc,C.h,D.cc,D.h,matrixBug.cc,testPIBS.cc: * testPIBSd.cc,testPIBSdc.cc,testPIBSdcb.cc,testPICS.cc: * testPIXS.cc,testPOS.cc,testRTTI.cc (Removed): PersistentIO removal ======================== 05.02.98 Release CLHEP-1.2 ========================== ======================================================== 08.12.97 Release CLHEP-1.1: Geant4 has migrated to CLHEP ======================================================== Fri Dec 5 09:28:25 1997 Evgueni Tcherniaev * Units/PhysicalConstants.h,SystemOfUnits.h: Removed all HepUnitOf... Redefined pascal Replaced pasc to pascal Added km, km2, km3 and mg Thu Nov 27 14:59:23 1997 Evgueni Tcherniaev * test/testUnits.cc: exit(0) changed to return 0 Sun Oct 12 11:47:36 1997 Evgueni Tcherniaev * Units/PhysicalConstants.h,SystemOfUnits.h: Changes in comments Wed Mar 12 07:53:31 1997 Nobu KATAYAMA - Added Units from the Geant4 team. - Added HEP_ to HAVE_STL,HAVE_BOOL and BOOL_IS_NOT_INT clhep-2.1.4.1.orig/Units/CMakeLists.txt0000644000175000017500000000042211716540263016242 0ustar olesoles# main Units cmake instructions # automake/autoconf variables set( PACKAGE Units ) clhep_package_config_no_lib() add_subdirectory(Units) add_subdirectory(test) if ( CLHEP_BUILD_DOCS ) message(STATUS "building documents for ${PACKAGE}" ) add_subdirectory(doc) endif() clhep-2.1.4.1.orig/Units/autotools/0000755000175000017500000000000012242515144015530 5ustar olesolesclhep-2.1.4.1.orig/Units/autotools/.cvsignore0000755000175000017500000000010107705060311017522 0ustar olesolesconfig.sub config.guess depcomp install-sh missing mkinstalldirs clhep-2.1.4.1.orig/Units/autotools/ltmain.sh0000755000175000017500000057547210233777060017404 0ustar olesoles# Generated from ltmain.in; do not edit by hand # ltmain.sh (GNU libtool) 1.9b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: powerpc-apple-darwin7.5.0 # shell: $SHELL # compiler: $LTCC # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 1.9b # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST elif test -n "${BASH_VERSION+set}${KSH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh dirname="s,/[^/]*$,," basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: PROGRAM=ltmain.sh progname=`echo "$progpath" | $SED "$basename"` # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *) progdir=`echo "$progpath" | $SED "$dirname"` progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; esac # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.9b TIMESTAMP="" package_revision=1.1571 # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $echo $progname${mode+: }$mode: warning: ${1+"$@"} 1>&2 } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } # func_version # Echo version message to standard output and exit. func_version () { $SED '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# //; s/^# *$//; s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED '/^# Usage:/,/# -h/ { s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" echo echo "run \`$progname --help | more' for full usage" exit $EXIT_SUCCESS } # func_help # Echo long help message to standard output and exit. func_help () { $SED '/^# Usage:/,/# Report bugs to/ { s/^# //; s/^# *$//; s:\$progname:'$progname':; s:\$SHELL:'"$SHELL"':; s:\$LTCC:'"$LTCC"':; s:\$LD:'"$LD"':; s/\$with_gnu_ld/'"$with_gnu_ld"'/; s/\$automake_version/'"`automake --version 2>/dev/null |$SED 1q`"'/; s/\$autoconf_version/'"`autoconf --version 2>/dev/null |$SED 1q`"'/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $EXIT_SUCCESS } # func_features # Display the features supported by this script. func_features () { $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable "`\"foo\"`", so we have to do # it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $echo \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $echo $echo "Try \`$progname --help' for more information about other modes." exit $EXIT_SUCCESS } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # sed scripts: my_sed_single_opt='1s/^\(..\).*$/\1/;q' my_sed_single_rest='1s/^..\(.*\)$/\1/;q' my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' exit_cmd=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set -- --mode clean ${1+"$@"} ;; compile|compil|compi|comp|com|co|c) shift; set -- --mode compile ${1+"$@"} ;; execute|execut|execu|exec|exe|ex|e) shift; set -- --mode execute ${1+"$@"} ;; finish|finis|fini|fin|fi|f) shift; set -- --mode finish ${1+"$@"} ;; install|instal|insta|inst|ins|in|i) shift; set -- --mode install ${1+"$@"} ;; link|lin|li|l) shift; set -- --mode link ${1+"$@"} ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set -- --mode uninstall ${1+"$@"} ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" set -x ;; --dlopen) test $# -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" ;; --dry-run | -n) run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test $# -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" show=: ;; --tag) test $# -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: --dlopen=*|--mode=*|--tag=*) arg=`echo "$opt" | $SED "$my_sed_long_arg"` opt=`echo "$opt" | $SED "$my_sed_long_opt"` set -- "$opt" "$arg" ${1+"$@"} ;; # Separate optargs to short options: # -x*|-y*) # arg=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "$arg" ${1+"$@"} # ;; # Separate non-argument short options: # -z*|-z*|-y*) # rest=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "-$rest" ${1+"$@"} # ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`echo "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$my_dlsyms" test -z "$run" && $echo > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do $show "extracting global C symbols from \`$progfile'" $run eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for dlprefile in $dlprefiles; do $show "extracting global C symbols from \`$dlprefile'" name=`$echo "$dlprefile" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ const struct { const char *originator; const struct { const char *name; void *address; } symbols[]; } lt_${my_prefix}_LTX_preloaded_symbols = {\ \"$my_originator\", { " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" $echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} } }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" status=$? if test "$status" -ne 0 && test ! -d "$my_xdir"; then exit $status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename $darwin_archive` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" # Remove the table of contents from the thin files. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" $AR -xo "${darwin_base_archive}" rm "${darwin_base_archive}" cd "$darwin_curdir" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist rm -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir (cd $my_xdir && $AR x $my_xabs) || exit $? fi # $darwin_arches fi # $run ;; *) # We will extract separately just the conflicting names and we will # no longer touch any unique names. It is faster to leave these # extract automatically by $AR in one run. $show "(cd $my_xdir && $AR x $my_xabs)" $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; renaming object files" func_warning "to ensure that they will not overwrite" $AR t "$my_xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_mode_compile arg... func_mode_compile () { # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1 || \ func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi } # func_mode_finish arg... func_mode_finish () { libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit $EXIT_SUCCESS } # func_mode_install arg... func_mode_install () { # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files test "$#" -gt 2 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. (${SED} -e '2q' $file | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1 || \ func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" $show "$relink_command" $run eval "$relink_command" || \ func_fatal_error "error: relink \`$file' with the above command before installing it" fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | $GREP "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. test -z "$notinst_deplibs" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask func_error "error: cannot create temporary directory \`$tmpdir'" continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" ${rm}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } # func_mode_link arg... func_mode_link () { case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static # See comment for -static flag below, for more details. compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" || \ func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else func_fatal_error "link input file \`$save_arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) # The effects of -all-static are defined in a previous loop. continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs $inherited_linker_flags" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *[\\/]*.la) . $lib ;; *.la) . ./$lib ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`echo "$deplib" |$SED "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$inherited_linker_flags " in *" $deplib "*) ;; * ) inherited_linker_flags="$inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $lib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not use here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib'" fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then : else func_fatal_error "\`$lib' is not a valid libtool archive" fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac case $host in *-*-darwin*) # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then inherited_linker_flags=`$echo "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` fi dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP "bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $echo "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "*** And there doesn't seem to be a static archive available" $echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs $inherited_linker_flags; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" eval darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//' | xargs` compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for archives" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath test "$#" -gt 2 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" test -n "$8" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "AGE \`$age' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | ${SED} 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null | ${SED} 10q | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` inherited_linker_flags=`$echo "X $inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$echo "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`echo "$output" | $SED $basename` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnk $echo "creating GNU ld script: $output" $echo 'INPUT (' > $output for obj in $save_libobjs do $echo \""$obj"\" >> $output done $echo ')' >> $output else $echo "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for objects" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; struct stat st; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$dlsymsobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; overriding AR_FLAGS to 'cq'" func_warning "to ensure that POSIX-compatible ar will work" AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS } # func_mode_uninstall arg... func_mode_uninstall () { rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done test -z "$rm" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 || (test -h "$file") >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status } ## ----------- ## ## Main. ## ## ----------- ## { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." case $mode in compile) func_mode_compile ${1+"$@"} ;; execute) func_mode_execute ${1+"$@"} ;; finish) func_mode_finish ${1+"$@"} ;; install) func_mode_install ${1+"$@"} ;; link|relink) func_mode_link ${1+"$@"} ;; uninstall|clean) func_mode_uninstall ${1+"$@"} ;; "") help="$generic_help" func_fatal_help "you must specify a MODE" ;; esac test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi } exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: clhep-2.1.4.1.orig/.cvsignore0000755000175000017500000000015110234001432014362 0ustar olesolesMakefile.in configure aclocal.m4 autom4te.cache install-sh missing mkinstalldirs config.guess config.sub clhep-2.1.4.1.orig/cmake/0000755000175000017500000000000012242515135013455 5ustar olesolesclhep-2.1.4.1.orig/cmake/Templates/0000755000175000017500000000000012242515135015413 5ustar olesolesclhep-2.1.4.1.orig/cmake/Templates/clhep.pc.in0000644000175000017500000000052311672505677017457 0ustar olesoles# - Relocatable pkgconfig file for CLHEP # Generated by CMake : DO NOT EDIT! # prefix=@CLHEP_PKGCONFIG_PREFIX@ libdir=@CLHEP_PKGCONFIG_LIBDIR@ includedir=@CLHEP_PKGCONFIG_INCLUDEDIR@ Name: CLHEP Description: Class Library for High Energy Physics Version: @CLHEP_VERSION@ Libs: -L${libdir} -lCLHEP-@CLHEP_VERSION@ Cflags: -I${includedir} clhep-2.1.4.1.orig/cmake/Templates/ClhepVersion.h.in0000644000175000017500000000111411607115114020564 0ustar olesoles#ifndef CLHEP_VERSION_H #define CLHEP_VERSION_H 1 // // ClhepVersion.h // // Sample Usage: // std::string version = CLHEP::Version::String() // int mjr = CLHEP::Version::Major(); // #include namespace CLHEP { struct Version { static std::string String() { return "@VERSION@"; } static int Major() { return @CLHEP_Major@; } static int SubMajor() { return @CLHEP_SubMajor@; } static int Minor() { return @CLHEP_Minor@; } static int SubMinor() { return @CLHEP_SubMinor@; } }; } // namespace #endif // CLHEP_VERSION_H clhep-2.1.4.1.orig/cmake/Templates/CLHEPConfigVersion.cmake.in0000644000175000017500000000153711672505677022377 0ustar olesoles# - Versioning file for CLHEP # # This enables client projects of CLHEP to determine the version of CLHEP # they found using the find_package command. More importantly, it allows that # command to automatically determine whether the detected version is suitable # if the client project requested a minimum (or even exact) version of # CLHEP. # # Basic structure taken from the CMake Wiki tutorial: # http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file set(PACKAGE_VERSION "@CLHEP_VERSION@") # Check whether the requested PACKAGE_FIND_VERSION is compatible if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") set(PACKAGE_VERSION_COMPATIBLE FALSE) else() set(PACKAGE_VERSION_COMPATIBLE TRUE) if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") set(PACKAGE_VERSION_EXACT TRUE) endif() endif() clhep-2.1.4.1.orig/cmake/Templates/CLHEPConfig.cmake.in0000644000175000017500000001047111672505677021026 0ustar olesoles# - Config file for the CLHEP package # It defines the following variables # CLHEP_INCLUDE_DIRS - include directories for CLHEP # CLHEP_DEFINITIONS - compile definitions needed to use CLHEP # CLHEP_LIBRARIES - libraries to link against # # CLHEP is built concurrently as a single library and as a set of component # libraries. At present, this config file is only designed to configure # the single main library in static or shared mode. # # The following per-component variables are set: # # CLHEP_${COMPONENT}_FOUND True if CLHEP library mode "component" # was found # # CLHEP_${COMPONENT}_LIBRARY Contains the library for specified mode # "component" # # CLHEP current only supports two components: static and shared, which # represent the two possible library modes that the main CLHEP library # is built in. # # You can call find_package with 'static' or 'shared' as component arguments # to pick a particular library mode of CLHEP. For example # # find_package(CLHEP REQUIRED static) # # will set CLHEP_LIBRARIES to the CLHEP static library. # # If you do not specify a shared or static component argument, shared # libraries will be selected by default. # # =========================================================================== # Variables used by this module which can change the default behaviour of # this module. They need to be set prior to the call to find_package # # CLHEP_CONFIG_DEBUG - If set, this will enable some output from this module # to help in debugging it behaviour # #---------------------------------------------------------------------------- # --------------------------------------------------------------------------- # Print out values of the variables that we expect find_package to have passed # to us. This is useful for developers of CLHEPConfig! # if(CLHEP_CONFIG_DEBUG) message(STATUS "CLHEPDebug : CLHEP_VERSION = ${CLHEP_VERSION}") message(STATUS "CLHEPDebug : CLHEP_FIND_VERSION = ${CLHEP_FIND_VERSION}") message(STATUS "CLHEPDebug : CLHEP_FIND_REQUIRED = ${CLHEP_FIND_REQUIRED}") message(STATUS "CLHEPDebug : CLHEP_FIND_QUIETLY = ${CLHEP_FIND_QUIETLY}") message(STATUS "CLHEPDebug : CLHEP_FIND_COMPONENTS = ${CLHEP_FIND_COMPONENTS}") foreach(_cpt ${CLHEP_FIND_COMPONENTS}) message(STATUS "CLHEPDebug : CLHEP_FIND_REQUIRED_${_cpt} = ${CLHEP_FIND_REQUIRED_${_cpt}}") endforeach() endif() # end of debugging #---------------------------------------------------------------------------- # Locate ourselves, since all our config files should have been installed # alongside us... # get_filename_component(_thisdir "${CMAKE_CURRENT_LIST_FILE}" PATH) #---------------------------------------------------------------------------- # Configure the path to the CLHEP headers, using a relative path if possible. # This is only known at CMake time, so expand a CMake supplied variable # CLHEP has a nice simple header structure. set(CLHEP_INCLUDE_DIR @CLHEP_INCLUDE_DIR@) #---------------------------------------------------------------------------- # Construct the overall include path for using CLHEP # set(CLHEP_INCLUDE_DIRS ${CLHEP_INCLUDE_DIR}) #---------------------------------------------------------------------------- # Set the compile definitions required to use CLHEP # We don't really need this for now. set(CLHEP_DEFINITIONS @CLHEP_DEFINITIONS@) #---------------------------------------------------------------------------- # Include the file listing all the imported targets. # This is installed in the same location as us... # include("${_thisdir}/CLHEPLibraryDepends.cmake") #---------------------------------------------------------------------------- # Whilst the export file lists usable CMake targets, we also create # standard style _LIBRAR{Y|IES} so usage is transparent. This is also # useful later if we want to introduce component libraries. # set(CLHEP_shared_LIBRARY CLHEP) set(CLHEP_shared_FOUND 1) set(CLHEP_static_LIBRARY CLHEPS) set(CLHEP_static_FOUND 1) # - Handle shared vs static - default to shared if user didn't specify # This is actually very simple because we always build both! if(CLHEP_FIND_REQUIRED_shared) set(CLHEP_LIBRARIES CLHEP) elseif(CLHEP_FIND_REQUIRED_static) set(CLHEP_LIBRARIES CLHEPS) else() set(CLHEP_LIBRARIES CLHEP) endif() # And we should be good to go... clhep-2.1.4.1.orig/cmake/Modules/0000755000175000017500000000000012242515135015065 5ustar olesolesclhep-2.1.4.1.orig/cmake/Modules/ClhepParseArgs.cmake0000644000175000017500000000245211606714767020754 0ustar olesoles######################################################################## # clhep_parse_args # # From PARSE_ARGUMENTS (http://www.cmake.org/Wiki/CMakeMacroParseArguments). ######################################################################## MACRO(clhep_parse_args prefix arg_names option_names) SET(DEFAULT_ARGS) FOREACH(arg_name ${arg_names}) SET(${prefix}_${arg_name}) ENDFOREACH(arg_name) FOREACH(option ${option_names}) SET(${prefix}_${option} FALSE) ENDFOREACH(option) SET(current_arg_name DEFAULT_ARGS) SET(current_arg_list) FOREACH(arg ${ARGN}) SET(larg_names ${arg_names}) LIST(FIND larg_names "${arg}" is_arg_name) IF (is_arg_name GREATER -1) SET(${prefix}_${current_arg_name} ${current_arg_list}) SET(current_arg_name ${arg}) SET(current_arg_list) ELSE (is_arg_name GREATER -1) SET(loption_names ${option_names}) LIST(FIND loption_names "${arg}" is_option) IF (is_option GREATER -1) SET(${prefix}_${arg} TRUE) ELSE (is_option GREATER -1) SET(current_arg_list ${current_arg_list} ${arg}) ENDIF (is_option GREATER -1) ENDIF (is_arg_name GREATER -1) ENDFOREACH(arg) SET(${prefix}_${current_arg_name} ${current_arg_list}) ENDMACRO(clhep_parse_args) clhep-2.1.4.1.orig/cmake/Modules/ClhepBuildTex.cmake0000644000175000017500000000476412234461051020574 0ustar olesoles# run latex # clhep_latex( package main_tex_file [other tex or sty files to include] ) # for documentation FIND_PACKAGE(LATEX) macro( clhep_latex package main_tex_file ) IF(LATEX_COMPILER) FOREACH(arg ${ARGN}) CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/${arg} ${CMAKE_CURRENT_BINARY_DIR}/${arg} COPYONLY) set( depend_list ${arg} ${depend_list} ) ENDFOREACH(arg) ##message(STATUS "${package} ${main_tex_file} depends on ${depend_list}" ) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.aux COMMAND ${LATEX_COMPILER} -interaction=batchmode ${CMAKE_CURRENT_SOURCE_DIR}/${main_tex_file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${main_tex_file}.tex ${depend_list} COMMENT "Latex - first pass" ) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.dvi COMMAND ${LATEX_COMPILER} -interaction=batchmode ${CMAKE_CURRENT_SOURCE_DIR}/${main_tex_file} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.aux COMMENT "Latex - second pass" ) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.log COMMAND ${LATEX_COMPILER} -interaction=batchmode ${CMAKE_CURRENT_SOURCE_DIR}/${main_tex_file} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.dvi COMMENT "Latex - third pass" ) ADD_CUSTOM_TARGET(${main_tex_file} ALL echo DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.log ) IF(DVIPS_CONVERTER) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.ps COMMAND ${DVIPS_CONVERTER} ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.dvi -o ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.ps DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.dvi COMMENT "dvi2ps" ) IF(PS2PDF_CONVERTER) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.pdf COMMAND ${PS2PDF_CONVERTER} ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.ps DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.ps COMMENT "ps2pdf" ) ADD_CUSTOM_TARGET( ${package}${main_tex_file}Document ALL echo DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.pdf ) ENDIF(PS2PDF_CONVERTER) ENDIF(DVIPS_CONVERTER) INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.pdf DESTINATION doc/${package} ) ENDIF(LATEX_COMPILER) endmacro( clhep_latex ) clhep-2.1.4.1.orig/cmake/Modules/ClhepBuildLibrary.cmake0000644000175000017500000001043412047023777021442 0ustar olesoles# Build package libraries. # Build the main CLHEP source code list as we go. # # Recommended use: # clhep_build_library( ) # macro(clhep_build_library package) set( CLHEP_${package}_SOURCES ${ARGN} ) # build up the source list for CLHEP set( CLHEP_${package}_list CACHE INTERNAL "${package} sources" FORCE ) foreach( file ${ARGN} ) set( CLHEP_${package}_list ${CLHEP_${package}_list} ${CMAKE_CURRENT_SOURCE_DIR}/${file} CACHE INTERNAL "${package} sources" ) endforeach(file) ##message( STATUS "in ${package}, clheplib source list ${CLHEP_${package}_list}" ) # check for dependencies set( package_library_list ) if( ${PACKAGE}_DEPS ) foreach ( dep ${${PACKAGE}_DEPS} ) ##message( STATUS "clhep_build_library ${package} will use ${dep}") list(APPEND package_library_list ${dep}) endforeach() endif() # Add the libraries and set properties ADD_LIBRARY(${package} SHARED ${CLHEP_${package}_SOURCES}) ADD_LIBRARY(${package}S STATIC ${CLHEP_${package}_SOURCES}) SET_TARGET_PROPERTIES (${package} PROPERTIES OUTPUT_NAME CLHEP-${package}-${VERSION} CLEAN_DIRECT_OUTPUT 1 ) SET_TARGET_PROPERTIES(${package}S PROPERTIES OUTPUT_NAME CLHEP-${package}-${VERSION} CLEAN_DIRECT_OUTPUT 1 ) target_link_libraries(${package} ${package_library_list} ) target_link_libraries(${package}S ${package_library_list} ) # Install the libraries INSTALL (TARGETS ${package} ${package}S RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} ) endmacro(clhep_build_library) macro(clhep_build_libclhep ) foreach( pkg ${ARGN} ) ##message( STATUS "${pkg} sources are ${CLHEP_${pkg}_list}" ) list(APPEND CLHEP_DEPS ${LIBRARY_OUTPUT_PATH}/${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP-${pkg}-${VERSION}${CMAKE_STATIC_LIBRARY_SUFFIX} ) list(APPEND clhep_sources ${CLHEP_${pkg}_list} ) endforeach() ##message( STATUS "clheplib source list ${clhep_sources}" ) ADD_LIBRARY (CLHEP SHARED ${clhep_sources}) ADD_LIBRARY (CLHEPS STATIC ${clhep_sources}) SET_TARGET_PROPERTIES(CLHEP PROPERTIES OUTPUT_NAME CLHEP-${VERSION} CLEAN_DIRECT_OUTPUT 1 ) SET_TARGET_PROPERTIES(CLHEPS PROPERTIES OUTPUT_NAME CLHEP-${VERSION} CLEAN_DIRECT_OUTPUT 1 ) # export creates library dependency files for CLHEPConfig.cmake INSTALL(TARGETS CLHEP CLHEPS EXPORT CLHEPLibraryDepends RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} ) if( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" ) # copy file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clhep_static_symlink "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E copy ${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP-${VERSION}${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP${CMAKE_STATIC_LIBRARY_SUFFIX} WORKING_DIRECTORY \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}\" )" ) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clhep_shared_symlink "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E copy ${CMAKE_SHARED_LIBRARY_PREFIX}CLHEP-${VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_SHARED_LIBRARY_PREFIX}CLHEP${CMAKE_SHARED_LIBRARY_SUFFIX} WORKING_DIRECTORY \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin\" )" ) else() # create the symbolic links file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clhep_static_symlink "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP-${VERSION}${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP${CMAKE_STATIC_LIBRARY_SUFFIX} WORKING_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}\" )" ) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clhep_shared_symlink "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ${CMAKE_SHARED_LIBRARY_PREFIX}CLHEP-${VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_SHARED_LIBRARY_PREFIX}CLHEP${CMAKE_SHARED_LIBRARY_SUFFIX} WORKING_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}\" )" ) endif() INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/clhep_static_symlink ) INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/clhep_shared_symlink ) endmacro(clhep_build_libclhep ) clhep-2.1.4.1.orig/cmake/Modules/ClhepOutOfSourceBuild.cmake0000644000175000017500000000143511607661650022253 0ustar olesoles# Throw a fatal error if cmake is invoked from within the source code directory tree # clhep_ensure_out_of_source_build() # macro (clhep_ensure_out_of_source_build) string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" in_source) string( REGEX MATCH "${CMAKE_SOURCE_DIR}/" in_source_subdir "${CMAKE_BINARY_DIR}") if (in_source OR in_source_subdir) message(FATAL_ERROR " ERROR: In source builds of this project are not allowed. A separate build directory is required. Please create one and run cmake from the build directory. Also note that cmake has just added files to your source code directory. We suggest getting a new copy of the source code. Otherwise, delete `CMakeCache.txt' and the directory `CMakeFiles'. ") endif () endmacro (clhep_ensure_out_of_source_build) clhep-2.1.4.1.orig/cmake/Modules/ClhepPackaging.cmake0000644000175000017500000001415012012537502020725 0ustar olesoles# - ClhepPackaging # # This module provides CPack configuration for CLHEP # # original code supplied by Ben Morgan Ben.Morgan@warwick.ac.uk # modifications by Lynn Garren garren@fnal.gov # the binary tarball should, e.g., have this format: # x86_64-slc5-gcc46-opt/include # /bin # /lib # /doc (optional) # basically, the tarball should mirror the install directory, # but with the appropriate top level directory # tarball names: clhep-2.1.1.0-x86_64-slc5-gcc46-opt.tgz # clhep-2.1.1.0-x86_64-slc5-gcc41-opt.tgz # clhep-2.1.1.0-x86_64-mac106-gcc42-opt.tgz # result of lsb_release -s -i on various platforms # Scientific Linux Fermi 5.x: ScientificSLF # Scientific Linux Fermi 6.x: ScientificFermi # Scientific Linux CERN 5.x: ScientificCERNSLC # Scientific Linux CERN 6.x: ScientificFermi # no lsb_release on lx64slc6.cern.ch machines? include(ClhepPackageCompiler) #---------------------------------------------------------------------------- # Package up needed system libraries - seems to only be needed on Windows # if("${CPACK_SYSTEM_NAME}" MATCHES Windows) include(InstallRequiredSystemLibraries) endif() #---------------------------------------------------------------------------- # General packaging setup - variables relevant to all package formats # CLHEP use of version variables is non-standard set(CPACK_PACKAGE_VERSION ${VERSION}) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Class Library for High Energy Physics") set(CPACK_PACKAGE_VENDOR "CLHEP Project") # add a top level directory with the same name as the package tarball set( CPACK_INCLUDE_TOPLEVEL_DIRECTORY 1 ) set( CPACK_GENERATOR TGZ ) set( CPACK_PACKAGE_NAME clhep ) clhep_package_compiler() #---------------------------------------------------------------------------- # Set name of CPACK_SYSTEM_NAME based on platform and architecture where # needed. We do this because we may want to produce packages for, say, # 32 and 64 bit arches on linux. # # N.B. This is all UNTESTED for the cross-compile case!!! # if(NOT DEFINED CPACK_SYSTEM_NAME) # Cygwin is always Cygwin... if("${CMAKE_SYSTEM_NAME}" MATCHES "CYGWIN") set(CPACK_SYSTEM_NAME Cygwin) else() if(UNIX AND NOT APPLE) # On Linux, try and find lsb_release find_program(LSB_RELEASE_PROGRAM lsb_release DOC "The Linux Standard Base system query tool") if(LSB_RELEASE_PROGRAM) # We have linux, so incorporate Vendor info into package name # - Distributor ID execute_process(COMMAND ${LSB_RELEASE_PROGRAM} -s -i OUTPUT_VARIABLE LSB_VENDOR OUTPUT_STRIP_TRAILING_WHITESPACE) string(REGEX REPLACE " " "-" LSB_VENDOR ${LSB_VENDOR}) string(TOLOWER ${LSB_VENDOR} LSB_VENDOR) if("${LSB_VENDOR}" MATCHES "scientificslf") set(LSB_VENDOR "slf") elseif("${LSB_VENDOR}" MATCHES "scientificfermilts") set(LSB_VENDOR "slf") elseif("${LSB_VENDOR}" MATCHES "scientificfermi") set(LSB_VENDOR "slf") elseif("${LSB_VENDOR}" MATCHES "scientificcernslc") set(LSB_VENDOR "slc") else() set(LSB_VENDOR ${LSB_VENDOR}) endif() # - Distributor release execute_process(COMMAND ${LSB_RELEASE_PROGRAM} -s -r OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE) string(TOLOWER ${LSB_RELEASE} LSB_RELEASE) string(REGEX REPLACE "([0-9])\\.([0-9])?" "\\1" LSB_RELEASE ${LSB_RELEASE}) # Cache the vendor tag, because users might want to edit it set(LSB_VENDOR_TAG ${LSB_VENDOR}${LSB_RELEASE} CACHE STRING "LSB vendor tag for use in packaging") if( NOT CPack_COMPILER_STRING ) set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_PROCESSOR}-${LSB_VENDOR_TAG}) else() set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_PROCESSOR}-${LSB_VENDOR_TAG}${CPack_COMPILER_STRING}) endif() mark_as_advanced(LSB_RELEASE_PROGRAM LSB_VENDOR_TAG) else() # Fallback to using NAME-ARCH on other UNICES other than Apple set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_NAME}${CPack_COMPILER_STRING}) endif() else() # On Mac, we use NAME-ARCH, but ARCH is 'Universal' if more than # one arch is built for. Note that falling back to use # CMAKE_SYSTEM_PROCESSOR may *not* be 100% reliable. list(LENGTH CMAKE_OSX_ARCHITECTURES _number_of_arches) # CERN uses mac106 for Snow Leopard string(REGEX REPLACE "([0-9])\\.([0-9])?" "\\1\\2" LSB_RELEASE ${CMAKE_SYSTEM_VERSION}) if("${LSB_RELEASE}" MATCHES "108") set(BASE_SYSTEM_NAME mac106) else() set(BASE_SYSTEM_NAME mac${LSB_RELEASE}) endif() if(NOT _number_of_arches) # - Default set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_PROCESSOR}-${BASE_SYSTEM_NAME}${CPack_COMPILER_STRING}) elseif(_number_of_arches GREATER 1) # - Universal set(CPACK_SYSTEM_NAME ${BASE_SYSTEM_NAME}-Universal) else() # - Use what the user specified set(CPACK_SYSTEM_NAME ${CMAKE_OSX_ARCHITECTURES}-${BASE_SYSTEM_NAME}${CPack_COMPILER_STRING}) endif() endif() endif() endif() # On Windows, distinguish x64 and x86 - not sure this is really needed yet!!! if("${CPACK_SYSTEM_NAME}" MATCHES Windows) if(CMAKE_CL_64) set(CPACK_SYSTEM_NAME win64-x64) else() set(CPACK_SYSTEM_NAME win32-x86) endif() endif() # check for extra qualifiers if( NOT CMAKE_BUILD_TYPE ) SET( CMAKE_BUILD_TYPE_TOLOWER default ) else() STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) if( ${CMAKE_BUILD_TYPE_TOLOWER} MATCHES "debug") set(CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-debug ) elseif( ${CMAKE_BUILD_TYPE_TOLOWER} MATCHES "relwithdebinfo") set(CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-opt ) else() set(CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-${CMAKE_BUILD_TYPE_TOLOWER} ) endif() endif() message(STATUS "clhep CPACK_PACKAGE_NAME: ${CPACK_PACKAGE_NAME} " ) message(STATUS "clhep CPACK_PACKAGE_VERSION: ${CPACK_PACKAGE_VERSION} " ) message(STATUS "clhep CPACK_SYSTEM_NAME: ${CPACK_SYSTEM_NAME}" ) #---------------------------------------------------------------------------- # Finally, include the base CPack configuration # include(CPack) clhep-2.1.4.1.orig/cmake/Modules/ClhepCopyHeaders.cmake0000644000175000017500000000412411772163753021266 0ustar olesoles# since the CLHEP source code installation does not have the # expected header paths, install headers in the build directory # # Recommended use: # clhep_copy_headers( ) include(ClhepParseVersion) macro (clhep_copy_headers ) foreach( package ${ARGN} ) message(STATUS "checking for headers in ${package}") string(TOUPPER ${package} UPACKAGE ) set( PACKAGE ${package} ) if( found_drand48 ) set( DRAND48_DEF "#define HAVE_DRAND48 1" ) else() set( DRAND48_DEF "#undef HAVE_DRAND48" ) endif() FILE( GLOB headers ${CLHEP_SOURCE_DIR}/${package}/${package}/*.h ${CLHEP_SOURCE_DIR}/${package}/${package}/*.hh ${CLHEP_SOURCE_DIR}/${package}/${package}/*.icc ) FILE( GLOB defs ${CLHEP_SOURCE_DIR}/${package}/${package}/cmake-defs.h.in ) foreach( defhdr ${defs} ) ##message(STATUS "process ${defhdr} to create ${CLHEP_BINARY_DIR}/CLHEP/${package}/defs.h") # this copies the file and creates directories if necessary CONFIGURE_FILE( ${defhdr} ${CLHEP_BINARY_DIR}/CLHEP/${package}/defs.h @ONLY ) # install defs.h from here INSTALL (FILES ${CLHEP_BINARY_DIR}/CLHEP/${package}/defs.h DESTINATION include/CLHEP/${package} ) endforeach( defhdr ) foreach( hdr ${headers} ) #STRING( REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/${package} ${CLHEP_BINARY_DIR}/CLHEP output_file ${hdr}) set(output_dir ${CLHEP_BINARY_DIR}/CLHEP/${package}) get_filename_component(shorthdr ${hdr} NAME) ##message(STATUS "moving ${shorthdr} to ${output_dir}") # this copies the file and creates directories if necessary CONFIGURE_FILE( ${hdr} ${output_dir}/${shorthdr} COPYONLY ) endforeach( hdr ) endforeach(package) # get ClhepVersion.h parse_version( CLHEP ${VERSION} ) CONFIGURE_FILE( ${CLHEP_SOURCE_DIR}/cmake/Templates/ClhepVersion.h.in ${CLHEP_BINARY_DIR}/CLHEP/ClhepVersion.h @ONLY ) INSTALL (FILES ${CLHEP_BINARY_DIR}/CLHEP/ClhepVersion.h DESTINATION include/CLHEP ) endmacro (clhep_copy_headers) clhep-2.1.4.1.orig/cmake/Modules/ClhepPackageCompiler.cmake0000644000175000017500000000600012012537502022062 0ustar olesoles# determine the compiler and version # this code is more or less lifted from FindBoost #------------------------------------------------------------------------------- # # Runs compiler with "-dumpversion" and parses major/minor # version with a regex. # FUNCTION(_My_COMPILER_DUMPVERSION _OUTPUT_VERSION) execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dumpversion OUTPUT_VARIABLE _my_COMPILER_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) set( COMPILER_VERSION ${_my_COMPILER_VERSION} PARENT_SCOPE) STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" _my_COMPILER_VERSION ${_my_COMPILER_VERSION}) SET(${_OUTPUT_VERSION} ${_my_COMPILER_VERSION} PARENT_SCOPE) ENDFUNCTION() # # End functions/macros # #------------------------------------------------------------------------------- macro( clhep_package_compiler ) if (My_COMPILER) SET (CPack_COMPILER_STRING ${My_COMPILER}) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "using user-specified My_COMPILER = ${CPack_COMPILER_STRING}") else(My_COMPILER) # Attempt to guess the compiler suffix # NOTE: this is not perfect yet, if you experience any issues # please report them and use the My_COMPILER variable # to work around the problems. if (MSVC90) SET (CPack_COMPILER_STRING "-vc90") elseif (MSVC80) SET (CPack_COMPILER_STRING "-vc80") elseif (MSVC71) SET (CPack_COMPILER_STRING "-vc71") elseif (MSVC70) # Good luck! SET (CPack_COMPILER_STRING "-vc7") # yes, this is correct elseif (MSVC60) # Good luck! SET (CPack_COMPILER_STRING "-vc6") # yes, this is correct elseif (BORLAND) SET (CPack_COMPILER_STRING "-bcb") elseif("${CMAKE_CXX_COMPILER}" MATCHES "icl" OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") if(WIN32) set (CPack_COMPILER_STRING "-iw") else() set (CPack_COMPILER_STRING "-il") endif() elseif (MINGW) _My_COMPILER_DUMPVERSION(CPack_COMPILER_STRING_VERSION) SET (CPack_COMPILER_STRING "-mgw${CPack_COMPILER_STRING_VERSION}") elseif (UNIX) if (CMAKE_COMPILER_IS_GNUCXX) _My_COMPILER_DUMPVERSION(CPack_COMPILER_STRING_VERSION) # Determine which version of GCC we have. if(APPLE) SET (CPack_COMPILER_STRING "-gcc${CPack_COMPILER_STRING_VERSION}") else() SET (CPack_COMPILER_STRING "-gcc${CPack_COMPILER_STRING_VERSION}") endif() endif (CMAKE_COMPILER_IS_GNUCXX) endif() #message(STATUS "Package compiler ${CPack_COMPILER_STRING}") endif(My_COMPILER) endmacro( clhep_package_compiler ) macro( clhep_package_compiler_status ) clhep_package_compiler() message(STATUS " ") message(STATUS "C++ compiler: ${CMAKE_CXX_COMPILER}") message(STATUS "Compiler version: ${COMPILER_VERSION}") message(STATUS "Compiler string for cpack: ${CPack_COMPILER_STRING}") message(STATUS " ") endmacro( clhep_package_compiler_status ) clhep-2.1.4.1.orig/cmake/Modules/ClhepVariables.cmake0000644000175000017500000002451512013254144020756 0ustar olesoles# # clhep_set_compiler_flags() # sets the default compiler flags # calls clhep_autoconf_variables # # clhep_autoconf_variables() defines global variables # # clhep_package_config(): # defines ${PACKAGE}_LIBS # processes ${PACKAGE}-config.in # processes ${PACKAGE}-deps.in # # clhep_package_config_no_lib(): # processes ${PACKAGE}-config.in # # clhep_config(): # processes clhep-config.in # # clhep_lib_suffix(); # check for -DLIB_SUFFIX=xxx and process intelligently macro( clhep_autoconf_variables ) # these variables are used by -config.in # typical values from autoconf: # AM_CXXFLAGS = -O -ansi -pedantic -Wall -D_GNU_SOURCE # CXXFLAGS = -g -O2 # CXX = g++ # CXXCPP = g++ -E # CPPFLAGS = # CXXLD = $(CXX) # AM_LDFLAGS = # LDFLAGS = # LIBS = # automake/autoconf variables set( prefix ${CMAKE_INSTALL_PREFIX} ) set( exec_prefix "\${prefix}" ) set( includedir "\${prefix}/include" ) set( configure_input "Generated by cmake" ) ### autoconf variables typically do not have the path ##get_filename_component( CXX ${CMAKE_CXX_COMPILER} NAME ) ##if( ${CXX} MATCHES "c\\+\\+" ) ## set( CXX g++ ) ##endif() set( CXX ${CMAKE_BASE_NAME} ) ##get_filename_component( AR ${CMAKE_AR} NAME ) ##get_filename_component( RANLIB ${CMAKE_RANLIB} NAME ) set( CXXCPP "${CXX} -E" ) if( ${CMAKE_BUILD_TYPE} MATCHES "Debug" ) set( CXXFLAGS ${CMAKE_CXX_FLAGS_DEBUG} ) elseif( ${CMAKE_BUILD_TYPE} MATCHES "Release" ) set( CXXFLAGS ${CMAKE_CXX_FLAGS_RELEASE} ) elseif( ${CMAKE_BUILD_TYPE} MATCHES "RelWithDebInfo" ) set( CXXFLAGS ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ) elseif( ${CMAKE_BUILD_TYPE} MATCHES "MinSizeRel" ) set( CXXFLAGS ${CMAKE_CXX_FLAGS_MINSIZEREL} ) endif() ##message( STATUS "build type ${CMAKE_BUILD_TYPE} has ${CXXFLAGS}") set( AM_CXXFLAGS ${CMAKE_CXX_FLAGS} ) set( LDFLAGS ${CMAKE_MODULE_LINKER_FLAGS} ) set( LIBS "" ) set( DIFF_Q "diff -q -b" ) ### useful if you need to check a variable ##message( STATUS "CMAKE_SYSTEM_NAME is ${CMAKE_SYSTEM_NAME}" ) ##message( STATUS "CMAKE_BASE_NAME is ${CMAKE_BASE_NAME}" ) ##message( STATUS "CMAKE_CXX_COMPILER_ID is ${CMAKE_CXX_COMPILER_ID}" ) ##message( STATUS "CMAKE_COMPILER_IS_GNUCXX is ${CMAKE_COMPILER_IS_GNUCXX}" ) ##message( STATUS "CMAKE_COMPILER_IS_MINGW is ${CMAKE_COMPILER_IS_MINGW}" ) ##message( STATUS "CMAKE_COMPILER_IS_CYGWIN is ${CMAKE_COMPILER_IS_CYGWIN}" ) ##message( STATUS "CMAKE_AR is ${CMAKE_AR}" ) ##message( STATUS "CMAKE_RANLIB is ${CMAKE_RANLIB}" ) ##message( STATUS "CMAKE_CXX_OUTPUT_EXTENSION is ${CMAKE_CXX_OUTPUT_EXTENSION}" ) ##message( STATUS "CMAKE_SHARED_LIBRARY_CXX_FLAGS is ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}" ) ##message( STATUS "CMAKE_SHARED_MODULE_CXX_FLAGS is ${CMAKE_SHARED_MODULE_CXX_FLAGS}" ) ##message( STATUS "CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS is ${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}" ) ##message( STATUS "CMAKE_CXX_FLAGS is ${CMAKE_CXX_FLAGS}" ) ##message( STATUS "CMAKE_CXX_FLAGS_DEBUG is ${CMAKE_CXX_FLAGS_DEBUG}" ) ##message( STATUS "CMAKE_CXX_FLAGS_RELEASE is ${CMAKE_CXX_FLAGS_RELEASE}" ) ##message( STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO is ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" ) ##message( STATUS "CMAKE_CXX_STANDARD_LIBRARIES is ${CMAKE_CXX_STANDARD_LIBRARIES}" ) ##message( STATUS "CMAKE_CXX_LINK_FLAGS is ${CMAKE_CXX_LINK_FLAGS}" ) endmacro( clhep_autoconf_variables ) macro( clhep_set_compiler_flags ) ##message(STATUS "incoming cmake build type is ${CMAKE_BUILD_TYPE}") if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "" FORCE) endif() message(STATUS "cmake build type is ${CMAKE_BUILD_TYPE}") #message(STATUS "cmake compilers ${CMAKE_CXX_COMPILER} ${CMAKE_C_COMPILER}") get_filename_component(clhep_cxx_compiler ${CMAKE_CXX_COMPILER} NAME) get_filename_component(clhep_c_compiler ${CMAKE_C_COMPILER} NAME) #message(STATUS "using compilers ${clhep_cxx_compiler} ${clhep_c_compiler}") if( ${clhep_c_compiler} STREQUAL "clang" ) set(CMAKE_C_FLAGS "-O -pedantic -Wall ${CMAKE_C_FLAGS}") elseif( CMAKE_COMPILER_IS_GNUCC ) set(CMAKE_C_FLAGS "-O -ansi -pedantic -Wall -D_GNU_SOURCE ${CMAKE_C_FLAGS}") endif() if( ${clhep_cxx_compiler} STREQUAL "clang++" ) set(CMAKE_CXX_FLAGS "-O -pedantic -Wall ${CMAKE_CXX_FLAGS}") elseif(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "-O -ansi -pedantic -Wall -D_GNU_SOURCE ${CMAKE_CXX_FLAGS}") endif() if( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" ) ##message( STATUS "system is Windows" ) ##message( STATUS "CMAKE_BASE_NAME is ${CMAKE_BASE_NAME}" ) if( ${CMAKE_BASE_NAME} MATCHES "cl" ) ##message( STATUS "compiler is MSVC" ) ##message( STATUS "incoming basic compiler flags are ${CMAKE_CXX_FLAGS}") set(CMAKE_C_FLAGS "/EHsc /nologo /GR /MD /D USING_VISUAL") set(CMAKE_CXX_FLAGS "/EHsc /nologo /GR /MD /D USING_VISUAL") endif() endif() clhep_autoconf_variables() message( STATUS "compiling with ${clhep_cxx_compiler} ${CMAKE_CXX_FLAGS} ${CXXFLAGS}") endmacro( clhep_set_compiler_flags ) macro( clhep_package_config_no_lib ) set( ${PACKAGE}_CPPFLAGS "-I${includedir}" ) set( ${PACKAGE}_LDFLAGS " " ) set( ${PACKAGE}_LIBS " " ) configure_file ( ${CLHEP_SOURCE_DIR}/${PACKAGE}/${PACKAGE}-config.in ${CLHEP_BINARY_DIR}/${PACKAGE}/${PACKAGE}-config @ONLY ) ## don't install -config on Windows if( NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows" ) install ( PROGRAMS ${CLHEP_BINARY_DIR}/${PACKAGE}/${PACKAGE}-config DESTINATION bin ) endif() endmacro( clhep_package_config_no_lib ) macro( clhep_package_config ) set( ${PACKAGE}_CPPFLAGS "-I${includedir}" ) set( ${PACKAGE}_LDFLAGS "-L\${exec_prefix}/lib${LIB_SUFFIX}" ) set( ${PACKAGE}_LIBS "-lCLHEP-${PACKAGE}-${VERSION}" ) if( ${PACKAGE}_DEPS ) foreach ( dep ${${PACKAGE}_DEPS} ) message( STATUS "${PACKAGE} depends on ${dep}") set( ${PACKAGE}_LIBS "${${PACKAGE}_LIBS} -lCLHEP-${dep}-${VERSION}" ) endforeach() endif() configure_file ( ${CLHEP_SOURCE_DIR}/${PACKAGE}/${PACKAGE}-config.in ${CLHEP_BINARY_DIR}/${PACKAGE}/${PACKAGE}-config @ONLY ) configure_file ( ${CLHEP_SOURCE_DIR}/${PACKAGE}/${PACKAGE}-deps.in ${CLHEP_BINARY_DIR}/${PACKAGE}/${PACKAGE}-deps @ONLY ) ## don't install -config on Windows if( NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows" ) install ( PROGRAMS ${CLHEP_BINARY_DIR}/${PACKAGE}/${PACKAGE}-config DESTINATION bin ) endif() endmacro( clhep_package_config ) macro( clhep_config ) configure_file ( ${CLHEP_SOURCE_DIR}/clhep-config.in ${CLHEP_BINARY_DIR}/clhep-config @ONLY ) ## don't install clhep-config on Windows if( NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows" ) install ( PROGRAMS ${CLHEP_BINARY_DIR}/clhep-config DESTINATION bin ) endif() endmacro( clhep_config ) macro( _clhep_lib_suffix_64 ) if( APPLE ) #message(STATUS "checking LIB_SUFFIX ${LIB_SUFFIX} against ${CMAKE_SYSTEM_PROCESSOR} and ${CMAKE_OSX_ARCHITECTURES}") # On Mac, we use NAME-ARCH, but ARCH is 'Universal' if more than # one arch is built for. Note that falling back to use # CMAKE_SYSTEM_PROCESSOR may *not* be 100% reliable. list(LENGTH CMAKE_OSX_ARCHITECTURES _number_of_arches) if(NOT _number_of_arches) # - Default if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") # building for 64bit else() message(STATUS "WARNING: LIB_SUFFIX ${LIB_SUFFIX} inappropriate for this build") set(LIB_SUFFIX "") endif() elseif(_number_of_arches GREATER 1) # - Universal else() # - Use what the user specified if (${CMAKE_OSX_ARCHITECTURES} STREQUAL "x86_64") # building for 64bit else() message(STATUS "WARNING: LIB_SUFFIX ${LIB_SUFFIX} inappropriate for this build") set(LIB_SUFFIX "") endif() endif() elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" ) #message(STATUS "checking LIB_SUFFIX ${LIB_SUFFIX} against ${CMAKE_SYSTEM_PROCESSOR} ") if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86") # building for 64bit else() message(STATUS "WARNING: LIB_SUFFIX ${LIB_SUFFIX} inappropriate for this build") set(LIB_SUFFIX "") endif() else() #message(STATUS "checking LIB_SUFFIX ${LIB_SUFFIX} against ${CMAKE_SYSTEM_PROCESSOR} ") if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") # building for 64bit else() message(STATUS "WARNING: LIB_SUFFIX ${LIB_SUFFIX} inappropriate for this build") set(LIB_SUFFIX "") endif() endif() endmacro( _clhep_lib_suffix_64 ) macro( _clhep_lib_suffix_32 ) if( APPLE ) #message(STATUS "checking LIB_SUFFIX ${LIB_SUFFIX} against ${CMAKE_SYSTEM_PROCESSOR} and ${CMAKE_OSX_ARCHITECTURES}") # On Mac, we use NAME-ARCH, but ARCH is 'Universal' if more than # one arch is built for. Note that falling back to use # CMAKE_SYSTEM_PROCESSOR may *not* be 100% reliable. list(LENGTH CMAKE_OSX_ARCHITECTURES _number_of_arches) if(NOT _number_of_arches) # - Default if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386") # building for 32bit else() message(STATUS "WARNING: LIB_SUFFIX ${LIB_SUFFIX} inappropriate for this build") set(LIB_SUFFIX "") endif() elseif(_number_of_arches GREATER 1) # - Universal else() # - Use what the user specified if (${CMAKE_OSX_ARCHITECTURES} STREQUAL "i386") # building for 32bit else() message(STATUS "WARNING: LIB_SUFFIX ${LIB_SUFFIX} inappropriate for this build") set(LIB_SUFFIX "") endif() endif() else() #message(STATUS "checking LIB_SUFFIX ${LIB_SUFFIX} against ${CMAKE_SYSTEM_PROCESSOR} ") if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686") # building for 32bit elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386") # building for 32bit else() message(STATUS "WARNING: LIB_SUFFIX ${LIB_SUFFIX} inappropriate for this build") set(LIB_SUFFIX "") endif() endif() endmacro( _clhep_lib_suffix_32 ) macro( clhep_lib_suffix ) if(LIB_SUFFIX) if ( ${LIB_SUFFIX} STREQUAL "64" ) _clhep_lib_suffix_64() elseif( ${LIB_SUFFIX} STREQUAL "32" ) _clhep_lib_suffix_32() endif() endif() message(STATUS "libraries will be installed in $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}") endmacro( clhep_lib_suffix ) clhep-2.1.4.1.orig/cmake/Modules/ClhepBuildTest.cmake0000644000175000017500000000502312235754600020746 0ustar olesoles# Create the tests # # clhep_test( testname # [LIBS] # [DEPENDS] # [SIMPLE] - this test does not require a shell script # [FAIL] - test is epected to fail # [NOLIB] - no library dependencies # ) # testname is the base name of the .cc file # # if the test requires running a shell script: # clhep_test( testname ) # testname is the base name of the .cc and .sh.in file # include(ClhepParseArgs) macro( clhep_test testname ) clhep_parse_args( CTST "LIBS;DEPENDS" "SIMPLE;FAIL;NOLIB" ${ARGN}) # automake/autoconf variables for ${testname}.sh.in set(srcdir ${CMAKE_CURRENT_SOURCE_DIR}) set(builddir ${CMAKE_CURRENT_BINARY_DIR}) if( CTST_NOLIB ) set(package_library_list) else() set( package_library_list ${PACKAGE}S) #set( package_library_list ${PROJECT_BINARY_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP-${PACKAGE}-${VERSION}${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() if( ${PACKAGE}_DEPS ) foreach ( dep ${${PACKAGE}_DEPS} ) ##message( STATUS "clhep_test ${testname} will use ${dep}") list(APPEND package_library_list ${PACKAGE}S) #list(APPEND package_library_list ${PROJECT_BINARY_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}CLHEP-${dep}-${VERSION}${CMAKE_STATIC_LIBRARY_SUFFIX} ) endforeach() endif() link_libraries( ${package_library_list} ) ##message( STATUS "building ${testname} from ${CMAKE_CURRENT_SOURCE_DIR} in ${CMAKE_CURRENT_BINARY_DIR}" ) ADD_EXECUTABLE(${testname} ${testname}.cc) if( CTST_SIMPLE ) add_test( ${testname} ${CMAKE_CURRENT_BINARY_DIR}/${testname} ) if( CTST_FAIL ) set_tests_properties( ${testname} PROPERTIES WILL_FAIL TRUE ) endif() if( CTST_DEPENDS ) set_tests_properties( ${testname} PROPERTIES DEPENDS ${CTST_DEPENDS} ) #message(STATUS "clhep_test: ${testname} depends on ${CTST_DEPENDS}") endif( CTST_DEPENDS ) else() if( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" ) message( STATUS "skipping ${testname}.sh on ${CMAKE_SYSTEM_NAME}") else() configure_file( ${testname}.sh.in ${CMAKE_CURRENT_BINARY_DIR}/${testname}.sh @ONLY ) add_test( ${testname}.sh ${CMAKE_CURRENT_BINARY_DIR}/${testname}.sh ) if( CTST_FAIL ) set_tests_properties( ${testname}.sh PROPERTIES WILL_FAIL TRUE ) endif() if( CTST_DEPENDS ) add_custom_target(check COMMAND ${testname} DEPENDS ${CTST_DEPENDS} ) endif( CTST_DEPENDS ) endif() endif() endmacro( clhep_test ) clhep-2.1.4.1.orig/cmake/Modules/ClhepParseVersion.cmake0000644000175000017500000000134411607661650021475 0ustar olesoles# parse a version string and set the cmake project subversions # # parse_version( package version ) macro( parse_version package vers ) # CLHEP versions have 4 numbers STRING( REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+\\.[0-9]+.*" "\\1" ${package}_Major "${vers}" ) STRING( REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" ${package}_SubMajor "${vers}" ) STRING( REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" ${package}_Minor "${vers}" ) STRING( REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" ${package}_SubMinor "${vers}" ) ##message(STATUS "version ${vers} parses to ${${package}_Major} ${${package}_SubMajor} ${${package}_Minor} ${${package}_SubMinor}" ) endmacro( parse_version ) clhep-2.1.4.1.orig/cmake/Modules/ClhepToolchain.cmake0000644000175000017500000001260712013254144020765 0ustar olesoles#---------------------------------------------------------------------------- # Finally, we can configure the toolchain files for build and install # directories. # # Toolchains: # - CMake via use of 'CLHEPConfig.cmake' # - pkgconfig via 'clhep.pc' # # We only do this for the main CLHEP library to illustrate the basic # pattern. It can be extended to handle the component packages, but this # is more complex and would hide the basic concepts. # # Both are fully relocatable, like clhep-config, so can be distributed in # relocatable binary packages. # code supplied by Ben Morgan Ben.Morgan@warwick.ac.uk macro(clhep_toolchain) #---------------------------------------------------------------------------- # - First we handle the build tree # This setup allows a build of CLHEP to be used directly *without* installing # it. This allows several useful development patterns, such as checking an # application using CLHEP works with different versions/tag sets. # # First we set the needed variables set(CLHEP_VERSION ${VERSION}) set(CLHEP_DEFINITIONS ) set(CLHEP_INCLUDE_DIR ${PROJECT_BINARY_DIR}) # Now we configure the CLHEPConfig and CLHEPConfigVersion file templates, # outputting to the top level of the build tree. # This allows users to 'point' CMake to the build by something like # # # Some CMakeLists.txt # ... # find_package(CLHEP 2.1.0.1 REQUIRED) # # in their buildscript, and then pointing cmake to the build directory via # # cmake -DCLHEP_DIR=/path/to/clhep/build /path/to/source/of/app # configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/CLHEPConfigVersion.cmake.in ${PROJECT_BINARY_DIR}/CLHEPConfigVersion.cmake @ONLY ) configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/CLHEPConfig.cmake.in ${PROJECT_BINARY_DIR}/CLHEPConfig.cmake @ONLY ) # We 'export' the main CLHEP library targets from the build tree. # This file is include()d by CLHEPConfig.cmake export(TARGETS CLHEP CLHEPS FILE ${PROJECT_BINARY_DIR}/CLHEPLibraryDepends.cmake ) # Now we configure clhep.pc. # In the build tree we hardcode all paths, as we never need to relocate # a build tree # set(CLHEP_PKGCONFIG_PREFIX ${PROJECT_BINARY_DIR}) set(CLHEP_PKGCONFIG_INCLUDEDIR ${CLHEP_INCLUDE_DIR}) set(CLHEP_PKGCONFIG_LIBDIR ${PROJECT_BINARY_DIR}/lib${LIB_SUFFIX}) configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/clhep.pc.in ${PROJECT_BINARY_DIR}/clhep.pc @ONLY ) #---------------------------------------------------------------------------- # - Now we handle the installation tree # # Again we set the needed variable first. Not all have actually changed, # but we set again for clarity and just to be sure. set(CLHEP_VERSION ${VERSION}) set(CLHEP_DEFINITIONS ) # The setup of the include dir is slightly different because we want # to make the install relocatable (Current CLHEP setup *is* relocatable). # We use a relative path from the directory where the CLHEPConfig.cmake # file is installed to the actual include dir. file(RELATIVE_PATH _relincpath ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/CLHEP-${VERSION} ${CMAKE_INSTALL_PREFIX}/include ) set(CLHEP_INCLUDE_DIR "\${_thisdir}/${_relincpath}") # Now we configure the CLHEPConfig and CLHEPConfigVersion file templates, # outputting to a directory in the build directory. This is simply a # placeholder to store them until we install later. configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/CLHEPConfigVersion.cmake.in ${PROJECT_BINARY_DIR}/InstallTreeFiles/CLHEPConfigVersion.cmake @ONLY ) configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/CLHEPConfig.cmake.in ${PROJECT_BINARY_DIR}/InstallTreeFiles/CLHEPConfig.cmake @ONLY ) # Also configure the pkgconfig file, again outputting to a directory under # the build directory ready for installation # Now we use the 'pcfiledir' variable of pkg-config - this tells us the # directory where clhep.pc is located. Since we know we'll install clhep.pc # in CMAKE_INSTALL_PREFIX/lib/pkgconfig, we can calculate relative paths # to the include and lib dirs.... This make the pc file fully relocatable!! # If you later use GNUInstallDirs.cmake, this would need more work to # ensure accurate calculation of the relative path. set(CLHEP_PKGCONFIG_PREFIX "\${pcfiledir}/../..") set(CLHEP_PKGCONFIG_LIBDIR "\${prefix}/lib${LIB_SUFFIX}") set(CLHEP_PKGCONFIG_INCLUDEDIR "\${prefix}/include") configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/clhep.pc.in ${PROJECT_BINARY_DIR}/InstallTreeFiles/clhep.pc @ONLY ) # - Install the config files, and 'install export' the library depends file # The choice of 'lib/CLHEP-' is based on the recommendations # in the CMake documentation for find_package on UNIX so that # CMake can potentially find the Config file automatically. We don't # consider the Apple case because we don't (yet) build CLHEP as a Framework. # The Windows case can be easily added later. # The location can of course be modified if you wish. install(FILES ${PROJECT_BINARY_DIR}/InstallTreeFiles/CLHEPConfigVersion.cmake ${PROJECT_BINARY_DIR}/InstallTreeFiles/CLHEPConfig.cmake DESTINATION lib${LIB_SUFFIX}/CLHEP-${VERSION} ) install(EXPORT CLHEPLibraryDepends DESTINATION lib${LIB_SUFFIX}/CLHEP-${VERSION}) # Install the pkg-config file. The choice of 'lib${LIB_SUFFIX}/pkgconfig' for the # installation seems fairly standard. install(FILES ${PROJECT_BINARY_DIR}/InstallTreeFiles/clhep.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig ) # - And we should be done... endmacro(clhep_toolchain) clhep-2.1.4.1.orig/Matrix/0000755000175000017500000000000012242515220013634 5ustar olesolesclhep-2.1.4.1.orig/Matrix/INSTALL0000755000175000017500000000772111406201264014700 0ustar olesoles#------------------------------------------------------------- # platform specific issues #------------------------------------------------------------- This package requires autoconf 2.59 or later and automake 1.9.1 or later. If you bootstrap, you will probably have to build these yourself. See "building autotools" below. The new libtool no longer properly supports shared libraries for gcc 2.95.2. If you build CLHEP with gcc 2.95.2, you must configure --disable-shared. To build for Solaris CC, configure with CXX=CC CC=cc and use gmake. On MacOSX, you need to define MACOSX_DEPLOYMENT_TARGET appropriately. For instance, set MACOSX_DEPLOYMENT_TARGET to "10.4" if you have MacOS 10.4 installed on your system. #------------------------------------------------------------- # installing from a source code tar ball #------------------------------------------------------------- Unwind the source code tar ball in some relevant directory. Autoconf and automake will aready have been run. Determine where the files will be installed. Create a build directory that is NOT in the source code directory tree. cd /configure --prefix= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make check (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # configure options #------------------------------------------------------------- A variety of options can be given to configure. Below is a list of the options that you are likely to find most useful. --help provides a partial list of options --prefix=PREFIX install architecture-independent files in PREFIX [default is /usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [default is the same as PREFIX] --disable-shared build only static libraries --disable-static build only shared libraries --enable-exceptions use the CLHEP/Exceptions package --disable-exceptions DO NOT use the CLHEP/Exceptions package [--disable-exceptions is the default] #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are neither built nor installed automatically. Use the following commands to build and install documents: make docs make install-docs #------------------------------------------------------------- # building from cvs #------------------------------------------------------------- You will need current versions of automake, autoconf, and libtool. See building autotools below. cvs co CLHEP/package OR cvs co package cd [CLHEP/]package ./bootstrap Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building autotools #------------------------------------------------------------- If you do not have at least autoconf 2.59 and automake 1.9.1, you will need to build autoconf, automake, and libtool. On some platforms, you may also need to build m4 and texinfo. Download the relevant tarballs from gnu.org (http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/, and http://www.gnu.org/software/libtool/) Untar them in a common source code tree. Decide whether you want to install them in /usr/local or your own install directory. If you use your own install directory, use --prefix= with configure. For each autotool package: /configure [--prefix=] make make install Make sure that /bin is at the front of your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/Matrix/Makefile.am0000755000175000017500000000446610233764254015720 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP # put . first so that CLHEP directory is built before anything else SUBDIRS = Matrix . src test # list all subdirectories - for distribution and cleaning DIST_SUBDIRS = Matrix . src test bin_SCRIPTS = Matrix-config all-local: $(top_builddir)/CLHEP # create temporary CLHEP header tree # we only copy headers for packages listed in @PACKAGE@-deps # search for header directories in the following order: # 1. $(top_builddir)/this-package # 2. $(top_builddir)/../other-packages # 3. $(CLHEPSOURCE_DIR)/CLHEP # 4. $(CLHEP_DIR)/include/CLHEP # # abs_ => absolute path abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ COPY_P = @COPY_P@ $(top_builddir)/CLHEP: temp-package-dirs @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ if test -d "$$pkg" ; then \ (cd $$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d ../"$$pkg"/"$$pkg" ; then \ (cd ../$$pkg/$$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg"; then \ hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ else \ if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/include/CLHEP; then \ if test -d $(CLHEP_DIR)/include/CLHEP/"$$pkg"; then \ hdrs=`ls $(CLHEP_DIR)/include/CLHEP/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEP_DIR)/include/CLHEP/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ fi; \ fi; \ fi; \ fi; \ fi; \ done; temp-package-dirs: $(mkinstalldirs) $(abs_top_builddir)/CLHEP; @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ $(mkinstalldirs) $(abs_top_builddir)/CLHEP/$$pkg; \ done; docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs # extra clean rule clean-local: rm -rf $(top_builddir)/CLHEP clhep-2.1.4.1.orig/Matrix/bootstrap0000755000175000017500000000071510233764254015615 0ustar olesoles#! /bin/sh set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 rm -f Makefile.in */Makefile.in */defs.h.in rm -f autotools/config* autotools/depcomp autotools/install-sh autotools/m* rm -f configure config.* # run autotool commands aclocal -I autotools autoheader automake --add-missing --copy autoconf # ready to make a source code distribution tarball clhep-2.1.4.1.orig/Matrix/configure.ac0000755000175000017500000003063112241267303016135 0ustar olesoles# ====================================================================== # This is the Matrix configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.59) AC_INIT(CLHEP Matrix, 2.1.4.1, http://savannah.cern.ch/projects/clhep/, Matrix) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([src/DiagMatrix.cc]) AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # ---------------------------------------------------------------------- # --enable-shared and --enable-static # both shared and static libraries are built by default # ---------------------------------------------------------------------- AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Header containing #defines: AM_CONFIG_HEADER([Matrix/defs.h]) # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Matrix/Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([Matrix-deps]) AC_CONFIG_FILES([Matrix/copy-header.pl], [chmod +x Matrix/copy-header.pl]) # Configuration inquiry program/script: AC_CONFIG_FILES([Matrix-config], [chmod +x Matrix-config]) # Test driver program/script: AC_CONFIG_FILES([test/testMatrix.sh], [chmod +x test/testMatrix.sh]) AC_CONFIG_FILES([test/testInversion.sh], [chmod +x test/testInversion.sh]) AC_CONFIG_FILES([test/testBug6176.sh], [chmod +x test/testBug6176.sh]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- Matrix_CPPFLAGS="-I$includedir" Matrix_LDFLAGS="-L$libdir" Matrix_LIBS="-lCLHEP-$PACKAGE-$VERSION -lCLHEP-Random-$VERSION -lCLHEP-Vector-$VERSION" AC_SUBST(Matrix_CPPFLAGS) AC_SUBST(Matrix_LIBS) AC_SUBST(Matrix_LDFLAGS) # ---------------------------------------------------------------------- # Supply boilerplate for Matrix/defs.h source header: # ---------------------------------------------------------------------- AH_TOP([#ifndef MATRIX_DEFS_H #define MATRIX_DEFS_H]) ## the undefs are converted by configure AH_VERBATIM([PACKAGE],[/* Name of package */ #ifndef PACKAGE #undef PACKAGE #endif]) AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif]) AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */ #ifndef PACKAGE_NAME #undef PACKAGE_NAME #endif]) AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #undef PACKAGE_STRING #endif]) AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif]) AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */ #ifndef PACKAGE_VERSION #undef PACKAGE_VERSION #endif]) AH_VERBATIM([VERSION],[/* Version number of package */ #ifndef VERSION #undef VERSION #endif]) ## disable allocator until it is fixed AH_VERBATIM([DISABLE_ALLOC],[/* disable non-compliant allocator */ #ifndef DISABLE_ALLOC #define DISABLE_ALLOC #endif]) AH_BOTTOM([#endif // MATRIX_DEFS_H]) # ---------------------------------------------------------------------- # Account for any user configuration options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" LEAKTEST="testBug7328" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" LEAKTEST="" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" LEAKTEST="testBug7328" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" LEAKTEST="testBug7328" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" LEAKTEST="testBug7328" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" LEAKTEST="" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" LEAKTEST="testBug7328" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" LEAKTEST="" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" LEAKTEST="testBug7328" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" LEAKTEST="testBug7328" esac;; icc) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" LEAKTEST="testBug7328" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" LEAKTEST="testBug7328" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) LEAKTEST="testBug7328" ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" LEAKTEST="" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" LEAKTEST="" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" LEAKTEST="" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" LEAKTEST="" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" LEAKTEST="" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" LEAKTEST="" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) AC_SUBST(LEAKTEST) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Set system-dependent options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed libraries: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed header files: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed typedefs, structures, and compiler characteristics: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed library functions: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/Matrix/COPYING.LESSER0000644000175000017500000001674311406201264015677 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/Matrix/.cvsignore0000755000175000017500000000007407746044120015651 0ustar olesolesMakefile.in configure aclocal.m4 autom4te.cache config.h.in clhep-2.1.4.1.orig/Matrix/Matrix/0000755000175000017500000000000012242515220015100 5ustar olesolesclhep-2.1.4.1.orig/Matrix/Matrix/cmake-defs.h.in0000644000175000017500000000205711607115601017664 0ustar olesoles/* @PACKAGE@/defs.h Generated by cmake. */ #ifndef @UPACKAGE@_DEFS_H #define @UPACKAGE@_DEFS_H /* disable non-compliant allocator */ #ifndef DISABLE_ALLOC #define DISABLE_ALLOC #endif /* Name of package */ #ifndef PACKAGE #define PACKAGE "@PACKAGE@" #endif /* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #define PACKAGE_BUGREPORT "http://savannah.cern.ch/projects/clhep/" #endif /* Define to the full name of this package. */ #ifndef PACKAGE_NAME #define PACKAGE_NAME "@PROJECT_NAME@ @PACKAGE@" #endif /* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #define PACKAGE_STRING "@PROJECT_NAME@ @PACKAGE@ @VERSION@" #endif /* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #define PACKAGE_TARNAME "@PACKAGE@" #endif /* Define to the version of this package. */ #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "@VERSION@" #endif /* Version number of package */ #ifndef VERSION #define VERSION "@VERSION@" #endif #endif // @UPACKAGE@_DEFS_H clhep-2.1.4.1.orig/Matrix/Matrix/Matrix.h0000755000175000017500000004027212074100307016524 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definition of the HepMatrix class. // // This software written by Nobu Katayama and Mike Smyth, Cornell University. // // // .SS Usage // The Matrix class does all the obvious things, in all the obvious ways. // You declare a Matrix by saying // // .ft B // HepMatrix hm1(n, m); // // To declare a Matrix as a copy of a Matrix hm2, say // // .ft B // HepMatrix hm1(hm2); // or // .ft B // HepMatrix hm1 = hm2; // // You can declare initilizations of a Matrix, by giving it a third // integer argument, either 0 or 1. 0 means initialize to 0, one means // the identity matrix. If you do not give a third argument the memory // is not initialized. // // .ft B // HepMatrix hm1(n, m, 1); // // ./"This code has been written by Mike Smyth, and the algorithms used are // ./"described in the thesis "A Tracking Library for a Silicon Vertex Detector" // ./"(Mike Smyth, Cornell University, June 1993). // ./"This is file contains C++ stuff for doing things with Matrices. // ./"To turn on bound checking, define MATRIX_BOUND_CHECK before including // ./"this file. // // To find the number of rows or number of columns, say // // .ft B // nr = hm1.num_row(); // // or // // .ft B // nc = hm1.num_col(); // // You can print a Matrix by // // .ft B // cout << hm1; // // You can add, // subtract, and multiply two Matrices. You can multiply a Matrix by a // scalar, on the left or the right. +=, *=, -= act in the obvious way. // hm1 *= hm2 is as hm1 = hm1*hm2. You can also divide by a scalar on the // right, or use /= to do the same thing. // // You can read or write a Matrix element by saying // // .ft B // m(row, col) = blah. (1 <= row <= num_row(), 1 <= col <= num_col()) // // .ft B // blah = m(row, col) ... // // m(row, col) is inline, and by default does not do bound checking. // If bound checking is desired, say #define MATRIX_BOUND_CHECK before // including matrix.h. // // You can also access the element using C subscripting operator [] // // .ft B // m[row][col] = blah. (0 <= row < num_row(), 0 <= col < num_col()) // // .ft B // blah = m[row][col] ... // // m[row][col] is inline, and by default does not do bound checking. // If bound checking is desired, say #define MATRIX_BOUND_CHECK before // including matrix.h. (Notice the difference in bases in two access // methods.) // // .SS Comments on precision // // The user would normally use "Matrix" class whose precision is the same // as the other classes of CLHEP (ThreeVec, for example). However, he/she // can explicitly choose Matrix (double) or MatrixF (float) if he/she wishes. // In the former case, include "Matrix.h." In the latter case, include either // "Matrix.h," or "MatrixF.h," or both. The only operators that can talk // to each other are the copy constructor and assignment operator. // // .ft B // Matrix d(3,4,HEP_MATRIX_IDENTITY); // // .ft B // MatrixF f; // // .ft B // f = d; // // .ft B // MatrixF g(d); // // will convert from one to the other. // // .SS Other functions // // .ft B // mt = m.T(); // // returns the transpose of m. // // .ft B // ms = hm2.sub(row_min, row_max, col_min, col_max); // // returns the subMatrix. // hm2(row_min:row_max, col_min:col_max) in matlab terminology. // If instead you say // // .ft B // hm2.sub(row, col, hm1); // // then the subMatrix // hm2(row:row+hm1.num_row()-1, col:col+hm1.num_col()-1) is replaced with hm1. // // .ft B // md = dsum(hm1,hm2); // // returns the direct sum of the two matrices. // // Operations that do not have to be member functions or friends are listed // towards the end of this man page. // // // To invert a matrix, say // // .ft B // minv = m.inverse(ierr); // // ierr will be non-zero if the matrix is singular. // // If you can overwrite the matrix, you can use the invert function to avoid // two extra copies. Use // // .ft B // m.invert(ierr); // // Many basic linear algebra functions such as QR decomposition are defined. // In order to keep the header file a reasonable size, the functions are // defined in MatrixLinear.h. // // // .ft B // Note that Matrices run from (1,1) to (n, m), and [0][0] to // [n-1][m-1]. The users of the latter form should be careful about sub // functions. // // ./" The program that this class was orginally used with lots of small // ./" Matrices. It was very costly to malloc and free array space every // ./" time a Matrix is needed. So, a number of previously freed arrays are // ./" kept around, and when needed again one of these array is used. Right // ./" now, a set of piles of arrays with row <= row_max and col <= col_max // ./" are kept around. The piles of kept Matrices can be easily changed. // ./" Array mallocing and freeing are done only in new_m() and delete_m(), // ./" so these are the only routines that need to be rewritten. // // You can do things thinking of a Matrix as a list of numbers. // // .ft B // m = hm1.apply(HEP_MATRIX_ELEMENT (*f)(HEP_MATRIX_ELEMENT, int r, int c)); // // applies f to every element of hm1 and places it in m. // // .SS See Also: // SymMatrix[DF].h, GenMatrix[DF].h, DiagMatrix[DF].h Vector[DF].h // MatrixLinear[DF].h #ifndef _Matrix_H_ #define _Matrix_H_ #ifdef GNUPRAGMA #pragma interface #endif #include #include "CLHEP/Matrix/defs.h" #include "CLHEP/Matrix/GenMatrix.h" namespace CLHEP { class HepRandom; class HepSymMatrix; class HepDiagMatrix; class HepVector; class HepRotation; /** * @author * @ingroup matrix */ class HepMatrix : public HepGenMatrix { public: inline HepMatrix(); // Default constructor. Gives 0 x 0 matrix. Another Matrix can be // assigned to it. HepMatrix(int p, int q); // Constructor. Gives an unitialized p x q matrix. HepMatrix(int p, int q, int i); // Constructor. Gives an initialized p x q matrix. // If i=0, it is initialized to all 0. If i=1, the diagonal elements // are set to 1.0. HepMatrix(int p, int q, HepRandom &r); // Constructor with a Random object. HepMatrix(const HepMatrix &hm1); // Copy constructor. HepMatrix(const HepSymMatrix &); HepMatrix(const HepDiagMatrix &); HepMatrix(const HepVector &); // Constructors from SymMatrix, DiagMatrix and Vector. virtual ~HepMatrix(); // Destructor. virtual int num_row() const; // Returns the number of rows. virtual int num_col() const; // Returns the number of columns. virtual const double & operator()(int row, int col) const; virtual double & operator()(int row, int col); // Read or write a matrix element. // ** Note that the indexing starts from (1,1). ** HepMatrix & operator *= (double t); // Multiply a Matrix by a floating number. HepMatrix & operator /= (double t); // Divide a Matrix by a floating number. HepMatrix & operator += ( const HepMatrix &); HepMatrix & operator += ( const HepSymMatrix &); HepMatrix & operator += ( const HepDiagMatrix &); HepMatrix & operator += ( const HepVector &); HepMatrix & operator -= ( const HepMatrix &); HepMatrix & operator -= ( const HepSymMatrix &); HepMatrix & operator -= ( const HepDiagMatrix &); HepMatrix & operator -= ( const HepVector &); // Add or subtract a Matrix. // When adding/subtracting Vector, Matrix must have num_col of one. HepMatrix & operator = ( const HepMatrix &); HepMatrix & operator = ( const HepSymMatrix &); HepMatrix & operator = ( const HepDiagMatrix &); HepMatrix & operator = ( const HepVector &); HepMatrix & operator = ( const HepRotation &); // Assignment operators. HepMatrix operator- () const; // unary minus, ie. flip the sign of each element. HepMatrix apply(double (*f)(double, int, int)) const; // Apply a function to all elements of the matrix. HepMatrix T() const; // Returns the transpose of a Matrix. HepMatrix sub(int min_row, int max_row, int min_col, int max_col) const; // Returns a sub matrix of a Matrix. // WARNING: rows and columns are numbered from 1 void sub(int row, int col, const HepMatrix &hm1); // Sub matrix of this Matrix is replaced with hm1. // WARNING: rows and columns are numbered from 1 friend inline void swap(HepMatrix &hm1, HepMatrix &hm2); // Swap hm1 with hm2. inline HepMatrix inverse(int& ierr) const; // Invert a Matrix. Matrix must be square and is not changed. // Returns ierr = 0 (zero) when successful, otherwise non-zero. virtual void invert(int& ierr); // Invert a Matrix. Matrix must be square. // N.B. the contents of the matrix are replaced by the inverse. // Returns ierr = 0 (zero) when successful, otherwise non-zero. // This method has less overhead then inverse(). inline void invert(); // Invert a matrix. Throw std::runtime_error on failure. inline HepMatrix inverse() const; // Invert a matrix. Throw std::runtime_error on failure. double determinant() const; // calculate the determinant of the matrix. double trace() const; // calculate the trace of the matrix (sum of diagonal elements). class HepMatrix_row { public: inline HepMatrix_row(HepMatrix&,int); double & operator[](int); private: HepMatrix& _a; int _r; }; class HepMatrix_row_const { public: inline HepMatrix_row_const (const HepMatrix&,int); const double & operator[](int) const; private: const HepMatrix& _a; int _r; }; // helper classes for implementing m[i][j] inline HepMatrix_row operator[] (int); inline const HepMatrix_row_const operator[] (int) const; // Read or write a matrix element. // While it may not look like it, you simply do m[i][j] to get an // element. // ** Note that the indexing starts from [0][0]. ** protected: virtual int num_size() const; virtual void invertHaywood4(int& ierr); virtual void invertHaywood5(int& ierr); virtual void invertHaywood6(int& ierr); private: friend class HepMatrix_row; friend class HepMatrix_row_const; friend class HepVector; friend class HepSymMatrix; friend class HepDiagMatrix; // Friend classes. friend HepMatrix operator+(const HepMatrix &hm1, const HepMatrix &hm2); friend HepMatrix operator-(const HepMatrix &hm1, const HepMatrix &hm2); friend HepMatrix operator*(const HepMatrix &hm1, const HepMatrix &hm2); friend HepMatrix operator*(const HepMatrix &hm1, const HepSymMatrix &hm2); friend HepMatrix operator*(const HepMatrix &hm1, const HepDiagMatrix &hm2); friend HepMatrix operator*(const HepSymMatrix &hm1, const HepMatrix &hm2); friend HepMatrix operator*(const HepDiagMatrix &hm1, const HepMatrix &hm2); friend HepMatrix operator*(const HepVector &hm1, const HepMatrix &hm2); friend HepVector operator*(const HepMatrix &hm1, const HepVector &hm2); friend HepMatrix operator*(const HepSymMatrix &hm1, const HepSymMatrix &hm2); // Multiply a Matrix by a Matrix or Vector. friend HepVector solve(const HepMatrix &, const HepVector &); // solve the system of linear eq friend HepVector qr_solve(HepMatrix *, const HepVector &); friend HepMatrix qr_solve(HepMatrix *, const HepMatrix &b); friend void tridiagonal(HepSymMatrix *a,HepMatrix *hsm); friend void row_house(HepMatrix *,const HepMatrix &, double, int, int, int, int); friend void row_house(HepMatrix *,const HepVector &, double, int, int); friend void back_solve(const HepMatrix &R, HepVector *b); friend void back_solve(const HepMatrix &R, HepMatrix *b); friend void col_givens(HepMatrix *A, double c, double s, int k1, int k2, int rowmin, int rowmax); // Does a column Givens update. friend void row_givens(HepMatrix *A, double c, double s, int k1, int k2, int colmin, int colmax); friend void col_house(HepMatrix *,const HepMatrix &, double, int, int, int, int); friend HepVector house(const HepMatrix &a,int row,int col); friend void house_with_update(HepMatrix *a,int row,int col); friend void house_with_update(HepMatrix *a,HepMatrix *v,int row,int col); friend void house_with_update2(HepSymMatrix *a,HepMatrix *v, int row,int col); int dfact_matrix(double &det, int *ir); // factorize the matrix. If successful, the return code is 0. On // return, det is the determinant and ir[] is row-interchange // matrix. See CERNLIB's DFACT routine. int dfinv_matrix(int *ir); // invert the matrix. See CERNLIB DFINV. #ifdef DISABLE_ALLOC std::vector m; #else std::vector > m; #endif int nrow, ncol; int size_; }; // Operations other than member functions for Matrix // implemented in Matrix.cc and Matrix.icc (inline). HepMatrix operator*(const HepMatrix &, const HepMatrix &); HepMatrix operator*(double t, const HepMatrix &); HepMatrix operator*(const HepMatrix &, double ); // Multiplication operators // Note that m *= hm1 is always faster than m = m * hm1. HepMatrix operator/(const HepMatrix &, double ); // m = hm1 / t. (m /= t is faster if you can use it.) HepMatrix operator+(const HepMatrix &hm1, const HepMatrix &hm2); // m = hm1 + hm2; // Note that m += hm1 is always faster than m = m + hm1. HepMatrix operator-(const HepMatrix &hm1, const HepMatrix &hm2); // m = hm1 - hm2; // Note that m -= hm1 is always faster than m = m - hm1. HepMatrix dsum(const HepMatrix&, const HepMatrix&); // Direct sum of two matrices. The direct sum of A and B is the matrix // A 0 // 0 B HepVector solve(const HepMatrix &, const HepVector &); // solve the system of linear equations using LU decomposition. std::ostream& operator<<(std::ostream &s, const HepMatrix &q); // Read in, write out Matrix into a stream. // // Specialized linear algebra functions // HepVector qr_solve(const HepMatrix &A, const HepVector &b); HepVector qr_solve(HepMatrix *A, const HepVector &b); HepMatrix qr_solve(const HepMatrix &A, const HepMatrix &b); HepMatrix qr_solve(HepMatrix *A, const HepMatrix &b); // Works like backsolve, except matrix does not need to be upper // triangular. For nonsquare matrix, it solves in the least square sense. HepMatrix qr_inverse(const HepMatrix &A); HepMatrix qr_inverse(HepMatrix *A); // Finds the inverse of a matrix using QR decomposition. Note, often what // you really want is solve or backsolve, they can be much quicker than // inverse in many calculations. void qr_decomp(HepMatrix *A, HepMatrix *hsm); HepMatrix qr_decomp(HepMatrix *A); // Does a QR decomposition of a matrix. void back_solve(const HepMatrix &R, HepVector *b); void back_solve(const HepMatrix &R, HepMatrix *b); // Solves R*x = b where R is upper triangular. Also has a variation that // solves a number of equations of this form in one step, where b is a matrix // with each column a different vector. See also solve. void col_house(HepMatrix *a, const HepMatrix &v, double vnormsq, int row, int col, int row_start, int col_start); void col_house(HepMatrix *a, const HepMatrix &v, int row, int col, int row_start, int col_start); // Does a column Householder update. void col_givens(HepMatrix *A, double c, double s, int k1, int k2, int row_min=1, int row_max=0); // do a column Givens update void row_givens(HepMatrix *A, double c, double s, int k1, int k2, int col_min=1, int col_max=0); // do a row Givens update void givens(double a, double b, double *c, double *s); // algorithm 5.1.5 in Golub and Van Loan HepVector house(const HepMatrix &a, int row=1, int col=1); // Returns a Householder vector to zero elements. void house_with_update(HepMatrix *a, int row=1, int col=1); void house_with_update(HepMatrix *a, HepMatrix *v, int row=1, int col=1); // Finds and does Householder reflection on matrix. void row_house(HepMatrix *a, const HepVector &v, double vnormsq, int row=1, int col=1); void row_house(HepMatrix *a, const HepMatrix &v, double vnormsq, int row, int col, int row_start, int col_start); void row_house(HepMatrix *a, const HepMatrix &v, int row, int col, int row_start, int col_start); // Does a row Householder update. } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #ifndef HEP_DEBUG_INLINE #include "CLHEP/Matrix/Matrix.icc" #endif #endif /*_Matrix_H*/ clhep-2.1.4.1.orig/Matrix/Matrix/Pile.h0000755000175000017500000000676411604641731016172 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This software written by Nobu Katayama and Mike Smyth, Cornell University. // // This file contains an attempt to make the template "pile". A pile is // a finite size LIFO stack. When a element is pushed on that increases // the stack beyond its maximum size, the oldest element is deleted from // the stack. A subroutine can be used on that oldest element first. // The orginal use of this stack was to store old double arrays. When // a new array is needed, we can simply pull one off the pile. However, // we don't want to keep too many old array's around, after a while we just // want to start getting rid of them. When the pile gets too large, or // when the pile is destroyed, we want to call subroutines to get rid of // some of these arrays. // Unfortunately, in version 2.2 of g++ templates don't seem to work unless // they are declared inline. So this class has ridiculously long inline // functions. Also, g++ doesn't seem to allow multiple arguements to // templates, so the size of the pile is hardwired in. To change the size, // change the value of the const int sz. // A pile is easy to use. Just declare pile X_pile. To add a X to the // pile, say X_pile.push(X item). To get an item from the pile, first // check that the pile is not empty, and then say item=X_pile.pop(). It // is an error to try and pop from an empty pile. To check if a pile is // empty, say X_pile.is_empty(). If this is TRUE, then the pile is empty. // Otherwise it is FALSE. The subroutine called when the stack begins to // overflow is set by X_pile.destroy(void (*function)(X)), or it can be // set in the construction pile X_pile(void (*function)(X)). It is // okay to not supply a function, in that case nothing is done when an // item falls off the bottom of the pile. It is simply lost. #ifndef _PILE_H #define _PILE_H #include #include "CLHEP/Matrix/defs.h" /** * @author * @ingroup matrix */ namespace CLHEP { template class HepPile { public: // Destructor // (defined first in templated class due to a bug in VxWorks) ~HepPile() { while(bottom != top) { #if 1 destroy(stack[bottom]); #else delete [] stack[bottom]; #endif next(&bottom); } } HepPile(void (*f)(T)=0): top(0), bottom(0) { destroy_fun = f;} void set_destroy(void (*f)(T)) { destroy_fun = f;} void push(T item) { stack[top]=item; next(&top); if (top==bottom) { #if 1 destroy(stack[bottom]); #else delete [] stack[bottom]; #endif next(&bottom); } } bool is_empty() const { return top == bottom ?true :false;} T pop() { if (is_empty()) { std::cerr << "Attempt to pop empty pile.\n--- Exiting to system." << std::endl; exit(1); } previous(&top); return stack[top]; } private: enum {sz = 50}; T stack[sz+1]; int top,bottom; void (*destroy_fun)(T); void next(int *n) const {if (++(*n) >= sz+1) *n = 0;} void previous(int *n) const {if (--(*n) < 0) *n = sz;} void destroy(T t) { if (destroy_fun) (*destroy_fun)(t); } }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif /*_PILE_H */ clhep-2.1.4.1.orig/Matrix/Matrix/DiagMatrix.icc0000755000175000017500000000565712074100307017630 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This software written by Nobu Katayama and Mike Smyth, Cornell University. // #include namespace CLHEP { inline HepDiagMatrix::HepDiagMatrix() : m(0), nrow(0) {} inline int HepDiagMatrix::num_row() const { return nrow;} inline int HepDiagMatrix::num_col() const { return nrow;} inline int HepDiagMatrix::num_size() const { return nrow;} inline double & HepDiagMatrix::fast(int row,int col) { #ifdef MATRIX_BOUND_CHECK if (row<1 || row>nrow || col<1 || col>nrow) error("Range error in HepDiagMatrix::fast()"); #endif if (row != col) error("Index error in HepDiagMatrix::fast(i,j): i != j"); return *(m.begin()+(col-1)); } inline const double & HepDiagMatrix::fast(int row,int col) const { #ifdef MATRIX_BOUND_CHECK if (row<1 || row>nrow || col<1 || col>nrow) error("Range error in HepDiagMatrix::fast()"); #endif if (row == col) { return *(m.begin()+(col-1)); } else { #if defined(__sun) || !defined(__GNUG__) // // Sun CC 4.0.1 has this bug. // zero = 0; #endif return zero; } } inline double & HepDiagMatrix::operator()(int row, int col) { return fast(col,row); } inline const double & HepDiagMatrix::operator()(int row, int col) const { return fast(col,row); } inline void HepDiagMatrix::assign(const HepDiagMatrix &hm2) {(*this)=hm2;} inline HepDiagMatrix HepDiagMatrix::T() const {return HepDiagMatrix(*this);} inline HepDiagMatrix::HepDiagMatrix_row HepDiagMatrix::operator[] (int r) #ifdef HEP_GNU_OPTIMIZED_RETURN return b(*this,r); { #else { HepDiagMatrix_row b(*this,r); #endif return b; } inline HepDiagMatrix::HepDiagMatrix_row_const HepDiagMatrix::operator[] (int r) const #ifdef HEP_GNU_OPTIMIZED_RETURN return b(*this,r); { #else { const HepDiagMatrix_row_const b(*this,r); #endif return b; } inline double &HepDiagMatrix::HepDiagMatrix_row::operator[](int c) { return _a.fast(_r+1, c+1); } inline const double& HepDiagMatrix::HepDiagMatrix_row_const::operator[](int c) const { return _a.fast(_r+1,c+1); } inline HepDiagMatrix::HepDiagMatrix_row::HepDiagMatrix_row (HepDiagMatrix& a, int r) : _a(a), _r(r) {} inline HepDiagMatrix::HepDiagMatrix_row_const::HepDiagMatrix_row_const (const HepDiagMatrix& a, int r) : _a(a), _r(r) {} inline HepDiagMatrix HepDiagMatrix::inverse(int &ierr) const #ifdef HEP_GNU_OPTIMIZED_RETURN return mTmp(*this); { #else { HepDiagMatrix mTmp(*this); #endif mTmp.invert(ierr); return mTmp; } inline HepDiagMatrix HepDiagMatrix::inverse() const { int ierr; HepDiagMatrix mt=inverse(ierr); if (ierr) throw std::runtime_error("Error in HepDiagMatrix inversion"); return mt; } inline void HepDiagMatrix::invert() { int ierr; invert(ierr); if (ierr) throw std::runtime_error("Error in HepDiagMatrix inversion"); } } // namespace CLHEP clhep-2.1.4.1.orig/Matrix/Matrix/copy-header.pl.in0000755000175000017500000000164110043475755020266 0ustar olesoles#!/usr/bin/env perl # # copy a header into the temporary CLHEP header tree if # a) the header is not already there # b) the source is newer # if ($#ARGV != 1) { print "mungeit requires two arguments - exit\n"; exit; } else { $source_header=$ARGV[0]; $dest_header=$ARGV[1]; &check_header; } exit; sub check_header { # make sure source exists if ( ! -e $source_header ) { print "$source_header does not exist - exit\n"; exit; } # copy if not already there - otherwise, check the time stamp if ( ! -e $dest_header ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } else { $source_header_time = -M $source_header; $dest_header_time = -M $dest_header; # copy only if source is newer if( $source_header_time < $dest_header_time ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } } } clhep-2.1.4.1.orig/Matrix/Matrix/Makefile.am0000755000175000017500000000155010233764254017153 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@ COPY_P = @COPY_P@ pkginclude_HEADERS = \ DiagMatrix.h \ DiagMatrix.icc \ GenMatrix.h \ GenMatrix.icc \ Matrix.h \ Matrix.icc \ Pile.h \ SymMatrix.h \ SymMatrix.icc \ Vector.h \ Vector.icc \ defs.h # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = defs.h # copy headers into $(tempincludedir) install-tmpHEADERS: @echo " install headers in $(tempincludedir) " @list='$(pkginclude_HEADERS)'; \ if test $(tempincludedir); then \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ ./copy-header.pl $$d$$p $(tempincludedir)/$$f; \ done; \ fi; test -z "$$fail" clhep-2.1.4.1.orig/Matrix/Matrix/Vector.icc0000755000175000017500000000257011604641731017041 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // #include #include namespace CLHEP { // Swap two vectors without doing a full copy. inline void swap(HepVector &v1,HepVector &v2) { HepGenMatrix::swap(v1.m,v2.m); HepGenMatrix::swap(v1.nrow,v2.nrow); } inline HepVector::HepVector() : m(0), nrow(0) {} inline double HepVector::normsq() const {return dot((*this),(*this));} inline double HepVector::norm() const {return sqrt(normsq());} inline double & HepVector::operator()(int row) { #ifdef MATRIX_BOUND_CHECK if(row<1 || row>nrow) error("Range error in HepVector::operator()"); #endif return *(m.begin()+row-1); } inline const double & HepVector::operator()(int row) const { #ifdef MATRIX_BOUND_CHECK if(row<1 || row>nrow) error("Range error in HepVector::operator()"); #endif return *(m.begin()+row-1); } inline double & HepVector::operator[](int row) { #ifdef MATRIX_BOUND_CHECK if(row<0 || row>=nrow) error("Range error in HepVector::operator[]"); #endif return *(m.begin()+row); } inline const double & HepVector::operator[](int row) const { #ifdef MATRIX_BOUND_CHECK if(row<0 || row>=nrow) error("Range error in HepVector::operator[]"); #endif return *(m.begin()+row); } } // namespace CLHEP clhep-2.1.4.1.orig/Matrix/Matrix/Matrix.icc0000755000175000017500000000454312074100307017034 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This software written by Nobu Katayama and Mike Smyth, Cornell University. // // This is the definitions of the inline member functions of the // HepMatrix class // #include namespace CLHEP { inline HepMatrix::HepMatrix() : m(0), nrow(0), ncol(0), size_(0) {} inline HepMatrix::HepMatrix_row HepMatrix::operator[] (int r) #ifdef HEP_GNU_OPTIMIZED_RETURN return b(*this,r); { #else { HepMatrix_row b(*this,r); #endif return b; } inline const HepMatrix::HepMatrix_row_const HepMatrix::operator[] (int r) const #ifdef HEP_GNU_OPTIMIZED_RETURN return b(*this,r); { #else { HepMatrix_row_const b(*this,r); #endif return b; } inline double &HepMatrix::HepMatrix_row::operator[](int c) { #ifdef MATRIX_BOUND_CHECK if (_r<0 || _r>=_a.num_row() || c<0 || c>=_a.num_col()) HepGenMatrix::error("Range error in HepMatrix::operator[][]"); #endif return *(_a.m.begin()+_r*_a.ncol+c); } inline const double &HepMatrix::HepMatrix_row_const::operator[](int c) const { #ifdef MATRIX_BOUND_CHECK if (_r<0 || _r>=_a.num_row() || c<0 || c>=_a.num_col()) HepGenMatrix::error("Range error in HepMatrix::operator[][]"); #endif return *(_a.m.begin()+_r*_a.ncol+c); } inline HepMatrix::HepMatrix_row::HepMatrix_row(HepMatrix&a,int r) : _a(a) { _r = r; } inline HepMatrix::HepMatrix_row_const::HepMatrix_row_const (const HepMatrix&a, int r) : _a(a) { _r = r; } // This function swaps two Matrices without doing a full copy. inline void swap(HepMatrix &hm1,HepMatrix &hm2) { HepGenMatrix::swap(hm1.m,hm2.m); /*** commented HepGenMatrix::swap(hm1.nrow,hm2.nrow); HepGenMatrix::swap(hm1.ncol,hm2.ncol); HepGenMatrix::swap(hm1.size_,hm2.size_); */ } /*-ap inline */ HepMatrix HepMatrix::inverse(int &ierr) const #ifdef HEP_GNU_OPTIMIZED_RETURN return mTmp(*this); { #else { HepMatrix mTmp(*this); #endif mTmp.invert(ierr); return mTmp; } inline HepMatrix HepMatrix::inverse() const { int ierr; HepMatrix mt=inverse(ierr); if (ierr) throw std::runtime_error("Error in HepMatrix inversion"); return mt; } inline void HepMatrix::invert() { int ierr; invert(ierr); if (ierr) throw std::runtime_error("Error in HepMatrix inversion"); } } // namespace CLHEP clhep-2.1.4.1.orig/Matrix/Matrix/GenMatrix.icc0000755000175000017500000000312211604641731017467 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This software written by Nobu Katayama and Mike Smyth, Cornell University. // namespace CLHEP { // swap // inline void HepGenMatrix::swap(int &i,int &j) {int t=i;i=j;j=t;} #ifdef DISABLE_ALLOC inline void HepGenMatrix::swap(std::vector& i, std::vector& j) { std::vector t=i;i=j;j=t; } #else inline void HepGenMatrix::swap(std::vector >& i, std::vector >& j) { std::vector > t=i;i=j;j=t; } #endif // // operator [] (I cannot make it virtual because return types are different.) // Therefore I will have to use the virtual operator (,). // inline double &HepGenMatrix::HepGenMatrix_row::operator[](int c) { return _a(_r+1,c+1); } inline const double &HepGenMatrix::HepGenMatrix_row_const:: operator[](int c) const { return _a(_r+1,c+1); } inline HepGenMatrix::HepGenMatrix_row HepGenMatrix::operator[](int r) { HepGenMatrix_row b(*this,r); return b; } inline const HepGenMatrix::HepGenMatrix_row_const HepGenMatrix:: operator[](int r) const{ HepGenMatrix_row_const b(*this,r); return b; } inline HepGenMatrix::HepGenMatrix_row::HepGenMatrix_row(HepGenMatrix&a,int r) : _a(a) { _r = r; } inline HepGenMatrix::HepGenMatrix_row_const:: HepGenMatrix_row_const (const HepGenMatrix&a, int r) : _a(a) { _r = r; } } // namespace CLHEP // ----------------------------------------------------------------- clhep-2.1.4.1.orig/Matrix/Matrix/SymMatrix.icc0000755000175000017500000000636112074100307017525 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definitions of the inline member functions of the // HepSymMatrix class // #include namespace CLHEP { inline HepSymMatrix::HepSymMatrix() : m(0), nrow(0), size_(0) {} inline int HepSymMatrix::num_row() const { return nrow;} inline int HepSymMatrix::num_col() const { return nrow;} inline int HepSymMatrix::num_size() const { return size_;} inline double & HepSymMatrix::fast(int row,int col) { #ifdef MATRIX_BOUND_CHECK if(row<1||row>num_row() || col<1||col>num_col()) error("Range error in HepSymMatrix::fast()"); #endif return *(m.begin()+(row*(row-1))/2+(col-1)); } inline const double & HepSymMatrix::fast(int row,int col) const { #ifdef MATRIX_BOUND_CHECK if(row<1||row>num_row() || col<1||col>num_col()) error("Range error in HepSymMatrix::fast()"); #endif return *(m.begin()+(row*(row-1))/2+(col-1)); } inline double & HepSymMatrix::operator()(int row, int col) {return (row>=col? fast(row,col) : fast(col,row));} inline const double & HepSymMatrix::operator()(int row, int col) const {return (row>=col? fast(row,col) : fast(col,row));} inline void HepSymMatrix::assign(const HepSymMatrix &hm2) {(*this)=hm2;} inline HepSymMatrix HepSymMatrix::T() const {return HepSymMatrix(*this);} inline HepSymMatrix::HepSymMatrix_row HepSymMatrix::operator[] (int r) #ifdef HEP_GNU_OPTIMIZED_RETURN return b(*this,r); { #else { HepSymMatrix_row b(*this,r); #endif return b; } inline HepSymMatrix::HepSymMatrix_row_const HepSymMatrix::operator[] (int r) const #ifdef HEP_GNU_OPTIMIZED_RETURN return b(*this,r); { #else { const HepSymMatrix_row_const b(*this,r); #endif return b; } inline double &HepSymMatrix::HepSymMatrix_row::operator[](int c) { #ifdef MATRIX_BOUND_CHECK if(_r<0||_r>=_a.nrow || c<0||c>=_a.nrow) error("Range error in HepSymMatrix::operator[][]"); #endif if (_r >= c ) { return *(_a.m.begin() + (_r+1)*_r/2 + c); } else { return *(_a.m.begin() + (c+1)*c/2 + _r); } } inline const double & HepSymMatrix::HepSymMatrix_row_const::operator[](int c) const { #ifdef MATRIX_BOUND_CHECK if(_r<0||_r>=_a.nrow || c<0||c>=_a.nrow) error("Range error in HepSymMatrix::operator[][]"); #endif if (_r >= c ) { return *(_a.m.begin() + (_r+1)*_r/2 + c); } else { return *(_a.m.begin() + (c+1)*c/2 + _r); } } inline HepSymMatrix::HepSymMatrix_row::HepSymMatrix_row(HepSymMatrix &a, int r) : _a(a), _r(r) {} inline HepSymMatrix::HepSymMatrix_row_const::HepSymMatrix_row_const (const HepSymMatrix&a,int r) : _a(a), _r(r) {} inline HepSymMatrix HepSymMatrix::inverse(int &ifail) const #ifdef HEP_GNU_OPTIMIZED_RETURN return mTmp(*this); { #else { HepSymMatrix mTmp(*this); #endif mTmp.invert(ifail); return mTmp; } inline HepSymMatrix HepSymMatrix::inverse() const { int ierr; HepSymMatrix mt=inverse(ierr); if (ierr) throw std::runtime_error("Error in HepSymMatrix inversion"); return mt; } inline void HepSymMatrix::invert() { int ierr; invert(ierr); if (ierr) throw std::runtime_error("Error in HepSymMatrix inversion"); } } // namespace CLHEP clhep-2.1.4.1.orig/Matrix/Matrix/.cvsignore0000755000175000017500000000002607705453233017116 0ustar olesolesMakefile.in defs.h.in clhep-2.1.4.1.orig/Matrix/Matrix/GenMatrix.h0000755000175000017500000001136711604641731017172 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This software written by Nobu Katayama and Mike Smyth, Cornell University. // // This is the definition of the HepGenMatrix, base class for HepMatrix, // HepSymMatrix and HepDiagMatrix. This is an abstract cless. // See definitions in Matrix.h, SymMatrix.h, DiagMatrix.h and Vector.h #ifndef _GENMatrix_H_ #define _GENMatrix_H_ #ifdef GNUPRAGMA #pragma interface #endif #include #include #include "CLHEP/Matrix/defs.h" namespace CLHEP { class HepGenMatrix_row; class HepGenMatrix_row_const; class HepGenMatrix; /** * @author * @ingroup matrix */ class HepGenMatrix { public: virtual ~HepGenMatrix() {} #ifdef DISABLE_ALLOC // disable this non-compliant allocator #else template class Alloc { public: typedef T value_type; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef T* pointer; typedef const T* const_pointer; typedef T& reference; typedef const T& const_reference; pointer address(reference r) const { return &r; } const_pointer address(const_reference r) const { return &r; } Alloc() throw() {} Alloc(const Alloc&) throw() {} ~Alloc() throw() {} pointer allocate(size_type n, const void* hint=0 ) { if( n <= size ) return pool; else return new T[n]; } void deallocate(pointer p, size_type n) { if (p == pool ) return; delete [] p; } void construct(pointer p, const T& val ) { new(p) T(val); } void destroy(pointer p) { p->~T(); } size_type max_size() const throw() { size_type c = (size_type)(-1) /sizeof(T); return (0 < c ? c : 1); } template struct rebind { typedef Alloc other; }; private: T pool[size]; }; #endif #ifdef DISABLE_ALLOC typedef std::vector::iterator mIter; typedef std::vector::const_iterator mcIter; #else typedef std::vector >::iterator mIter; typedef std::vector >::const_iterator mcIter; #endif virtual int num_row() const = 0; virtual int num_col() const = 0; virtual const double & operator()(int row, int col) const =0; virtual double & operator()(int row, int col) =0; // Read or write a matrix element. // ** Note that the indexing starts from (1,1). ** virtual void invert(int&) = 0; class HepGenMatrix_row { public: inline HepGenMatrix_row(HepGenMatrix&,int); double & operator[](int); private: HepGenMatrix& _a; int _r; }; class HepGenMatrix_row_const { public: inline HepGenMatrix_row_const (const HepGenMatrix&,int); const double & operator[](int) const; private: const HepGenMatrix& _a; int _r; }; // helper classes to implement m[i][j] inline HepGenMatrix_row operator[] (int); inline const HepGenMatrix_row_const operator[] (int) const; // Read or write a matrix element. // While it may not look like it, you simply do m[i][j] to get an // element. // ** Note that the indexing starts from [0][0]. ** inline static void swap(int&,int&); #ifdef DISABLE_ALLOC inline static void swap(std::vector&, std::vector&); #else inline static void swap(std::vector >&, std::vector >&); #endif virtual bool operator== ( const HepGenMatrix& ) const; // equality operator for matrices (BaBar) static void error(const char *s); protected: virtual int num_size() const = 0; void delete_m(int size, double*); double* new_m(int size); public: enum{size_max = 25}; // This is not the maximum size of the Matrix. It is the maximum length of // the array (1D) which can be put on the pile. // // This enum used to be private, but it then is not accessible // in the definition of array_pile in the .cc file for Sun CC 4.0.1. // efrank@upenn5.hep.upenn.edu private: void operator=(const HepGenMatrix &) {} // Remove default operator for HepGenMatrix. friend class HepGenMatrix_row; friend class HepGenMatrix_row_const; //-ap: removed this as it is taken over by the std::vector //-ap double data_array[size_max]; }; double norm(const HepGenMatrix &m); double norm1(const HepGenMatrix &m); double norm_infinity(const HepGenMatrix &m); // 2, 1 or infinity-norm of a matrix. } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #ifndef HEP_DEBUG_INLINE #include "CLHEP/Matrix/GenMatrix.icc" #endif #endif clhep-2.1.4.1.orig/Matrix/Matrix/CMakeLists.txt0000644000175000017500000000054611606714767017671 0ustar olesoles set( pkginclude_HEADERS DiagMatrix.h DiagMatrix.icc GenMatrix.h GenMatrix.icc Matrix.h Matrix.icc Pile.h SymMatrix.h SymMatrix.icc Vector.h Vector.icc ) # notice that defs.h is not referenced here INSTALL (FILES ${pkginclude_HEADERS} DESTINATION include/CLHEP/Matrix ) clhep-2.1.4.1.orig/Matrix/Matrix/DiagMatrix.h0000755000175000017500000001713612074100307017314 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This software written by Nobu Katayama and Mike Smyth, Cornell University. // // DiagMatrix is a class for diagonal matrix. This is useful for a covariance // matrix of measured quantities since they are uncorrelated to each other // and therefore diagonal. It is obviously smaller and faster to manipulate. // #ifndef _DIAGMatrix_H_ #define _DIAGMatrix_H_ #ifdef GNUPRAGMA #pragma interface #endif #include #include "CLHEP/Matrix/defs.h" #include "CLHEP/Matrix/GenMatrix.h" namespace CLHEP { class HepRandom; class HepMatrix; class HepSymMatrix; class HepVector; /** * @author * @ingroup matrix */ class HepDiagMatrix: public HepGenMatrix { public: inline HepDiagMatrix(); // Default constructor. Gives 0x0 matrix. Another Matrix can be assigned // to it. explicit HepDiagMatrix(int p); HepDiagMatrix(int p, int); // Constructor. Gives p x p diagonal matrix. // With a second argument, either 0 or 1, the matrix is initialized. // 0 means a zero matrix, 1 means the identity matrix. HepDiagMatrix(int p, HepRandom &r); HepDiagMatrix(const HepDiagMatrix &hm1); // Copy constructor. virtual ~HepDiagMatrix(); // Destructor. inline int num_row() const; inline int num_col() const; // Returns the number of rows/columns. (Should be equal.) double &operator()(int row, int col); const double &operator()(int row, int col) const; // Read or write a matrix element. row must be equal to col. // ** Note that indexing starts from (1,1). ** double &fast(int row, int col); const double &fast(int row, int col) const; // fast element access. // Must be row>=col; // ** Note that indexing starts from (1,1). ** void assign(const HepMatrix &hm2); // Assigns hm2 to d, assuming hm2 is a diagnal matrix. void assign(const HepSymMatrix &hm2); // Assigns hm2 to d, assuming hm2 is a diagnal matrix. void assign(const HepDiagMatrix &hm2); // Another form of assignment. For consistency. HepDiagMatrix & operator*=(double t); // Multiply a DiagMatrix by a floating number HepDiagMatrix & operator/=(double t); // Divide a DiagMatrix by a floating number HepDiagMatrix & operator+=( const HepDiagMatrix &hm2); HepDiagMatrix & operator-=( const HepDiagMatrix &hm2); // Add or subtract a DiagMatrix. HepDiagMatrix & operator=( const HepDiagMatrix &hm2); // Assignment operator. To assign SymMatrix to DiagMatrix, use d< m; #else std::vector > m; #endif int nrow; #if defined(__sun) || !defined(__GNUG__) // // Sun CC 4.0.1 has this bug. // static double zero; #else static const double zero; #endif }; std::ostream& operator<<(std::ostream &s, const HepDiagMatrix &q); // Write out Matrix, SymMatrix, DiagMatrix and Vector into ostream. HepMatrix operator*(const HepMatrix &hm1, const HepDiagMatrix &hm2); HepMatrix operator*(const HepDiagMatrix &hm1, const HepMatrix &hm2); HepDiagMatrix operator*(double t, const HepDiagMatrix &d1); HepDiagMatrix operator*(const HepDiagMatrix &d1, double t); // Multiplication operators // Note that m *= hm1 is always faster than m = m * hm1 HepDiagMatrix operator/(const HepDiagMatrix &hm1, double t); // d = d1 / t. (d /= t is faster if you can use it.) HepMatrix operator+(const HepMatrix &hm1, const HepDiagMatrix &d2); HepMatrix operator+(const HepDiagMatrix &d1, const HepMatrix &hm2); HepDiagMatrix operator+(const HepDiagMatrix &hm1, const HepDiagMatrix &d2); HepSymMatrix operator+(const HepSymMatrix &s1, const HepDiagMatrix &d2); HepSymMatrix operator+(const HepDiagMatrix &d1, const HepSymMatrix &s2); // Addition operators HepMatrix operator-(const HepMatrix &hm1, const HepDiagMatrix &d2); HepMatrix operator-(const HepDiagMatrix &d1, const HepMatrix &hm2); HepDiagMatrix operator-(const HepDiagMatrix &d1, const HepDiagMatrix &d2); HepSymMatrix operator-(const HepSymMatrix &s1, const HepDiagMatrix &d2); HepSymMatrix operator-(const HepDiagMatrix &d1, const HepSymMatrix &s2); // Subtraction operators HepDiagMatrix dsum(const HepDiagMatrix &s1, const HepDiagMatrix &s2); // Direct sum of two diagonal matricies; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #ifndef HEP_DEBUG_INLINE #include "CLHEP/Matrix/DiagMatrix.icc" #endif #endif /*!_DIAGMatrix_H*/ clhep-2.1.4.1.orig/Matrix/Matrix/Vector.h0000755000175000017500000001470412074100307016523 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // Although Vector and Matrix class are very much related, I like the typing // information I get by making them different types. It is usually an error // to use a Matrix where a Vector is expected, except in the case that the // Matrix is a single column. But this case can be taken care of by using // constructors as conversions. For this same reason, I don't want to make // a Vector a derived class of Matrix. // #ifndef _Vector_H_ #define _Vector_H_ #ifdef GNUPRAGMA #pragma interface #endif #include "CLHEP/Matrix/defs.h" #include "CLHEP/Matrix/GenMatrix.h" namespace CLHEP { class HepRandom; class HepMatrix; class HepSymMatrix; class HepDiagMatrix; class Hep3Vector; /** * @author * @ingroup matrix */ class HepVector : public HepGenMatrix { public: inline HepVector(); // Default constructor. Gives vector of length 0. // Another Vector can be assigned to it. explicit HepVector(int p); HepVector(int p, int); // Constructor. Gives vector of length p. HepVector(int p, HepRandom &r); HepVector(const HepVector &v); HepVector(const HepMatrix &m); // Copy constructors. // Note that there is an assignment operator for v = Hep3Vector. virtual ~HepVector(); // Destructor. inline const double & operator()(int row) const; inline double & operator()(int row); // Read or write a matrix element. // ** Note that the indexing starts from (1). ** inline const double & operator[](int row) const; inline double & operator[](int row); // Read and write an element of a Vector. // ** Note that the indexing starts from [0]. ** virtual const double & operator()(int row, int col) const; virtual double & operator()(int row, int col); // Read or write a matrix element. // ** Note that the indexing starts from (1,1). ** // Allows accessing Vector using GenMatrix HepVector & operator*=(double t); // Multiply a Vector by a floating number. HepVector & operator/=(double t); // Divide a Vector by a floating number. HepVector & operator+=( const HepMatrix &v2); HepVector & operator+=( const HepVector &v2); HepVector & operator-=( const HepMatrix &v2); HepVector & operator-=( const HepVector &v2); // Add or subtract a Vector. HepVector & operator=( const HepVector &hm2); // Assignment operators. HepVector& operator=(const HepMatrix &); HepVector& operator=(const Hep3Vector &); // assignment operators from other classes. HepVector operator- () const; // unary minus, ie. flip the sign of each element. HepVector apply(double (*f)(double, int)) const; // Apply a function to all elements. HepVector sub(int min_row, int max_row) const; // Returns a sub vector. HepVector sub(int min_row, int max_row); // SGI CC bug. I have to have both with/without const. I should not need // one without const. void sub(int row, const HepVector &v1); // Replaces a sub vector of a Vector with v1. inline double normsq() const; // Returns norm squared. inline double norm() const; // Returns norm. virtual int num_row() const; // Returns number of rows. virtual int num_col() const; // Number of columns. Always returns 1. Provided for compatibility with // GenMatrix. HepMatrix T() const; // Returns the transpose of a Vector. Note that the returning type is // Matrix. friend inline void swap(HepVector &v1, HepVector &v2); // Swaps two vectors. protected: virtual int num_size() const; private: virtual void invert(int&); // produces an error. Demanded by GenMatrix friend class HepDiagMatrix; friend class HepSymMatrix; friend class HepMatrix; // friend classes friend double dot(const HepVector &v1, const HepVector &v2); // f = v1 * v2; friend HepVector operator+(const HepVector &v1, const HepVector &v2); friend HepVector operator-(const HepVector &v1, const HepVector &v2); friend HepVector operator*(const HepSymMatrix &hm1, const HepVector &hm2); friend HepVector operator*(const HepDiagMatrix &hm1, const HepVector &hm2); friend HepMatrix operator*(const HepVector &hm1, const HepMatrix &hm2); friend HepVector operator*(const HepMatrix &hm1, const HepVector &hm2); friend HepVector solve(const HepMatrix &a, const HepVector &v); friend void tridiagonal(HepSymMatrix *a,HepMatrix *hsm); friend void row_house(HepMatrix *,const HepMatrix &, double, int, int, int, int); friend void row_house(HepMatrix *,const HepVector &, double, int, int); friend void back_solve(const HepMatrix &R, HepVector *b); friend void col_house(HepMatrix *,const HepMatrix &,double, int, int, int, int); friend HepVector house(const HepSymMatrix &a,int row,int col); friend HepVector house(const HepMatrix &a,int row,int col); friend void house_with_update(HepMatrix *a,int row,int col); friend HepSymMatrix vT_times_v(const HepVector &v); friend HepVector qr_solve(HepMatrix *, const HepVector &); #ifdef DISABLE_ALLOC std::vector m; #else std::vector > m; #endif int nrow; }; // // Operations other than member functions // std::ostream& operator<<(std::ostream &s, const HepVector &v); // Write out Matrix, SymMatrix, DiagMatrix and Vector into ostream. HepVector operator*(const HepMatrix &hm1, const HepVector &hm2); HepVector operator*(double t, const HepVector &v1); HepVector operator*(const HepVector &v1, double t); // Multiplication operators. // Note that m *= x is always faster than m = m * x. HepVector operator/(const HepVector &v1, double t); // Divide by a real number. HepVector operator+(const HepMatrix &hm1, const HepVector &v2); HepVector operator+(const HepVector &v1, const HepMatrix &hm2); HepVector operator+(const HepVector &v1, const HepVector &v2); // Addition operators HepVector operator-(const HepMatrix &hm1, const HepVector &v2); HepVector operator-(const HepVector &v1, const HepMatrix &hm2); HepVector operator-(const HepVector &v1, const HepVector &v2); // subtraction operators HepVector dsum(const HepVector &s1, const HepVector &s2); // Direct sum of two vectors; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #include "CLHEP/Matrix/Vector.icc" #endif /*!_Vector_H*/ clhep-2.1.4.1.orig/Matrix/Matrix/SymMatrix.h0000755000175000017500000002650412074100307017217 0ustar olesoles// -*- C++ -*- // CLASSDOC OFF // --------------------------------------------------------------------------- // CLASSDOC ON // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definition of the HepSymMatrix class. // // This software written by Nobu Katayama and Mike Smyth, Cornell University. // // .SS Usage // // This is very much like the Matrix, except of course it is restricted to // Symmetric Matrix. All the operations for Matrix can also be done here // (except for the +=,-=,*= that don't yield a symmetric matrix. e.g. // +=(const Matrix &) is not defined) // The matrix is stored as a lower triangular matrix. // In addition to the (row, col) method of finding element, fast(row, col) // returns an element with checking to see if row and col need to be // interchanged so that row >= col. // New operations are: // // .ft B // sym = s.similarity(m); // // This returns m*s*m.T(). This is a similarity // transform when m is orthogonal, but nothing // restricts m to be orthogonal. It is just // a more efficient way to calculate m*s*m.T, // and it realizes that this should be a // HepSymMatrix (the explicit operation m*s*m.T // will return a Matrix, not realizing that // it is symmetric). // // .ft B // sym = similarityT(m); // // This returns m.T()*s*m. // // .ft B // s << m; // // This takes the matrix m, and treats it // as symmetric matrix that is copied to s. // This is useful for operations that yield // symmetric matrix, but which the computer // is too dumb to realize. // // .ft B // s = vT_times_v(const HepVector v); // // calculates v.T()*v. // // ./"This code has been written by Mike Smyth, and the algorithms used are // ./"described in the thesis "A Tracking Library for a Silicon Vertex Detector" // ./"(Mike Smyth, Cornell University, June 1993). // ./"This is file contains C++ stuff for doing things with Matrixes. // ./"To turn on bound checking, define MATRIX_BOUND_CHECK before including // ./"this file. // #ifndef _SYMMatrix_H_ #define _SYMMatrix_H_ #ifdef GNUPRAGMA #pragma interface #endif #include #include "CLHEP/Matrix/defs.h" #include "CLHEP/Matrix/GenMatrix.h" namespace CLHEP { class HepRandom; class HepMatrix; class HepDiagMatrix; class HepVector; /** * @author * @ingroup matrix */ class HepSymMatrix : public HepGenMatrix { public: inline HepSymMatrix(); // Default constructor. Gives 0x0 symmetric matrix. // Another SymMatrix can be assigned to it. explicit HepSymMatrix(int p); HepSymMatrix(int p, int); // Constructor. Gives p x p symmetric matrix. // With a second argument, the matrix is initialized. 0 means a zero // matrix, 1 means the identity matrix. HepSymMatrix(int p, HepRandom &r); HepSymMatrix(const HepSymMatrix &hm1); // Copy constructor. HepSymMatrix(const HepDiagMatrix &hm1); // Constructor from DiagMatrix virtual ~HepSymMatrix(); // Destructor. inline int num_row() const; inline int num_col() const; // Returns number of rows/columns. const double & operator()(int row, int col) const; double & operator()(int row, int col); // Read and write a SymMatrix element. // ** Note that indexing starts from (1,1). ** const double & fast(int row, int col) const; double & fast(int row, int col); // fast element access. // Must be row>=col; // ** Note that indexing starts from (1,1). ** void assign(const HepMatrix &hm2); // Assigns hm2 to s, assuming hm2 is a symmetric matrix. void assign(const HepSymMatrix &hm2); // Another form of assignment. For consistency. HepSymMatrix & operator*=(double t); // Multiply a SymMatrix by a floating number. HepSymMatrix & operator/=(double t); // Divide a SymMatrix by a floating number. HepSymMatrix & operator+=( const HepSymMatrix &hm2); HepSymMatrix & operator+=( const HepDiagMatrix &hm2); HepSymMatrix & operator-=( const HepSymMatrix &hm2); HepSymMatrix & operator-=( const HepDiagMatrix &hm2); // Add or subtract a SymMatrix. HepSymMatrix & operator=( const HepSymMatrix &hm2); HepSymMatrix & operator=( const HepDiagMatrix &hm2); // Assignment operators. Notice that there is no SymMatrix = Matrix. HepSymMatrix operator- () const; // unary minus, ie. flip the sign of each element. HepSymMatrix T() const; // Returns the transpose of a SymMatrix (which is itself). HepSymMatrix apply(double (*f)(double, int, int)) const; // Apply a function to all elements of the matrix. HepSymMatrix similarity(const HepMatrix &hm1) const; HepSymMatrix similarity(const HepSymMatrix &hm1) const; // Returns hm1*s*hm1.T(). HepSymMatrix similarityT(const HepMatrix &hm1) const; // temporary. test of new similarity. // Returns hm1.T()*s*hm1. double similarity(const HepVector &v) const; // Returns v.T()*s*v (This is a scaler). HepSymMatrix sub(int min_row, int max_row) const; // Returns a sub matrix of a SymMatrix. void sub(int row, const HepSymMatrix &hm1); // Sub matrix of this SymMatrix is replaced with hm1. HepSymMatrix sub(int min_row, int max_row); // SGI CC bug. I have to have both with/without const. I should not need // one without const. inline HepSymMatrix inverse(int &ifail) const; // Invert a Matrix. The matrix is not changed // Returns 0 when successful, otherwise non-zero. void invert(int &ifail); // Invert a Matrix. // N.B. the contents of the matrix are replaced by the inverse. // Returns ierr = 0 when successful, otherwise non-zero. // This method has less overhead then inverse(). inline void invert(); // Invert a matrix. Throw std::runtime_error on failure. inline HepSymMatrix inverse() const; // Invert a matrix. Throw std::runtime_error on failure. double determinant() const; // calculate the determinant of the matrix. double trace() const; // calculate the trace of the matrix (sum of diagonal elements). class HepSymMatrix_row { public: inline HepSymMatrix_row(HepSymMatrix&,int); inline double & operator[](int); private: HepSymMatrix& _a; int _r; }; class HepSymMatrix_row_const { public: inline HepSymMatrix_row_const(const HepSymMatrix&,int); inline const double & operator[](int) const; private: const HepSymMatrix& _a; int _r; }; // helper class to implement m[i][j] inline HepSymMatrix_row operator[] (int); inline HepSymMatrix_row_const operator[] (int) const; // Read or write a matrix element. // While it may not look like it, you simply do m[i][j] to get an // element. // ** Note that the indexing starts from [0][0]. ** // Special-case inversions for 5x5 and 6x6 symmetric positive definite: // These set ifail=0 and invert if the matrix was positive definite; // otherwise ifail=1 and the matrix is left unaltered. void invertCholesky5 (int &ifail); void invertCholesky6 (int &ifail); // Inversions for 5x5 and 6x6 forcing use of specific methods: The // behavior (though not the speed) will be identical to invert(ifail). void invertHaywood4 (int & ifail); void invertHaywood5 (int &ifail); void invertHaywood6 (int &ifail); void invertBunchKaufman (int &ifail); protected: inline int num_size() const; private: friend class HepSymMatrix_row; friend class HepSymMatrix_row_const; friend class HepMatrix; friend class HepDiagMatrix; friend void tridiagonal(HepSymMatrix *a,HepMatrix *hsm); friend double condition(const HepSymMatrix &m); friend void diag_step(HepSymMatrix *t,int begin,int end); friend void diag_step(HepSymMatrix *t,HepMatrix *u,int begin,int end); friend HepMatrix diagonalize(HepSymMatrix *s); friend HepVector house(const HepSymMatrix &a,int row,int col); friend void house_with_update2(HepSymMatrix *a,HepMatrix *v,int row,int col); friend HepSymMatrix operator+(const HepSymMatrix &hm1, const HepSymMatrix &hm2); friend HepSymMatrix operator-(const HepSymMatrix &hm1, const HepSymMatrix &hm2); friend HepMatrix operator*(const HepSymMatrix &hm1, const HepSymMatrix &hm2); friend HepMatrix operator*(const HepSymMatrix &hm1, const HepMatrix &hm2); friend HepMatrix operator*(const HepMatrix &hm1, const HepSymMatrix &hm2); friend HepVector operator*(const HepSymMatrix &hm1, const HepVector &hm2); // Multiply a Matrix by a Matrix or Vector. friend HepSymMatrix vT_times_v(const HepVector &v); // Returns v * v.T(); #ifdef DISABLE_ALLOC std::vector m; #else std::vector > m; #endif int nrow; int size_; // total number of elements static double posDefFraction5x5; static double adjustment5x5; static const double CHOLESKY_THRESHOLD_5x5; static const double CHOLESKY_CREEP_5x5; static double posDefFraction6x6; static double adjustment6x6; static const double CHOLESKY_THRESHOLD_6x6; static const double CHOLESKY_CREEP_6x6; void invert4 (int & ifail); void invert5 (int & ifail); void invert6 (int & ifail); }; // // Operations other than member functions for Matrix, SymMatrix, DiagMatrix // and Vectors implemented in Matrix.cc and Matrix.icc (inline). // std::ostream& operator<<(std::ostream &s, const HepSymMatrix &q); // Write out Matrix, SymMatrix, DiagMatrix and Vector into ostream. HepMatrix operator*(const HepMatrix &hm1, const HepSymMatrix &hm2); HepMatrix operator*(const HepSymMatrix &hm1, const HepMatrix &hm2); HepMatrix operator*(const HepSymMatrix &hm1, const HepSymMatrix &hm2); HepSymMatrix operator*(double t, const HepSymMatrix &s1); HepSymMatrix operator*(const HepSymMatrix &s1, double t); // Multiplication operators. // Note that m *= hm1 is always faster than m = m * hm1 HepSymMatrix operator/(const HepSymMatrix &hm1, double t); // s = s1 / t. (s /= t is faster if you can use it.) HepMatrix operator+(const HepMatrix &hm1, const HepSymMatrix &s2); HepMatrix operator+(const HepSymMatrix &s1, const HepMatrix &hm2); HepSymMatrix operator+(const HepSymMatrix &s1, const HepSymMatrix &s2); // Addition operators HepMatrix operator-(const HepMatrix &hm1, const HepSymMatrix &s2); HepMatrix operator-(const HepSymMatrix &hm1, const HepMatrix &hm2); HepSymMatrix operator-(const HepSymMatrix &s1, const HepSymMatrix &s2); // subtraction operators HepSymMatrix dsum(const HepSymMatrix &s1, const HepSymMatrix &s2); // Direct sum of two symmetric matrices; double condition(const HepSymMatrix &m); // Find the conditon number of a symmetric matrix. void diag_step(HepSymMatrix *t, int begin, int end); void diag_step(HepSymMatrix *t, HepMatrix *u, int begin, int end); // Implicit symmetric QR step with Wilkinson Shift HepMatrix diagonalize(HepSymMatrix *s); // Diagonalize a symmetric matrix. // It returns the matrix U so that s_old = U * s_diag * U.T() HepVector house(const HepSymMatrix &a, int row=1, int col=1); void house_with_update2(HepSymMatrix *a, HepMatrix *v, int row=1, int col=1); // Finds and does Householder reflection on matrix. void tridiagonal(HepSymMatrix *a, HepMatrix *hsm); HepMatrix tridiagonal(HepSymMatrix *a); // Does a Householder tridiagonalization of a symmetric matrix. } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #ifndef HEP_DEBUG_INLINE #include "CLHEP/Matrix/SymMatrix.icc" #endif #endif /*!_SYMMatrix_H*/ clhep-2.1.4.1.orig/Matrix/COPYING0000644000175000017500000010451311406201264014674 0ustar olesoles GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/Matrix/test/0000755000175000017500000000000012242515217014621 5ustar olesolesclhep-2.1.4.1.orig/Matrix/test/testInversion.cc0000755000175000017500000001553707716514316020033 0ustar olesoles// -*- C++ -*- // $Id: testInversion.cc,v 1.2 2003/08/13 20:00:12 garren Exp $ // // This file is a part of CLHEP - a Class Library for High Energy Physics. // // This is a collection of parts of programs that are useful // for testing matrix inversion algorithms // 9/97, Mario Stanke #include #include #include "CLHEP/Matrix/defs.h" #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/SymMatrix.h" #include "CLHEP/Matrix/DiagMatrix.h" using std::cout; using std::endl; using namespace CLHEP; int main() { //int n , i, j, k, ierr1, ierr2; int n, j, ierr1, ierr2; time_t zeit1, zeit2; // ****compare the speed of inversion algorithms HepSymMatrix A(5,1); // for (j=1;j <= 100; j++) // for (k=1; k<=j; k++) // A(j,k)=rand()%9-5; A(1,1)=6; A(1,2)=.8545; A(1,3)=-.684651; A(1,4)=.372547; A(1,5)=.68151; //A(1,6)=.068151; A(2,2)=4; A(2,3)=.5151; A(2,4)=.5151; A(2,5)=.651651; //A(2,6)=.9651651; A(3,3)=5; A(3,4)=.3; A(3,5)=.363; //A(3,6)=.7363; A(4,4)=-3; A(4,5)=-.23753; //A(4,6)=-.23753; A(5,5)=-5; //A(5,6)=-2; //A(6,6)=-3; HepSymMatrix B(A); HepSymMatrix D(A); HepSymMatrix C(5,0); HepMatrix M(A); cout << "M inverse" << M.inverse(ierr2) << endl; C = B.inverse(ierr1); D.invert(ierr2); cout << "B " << B << endl; cout << "B inverse" << C << endl; #ifndef INSTALLATION_CHECK cout << "B * inverse" << B * C << endl; #endif cout << "ierr1: " << ierr1 << endl; cout << "D * inverse" << D * C << endl; cout << "ierr2: " << ierr2 << endl; cout << "M inverse" << M.inverse(ierr2) << endl; #ifndef INSTALLATION_CHECK cout << "M * inverse" << M * M.inverse(ierr2)<< endl; #endif cout << "ierr2: " << ierr2 << endl; #ifndef INSTALLATION_CHECK n = 100000; #else n = 10; #endif zeit1 = time(NULL); cout << "Executing " << n << " inversions ..." << endl; for (j=0; j 1e-4) { cout << "bunch failed to invert but did not indicate" << endl; cout << C << endl; cout << "B " << B << endl; cout << "B*C" << B*C << endl; cout << "M*C" << M*C << endl; cout << "determinant " << C.determinant() << endl; cout << "dist2 " << dist2 << endl; cout << "dist1 " << dist1 << endl; cout << "ierr2 " << ierr2 < 1e-4 && ierr2==0) { cout << "old failed to invert but did not indicate" << endl; cout << C << endl; cout << "B*C" << B*C << endl; cout << "M*C" << M*C << endl; cout << "determinant " << C.determinant() << endl; cout << "ierr2 " << ierr2 < #include using std::cout; using std::endl; using namespace CLHEP; #define PRINTOUT int matrix_test1(const HepGenMatrix&m) { // // test of virtual finctions. // static int dum = 0; dum += m.num_col(); return 0; } // // test function // double neg(double f, int, int) { return -f; } double absf(double f, int, int) { return fabs(f); } double negv(double f, int) { return -f; } void matrix_test2(const HepSymMatrix&m, HepSymMatrix &n) { n = m.sub(2,5); } void matrix_test() { // // complete test of all functions in Matrix.cc // cout << "Starting Matrix tests" << endl; { // Test of HepMatrix() HepMatrix a; } { // Test of HepMatrix(p,q) HepMatrix a(3,5); HepMatrix b(4,5,0); cout << "4x5 matrix initialized to zero " << b; HepMatrix c(3,3,1); cout << "3x3 matrix initialized to identity " << c; } { // Test of HepMatrix(p,q,Random) HepRandom r; r.setTheSeed(31); HepMatrix a(3,3,r); cout << "3x3 matrix initialized with Random " << a; // Test of HepMatrix(const HepMatrix&); HepMatrix b(a); cout << "matrix initialized to the previous matrix " << b; } { // Test of sub matrix HepRandom r; r.setTheSeed(31); HepMatrix a(8,5,r); HepMatrix b = a.sub(2,6,3,5); cout << "8x5 matrix" << a; cout << "sub matrix (2-6 x 3-5 of the previous matrix." << b; HepMatrix c(2,3,0); a.sub(4,3,c); cout << "embedding sub matrix at 4,3" << a; // Test of dsum HepMatrix d(3,2,r); cout << "dsum" << dsum(a,d); } { // m += m1; HepRandom r; r.setTheSeed(31); HepMatrix a(5,5,r); HepMatrix b(5,5,r); cout << "a" << a; cout << "b" << b; cout << "a += b" << (a+=b); HepMatrix c; c = a + b; cout << "a + b" << c; } { // test of T(); HepRandom r; r.setTheSeed(31); HepMatrix a(5,3,r); HepMatrix b = a.T(); cout << "a" << a; cout << "a.T" << b; } cout << "End of Matrix tests" << endl; } void symmatrix_test() { { // Test of HepSymMatrix() HepSymMatrix a; } { // Test of HepSymMatrix(p) HepSymMatrix a(3); HepSymMatrix b(4,0); cout << "4x4 Symmetric matrix initialuzed to zero " << b; HepSymMatrix c(3,1); cout << "3x3 Symmetric matrix initialized to identity "<< c; } { // Test of HepSymMatrix(p,Random) HepRandom r; r.setTheSeed(31); HepSymMatrix a(3,r); cout << "3x3 symmetric matrix initialized with Random " << a << endl; // Test of HepSymMatrix(const HepSymMatrix&); HepSymMatrix b(a); cout << "symmetric matrix initialized to the previous matrix " << b; HepMatrix c(b); cout << "matrix initialized to the previous symmetric matrix " << c; // // Access to elements // double f = 3.8; double g = 22.5; cout << c(1,1) << " " << c[0][0] << endl; c(1,2) = f; c[2][1] = g; c(2,3) = f; c[1][2] = g; cout << c << endl; HepMatrix &d = c; cout << d(1,1) << " " << d[0][0] << endl; } { // Test of sub symmatrix HepRandom r; r.setTheSeed(31); HepSymMatrix a(5,r); HepSymMatrix b = a.sub(2,5); cout << "5x5 sym matrix" << a; cout << "sub sym matrix (2-5 x 2-5 of the previous sub matrix." << b; HepSymMatrix c(3,0); a.sub(2,c); cout << "embedding sub matrix at 2" << a; } { // m = m1 + s; HepRandom r; r.setTheSeed(31); HepMatrix a(5,5,r); HepSymMatrix b(5,r); cout << "a" << a; cout << "b(sym)" << b; cout << "a += b" << (a+=b); HepMatrix c = a + b; cout << "a + b" << c; } { // test of similarity(Matrix) HepRandom r; r.setTheSeed(31); HepMatrix a(5,3,r); HepSymMatrix b(3,r); HepSymMatrix c = b.similarity(a); cout << "a" << a; cout << "b" << b; cout << "c" << c; } { // test of similarityT(Matrix) HepRandom r; r.setTheSeed(31); HepMatrix a(3,5,r); HepSymMatrix b(3,r); HepSymMatrix c = b.similarityT(a); cout << "a" << a; cout << "b" << b; cout << "c" << c; } { // test of similarity(SymMatrix) HepRandom r; r.setTheSeed(31); HepSymMatrix a(3,r); HepSymMatrix b(3,r); HepSymMatrix c = b.similarity(a); cout << "a" << a; cout << "b" << b; cout << "c" << c; } { // test of similarity(Vector) HepRandom r; r.setTheSeed(31); HepVector a(3,r); HepSymMatrix b(3,r); double c = b.similarity(a); HepSymMatrix cc = b.similarity(HepMatrix(a.T())); cout << "a" << a; cout << "b" << b; cout << "c\t" << c << endl; cout << "c" << cc; } cout << "End of SymMatrix tests" << endl; } void diagmatrix_test() { { // Test of HepDiagMatrix() HepDiagMatrix a; } { // Test of HepDiagMatrix(p) HepDiagMatrix a(3); HepDiagMatrix b(4,0); cout << "4x4 diagonal matrix initialized to zero " << b; HepDiagMatrix c(3,1); cout << "3x3 diagonal matrix initialized to identity " << c; } { // Test of HepDiagMatrix(p,Random) HepRandom r; r.setTheSeed(31); HepDiagMatrix a(3,r); cout << "3x3 diagonal matrix initialized to Random " << a; // Test of HepDiagMatrix(const HepDiagMatrix&); HepDiagMatrix b(a); cout << "diagonal matrix initialized to the previous matrix " << b; HepMatrix c(b); cout << "matrix initialized to the previous diagonal matrix " << c; HepSymMatrix d(b); cout << "Symmetric matrix initialized to the previous diagonal matrix " << d; } { // Test of sub diagmatrix HepRandom r; r.setTheSeed(31); HepDiagMatrix a(8,r); HepDiagMatrix b = a.sub(2,5); cout << "8x8 diag matrix" << a; cout << "sub diag matrix (2-5 x 2-5 of the previous diag matrix." << b; HepDiagMatrix c(3,0); a.sub(2,c); cout << "embedding sub matrix at 2" << a; } { // m = m1 + s; HepRandom r; r.setTheSeed(31); HepMatrix a(5,5,r); HepDiagMatrix b(5,r); cout << "a" << a; cout << "b(diag)" << b; cout << "a += b" << (a+=b); HepMatrix c = a + b; cout << "a + b" << c; } cout << "End of DiagMatrix tests" << endl; } void vector_test() { { // Test of HepVector() HepVector a; } { // Test of HepVector(p) HepVector a(3); HepVector b(4,0); cout << "4 vector initialized to zero "<< b; HepVector c(3,1); cout << "3 vector initialized to identity " << c; } { // Test of HepVector(p,Random) HepRandom r; r.setTheSeed(31); HepVector a(3,r); cout << "3 vector initialized to Random " << a; // Test of HepVector(const HepVector&); HepVector b(a); cout << "Vector initialized to the previous vector " << b; HepMatrix c(b); cout << "matrix initialized to the previous vector " << c; HepVector d(c); cout << "Vector initialized to the previous matrix " << d; } { // Test of sub diagmatrix HepRandom r; r.setTheSeed(31); HepVector a(8,r); HepVector b = a.sub(2,5); cout << "8 vector" << a; cout << "sub vector (2-5 of the previous vector." << b; HepVector c(3,0); a.sub(2,c); cout << "embedding sub vector at 2 " << a; } { // m = m1 + s; HepRandom r; r.setTheSeed(31); HepMatrix a(5,1,r); HepVector b(5,r); cout << "a" << a; cout << "b(vector)" << b; cout << "a += b" << (a+=b); HepMatrix c = a + b; cout << "a + b" << c; } cout << "End of Vector tests" << endl; } int main() { // // Test of HepMatrix // cout << std::setiosflags(std::ios::fixed) << std::setw(10); matrix_test(); symmatrix_test(); diagmatrix_test(); vector_test(); // // Test of default constructor // HepMatrix m; // // Test of constructors. // HepMatrix d(3,3,1); HepMatrix e(3,3,0); HepMatrix f(5,3); HepMatrix g(f); matrix_test1(g); // // Test of constructor with a Random object. // HepRandom r; r.setTheSeed(31); HepMatrix a(3,3,r); #if defined(PRINTOUT) cout << a << endl; #endif HepMatrix b(3,5,r); matrix_test1(b); #if defined(PRINTOUT) cout << b << endl; #endif HepSymMatrix dds(3,r); HepMatrix ddm(dds); HepDiagMatrix ddd(3,r); HepMatrix ddmd(ddd); HepVector ddv(3,r); HepMatrix ddmv(ddv); #if defined(PRINTOUT) cout << "nraw=" << b.num_row() << " ncol=" << b.num_col() << endl; #endif #if defined(PRINTOUT) cout << "b(1,1)=" << b(1,1) << " b(2,1)=" << b(2,1) << endl; #endif b(2,3) = 1.0; b /= 3.0; b *= 6.0; HepSymMatrix sm(3,r); HepDiagMatrix dm(3,r); HepVector vvm(3,r); d += e; d += sm; d += dm; ddmv += vvm; a -= e; a -= sm; a -= dm; ddmv -= vvm; d = sm; d = dm; d = a; ddmv = vvm; e = d.apply(neg); a = d.T(); e = b.sub(1,2,3,2); b.sub(1,3,e); swap(a,d); m = d * a; m = d * sm; m = d * dm; m = sm * d; #if defined(PRINTOUT) cout << "Dm=" << dm << " d = " << d << endl; #endif m = dm * d; m = sm * sm; m = dm * dm; // // SymMatrix // HepSymMatrix s; HepSymMatrix ss(6); HepSymMatrix si(6,1); HepSymMatrix sz(6,0); HepSymMatrix sr(6,r); HepSymMatrix sc(sr); HepSymMatrix scd(dm); matrix_test1(si); #if defined(PRINTOUT) cout << "nraw=" << sr.num_row() << " ncol=" << sr.num_col() << endl; #endif #if defined(PRINTOUT) cout << "sr(1,1)=" << sr(1,1) << " sr(2,1)=" << sr(2,1) << endl; #endif sr(4,3) = r(); sr.fast(3,1) = r(); s.assign(d); #if defined(PRINTOUT) cout << "d=" << d << "s=" << s << endl; #endif ss.assign(sc); ss *= 0.5; ss /= 0.2; HepDiagMatrix ddds(ss.num_row(),r); ss += si; ss += ddds; ss -= sr; ss -= ddds; ss = ddds; s = sr; s = ss.T(); s.apply(neg); HepMatrix mm(6,4,r); ss = s.similarityT(mm); HepMatrix mt(8,6,r); ss = s.similarity(mt); s.assign(d); s = sr.sub(2,5); ss.sub(2,s); s = ss.sub(2,7); m = s * sr; m = s * m; m = m * s; HepVector v(6,r); s = vT_times_v(v); // // Test of HepDiagMatrix // HepDiagMatrix dt; HepDiagMatrix dn(6); HepDiagMatrix di(6,1); HepDiagMatrix dz(6,0); HepDiagMatrix dr(6,r); HepDiagMatrix dc(dr); matrix_test1(dr); #if defined(PRINTOUT) cout << "Nr=" << di.num_row() << " Nc=" << dz.num_col() << endl; #endif #if defined(PRINTOUT) cout << "dr(1,1)=" << dr(1,1) << endl; #endif dr(4,4) = r(); dr.fast(2,2) = r(); dt.assign(m); dt.assign(s); dt.assign(dc); dr *= 3.0; dr /= 3.0; dr += dt; dr -= di; dt = dz; dz = dt.T(); di = dt.apply(neg); s = dr.similarityT(mm); s = dr.similarity(mt); #if defined(PRINTOUT) cout << "sim=" << dr.similarity(v); #endif dt = dr.sub(2,5); dz.sub(3,dt); // // Test of HepVector // HepVector vt; HepVector vp(6); HepVector vz(6,0); HepVector vi(6,1); HepVector vr(6,r); HepVector vc(vr); #if defined(PRINTOUT) cout << "vz=" << vz << "vi=" << vi << endl; #endif HepVector vm(HepMatrix(6,1,r)); HepVector vs(HepSymMatrix(1,r)); HepVector vd(HepDiagMatrix(1,r)); #if defined(PRINTOUT) cout << "Nr=" << vr.num_row() << endl; #endif #if defined(PRINTOUT) cout << "vr(3)=" << vr(3) << endl; #endif vr(2) = r(); vi *= 2.5; vi /= 2.5; vm += HepMatrix(6,1,r); vs += HepSymMatrix(1,r); vd += HepDiagMatrix(1,r); vi += vr; vm -= HepMatrix(6,1,r); vs -= HepSymMatrix(1,r); vd -= HepDiagMatrix(1,r); vi -= vc; vm = HepMatrix(6,1,r); vs = HepSymMatrix(1,r); vd = HepDiagMatrix(1,r); vt = vc; vt = vc.apply(negv); vt = vc.sub(2,5); vc.sub(3,vt); #if defined(PRINTOUT) cout << "Normsq=" << vc.normsq() << "Norm=" << vc.norm() << endl; #endif m = vc.T(); swap(vc,vr); vt = sr * vr; vt = dr * vr; vt = mt * vr; f = vr * m; // // Test of other operators // f = 3.5 * m; s = 3.5 * ss; dt = 3.5 * dr; vt = 3.5 * vr; f = m * 3.6; s = ss * 3.6; dt = dr * 3.6; vt = vr * 3.6; f = m / 3.6; s = ss / 3.6; dt = dr / 3.6; vt = vr / 3.6; d = HepMatrix(6,3,r); e = HepMatrix(6,3,r); m = d + e; d = HepMatrix(6,6,r); m = d + sr; m = d + dr; m = sr + d; m = dr + d; s = sr + si; dt = dr + di; s = dr + sr; s = sr + dr; e = HepMatrix(6,1,r); v = e + vr; v = vr + e; v = vr + vz; d = HepMatrix(6,3,r); e = HepMatrix(6,3,r); m = d - e; d = HepMatrix(6,6,r); dr = HepDiagMatrix(6,r); m = d - sr; m = d - dr; m = sr - d; m = dr - d; s = sr - si; dt = dr - di; s = dr - sr; s = sr - dr; e = HepMatrix(6,1,r); v = e - vr; v = vr - e; v = vr - vz; // // Test of Matrix inversion // m = HepMatrix(6,6,r); // a = m; int inv; a = m.inverse(inv); #if defined(PRINTOUT) cout << "Inv=" << inv << endl; #endif if(inv==0) { #if defined(PRINTOUT) HepMatrix am(a * m), ma(m * a); cout << "a*m=" << am.apply(absf) << "m*a=" << ma.apply(absf) << endl; #endif } v = HepVector(6,r); vt = solve(m, v); #if defined(PRINTOUT) cout << "m*vt=" << m*vt << "v=" << v << endl; #endif ss = HepSymMatrix(6,r); // s = ss; s = ss.inverse(inv); #if defined(PRINTOUT) cout << "Inv=" << inv << endl; #endif if(inv==0) { #if defined(PRINTOUT) HepMatrix sss(s*ss), ssss(ss*s); cout << sss.apply(absf) << ssss.apply(absf) << endl; #endif } #if defined(PRINTOUT) cout << "Before diag:ss=" << ss << endl; s = ss; #endif m = diagonalize(&ss); #if defined(PRINTOUT) cout << "m=" << m << endl; #endif #if defined(PRINTOUT) cout << "ss=" << ss << endl; cout << "Sim" << ss.similarity(m) << endl; HepSymMatrix diff(ss.similarity(m) - s); cout << "Diff" << diff.apply(absf) << endl; #endif m = HepMatrix(6,6,r); a = qr_inverse(m); #if defined(PRINTOUT) HepMatrix am(a * m), ma(m * a); cout << am.apply(absf) << ma.apply(absf) << endl; #endif #if defined(PRINTOUT) cout << "Norm 1 =" << norm1(m) << endl; #endif #if defined(PRINTOUT) cout << "Norm 2 =" << norm(m) << endl; #endif #if defined(PRINTOUT) cout << "Norm i =" << norm_infinity(m) << endl; #endif m = HepMatrix(8,6,r); #if defined(PRINTOUT) cout << "m=" << m << endl; #endif a = qr_decomp(&m); #if defined(PRINTOUT) cout << "a=" << a << "m=" << m << endl; #endif #if defined(PRINTOUT) cout << "a*m=" << a*m << endl; #endif m = HepMatrix(8,8,r); v = HepVector(8,r); vt = qr_solve(m,v); #if defined(PRINTOUT) cout << "v=" << v << " m*vt=" << m*vt << endl; #endif m = HepMatrix(8,8,r); a = HepMatrix(8,3,r); b = qr_solve(m,a); #if defined(PRINTOUT) cout << "v=" << a << " m*b=" << m*b << endl; #endif #if defined(PRINTOUT) cout << "Test was successful" << endl; #endif // // Some useful things it can do. // // Spherisity // HepUniformRandomAB ab(-1,1); HepJamesRandom Myengine; RandFlat ab(Myengine); HepVector p[10]; int i; for(i=0;i<10;i++) { p[i] = HepVector(3,ab); p[i] *= 2.0; p[i](1) -= 1; p[i](2) -= 1; p[i](3) -= 1; } HepSymMatrix sp(3,0); for(i=0;i<10;i++) { double psq = p[i].normsq(); sp(1,1) += psq - p[i](1)*p[i](1); sp(2,2) += psq - p[i](2)*p[i](2); sp(3,3) += psq - p[i](3)*p[i](3); sp(2,1) -= p[i](2)*p[i](1); sp(3,1) -= p[i](3)*p[i](1); sp(3,2) -= p[i](3)*p[i](2); } HepMatrix spd = diagonalize(&sp); cout << "sp=" << sp << " spd=" << spd << endl; HepSymMatrix spps(7,r); HepSymMatrix sppss(spps); cout << "condition = " << condition(spps) << endl; HepMatrix sb = diagonalize(&spps); HepSymMatrix sppssdiff(sppss - spps.similarity(sb)); cout << "spps=" << spps << "sppss - sim = " << sppssdiff.apply(absf) << endl; return 0; } clhep-2.1.4.1.orig/Matrix/test/testBug6176.sh.in0000755000175000017500000000016211776622027017536 0ustar olesoles#! /bin/sh # @configure_input@ ./testBug6176@EXEEXT@ \ | @DIFF_Q@ - "@srcdir@/testBug6176.output" > /dev/null clhep-2.1.4.1.orig/Matrix/test/testMatrix.sh.in0000755000175000017500000000016111776622027017740 0ustar olesoles#! /bin/sh # @configure_input@ ./testMatrix@EXEEXT@ \ | @DIFF_Q@ - "@srcdir@/testMatrix.output" > /dev/null clhep-2.1.4.1.orig/Matrix/test/testBug7328.cc0000644000175000017500000001115011406201264017062 0ustar olesoles// testBug7328.cc // // The bug reported a memory leak in inverting symmetric matrices (of size // greater than 6x6). // // This test verifies that the leak is no longer present, and checks for // correctness. There is a break in method at N=25, so both sides are examined. // // A similar (though unreported) leak was present in the Determinant method; // since this was also fixed, this test tests for correctness of determinant as // well. // #include //#include #include #include #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/SymMatrix.h" int test_inversion (int N) { int i,j; CLHEP::HepSymMatrix S(N,0); for(i=1;i<=N;++i) { for(j=1;j<=N;++j) { if(i<=j) { S (i,j) = (10.0*i+j)/10; } } } CLHEP::HepSymMatrix SS(N,0); SS = S; int ierr = 0; SS.invert(ierr); if (ierr) { std::cout<<"SS.invert failed!!!! N = " << N << " ierr = "<< ierr < 1.0e-6) { std::cout<<"SS.invert incorrect N = " << N << " error = "<< fabs(SI(i,j)) < 1.0e-6) { std::cout<<"SS.invert incorrect N = " << N << " error = "<< fabs(1-SI(i,j)) < 1.0e-6) { std::cout<<"Determinant incorrect N = " << N << " error = " << fabs((detS-1.0/detSS)/detS) < #include #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/SymMatrix.h" int test_inversion (int N) { int i; int j; CLHEP::HepMatrix M(N,N,0); CLHEP::HepSymMatrix S(N,0); for(i=1;i<=N;++i) { for(j=1;j<=N;++j) { if(i<=j) { S (i,j) = 10*i+j; M (i,j) = 10*i+j; M (j,i) = M(i,j) + .1 * (i-j)*(i-j); } } } CLHEP::HepMatrix MM(N,N,0); CLHEP::HepSymMatrix SS(N,0); MM = M; SS = S; int ierr = 0; MM.invert(ierr); if (ierr) { std::cout<<"MM.invert failed!!!! N = " << N << " ierr = "<< ierr < testInversion.cout @DIFF_Q@ testInversion.cout "@srcdir@/testInversion.output" clhep-2.1.4.1.orig/Matrix/test/testInversion.output0000755000175000017500000000443307707314417020777 0ustar olesolesM inverse 0.173034 -0.0453089 0.0261018 0.0148243 0.0188705 -0.0453089 0.256354 -0.0362626 0.0329391 0.0230375 0.0261018 -0.0362626 0.205378 0.016527 0.0129569 0.0148243 0.0329391 0.016527 -0.326005 0.0230006 0.0188705 0.0230375 0.0129569 0.0230006 -0.194577 B 6 0.8545 -0.684651 0.372547 0.68151 0.8545 4 0.5151 0.5151 0.651651 -0.684651 0.5151 5 0.3 0.363 0.372547 0.5151 0.3 -3 -0.23753 0.68151 0.651651 0.363 -0.23753 -5 B inverse 0.173034 -0.0453089 0.0261018 0.0148243 0.0188705 -0.0453089 0.256354 -0.0362626 0.0329391 0.0230375 0.0261018 -0.0362626 0.205378 0.016527 0.0129569 0.0148243 0.0329391 0.016527 -0.326005 0.0230006 0.0188705 0.0230375 0.0129569 0.0230006 -0.194577 ierr1: 0 D * inverse 0.0332508 -0.0194786 0.0120098 -0.00289471 -0.000771172 -0.0194786 0.070701 -0.0170834 -0.00303536 0.000855944 0.0120098 -0.0170834 0.0446173 -0.00250311 0.000177222 -0.00289471 -0.00303536 -0.00250311 0.108386 -0.010721 -0.000771172 0.000855944 0.000177222 -0.010721 0.0394441 ierr2: 0 M inverse 0.173034 -0.0453089 0.0261018 0.0148243 0.0188705 -0.0453089 0.256354 -0.0362626 0.0329391 0.0230375 0.0261018 -0.0362626 0.205378 0.016527 0.0129569 0.0148243 0.0329391 0.016527 -0.326005 0.0230006 0.0188705 0.0230375 0.0129569 0.0230006 -0.194577 ierr2: 0 Executing 10 inversions ... B: duration of inversion: 0 secs Executing 10 inversions ... 0.173034 -0.0453089 0.0261018 0.0148243 0.0188705 -0.0453089 0.256354 -0.0362626 0.0329391 0.0230375 0.0261018 -0.0362626 0.205378 0.016527 0.0129569 0.0148243 0.0329391 0.016527 -0.326005 0.0230006 0.0188705 0.0230375 0.0129569 0.0230006 -0.194577 D: duration of inversion: 0 secs clhep-2.1.4.1.orig/Matrix/test/testBug6176.cc0000644000175000017500000000061611406201264017067 0ustar olesoles#include #include "CLHEP/Matrix/Matrix.h" typedef CLHEP::HepMatrix AlgebraicMatrix; int main(int, char **) { AlgebraicMatrix mtr(7,7,0); for(int i=1;i<8;++i) { for(int j=1;j<8;++j) { if(i<=j) { mtr(i,j) = 10*i+j; mtr(j,i) = 10*j+i; } } } std::cout<<"Initial matrix "< * change the names of more internal variables so -Wshadow does not complain ============================== 14.11.12 Release CLHEP-2.1.3.1 ============================== ============================== 06.11.12 Release CLHEP-2.1.3.0 ============================== 2012-09-06 Joe Boudreau * DiagMatrix, GenMatrix, SymMatrix: add invert() and inverse() methods Added two methods to [-,Diag,Sym]Matrix to carry out the matrix inversion without the users needing to provide an ierr flag. These methods are all inline and called invert() and inverse(), so they overload the existing inversion routines for the relevant class. If an error occurs, then an std::runtime_error is thrown. ============================== 16.08.12 Release CLHEP-2.1.2.5 ============================== ============================== 09.07.12 Release CLHEP-2.1.2.4 ============================== ============================== 31.05.12 Release CLHEP-2.1.2.3 ============================== 2012-05-30 Lynn Garren * more cleanup for -Wextra (remove register declaration of iterators) According to Stroustrup, 2000, use of register is now redundant. ============================== 14.02.12 Release CLHEP-2.1.2.2 ============================== ============================== 06.02.12 Release CLHEP-2.1.2.1 ============================== 2012-02-01 Lynn Garren * change the names of internal variables so -Wshadow does not complain ============================== 16.12.11 Release CLHEP-2.1.2.0 ============================== ============================== 29.07.11 Release CLHEP-2.1.1.0 ============================== 2011-06-30 W. E. Brown * rename internal size variable as size_ to avoid symbol conflicts ============================== 11.11.10 Release CLHEP-2.1.0.1 ============================== ============================== 23.07.10 Release CLHEP-2.1.0.0 ============================== ============================== 16.06.10 Release CLHEP-2.1.0.0.b01 ============================== ============================== 11.06.10 Release CLHEP-2.0.5.0.b01 ============================== 2010-06-11 Lynn Garren * Matrix/Matrix.h: inline virtual functions are now only virtual and not inline * Matrix/Vertex.h: inline virtual functions are now only virtual and not inline ============================== 09.03.10 Release CLHEP-2.0.4.6 ============================== ============================== 08.12.09 Release CLHEP-2.0.4.5 ============================== ============================== 12.11.09 Release CLHEP-2.0.4.4 ============================== 2009-11-10 Lynn Garren * test/testBug7328.cc: allow for heap collection before testing * configure.in, test/Makefile.am: finer control over testBug7328 ============================== 03.11.09 Release CLHEP-2.0.4.4.b01 ============================== ============================== 04.07.09 Release CLHEP-2.0.4.3 ============================== ============================== 18.11.08 Release CLHEP-2.0.4.2 ============================== ============================== 04.11.08 Release CLHEP-2.0.4.1 ============================== ============================== 07.08.08 Release CLHEP-2.0.4.0 ============================== 2008-07-16 Lynn Garren * src/SymMatrix.cc, Matrix.cc, DiagMatrix.cc, MatrixLinear.cc: Iterators were set to a nonexistent memory location in many places. Even though the iterators were not used, this operation is not allowed and causes problems with the newer VC++ compilers. In some cases, a more efficient rewrite was possible. ============================== 01.05.08 Release CLHEP-2.0.3.3 ============================== ============================== 18.10.07 Release CLHEP-2.0.3.2 ============================== ============================== 15.11.06 Release CLHEP-2.0.3.1 ============================== ============================== 18.10.06 Release CLHEP-2.0.3.0 ============================== ============================== 20.06.06 Release CLHEP-2.0.2.3 ============================== ============================== 21.11.05 Release CLHEP-2.0.2.2 ============================== 2005-11-21 Lynn Garren * src/Makefile.am, test/Makefile.am: Build libraries for Windows Visual C++ without lib prefix. ============================== 22.06.05 Release CLHEP-2.0.2.1 ============================== Wed Jun 22 2005 Andreas Pfeiffer * configure.in: changed soname to install_name for darwin targets, dylibs still don't build properly on 10.3/10.4, static libs ok. 2005-06-19 Lynn Garren * configure.in, Makefile.am: Use lib when building Visual C++ libraries. Disable shared library build for Solaris CC. ============================== 22.04.05 Release CLHEP-2.0.2.0 ============================== 2005-04-07 Lynn Garren * configure.in: set AR and ARFLAGS 2005-03-23 Mark Fischler * SymMatrix.cc, testBug7328.cc Repair bug introduced into determinant of large matrices, and exposed by testBug7328 when it is run on VC++ 7.1. Also clean up the test program to avoid declaring loop indices in the for loop statement when indices of the same name will be used later -- VC++ still fouls up when this is done, though it is proper C++. 2005-03-15 Mark Fischler * SymMatrix.cc, testBug7328.cc Repair of bug 7328, a memory leak encountered when inverting symmetric matrices above the size of 6x6. 2005-02-25 Mark Fischler * Matrix.cc, testBug6181.cc Repair of bug 6181, a serious error in inverting matrices above the size of 6x6. 2005-02-18 Lynn Garren * configure.in, Makefile.am: Stop using libtool. The newer releases of libtool seem to have dropped support for Windows Visual C++. 2005-02-14 Lynn Garren * configure.in: Visual C++ flags are now "-EHsc -nologo -GR -GX -MD" 2005-02-14 Mark Fischler * SymMatrixInvert.cc Implementation of invertHaywood4() 2005-02-03 Lynn Garren * configure.in: install step creates libCLHEP.a, libCLHEP.so, and/or libCLHEP.dylib by adding a symbolic link. 2005-02-02 Andreas PFEIFFER * configure.in: modified compiler flags for windows: added "-O -GR -GX -MD" as this is needed for the multi-thread environments used. 2005-02-01 Lynn Garren * Matrix: remove HEP_CC_NEED_SUB_WITHOUT_CONST ifdefs HEP_CC_NEED_SUB_WITHOUT_CONST has been defined to 1 in all cases for a long time. 2005-01-31 Andreas PFEIFFER * src/Matrix.h: fixed error in sub(int, int, int, int), savannah bug id 6176, added corresponding files (testBug6176*) in test/, updated Makefile.am accordingly to generate tests. ============================== 30.11.04 Release CLHEP-2.0.1.2 ============================== ============================== 27.10.04 Release CLHEP-2.0.1.1 ============================== Fri Sep 24 2004 Lynn Garren * use AM_CXXFLAGS * require autoconf 2.59, automake 1.9.1, and libtool 1.9b * Matrix: remove unnecessary copy and disable allocator Tue Aug 31 2004 Lynn Garren * change Solaris CC compile flags from "-O -mt" to "-O" * libtools 1.9b or later is required for Solaris CC ============================== 23.07.04 Release CLHEP-2.0.1.0 ============================== ============================== 11.05.04 Release CLHEP-2.0.0.2 ============================== ============================== 11.05.04 Release CLHEP-1.9.0.2 ============================== ============================== 21.04.04 Release CLHEP-2.0.0.1 ============================== ============================== 24.10.03 Release CLHEP-2.0.0.0 ============================== ============================== 23.10.03 Release CLHEP-1.9.0.0 ============================== Tue Aug 27 10:11:14 2002 Mark Fischler * Matrix/Matrix.cc: Fix a BUG that was in trace from time immemorial! Trace used to return the sum of the elements in the first column, rather than the sum of the diagonal elements. Warning: This repair may change the behavior of some programs. I claim in those cases, the change is a correction. ============================== 01.06.02 Release CLHEP-1.8.0.0 ============================== ========================================= 25.04.02 revised StdHep uses HepMC ========================================= ========================================= 08.03.02 HepMC has become a part of CLHEP ========================================= ========================================== 09.11.01 HepPDT has become a part of CLHEP ========================================== Mon Aug 13 11:21:31 2001 Evgueni Tcherniaev * Matrix/GenMatrix.cc: Added #include to provide declaration of memset(). * Matrix/Matrix.cc: All "return invertHaywood...(ierr);" statements have been subdivided in two lines: invertHaywood...(ierr); return; to avoid problems on DEC/cxx. * Matrix/DiagMatrix.h,SymMatrix.h,Vector.h: Removed "explicit" for constructors with two parameters to avoid problems on HP/aCC. * Geometry/BasicVector3D.h: Corrected operator>> Mon Jul 30 18:31:38 2001 Evgueni Tcherniaev * Matrix/Makefile.in: Added MatrixEqRotation.cc, MatrixInvert.cc, SymMatrixInvert.cc. Mon Jul 30 11:19:43 2001 Mark Fischler * Matrix/MatrixInvert.cc,SymMatrixInvert.cc (Added): These files contain invertHaywood 4, 5, and 6 and invertChoelsky 4, 5, 6. Fri Jul 27 2001 Mark Fischler * Matrix/SymMatrix.h,SymMatrix.cc,Matrix.h,Matrix.cc: * Matrix/SymMatrixInvert.cc,MatrixINvert.cc (Added): Implemented speed-improved inversion for 4x4, 5x5 and 6x6 matrices. Inserted the Haywood-style implemtation of inversion for 4x4, 5x5, and 6x6 matrices. The speed increase is consdierable for some cases, and a bit less in others. In particular, 5x5 symmetric positive definite matrices go quite fast now, and these are importat for tracking. * Matrix/GenMatrix.cc,GenMatrix.icc: Zero the elements in the case of pre-allocated storage. When constructing a matrix small enough to use pre-allocated array, still zero the array data. Lack of this was causing CDF code to crash. * Matrix/Vector.h,Matrix.h: Made ctor from int explicit. ============================== 15.06.01 Release CLHEP-1.7.0.0 ============================== ========================================================================== 18.01.01 ZOOM PhysicsVectors Capabilities have become part of CLHEP/Vector ========================================================================== ====================================================================== 24.10.00 Generic Functions by Joe Boudreau have become a part of CLHEP ====================================================================== ============================== 20.10.00 Release CLHEP-1.6.0.0 ============================== ============================================================================== 12.10.00 Expression Evaluator by Evgueni Tcherniaev has become a part of CLHEP Alist, String and Combination have been disabled ============================================================================== Tue Aug 22 11:33:33 2000 Mark Fischler * Matrix/GenMatrix.cc: Correction to operator==, to use indices 1-3 rather than 0-2. ============================== 08.05.00 Release CLHEP-1.5.0.0 ============================== ============================================================ 24.04.00 StdHepC++ by Lynn Garren has become a part of CLHEP ============================================================ Fri Jul 2 19:02:10 1999 Mark Fischler * Matrix/Vector.h: class HepSymMatrix; class HepDiagMatrix; needed to be forward-declared in Vector.h so that some rather strict compilers would not issue a message. ============================== 20.04.99 Release CLHEP-1.4.0.0 ============================== Thu Feb 4 11:38:32 1999 Evgueni Tcherniaev * test/testMatrix.out.save: Update: the initial random sequence is now different Wed Jan 13 09:59:26 1999 Evgueni Tcherniaev * Matrix/SymMatrix.cc,test/testInversion.cc: Removed declaration of unused variables Wed Jan 6 17:34:18 1999 Evgueni Tcherniaev * Matrix/SymMatrix.cc,SymMatrix.h: New invert() based on "Bunch-Kaufman" algorithm. * test/Makefile.in: * test/testInversion.cc,testInversion.out.save (Added): Added test for new inversion algorithm. Fri Dec 18 11:00:23 1998 Evgueni Tcherniaev * Matrix/Matrix.cc,Matrix.h,SymMatrix.cc,Vector.cc: Changed dfact() and dfinv() to dfact_matrix() and dfinv_matrix() to avoid conflicts with correspondent CERNLIB symbols. * Matrix/GenMatrix.cc,GenMatrix.h: Added operator== * Matrix/GenMatrix.icc: Added implementations of operator[] for GenMatrix_row and GenMatrix_row_const. Commented-out (temporary solution) pile-up mechanism in delete_m() and new_m() since responsible of huge mwmory leaks. * Matrix/Matrix.cc: Fixed bug in dfact_matrix() and introduced "epsilon" constant. * Matrix/Pile.h: Moved private data on bottom and destructor on top: trick needed to fix a bug in VxWorks which requires destructors of template classes to be declared at the begining. ========================================================================= 16.12.98 Started: merging with BaBar version of CLHEP provided by G.Cosmo ========================================================================= Fri Dec 11 11:58:09 1998 Evgueni Tcherniaev * config/CLHEP.h: * Matrix/Matrix.cc,Matrix.h,Vector.cc,Vector.h: * tests/testMatrix.cc: Introduced HEP_USE_VECTOR_MODULE flag to facilitate disabling dependence between the Matrix and Vector modules * Utilities/CLHEP.h: Added config/TemplateFuntions.h by request of G.Cosmo Mon Sep 28 09:06:56 1998 Evgueni Tcherniaev * configure.in: Some modifications for a case NT & g++ * Matrix/DiagMatrix.icc: Bug fix: ncol has been changed to nrow by request of Nobu Katayama ========================== 28.07.98 Release CLHEP-1.3 ========================== Fri Jul 17 09:08:52 1998 Evgueni Tcherniaev * Matrix/DiagMatrix.cc: Bug fix in operator+= and operator-= Fri Jul 3 15:44:38 1998 Evgueni Tcherniaev * Matrix/DiagMatrix.cc: Added ierr = 0; in void HepDiagMatrix::invert(). Thanks to Andre.Holzner@cern.ch Thu Feb 19 10:19:45 1998 Evgueni Tcherniaev * Matrix/Matrix.cc: Bug fix in dfact() provided by Nobu Katayama. The bug affected calculation of determinant. Tue Feb 10 17:44:35 1998 Evgueni Tcherniaev * Matrix/Matrix.cc: Changed HepDouble *mm(m); -> HepDouble *mm; mm = m; to avoid problems on Windows NT ========================== 05.02.98 Release CLHEP-1.2 ========================== Fri Jan 30 17:10:59 1998 Evgueni Tcherniaev * Matrix/: * DiagMatrix.cc,DiagMatrix.h,DiagMatrix.icc,GenMatrix.cc: * GenMatrix.h,GenMatrix.icc,Matrix.cc,Matrix.h,Matrix.icc: * MatrixLinear.cc,Pile.h,SymMatrix.cc,SymMatrix.h,SymMatrix.icc: * Vector.cc,Vector.h,Vector.icc: Removed PersistentIO stuff. Changes in comments * Matrix/: * DiagMatrix.cc,DiagMatrix.h,GenMatrix.cc,GenMatrix.h,Matrix.cc: * Matrix.h,SymMatrix.cc,SymMatrix.h,Vector.cc,Vector.h: #include isolated in GenMatrix.h and Pile.h Wed Jan 28 09:55:53 1998 Evgueni Tcherniaev * Matrix/Matrix.cc: Bug fix in HepMatrix::operator=(const HepRotation &m2) Fri Jan 23 16:24:24 1998 Evgueni Tcherniaev * Geometry/Plane3D.h: * Matrix/DiagMatrix.h,Matrix.h,SymMatrix.h,Vector.h: * String/CmdLine.h: * Vector/LorentzVector.h,ThreeVector.h: Declaration class ostream; changed to #include to avoid problems with KCC ======================================================== 08.12.97 Release CLHEP-1.1: Geant4 has migrated to CLHEP ======================================================== Fri Mar 14 19:24:41 1997 Nobu KATAYAMA - Added Matrix = Rotation Fri Feb 7 12:31:52 1997 Leif Lonnblad * Matrix/Vector.cc: Wraped the #include of PIStream.h and POStream.h inside a #ifndef HEP_NO_PERSISTENT_STREAMS. * Matrix/SymMatrix.cc: Wraped the #include of PIStream.h and POStream.h inside a #ifndef HEP_NO_PERSISTENT_STREAMS. * Matrix/Matrix.cc: Wraped the #include of PIStream.h and POStream.h inside a #ifndef HEP_NO_PERSISTENT_STREAMS. * Matrix/DiagMatrix.icc (fast): Changed the 'static const double zero = 0.0' statement to 'static double zero = 0.0' to avoid problems on some compilers. * Matrix/DiagMatrix.cc: Wraped the #include of PIStream.h and POStream.h inside a #ifndef HEP_NO_PERSISTENT_STREAMS. clhep-2.1.4.1.orig/Matrix/CMakeLists.txt0000644000175000017500000000053111607417635016412 0ustar olesoles# main Matrix cmake instructions # automake/autoconf variables set( PACKAGE Matrix ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDISABLE_ALLOC") # define dependency list that will be used in several places list(APPEND ${PACKAGE}_DEPS Random Vector ) clhep_package_config() add_subdirectory(Matrix) add_subdirectory(src) add_subdirectory(test) clhep-2.1.4.1.orig/Matrix/autotools/0000755000175000017500000000000012242515220015665 5ustar olesolesclhep-2.1.4.1.orig/Matrix/autotools/.cvsignore0000755000175000017500000000010107705060311017664 0ustar olesolesconfig.sub config.guess depcomp install-sh missing mkinstalldirs clhep-2.1.4.1.orig/Matrix/autotools/ltmain.sh0000755000175000017500000057547210233764254017547 0ustar olesoles# Generated from ltmain.in; do not edit by hand # ltmain.sh (GNU libtool) 1.9b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: powerpc-apple-darwin7.5.0 # shell: $SHELL # compiler: $LTCC # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 1.9b # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST elif test -n "${BASH_VERSION+set}${KSH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh dirname="s,/[^/]*$,," basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: PROGRAM=ltmain.sh progname=`echo "$progpath" | $SED "$basename"` # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *) progdir=`echo "$progpath" | $SED "$dirname"` progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; esac # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.9b TIMESTAMP="" package_revision=1.1571 # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $echo $progname${mode+: }$mode: warning: ${1+"$@"} 1>&2 } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } # func_version # Echo version message to standard output and exit. func_version () { $SED '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# //; s/^# *$//; s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED '/^# Usage:/,/# -h/ { s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" echo echo "run \`$progname --help | more' for full usage" exit $EXIT_SUCCESS } # func_help # Echo long help message to standard output and exit. func_help () { $SED '/^# Usage:/,/# Report bugs to/ { s/^# //; s/^# *$//; s:\$progname:'$progname':; s:\$SHELL:'"$SHELL"':; s:\$LTCC:'"$LTCC"':; s:\$LD:'"$LD"':; s/\$with_gnu_ld/'"$with_gnu_ld"'/; s/\$automake_version/'"`automake --version 2>/dev/null |$SED 1q`"'/; s/\$autoconf_version/'"`autoconf --version 2>/dev/null |$SED 1q`"'/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $EXIT_SUCCESS } # func_features # Display the features supported by this script. func_features () { $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable "`\"foo\"`", so we have to do # it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $echo \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $echo $echo "Try \`$progname --help' for more information about other modes." exit $EXIT_SUCCESS } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # sed scripts: my_sed_single_opt='1s/^\(..\).*$/\1/;q' my_sed_single_rest='1s/^..\(.*\)$/\1/;q' my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' exit_cmd=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set -- --mode clean ${1+"$@"} ;; compile|compil|compi|comp|com|co|c) shift; set -- --mode compile ${1+"$@"} ;; execute|execut|execu|exec|exe|ex|e) shift; set -- --mode execute ${1+"$@"} ;; finish|finis|fini|fin|fi|f) shift; set -- --mode finish ${1+"$@"} ;; install|instal|insta|inst|ins|in|i) shift; set -- --mode install ${1+"$@"} ;; link|lin|li|l) shift; set -- --mode link ${1+"$@"} ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set -- --mode uninstall ${1+"$@"} ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" set -x ;; --dlopen) test $# -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" ;; --dry-run | -n) run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test $# -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" show=: ;; --tag) test $# -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: --dlopen=*|--mode=*|--tag=*) arg=`echo "$opt" | $SED "$my_sed_long_arg"` opt=`echo "$opt" | $SED "$my_sed_long_opt"` set -- "$opt" "$arg" ${1+"$@"} ;; # Separate optargs to short options: # -x*|-y*) # arg=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "$arg" ${1+"$@"} # ;; # Separate non-argument short options: # -z*|-z*|-y*) # rest=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "-$rest" ${1+"$@"} # ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`echo "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$my_dlsyms" test -z "$run" && $echo > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do $show "extracting global C symbols from \`$progfile'" $run eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for dlprefile in $dlprefiles; do $show "extracting global C symbols from \`$dlprefile'" name=`$echo "$dlprefile" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ const struct { const char *originator; const struct { const char *name; void *address; } symbols[]; } lt_${my_prefix}_LTX_preloaded_symbols = {\ \"$my_originator\", { " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" $echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} } }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" status=$? if test "$status" -ne 0 && test ! -d "$my_xdir"; then exit $status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename $darwin_archive` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" # Remove the table of contents from the thin files. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" $AR -xo "${darwin_base_archive}" rm "${darwin_base_archive}" cd "$darwin_curdir" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist rm -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir (cd $my_xdir && $AR x $my_xabs) || exit $? fi # $darwin_arches fi # $run ;; *) # We will extract separately just the conflicting names and we will # no longer touch any unique names. It is faster to leave these # extract automatically by $AR in one run. $show "(cd $my_xdir && $AR x $my_xabs)" $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; renaming object files" func_warning "to ensure that they will not overwrite" $AR t "$my_xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_mode_compile arg... func_mode_compile () { # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1 || \ func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi } # func_mode_finish arg... func_mode_finish () { libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit $EXIT_SUCCESS } # func_mode_install arg... func_mode_install () { # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files test "$#" -gt 2 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. (${SED} -e '2q' $file | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1 || \ func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" $show "$relink_command" $run eval "$relink_command" || \ func_fatal_error "error: relink \`$file' with the above command before installing it" fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | $GREP "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. test -z "$notinst_deplibs" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask func_error "error: cannot create temporary directory \`$tmpdir'" continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" ${rm}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } # func_mode_link arg... func_mode_link () { case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static # See comment for -static flag below, for more details. compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" || \ func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else func_fatal_error "link input file \`$save_arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) # The effects of -all-static are defined in a previous loop. continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs $inherited_linker_flags" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *[\\/]*.la) . $lib ;; *.la) . ./$lib ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`echo "$deplib" |$SED "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$inherited_linker_flags " in *" $deplib "*) ;; * ) inherited_linker_flags="$inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $lib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not use here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib'" fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then : else func_fatal_error "\`$lib' is not a valid libtool archive" fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac case $host in *-*-darwin*) # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then inherited_linker_flags=`$echo "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` fi dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP "bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $echo "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "*** And there doesn't seem to be a static archive available" $echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs $inherited_linker_flags; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" eval darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//' | xargs` compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for archives" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath test "$#" -gt 2 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" test -n "$8" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "AGE \`$age' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | ${SED} 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null | ${SED} 10q | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` inherited_linker_flags=`$echo "X $inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$echo "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`echo "$output" | $SED $basename` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnk $echo "creating GNU ld script: $output" $echo 'INPUT (' > $output for obj in $save_libobjs do $echo \""$obj"\" >> $output done $echo ')' >> $output else $echo "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for objects" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; struct stat st; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$dlsymsobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; overriding AR_FLAGS to 'cq'" func_warning "to ensure that POSIX-compatible ar will work" AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS } # func_mode_uninstall arg... func_mode_uninstall () { rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done test -z "$rm" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 || (test -h "$file") >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status } ## ----------- ## ## Main. ## ## ----------- ## { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." case $mode in compile) func_mode_compile ${1+"$@"} ;; execute) func_mode_execute ${1+"$@"} ;; finish) func_mode_finish ${1+"$@"} ;; install) func_mode_install ${1+"$@"} ;; link|relink) func_mode_link ${1+"$@"} ;; uninstall|clean) func_mode_uninstall ${1+"$@"} ;; "") help="$generic_help" func_fatal_help "you must specify a MODE" ;; esac test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi } exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: clhep-2.1.4.1.orig/Matrix/src/0000755000175000017500000000000012242515220014423 5ustar olesolesclhep-2.1.4.1.orig/Matrix/src/SymMatrix.cc0000755000175000017500000010533412074100307016677 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // #ifdef GNUPRAGMA #pragma implementation #endif #include #include // for DBL_EPSILON #include "CLHEP/Matrix/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Matrix/SymMatrix.h" #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/DiagMatrix.h" #include "CLHEP/Matrix/Vector.h" #ifdef HEP_DEBUG_INLINE #include "CLHEP/Matrix/SymMatrix.icc" #endif namespace CLHEP { // Simple operation for all elements #define SIMPLE_UOP(OPER) \ HepMatrix::mIter a=m.begin(); \ HepMatrix::mIter e=m.begin()+num_size(); \ for(;a num_row()) error("HepSymMatrix::sub: Index out of range"); HepMatrix::mIter a = mret.m.begin(); HepMatrix::mcIter b1 = m.begin() + (min_row+2)*(min_row-1)/2; int rowsize=mret.num_row(); for(int irow=1; irow<=rowsize; irow++) { HepMatrix::mcIter b = b1; for(int icol=0; icol num_row()) error("HepSymMatrix::sub: Index out of range"); HepMatrix::mIter a = mret.m.begin(); HepMatrix::mIter b1 = m.begin() + (min_row+2)*(min_row-1)/2; int rowsize=mret.num_row(); for(int irow=1; irow<=rowsize; irow++) { HepMatrix::mIter b = b1; for(int icol=0; icol num_row() ) error("HepSymMatrix::sub: Index out of range"); HepMatrix::mcIter a = hm1.m.begin(); HepMatrix::mIter b1 = m.begin() + (row+2)*(row-1)/2; int rowsize=hm1.num_row(); for(int irow=1; irow<=rowsize; ++irow) { HepMatrix::mIter b = b1; for(int icol=0; icolhm2.num_col() ){ mit2+=hm2.num_col(); } } if(step= k for(int j=0; j!=nrow; ++j) { for(int k=0; k<=j; ++k) { m[j*ncol+k] += *sjk; // make sure this is not a diagonal element if(k!=j) m[k*nrow+j] += *sjk; ++sjk; } } return (*this); } HepSymMatrix & HepSymMatrix::operator+=(const HepSymMatrix &hm2) { CHK_DIM_2(num_row(),hm2.num_row(),num_col(),hm2.num_col(),+=); SIMPLE_BOP(+=) return (*this); } HepMatrix & HepMatrix::operator-=(const HepSymMatrix &hm2) { CHK_DIM_2(num_row(),hm2.num_row(),num_col(),hm2.num_col(),-=); HepMatrix::mcIter sjk = hm2.m.begin(); // j >= k for(int j=0; j!=nrow; ++j) { for(int k=0; k<=j; ++k) { m[j*ncol+k] -= *sjk; // make sure this is not a diagonal element if(k!=j) m[k*nrow+j] -= *sjk; ++sjk; } } return (*this); } HepSymMatrix & HepSymMatrix::operator-=(const HepSymMatrix &hm2) { CHK_DIM_2(num_row(),hm2.num_row(),num_col(),hm2.num_col(),-=); SIMPLE_BOP(-=) return (*this); } HepSymMatrix & HepSymMatrix::operator/=(double t) { SIMPLE_UOP(/=) return (*this); } HepSymMatrix & HepSymMatrix::operator*=(double t) { SIMPLE_UOP(*=) return (*this); } HepMatrix & HepMatrix::operator=(const HepSymMatrix &hm1) { // define size, rows, and columns of *this nrow = ncol = hm1.nrow; if(nrow*ncol != size_) { size_ = nrow*ncol; m.resize(size_); } // begin copy mcIter sjk = hm1.m.begin(); // j >= k for(int j=0; j!=nrow; ++j) { for(int k=0; k<=j; ++k) { m[j*ncol+k] = *sjk; // we could copy the diagonal element twice or check // doing the check may be a tiny bit faster, // so we choose that option for now if(k!=j) m[k*nrow+j] = *sjk; ++sjk; } } return (*this); } HepSymMatrix & HepSymMatrix::operator=(const HepSymMatrix &hm1) { if(hm1.nrow != nrow) { nrow = hm1.nrow; size_ = hm1.size_; m.resize(size_); } m = hm1.m; return (*this); } HepSymMatrix & HepSymMatrix::operator=(const HepDiagMatrix &hm1) { if(hm1.nrow != nrow) { nrow = hm1.nrow; size_ = nrow * (nrow+1) / 2; m.resize(size_); } m.assign(size_,0); HepMatrix::mIter mrr = m.begin(); HepMatrix::mcIter mr = hm1.m.begin(); for(int r=1; r<=nrow; r++) { *mrr = *(mr++); if(r= t2) { if (t3 >= t1) { temp = *(m.begin()+3); det = c23*c12-c22*c13; } else { temp = *m.begin(); det = c22*c33-c23*c23; } } else if (t3 >= t2) { temp = *(m.begin()+3); det = c23*c12-c22*c13; } else { temp = *(m.begin()+1); det = c13*c23-c12*c33; } if (det==0) { ifail = 1; return; } { double ds = temp/det; HepMatrix::mIter hmm = m.begin(); *(hmm++) = ds*c11; *(hmm++) = ds*c12; *(hmm++) = ds*c22; *(hmm++) = ds*c13; *(hmm++) = ds*c23; *(hmm) = ds*c33; } } break; case 2: { double det, temp, ds; det = (*m.begin())*(*(m.begin()+2)) - (*(m.begin()+1))*(*(m.begin()+1)); if (det==0) { ifail = 1; return; } ds = 1.0/det; *(m.begin()+1) *= -ds; temp = ds*(*(m.begin()+2)); *(m.begin()+2) = ds*(*m.begin()); *m.begin() = temp; break; } case 1: { if ((*m.begin())==0) { ifail = 1; return; } *m.begin() = 1.0/(*m.begin()); break; } case 5: { invert5(ifail); return; } case 6: { invert6(ifail); return; } case 4: { invert4(ifail); return; } default: { invertBunchKaufman(ifail); return; } } return; // inversion successful } double HepSymMatrix::determinant() const { static const int max_array = 20; // ir must point to an array which is ***1 longer than*** nrow static std::vector ir_vec (max_array+1); if (ir_vec.size() <= static_cast(nrow)) ir_vec.resize(nrow+1); int * ir = &ir_vec[0]; double det; HepMatrix mt(*this); int i = mt.dfact_matrix(det, ir); if(i==0) return det; return 0.0; } double HepSymMatrix::trace() const { double t = 0.0; for (int i=0; i xvec (max_array); static std::vector pivv (max_array); typedef std::vector::iterator pivIter; #else static std::vector > xvec (max_array); static std::vector > pivv (max_array); typedef std::vector >::iterator pivIter; #endif if (xvec.size() < static_cast(nrow)) xvec.resize(nrow); if (pivv.size() < static_cast(nrow)) pivv.resize(nrow); // Note - resize shuld do nothing if the size is already larger than nrow, // but on VC++ there are indications that it does so we check. // Note - the data elements in a vector are guaranteed to be contiguous, // so x[i] and piv[i] are optimally fast. mIter x = xvec.begin(); // x[i] is used as helper storage, needs to have at least size nrow. pivIter piv = pivv.begin(); // piv[i] is used to store details of exchanges double temp1, temp2; HepMatrix::mIter ip, mjj, iq; double lambda, sigma; const double alpha = .6404; // = (1+sqrt(17))/8 const double epsilon = 32*DBL_EPSILON; // whenever a sum of two doubles is below or equal to epsilon // it is set to zero. // this constant could be set to zero but then the algorithm // doesn't neccessarily detect that a matrix is singular for (i = 0; i < nrow; ++i) piv[i] = i+1; ifail = 0; // compute the factorization P*A*P^T = L * D * L^T // L is unit lower triangular, D is direct sum of 1x1 and 2x2 matrices // L and D^-1 are stored in A = *this, P is stored in piv[] for (j=1; j < nrow; j+=is) // main loop over columns { mjj = m.begin() + j*(j-1)/2 + j-1; lambda = 0; // compute lambda = max of A(j+1:n,j) pivrow = j+1; //ip = m.begin() + (j+1)*j/2 + j-1; for (i=j+1; i <= nrow ; ++i) { // calculate ip to avoid going off end of storage array ip = m.begin() + (i-1)*i/2 + j-1; if (fabs(*ip) > lambda) { lambda = fabs(*ip); pivrow = i; } } // for i if (lambda == 0 ) { if (*mjj == 0) { ifail = 1; return; } is=1; *mjj = 1./ *mjj; } else { // lambda == 0 if (fabs(*mjj) >= lambda*alpha) { is=1; pivrow=j; } else { // fabs(*mjj) >= lambda*alpha sigma = 0; // compute sigma = max A(pivrow, j:pivrow-1) ip = m.begin() + pivrow*(pivrow-1)/2+j-1; for (k=j; k < pivrow; k++) { if (fabs(*ip) > sigma) sigma = fabs(*ip); ip++; } // for k if (sigma * fabs(*mjj) >= alpha * lambda * lambda) { is=1; pivrow = j; } else if (fabs(*(m.begin()+pivrow*(pivrow-1)/2+pivrow-1)) >= alpha * sigma) { is=1; } else { is=2; } // if sigma... } // fabs(*mjj) >= lambda*alpha if (pivrow == j) { // no permutation neccessary piv[j-1] = pivrow; if (*mjj == 0) { ifail=1; return; } temp2 = *mjj = 1./ *mjj; // invert D(j,j) // update A(j+1:n, j+1,n) for (i=j+1; i <= nrow; i++) { temp1 = *(m.begin() + i*(i-1)/2 + j-1) * temp2; ip = m.begin()+i*(i-1)/2+j; for (k=j+1; k<=i; k++) { *ip -= temp1 * *(m.begin() + k*(k-1)/2 + j-1); if (fabs(*ip) <= epsilon) *ip=0; ip++; } } // for i // update L //ip = m.begin() + (j+1)*j/2 + j-1; for (i=j+1; i <= nrow; ++i) { // calculate ip to avoid going off end of storage array ip = m.begin() + (i-1)*i/2 + j-1; *ip *= temp2; } } else if (is==1) { // 1x1 pivot piv[j-1] = pivrow; // interchange rows and columns j and pivrow in // submatrix (j:n,j:n) ip = m.begin() + pivrow*(pivrow-1)/2 + j; for (i=j+1; i < pivrow; i++, ip++) { temp1 = *(m.begin() + i*(i-1)/2 + j-1); *(m.begin() + i*(i-1)/2 + j-1)= *ip; *ip = temp1; } // for i temp1 = *mjj; *mjj = *(m.begin()+pivrow*(pivrow-1)/2+pivrow-1); *(m.begin()+pivrow*(pivrow-1)/2+pivrow-1) = temp1; ip = m.begin() + (pivrow+1)*pivrow/2 + j-1; iq = ip + pivrow-j; for (i = pivrow+1; i <= nrow; ip += i, iq += i++) { temp1 = *iq; *iq = *ip; *ip = temp1; } // for i if (*mjj == 0) { ifail = 1; return; } // *mjj == 0 temp2 = *mjj = 1./ *mjj; // invert D(j,j) // update A(j+1:n, j+1:n) for (i = j+1; i <= nrow; i++) { temp1 = *(m.begin() + i*(i-1)/2 + j-1) * temp2; ip = m.begin()+i*(i-1)/2+j; for (k=j+1; k<=i; k++) { *ip -= temp1 * *(m.begin() + k*(k-1)/2 + j-1); if (fabs(*ip) <= epsilon) *ip=0; ip++; } // for k } // for i // update L //ip = m.begin() + (j+1)*j/2 + j-1; for (i=j+1; i <= nrow; ++i) { // calculate ip to avoid going off end of storage array ip = m.begin() + (i-1)*i/2 + j-1; *ip *= temp2; } } else { // is=2, ie use a 2x2 pivot piv[j-1] = -pivrow; piv[j] = 0; // that means this is the second row of a 2x2 pivot if (j+1 != pivrow) { // interchange rows and columns j+1 and pivrow in // submatrix (j:n,j:n) ip = m.begin() + pivrow*(pivrow-1)/2 + j+1; for (i=j+2; i < pivrow; i++, ip++) { temp1 = *(m.begin() + i*(i-1)/2 + j); *(m.begin() + i*(i-1)/2 + j) = *ip; *ip = temp1; } // for i temp1 = *(mjj + j + 1); *(mjj + j + 1) = *(m.begin() + pivrow*(pivrow-1)/2 + pivrow-1); *(m.begin() + pivrow*(pivrow-1)/2 + pivrow-1) = temp1; temp1 = *(mjj + j); *(mjj + j) = *(m.begin() + pivrow*(pivrow-1)/2 + j-1); *(m.begin() + pivrow*(pivrow-1)/2 + j-1) = temp1; ip = m.begin() + (pivrow+1)*pivrow/2 + j; iq = ip + pivrow-(j+1); for (i = pivrow+1; i <= nrow; ip += i, iq += i++) { temp1 = *iq; *iq = *ip; *ip = temp1; } // for i } // j+1 != pivrow // invert D(j:j+1,j:j+1) temp2 = *mjj * *(mjj + j + 1) - *(mjj + j) * *(mjj + j); if (temp2 == 0) { std::cerr << "SymMatrix::bunch_invert: error in pivot choice" << std::endl; } temp2 = 1. / temp2; // this quotient is guaranteed to exist by the choice // of the pivot temp1 = *mjj; *mjj = *(mjj + j + 1) * temp2; *(mjj + j + 1) = temp1 * temp2; *(mjj + j) = - *(mjj + j) * temp2; if (j < nrow-1) { // otherwise do nothing // update A(j+2:n, j+2:n) for (i=j+2; i <= nrow ; i++) { ip = m.begin() + i*(i-1)/2 + j-1; temp1 = *ip * *mjj + *(ip + 1) * *(mjj + j); if (fabs(temp1 ) <= epsilon) temp1 = 0; temp2 = *ip * *(mjj + j) + *(ip + 1) * *(mjj + j + 1); if (fabs(temp2 ) <= epsilon) temp2 = 0; for (k = j+2; k <= i ; k++) { ip = m.begin() + i*(i-1)/2 + k-1; iq = m.begin() + k*(k-1)/2 + j-1; *ip -= temp1 * *iq + temp2 * *(iq+1); if (fabs(*ip) <= epsilon) *ip = 0; } // for k } // for i // update L for (i=j+2; i <= nrow ; i++) { ip = m.begin() + i*(i-1)/2 + j-1; temp1 = *ip * *mjj + *(ip+1) * *(mjj + j); if (fabs(temp1) <= epsilon) temp1 = 0; *(ip+1) = *ip * *(mjj + j) + *(ip+1) * *(mjj + j + 1); if (fabs(*(ip+1)) <= epsilon) *(ip+1) = 0; *ip = temp1; } // for k } // j < nrow-1 } } } // end of main loop over columns if (j == nrow) { // the the last pivot is 1x1 mjj = m.begin() + j*(j-1)/2 + j-1; if (*mjj == 0) { ifail = 1; return; } else { *mjj = 1. / *mjj; } } // end of last pivot code // computing the inverse from the factorization for (j = nrow ; j >= 1 ; j -= is) // loop over columns { mjj = m.begin() + j*(j-1)/2 + j-1; if (piv[j-1] > 0) { // 1x1 pivot, compute column j of inverse is = 1; if (j < nrow) { //ip = m.begin() + (j+1)*j/2 + j-1; //for (i=0; i < nrow-j; ip += 1+j+i++) x[i] = *ip; ip = m.begin() + (j+1)*j/2 - 1; for (i=0; i < nrow-j; ++i) { ip += i + j; x[i] = *ip; } for (i=j+1; i<=nrow ; i++) { temp2=0; ip = m.begin() + i*(i-1)/2 + j; for (k=0; k <= i-j-1; k++) temp2 += *ip++ * x[k]; // avoid setting ip outside the bounds of the storage array ip -= 1; // using the value of k from the previous loop for ( ; k < nrow-j; ++k) { ip += j+k; temp2 += *ip * x[k]; } *(m.begin()+ i*(i-1)/2 + j-1) = -temp2; } // for i temp2 = 0; //ip = m.begin() + (j+1)*j/2 + j-1; //for (k=0; k < nrow-j; ip += 1+j+k++) //temp2 += x[k] * *ip; ip = m.begin() + (j+1)*j/2 - 1; for (k=0; k < nrow-j; ++k) { ip += j+k; temp2 += x[k] * *ip; } *mjj -= temp2; } // j < nrow } else { //2x2 pivot, compute columns j and j-1 of the inverse if (piv[j-1] != 0) std::cerr << "error in piv" << piv[j-1] << std::endl; is=2; if (j < nrow) { //ip = m.begin() + (j+1)*j/2 + j-1; //for (i=0; i < nrow-j; ip += 1+j+i++) x[i] = *ip; ip = m.begin() + (j+1)*j/2 - 1; for (i=0; i < nrow-j; ++i) { ip += i + j; x[i] = *ip; } for (i=j+1; i<=nrow ; i++) { temp2 = 0; ip = m.begin() + i*(i-1)/2 + j; for (k=0; k <= i-j-1; k++) temp2 += *ip++ * x[k]; for (ip += i-1; k < nrow-j; ip += 1+j+k++) temp2 += *ip * x[k]; *(m.begin()+ i*(i-1)/2 + j-1) = -temp2; } // for i temp2 = 0; //ip = m.begin() + (j+1)*j/2 + j-1; //for (k=0; k < nrow-j; ip += 1+j+k++) temp2 += x[k] * *ip; ip = m.begin() + (j+1)*j/2 - 1; for (k=0; k < nrow-j; ++k) { ip += k + j; temp2 += x[k] * *ip; } *mjj -= temp2; temp2 = 0; //ip = m.begin() + (j+1)*j/2 + j-2; //for (i=j+1; i <= nrow; ip += i++) temp2 += *ip * *(ip+1); ip = m.begin() + (j+1)*j/2 - 2; for (i=j+1; i <= nrow; ++i) { ip += i - 1; temp2 += *ip * *(ip+1); } *(mjj-1) -= temp2; //ip = m.begin() + (j+1)*j/2 + j-2; //for (i=0; i < nrow-j; ip += 1+j+i++) x[i] = *ip; ip = m.begin() + (j+1)*j/2 - 2; for (i=0; i < nrow-j; ++i) { ip += i + j; x[i] = *ip; } for (i=j+1; i <= nrow ; i++) { temp2 = 0; ip = m.begin() + i*(i-1)/2 + j; for (k=0; k <= i-j-1; k++) temp2 += *ip++ * x[k]; for (ip += i-1; k < nrow-j; ip += 1+j+k++) temp2 += *ip * x[k]; *(m.begin()+ i*(i-1)/2 + j-2)= -temp2; } // for i temp2 = 0; //ip = m.begin() + (j+1)*j/2 + j-2; //for (k=0; k < nrow-j; ip += 1+j+k++) // temp2 += x[k] * *ip; ip = m.begin() + (j+1)*j/2 - 2; for (k=0; k < nrow-j; ++k) { ip += k + j; temp2 += x[k] * *ip; } *(mjj-j) -= temp2; } // j < nrow } // else piv[j-1] > 0 // interchange rows and columns j and piv[j-1] // or rows and columns j and -piv[j-2] pivrow = (piv[j-1]==0)? -piv[j-2] : piv[j-1]; ip = m.begin() + pivrow*(pivrow-1)/2 + j; for (i=j+1;i < pivrow; i++, ip++) { temp1 = *(m.begin() + i*(i-1)/2 + j-1); *(m.begin() + i*(i-1)/2 + j-1) = *ip; *ip = temp1; } // for i temp1 = *mjj; *mjj = *(m.begin() + pivrow*(pivrow-1)/2 + pivrow-1); *(m.begin() + pivrow*(pivrow-1)/2 + pivrow-1) = temp1; if (is==2) { temp1 = *(mjj-1); *(mjj-1) = *( m.begin() + pivrow*(pivrow-1)/2 + j-2); *( m.begin() + pivrow*(pivrow-1)/2 + j-2) = temp1; } // is==2 // problem right here if( pivrow < nrow ) { ip = m.begin() + (pivrow+1)*pivrow/2 + j-1; // &A(i,j) // adding parenthesis for VC++ iq = ip + (pivrow-j); for (i = pivrow+1; i <= nrow; i++) { temp1 = *iq; *iq = *ip; *ip = temp1; if( i < nrow ) { ip += i; iq += i; } } // for i } // pivrow < nrow } // end of loop over columns (in computing inverse from factorization) return; // inversion successful } } // namespace CLHEP clhep-2.1.4.1.orig/Matrix/src/MatrixLinear.cc0000755000175000017500000007135612074100307017347 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the definition of special linear algebra functions for the // HepMatrix class. // // Many of these algorithms are taken from Golub and Van Loan. // #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/Vector.h" #include "CLHEP/Matrix/SymMatrix.h" namespace CLHEP { static inline int sign(double x) { return (x>0 ? 1: -1);} /* ----------------------------------------------------------------------- The following contains stuff to try to do basic things with matrixes. The functions are: back_solve - Solves R*x = b where R is upper triangular. Also has a variation that solves a number of equations of this form in one step, where b is a matrix with each column a different vector. See also solve. col_givens - Does a column Givens update. col_house - Does a column Householder update. condition - Find the conditon number of a symmetric matrix. diag_step - Implicit symmetric QR step with Wilkinson Shift diagonalize - Diagonalize a symmetric matrix. givens - algorithm 5.1.5 in Golub and Van Loan house - Returns a Householder vector to zero elements. house_with_update - Finds and does Householder reflection on matrix. qr_inverse - Finds the inverse of a matrix. Note, often what you really want is solve or backsolve, they can be much quicker than inverse in many calculations. min_line_dist - Takes a set of lines and returns the point nearest to all the lines in the least squares sense. qr_decomp - Does a QR decomposition of a matrix. row_givens - Does a row Givens update. row_house - Does a row Householder update. qr_solve - Works like backsolve, except matrix does not need to be upper triangular. For nonsquare matrix, it solves in the least square sense. tridiagonal - Does a Householder tridiagonalization of a symmetric matrix. ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- back_solve Version: 1.00 Date Last Changed: 2/9/93 This solves the system R*x=b where R is upper triangular. Since b is most likely not interesting after this step, x is returned in b. This is algorithm 3.1.2 in Golub & Van Loan ----------------------------------------------------------------------- */ void back_solve(const HepMatrix &R, HepVector *b) { (*b)(b->num_row()) /= R(b->num_row(),b->num_row()); int n = R.num_col(); int nb = b->num_row(); HepMatrix::mIter br = b->m.begin() + b->num_row() - 2; HepMatrix::mcIter Rrr = R.m.begin() + (nb-2) * (n+1); for (int r=b->num_row()-1;r>=1;--r) { HepMatrix::mIter bc = br+1; HepMatrix::mcIter Rrc = Rrr+1; for (int c=r+1;c<=b->num_row();c++) { (*br)-=(*(Rrc++))*(*(bc++)); } (*br)/=(*Rrr); if(r>1) { br--; Rrr -= n+1; } } } /* ----------------------------------------------------------------------- Variation that solves a set of equations R*x=b in one step, where b is a Matrix with columns each a different vector. Solution is again returned in b. ----------------------------------------------------------------------- */ void back_solve(const HepMatrix &R, HepMatrix *b) { int n = R.num_col(); int nb = b->num_row(); int nc = b->num_col(); HepMatrix::mIter bbi = b->m.begin() + (nb - 2) * nc; for (int i=1;i<=b->num_col();i++) { (*b)(b->num_row(),i) /= R(b->num_row(),b->num_row()); HepMatrix::mcIter Rrr = R.m.begin() + (nb-2) * (n+1); HepMatrix::mIter bri = bbi; for (int r=b->num_row()-1;r>=1;--r) { HepMatrix::mIter bci = bri + nc; HepMatrix::mcIter Rrc = Rrr+1; for (int c=r+1;c<=b->num_row();c++) { (*bri)-= (*(Rrc++)) * (*bci); if(cnum_row()) bci += nc; } (*bri)/= (*Rrr); if(r>1) { Rrr -= (n+1); bri -= nc; } } bbi++; } } /* ----------------------------------------------------------------------- col_givens Version: 1.00 Date Last Changed: 1/28/93 This does the same thing as row_givens, except it works for columns. It replaces A with A*G. ----------------------------------------------------------------------- */ void col_givens(HepMatrix *A, double c,double ds, int k1, int k2, int row_min, int row_max) { if (row_max<=0) row_max = A->num_row(); int n = A->num_col(); HepMatrix::mIter Ajk1 = A->m.begin() + (row_min - 1) * n + k1 - 1; HepMatrix::mIter Ajk2 = A->m.begin() + (row_min - 1) * n + k2 - 1; for (int j=row_min;j<=row_max;j++) { double tau1=(*Ajk1); double tau2=(*Ajk2); (*Ajk1)=c*tau1-ds*tau2;(*Ajk2)=ds*tau1+c*tau2; if(jnum_col()-col+1,0); /* not tested */ HepMatrix::mIter wptr = w.m.begin(); int n = a->num_col(); int nv = v.num_col(); HepMatrix::mIter acrb = a->m.begin() + (col-1) * n + (row-1); int c; for (c=col;c<=a->num_col();c++) { HepMatrix::mcIter vp = v.m.begin() + (row_start-1) * nv + (col_start-1); HepMatrix::mcIter acr = acrb; for (int r=row;r<=a->num_row();r++) { (*wptr)+=(*(acr++))*(*vp); vp += nv; } wptr++; if(cnum_col()) acrb += n; } w*=beta; // Fast way of calculating A.sub=A.sub+w*v.T() HepMatrix::mIter arcb = a->m.begin() + (row-1) * n + col-1; wptr = w.m.begin(); for (int r=row; r<=a->num_row();r++) { HepMatrix::mIter arc = arcb; HepMatrix::mcIter vp = v.m.begin() + (row_start-1) * nv + col_start; for (c=col;c<=a->num_col();c++) { (*(arc++))+=(*vp)*(*wptr); vp += nv; } wptr++; if(rnum_row()) arcb += n; } } /* ----------------------------------------------------------------------- condition Version: 1.00 Date Last Changed: 1/28/93 This finds the condition number of SymMatrix. ----------------------------------------------------------------------- */ double condition(const HepSymMatrix &hm) { HepSymMatrix mcopy=hm; diagonalize(&mcopy); double max,min; max=min=fabs(mcopy(1,1)); int n = mcopy.num_row(); HepMatrix::mIter mii = mcopy.m.begin() + 2; for (int i=2; i<=n; i++) { if (maxfabs(*mii)) min=fabs(*mii); if(ifast(end-1,end-1)-t->fast(end,end))/2; double mu=t->fast(end,end)-t->fast(end,end-1)*t->fast(end,end-1)/ (d+sign(d)*sqrt(d*d+ t->fast(end,end-1)*t->fast(end,end-1))); double x=t->fast(begin,begin)-mu; double z=t->fast(begin+1,begin); HepMatrix::mIter tkk = t->m.begin() + (begin+2)*(begin-1)/2; HepMatrix::mIter tkp1k = tkk + begin; HepMatrix::mIter tkp2k = tkk + 2 * begin + 1; for (int k=begin;k<=end-1;k++) { double c,ds; givens(x,z,&c,&ds); // This is the result of G.T*t*G, making use of the special structure // of t and G. Note that since t is symmetric, only the lower half // needs to be updated. Equations were gotten from maple. if (k!=begin) { *(tkk-1)= *(tkk-1)*c-(*(tkp1k-1))*ds; *(tkp1k-1)=0; } double ap=(*tkk); double bp=(*tkp1k); double aq=(*tkp1k+1); (*tkk)=ap*c*c-2*c*bp*ds+aq*ds*ds; (*tkp1k)=c*ap*ds+bp*c*c-bp*ds*ds-ds*aq*c; (*(tkp1k+1))=ap*ds*ds+2*c*bp*ds+aq*c*c; if (kfast(end-1,end-1)-t->fast(end,end))/2; double mu=t->fast(end,end)-t->fast(end,end-1)*t->fast(end,end-1)/ (d+sign(d)*sqrt(d*d+ t->fast(end,end-1)*t->fast(end,end-1))); double x=t->fast(begin,begin)-mu; double z=t->fast(begin+1,begin); HepMatrix::mIter tkk = t->m.begin() + (begin+2)*(begin-1)/2; HepMatrix::mIter tkp1k = tkk + begin; HepMatrix::mIter tkp2k = tkk + 2 * begin + 1; for (int k=begin;k<=end-1;k++) { double c,ds; givens(x,z,&c,&ds); col_givens(u,c,ds,k,k+1); // This is the result of G.T*t*G, making use of the special structure // of t and G. Note that since t is symmetric, only the lower half // needs to be updated. Equations were gotten from maple. if (k!=begin) { *(tkk-1)= (*(tkk-1))*c-(*(tkp1k-1))*ds; *(tkp1k-1)=0; } double ap=(*tkk); double bp=(*tkp1k); double aq=(*(tkp1k+1)); (*tkk)=ap*c*c-2*c*bp*ds+aq*ds*ds; (*tkp1k)=c*ap*ds+bp*c*c-bp*ds*ds-ds*aq*c; (*(tkp1k+1))=ap*ds*ds+2*c*bp*ds+aq*c*c; if (knum_row(); while(begin!=end) { HepMatrix::mIter sii = hms->m.begin() + (begin+2)*(begin-1)/2; HepMatrix::mIter sip1i = sii + begin; for (int i=begin;i<=end-1;i++) { if (fabs(*sip1i)<= tolerance*(fabs(*sii)+fabs(*(sip1i+1)))) { (*sip1i)=0; } if(ifast(begin+1,begin) ==0) begin++; while(end>begin && hms->fast(end,end-1) ==0) end--; if (begin!=end) diag_step(hms,&u,begin,end); } return u; } /* ----------------------------------------------------------------------- house Version: 1.00 Date Last Changed: 1/28/93 This return a Householder Vector to zero the elements in column col, from row+1 to a.num_row(). ----------------------------------------------------------------------- */ HepVector house(const HepSymMatrix &a,int row,int col) { HepVector v(a.num_row()-row+1); /* not tested */ HepMatrix::mIter vp = v.m.begin(); HepMatrix::mcIter aci = a.m.begin() + col * (col - 1) / 2 + row - 1; int i; for (i=row;i<=col;i++) { (*(vp++))=(*(aci++)); } for (;i<=a.num_row();i++) { (*(vp++))=(*aci); aci += i; } v(1)+=sign(a(row,col))*v.norm(); return v; } HepVector house(const HepMatrix &a,int row,int col) { HepVector v(a.num_row()-row+1); /* not tested */ int n = a.num_col(); HepMatrix::mcIter aic = a.m.begin() + (row - 1) * n + (col - 1) ; HepMatrix::mIter vp = v.m.begin(); for (int i=row;i<=a.num_row();i++) { (*(vp++))=(*aic); aic += n; } v(1)+=sign(a(row,col))*v.norm(); return v; } /* ----------------------------------------------------------------------- house_with_update Version: 1.00 Date Last Changed: 1/28/93 This returns the householder vector as in house, and it also changes A to be PA. (It is slightly more efficient than calling house, followed by calling row_house). If you include the optional Matrix *house_vector, then the householder vector is stored in house_vector(row,col) to house_vector(a->num_row(),col). ----------------------------------------------------------------------- */ void house_with_update(HepMatrix *a,int row,int col) { HepVector v(a->num_row()-row+1); /* not tested */ HepMatrix::mIter vp = v.m.begin(); int n = a->num_col(); HepMatrix::mIter arc = a->m.begin() + (row-1) * n + (col-1); int r; for (r=row;r<=a->num_row();r++) { (*(vp++))=(*arc); if(rnum_row()) arc += n; } double normsq=v.normsq(); double norm=sqrt(normsq); normsq-=v(1)*v(1); v(1)+=sign((*a)(row,col))*norm; normsq+=v(1)*v(1); (*a)(row,col)=-sign((*a)(row,col))*norm; if (rownum_row()) { arc = a->m.begin() + row * n + (col-1); for (r=row+1;r<=a->num_row();r++) { (*arc)=0; if(rnum_row()) arc += n; } row_house(a,v,normsq,row,col+1); } } void house_with_update(HepMatrix *a,HepMatrix *v,int row,int col) { double normsq=0; int nv = v->num_col(); int na = a->num_col(); HepMatrix::mIter vrc = v->m.begin() + (row-1) * nv + (col-1); HepMatrix::mIter arc = a->m.begin() + (row-1) * na + (col-1); int r; for (r=row;r<=a->num_row();r++) { (*vrc)=(*arc); normsq+=(*vrc)*(*vrc); if(rnum_row()) { vrc += nv; arc += na; } } double norm=sqrt(normsq); vrc = v->m.begin() + (row-1) * nv + (col-1); normsq-=(*vrc)*(*vrc); (*vrc)+=sign((*a)(row,col))*norm; normsq+=(*vrc)*(*vrc); (*a)(row,col)=-sign((*a)(row,col))*norm; if (rownum_row()) { arc = a->m.begin() + row * na + (col-1); for (r=row+1;r<=a->num_row();r++) { (*arc)=0; if(rnum_row()) arc += na; } row_house(a,*v,normsq,row,col+1,row,col); } } /* ----------------------------------------------------------------------- house_with_update2 Version: 1.00 Date Last Changed: 1/28/93 This is a variation of house_with_update for use with tridiagonalization. It only updates column number col in a SymMatrix. ----------------------------------------------------------------------- */ void house_with_update2(HepSymMatrix *a,HepMatrix *v,int row,int col) { double normsq=0; int nv = v->num_col(); HepMatrix::mIter vrc = v->m.begin() + (row-1) * nv + (col-1); HepMatrix::mIter arc = a->m.begin() + (row-1) * row / 2 + (col-1); int r; for (r=row;r<=a->num_row();r++) { (*vrc)=(*arc); normsq+=(*vrc)*(*vrc); if(rnum_row()) { arc += r; vrc += nv; } } double norm=sqrt(normsq); vrc = v->m.begin() + (row-1) * nv + (col-1); arc = a->m.begin() + (row-1) * row / 2 + (col-1); (*vrc)+=sign(*arc)*norm; (*arc)=-sign(*arc)*norm; arc += row; for (r=row+1;r<=a->num_row();r++) { (*arc)=0; if(rnum_row()) arc += r; } } /* ----------------------------------------------------------------------- inverse Version: 1.00 Date Last Changed: 2/9/93 This calculates the inverse of a square matrix. Note that this is often not what you really want to do. Often, you really want solve or backsolve, which can be faster at calculating (e.g. you want the inverse to calculate A^-1*c where c is a vector. Then this is just solve(A,c)) If A is not need after the calculation, you can call this with *A. A will be destroyed, but the inverse will be calculated quicker. ----------------------------------------------------------------------- */ HepMatrix qr_inverse(const HepMatrix &A) { HepMatrix Atemp=A; return qr_inverse(&Atemp); } HepMatrix qr_inverse(HepMatrix *A) { if (A->num_row()!=A->num_col()) { HepGenMatrix::error("qr_inverse: The matrix is not square."); } HepMatrix QT=qr_decomp(A).T(); back_solve(*A,&QT); return QT; } /* ----------------------------------------------------------------------- Version: 1.00 Date Last Changed: 5/26/93 This takes a set of lines described by Xi=Ai*t+Bi and finds the point P that is closest to the lines in the least squares sense. n is the number of lines, and A and B are pointers to arrays of the Vectors Ai and Bi. The array runs from 0 to n-1. ----------------------------------------------------------------------- */ HepVector min_line_dist(const HepVector *const A, const HepVector *const B, int n) { // For (P-(A t +B))^2 minimum, we have tmin=dot(A,P-B)/A.normsq(). So // To minimize distance, we want sum_i (P-(Ai tmini +Bi))^2 minimum. This // is solved by having // (sum_i k Ai*Ai.T +1) P - (sum_i k dot(Ai,Bi) Ai + Bi) = 0 // where k=1-2/Ai.normsq const double small = 1e-10; // Small number HepSymMatrix C(3,0),I(3,1); HepVector D(3,0); double t; for (int i=0;i= number of columns. If A is a mxn matrix, Q is mxn and R is nxn. R is returned in the upper left part of A. qr_decomp with a second matrix changes A to R, and returns a set of householder vectors. Algorithm is from Golub and Van Loan 5.15. ----------------------------------------------------------------------- */ HepMatrix qr_decomp(HepMatrix *A) { HepMatrix hsm(A->num_row(),A->num_col()); qr_decomp(A,&hsm); // Try to make Q diagonal // HepMatrix Q(A->num_row(),A->num_col(),1); HepMatrix Q(A->num_row(),A->num_row(),1); for (int j=hsm.num_col();j>=1;--j) row_house(&Q,hsm,j,j,j,j); return Q; } /* ----------------------------------------------------------------------- row_givens Version: 1.00 Date Last Changed: 1/28/93 This algorithm performs a Givens rotation on the left. Given c and s and k1 and k2, this is like forming G= identity except for row k1 and k2 where G(k1,k1)=c, G(k1,k2)=s, G(k2,k1)=-s, G(k2,k2)=c. It replaces A with G.T()*A. A variation allows you to express col_min and col_max, and then only the submatrix of A from (1,col_min) to (num_row(),col_max) are updated. This is algorithm 5.1.6 in Golub and Van Loan. ----------------------------------------------------------------------- */ void row_givens(HepMatrix *A, double c,double ds, int k1, int k2, int col_min, int col_max) { /* not tested */ if (col_max==0) col_max = A->num_col(); int n = A->num_col(); HepMatrix::mIter Ak1j = A->m.begin() + (k1-1) * n + (col_min-1); HepMatrix::mIter Ak2j = A->m.begin() + (k2-1) * n + (col_min-1); for (int j=col_min;j<=col_max;j++) { double tau1=(*Ak1j); double tau2=(*Ak2j); (*(Ak1j++))=c*tau1-ds*tau2;(*(Ak2j++))=ds*tau1+c*tau2; } } /* ----------------------------------------------------------------------- row_house Version: 1.00 Date Last Changed: 1/28/93 This replaces A with P*A where P=I-2v*v.T/(v.T*v). If row and col are not one, then it only acts on the subpart of A, from A(row,col) to A(A.num_row(),A.num_row()). For use with house, can pass V as a matrix. Then row_start and col_start describe where the vector lies. It is assumed to run from V(row_start,col_start) to V(row_start+A.num_row()-row,col_start). Since typically row_house comes after house, and v.normsq is calculated in house, it is passed as a arguement. Also supplied without vnormsq. ----------------------------------------------------------------------- */ void row_house(HepMatrix *a,const HepVector &v,double vnormsq, int row, int col) { double beta=-2/vnormsq; // This is a fast way of calculating w=beta*A.sub(row,n,col,n).T()*v HepVector w(a->num_col()-col+1,0); /* not tested */ int na = a->num_col(); HepMatrix::mIter wptr = w.m.begin(); HepMatrix::mIter arcb = a->m.begin() + (row-1) * na + (col-1); int c; for (c=col;c<=a->num_col();c++) { HepMatrix::mcIter vp = v.m.begin(); HepMatrix::mIter arc = arcb; for (int r=row;r<=a->num_row();r++) { (*wptr)+=(*arc)*(*(vp++)); if(rnum_row()) arc += na; } wptr++; arcb++; } w*=beta; // Fast way of calculating A.sub=A.sub+v*w.T() arcb = a->m.begin() + (row-1) * na + (col-1); HepMatrix::mcIter vp = v.m.begin(); for (int r=row; r<=a->num_row();r++) { HepMatrix::mIter wptr2 = w.m.begin(); HepMatrix::mIter arc = arcb; for (c=col;c<=a->num_col();c++) { (*(arc++))+=(*vp)*(*(wptr2++)); } vp++; if(rnum_row()) arcb += na; } } void row_house(HepMatrix *a,const HepMatrix &v,double vnormsq, int row, int col, int row_start, int col_start) { double beta=-2/vnormsq; // This is a fast way of calculating w=beta*A.sub(row,n,col,n).T()*v HepVector w(a->num_col()-col+1,0); int na = a->num_col(); int nv = v.num_col(); HepMatrix::mIter wptr = w.m.begin(); HepMatrix::mIter arcb = a->m.begin() + (row-1) * na + (col-1); HepMatrix::mcIter vpcb = v.m.begin() + (row_start-1) * nv + (col_start-1); int c; for (c=col;c<=a->num_col();c++) { HepMatrix::mIter arc = arcb; HepMatrix::mcIter vpc = vpcb; for (int r=row;r<=a->num_row();r++) { (*wptr)+=(*arc)*(*vpc); if(rnum_row()) { arc += na; vpc += nv; } } wptr++; arcb++; } w*=beta; arcb = a->m.begin() + (row-1) * na + (col-1); HepMatrix::mcIter vpc = v.m.begin() + (row_start-1) * nv + (col_start-1); for (int r=row; r<=a->num_row();r++) { HepMatrix::mIter arc = arcb; HepMatrix::mIter wptr2 = w.m.begin(); for (c=col;c<=a->num_col();c++) { (*(arc++))+=(*vpc)*(*(wptr2++)); } if(rnum_row()) { arcb += na; vpc += nv; } } } /* ----------------------------------------------------------------------- solve Version: 1.00 Date Last Changed: 2/9/93 This solves the system A*x=b where A is not upper triangular, but it must have full rank. If A is not square, then this is solved in the least squares sense. Has a variation that works for b a matrix with each column being a different vector. If A is not needed after this call, you can call solve with *A. This will destroy A, but it will run faster. ----------------------------------------------------------------------- */ HepVector qr_solve(const HepMatrix &A, const HepVector &b) { HepMatrix temp = A; return qr_solve(&temp,b); } HepVector qr_solve(HepMatrix *A,const HepVector &b) { HepMatrix Q=qr_decomp(A); // Quick way to to Q.T*b. HepVector b2(Q.num_col(),0); HepMatrix::mIter b2r = b2.m.begin(); HepMatrix::mIter Qr = Q.m.begin(); int n = Q.num_col(); for (int r=1;r<=b2.num_row();r++) { HepMatrix::mcIter bc = b.m.begin(); HepMatrix::mIter Qcr = Qr; for (int c=1;c<=b.num_row();c++) { *b2r += (*Qcr) * (*(bc++)); if(cnum_col(); for (int k=1;k<=a->num_col()-2;k++) { // If this row is already in tridiagonal form, we can skip the // transformation. double scale=0; HepMatrix::mIter ajk = a->m.begin() + k * (k+5) / 2; int j; for (j=k+2;j<=a->num_row();j++) { scale+=fabs(*ajk); if(jnum_row()) ajk += j; } if (scale ==0) { HepMatrix::mIter hsmjkp = hsm->m.begin() + k * (nh+1) - 1; for (j=k+1;j<=hsm->num_row();j++) { *hsmjkp = 0; if(jnum_row()) hsmjkp += nh; } } else { house_with_update2(a,hsm,k+1,k); double normsq=0; HepMatrix::mIter hsmrptrkp = hsm->m.begin() + k * (nh+1) - 1; int rptr; for (rptr=k+1;rptr<=hsm->num_row();rptr++) { normsq+=(*hsmrptrkp)*(*hsmrptrkp); if(rptrnum_row()) hsmrptrkp += nh; } HepVector p(a->num_row()-k,0); rptr=k+1; HepMatrix::mIter pr = p.m.begin(); int r; for (r=1;r<=p.num_row();r++) { HepMatrix::mIter hsmcptrkp = hsm->m.begin() + k * (nh+1) - 1; int cptr; for (cptr=k+1;cptr<=rptr;cptr++) { (*pr)+=a->fast(rptr,cptr)*(*hsmcptrkp); if(cptrnum_col()) hsmcptrkp += nh; } for (;cptr<=a->num_col();cptr++) { (*pr)+=a->fast(cptr,rptr)*(*hsmcptrkp); if(cptrnum_col()) hsmcptrkp += nh; } (*pr)*=2/normsq; rptr++; pr++; } double pdotv=0; pr = p.m.begin(); hsmrptrkp = hsm->m.begin() + k * (nh+1) - 1; for (r=1;r<=p.num_row();r++) { pdotv+=(*(pr++))*(*hsmrptrkp); if(rm.begin() + k * (nh+1) - 1; for (r=1;r<=p.num_row();r++) { (*(pr++))-=pdotv*(*hsmrptrkp)/normsq; if(rm.begin() + k * (nh+1) - 1; for (r=1;r<=p.num_row();r++) { int cptr=k+1; HepMatrix::mIter mpc = p.m.begin(); HepMatrix::mIter hsmcptrkp = hsm->m.begin() + k * (nh+1) - 1; for (int c=1;c<=r;c++) { a->fast(rptr,cptr)-= (*hsmrptrkp)*(*(mpc++))+(*pr)*(*hsmcptrkp); cptr++; if(cnum_row(),a->num_col(),1); if (a->num_col()>2) { HepMatrix hsm(a->num_col(),a->num_col()-2,0); tridiagonal(a,&hsm); for (int j=hsm.num_col();j>=1;--j) { row_house(&U,hsm,j,j,j,j); } } return U; } void col_house(HepMatrix *a,const HepMatrix &v,int row,int col, int row_start,int col_start) { double normsq=0; for (int i=row_start;i<=row_start+a->num_row()-row;i++) normsq+=v(i,col)*v(i,col); col_house(a,v,normsq,row,col,row_start,col_start); } void givens(double a, double b, double *c, double *ds) { if (b ==0) { *c=1; *ds=0; } else { if (fabs(b)>fabs(a)) { double tau=-a/b; *ds=1/sqrt(1+tau*tau); *c=(*ds)*tau; } else { double tau=-b/a; *c=1/sqrt(1+tau*tau); *ds=(*c)*tau; } } } void qr_decomp(HepMatrix *A,HepMatrix *hsm) { for (int i=1;i<=A->num_col();i++) house_with_update(A,hsm,i,i); } void row_house(HepMatrix *a,const HepMatrix &v,int row,int col, int row_start,int col_start) { double normsq=0; int end = row_start+a->num_row()-row; for (int i=row_start; i<=end; i++) normsq += v(i,col)*v(i,col); // If v is 0, then we can skip doing row_house. if (normsq !=0) row_house(a,v,normsq,row,col,row_start,col_start); } } // namespace CLHEP clhep-2.1.4.1.orig/Matrix/src/Makefile.am0000755000175000017500000000367111406201264016472 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir) libCLHEP_Matrix_@VERSION@_a_SOURCES = \ DiagMatrix.cc \ GenMatrix.cc \ Matrix.cc \ MatrixEqRotation.cc \ MatrixInvert.cc \ MatrixLinear.cc \ SymMatrix.cc \ SymMatrixInvert.cc \ Vector.cc libCLHEP_Matrix_@VERSION@_so_OBJECTS = $(patsubst %.cc,$(shareddir)/%.$(OBJEXT),$(libCLHEP_Matrix_@VERSION@_a_SOURCES)) # these if/else blocks will be parsed by automake and translated if BUILD_SHARED shareddir = shared if BUILD_VISUAL lib_shared = CLHEP-Matrix-@VERSION@.$(SHEXT) else lib_shared = libCLHEP-Matrix-@VERSION@.$(SHEXT) LDADD = -L${top_builddir}/../Random/src -lCLHEP-Random-@VERSION@ \ -L${top_builddir}/../Vector/src -lCLHEP-Vector-@VERSION@ endif SHFLAGS = @MY_SHFLAGS@ SHLINK = @MY_SHLINK@ @MY_SHEXTRA@ SHNAME = @MY_SHNAME@ endif if BUILD_STATIC lib_LIBRARIES = libCLHEP-Matrix-@VERSION@.a endif CLEANFILES = $(lib_shared) all-local: $(shareddir) $(lib_shared) $(shareddir): test -d $(shareddir) || mkdir $(shareddir) if BUILD_VISUAL $(lib_shared): $(libCLHEP_Matrix_@VERSION@_so_OBJECTS) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Matrix_@VERSION@_so_OBJECTS) $(LDADD) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) /c /Fo$@ $< else $(lib_shared): $(libCLHEP_Matrix_@VERSION@_so_OBJECTS) $(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Matrix_@VERSION@_so_OBJECTS) $(LDADD) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) -c -o $@ $< endif install-exec-local: $(lib_shared) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_shared)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$p'"; \ $(INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done clean-local: -test -d $(shareddir) && rm -f $(shareddir)/*.$(OBJEXT) distclean-local: -test -d $(shareddir) && rm -rf ./$(shareddir) clhep-2.1.4.1.orig/Matrix/src/GenMatrix.cc0000755000175000017500000000513012074100307016631 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This is the implementation of the HepGenMatrix class. // #ifdef GNUPRAGMA #pragma implementation #endif #include #include #include #include "CLHEP/Matrix/GenMatrix.h" #include "CLHEP/Matrix/SymMatrix.h" #include "CLHEP/Matrix/Matrix.h" #ifdef HEP_DEBUG_INLINE #include "CLHEP/Matrix/GenMatrix.icc" #endif namespace CLHEP { #ifdef HEP_THIS_FUNCTION_IS_NOT_NEEDED static void delete_array(double *hm) { delete [] hm; } #endif double norm_infinity(const HepGenMatrix &hm) { double max=0,sum; for(int r=1;r<=hm.num_row();r++) { sum=0; for(int c=1;c<=hm.num_col();c++) { sum+=fabs(hm(r,c)); } if(sum>max) max=sum; } return max; } double norm1(const HepGenMatrix &hm) { double max=0,sum; for(int c=1;c<=hm.num_col();c++) { sum=0; for(int r=1;r<=hm.num_row();r++) sum+=fabs(hm(r,c)); if(sum>max) max=sum; } return max; } double norm(const HepGenMatrix &hm) { HepSymMatrix A(hm.num_col(),0); // Calculate hm.T*hm int r; for(r=1;r<=A.num_row();r++) for(int c=1;c<=r;c++) for(int i=1;i<=hm.num_row();i++) A.fast(r,c)=hm(i,r)*hm(i,c); diagonalize(&A); double max=fabs(A(1,1)); for(r=2;r<=A.num_row();r++) if(max size_max) delete [] hm; } } double* HepGenMatrix::new_m(int ) { /*-ap: data_array is replaced by the std::vector, * so we simply return 0 here * * if (size == 0) return 0; * else { * if ( size <= size_max ) { * memset(data_array, 0, size * sizeof(double)); * return data_array; * } else { * double * nnn = new double[size]; * memset(nnn, 0, size * sizeof(double)); * return nnn; * } * } *-ap end */ return 0; } } // namespace CLHEP clhep-2.1.4.1.orig/Matrix/src/Vector.cc0000755000175000017500000003261412074100307016204 0ustar olesoles// -*- C++ -*- // --------------------------------------------------------------------------- // #ifdef GNUPRAGMA #pragma implementation #endif #include #include "CLHEP/Matrix/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Matrix/Vector.h" #include "CLHEP/Matrix/Matrix.h" #ifdef HEP_DEBUG_INLINE #include "CLHEP/Matrix/Vector.icc" #endif namespace CLHEP { // Simple operation for all elements #define SIMPLE_UOP(OPER) \ HepGenMatrix::mIter a=m.begin(); \ HepGenMatrix::mIter e=m.begin()+num_size(); \ for(;anrow) error("Range error in HepVector::operator(i,j)"); #else inline double & HepVector::operator()(int row, int) { #endif return *(m.begin()+(row-1)); } #ifdef MATRIX_BOUND_CHECK inline const double & HepVector::operator()(int row, int col) const { if( col!=1 || row<1 || row>nrow) error("Range error in HepVector::operator(i,j)"); #else inline const double & HepVector::operator()(int row, int) const { #endif return *(m.begin()+(row-1)); } // Sub matrix HepVector HepVector::sub(int min_row, int max_row) const #ifdef HEP_GNU_OPTIMIZED_RETURN return vret(max_row-min_row+1); { #else { HepVector vret(max_row-min_row+1); #endif if(max_row > num_row()) error("HepVector::sub: Index out of range"); HepGenMatrix::mIter a = vret.m.begin(); HepGenMatrix::mcIter b = m.begin() + min_row - 1; HepGenMatrix::mIter e = vret.m.begin() + vret.num_row(); for(;a num_row()) error("HepVector::sub: Index out of range"); HepGenMatrix::mIter a = vret.m.begin(); HepGenMatrix::mIter b = m.begin() + min_row - 1; HepGenMatrix::mIter e = vret.m.begin() + vret.num_row(); for(;a num_row()) error("HepVector::sub: Index out of range"); HepGenMatrix::mcIter a = v1.m.begin(); HepGenMatrix::mIter b = m.begin() + row - 1; HepGenMatrix::mcIter e = v1.m.begin() + v1.num_row(); for(;a max_array) { delete [] ir; max_array = n; ir = new int [max_array+1]; } double det; HepMatrix mt(a); int i = mt.dfact_matrix(det, ir); if (i!=0) { for (i=1;i<=n;i++) vret(i) = 0; return vret; } double s21, s22; int nxch = ir[n]; if (nxch!=0) { for (int hmm=1;hmm<=nxch;hmm++) { int ij = ir[hmm]; i = ij >> 12; int j = ij%4096; double te = vret(i); vret(i) = vret(j); vret(j) = te; } } vret(1) = mt(1,1) * vret(1); if (n!=1) { for (i=2;i<=n;i++) { s21 = -vret(i); for (int j=1;j #include #include "CLHEP/Matrix/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Matrix/DiagMatrix.h" #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/SymMatrix.h" #include "CLHEP/Matrix/Vector.h" #ifdef HEP_DEBUG_INLINE #include "CLHEP/Matrix/DiagMatrix.icc" #endif namespace CLHEP { // Simple operation for all elements #define SIMPLE_UOP(OPER) \ HepMatrix::mIter a=m.begin(); \ HepMatrix::mIter e=m.begin()+num_size(); \ for(;a num_row()) error("HepDiagMatrix::sub: Index out of range"); HepMatrix::mIter a = mret.m.begin(); HepMatrix::mcIter b = m.begin() + min_row - 1; HepMatrix::mIter e = mret.m.begin() + mret.num_row(); for(;a num_row()) error("HepDiagMatrix::sub: Index out of range"); HepMatrix::mIter a = mret.m.begin(); HepMatrix::mIter b = m.begin() + min_row - 1; HepMatrix::mIter e = mret.m.begin() + mret.num_row(); for(;a num_row() ) error("HepDiagMatrix::sub: Index out of range"); HepMatrix::mcIter a = hm1.m.begin(); HepMatrix::mIter b = m.begin() + row - 1; HepMatrix::mcIter e = hm1.m.begin() + hm1.num_row(); for(;a #include // for DBL_EPSILON #include #include #include "CLHEP/Matrix/defs.h" #include "CLHEP/Random/Random.h" #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/SymMatrix.h" #include "CLHEP/Matrix/DiagMatrix.h" #include "CLHEP/Matrix/Vector.h" #ifdef HEP_DEBUG_INLINE #include "CLHEP/Matrix/Matrix.icc" #endif namespace CLHEP { // Simple operation for all elements #define SIMPLE_UOP(OPER) \ mIter a=m.begin(); \ mIter e=m.end(); \ for(;a!=e; a++) (*a) OPER t; #define SIMPLE_BOP(OPER) \ HepMatrix::mIter a=m.begin(); \ HepMatrix::mcIter b=hm2.m.begin(); \ HepMatrix::mIter e=m.end(); \ for(;a!=e; a++, b++) (*a) OPER (*b); #define SIMPLE_TOP(OPER) \ HepMatrix::mcIter a=hm1.m.begin(); \ HepMatrix::mcIter b=hm2.m.begin(); \ HepMatrix::mIter t=mret.m.begin(); \ HepMatrix::mcIter e=hm1.m.end(); \ for(;a!=e; a++, b++, t++) (*t) = (*a) OPER (*b); // Static functions. #define CHK_DIM_2(r1,r2,c1,c2,fun) \ if (r1!=r2 || c1!=c2) { \ HepGenMatrix::error("Range error in Matrix function " #fun "(1)."); \ } #define CHK_DIM_1(c1,r2,fun) \ if (c1!=r2) { \ HepGenMatrix::error("Range error in Matrix function " #fun "(2)."); \ } // Constructors. (Default constructors are inlined and in .icc file) HepMatrix::HepMatrix(int p,int q) : m(p*q), nrow(p), ncol(q) { size_ = nrow * ncol; } HepMatrix::HepMatrix(int p,int q,int init) : m(p*q), nrow(p), ncol(q) { size_ = nrow * ncol; if (size_ > 0) { switch(init) { case 0: break; case 1: { if ( ncol == nrow ) { mIter a = m.begin(); for( int step=0; step < size_; step+=(ncol+1) ) *(a+step) = 1.0; } else { error("Invalid dimension in HepMatrix(int,int,1)."); } break; } default: error("Matrix: initialization must be either 0 or 1."); } } } HepMatrix::HepMatrix(int p,int q, HepRandom &r) : m(p*q), nrow(p), ncol(q) { size_ = nrow * ncol; mIter a = m.begin(); mIter b = m.end(); for(; anum_row() || col<1 || col>num_col()) error("Range error in HepMatrix::operator()"); #endif return *(m.begin()+(row-1)*ncol+col-1); } const double & HepMatrix::operator()(int row, int col) const { #ifdef MATRIX_BOUND_CHECK if(row<1 || row>num_row() || col<1 || col>num_col()) error("Range error in HepMatrix::operator()"); #endif return *(m.begin()+(row-1)*ncol+col-1); } HepMatrix::HepMatrix(const HepSymMatrix &hm1) : m(hm1.nrow*hm1.nrow), nrow(hm1.nrow), ncol(hm1.nrow) { size_ = nrow * ncol; mcIter sjk = hm1.m.begin(); // j >= k for(int j=0; j!=nrow; ++j) { for(int k=0; k<=j; ++k) { m[j*ncol+k] = *sjk; // we could copy the diagonal element twice or check // doing the check may be a tiny bit faster, // so we choose that option for now if(k!=j) m[k*nrow+j] = *sjk; ++sjk; } } } HepMatrix::HepMatrix(const HepDiagMatrix &hm1) : m(hm1.nrow*hm1.nrow), nrow(hm1.nrow), ncol(hm1.nrow) { size_ = nrow * ncol; int n = num_row(); mIter mrr; mcIter mr = hm1.m.begin(); for(int r=0;r num_row() || max_col >num_col()) error("HepMatrix::sub: Index out of range"); mIter a = mret.m.begin(); int nc = num_col(); mcIter b1 = m.begin() + (min_row - 1) * nc + min_col - 1; int rowsize = mret.num_row(); for(int irow=1; irow<=rowsize; ++irow) { mcIter brc = b1; for(int icol=0; icol num_row() || col <1 || col+hm1.num_col()-1 > num_col() ) error("HepMatrix::sub: Index out of range"); mcIter a = hm1.m.begin(); int nc = num_col(); mIter b1 = m.begin() + (row - 1) * nc + col - 1; int rowsize = hm1.num_row(); for(int irow=1; irow<=rowsize; ++irow) { mIter brc = b1; for(int icol=0; icol2) { mIter mimim = hm11 + n + 1; for (int i=3;i<=n;i++) { // calculate these to avoid pointing off the end of the storage array mIter mi = hm11 + (i-1) * n; mIter mii= hm11 + (i-1) * n + i - 1; int ihm2 = i - 2; mIter mj = hm11; mIter mji = mj + i - 1; mIter mij = mi; for (int j=1;j<=ihm2;j++) { s31 = 0.0; s32 = *mji; mIter mkj = mj + j - 1; mIter mik = mi + j - 1; mIter mjkp = mj + j; mIter mkpi = mj + n + i - 1; for (int k=j;k<=ihm2;k++) { s31 += (*mkj) * (*(mik++)); s32 += (*(mjkp++)) * (*mkpi); mkj += n; mkpi += n; } // for k *mij = -(*mii) * (((*(mij-n)))*( (*(mii-1)))+(s31)); *mji = -s32; mj += n; mji += n; mij++; } // for j *(mii-1) = -(*mii) * (*mimim) * (*(mii-1)); *(mimim+1) = -(*(mimim+1)); mimim += (n+1); } // for i } // n>2 mIter mi = hm11; mIter mii = hm11; for (int i=1;i> 12; int j = ij%4096; for (k=1; k<=n;k++) { // avoid setting the iterator beyond the end of the storage vector mIter mki = hm11 + (k-1)*n + i - 1; mIter mkj = hm11 + (k-1)*n + j - 1; // 2/24/05 David Sachs fix of improper swap bug that was present // for many years: double ti = *mki; // 2/24/05 *mki = *mkj; *mkj = ti; // 2/24/05 } } // for hmm return 0; } int HepMatrix::dfact_matrix(double &det, int *ir) { if (ncol!=nrow) error("dfact_matrix: Matrix is not NxN"); int ifail, jfail; int n = ncol; double tf; double g1 = 1.0e-19, g2 = 1.0e19; double p, q, t; double s11, s12; double epsilon = 8*DBL_EPSILON; // could be set to zero (like it was before) // but then the algorithm often doesn't detect // that a matrix is singular int normal = 0, imposs = -1; int jrange = 0, jover = 1, junder = -1; ifail = normal; jfail = jrange; int nxch = 0; det = 1.0; mIter mj = m.begin(); mIter mjj = mj; for (int j=1;j<=n;j++) { int k = j; p = (fabs(*mjj)); if (j!=n) { // replace mij with calculation of position for (int i=j+1;i p) { k = i; p = q; } } // for i if (k==j) { if (p <= epsilon) { det = 0; ifail = imposs; jfail = jrange; return ifail; } det = -det; // in this case the sign of the determinant // must not change. So I change it twice. } // k==j mIter mjl = mj; mIter mkl = m.begin() + (k-1)*n; for (int l=1;l<=n;l++) { tf = *mjl; *(mjl++) = *mkl; *(mkl++) = tf; } nxch = nxch + 1; // this makes the determinant change its sign ir[nxch] = (((j)<<12)+(k)); } else { // j!=n if (p <= epsilon) { det = 0.0; ifail = imposs; jfail = jrange; return ifail; } } // j!=n det *= *mjj; *mjj = 1.0 / *mjj; t = (fabs(det)); if (t < g1) { det = 0.0; if (jfail == jrange) jfail = junder; } else if (t > g2) { det = 1.0; if (jfail==jrange) jfail = jover; } // calculate mk and mkjp so we don't point off the end of the vector if (j!=n) { mIter mjk = mj + j; for (k=j+1;k<=n;k++) { mIter mk = mj + n*(k-j); mIter mkjp = mk + j; s11 = - (*mjk); s12 = - (*mkjp); if (j!=1) { mIter mik = m.begin() + k - 1; mIter mijp = m.begin() + j; mIter mki = mk; mIter mji = mj; for (int i=1;i max_array) { delete [] ir; max_array = nrow; ir = new int [max_array+1]; } double t1, t2, t3; double det, temp, sd; int ifail; switch(nrow) { case 3: double c11,c12,c13,c21,c22,c23,c31,c32,c33; ifail = 0; c11 = (*(m.begin()+4)) * (*(m.begin()+8)) - (*(m.begin()+5)) * (*(m.begin()+7)); c12 = (*(m.begin()+5)) * (*(m.begin()+6)) - (*(m.begin()+3)) * (*(m.begin()+8)); c13 = (*(m.begin()+3)) * (*(m.begin()+7)) - (*(m.begin()+4)) * (*(m.begin()+6)); c21 = (*(m.begin()+7)) * (*(m.begin()+2)) - (*(m.begin()+8)) * (*(m.begin()+1)); c22 = (*(m.begin()+8)) * (*m.begin()) - (*(m.begin()+6)) * (*(m.begin()+2)); c23 = (*(m.begin()+6)) * (*(m.begin()+1)) - (*(m.begin()+7)) * (*m.begin()); c31 = (*(m.begin()+1)) * (*(m.begin()+5)) - (*(m.begin()+2)) * (*(m.begin()+4)); c32 = (*(m.begin()+2)) * (*(m.begin()+3)) - (*m.begin()) * (*(m.begin()+5)); c33 = (*m.begin()) * (*(m.begin()+4)) - (*(m.begin()+1)) * (*(m.begin()+3)); t1 = fabs(*m.begin()); t2 = fabs(*(m.begin()+3)); t3 = fabs(*(m.begin()+6)); if (t1 >= t2) { if (t3 >= t1) { temp = *(m.begin()+6); det = c23*c12-c22*c13; } else { temp = *(m.begin()); det = c22*c33-c23*c32; } } else if (t3 >= t2) { temp = *(m.begin()+6); det = c23*c12-c22*c13; } else { temp = *(m.begin()+3); det = c13*c32-c12*c33; } if (det==0) { ierr = 1; return; } { double s1 = temp/det; mIter hmm = m.begin(); *(hmm++) = s1*c11; *(hmm++) = s1*c21; *(hmm++) = s1*c31; *(hmm++) = s1*c12; *(hmm++) = s1*c22; *(hmm++) = s1*c32; *(hmm++) = s1*c13; *(hmm++) = s1*c23; *(hmm) = s1*c33; } break; case 2: ifail = 0; det = (*m.begin())*(*(m.begin()+3)) - (*(m.begin()+1))*(*(m.begin()+2)); if (det==0) { ierr = 1; return; } sd = 1.0/det; temp = sd*(*(m.begin()+3)); *(m.begin()+1) *= -sd; *(m.begin()+2) *= -sd; *(m.begin()+3) = sd*(*m.begin()); *(m.begin()) = temp; break; case 1: ifail = 0; if ((*(m.begin()))==0) { ierr = 1; return; } *(m.begin()) = 1.0/(*(m.begin())); break; case 4: invertHaywood4(ierr); return; case 5: invertHaywood5(ierr); return; case 6: invertHaywood6(ierr); return; default: ifail = dfact_matrix(det, ir); if(ifail) { ierr = 1; return; } dfinv_matrix(ir); break; } ierr = 0; return; } double HepMatrix::determinant() const { static int max_array = 20; static int *ir = new int [max_array+1]; if(ncol != nrow) error("HepMatrix::determinant: Matrix is not NxN"); if (ncol > max_array) { delete [] ir; max_array = nrow; ir = new int [max_array+1]; } double det; HepMatrix mt(*this); int i = mt.dfact_matrix(det, ir); if(i==0) return det; return 0; } double HepMatrix::trace() const { double t = 0.0; for (mcIter d = m.begin(); d < m.end(); d += (ncol+1) ) t += *d; return t; } } // namespace CLHEP clhep-2.1.4.1.orig/Matrix/src/SymMatrixInvert.cc0000755000175000017500000011603710233764254020105 0ustar olesoles// -*- C++ -*- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This software written by Mark Fischler and Steven Haywood // #ifdef GNUPRAGMA #pragma implementation #endif #include #include // for DBL_EPSILON #include #include "CLHEP/Matrix/defs.h" #include "CLHEP/Matrix/SymMatrix.h" namespace CLHEP { double HepSymMatrix::posDefFraction5x5 = 1.0; double HepSymMatrix::posDefFraction6x6 = 1.0; double HepSymMatrix::adjustment5x5 = 0.0; double HepSymMatrix::adjustment6x6 = 0.0; const double HepSymMatrix::CHOLESKY_THRESHOLD_5x5 = .5; const double HepSymMatrix::CHOLESKY_THRESHOLD_6x6 = .2; const double HepSymMatrix::CHOLESKY_CREEP_5x5 = .005; const double HepSymMatrix::CHOLESKY_CREEP_6x6 = .002; // Aij are indices for a 6x6 symmetric matrix. // The indices for 5x5 or 4x4 symmetric matrices are the same, // ignoring all combinations with an index which is inapplicable. #define A00 0 #define A01 1 #define A02 3 #define A03 6 #define A04 10 #define A05 15 #define A10 1 #define A11 2 #define A12 4 #define A13 7 #define A14 11 #define A15 16 #define A20 3 #define A21 4 #define A22 5 #define A23 8 #define A24 12 #define A25 17 #define A30 6 #define A31 7 #define A32 8 #define A33 9 #define A34 13 #define A35 18 #define A40 10 #define A41 11 #define A42 12 #define A43 13 #define A44 14 #define A45 19 #define A50 15 #define A51 16 #define A52 17 #define A53 18 #define A54 19 #define A55 20 void HepSymMatrix::invert5(int & ifail) { if (posDefFraction5x5 >= CHOLESKY_THRESHOLD_5x5) { invertCholesky5(ifail); posDefFraction5x5 = .9*posDefFraction5x5 + .1*(1-ifail); if (ifail!=0) { // Cholesky failed -- invert using Haywood invertHaywood5(ifail); } } else { if (posDefFraction5x5 + adjustment5x5 >= CHOLESKY_THRESHOLD_5x5) { invertCholesky5(ifail); posDefFraction5x5 = .9*posDefFraction5x5 + .1*(1-ifail); if (ifail!=0) { // Cholesky failed -- invert using Haywood invertHaywood5(ifail); adjustment5x5 = 0; } } else { invertHaywood5(ifail); adjustment5x5 += CHOLESKY_CREEP_5x5; } } return; } void HepSymMatrix::invert6(int & ifail) { if (posDefFraction6x6 >= CHOLESKY_THRESHOLD_6x6) { invertCholesky6(ifail); posDefFraction6x6 = .9*posDefFraction6x6 + .1*(1-ifail); if (ifail!=0) { // Cholesky failed -- invert using Haywood invertHaywood6(ifail); } } else { if (posDefFraction6x6 + adjustment6x6 >= CHOLESKY_THRESHOLD_6x6) { invertCholesky6(ifail); posDefFraction6x6 = .9*posDefFraction6x6 + .1*(1-ifail); if (ifail!=0) { // Cholesky failed -- invert using Haywood invertHaywood6(ifail); adjustment6x6 = 0; } } else { invertHaywood6(ifail); adjustment6x6 += CHOLESKY_CREEP_6x6; } } return; } void HepSymMatrix::invertHaywood5 (int & ifail) { ifail = 0; // Find all NECESSARY 2x2 dets: (25 of them) double Det2_23_01 = m[A20]*m[A31] - m[A21]*m[A30]; double Det2_23_02 = m[A20]*m[A32] - m[A22]*m[A30]; double Det2_23_03 = m[A20]*m[A33] - m[A23]*m[A30]; double Det2_23_12 = m[A21]*m[A32] - m[A22]*m[A31]; double Det2_23_13 = m[A21]*m[A33] - m[A23]*m[A31]; double Det2_23_23 = m[A22]*m[A33] - m[A23]*m[A32]; double Det2_24_01 = m[A20]*m[A41] - m[A21]*m[A40]; double Det2_24_02 = m[A20]*m[A42] - m[A22]*m[A40]; double Det2_24_03 = m[A20]*m[A43] - m[A23]*m[A40]; double Det2_24_04 = m[A20]*m[A44] - m[A24]*m[A40]; double Det2_24_12 = m[A21]*m[A42] - m[A22]*m[A41]; double Det2_24_13 = m[A21]*m[A43] - m[A23]*m[A41]; double Det2_24_14 = m[A21]*m[A44] - m[A24]*m[A41]; double Det2_24_23 = m[A22]*m[A43] - m[A23]*m[A42]; double Det2_24_24 = m[A22]*m[A44] - m[A24]*m[A42]; double Det2_34_01 = m[A30]*m[A41] - m[A31]*m[A40]; double Det2_34_02 = m[A30]*m[A42] - m[A32]*m[A40]; double Det2_34_03 = m[A30]*m[A43] - m[A33]*m[A40]; double Det2_34_04 = m[A30]*m[A44] - m[A34]*m[A40]; double Det2_34_12 = m[A31]*m[A42] - m[A32]*m[A41]; double Det2_34_13 = m[A31]*m[A43] - m[A33]*m[A41]; double Det2_34_14 = m[A31]*m[A44] - m[A34]*m[A41]; double Det2_34_23 = m[A32]*m[A43] - m[A33]*m[A42]; double Det2_34_24 = m[A32]*m[A44] - m[A34]*m[A42]; double Det2_34_34 = m[A33]*m[A44] - m[A34]*m[A43]; // Find all NECESSARY 3x3 dets: (30 of them) double Det3_123_012 = m[A10]*Det2_23_12 - m[A11]*Det2_23_02 + m[A12]*Det2_23_01; double Det3_123_013 = m[A10]*Det2_23_13 - m[A11]*Det2_23_03 + m[A13]*Det2_23_01; double Det3_123_023 = m[A10]*Det2_23_23 - m[A12]*Det2_23_03 + m[A13]*Det2_23_02; double Det3_123_123 = m[A11]*Det2_23_23 - m[A12]*Det2_23_13 + m[A13]*Det2_23_12; double Det3_124_012 = m[A10]*Det2_24_12 - m[A11]*Det2_24_02 + m[A12]*Det2_24_01; double Det3_124_013 = m[A10]*Det2_24_13 - m[A11]*Det2_24_03 + m[A13]*Det2_24_01; double Det3_124_014 = m[A10]*Det2_24_14 - m[A11]*Det2_24_04 + m[A14]*Det2_24_01; double Det3_124_023 = m[A10]*Det2_24_23 - m[A12]*Det2_24_03 + m[A13]*Det2_24_02; double Det3_124_024 = m[A10]*Det2_24_24 - m[A12]*Det2_24_04 + m[A14]*Det2_24_02; double Det3_124_123 = m[A11]*Det2_24_23 - m[A12]*Det2_24_13 + m[A13]*Det2_24_12; double Det3_124_124 = m[A11]*Det2_24_24 - m[A12]*Det2_24_14 + m[A14]*Det2_24_12; double Det3_134_012 = m[A10]*Det2_34_12 - m[A11]*Det2_34_02 + m[A12]*Det2_34_01; double Det3_134_013 = m[A10]*Det2_34_13 - m[A11]*Det2_34_03 + m[A13]*Det2_34_01; double Det3_134_014 = m[A10]*Det2_34_14 - m[A11]*Det2_34_04 + m[A14]*Det2_34_01; double Det3_134_023 = m[A10]*Det2_34_23 - m[A12]*Det2_34_03 + m[A13]*Det2_34_02; double Det3_134_024 = m[A10]*Det2_34_24 - m[A12]*Det2_34_04 + m[A14]*Det2_34_02; double Det3_134_034 = m[A10]*Det2_34_34 - m[A13]*Det2_34_04 + m[A14]*Det2_34_03; double Det3_134_123 = m[A11]*Det2_34_23 - m[A12]*Det2_34_13 + m[A13]*Det2_34_12; double Det3_134_124 = m[A11]*Det2_34_24 - m[A12]*Det2_34_14 + m[A14]*Det2_34_12; double Det3_134_134 = m[A11]*Det2_34_34 - m[A13]*Det2_34_14 + m[A14]*Det2_34_13; double Det3_234_012 = m[A20]*Det2_34_12 - m[A21]*Det2_34_02 + m[A22]*Det2_34_01; double Det3_234_013 = m[A20]*Det2_34_13 - m[A21]*Det2_34_03 + m[A23]*Det2_34_01; double Det3_234_014 = m[A20]*Det2_34_14 - m[A21]*Det2_34_04 + m[A24]*Det2_34_01; double Det3_234_023 = m[A20]*Det2_34_23 - m[A22]*Det2_34_03 + m[A23]*Det2_34_02; double Det3_234_024 = m[A20]*Det2_34_24 - m[A22]*Det2_34_04 + m[A24]*Det2_34_02; double Det3_234_034 = m[A20]*Det2_34_34 - m[A23]*Det2_34_04 + m[A24]*Det2_34_03; double Det3_234_123 = m[A21]*Det2_34_23 - m[A22]*Det2_34_13 + m[A23]*Det2_34_12; double Det3_234_124 = m[A21]*Det2_34_24 - m[A22]*Det2_34_14 + m[A24]*Det2_34_12; double Det3_234_134 = m[A21]*Det2_34_34 - m[A23]*Det2_34_14 + m[A24]*Det2_34_13; double Det3_234_234 = m[A22]*Det2_34_34 - m[A23]*Det2_34_24 + m[A24]*Det2_34_23; // Find all NECESSARY 4x4 dets: (15 of them) double Det4_0123_0123 = m[A00]*Det3_123_123 - m[A01]*Det3_123_023 + m[A02]*Det3_123_013 - m[A03]*Det3_123_012; double Det4_0124_0123 = m[A00]*Det3_124_123 - m[A01]*Det3_124_023 + m[A02]*Det3_124_013 - m[A03]*Det3_124_012; double Det4_0124_0124 = m[A00]*Det3_124_124 - m[A01]*Det3_124_024 + m[A02]*Det3_124_014 - m[A04]*Det3_124_012; double Det4_0134_0123 = m[A00]*Det3_134_123 - m[A01]*Det3_134_023 + m[A02]*Det3_134_013 - m[A03]*Det3_134_012; double Det4_0134_0124 = m[A00]*Det3_134_124 - m[A01]*Det3_134_024 + m[A02]*Det3_134_014 - m[A04]*Det3_134_012; double Det4_0134_0134 = m[A00]*Det3_134_134 - m[A01]*Det3_134_034 + m[A03]*Det3_134_014 - m[A04]*Det3_134_013; double Det4_0234_0123 = m[A00]*Det3_234_123 - m[A01]*Det3_234_023 + m[A02]*Det3_234_013 - m[A03]*Det3_234_012; double Det4_0234_0124 = m[A00]*Det3_234_124 - m[A01]*Det3_234_024 + m[A02]*Det3_234_014 - m[A04]*Det3_234_012; double Det4_0234_0134 = m[A00]*Det3_234_134 - m[A01]*Det3_234_034 + m[A03]*Det3_234_014 - m[A04]*Det3_234_013; double Det4_0234_0234 = m[A00]*Det3_234_234 - m[A02]*Det3_234_034 + m[A03]*Det3_234_024 - m[A04]*Det3_234_023; double Det4_1234_0123 = m[A10]*Det3_234_123 - m[A11]*Det3_234_023 + m[A12]*Det3_234_013 - m[A13]*Det3_234_012; double Det4_1234_0124 = m[A10]*Det3_234_124 - m[A11]*Det3_234_024 + m[A12]*Det3_234_014 - m[A14]*Det3_234_012; double Det4_1234_0134 = m[A10]*Det3_234_134 - m[A11]*Det3_234_034 + m[A13]*Det3_234_014 - m[A14]*Det3_234_013; double Det4_1234_0234 = m[A10]*Det3_234_234 - m[A12]*Det3_234_034 + m[A13]*Det3_234_024 - m[A14]*Det3_234_023; double Det4_1234_1234 = m[A11]*Det3_234_234 - m[A12]*Det3_234_134 + m[A13]*Det3_234_124 - m[A14]*Det3_234_123; // Find the 5x5 det: double det = m[A00]*Det4_1234_1234 - m[A01]*Det4_1234_0234 + m[A02]*Det4_1234_0134 - m[A03]*Det4_1234_0124 + m[A04]*Det4_1234_0123; if ( det == 0 ) { #ifdef SINGULAR_DIAGNOSTICS std::cerr << "Kramer's rule inversion of a singular 5x5 matrix: " << *this << "\n"; #endif ifail = 1; return; } double oneOverDet = 1.0/det; double mn1OverDet = - oneOverDet; m[A00] = Det4_1234_1234 * oneOverDet; m[A01] = Det4_1234_0234 * mn1OverDet; m[A02] = Det4_1234_0134 * oneOverDet; m[A03] = Det4_1234_0124 * mn1OverDet; m[A04] = Det4_1234_0123 * oneOverDet; m[A11] = Det4_0234_0234 * oneOverDet; m[A12] = Det4_0234_0134 * mn1OverDet; m[A13] = Det4_0234_0124 * oneOverDet; m[A14] = Det4_0234_0123 * mn1OverDet; m[A22] = Det4_0134_0134 * oneOverDet; m[A23] = Det4_0134_0124 * mn1OverDet; m[A24] = Det4_0134_0123 * oneOverDet; m[A33] = Det4_0124_0124 * oneOverDet; m[A34] = Det4_0124_0123 * mn1OverDet; m[A44] = Det4_0123_0123 * oneOverDet; return; } void HepSymMatrix::invertHaywood6 (int & ifail) { ifail = 0; // Find all NECESSARY 2x2 dets: (39 of them) double Det2_34_01 = m[A30]*m[A41] - m[A31]*m[A40]; double Det2_34_02 = m[A30]*m[A42] - m[A32]*m[A40]; double Det2_34_03 = m[A30]*m[A43] - m[A33]*m[A40]; double Det2_34_04 = m[A30]*m[A44] - m[A34]*m[A40]; double Det2_34_12 = m[A31]*m[A42] - m[A32]*m[A41]; double Det2_34_13 = m[A31]*m[A43] - m[A33]*m[A41]; double Det2_34_14 = m[A31]*m[A44] - m[A34]*m[A41]; double Det2_34_23 = m[A32]*m[A43] - m[A33]*m[A42]; double Det2_34_24 = m[A32]*m[A44] - m[A34]*m[A42]; double Det2_34_34 = m[A33]*m[A44] - m[A34]*m[A43]; double Det2_35_01 = m[A30]*m[A51] - m[A31]*m[A50]; double Det2_35_02 = m[A30]*m[A52] - m[A32]*m[A50]; double Det2_35_03 = m[A30]*m[A53] - m[A33]*m[A50]; double Det2_35_04 = m[A30]*m[A54] - m[A34]*m[A50]; double Det2_35_05 = m[A30]*m[A55] - m[A35]*m[A50]; double Det2_35_12 = m[A31]*m[A52] - m[A32]*m[A51]; double Det2_35_13 = m[A31]*m[A53] - m[A33]*m[A51]; double Det2_35_14 = m[A31]*m[A54] - m[A34]*m[A51]; double Det2_35_15 = m[A31]*m[A55] - m[A35]*m[A51]; double Det2_35_23 = m[A32]*m[A53] - m[A33]*m[A52]; double Det2_35_24 = m[A32]*m[A54] - m[A34]*m[A52]; double Det2_35_25 = m[A32]*m[A55] - m[A35]*m[A52]; double Det2_35_34 = m[A33]*m[A54] - m[A34]*m[A53]; double Det2_35_35 = m[A33]*m[A55] - m[A35]*m[A53]; double Det2_45_01 = m[A40]*m[A51] - m[A41]*m[A50]; double Det2_45_02 = m[A40]*m[A52] - m[A42]*m[A50]; double Det2_45_03 = m[A40]*m[A53] - m[A43]*m[A50]; double Det2_45_04 = m[A40]*m[A54] - m[A44]*m[A50]; double Det2_45_05 = m[A40]*m[A55] - m[A45]*m[A50]; double Det2_45_12 = m[A41]*m[A52] - m[A42]*m[A51]; double Det2_45_13 = m[A41]*m[A53] - m[A43]*m[A51]; double Det2_45_14 = m[A41]*m[A54] - m[A44]*m[A51]; double Det2_45_15 = m[A41]*m[A55] - m[A45]*m[A51]; double Det2_45_23 = m[A42]*m[A53] - m[A43]*m[A52]; double Det2_45_24 = m[A42]*m[A54] - m[A44]*m[A52]; double Det2_45_25 = m[A42]*m[A55] - m[A45]*m[A52]; double Det2_45_34 = m[A43]*m[A54] - m[A44]*m[A53]; double Det2_45_35 = m[A43]*m[A55] - m[A45]*m[A53]; double Det2_45_45 = m[A44]*m[A55] - m[A45]*m[A54]; // Find all NECESSARY 3x3 dets: (65 of them) double Det3_234_012 = m[A20]*Det2_34_12 - m[A21]*Det2_34_02 + m[A22]*Det2_34_01; double Det3_234_013 = m[A20]*Det2_34_13 - m[A21]*Det2_34_03 + m[A23]*Det2_34_01; double Det3_234_014 = m[A20]*Det2_34_14 - m[A21]*Det2_34_04 + m[A24]*Det2_34_01; double Det3_234_023 = m[A20]*Det2_34_23 - m[A22]*Det2_34_03 + m[A23]*Det2_34_02; double Det3_234_024 = m[A20]*Det2_34_24 - m[A22]*Det2_34_04 + m[A24]*Det2_34_02; double Det3_234_034 = m[A20]*Det2_34_34 - m[A23]*Det2_34_04 + m[A24]*Det2_34_03; double Det3_234_123 = m[A21]*Det2_34_23 - m[A22]*Det2_34_13 + m[A23]*Det2_34_12; double Det3_234_124 = m[A21]*Det2_34_24 - m[A22]*Det2_34_14 + m[A24]*Det2_34_12; double Det3_234_134 = m[A21]*Det2_34_34 - m[A23]*Det2_34_14 + m[A24]*Det2_34_13; double Det3_234_234 = m[A22]*Det2_34_34 - m[A23]*Det2_34_24 + m[A24]*Det2_34_23; double Det3_235_012 = m[A20]*Det2_35_12 - m[A21]*Det2_35_02 + m[A22]*Det2_35_01; double Det3_235_013 = m[A20]*Det2_35_13 - m[A21]*Det2_35_03 + m[A23]*Det2_35_01; double Det3_235_014 = m[A20]*Det2_35_14 - m[A21]*Det2_35_04 + m[A24]*Det2_35_01; double Det3_235_015 = m[A20]*Det2_35_15 - m[A21]*Det2_35_05 + m[A25]*Det2_35_01; double Det3_235_023 = m[A20]*Det2_35_23 - m[A22]*Det2_35_03 + m[A23]*Det2_35_02; double Det3_235_024 = m[A20]*Det2_35_24 - m[A22]*Det2_35_04 + m[A24]*Det2_35_02; double Det3_235_025 = m[A20]*Det2_35_25 - m[A22]*Det2_35_05 + m[A25]*Det2_35_02; double Det3_235_034 = m[A20]*Det2_35_34 - m[A23]*Det2_35_04 + m[A24]*Det2_35_03; double Det3_235_035 = m[A20]*Det2_35_35 - m[A23]*Det2_35_05 + m[A25]*Det2_35_03; double Det3_235_123 = m[A21]*Det2_35_23 - m[A22]*Det2_35_13 + m[A23]*Det2_35_12; double Det3_235_124 = m[A21]*Det2_35_24 - m[A22]*Det2_35_14 + m[A24]*Det2_35_12; double Det3_235_125 = m[A21]*Det2_35_25 - m[A22]*Det2_35_15 + m[A25]*Det2_35_12; double Det3_235_134 = m[A21]*Det2_35_34 - m[A23]*Det2_35_14 + m[A24]*Det2_35_13; double Det3_235_135 = m[A21]*Det2_35_35 - m[A23]*Det2_35_15 + m[A25]*Det2_35_13; double Det3_235_234 = m[A22]*Det2_35_34 - m[A23]*Det2_35_24 + m[A24]*Det2_35_23; double Det3_235_235 = m[A22]*Det2_35_35 - m[A23]*Det2_35_25 + m[A25]*Det2_35_23; double Det3_245_012 = m[A20]*Det2_45_12 - m[A21]*Det2_45_02 + m[A22]*Det2_45_01; double Det3_245_013 = m[A20]*Det2_45_13 - m[A21]*Det2_45_03 + m[A23]*Det2_45_01; double Det3_245_014 = m[A20]*Det2_45_14 - m[A21]*Det2_45_04 + m[A24]*Det2_45_01; double Det3_245_015 = m[A20]*Det2_45_15 - m[A21]*Det2_45_05 + m[A25]*Det2_45_01; double Det3_245_023 = m[A20]*Det2_45_23 - m[A22]*Det2_45_03 + m[A23]*Det2_45_02; double Det3_245_024 = m[A20]*Det2_45_24 - m[A22]*Det2_45_04 + m[A24]*Det2_45_02; double Det3_245_025 = m[A20]*Det2_45_25 - m[A22]*Det2_45_05 + m[A25]*Det2_45_02; double Det3_245_034 = m[A20]*Det2_45_34 - m[A23]*Det2_45_04 + m[A24]*Det2_45_03; double Det3_245_035 = m[A20]*Det2_45_35 - m[A23]*Det2_45_05 + m[A25]*Det2_45_03; double Det3_245_045 = m[A20]*Det2_45_45 - m[A24]*Det2_45_05 + m[A25]*Det2_45_04; double Det3_245_123 = m[A21]*Det2_45_23 - m[A22]*Det2_45_13 + m[A23]*Det2_45_12; double Det3_245_124 = m[A21]*Det2_45_24 - m[A22]*Det2_45_14 + m[A24]*Det2_45_12; double Det3_245_125 = m[A21]*Det2_45_25 - m[A22]*Det2_45_15 + m[A25]*Det2_45_12; double Det3_245_134 = m[A21]*Det2_45_34 - m[A23]*Det2_45_14 + m[A24]*Det2_45_13; double Det3_245_135 = m[A21]*Det2_45_35 - m[A23]*Det2_45_15 + m[A25]*Det2_45_13; double Det3_245_145 = m[A21]*Det2_45_45 - m[A24]*Det2_45_15 + m[A25]*Det2_45_14; double Det3_245_234 = m[A22]*Det2_45_34 - m[A23]*Det2_45_24 + m[A24]*Det2_45_23; double Det3_245_235 = m[A22]*Det2_45_35 - m[A23]*Det2_45_25 + m[A25]*Det2_45_23; double Det3_245_245 = m[A22]*Det2_45_45 - m[A24]*Det2_45_25 + m[A25]*Det2_45_24; double Det3_345_012 = m[A30]*Det2_45_12 - m[A31]*Det2_45_02 + m[A32]*Det2_45_01; double Det3_345_013 = m[A30]*Det2_45_13 - m[A31]*Det2_45_03 + m[A33]*Det2_45_01; double Det3_345_014 = m[A30]*Det2_45_14 - m[A31]*Det2_45_04 + m[A34]*Det2_45_01; double Det3_345_015 = m[A30]*Det2_45_15 - m[A31]*Det2_45_05 + m[A35]*Det2_45_01; double Det3_345_023 = m[A30]*Det2_45_23 - m[A32]*Det2_45_03 + m[A33]*Det2_45_02; double Det3_345_024 = m[A30]*Det2_45_24 - m[A32]*Det2_45_04 + m[A34]*Det2_45_02; double Det3_345_025 = m[A30]*Det2_45_25 - m[A32]*Det2_45_05 + m[A35]*Det2_45_02; double Det3_345_034 = m[A30]*Det2_45_34 - m[A33]*Det2_45_04 + m[A34]*Det2_45_03; double Det3_345_035 = m[A30]*Det2_45_35 - m[A33]*Det2_45_05 + m[A35]*Det2_45_03; double Det3_345_045 = m[A30]*Det2_45_45 - m[A34]*Det2_45_05 + m[A35]*Det2_45_04; double Det3_345_123 = m[A31]*Det2_45_23 - m[A32]*Det2_45_13 + m[A33]*Det2_45_12; double Det3_345_124 = m[A31]*Det2_45_24 - m[A32]*Det2_45_14 + m[A34]*Det2_45_12; double Det3_345_125 = m[A31]*Det2_45_25 - m[A32]*Det2_45_15 + m[A35]*Det2_45_12; double Det3_345_134 = m[A31]*Det2_45_34 - m[A33]*Det2_45_14 + m[A34]*Det2_45_13; double Det3_345_135 = m[A31]*Det2_45_35 - m[A33]*Det2_45_15 + m[A35]*Det2_45_13; double Det3_345_145 = m[A31]*Det2_45_45 - m[A34]*Det2_45_15 + m[A35]*Det2_45_14; double Det3_345_234 = m[A32]*Det2_45_34 - m[A33]*Det2_45_24 + m[A34]*Det2_45_23; double Det3_345_235 = m[A32]*Det2_45_35 - m[A33]*Det2_45_25 + m[A35]*Det2_45_23; double Det3_345_245 = m[A32]*Det2_45_45 - m[A34]*Det2_45_25 + m[A35]*Det2_45_24; double Det3_345_345 = m[A33]*Det2_45_45 - m[A34]*Det2_45_35 + m[A35]*Det2_45_34; // Find all NECESSARY 4x4 dets: (55 of them) double Det4_1234_0123 = m[A10]*Det3_234_123 - m[A11]*Det3_234_023 + m[A12]*Det3_234_013 - m[A13]*Det3_234_012; double Det4_1234_0124 = m[A10]*Det3_234_124 - m[A11]*Det3_234_024 + m[A12]*Det3_234_014 - m[A14]*Det3_234_012; double Det4_1234_0134 = m[A10]*Det3_234_134 - m[A11]*Det3_234_034 + m[A13]*Det3_234_014 - m[A14]*Det3_234_013; double Det4_1234_0234 = m[A10]*Det3_234_234 - m[A12]*Det3_234_034 + m[A13]*Det3_234_024 - m[A14]*Det3_234_023; double Det4_1234_1234 = m[A11]*Det3_234_234 - m[A12]*Det3_234_134 + m[A13]*Det3_234_124 - m[A14]*Det3_234_123; double Det4_1235_0123 = m[A10]*Det3_235_123 - m[A11]*Det3_235_023 + m[A12]*Det3_235_013 - m[A13]*Det3_235_012; double Det4_1235_0124 = m[A10]*Det3_235_124 - m[A11]*Det3_235_024 + m[A12]*Det3_235_014 - m[A14]*Det3_235_012; double Det4_1235_0125 = m[A10]*Det3_235_125 - m[A11]*Det3_235_025 + m[A12]*Det3_235_015 - m[A15]*Det3_235_012; double Det4_1235_0134 = m[A10]*Det3_235_134 - m[A11]*Det3_235_034 + m[A13]*Det3_235_014 - m[A14]*Det3_235_013; double Det4_1235_0135 = m[A10]*Det3_235_135 - m[A11]*Det3_235_035 + m[A13]*Det3_235_015 - m[A15]*Det3_235_013; double Det4_1235_0234 = m[A10]*Det3_235_234 - m[A12]*Det3_235_034 + m[A13]*Det3_235_024 - m[A14]*Det3_235_023; double Det4_1235_0235 = m[A10]*Det3_235_235 - m[A12]*Det3_235_035 + m[A13]*Det3_235_025 - m[A15]*Det3_235_023; double Det4_1235_1234 = m[A11]*Det3_235_234 - m[A12]*Det3_235_134 + m[A13]*Det3_235_124 - m[A14]*Det3_235_123; double Det4_1235_1235 = m[A11]*Det3_235_235 - m[A12]*Det3_235_135 + m[A13]*Det3_235_125 - m[A15]*Det3_235_123; double Det4_1245_0123 = m[A10]*Det3_245_123 - m[A11]*Det3_245_023 + m[A12]*Det3_245_013 - m[A13]*Det3_245_012; double Det4_1245_0124 = m[A10]*Det3_245_124 - m[A11]*Det3_245_024 + m[A12]*Det3_245_014 - m[A14]*Det3_245_012; double Det4_1245_0125 = m[A10]*Det3_245_125 - m[A11]*Det3_245_025 + m[A12]*Det3_245_015 - m[A15]*Det3_245_012; double Det4_1245_0134 = m[A10]*Det3_245_134 - m[A11]*Det3_245_034 + m[A13]*Det3_245_014 - m[A14]*Det3_245_013; double Det4_1245_0135 = m[A10]*Det3_245_135 - m[A11]*Det3_245_035 + m[A13]*Det3_245_015 - m[A15]*Det3_245_013; double Det4_1245_0145 = m[A10]*Det3_245_145 - m[A11]*Det3_245_045 + m[A14]*Det3_245_015 - m[A15]*Det3_245_014; double Det4_1245_0234 = m[A10]*Det3_245_234 - m[A12]*Det3_245_034 + m[A13]*Det3_245_024 - m[A14]*Det3_245_023; double Det4_1245_0235 = m[A10]*Det3_245_235 - m[A12]*Det3_245_035 + m[A13]*Det3_245_025 - m[A15]*Det3_245_023; double Det4_1245_0245 = m[A10]*Det3_245_245 - m[A12]*Det3_245_045 + m[A14]*Det3_245_025 - m[A15]*Det3_245_024; double Det4_1245_1234 = m[A11]*Det3_245_234 - m[A12]*Det3_245_134 + m[A13]*Det3_245_124 - m[A14]*Det3_245_123; double Det4_1245_1235 = m[A11]*Det3_245_235 - m[A12]*Det3_245_135 + m[A13]*Det3_245_125 - m[A15]*Det3_245_123; double Det4_1245_1245 = m[A11]*Det3_245_245 - m[A12]*Det3_245_145 + m[A14]*Det3_245_125 - m[A15]*Det3_245_124; double Det4_1345_0123 = m[A10]*Det3_345_123 - m[A11]*Det3_345_023 + m[A12]*Det3_345_013 - m[A13]*Det3_345_012; double Det4_1345_0124 = m[A10]*Det3_345_124 - m[A11]*Det3_345_024 + m[A12]*Det3_345_014 - m[A14]*Det3_345_012; double Det4_1345_0125 = m[A10]*Det3_345_125 - m[A11]*Det3_345_025 + m[A12]*Det3_345_015 - m[A15]*Det3_345_012; double Det4_1345_0134 = m[A10]*Det3_345_134 - m[A11]*Det3_345_034 + m[A13]*Det3_345_014 - m[A14]*Det3_345_013; double Det4_1345_0135 = m[A10]*Det3_345_135 - m[A11]*Det3_345_035 + m[A13]*Det3_345_015 - m[A15]*Det3_345_013; double Det4_1345_0145 = m[A10]*Det3_345_145 - m[A11]*Det3_345_045 + m[A14]*Det3_345_015 - m[A15]*Det3_345_014; double Det4_1345_0234 = m[A10]*Det3_345_234 - m[A12]*Det3_345_034 + m[A13]*Det3_345_024 - m[A14]*Det3_345_023; double Det4_1345_0235 = m[A10]*Det3_345_235 - m[A12]*Det3_345_035 + m[A13]*Det3_345_025 - m[A15]*Det3_345_023; double Det4_1345_0245 = m[A10]*Det3_345_245 - m[A12]*Det3_345_045 + m[A14]*Det3_345_025 - m[A15]*Det3_345_024; double Det4_1345_0345 = m[A10]*Det3_345_345 - m[A13]*Det3_345_045 + m[A14]*Det3_345_035 - m[A15]*Det3_345_034; double Det4_1345_1234 = m[A11]*Det3_345_234 - m[A12]*Det3_345_134 + m[A13]*Det3_345_124 - m[A14]*Det3_345_123; double Det4_1345_1235 = m[A11]*Det3_345_235 - m[A12]*Det3_345_135 + m[A13]*Det3_345_125 - m[A15]*Det3_345_123; double Det4_1345_1245 = m[A11]*Det3_345_245 - m[A12]*Det3_345_145 + m[A14]*Det3_345_125 - m[A15]*Det3_345_124; double Det4_1345_1345 = m[A11]*Det3_345_345 - m[A13]*Det3_345_145 + m[A14]*Det3_345_135 - m[A15]*Det3_345_134; double Det4_2345_0123 = m[A20]*Det3_345_123 - m[A21]*Det3_345_023 + m[A22]*Det3_345_013 - m[A23]*Det3_345_012; double Det4_2345_0124 = m[A20]*Det3_345_124 - m[A21]*Det3_345_024 + m[A22]*Det3_345_014 - m[A24]*Det3_345_012; double Det4_2345_0125 = m[A20]*Det3_345_125 - m[A21]*Det3_345_025 + m[A22]*Det3_345_015 - m[A25]*Det3_345_012; double Det4_2345_0134 = m[A20]*Det3_345_134 - m[A21]*Det3_345_034 + m[A23]*Det3_345_014 - m[A24]*Det3_345_013; double Det4_2345_0135 = m[A20]*Det3_345_135 - m[A21]*Det3_345_035 + m[A23]*Det3_345_015 - m[A25]*Det3_345_013; double Det4_2345_0145 = m[A20]*Det3_345_145 - m[A21]*Det3_345_045 + m[A24]*Det3_345_015 - m[A25]*Det3_345_014; double Det4_2345_0234 = m[A20]*Det3_345_234 - m[A22]*Det3_345_034 + m[A23]*Det3_345_024 - m[A24]*Det3_345_023; double Det4_2345_0235 = m[A20]*Det3_345_235 - m[A22]*Det3_345_035 + m[A23]*Det3_345_025 - m[A25]*Det3_345_023; double Det4_2345_0245 = m[A20]*Det3_345_245 - m[A22]*Det3_345_045 + m[A24]*Det3_345_025 - m[A25]*Det3_345_024; double Det4_2345_0345 = m[A20]*Det3_345_345 - m[A23]*Det3_345_045 + m[A24]*Det3_345_035 - m[A25]*Det3_345_034; double Det4_2345_1234 = m[A21]*Det3_345_234 - m[A22]*Det3_345_134 + m[A23]*Det3_345_124 - m[A24]*Det3_345_123; double Det4_2345_1235 = m[A21]*Det3_345_235 - m[A22]*Det3_345_135 + m[A23]*Det3_345_125 - m[A25]*Det3_345_123; double Det4_2345_1245 = m[A21]*Det3_345_245 - m[A22]*Det3_345_145 + m[A24]*Det3_345_125 - m[A25]*Det3_345_124; double Det4_2345_1345 = m[A21]*Det3_345_345 - m[A23]*Det3_345_145 + m[A24]*Det3_345_135 - m[A25]*Det3_345_134; double Det4_2345_2345 = m[A22]*Det3_345_345 - m[A23]*Det3_345_245 + m[A24]*Det3_345_235 - m[A25]*Det3_345_234; // Find all NECESSARY 5x5 dets: (19 of them) double Det5_01234_01234 = m[A00]*Det4_1234_1234 - m[A01]*Det4_1234_0234 + m[A02]*Det4_1234_0134 - m[A03]*Det4_1234_0124 + m[A04]*Det4_1234_0123; double Det5_01235_01234 = m[A00]*Det4_1235_1234 - m[A01]*Det4_1235_0234 + m[A02]*Det4_1235_0134 - m[A03]*Det4_1235_0124 + m[A04]*Det4_1235_0123; double Det5_01235_01235 = m[A00]*Det4_1235_1235 - m[A01]*Det4_1235_0235 + m[A02]*Det4_1235_0135 - m[A03]*Det4_1235_0125 + m[A05]*Det4_1235_0123; double Det5_01245_01234 = m[A00]*Det4_1245_1234 - m[A01]*Det4_1245_0234 + m[A02]*Det4_1245_0134 - m[A03]*Det4_1245_0124 + m[A04]*Det4_1245_0123; double Det5_01245_01235 = m[A00]*Det4_1245_1235 - m[A01]*Det4_1245_0235 + m[A02]*Det4_1245_0135 - m[A03]*Det4_1245_0125 + m[A05]*Det4_1245_0123; double Det5_01245_01245 = m[A00]*Det4_1245_1245 - m[A01]*Det4_1245_0245 + m[A02]*Det4_1245_0145 - m[A04]*Det4_1245_0125 + m[A05]*Det4_1245_0124; double Det5_01345_01234 = m[A00]*Det4_1345_1234 - m[A01]*Det4_1345_0234 + m[A02]*Det4_1345_0134 - m[A03]*Det4_1345_0124 + m[A04]*Det4_1345_0123; double Det5_01345_01235 = m[A00]*Det4_1345_1235 - m[A01]*Det4_1345_0235 + m[A02]*Det4_1345_0135 - m[A03]*Det4_1345_0125 + m[A05]*Det4_1345_0123; double Det5_01345_01245 = m[A00]*Det4_1345_1245 - m[A01]*Det4_1345_0245 + m[A02]*Det4_1345_0145 - m[A04]*Det4_1345_0125 + m[A05]*Det4_1345_0124; double Det5_01345_01345 = m[A00]*Det4_1345_1345 - m[A01]*Det4_1345_0345 + m[A03]*Det4_1345_0145 - m[A04]*Det4_1345_0135 + m[A05]*Det4_1345_0134; double Det5_02345_01234 = m[A00]*Det4_2345_1234 - m[A01]*Det4_2345_0234 + m[A02]*Det4_2345_0134 - m[A03]*Det4_2345_0124 + m[A04]*Det4_2345_0123; double Det5_02345_01235 = m[A00]*Det4_2345_1235 - m[A01]*Det4_2345_0235 + m[A02]*Det4_2345_0135 - m[A03]*Det4_2345_0125 + m[A05]*Det4_2345_0123; double Det5_02345_01245 = m[A00]*Det4_2345_1245 - m[A01]*Det4_2345_0245 + m[A02]*Det4_2345_0145 - m[A04]*Det4_2345_0125 + m[A05]*Det4_2345_0124; double Det5_02345_01345 = m[A00]*Det4_2345_1345 - m[A01]*Det4_2345_0345 + m[A03]*Det4_2345_0145 - m[A04]*Det4_2345_0135 + m[A05]*Det4_2345_0134; double Det5_02345_02345 = m[A00]*Det4_2345_2345 - m[A02]*Det4_2345_0345 + m[A03]*Det4_2345_0245 - m[A04]*Det4_2345_0235 + m[A05]*Det4_2345_0234; double Det5_12345_01234 = m[A10]*Det4_2345_1234 - m[A11]*Det4_2345_0234 + m[A12]*Det4_2345_0134 - m[A13]*Det4_2345_0124 + m[A14]*Det4_2345_0123; double Det5_12345_01235 = m[A10]*Det4_2345_1235 - m[A11]*Det4_2345_0235 + m[A12]*Det4_2345_0135 - m[A13]*Det4_2345_0125 + m[A15]*Det4_2345_0123; double Det5_12345_01245 = m[A10]*Det4_2345_1245 - m[A11]*Det4_2345_0245 + m[A12]*Det4_2345_0145 - m[A14]*Det4_2345_0125 + m[A15]*Det4_2345_0124; double Det5_12345_01345 = m[A10]*Det4_2345_1345 - m[A11]*Det4_2345_0345 + m[A13]*Det4_2345_0145 - m[A14]*Det4_2345_0135 + m[A15]*Det4_2345_0134; double Det5_12345_02345 = m[A10]*Det4_2345_2345 - m[A12]*Det4_2345_0345 + m[A13]*Det4_2345_0245 - m[A14]*Det4_2345_0235 + m[A15]*Det4_2345_0234; double Det5_12345_12345 = m[A11]*Det4_2345_2345 - m[A12]*Det4_2345_1345 + m[A13]*Det4_2345_1245 - m[A14]*Det4_2345_1235 + m[A15]*Det4_2345_1234; // Find the determinant double det = m[A00]*Det5_12345_12345 - m[A01]*Det5_12345_02345 + m[A02]*Det5_12345_01345 - m[A03]*Det5_12345_01245 + m[A04]*Det5_12345_01235 - m[A05]*Det5_12345_01234; if ( det == 0 ) { #ifdef SINGULAR_DIAGNOSTICS std::cerr << "Kramer's rule inversion of a singular 6x6 matrix: " << *this << "\n"; #endif ifail = 1; return; } double oneOverDet = 1.0/det; double mn1OverDet = - oneOverDet; m[A00] = Det5_12345_12345*oneOverDet; m[A01] = Det5_12345_02345*mn1OverDet; m[A02] = Det5_12345_01345*oneOverDet; m[A03] = Det5_12345_01245*mn1OverDet; m[A04] = Det5_12345_01235*oneOverDet; m[A05] = Det5_12345_01234*mn1OverDet; m[A11] = Det5_02345_02345*oneOverDet; m[A12] = Det5_02345_01345*mn1OverDet; m[A13] = Det5_02345_01245*oneOverDet; m[A14] = Det5_02345_01235*mn1OverDet; m[A15] = Det5_02345_01234*oneOverDet; m[A22] = Det5_01345_01345*oneOverDet; m[A23] = Det5_01345_01245*mn1OverDet; m[A24] = Det5_01345_01235*oneOverDet; m[A25] = Det5_01345_01234*mn1OverDet; m[A33] = Det5_01245_01245*oneOverDet; m[A34] = Det5_01245_01235*mn1OverDet; m[A35] = Det5_01245_01234*oneOverDet; m[A44] = Det5_01235_01235*oneOverDet; m[A45] = Det5_01235_01234*mn1OverDet; m[A55] = Det5_01234_01234*oneOverDet; return; } void HepSymMatrix::invertCholesky5 (int & ifail) { // Invert by // // a) decomposing M = G*G^T with G lower triangular // (if M is not positive definite this will fail, leaving this unchanged) // b) inverting G to form H // c) multiplying H^T * H to get M^-1. // // If the matrix is pos. def. it is inverted and 1 is returned. // If the matrix is not pos. def. it remains unaltered and 0 is returned. double h10; // below-diagonal elements of H double h20, h21; double h30, h31, h32; double h40, h41, h42, h43; double h00, h11, h22, h33, h44; // 1/diagonal elements of G = // diagonal elements of H double g10; // below-diagonal elements of G double g20, g21; double g30, g31, g32; double g40, g41, g42, g43; ifail = 1; // We start by assuing we won't succeed... // Form G -- compute diagonal members of H directly rather than of G //------- // Scale first column by 1/sqrt(A00) h00 = m[A00]; if (h00 <= 0) return; h00 = 1.0 / sqrt(h00); g10 = m[A10] * h00; g20 = m[A20] * h00; g30 = m[A30] * h00; g40 = m[A40] * h00; // Form G11 (actually, just h11) h11 = m[A11] - (g10 * g10); if (h11 <= 0) return; h11 = 1.0 / sqrt(h11); // Subtract inter-column column dot products from rest of column 1 and // scale to get column 1 of G g21 = (m[A21] - (g10 * g20)) * h11; g31 = (m[A31] - (g10 * g30)) * h11; g41 = (m[A41] - (g10 * g40)) * h11; // Form G22 (actually, just h22) h22 = m[A22] - (g20 * g20) - (g21 * g21); if (h22 <= 0) return; h22 = 1.0 / sqrt(h22); // Subtract inter-column column dot products from rest of column 2 and // scale to get column 2 of G g32 = (m[A32] - (g20 * g30) - (g21 * g31)) * h22; g42 = (m[A42] - (g20 * g40) - (g21 * g41)) * h22; // Form G33 (actually, just h33) h33 = m[A33] - (g30 * g30) - (g31 * g31) - (g32 * g32); if (h33 <= 0) return; h33 = 1.0 / sqrt(h33); // Subtract inter-column column dot product from A43 and scale to get G43 g43 = (m[A43] - (g30 * g40) - (g31 * g41) - (g32 * g42)) * h33; // Finally form h44 - if this is possible inversion succeeds h44 = m[A44] - (g40 * g40) - (g41 * g41) - (g42 * g42) - (g43 * g43); if (h44 <= 0) return; h44 = 1.0 / sqrt(h44); // Form H = 1/G -- diagonal members of H are already correct //------------- // The order here is dictated by speed considerations h43 = -h33 * g43 * h44; h32 = -h22 * g32 * h33; h42 = -h22 * (g32 * h43 + g42 * h44); h21 = -h11 * g21 * h22; h31 = -h11 * (g21 * h32 + g31 * h33); h41 = -h11 * (g21 * h42 + g31 * h43 + g41 * h44); h10 = -h00 * g10 * h11; h20 = -h00 * (g10 * h21 + g20 * h22); h30 = -h00 * (g10 * h31 + g20 * h32 + g30 * h33); h40 = -h00 * (g10 * h41 + g20 * h42 + g30 * h43 + g40 * h44); // Change this to its inverse = H^T*H //------------------------------------ m[A00] = h00 * h00 + h10 * h10 + h20 * h20 + h30 * h30 + h40 * h40; m[A01] = h10 * h11 + h20 * h21 + h30 * h31 + h40 * h41; m[A11] = h11 * h11 + h21 * h21 + h31 * h31 + h41 * h41; m[A02] = h20 * h22 + h30 * h32 + h40 * h42; m[A12] = h21 * h22 + h31 * h32 + h41 * h42; m[A22] = h22 * h22 + h32 * h32 + h42 * h42; m[A03] = h30 * h33 + h40 * h43; m[A13] = h31 * h33 + h41 * h43; m[A23] = h32 * h33 + h42 * h43; m[A33] = h33 * h33 + h43 * h43; m[A04] = h40 * h44; m[A14] = h41 * h44; m[A24] = h42 * h44; m[A34] = h43 * h44; m[A44] = h44 * h44; ifail = 0; return; } void HepSymMatrix::invertCholesky6 (int & ifail) { // Invert by // // a) decomposing M = G*G^T with G lower triangular // (if M is not positive definite this will fail, leaving this unchanged) // b) inverting G to form H // c) multiplying H^T * H to get M^-1. // // If the matrix is pos. def. it is inverted and 1 is returned. // If the matrix is not pos. def. it remains unaltered and 0 is returned. double h10; // below-diagonal elements of H double h20, h21; double h30, h31, h32; double h40, h41, h42, h43; double h50, h51, h52, h53, h54; double h00, h11, h22, h33, h44, h55; // 1/diagonal elements of G = // diagonal elements of H double g10; // below-diagonal elements of G double g20, g21; double g30, g31, g32; double g40, g41, g42, g43; double g50, g51, g52, g53, g54; ifail = 1; // We start by assuing we won't succeed... // Form G -- compute diagonal members of H directly rather than of G //------- // Scale first column by 1/sqrt(A00) h00 = m[A00]; if (h00 <= 0) return; h00 = 1.0 / sqrt(h00); g10 = m[A10] * h00; g20 = m[A20] * h00; g30 = m[A30] * h00; g40 = m[A40] * h00; g50 = m[A50] * h00; // Form G11 (actually, just h11) h11 = m[A11] - (g10 * g10); if (h11 <= 0) return; h11 = 1.0 / sqrt(h11); // Subtract inter-column column dot products from rest of column 1 and // scale to get column 1 of G g21 = (m[A21] - (g10 * g20)) * h11; g31 = (m[A31] - (g10 * g30)) * h11; g41 = (m[A41] - (g10 * g40)) * h11; g51 = (m[A51] - (g10 * g50)) * h11; // Form G22 (actually, just h22) h22 = m[A22] - (g20 * g20) - (g21 * g21); if (h22 <= 0) return; h22 = 1.0 / sqrt(h22); // Subtract inter-column column dot products from rest of column 2 and // scale to get column 2 of G g32 = (m[A32] - (g20 * g30) - (g21 * g31)) * h22; g42 = (m[A42] - (g20 * g40) - (g21 * g41)) * h22; g52 = (m[A52] - (g20 * g50) - (g21 * g51)) * h22; // Form G33 (actually, just h33) h33 = m[A33] - (g30 * g30) - (g31 * g31) - (g32 * g32); if (h33 <= 0) return; h33 = 1.0 / sqrt(h33); // Subtract inter-column column dot products from rest of column 3 and // scale to get column 3 of G g43 = (m[A43] - (g30 * g40) - (g31 * g41) - (g32 * g42)) * h33; g53 = (m[A53] - (g30 * g50) - (g31 * g51) - (g32 * g52)) * h33; // Form G44 (actually, just h44) h44 = m[A44] - (g40 * g40) - (g41 * g41) - (g42 * g42) - (g43 * g43); if (h44 <= 0) return; h44 = 1.0 / sqrt(h44); // Subtract inter-column column dot product from M54 and scale to get G54 g54 = (m[A54] - (g40 * g50) - (g41 * g51) - (g42 * g52) - (g43 * g53)) * h44; // Finally form h55 - if this is possible inversion succeeds h55 = m[A55] - (g50*g50) - (g51*g51) - (g52*g52) - (g53*g53) - (g54*g54); if (h55 <= 0) return; h55 = 1.0 / sqrt(h55); // Form H = 1/G -- diagonal members of H are already correct //------------- // The order here is dictated by speed considerations h54 = -h44 * g54 * h55; h43 = -h33 * g43 * h44; h53 = -h33 * (g43 * h54 + g53 * h55); h32 = -h22 * g32 * h33; h42 = -h22 * (g32 * h43 + g42 * h44); h52 = -h22 * (g32 * h53 + g42 * h54 + g52 * h55); h21 = -h11 * g21 * h22; h31 = -h11 * (g21 * h32 + g31 * h33); h41 = -h11 * (g21 * h42 + g31 * h43 + g41 * h44); h51 = -h11 * (g21 * h52 + g31 * h53 + g41 * h54 + g51 * h55); h10 = -h00 * g10 * h11; h20 = -h00 * (g10 * h21 + g20 * h22); h30 = -h00 * (g10 * h31 + g20 * h32 + g30 * h33); h40 = -h00 * (g10 * h41 + g20 * h42 + g30 * h43 + g40 * h44); h50 = -h00 * (g10 * h51 + g20 * h52 + g30 * h53 + g40 * h54 + g50 * h55); // Change this to its inverse = H^T*H //------------------------------------ m[A00] = h00 * h00 + h10 * h10 + h20 * h20 + h30 * h30 + h40 * h40 + h50*h50; m[A01] = h10 * h11 + h20 * h21 + h30 * h31 + h40 * h41 + h50 * h51; m[A11] = h11 * h11 + h21 * h21 + h31 * h31 + h41 * h41 + h51 * h51; m[A02] = h20 * h22 + h30 * h32 + h40 * h42 + h50 * h52; m[A12] = h21 * h22 + h31 * h32 + h41 * h42 + h51 * h52; m[A22] = h22 * h22 + h32 * h32 + h42 * h42 + h52 * h52; m[A03] = h30 * h33 + h40 * h43 + h50 * h53; m[A13] = h31 * h33 + h41 * h43 + h51 * h53; m[A23] = h32 * h33 + h42 * h43 + h52 * h53; m[A33] = h33 * h33 + h43 * h43 + h53 * h53; m[A04] = h40 * h44 + h50 * h54; m[A14] = h41 * h44 + h51 * h54; m[A24] = h42 * h44 + h52 * h54; m[A34] = h43 * h44 + h53 * h54; m[A44] = h44 * h44 + h54 * h54; m[A05] = h50 * h55; m[A15] = h51 * h55; m[A25] = h52 * h55; m[A35] = h53 * h55; m[A45] = h54 * h55; m[A55] = h55 * h55; ifail = 0; return; } void HepSymMatrix::invert4 (int & ifail) { ifail = 0; // Find all NECESSARY 2x2 dets: (14 of them) double Det2_12_01 = m[A10]*m[A21] - m[A11]*m[A20]; double Det2_12_02 = m[A10]*m[A22] - m[A12]*m[A20]; double Det2_12_12 = m[A11]*m[A22] - m[A12]*m[A21]; double Det2_13_01 = m[A10]*m[A31] - m[A11]*m[A30]; double Det2_13_02 = m[A10]*m[A32] - m[A12]*m[A30]; double Det2_13_03 = m[A10]*m[A33] - m[A13]*m[A30]; double Det2_13_12 = m[A11]*m[A32] - m[A12]*m[A31]; double Det2_13_13 = m[A11]*m[A33] - m[A13]*m[A31]; double Det2_23_01 = m[A20]*m[A31] - m[A21]*m[A30]; double Det2_23_02 = m[A20]*m[A32] - m[A22]*m[A30]; double Det2_23_03 = m[A20]*m[A33] - m[A23]*m[A30]; double Det2_23_12 = m[A21]*m[A32] - m[A22]*m[A31]; double Det2_23_13 = m[A21]*m[A33] - m[A23]*m[A31]; double Det2_23_23 = m[A22]*m[A33] - m[A23]*m[A32]; // Find all NECESSARY 3x3 dets: (10 of them) double Det3_012_012 = m[A00]*Det2_12_12 - m[A01]*Det2_12_02 + m[A02]*Det2_12_01; double Det3_013_012 = m[A00]*Det2_13_12 - m[A01]*Det2_13_02 + m[A02]*Det2_13_01; double Det3_013_013 = m[A00]*Det2_13_13 - m[A01]*Det2_13_03 + m[A03]*Det2_13_01; double Det3_023_012 = m[A00]*Det2_23_12 - m[A01]*Det2_23_02 + m[A02]*Det2_23_01; double Det3_023_013 = m[A00]*Det2_23_13 - m[A01]*Det2_23_03 + m[A03]*Det2_23_01; double Det3_023_023 = m[A00]*Det2_23_23 - m[A02]*Det2_23_03 + m[A03]*Det2_23_02; double Det3_123_012 = m[A10]*Det2_23_12 - m[A11]*Det2_23_02 + m[A12]*Det2_23_01; double Det3_123_013 = m[A10]*Det2_23_13 - m[A11]*Det2_23_03 + m[A13]*Det2_23_01; double Det3_123_023 = m[A10]*Det2_23_23 - m[A12]*Det2_23_03 + m[A13]*Det2_23_02; double Det3_123_123 = m[A11]*Det2_23_23 - m[A12]*Det2_23_13 + m[A13]*Det2_23_12; // Find the 4x4 det: double det = m[A00]*Det3_123_123 - m[A01]*Det3_123_023 + m[A02]*Det3_123_013 - m[A03]*Det3_123_012; if ( det == 0 ) { #ifdef SINGULAR_DIAGNOSTICS std::cerr << "Kramer's rule inversion of a singular 4x4 matrix: " << *this << "\n"; #endif ifail = 1; return; } double oneOverDet = 1.0/det; double mn1OverDet = - oneOverDet; m[A00] = Det3_123_123 * oneOverDet; m[A01] = Det3_123_023 * mn1OverDet; m[A02] = Det3_123_013 * oneOverDet; m[A03] = Det3_123_012 * mn1OverDet; m[A11] = Det3_023_023 * oneOverDet; m[A12] = Det3_023_013 * mn1OverDet; m[A13] = Det3_023_012 * oneOverDet; m[A22] = Det3_013_013 * oneOverDet; m[A23] = Det3_013_012 * mn1OverDet; m[A33] = Det3_012_012 * oneOverDet; return; } void HepSymMatrix::invertHaywood4 (int & ifail) { invert4(ifail); // For the 4x4 case, the method we use for invert is already // the Haywood method. } } // namespace CLHEP clhep-2.1.4.1.orig/Matrix/src/CMakeLists.txt0000644000175000017500000000033211606714767017205 0ustar olesoles clhep_build_library( Matrix DiagMatrix.cc GenMatrix.cc Matrix.cc MatrixEqRotation.cc MatrixInvert.cc MatrixLinear.cc SymMatrix.cc SymMatrixInvert.cc Vector.cc ) clhep-2.1.4.1.orig/Matrix/src/MatrixInvert.cc0000755000175000017500000012044410233764254017411 0ustar olesoles// -*- C++ -*- // // This file is a part of the CLHEP - a Class Library for High Energy Physics. // // This software written by Mark Fischler and Steven Haywood // #ifdef GNUPRAGMA #pragma implementation #endif #include #include "CLHEP/Matrix/defs.h" #include "CLHEP/Matrix/Matrix.h" namespace CLHEP { // Aij are indices for a 6x6 matrix. // Mij are indices for a 5x5 matrix. // Fij are indices for a 4x4 matrix. #define A00 0 #define A01 1 #define A02 2 #define A03 3 #define A04 4 #define A05 5 #define A10 6 #define A11 7 #define A12 8 #define A13 9 #define A14 10 #define A15 11 #define A20 12 #define A21 13 #define A22 14 #define A23 15 #define A24 16 #define A25 17 #define A30 18 #define A31 19 #define A32 20 #define A33 21 #define A34 22 #define A35 23 #define A40 24 #define A41 25 #define A42 26 #define A43 27 #define A44 28 #define A45 29 #define A50 30 #define A51 31 #define A52 32 #define A53 33 #define A54 34 #define A55 35 #define M00 0 #define M01 1 #define M02 2 #define M03 3 #define M04 4 #define M10 5 #define M11 6 #define M12 7 #define M13 8 #define M14 9 #define M20 10 #define M21 11 #define M22 12 #define M23 13 #define M24 14 #define M30 15 #define M31 16 #define M32 17 #define M33 18 #define M34 19 #define M40 20 #define M41 21 #define M42 22 #define M43 23 #define M44 24 #define F00 0 #define F01 1 #define F02 2 #define F03 3 #define F10 4 #define F11 5 #define F12 6 #define F13 7 #define F20 8 #define F21 9 #define F22 10 #define F23 11 #define F30 12 #define F31 13 #define F32 14 #define F33 15 void HepMatrix::invertHaywood4 (int & ifail) { ifail = 0; // Find all NECESSARY 2x2 dets: (18 of them) double Det2_12_01 = m[F10]*m[F21] - m[F11]*m[F20]; double Det2_12_02 = m[F10]*m[F22] - m[F12]*m[F20]; double Det2_12_03 = m[F10]*m[F23] - m[F13]*m[F20]; // double Det2_12_13 = m[F11]*m[F23] - m[F13]*m[F21]; // double Det2_12_23 = m[F12]*m[F23] - m[F13]*m[F22]; // double Det2_12_12 = m[F11]*m[F22] - m[F12]*m[F21]; double Det2_13_01 = m[F10]*m[F31] - m[F11]*m[F30]; double Det2_13_02 = m[F10]*m[F32] - m[F12]*m[F30]; double Det2_13_03 = m[F10]*m[F33] - m[F13]*m[F30]; double Det2_13_12 = m[F11]*m[F32] - m[F12]*m[F31]; double Det2_13_13 = m[F11]*m[F33] - m[F13]*m[F31]; double Det2_13_23 = m[F12]*m[F33] - m[F13]*m[F32]; // double Det2_23_01 = m[F20]*m[F31] - m[F21]*m[F30]; double Det2_23_02 = m[F20]*m[F32] - m[F22]*m[F30]; double Det2_23_03 = m[F20]*m[F33] - m[F23]*m[F30]; double Det2_23_12 = m[F21]*m[F32] - m[F22]*m[F31]; double Det2_23_13 = m[F21]*m[F33] - m[F23]*m[F31]; double Det2_23_23 = m[F22]*m[F33] - m[F23]*m[F32]; // Find all NECESSARY 3x3 dets: (16 of them) double Det3_012_012 = m[F00]*Det2_12_12 - m[F01]*Det2_12_02 + m[F02]*Det2_12_01; double Det3_012_013 = m[F00]*Det2_12_13 - m[F01]*Det2_12_03 + m[F03]*Det2_12_01; // double Det3_012_023 = m[F00]*Det2_12_23 - m[F02]*Det2_12_03 + m[F03]*Det2_12_02; // double Det3_012_123 = m[F01]*Det2_12_23 - m[F02]*Det2_12_13 + m[F03]*Det2_12_12; // double Det3_013_012 = m[F00]*Det2_13_12 - m[F01]*Det2_13_02 + m[F02]*Det2_13_01; double Det3_013_013 = m[F00]*Det2_13_13 - m[F01]*Det2_13_03 + m[F03]*Det2_13_01; double Det3_013_023 = m[F00]*Det2_13_23 - m[F02]*Det2_13_03 + m[F03]*Det2_13_02; // double Det3_013_123 = m[F01]*Det2_13_23 - m[F02]*Det2_13_13 + m[F03]*Det2_13_12; // double Det3_023_012 = m[F00]*Det2_23_12 - m[F01]*Det2_23_02 + m[F02]*Det2_23_01; double Det3_023_013 = m[F00]*Det2_23_13 - m[F01]*Det2_23_03 + m[F03]*Det2_23_01; double Det3_023_023 = m[F00]*Det2_23_23 - m[F02]*Det2_23_03 + m[F03]*Det2_23_02; double Det3_023_123 = m[F01]*Det2_23_23 - m[F02]*Det2_23_13 + m[F03]*Det2_23_12; // double Det3_123_012 = m[F10]*Det2_23_12 - m[F11]*Det2_23_02 + m[F12]*Det2_23_01; double Det3_123_013 = m[F10]*Det2_23_13 - m[F11]*Det2_23_03 + m[F13]*Det2_23_01; double Det3_123_023 = m[F10]*Det2_23_23 - m[F12]*Det2_23_03 + m[F13]*Det2_23_02; double Det3_123_123 = m[F11]*Det2_23_23 - m[F12]*Det2_23_13 + m[F13]*Det2_23_12; // Find the 4x4 det: double det = m[F00]*Det3_123_123 - m[F01]*Det3_123_023 + m[F02]*Det3_123_013 - m[F03]*Det3_123_012; if ( det == 0 ) { #ifdef SINGULAR_DIAGNOSTICS std::cerr << "Kramer's rule inversion of a singular 4x4 matrix: " << *this << "\n"; #endif ifail = 1; return; } double oneOverDet = 1.0/det; double mn1OverDet = - oneOverDet; m[F00] = Det3_123_123 * oneOverDet; m[F01] = Det3_023_123 * mn1OverDet; m[F02] = Det3_013_123 * oneOverDet; m[F03] = Det3_012_123 * mn1OverDet; m[F10] = Det3_123_023 * mn1OverDet; m[F11] = Det3_023_023 * oneOverDet; m[F12] = Det3_013_023 * mn1OverDet; m[F13] = Det3_012_023 * oneOverDet; m[F20] = Det3_123_013 * oneOverDet; m[F21] = Det3_023_013 * mn1OverDet; m[F22] = Det3_013_013 * oneOverDet; m[F23] = Det3_012_013 * mn1OverDet; m[F30] = Det3_123_012 * mn1OverDet; m[F31] = Det3_023_012 * oneOverDet; m[F32] = Det3_013_012 * mn1OverDet; m[F33] = Det3_012_012 * oneOverDet; return; } void HepMatrix::invertHaywood5 (int & ifail) { ifail = 0; // Find all NECESSARY 2x2 dets: (30 of them) double Det2_23_01 = m[M20]*m[M31] - m[M21]*m[M30]; double Det2_23_02 = m[M20]*m[M32] - m[M22]*m[M30]; double Det2_23_03 = m[M20]*m[M33] - m[M23]*m[M30]; double Det2_23_04 = m[M20]*m[M34] - m[M24]*m[M30]; double Det2_23_12 = m[M21]*m[M32] - m[M22]*m[M31]; // double Det2_23_13 = m[M21]*m[M33] - m[M23]*m[M31]; double Det2_23_14 = m[M21]*m[M34] - m[M24]*m[M31]; // double Det2_23_23 = m[M22]*m[M33] - m[M23]*m[M32]; double Det2_23_24 = m[M22]*m[M34] - m[M24]*m[M32]; // double Det2_23_34 = m[M23]*m[M34] - m[M24]*m[M33]; // double Det2_24_01 = m[M20]*m[M41] - m[M21]*m[M40]; double Det2_24_02 = m[M20]*m[M42] - m[M22]*m[M40]; double Det2_24_03 = m[M20]*m[M43] - m[M23]*m[M40]; double Det2_24_04 = m[M20]*m[M44] - m[M24]*m[M40]; double Det2_24_12 = m[M21]*m[M42] - m[M22]*m[M41]; double Det2_24_13 = m[M21]*m[M43] - m[M23]*m[M41]; double Det2_24_14 = m[M21]*m[M44] - m[M24]*m[M41]; double Det2_24_23 = m[M22]*m[M43] - m[M23]*m[M42]; double Det2_24_24 = m[M22]*m[M44] - m[M24]*m[M42]; double Det2_24_34 = m[M23]*m[M44] - m[M24]*m[M43]; // double Det2_34_01 = m[M30]*m[M41] - m[M31]*m[M40]; double Det2_34_02 = m[M30]*m[M42] - m[M32]*m[M40]; double Det2_34_03 = m[M30]*m[M43] - m[M33]*m[M40]; double Det2_34_04 = m[M30]*m[M44] - m[M34]*m[M40]; double Det2_34_12 = m[M31]*m[M42] - m[M32]*m[M41]; double Det2_34_13 = m[M31]*m[M43] - m[M33]*m[M41]; double Det2_34_14 = m[M31]*m[M44] - m[M34]*m[M41]; double Det2_34_23 = m[M32]*m[M43] - m[M33]*m[M42]; double Det2_34_24 = m[M32]*m[M44] - m[M34]*m[M42]; double Det2_34_34 = m[M33]*m[M44] - m[M34]*m[M43]; // Find all NECESSARY 3x3 dets: (40 of them) double Det3_123_012 = m[M10]*Det2_23_12 - m[M11]*Det2_23_02 + m[M12]*Det2_23_01; double Det3_123_013 = m[M10]*Det2_23_13 - m[M11]*Det2_23_03 + m[M13]*Det2_23_01; double Det3_123_014 = m[M10]*Det2_23_14 - m[M11]*Det2_23_04 + m[M14]*Det2_23_01; // double Det3_123_023 = m[M10]*Det2_23_23 - m[M12]*Det2_23_03 + m[M13]*Det2_23_02; double Det3_123_024 = m[M10]*Det2_23_24 - m[M12]*Det2_23_04 + m[M14]*Det2_23_02; // double Det3_123_034 = m[M10]*Det2_23_34 - m[M13]*Det2_23_04 + m[M14]*Det2_23_03; // double Det3_123_123 = m[M11]*Det2_23_23 - m[M12]*Det2_23_13 + m[M13]*Det2_23_12; double Det3_123_124 = m[M11]*Det2_23_24 - m[M12]*Det2_23_14 + m[M14]*Det2_23_12; // double Det3_123_134 = m[M11]*Det2_23_34 - m[M13]*Det2_23_14 + m[M14]*Det2_23_13; // double Det3_123_234 = m[M12]*Det2_23_34 - m[M13]*Det2_23_24 + m[M14]*Det2_23_23; // double Det3_124_012 = m[M10]*Det2_24_12 - m[M11]*Det2_24_02 + m[M12]*Det2_24_01; double Det3_124_013 = m[M10]*Det2_24_13 - m[M11]*Det2_24_03 + m[M13]*Det2_24_01; double Det3_124_014 = m[M10]*Det2_24_14 - m[M11]*Det2_24_04 + m[M14]*Det2_24_01; double Det3_124_023 = m[M10]*Det2_24_23 - m[M12]*Det2_24_03 + m[M13]*Det2_24_02; double Det3_124_024 = m[M10]*Det2_24_24 - m[M12]*Det2_24_04 + m[M14]*Det2_24_02; double Det3_124_034 = m[M10]*Det2_24_34 - m[M13]*Det2_24_04 + m[M14]*Det2_24_03; // double Det3_124_123 = m[M11]*Det2_24_23 - m[M12]*Det2_24_13 + m[M13]*Det2_24_12; double Det3_124_124 = m[M11]*Det2_24_24 - m[M12]*Det2_24_14 + m[M14]*Det2_24_12; double Det3_124_134 = m[M11]*Det2_24_34 - m[M13]*Det2_24_14 + m[M14]*Det2_24_13; // double Det3_124_234 = m[M12]*Det2_24_34 - m[M13]*Det2_24_24 + m[M14]*Det2_24_23; // double Det3_134_012 = m[M10]*Det2_34_12 - m[M11]*Det2_34_02 + m[M12]*Det2_34_01; double Det3_134_013 = m[M10]*Det2_34_13 - m[M11]*Det2_34_03 + m[M13]*Det2_34_01; double Det3_134_014 = m[M10]*Det2_34_14 - m[M11]*Det2_34_04 + m[M14]*Det2_34_01; double Det3_134_023 = m[M10]*Det2_34_23 - m[M12]*Det2_34_03 + m[M13]*Det2_34_02; double Det3_134_024 = m[M10]*Det2_34_24 - m[M12]*Det2_34_04 + m[M14]*Det2_34_02; double Det3_134_034 = m[M10]*Det2_34_34 - m[M13]*Det2_34_04 + m[M14]*Det2_34_03; double Det3_134_123 = m[M11]*Det2_34_23 - m[M12]*Det2_34_13 + m[M13]*Det2_34_12; double Det3_134_124 = m[M11]*Det2_34_24 - m[M12]*Det2_34_14 + m[M14]*Det2_34_12; double Det3_134_134 = m[M11]*Det2_34_34 - m[M13]*Det2_34_14 + m[M14]*Det2_34_13; double Det3_134_234 = m[M12]*Det2_34_34 - m[M13]*Det2_34_24 + m[M14]*Det2_34_23; // double Det3_234_012 = m[M20]*Det2_34_12 - m[M21]*Det2_34_02 + m[M22]*Det2_34_01; double Det3_234_013 = m[M20]*Det2_34_13 - m[M21]*Det2_34_03 + m[M23]*Det2_34_01; double Det3_234_014 = m[M20]*Det2_34_14 - m[M21]*Det2_34_04 + m[M24]*Det2_34_01; double Det3_234_023 = m[M20]*Det2_34_23 - m[M22]*Det2_34_03 + m[M23]*Det2_34_02; double Det3_234_024 = m[M20]*Det2_34_24 - m[M22]*Det2_34_04 + m[M24]*Det2_34_02; double Det3_234_034 = m[M20]*Det2_34_34 - m[M23]*Det2_34_04 + m[M24]*Det2_34_03; double Det3_234_123 = m[M21]*Det2_34_23 - m[M22]*Det2_34_13 + m[M23]*Det2_34_12; double Det3_234_124 = m[M21]*Det2_34_24 - m[M22]*Det2_34_14 + m[M24]*Det2_34_12; double Det3_234_134 = m[M21]*Det2_34_34 - m[M23]*Det2_34_14 + m[M24]*Det2_34_13; double Det3_234_234 = m[M22]*Det2_34_34 - m[M23]*Det2_34_24 + m[M24]*Det2_34_23; // Find all NECESSARY 4x4 dets: (25 of them) double Det4_0123_0123 = m[M00]*Det3_123_123 - m[M01]*Det3_123_023 + m[M02]*Det3_123_013 - m[M03]*Det3_123_012; double Det4_0123_0124 = m[M00]*Det3_123_124 - m[M01]*Det3_123_024 + m[M02]*Det3_123_014 - m[M04]*Det3_123_012; // double Det4_0123_0134 = m[M00]*Det3_123_134 - m[M01]*Det3_123_034 + m[M03]*Det3_123_014 - m[M04]*Det3_123_013; // double Det4_0123_0234 = m[M00]*Det3_123_234 - m[M02]*Det3_123_034 + m[M03]*Det3_123_024 - m[M04]*Det3_123_023; // double Det4_0123_1234 = m[M01]*Det3_123_234 - m[M02]*Det3_123_134 + m[M03]*Det3_123_124 - m[M04]*Det3_123_123; // double Det4_0124_0123 = m[M00]*Det3_124_123 - m[M01]*Det3_124_023 + m[M02]*Det3_124_013 - m[M03]*Det3_124_012; double Det4_0124_0124 = m[M00]*Det3_124_124 - m[M01]*Det3_124_024 + m[M02]*Det3_124_014 - m[M04]*Det3_124_012; double Det4_0124_0134 = m[M00]*Det3_124_134 - m[M01]*Det3_124_034 + m[M03]*Det3_124_014 - m[M04]*Det3_124_013; // double Det4_0124_0234 = m[M00]*Det3_124_234 - m[M02]*Det3_124_034 + m[M03]*Det3_124_024 - m[M04]*Det3_124_023; // double Det4_0124_1234 = m[M01]*Det3_124_234 - m[M02]*Det3_124_134 + m[M03]*Det3_124_124 - m[M04]*Det3_124_123; // double Det4_0134_0123 = m[M00]*Det3_134_123 - m[M01]*Det3_134_023 + m[M02]*Det3_134_013 - m[M03]*Det3_134_012; double Det4_0134_0124 = m[M00]*Det3_134_124 - m[M01]*Det3_134_024 + m[M02]*Det3_134_014 - m[M04]*Det3_134_012; double Det4_0134_0134 = m[M00]*Det3_134_134 - m[M01]*Det3_134_034 + m[M03]*Det3_134_014 - m[M04]*Det3_134_013; double Det4_0134_0234 = m[M00]*Det3_134_234 - m[M02]*Det3_134_034 + m[M03]*Det3_134_024 - m[M04]*Det3_134_023; // double Det4_0134_1234 = m[M01]*Det3_134_234 - m[M02]*Det3_134_134 + m[M03]*Det3_134_124 - m[M04]*Det3_134_123; // double Det4_0234_0123 = m[M00]*Det3_234_123 - m[M01]*Det3_234_023 + m[M02]*Det3_234_013 - m[M03]*Det3_234_012; double Det4_0234_0124 = m[M00]*Det3_234_124 - m[M01]*Det3_234_024 + m[M02]*Det3_234_014 - m[M04]*Det3_234_012; double Det4_0234_0134 = m[M00]*Det3_234_134 - m[M01]*Det3_234_034 + m[M03]*Det3_234_014 - m[M04]*Det3_234_013; double Det4_0234_0234 = m[M00]*Det3_234_234 - m[M02]*Det3_234_034 + m[M03]*Det3_234_024 - m[M04]*Det3_234_023; double Det4_0234_1234 = m[M01]*Det3_234_234 - m[M02]*Det3_234_134 + m[M03]*Det3_234_124 - m[M04]*Det3_234_123; // double Det4_1234_0123 = m[M10]*Det3_234_123 - m[M11]*Det3_234_023 + m[M12]*Det3_234_013 - m[M13]*Det3_234_012; double Det4_1234_0124 = m[M10]*Det3_234_124 - m[M11]*Det3_234_024 + m[M12]*Det3_234_014 - m[M14]*Det3_234_012; double Det4_1234_0134 = m[M10]*Det3_234_134 - m[M11]*Det3_234_034 + m[M13]*Det3_234_014 - m[M14]*Det3_234_013; double Det4_1234_0234 = m[M10]*Det3_234_234 - m[M12]*Det3_234_034 + m[M13]*Det3_234_024 - m[M14]*Det3_234_023; double Det4_1234_1234 = m[M11]*Det3_234_234 - m[M12]*Det3_234_134 + m[M13]*Det3_234_124 - m[M14]*Det3_234_123; // Find the 5x5 det: double det = m[M00]*Det4_1234_1234 - m[M01]*Det4_1234_0234 + m[M02]*Det4_1234_0134 - m[M03]*Det4_1234_0124 + m[M04]*Det4_1234_0123; if ( det == 0 ) { #ifdef SINGULAR_DIAGNOSTICS std::cerr << "Kramer's rule inversion of a singular 5x5 matrix: " << *this << "\n"; #endif ifail = 1; return; } double oneOverDet = 1.0/det; double mn1OverDet = - oneOverDet; m[M00] = Det4_1234_1234 * oneOverDet; m[M01] = Det4_0234_1234 * mn1OverDet; m[M02] = Det4_0134_1234 * oneOverDet; m[M03] = Det4_0124_1234 * mn1OverDet; m[M04] = Det4_0123_1234 * oneOverDet; m[M10] = Det4_1234_0234 * mn1OverDet; m[M11] = Det4_0234_0234 * oneOverDet; m[M12] = Det4_0134_0234 * mn1OverDet; m[M13] = Det4_0124_0234 * oneOverDet; m[M14] = Det4_0123_0234 * mn1OverDet; m[M20] = Det4_1234_0134 * oneOverDet; m[M21] = Det4_0234_0134 * mn1OverDet; m[M22] = Det4_0134_0134 * oneOverDet; m[M23] = Det4_0124_0134 * mn1OverDet; m[M24] = Det4_0123_0134 * oneOverDet; m[M30] = Det4_1234_0124 * mn1OverDet; m[M31] = Det4_0234_0124 * oneOverDet; m[M32] = Det4_0134_0124 * mn1OverDet; m[M33] = Det4_0124_0124 * oneOverDet; m[M34] = Det4_0123_0124 * mn1OverDet; m[M40] = Det4_1234_0123 * oneOverDet; m[M41] = Det4_0234_0123 * mn1OverDet; m[M42] = Det4_0134_0123 * oneOverDet; m[M43] = Det4_0124_0123 * mn1OverDet; m[M44] = Det4_0123_0123 * oneOverDet; return; } void HepMatrix::invertHaywood6 (int & ifail) { ifail = 0; // Find all NECESSARY 2x2 dets: (45 of them) double Det2_34_01 = m[A30]*m[A41] - m[A31]*m[A40]; double Det2_34_02 = m[A30]*m[A42] - m[A32]*m[A40]; double Det2_34_03 = m[A30]*m[A43] - m[A33]*m[A40]; double Det2_34_04 = m[A30]*m[A44] - m[A34]*m[A40]; double Det2_34_05 = m[A30]*m[A45] - m[A35]*m[A40]; // double Det2_34_12 = m[A31]*m[A42] - m[A32]*m[A41]; double Det2_34_13 = m[A31]*m[A43] - m[A33]*m[A41]; double Det2_34_14 = m[A31]*m[A44] - m[A34]*m[A41]; double Det2_34_15 = m[A31]*m[A45] - m[A35]*m[A41]; // double Det2_34_23 = m[A32]*m[A43] - m[A33]*m[A42]; double Det2_34_24 = m[A32]*m[A44] - m[A34]*m[A42]; double Det2_34_25 = m[A32]*m[A45] - m[A35]*m[A42]; // double Det2_34_34 = m[A33]*m[A44] - m[A34]*m[A43]; double Det2_34_35 = m[A33]*m[A45] - m[A35]*m[A43]; // double Det2_34_45 = m[A34]*m[A45] - m[A35]*m[A44]; // double Det2_35_01 = m[A30]*m[A51] - m[A31]*m[A50]; double Det2_35_02 = m[A30]*m[A52] - m[A32]*m[A50]; double Det2_35_03 = m[A30]*m[A53] - m[A33]*m[A50]; double Det2_35_04 = m[A30]*m[A54] - m[A34]*m[A50]; double Det2_35_05 = m[A30]*m[A55] - m[A35]*m[A50]; double Det2_35_12 = m[A31]*m[A52] - m[A32]*m[A51]; double Det2_35_13 = m[A31]*m[A53] - m[A33]*m[A51]; double Det2_35_14 = m[A31]*m[A54] - m[A34]*m[A51]; double Det2_35_15 = m[A31]*m[A55] - m[A35]*m[A51]; double Det2_35_23 = m[A32]*m[A53] - m[A33]*m[A52]; double Det2_35_24 = m[A32]*m[A54] - m[A34]*m[A52]; double Det2_35_25 = m[A32]*m[A55] - m[A35]*m[A52]; double Det2_35_34 = m[A33]*m[A54] - m[A34]*m[A53]; double Det2_35_35 = m[A33]*m[A55] - m[A35]*m[A53]; double Det2_35_45 = m[A34]*m[A55] - m[A35]*m[A54]; // double Det2_45_01 = m[A40]*m[A51] - m[A41]*m[A50]; double Det2_45_02 = m[A40]*m[A52] - m[A42]*m[A50]; double Det2_45_03 = m[A40]*m[A53] - m[A43]*m[A50]; double Det2_45_04 = m[A40]*m[A54] - m[A44]*m[A50]; double Det2_45_05 = m[A40]*m[A55] - m[A45]*m[A50]; double Det2_45_12 = m[A41]*m[A52] - m[A42]*m[A51]; double Det2_45_13 = m[A41]*m[A53] - m[A43]*m[A51]; double Det2_45_14 = m[A41]*m[A54] - m[A44]*m[A51]; double Det2_45_15 = m[A41]*m[A55] - m[A45]*m[A51]; double Det2_45_23 = m[A42]*m[A53] - m[A43]*m[A52]; double Det2_45_24 = m[A42]*m[A54] - m[A44]*m[A52]; double Det2_45_25 = m[A42]*m[A55] - m[A45]*m[A52]; double Det2_45_34 = m[A43]*m[A54] - m[A44]*m[A53]; double Det2_45_35 = m[A43]*m[A55] - m[A45]*m[A53]; double Det2_45_45 = m[A44]*m[A55] - m[A45]*m[A54]; // Find all NECESSARY 3x3 dets: (80 of them) double Det3_234_012 = m[A20]*Det2_34_12 - m[A21]*Det2_34_02 + m[A22]*Det2_34_01; double Det3_234_013 = m[A20]*Det2_34_13 - m[A21]*Det2_34_03 + m[A23]*Det2_34_01; double Det3_234_014 = m[A20]*Det2_34_14 - m[A21]*Det2_34_04 + m[A24]*Det2_34_01; double Det3_234_015 = m[A20]*Det2_34_15 - m[A21]*Det2_34_05 + m[A25]*Det2_34_01; // double Det3_234_023 = m[A20]*Det2_34_23 - m[A22]*Det2_34_03 + m[A23]*Det2_34_02; double Det3_234_024 = m[A20]*Det2_34_24 - m[A22]*Det2_34_04 + m[A24]*Det2_34_02; double Det3_234_025 = m[A20]*Det2_34_25 - m[A22]*Det2_34_05 + m[A25]*Det2_34_02; // double Det3_234_034 = m[A20]*Det2_34_34 - m[A23]*Det2_34_04 + m[A24]*Det2_34_03; double Det3_234_035 = m[A20]*Det2_34_35 - m[A23]*Det2_34_05 + m[A25]*Det2_34_03; // double Det3_234_045 = m[A20]*Det2_34_45 - m[A24]*Det2_34_05 + m[A25]*Det2_34_04; // double Det3_234_123 = m[A21]*Det2_34_23 - m[A22]*Det2_34_13 + m[A23]*Det2_34_12; double Det3_234_124 = m[A21]*Det2_34_24 - m[A22]*Det2_34_14 + m[A24]*Det2_34_12; double Det3_234_125 = m[A21]*Det2_34_25 - m[A22]*Det2_34_15 + m[A25]*Det2_34_12; // double Det3_234_134 = m[A21]*Det2_34_34 - m[A23]*Det2_34_14 + m[A24]*Det2_34_13; double Det3_234_135 = m[A21]*Det2_34_35 - m[A23]*Det2_34_15 + m[A25]*Det2_34_13; // double Det3_234_145 = m[A21]*Det2_34_45 - m[A24]*Det2_34_15 + m[A25]*Det2_34_14; // double Det3_234_234 = m[A22]*Det2_34_34 - m[A23]*Det2_34_24 + m[A24]*Det2_34_23; double Det3_234_235 = m[A22]*Det2_34_35 - m[A23]*Det2_34_25 + m[A25]*Det2_34_23; // double Det3_234_245 = m[A22]*Det2_34_45 - m[A24]*Det2_34_25 + m[A25]*Det2_34_24; // double Det3_234_345 = m[A23]*Det2_34_45 - m[A24]*Det2_34_35 + m[A25]*Det2_34_34; // double Det3_235_012 = m[A20]*Det2_35_12 - m[A21]*Det2_35_02 + m[A22]*Det2_35_01; double Det3_235_013 = m[A20]*Det2_35_13 - m[A21]*Det2_35_03 + m[A23]*Det2_35_01; double Det3_235_014 = m[A20]*Det2_35_14 - m[A21]*Det2_35_04 + m[A24]*Det2_35_01; double Det3_235_015 = m[A20]*Det2_35_15 - m[A21]*Det2_35_05 + m[A25]*Det2_35_01; double Det3_235_023 = m[A20]*Det2_35_23 - m[A22]*Det2_35_03 + m[A23]*Det2_35_02; double Det3_235_024 = m[A20]*Det2_35_24 - m[A22]*Det2_35_04 + m[A24]*Det2_35_02; double Det3_235_025 = m[A20]*Det2_35_25 - m[A22]*Det2_35_05 + m[A25]*Det2_35_02; double Det3_235_034 = m[A20]*Det2_35_34 - m[A23]*Det2_35_04 + m[A24]*Det2_35_03; double Det3_235_035 = m[A20]*Det2_35_35 - m[A23]*Det2_35_05 + m[A25]*Det2_35_03; double Det3_235_045 = m[A20]*Det2_35_45 - m[A24]*Det2_35_05 + m[A25]*Det2_35_04; // double Det3_235_123 = m[A21]*Det2_35_23 - m[A22]*Det2_35_13 + m[A23]*Det2_35_12; double Det3_235_124 = m[A21]*Det2_35_24 - m[A22]*Det2_35_14 + m[A24]*Det2_35_12; double Det3_235_125 = m[A21]*Det2_35_25 - m[A22]*Det2_35_15 + m[A25]*Det2_35_12; double Det3_235_134 = m[A21]*Det2_35_34 - m[A23]*Det2_35_14 + m[A24]*Det2_35_13; double Det3_235_135 = m[A21]*Det2_35_35 - m[A23]*Det2_35_15 + m[A25]*Det2_35_13; double Det3_235_145 = m[A21]*Det2_35_45 - m[A24]*Det2_35_15 + m[A25]*Det2_35_14; // double Det3_235_234 = m[A22]*Det2_35_34 - m[A23]*Det2_35_24 + m[A24]*Det2_35_23; double Det3_235_235 = m[A22]*Det2_35_35 - m[A23]*Det2_35_25 + m[A25]*Det2_35_23; double Det3_235_245 = m[A22]*Det2_35_45 - m[A24]*Det2_35_25 + m[A25]*Det2_35_24; // double Det3_235_345 = m[A23]*Det2_35_45 - m[A24]*Det2_35_35 + m[A25]*Det2_35_34; // double Det3_245_012 = m[A20]*Det2_45_12 - m[A21]*Det2_45_02 + m[A22]*Det2_45_01; double Det3_245_013 = m[A20]*Det2_45_13 - m[A21]*Det2_45_03 + m[A23]*Det2_45_01; double Det3_245_014 = m[A20]*Det2_45_14 - m[A21]*Det2_45_04 + m[A24]*Det2_45_01; double Det3_245_015 = m[A20]*Det2_45_15 - m[A21]*Det2_45_05 + m[A25]*Det2_45_01; double Det3_245_023 = m[A20]*Det2_45_23 - m[A22]*Det2_45_03 + m[A23]*Det2_45_02; double Det3_245_024 = m[A20]*Det2_45_24 - m[A22]*Det2_45_04 + m[A24]*Det2_45_02; double Det3_245_025 = m[A20]*Det2_45_25 - m[A22]*Det2_45_05 + m[A25]*Det2_45_02; double Det3_245_034 = m[A20]*Det2_45_34 - m[A23]*Det2_45_04 + m[A24]*Det2_45_03; double Det3_245_035 = m[A20]*Det2_45_35 - m[A23]*Det2_45_05 + m[A25]*Det2_45_03; double Det3_245_045 = m[A20]*Det2_45_45 - m[A24]*Det2_45_05 + m[A25]*Det2_45_04; double Det3_245_123 = m[A21]*Det2_45_23 - m[A22]*Det2_45_13 + m[A23]*Det2_45_12; double Det3_245_124 = m[A21]*Det2_45_24 - m[A22]*Det2_45_14 + m[A24]*Det2_45_12; double Det3_245_125 = m[A21]*Det2_45_25 - m[A22]*Det2_45_15 + m[A25]*Det2_45_12; double Det3_245_134 = m[A21]*Det2_45_34 - m[A23]*Det2_45_14 + m[A24]*Det2_45_13; double Det3_245_135 = m[A21]*Det2_45_35 - m[A23]*Det2_45_15 + m[A25]*Det2_45_13; double Det3_245_145 = m[A21]*Det2_45_45 - m[A24]*Det2_45_15 + m[A25]*Det2_45_14; double Det3_245_234 = m[A22]*Det2_45_34 - m[A23]*Det2_45_24 + m[A24]*Det2_45_23; double Det3_245_235 = m[A22]*Det2_45_35 - m[A23]*Det2_45_25 + m[A25]*Det2_45_23; double Det3_245_245 = m[A22]*Det2_45_45 - m[A24]*Det2_45_25 + m[A25]*Det2_45_24; double Det3_245_345 = m[A23]*Det2_45_45 - m[A24]*Det2_45_35 + m[A25]*Det2_45_34; // double Det3_345_012 = m[A30]*Det2_45_12 - m[A31]*Det2_45_02 + m[A32]*Det2_45_01; double Det3_345_013 = m[A30]*Det2_45_13 - m[A31]*Det2_45_03 + m[A33]*Det2_45_01; double Det3_345_014 = m[A30]*Det2_45_14 - m[A31]*Det2_45_04 + m[A34]*Det2_45_01; double Det3_345_015 = m[A30]*Det2_45_15 - m[A31]*Det2_45_05 + m[A35]*Det2_45_01; double Det3_345_023 = m[A30]*Det2_45_23 - m[A32]*Det2_45_03 + m[A33]*Det2_45_02; double Det3_345_024 = m[A30]*Det2_45_24 - m[A32]*Det2_45_04 + m[A34]*Det2_45_02; double Det3_345_025 = m[A30]*Det2_45_25 - m[A32]*Det2_45_05 + m[A35]*Det2_45_02; double Det3_345_034 = m[A30]*Det2_45_34 - m[A33]*Det2_45_04 + m[A34]*Det2_45_03; double Det3_345_035 = m[A30]*Det2_45_35 - m[A33]*Det2_45_05 + m[A35]*Det2_45_03; double Det3_345_045 = m[A30]*Det2_45_45 - m[A34]*Det2_45_05 + m[A35]*Det2_45_04; double Det3_345_123 = m[A31]*Det2_45_23 - m[A32]*Det2_45_13 + m[A33]*Det2_45_12; double Det3_345_124 = m[A31]*Det2_45_24 - m[A32]*Det2_45_14 + m[A34]*Det2_45_12; double Det3_345_125 = m[A31]*Det2_45_25 - m[A32]*Det2_45_15 + m[A35]*Det2_45_12; double Det3_345_134 = m[A31]*Det2_45_34 - m[A33]*Det2_45_14 + m[A34]*Det2_45_13; double Det3_345_135 = m[A31]*Det2_45_35 - m[A33]*Det2_45_15 + m[A35]*Det2_45_13; double Det3_345_145 = m[A31]*Det2_45_45 - m[A34]*Det2_45_15 + m[A35]*Det2_45_14; double Det3_345_234 = m[A32]*Det2_45_34 - m[A33]*Det2_45_24 + m[A34]*Det2_45_23; double Det3_345_235 = m[A32]*Det2_45_35 - m[A33]*Det2_45_25 + m[A35]*Det2_45_23; double Det3_345_245 = m[A32]*Det2_45_45 - m[A34]*Det2_45_25 + m[A35]*Det2_45_24; double Det3_345_345 = m[A33]*Det2_45_45 - m[A34]*Det2_45_35 + m[A35]*Det2_45_34; // Find all NECESSARY 4x4 dets: (75 of them) double Det4_1234_0123 = m[A10]*Det3_234_123 - m[A11]*Det3_234_023 + m[A12]*Det3_234_013 - m[A13]*Det3_234_012; double Det4_1234_0124 = m[A10]*Det3_234_124 - m[A11]*Det3_234_024 + m[A12]*Det3_234_014 - m[A14]*Det3_234_012; double Det4_1234_0125 = m[A10]*Det3_234_125 - m[A11]*Det3_234_025 + m[A12]*Det3_234_015 - m[A15]*Det3_234_012; // double Det4_1234_0134 = m[A10]*Det3_234_134 - m[A11]*Det3_234_034 + m[A13]*Det3_234_014 - m[A14]*Det3_234_013; double Det4_1234_0135 = m[A10]*Det3_234_135 - m[A11]*Det3_234_035 + m[A13]*Det3_234_015 - m[A15]*Det3_234_013; // double Det4_1234_0145 = m[A10]*Det3_234_145 - m[A11]*Det3_234_045 + m[A14]*Det3_234_015 - m[A15]*Det3_234_014; // double Det4_1234_0234 = m[A10]*Det3_234_234 - m[A12]*Det3_234_034 + m[A13]*Det3_234_024 - m[A14]*Det3_234_023; double Det4_1234_0235 = m[A10]*Det3_234_235 - m[A12]*Det3_234_035 + m[A13]*Det3_234_025 - m[A15]*Det3_234_023; // double Det4_1234_0245 = m[A10]*Det3_234_245 - m[A12]*Det3_234_045 + m[A14]*Det3_234_025 - m[A15]*Det3_234_024; // double Det4_1234_0345 = m[A10]*Det3_234_345 - m[A13]*Det3_234_045 + m[A14]*Det3_234_035 - m[A15]*Det3_234_034; // double Det4_1234_1234 = m[A11]*Det3_234_234 - m[A12]*Det3_234_134 + m[A13]*Det3_234_124 - m[A14]*Det3_234_123; double Det4_1234_1235 = m[A11]*Det3_234_235 - m[A12]*Det3_234_135 + m[A13]*Det3_234_125 - m[A15]*Det3_234_123; // double Det4_1234_1245 = m[A11]*Det3_234_245 - m[A12]*Det3_234_145 + m[A14]*Det3_234_125 - m[A15]*Det3_234_124; // double Det4_1234_1345 = m[A11]*Det3_234_345 - m[A13]*Det3_234_145 + m[A14]*Det3_234_135 - m[A15]*Det3_234_134; // double Det4_1234_2345 = m[A12]*Det3_234_345 - m[A13]*Det3_234_245 + m[A14]*Det3_234_235 - m[A15]*Det3_234_234; // double Det4_1235_0123 = m[A10]*Det3_235_123 - m[A11]*Det3_235_023 + m[A12]*Det3_235_013 - m[A13]*Det3_235_012; double Det4_1235_0124 = m[A10]*Det3_235_124 - m[A11]*Det3_235_024 + m[A12]*Det3_235_014 - m[A14]*Det3_235_012; double Det4_1235_0125 = m[A10]*Det3_235_125 - m[A11]*Det3_235_025 + m[A12]*Det3_235_015 - m[A15]*Det3_235_012; double Det4_1235_0134 = m[A10]*Det3_235_134 - m[A11]*Det3_235_034 + m[A13]*Det3_235_014 - m[A14]*Det3_235_013; double Det4_1235_0135 = m[A10]*Det3_235_135 - m[A11]*Det3_235_035 + m[A13]*Det3_235_015 - m[A15]*Det3_235_013; double Det4_1235_0145 = m[A10]*Det3_235_145 - m[A11]*Det3_235_045 + m[A14]*Det3_235_015 - m[A15]*Det3_235_014; // double Det4_1235_0234 = m[A10]*Det3_235_234 - m[A12]*Det3_235_034 + m[A13]*Det3_235_024 - m[A14]*Det3_235_023; double Det4_1235_0235 = m[A10]*Det3_235_235 - m[A12]*Det3_235_035 + m[A13]*Det3_235_025 - m[A15]*Det3_235_023; double Det4_1235_0245 = m[A10]*Det3_235_245 - m[A12]*Det3_235_045 + m[A14]*Det3_235_025 - m[A15]*Det3_235_024; // double Det4_1235_0345 = m[A10]*Det3_235_345 - m[A13]*Det3_235_045 + m[A14]*Det3_235_035 - m[A15]*Det3_235_034; // double Det4_1235_1234 = m[A11]*Det3_235_234 - m[A12]*Det3_235_134 + m[A13]*Det3_235_124 - m[A14]*Det3_235_123; double Det4_1235_1235 = m[A11]*Det3_235_235 - m[A12]*Det3_235_135 + m[A13]*Det3_235_125 - m[A15]*Det3_235_123; double Det4_1235_1245 = m[A11]*Det3_235_245 - m[A12]*Det3_235_145 + m[A14]*Det3_235_125 - m[A15]*Det3_235_124; // double Det4_1235_1345 = m[A11]*Det3_235_345 - m[A13]*Det3_235_145 + m[A14]*Det3_235_135 - m[A15]*Det3_235_134; // double Det4_1235_2345 = m[A12]*Det3_235_345 - m[A13]*Det3_235_245 + m[A14]*Det3_235_235 - m[A15]*Det3_235_234; // double Det4_1245_0123 = m[A10]*Det3_245_123 - m[A11]*Det3_245_023 + m[A12]*Det3_245_013 - m[A13]*Det3_245_012; double Det4_1245_0124 = m[A10]*Det3_245_124 - m[A11]*Det3_245_024 + m[A12]*Det3_245_014 - m[A14]*Det3_245_012; double Det4_1245_0125 = m[A10]*Det3_245_125 - m[A11]*Det3_245_025 + m[A12]*Det3_245_015 - m[A15]*Det3_245_012; double Det4_1245_0134 = m[A10]*Det3_245_134 - m[A11]*Det3_245_034 + m[A13]*Det3_245_014 - m[A14]*Det3_245_013; double Det4_1245_0135 = m[A10]*Det3_245_135 - m[A11]*Det3_245_035 + m[A13]*Det3_245_015 - m[A15]*Det3_245_013; double Det4_1245_0145 = m[A10]*Det3_245_145 - m[A11]*Det3_245_045 + m[A14]*Det3_245_015 - m[A15]*Det3_245_014; double Det4_1245_0234 = m[A10]*Det3_245_234 - m[A12]*Det3_245_034 + m[A13]*Det3_245_024 - m[A14]*Det3_245_023; double Det4_1245_0235 = m[A10]*Det3_245_235 - m[A12]*Det3_245_035 + m[A13]*Det3_245_025 - m[A15]*Det3_245_023; double Det4_1245_0245 = m[A10]*Det3_245_245 - m[A12]*Det3_245_045 + m[A14]*Det3_245_025 - m[A15]*Det3_245_024; double Det4_1245_0345 = m[A10]*Det3_245_345 - m[A13]*Det3_245_045 + m[A14]*Det3_245_035 - m[A15]*Det3_245_034; // double Det4_1245_1234 = m[A11]*Det3_245_234 - m[A12]*Det3_245_134 + m[A13]*Det3_245_124 - m[A14]*Det3_245_123; double Det4_1245_1235 = m[A11]*Det3_245_235 - m[A12]*Det3_245_135 + m[A13]*Det3_245_125 - m[A15]*Det3_245_123; double Det4_1245_1245 = m[A11]*Det3_245_245 - m[A12]*Det3_245_145 + m[A14]*Det3_245_125 - m[A15]*Det3_245_124; double Det4_1245_1345 = m[A11]*Det3_245_345 - m[A13]*Det3_245_145 + m[A14]*Det3_245_135 - m[A15]*Det3_245_134; // double Det4_1245_2345 = m[A12]*Det3_245_345 - m[A13]*Det3_245_245 + m[A14]*Det3_245_235 - m[A15]*Det3_245_234; // double Det4_1345_0123 = m[A10]*Det3_345_123 - m[A11]*Det3_345_023 + m[A12]*Det3_345_013 - m[A13]*Det3_345_012; double Det4_1345_0124 = m[A10]*Det3_345_124 - m[A11]*Det3_345_024 + m[A12]*Det3_345_014 - m[A14]*Det3_345_012; double Det4_1345_0125 = m[A10]*Det3_345_125 - m[A11]*Det3_345_025 + m[A12]*Det3_345_015 - m[A15]*Det3_345_012; double Det4_1345_0134 = m[A10]*Det3_345_134 - m[A11]*Det3_345_034 + m[A13]*Det3_345_014 - m[A14]*Det3_345_013; double Det4_1345_0135 = m[A10]*Det3_345_135 - m[A11]*Det3_345_035 + m[A13]*Det3_345_015 - m[A15]*Det3_345_013; double Det4_1345_0145 = m[A10]*Det3_345_145 - m[A11]*Det3_345_045 + m[A14]*Det3_345_015 - m[A15]*Det3_345_014; double Det4_1345_0234 = m[A10]*Det3_345_234 - m[A12]*Det3_345_034 + m[A13]*Det3_345_024 - m[A14]*Det3_345_023; double Det4_1345_0235 = m[A10]*Det3_345_235 - m[A12]*Det3_345_035 + m[A13]*Det3_345_025 - m[A15]*Det3_345_023; double Det4_1345_0245 = m[A10]*Det3_345_245 - m[A12]*Det3_345_045 + m[A14]*Det3_345_025 - m[A15]*Det3_345_024; double Det4_1345_0345 = m[A10]*Det3_345_345 - m[A13]*Det3_345_045 + m[A14]*Det3_345_035 - m[A15]*Det3_345_034; double Det4_1345_1234 = m[A11]*Det3_345_234 - m[A12]*Det3_345_134 + m[A13]*Det3_345_124 - m[A14]*Det3_345_123; double Det4_1345_1235 = m[A11]*Det3_345_235 - m[A12]*Det3_345_135 + m[A13]*Det3_345_125 - m[A15]*Det3_345_123; double Det4_1345_1245 = m[A11]*Det3_345_245 - m[A12]*Det3_345_145 + m[A14]*Det3_345_125 - m[A15]*Det3_345_124; double Det4_1345_1345 = m[A11]*Det3_345_345 - m[A13]*Det3_345_145 + m[A14]*Det3_345_135 - m[A15]*Det3_345_134; double Det4_1345_2345 = m[A12]*Det3_345_345 - m[A13]*Det3_345_245 + m[A14]*Det3_345_235 - m[A15]*Det3_345_234; // double Det4_2345_0123 = m[A20]*Det3_345_123 - m[A21]*Det3_345_023 + m[A22]*Det3_345_013 - m[A23]*Det3_345_012; double Det4_2345_0124 = m[A20]*Det3_345_124 - m[A21]*Det3_345_024 + m[A22]*Det3_345_014 - m[A24]*Det3_345_012; double Det4_2345_0125 = m[A20]*Det3_345_125 - m[A21]*Det3_345_025 + m[A22]*Det3_345_015 - m[A25]*Det3_345_012; double Det4_2345_0134 = m[A20]*Det3_345_134 - m[A21]*Det3_345_034 + m[A23]*Det3_345_014 - m[A24]*Det3_345_013; double Det4_2345_0135 = m[A20]*Det3_345_135 - m[A21]*Det3_345_035 + m[A23]*Det3_345_015 - m[A25]*Det3_345_013; double Det4_2345_0145 = m[A20]*Det3_345_145 - m[A21]*Det3_345_045 + m[A24]*Det3_345_015 - m[A25]*Det3_345_014; double Det4_2345_0234 = m[A20]*Det3_345_234 - m[A22]*Det3_345_034 + m[A23]*Det3_345_024 - m[A24]*Det3_345_023; double Det4_2345_0235 = m[A20]*Det3_345_235 - m[A22]*Det3_345_035 + m[A23]*Det3_345_025 - m[A25]*Det3_345_023; double Det4_2345_0245 = m[A20]*Det3_345_245 - m[A22]*Det3_345_045 + m[A24]*Det3_345_025 - m[A25]*Det3_345_024; double Det4_2345_0345 = m[A20]*Det3_345_345 - m[A23]*Det3_345_045 + m[A24]*Det3_345_035 - m[A25]*Det3_345_034; double Det4_2345_1234 = m[A21]*Det3_345_234 - m[A22]*Det3_345_134 + m[A23]*Det3_345_124 - m[A24]*Det3_345_123; double Det4_2345_1235 = m[A21]*Det3_345_235 - m[A22]*Det3_345_135 + m[A23]*Det3_345_125 - m[A25]*Det3_345_123; double Det4_2345_1245 = m[A21]*Det3_345_245 - m[A22]*Det3_345_145 + m[A24]*Det3_345_125 - m[A25]*Det3_345_124; double Det4_2345_1345 = m[A21]*Det3_345_345 - m[A23]*Det3_345_145 + m[A24]*Det3_345_135 - m[A25]*Det3_345_134; double Det4_2345_2345 = m[A22]*Det3_345_345 - m[A23]*Det3_345_245 + m[A24]*Det3_345_235 - m[A25]*Det3_345_234; // Find all NECESSARY 5x5 dets: (36 of them) double Det5_01234_01234 = m[A00]*Det4_1234_1234 - m[A01]*Det4_1234_0234 + m[A02]*Det4_1234_0134 - m[A03]*Det4_1234_0124 + m[A04]*Det4_1234_0123; double Det5_01234_01235 = m[A00]*Det4_1234_1235 - m[A01]*Det4_1234_0235 + m[A02]*Det4_1234_0135 - m[A03]*Det4_1234_0125 + m[A05]*Det4_1234_0123; // double Det5_01234_01245 = m[A00]*Det4_1234_1245 - m[A01]*Det4_1234_0245 + m[A02]*Det4_1234_0145 - m[A04]*Det4_1234_0125 + m[A05]*Det4_1234_0124; // double Det5_01234_01345 = m[A00]*Det4_1234_1345 - m[A01]*Det4_1234_0345 + m[A03]*Det4_1234_0145 - m[A04]*Det4_1234_0135 + m[A05]*Det4_1234_0134; // double Det5_01234_02345 = m[A00]*Det4_1234_2345 - m[A02]*Det4_1234_0345 + m[A03]*Det4_1234_0245 - m[A04]*Det4_1234_0235 + m[A05]*Det4_1234_0234; // double Det5_01234_12345 = m[A01]*Det4_1234_2345 - m[A02]*Det4_1234_1345 + m[A03]*Det4_1234_1245 - m[A04]*Det4_1234_1235 + m[A05]*Det4_1234_1234; // double Det5_01235_01234 = m[A00]*Det4_1235_1234 - m[A01]*Det4_1235_0234 + m[A02]*Det4_1235_0134 - m[A03]*Det4_1235_0124 + m[A04]*Det4_1235_0123; double Det5_01235_01235 = m[A00]*Det4_1235_1235 - m[A01]*Det4_1235_0235 + m[A02]*Det4_1235_0135 - m[A03]*Det4_1235_0125 + m[A05]*Det4_1235_0123; double Det5_01235_01245 = m[A00]*Det4_1235_1245 - m[A01]*Det4_1235_0245 + m[A02]*Det4_1235_0145 - m[A04]*Det4_1235_0125 + m[A05]*Det4_1235_0124; // double Det5_01235_01345 = m[A00]*Det4_1235_1345 - m[A01]*Det4_1235_0345 + m[A03]*Det4_1235_0145 - m[A04]*Det4_1235_0135 + m[A05]*Det4_1235_0134; // double Det5_01235_02345 = m[A00]*Det4_1235_2345 - m[A02]*Det4_1235_0345 + m[A03]*Det4_1235_0245 - m[A04]*Det4_1235_0235 + m[A05]*Det4_1235_0234; // double Det5_01235_12345 = m[A01]*Det4_1235_2345 - m[A02]*Det4_1235_1345 + m[A03]*Det4_1235_1245 - m[A04]*Det4_1235_1235 + m[A05]*Det4_1235_1234; // double Det5_01245_01234 = m[A00]*Det4_1245_1234 - m[A01]*Det4_1245_0234 + m[A02]*Det4_1245_0134 - m[A03]*Det4_1245_0124 + m[A04]*Det4_1245_0123; double Det5_01245_01235 = m[A00]*Det4_1245_1235 - m[A01]*Det4_1245_0235 + m[A02]*Det4_1245_0135 - m[A03]*Det4_1245_0125 + m[A05]*Det4_1245_0123; double Det5_01245_01245 = m[A00]*Det4_1245_1245 - m[A01]*Det4_1245_0245 + m[A02]*Det4_1245_0145 - m[A04]*Det4_1245_0125 + m[A05]*Det4_1245_0124; double Det5_01245_01345 = m[A00]*Det4_1245_1345 - m[A01]*Det4_1245_0345 + m[A03]*Det4_1245_0145 - m[A04]*Det4_1245_0135 + m[A05]*Det4_1245_0134; // double Det5_01245_02345 = m[A00]*Det4_1245_2345 - m[A02]*Det4_1245_0345 + m[A03]*Det4_1245_0245 - m[A04]*Det4_1245_0235 + m[A05]*Det4_1245_0234; // double Det5_01245_12345 = m[A01]*Det4_1245_2345 - m[A02]*Det4_1245_1345 + m[A03]*Det4_1245_1245 - m[A04]*Det4_1245_1235 + m[A05]*Det4_1245_1234; // double Det5_01345_01234 = m[A00]*Det4_1345_1234 - m[A01]*Det4_1345_0234 + m[A02]*Det4_1345_0134 - m[A03]*Det4_1345_0124 + m[A04]*Det4_1345_0123; double Det5_01345_01235 = m[A00]*Det4_1345_1235 - m[A01]*Det4_1345_0235 + m[A02]*Det4_1345_0135 - m[A03]*Det4_1345_0125 + m[A05]*Det4_1345_0123; double Det5_01345_01245 = m[A00]*Det4_1345_1245 - m[A01]*Det4_1345_0245 + m[A02]*Det4_1345_0145 - m[A04]*Det4_1345_0125 + m[A05]*Det4_1345_0124; double Det5_01345_01345 = m[A00]*Det4_1345_1345 - m[A01]*Det4_1345_0345 + m[A03]*Det4_1345_0145 - m[A04]*Det4_1345_0135 + m[A05]*Det4_1345_0134; double Det5_01345_02345 = m[A00]*Det4_1345_2345 - m[A02]*Det4_1345_0345 + m[A03]*Det4_1345_0245 - m[A04]*Det4_1345_0235 + m[A05]*Det4_1345_0234; // double Det5_01345_12345 = m[A01]*Det4_1345_2345 - m[A02]*Det4_1345_1345 + m[A03]*Det4_1345_1245 - m[A04]*Det4_1345_1235 + m[A05]*Det4_1345_1234; // double Det5_02345_01234 = m[A00]*Det4_2345_1234 - m[A01]*Det4_2345_0234 + m[A02]*Det4_2345_0134 - m[A03]*Det4_2345_0124 + m[A04]*Det4_2345_0123; double Det5_02345_01235 = m[A00]*Det4_2345_1235 - m[A01]*Det4_2345_0235 + m[A02]*Det4_2345_0135 - m[A03]*Det4_2345_0125 + m[A05]*Det4_2345_0123; double Det5_02345_01245 = m[A00]*Det4_2345_1245 - m[A01]*Det4_2345_0245 + m[A02]*Det4_2345_0145 - m[A04]*Det4_2345_0125 + m[A05]*Det4_2345_0124; double Det5_02345_01345 = m[A00]*Det4_2345_1345 - m[A01]*Det4_2345_0345 + m[A03]*Det4_2345_0145 - m[A04]*Det4_2345_0135 + m[A05]*Det4_2345_0134; double Det5_02345_02345 = m[A00]*Det4_2345_2345 - m[A02]*Det4_2345_0345 + m[A03]*Det4_2345_0245 - m[A04]*Det4_2345_0235 + m[A05]*Det4_2345_0234; double Det5_02345_12345 = m[A01]*Det4_2345_2345 - m[A02]*Det4_2345_1345 + m[A03]*Det4_2345_1245 - m[A04]*Det4_2345_1235 + m[A05]*Det4_2345_1234; // double Det5_12345_01234 = m[A10]*Det4_2345_1234 - m[A11]*Det4_2345_0234 + m[A12]*Det4_2345_0134 - m[A13]*Det4_2345_0124 + m[A14]*Det4_2345_0123; double Det5_12345_01235 = m[A10]*Det4_2345_1235 - m[A11]*Det4_2345_0235 + m[A12]*Det4_2345_0135 - m[A13]*Det4_2345_0125 + m[A15]*Det4_2345_0123; double Det5_12345_01245 = m[A10]*Det4_2345_1245 - m[A11]*Det4_2345_0245 + m[A12]*Det4_2345_0145 - m[A14]*Det4_2345_0125 + m[A15]*Det4_2345_0124; double Det5_12345_01345 = m[A10]*Det4_2345_1345 - m[A11]*Det4_2345_0345 + m[A13]*Det4_2345_0145 - m[A14]*Det4_2345_0135 + m[A15]*Det4_2345_0134; double Det5_12345_02345 = m[A10]*Det4_2345_2345 - m[A12]*Det4_2345_0345 + m[A13]*Det4_2345_0245 - m[A14]*Det4_2345_0235 + m[A15]*Det4_2345_0234; double Det5_12345_12345 = m[A11]*Det4_2345_2345 - m[A12]*Det4_2345_1345 + m[A13]*Det4_2345_1245 - m[A14]*Det4_2345_1235 + m[A15]*Det4_2345_1234; // Find the determinant double det = m[A00]*Det5_12345_12345 - m[A01]*Det5_12345_02345 + m[A02]*Det5_12345_01345 - m[A03]*Det5_12345_01245 + m[A04]*Det5_12345_01235 - m[A05]*Det5_12345_01234; if ( det == 0 ) { #ifdef SINGULAR_DIAGNOSTICS std::cerr << "Kramer's rule inversion of a singular 6x6 matrix: " << *this << "\n"; #endif ifail = 1; return; } double oneOverDet = 1.0/det; double mn1OverDet = - oneOverDet; m[A00] = Det5_12345_12345*oneOverDet; m[A01] = Det5_02345_12345*mn1OverDet; m[A02] = Det5_01345_12345*oneOverDet; m[A03] = Det5_01245_12345*mn1OverDet; m[A04] = Det5_01235_12345*oneOverDet; m[A05] = Det5_01234_12345*mn1OverDet; m[A10] = Det5_12345_02345*mn1OverDet; m[A11] = Det5_02345_02345*oneOverDet; m[A12] = Det5_01345_02345*mn1OverDet; m[A13] = Det5_01245_02345*oneOverDet; m[A14] = Det5_01235_02345*mn1OverDet; m[A15] = Det5_01234_02345*oneOverDet; m[A20] = Det5_12345_01345*oneOverDet; m[A21] = Det5_02345_01345*mn1OverDet; m[A22] = Det5_01345_01345*oneOverDet; m[A23] = Det5_01245_01345*mn1OverDet; m[A24] = Det5_01235_01345*oneOverDet; m[A25] = Det5_01234_01345*mn1OverDet; m[A30] = Det5_12345_01245*mn1OverDet; m[A31] = Det5_02345_01245*oneOverDet; m[A32] = Det5_01345_01245*mn1OverDet; m[A33] = Det5_01245_01245*oneOverDet; m[A34] = Det5_01235_01245*mn1OverDet; m[A35] = Det5_01234_01245*oneOverDet; m[A40] = Det5_12345_01235*oneOverDet; m[A41] = Det5_02345_01235*mn1OverDet; m[A42] = Det5_01345_01235*oneOverDet; m[A43] = Det5_01245_01235*mn1OverDet; m[A44] = Det5_01235_01235*oneOverDet; m[A45] = Det5_01234_01235*mn1OverDet; m[A50] = Det5_12345_01234*mn1OverDet; m[A51] = Det5_02345_01234*oneOverDet; m[A52] = Det5_01345_01234*mn1OverDet; m[A53] = Det5_01245_01234*oneOverDet; m[A54] = Det5_01235_01234*mn1OverDet; m[A55] = Det5_01234_01234*oneOverDet; return; } } // namespace CLHEP clhep-2.1.4.1.orig/Matrix/Matrix-deps.in0000755000175000017500000000037311421364007016372 0ustar olesolesCLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Random-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Vector-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Utility-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Units-@VERSION@ clhep-2.1.4.1.orig/INSTALL.cmake0000644000175000017500000000634112074042007014505 0ustar olesoles#------------------------------------------------------------- # building CLHEP with cmake #------------------------------------------------------------- At this time, the cmake build system only supports building CLHEP as a complete package, starting from the top level directory. This package requires cmake 2.6 or later. #------------------------------------------------------------- # installing from a source code tar ball #------------------------------------------------------------- Unwind the source code tar ball in some relevant directory. Determine where the files will be installed. Create a build directory that is NOT in the source code directory tree. Make sure cmake is in your path. cd cmake -DCMAKE_INSTALL_PREFIX= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make test (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # cmake options #------------------------------------------------------------- -DCMAKE_INSTALL_PREFIX=/install/path -DCMAKE_BUILD_TYPE=Debug|Release|RelWithDebInfo|MinSizeRel -DCLHEP_BUILD_DOCS=ON -DCMAKE_C_COMPILER=... -DCMAKE_CXX_COMPILER=... -DCMAKE_CXX_FLAGS="list_of_flags" -DLIB_SUFFIX=64 (installs the libraries in a lib64 subdirectory) IMPORTANT: If you include -DCLHEP_BUILD_DOCS=ON, do not use "make -jN" #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are not built or installed automatically. If you wish to build and install the documents, add -DCLHEP_BUILD_DOCS=ON to your cmake command. Documents will then be built during the normal build. You will need to have latex in your path. #------------------------------------------------------------- # building from svn #------------------------------------------------------------- To work with a tagged branch: svn co svn+ssh://svn.cern.ch/reps/clhep/tags/CLHEP_2_1_2_2 To work with the head: svn co svn+ssh://svn.cern.ch/reps/clhep/trunk CLHEP You may also download directly from the online browser http://svnweb.cern.ch/world/wsvn/clhep/ Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building cmake #------------------------------------------------------------- cmake 2.6 or later is readily available for Linux, although you may need to install it download the cmake tar file from http://www.cmake.org/cmake/resources/software.html You may find a usable binary distribution there. If not, get the source code and proceed as below (for either MacOSX or Linux). Unwind the source code tarball. This directory is . Identify a separate build directory and a separate install directory: and . cd /bootstrap --prefix= make make install Add /bin to your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/compilers.txt0000755000175000017500000000641207705060311015140 0ustar olesoles+------------+---+---+ +---+---+---+ +---+---+---+ +---+ +---+---+---+---+---+ ! ! S ! s ! ! s ! s ! i ! ! s ! s ! s ! ! c ! ! b ! t ! n ! e ! t ! ! ! T ! t ! ! t ! t ! o ! ! s ! t ! t ! ! m ! ! o ! e ! a ! x ! y ! ! ! L ! d ! ! d ! d ! s ! ! t ! r ! r ! ! a ! ! o ! m ! m ! p ! p ! ! ! ! : ! ! : ! : ! f ! ! r ! s ! s ! ! t ! ! l ! p ! e ! l ! e ! ! ! ! S ! ! I ! I ! w ! ! e ! t ! t ! ! h ! ! ! l ! s ! i ! n ! ! ! ! T ! ! O ! O ! d ! ! a ! r ! r ! ! ! ! ! a ! p ! c ! a ! ! ! ! L ! ! | ! ! ! ! m ! e ! e ! ! ! ! ! t ! a ! i ! m ! ! ! ! ! ! B ! ! ! ! ! a ! a ! ! ! ! ! e ! c ! t ! e ! ! ! ! ! ! A ! ! ! ! ! m ! m ! ! ! ! ! <>! e ! ! ! ! ! ! ! ! S ! ! ! ! ! ! . ! ! ! ! ! ! ! ! ! ! ! ! ! ! E ! ! ! ! ! ! h ! ! ! ! ! ! ! ! ! +------------+---+---+ +---+---+---+ +---+---+---+ +---+ +---+---+---+---+---+ !Linux ! ! ! ! ! ! ! ! ! ! ! !gcc 2.95.2 !yes!yes! ! - !yes!yes! ! - !yes!yes! !yes! !yes!yes!yes!yes!yes! !gcc 3.2.1 !yes!yes! !yes!yes!yes! !yes!yes!yes! !yes! !yes!yes!yes!yes!yes! +------------+---+---+ +---+---+---+ +---+---+---+ +---+ +---+---+---+---+---+ !Sun Solaris ! ! ! ! ! ! ! ! ! ! ! !CC 5.2 !yes!yes! !yes!yes!yes! !yes!yes!yes! !yes! !yes!yes!yes!yes!yes! +------------+---+---+ +---+---+---+ +---+---+---+ +---+ +---+---+---+---+---+ !DEC ! ! ! ! ! ! ! ! ! ! ! !cxx V6.1-027!yes!yes! !yes!yes!yes! !yes!yes! - ! ! - ! !yes!yes!yes!yes!yes! +------------+---+---+ +---+---+---+ +---+---+---+ +---+ +---+---+---+---+---+ !SGI ! ! ! ! ! ! ! ! ! ! ! !gcc 2.95.2 !yes!yes! ! - !yes!yes! ! - !yes!yes! !yes! !yes!yes!yes!yes!yes! !gcc 3.2.1 !yes!yes! !yes!yes!yes! !yes!yes!yes! !yes! !yes!yes!yes!yes!yes! +------------+---+---+ +---+---+---+ +---+---+---+ +---+ +---+---+---+---+---+ !HP-UX ! ! ! ! ! ! ! ! ! ! ! !aCC A.01.23 !yes! - ! ! - ! - ! - ! ! - ! - !yes! !yes! !yes!yes!yes!yes!yes! +------------+---+---+ +---+---+---+ +---+---+---+ +---+ +---+---+---+---+---+ !Win2000 ! ! ! ! ! ! ! ! ! ! ! !VC++ 6.0 !yes!yes! !yes!yes!yes! !yes!yes! - ! !yes! !yes!yes!yes!yes!yes! +------------+---+---+ +---+---+---+ +---+---+---+ +---+ +---+---+---+---+---+ ============================================================================== Obsolete Compilers +------------+---+---+ +---+---+---+ +---+---+---+ +---+ +---+---+---+---+---+ !egcs-1.91.66!yes!yes! ! - !yes!yes! ! - !yes!yes! !yes! !yes!yes!yes!yes!yes! !KCC 4.0f0 !yes!yes! ! ? !yes!yes! !yes!yes!yes! !yes! !yes!yes!yes!yes!yes! !AIX xlC ! - ! - ! ! ? ! - ! - ! ! - ! - !yes! ! - ! ! - ! - ! - ! - ! - ! !Sun CC 4.2 ! - ! - ! ! ? ! - ! - ! ! - ! - !yes! ! - ! ! - !yes! - ! - ! - ! !SGI CC 7.2.1!yes!yes! ! - ! - ! - ! ! - ! - !yes! ! - ! !yes!yes!yes!yes!yes! !HP CC ! - ! - ! ! ? ! - ! - ! ! - ! - !yes! ! - ! ! - ! - ! - ! - ! - ! +------------+---+---+ +---+---+---+ +---+---+---+ +---+ +---+---+---+---+---+ clhep-2.1.4.1.orig/Exceptions/0000755000175000017500000000000012242515141014513 5ustar olesolesclhep-2.1.4.1.orig/Exceptions/Exceptions-config.in0000755000175000017500000000406412234340066020441 0ustar olesoles#! /bin/sh # @configure_input@ # we include the paths of the original install directories for reference orig_prefix="@prefix@" orig_exec_prefix="@exec_prefix@" orig_includedir="@includedir@" # use the full name of this script to get the current path configpath=`dirname ${0}` # check for a leading slash to determine if this is a relative path firstc=`expr ${configpath} : "\/"` calldir=`pwd` if [ ${firstc} -eq 0 ] then cd "${calldir}/${configpath}"; newpath=`pwd` binpath=${newpath} else binpath=${configpath} fi # OK - now we have to strip the trailing "/bin" out of the path prefix=`dirname "${binpath}"` includedir=${prefix}/include libdir=${prefix}/lib usage() { cat < /configure --prefix= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make check (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # configure options #------------------------------------------------------------- A variety of options can be given to configure. Below is a list of the options that you are likely to find most useful. --help provides a partial list of options --prefix=PREFIX install architecture-independent files in PREFIX [default is /usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [default is the same as PREFIX] --disable-shared build only static libraries --disable-static build only shared libraries --enable-exceptions use the CLHEP/Exceptions package --disable-exceptions DO NOT use the CLHEP/Exceptions package [--disable-exceptions is the default] #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are neither built nor installed automatically. Use the following commands to build and install documents: make docs make install-docs #------------------------------------------------------------- # building from cvs #------------------------------------------------------------- You will need current versions of automake, autoconf, and libtool. See building autotools below. cvs co CLHEP/package OR cvs co package cd [CLHEP/]package ./bootstrap Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building autotools #------------------------------------------------------------- If you do not have at least autoconf 2.59 and automake 1.9.1, you will need to build autoconf, automake, and libtool. On some platforms, you may also need to build m4 and texinfo. Download the relevant tarballs from gnu.org (http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/, and http://www.gnu.org/software/libtool/) Untar them in a common source code tree. Decide whether you want to install them in /usr/local or your own install directory. If you use your own install directory, use --prefix= with configure. For each autotool package: /configure [--prefix=] make make install Make sure that /bin is at the front of your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/Exceptions/Exceptions-deps.in0000755000175000017500000000023110043511633020113 0ustar olesolesCLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-RefCount-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Cast-@VERSION@ clhep-2.1.4.1.orig/Exceptions/Makefile.am0000755000175000017500000000450610233520632016556 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP # put . first so that CLHEP directory is built before anything else SUBDIRS = Exceptions . src test # list all subdirectories - for distribution and cleaning DIST_SUBDIRS = Exceptions . src test doc bin_SCRIPTS = Exceptions-config all-local: $(top_builddir)/CLHEP # create temporary CLHEP header tree # we only copy headers for packages listed in @PACKAGE@-deps # search for header directories in the following order: # 1. $(top_builddir)/this-package # 2. $(top_builddir)/../other-packages # 3. $(CLHEPSOURCE_DIR)/CLHEP # 4. $(CLHEP_DIR)/include/CLHEP # # abs_ => absolute path abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ COPY_P = @COPY_P@ $(top_builddir)/CLHEP: temp-package-dirs @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ if test -d "$$pkg" ; then \ (cd $$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d ../"$$pkg"/"$$pkg" ; then \ (cd ../$$pkg/$$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg"; then \ hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ else \ if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/include/CLHEP; then \ if test -d $(CLHEP_DIR)/include/CLHEP/"$$pkg"; then \ hdrs=`ls $(CLHEP_DIR)/include/CLHEP/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEP_DIR)/include/CLHEP/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ fi; \ fi; \ fi; \ fi; \ fi; \ done; temp-package-dirs: $(mkinstalldirs) $(abs_top_builddir)/CLHEP; @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ $(mkinstalldirs) $(abs_top_builddir)/CLHEP/$$pkg; \ done; docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs # extra clean rule clean-local: rm -rf $(top_builddir)/CLHEP clhep-2.1.4.1.orig/Exceptions/bootstrap0000755000175000017500000000071510233520632016460 0ustar olesoles#! /bin/sh set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 rm -f Makefile.in */Makefile.in */defs.h.in rm -f autotools/config* autotools/depcomp autotools/install-sh autotools/m* rm -f configure config.* # run autotool commands aclocal -I autotools autoheader automake --add-missing --copy autoconf # ready to make a source code distribution tarball clhep-2.1.4.1.orig/Exceptions/configure.ac0000755000175000017500000003046412241267303017016 0ustar olesoles# ====================================================================== # This is the Exceptions configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.59) AC_INIT(CLHEP Exceptions, 2.1.4.1, http://savannah.cern.ch/projects/clhep/, Exceptions) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([src/ZMerrno.cc]) AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # ---------------------------------------------------------------------- # --enable-shared and --enable-static # both shared and static libraries are built by default # ---------------------------------------------------------------------- AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Header containing #defines: AM_CONFIG_HEADER([Exceptions/defs.h]) # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Exceptions/Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([doc/Makefile]) AC_CONFIG_FILES([Exceptions-deps]) AC_CONFIG_FILES([Exceptions/copy-header.pl], [chmod +x Exceptions/copy-header.pl]) # Configuration inquiry program/script: AC_CONFIG_FILES([Exceptions-config], [chmod +x Exceptions-config]) # Test driver program/script: AC_CONFIG_FILES([test/testExceptions.sh], [chmod +x test/testExceptions.sh]) AC_CONFIG_FILES([test/testzmex.sh], [chmod +x test/testzmex.sh]) AC_CONFIG_FILES([test/testThrowFrom.sh], [chmod +x test/testThrowFrom.sh]) AC_CONFIG_FILES([test/exctest1.sh], [chmod +x test/exctest1.sh]) AC_CONFIG_FILES([test/exctest2.sh], [chmod +x test/exctest2.sh]) AC_CONFIG_FILES([test/exctest3.sh], [chmod +x test/exctest3.sh]) AC_CONFIG_FILES([test/exctest4.sh], [chmod +x test/exctest4.sh]) AC_CONFIG_FILES([test/exctestNothrow.sh], [chmod +x test/exctestNothrow.sh]) AC_CONFIG_FILES([test/excDblThrow.sh], [chmod +x test/excDblThrow.sh]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- Exceptions_CPPFLAGS="-I$includedir" Exceptions_LDFLAGS="-L$libdir" Exceptions_LIBS="-lCLHEP-$PACKAGE-$VERSION" AC_SUBST(Exceptions_CPPFLAGS) AC_SUBST(Exceptions_LIBS) AC_SUBST(Exceptions_LDFLAGS) # ---------------------------------------------------------------------- # Supply boilerplate for Exceptions/defs.h source header: # ---------------------------------------------------------------------- AH_TOP([#ifndef EXCEPTIONS_DEFS_H #define EXCEPTIONS_DEFS_H]) ## the undefs are converted by configure AH_VERBATIM([PACKAGE],[/* Name of package */ #ifndef PACKAGE #undef PACKAGE #endif]) AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif]) AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */ #ifndef PACKAGE_NAME #undef PACKAGE_NAME #endif]) AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #undef PACKAGE_STRING #endif]) AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif]) AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */ #ifndef PACKAGE_VERSION #undef PACKAGE_VERSION #endif]) AH_VERBATIM([VERSION],[/* Version number of package */ #ifndef VERSION #undef VERSION #endif]) AH_BOTTOM([#endif // EXCEPTIONS_DEFS_H]) # ---------------------------------------------------------------------- # Account for any user configuration options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; icc) useicc=true case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AM_CONDITIONAL(USING_ICC, test x$useicc = xtrue) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Set system-dependent options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed libraries: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed header files: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed typedefs, structures, and compiler characteristics: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed library functions: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/Exceptions/COPYING.LESSER0000644000175000017500000001674311406166731016565 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/Exceptions/README0000755000175000017500000000247010043511633015400 0ustar olesolesExceptions Package Release Notes -------------------------------- (NON-Release) Beta version 21-Nov-1997 W E Brown This version of the Exceptions package is incorporated into pre-released versions of ZOOM packages including HepTuple, and is tested on the supported platforms. The exceptions will, by default, log in a sensible way. Users obtaining ZOOM packages that may ZMthrow exceptions should be able to do all the necessary activities: Setting handlers and loggers, catching exceptions ultimately thrown rather than ignored, and so forth. Formal release is delayed until documentation supporting user-defined ZOOM exceptions is prepared, and until the HepTuple package ZMexception instrumentation is tested. - - - Alpha release 07-Oct-1997 W E Brown This version of the Exceptions package is now available for testing by knowledgeable users. Its documentation is currently in preparation; the current working draft may be found online at: fnal.gov/docs/working-groups/fpcltf/Pkg/Exceptions/doc/html/0Exceptions.html User feedback is actively solicited. Please direct your questions, comments, or bug reports to wb@fnal.gov. fnal.gov/docs/working-groups/fpcltf/Pkg/Exceptions/doc/html/0Exceptions.html User feedback is actively solicited. Please direct your questions, comments, or bug reports to wb@fnal.gov. clhep-2.1.4.1.orig/Exceptions/doc/0000755000175000017500000000000012242515141015260 5ustar olesolesclhep-2.1.4.1.orig/Exceptions/doc/whyZMthrowRethrows.txt0000755000175000017500000000346610043511633021734 0ustar olesolesWhen exceptions are enabled, the ZMthrow macro looks like: #define ZMthrow(userExcept) \ do { \ try { throw userExcept; } \ catch ( const ZMexception & x ) { \ if ( ZMthrow_( x, __LINE__, __FILE__ ) == ZMexThrowIt ) { \ throw; \ } \ } \ } while (false) Why do we have to do that apparently convoluted try/catch block. After all, we know the try part will throw... why not just do: #define ZMthrow(userExcept) \ do { \ if ( ZMthrow_( x, __LINE__, __FILE__ ) == ZMexThrowIt ) { \ throw x; \ } \ } while (false) Well, consider how ZMthrow is typically used: ZMthrow (ZMexBadThing("explanatory text")); The simpler code would expand this to do { if ( ZMthrow_( ZMexBadThing("explanatory text"), __LINE__, __FILE__ ) == ZMexThrowIt ) { throw ZMexBadThing("explanatory text"); } } while (false) Notice that the exception object is constructed twice; any side effects of that construction would occur twice. The semantics of throw x, on the other hand, are that x is not constructed an extra time. The macro used achievs this: The x reference is passed to ZMthrow but that does not require construction, and the re-throw also does not. clhep-2.1.4.1.orig/Exceptions/doc/m-pcanal-30000755000175000017500000001547010043511633017044 0ustar olesolesFrom pcanal@fndaub Wed Jul 9 16:17:45 1997 > > I thought handler(whatever) was the routine that establishes the handler. > Yes, we can distinguish the two by signature, but to me that feels like > having a write(val) and a value=read() method, only calling the read method > value=write(). Possible but not as clear. I agree with this point ... so settling for setHandler() and handler() seems appropriate From mf Wed Jul 9 14:02:47 1997 Philippe Canal writes: > > >> 4 - The status of what was set up for ignoring and handling may be probed, so >> temporary control be havior can be set and then put back to what it was:> >> >> GetHandler() returns the estabished handler (and we have to decide how >> to cope with the two different handler signatures!!).>> >> >> int ignoreStatus(); // 1 - ignore was specified >> // -1 - dontIgnore was specified >> // 0 - neither was specified; use status from >> // parent >> void setIgnoreStatus(int); > >A few comments: > >the documents may (or may not) need to be updated in its ealier part ( >it talks about the ignore() and dontIgnore() methods). > I think it is OK there. >the return ignoreStatus() returns may be more flexible with the following >semantics: > -1: always ignore > 0: don't Ignore > 1-999999: ignore this number of times. > I prefer to let the user set up "ignore this number of times" by having a handler. However, perhaps our "ignore" concept should be extended to include a possibility meaning "ignore completely without even calling handler". In that case, modifying the ignore and dontIgnore() methods to control this would be sensible. >Comestically (unless ZOOM has any other standard) GetHandler might just >as well be called handler(). > I thought handler(whatever) was the routine that establishes the handler. Yes, we can distinguish the two by signature, but to me that feels like having a write(val) and a value=read() method, only calling the read method value=write(). Possible but not as clear. >It should be make clear where handler() and ignoreStatus return the >information contained in the current class OR the information that will be >actually used for the class (those two will be different if the a top class >have been set while the sub class has not). Good point. The intent was the info in the current class. But maybe there needs to be a method for the other. > >I dont remember if the document explained what happen if: > >HepTuple::ZMxGeneral::handler() == MyGeneralHandler() >HepTuple::ZMxCapture::ignoreStatus() == don't ignore .... >HepTuple::ZMxCapture::handler() == NULL > >If I ZMthrow a HepTuple::ZMxCapture is going to: > run MyGeneralHandler() I did not think about establishing a NULL handler explicitly. Probably the way to establish a trivial handler just to prevent the invoking of a parent handler is to make one and set the handler to that, rather than to use NULL. The way I had it, the above code WOULD call MyGeneralHandler, but I don't know this is the right way to work it. > throw a HepTuple::ZMxCapture:: Should do so only if MyGeneralHandler() returns true. >How to I tell force it to throw a HepTuple::ZMxCapture:: ? write a handler that always returns true. Or have a trivial handler (or no handler up the line) and set the dontIgnore. I RAN OUT OF TIME TO ANSWER REST OF THIS, WILL ANSWER LATER. >Do I need to set an handler that returns false ? > >In a more general sense what is the interaction/precedence of >the ignoreStatus and the handler pointer > >Do we still have two different handler signatures ? > >Philippe. > From pcanal@fndaub Wed Jul 9 13:32:43 1997 > > No, according to Mengel there are some circumstances in which it misbehaves a nd > others where it is OK. > Do we know the circunstance where it does not misbehave ? From pcanal@fndaub Wed Jul 9 12:02:43 1997 Status: RO Hi, I suspect that you are aware of the fact that as of gcc 2.7.2, exception do not work on MIPS platforms. (actually it just ignore the throw). Philippe Canal, pcanal@fnal.gov, 630-840-2545. From pcanal@fndaub Wed Jul 9 16:17:45 1997 d handler() seems appropriate From pcanal@fndaub Wed Jul 9 11:12:43 1997 > 4 - The status of what was set up for ignoring and handling may be probed, so > temporary control be havior can be set and then put back to what it was:> > > GetHandler() returns the estabished handler (and we have to decide how > to cope with the two different handler signatures!!).>> > > int ignoreStatus(); // 1 - ignore was specified > // -1 - dontIgnore was specified > // 0 - neither was specified; use status from > // parent > void setIgnoreStatus(int); A few comments: the documents may (or may not) need to be updated in its ealier part ( it talks about the ignore() and dontIgnore() methods). the return ignoreStatus() returns may be more flexible with the following semantics: -1: always ignore 0: don't Ignore 1-999999: ignore this number of times. Comestically (unless ZOOM has any other standard) GetHandler might just as well be called handler(). It should be make clear where handler() and ignoreStatus return the information contained in the current class OR the information that will be actually used for the class (those two will be different if the a top class have been set while the sub class has not). I dont remember if the document explained what happen if: HepTuple::ZMxGeneral::handler() == MyGeneralHandler() HepTuple::ZMxCapture::ignoreStatus() == don't ignore .... HepTuple::ZMxCapture::handler() == NULL If I ZMthrow a HepTuple::ZMxCapture is going to: throw a HepTuple::ZMxCapture:: run MyGeneralHandler() How to I tell force it to throw a HepTuple::ZMxCapture:: ? Do I need to set an handler that returns false ? In a more general sense what is the interaction/precedence of the ignoreStatus and the handler pointer Do we still have two different handler signatures ? Philippe. From pcanal@fndaub Tue Jul 8 14:17:39 1997 > > I think you are right. The first argument should be a ZMexception&. Then > when we do > class ZMxCapture : public ZMexception { ... } > : > : > ZMexcept ( ZMxCapture ("a message"), line, file, data, time ); > > And > ZMexcept ( ZMexception &x, int line, > char file[], char data[], char time[]) { > : > : > throw x; > } > > this will (I think) throw the ZMxCapture. If not, we will need to make it > a ZMexception* and do: > > class ZMxCapture : public ZMexception { ... } > : > : > ZMexcept ( *ZMxCapture ("a message"), line, file, data, time ); > > And > ZMexcept ( ZMexception *x, int line, > char file[], char data[], char time[]) { > : > : > throw *x; > } > > which is less elegant but may be necessary. Actually I think the right solution is to have ZMexcept being a template: template void ZMexcept ( exception x, int line, char file[], char date[], char time[]); clhep-2.1.4.1.orig/Exceptions/doc/ex-design-10000755000175000017500000002536410043511633017240 0ustar olesoles ZOOM Exception Mechanism Design ------------------------------- The Zoom exception mechanism is intended to be the tools used by ZOOM modules to handle exceptions in a useful way and provide the user with interfaces to control how to react to problems. It is not (at this time) intended to be a mechanism for the user to hook into to define his own exceptions, althogh that may come later. We need the mechanism "now" because we are trying to deliver at least two packages which will have to be re-instrumented when the mechanism is finally adopted. This is not a "signal handler" mechanism, which could be used to establish behavior for segment violations, arthmetic exceptions, and so forth. It would be nice to have this but C++ does not provide generic support for those activities. A **later** possibility will be to provide this support for POSIX-compliant operating systems, and coordinate it with the exception mechanism. We need to be able to cope with the following realities: -------------------------------------------------------- 1 - Users will not, in every case, imbed calls into a try block. 2 - Frameworks will incorporate code from multiple users and in some circumstances cannot afford to abort the entire job if some rare path in one user's code blows up. To the extent we can help with this, we must. 3 - Framework creators CAN be expected to imbed portions in try blocks, or set up behaviors for various exceptions, assuming we give them the necessary tools. In the remainder of this document, the "user" who sets things up is assmued to be such a framework manager. 4 - There is need for coordinated logging and related behavior. To be able to satisfy this, the goal is to allow: ------------------------------------------------- 1 - The user should be able to specify, for a given sort of exception, whether she wants to: a - Throw the exception via the C++ mechanism, thus aborting unless she in the framework or a lower-level user responsible catchs the problem. b - Invoke a user-written handler when the exception occurs, which may itself determine it is necessary to throw the exception. c - Ignore the exception RETURNING TO THE SPOT IN THE ZOOM MODULE THAT DETECTED THE PROBLEM. This can happen with or without a handler being invoked. Typically, the module will then return some approriate pseudo-value to the user. 2 - In cases where exceptions are to be handled or ignored, there should be a well-known way to get information about the existance of a problem, analogous to the errno mechanism in C. 3 - Explanatory strings should be associated with the problem at the point of origin. 4 - The exceptions are organized in a hierarchical manner, which uniformly applies one simple category philosophy that the users can understand, across the various ZOOM packages. With this in mind, our mechanism has the following structure: ------------------------------------------------------------- 1 - Upon detecting a problem for which it would like to (potential) throw an exception, the module code will instead invoke the ZMthrow macro. 2 - ZMthrow takes as its argument a ZMexception object constructor, which has as ITS first argument a const char*. The intent is for the ZMexception object actually do be derived from the base ZMexception class, and for the char* first argument to contain an explanatory message. Particular ZMexceptions can also have construction forms taking a second string, or whatever. For example, ZMthrow ( ZMexceptHepTupleCapture( "Column not found", name ) ); 3 - The ZMthrow macro appends __LINE__, __FILE__, __DATE__, __TIME__ and calls ZMexcept. 4 - ZMexcept has signature void ZMexcept ( ZMexception x, int line, char file[], char data[], char time[]); It does the following: a - Places x.ZMexceptionId into a circular buffer ZMerrno. Actually, constructing the ZMexcept object does that. More about ZMerrno later. b - Determines for this exception what sort of logging is enabled, and logs it. c - Determines whether a handler has been established, and if so invokes it. The handler will be passed the exception object, and can be set up to also take the line/file/time arguments. The handler returns a bool which if true will say to throw the exception. d - Determines (after any handler has been invoked) whether to ignore the exception. It will do either throw x; or return; 5 - ZMerrno is analogous to the C/Unix errno mechanism, but allows viewing a history of the last N problems detected. The interface is: a - ((creation somehow, specifying N)) b - ZMerrno.write (int id); // put on stack exception id. The user would not use a and b but would use: c - int ZMerrno.read (); // read the last value on ZMerrno int ZMerrno.read (int k); // read the last-but-k value on ZMerrno d - void ZMerrno.clear(); // put a zero (indicating no current error) // on ZMerrno. e - void ZMerrno.pop(); // remove an entry setting the top to the // previous entry. For instance, if you // have a loop in which some known ignorable // happening places a value on ZMerrno, you // can pop each one so as not to wipe out // the history for others. Thus after the start, or after ZMerrno.clear(), the user can always find out whether any ignored exceptions had occured by doing if (ZMerrno.read()) { ... then something has happened } If we later incorporate signal handling, this ZMerrno stack is where the user can find out whether he has had his arithmetic error since the last clear. 6 - The id 0 indicates no error. Each upper 16-bit value is assigned to a module to avoid conflicts; the values starting with upper bit set are reserved for user definition at a later date. The lower 16 bits distinguish the specific error. Each ZMexception object class has its own error id which is established (hardwired) at construction. The ZMexception codes for the upper 16 bits are defined in ZMexception.h. The lower 16 bits, for each module are defined in files with names like HepTupleZMexception.h. 7 - When a ZMexcept exception is thrown it does a ZMerrno.write(this.id). Thus ZMerrno tracks these exceptions even if they are explicitly thrown and caught by the user outside the ZMthrow/ZMexception mechanism. The user interface to control exception behavior is: ----------------------------------------------------- By the way, this is an interface for the framework manager to use; the lower level user would generally never establish handlers or ignores, and would only use the ZMerrno.read() and .clear(). 1 - To establish a handler for a particular exception type, say for ZMexceptCapture: ZMexceptHepTupleCapture.handler ( myhandler ); The signature of the handler may be either: bool myhandler ( ZMexcept x, string message ); or bool myhandler ( ZMexcept x, string message, int line, char file[], char date[], char time[] ); (The ZMexcept.handler() method of has two different signatures based on the signature of the assigned handler, so the proper call will be set up.) The handler should return false to ignore the exception and return to the user code (from ZMexcept), or true to throw the exception after the handler returns. The user can also throw an exception explicitly in the handler. 2 - You may establish a handler for an entire base class, which applies to any ZMexceptions derived from in that class for which no specific handler is established. For example, ZMexceptHepTupleNewColumn is derived from ZMexceptHepTuple so ZMexceptHepTuple.handler ( myDefaultHandler ); will apply to ZMexceptHepTupleNewColumn if that is ever ZMthrown. 3 - Note that if a handler is established for a subclass it takes precedence over that for the base class. If you instead wish to call the base class handler after executing the specific handler, you must invoke it explicitly. Only if no handler has been established will the exception check for and invoke a handler in its base class automatically. 4 - The user can tell the system to whether or not to ignore an unhandled ZMexception: ZMexceptHepTupleCapture.ignore() ZMexceptHepTupleCapture.dontIgnore() The default is don't ignore -- meaning throw the exception unless a handler is invoked and comes back false. The same rules for inheritance apply as in the handler case: If you haven't specifically said anything about a subclass, then what you have said about the base class will apply. 5 - The ZMerrno methods may be used to see if (ignored) exceptions have happened. Typically, the user used to Unix exceptions would call ZNerrno.read() and maybe ZMerrno.clear(). 6 - The ordinary user can try, and catch, these ZMexceptions. We ask that usrs not throw ZMexceptions that the ZOOM modules throw. Later we may extend support to include user-defined subclasses of ZMexception. The following usage recommendations pertain to writers of ZOOM code: -------------------------------------------------------------------- Don't create too many types of exceptions. The error codes appearing on the ZMerrno stack are defined per each type, but unless you envision the user needing to AUTOMATICALLY distinguish between one problem and another in the same submodule via ZMerrno, don't define them as two separate exception types. In cases where the user interface promises a routine will not throw an exception (but might return false if something goes awry) the ZOOM code itself should enclose any possible ZMthrows in try blocks, to catch the problem in case the user has not specified ignoring the exception. Note that the argument to the constructor of the ZMexception in ZMthrow can (and often will) be a string formed by concatenating some fixed informatory message with some variable information, as in ZMthrow ( ZMexceptHepTupleCapture( "Column not found", name ) ); To do this, one should have a constructor for that sort of ZMexceptoin object with the extra argument in its signature, as well as the one with just a const char[]. One could alternatively do someting like ZMthrow ( ZMexceptHepTupleCapture( strcat("Column not found", name) ) ); but if you use the exception in more than one place, the recommended second constructor is less work. When returning a pointer, in circumstances where things have gone wrong, the usual action is to return a null pointer. In many cases this is appropriate, especially if the user interface defines it. However, the sloppy user might cause an (uncatchable) bus error if he does not check for null pointer. Consider returning a pointer to a braindead object (whose methods throw ignorable ZMthrows) rather than NULL -- then the job might not abort. clhep-2.1.4.1.orig/Exceptions/doc/ex-design-50000755000175000017500000004422410043511633017240 0ustar olesolesFrom pcanal@fndaub Thu Jul 10 13:02:56 1997 Received: from FNAL.FNAL.Gov by fncrd8.fnal.gov via ESMTP (950413.SGI.8.6.12/911001.SGI) for id MAA09837; Thu, 10 Jul 1997 12:58:14 -0500 Received: from fndaub.fnal.gov ("port 1913"@fndaub.fnal.gov) by FNAL.FNAL.GOV (PMDF V5.0-8 #3998) id <01IL2MCCY2N6000NXX@FNAL.FNAL.GOV> for mf@FNAL.FNAL.GOV; Thu, 10 Jul 1997 12:58:14 -0600 Received: from localhost by fndaub.fnal.gov via SMTP (951211.SGI.8.6.12.PATCH1042/911001.SGI) id MAA25542; Thu, 10 Jul 1997 12:58:13 -0500 Date: Thu, 10 Jul 1997 12:58:13 -0500 (CDT) From: Philippe Canal Subject: exception design To: pcanal@fndaub, mf@FNAL.GOV Message-id: <199707101758.MAA25542@fndaub.fnal.gov> MIME-version: 1.0 X-Mailer: exmh version 1.6.6 3/24/96 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Status: RO ZOOM Exception Mechanism Design ------------------------------- The Zoom exception mechanism is intended to be the tools used by ZOOM modules to handle exceptions in a useful way and provide the user with interfaces to control how to react to problems. It is not (at this time) intended to be a mechanism for the user to hook into to define his own exceptions, although that may come later. Frankly, successful implementation and use by ZOOM modules will be necessary to sell this structure to our users as potentially useful, anyway. We need the mechanism "now" because we are trying to deliver at least two packages which will have to be re-instrumented when the mechanism is finally adopted. This is not a "signal handler" mechanism, which could be used to establish behavior for segment violations, arthmetic exceptions, and so forth. It would be nice to have this but C++ does not provide generic support for those activities. A **later** possibility will be to provide this support for POSIX-compliant operating systems, and coordinate it with the exception mechanism. We need to be able to cope with the following realities: - -------------------------------------------------------- 1 - Users will not, in every case, imbed calls into a try block. 2 - Frameworks will incorporate code from multiple users and in some circumstances cannot afford to abort the entire job if some rare path in one user's code blows up. To the extent we can help with this, we must. 3 - Framework creators CAN be expected to imbed portions in try blocks, or set up behaviors for various exceptions, assuming we give them the necessary tools. In the remainder of this document, the "user" who sets things up is assmued to be such a framework manager. 4 - There is need for coordinated logging and related behavior. To be able to satisfy this, the goal is to allow: - ------------------------------------------------- 1 - The user should be able to specify, for a given sort of exception, whether she wants to: a - Throw the exception via the C++ mechanism, thus aborting unless she in the framework or a lower-level user responsible catchs the problem. b - Invoke a user-written handler when the exception occurs, which may itself determine it is necessary to throw the exception. c - Ignore the exception RETURNING TO THE SPOT IN THE ZOOM MODULE THAT DETECTED THE PROBLEM. This can happen with or without a handler being invoked. Typically, the module will then return some approriate pseudo-value to the user. 2 - In cases where exceptions are to be handled or ignored, there should be a well-known way to get information about the existance of a problem, analogous to the errno mechanism in C. 3 - Explanatory strings should be associated with the problem at the point of origin. 4 - The exceptions are organized in a hierarchical manner, which uniformly applies one simple category philosophy that the users can understand, across the various ZOOM packages. With this in mind, our mechanism has the following structure: - ------------------------------------------------------------- 1 - Upon detecting a problem for which it would like to (potential) throw an exception, the module code will instead invoke the ZMthrow macro. 2 - ZMthrow takes as its argument a ZMexception object constructor, which has as ITS first argument a const char*. The intent is for the ZMexception object actually do be derived from the base ZMexception class, and for the char* first argument to contain an explanatory message. Particular ZMexceptions can also have construction forms taking a second string, or whatever. For example, ZMthrow ( HepTuple::ZMxCapture( "Column not found", name ) ); 3 - The ZMthrow macro appends __LINE__, __FILE__ and calls ZMexcept. 4 - ZMexcept has signature template void ZMexcept ( Exception x, int line,char file[]); It does the following: a - Places a copy of the exception object x into a circular buffer ZMerrno. More about ZMerrno later. b - Determines for this exception what sort of logging is enabled, and logs it. Note that derived exceptions must modify the general logging method if they wish to include information beyond the message and file/line/time stamp. c - Determines whether the exception needs to be ignored, if so return d- Determines whether the exception a handler has been established, and if so invokes it. The handler will be passed the exception object, and can be set up to also take the line/file/time arguments. The handler returns a bool which if true will say to throw the exception. d - Determines (after any handler has been invoked) whether to ignore the exception. It will do either throw x; or return; 5 - ZMerrno is analogous to the C/Unix errno mechanism, but allows viewing a history of the last N problems detected. We anticipate using it like errno, via exception id, but we copies of place the whole exception object onto ZMerrno to provide more info if desired. The interface is: a - ((creation somehow, specifying N)) b - ZMerrno.write (ZMexcption* x); // copy an exception onto ZMerrno The user would not use a and b but would use: c - string ZMerrno.read (); // read the last id value on ZMerrno string ZMerrno.read (int k); // read the last-but-k id value on ZMerrno d - void ZMerrno.clear(); // put a zero (indicating no current error) // on ZMerrno. e - void ZMerrno.pop(); // remove an entry setting the top to the // previous entry. For instance, if you // have a loop in which some known ignorable // happening places a value on ZMerrno, you // can pop each one so as not to wipe out // the history for others. f - ZMexception* ZMerrno.get() // Return pointer to the last or ZMexception* ZMerrno.get(int k) // last-but-k exception on ZMerrno. // Allows perusal of things like the // message and the logger and handler // used when the exception was // encountered. Thus after the start, or after ZMerrno.clear(), the user can always find out whether any ignored exceptions had occured by doing if (!ZMerrno.read().empty()) { ... then something has happened } If we later incorporate signal handling, this ZMerrno stack is where the user can find out whether he has had his arithmetic error since the last clear. ZMerrno is pronounced "oops." 6 - The id empty string indicates no error. The id is a string representing the unique name of the exception class. Each ZMexception object class has its own error id which is established (hardwired) at construction. 7 - When a ZMexcept is thrown it does a ZMerrno.write(x). Thus ZMerrno tracks these exceptions even if they are explicitly thrown and caught by the user outside the ZMthrow/ZMexception mechanism. 8 - Logging is discussed separately. The user interface to control exception behavior is: - ----------------------------------------------------- By the way, this is an interface for the framework manager to use; the lower level user would generally never establish handlers or ignores, and would only use the ZMerrno.read() and .clear(). 1 - To establish a handler for a particular exception type, say for ZMexceptCapture: HepTuple::ZMxCapture.setHandler ( new ZMhandler(myhandler) ); The handlerName string gives a convenient way to tell about the handling in log messages ("... was handled by mySuperHandler"). The signature of the handler must be: bool myhandler ( ZMexception *x ); We will have a ZMhandler class to contain that and the handlerName. Note that the handler has access to the fields of x including for all ZMexception objects: char* message; int line; char* sourceFileName; int serialNumber; ZMhandler* handler; ZMlogger* logger; // and class-wide data: static int id; static char* messagePreamble; static int count; and, for particular derived ZMexception objects, any secondary messages or other information provided to the constructor and kept in the object. The handler should return false to ignore the exception and return to the user code (from ZMexcept), or true to throw the exception after the handler returns. The user can also throw an exception explicitly in the handler. 2 - You may establish a handler for an entire base class, which applies to any ZMexceptions derived from in that class for which no specific handler is established. For example, HepTuple::ZMxNewColumn is derived from HepTuple::ZMxGeneral so HepTuple::ZMxGeneral.setHandler ( myDefaultHandler ); will apply to HepTuple::ZMxNewColumn if that is ever ZMthrown. 3 - Note that if a handler is established for a subclass it takes precedence over that for the base class. If you instead wish to call the base class handler after executing the specific handler, you must invoke it explicitly. Only if no handler has been established will the exception check for and invoke a handler in its base class automatically. 4 - Four default handler types are provides: ZMignore ZMthrow ZMparentHandler ZMingnoreCount ZMparentHandler is the default handler. The default for the top most exception class is ZMparentHandler 4a- At times you may wish to prevent the calling of the base class handler yet have no need for explicit handling. In which case you would set the handler for this class to ZMignore or ZMthrow. 4b- The user can tell the system to whether or not to ignore an unhandled ZMexception: HepTuple::ZMxCapture.ignore() HepTuple::ZMxCapture.dontIgnore() HepTuple::ZMxCapture.default() The default is don't ignore -- meaning throw the exception unless a handler is invoked and comes back false. The same rules for inheritance apply as in the handler case: If you haven't specifically said anything about a subclass, then what you have said about the parent class will apply. Thus calling dontIgnore() is NOT the same as not calling ignore(). In analogy with handling, we need a way to say "pretend I never said ignore or dont; use the parent class decision". This is: HepTuple::ZMxCapture.setHandler(new ZMparentHandler) 5 - Sometimes you may want to ignore an exception the first N times and then react differently. The handler can have a static count variable to implement this behavior. Alternatively, there is a call to establish this behavior even if no handler is used: HepTuple::ZMxCapture.setHandler(new ZMignoreCount(N)) The part of the interface seen by non-framework-manager users is simpler: - -------------------------------------------------------------------------- 1 - The ZMerrno methods may be used to see if (ignored) exceptions have happened. Typically, the user used to Unix exceptions would call ZNerrno.read() and maybe ZMerrno.clear(). 2 - The ordinary user can try, and catch, these ZMexceptions. We ask that usrs not throw ZMexceptions that the ZOOM modules throw. Later we may extend support to include user-defined subclasses of ZMexception. 3 - When an exception occurs and is not ignored, the user will know the message given for the exception, as well as the and line number where the ZMthrow macro was invoked. This is inside ZOOM code. By doing debug core the user can get a traceback into the user routines to find which line of his code encountered the problem. 4 - The status of what was set up for ignoring and handling may be probed, so temporary control behavior can be set and then put back to what it was: handler() returns the established handler. logger() returns the established logger. Logging is handled as follows: - ------------------------------ 0 - The connection between a class of ZMexceptions and logging that is through a ZMlogger. The (framework) user may create her own logger but typically will use our provided class ZMlog, which has is a ZMlogger and has a constructor taking a file name. Any actions taken by the logger we describe below will refer to how ZMlog behaves. 1 - Every individual ZMexception object can have a method for creating (from the other arguments aside from messge) a string to put into a log. (Of course, it may be inherited from its base class.) But the message as well as time, line, id, and so forth is not to be handled by each; instead, ZMthrow handles this. The method to create the string is logMessage(). ZMexcept will at various points call the logThis() method of the established logger when it wants to log information. 1a- The user assgns a ZMlogger to an exception class by ZMexception::setLogger(ZMlogger*). For example, ZMlog* mylog ("logfilename.txt"); ZMxCapture::setLogger(mylog); The pointer returned should be checked. In the case of ZMlog, it can be NULL for two reasons: The file cannot be opened for append, or the file is already open for some other purpose. (If it is already opened for logging, that is fine; this logger will also cause logging of messages there). 2 - ZMexception has a method setLogger(ZMlogger) which will open a log using that logger for that type of exception. This will establish this logger to be used for exceptions of this class. In the case of ZMlog, that means it will establish the file which was provided when the logger was constructed, as a logging point for exceptions of this class. (This is class static information.) 2a- The ZMlog object will log to a file: its constructor will open a log to that file for that type of exception. A user can provide a different logger which, for example, ties into the CDF or D0 general logging mechanism instead of writing to a file. 3 - If no logging is specified for a class the file defaults to the base class. Thus HepTuple::ZMxCapture might log to the file for HepTuple::ZMxGeneral, or if no logging is established there, for ZMexception. It is possible (the default) that no logging is established anywhere. 4 - You may log to multiple files; each ZMexception (sub)class has a class static linked list of log files. 5 - Aside from single files, you can also establish a "rolling log" pair of files: ZMrollingLog* mylog (const char filename1[], const char filename2[], int n ); bool ZMexception::setLogger(mylog); The way this works is that the first file is opened (still for append), and up to n exception instances are logged into it, at which point it is closed, renamed to the second file, and re-created (empty) for more logging. A script can detect when this has happended and archive the second file if desired. 6 - If you wish to cease logging a particular exception type in general or to a particular log file, you may: HepTuple::ZMxCapture.stopLog(); If no exceptions are logging to a particular log anymore, that file will be closed. 7 - To be able to temporarily modify logging behavior for an exception, you may call ZMlog* oldLog = logger(), and later call setLogger(oldLog) The following usage recommendations pertain to writers of ZOOM code: - -------------------------------------------------------------------- As shown in the examples, place your definitions of the exception objects inside the class definition for the class. That way, methods within this class can simply call the shorter name -- ZMxCapture rather than ZMxHepTupleCapture. Don't create too many types of exceptions. The error codes appearing on the ZMerrno stack are defined per each type, but unless you envision the user needing to AUTOMATICALLY distinguish between one problem and another in the same submodule via ZMerrno, don't define them as two separate exception types. In cases where the user interface promises a routine will not throw an exception (but might return false if something goes awry) the ZOOM code itself should enclose any possible ZMthrows in try blocks, to catch the problem in case the user has not specified ignoring the exception. Note that the argument to the constructor of the ZMexception in ZMthrow can (and often will) be a string formed by concatenating some fixed informatory message with some variable information, as in ZMthrow ( ZMxCapture( "Column not found", name ) ); To do this, one should have a constructor for that sort of ZMexceptoin object with the extra argument in its signature, as well as the one with just a const char[]. One could alternatively do someting like ZMthrow ( ZMxCapture( strcat("Column not found", name) ) ); but if you use the exception in more than one place, the recommended second constructor is less work. When returning a pointer, in circumstances where things have gone wrong, the usual action is to return a null pointer. In many cases this is appropriate, especially if the user interface defines it. However, the sloppy user might cause an (uncatchable) bus error if he does not check for null pointer. Consider returning a pointer to a braindead object (whose methods throw ignorable ZMthrows) rather than NULL -- then the job might not abort. Documentation should be layered: 1 - How the user interacts with the mechanism (VERY brief). 2 - How the framework manager user interacts (settting up handlers, logs, ignores). 3 - How to define a ZMx class. 4 - Usage recommendations for writers of ZOOM code. clhep-2.1.4.1.orig/Exceptions/doc/Makefile.am0000755000175000017500000000331011406166731017324 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif TEX = latex doc_srcdir = $(top_srcdir)/doc doc_builddir = $(top_builddir)/doc doc_installdir = $(prefix)/doc/@PACKAGE@ install-docs: $(mkinstalldirs) $(DESTDIR)$(doc_installdir) $(INSTALL_DATA) $(doc_srcdir)/HepTuple-exceptions $(DESTDIR)$(doc_installdir)/HepTuple-exceptions $(INSTALL_DATA) $(doc_srcdir)/ZMthrow_event_sequence.txt $(DESTDIR)$(doc_installdir)/ZMthrow_event_sequence.txt $(INSTALL_DATA) $(doc_srcdir)/ex-design-1 $(DESTDIR)$(doc_installdir)/ex-design-1 $(INSTALL_DATA) $(doc_srcdir)/ex-design-2 $(DESTDIR)$(doc_installdir)/ex-design-2 $(INSTALL_DATA) $(doc_srcdir)/ex-design-3 $(DESTDIR)$(doc_installdir)/ex-design-3 $(INSTALL_DATA) $(doc_srcdir)/ex-design-5 $(DESTDIR)$(doc_installdir)/ex-design-5 $(INSTALL_DATA) $(doc_srcdir)/ex-design-6 $(DESTDIR)$(doc_installdir)/ex-design-6 $(INSTALL_DATA) $(doc_srcdir)/how-ZMxTop-is-setup $(DESTDIR)$(doc_installdir)/how-ZMxTop-is-setup $(INSTALL_DATA) $(doc_srcdir)/m-pcanal-1 $(DESTDIR)$(doc_installdir)/m-pcanal-1 $(INSTALL_DATA) $(doc_srcdir)/m-pcanal-2 $(DESTDIR)$(doc_installdir)/m-pcanal-2 $(INSTALL_DATA) $(doc_srcdir)/m-pcanal-3 $(DESTDIR)$(doc_installdir)/m-pcanal-3 $(INSTALL_DATA) $(doc_srcdir)/mechanics_ZMx.txt $(DESTDIR)$(doc_installdir)/mechanics_ZMx.txt $(INSTALL_DATA) $(doc_srcdir)/reply-pcanal-1 $(DESTDIR)$(doc_installdir)/reply-pcanal-1 $(INSTALL_DATA) $(doc_srcdir)/reply-pcanal-2 $(DESTDIR)$(doc_installdir)/reply-pcanal-2 $(INSTALL_DATA) $(doc_srcdir)/whyZMthrowRethrows.txt $(DESTDIR)$(doc_installdir)/whyZMthrowRethrows.txt # Identify generated file(s) to be removed when 'make clean' is requested: #CLEANFILES = *.aux *.log *.toc *.dvi clhep-2.1.4.1.orig/Exceptions/doc/m-pcanal-20000755000175000017500000000217210043511633017036 0ustar olesolesFrom pcanal@fndaub Tue Jul 8 13:42:37 1997 Received: from fndaub.fnal.gov by fncrd8.fnal.gov via ESMTP (950413.SGI.8.6.12/911001.SGI) for id NAA01517; Tue, 8 Jul 1997 13:41:35 -0500 Received: from localhost by fndaub.fnal.gov via SMTP (951211.SGI.8.6.12.PATCH1042/911001.SGI) id NAA13661; Tue, 8 Jul 1997 13:41:34 -0500 Message-Id: <199707081841.NAA13661@fndaub.fnal.gov> X-Mailer: exmh version 1.6.6 3/24/96 To: mf (Mark Fischler) cc: pcanal@fndaub Subject: Re: ZOOM exceptions In-reply-to: Your message of "Tue, 08 Jul 1997 10:33:49 CDT." <199707081533.KAA18029@fncrdn.fnal.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 08 Jul 1997 13:41:34 CDT From: Philippe Canal Status: RO > 4 - ZMexcept has signature > > void ZMexcept ( ZMexception x, int line, > char file[], char data[], char time[]); > This signature worries me in the following sense: by receiving explicitly a ZMexception, ZMExcept do not get any type information (except for the id). if ZMExcept throw the exception it will throw an exception of type ZMexception not the intended type! clhep-2.1.4.1.orig/Exceptions/doc/reply-pcanal-10000755000175000017500000000237310043511633017737 0ustar olesoles > The user interface to control exception behavior is: > ----------------------------------------------------- > We may also want to have to add method like IsIgnored() and GetHandler() so that you can set a temporary control behavior and then return to the previous behavior. Done. Not as simple for IsIgnored because there are 3 states including "never specified" but see wha\t we have defined now. It has been mentioned that the definitions on the subclasses supersede (spelling ?) the behavior defined for the top class. We may want to provide a way to over-ride this behavior so that one is easily able to ignore all the exceptions types no matter what was set before. No. Because then there ought also to be a way to specify that a particular routine be handled (or whatever) in spite of what you said in general... Since we can never end that path, let's just stop at the beginning. > The signature of the handler may be either: > bool myhandler ( ZMexcept x, string message ); The message seems redundant since the exception x already contain a message. Good point. In fact, this cures another worry I had, about the dual-signatures for handler. > ... ZMexception object constructor, which > has as ITS first argument a const char*. clhep-2.1.4.1.orig/Exceptions/doc/m-pcanal-10000755000175000017500000000315310043511633017035 0ustar olesolesFrom pcanal@fndaub Tue Jul 8 11:17:36 1997 Received: from fndaub.fnal.gov by fncrd8.fnal.gov via ESMTP (950413.SGI.8.6.12/911001.SGI) id LAA01156; Tue, 8 Jul 1997 11:17:05 -0500 Received: from localhost by fndaub.fnal.gov via SMTP (951211.SGI.8.6.12.PATCH1042/911001.SGI) id LAA04483; Tue, 8 Jul 1997 11:17:03 -0500 Message-Id: <199707081617.LAA04483@fndaub.fnal.gov> X-Mailer: exmh version 1.6.6 3/24/96 To: mf (Mark Fischler) cc: pcanal (Philippe Canal), wb (Walter Brown), jluther (Jason Luther), pcanal@fndaub Subject: Re: ZOOM exceptions In-reply-to: Your message of "Tue, 08 Jul 1997 10:33:49 CDT." <199707081533.KAA18029@fncrdn.fnal.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 08 Jul 1997 11:17:03 CDT From: Philippe Canal Status: RO > The user interface to control exception behavior is: > ----------------------------------------------------- > We may also want to have to add method like IsIgnored() and GetHandler() so that you can set a temporary control behavior and then return to the previous behavior. It has been mentioned that the definitions on the subclasses supersede (spelling ?) the behavior defined for the top class. We may want to provide a way to over-ride this behavior so that one is easily able to ignore all the exceptions types no matter what was set before. > The signature of the handler may be either: > bool myhandler ( ZMexcept x, string message ); The message seems redundant since the exception x already contain a message. > ... ZMexception object constructor, which > has as ITS first argument a const char*. clhep-2.1.4.1.orig/Exceptions/doc/reply-pcanal-20000755000175000017500000000351010043511633017732 0ustar olesolesFrom pcanal@fndaub Tue Jul 8 13:42:37 1997 Received: from fndaub.fnal.gov by fncrd8.fnal.gov via ESMTP (950413.SGI.8.6.12/911001.SGI) for id NAA01517; Tue, 8 Jul 1997 13:41:35 -0500 Received: from localhost by fndaub.fnal.gov via SMTP (951211.SGI.8.6.12.PATCH1042/911001.SGI) id NAA13661; Tue, 8 Jul 1997 13:41:34 -0500 Message-Id: <199707081841.NAA13661@fndaub.fnal.gov> X-Mailer: exmh version 1.6.6 3/24/96 To: mf (Mark Fischler) cc: pcanal@fndaub Subject: Re: ZOOM exceptions In-reply-to: Your message of "Tue, 08 Jul 1997 10:33:49 CDT." <199707081533.KAA18029@fncrdn.fnal.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 08 Jul 1997 13:41:34 CDT From: Philippe Canal Status: RO > 4 - ZMexcept has signature > > void ZMexcept ( ZMexception x, int line, > char file[], char data[], char time[]); > This signature worries me in the following sense: by receiving explicitly a ZMexception, ZMExcept do not get any type information (except for the id). if ZMExcept throw the exception it will throw an exception of type ZMexception not the intended type! ------------------ I think you are right. The first argument should be a ZMexception&. Then when we do class ZMxCapture : public ZMexception { ... } : : ZMexcept ( ZMxCapture ("a message"), line, file, data, time ); And ZMexcept ( ZMexception &x, int line, char file[], char data[], char time[]) { : : throw x; } this will (I think) throw the ZMxCapture. If not, we will need to make it a ZMexception* and do: class ZMxCapture : public ZMexception { ... } : : ZMexcept ( *ZMxCapture ("a message"), line, file, data, time ); And ZMexcept ( ZMexception *x, int line, char file[], char data[], char time[]) { : : throw *x; } which is less elegant but may be necessary. clhep-2.1.4.1.orig/Exceptions/doc/.cvsignore0000755000175000017500000000001410044066304017256 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Exceptions/doc/HepTuple-exceptions0000755000175000017500000002246110043511633021117 0ustar olesolesExisting ZMexception mechanism: Say ZMxA is a child of ZMxB. The coder would say: ZMxCompleteDefinition (ZMxA, ZMxB) ZMxInfo ZMxA::information ("ZMxA", ...); ZMxCompleteDefinition (ZMxA, ZMxB) expands to Class ZMxA : public ZMxB { public: ZMxA(string mssg, ZMxSeverityLevel lever = EndOfSeverity) : ZMxB (msg,level) { init (level); } ; static ZMexceptInfo information; ZMexceptionWrappers; virtual ZMexception* copy () {return new ZMxA(*this); }; ZMexceptionWrappers expands to a large bunch of static method declaratoins and definitions, a few virtual trivial methods, and the nontrivial method init: static void setHandler(const ZMhandler& newHandler) { information.setHandler(newHandler) } ... virtual string id() { return information._id; }; virtual void init(ZMxSeverityLevel level) { information._count++; _myCount = information._count(); if (level==EndOfSeverity) {_mySeverity=information.severity;} else {_mySeverity=level;} } Let's try to understand _mySeverity and _myCount: Both are variables declared when the ZMexception class is declared; therefore, they are individual per instance of ZMx. Let's try to understand information._count: In the definition of ZMxA we have an information data member, which is a ***static*** ZMexceptInfo. In ZMexception.icc, the following data members are initialized: _id, _messagePreamble, _severity, _logger, _handler (all from args) AND count(0), _previousHandler(0), _previousLogger(0) So count does start as 0. How does push/pop work out? It doen't yet. OK, what do we want in information? Have string _id string _messagePreamble, ZMxSL _severity Want: facilityNumber -- normally from parent facilityName -- normally from parent Mnemonic = _id Name (should be same as class name) = _messagePreamble severity, number exceptionNumber is a method returning Severity (4bits) Facility (12 bits) Number (16 bits) How to inherit from parent? Obvious: In ZMexceptIfno constructor, init to Parent::facilityName That means a top of a facility must contain an additional line or argument to the constructor. Sequence when ZMthrow (ZMxA) happens 1 - ZMexcept(Except, ...) 2 - x.log() Declared in ZMexception Defined in Boilerplate x.information.classLog(x) 3 - x.information.classLog(ZMexception *that) declared in ZMexceptInfo defined in ZMexception.icc if _logger==NULL (which it starts out as) return classParentLog (that) classParentLog would return Parent::information.classLog(*x) Now we come to _logger->log(*x) 4 - _logger is typically ZMlSimple (which we will just call ZMlog()) in ZMlogger.cc. The log() method there just writes to an ofstream or whatever. 5 - ZMerrno.write(x); 6 - result = x.handle(); x.handle() is declared in ZMexception Defined in Boilerplate 7 - x.information.classHandle(ZMxA *x) declared in ZMexceptInfo defined in ZMexception.icc if _handler==NULL (which it starts out as) return classParentHandle (that) classParentHandle would return Parent::information.classHandle(*x) By the way, if you run out after PArent, you go to the action zmxThrow which is defined in ZMhandler.h as part of an enum. Now we come to _handler->execute(*x) 8 - handler may do stuff (the supplied ones don't) and will return a ZMxAction. 9 - The interesting case is ZMxParent, because now we are back in classHandle at the point where the parent's handler is called. Here is the way to cope with need for identifying exceptions: 1) MURMUR (G.O.) Agreed that no need to generate cross-program murmur id number. 2) FACILITY-S-MNEMONIC is unique and meaningful. 3) Therefore, only thing necessary is for the USER DURING THE PROGRAM to be able to ask two things: Is this exception a ZMxWhichever? Is this exception descended from ZMxWhichever? 4) Using type_id for the first and dynamic_cast for the second would be possible but this is not yet here. 5) Instead we define the following methods in ZMexception: bool isExactly (ZMxexception x) bool isAncestorOf (ZMxexception x) In the future these may be implemented via type_id and dynamic_cast 6) For the benefit of current implementation, the syntax we give the user is if (ZMxA::isExactly x) if (ZMxA::isAncestorOf x) rather than if (x.isExactly(ZMxA)) which tries to pass a class as an argument. This means we have an isAncestorOf method rather than a isDescendantOf method. 7) To implement this now: a) We define a class ZMexceptionIdentifier int exceptionID $$$ static int maxAssigned (which we start at 0) int nextID () {return ++exceptionID;} b) The ZMexceptInfo

    class contains static ZMexceptionIdentifier eid; c) The macro for defining c) Where we initialize ZMexceptInfo we also do eid.exceptionID = eid.nextID(); We may have to do this by having a constructor for ZMexceptionIdentifier or something. d) in ZMexception we have a potentially non-virtual method bool isExactly (ZMxexception &x) which for now merely compares eid.exceptionID with x.eid.excptionID and which ultimately becomes if (type_id(this) == type_id(x)) Actually, when you call something like ZMxA::isExactly(x) can the isExactly method use this? If not, what can we do to use type_id, if anything? e) in ZMexception we have a virtual method bool isAncestorOf (ZMxexception &x) which in the top of tree exception also merely compares eid.exceptionID with x.eid.excptionID. f) The bool isAncestorOf (ZMxexception &x) in other exceptions (thus in the standard definition would do: ????????????????? bool isAncestorOf (ZMxexception x) which at that point both The constructor for a $$$ Note that we really don't need facilty and problemNumber to be distinct since we now only check for b) ErrorIdentifier each This implies that the top of a the overall tree must be different than its descendants, particularly in how isDescendedFrom() works. We already have the overall top different anyway. Proposed layout of ZMexceptions in HepTuple: General statements about exceptions: Each ZOOM exception is an object of some class, inheriting off some ZMexception parent (except for ZMxTop which is the anscestor of all exceptions), and has some FaciltyName and some ExceptionName. We should also perhaps add a Mnemonic, intended as a short string as in RMS-E-NOTFOUND for the RMS facility issuing an E severity error because a file was not found in some manner. The name of the class (which should match the ExceptoinName, should generally reflect the name of the method which threw the exeption and/or the class which that method is part of. - - - It is tempting to say that Where applicable we should declare the exception in the public area of the class whose methods might throw it; then the name will automatically reflect that class. For example, the ZMexception class for an exception encountered during the accumulate() method of HepHist1D might be HepHist1D::ZMxAccumlate. The name would then be "HepHist1D::ZMxaccumlate", and its mnemonic might be "ACCUMULATE". WE DO NOT DO THIS for the following reason: It is desirable that the list of all ZMx exception types appear contiguously in a commonly seen header such as the facility's overall .h file. Burying the exception classes inside individual classes obscures some of the the information and accessibility we want the user to have. - - - With this in mind, here is how I propose to layout exceptions thrown by HepTuple (HepTuple exceptions): * All HepTuple exceptions have their Facility as "HEPTUPLE" (by murmur convention, facility names and mnemonics are upper case). * Every HepTuple exception class is declared in HepTuple.h * HepTuple exception classes are defined -- and their static data members initialized -- in the .cc file corresponding to the class whose methods throw them. If several classes throw one type of excpetion, we will define it in the file for the class it is most closely connected with. * There is a topmost HepTuple exception defined in HepObj.cc (in most packages, where the name of the package does not conflict with the name of a class, it would be in packageName.cc). declaration is in HepTuple.h -- class ZMxHepTuple : public ZMxTop { public: ZMxHepTuple(.....); virtual ZMxHeptuple* copy () {.....}; static ZMexceptInfo information; MexceptionWrappers; } statics in HepObj.cc -- ZMxHeptuple::information.facility = "HEPTUPLE"; ZMxHeptuple::information.mnemonic = "HEPTUPLE"; ZMxHeptuple::information.name = "ZMxHepTuple"; ZMxHeptuple::information.severity = ZMxSeverityProblem; Things will inherit off this, but will HepTuple routines will probably not ZMthrow this one directly, except where "impossible" circumstances are checked for and we don't think it worthwhile to declare a specific class. * Other exceptions will be declared in HepTuple.h public area in the appropriate class, or (if thrown from a variety of classes at global scope in HepTuple.h). We should NOT assign a unique exception class to each possible way an exception can be throw. One given method might throw one or maybe a couple of possible types of exception objects. Several methods might share the ability to throw one type of exception. * The message going with each line of code ZMthrow-ing a HepTuple exception should be unique, even though the same class might be thrown from many places. clhep-2.1.4.1.orig/Exceptions/doc/CMakeLists.txt0000644000175000017500000000066011606714767020044 0ustar olesoles# install Exceptions documentation INSTALL (FILES ex-design-1 ex-design-2 ex-design-3 ex-design-5 ex-design-6 HepTuple-exceptions how-ZMxTop-is-setup mechanics_ZMx.txt m-pcanal-1 m-pcanal-2 m-pcanal-3 reply-pcanal-1 reply-pcanal-2 whyZMthrowRethrows.txt ZMthrow_event_sequence.txt DESTINATION doc/Exceptions ) clhep-2.1.4.1.orig/Exceptions/doc/ZMthrow_event_sequence.txt0000755000175000017500000001123610043511633022531 0ustar olesoles ZMthrow event sequence W. E. Brown, 21-Dec-1998 These notes document the sequence of significant events set into motion by execution of a single ZMthrow(). A number of details are elided for the sake of clear exposition. 1. ZMthrow( usersException ) ZMthrow() is a macro. It expands mainly into a call of ZMthrow_(), passing on the usersException, hereinafter known simply as x, together with the line number and file name from which the macro is invoked. It is mandatory that x be of a type derived from class ZMexception. The result of ZMthrow_() is a code indicating whether x is to be a) thrown, or b) ignored as the macro's final act. 2. ZMthrow_( x, lineNum, fileName ) ZMthrow_() is a global function of the ZMex namespace. This function first pokes the lineNum and fileName information into x, and then calls x.handleMe(), thus initiating x's handling and logging. Next, ZMthrow_() inspects x's severity to decide whether x is to be copied to ZMerrno. If the severity is at least ZMexERROR, the copy is made. Finally, ZMthrow_() returns a code for use by ZMthrow(), as indicated above. This code is identical to the code returned by handleMe(). 3. x.handleMe() handleMe() is a virtual member function of class ZMexception and of exception classes descended from ZMexception. handleMe's primary task is to determine the handler currently associated with x's class, and to invoke that handler's takeCareOf() method, passing it the user exception x. The result of takeCareOf(x) is used to decide whether the exception has been sufficiently handled; if not, another handleMe() function is called, namely the one associated with the parent class of x's class. Finally, handleMe() returns a code [obtained from takeCareOf()] for ZMthrow_() to return, as documented above. 4. takeCareOf( x ) takeCareOf() is a virtual member function of ZMexHandler and of handler classes descended from ZMexHandler. This is a forwarding function that a) calls the takeCareOf() method associated with the ZMexHandlerBehavior with which the current handler was instantiated, and b) returns that function's result as its own result. 5. takeCareOf( x ) This takeCareOf() method is a virtual member function of a ZMexHandlerBehavior class. For most such behavior classes, this method calls standardHandling() with arguments giving the exception x together with a throw/ignore flag. takeCareOf() returns the same result given as the result of standardHandling(). 6. standardHandling( x, flag ) standardHandling() is a member function of ZMexHandlerBehavior. It first pokes, into x, the name of the handler being used together with the value of the throw/ignore flag. Based on filtering criteria, standardHandling() determines whether this exception is to be logged. If so, it calls the logMe() function associated with x's class. Finally, standardHandling() returns a code directly derived from the throw/ignore flag. 7. x.logMe() logMe() is a virtual member function of ZMexception and of exception classes descended from ZMexception. logMe's primary task is to determine the logger currently associated with x's class, and to invoke that logger's emit() method, passing it the user exception x. The result of emit() is used to decide whether the exception has been sufficiently logged; if not, another logMe() function is called, namely the one associated with the parent class of x's class. Finally, logMe() returns a code [obtained from emit()] for standardHandling() to interrogate, if it wishes. 8. emit( x ) emit() is a member function of ZMexLogger and of logger classes descended from ZMexLogger. This is a forwarding function that a) calls x.logMessage() to obtain the complete formatted text of user exception x, a) passes that text to the emit() method associated with the ZMexLoggerBehavior with which the current logger was instantiated, and b) returns that function's result as its own result. 9. x.logMessage() logMessage() is a virtual member function of ZMexception and of exception classes descended from ZMexception. logMessage() is responsible for formatting the complete text of the exception being logged; this formatted text is the function's string result. 10. emit( s ) This emit() method is a virtual member function of a ZMexLoggerBehavior class. For most such behavior classes, this method sends the formatted string s to the ostream destination specified when the logger was instantiated. emit() returns, as its result, a code describing what, if any, action it actually took. clhep-2.1.4.1.orig/Exceptions/doc/how-ZMxTop-is-setup0000755000175000017500000000053010043511633020746 0ustar olesolesZMlog is a ZMstandardLog, instantiated in ZMexceptions.cc, using stderr as its destination. ZMxTop is declared in ZMexceptions.cc, instatiated with ZMlog as its log. To change the destination of the default logging, a framework writer would instantiate another ZMstandardLog with, say, a file name. Then ZMxTop.setLogger(thatLog) is called. clhep-2.1.4.1.orig/Exceptions/doc/ex-design-60000755000175000017500000004651010043511633017241 0ustar olesoles ZOOM Exception Mechanism Design ------------------------------- The Zoom exception mechanism is intended to be the tools used by ZOOM modules to handle exceptions in a useful way and provide the user with interfaces to control how to react to problems. It is not (at this time) intended to be a mechanism for the user to hook into to define his own exceptions, although that may come later. Frankly, successful implementation and use by ZOOM modules will be necessary to sell this structure to our users as potentially useful, anyway. We need the mechanism "now" because we are trying to deliver at least two packages which will have to be re-instrumented when the mechanism is finally adopted. This is not a "signal handler" mechanism, which could be used to establish behavior for segment violations, arthmetic exceptions, and so forth. It would be nice to have this but C++ does not provide generic support for those activities. A **later** possibility will be to provide this support for POSIX-compliant operating systems, and coordinate it with the exception mechanism. We need to be able to cope with the following realities: - -------------------------------------------------------- 1 - Users will not, in every case, imbed calls into a try block. 2 - Frameworks will incorporate code from multiple users and in some circumstances cannot afford to abort the entire job if some rare path in one user's code blows up. To the extent we can help with this, we must. 3 - Framework creators CAN be expected to imbed portions in try blocks, or set up behaviors for various exceptions, assuming we give them the necessary tools. In the remainder of this document, the "user" who sets things up is assmued to be such a framework manager. 4 - There is need for coordinated logging and related behavior. To be able to satisfy this, the goal is to allow: - ------------------------------------------------- 1 - The user should be able to specify, for a given sort of exception, whether she wants to: a - Throw the exception via the C++ mechanism, thus aborting unless she in the framework or a lower-level user responsible catchs the problem. b - Invoke a user-written handler when the exception occurs, which may itself determine it is necessary to throw the exception. c - Ignore the exception RETURNING TO THE SPOT IN THE ZOOM MODULE THAT DETECTED THE PROBLEM. This can happen with or without a handler being invoked. Typically, the module will then return some approriate pseudo-value to the user. 2 - In cases where exceptions are to be handled or ignored, there should be a well-known way to get information about the existance of a problem, analogous to the errno mechanism in C. 3 - Explanatory strings should be associated with the problem at the point of origin. 4 - The exceptions are organized in a hierarchical manner, which uniformly applies one simple category philosophy that the users can understand, across the various ZOOM packages. With this in mind, our mechanism has the following structure: - ------------------------------------------------------------- 1 - Upon detecting a problem for which it would like to (potential) throw an exception, the module code will instead invoke the ZMthrow macro. 2 - ZMthrow takes as its argument a ZMexception object constructor, which has as ITS first argument a const char*. The intent is for the ZMexception object actually to be derived from the base ZMexception class, and for the char* first argument to contain an explanatory message. Particular ZMexceptions can also have construction forms taking a second string, or whatever. For example, ZMthrow ( HepTuple::ZMxCapture( "Column not found", name ) ); 3 - The ZMthrow macro appends __LINE__, __FILE__ and calls ZMexcept. 4 - ZMexcept has signature template void ZMexcept ( Exception x, int line,char file[]); It does the following: a - Places a copy of the exception object x into a circular buffer ZMerrno. More about ZMerrno later. b - Determines for this exception what sort of logging is enabled, and logs it. Note that derived exceptions must modify the general logging method if they wish to include information beyond the message and file/line/time stamp. c - Determines whether the exception needs to be ignored, if so return d- Determines whether the exception a handler has been established, and if so invokes it. The handler will be passed the exception object, and can be set up to also take the line/file/time arguments. The handler returns a bool which if true will say to throw the exception. e - Determines (after any handler has been invoked) whether to ignore the exception. It will do either throw x; or return; 5 - ZMerrno is analogous to the C/Unix errno mechanism, but allows viewing a history of the last N problems detected. We anticipate using it like errno, via exception id, but we copies of place the whole exception object onto ZMerrno to provide more info if desired. The interface is: a - ((creation somehow, specifying N)) b - ZMerrno.write (ZMexception& x); // copy an exception onto ZMerrno The user would not use a and b but would use: c - string ZMerrno.read (); // read the last id value on ZMerrno string ZMerrno.read (int k); // read the last-but-k id value on ZMerrno d - void ZMerrno.clear(); // put a zero (indicating no current error) // on ZMerrno. e - void ZMerrno.pop(); // remove an entry setting the top to the // previous entry. For instance, if you // have a loop in which some known ignorable // happening places a value on ZMerrno, you // can pop each one so as not to wipe out // the history for others. f - ZMexception* ZMerrno.get() // Return pointer to the last or ZMexception* ZMerrno.get(int k) // last-but-k exception on ZMerrno. // Allows perusal of things like the // message and the logger and handler // used when the exception was // encountered. Thus after the start, or after ZMerrno.clear(), the user can always find out whether any ignored exceptions had occured by doing if (!ZMerrno.read().empty()) { ... then something has happened } If we later incorporate signal handling, this ZMerrno stack is where the user can find out whether he has had his arithmetic error since the last clear. ZMerrno is pronounced "oops." 6 - The id empty string indicates no error. The id is a string representing the unique name of the exception class. Each ZMexception object class has its own error id which is established (hardwired) at construction. 7 - When a ZMexcept is thrown it does a ZMerrno.write(x). Thus ZMerrno tracks these exceptions even if they are explicitly thrown and caught by the user outside the ZMthrow/ZMexception mechanism. 8 - Logging is discussed separately. The user interface to control exception behavior is: - ----------------------------------------------------- By the way, this is an interface for the framework manager to use; the lower level user would generally never establish handlers or ignores, and would only use the ZMerrno.read() and .clear(). 1 - To establish a handler for a particular exception type, say for ZMexceptCapture: HepTuple::ZMxCapture.setHandler ( ZMhandler(myhandler) ); The handlerName string gives a convenient way to tell about the handling in log messages ("... was handled by mySuperHandler"). The signature of the handler must be: bool myhandler ( ZMexception *x ); We will have a ZMhandler class to contain that and the handlerName. Note that the handler has access to the fields of x including for all ZMexception objects: char* message; int line; char* sourceFileName; int serialNumber; ZMhandler* handler; ZMlogger* logger; // and class-wide data: static int id; static char* messagePreamble; static int count; and, for particular derived ZMexception objects, any secondary messages or other information provided to the constructor and kept in the object. The handler should return false to ignore the exception and return to the user code (from ZMexcept), or true to throw the exception after the handler returns. The user can also throw an exception explicitly in the handler. 2 - You may establish a handler for an entire base class, which applies to any ZMexceptions derived from in that class for which no specific handler is established. For example, HepTuple::ZMxNewColumn is derived from HepTuple::ZMxGeneral so HepTuple::ZMxGeneral.setHandler ( myDefaultHandler ); will apply to HepTuple::ZMxNewColumn if that is ever ZMthrown. 2a- You may restore the previous handler by calling: HepTuple::ZMxGeneral.restorePreviousHandler(); But set/restore do not implement a full stack: You can freely do setHandler many times (or at the beginning of a loop for example) without leaking memory, even if you never restore. 3 - You can also use a deeper stack by using the following methods: HepTuple::ZMxGeneral.pushHandler(ZMHandler& Zh); HepTuple::ZMxGeneral.popHandler(); If there is too many call to pop compared to the number of push, they simply will be ignored. 4 - Note that if a handler is established for a subclass it takes precedence over that for the base class. If you instead wish to call the base class handler after executing the specific handler, you must invoke it explicitly. Only if no handler has been established will the exception check for and invoke a handler in its base class automatically. 5 - Four default handler types are provided: ZMHignore ZMHthrow ZMHparentHandler ZMHignoreNextN ZMHparentHandler is the default handler. The default for the top most exception class (ZMexception) is ZMthrow. 6a- At times you may wish to prevent the calling of the parent class handler yet have no need for explicit handling. In which case you would set the handler for this class to ZMHignore or ZMHthrow. 6b- The user can tell the system to whether or not to ignore an unhandled ZMexception (those methods are merely wrappers around less explicit calls to setHandler(ProperZmHandlerTypeForTheAction Zh) HepTuple::ZMxCapture.ignore() HepTuple::ZMxCapture.dontIgnore() HepTuple::ZMxCapture.default() The default is don't ignore -- meaning throw the exception unless a handler is invoked and comes back false. The same rules for inheritance apply as in the handler case: If you haven't specifically said anything about a subclass, then what you have said about the parent class will apply. Thus calling dontIgnore() is NOT the same as not calling ignore(). In analogy with handling, we need a way to say "pretend I never said ignore or dont; use the parent class decision". This is: HepTuple::ZMxCapture.setHandler(ZMparentHandler Zh) 7 - Sometimes you may want to ignore an exception the first N times and then react differently. The handler can have a static count variable to implement this behavior. Alternatively, there is a call to establish this behavior even if no handler is used: HepTuple::ZMxCapture.setHandler(ZMHignoreNextN(N) Zh) The part of the interface seen by non-framework-manager users is simpler: - -------------------------------------------------------------------------- 1 - The ZMerrno methods may be used to see if (ignored) exceptions have happened. Typically, the user used to Unix exceptions would call ZNerrno.read() and maybe ZMerrno.clear(). 2 - The ordinary user can try, and catch, these ZMexceptions. We ask that usrs not throw ZMexceptions that the ZOOM modules throw. Later we may extend support to include user-defined subclasses of ZMexception. 3 - When an exception occurs and is not ignored, the user will know the message given for the exception, as well as the and line number where the ZMthrow macro was invoked. This is inside ZOOM code. By doing debug core the user can get a traceback into the user routines to find which line of his code encountered the problem. 4 - The status of what was set up for ignoring and handling may be probed, so temporary control behavior can be set and then put back to what it was: const ZMhandler& handler() returns the established handler. const ZMlogger& logger() returns the established logger. Logging is handled as follows: - ------------------------------ 0 - The connection between a class of ZMexceptions and logging that is through a ZMlogger. The (framework) user may create her own logger but typically will use our provided class ZMlog, which has is a ZMlogger and has a constructor taking a file name. Any actions taken by the logger we describe below will refer to how ZMlog behaves. 1 - Every individual ZMexception object can have a method for creating (from the other arguments aside from messge) a string to put into a log. (Of course, it may be inherited from its base class.) But the message as well as time, line, id, and so forth is not to be handled by each; instead, ZMthrow handles this. The method to create the string is logMessage(). ZMexcept will at various points call the logThis() method of the established logger when it wants to log information. 1a- The user assgns a ZMlogger to an exception class by ZMexception::setLogger(ZMlogger*). For example, ZMlog mylog ("logfilename.txt"); ZMxCapture::setLogger(mylog); The pointer returned should be checked. In the case of ZMlog, it can be NULL for two reasons: The file cannot be opened for append, or the file is already open for some other purpose. (If it is already opened for logging, that is fine; this logger will also cause logging of messages there). 2 - ZMexception has a method setLogger(ZMlogger) which will open a log using that logger for that type of exception. This will establish this logger to be used for exceptions of this class. In the case of ZMlog, that means it will establish the file which was provided when the logger was constructed, as a logging point for exceptions of this class. (This is class static information.) 2a- The ZMlog object will log to a file: its constructor will open a log to that file for that type of exception. A user can provide a different logger which, for example, ties into the CDF or D0 general logging mechanism instead of writing to a file. 3 - If no logging is specified for a class the file defaults to the base class. Thus HepTuple::ZMxCapture might log to the file for HepTuple::ZMxGeneral, or if no logging is established there, for ZMexception. It is possible (the default) that no logging is established anywhere. 4 - You may log to multiple files; each ZMexception (sub)class has a class static linked list of log files. 5 - Aside from single files, you can also establish a "rolling log" pair of files: ZMrollingLog mylog (const char filename1[], const char filename2[], int n ); bool ZMexception::setLogger(mylog); The way this works is that the first file is opened (still for append), and up to n exception instances are logged into it, at which point it is closed, renamed to the second file, and re-created (empty) for more logging. A script can detect when this has happended and archive the second file if desired. 6 - If you wish to cease logging a particular exception type in general or to a particular log file, you may: HepTuple::ZMxCapture.stopLog(); If no exceptions are logging to a particular log anymore, that file will be closed. 7 - To be able to temporarily modify logging behavior for an exception, you may call setLogger(ZMlogger& newlog) and later call restorePreviousLogger() For a deeper stack you can also use: pushLogger(ZMlogger& newlog); popLogger(); The following shows how the above design can work - -------------------------------------------------------------------- 1. Each logger, handler and exception types will have a virtual Copy() method. For example an handler class will have: virtual ZMhandler* Copy() { return new ZMspecificHandler(*this); } This will allow the exception class to create its own copy of each handler and logger of the correct actual type and not have to worry about external memory management. 2. The exception class contains the following functions: bool restorePreviousHandler(); const ZMhandler& handler(); bool popHandler(); bool pushHandler(ZMhandler& Zh); bool setHandler(ZMhandler& Zh); 3. setHandler has the following signature: setHandler ( ZMhandler& newHandler) and will execute at LEAST something like: delete _previousHandler; _previousHandler = _handler; [ZMhandler*] _handler = newHandler.Copy() This scheme insure us: Nobody can delete a used handler object. handler object are only used in on exception class. restorePreviousHandler implement a limited pop concept. (stack of size one). 4. The same concept applied to the logger classes and to the exception classes (for the benefit and ZMerrno). The following usage recommendations pertain to writers of ZOOM code: - -------------------------------------------------------------------- As shown in the examples, place your definitions of the exception objects inside the class definition for the class. That way, methods within this class can simply call the shorter name -- ZMxCapture rather than ZMxHepTupleCapture. Don't create too many types of exceptions. The error codes appearing on the ZMerrno stack are defined per each type, but unless you envision the user needing to AUTOMATICALLY distinguish between one problem and another in the same submodule via ZMerrno, don't define them as two separate exception types. In cases where the user interface promises a routine will not throw an exception (but might return false if something goes awry) the ZOOM code itself should enclose any possible ZMthrows in try blocks, to catch the problem in case the user has not specified ignoring the exception. Note that the argument to the constructor of the ZMexception in ZMthrow can (and often will) be a string formed by concatenating some fixed informatory message with some variable information, as in ZMthrow ( ZMxCapture( "Column not found", name ) ); To do this, one should have a constructor for that sort of ZMexceptoin object with the extra argument in its signature, as well as the one with just a const char[]. One could alternatively do someting like ZMthrow ( ZMxCapture( strcat("Column not found", name) ) ); but if you use the exception in more than one place, the recommended second constructor is less work. When returning a pointer, in circumstances where things have gone wrong, the usual action is to return a null pointer. In many cases this is appropriate, especially if the user interface defines it. However, the sloppy user might cause an (uncatchable) bus error if he does not check for null pointer. Consider returning a pointer to a braindead object (whose methods throw ignorable ZMthrows) rather than NULL -- then the job might not abort. Documentation should be layered: 1 - How the user interacts with the mechanism (VERY brief). 2 - How the framework manager user interacts (settting up handlers, logs, ignores). 3 - How to define a ZMx class. 4 - Usage recommendations for writers of ZOOM code. clhep-2.1.4.1.orig/Exceptions/doc/mechanics_ZMx.txt0000755000175000017500000003370410043511633020562 0ustar olesolesIntroduction to the Use of Zoom Exceptions W E Brown, 30-Oct-1997, last revised 5-Jan-1998 1. Introduction --------------- This summary describes the mechanics decided on for creating and throwing a ZMexception as implemented by the zoom Exceptions package. Note that all public C++ symbols used within this Exceptions class begin with the unlikely prefix "ZMex" (or, in the case of the preprocessor, "ZMEX") in order to help avoid namespace pollution. For example, we use "ZMexception" as the name of the class from which all other exception classes are (directly or indirectly) derived. Additionally, all ZOOM-generated ZMexception classes will use at least "ZMx" as their name prefix. More typically, to avoid internal name clashes, the names start with a short string identifying the package, e.g. "ZMxHep" for HepTuple, or "ZMxpv" for the PhysicsVectors package. It is recommended that users defining their own ZMexceptions establish and employ some similar convention. 2. How to declare and define a new exception class -------------------------------------------------- Declaring/defining a new exception class is done as follows (code adapted from Exceptions/test/exctest1.cc): // Required header, with recommended code guard: #ifndef ZMEXCEPTION_H #include "Exceptions/ZMexception.h" #endif // ZMEXCEPTION_H // Required (sample) declaration (for use in a .h file): ZMexStandardDefinition( ZMexception, ZMxOops ); // Defines class ZMxOops : public ZMexception { ... }; // Required (sample) definition (for use in a .cc file): ZMexClassInfo ZMxOops::_classInfo( "Oops", "ExcTest", ZMexWARNING ); // Provides certain details specific to the new class In the example above: 1) ZMxOops is the name of the newly-defined exception class. Note that this name appears in three places; it is important to be consistent. 2) ZMexception is the name of the parent exception class of ZMxOops; any previously defined ZMexception may be used as the parent. 3) "Oops" is the exception's name as it is to appear in the log. Such a quoted exception name string should for clarity be closely related to the actual name but, as shown here, might omit some package- identifying baggage. 4) "ExcTest" is the logged message prefix (normally indicating the package, facility, or program giving rise to the message). 5) ZMexWARNING is the default severity level of ZMxOops. (See below for a complete list of possible severity levels and the intended significance of each.) 3. Constructing/throwing an instance of the new exception class --------------------------------------------------------------- This Exceptions package provides a facility, ZMthrow(), to make use of ZMexception and its descendent classes. Before using this capability, insert the following line to provide the necessary declaration: #include "Exceptions/ZMthrow.h" Thereafter, an exception of a class defined as shown above is typically constructed and thrown within a single statement, such as: ZMthrow( ZMxOops("Ouch!") ); Here, "Ouch!" may be arbitrary text to be associated with this particular occurrence (exception instance). The text will be logged, as described below. 4. Resulting log message ------------------------ Assuming that the ExcTest program has been compiled with appropriate compiler switches that enable use of exceptions, the logged message resulting from the above ZMthrow(...) example will be: ExcTest-W-Oops [#1] Ouch! Thu Oct 30 16:17:07 1997 -- ZMthrow was issued from exctest1.cc line 21 ... Exception thrown! The parts of this message are interpreted as follows: 1) ExcTest the message came from the ExcTest facilty; 2) -W- it is considered a Warning; 3) Oops it is classified as an Oops occurrence; 4) [#1] this is the first instance of such an occurrence; 5) Ouch! this text is associated with this specific occurrence; 6) Thu ... 1997 timestamp; 7) ...exctest1.cc this occurrence arose from this associated compilation unit; 8) line 21 identifies the specific line of source text giving rise to this occurrence; 9) ... thrown gives the run-time disposition of the exception. 5. Available severity levels ---------------------------- Here is a list of the seven severity levels that are available for use in defining a new exception class. Each severity is accompanied by a description of its intended interpretation, as documented in the Exceptions/ZMexSeverity.h header file: ZMexNORMAL All is well; always safe to ignore; typically not worth logging since it's probably just a temporary placeholder. ZMexINFO In the normal course of events, here is news worth logging; always safe to ignore; often useful for progress reporting and for debugging purposes. ZMexWARNING Something unusual has happened, but we have a quite reasonable action to take; it's generally safe to ignore the warning because you'll probably get just about the result you intended; logging can probably cease after (say) 50 of the same warnings. ZMexERROR We encountered something such that, although we can make it safe to continue running (e.g., by supplying a default value instead of a value we can't for some reason calculate), you probably won't get the result you expected unless you handle this yourself; ought always be logged (but may be sensible, if hundreds of the same error are intentionally ignored, to stop logging each one). ZMexSEVERE The action you intended will almost certainly have a seriously flawed outcome and we doubt that either we or you can make it safe to continue if you ignore this; ought always be logged. ZMexFATAL We can make no representations as to the state of any part of the software, even of software parts not obviously associated with the failed intended action and even if you try to handle the problem; ought always be logged and essentially never be ignored. ZMexPROBLEM The software has reached a logically impossible internal state; must always be logged and never be ignored; if encountered, should always be reported to the software's developers and/or maintainers. 6. Using handlers In the Exceptions package, a handler is the term for an instance of a class that processes a ZMthrow'n exception. A handler is responsible for having the exception instance logged; for taking any remedial action appropriate to the exception instance; and for determining whether the exception instance can safely be ignored by the user code. The Exceptions package includes a number of pre-defined handlers (listed below), implementing several commonly-wanted behaviors. Each exception class is associated with a handler to be applied to all ZMthrow'n instances of that class. By default, this handler implements the behavior known as ZMexHandleViaParent(); this applies the behavior -- whatever it may be -- of the parent exception class' handler to the current exception class. A user may change this behavior in two ways. A different handler may be associated with an exception class when the class is defined: ZMexClassInfo ZMxOops::_classInfo( "Oops", "ExcTest", ZMexWARNING, ZMexIgnoreAlways() ); Alternatively, the handler associated with an exception class may be changed dynamically: #include "Exceptions/ZMexHandler.h" ZMexOops::setHandler( ZMexIgnoreAlways() ); The given behavior will apply to any exceptions ZMthrow'n after the handler has been established. 7. Available handlers Here is a list of the five standard handlers that are defined via the Exceptions package. Each is accompanied by a brief description of its behavior: ZMexThrowAlways() the ZMthrow'n exception instance will, after handling, become the object of a C++ throw. ZMexIgnoreAlways() the ZMthrow'n exception instance will be handled, but will have no further affect on subsequent control flow. ZMexThrowErrors() the ZMthrow'n exception instance will, after handling, be thrown if its severity is ZMexERROR or higher, but be ignored if of a lesser severity. Note: this is the default handling behavior of the package's ZMexception class, the intended (direct or indirect) ancestor class of all other exception classes. ZMexIgnoreNextN( n ) the next n occurrences of a ZMthrow'n instance of this class will be ignored after handling; subsequent instances will be thrown after handling. ZMexHandleViaParent() the ZMthrow'n exception instance will be handled by the handler currently associated with the parent exception class. 8. Using loggers In the Exceptions package, a logger is the term for an instance of a class that records, to a designated destination, a ZMthrow'n exception. A logger is responsible only for routing the message associated with an exception instance; it is not responsible for determining or formatting any message. The Exceptions package includes a few pre-defined loggers (listed below), implementing several commonly-wanted logging behaviors. Each exception class is associated with a logger to be applied to all ZMthrow'n instances of that class. By default, this logger implements the behavior known as ZMexLogViaParent(); this applies the behavior -- whatever it may be -- of the parent exception class' logger to the current exception class. A user may change this behavior in two ways. A different logger may be associated with an exception class when the class is defined: ZMexClassInfo ZMxOops::_classInfo( "Oops", "ExcTest", ZMexWARNING, ZMexIgnoreAlways(), ZMexLogAlways() ); Alternatively, the logger associated with an exception class may be changed dynamically: #include "Exceptions/ZMexLogger.h" ZMexOops::setLogger( ZMexLogAlways() ); The given behavior will apply to any exceptions ZMthrow'n after the logger has been established, provided the handler invokes the logger. 9. Available loggers Here is a list of the standard loggers that are defined via the Exceptions package. Each is accompanied by a brief description of its behavior: ZMexLogAlways( ostream & Dest = cerr ) All ZMthrow'n exception instances processed by this logger will appear in the designated destination. Note: this is the default logging behavior of the package's ZMexception class, the intended (direct or indirect) ancestor class of all other exception classes. ZMexLogTwice( ostream & Dest1, ostream & Dest2 = cerr ) All ZMthrow'n exception instances processed by this logger will appear in both designated destinations. ZMexLogNever() No ZMthrow'n exception instances processed by this logger will appear in any designated destination. ZMexLogViaParent() All ZMthrow'n exception instances processed by this logger will be logged by the logger currently associated with the parent exception class. 10. Exception history This Exceptions package records, by default, all exceptions that have been ZMthrow'n. Known as ZMerrno, this capability is in addition to the logging described earlier, and allows user code to interrogate and make decisions based on such exceptions. To use this ZMerrno facility, insert the following line to provide the necessary declaration: #include "Exceptions/ZMerrno.h" This declaration makes the following operations (functions) available: 1) ZMerrno.setMax( unsigned int limit = 100 ) Sets the maximum number of ZMthrow'n exceptions to be recorded. Once this limit has been reached, each subsequently ZMthrow'n exception will cause the oldest (least recent) recorded exception to be forgotten (i.e., discarded from ZMerrno's list). The default limit is 100. If this limit is acceptable, user code need not call this function at all. If the limit is set to 0, this ZMerrno facility is effectively disabled, and any recorded exceptions are immediately permanently discarded. 2) ZMerrno.write( const ZMexception & exc ) Records the given exception. This is typically taken care of by the exception handler; thus, user code seldom needs to call this function directly. 3) ZMerrno.count() Return the (integer) number of ZMthrow'n exceptions ever recorded via ZMerrno.write(), whether or not they are still recorded. 4) ZMerrno.size() Return the (integer) number of ZMthrow'n exceptions currently recorded. 5) ZMerrno.clear() Set an internal counter to zero. This counter is available (see next function) to user code to track ZMthrow'n exceptions that have occurred during any arbitrary time interval. 6) ZMerrno.countSinceCleared() Return the (integer) number of ZMthrow'n exceptions that have been recorded via ZMerrno.write(), whether or not they are still recorded, since the user counter was last cleared (see previous function). 7) ZMerrno.name( unsigned int k = 0 ) Return the name (as logged) of the latest-but-k exception currently recorded via ZMerrno. Thus, ZMerrno.name() gives the (string) name of the latest recorded exception, while ZMerrno.name(1) gives the name of the exception recorded immediately before the last one. 8) ZMerrno.get( unsigned int k = 0 ) Return a (const pointer to) the latest-but-k exception currently recorded via ZMerrno. Thus, ZMerrno.get() gives a (const pointer to) the latest recorded exception, while ZMerrno.get(1) gives the corresponding pointer to the exception recorded immediately before the last one. This may be useful to peruse the exception's message text, to note the handler and logger used when the exception was ZMthrow'n, etc. The resulting pointer should generally be checked against 0, in case ZMerrno does not go back as far as requested. 9) ZMerrno.erase() Remove the most recently-recorded exception. This can be useful if, for example, there is a loop of known ignorable exceptions, all nonetheless duly recorded by the handler. These exceptions can be erase()'d so as not to wipe out history for other, more interesting, exceptions. clhep-2.1.4.1.orig/Exceptions/doc/ex-design-30000755000175000017500000004357510043511633017246 0ustar olesoles ZOOM Exception Mechanism Design ------------------------------- The Zoom exception mechanism is intended to be the tools used by ZOOM modules to handle exceptions in a useful way and provide the user with interfaces to control how to react to problems. It is not (at this time) intended to be a mechanism for the user to hook into to define his own exceptions, although that may come later. Frankly, successful implementation and use by ZOOM modules will be necessary to sell this structure to our users as potentially useful, anyway. We need the mechanism "now" because we are trying to deliver at least two packages which will have to be re-instrumented when the mechanism is finally adopted. This is not a "signal handler" mechanism, which could be used to establish behavior for segment violations, arthmetic exceptions, and so forth. It would be nice to have this but C++ does not provide generic support for those activities. A **later** possibility will be to provide this support for POSIX-compliant operating systems, and coordinate it with the exception mechanism. We need to be able to cope with the following realities: -------------------------------------------------------- 1 - Users will not, in every case, imbed calls into a try block. 2 - Frameworks will incorporate code from multiple users and in some circumstances cannot afford to abort the entire job if some rare path in one user's code blows up. To the extent we can help with this, we must. 3 - Framework creators CAN be expected to imbed portions in try blocks, or set up behaviors for various exceptions, assuming we give them the necessary tools. In the remainder of this document, the "user" who sets things up is assmued to be such a framework manager. 4 - There is need for coordinated logging and related behavior. To be able to satisfy this, the goal is to allow: ------------------------------------------------- 1 - The user should be able to specify, for a given sort of exception, whether she wants to: a - Throw the exception via the C++ mechanism, thus aborting unless she in the framework or a lower-level user responsible catchs the problem. b - Invoke a user-written handler when the exception occurs, which may itself determine it is necessary to throw the exception. c - Ignore the exception RETURNING TO THE SPOT IN THE ZOOM MODULE THAT DETECTED THE PROBLEM. This can happen with or without a handler being invoked. Typically, the module will then return some approriate pseudo-value to the user. 2 - In cases where exceptions are to be handled or ignored, there should be a well-known way to get information about the existance of a problem, analogous to the errno mechanism in C. 3 - Explanatory strings should be associated with the problem at the point of origin. 4 - The exceptions are organized in a hierarchical manner, which uniformly applies one simple category philosophy that the users can understand, across the various ZOOM packages. With this in mind, our mechanism has the following structure: ------------------------------------------------------------- 1 - Upon detecting a problem for which it would like to (potential) throw an exception, the module code will instead invoke the ZMthrow macro. 2 - ZMthrow takes as its argument a ZMexception object constructor, which has as ITS first argument a const char*. The intent is for the ZMexception object actually do be derived from the base ZMexception class, and for the char* first argument to contain an explanatory message. Particular ZMexceptions can also have construction forms taking a second string, or whatever. For example, ZMthrow ( HepTuple::ZMxCapture( "Column not found", name ) ); 3 - The ZMthrow macro appends __LINE__, __FILE__ and calls ZMexcept. 4 - ZMexcept has signature void ZMexcept ( ZMexception x, int line, char file[], char data[], char time[]); It does the following: a - Places x.ZMexceptionId into a circular buffer ZMerrno. Actually, constructing the ZMexcept object does that. More about ZMerrno later. b - Determines for this exception what sort of logging is enabled, and logs it. Note that derived exceptions must modify the general logging method if they wish to include information beyond the message and file/line/time stamp. c - Determines whether a handler has been established, and if so invokes it. The handler will be passed the exception object, and can be set up to also take the line/file/time arguments. The handler returns a bool which if true will say to throw the exception. d - Determines (after any handler has been invoked) whether to ignore the exception. It will do either throw x; or return; 5 - ZMerrno is analogous to the C/Unix errno mechanism, but allows viewing a history of the last N problems detected. We anticipate using it like errno, via exception id, but we copies of place the whole exception object onto ZMerrno to provide more info if desired. The interface is: a - ((creation somehow, specifying N)) b - ZMerrno.write (ZMexcption* x); // copy an exception onto ZMerrno The user would not use a and b but would use: c - int ZMerrno.read (); // read the last id value on ZMerrno int ZMerrno.read (int k); // read the last-but-k id value on ZMerrno d - void ZMerrno.clear(); // put a zero (indicating no current error) // on ZMerrno. e - void ZMerrno.pop(); // remove an entry setting the top to the // previous entry. For instance, if you // have a loop in which some known ignorable // happening places a value on ZMerrno, you // can pop each one so as not to wipe out // the history for others. f - ZMexception* ZMerrno.get() // Return pointer to the last or ZMexception* ZMerrno.get(int k) // last-but-k exception on ZMerrno. // Allows perusal of things like the // message and the logger and handler // used when the exception was // encountered. Thus after the start, or after ZMerrno.clear(), the user can always find out whether any ignored exceptions had occured by doing if (ZMerrno.read()) { ... then something has happened } If we later incorporate signal handling, this ZMerrno stack is where the user can find out whether he has had his arithmetic error since the last clear. ZMerrno is pronounced "oops." 6 - The id 0 indicates no error. Each upper 16-bit value is assigned to a module to avoid conflicts; the values starting with upper bit set are reserved for user definition at a later date. The lower 16 bits distinguish the specific error. Each ZMexception object class has its own error id which is established (hardwired) at construction. The ZMexception codes for the upper 16 bits are defined in ZMexception.h. The lower 16 bits, for each module are defined in files with names like HepTupleZMexception.h. 7 - When a ZMexcept exception is thrown it does a ZMerrno.write(this.id). Thus ZMerrno tracks these exceptions even if they are explicitly thrown and caught by the user outside the ZMthrow/ZMexception mechanism. 8 - Logging is discussed separately. The user interface to control exception behavior is: ----------------------------------------------------- By the way, this is an interface for the framework manager to use; the lower level user would generally never establish handlers or ignores, and would only use the ZMerrno.read() and .clear(). 1 - To establish a handler for a particular exception type, say for ZMexceptCapture: HepTuple::ZMxCapture.setHandler ( myhandler, "handlerName" ); The handlerName string gives a convenient way to tell about the handling in log messages ("... was handled by mySuperHandler"). The signature of the handler must be: bool myhandler ( ZMexception x ); We will have a ZMhandler class to contain that and the handlerName. Note that the handler has access to the fields of x including for all ZMexception objects: char* message; int line; char* sourceFileName; int serialNumber; ZMhandler handler; ZMlogger logger; // and class-wide data: static int id; static char* messagePreamble; static int count; and, for particular derived ZMexception objects, any secondary messages or other information provided to the constructor and kept in the object. The handler should return false to ignore the exception and return to the user code (from ZMexcept), or true to throw the exception after the handler returns. The user can also throw an exception explicitly in the handler. 2 - You may establish a handler for an entire base class, which applies to any ZMexceptions derived from in that class for which no specific handler is established. For example, HepTuple::ZMxNewColumn is derived from HepTuple::ZMxGeneral so HepTuple::ZMxGeneral.setHandler ( myDefaultHandler ); will apply to HepTuple::ZMxNewColumn if that is ever ZMthrown. 3 - Note that if a handler is established for a subclass it takes precedence over that for the base class. If you instead wish to call the base class handler after executing the specific handler, you must invoke it explicitly. Only if no handler has been established will the exception check for and invoke a handler in its base class automatically. 3a- At times you may wish to prevent the calling of the base class handler yet have no need for explicit handling. The mechanism provides ZMtrivialHandler which merely checks whether (in the absense of a handler) the exception would be ignored or thrown, and returns false or true accordingly. Conversely, setting the handler to NULL will cause it to revert to the initial behavior of defering to the handler of the parent class. 4 - The user can tell the system to whether or not to ignore an unhandled ZMexception: HepTuple::ZMxCapture.ignore() HepTuple::ZMxCapture.dontIgnore() The default is don't ignore -- meaning throw the exception unless a handler is invoked and comes back false. The same rules for inheritance apply as in the handler case: If you haven't specifically said anything about a subclass, then what you have said about the parent class will apply. Thus calling dontIgnore() is NOT the same as not calling ignore(). In analogy with handling, we need a way to say "pretend I never said ignore or dont; use the parent class decision". This is: HepTuple::ZMxCapture.useParentIgnore() 5 - Sometimes you may want to ignore an exception the first N times and then react differently. The handler can have a static count variable to implement this behavior. Alternatively, there is a call to establish this behavior even if no handler is used: HepTuple::ZMxCapture.ignore(N) The part of the interface seen by non-framework-manager users is simpler: -------------------------------------------------------------------------- 1 - The ZMerrno methods may be used to see if (ignored) exceptions have happened. Typically, the user used to Unix exceptions would call ZNerrno.read() and maybe ZMerrno.clear(). 2 - The ordinary user can try, and catch, these ZMexceptions. We ask that usrs not throw ZMexceptions that the ZOOM modules throw. Later we may extend support to include user-defined subclasses of ZMexception. 3 - When an exception occurs and is not ignored, the user will know the message given for the exception, as well as the and line number where the ZMthrow macro was invoked. This is inside ZOOM code. By doing debug core the user can get a traceback into the user routines to find which line of his code encountered the problem. 4 - The status of what was set up for ignoring and handling may be probed, so temporary control behavior can be set and then put back to what it was: handler() returns the established handler. logger() returns the established logger. int ignoreStatus(); // -2 - ignore was specified (or ignore N was // specified but have none left) // -1 - dontIgnore was specified // positive integer - ignore N times was specified // and have this number left // 0 - neither was specified; use policy from // parent void setIgnorePolicy(int); Logging is handled as follows: ------------------------------ 0 - The connection between a class of ZMexceptions and logging that is through a ZMlogger. The (framework) user may create her own logger but typically will use our provided class ZMlog, which has is a ZMlogger and has a constructor taking a file name. Any actions taken by the logger we describe below will refer to how ZMlog behaves. 1 - Every individual ZMexception object can have a method for creating (from the other arguments aside from messge) a string to put into a log. (Of course, it may be inherited from its base class.) But the message as well as time, line, id, and so forth is not to be handled by each; instead, ZMthrow handles this. The method to create the string is logMessage(). ZMexcept will at various points call the logThis() method of the established logger when it wants to log information. 1a- The user assgns a ZMlogger to an exception class by ZMexception::setLogger(ZMlogger*). For example, ZMlog* mylog ("logfilename.txt"); ZMxCapture::setLogger(mylog); The pointer returned should be checked. In the case of ZMlog, it can be NULL for two reasons: The file cannot be opened for append, or the file is already open for some other purpose. (If it is already opened for logging, that is fine; this logger will also cause logging of messages there). 2 - ZMexception has a method setLogger(ZMlogger) which will open a log using that logger for that type of exception. This will establish this logger to be used for exceptions of this class. In the case of ZMlog, that means it will establish the file which was provided when the logger was constructed, as a logging point for exceptions of this class. (This is class static information.) 2a- The ZMlog object will log to a file: its constructor will open a log to that file for that type of exception. A user can provide a different logger which, for example, ties into the CDF or D0 general logging mechanism instead of writing to a file. 3 - If no logging is specified for a class the file defaults to the base class. Thus HepTuple::ZMxCapture might log to the file for HepTuple::ZMxGeneral, or if no logging is established there, for ZMexception. It is possible (the default) that no logging is established anywhere. 4 - You may log to multiple files; each ZMexception (sub)class has a class static linked list of log files. - - - - up to here 5 - Aside from single files, you can also establish a "rolling log" pair of files: bool ZMexception::log(const char filename1[], int n, const char filename2[], ); The way this works is that the first file is opened (still for append), and up to n exception instances are logged into it, at which point it is closed, renamed to the second file, and re-created (empty) for more logging. A script can detect when this has happended and archive the second file if desired. 6 - If you wish to cease logging a particular exception type in general or to a particular log file, you may: HepTuple::ZMxCapture.stopLog(); HepTuple::ZMxCapture.stopLog(filename); If no exceptions are logging to a particular log anymore, that file will be closed. 7 - To be able to temporarily modify logging behavior for an exception, you may call int saveLogInstructions(), and later call restoreLogInstructions(int). The following usage recommendations pertain to writers of ZOOM code: -------------------------------------------------------------------- As shown in the examples, place your definitions of the exception objects inside the class definition for the class. That way, methods within this class can simply call the shorter name -- ZMxCapture rather than ZMxHepTupleCapture. Don't create too many types of exceptions. The error codes appearing on the ZMerrno stack are defined per each type, but unless you envision the user needing to AUTOMATICALLY distinguish between one problem and another in the same submodule via ZMerrno, don't define them as two separate exception types. In cases where the user interface promises a routine will not throw an exception (but might return false if something goes awry) the ZOOM code itself should enclose any possible ZMthrows in try blocks, to catch the problem in case the user has not specified ignoring the exception. Note that the argument to the constructor of the ZMexception in ZMthrow can (and often will) be a string formed by concatenating some fixed informatory message with some variable information, as in ZMthrow ( ZMxCapture( "Column not found", name ) ); To do this, one should have a constructor for that sort of ZMexceptoin object with the extra argument in its signature, as well as the one with just a const char[]. One could alternatively do someting like ZMthrow ( ZMxCapture( strcat("Column not found", name) ) ); but if you use the exception in more than one place, the recommended second constructor is less work. When returning a pointer, in circumstances where things have gone wrong, the usual action is to return a null pointer. In many cases this is appropriate, especially if the user interface defines it. However, the sloppy user might cause an (uncatchable) bus error if he does not check for null pointer. Consider returning a pointer to a braindead object (whose methods throw ignorable ZMthrows) rather than NULL -- then the job might not abort. Documentation should be layered: 1 - How the user interacts with the mechanism (VERY brief). 2 - How the framework manager user interacts (settting up handlers, logs, ignores). 3 - How to define a ZMx class. 4 - Usage recommendations for writers of ZOOM code. clhep-2.1.4.1.orig/Exceptions/doc/ex-design-20000755000175000017500000003566110043511633017242 0ustar olesoles ZOOM Exception Mechanism Design ------------------------------- The Zoom exception mechanism is intended to be the tools used by ZOOM modules to handle exceptions in a useful way and provide the user with interfaces to control how to react to problems. It is not (at this time) intended to be a mechanism for the user to hook into to define his own exceptions, although that may come later. Frankly, successful implementation and use by ZOOM modules will be necessary to sell this structure to our users as potentially useful, anyway. We need the mechanism "now" because we are trying to deliver at least two packages which will have to be re-instrumented when the mechanism is finally adopted. This is not a "signal handler" mechanism, which could be used to establish behavior for segment violations, arthmetic exceptions, and so forth. It would be nice to have this but C++ does not provide generic support for those activities. A **later** possibility will be to provide this support for POSIX-compliant operating systems, and coordinate it with the exception mechanism. We need to be able to cope with the following realities: -------------------------------------------------------- 1 - Users will not, in every case, imbed calls into a try block. 2 - Frameworks will incorporate code from multiple users and in some circumstances cannot afford to abort the entire job if some rare path in one user's code blows up. To the extent we can help with this, we must. 3 - Framework creators CAN be expected to imbed portions in try blocks, or set up behaviors for various exceptions, assuming we give them the necessary tools. In the remainder of this document, the "user" who sets things up is assmued to be such a framework manager. 4 - There is need for coordinated logging and related behavior. To be able to satisfy this, the goal is to allow: ------------------------------------------------- 1 - The user should be able to specify, for a given sort of exception, whether she wants to: a - Throw the exception via the C++ mechanism, thus aborting unless she in the framework or a lower-level user responsible catchs the problem. b - Invoke a user-written handler when the exception occurs, which may itself determine it is necessary to throw the exception. c - Ignore the exception RETURNING TO THE SPOT IN THE ZOOM MODULE THAT DETECTED THE PROBLEM. This can happen with or without a handler being invoked. Typically, the module will then return some approriate pseudo-value to the user. 2 - In cases where exceptions are to be handled or ignored, there should be a well-known way to get information about the existance of a problem, analogous to the errno mechanism in C. 3 - Explanatory strings should be associated with the problem at the point of origin. 4 - The exceptions are organized in a hierarchical manner, which uniformly applies one simple category philosophy that the users can understand, across the various ZOOM packages. With this in mind, our mechanism has the following structure: ------------------------------------------------------------- 1 - Upon detecting a problem for which it would like to (potential) throw an exception, the module code will instead invoke the ZMthrow macro. 2 - ZMthrow takes as its argument a ZMexception object constructor, which has as ITS first argument a const char*. The intent is for the ZMexception object actually do be derived from the base ZMexception class, and for the char* first argument to contain an explanatory message. Particular ZMexceptions can also have construction forms taking a second string, or whatever. For example, ZMthrow ( HepTuple::ZMxCapture( "Column not found", name ) ); 3 - The ZMthrow macro appends __LINE__, __FILE__, __DATE__, __TIME__ and calls ZMexcept. 4 - ZMexcept has signature void ZMexcept ( ZMexception x, int line, char file[], char data[], char time[]); It does the following: a - Places x.ZMexceptionId into a circular buffer ZMerrno. Actually, constructing the ZMexcept object does that. More about ZMerrno later. b - Determines for this exception what sort of logging is enabled, and logs it. Note that derived exceptions must modify the general logging method if they wish to include information beyond the message and file/line/time stamp. c - Determines whether a handler has been established, and if so invokes it. The handler will be passed the exception object, and can be set up to also take the line/file/time arguments. The handler returns a bool which if true will say to throw the exception. d - Determines (after any handler has been invoked) whether to ignore the exception. It will do either throw x; or return; 5 - ZMerrno is analogous to the C/Unix errno mechanism, but allows viewing a history of the last N problems detected. The interface is: a - ((creation somehow, specifying N)) b - ZMerrno.write (int id); // put on stack exception id. The user would not use a and b but would use: c - int ZMerrno.read (); // read the last value on ZMerrno int ZMerrno.read (int k); // read the last-but-k value on ZMerrno d - void ZMerrno.clear(); // put a zero (indicating no current error) // on ZMerrno. e - void ZMerrno.pop(); // remove an entry setting the top to the // previous entry. For instance, if you // have a loop in which some known ignorable // happening places a value on ZMerrno, you // can pop each one so as not to wipe out // the history for others. Thus after the start, or after ZMerrno.clear(), the user can always find out whether any ignored exceptions had occured by doing if (ZMerrno.read()) { ... then something has happened } If we later incorporate signal handling, this ZMerrno stack is where the user can find out whether he has had his arithmetic error since the last clear. ZMerrno is pronounced "oops." 6 - The id 0 indicates no error. Each upper 16-bit value is assigned to a module to avoid conflicts; the values starting with upper bit set are reserved for user definition at a later date. The lower 16 bits distinguish the specific error. Each ZMexception object class has its own error id which is established (hardwired) at construction. The ZMexception codes for the upper 16 bits are defined in ZMexception.h. The lower 16 bits, for each module are defined in files with names like HepTupleZMexception.h. 7 - When a ZMexcept exception is thrown it does a ZMerrno.write(this.id). Thus ZMerrno tracks these exceptions even if they are explicitly thrown and caught by the user outside the ZMthrow/ZMexception mechanism. 8 - Logging is discussed separately. The user interface to control exception behavior is: ----------------------------------------------------- By the way, this is an interface for the framework manager to use; the lower level user would generally never establish handlers or ignores, and would only use the ZMerrno.read() and .clear(). 1 - To establish a handler for a particular exception type, say for ZMexceptCapture: HepTuple::ZMxCapture.handler ( myhandler ); The signature of the handler must be: bool myhandler ( ZMexception x ); Note that the handler has access to the fields of x including for all ZMexception objects: char* message; int line; char* file; char* date; char *time; and, for particular derived ZMexception objects, any secondary messages or other information provided to the constructor. The handler should return false to ignore the exception and return to the user code (from ZMexcept), or true to throw the exception after the handler returns. The user can also throw an exception explicitly in the handler. 2 - You may establish a handler for an entire base class, which applies to any ZMexceptions derived from in that class for which no specific handler is established. For example, HepTuple::ZMxNewColumn is derived from HepTuple::ZMxGeneral so HepTuple::ZMxGeneral.handler ( myDefaultHandler ); will apply to HepTuple::ZMxNewColumn if that is ever ZMthrown. 3 - Note that if a handler is established for a subclass it takes precedence over that for the base class. If you instead wish to call the base class handler after executing the specific handler, you must invoke it explicitly. Only if no handler has been established will the exception check for and invoke a handler in its base class automatically. 4 - The user can tell the system to whether or not to ignore an unhandled ZMexception: HepTuple::ZMxCapture.ignore() HepTuple::ZMxCapture.dontIgnore() The default is don't ignore -- meaning throw the exception unless a handler is invoked and comes back false. The same rules for inheritance apply as in the handler case: If you haven't specifically said anything about a subclass, then what you have said about the base class will apply. Thus calling dontIgnore() is NOT the same as not calling ignore(). 5 - Sometimes you may want to ignore an exception the firt N times and then react differently. The handler can have a static count variable to implement this behavior. The part of the interface seen by non-framework-manager users is simpler: -------------------------------------------------------------------------- 1 - The ZMerrno methods may be used to see if (ignored) exceptions have happened. Typically, the user used to Unix exceptions would call ZNerrno.read() and maybe ZMerrno.clear(). 2 - The ordinary user can try, and catch, these ZMexceptions. We ask that usrs not throw ZMexceptions that the ZOOM modules throw. Later we may extend support to include user-defined subclasses of ZMexception. 3 - When an exception occurs and is not ignored, the user will know the message given for the exception, as well as the and line number where the ZMthrow macro was invoked. This is inside ZOOM code. By doing debug core the user can get a traceback into the user routines to find which line of his code encountered the problem. 4 - The status of what was set up for ignoring and handling may be probed, so temporary control be havior can be set and then put back to what it was: GetHandler() returns the estabished handler (and we have to decide how to cope with the two different handler signatures!!). int ignoreStatus(); // 1 - ignore was specified // -1 - dontIgnore was specified // 0 - neither was specified; use status from // parent void setIgnoreStatus(int); Logging is handled as follows: ------------------------------ 1 - Every individual ZMexception object can have a method for creating (from the other arguments aside from messge) a string to put into a log. (Of course, it may be inherited from its base class.) But the message as well as time, line, id, and so forth is not to be handled by each; instead, ZMthrow handles this. The method to create the string is logMessage(). 2 - ZMexception has a method log(filename) which will open a log to that file for that type of exception. bool ZMexception::log(const char filename[]); This will (if it is not already open for logging) open the file FOR APPEND and establish that file as a logging point for exceptions of this class. (This is class static information.) The bool returned should be checked. It can be false for two reasons: The file cannot be opened for append, or the file is already open for some other purpose. (If it is already opened for logging, that is fine; this ZMexception will also log its messages there. 3 - If no logging is specified for a class the file defaults to the base class. Thus HepTuple::ZMxCapture might log to the file for HepTuple::ZMxGeneral, or if no logging is established there, for ZMexception. It is possible (the default) that no logging is established anywhere. 4 - You may log to multiple files; each ZMexception (sub)class has a class static linked list of log files. 5 - Aside from single files, you can also establish a "rolling log" pair of files: bool ZMexception::log(const char filename1[], int n, const char filename2[], ); The way this works is that the first file is opened (still for append), and up to n exception instances are logged into it, at which point it is closed, renamed to the second file, and re-created (empty) for more logging. A script can detect when this has happended and archive the second file if desired. 6 - If you wish to cease logging a particular exception type in general or to a particular log file, you may: HepTuple::ZMxCapture.stopLog(); HepTuple::ZMxCapture.stopLog(filename); If no exceptions are logging to a particular log anymore, that file will be closed. 7 - To be able to temporarily modify logging behavior for an exception, you may call int saveLogInstructions(), and later call restoreLogInstructions(int). The following usage recommendations pertain to writers of ZOOM code: -------------------------------------------------------------------- As shown in the examples, place your definitions of the exception objects inside the class definition for the class. That way, methods within this class can simply call the shorter name -- ZMxCapture rather than ZMxHepTupleCapture. Don't create too many types of exceptions. The error codes appearing on the ZMerrno stack are defined per each type, but unless you envision the user needing to AUTOMATICALLY distinguish between one problem and another in the same submodule via ZMerrno, don't define them as two separate exception types. In cases where the user interface promises a routine will not throw an exception (but might return false if something goes awry) the ZOOM code itself should enclose any possible ZMthrows in try blocks, to catch the problem in case the user has not specified ignoring the exception. Note that the argument to the constructor of the ZMexception in ZMthrow can (and often will) be a string formed by concatenating some fixed informatory message with some variable information, as in ZMthrow ( ZMxCapture( "Column not found", name ) ); To do this, one should have a constructor for that sort of ZMexceptoin object with the extra argument in its signature, as well as the one with just a const char[]. One could alternatively do someting like ZMthrow ( ZMxCapture( strcat("Column not found", name) ) ); but if you use the exception in more than one place, the recommended second constructor is less work. When returning a pointer, in circumstances where things have gone wrong, the usual action is to return a null pointer. In many cases this is appropriate, especially if the user interface defines it. However, the sloppy user might cause an (uncatchable) bus error if he does not check for null pointer. Consider returning a pointer to a braindead object (whose methods throw ignorable ZMthrows) rather than NULL -- then the job might not abort. clhep-2.1.4.1.orig/Exceptions/.cvsignore0000755000175000017500000000007410043511633016516 0ustar olesolesMakefile.in configure aclocal.m4 autom4te.cache config.h.in clhep-2.1.4.1.orig/Exceptions/Exceptions/0000755000175000017500000000000012242515140016633 5ustar olesolesclhep-2.1.4.1.orig/Exceptions/Exceptions/ZMexception.h0000755000175000017500000004151212045031613021256 0ustar olesoles#ifndef ZMEXCEPTION_H #define ZMEXCEPTION_H // ---------------------------------------------------------------------- // // ZMexception.h - class declaration for the ZOOM Exception base classes, // and macros to help set up specific exceptions definitions. // // class ZMexception: This is the public base type of all exceptions. // In particular this is the interface seen by // handler and logger. Methods are defined in // a macro ZMexClassStaticMethods, in ZMexception.icc, // or in .../Exceptions/src/ZMexception.cc: // // in the macro ZMexception.icc src/ZMexception.cc // ------------ --------------- ------------------ // setHandler() ZMexception // getHandler() message() // setLogger() // getLogger() count() // isTypeOf() wasThrown() logMessage(optText) // isBaseOf() severity() // isDerivedFrom location(line, file) // logNMore() fileName() // handleMe() line() // logMe() name() // facility() // OKtoLog() // // ZMexClassStaticMethods is defined here. It is used not only by the base // class definition (ZMexception) but also by a couple of macros established // for the convenience of creators of ZMex exceptions: // // ZMexStandardContents contains definitions of all the functions in the // interface for exception creators which are implemented // via methods in classInfo. See technical notes 2 - 5. // // ZMexStandardDefinition defines an exception in the inheritance hierarchy, // with no specific data or member functions beyond // the standard contents. If more members are needed, // use this macro as an example and add them after the // ZMexStandardContents. // // See technical note 1 for instructions on how to use these macros to define // ZOOM exceptions. (Technical notes are in file technical-notes in the // doc area of the Exceptions product). // // One further key macro should be known: // // ZMthrow(x) in ZMthrow.h calls ZMthrow_ but adds on the line and file // arguments. ZMthrow_(x,line,file) does the dispatching of the exception // handling. // // Related structures include: // // ZMexClassInfo contains the definitions of the classInfo structure. // ZMexClassInfo.h // // Revision History: // 970912 MF Initial version after separating out classInfo etc. // 970914 MF Corrected isBaseOf method, which needs isDerivedFrom. // 970916 WEB Updated per code review // 970917 WEB Updated per code review 2 // 970918 WEB Updated per code review 3 // 970918 PGC Updated per code review 4 // 971112 WEB Updated for conformance to standard and the zoom // compatability headers // 971211 WEB Updated per code walkthrough // 971215 WEB Gave names to the default handler & logger // 980219 WEB Corrected return types of get/set Handler/Logger // to match those of those classes' methods // 980304 WEB Cleaned up logMessage() & related stuff // 980421 WEB Moved name() and facility() from .icc to .cc // 980615 WEB Added namespace support // 990318 MF Added virtual destructor // 990801 JVR Added logObject() for augmented exception purposes // 000217 WEB Improve C++ standards compliance // 000503 WEB Avoid global using // 010413 MF Vetted for proper namespace behavior: // all macros need to use the equivalent of ZM_QUAL_NAME // to append zmex if (and only if) namespaces are enabled. // 010626 MF ctor from ostringstream for syntactic convenience // 010626 MF Have ctor use string& rather than string // 011012 MF Include ZMutility/sstream so ostringstream& is OK // (KCC somehow survived the omission; gcc does not) // 011217 MF logMe() for base class does // ZMexception::classInfo().getLogger().emit(*this); // instead of emit(msg). This significantly improves // the look of the output when this path is taken, and // when logging to an ErrorLog allows statistics to work. // 031105 LG Get rid of all ZMutility references // 051117 LG Always use // // ---------------------------------------------------------------------- #include "CLHEP/Exceptions/defs.h" #include #ifndef STRING_INCLUDED #define STRING_INCLUDED #include #endif #ifndef ZMEXSEVERITY_H #include "CLHEP/Exceptions/ZMexSeverity.h" #endif #ifndef ZMEXLOGRESULT_H #include "CLHEP/Exceptions/ZMexLogResult.h" #endif #ifndef ZMEXACTION_H #include "CLHEP/Exceptions/ZMexAction.h" #endif #ifndef ZMEXCLASSINFO_H #include "CLHEP/Exceptions/ZMexClassInfo.h" #endif #include #ifdef ZM_USE_NAMESPACES #define ZMEX zmex #else #define ZMEX #endif namespace zmex { class ZMexHandler; class ZMexLogger; class ZMexNoParent; // ************************************** // // ZMexUserActivity, ZMexUserNumericalTag // // ************************************** extern std::string ZMexUserActivity; extern int ZMexUserNumericalTag; // ******************* // // ZMhandler, ZMlogger // // ******************* ZMexHandler & ZMhandler(); ZMexLogger & ZMlogger(); // *********** // // ZMexception // // *********** class ZMexception { protected: static ZMexClassInfo _classInfo; // The base class has these static members for its class information. const std::string message_; // Indicates reason for the exception. Should be unique to the line of // code doing ZMthrow. Multiple lines can throw the same ZMexception, // but normally supply different messages. #ifndef DEFECT_NO_MUTABLE mutable #endif int line_; #ifndef DEFECT_NO_MUTABLE mutable #endif std::string sourceFileName_; // Indicate location of the source of the exception // Copy for each instance of the class-wide data to snapshot them. const ZMexSeverity mySeverity_; const int myCount_; #ifndef DEFECT_NO_MUTABLE mutable #endif std::string handlerUsed_; #ifndef DEFECT_NO_MUTABLE mutable #endif bool wasThrown_; public: // ********************** // // Constructor/Destructor // // ********************** // ZMexception( const std::string & mesg , const ZMexSeverity howBad = ZMexSEVERITYenumLAST , int icount = ZMexception::_classInfo.nextCount() ); explicit ZMexception( const std::ostringstream & msg , const ZMexSeverity howBad = ZMexSEVERITYenumLAST , int icount = ZMexception::_classInfo.nextCount() ); virtual ~ZMexception() {} // ********************** // // Instance Methods // // ********************** // void location( int line, const std::string file ) const; // Set the location of the creator of the exception ZMexSeverity severity() const; // Determine the severity of this exception. int line() const; std::string fileName() const; // Determine the file/line number of the ZMthrow of this exception. std::string message() const; int count() const; std::string handlerUsed() const; bool wasThrown() const; // The following are for internal use of the exception mechanism routines: void handlerUsed( const std::string handlerName ) const; void wasThrown( bool b ) const; virtual std::string logMessage( const std::string optText = "" ) const; virtual std::string facility() const; // Return the class facility preamble string. virtual std::string name() const; // Return the exception name string, e.g., "ZMexWhatever". bool OKtoLog() const; // **************************** // // Methods dealt with in the // ZMexClassStaticMethods macro // // **************************** public: // ********************** // // Class static Methods // // ********************** // // This declares the standard static methods and the virtual // functions that depend on the static member of exception class -- // classInfo. Technical note 5 explains why we will // need to use a macro defining these methods, rather than using simple // virtual methods or using templates. // Note - These declarations become moot for every class derived from // ZMexception, because the methods of the same names are explicitly // declared and defined in the ZMexClassStaticMethods macro. However, // it is useful to have these declarations here in the base class, to // set forth a clean and commented specification of the interface to // these routines. The interface applies to ALL ZOOM exceptions. /* static ZMexHandler setHandler( const ZMexHandler & newHandler ); // Replace previous handler; return old handler. static const ZMexHandler getHandler(); // Return the current handler. static ZMexLogger setLogger( const ZMexLogger & newLogger ); // Replace previous logger; return old logger. static const ZMexLogger getLogger(); // Return the current logger. static ZMexSeverity setSeverity ( const ZMexSeverity & newSeverity ); // Replace previous severity; return old severity. static const std::string setName ( const std::string & newName ); // Replace previous name; return old name. static const std::string setFacility ( const std::string & newFacility ); // Replace previous Facility; return old Facility. static bool isTypeOf( const ZMexception & x ); // Test if x is this type of exception static bool isBaseOf( const ZMexception & x ); // Test if x is exactly or derived from this type of exception */ // ************************************************************** // // Virtual instance methods that utilize class static information // // ************************************************************** // // Note - These are just like the class static methods in that they // have to be declared explicitly for each exception class, lest they // incorrectly use the method of that name in the base class ZMexception. // See technical note 6. // The difference is that (letting x be an instance of an exception type X) // these "instance methods" are invoked as x.f(), while the "class static // methods" are invoked by X::f(). // These instance methods have to be virtual because the exception x is passed // to a method expecting a ZMexception, which then invokes x.method(). If // method() is not virtual you get ZMexception.method() - which we don't // want - even though X has a method of that same name defined. /* virtual ZMexClassInfo & classInfo(); // return the appropriate classInfo virtual ZMexAction handleMe() const; // handle the current instance virtual ZMexLogResult logMe() const; // log the current instance virtual bool isDerivedFrom( const std::string name, const std::string facility ); // check if this intance is of class derived form the one qualified // by name and facility. // Test if this exception is derived from an exception with given name */ // **************************** // ZMexClassStaticMethods macro // **************************** // This macro contains definitions implementing the standard static methods // (class-wide logically virtual functions) that depend on the static member // of the exception class -- classInfo. Technical note 5 // addresses the need to use a macro defining these methods, // CODING NOTE -- THE ROUTINES DEFINED HERE SHOULD MATCH EXACTLY THE // INTERFACE DECLARED ABOVE (except that static methods // may not be declared const). #define ZMexClassStaticMethods \ \ static zmex::ZMexHandler setHandler( \ const zmex::ZMexHandler & newHandler ) { \ return _classInfo.setHandler( newHandler); } \ static zmex::ZMexHandler getHandler() { \ return _classInfo.getHandler(); } \ \ static zmex::ZMexLogger setLogger( \ const zmex::ZMexLogger & newLogger ) { \ return _classInfo.setLogger( newLogger ); } \ static zmex::ZMexLogger getLogger() { \ return _classInfo.getLogger(); } \ \ static zmex::ZMexSeverity setSeverity ( \ const zmex::ZMexSeverity & newSeverity ) { \ return _classInfo.setSeverity (newSeverity); } \ static const std::string setName ( const std::string & newName ) { \ return _classInfo.setName (newName); } \ static const std::string setFacility(const std::string& newFacility){ \ return _classInfo.setFacility (newFacility); } \ static bool isTypeOf( const zmex::ZMexception & x ) { \ return ( (_classInfo.name() == x.name()) && \ (_classInfo.facility() == x.facility() ) ); } \ \ static bool isBaseOf( const zmex::ZMexception & x ) { \ return ( x.isDerivedFrom (_classInfo.name(), \ _classInfo.facility()) ); } \ \ static void logNMore( const int N ) { \ _classInfo.logNMore( N ); } \ // // end of ZMexClassStaticMethods macro // **************************** // ZMexVirtualMethods macro // **************************** // This macro contains definitions implementing the standard virtual methods // that depend on the static members of the exception class -- classInfo. // Technical note 5 addresses the need to use a macro defining // these methods, // CODING NOTE -- THE ROUTINES DEFINED HERE SHOULD MATCH EXACTLY THE // INTERFACE DECLARED ABOVE (except that static methods // may not be declared const). #define ZMexVirtualMethods(Parent,Class) \ \ virtual Class * clone() const { \ return new Class( *this ); } \ \ virtual zmex::ZMexClassInfo & classInfo() const { \ return Class::_classInfo; } \ \ virtual zmex::ZMexAction handleMe() const { \ /* DEBUG std::cerr << #Class "::handleMe()" << std::endl; */ \ zmex::ZMexAction result = \ Class::classInfo().getHandler().takeCareOf( *this ); \ return (result == zmex::ZMexHANDLEVIAPARENT) ? \ Parent::handleMe() : result; } \ \ virtual zmex::ZMexLogResult logMe() const { \ /* DEBUG std::cerr << #Class "::logMe()" << std::endl; */ \ zmex::ZMexLogResult result = \ Class::classInfo().getLogger().emit( *this ); \ return (result == zmex::ZMexLOGVIAPARENT) ? \ Parent::logMe() : result; } \ \ virtual bool isDerivedFrom( const std::string aName, \ const std::string aFacility ) const { \ return aName == name() && aFacility == facility() \ ? true \ : Parent::isDerivedFrom( aName, aFacility ); \ } \ // // end of ZMexVirtualMethods macro public: ZMexClassStaticMethods; // Define all the static methods for the ZMexception base class. // Special cases for the virtual functions for the top exception class. virtual ZMexception * clone() const { return new ZMexception ( *this ); } virtual zmex::ZMexClassInfo & classInfo() const { return ZMexception::_classInfo; } virtual ZMexAction handleMe() const { // DEBUG std::cerr << "ZMexception::handleMe()" << std::endl; return ZMexception::classInfo().getHandler().takeCareOf( *this ); } virtual ZMexLogResult logMe() const { // DEBUG std::cerr << "ZMexception::logMe()" << std::endl; return ZMexception::classInfo().getLogger().emit(*this); } virtual bool isDerivedFrom( const std::string , const std::string ) const { return false; } virtual void logObject() const {} //added }; // ZMexception // ************************************* // // Macros for deriving ZOOM exceptions // // ************************************* // ******************************* // ZMexStandardContents macro // ******************************* #define ZMexStandardContents(Parent,Class) \ public: \ static zmex::ZMexClassInfo _classInfo; \ public: \ Class( \ const std::string & mesg \ , const zmex::ZMexSeverity howBad = \ zmex::ZMexSEVERITYenumLAST \ , int icount = _classInfo.nextCount() \ ) : \ Parent( \ mesg \ , (howBad == zmex::ZMexSEVERITYenumLAST ? \ _classInfo.severity() : howBad) \ , icount \ ) \ { } \ \ Class( \ const std::ostringstream& msg \ , const zmex::ZMexSeverity howBad = \ zmex::ZMexSEVERITYenumLAST \ , int icount = _classInfo.nextCount() \ ) : \ Parent( \ msg \ , (howBad == zmex::ZMexSEVERITYenumLAST ? \ _classInfo.severity() : howBad) \ , icount \ ) \ { } \ \ ZMexClassStaticMethods; \ ZMexVirtualMethods(Parent,Class); \ // // end of ZMexStandardContents macro // ******************************* // ZMexStandardDefinition macro // ******************************* #define ZMexStandardDefinition(Parent,Class) \ class Class : public Parent { \ ZMexStandardContents(Parent,Class) \ } \ // // end of ZMexStandardDefinition macro } // namespace zmex #define ZMEXCEPTION_ICC #include "CLHEP/Exceptions/ZMexception.icc" #undef ZMEXCEPTION_ICC #endif // ZMEXCEPTION_H clhep-2.1.4.1.orig/Exceptions/Exceptions/cmake-defs.h.in0000644000175000017500000000172511607115601021417 0ustar olesoles/* @PACKAGE@/defs.h Generated by cmake. */ #ifndef @UPACKAGE@_DEFS_H #define @UPACKAGE@_DEFS_H /* Name of package */ #ifndef PACKAGE #define PACKAGE "@PACKAGE@" #endif /* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #define PACKAGE_BUGREPORT "http://savannah.cern.ch/projects/clhep/" #endif /* Define to the full name of this package. */ #ifndef PACKAGE_NAME #define PACKAGE_NAME "@PROJECT_NAME@ @PACKAGE@" #endif /* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #define PACKAGE_STRING "@PROJECT_NAME@ @PACKAGE@ @VERSION@" #endif /* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #define PACKAGE_TARNAME "@PACKAGE@" #endif /* Define to the version of this package. */ #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "@VERSION@" #endif /* Version number of package */ #ifndef VERSION #define VERSION "@VERSION@" #endif #endif // @UPACKAGE@_DEFS_H clhep-2.1.4.1.orig/Exceptions/Exceptions/ZMexHandler.icc0000755000175000017500000000717212045031613021505 0ustar olesoles#ifndef ZMEXHANDLER_ICC #error "Exceptions/ZMexHandler.icc included without Exceptions/ZMexHandler.h" #endif // ---------------------------------------------------------------------- // // ZMexHandler.icc -- inline implementations for the standard handlers. // // // The following methods are defined here: // takeCareOf() and clone() for each provided handler: // ZMexThrowAlways ::takeCareOf() and ::clone() // ZMexIgnoreAlways ::takeCareOf() and ::clone() // ZMexIgnoreNextN ::takeCareOf() and ::clone() // ZMexThrowErrors and ::clone() // ZMexParentHandler::takeCareOf() and ::clone() // // Other implementations are in ZMexHandler.cc // // Revision History: // 970910 MF Initial version // 970917 WEB Updated per code review 2 // 980617 WEB Added namespace support // // ---------------------------------------------------------------------- namespace zmex { //******************************************* // // takeCareOf() for various standard exceptions // // This operator provides the handler's functionality; in general, it must: // record the handler's name // obtain (via x.OKtoLog() ) permission, from the exception, to log; // if granted, invoke the exception's logger (via x.logMe() ) // decide on an action // record (via x.wasThrown() ) the determined action // return the determined action // //******************************************* //****************************** // // ZMexThrowAlways::takeCareOf() // //****************************** inline ZMexAction ZMexThrowAlways::takeCareOf( const ZMexception & x ) { //DEBUG cerr << "ThrowAlways::takeCareOf" << endl; return standardHandling( x, true ); } //******************************* // // ZMexIgnoreAlways::takeCareOf() // //******************************* inline ZMexAction ZMexIgnoreAlways::takeCareOf( const ZMexception & x ) { //DEBUG cerr << "IgnoreAlways::takeCareOf" << endl; return standardHandling( x, false ); } //****************************** // // ZMexIgnoreNextN::takeCareOf() // //****************************** inline ZMexAction ZMexIgnoreNextN::takeCareOf( const ZMexception & x ) { return standardHandling( x, ( countDown_ <= 0 ) ? true : (--countDown_, false) ); } //******************************** // // ZMexParentHandler::takeCareOf() // //******************************** inline ZMexAction ZMexHandleViaParent::takeCareOf( const ZMexception & ) { //DEBUG cerr << "HandleViaParent::takeCareOf" << endl; return ZMexHANDLEVIAPARENT; } //******************************************* // // clone() for various standard exceptions // //******************************************* //************************* // // ZMexThrowAlways::clone() // //************************* inline ZMexThrowAlways * ZMexThrowAlways::clone() const { return new ZMexThrowAlways( *this ); } //************************** // // ZMexIgnoreAlways::clone() // //************************** inline ZMexIgnoreAlways * ZMexIgnoreAlways::clone() const { return new ZMexIgnoreAlways( *this ); } //************************** // // ZMexThrowErrors::clone() // //************************** inline ZMexThrowErrors * ZMexThrowErrors::clone() const { return new ZMexThrowErrors( *this ); } //************************* // // ZMexIgnoreNextN::clone() // //************************* inline ZMexIgnoreNextN * ZMexIgnoreNextN::clone() const { return new ZMexIgnoreNextN( *this ); } //*************************** // // ZMexParentHandler::clone() // //*************************** inline ZMexHandleViaParent * ZMexHandleViaParent::clone() const { return new ZMexHandleViaParent( *this ); } } // namespace zmex clhep-2.1.4.1.orig/Exceptions/Exceptions/ZMthrow.h0000755000175000017500000000627210043511633020430 0ustar olesoles#ifndef ZMTHROW_H #define ZMTHROW_H // ---------------------------------------------------------------------- // // ZMthrow.h - macro definition for the ZMthrow macro, tand function // declarations for ZMthrow_from() and ZMthrow_(). // // ZMthrow(x) calls ZMthrow_ but adds on the line and file arguments. // It either throws or not, depending on the return value of ZMthrow_. // // ZMthrow_from(x,line,file) calls ZMthrow_ using the supplied line and file // file arguments. Again, it either throws or not, depending on the return // value of ZMthrow_. // // ZMthrow_(), should not be used directly by user code, but is defined in // ZMthrow.cc for use by the ZMthrow macro and by ZMthrow_from. // // NOTE -- ZMthrow() and ZMthrow_from() are NOT in namespace zmex:: // ZMthrow() is NOT namespace qualified; it is a macro. // ZMthrow_from() is NOT namespace qualified; it is a macro. // // Revision History // 970910 MF Initial version // 970916 WEB Update per code review // 970917 WEB Update per code review 2 // 970918 PGC Replace monolitic if by do while loop // 971113 WEB Correct minor typo // 980615 WEB Add namespace support // 000218 WEB Replace NOTHROW by DEFECT_NO_EXCEPTIONS for // ISOcxx compatibility // 000512 WEB DEBUG corrections; remove useless reference in // NO_EXCEPTIONS definition // 010409 MF ZMthrow_from() // 010413 MF Include ZMenvironment and make other changes to // make sure namespaces are treated properly. // 031105 LG Get rid of all ZMutility references // // ---------------------------------------------------------------------- #ifndef ZMEXACTION_H #include "CLHEP/Exceptions/ZMexAction.h" #endif #include // for abort() #include /* DEBUG #include // for cerr */ namespace zmex { class ZMexception; //******************* // // ZMthrow_from macro // //******************* #ifdef DEFECT_NO_EXCEPTIONS #define ZMthrow_from(userExcept, line, file ) \ do { \ if ( zmex::ZMthrow_( userExcept, line, file ) == \ zmex::ZMexThrowIt ) { \ abort(); } \ } while (false) \ #else #define ZMthrow_from(userExcept, line, file ) \ do { \ try { throw userExcept; } \ catch ( const zmex::ZMexception & x ) { \ if ( zmex::ZMthrow_( x, line, file ) == \ zmex::ZMexThrowIt ) { \ throw; \ } \ } \ } while (false) \ #endif // NOTHROW // // End of the ZMthrow_from macro, which should NOT end with a semicolon. //************** // // ZMthrow macro // //************** #define ZMthrow(userExcept) ZMthrow_from(userExcept, __LINE__, __FILE__) // // End of the ZMthrow macro, which should NOT end with a semicolon. // NOTE - This is a macro. It has to be a monolithic statement so that a // construct like // if (xxx) ZMthrow(ZMxAbc); else dowhatever; // works. Since the content CANNOT therefore be in a block, we use // a do-while loop that will be executed exactly once. //*********** // // ZMthrow_() // //*********** ZMexAction ZMthrow_( const ZMexception & userException , int lineNum , const char fileName[] ); } // namespace zmex #endif // ZMTHROW_H clhep-2.1.4.1.orig/Exceptions/Exceptions/ZMexHandler.h0000755000175000017500000001065212045031613021173 0ustar olesoles#ifndef ZMEXHANDLER_H #define ZMEXHANDLER_H // ---------------------------------------------------------------------- // // ZMexHandler.h - interface class declarations for the ZOOM Exception // Handler base class and the basic handlers: // ZMexThrowAlways // ZMexIgnoreAlways // ZMexThrowErrors // ZMexIgnoreNextN // ZMexHandleViaParent // These can be used as examples if custom handlers are desired. // // Revision History: // 970909 MF Initial version // 970916 WEB Updated per code review // 970917 WEB Updated per code review 2 // 970923 WEB Updated per code review 4 // 971008 WEB ZMutility is the new name for the Utility package // 971112 WEB Updated for conformance to standard and the zoom // compatability headers // 980615 WEB Added namespace support // 990318 MF Modified intializer list orders to avoid warnings // 000217 WEB Improve C++ standards compliance // 000503 WEB Avoid global using // 031105 LG Get rid of all ZMutility references // // ---------------------------------------------------------------------- #ifndef STRING_INCLUDED #define STRING_INCLUDED #include #endif #ifndef ZMHANDLETO_H #include "CLHEP/RefCount/ZMhandleTo.h" #endif #ifndef ZMEXSEVERITY_H #include "CLHEP/Exceptions/ZMexSeverity.h" #endif #ifndef ZMEXACTION_H #include "CLHEP/Exceptions/ZMexAction.h" #endif namespace zmex { class ZMexception; //******************** // // ZMexHandlerBehavior // //******************** class ZMexHandlerBehavior { // Handler behavior interface definition public: ZMexHandlerBehavior( const std::string aname = "ZMexHandlerBehavior" ) : name_( aname ) { } virtual ~ZMexHandlerBehavior() { } virtual ZMexHandlerBehavior * clone() const { return new ZMexHandlerBehavior( *this ); } virtual std::string name() const { return name_; } virtual ZMexAction takeCareOf( const ZMexception & ) { return ZMexThrowIt; } protected: /*virtual void handleLog( ZMexception & x, const int limit );*/ ZMexAction standardHandling( const ZMexception & x, bool willThrow ); private: const std::string name_; }; // ZMexHandlerBehavior //************ // // ZMexHandler // //************ class ZMexHandler : public ZMhandleTo< ZMexHandlerBehavior > { // Handler interface public: ZMexHandler( const ZMexHandlerBehavior & behaviorWanted ) : ZMhandleTo( behaviorWanted ) { } virtual ~ZMexHandler() { } std::string name() const { return rep_->name(); } virtual ZMexAction takeCareOf( const ZMexception & x ) { return rep_->takeCareOf(x); } int setLogLimit( ZMexSeverity s, int limit ) { int lim = ZMexSeverityLimit[ s ]; ZMexSeverityLimit[ s ] = limit; return lim; } }; // ZMexHandler //**************** // // ZMexThrowAlways // //**************** class ZMexThrowAlways : public ZMexHandlerBehavior { public: ZMexThrowAlways() : ZMexHandlerBehavior( "ZMexThrowAlways" ) { } virtual ZMexThrowAlways * clone() const; virtual ZMexAction takeCareOf( const ZMexception & x ); }; //**************** // // ZMexThrowErrors // //**************** class ZMexThrowErrors : public ZMexHandlerBehavior { public: ZMexThrowErrors() : ZMexHandlerBehavior( "ZMexThrowErrors" ) { } virtual ZMexThrowErrors * clone() const; virtual ZMexAction takeCareOf( const ZMexception & x ); }; //***************** // // ZMexIgnoreAlways // //***************** class ZMexIgnoreAlways : public ZMexHandlerBehavior { public: ZMexIgnoreAlways() : ZMexHandlerBehavior( "ZMexIgnoreAlways" ) { } virtual ZMexIgnoreAlways * clone() const; virtual ZMexAction takeCareOf( const ZMexception & x ); }; //***************** // // ZMexIgnoreNextN // //***************** class ZMexIgnoreNextN : public ZMexHandlerBehavior { public: ZMexIgnoreNextN( int n ) : ZMexHandlerBehavior( "ZMexIgnoreNextN" ), countDown_( n ) { } virtual ZMexIgnoreNextN * clone() const; virtual ZMexAction takeCareOf( const ZMexception & x ); private: int countDown_; }; //****************** // // ZMexHandleViaParent // //****************** class ZMexHandleViaParent : public ZMexHandlerBehavior { public: ZMexHandleViaParent() : ZMexHandlerBehavior( "" ) { } virtual ZMexHandleViaParent * clone() const; virtual ZMexAction takeCareOf( const ZMexception & x ); }; } // namespace zmex #define ZMEXHANDLER_ICC #include "CLHEP/Exceptions/ZMexHandler.icc" #undef ZMEXHANDLER_ICC #endif // ZMEXHANDLER_H clhep-2.1.4.1.orig/Exceptions/Exceptions/copy-header.pl.in0000755000175000017500000000164110043511633022002 0ustar olesoles#!/usr/bin/env perl # # copy a header into the temporary CLHEP header tree if # a) the header is not already there # b) the source is newer # if ($#ARGV != 1) { print "mungeit requires two arguments - exit\n"; exit; } else { $source_header=$ARGV[0]; $dest_header=$ARGV[1]; &check_header; } exit; sub check_header { # make sure source exists if ( ! -e $source_header ) { print "$source_header does not exist - exit\n"; exit; } # copy if not already there - otherwise, check the time stamp if ( ! -e $dest_header ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } else { $source_header_time = -M $source_header; $dest_header_time = -M $dest_header; # copy only if source is newer if( $source_header_time < $dest_header_time ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } } } clhep-2.1.4.1.orig/Exceptions/Exceptions/Makefile.am0000755000175000017500000000174210233520632020676 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@ COPY_P = @COPY_P@ pkginclude_HEADERS = \ ZMerrno.h \ ZMerrno.icc \ ZMexAction.h \ ZMexClassInfo.h \ ZMexClassInfo.icc \ ZMexHandler.h \ ZMexHandler.icc \ ZMexLogResult.h \ ZMexLogger.h \ ZMexSeverity.h \ ZMexception.h \ ZMexception.icc \ ZMthrow.h \ arch_spec_Exceptions.mk \ link_Exceptions.mk \ defs.h # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = defs.h # copy headers into $(tempincludedir) install-tmpHEADERS: @echo " install headers in $(tempincludedir) " @list='$(pkginclude_HEADERS)'; \ if test $(tempincludedir); then \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ ./copy-header.pl $$d$$p $(tempincludedir)/$$f; \ done; \ fi; test -z "$$fail" clhep-2.1.4.1.orig/Exceptions/Exceptions/ZMerrno.icc0000755000175000017500000000323210043511633020712 0ustar olesoles#ifndef ZMERRNO_ICC #error "Exceptions/ZMerrno.icc included without Exceptions/ZMerrno.h" #endif // ---------------------------------------------------------------------- // // ZMerrno.icc -- inline implementations for the error list mechanism. // // // The following methods of ZMerrnoList are defined here: // ZMerrnoList(); // unsigned int size(); // void clear(); // int count(); // int countSinceCleared(); // // Revision History: // 970916 WEB Updated per code review // 970917 WEB Updated per code review 2 // 980617 WEB Added namespace support // 011030 MF Changed return type of size to unsigned // // ---------------------------------------------------------------------- namespace zmex { //************** // // ZMerrnoList() // //************** // Constructor inline ZMerrnoList::ZMerrnoList() : max_( ZMERRNO_LENGTH ) , count_( 0 ) , countSinceCleared_( 0 ) { } //******************** // // countSinceCleared() // //******************** inline int ZMerrnoList::countSinceCleared() const { // Return the number of exceptions written to the ZMerrnoList since // last cleared return countSinceCleared_; } //******** // // size() // //******** // // unsigned int size() const; // return the number of entries currently on the exception stack inline unsigned int ZMerrnoList::size() const { return errors_.size(); } //******** // // count() // //******** // // int count() const; // return the number of entries ever ZMerrno.write() to the exception stack inline int ZMerrnoList::count() const { return count_; } //******** // // clear() // //******** inline void ZMerrnoList::clear() { countSinceCleared_ = 0; } } // namespace zmex clhep-2.1.4.1.orig/Exceptions/Exceptions/ZMexClassInfo.h0000755000175000017500000001225610043511633021502 0ustar olesoles#ifndef ZMEXCLASSINFO_H #define ZMEXCLASSINFO_H // ---------------------------------------------------------------------- // // ZMexClassInfo.h - class declaration for the member of ZOOM Exception // classes that contains all the static information // that does NOT depend on the parent class. // // Every ZOOM exception must have a static member classInfo, of type // ZMexClassInfo. This is done in the macro ZMexStandardContents. // See ZMexception.h. // // Methods (in .icc): // ZMexClassInfo() constructor // const string name() const; // const string facility() const; // int nextCount(); // ZMexHandler getHandler() const; // ZMexHandler setHandler(const ZMexHandler & newHandler); // ZMexLogger getLogger() const; // ZMexLogger setLogger(const ZMexLogger & newLogger); // void logNMore(); // bool OKtoLog() const; // int count() const; // int filterMax() const; // // A related header is ZMexHeritage.h which contains class static info // which DOES depend on the parent class. // // Revision History // 970911 MF Initial version // 970914 MF Added nextCount to be able to keep count_ private // 970916 WEB Updated per code review // 970917 WEB Updated per code review 2 // 971112 WEB Updated for conformance to standard and the zoom // compatability headers // 971211 WEB Updated per code walkthrough // 971217 WEB Added count() and filterMax() member functions // 980219 WEB Fixed get/set Logger/Handler return type // 980615 WEB Added namespace support // 990721 JVR Added setName, setFacility, and setSeverity functions // 000217 WEB Improve C++ standard compliance // 000503 WEB Avoid global using // 010411 MF setName, setFacility and setSeverity return old value // and take const argument reference // 011212 WEB Pass all std::strings by const &; add new 3- and // 4-arg constructors in lieu of a single 5-arg // constructor taking default arguments // 031105 LG Get rid of all ZMutility references // // ---------------------------------------------------------------------- #ifndef STRING_INCLUDED #define STRING_INCLUDED #include #endif #ifndef ZMEXHANDLER_H #include "CLHEP/Exceptions/ZMexHandler.h" #endif #ifndef ZMEXLOGGER_H #include "CLHEP/Exceptions/ZMexLogger.h" #endif #ifndef ZMEXSEVERITY_H #include "CLHEP/Exceptions/ZMexSeverity.h" #endif namespace zmex { // ****************************************************** // // ZMexClassInfo // // Template for ZMexClassInfo (used to define classInfo) // // ****************************************************** // Contains all the methods which are logically "virtual class statics", // and which do not depend on a Parent's method (see note (1)). // Each derived exception contains a ZMexClassInfo member named classInfo. // The members and functions of ZMexClassInfo are public so that when the // exception class uses classInfo it can get at the info. But classInfo itself // is declared protected, to isolate this from the actual interface. class ZMexClassInfo { // - Methods - // public: ZMexClassInfo( const std::string & name , const std::string & facility , const ZMexSeverity s = ZMexERROR ); ZMexClassInfo( const std::string & name , const std::string & facility , const ZMexSeverity s , const ZMexHandler & h ); ZMexClassInfo( const std::string & name , const std::string & facility , const ZMexSeverity s , const ZMexHandler & h , const ZMexLogger & l ); const std::string name() const; // return the name_ of this exception type, which ought to match the // class name ZMexWhatever. const std::string setName(const std::string& newName); const std::string facility() const; // return the name of facility_ this exception type is under. const std::string setFacility(const std::string& newFacility); ZMexSeverity severity() const; // return the severity_ of the exception class. ZMexSeverity setSeverity(const ZMexSeverity& newSeverity); int nextCount(); // increment the count_ and return that value int count() const; // return the current count_ value ZMexHandler getHandler () const ; ZMexHandler setHandler( const ZMexHandler & newHandler ); // Replace previous handler with this new one. ZMexLogger getLogger() const; ZMexLogger setLogger( const ZMexLogger & newLogger ); // Replace previous logger with this new one. void logNMore( const int N ); // Allow logging the next N exceptions of this class. bool OKtoLog() const; // May the currently-thrown exception be logged // (based on count_ <= filterMax_)? int filterMax() const; // return the current filterMax_ value // - Data Members - // private: int count_; int filterMax_; std::string name_; // was const std::string facility_; // was const ZMexSeverity severity_; // was const ZMexHandler handler_; ZMexLogger logger_; }; // ZMexClassInfo } // namespace zmex #define ZMEXCLASSINFO_ICC #include "CLHEP/Exceptions/ZMexClassInfo.icc" #undef ZMEXCLASSINFO_ICC #endif // ZMEXCLASSINFO_H clhep-2.1.4.1.orig/Exceptions/Exceptions/ZMexLogger.h0000755000175000017500000001536610043511633021045 0ustar olesoles#ifndef ZMEXLOGGER_H #define ZMEXLOGGER_H // ---------------------------------------------------------------------- // // ZMexLogger.h - class declaration for the ZOOM Exception Logger base class // and the basic logger ZMexLogger, the base class // ZMexLogBehavior, and behaviors supplied with the package: // ZMexLogNever // ZMexLogAlways // ZMexLogTwice // ZMexLogViaParent // ZMexValidationStyle // // Revision History: // 970917 WEB Updated per code review 2 // 970919 WEB Updated per code review 4 // 971007 WEB Removed limiting logger; all loggers now // optionally limit by exception severity // 971008 WEB ZMutility is the new name for the Utility package // 971112 WEB Updated for conformance to standard and the zoom // compatability headers // 971211 WEB Updated per code walkthrough // 971215 WEB Removed unused 2nd parm to ZMexLogger constructor // 980615 WEB Added namespace support // 010410 MF Added ZMexValidationStyle // // ---------------------------------------------------------------------- #ifndef STRING_INCLUDED #define STRING_INCLUDED #include #endif #include #ifndef ZMEXLOGRESULT_H #include "CLHEP/Exceptions/ZMexLogResult.h" #endif #ifndef ZMHANDLETO_H #include "CLHEP/RefCount/ZMhandleTo.h" #endif // ---------------------------------------------------------------------- namespace zmex { // ---------------------------------------------------------------------- class ZMexLogger; class ZMexception; // ---------------------------------------------------------------------- // --------------- // ZMexLogBehavior // --------------- class ZMexLogBehavior { // Logger behavior interface class public: ZMexLogBehavior(); // Construct this behavior virtual ~ZMexLogBehavior(); // Destroy this behavior virtual ZMexLogBehavior * clone() const; // Duplicate this logger object virtual ZMexLogResult emit( const ZMexception & x ); // Extract the formatted message, then // carry out this logger's basic logging behavior virtual ZMexLogResult emit( const std::string & s ); // Carry out this logger's basic logging behavior // Do nothing with s; this base class function ought never be called virtual bool isTimeDesired() const; virtual bool isFilePathDesired() const; }; // ZMexLogBehavior // ------------ // ZMexLogNever // ------------ class ZMexLogNever : public ZMexLogBehavior { public: ZMexLogNever(); // Construct this behavior virtual ~ZMexLogNever(); // Destroy this behavior virtual ZMexLogResult emit( const ZMexception & x ); // Extract the formatted message, then // carry out this logger's basic logging behavior virtual ZMexLogNever * clone() const; // Duplicate this logger object virtual ZMexLogResult emit( const std::string & s ); // Carry out this logger's basic logging behavior: do nothing with s }; // ZMexLogNever // ------------- // ZMexLogAlways // ------------- class ZMexLogAlways : public ZMexLogBehavior { public: ZMexLogAlways(); ZMexLogAlways( std::ostream & os ); // Construct this behavior with given destination virtual ~ZMexLogAlways(); // Destroy this behavior virtual ZMexLogAlways * clone() const; // Duplicate this logger object virtual ZMexLogResult emit( const ZMexception & x ); // Extract the formatted message, then // carry out this logger's basic logging behavior virtual ZMexLogResult emit( const std::string & s ); // Carry out this logger's basic logging behavior: myOs << s private: std::ostream & myOs; // This logger's destination for messages to be logged }; // ZMexLogAlways // ------------- // ZMexLogTwice // ------------- class ZMexLogTwice : public ZMexLogBehavior { public: ZMexLogTwice( std::ostream & os1 ); ZMexLogTwice( std::ostream & os1, std::ostream & os2 ); // Construct this behavior with given destinations virtual ~ZMexLogTwice(); // Destroy this behavior virtual ZMexLogTwice * clone() const; // Duplicate this logger object virtual ZMexLogResult emit( const ZMexception & x ); // Extract the formatted message, then // carry out this logger's basic logging behavior virtual ZMexLogResult emit( const std::string & s ); // Carry out this logger's basic logging behavior: os_ << s, os2_ << s private: std::ostream & myOs1; std::ostream & myOs2; }; // ZMexLogTwice // ---------------- // ZMexLogViaParent // ---------------- class ZMexLogViaParent : public ZMexLogBehavior { public: ZMexLogViaParent(); // Construct this behavior virtual ~ZMexLogViaParent(); // Destroy this behavior virtual ZMexLogViaParent * clone() const; // Duplicate this logger object virtual ZMexLogResult emit( const ZMexception & x ); // Extract the formatted message, then // carry out this logger's basic logging behavior virtual ZMexLogResult emit( const std::string & s ); // Carry out this logger's basic logging behavior: defer elsewhere }; // ZMexLogViaParent // ----------------- // ZMexValidationStyle // ----------------- class ZMexValidationStyle : public ZMexLogBehavior { public: ZMexValidationStyle(); ZMexValidationStyle( std::ostream & os ); // Construct this behavior with given destination virtual ~ZMexValidationStyle(); // Destroy this behavior virtual ZMexValidationStyle * clone() const; // Duplicate this logger object virtual ZMexLogResult emit( const ZMexception & x ); // Extract the formatted message, then // carry out this logger's basic logging behavior virtual ZMexLogResult emit( const std::string & s ); // Carry out this logger's basic logging behavior: myOs << s virtual bool isTimeDesired() const; virtual bool isFilePathDesired() const; private: std::ostream & myOs; // This logger's destination for messages to be logged }; // ZMexValidationStyle //************ // ZMexLogger //************ class ZMexLogger : public ZMhandleTo< ZMexLogBehavior > { // Class defining logger interface public: ZMexLogger( const ZMexLogBehavior & desiredBehavior ); // Construct logger with specified behavior ~ZMexLogger(); // Destroy logger with its behavior ZMexLogResult emit( const ZMexception & exc ); // Hand over the exception for formatting and log entry ZMexLogResult emit( const std::string & message ); // Hand over the given string (or char*) for log entry ZMexLogBehavior * control(); // Grant access to the representation // to permit calling specialized behavior functions }; // ZMexLogger // ---------------------------------------------------------------------- } // namespace zmex // ---------------------------------------------------------------------- #endif // ZMEXLOGGER_H clhep-2.1.4.1.orig/Exceptions/Exceptions/ZMexAction.h0000755000175000017500000000106410043511633021031 0ustar olesoles#ifndef ZMEXACTION_H #define ZMEXACTION_H // ---------------------------------------------------------------------- // // ZMexAction.h - define codes for handler return values // // Revision History: // 970916 WEB Initial creation, excised from ZMexHandler.h // 980615 WEB Added namespace support // 031105 LG Get rid of all ZMutility references // // ---------------------------------------------------------------------- namespace zmex { enum ZMexAction { ZMexThrowIt, ZMexIgnoreIt, ZMexHANDLEVIAPARENT }; } // namespace zmex #endif // ZMEXACTION_H clhep-2.1.4.1.orig/Exceptions/Exceptions/.cvsignore0000755000175000017500000000002610043511633020634 0ustar olesolesMakefile.in defs.h.in clhep-2.1.4.1.orig/Exceptions/Exceptions/ZMexClassInfo.icc0000755000175000017500000000650710043511633022013 0ustar olesoles#ifndef ZMEXCLASSINFO_ICC #error "Exceptions/ZMexClassInfo.icc included without Exceptions/ZMexClassInfo.h" #endif // ---------------------------------------------------------------------- // // ZMexClassInfo.icc // // Contains the following methods: // // ZMexClassInfo() // name() // setName() // // facilty() // setFacility() // // nextCount() // setHandler() // getHandler() // setLogger() // getLogger() // logNMore() // OKtoLog() // count() // filterMax() // // Revision History // 970914 MF Initial version, after adding nextCount() // 970916 WEB Updated per code review // 970917 WEB Updated per code review 2 // 971211 WEB Updated per code walkthrough // 971217 WEB Added count() and filterMax() // 980219 WEB Fixed get/set Handler()/setLogger() to return // correct type // 980617 WEB Added namespace support // 990318 MF Modified intializer list orders to avoid warnings // 990721 JVR Added setName, setFacility, and setSeverity functions // 010411 MF setName, setFacility, and setSeverity return old value // and take const & argument // 011212 WEB Pass all std::strings by const &; constructor no // longer inline // // ---------------------------------------------------------------------- namespace zmex { // name() // ------ inline const std::string ZMexClassInfo::name() const { return name_; } // setName() // --------- inline const std::string ZMexClassInfo::setName(const std::string& newName) { std::string n=name_; name_ = newName; return n; } // facility() // ---------- inline const std::string ZMexClassInfo::facility() const { return facility_; } // setFacility() // ------------- inline const std::string ZMexClassInfo::setFacility(const std::string& newFacility) { std::string f=facility_; facility_ = newFacility; return f; } // severity() // ---------- inline ZMexSeverity ZMexClassInfo::severity() const { return severity_; } // setSeverity() // ------------- inline ZMexSeverity ZMexClassInfo::setSeverity(const ZMexSeverity& newSeverity) { ZMexSeverity s=severity_; severity_ = newSeverity; return s; } // nextCount() // ----------- inline int ZMexClassInfo::nextCount() { return ++count_; } // setHandler() //------------- inline ZMexHandler ZMexClassInfo::setHandler( const ZMexHandler & newHandler ) { ZMexHandler oldHandler = handler_; handler_ = newHandler; return oldHandler; } // getHandler() // ------------ inline ZMexHandler ZMexClassInfo::getHandler() const { return handler_; } // setLogger() // ----------- inline ZMexLogger ZMexClassInfo::setLogger( const ZMexLogger & newLogger ) { ZMexLogger oldLogger = logger_; logger_ = newLogger; return oldLogger; } // getLogger() // ----------- inline ZMexLogger ZMexClassInfo::getLogger() const { return logger_; } // logNMore() // ---------- inline void ZMexClassInfo::logNMore( const int N ) { filterMax_ = count_ + N; } // OKtoLog() // --------- inline bool ZMexClassInfo::OKtoLog() const { return (filterMax_ < 0) || (count_ <= filterMax_) ; } // count() // --------- inline int ZMexClassInfo::count() const { return count_; } // filterMax() // --------- inline int ZMexClassInfo::filterMax() const { return filterMax_; } } // namespace zmex clhep-2.1.4.1.orig/Exceptions/Exceptions/ZMerrno.h0000755000175000017500000000737610043511633020420 0ustar olesoles#ifndef ZMERRNO_H #define ZMERRNO_H // ---------------------------------------------------------------------- // // ZMerrno.h - declaration of ZMerrno and its ZMerrnoList class // // Declares the following, which are defined in ZMerrno.cc: // ZMerrnoList(); // unsigned int setMax(unsigned int max_number); // void write(ZMexception& x); // string name(unsigned int k = 0) const; // const ZMexception* get(unsigned int k=0) const; // void clear(); // void erase(); // discard(); // // Defined in ZMerrno.icc: // int size() const; // int count() const; // int countSinceCleared() const; // // Revision History: // 970916 WEB Updated per code review // 970917 WEB Updated per code review 2 // 970918 PGC Change deque from Exception object to Exception // pointer to keep polymorphism. // 971112 WEB Updated for conformance to standard and the zoom // compatability headers // 980615 WEB Added namespace support // 980728 WEB Added ZMerrnoList destructor // 000217 WEB Improve C++ standard compliance // 000503 WEB Avoid global using // 011030 MF Changed return type of size() to unsigned int // to avoid conversion warnings // 031105 LG Get rid of all ZMutility references // // ---------------------------------------------------------------------- #ifndef STRING_INCLUDED #define STRING_INCLUDED #include #endif #ifndef DEQUE_INCLUDED #define DEQUE_INCLUDED #include #endif namespace zmex { class ZMexception; class ZMerrnoList { public: ZMerrnoList(); // Constructor of list. ~ZMerrnoList(); // Destructor of list. unsigned int setMax( unsigned int limit ); // Set the maximum number of exceptions to be kept in the ZMerrnoList. // We prohibit unlimited size because each exception kept // may represent a memory leak of at least sizeof(ZMexception). You // really do want a circular buffer; in Unix the size of that buffer is 1. // Zero completely disables the ZMerrno mechanism and clears out and // deletes the exceptions on the list. void write( const ZMexception & x ); // Copy an exception onto ZMerrno at the "back" of the deque int countSinceCleared() const; // Returns the number of exceptions since last cleared std::string name( unsigned int k = 0 ) const; // Obtain the mnemonic name of the latest-but-k exception on ZMerrno. // Thus name()gets the name of the latest exception. const ZMexception* get( unsigned int k = 0 ) const; // Obtain a pointer to the exception for the latest-but-k exception // on ZMerrno. Thus get() obtains a const pointer to the latest exception. // Allows perusal of things like the message and the logger // and handler used when the exception was encountered. Should be // checked for 0 since ZMerrno may not go back as far as requested. void clear(); // Zero out the countSinceCleared. void erase(); // Remove the top entry, restoring the top (latest entry) to the // previous entry (if any). For instance, if you have a loop in which // some known ignorable happening places a value on the ZMerrnoList, you // can erase each one so as not to wipe out the history for others. int count() const; // Return the number of exceptions ever placed on the ZMerrnoList // via ZMerrnoList::write(). unsigned int size() const; // Return the number of entries currently on the stack. private: std::deque< const ZMexception * > errors_; unsigned int max_; enum { ZMERRNO_LENGTH = 100 }; // Default maximum number of entries on the stack int count_; int countSinceCleared_; }; // ZMerrnoList extern ZMerrnoList ZMerrno; } // namespace zmex #define ZMERRNO_ICC #include "CLHEP/Exceptions/ZMerrno.icc" #undef ZMERRNO_ICC #endif // ZMERRNO_H clhep-2.1.4.1.orig/Exceptions/Exceptions/arch_spec_Exceptions.mk0000755000175000017500000000477110043511633023330 0ustar olesoles# ====================================================================== # # arch_spec_Exceptions.mk - Architecture/site-specific makefile fragment # for inclusion by packages that use Zoom's Exceptions package. # # History: # 08-Feb-2000 WEB Extracted from ZMutility/zoom.symbols.mk; updated # logic reflecting KAI 3.3+ defaults; moved into Exceptions package # (could later be moved into SoftRelTools package, if suffient use) # 30-May-2002 WEB Updated logic for post-egcs versions of gcc # # ====================================================================== # ---------------------------------------------------------------------- # Prepare for SRT package specialization logic: # ---------------------------------------------------------------------- extpkg := Exceptions # ---------------------------------------------------------------------- # Note whether exception-handling is disabled: # ---------------------------------------------------------------------- Exceptions_USED := yes # assume exceptions are enabled ifeq ($(CXX),KCC) # KCC 3.3 onward defaults to "--exceptions" ifeq ($(filter --no_exceptions,$(CXXFLAGS)),--no_exceptions) Exceptions_USED := no endif endif # KCC #ifeq ($(CXX),g++) # egcs required "-fhandle-exceptions" and "-frtti" # ifeq ($(filter -fhandle-exceptions,$(CXXFLAGS)),) # Exceptions_USED := no # endif # ifeq ($(filter -frtti,$(CXXFLAGS)),) # Exceptions_USED := no # endif #endif # g++ ifeq ($(CXX),g++) # gcc 2.95.2 onward defaults to "-fexceptions" ifeq ($(filter -fno_exceptions,$(CXXFLAGS)),-fno_exceptions) Exceptions_USED := no endif endif # g++ # ---------------------------------------------------------------------- # Connect to SRT package specialization logic: # ---------------------------------------------------------------------- include SoftRelTools/specialize_arch_spec.mk include SoftRelTools/arch_spec_clhep.mk # ---------------------------------------------------------------------- # Define DEFECT_NO_EXCEPTIONS if exceptions are not used # (in order to force an abort() call instead of a throw # in packages that employ Zoom's Exceptions package): # ---------------------------------------------------------------------- ifeq ($(Exceptions_USED),no) # avoid duplicate: ifneq ($(filter -DDEFECT_NO_EXCEPTIONS,$(CPPFLAGS)),-DDEFECT_NO_EXCEPTIONS) override CPPFLAGS += -DDEFECT_NO_EXCEPTIONS endif endif # $(Exceptions_USED) == no clhep-2.1.4.1.orig/Exceptions/Exceptions/link_Exceptions.mk0000755000175000017500000000042511406166731022337 0ustar olesoles# $Id: link_Exceptions.mk,v 1.4 2010/06/16 15:29:29 garren Exp $ # # Makefile fragment for PackageList linking system # override LINK_ZMutility += Exceptions override LINK_STLUtility += HepTuple ifeq (BABAR,$(EXPERIMENT)) override CPPFLAGS += -DDEFECT_NO_MUTABLE endif clhep-2.1.4.1.orig/Exceptions/Exceptions/CMakeLists.txt0000644000175000017500000000105211606714767021414 0ustar olesoles set( pkginclude_HEADERS ZMerrno.h ZMerrno.icc ZMexAction.h ZMexClassInfo.h ZMexClassInfo.icc ZMexHandler.h ZMexHandler.icc ZMexLogResult.h ZMexLogger.h ZMexSeverity.h ZMexception.h ZMexception.icc ZMthrow.h arch_spec_Exceptions.mk link_Exceptions.mk ) # notice that defs.h is not referenced here INSTALL (FILES ${pkginclude_HEADERS} DESTINATION include/CLHEP/Exceptions ) clhep-2.1.4.1.orig/Exceptions/Exceptions/ZMexSeverity.h0000755000175000017500000000610610043511633021430 0ustar olesoles#ifndef ZMEXSEVERITY_H #define ZMEXSEVERITY_H // ---------------------------------------------------------------------- // // ZMexSeverity.h - define severity codes & ancillary information // // Revision History: // 970917 WEB Updated per code review 2 // 971006 WEB Added ZMexSeverityLimit to support limiting // logging by severity // 971016 WEB Added explanations of the various severity levels // 971112 WEB Updated for conformance to standard and the zoom // compatability headers // 980615 WEB Added namespace support // 000217 WEB Improve C++ standards compliance // 000503 WEB Avoid global using // 031105 LG Get rid of all ZMutility references // // ---------------------------------------------------------------------- #ifndef STRING_INCLUDED #define STRING_INCLUDED #include #endif namespace zmex { enum ZMexSeverity { ZMexNORMAL, // All is well; always safe to ignore; typically not worth logging // since it's probably just a temporary placeholder. ZMexINFO, // In the normal course of events, here is news worth logging; // always safe to ignore; often useful for progress reporting and // for debugging purposes. ZMexWARNING, // Something unusual has happened, but we have a quite reasonable // action to take; it's generally safe to ignore the warning because // you'll probably get just about the result you intended; logging // can probably cease after (say) 50 of the same warnings. ZMexERROR, // We encountered something such that, although we can make it safe // to continue running (e.g., by supplying a default value instead of // a value we can't for some reason calculate), you probably won't // get the result you expected unless you handle this yourself; ought // always be logged (but may be sensible, if hundreds of the same // error are intentionally ignored, to stop logging each one). ZMexSEVERE, // The action you intended will almost certainly have a seriously // flawed outcome and we doubt that either we or you can make it safe // to continue if you ignore this; ought always be logged. ZMexFATAL, // We can make no representations as to the state of any part of the // software, even of software parts not obviously associated with the // failed intended action and even if you try to handle the problem; // ought always be logged and essentially never be ignored. ZMexPROBLEM, // The software has reached a logically impossible internal state; // must always be logged and never be ignored; if encountered, should // always be reported to the software's developers and/or maintainers. ZMexSEVERITYenumLAST // Not a true severity level; useful to count the number of distinct // severity levels and, as such, must always be physically last // within this enum's definition. }; // ZMexSeverity extern const std::string ZMexSeverityName[ ZMexSEVERITYenumLAST ]; extern const char ZMexSeverityLetter[ ZMexSEVERITYenumLAST ]; extern int ZMexSeverityLimit[ ZMexSEVERITYenumLAST ]; } // namespace zmex #endif // ZMEXSEVERITY_H clhep-2.1.4.1.orig/Exceptions/Exceptions/ZMexLogResult.h0000755000175000017500000000102610043511633021532 0ustar olesoles#ifndef ZMEXLOGRESULT_H #define ZMEXLOGRESULT_H // ---------------------------------------------------------------------- // // ZMexLogResult.h - define action values returnable by a logger // // Revision History: // 970917 WEB Split out from ZMexLogger.h, per code review 2 // 980615 WEB Added namespace support // // ---------------------------------------------------------------------- namespace zmex { enum ZMexLogResult { ZMexLOGGED, ZMexNOTLOGGED, ZMexLOGVIAPARENT }; } // namespace zmex #endif // ZMEXLOGRESULT_H clhep-2.1.4.1.orig/Exceptions/Exceptions/ZMexception.icc0000755000175000017500000000622011712060772021572 0ustar olesoles#ifndef ZMEXCEPTION_ICC #error "Exceptions/ZMexception.icc included without Exceptions/ZMexception.h" #endif // ---------------------------------------------------------------------- // // ZMexception.icc // // Constructor ZMexception // message() // count() // wasThrown() // handlerUsed() // severity() // location(line, filename) // fileName() // line() // // Revision History: // 970912 MF Initial version after separating .icc versus .cc // 970916 WEB Updated per code review // 970917 WEB Updated per code review 2 // 971211 WEB Updated per code walkthrough // 980421 WEB Moved name() and facility() from .icc to .cc // 980617 WEB Added namespace support // 990318 MF Modified intializer list orders to avoid warnings // // ---------------------------------------------------------------------- namespace zmex { // ******************************** // // Member functions in base class // // ******************************** //********************** // Constructor //********************** inline ZMexception::ZMexception( const std::string & mesg , const ZMexSeverity howBad , int icount ) : message_(mesg) , line_( 0 ) , sourceFileName_( "not ZMthrow'n as of yet" ) , mySeverity_( howBad == ZMexSEVERITYenumLAST ? _classInfo.severity() : howBad ) , myCount_( icount ) , wasThrown_( false ) { } //********************** // Information accessors //********************** // message() //---------- inline std::string ZMexception::message() const { return message_; } // count() //-------- inline int ZMexception::count() const { return myCount_; } // wasThrown() //------------ inline bool ZMexception::wasThrown() const { return wasThrown_; } inline void ZMexception::wasThrown( bool b ) const { #ifdef DEFECT_NO_MUTABLE ZMexception * localThis = const_cast(this); localThis->wasThrown_ = b; #else wasThrown_ = b; #endif } //************** // handler names //************** // handlerUsed() //-------------- inline std::string ZMexception::handlerUsed() const { return handlerUsed_; } inline void ZMexception::handlerUsed( const std::string handlerName ) const { #ifdef DEFECT_NO_MUTABLE ZMexception * localThis = const_cast(this); localThis->handlerUsed_ = handlerName; #else handlerUsed_ = handlerName; #endif } //*********** // severity() //*********** inline ZMexSeverity ZMexception::severity() const { return mySeverity_; } //****************************** // location setter and accessors //****************************** // location(line, filename) // fileName() // line() //------------------------- inline void ZMexception::location( int iline, const std::string filename ) const { #ifdef DEFECT_NO_MUTABLE ZMexception * localThis = const_cast(this); localThis->line_ = iline; localThis->sourceFileName_ = filename; #else line_ = iline; sourceFileName_ = filename; #endif } inline std::string ZMexception::fileName() const { return sourceFileName_; } inline int ZMexception::line() const { return line_; } inline bool ZMexception::OKtoLog() const { return classInfo().OKtoLog(); } } // namespace zmex clhep-2.1.4.1.orig/Exceptions/COPYING0000644000175000017500000010451311406166731015562 0ustar olesoles GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/Exceptions/test/0000755000175000017500000000000012242515140015471 5ustar olesolesclhep-2.1.4.1.orig/Exceptions/test/testzmex.cc0000755000175000017500000000327010043511633017670 0ustar olesoles// ---------------------------------------------------------------------- // // testzmex.cc - test whether namespaces work out. // // History: // 04/13/01 mf wrote // // // usage: Place into src and test makefile // override CPPFLAGS += -DZM_USE_NAMESPACES // and build. // ---------------------------------------------------------------------- #include using std::string; #include "CLHEP/Cast/itos.h" #include "CLHEP/Exceptions/ZMthrow.h" #include "CLHEP/Exceptions/ZMexception.h" #include "CLHEP/Exceptions/ZMerrno.h" // remove the above line to test with namespace on. // ---------- // Define exception classes and default behaviors: // ---------- ZMexStandardDefinition( zmex::ZMexception, ZMxTest ); zmex::ZMexClassInfo ZMxTest::_classInfo( "ZMxTest", "Test", zmex::ZMexSEVERE ); // ---------- // Define output formats, etc // ---------- const string QUOTE = "\""; const string NEWLINE1 = "\n"; const string NEWLINE2 = "\n\n"; void display( const zmex::ZMexception * ex ) { zmex::ZMlogger().emit( NEWLINE1 + ex->name() + ": " + QUOTE + ex->message() + QUOTE + NEWLINE1 + " " + (ex->wasThrown() ? "thrown" : "ignored") + " by " + ex->handlerUsed() + "()" + NEWLINE1 ); } int main() { // ---------- // Begin testing, check out basic logger: // ---------- zmex::ZMlogger().emit( NEWLINE1 ); zmex::ZMlogger().emit( "---------- Begin testing: ----------\n" ); zmex::ZMlogger().emit( NEWLINE1 ); zmex::ZMlogger().emit( "This message checks out basic logger behavior\n" ); ZMthrow( ZMxTest( "Testing exception behavior" ) ); // ---------- // Done, go home // ---------- return 0; } // main() clhep-2.1.4.1.orig/Exceptions/test/excDblThrow.cc0000755000175000017500000000233210043511633020230 0ustar olesoles// Explore single- and double-throwing techniques #include using std::cerr; struct B { B() { cerr << "make B\n"; } B( B const & b ) { cerr << "copy B\n"; } virtual char type() const { return 'B'; }; }; // struct B struct D : public B { D() { cerr << "make D\n"; } D( const D & d ) : B( d ) { cerr << "copy D\n"; } virtual char type() const { return 'D'; }; }; // struct D #define single( obj ) \ cerr << "\nsingle( " #obj " )\n"; \ const B & ref = obj; \ throw ref; #define double( obj ) \ cerr << "\ndouble( " #obj " )\n"; \ try { throw obj; } \ catch ( const B & x ) { throw; } void f( void g() ) { try { g(); } //catch( D const & x ) { cerr << "Caught D is " << x.type() << '\n'; } catch( B const & x ) { cerr << "Caught B is " << x.type() << '\n'; } } void test1() { double( B() ); } void test2() { double( D() ); } void test3() { single( B() ); } void test4() { single( D() ); } int main() { cerr << "\nTesting double throws:\n"; f( test1 ); f( test2 ); cerr << "\nTesting single throws:\n"; f( test3 ); f( test4 ); } clhep-2.1.4.1.orig/Exceptions/test/Makefile.am0000755000175000017500000000675211406166731017553 0ustar olesoles# Applicable to each test program: if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir)/ # libraries to link, and whence if BUILD_STATIC LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.a \ ${top_builddir}/../Cast/src/libCLHEP-Cast-@VERSION@.a \ ${top_builddir}/../RefCount/src/libCLHEP-RefCount-@VERSION@.a OUTFLAG = -o $@ else if BUILD_VISUAL LDADD = $(top_builddir)/src/CLHEP-@PACKAGE@-@VERSION@.$(SHEXT) \ ${top_builddir}/../Cast/src/CLHEP-Cast-@VERSION@.$(SHEXT) \ ${top_builddir}/../RefCount/src/CLHEP-RefCount-@VERSION@.$(SHEXT) OUTFLAG = /Fo$@ else LIBS += $(MY_LD)$(top_builddir)/src \ $(MY_LD)${top_builddir}/../Cast/src \ $(MY_LD)${top_builddir}/../RefCount/src LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.$(SHEXT) \ ${top_builddir}/../Cast/src/libCLHEP-Cast-@VERSION@.$(SHEXT) \ ${top_builddir}/../RefCount/src/libCLHEP-RefCount-@VERSION@.$(SHEXT) OUTFLAG = -o $@ endif endif # normally, CXXLINK is supplied by automake, but we need to use /Fo instead # of -o when compiling with Visual C++ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ $(OUTFLAG) # Identify executables needed during testing: check_PROGRAMS = \ testExceptions \ testzmex \ testThrowFrom \ exctest1 \ exctest2 \ exctest3 \ exctest4 \ exctestNothrow # excDblThrow check_SCRIPTS = \ testExceptions.sh \ testzmex.sh \ testThrowFrom.sh \ exctest1.sh \ exctest2.sh \ exctest3.sh \ exctest4.sh \ exctestNothrow.sh \ excDblThrow.sh # Identify test(s) to run when 'make check' is requested: if USING_ICC # Exceptions is not supported for icc TESTS = else if BUILD_VISUAL #avoid problems with vc8/9 TESTS = \ testExceptions.sh \ testThrowFrom.sh \ exctest1.sh \ exctest2.sh \ exctest3.sh \ exctest4.sh \ exctestNothrow.sh else TESTS = \ testExceptions.sh \ testzmex.sh \ testThrowFrom.sh \ exctest1.sh \ exctest2.sh \ exctest3.sh \ exctest4.sh \ exctestNothrow.sh endif endif # excDblThrow.sh # Identify the test(s) for which failure is the intended outcome: XFAIL_TESTS = testzmex.sh # Identify the dependencies on a per-test basis: testExceptions_SOURCES = testExceptions.cc testzmex_SOURCES = testzmex.cc testThrowFrom_SOURCES = testThrowFrom.cc exctest1_SOURCES = exctest1.cc exctest2_SOURCES = exctest2.cc exctest3_SOURCES = exctest3.cc exctest4_SOURCES = exctest4.cc exctestNothrow_SOURCES = exctestNothrow.cc #excDblThrow_SOURCES = excDblThrow.cc # Identify input data file(s) and prototype output file(s): #EXTRA_DIST = testExceptions.input testExceptions.output # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = \ testExceptions.sh \ testzmex.sh \ testThrowFrom.sh \ exctest1.sh \ exctest2.sh \ exctest3.sh \ exctest4.sh \ exctestNothrow.sh \ excDblThrow.sh # supply our own suffix rule .cc.obj: if BUILD_VISUAL # $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c $(OUTFLAG) `$(CYGPATH_W) '$<'` # mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po source='$<' object='$@' libtool=no \ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ $(CXXCOMPILE) -c $(OUTFLAG) `$(CYGPATH_W) '$<'` else if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c $(OUTFLAG) `$(CYGPATH_W) '$<'`; \ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi # source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ # $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` endif clhep-2.1.4.1.orig/Exceptions/test/exctestNothrow.sh.in0000755000175000017500000000007310043511633021475 0ustar olesoles#! /bin/sh # @configure_input@ ./exctestNothrow@EXEEXT@ clhep-2.1.4.1.orig/Exceptions/test/testzmex.sh.in0000755000175000017500000000006510043511633020321 0ustar olesoles#! /bin/sh # @configure_input@ ./testzmex@EXEEXT@ clhep-2.1.4.1.orig/Exceptions/test/exctest2.cc0000755000175000017500000000156311406166731017562 0ustar olesoles// Test program to check out environment's exception-handling #include using std::cerr; using std::endl; class Exception { public: Exception( const char [] ) {} }; class Oops : public Exception { public: Oops( const char s[] ) : Exception( s ) {} }; int main() { try { cerr << "Starting main() ..." << endl; cerr << "About to: throw( Oops(\"Ouch\") )" << endl; const Exception & o = Oops("Ouch"); throw o; cerr << "The following ought to produce a compilation warning \n" << "Got past: throw( Oops(\"Ouch\") ) -- not good!" << endl; } catch ( const Oops & egad ) { cerr << "Caught: Oops" << endl; } catch ( const Exception & egad ) { cerr << "Caught: Exception" << endl; } catch ( ... ) { cerr << "Caught: don't know what" << endl; } cerr << "Done." << endl; return 0; } // main() clhep-2.1.4.1.orig/Exceptions/test/exctest1.cc0000755000175000017500000000200510043511633017540 0ustar olesoles#include using std::cerr; using std::endl; #include "CLHEP/Exceptions/ZMexception.h" #include "CLHEP/Exceptions/ZMthrow.h" using namespace zmex; ZMexStandardDefinition(ZMexception,Oops); ZMexClassInfo Oops::_classInfo( "Oops", "exctest1", ZMexERROR ); int main() { cerr << "Starting main() ..." << endl; #ifndef DEFECT_NO_EXCEPTIONS try { #endif //cerr << "About to: Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) ); //Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) ); cerr << "About to: ZMthrow( Oops(\"Ouch\") )" << endl; ZMthrow( Oops("Ouch") ); // unreachable statement: cerr << "Got past: ZMthrow( Oops(\"Ouch\") ) -- not good!" << endl; #ifndef DEFECT_NO_EXCEPTIONS } catch ( const Oops egad ) { cerr << "Caught: Oops" << endl; } catch ( const ZMexception egad ) { cerr << "Caught: ZMexception" << endl; } catch ( ... ) { cerr << "Caught: don't know what" << endl; } #endif cerr << "Done." << endl; return 0; } // main() clhep-2.1.4.1.orig/Exceptions/test/testThrowFrom.sh.in0000755000175000017500000000007210043511633021263 0ustar olesoles#! /bin/sh # @configure_input@ ./testThrowFrom@EXEEXT@ clhep-2.1.4.1.orig/Exceptions/test/.cvsignore0000755000175000017500000000001410043511633017467 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Exceptions/test/exctest3.sh.in0000755000175000017500000000006510043511633020200 0ustar olesoles#! /bin/sh # @configure_input@ ./exctest3@EXEEXT@ clhep-2.1.4.1.orig/Exceptions/test/exctestNothrow.cc0000755000175000017500000000577710043511633021063 0ustar olesoles// This program tests the DEFECT_NO_EXCEPTIONS version of the Exceptions package: // 12-Dec-2001 WEB Avoid signed/unsigned comparison warnings #ifndef DEFECT_NO_EXCEPTIONS #define DEFECT_NO_EXCEPTIONS 1 #endif #include "CLHEP/Exceptions/ZMthrow.h" #include "CLHEP/Exceptions/ZMexception.h" #include "CLHEP/Exceptions/ZMerrno.h" using namespace zmex; #include using namespace std; // We try to have this test program test several cases, including // several actual throws, so we assume that the DEFECT_NO_EXCEPTIONS version of // the ZMthrow macro will use exit() or abort() and so override // those behaviors in order to keep going for multiple testing herein: #include #define exit( x ) printf( "this is an actual exit\n", x ); #define abort( ) printf( "this is an actual abort\n" ); ZMexStandardDefinition( ZMexception, ZMxTop ); ZMexClassInfo ZMxTop::_classInfo( "ZMxTop", "HepTuple" ); ZMexStandardDefinition( ZMxTop, ZMxHepTuple ); ZMexClassInfo ZMxHepTuple::_classInfo( "ZMxHeptuple", "HepTuple" ); ZMexStandardDefinition( ZMexception, ZMxTop2 ); ZMexClassInfo ZMxTop2::_classInfo( "ZMxTop2", "Other Top Exception" ); ZMexStandardDefinition( ZMxTop2, ZMxHepTuple2 ); ZMexClassInfo ZMxHepTuple2::_classInfo( "ZMxHepTuple2", "Other HepTuple" ); ZMexStandardDefinition( ZMxHepTuple2, ZMxColumn ); ZMexClassInfo ZMxColumn::_classInfo( "ZMxColumn", "Column excep" ); int main ( ) { ZMxTop::setHandler( ZMexIgnoreAlways( ) ); ZMxHepTuple::setHandler( ZMexThrowAlways( ) ); printf( "Try to ignore a ZMxTop with msg -top-\n" ); ZMthrow( ZMxTop( "top" ) ); printf( "Try to throw a ZMxHepTuple with msg -bottom-\n" ); ZMthrow( ZMxHepTuple( "bottom" ) ); printf( "Try to throw a top exception with a ZMhParentHandler\n" ); ZMthrow( ZMxTop2( "top2" ) ); printf( "Try to throw a ZMxColumn\n" ); ZMthrow( ZMxColumn( "a column error" ) ); ZMxHepTuple2::setHandler( ZMexIgnoreNextN( 3 ) ); std::ofstream logfile( "exception.report" ); ZMxHepTuple2::setLogger( ZMexLogAlways( logfile ) ); printf( "Try to throw a ZMxTop2\n" ); ZMthrow( ZMxTop2( "top2" ) ); printf( "Try to ignore a ZMxHepTuple2\n" ); ZMthrow( ZMxHepTuple2( "a heptuple error" ) ); //ZMxColumn::logNMore( 4 ); printf( "Try to ignore a ZMxColumn\n" ); ZMthrow( ZMxColumn( "2 column error" ) ); printf( "Try to ignore a ZMxColumn\n" ); ZMthrow( ZMxColumn( "3 column error" ) ); printf( "Try to throw a ZMxColumn\n" ); ZMthrow( ZMxColumn( "4 column error" ) ); printf( "Try to throw a ZMxColumn\n" ); ZMthrow( ZMxColumn( "5 column error" ) ); std::cout << "logged the following exceptions\n"; unsigned int s; for ( s = 0; s < ZMerrno.size( ); s++ ) { std::cout << ZMerrno.get( s )->name( ) << " : " << ZMerrno.get( s )->message( ) << std::endl; } std::cout << "Reset the length of ZMerrno to 4\n"; ZMerrno.setMax( 4 ); for ( s = 0; s < ZMerrno.size( ); s++ ) { std::cout << ZMerrno.get( s )->name( ) << " : " << ZMerrno.get( s )->message( ) << std::endl; } return 0; } clhep-2.1.4.1.orig/Exceptions/test/testThrowFrom.cc0000755000175000017500000000400710043511633020633 0ustar olesoles// ---------------------------------------------------------------------- // // testThrowFrom.cc - test the ZMthrow_from() method, // and the ZMexValidationStyle behavior, // and setName, setSeverity, setFacility. // // History: // 10-Apr-2001 mf Initial draft testing just ZMthrow_from() // 11-Apr-2001 mf Test the other enhancements. // 12-Jun-2002 web Insert conditional try-catch to allow testing in // presence of true exceptions // // ---------------------------------------------------------------------- #include "CLHEP/Exceptions/ZMthrow.h" #include "CLHEP/Exceptions/ZMexception.h" using namespace zmex; ZMexStandardDefinition( ZMexception, ZMxTest ); ZMexClassInfo ZMxTest::_classInfo( "ZMxTest", "Test", ZMexSEVERE ); int main() { // std::cout << "starting...\n"; // Not: ZMexception::setHandler( ZMexIgnoreAlways() ) ; // Instead: ZMxTest::setSeverity( ZMexWARNING ); // Which should not abort ZMexception::setLogger( ZMexValidationStyle(std::cout) ) ; // std::cout << "throwing...\n"; ZMthrow_from( ZMxTest("Artificial Exception"), 1000, "directory/subdirectory/fictitious.file" ); ZMthrow_from( ZMxTest("Artificial backslash Exception"), 4000, "directory/subdirectory\\fictitious.file" ); ZMthrow_from( ZMxTest("Artificial no slash Exception"), 4000, "fictitious.file" ); ZMthrow( ZMxTest("Normal exception") ); ZMxTest::setName("MyExName"); ZMthrow( ZMxTest("Exception with new name") ); ZMxTest::setFacility("newFacility"); ZMthrow( ZMxTest("Exception from new facility") ); // ------------- // Done, go home // ------------- ZMexception::setLogger( ZMexLogAlways(std::cout) ) ; ZMxTest::setSeverity( ZMexERROR ); // Which should not abort #ifndef DEFECT_NO_EXCEPTIONS try { #endif ZMthrow( ZMxTest("Ordinary Error") ); #ifndef DEFECT_NO_EXCEPTIONS } catch( ZMexception & e ) { std::cerr << "Caught: " << e.name() << "\n"; } #endif return 0; } // main() clhep-2.1.4.1.orig/Exceptions/test/exctest3.cc0000755000175000017500000000232211406166731017555 0ustar olesoles// Test program to check out the environment exception-handling #include using std::cerr; using std::endl; class Exception { public: Exception( const char [] ) {} virtual ~Exception() {} virtual void f() const { cerr << "Exception::f()" << endl; } }; class Oops : public Exception { public: Oops( const char s[] ) : Exception( s ) {} virtual ~Oops() {} virtual void f() const { cerr << "Oops::f()" << endl; } }; int main() { try { cerr << "Starting main() ..." << endl; cerr << "About to: throw( Oops(\"Ouch\") )" << endl; try { throw Oops("Ouch"); } catch ( const Exception & x ) { x.f(); throw; } catch ( ... ) { cerr << "Caught unknown!" << endl; throw; } // Unreachable statement (we certainly hope!): cerr << "The following ought to produce a compilation warning \n" << "Got past: throw( Oops(\"Ouch\") ) -- not good!" << endl; } catch ( const Oops & egad ) { cerr << "Caught: Oops" << endl; } catch ( const Exception & egad ) { cerr << "Caught: Exception" << endl; } catch ( ... ) { cerr << "Caught: don't know what" << endl; } cerr << "Done." << endl; return 0; } // main() clhep-2.1.4.1.orig/Exceptions/test/CMakeLists.txt0000644000175000017500000000044511606714767020257 0ustar olesoles set( Exceptions_tests testExceptions testThrowFrom exctest1 exctest2 exctest3 exctest4 exctestNothrow ) foreach ( test ${Exceptions_tests} ) clhep_test( ${test} ) endforeach ( test ${Exceptions_tests} ) clhep_test( testzmex FAIL ) clhep-2.1.4.1.orig/Exceptions/test/exctest4.sh.in0000755000175000017500000000006510043511633020201 0ustar olesoles#! /bin/sh # @configure_input@ ./exctest4@EXEEXT@ clhep-2.1.4.1.orig/Exceptions/test/excDblThrow.sh.in0000755000175000017500000000007010043511633020657 0ustar olesoles#! /bin/sh # @configure_input@ ./excDblThrow@EXEEXT@ clhep-2.1.4.1.orig/Exceptions/test/exctest4.cc0000755000175000017500000000224210043511633017546 0ustar olesoles#include using std::cerr; using std::endl; #include "CLHEP/Exceptions/ZMexception.h" #include "CLHEP/Exceptions/ZMthrow.h" using namespace zmex; ZMexStandardDefinition(ZMexception,Oops); ZMexClassInfo Oops::_classInfo( "Oops", "exctest4", ZMexERROR , ZMexHandler( ZMexThrowAlways() ) , ZMexLogger ( ZMexLogNever() ) ); int main() { cerr << "Starting main() ..." << endl; #ifndef DEFECT_NO_EXCEPTIONS try { #endif //cerr << "About to: Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) ); //Oops::setHandler( ZMexHandler( ZMexIgnoreAlways() ) ); cerr << "About to: ZMthrow( Oops(\"Ouch\") )" << endl; ZMthrow( Oops("Ouch") ); // unreachable statement: cerr << "Got past: ZMthrow( Oops(\"Ouch\") ) -- not good!" << endl; #ifndef DEFECT_NO_EXCEPTIONS } catch ( const Oops egad ) { cerr << "Caught: Oops" << endl; } catch ( const ZMexception egad ) { cerr << "Caught: ZMexception" << endl; } catch ( ... ) { cerr << "Caught: don't know what" << endl; } #endif cerr << "Done." << endl; return 0; } // main() clhep-2.1.4.1.orig/Exceptions/test/testExceptions.cc0000755000175000017500000001633011406166731021040 0ustar olesoles// ---------------------------------------------------------------------- // // testExceptions.cc - test the DEFECT_NO_EXCEPTIONS version of the Exceptions package // // History: // 19-Dec-1997 WEB Initial draft; redefining exit() based on an idea // by Philippe Canal // 04-Mar-1998 WEB Minor grammar update // 15-Jun-1998 WEB Added namespace support // 26-Jun-2001 MF Tested ctor of ZMexception from ostringstream // 12-Dec-2001 WEB Avoid signed/unsigned comparison warnings // 12-Jun-2002 WEB Rearrange to ensure correct ZMthrow definition // // ---------------------------------------------------------------------- #include #include using std::string; #include "CLHEP/Exceptions/defs.h" #include "CLHEP/Cast/itos.h" #include "CLHEP/Exceptions/ZMthrow.h" #include "CLHEP/Exceptions/ZMexception.h" #include "CLHEP/Exceptions/ZMerrno.h" using namespace zmex; // ---------- // In case our compilation environment does not support exceptions: // // Since this program tests several cases, including several actual throws, // we assume that the DEFECT_NO_EXCEPTIONS version of the ZMthrow macro // will use abort() and so override abort()'s behavior in order to keep // going for multiple testing herein: (earlier we used exit(), which we // also overide) // ---------- #ifdef DEFECT_NO_EXCEPTIONS #define exit( x ) \ ZMlogger().emit( "Note: exception would have been correctly thrown here\n" ); #define abort() \ ZMlogger().emit( "Note: exception would have been correctly thrown here\n" ); #endif // DEFECT_NO_EXCEPTIONS // ---------- // Define exception classes and default behaviors: // ---------- ZMexStandardDefinition( ZMexception, ZMxTest ); ZMexClassInfo ZMxTest::_classInfo( "ZMxTest", "Test", ZMexSEVERE ); ZMexStandardDefinition( ZMxTest, ZMxInfo ); ZMexClassInfo ZMxInfo::_classInfo( "ZMxInfo", "Test", ZMexINFO ); ZMexStandardDefinition( ZMxTest, ZMxGoof ); ZMexClassInfo ZMxGoof::_classInfo( "ZMxGoof", "Test", ZMexERROR ); ZMexStandardDefinition( ZMxGoof, ZMxOops ); ZMexClassInfo ZMxOops::_classInfo( "ZMxOops", "Test", ZMexWARNING ); ZMexStandardDefinition( ZMxGoof, ZMxBooBoo ); ZMexClassInfo ZMxBooBoo::_classInfo( "ZMxBooBoo", "Test", ZMexFATAL, ZMexIgnoreAlways() ); // ---------- // Define output formats, etc // ---------- const string QUOTE = "\""; const string NEWLINE1 = "\n"; const string NEWLINE2 = "\n\n"; void display( const ZMexception * ex ) { ZMlogger().emit( NEWLINE1 + ex->name() + ": " + QUOTE + ex->message() + QUOTE + NEWLINE1 + " " + (ex->wasThrown() ? "thrown" : "ignored") + " by " + ex->handlerUsed() + "()" + NEWLINE1 ); } int main() { unsigned int k; // ---------- // Begin testing, check out basic logger: // ---------- ZMlogger().emit( NEWLINE1 ); ZMlogger().emit( "---------- Begin testing: ----------\n" ); ZMlogger().emit( NEWLINE1 ); ZMlogger().emit( "This message checks out basic logger behavior\n" ); // ---------- // Test default informational behavior: // ---------- ZMlogger().emit( NEWLINE2 ); ZMlogger().emit( "---------- Testing default informational behavior: ----------\n" ); ZMlogger().emit( NEWLINE1 ); ZMthrow( ZMxInfo( "Testing default informational exception behavior" ) ); // ---------- // Test default informational behavior using an ostringstream // ---------- ZMlogger().emit( NEWLINE2 ); ZMlogger().emit( "---------- Testing default ostringstream behavior 3 times: ----------\n" ); std::ostringstream oss; oss << "Accumulated numbers are "; for ( k = 0; k < 3; ++k ) { ZMlogger().emit( NEWLINE1 ); if ( k > 0 ) oss << ", "; oss << k; ZMthrow( ZMxOops( oss ) ); } // ---------- // Test default ignoring behavior 3 times: // ---------- ZMlogger().emit( NEWLINE2 ); ZMlogger().emit( "---------- Testing default ignoring behavior 3 times: ----------\n" ); for ( k = 0; k < 3; ++k ) { ZMlogger().emit( NEWLINE1 ); string testMesg = "Testing default exception ignoring behavior #"; ZMthrow( ZMxOops( testMesg + itos(k+1) ) ); } // ---------- // Test defined ignoring behavior 3 times: // ---------- ZMlogger().emit( NEWLINE2 ); ZMlogger().emit( "---------- Testing defined ignoring behavior 3 times: ----------\n" ); for ( k = 0; k < 3; ++k ) { ZMlogger().emit( NEWLINE1 ); string testMesg = "Testing defined exception ignoring behavior #"; ZMthrow( ZMxBooBoo( testMesg + itos(k+1) ) ); } // ---------- // Test default throwing behavior 3 times: // ---------- ZMlogger().emit( NEWLINE2 ); ZMlogger().emit( "---------- Testing default throwing behavior 3 times: ----------\n" ); for ( k = 0; k < 3; ++k ) { ZMlogger().emit( NEWLINE1 ); string testMesg = "Testing default exception throwing behavior #"; #ifndef DEFECT_NO_EXCEPTIONS try { #endif ZMthrow( ZMxGoof( testMesg + itos(k+1) ) ); #ifndef DEFECT_NO_EXCEPTIONS } catch ( ZMexception & e ) { std::cerr << "Caught: " << e.name() << "\n"; } #endif } // ---------- // Test forced throwing behavior 3 times: // ---------- ZMlogger().emit( NEWLINE2 ); ZMlogger().emit( "---------- Testing forced throwing behavior 3 times: ----------\n" ); ZMxBooBoo::setHandler( ZMexThrowAlways() ); for ( k = 0; k < 3; ++k ) { ZMlogger().emit( NEWLINE1 ); string testMesg = "Testing forced exception throwing behavior #"; #ifndef DEFECT_NO_EXCEPTIONS try { #endif ZMthrow( ZMxBooBoo( testMesg + itos(k+1) ) ); #ifndef DEFECT_NO_EXCEPTIONS } catch ( ZMexception & e ) { std::cerr << "Caught: " << e.name() << "\n"; } #endif } // ---------- // Test scheduled throwing behavior 3 times: // ---------- ZMlogger().emit( NEWLINE2 ); ZMlogger().emit( "---------- Testing scheduled throwing behavior 3 times: ----------\n" ); ZMxBooBoo::setHandler( ZMexIgnoreNextN( 2 ) ); for ( k = 0; k < 3; ++k ) { ZMlogger().emit( NEWLINE1 ); string testMesg = "Testing scheduled exception throwing behavior #"; #ifndef DEFECT_NO_EXCEPTIONS try { #endif ZMthrow( ZMxBooBoo( testMesg + itos(k+1) ) ); #ifndef DEFECT_NO_EXCEPTIONS } catch ( ZMexception & e ) { std::cerr << "Caught: " << e.name() << "\n"; } #endif } //ZMxColumn::logNMore( 4 ); // ---------- // Test exception history: // ---------- ZMlogger().emit( NEWLINE2 ); ZMlogger().emit( "---------- Test exception history: ----------\n" ); ZMlogger().emit( NEWLINE1 ); ZMlogger().emit( string( "The following " ) + itos( ZMerrno.size() ) + " exceptions were recorded (most recent first):\n" ); for ( k = 0; k < ZMerrno.size(); ++k ) display( ZMerrno.get( k ) ); const int NEWMAX = 4; ZMerrno.setMax( NEWMAX ); ZMlogger().emit( NEWLINE1 ); ZMlogger().emit( string("ZMerrno.setMax( ") + itos( NEWMAX ) + " );" ); ZMlogger().emit( string( " we now have record of these " ) + itos(ZMerrno.size()) + " exceptions:\n" ); for ( k = 0; k < ZMerrno.size(); ++k ) display( ZMerrno.get( k ) ); // ---------- // Done, go home // ---------- return 0; } // main() clhep-2.1.4.1.orig/Exceptions/test/testExceptions.sh.in0000755000175000017500000000007310043511633021456 0ustar olesoles#! /bin/sh # @configure_input@ ./testExceptions@EXEEXT@ clhep-2.1.4.1.orig/Exceptions/test/exctest1.sh.in0000755000175000017500000000006510043511633020176 0ustar olesoles#! /bin/sh # @configure_input@ ./exctest1@EXEEXT@ clhep-2.1.4.1.orig/Exceptions/test/exctest2.sh.in0000755000175000017500000000006510043511633020177 0ustar olesoles#! /bin/sh # @configure_input@ ./exctest2@EXEEXT@ clhep-2.1.4.1.orig/Exceptions/ChangeLog0000755000175000017500000001755512241267303016310 0ustar olesoles============================== 14.11.13 Release CLHEP-2.1.4.1 ============================== ============================== 05.11.13 Release CLHEP-2.1.4.0 ============================== ============================== 14.11.12 Release CLHEP-2.1.3.1 ============================== ============================== 06.11.12 Release CLHEP-2.1.3.0 ============================== ============================== 16.08.12 Release CLHEP-2.1.2.5 ============================== ============================== 09.07.12 Release CLHEP-2.1.2.4 ============================== ============================== 31.05.12 Release CLHEP-2.1.2.3 ============================== ============================== 14.02.12 Release CLHEP-2.1.2.2 ============================== ============================== 06.02.12 Release CLHEP-2.1.2.1 ============================== 2012-01-31 Lynn Garren * change the names of internal variables so -Wshadow does not complain ============================== 16.12.11 Release CLHEP-2.1.2.0 ============================== ============================== 29.07.11 Release CLHEP-2.1.1.0 ============================== ============================== 11.11.10 Release CLHEP-2.1.0.1 ============================== ============================== 23.07.10 Release CLHEP-2.1.0.0 ============================== ============================== 16.06.10 Release CLHEP-2.1.0.0.b01 ============================== ============================== 11.06.10 Release CLHEP-2.0.5.0.b01 ============================== ============================== 09.03.10 Release CLHEP-2.0.4.6 ============================== ============================== 08.12.09 Release CLHEP-2.0.4.5 ============================== ============================== 12.11.09 Release CLHEP-2.0.4.4 ============================== 2009-11-10 Lynn Garren * test/exctest2.cc, exctest3.cc: improve ansi compliance ============================== 03.11.09 Release CLHEP-2.0.4.4.b01 ============================== ============================== 04.07.09 Release CLHEP-2.0.4.3 ============================== ============================== 18.11.08 Release CLHEP-2.0.4.2 ============================== ============================== 04.11.08 Release CLHEP-2.0.4.1 ============================== ============================== 07.08.08 Release CLHEP-2.0.4.0 ============================== ============================== 01.05.08 Release CLHEP-2.0.3.3 ============================== ============================== 18.10.07 Release CLHEP-2.0.3.2 ============================== ============================== 15.11.06 Release CLHEP-2.0.3.1 ============================== ============================== 18.10.06 Release CLHEP-2.0.3.0 ============================== 2006-10-05 Lynn Garren * configure.in: add flags for the Intel compiler (icc) Exceptions is not supported for use with icc. ============================== 20.06.06 Release CLHEP-2.0.2.3 ============================== ============================== 21.11.05 Release CLHEP-2.0.2.2 ============================== 2005-11-21 Lynn Garren * src/Makefile.am, test/Makefile.am: Build libraries for Windows Visual C++ without lib prefix. ============================== 22.06.05 Release CLHEP-2.0.2.1 ============================== Wed Jun 22 2005 Andreas Pfeiffer * configure.in: changed soname to install_name for darwin targets, dylibs still don't build properly on 10.3/10.4, static libs ok. 2005-06-19 Lynn Garren * configure.in, Makefile.am: Use lib when building Visual C++ libraries. Disable shared library build for Solaris CC. ============================== 22.04.05 Release CLHEP-2.0.2.0 ============================== 2005-04-07 Lynn Garren * configure.in: set AR and ARFLAGS 2005-02-18 Lynn Garren * configure.in, Makefile.am: Stop using libtool. The newer releases of libtool seem to have dropped support for Windows Visual C++. 2005-02-14 Lynn Garren * configure.in: Visual C++ flags are now "-EHsc -nologo -GR -GX -MD" 2005-02-03 Lynn Garren * configure.in: install step creates libCLHEP.a, libCLHEP.so, and/or libCLHEP.dylib by adding a symbolic link. 2005-02-02 Andreas PFEIFFER * configure.in: modified compiler flags for windows: added "-O -GR -GX -MD" as this is needed for the multi-thread environments used. ============================== 30.11.04 Release CLHEP-2.0.1.2 ============================== ============================== 27.10.04 Release CLHEP-2.0.1.1 ============================== Fri Sep 24 2004 Lynn Garren * use AM_CXXFLAGS * require autoconf 2.59, automake 1.9.1, and libtool 1.9b Tue Aug 31 2004 Lynn Garren * change Solaris CC compile flags from "-O -mt" to "-O" * libtools 1.9b or later is required for Solaris CC ============================== 23.07.04 Release CLHEP-2.0.1.0 ============================== ============================== 11.05.04 Release CLHEP-2.0.0.2 ============================== ============================== 11.05.04 Release CLHEP-1.9.0.2 ============================== ============================== 21.04.04 Release CLHEP-2.0.0.1 ============================== Thu Nov 06 2003 Lynn Garren * adding ZOOM Exceptions package for FNAL * adding supporting RefCount and Cast packages ============================== 24.10.03 Release CLHEP-2.0.0.0 ============================== ============================== 23.10.03 Release CLHEP-1.9.0.0 ============================== ============================== 01.06.02 Release CLHEP-1.8.0.0 ============================== ========================================= 25.04.02 revised StdHep uses HepMC ========================================= ========================================= 08.03.02 HepMC has become a part of CLHEP ========================================= ========================================== 09.11.01 HepPDT has become a part of CLHEP ========================================== ============================== 15.06.01 Release CLHEP-1.7.0.0 ============================== ========================================================================== 18.01.01 ZOOM PhysicsVectors Capabilities have become part of CLHEP/Vector ========================================================================== ====================================================================== 24.10.00 Generic Functions by Joe Boudreau have become a part of CLHEP ====================================================================== ============================== 20.10.00 Release CLHEP-1.6.0.0 ============================== ============================================================================== 12.10.00 Expression Evaluator by Evgueni Tcherniaev has become a part of CLHEP Alist, String and Combination have been disabled ============================================================================== ============================== 08.05.00 Release CLHEP-1.5.0.0 ============================== ============================================================ 24.04.00 StdHepC++ by Lynn Garren has become a part of CLHEP ============================================================ ============================== 20.04.99 Release CLHEP-1.4.0.0 ============================== ========================================================================= 16.12.98 Started: merging with BaBar version of CLHEP provided by G.Cosmo ========================================================================= ========================== 28.07.98 Release CLHEP-1.3 ========================== ========================== 05.02.98 Release CLHEP-1.2 ========================== ======================================================== 08.12.97 Release CLHEP-1.1: Geant4 has migrated to CLHEP ======================================================== clhep-2.1.4.1.orig/Exceptions/CMakeLists.txt0000644000175000017500000000063111672427737017276 0ustar olesoles# main Exceptions cmake instructions # automake/autoconf variables set( PACKAGE Exceptions ) # define dependency list that will be used in several places list(APPEND ${PACKAGE}_DEPS Cast RefCount ) clhep_package_config() add_subdirectory(Exceptions) add_subdirectory(src) add_subdirectory(test) if ( CLHEP_BUILD_DOCS ) message(STATUS "building documents for ${PACKAGE}" ) add_subdirectory(doc) endif() clhep-2.1.4.1.orig/Exceptions/autotools/0000755000175000017500000000000012242515141016544 5ustar olesolesclhep-2.1.4.1.orig/Exceptions/autotools/.cvsignore0000755000175000017500000000010110043511633020536 0ustar olesolesconfig.sub config.guess depcomp install-sh missing mkinstalldirs clhep-2.1.4.1.orig/Exceptions/autotools/ltmain.sh0000755000175000017500000057547210233520632020412 0ustar olesoles# Generated from ltmain.in; do not edit by hand # ltmain.sh (GNU libtool) 1.9b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: powerpc-apple-darwin7.5.0 # shell: $SHELL # compiler: $LTCC # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 1.9b # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST elif test -n "${BASH_VERSION+set}${KSH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh dirname="s,/[^/]*$,," basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: PROGRAM=ltmain.sh progname=`echo "$progpath" | $SED "$basename"` # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *) progdir=`echo "$progpath" | $SED "$dirname"` progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; esac # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.9b TIMESTAMP="" package_revision=1.1571 # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $echo $progname${mode+: }$mode: warning: ${1+"$@"} 1>&2 } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } # func_version # Echo version message to standard output and exit. func_version () { $SED '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# //; s/^# *$//; s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED '/^# Usage:/,/# -h/ { s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" echo echo "run \`$progname --help | more' for full usage" exit $EXIT_SUCCESS } # func_help # Echo long help message to standard output and exit. func_help () { $SED '/^# Usage:/,/# Report bugs to/ { s/^# //; s/^# *$//; s:\$progname:'$progname':; s:\$SHELL:'"$SHELL"':; s:\$LTCC:'"$LTCC"':; s:\$LD:'"$LD"':; s/\$with_gnu_ld/'"$with_gnu_ld"'/; s/\$automake_version/'"`automake --version 2>/dev/null |$SED 1q`"'/; s/\$autoconf_version/'"`autoconf --version 2>/dev/null |$SED 1q`"'/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $EXIT_SUCCESS } # func_features # Display the features supported by this script. func_features () { $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable "`\"foo\"`", so we have to do # it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $echo \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $echo $echo "Try \`$progname --help' for more information about other modes." exit $EXIT_SUCCESS } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # sed scripts: my_sed_single_opt='1s/^\(..\).*$/\1/;q' my_sed_single_rest='1s/^..\(.*\)$/\1/;q' my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' exit_cmd=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set -- --mode clean ${1+"$@"} ;; compile|compil|compi|comp|com|co|c) shift; set -- --mode compile ${1+"$@"} ;; execute|execut|execu|exec|exe|ex|e) shift; set -- --mode execute ${1+"$@"} ;; finish|finis|fini|fin|fi|f) shift; set -- --mode finish ${1+"$@"} ;; install|instal|insta|inst|ins|in|i) shift; set -- --mode install ${1+"$@"} ;; link|lin|li|l) shift; set -- --mode link ${1+"$@"} ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set -- --mode uninstall ${1+"$@"} ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" set -x ;; --dlopen) test $# -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" ;; --dry-run | -n) run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test $# -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" show=: ;; --tag) test $# -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: --dlopen=*|--mode=*|--tag=*) arg=`echo "$opt" | $SED "$my_sed_long_arg"` opt=`echo "$opt" | $SED "$my_sed_long_opt"` set -- "$opt" "$arg" ${1+"$@"} ;; # Separate optargs to short options: # -x*|-y*) # arg=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "$arg" ${1+"$@"} # ;; # Separate non-argument short options: # -z*|-z*|-y*) # rest=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "-$rest" ${1+"$@"} # ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`echo "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$my_dlsyms" test -z "$run" && $echo > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do $show "extracting global C symbols from \`$progfile'" $run eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for dlprefile in $dlprefiles; do $show "extracting global C symbols from \`$dlprefile'" name=`$echo "$dlprefile" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ const struct { const char *originator; const struct { const char *name; void *address; } symbols[]; } lt_${my_prefix}_LTX_preloaded_symbols = {\ \"$my_originator\", { " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" $echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} } }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" status=$? if test "$status" -ne 0 && test ! -d "$my_xdir"; then exit $status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename $darwin_archive` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" # Remove the table of contents from the thin files. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" $AR -xo "${darwin_base_archive}" rm "${darwin_base_archive}" cd "$darwin_curdir" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist rm -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir (cd $my_xdir && $AR x $my_xabs) || exit $? fi # $darwin_arches fi # $run ;; *) # We will extract separately just the conflicting names and we will # no longer touch any unique names. It is faster to leave these # extract automatically by $AR in one run. $show "(cd $my_xdir && $AR x $my_xabs)" $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; renaming object files" func_warning "to ensure that they will not overwrite" $AR t "$my_xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_mode_compile arg... func_mode_compile () { # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1 || \ func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi } # func_mode_finish arg... func_mode_finish () { libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit $EXIT_SUCCESS } # func_mode_install arg... func_mode_install () { # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files test "$#" -gt 2 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. (${SED} -e '2q' $file | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1 || \ func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" $show "$relink_command" $run eval "$relink_command" || \ func_fatal_error "error: relink \`$file' with the above command before installing it" fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | $GREP "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. test -z "$notinst_deplibs" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask func_error "error: cannot create temporary directory \`$tmpdir'" continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" ${rm}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } # func_mode_link arg... func_mode_link () { case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static # See comment for -static flag below, for more details. compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" || \ func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else func_fatal_error "link input file \`$save_arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) # The effects of -all-static are defined in a previous loop. continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs $inherited_linker_flags" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *[\\/]*.la) . $lib ;; *.la) . ./$lib ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`echo "$deplib" |$SED "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$inherited_linker_flags " in *" $deplib "*) ;; * ) inherited_linker_flags="$inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $lib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not use here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib'" fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then : else func_fatal_error "\`$lib' is not a valid libtool archive" fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac case $host in *-*-darwin*) # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then inherited_linker_flags=`$echo "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` fi dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP "bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $echo "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "*** And there doesn't seem to be a static archive available" $echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs $inherited_linker_flags; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" eval darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//' | xargs` compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for archives" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath test "$#" -gt 2 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" test -n "$8" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "AGE \`$age' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | ${SED} 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null | ${SED} 10q | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` inherited_linker_flags=`$echo "X $inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$echo "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`echo "$output" | $SED $basename` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnk $echo "creating GNU ld script: $output" $echo 'INPUT (' > $output for obj in $save_libobjs do $echo \""$obj"\" >> $output done $echo ')' >> $output else $echo "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for objects" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; struct stat st; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$dlsymsobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; overriding AR_FLAGS to 'cq'" func_warning "to ensure that POSIX-compatible ar will work" AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS } # func_mode_uninstall arg... func_mode_uninstall () { rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done test -z "$rm" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 || (test -h "$file") >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status } ## ----------- ## ## Main. ## ## ----------- ## { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." case $mode in compile) func_mode_compile ${1+"$@"} ;; execute) func_mode_execute ${1+"$@"} ;; finish) func_mode_finish ${1+"$@"} ;; install) func_mode_install ${1+"$@"} ;; link|relink) func_mode_link ${1+"$@"} ;; uninstall|clean) func_mode_uninstall ${1+"$@"} ;; "") help="$generic_help" func_fatal_help "you must specify a MODE" ;; esac test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi } exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: clhep-2.1.4.1.orig/Exceptions/src/0000755000175000017500000000000012242515141015302 5ustar olesolesclhep-2.1.4.1.orig/Exceptions/src/ZMexClassInfo.cc0000755000175000017500000000271711712574000020310 0ustar olesoles// ---------------------------------------------------------------------- // // ZMexClassInfo.cc // // Contains the following methods: // // ZMexClassInfo() // // Revision History // 011212 WEB Initial version w/ constructor no longer inline; // add new 3- and 4-arg constructors in lieu of a // single 5-arg constructor taking default arguments // // ---------------------------------------------------------------------- #include "CLHEP/Exceptions/ZMexClassInfo.h" namespace zmex { // ZMexClassInfo() //------------------ ZMexClassInfo::ZMexClassInfo( const std::string & nname , const std::string & ffacility , const ZMexSeverity s ) : count_ ( 0 ) , filterMax_( -1 ) , name_ ( nname ) , facility_ ( ffacility ) , severity_ ( s ) , handler_ ( ZMexHandleViaParent() ) , logger_ ( ZMexLogViaParent() ) { } ZMexClassInfo::ZMexClassInfo( const std::string & nname , const std::string & ffacility , const ZMexSeverity s , const ZMexHandler & h ) : count_ ( 0 ) , filterMax_( -1 ) , name_ ( nname ) , facility_ ( ffacility ) , severity_ ( s ) , handler_ ( h ) , logger_ ( ZMexLogViaParent() ) { } ZMexClassInfo::ZMexClassInfo( const std::string & nname , const std::string & ffacility , const ZMexSeverity s , const ZMexHandler & h , const ZMexLogger & l ) : count_ ( 0 ) , filterMax_( -1 ) , name_ ( nname ) , facility_ ( ffacility ) , severity_ ( s ) , handler_ ( h ) , logger_ ( l ) { } } // namespace zmex clhep-2.1.4.1.orig/Exceptions/src/ZMexHandler.cc0000755000175000017500000000357710043511633020010 0ustar olesoles// ---------------------------------------------------------------------- // // ZMexHandler.cc -- implementations for the standard handlers. // // // The following methods are defined here: // standardHandling( ZMexception & x, bool willThrow ) // ZMexThrowErrors::takeCareOf() // // Revision History: // 970923 PhilC Initial version // 971113 WEB Updated to conform to standard coding techniques // 980615 WEB Added namespace support // // ---------------------------------------------------------------------- #include "CLHEP/Exceptions/ZMexHandler.h" #include "CLHEP/Exceptions/ZMexception.h" namespace zmex { //****************************************** // // standardHandling( ZMexception & x, bool willThrow ) // provides functionality common to many (most?) handlers: // record the handler's name // record (via x.wasThrown() ) the determined action // obtain permission, from the exception, to log; // if granted, invoke the exception's logger // return the determined action // //****************************************** ZMexAction ZMexHandlerBehavior:: standardHandling( const ZMexception & x, bool willThrow ) { x.handlerUsed( name() ); // record handler's name x.wasThrown( willThrow ); // record go/nogo decision int & val = ZMexSeverityLimit[ x.severity() ]; if ( x.OKtoLog() && val != 0 ) // handle logging, if desired if ( x.logMe() == ZMexLOGGED && val > 0 ) --val; return willThrow ? ZMexThrowIt : ZMexIgnoreIt; } //******************************* // // ZMexThrowErrors::takeCareOf() // //******************************* ZMexAction ZMexThrowErrors:: takeCareOf( const ZMexception & x ) { //DEBUG cerr << "ThrowErrors::takeCareOf" << endl; return standardHandling( x, ( x.severity() >= ZMexERROR ) ? true : false ); } } // namespace zmex clhep-2.1.4.1.orig/Exceptions/src/ZMexLogger.cc0000755000175000017500000001505212045031613017640 0ustar olesoles// ---------------------------------------------------------------------- // // ZMexLogger.cc - define basic logging behaviors // // History: // 970919 WEB Created based on code review 4 comments on // ZMexLogger behavior desired // 971007 WEB Removed limiting logger; all loggers now // optionally limit by exception severity // 971211 WEB Updated per code walkthrough // 971211 WEB Created from ZMexLogger.icc per code walkthrough // 971215 WEB Removed unused 2nd parm to ZMexLogger constructor // 971219 WEB Use std::flush instead of endl in ...::emit() // 980617 WEB Added namespace support // 990104 WEB Merged with .icc; restructured os data member // ownership // 990802 JVR Added support for augmented exception logging // 010410 MF Added ZMexValidationStyle // // ---------------------------------------------------------------------- #include "CLHEP/Exceptions/ZMexLogger.h" #include "CLHEP/Exceptions/ZMexception.h" // ---------------------------------------------------------------------- namespace zmex { // ---------------------------------------------------------------------- // ----------------- // ZMexLogBehavior:: // ----------------- ZMexLogBehavior::ZMexLogBehavior() { ; } ZMexLogBehavior::~ZMexLogBehavior() { ; } ZMexLogBehavior * ZMexLogBehavior::clone() const { return new ZMexLogBehavior( *this ); } ZMexLogResult ZMexLogBehavior::emit( const ZMexception & ) { return ZMexNOTLOGGED; } ZMexLogResult ZMexLogBehavior::emit( const std::string & ) { //DEBUG cerr << "ZMexLogBehavior::emit()" << endl; // Do nothing with string& (but do it well!): return ZMexNOTLOGGED; } bool ZMexLogBehavior::isTimeDesired() const { return true; } bool ZMexLogBehavior::isFilePathDesired() const { return true; } // -------------- // ZMexLogNever:: // -------------- ZMexLogNever::ZMexLogNever() : ZMexLogBehavior() { ; } ZMexLogNever::~ZMexLogNever() { ; } ZMexLogNever * ZMexLogNever::clone() const { return new ZMexLogNever( *this ); } ZMexLogResult ZMexLogNever::emit( const ZMexception & ) { return ZMexNOTLOGGED; // } ZMexLogResult ZMexLogNever::emit( const std::string & ) { //DEBUG cerr << "ZMexLogNever::emit()" << endl; // Do nothing with string& (but do it well!): return ZMexNOTLOGGED; } // --------------- // ZMexLogAlways:: // --------------- ZMexLogAlways::ZMexLogAlways( ) : ZMexLogBehavior() , myOs( std::cerr ) { ; } ZMexLogAlways::ZMexLogAlways( std::ostream & os ) : ZMexLogBehavior() , myOs( os ) { ; } ZMexLogAlways::~ZMexLogAlways() { ; } ZMexLogAlways * ZMexLogAlways::clone() const { return new ZMexLogAlways( *this ); } ZMexLogResult ZMexLogAlways::emit( const ZMexception & x ) { std::string s = x.logMessage(); // if ( s != "" ) return emit( s ); x.logObject(); return ZMexLOGGED; } ZMexLogResult ZMexLogAlways::emit( const std::string & s ) { //DEBUG cerr << "ZMexLogAlways::emit( \"" << s << "\" )" << endl; // Emit the message, flushing the output right away: myOs << s << std::flush; return ZMexLOGGED; } // --------------- // ZMexLogTwice:: // --------------- ZMexLogTwice::ZMexLogTwice( std::ostream & os1 ) : ZMexLogBehavior() , myOs1( os1 ) , myOs2( std::cerr ) { ; } ZMexLogTwice::ZMexLogTwice( std::ostream & os1, std::ostream & os2 ) : ZMexLogBehavior() , myOs1( os1 ) , myOs2( os2 ) { ; } ZMexLogTwice::~ZMexLogTwice() { ; } ZMexLogTwice * ZMexLogTwice::clone() const { return new ZMexLogTwice( *this ); } ZMexLogResult ZMexLogTwice::emit( const ZMexception & x ) { std::string s = x.logMessage(); if (s != "") return emit( s ); std::cerr << "WARNING: ZMexLogTwice() does not log in the usual manner for"; std::cerr << " SuperEx's.\n\t Its ostreams may not have received logs.\n"; x.logObject(); return ZMexLOGGED; } ZMexLogResult ZMexLogTwice::emit( const std::string & s ) { //DEBUG cerr << "ZMexLogTwice::emit( \"" << s << "\" )" << endl; // Emit the message, flushing the output right away: myOs1 << s << std::flush; myOs2 << s << std::flush; return ZMexLOGGED; } // ------------------ // ZMexLogViaParent:: // ------------------ ZMexLogViaParent::ZMexLogViaParent() : ZMexLogBehavior() { ; } ZMexLogViaParent::~ZMexLogViaParent() { ; } ZMexLogViaParent * ZMexLogViaParent::clone() const { return new ZMexLogViaParent( *this ); } ZMexLogResult ZMexLogViaParent::emit( const ZMexception & ) { return ZMexLOGVIAPARENT; // } ZMexLogResult ZMexLogViaParent::emit( const std::string & ) { //DEBUG cerr << "ZMexLogViaParent::emit( \"" << s << "\" )" << endl; // Bump logging decisions to someone else's logger: return ZMexLOGVIAPARENT; } // ------------------ // ZMexValidationStyle:: // ------------------ ZMexValidationStyle::ZMexValidationStyle( ) : ZMexLogBehavior() , myOs( std::cerr ) { ; } ZMexValidationStyle::ZMexValidationStyle( std::ostream & os ) : ZMexLogBehavior() , myOs( os ) { ; } ZMexValidationStyle::~ZMexValidationStyle() { ; } ZMexValidationStyle * ZMexValidationStyle::clone() const { return new ZMexValidationStyle( *this ); } ZMexLogResult ZMexValidationStyle::emit( const ZMexception & x ) { std::string s = x.logMessage(); if ( s != "" ) return emit( s ); x.logObject(); return ZMexLOGGED; } ZMexLogResult ZMexValidationStyle::emit( const std::string & s ) { //DEBUG cerr << "ZMexValidationStyle::emit( \"" << s << "\" )" << endl; // Emit the message, flushing the output right away: myOs << s << std::flush; return ZMexLOGGED; } bool ZMexValidationStyle::isTimeDesired() const { return false; } bool ZMexValidationStyle::isFilePathDesired() const { return false; } // ------------ // ZMexLogger:: // ------------ ZMexLogger::ZMexLogger( const ZMexLogBehavior & desiredBehavior ) : ZMhandleTo( desiredBehavior ) { ; } // Construct logger with specified behavior. ZMexLogger::~ZMexLogger() { ; } // Destroy logger with its behavior. ZMexLogResult ZMexLogger::emit( const ZMexception & exc ) { return rep_->emit( exc ); } // Force the given exception's message into the log. ZMexLogResult ZMexLogger::emit( const std::string & message ) { return rep_->emit( message ); } // Force the given message into the log. ZMexLogBehavior * ZMexLogger::control() { return rep_; } // Grant access to the representation // to permit calling specialized behavior functions. // ---------------------------------------------------------------------- } // namespace zmex clhep-2.1.4.1.orig/Exceptions/src/Makefile.am0000755000175000017500000000367011406166731017357 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir) libCLHEP_Exceptions_@VERSION@_a_SOURCES = \ ZMerrno.cc \ ZMexClassInfo.cc \ ZMexHandler.cc \ ZMexLogger.cc \ ZMexSeverity.cc \ ZMexception.cc \ ZMthrow.cc libCLHEP_Exceptions_@VERSION@_so_OBJECTS = $(patsubst %.cc,$(shareddir)/%.$(OBJEXT),$(libCLHEP_Exceptions_@VERSION@_a_SOURCES)) # these if/else blocks will be parsed by automake and translated if BUILD_SHARED shareddir = shared if BUILD_VISUAL lib_shared = CLHEP-Exceptions-@VERSION@.$(SHEXT) else lib_shared = libCLHEP-Exceptions-@VERSION@.$(SHEXT) LDADD = -L${top_builddir}/../Cast/src -lCLHEP-Cast-@VERSION@ \ -L${top_builddir}/../RefCount/src -lCLHEP-RefCount-@VERSION@ endif SHFLAGS = @MY_SHFLAGS@ SHLINK = @MY_SHLINK@ @MY_SHEXTRA@ SHNAME = @MY_SHNAME@ endif if BUILD_STATIC lib_LIBRARIES = libCLHEP-Exceptions-@VERSION@.a endif CLEANFILES = $(lib_shared) all-local: $(shareddir) $(lib_shared) $(shareddir): test -d $(shareddir) || mkdir $(shareddir) if BUILD_VISUAL $(lib_shared): $(libCLHEP_Exceptions_@VERSION@_so_OBJECTS) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Exceptions_@VERSION@_so_OBJECTS) $(LDADD) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) /c /Fo$@ $< else $(lib_shared): $(libCLHEP_Exceptions_@VERSION@_so_OBJECTS) $(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Exceptions_@VERSION@_so_OBJECTS) $(LDADD) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) -c -o $@ $< endif install-exec-local: $(lib_shared) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_shared)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$p'"; \ $(INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done clean-local: -test -d $(shareddir) && rm -f $(shareddir)/*.$(OBJEXT) distclean-local: -test -d $(shareddir) && rm -rf ./$(shareddir) clhep-2.1.4.1.orig/Exceptions/src/ZMexception.cc0000755000175000017500000001342211712060772020071 0ustar olesoles// ---------------------------------------------------------------------- // // ZMexception.cc -- implementation of the ZMexception class // // Methods found here: // handleThis(x) // logMessage() // // Revision History: // 970912 MF Initial version after separating .icc from .cc // 970916 WEB Updated per code review // 970917 WEB Updated per code review 2 // 970918 WEB Updated per code review 3 // 971113 WEB Updated to conform to standard coding techniques // 971211 WEB Updated per code walkthrough // 971215 WEB Gave names to the default handler & logger // 971217 WEB Append filter failure messages in logMessage() // 971219 WEB Append newline to formatted messages // 980213 WEB Include ZMutility/ZMtime.h instead of // 980223 WEB Include ZMutility/ctime instead of ZMtime // 980304 WEB Reformat logged messages to avoid excessively // long lines; otherwise cleaned up logMessage() & // related stuff // 980421 WEB Moved name() and facility() from .icc to .cc // 980615 WEB Added namespace support // 000217 WEB Improve C++ standards compliance // 010410 MF Added code to supress time and file path // 010626 MF Added code for ctor from ostringstream // 031105 LG Get rid of all ZMutility references // // ---------------------------------------------------------------------- #include "CLHEP/Exceptions/defs.h" #include "CLHEP/Exceptions/ZMexception.h" #include "CLHEP/Exceptions/ZMexAction.h" #include "CLHEP/Exceptions/ZMexHandler.h" #include "CLHEP/Exceptions/ZMexLogger.h" #include "CLHEP/Exceptions/ZMexLogResult.h" #include #include namespace zmex { // ************************************** // // ZMexUserActivity, ZMexUserNumericalTag // // ************************************** std::string ZMexUserActivity = ""; int ZMexUserNumericalTag = 0; // ******************* // // ZMhandler, ZMlogger // // ******************* ZMexHandler & ZMhandler() { static ZMexHandler ZMhandler = ZMexHandler( ZMexThrowErrors() ); return ZMhandler; } // ZMhandler() ZMexLogger & ZMlogger() { static ZMexLogger ZMlogger = ZMexLogger( ZMexLogAlways() ); return ZMlogger; } // *********************** // // ZMexception::_classInfo // // *********************** ZMexClassInfo ZMexception::_classInfo( "ZMexception" , "Exceptions" , ZMexFATAL , ZMhandler() , ZMlogger() ); // *********************** // ZMexception::facility() // *********************** std::string ZMexception::facility() const { return classInfo().facility(); } // ZMexception::facility() // ******************* // ZMexception::name() // ******************* std::string ZMexception::name() const { return classInfo().name(); } // ZMexception::name() //************* // logMessage() //************* // This will be overridden in cases where, for a particular exception, // one wishes to include auxiliary information with the logged message. // The overriding function should compose its string, then call this // (its ancestor) function with that string as argument. std::string ZMexception::logMessage( const std::string optText ) const { std::ostringstream mesg; // define how each follow-on line should begin: #define NEXT "\n " // Supply the exception's identification as the first line: mesg << facility() << "-" << ZMexSeverityLetter[ severity() ] << "-" << name() << " [#" << count() << "]"; // Second line gives the exception instance's message mesg << NEXT << message(); // Warn if this exception hits the max for its severity: if ( 1 == ZMexSeverityLimit[ severity() ] ) mesg << NEXT "-- Note: severity threshhold has been reached; " "logging will be suppressed " "for any future exceptions of this severity"; // Warn if this exception hits the max for its class: if ( classInfo().count() == classInfo().filterMax() ) mesg << NEXT "-- Note: class threshhold has been reached; " "logging will be suppressed " "for any future exceptions of this class"; // Insert optional text (probably from override calling this as its ancestor): if ( optText.length() ) mesg << NEXT << optText; // Insert time stamp: ZMexLogger lgr = getLogger(); if ( lgr.control()->isTimeDesired() ) { time_t now( time(0) ); char * timeText = ctime( & now ); timeText[24] = '\0'; // overwrite terminal '\n' mesg << NEXT << timeText; } // Identify whence we got here: mesg << NEXT "-- ZMthrow was issued at line " << line(); std::string fullName = fileName(); std::string fname; if ( lgr.control()->isFilePathDesired() ) { fname = fullName; } else { unsigned int lastSlash = fullName.find_last_of("/\\"); if ( lastSlash == fullName.length() ) { fname = fullName; } else { fname = fullName.substr(lastSlash+1); } } mesg << NEXT "of file \"" << fname << '\"'; // Identify disposition: mesg << NEXT "... Exception " << ( wasThrown() ? "thrown!" : "ignored" ); // Include optional user information, part 1: if ( ZMexUserActivity.length() ) mesg << NEXT "-- ZMexUserActivity was: " << ZMexUserActivity; // Include optional user information, part 2: if ( ZMexUserNumericalTag ) mesg << NEXT "-- User Numerical Tag was: " << ZMexUserNumericalTag; return mesg.str() + '\n'; } // ZMexception::logMessage() //*********************************************** // Constructor of ZMexception from ostringstream& //*********************************************** ZMexception::ZMexception( const std::ostringstream & msg , const ZMexSeverity howBad , int icount ) : message_(msg.str()) , line_( 0 ) , sourceFileName_( "not ZMthrow'n as of yet" ) , mySeverity_( howBad == ZMexSEVERITYenumLAST ? _classInfo.severity() : howBad ) , myCount_( icount ) , wasThrown_( false ) { } } // namespace zmex clhep-2.1.4.1.orig/Exceptions/src/ZMerrno.cc0000755000175000017500000000635210043511633017215 0ustar olesoles// ---------------------------------------------------------------------- // // ZMerrno.cc -- implementation of the error list mechanism. // // The following are instantiated here: // ZMerrnoList ZMerrno; // // The following methods of ZMerrnoList are defined here: // void write(ZMexception& x); // const ZMexception* get(unsigned int k=0); // string name(unsigned int k=0); // void erase(); // unsigned int setMax(unsigned int maxNumber); // // Revision History: // 970916 WEB Updated per code review // 970917 WEB Updated per code review 2 // 971113 WEB Updated to conform to standard coding techniques // 980615 WEB Added namespace support // 980728 WEB Added destructor; fixed other memory leaks // // ---------------------------------------------------------------------- #include "CLHEP/Exceptions/ZMerrno.h" #include "CLHEP/Exceptions/ZMexception.h" namespace zmex { //******** // // ZMerrno // //******** ZMerrnoList ZMerrno; // Define the actual ZMerrno instance !! //*************** // // ~ZMerrnoList() // //*************** ZMerrnoList::~ZMerrnoList() { while ( size() > 0 ) { const ZMexception * e = errors_.front(); errors_.pop_front(); delete const_cast( e ); } } // ZMerrnoList::~ZMerrnoList() //************************* // // write( ZMexception & x ) // //************************* void ZMerrnoList::write( const ZMexception & x ) { // copy an exception onto ZMerrno ++count_; ++countSinceCleared_; if ( max_ <= 0 ) { return; } if ( max_ <= size() ) { // Get rid of the oldest. const ZMexception * e = errors_.front(); errors_.pop_front(); delete const_cast( e ); } errors_.push_back( x.clone() ); } // ZMerrnoList::write() //******* // // get(k) // //******* const ZMexception * ZMerrnoList::get( unsigned int k ) const { // Obtain a const pointer to the exception for the latest-but-k entry // on ZMerrno. // Will be NULL if ZMerrno has been cleared since the last ZMthrow, // and also if k is not less than ZMerrno.size(). return k < size() ? errors_[size()-1-k] : 0; } // ZMerrnoList::get() //******** // // name(k) // //******** std::string ZMerrnoList::name( unsigned int k ) const { // Obtain the mnemonic name of the latest-but-k exception on ZMerrno return k < size() ? get(k)->name() : std::string(); } // ZMerrnoList::name() //******** // // erase() // //******** // Remove the latest entry. void ZMerrnoList::erase() { if ( size() > 0 ) { const ZMexception * e = errors_.back(); errors_.pop_back(); delete const_cast( e ); } } // ZMerrnoList::erase() //********************************** // // setMax (unsigned int maxNumber) // //********************************** unsigned int ZMerrnoList::setMax( unsigned int newMax ) { // Set the maximum number of exceptions to be kept in the list. // Zero completely disables the ZMerrno mechanism. unsigned int oldMax = max_; // If a reduction, you may have to pop some old entries off: while ( newMax < size() ) { const ZMexception * e = errors_.front(); errors_.pop_front(); delete const_cast( e ); } max_ = newMax; return oldMax; } // ZMerrnoList::setMax() } // namespace zmex clhep-2.1.4.1.orig/Exceptions/src/.cvsignore0000755000175000017500000000001410043511633017277 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Exceptions/src/ZMthrow.cc0000755000175000017500000000435510043511633017234 0ustar olesoles// ---------------------------------------------------------------------- // // ZMthrow.cc -- implementation of ZMthrow // // ZMthrow_() is invoked by the ZMthrow(x) macro, which supplies the lineNum // and file arguments as well as the constructed ZOOM exception object. // // Revision History: // 970910 MF Initial version // 970916 WEB Updated per code review // 970917 WEB Updated per code review 2 // 980615 WEB Added namespace support // // ---------------------------------------------------------------------- #include "CLHEP/Exceptions/ZMthrow.h" #include "CLHEP/Exceptions/ZMexSeverity.h" #include "CLHEP/Exceptions/ZMexception.h" #include "CLHEP/Exceptions/ZMerrno.h" namespace zmex { //********************** // // ZMthrow_ () // //********************** ZMexAction ZMthrow_( const ZMexception & userException , int lineNum , const char fileName[] ) { // a) Place the lineNum and fileName information into the exception object. // b) Cause the handler to be invoked via x.X::handleMe(). // That finds the handler, puts the handler name into the exception, // and invokes the handler's takeCareOf() method, passing it the // exception object so that, if any parent handlers are involved, // you later have x.Y::handleMe() invoked, where Y is an ancestor of X. // c) If the exception is of severity ZMexERROR or higher, copy the // exception object onto ZMerrno. // d) Return the result of the handler's decision. // The following are done elsewhere, so ZMthrow_ does not have to: // The constructor for ZMexception takes care of incrementing // the static count, and saving its value. // The handler notifies the exception object of the handler's // decision whether to have the object be thrown or ignored. // Identifying the logger to call, and saving that information, // in this exception instance, is done by x.logMe() // called by handler, assuming the handler decides to log. userException.location( lineNum, fileName ); // (a) ZMexAction whatToDo = userException.handleMe(); // (b) if ( userException.severity() >= ZMexERROR ) // (c) ZMerrno.write( userException ); return whatToDo; // (d) } // ZMthrow_() } // namespace zmex clhep-2.1.4.1.orig/Exceptions/src/ZMexSeverity.cc0000755000175000017500000000232510043511633020233 0ustar olesoles// ---------------------------------------------------------------------- // // ZMexSeverity.cc - define severity codes & ancillary information // // Revision History: // 971006 WEB Split out from ZMexSeverity.h // 971113 WEB Updated to conform to standard coding techniques // 980615 WEB Added namespace support // // ---------------------------------------------------------------------- #include "CLHEP/Exceptions/ZMexSeverity.h" namespace zmex { const std::string ZMexSeverityName[ ZMexSEVERITYenumLAST ] = { "NORMAL", // ZMexNORMAL "INFORMATIONAL", // ZMexINFO "WARNING", // ZMexWARNING "ERROR", // ZMexERROR "SEVERE", // ZMexSEVERE "FATAL", // ZMexFATAL "UNANTICIPATED PROBLEM", // ZMexPROBLEM }; const char ZMexSeverityLetter[ ZMexSEVERITYenumLAST ] = { ' ', // ZMexNORMAL 'I', // ZMexINFO 'W', // ZMexWARNING 'E', // ZMexERROR 'S', // ZMexSEVERE 'F', // ZMexFATAL '?', // ZMexPROBLEM }; int ZMexSeverityLimit[ ZMexSEVERITYenumLAST ] = { // Provide starting values to limit logging by severity -1, // ZMexNORMAL -1, // ZMexINFO -1, // ZMexWARNING -1, // ZMexERROR -1, // ZMexSEVERE -1, // ZMexFATAL -1, // ZMexPROBLEM }; } // namespace zmex clhep-2.1.4.1.orig/Exceptions/src/CMakeLists.txt0000644000175000017500000000023611606714767020065 0ustar olesoles clhep_build_library( Exceptions ZMerrno.cc ZMexClassInfo.cc ZMexHandler.cc ZMexLogger.cc ZMexSeverity.cc ZMexception.cc ZMthrow.cc ) clhep-2.1.4.1.orig/COPYING0000644000175000017500000010451311406214373013435 0ustar olesoles GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/Fields/0000755000175000017500000000000012242515221013577 5ustar olesolesclhep-2.1.4.1.orig/Fields/INSTALL0000755000175000017500000000772111406231616014646 0ustar olesoles#------------------------------------------------------------- # platform specific issues #------------------------------------------------------------- This package requires autoconf 2.59 or later and automake 1.9.1 or later. If you bootstrap, you will probably have to build these yourself. See "building autotools" below. The new libtool no longer properly supports shared libraries for gcc 2.95.2. If you build CLHEP with gcc 2.95.2, you must configure --disable-shared. To build for Solaris CC, configure with CXX=CC CC=cc and use gmake. On MacOSX, you need to define MACOSX_DEPLOYMENT_TARGET appropriately. For instance, set MACOSX_DEPLOYMENT_TARGET to "10.4" if you have MacOS 10.4 installed on your system. #------------------------------------------------------------- # installing from a source code tar ball #------------------------------------------------------------- Unwind the source code tar ball in some relevant directory. Autoconf and automake will aready have been run. Determine where the files will be installed. Create a build directory that is NOT in the source code directory tree. cd /configure --prefix= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make check (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # configure options #------------------------------------------------------------- A variety of options can be given to configure. Below is a list of the options that you are likely to find most useful. --help provides a partial list of options --prefix=PREFIX install architecture-independent files in PREFIX [default is /usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [default is the same as PREFIX] --disable-shared build only static libraries --disable-static build only shared libraries --enable-exceptions use the CLHEP/Exceptions package --disable-exceptions DO NOT use the CLHEP/Exceptions package [--disable-exceptions is the default] #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are neither built nor installed automatically. Use the following commands to build and install documents: make docs make install-docs #------------------------------------------------------------- # building from cvs #------------------------------------------------------------- You will need current versions of automake, autoconf, and libtool. See building autotools below. cvs co CLHEP/package OR cvs co package cd [CLHEP/]package ./bootstrap Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building autotools #------------------------------------------------------------- If you do not have at least autoconf 2.59 and automake 1.9.1, you will need to build autoconf, automake, and libtool. On some platforms, you may also need to build m4 and texinfo. Download the relevant tarballs from gnu.org (http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/, and http://www.gnu.org/software/libtool/) Untar them in a common source code tree. Decide whether you want to install them in /usr/local or your own install directory. If you use your own install directory, use --prefix= with configure. For each autotool package: /configure [--prefix=] make make install Make sure that /bin is at the front of your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/Fields/Makefile.am0000755000175000017500000000446611406231616015654 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP # put . first so that CLHEP directory is built before anything else SUBDIRS = Fields . src test # list all subdirectories - for distribution and cleaning DIST_SUBDIRS = Fields . src test bin_SCRIPTS = Fields-config all-local: $(top_builddir)/CLHEP # create temporary CLHEP header tree # we only copy headers for packages listed in @PACKAGE@-deps # search for header directories in the following order: # 1. $(top_builddir)/this-package # 2. $(top_builddir)/../other-packages # 3. $(CLHEPSOURCE_DIR)/CLHEP # 4. $(CLHEP_DIR)/include/CLHEP # # abs_ => absolute path abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ COPY_P = @COPY_P@ $(top_builddir)/CLHEP: temp-package-dirs @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ if test -d "$$pkg" ; then \ (cd $$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d ../"$$pkg"/"$$pkg" ; then \ (cd ../$$pkg/$$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg"; then \ hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ else \ if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/include/CLHEP; then \ if test -d $(CLHEP_DIR)/include/CLHEP/"$$pkg"; then \ hdrs=`ls $(CLHEP_DIR)/include/CLHEP/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEP_DIR)/include/CLHEP/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ fi; \ fi; \ fi; \ fi; \ fi; \ done; temp-package-dirs: $(mkinstalldirs) $(abs_top_builddir)/CLHEP; @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ $(mkinstalldirs) $(abs_top_builddir)/CLHEP/$$pkg; \ done; docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs # extra clean rule clean-local: rm -rf $(top_builddir)/CLHEP clhep-2.1.4.1.orig/Fields/bootstrap0000755000175000017500000000071511422362354015553 0ustar olesoles#! /bin/sh set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 rm -f Makefile.in */Makefile.in */defs.h.in rm -f autotools/config* autotools/depcomp autotools/install-sh autotools/m* rm -f configure config.* # run autotool commands aclocal -I autotools autoheader automake --add-missing --copy autoconf # ready to make a source code distribution tarball clhep-2.1.4.1.orig/Fields/configure.ac0000755000175000017500000002715712241267303016110 0ustar olesoles# ====================================================================== # This is the Fields configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.57) AC_INIT(CLHEP Fields, 2.1.4.1, CLHEP@cern.ch, Fields) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([src/XF.cc]) AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # ---------------------------------------------------------------------- # --enable-shared and --enable-static # both shared and static libraries are built by default # ---------------------------------------------------------------------- AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Header containing #defines: AM_CONFIG_HEADER([Fields/defs.h]) # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Fields/Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([Fields-deps]) AC_CONFIG_FILES([Fields/copy-header.pl], [chmod +x Fields/copy-header.pl]) # Configuration inquiry program/script: AC_CONFIG_FILES([Fields-config], [chmod +x Fields-config]) # Test driver program/script: AC_CONFIG_FILES([test/testXF.sh], [chmod +x test/testXF.sh]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- Fields_CPPFLAGS="-I$includedir" Fields_LDFLAGS="-L$libdir" Fields_LIBS="-lCLHEP-$PACKAGE-$VERSION -lCLHEP-Geometry-$VERSION -lCLHEP-GenericFunctions-$VERSION" AC_SUBST(Fields_CPPFLAGS) AC_SUBST(Fields_LIBS) AC_SUBST(Fields_LDFLAGS) # ---------------------------------------------------------------------- # Supply boilerplate for Fields/defs.h source header: # ---------------------------------------------------------------------- AH_TOP([#ifndef FIELDS_DEFS_H #define FIELDS_DEFS_H]) ## the undefs are converted by configure AH_VERBATIM([PACKAGE],[/* Name of package */ #ifndef PACKAGE #undef PACKAGE #endif]) AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif]) AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */ #ifndef PACKAGE_NAME #undef PACKAGE_NAME #endif]) AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #undef PACKAGE_STRING #endif]) AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif]) AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */ #ifndef PACKAGE_VERSION #undef PACKAGE_VERSION #endif]) AH_VERBATIM([VERSION],[/* Version number of package */ #ifndef VERSION #undef VERSION #endif]) AH_BOTTOM([#endif // FIELDS_DEFS_H]) # ---------------------------------------------------------------------- # Account for any user configuration options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; icc) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Set system-dependent options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed libraries: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed header files: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed typedefs, structures, and compiler characteristics: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed library functions: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/Fields/COPYING.LESSER0000644000175000017500000001674311406234130015637 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/Fields/Fields-config.in0000755000175000017500000000404612234340066016613 0ustar olesoles#! /bin/sh # @configure_input@ # we include the paths of the original install directories for reference orig_prefix="@prefix@" orig_exec_prefix="@exec_prefix@" orig_includedir="@includedir@" # use the full name of this script to get the current path configpath=`dirname ${0}` # check for a leading slash to determine if this is a relative path firstc=`expr ${configpath} : "\/"` calldir=`pwd` if [ ${firstc} -eq 0 ] then cd "${calldir}/${configpath}"; newpath=`pwd` binpath=${newpath} else binpath=${configpath} fi # OK - now we have to strip the trailing "/bin" out of the path prefix=`dirname "${binpath}"` includedir=${prefix}/include libdir=${prefix}/lib usage() { cat < Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/Fields/test/0000755000175000017500000000000012242515220014555 5ustar olesolesclhep-2.1.4.1.orig/Fields/test/Makefile.am0000755000175000017500000000524311406231616016625 0ustar olesoles if USE_GMAKE MAKE = gmake endif # Applicable to each test program: INCLUDES = -I$(top_builddir)/ # libraries to link, and whence if BUILD_STATIC LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.a \ ${top_builddir}/../Geometry/src/libCLHEP-Geometry-@VERSION@.a \ ${top_builddir}/../GenericFunctions/src/libCLHEP-GenericFunctions-@VERSION@.a \ ${top_builddir}/../Vector/src/libCLHEP-Vector-@VERSION@.a OUTFLAG = -o $@ else if BUILD_VISUAL LDADD = $(top_builddir)/src/CLHEP-@PACKAGE@-@VERSION@.$(SHEXT) \ ${top_builddir}/../Geometry/src/CLHEP-Geometry-@VERSION@.$(SHEXT) \ ${top_builddir}/../GenericFunctions/src/CLHEP-GenericFunctions-@VERSION@.$(SHEXT) \ ${top_builddir}/../Vector/src/CLHEP-Vector-@VERSION@.$(SHEXT) OUTFLAG = /Fo$@ else LIBS += $(MY_LD)$(top_builddir)/src \ $(MY_LD)${top_builddir}/../Geometry/src \ $(MY_LD)${top_builddir}/../GenericFunctions/src \ $(MY_LD)${top_builddir}/../Vector/src LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.$(SHEXT) \ ${top_builddir}/../Geometry/src/libCLHEP-Geometry-@VERSION@.$(SHEXT) \ ${top_builddir}/../GenericFunctions/src/libCLHEP-GenericFunctions-@VERSION@.$(SHEXT) \ ${top_builddir}/../Vector/src/libCLHEP-Vector-@VERSION@.$(SHEXT) OUTFLAG = -o $@ endif endif # normally, CXXLINK is supplied by automake, but we need to use /Fo instead # of -o when compiling with Visual C++ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ $(OUTFLAG) # Identify executables needed during testing: check_PROGRAMS = \ testXF check_SCRIPTS = \ testXF.sh # Identify test(s) to run when 'make check' is requested: TESTS = \ testXF.sh # Identify the test(s) for which failure is the intended outcome: XFAIL_TESTS = # Identify the dependencies on a per-test basis: testXF_SOURCES = testXF.cc # Identify input data file(s) and prototype output file(s): EXTRA_DIST = \ testXF.input testXF.output # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = testXF.sh # supply our own suffix rule .cc.obj: if BUILD_VISUAL # $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c $(OUTFLAG) `$(CYGPATH_W) '$<'` # mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po source='$<' object='$@' libtool=no \ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ $(CXXCOMPILE) -c $(OUTFLAG) `$(CYGPATH_W) '$<'` else if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c $(OUTFLAG) `$(CYGPATH_W) '$<'`; \ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi # source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ # $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` endif clhep-2.1.4.1.orig/Fields/test/testXF.cc0000755000175000017500000000031211406234130016277 0ustar olesoles// -*- C++ -*- // $Id: // --------------------------------------------------------------------------- #include #include #include "CLHEP/Fields/XF.h" int main() { return 0; } clhep-2.1.4.1.orig/Fields/test/.cvsignore0000755000175000017500000000001411406234724016563 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Fields/test/testXF.sh.in0000755000175000017500000000030311406234130016731 0ustar olesoles#! /bin/sh # @configure_input@ # right now, testXF.cc is an empty placeholder #./testXF@EXEEXT@ < @srcdir@/testXF.input \ # | diff -b -q - @srcdir@/testXF.output > /dev/null ./testXF@EXEEXT@ clhep-2.1.4.1.orig/Fields/test/testXF.output0000755000175000017500000000006007777755631017310 0ustar olesoles(1,2,3) (1,2,3) (1,2,3) (1,2,3) (1,2,3) (1,2,3) clhep-2.1.4.1.orig/Fields/test/testXF.input0000755000175000017500000000014707777755631017115 0ustar olesoles(1,2,3) (1.,2.,3.) (1.0,2.0,3.0) (1e+00,2e+00,3e+00) (1.e+00,2.e+00,3.e+00) (1.0e+00,2.0e+00,3.0e+00) clhep-2.1.4.1.orig/Fields/Fields/0000755000175000017500000000000012242515221015005 5ustar olesolesclhep-2.1.4.1.orig/Fields/Fields/copy-header.pl.in0000755000175000017500000000164110050331750020152 0ustar olesoles#!/usr/bin/env perl # # copy a header into the temporary CLHEP header tree if # a) the header is not already there # b) the source is newer # if ($#ARGV != 1) { print "mungeit requires two arguments - exit\n"; exit; } else { $source_header=$ARGV[0]; $dest_header=$ARGV[1]; &check_header; } exit; sub check_header { # make sure source exists if ( ! -e $source_header ) { print "$source_header does not exist - exit\n"; exit; } # copy if not already there - otherwise, check the time stamp if ( ! -e $dest_header ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } else { $source_header_time = -M $source_header; $dest_header_time = -M $dest_header; # copy only if source is newer if( $source_header_time < $dest_header_time ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } } } clhep-2.1.4.1.orig/Fields/Fields/Makefile.am0000755000175000017500000000125410050331750017044 0ustar olesoles## Process this file with automake to produce Makefile.in includedir = $(prefix)/include/CLHEP tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@ COPY_P = @COPY_P@ pkginclude_HEADERS = \ XF.h \ defs.h # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = defs.h # copy headers into $(tempincludedir) install-tmpHEADERS: @echo " install headers in $(tempincludedir) " @list='$(pkginclude_HEADERS)'; \ if test $(tempincludedir); then \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ ./copy-header.pl $$d$$p $(tempincludedir)/$$f; \ done; \ fi; test -z "$$fail" clhep-2.1.4.1.orig/Fields/Fields/.cvsignore0000755000175000017500000000002611406234724017015 0ustar olesolesMakefile.in defs.h.in clhep-2.1.4.1.orig/Fields/Fields/XF.h0000755000175000017500000001576407777761577015555 0ustar olesoles//---------------XF::Function (transformation field)--------------------// // // // XF::Function, class of function objects which evaluate to a // // evaluate to a HepTransform, and a class XF::Pow which can be // // used to exponentiate any transform. The transformations fields // // can be multiplied together or multiplied with a fixed global // // transformation. These can be used to build arbitrary // // HepTransform3D-valued-fields which are very compact. Chief // // application so far is in geometry modelling where it is a // // powerful technique for parameterization. // // // // Example: // // // // // Define some constants: // // int N; // // double c1, c2, r, z; // // // // // Construct a simple linear function of a variable i: // // // // Variable i; // // // // GENFUNCTION g = c1+c2*i; // // // // // Create a transfunction // // // // TRANSFUNCTION xf = Pow(HepRotateZ3D(1),g)* // // HepTranslateX3D(r)* // // HepTranslateZ3D(z); // // // // // Evaluation of TRANSFUNCTION // // // // HepTransform3D x = xf(33.2); // // // // // // ... // // Similar techniques may be used to create a transformation field of // // more than one variable. // // // // // //----------------------------------------------------------------------// #ifndef TransformFunction_h #define TransformFunction_h 1 #include "CLHEP/GenericFunctions/AbsFunction.hh" #include "CLHEP/GenericFunctions/Argument.hh" #include "CLHEP/Geometry/Transform3D.h" //-----------------------------------------------------------------------// // Exact return type of arithmentic operations. To the user, the return // // type is TRANSFUNCTION, or const XF::Function &. // //-----------------------------------------------------------------------// namespace XF { class Product; class PreMult; class PostMult; class Pow; class Function { public: // Default Constructor Function (); // Destructor virtual ~ Function (); // Function value: N-dimensional functions must override these: virtual unsigned int dimensionality () const; //returns 1; // Function value virtual HepGeom::Transform3D operator () (double argument) const = 0; virtual HepGeom::Transform3D operator () (const Genfun:: Argument & argument) const = 0; // Every function must override this: virtual Function *clone () const = 0; // Copy constructor Function (const Function & right); private: // Assignment operator const Function & operator = (const Function & right); }; class Pow:public Function { public: Pow (const HepGeom::Transform3D &, Genfun::GENFUNCTION f); virtual ~ Pow (); virtual HepGeom::Transform3D operator () (double argument) const; virtual HepGeom::Transform3D operator () (const Genfun:: Argument & argument) const; // Every function must override this: Pow *clone () const; // Copy constructor: Pow (const Pow & right); private: // Assignment operator const Pow & operator = (const Pow & right); const HepGeom::Transform3D xf; const Genfun::AbsFunction * function; }; Product operator * (const Function & op1, const Function & op2); PreMult operator * (const HepGeom::Transform3D & xf, const Function & op2); PostMult operator * (const Function & op2, const HepGeom::Transform3D & xf); // Internally used class:: Product: class Product:public Function { public: Product (const Function * arg1, const Function * arg2); virtual ~ Product (); virtual unsigned int dimensionality () const; virtual HepGeom::Transform3D operator () (double argument) const; virtual HepGeom::Transform3D operator () (const Genfun:: Argument & argument) const; // Every function must override this: virtual Product *clone () const; // Copy constructor: Product (const Product & right); private: const Function *_arg1; const Function *_arg2; }; // Internally used class:: PreMult : class PreMult:public Function { public: PreMult (const HepGeom::Transform3D & arg1, const Function * arg2); virtual ~ PreMult (); virtual unsigned int dimensionality () const; virtual HepGeom::Transform3D operator () (double argument) const; virtual HepGeom::Transform3D operator () (const Genfun:: Argument & argument) const; // Every function must override this: virtual PreMult *clone () const; // Copy constructor: PreMult (const PreMult & right); private: const HepGeom::Transform3D _arg1; const Function *_arg2; }; // Internally used class:: PostMult : class PostMult:public Function { public: PostMult (const Function * arg1, const HepGeom::Transform3D & arg2); virtual ~ PostMult (); virtual unsigned int dimensionality () const; virtual HepGeom::Transform3D operator () (double argument) const; virtual HepGeom::Transform3D operator () (const Genfun:: Argument & argument) const; // Every function must override this: virtual PostMult *clone () const; // Copy constructor: PostMult (const PostMult & right); private: const Function *_arg1; const HepGeom::Transform3D _arg2; }; typedef const Function & TRANSFUNCTION; } #endif clhep-2.1.4.1.orig/Fields/ChangeLog0000644000175000017500000000255312241267303015362 0ustar olesoles============================== 14.11.13 Release CLHEP-2.1.4.1 ============================== ============================== 05.11.13 Release CLHEP-2.1.4.0 ============================== ============================== 14.11.12 Release CLHEP-2.1.3.1 ============================== ============================== 06.11.12 Release CLHEP-2.1.3.0 ============================== ============================== 16.08.12 Release CLHEP-2.1.2.5 ============================== ============================== 09.07.12 Release CLHEP-2.1.2.4 ============================== ============================== 31.05.12 Release CLHEP-2.1.2.3 ============================== ============================== 14.02.12 Release CLHEP-2.1.2.2 ============================== ============================== 06.02.12 Release CLHEP-2.1.2.1 ============================== ============================== 16.12.11 Release CLHEP-2.1.2.0 ============================== ============================== 29.07.11 Release CLHEP-2.1.1.0 ============================== ============================== 11.11.10 Release CLHEP-2.1.0.1 ============================== ============================== 23.07.10 Release CLHEP-2.1.0.0 ============================== ============================== 16.06.10 Release CLHEP-2.1.0.0.b01 ============================== 2010-06-11 Lynn Garren * CLHEP now uses the LGPL license. clhep-2.1.4.1.orig/Fields/autotools/0000755000175000017500000000000012242515221015630 5ustar olesolesclhep-2.1.4.1.orig/Fields/autotools/.cvsignore0000755000175000017500000000010111406234724017632 0ustar olesolesconfig.sub config.guess depcomp install-sh missing mkinstalldirs clhep-2.1.4.1.orig/Fields/autotools/ltmain.sh0000755000175000017500000057547211406234724017506 0ustar olesoles# Generated from ltmain.in; do not edit by hand # ltmain.sh (GNU libtool) 1.9b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: powerpc-apple-darwin7.5.0 # shell: $SHELL # compiler: $LTCC # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 1.9b # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST elif test -n "${BASH_VERSION+set}${KSH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh dirname="s,/[^/]*$,," basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: PROGRAM=ltmain.sh progname=`echo "$progpath" | $SED "$basename"` # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *) progdir=`echo "$progpath" | $SED "$dirname"` progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; esac # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.9b TIMESTAMP="" package_revision=1.1571 # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $echo $progname${mode+: }$mode: warning: ${1+"$@"} 1>&2 } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } # func_version # Echo version message to standard output and exit. func_version () { $SED '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# //; s/^# *$//; s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED '/^# Usage:/,/# -h/ { s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" echo echo "run \`$progname --help | more' for full usage" exit $EXIT_SUCCESS } # func_help # Echo long help message to standard output and exit. func_help () { $SED '/^# Usage:/,/# Report bugs to/ { s/^# //; s/^# *$//; s:\$progname:'$progname':; s:\$SHELL:'"$SHELL"':; s:\$LTCC:'"$LTCC"':; s:\$LD:'"$LD"':; s/\$with_gnu_ld/'"$with_gnu_ld"'/; s/\$automake_version/'"`automake --version 2>/dev/null |$SED 1q`"'/; s/\$autoconf_version/'"`autoconf --version 2>/dev/null |$SED 1q`"'/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $EXIT_SUCCESS } # func_features # Display the features supported by this script. func_features () { $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable "`\"foo\"`", so we have to do # it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $echo \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $echo $echo "Try \`$progname --help' for more information about other modes." exit $EXIT_SUCCESS } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # sed scripts: my_sed_single_opt='1s/^\(..\).*$/\1/;q' my_sed_single_rest='1s/^..\(.*\)$/\1/;q' my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' exit_cmd=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set -- --mode clean ${1+"$@"} ;; compile|compil|compi|comp|com|co|c) shift; set -- --mode compile ${1+"$@"} ;; execute|execut|execu|exec|exe|ex|e) shift; set -- --mode execute ${1+"$@"} ;; finish|finis|fini|fin|fi|f) shift; set -- --mode finish ${1+"$@"} ;; install|instal|insta|inst|ins|in|i) shift; set -- --mode install ${1+"$@"} ;; link|lin|li|l) shift; set -- --mode link ${1+"$@"} ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set -- --mode uninstall ${1+"$@"} ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" set -x ;; --dlopen) test $# -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" ;; --dry-run | -n) run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test $# -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" show=: ;; --tag) test $# -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: --dlopen=*|--mode=*|--tag=*) arg=`echo "$opt" | $SED "$my_sed_long_arg"` opt=`echo "$opt" | $SED "$my_sed_long_opt"` set -- "$opt" "$arg" ${1+"$@"} ;; # Separate optargs to short options: # -x*|-y*) # arg=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "$arg" ${1+"$@"} # ;; # Separate non-argument short options: # -z*|-z*|-y*) # rest=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "-$rest" ${1+"$@"} # ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`echo "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$my_dlsyms" test -z "$run" && $echo > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do $show "extracting global C symbols from \`$progfile'" $run eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for dlprefile in $dlprefiles; do $show "extracting global C symbols from \`$dlprefile'" name=`$echo "$dlprefile" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ const struct { const char *originator; const struct { const char *name; void *address; } symbols[]; } lt_${my_prefix}_LTX_preloaded_symbols = {\ \"$my_originator\", { " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" $echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} } }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" status=$? if test "$status" -ne 0 && test ! -d "$my_xdir"; then exit $status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename $darwin_archive` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" # Remove the table of contents from the thin files. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" $AR -xo "${darwin_base_archive}" rm "${darwin_base_archive}" cd "$darwin_curdir" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist rm -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir (cd $my_xdir && $AR x $my_xabs) || exit $? fi # $darwin_arches fi # $run ;; *) # We will extract separately just the conflicting names and we will # no longer touch any unique names. It is faster to leave these # extract automatically by $AR in one run. $show "(cd $my_xdir && $AR x $my_xabs)" $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; renaming object files" func_warning "to ensure that they will not overwrite" $AR t "$my_xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_mode_compile arg... func_mode_compile () { # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1 || \ func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi } # func_mode_finish arg... func_mode_finish () { libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit $EXIT_SUCCESS } # func_mode_install arg... func_mode_install () { # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files test "$#" -gt 2 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. (${SED} -e '2q' $file | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1 || \ func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" $show "$relink_command" $run eval "$relink_command" || \ func_fatal_error "error: relink \`$file' with the above command before installing it" fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | $GREP "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. test -z "$notinst_deplibs" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask func_error "error: cannot create temporary directory \`$tmpdir'" continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" ${rm}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } # func_mode_link arg... func_mode_link () { case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static # See comment for -static flag below, for more details. compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" || \ func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else func_fatal_error "link input file \`$save_arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) # The effects of -all-static are defined in a previous loop. continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs $inherited_linker_flags" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *[\\/]*.la) . $lib ;; *.la) . ./$lib ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`echo "$deplib" |$SED "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$inherited_linker_flags " in *" $deplib "*) ;; * ) inherited_linker_flags="$inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $lib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not use here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib'" fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then : else func_fatal_error "\`$lib' is not a valid libtool archive" fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac case $host in *-*-darwin*) # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then inherited_linker_flags=`$echo "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` fi dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP "bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $echo "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "*** And there doesn't seem to be a static archive available" $echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs $inherited_linker_flags; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" eval darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//' | xargs` compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for archives" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath test "$#" -gt 2 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" test -n "$8" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "AGE \`$age' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | ${SED} 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null | ${SED} 10q | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` inherited_linker_flags=`$echo "X $inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$echo "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`echo "$output" | $SED $basename` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnk $echo "creating GNU ld script: $output" $echo 'INPUT (' > $output for obj in $save_libobjs do $echo \""$obj"\" >> $output done $echo ')' >> $output else $echo "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for objects" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; struct stat st; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$dlsymsobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; overriding AR_FLAGS to 'cq'" func_warning "to ensure that POSIX-compatible ar will work" AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS } # func_mode_uninstall arg... func_mode_uninstall () { rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done test -z "$rm" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 || (test -h "$file") >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status } ## ----------- ## ## Main. ## ## ----------- ## { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." case $mode in compile) func_mode_compile ${1+"$@"} ;; execute) func_mode_execute ${1+"$@"} ;; finish) func_mode_finish ${1+"$@"} ;; install) func_mode_install ${1+"$@"} ;; link|relink) func_mode_link ${1+"$@"} ;; uninstall|clean) func_mode_uninstall ${1+"$@"} ;; "") help="$generic_help" func_fatal_help "you must specify a MODE" ;; esac test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi } exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: clhep-2.1.4.1.orig/Fields/src/0000755000175000017500000000000012242515221014366 5ustar olesolesclhep-2.1.4.1.orig/Fields/src/Makefile.am0000755000175000017500000000357711406231616016445 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir) -I$(top_srcdir) libCLHEP_Fields_@VERSION@_a_SOURCES = XF.cc libCLHEP_Fields_@VERSION@_so_OBJECTS = $(patsubst %.cc,$(shareddir)/%.$(OBJEXT),$(libCLHEP_Fields_@VERSION@_a_SOURCES)) # these if/else blocks will be parsed by automake and translated if BUILD_SHARED shareddir = shared if BUILD_VISUAL lib_shared = CLHEP-Fields-@VERSION@.$(SHEXT) else lib_shared = libCLHEP-Fields-@VERSION@.$(SHEXT) LDADD = -L${top_builddir}/../Geometry/src -lCLHEP-Geometry-@VERSION@ \ -L${top_builddir}/../GenericFunctions/src -lCLHEP-GenericFunctions-@VERSION@ \ -L${top_builddir}/../Vector/src -lCLHEP-Vector-@VERSION@ endif SHFLAGS = @MY_SHFLAGS@ SHLINK = @MY_SHLINK@ @MY_SHEXTRA@ SHNAME = @MY_SHNAME@ endif if BUILD_STATIC lib_LIBRARIES = libCLHEP-Fields-@VERSION@.a endif CLEANFILES = $(lib_shared) all-local: $(shareddir) $(lib_shared) $(shareddir): test -d $(shareddir) || mkdir $(shareddir) if BUILD_VISUAL $(lib_shared): $(libCLHEP_Fields_@VERSION@_so_OBJECTS) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Fields_@VERSION@_so_OBJECTS) $(LDADD) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) /c /Fo$@ $< else $(lib_shared): $(libCLHEP_Fields_@VERSION@_so_OBJECTS) $(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Fields_@VERSION@_so_OBJECTS) $(LDADD) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) -c -o $@ $< endif install-exec-local: $(lib_shared) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_shared)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$p'"; \ $(INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done clean-local: -test -d $(shareddir) && rm -f $(shareddir)/*.$(OBJEXT) distclean-local: -test -d $(shareddir) && rm -rf ./$(shareddir) clhep-2.1.4.1.orig/Fields/src/XF.cc0000755000175000017500000001307407777761577015264 0ustar olesoles#include "CLHEP/Fields/XF.h" #include #include namespace XF { //------------------------------------------------------------------// // // // Implementation of Function // // // //------------------------------------------------------------------// Function::Function () { } Function::~Function () { } Product operator * (const Function & a, const Function & b) { return Product (&a, &b); } PreMult operator * (const HepGeom::Transform3D & xf, const Function & b) { return PreMult (xf, &b); } PostMult operator * (const Function & a, const HepGeom::Transform3D & xf) { return PostMult (&a, xf); } unsigned int Function::dimensionality () const { return 1; } //------------------------------------------------------------------// // // // Implementation of Product // // // //------------------------------------------------------------------// Product::Product (const Function * arg1, const Function * arg2):_arg1 (arg1->clone ()), _arg2 (arg2->clone ()) { if (arg1->dimensionality () != arg2->dimensionality ()) { std::cout <<"Warning: dimension mismatch in XF::Product" << std::endl; assert(0); } } // Every function must override this: Product *Product::clone () const { return new Product (*this); } // Copy constructor: Product::Product (const Product & right):Function (), _arg1 (right._arg1->clone ()), _arg2 (right._arg2->clone ()) { } Product::~Product () { delete _arg1; delete _arg2; } unsigned int Product::dimensionality () const { return _arg1->dimensionality (); } HepGeom::Transform3D Product::operator () (double x) const { return (*_arg1) (x) * (*_arg2) (x); } HepGeom::Transform3D Product::operator () (const Genfun::Argument & x) const { return (*_arg1) (x) * (*_arg2) (x); } //------------------------------------------------------------------// // // // Implementation of PreMult // // // //------------------------------------------------------------------// PreMult::PreMult (const HepGeom::Transform3D & arg1, const Function * arg2):_arg1 (arg1), _arg2 (arg2->clone ()) { } // Every function must override this: PreMult *PreMult::clone () const { return new PreMult (*this); } // Copy constructor: PreMult::PreMult (const PreMult & right):Function (), _arg1 (right._arg1), _arg2 (right._arg2->clone ()) { } PreMult::~PreMult () { delete _arg2; } unsigned int PreMult::dimensionality () const { return _arg2->dimensionality (); } HepGeom::Transform3D PreMult::operator () (double x) const { return _arg1 * (*_arg2) (x); } HepGeom::Transform3D PreMult::operator () (const Genfun::Argument & x) const { return _arg1 * (*_arg2) (x); } //------------------------------------------------------------------// // // // Implementation of PostMult // // // //------------------------------------------------------------------// PostMult::PostMult (const Function * arg1, const HepGeom::Transform3D & arg2):_arg1 (arg1->clone ()), _arg2 (arg2) { } // Every function must override this: PostMult *PostMult::clone () const { return new PostMult (*this); } // Copy constructor: PostMult::PostMult (const PostMult & right):Function (), _arg1 (right._arg1->clone ()), _arg2 (right._arg2) { } PostMult::~PostMult () { delete _arg1; } unsigned int PostMult::dimensionality () const { return _arg1->dimensionality (); } HepGeom::Transform3D PostMult::operator () (double x) const { return (*_arg1) (x) * _arg2; } HepGeom::Transform3D PostMult::operator () (const Genfun::Argument & x) const { return (*_arg1) (x) * _arg2; } Pow::Pow (const HepGeom::Transform3D & xform, Genfun::GENFUNCTION f):xf (xform), function (f.clone ()) { } Pow::~Pow () { delete function; } HepGeom::Transform3D Pow::operator () (double x) const { // // Get the translation part and the rotation part: // CLHEP::HepRotation rotate = xf.getRotation (); CLHEP::Hep3Vector translate = xf.getTranslation (); CLHEP::HepAxisAngle aa = rotate.axisAngle (); // // Evaluate the function // double nTimes = (*function) (x); // // Modify: // translate *= nTimes; aa.setDelta (aa.delta () * nTimes); // // Now compose these and return a result: // return HepGeom::Translate3D (translate) * HepGeom::Rotate3D (aa.delta (), aa.axis ()); } HepGeom::Transform3D Pow::operator () (const Genfun::Argument & argument) const { return operator () (argument[0]); } Pow *Pow::clone () const { return new Pow (*this); } Pow::Pow (const Pow & right):Function (), xf (right.xf), function (right.function->clone ()) { } } clhep-2.1.4.1.orig/Fields/src/.cvsignore0000755000175000017500000000001411406234724016373 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/setup.cygwin-VC710000755000175000017500000000161311406214373015442 0ustar olesoles # Set up to find the VC71 compiler (assuming a standard # installation) and the other tools used by it ... export VSPATH="/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003" export PATH="/cygdrive/c/WINNT/Microsoft.NET/Framework/v1.1.4322":${PATH} export PATH="${VSPATH}/SDK/v1.1/bin":${PATH} export PATH="${VSPATH}/Common7/Tools/bin":${PATH} export PATH="${VSPATH}/Common7/Tools/bin/prerelease":${PATH} export PATH="${VSPATH}/Common7/Tools/":${PATH} export PATH="${VSPATH}/Vc7/bin":${PATH} export PATH="${VSPATH}/Common7/IDE":${PATH} # include and lib are interpreted by the compiler, so use win syntax export INCLUDE="c:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/include;C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include" export LIB="c:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/lib;C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib" clhep-2.1.4.1.orig/ChangeLog0000755000175000017500000042756412242515016014172 0ustar olesoles============================== 18.11.13 Release CLHEP-2.1.4.1 ============================== 2013-11-18 Lynn Garren * src/setSystemOfUnits.cc: additional units to match Units 2013-11-14 Lynn Garren * Random/Random/Randomize.h: include RandExpZiggurat and RandGaussZiggurat * configure.ac: change for unsupported Darwin build with autotools ============================== 05.11.13 Release CLHEP-2.1.4.0 ============================== 2013-11-04 Lynn Garren * Random/test: make sure all output streams have unique names * Random/RandGaussZiggurat - abs type correctness 2013-10-31 Lynn Garren * Random/src/RandGaussZiggurat.cc - fix potential shadowing issue * Random/src/RandExpZiggurat.cc - fix potential shadowing issue * Units/Units/SystemOfUnits.h: adding definitions for curies * Units/test/testUnits.cc: use the same M_PI logic as found elsewhere * clhep-config: fix for OSX * cmake/Modules/ClhepBuildTex.cmake: don't try to install a file that has not been created 2013-09-26 Lynn Garren * Random: including RandGaussZiggurat and RandExpZiggurat 2013-01-11 Lynn Garren * Matrix: change the names of more internal variables so -Wshadow does not complain ============================== 14.11.12 Release CLHEP-2.1.3.1 ============================== 2012-11-14 Lynn Garren * Vector: clean up naming overlap between Units and internal variables ============================== 06.11.12 Release CLHEP-2.1.3.0 ============================== 2012-11-08 Lynn Garren * creation of symbolic links now respects DESTDIR 2012-09-06 Joe Boudreau * MATRIX/DiagMatrix, MATRIX/GenMatrix, MATRIX/SymMatrix: Added two methods to [-,Diag,Sym]Matrix to carry out the matrix inversion without the users needing to provide an ierr flag. These methods are all inline and called invert() and inverse(), so they overload the existing inversion routines for the relevant class. If an error occurs, then an std::runtime_error is thrown. 2012-08-22 Lynn Garren * clhep-config: fix for Mountain Lion ============================== 16.08.12 Release CLHEP-2.1.2.5 ============================== 2012-08-15 Lynn Garren * GenericFunctions: latest changes from Joe Boudreau * GenericFunctions: change the names of internal variables so -Wshadow does not complain 2012-08-14 Lynn Garren * cmake/Modules: use OUTPUT_STRIP_TRAILING_WHITESPACE with execute_process commands * CMakeLists.txt, cmake/Modules: enable -DLIB_SUFFIX=64 2012-08-07 Lynn Garren * Vector/LorentzVector.h: make the HepLorentzVector(double t) constructor explicit ============================== 09.07.12 Release CLHEP-2.1.2.4 ============================== 2012-07-09 L. Garren * cmake/Modules: enclose CMAKE_COMMAND in quotes when inside execute_process * test shell scripts: make sure any paths are enclosed in quotes 2012-06-25 L. Garren * cmake/Modules: Use newer execute_process instead of exec_program Try to cope with special characters in path ============================== 31.05.12 Release CLHEP-2.1.2.3 ============================== 2012-05-31 Lynn Garren * Random: fix for shadowing when global units used * Vector: fix for shadowing when global units used USING_VISUAL code blocks are no longer needed 2012-05-30 Lynn Garren * GenericFunctions: latest changes from Joe Boudreau * Matrix: cleanup for -Wextra 2012-05-11 Lynn Garren * Vector, Evaluator, Random, Geometry: use explicit std:: with math functions ============================== 14.02.12 Release CLHEP-2.1.2.2 ============================== 2012-02-14 L. Garren * cmake/Modules/ClhepVariables.cmake: make sure config files are executable add clhep_package_config_no_lib() ============================== 06.02.12 Release CLHEP-2.1.2.1 ============================== 2012-02-03 Lynn Garren * Random/src/Ranlux64Engine.cc: use a template to get rid of the warnings 2012-02-02 Lynn Garren * GenericFunctions/GenericFunctions/ClassicalSolver.hh: make destructor virtual * GenericFunctions/src/PhaseSpace.cc: fix typo, GenFun::Variable index() returns unsigned int, not double * GenericFunctions/src/InterpolatingPolynomial.cc: deal with int comparison 2012-02-02 Lynn Garren * Vector, Geometry, Random, Matrix, Exceptions : change the names of internal variables so -Wshadow does not complain 2012-01-31 Lynn Garren and Mark Fischler * Evaluator/src/Evaluator.cc: fix a problem with unary +/- and exponentials * Evaluator/test/testBug90848.cc: new test for bug #90848 ============================== 16.12.11 Release CLHEP-2.1.2.0 ============================== 2011-12-15 Lynn Garren * cmake is now the preferred build option * building with autotools and configure is deprecated * you MUST use cmake when building with clang and other exotic compilers * various improvements to the cmake build from Ben Morgan (Warwick) * to build documents, call cmake with -DCLHEP_BUILD_DOCS=ON * lib/CLHEP- contains cmake files for use by find_package * lib/pkgconfig contains clhep.pc ============================== 29.07.11 Release CLHEP-2.1.1.0 ============================== 2011-07-12 Lynn Garren * cmake/Templates/ClhepVersion.h.in: cmake template for ClhepVersion.h 2011-07-11 Lynn Garren * CMakeLists.txt: adding the ability to build with cmake * cmake/Modules: utility macros for cmake 2011-06-06 Lynn Garren * clhep-config: Since the clhep installation may have been relocated, use the full path to clhep-config to get the install prefix. Note that this presumes that bin, lib, and include are all under the same $prefix. 2011-05-27 Mark Fischler and Lynn Garren * Random/Random/RandSkewNormal.h, Random/Random/RandSkewNormal.icc, Random/src/RandSkewNormal.cc: An implementation of the Azzalini skew-normal distribution, as requested in bug #75534 ============================== 11.11.10 Release CLHEP-2.1.0.1 ============================== 2010-10-25 Lynn Garren * Random/Random/NonRandomEngine.h, Random/Random/RandomEngine.h, Random/Random/RandomEngine.icc, Random/src/RandomEngine.cc: minor changes to avoid compilation warnings when using the -W flag 2010-10-21 Mark Fischler and Lynn Garren * Random/src/Ranlux64Engine.cc: fix problem with random numbers when seed is greater than 32bits * Random/test/testBug73093.cc: test for the Ranlux64Engine problem ============================== 23.07.10 Release CLHEP-2.1.0.0 ============================== 2010-07-23 Lynn Garren * renamed configure.in to configure.ac in all packages 2010-07-22 Lynn Garren * GenericFunctions/src/AnalyticConvolution.cc: replace finite with std::isfinite (for MacOSX) use _finite from float.h if _WIN32 (for VC++) 2010-06-30 Lynn Garren * Random/src/Hurd160Engine.cc, Hurd288Engine.cc: deal with an undefined order of execution warning reported by gcc 4.5 2010-06-29 Mark Fischler * Evaluator/src/Evaluator.cc: Improve the logic so that unary plus and minus work as expected. See bug report #66214. 2010-06-28 Lynn Garren * Evaluator/Evaluator/Evaluator.h: Add error_name() method to return the error as a string * Evaluator/test/testBug66214.cc: Test unary operator bug (report #66214) 2010-06-23 Mark Fischler and Lynn Garren * Random/Random/RanecuEngine.h: add a private method (see below) * Random/src/RanecuEngine.cc: Modify constructor and setSeed to utilize all info provided and avoid coincidence of same state from different seeds * Random/test/testRanecuSequence.cc: test for repeating sequences 2010-03-09 Lynn Garren * GenericFunctions/src/RKIntegrator.cc: Add parentheses to fix a VC++ warning ============================== 16.06.10 Release CLHEP-2.1.0.0.b01 ============================== 2009/06/26 boudreau * GenericFunctions/src/AnalyticConvolution.cc: add protection to gauss and exp 2008/11/19 boudreau * GenericFunctions/GenericFunctions/CutBase.icc: fix compiler warnings 2007-01-23 boudreau * GenericFunctions/src/AnalyticConvolution.cc: patch for sigma=0 2007/01/21 boudreau * GenericFunctions/GenericFunctions/AbsFunction.hh: use new ParameterComposition * GenericFunctions/GenericFunctions/Bessel.icc: bug fix (remove extra "inline") * GenericFunctions: added Airy.hh Gamma.hh GammaDistribution.hh KroneckerDelta.hh Legendre.hh ParameterComposition.hh SymToArgAdaptor.hh ============================== 11.06.10 Release CLHEP-2.0.5.0.b01 ============================== 2010-06-11 Lynn Garren * CLHEP now uses the LGPL license. * Matrix: inline virtual functions are now only virtual and not inline 2010-04-29 Lynn Garren * Random now depends on Utility 2010-03-19 W. E. Brown - New package Utility, inspired by useful bits of C++0X and Boost 2009-08-25 Lynn Garren * Vector/ThreeVector: Each constructor possibility is now a separate instance to avoid confusion if Hep3Vector is in the constructor of another function. ============================== 09.03.10 Release CLHEP-2.0.4.6 ============================== 2010-03-09 Lynn Garren * GenericFunctions/src/RKIntegrator.cc: Add parentheses to fix a VC++ warning 2010-03-08 Mark Fischler and Lynn Garren * Random/src/RandEngine.cc: Cast RAND_MAX to unsigned long to avoid gcc 4.4 warnings. * Random/src/RanecuEngine.cc: Fix a bug introduced in 2.0.4.5/1.9.4.5 which resulted in the inability to rollback the random state. * Random/test/testBug58950: test rolling back the random state ============================== 08.12.09 Release CLHEP-2.0.4.5 ============================== 2009-12-07 Lynn Garren * Random/test/testBug58950.cc: test for the 64bit bug 2009-12-01 Mark Fischler and Lynn Garren * Random/src/RanecuEngine.cc: Negative seeds are not allowed. In the past, negative seeds were ignored, resulting in a reproducable sequence. Instead, we now use the absolute value of any negative seeds. 2009-12-01 Mark Fischler and Lynn Garren * Random/Random/RanecuEngine.h, Random/src/RanecuEngine.cc: define maxSeq as a static const int since it contains the size of an array * Random/src/RanecuEngine.cc: ensure that all seeds are in the expected 32bit range. ============================== 12.11.09 Release CLHEP-2.0.4.4 ============================== 2009-11-10 Lynn Garren * GenericFunctions/src/Gaussian.cc, BivariateGaussian.cc, PtRelFcn.cc, TrivariateGaussian.cc: protect against M_PI in cmath * Matrix/test/testBug7328.cc: allow for heap collection before testing * Matrix/configure.in, Matrix/test/Makefile.am: finer control over testBug7328 * Exceptions/test/exctest2.cc, exctest3.cc: improve ansi compliance 2009-11-04 Lynn Garren * GenericFunctions/GenericFunctions/Bessel.icc, EllipticIntegral.icc: replace math.h with cmath ============================== 03.11.09 Release CLHEP-2.0.4.4.b01 ============================== 2009-11-03 Lynn Garren * */src/Makefile.am: use -L -l for dependencies 2009-08-25 Lynn Garren * configure.in, */configure.in: remove old -lcxa -lunwind icc flags ============================== 04.07.09 Release CLHEP-2.0.4.3 ============================== 2009-06-30 Lynn Garren * configure.in, */configure.in, */src/Makefile.am: Make sure that the shared library build picks up package dependencies. ============================== 18.11.08 Release CLHEP-2.0.4.2 ============================== 2008-11-18 Lynn Garren * Random/test/testVectorSave.cc: Add a test for bug #44156 * clhep-config.in, */*-config.in: get rid of undefined symbols 2008-11-13 Mark Fischler * Random/src/engineIDulong.cc: Fix problem that caused check for proper engine type to fail where an unsigned long is 64bits. (bug #44156) * Random/src/*Engine.cc: make sure that existing stored engine states don't break due to the change in engineIDulong.cc ============================== 04.11.08 Release CLHEP-2.0.4.1 ============================== 2008-11-04 Lynn Garren * Units/PhysicalConstants.h: update Avogadro, h_Planck, electron_mass_c2, proton_mass_c2, amu_c2, and k_Boltzmann to PDG 2008 values * Units/SystemOfUnits.h: update e_SI to PDG 2008 value * Units.tex: update for modern LaTeX ============================== 07.08.08 Release CLHEP-2.0.4.0 ============================== 2008-08-06 Lynn Garren * configure.in, Makefile.am, build-header.in: automatically create ClhepVersion.h during the build proceedure Version information is available as integers and the full string. 2008-07-17 Lynn Garren * various changes in Random to keep gcc 4.3 happy 2008-07-16 Lynn Garren * Matrix/src/SymMatrix.cc, Matrix.cc, DiagMatrix.cc, MatrixLinear.cc: Iterators were set to a nonexistent memory location in many places. Even though the iterators were not used, this operation is not allowed and causes problems with the newer VC++ compilers. In some cases, a more efficient rewrite was possible. ============================== 01.05.08 Release CLHEP-2.0.3.3 ============================== 2008-05-01 Lynn Garren * */test/Makefile.am: use "/Fo$@" instead of "-o $@" for Visual C++ 2008-04-30 Lynn Garren * configure.in: VC++ compiler flag -GX is replaced by -EHsc icc compiler flag -mp is replaced by -fp-model precise remove KCC from list of C++ compilers 2008-04-29 Lynn Garren * Units/PhysicalConstants.h: update h_Planck, electron_mass_c2, proton_mass_c2, neutron_mass_c2, and amu_c2 to PDG 2006 values * Units/SystemOfUnits.h: update e_SI to PDG 2006 value ============================== 18.10.07 Release CLHEP-2.0.3.2 ============================== 2007-10-18 Mark Fischler * RandPoissonQ.cc: Change fire(mena) to call shoot(theLocalEngine(),mean) instead of shoot(mean), which had caused "cross-talk" between modules that should not have affected eah other. ============================== 15.11.06 Release CLHEP-2.0.3.1 ============================== 2006-11-15 Lynn Garren * configure.in: change ordering of possible C++ compilers so that g++ remains the default compiler if icc is in the path ============================== 18.10.06 Release CLHEP-2.0.3.0 ============================== 2006-10-13 Lynn Garren * configure.in: build only static libraries when using gcc with cygwin 2006-10-05 Lynn Garren * configure.in: add flags for the Intel compiler (icc) 2006-09-29 Lynn Garren * configure.in. Makefile.am: stop building HepMC, HepPDT, and StdHep ============================== 20.06.06 Release CLHEP-2.0.2.3 ============================== 2006-05-17 Lynn Garren * configure.in: add support for g++4 2006-05-14 Andreas Pfeiffer * configure.in: add changes from Gabriele Cosmo for MacOSX ============================== 21.11.05 Release CLHEP-2.0.2.2 ============================== 2005-11-21 Lynn Garren * Makefile.am: Library for Windows Visual C++ is named CLHEP.lib. 2005-11-17 Lynn Garren * configure.in: Remove check for sstream so Windows will not generate spurious complaint. Remove HepPDT/StringStream.h. Remove Cast/StringStream.h. 2005-11-14 Lynn Garren * Vector/RotationInterfaces.h: Instantiate private destructors so that dictionary builders will not complain. 2005-11-04 Lynn Garren * HepPDT/addEvtGenParticles.cc: Bug fix 2005-11-03 Lynn Garren * Vector/configure.in, LorentzVector.icc Provide a flag to enable code differences when compiling with Visual C++. 2005-10-20 Lynn Garren * HepPDT/CommonParticleData.icc: Bug fix - low and high cutoffs for the width were not being saved. * Also write out cutoffs. 2005-07-27 Lynn Garren * HepPDT/convertTemporaryMap.icc: Fill DecayData properly. Also get proper particle names when parsing PDG table. ============================== 22.06.05 Release CLHEP-2.0.2.1 ============================== Wed Jun 22 2005 Andreas Pfeiffer * configure.in: changed soname to install_name for darwin targets, dylibs still don't build properly on 10.3/10.4, static libs ok. 2005-06-19 Lynn Garren * configure.in, Makefile.am: Use lib when building Visual C++ libraries. Disable shared library build for Solaris CC. ============================== 22.04.05 Release CLHEP-2.0.2.0 ============================== Fri Apr 22 2005 Andreas Pfeiffer * configure.in: changed flags for building dynamic libs on Mac OS X still problems building them for OS X 10.3, to be checked on 10.4 prepared for tagging release 1.9.2.0 Thu Apr 7 2005 Lynn Garren * configure.in: set AR and ARFLAGS 2005-03-15 Lynn Garren * examples are now installed 2005-03-15 Mark Fischler * engineIDulong.cc, engineIDulong.h DoubConv.cc, DoubConv.h EngineFactory.cc, ranRestoreTest.cc all Random Engine classes Add put() and get() methods to every engine transfering state to a vector of unsigned longs. Thu Mar 10 2005 Andreas Pfeiffer * Geometry/BasicVector3D.h : added operator to convert to Hep3Vector for backward compatibility (savannah bug id 6740) * Geometry/config.in, Geometry/test/testBug6740.cc, Geometry/test/testBug6740.sh, Geometry/test/testBug6740.output, Geometry/test/Makefile.am: added test for bug ID 6740 2005-02-14 Mark Fischler * JamesRandom.cc Check that seed is non-negative. Negative seeds give terrible sequences. 2005-02-11 Mark Fischler * RandPoissonQ.cc RandPoissonT.cc RandomEngine.cc Added missing implementations, per bug # 1806 (FireArray(), shootArray(), getTableSeeds) 2005-03-15 Mark Fischler * SymMatrix.cc, testBug7328.cc Repair of bug 7328, a memory leak encountered when inverting symmetric matrices above the size of 6x6. 2005-02-25 Mark Fischler * Matrix.cc, testBug6181.cc Repair of bug 6181, a serious error in inverting matrices above the size of 6x6. 2005-02-18 Lynn Garren * configure.in, Makefile.am: Stop using libtool. The newer releases of libtool seem to have dropped support for Windows Visual C++. 2005-02-14 Lynn Garren * */configure.in: Visual C++ flags are now "-EHsc -nologo -GR -GX -MD" 2005-02-03 Lynn Garren * configure.in: install step creates libCLHEP.a, libCLHEP.so, and/or libCLHEP.dylib by adding a symbolic link. * HepMC/GenParticle.h: define HepMC::GenParticle::setParticleID * HepPDT: define HepPDT::QQDecayTable::writeTable, HepPDT::QQChannel::write, and HepPDT::QQDecay::write 2005-02-02 Andreas PFEIFFER * */configure.in: modified compiler flags for windows: added "-O -GR -GX -MD" as this is needed for the multi-thread environments used. 2005-02-01 Lynn Garren * config: remove HEP_CC_NEED_SUB_WITHOUT_CONST from config/CLHEP.h. HEP_CC_NEED_SUB_WITHOUT_CONST has been defined to 1 in all cases for a long time. * Matrix: remove HEP_CC_NEED_SUB_WITHOUT_CONST ifdefs 2005-02-01 Andreas PFEIFFER * Geometry/Geometry/BasicVector3D.h : changed template specialisations for multiplication of vector with scalar and division of vector by scalar to use float scalars instead of double (savannah bug id 6523) 2005-01-31 Andreas PFEIFFER * Matrix/src/Matrix.h: fixed error in sub(int, int, int, int), savannah bug id 6176, added corresponding files (testBug6176*) in test/, updated Makefile.am accordingly to generate tests. Mon Dec 27 2004 Mark Fischler * *.cc and .h for all the engine classes. * Random.cc EngineFactory.cc StaticRandomStates.cc Ability to restore engines and distributions without knowing in the restoring program which type of engine was used in the saving program. Wed Dec 22 2004 Mark Fischler * Random.h StaticRandomState.h Random.cc StaticRandomState.cc Added HepRandom::saveStaticRandomState(ostream) and restore to istream. Mon Dec 20 2004 Mark Fischler * Random.h RandGauss.h RandFlat.h RandFlat.icc RandBit.h Random.cc RandGauss.cc RandFlat.cc Added static methods for save/restore to streams. Thu Dec 16 2004 Mark Fischler * Random/*.cc for all engines and distributions. * Random/test/ranRestoreTest.cc Added put and get methods, as well as ostream operations, so that engine and distribution instances can be saved and restored to/from streams. Thu Dec 16 Wed Dec 15 2004 Mark Fischler * RandPoissonQ.cc (RandPoissonT.cc) RandPoissonQ has a path, potentially taken when mean is more than 100, where an additional gaussian random number is needed. Instead we use the engine owned by the RandPoissonQ instance. This will affect in rare cases the values of random variates delivered by **instances** (not the shoot() methods) of RandPoissonQ and RandPoissonT. Thu Dec 16 Tue Dec 14 2004 Mark Fischler * RandGeneral.cc Modify local variable theIntegralPdf, using a std::vector instead of a double* pointing to a new-ed array. No behavioral change. Thu Dec 16 Fri Dec 3 2004 Mark Fischler * Random/*.cc for all engines * Random/test/ranRestoreTest.cc Modified engines and additional-state distributions so that restoreENgineState behaves better (error message and return instead of hang up) when file requested is not found. ============================== 30.11.04 Release CLHEP-2.0.1.2 ============================== Tue Nov 30 2004 Andreas Pfeiffer * Geometry/Plane3D.h: replaced wrong by in Point3D point(const Point3D & p) const { Mon Nov 29 2004 Mark Fischler * In LorentzVectorC.cc, in deltaR, fixed to use pp.deltaRPhi(w.getV()) Mon Nov 29 2004 Lynn Garren * Vector/src: add missing implemetations Fri Nov 26 2004 Andreas Pfeiffer * HepMC/doc/Makefile.in: add -o option to dvips, otherwise it prints on some systems ============================== 27.10.04 Release CLHEP-2.0.1.1 ============================== Wed Oct 27 2004 Andreas Pfeiffer * Geometry/BasicVector3D.h: made dtor virtual as this is a base class * Geometry/Transform3D.h: added virtual dtor for persistency. This may go away in later releases. Fri Sep 24 2004 Lynn Garren * use AM_CXXFLAGS * require autoconf 2.59, automake 1.9.1, and libtool 1.9b * Matrix: remove unnecessary copy and disable allocator Tue Aug 31 2004 Lynn Garren * change Solaris CC compile flags from "-O -mt" to "-O" * libtools 1.9b or later is required for Solaris CC ============================== 23.07.04 Release CLHEP-2.0.1.0 ============================== Fri Jul 23 2004 Lynn Garren * remove obsolete Utilities from 2.0 to avoid confusion * more changes for Solaris tests * HepPDT version is 1.01.00 * HepPDT: access ParticleData information by name (std::string) Wed May 19 2004 Lynn Garren * HepPDT: fix bugs in translation * HepPDT: add translation tests * a couple of miscellaneous changes for Solaris ============================== 11.05.04 Release CLHEP-2.0.0.2 ============================== Tue May 11 2004 Lynn Garren * tagged for CLHEP 2.0.0.2 (CLHEP_2_0_0_2) * library version changed to 2.0.0.2 Tue May 11 2004 Lynn Garren * HepMC 1.25 changes merged with CLHEP/HepMC * HepMC/HepMC/CBhepevt.icc: include stdio.h * HepMC/HepMC/CBherwig.icc: include stdio.h note that CLHEP/HepMC already had the most important change to use std::iterator Tue May 11 2004 Mark Fischler * RandPoissonT.cc * RandPoissonQ.cc Repaired misbehavior when mean is precisely 100.0 in these routines. Thu Apr 29 2004 Mark Fischler * LorentzVectorK.cc Modified behavior when rapidity of a light-like vector moving in the -z direction is taken. Previously, would have tried to take log(0.0). Thu Apr 29 2004 Mark Fischler * RandEngine.cc * RandEngine.h Code to accomodate possible systems where RAND_MAX is not one fo the two "expected" values of 2**15-1 or 2**31-1. Wed Apr 28 2004 Lynn Garren * make CLHEP work with Visual C++ Wed Apr 21 2004 Lynn Garren * change version to CLHEP 2.0.0.1 * fix Herwig and Isajet translation routines in HepPDT add translation checking tests Thu Nov 06 2003 Lynn Garren * adding ZOOM Exceptions package for FNAL * adding supporting RefCount and Cast packages Fri Oct 24 2003 Lynn Garren * tagged for CLHEP 2.0.0.0 * backwards compatibility code disabled Thu Oct 23 2003 Lynn Garren * tagged for CLHEP 1.9.0.0 * backwards compatibility code enabled Fri Oct 10 2003 Mark Fischler * ZMxpv.h and ZMxpv.cc Modified the ZZMthrowA and ZMthrowC macros such that the package never calls exit(), throwing an exception instead. Existing code in entire package was already instrumented to throw the various exceptions. * Boost.h and Boost.icc and Boost.cc Correct a typo in Boost::vectorMutiplication() [that is, boost*4vector]. This affected off-axis boosts applied to a LorentzVector when the x- and/or y- components of both the Boost and the LorentzVector are not small. Boosts in the z-direction are unaffected and Boosts dominantly in the z-direction suffered only second-order effects. Repair a bug in LorentzVector::deltaR() which could return large values when the phi values are close to + and - pi respectively, for two vectors which are actually near each other. Rectify misbehaviour when isNear() is taken between a specialized or general Boost and a general LorentzRotation. Supply output operator. * BoostX.cc, BoostY.cc, BoostZ.cc Rectify misbehaviour when isNear() is taken between a specialized or general Boost and a general LorentzRotation. Supply output operators. * LorentzRotation.cc Multiplication by specialized rotations More efficient multiplicatio by a rotation *LorentzVectorC.cc Correction in isNear for two vectors both close to -Z axis. * RotationE.cc Methods to find EUler angles phi() and psi() now forgiving of cos phi apparently slightly above 1 due to roundoff error. Fri Oct 10 2003 Lynn Garren * HepMC 1.24 changes merged with CLHEP/HepMC Tue Jul 22 17:40:39 CDT 2003 Lynn Garren * Alpha release of the CLHEP split * Directory structure has changed * Each package may be built either separately, or as part of CLHEP Mon May 5 10:32:18 2003 Evgueni Tcherniaev * Geometry/BasicVector3D.h,Normal3D.h,Plane3D.cc,Plane3D.h,Point3D.h: * Geometry/Transform3D.cc,Transform3D.h,Vector3D.h: * Geometry/BasicVector3D.cc,Normal3D.cc,Point3D.cc (Added): * Geometry/Transform3D.icc,Vector3D.cc (Added): Template implementation of Point3D, Vector3D and Normal3D. * test/testBasicVector3D.cc: * test/testBasicVector3D.input,testBasicVector3D.out.save: New (rather complete) test for basic geometrical classes. * test/Makefile.in: Use diff -w to avoid problems on Windows. Thu May 1 11:18:49 2003 Mark Fischler * Vector/RotationE.cc: This modifies the eulerAngles() method to address a flaw pointed out by A. Skiba: When the rotation matrix for a HepRotation was slightly perturbed due to accumulated roud-off error, and the rotation was very nearly but not exactly about the Z axis, the Euler angles computed could be incorrect in the sense that reconstructing a HepRotation from them would give a significantly different rotation. The new algorithm is much more numerically stable, and handles these cases better. * Vector/doc/eulerAngleComputation.tex: This file gives mathematical detail of the problem and the algorithm used to improve the numerical stability. * Vector/test/eulerProb.cc,eulerTest.cc (Added): The original program submitted by Skiba to exhibit numerical instability in eulerAngles() method, and a program to significantly excercise many different cases to verify that the improved method does give accurate results in the difficult and easy cases. Wed Jan 22 16:35:11 2003 Lynn Garren * HepMC/GenParticle.h,GenVertex.h: * HepMC/particleHas.cc,particleNum.cc (Added): * HepMC/vertexHas.cc,vertexNum.cc (Added): added (by request) numChildren(), numParents(), hasChildren(), and hasParents() methods to HepMC::GenVertex and HepMC::GenParticle. * HepMC/GenParticle.cc: don't attempt to print address of non-existent vertex pointer * HepMC/examples/GNUmakefile: minor improvements * HepMC/examples/testMethods.cc: testing new utility methods * HepMC/doc/HepMC_user_manual.ps: CLHEP revision Tue Jan 14 10:30:44 2003 Lynn Garren * HepPDT/TableBuilderT.hh: * HepPDT/examples/examMyPDT.cc: use map.erase Wed Dec 4 13:45:54 2002 Lynn Garren * StdHep/printVersion.cc: use string.h since the version must be accessable from C Sun Nov 24 16:03:56 2002 Joe Boudreau * GenericFunctions/GSLMetaProxy.c,GSLMetaProxy.h (Removed): * GenericFunctions/Bessel.hh,EllipticIntegral.hh,SphericalBessel.hh: * GenericFunctions/SphericalNeumann.hh: * GenericFunctions/Bessel.cc,EllipticIntegral.cc,SphericalBessel.cc: * GenericFunctions/SphericalNeumann.cc: Finally got rid of the MetaProxy scheme in favor of something much simpler suggested a long time ago by Evgueni.. Namely putting all the code that calls GSL into .icc files. That makes CLHEP independent of the external package but user code will develop a dependency as soon as it includes either the Bessels, the Spherical Bessels/Neumanns, or the Elliptic Integrals. Mon Oct 28 15:07:43 2002 Mark Fischler * GenericFunctions/Psi2Hydrogen.cc: Correct a warning about double to int, caused by using a 1.0 in an expression being used as int argument to factorial. Thu Oct 10 16:33:48 2002 Joe Boudreau * GenericFunctions/Psi2Hydrogen.cc,Psi2Hydrogen.hh (Added): Added Hydrogenic Wavefunctions * GenericFunctions/Abs.cc,Abs.hh (Added): Added Absolute value functions * GenericFunctions/Variable.cc,Variable.hh: Brought the variable class up to date with the FNAL repository version where most of the development work has been taking place till now * GenericFunctions/Parameter.cc: Portability change in print method * GenericFunctions/ParamToArgAdaptor.icc: Removed numeric_limits class, use of which limits portability Tue Oct 1 11:56:09 2002 Lynn Garren * HepMC/doc/README, ChangeLog: Tue Aug 27 10:11:14 2002 Mark Fischler * Matrix/Matrix.cc: Fix a BUG that was in trace from time immemorial! Trace used to return the sum of the elements in the first column, rather than the sum of the diagonal elements. Warning: This repair may change the behavior of some programs. I claim in those cases, the change is a correction. Fri Aug 9 14:55:05 2002 Evgueni Tcherniaev * Evaluator/Evaluator.cc: Fixed memory leak. Thanks to Wed Jul 31 18:29:05 2002 Evgueni Tcherniaev * Geometry/Transform3D.cc,Transform3D.h: * test/testTransform3D.cc: Rewritten test for equality Mon Jul 29 18:24:13 2002 Evgueni Tcherniaev * Geometry/Transform3D.cc,Transform3D.h: * test/testTransform3D.cc: Added isNear() function Fri Jul 26 16:11:29 2002 Lynn Garren * HepMC/ParticleDataTableConfig.h: for osf1 * HepMC/examples/exampleReadHepMC.cc: remove extraneous semicolon * HepMC/examples/GNUmakefile,example_UsingIterators.cc: use proper true/false instead of 1/0 Wed Jul 24 16:15:31 2002 Lynn Garren * HepPDT/ParticleDataT.hh: explicitly include Constituent.hh * HepPDT/examples/examDMF.cc: fix for KCC ============================== 01.06.02 Release CLHEP-1.8.0.0 ============================== Fri May 31 12:57:30 2002 Lynn Garren * HepPDT/Measurement.icc: inline better than static in this context Fri May 31 14:34:54 2002 Evgueni Tcherniaev * HepPDT/DMFactory.hh,DMFactory.icc: Use MakerBase instead of typedefed MakerBase * GenericFunctions/Makefile.in: * StdHep/Makefile.in: Added *.icc to the header file list: HEADERS = *.hh *.icc Thu May 30 18:51:37 2002 Lynn Garren * HepMC/ConvertHEPEVT.h,Makefile.in: * HepMC/CBInterface.h,CBhepevt.h,CBhepevt.icc (Added): * HepMC/GenEventConvert.h,GenEventConvert.icc (Added): * HepMC/GenEventtoHEPEVT.icc,HEPEVTtoGenEvent.icc (Added): * HepMC/ConvertHEPEVT.cc,FIhepevt.cc,FIhepevt.h (Removed): * HepMC/GenEventtoHEPEVT.cc,HEPEVTtoGenEvent.cc,clean.cc (Removed): redesign interface to common blocks * StdHep/ConversionMethods.hh,combineEvents.cc,printVersion.cc: * StdHep/CBcm.hh,CBstdhep.hh,CBstdhep.icc,StdEventConvert.hh (Added): * StdHep/StdEventConvert.icc,StdHep.hh,StdHepfromStdEvent.icc (Added): * StdHep/StdHeptoGenEvent.icc,StdRunInfoConvert.hh (Added): * StdHep/StdRunInfoConvert.icc (Added): * StdHep/CollisionToStdTmp.cc,FIcm.cc,FIcm.hh,FIstdtmp.cc (Removed): * StdHep/FIstdtmp.hh,MultipleInteractionInfo.cc (Removed): * StdHep/RunInfoToSTDCM.cc,StdEventToHEPEVT.cc,cleantmp.cc (Removed): * StdHep/findInTemporaryMap.cc,getRunInfoFromSTDCM.cc (Removed): * StdHep/getStdEventfromHEPEVT.cc,setConsistencyCheck.cc (Removed): * StdHep/setTrustMothers.cc setupConversion.cc (Removed): redesign interface to common blocks * StdHep/examples/GNUmakefile,dummy.F,examHerwigToStdHep.cc: * StdHep/examples/examPythiaToStdHep.cc,readPythia.cc: * StdHep/examples/readPythiaHerwig.cc: redesign interface to common blocks * StdHep/include/stdtmp.inc (Added): need stdtmp.inc Wed May 29 17:08:23 2002 Evgueni Tcherniaev * configure.in: alpha-dec-osf* --> alpha*-dec-osf* * test/testHepPDT.cc: use namespace for HepPDT::addPDGParticles() Tue May 28 17:46:34 2002 Lynn Garren * HepPDT/DMFactory.icc,ParticleDataTableT.icc: add typename * HepPDT/ParticleDataTableT.icc: got one extra typename * HepMC/GenEventtoHEPEVT.cc,HEPEVTtoGenEvent.cc (Restored): * StdHep/CollisionToStdTmp.cc,MultipleInteractionInfo.cc (Restored): * StdHep/RunInfoToSTDCM.cc,StdEventToHEPEVT.cc (Restored): * StdHep/getRunInfoFromSTDCM.cc,getStdEventfromHEPEVT.cc (Restored): restore necessary files Mon May 27 15:07:16 2002 Evgueni Tcherniaev * GenericFunctions/AbsFunction.hh,AbsParameter.hh: The copy constructors are now public rather than private. It has been done to avoid multiple warnings on Sun Solaris. An example of the compiler message: "ACos.cc", line 33: Warning (Anachronism): Genfun::AbsFunction::AbsFunction(const Genfun::AbsFunction&) is not accessible from Genfun::ACos::partial(unsigned) const. 1 Warning(s) detected. Sun May 26 11:44:07 2002 Evgueni Tcherniaev * HepMC/DummyDecayModel.h: Added empty implementation of ~DummyDecayModel() * HepMC/FIhepevt.h,FIhepevt.cc: Implementation of instance() has been moved to the header * HepMC/GenEventtoHEPEVT.cc,HEPEVTtoGenEvent.cc (Removed): Use of FIhepevt::instance() does not allow to create usable shared library * StdHep/FIcm.hh,FIcm.cc,FIstdtmp.hh,FIstdtmp.cc: Implementation of instance() has been moved to the header * StdHep/CollisionToStdTmp.cc,MultipleInteractionInfo.cc (Removed): * StdHep/RunInfoToSTDCM.cc,StdEventToHEPEVT.cc (Removed): * StdHep/getRunInfoFromSTDCM.cc,getStdEventfromHEPEVT.cc (Removed): Use of FIcm::instance() and FIstdtmp::instance() does not allow to create usable shared library Sat May 25 10:03:13 2002 Evgueni Tcherniaev * Random/RandStudentT.cc,RandStudentT.h: Added #include HUGE_VAL --> DBL_MAX On Apple/Darwin HUGE_VAL is defined to 1e500 and g++ compiler complains that floating point number exceeds range of `double' Fri May 24 17:07:39 2002 Evgueni Tcherniaev * configure.in: Added cygwin Disabled HepPDT, HepMC and StdHep on Windows Fri May 24 14:44:32 2002 Mark Fischler * Vector/Rotation.cc,RotationA.cc,RotationE.cc,RotationX.cc: * Vector/RotationY.cc,RotationZ.cc: Protection against taking acos(>1.0000) in cases where roundoff has caused a matrix element to become greater than 1. Tue May 21 10:33:42 2002 Evgueni Tcherniaev * config/istream.h,ostream.h (Removed): and are absent on Macintosh: use iostream.h instead Mon May 20 12:39:57 2002 Lynn Garren * HepPDT/test/testHepPDT.cc,testHepPDT.out.save (Removed): test has been moved * HepPDT/test/Makefile.in: only testPID remains * HepMC/ReadHepMC.h,WriteHepMC.h: * HepMC/examples/GNUmakefile: use iostream instead of istream or ostream * StdHep/ConversionMethods.hh,ReadStdHep.hh,StdEvent.hh,WriteStdHep.hh: * StdHep/print.cc,printVersion.cc,tree.cc: use iostream instead of istream or ostream * StdHep/ConversionMethods.hh,Makefile.in: * StdHep/CollisionFromC.cc,CollisionToC.cc,StdEventC.h (Removed): * StdHep/StdEventToC.cc,getStdEventFromC.cc (Removed): to avoid confusion, remove StdEventC.h until it works properly Mon May 20 19:13:18 2002 Evgueni Tcherniaev * StdHepC++ (Removed): Obsolete StdHepC++ has been removed * doxygen/config.doxygen,modules.doc: StdHepC++ --> StdHep * test/Makefile.in: * test/testHepPDT.cc,testHepPDT.out.save (Added): Added test for HepPDT * configure.in: removed HepPDT/test/Makefile Mon May 20 17:07:46 2002 Evgueni Tcherniaev * config/config.guess,config.sub,install-sh: More recent files for configure: support of Macintosh is included * configure.in: added support of Apple with PowerPC * Random/DRand48Engine.cc,drand48.src: Added support of Apple PowerPC Fri May 10 12:32:25 2002 Lynn Garren * StdHep/parseStdEventLine.cc,readBlockType.cc,readRunInfo.cc: * StdHep/parseStdEventLine.cc,readBlockType.cc,readRunInfo.cc: * StdHep/parseStdEventLine.cc,readBlockType.cc,readRunInfo.cc: need CLHEP/config/sstream.h header * HepMC/HepMCConfig.h,ReadHepMCBlockType.cc: * HepMC/ParticleDataTableConfig.h: remove unnecessary template instantiation * HepMC/examples/GNUmakefile,examplePythiaWriteHepMC.cc: remove unnecessary template instantiation Thu May 9 11:15:49 2002 Lynn Garren * StdHep/ConversionMethods.hh,Makefile.in: disable code using StdEventC.h for now * StdHep/examples/GNUmakefile: clean up KCC ti_files Thu May 9 10:01:10 2002 Evgueni Tcherniaev * GenericFunctions/EllipticIntegral.CC (Added): Renamed EllipticIntegral.cc to EllipticIntegral.CC * GenericFunctions/Bessel.CC,SphericalBessel.CC,SphericalNeumann.CC: * GenericFunctions/Bessel.cc,EllipticIntegral.cc (Removed): * GenericFunctions/SphericalBessel.cc,SphericalNeumann.cc (Removed): See Bessel.CC, SphericalBessel.CC, SphericalNeumann.CC * GenericFunctions/ACos.cc,ACos.hh,ASin.cc,ASin.hh,ATan.cc,ATan.hh: * GenericFunctions/BivariateGaussian.cc,BivariateGaussian.hh: * GenericFunctions/DoubleParamToArgAdaptor.icc,EllipticIntegral.hh: * GenericFunctiopns/Exp.cc,IncompleteGamma.cc,ParamToArgAdaptor.icc: Added Id line * StdHep/CollisionFromC.cc,CollisionToC.cc,CollisionToStdTmp.cc: Detail --> StdHep::Detail Wed May 8 13:46:50 2002 Mark Fischler * GenericFunctions/DoubleParamToArgAdaptor.icc,ParamToArgAdaptor.icc: * GenericFunctions/ACos.cc,ACos.hh,ASin.cc,ASin.hh (Added): * GenericFunctions/ATan.cc,ATan.hh,Bessel.cc (Added): * GenericFunctions/EllipticIntegral.cc,EllipticIntegral.hh (Added): * GenericFunctions/SphericalBessel.cc,SphericalNeumann.cc (Added): Files that had been in ZOOM's CLHEP but were not in the CERN version. These have been brought up to date so as to work with the latest config.h (that is, HEP_BEGIN_NAMESPACE no longer appears, etc.) Wed May 8 11:14:51 2002 Lynn Garren * HepMC/GenEvent.h,GenVertex.h: use conditional typedefs for forward iterators Wed May 1 15:32:04 2002 Lynn Garren * StdHep/ReadStdHep.hh,StdEvent.hh,StdRunInfo.cc,StdRunInfo.hh: * StdHep/WriteStdHep.cc,WriteStdHep.hh,particle.cc,readRunInfo.cc: * StdHep/readStdComment.cc,readStdEvent.cc,readStdRun.cc: * StdHep/writeEventKey.cc,writeRunInfo.cc,writeStdComment.cc: * StdHep/StdEventPAncestors.cc,StdEventPChildren.cc (Added): * StdHep/StdEventPDescendants.cc,StdEventPParents.cc (Added): * StdHep/StdEventVAncestors.cc,StdEventVChildren.cc (Added): * StdHep/StdEventVDescendants.cc,StdEventVParents.cc (Added): * StdHep/StdEventVertex.cc,collision.cc,findBlockType.cc (Added): * StdHep/findNextStdEvent.cc,readBlockType.cc (Added): improve functionality * StdHep/examples/.cvsignore,GNUmakefile,bookhist.F: * StdHep/examples/examHerwigToStdHep.cc,examPythiaToStdHep.cc: * StdHep/examples/readPythia.cc,readPythiaHerwig.cc: * StdHep/examples/analyzeEvent.cc,analyzeEvent.hh (Added): improve functionality * HepMC/ReadHepMC.cc,ReadHepMC.h,ReadHepMCDetail.cc,WriteHepMC.cc: * HepMC/WriteHepMC.h,writeComment.cc: * HepMC/ReadHepMCBlockType.cc,ReadHepMCComment.cc (Added): * HepMC/ReadHepMCFindBlock.cc,ReadNextHepMC.cc (Added): improve functionality * HepMC/examples/examplePythiaWriteHepMC.cc,exampleReadHepMC.cc: improve functionality Fri Apr 26 11:08:48 2002 Lynn Garren * StdHep/examples/hwtran.F,lunhep.F,lutran.F,stdflhwxsec.F: * StdHep/examples/stdflpyxsec.F: use latest stdhep fortran routines * StdHep/CollisionFromC.cc,CollisionToC.cc,CollisionToStdTmp.cc: * StdHep/MultipleInteractionInfo.cc,findInTemporaryMap.cc: * StdHep/parseStdEventLine.cc,readRunInfo.cc,readStdComment.cc: * StdHep/readStdEventInfo.cc: use explicit namespace for detail methods * StdHep/StdEventC.h,StdEventToC.cc,StdHepVersion.h,StdRunInfo.cc: * StdHep/getRunInfoFromSTDCM.cc,readStdEvent.cc: fixes for gcc 3.0.x ========================================= 25.04.02 revised StdHep uses HepMC ========================================= Thu Apr 25 16:13:27 2002 Lynn Garren * HepMC/GenEvent.cc,GenEvent.h,ReadHepMCDetail.cc,WriteHepMC.cc: * HepMC/examples/IO_Ascii.cc: need to save random state as doubles * StdHep: added to the repository * Makefile.in,configure.in: rename StdHepC++ to StdHep * StdHep/CollisionFromC.cc,CollisionToC.cc (Added): * StdHep/CollisionToStdTmp.cc,ConversionMethods.hh (Added): * StdHep/FIcm.cc,FIcm.hh,FIstdtmp.cc,FIstdtmp.hh (Added): * StdHep/Makefile.in,MultipleInteractionInfo.cc,ReadStdHep.hh (Added): * StdHep/RunInfoToSTDCM.cc,StdEvent.cc,StdEvent.hh,StdEventC.h (Added): * StdHep/StdEventToC.cc,StdEventToHEPEVT.cc,StdHepVersion.h (Added): * StdHep/StdRunInfo.cc,StdRunInfo.hh,WriteStdHep.cc (Added): * StdHep/WriteStdHep.hh,appendCollision.cc,cleantmp.cc (Added): * StdHep/combineEvents.cc,findInTemporaryMap.cc (Added): * StdHep/getRunInfoFromSTDCM.cc,getStdEventFromC.cc (Added): * StdHep/getStdEventfromHEPEVT.cc,numParticles.cc (Added): * StdHep/numVertices.cc,parseStdEventLine.cc,particle.cc (Added): * StdHep/print.cc,printVersion.cc,readRunInfo.cc (Added): * StdHep/readStdComment.cc,readStdEvent.cc,readStdEventInfo.cc (Added): * StdHep/readStdRun.cc,setConsistencyCheck.cc (Added): * StdHep/setTrustMothers.cc,setupConversion.cc,tree.cc (Added): * StdHep/writeEventKey.cc,writeRunInfo.cc,writeStdComment.cc (Added): revised StdHep uses HepMC * StdHep/include/Makefile.in,herwig61.inc,herwig64.inc (Added): * StdHep/include/stdcm1.h,stdcm1.inc,stdcnt.h,stdcnt.inc (Added): * StdHep/include/stdevent.h,stdlun.h,stdlun.inc,stdtmp.h (Added): * StdHep/include/stdver.h,stdver.inc (Added): revised StdHep uses HepMC * StdHep/examples/GNUmakefile,bookhist.F,dummy.F (Added): * StdHep/examples/examHerwigToStdHep.cc,examPythiaToStdHep.cc (Added): * StdHep/examples/hwghep.F,hwtran.F,lunhep.F,lutran.F (Added): * StdHep/examples/readPythia.cc,readPythiaHerwig.cc,readcxx.F (Added): * StdHep/examples/stdflhwxsec.F,stdflpyxsec.F,stdhwgcxx.F (Added): * StdHep/examples/stdpytcxx.F (Added): revised StdHep uses HepMC * HepMC/FIhepevt.cc: need pretend-to-use Tue Apr 23 09:51:58 2002 Lynn Garren * HepMC/Polarization.cc: TemplateFuntions.h required for egcs * HepMC/ReadHepMCDetail.cc,WriteHepMCDetail.cc: use explicit namespace * HepMC/Flow.h,GenParticle.h: remove set_unique_icode * HepMC/vertexPointers.cc: improve failure checks * HepMC/examples/GNUmakefile: add debug option * Makefile.in: don't clean HepPDT/test here Fri Apr 19 18:33:41 2002 Evgueni Tcherniaev * Geometry/BasicVector3D.h,Normal3D.h,Plane3D.h,Point3D.h: * Geometry/Transform3D.h,Vector3D.h: Added documenting comments. Thu Apr 18 12:21:36 2002 Lynn Garren * HepMC/include/hepev4.h,hepev4.inc (Added): more information * HepMC/Polarization.h: * HepPDT/addPDGParticles.cc,digit.cc: for consistency, get math.h from CLHEP.h * HepPDT,HepPDT/test: replace HepStd and HepSTL with std * HepMC/GenEvent.cc,GenEventtoHEPEVT.cc,GenParticle.cc,GenVertex.cc: use stdio.h instead of cstdio - for DEC * HepMC/HepMCConfig.h: fix forward declaration * HepMC/examples/testMethods.cc: get rid of cmath Wed Apr 17 13:33:45 2002 Lynn Garren * HepMC/FIhepevt.h,GenEvent.h,GenEventtoHEPEVT.cc,GenParticle.h: * HepMC/HEPEVTtoGenEvent.cc,clean.cc: * HepMC/particleMotherDaughter.cc (Added): adding old StdHepC++ methods deal with another common block * HepMC/examples/initpydata.F: deal with another common block * HepMC/Polarization.h: * HepPDT/addPDGParticles.cc,digit.cc: use math.h instead of cmath cannot use std::sqrt or std::pow with math.h Wed Apr 17 10:08:52 2002 Mark Fischler * GenericFunctions/IncompleteGamma.hh,IncompleteGamma.cc: Prevent the warning in gcc 3 about comparison of signed to unsigned int, while not breaking the behavion of the code, by making the static const ITMAX into an int instead of an unsigned int. Fri Apr 12 16:58:58 2002 Evgueni Tcherniaev * Random/RandGeneral.cc: Bug fix in the destructor, thanks to Willy Langeveld Bug fix: delete [] (theIntegralPdf); * doxygen/README,config.doxygen,footer.html,modules.doc (Added): Files for generation of the documantation with Doxygen. * All_headers: For Doxygen: added empty documeting comments for classes. Thu Apr 11 10:10:28 2002 Evgueni Tcherniaev * Alist,Combination,Combination,Hist,String,classdoc (Removed): Removed obsolete directories. They can be recovered from the Attic area, for example: cvs update -d -r CLHEP_1_700 Alist * GenericFunctions/Bessel.cc (Removed): * GenericFunctions/SphericalBessel.cc (Removed): * GenericFunctions/SphericalNeumann.cc (Removed): * GenericFunctions/Bessel.CC (Added): * GenericFunctions/SphericalBessel.CC (Added): * GenericFunctions/SphericalNeumann.CC (Added): Renamed files which use gsl. * Evaluator/Makefile.in: * GenericFunctions/Makefile.in: * Geometry/Makefile.in: * Matrix/Makefile.in: * Random/Makefile.in: * RandomObjects/Makefile.in: * StdHepC++/Makefile.in: * Vector/Makefile.in: Simplified Makefile.in Mon Apr 1 14:22:12 2002 Lynn Garren * HepPDT/DDMFactory.hh: Use std::map instead of MapVector. MapVector does not compile on the non-standard egcs compiler. Sun Mar 31 10:54:23 2002 Evgueni Tcherniaev * Global_Clean_Up: The following macros have been removed from config/CLHEP-target.h.in (the reason is indicated). Respectively checks for them have been removed from configure.in: HEP_HAVE_STL - all supported compilers have string, vector, ... HEP_HAVE_BOOL - all supported compilers have bool HEP_HAVE_NAMESPACE - all supported compilers have namespace HEP_HAVE_EXPLICIT - all supported compilers have explicit HEP_HAVE_TYPENAME - all supported compilers have typename HEP_HAVE_EMPTY_TEMPLATE_PARAMETER_LIST - all supported compilers have template<> HEP_SQR_NEEDS_PARAMETER_WITHOUT_CONST HEP_ABS_NEEDS_PARAMETER_WITHOUT_CONST - current definition of sqr() and abs() works everywhere HEP_QSORT_NEEDS_FUNCTION_WITH_EXTERN_C_LINKAGE - qsort() is not used The following macros have been removed from config/CLHEP.h: HepStdString HepStdVector HepStdList HEP_TEMPLATE_SPECIALIZATION HEP_BEGIN_NAMESPACE HEP_END_NAMESPACE HEP_USING_NAMESPACE The following modifications have been made in the code: HepStdString --> HepSTL::string HepStdVector --> HepSTL::vector HepBoolean --> bool HepDouble --> double HepFloat --> float HepInt --> int HEP_BEGIN_NAMESPACE(xxx) --> namespace xxx { HEP_END_NAMESPACE(xxx) --> } // namespace xxx Fri Mar 29 21:02:16 2002 Evgueni Tcherniaev * Makefile.in: Introduced SRC_HOME to fix the problem with second level of include subdirectories (StdHepC++/include and HepMC/include) Mon Mar 25 15:55:52 2002 Evgueni Tcherniaev * compilers.txt: Added information on std::ios_base. Fri Mar 8 12:00:47 2002 Lynn Garren * Makefile.in,configure.in: Added HepMC. ========================================= 08.03.02 HepMC has become a part of CLHEP ========================================= Fri Mar 8 12:00:47 2002 Lynn Garren * HepMC (Added): * HepMC/include (Added): * HepMC/doc (Added): * HepMC/examples (Added): HepMC added the repository. Fri Mar 8 09:55:09 2002 Lynn Garren * config/CLHEP-target.h.in,CLHEP.h: * config/istream.h,ostream.h (Added): Need to deal with base_ios (standard) versus ios (old). * HepPDT/ParticleDataTableT.icc,TableBuilderPythiaT.icc: * HepPDT/TableBuilderT.hh,TableBuilderT.icc: * HepPDT/stringtodouble.cc,stringtodouble.hh (Added): Get ready for HepMC. * HepPDT/test/testHepPDT.cc,testHepPDT.out.save: Get ready for HepMC. * HepPDT/examples/examMyPDT.out.save,examReadEvtGen.out.save: * HepPDT/examples/examReadPDG.out.save,examReadPythia.out.save: * HepPDT/examples/examReadQQ.out.save: Get ready for HepMC. Wed Mar 6 09:37:58 2002 Mark Fischler * Vector/Boost.cc,Boost.h,Boost.icc,BoostX.cc,BoostX.h,BoostX.icc: * Vector/BoostY.cc,BoostY.h,BoostY.icc,BoostZ.cc,BoostZ.h,BoostZ.icc: * Vector/LorentzRotation.cc,LorentzRotation.h,LorentzRotation.icc: * Vector/LorentzRotationC.cc,LorentzRotationD.cc: * Vector/Rotation.cc,Rotation.h,Rotation.icc,RotationA.cc: * Vector/RotationC.cc,RotationE.cc,RotationInterfaces.cc: * Vector/RotationInterfaces.h,RotationInterfaces.icc,RotationL.cc: * Vector/RotationP.cc,RotationX.cc,RotationX.h,RotationX.icc: * Vector/RotationXYZ.cc,RotationY.cc,RotationY.h,RotationY.icc: * Vector/RotationZ.cc,RotationZ.h,RotationZ.icc,ThreeVector.icc: * Vector/TwoVector.icc: Speeed enhancements by making Rotation completely non-polymorphic, inlining everything that remotely seems appropriate, ordering appearance of inline definitions such that the inlining is ot defeated, and so forth. This addresses the issue that R*v in CLHEP 1.7 was 3.5 times slower than in CLHEP 1.6. They are now the same speed. Tue Mar 5 16:41:23 2002 Mark Fischler * GenericFunctions/IncompleteGamma.cc: Fix something that fails to compile on some good compilers (gcc 3). Thu Feb 21 16:50:08 2002 Evgueni Tcherniaev * configure.in: Added -D_GNU_SOURCE for g++. Removed check for HEP_DIFFERENT_EXCEPTIONS. * config/CLHEP-target.h.in: Removed HEP_DIFFERENT_EXCEPTIONS * Random/DRand48Engine.cc,DRand48Engine.h: Re-declarations of drand48, srand48 and seed48 have been moved to DRand48Engine.cc Fri Feb 8 18:40:17 2002 Lynn Garren * HepPDT/DecayChannelT.hh,DecayChannelT.icc,DecayDataT.hh: * HepPDT/DecayDataT.icc,DecayModelBase.hh,ParticleDataT.hh: * HepPDT/ParticleDataTableT.hh,ParticleDataTableT.icc: * HepPDT/addPDGParticles.cc: Bug fixes. * HepPDT/examples/examMyPDT.cc,examReadEvtGen.cc,examReadPDG.cc: * HepPDT/examples/examReadPythia.cc,examReadQQ.cc: Use DefaultConfig.hh. Mon Jan 14 17:43:44 2002 Lynn Garren * HepPDT/DMFactory.icc,ParticleDataTableT.icc,convertTemporaryMap.icc: Fix some definitions. Tue Dec 4 08:31:13 2001 Mark Fischler * Vector/ZMinput.cc: Helper methods to support flexible input formats. Mon Dec 3 11:55:35 2001 Mark Fischler * Vector/ThreeVector.h,ThreeVector.icc: Declaration of deltaPhi() and implementation of azimAngle in terms of it. Fri Nov 30 14:56:46 2001 Lynn Garren * HepPDT/DecayChannelT.icc,TableBuilderT.icc: * HepPDT/translatePDGtabletoPDT.cc,translatePDTtoPDGtable.cc: Fix array size problem. Fri Nov 30 11:32:56 2001 Mark Fischler * Vector/AxisAngle.cc,Boost.icc,BoostX.icc,BoostY.icc,BoostZ.icc: * Vector/EulerAngles.cc,LorentzRotation.icc,LorentzRotationC.cc: * Vector/Rotation.icc,RotationA.cc,RotationC.cc,RotationE.cc: * Vector/SpaceVectorD.cc,ThreeVector.cc,TwoVector.cc,TwoVector.h: * Vector/TwoVector.icc: - fix warnings about uninitialized base classes; - correct behavior of deltaR() for vectors near but on opposite sides of phi = - pi; - correct azimangle and provide deltaPhi() method; - set(x,y) for Hep2Vector; - all classes that have operator>> can now accept input in same form as operator<< generates output; - return value if you take eta(zero vector) is zero rather than 10^72; Thu Nov 29 16:42:17 2001 Evgueni Tcherniaev * configure.in: Added check for the problem with different exceptions in drand48. This requires also use of -pedantic-errors instead of -pedantic. * config/CLHEP-target.h.in: * Random/DRand48Engine.h: Introduced HEP_DIFFERENT_EXCEPTIONS. * test/testVectorDists.cc: Minor changes to provide compilation with -pedantic-errors. Tue Nov 27 16:48:13 2001 Lynn Garren * HepPDT/DMFactory.hh,DMFactory.icc,PDGtoQQTable.cc: Get rid of g++ -pedantic warnings. Fri Nov 23 15:10:35 2001 Evgueni Tcherniaev * compilers.txt (Added): Added table of compiler dependent features. Mon Nov 19 17:21:18 2001 Lynn Garren * configure.in: * config/CLHEP-target.h.in: * config/StringStream.h,sstream.h (Added): Check for sstream and set HEP_HAVE_SSTREAM. * HepPDT/CommonParticleData.hh,CommonParticleData.icc,PDGtoQQTable.hh: * HepPDT/ParticleDataT.hh,QQChannel.cc,QQChannel.hh,QQDecay.hh: * HepPDT/QQDecayTable.hh,SimpleDecayModel.cc,TableBuilderT.icc: * HepPDT/TempParticleData.cc,addEvtGenParticles.cc,addPDGParticles.cc: * HepPDT/addPythiaParticles.cc,hasMethods.cc,readQQchannel.cc: * HepPDT/readQQstream.cc,write.cc,writeTranslations.cc: * HepPDT/HepStringStream.hh (Removed): Use CLHEP/config/sstream.h Minor cleanup of warning messages. Thu Nov 15 19:29:36 2001 Lynn Garren * HepPDT/DMFactory.icc,PDGtoQQTable.cc: assert( _inst != 0 ) [should not be necessary] Tue Nov 13 19:31:56 2001 Lynn Garren * HepPDT/CommonParticleData.hh,CommonParticleData.icc,Constituent.hh: * HepPDT/DMFactory.hh,DMFactory.icc,DecayChannelT.hh,DecayChannelT.icc: * HepPDT/DecayDataT.hh,DecayDataT.icc,DecayModelBase.hh,DefTable.cc: * HepPDT/MapVector.hh,Measurement.icc,NullDecayModelT.hh: * HepPDT/PDGtoQQTable.cc,PDGtoQQTable.hh,ParticleDataT.hh: * HepPDT/ParticleDataT.icc,ParticleDataTableT.hh,ParticleID.hh: * HepPDT/ParticleID.icc,QQChannel.cc,QQChannel.hh,QQDecay.cc: * HepPDT/QQDecay.hh,QQDecayTable.cc,ResonanceStructure.cc: * HepPDT/SimpleDecayModel.cc,SimpleDecayModel.hh,SpinState.icc: * HepPDT/TableBuilderPythiaT.icc,TableBuilderT.icc: * HepPDT/TableBuilderTEvtGen.icc,TableBuilderTQQ.icc: * HepPDT/TempParticleData.cc,TempParticleData.hh,addEvtGenParticles.cc: * HepPDT/addPDGParticles.cc,addPythiaParticles.cc,addQQParticles.cc: * HepPDT/buildTable.cc,convertTemporaryMap.icc,readQQstream.cc: * HepPDT/translateEvtGentoPDT.cc,translateGeanttoPDT.cc: * HepPDT/translateHerwigtoPDT.cc,translateIsajettoPDT.cc: * HepPDT/translatePDGtabletoPDT.cc,translatePDTtoEvtGen.cc: * HepPDT/translatePDTtoGeant.cc,translatePDTtoHerwig.cc: * HepPDT/translatePDTtoIsajet.cc,translatePDTtoPDGtable.cc: * HepPDT/translatePDTtoPythia.cc,translatePythiatoPDT.cc,version.cc: * HepPDT/write.cc,writeTranslations.cc: * HepPDT/test/testPID.cc: Using assert.h, iomanip.h, HepStd, HepSTL. Fri Nov 9 14:37:30 2001 Lynn Garren * Makefile.in,configure.in: Add HepPDT. Add --diag_suppress nonstd_long_long for Linux KCC. * HepPDT/HepStringStream.hh: Do the right thing for gcc 3.x This file needs to be merged with the CLHEP header. ========================================== 09.11.01 HepPDT has become a part of CLHEP ========================================== Tue Nov 9 07:48:22 2001 Mark Fischler * HepPDT (Added): * HepPDT/doc (Added): * HepPDT/test (Added): * HepPDT/data (Added): * HepPDT/examples (Added): * HepPDT/examples/data (Added): HepPDT added the repository. Tue Nov 8 07:48:22 2001 Mark Fischler * test/testVectorDists.cc,testVectorDists.out.save: Modified this test such that when it outputs a matrix, elements smaller than one-trillionth are output as 0. Thus the test should produce identical results despite slightly different FP math and roundoff. Mon Aug 13 11:21:31 2001 Evgueni Tcherniaev * Matrix/GenMatrix.cc: Added #include to provide declaration of memset(). * Matrix/Matrix.cc: All "return invertHaywood...(ierr);" statements have been subdivided in two lines: invertHaywood...(ierr); return; to avoid problems on DEC/cxx. * Matrix/DiagMatrix.h,SymMatrix.h,Vector.h: Removed "explicit" for constructors with two parameters to avoid problems on HP/aCC. * Geometry/BasicVector3D.h: Corrected operator>> Tue Jul 31 18:54:39 2001 Evgueni Tcherniaev * Geometry/BasicVector3D.h: Constructor from Hep3Vector is now protected. Changed the signature of the conversion operator to Hep3Vector. Tue Jul 31 09:13:53 2001 Mark Fischler * Random/RandGeneral.cc: Changed from assert (above = below+1) to == This was first reported by Gregory P. Dubois-Felsmann at SLAC. Mon Jul 30 18:31:38 2001 Evgueni Tcherniaev * Matrix/Makefile.in: Added MatrixEqRotation.cc, MatrixInvert.cc, SymMatrixInvert.cc. Mon Jul 30 11:19:43 2001 Mark Fischler * Matrix/MatrixInvert.cc,SymMatrixInvert.cc (Added): These files contain invertHaywood 4, 5, and 6 and invertChoelsky 4, 5, 6. Thu Aug 2 2001 Mark Fischler * Vector/Boost.icc: Repair incorrect syntax in new error message code. Fri Jul 27 2001 Mark Fischler * Random/doc/html/ (Added): * Random/doc/html/CLHEP-random.html (Added): Added this ZOOM documentation page. Fri Jul 27 2001 Mark Fischler * Matrix/SymMatrix.h,SymMatrix.cc,Matrix.h,Matrix.cc: * Matrix/SymMatrixInvert.cc,MatrixINvert.cc (Added): Implemented speed-improved inversion for 4x4, 5x5 and 6x6 matrices. Inserted the Haywood-style implemtation of inversion for 4x4, 5x5, and 6x6 matrices. The speed increase is consdierable for some cases, and a bit less in others. In particular, 5x5 symmetric positive definite matrices go quite fast now, and these are importat for tracking. * Matrix/GenMatrix.cc,GenMatrix.icc: Zero the elements in the case of pre-allocated storage. When constructing a matrix small enough to use pre-allocated array, still zero the array data. Lack of this was causing CDF code to crash. * Matrix/Vector.h,Matrix.h: Made ctor from int explicit. Fri Jul 27 2001 Mark Fischler * Vector/ThreeVector.h,ThreeVector.icc,ThreeVector.cc: * Vector/AxisAngle.cc,Boost.cc,BoostX.cc,BoostY.cc,BoostZ.cc: * Vector/EulerAngles.cc,LorentzRotationD.cc,LorentzVectorC.cc: * Vetor/Rotation.cc,RotationE.cc,SpaceVectorP.cc,SpaceVectorR.cc: NaN-proofed the package: At every place where there is a potential division by zero or a function that could return a memeaningless result or Not-A-Number, it is checked and an error message (via ZMthrowA or ZMthrowC) is done if there is a problem. No silent NaN generation. * Vector/Boost.icc: Rectify a misleading error message if ctor is supplied a 0 direction. Thu Jul 26 18:51:47 2001 Evgueni Tcherniaev * Geometry/BasicVector3D.h: Added r(), getR(), SetR(), getPhi(), getTheta(), eta(), getEta(), setEta(). Mon Jun 18 13:58:16 2001 Evgueni Tcherniaev * Units/doc (Added): * Units/doc/Units.tex (Added): Added documentation for Units. ============================== 15.06.01 Release CLHEP-1.7.0.0 ============================== Fri Jun 15 09:30:42 2001 Evgueni Tcherniaev * Geometry/Transform3D.cc,Transform3D.h: Disabled m^-1. * configure.in: Set default options for MS VC++ to "-DWIN32 -O -GX -GR -MD" * test/testEvaluator.cc: Added "return 0" to avoid problems with "make -check" on NT. Added header comments. * test/testBasicVector3D.cc: Changed endl to HepStd::endl Thu Jun 14 11:27:44 2001 Evgueni Tcherniaev * Geometry/BasicVector3D.h (Added): * Geometry/Point3D.h,Vector3D.h,Normal3D.h: * test/testBasicVector3D.cc (Added): * test/testBasicVector3D.input,testBasicVector3D.out.save (Added): * test/testTransform3D.cc,Makefile.in: Added BasicVector3D.h to decouple functionality of Point3D, Vector3D and Normal3D from functionality of Hep3Vector. * test/testEvaluator.in (Removed): * test/testEvaluator.input (Added): * test/Makefile.in: testEvaluator.in has been renamed to testEvaluator.input Tue Jun 12 08:45:20 2001 Evgueni Tcherniaev * Makefile.in: Get rid of xargs. Mon Jun 11 10:20:35 2001 Evgueni Tcherniaev * configure.in,Makefile.in: * configure/Makefile.common.in: * test/Makefile.in: Added $(VERSION) to the name of the library * GenericFunctions/FunctionNumDeriv.cc: Replaced max() by if() * GenericFunctions/Variable.hh: Removed const from parameters of the constructor Variable(unsigned int selectionIndex=0); * Geometry/Transform3D.cc,Transform3D.h: Added getDecomposition(Scale &, Rotation &, Translation &) * test/Makefile.in: * test/testTransform3D.cc (Added): Added test for Transform3D. * test/testAList.cc,testCmd.cc,testCmd.out.save (Removed): * test/testComb.cc,testStrings.cc (Removed): Removed obsolete tests. Sat Jun 9 09:45:32 2001 Evgueni Tcherniaev * Evaluator/Makefile.in: * Matrix/Makefile.in: * RandomObjects/Makefile.in: * StdHepC++/Makefile.in: * Vector/Makefile.in: ALLOBJECTS = $(((patsubst %.cc,%.o,$(((SOURCES)) Fri Jun 8 17:47:25 2001 Evgueni Tcherniaev * GenericFunctiuons/Makefile.in: Disabled compilation of Bessel.cc, SphericalBessel.cc and SphericalNeumann.cc Wed May 30 15:51:33 2001 Evgueni Tcherniaev * Evaluator/Evaluator.cc,string.src: * test/testEvaluator.cc: Added code to ignore leading and trailing spaces in names. Fri May 18 09:32:21 2001 Evgueni Tcherniaev * Evaluator/hash_map.src,utility.src: removed "using HepSTL::pair", because it does not compile on HP. * GenericFunctions/Bessel.cc,SphericalBessel.cc,SphericalNeumann.cc: Changed std:: to HepStd:: Wed May 16 07:10:41 2001 Joe Boudreau * ENTIRE_GenericFunctions_Package: * GenericFunctions/Bessel.cc,Bessel.hh (Added): * GenericFunctions/BivariateGaussian.cc,BivariateGaussian.hh (Added): * GenericFunctions/CutBase.hh,CutBase.icc (Added): * GenericFunctions/DoubleParamToArgAdaptor.hh (Added): * GenericFunctions/DoubleParamToArgAdaptor.icc (Added): * GenericFunctions/Exp.cc,Exp.hh (Added): * GenericFunctions/FunctionNoop.cc,FunctionNoop.hh (Added): * GenericFunctions/FunctionNumDeriv.cc,FunctionNumDeriv.hh (Added): * GenericFunctions/GSLMetaProxy.c,GSLMetaProxy.h (Added): * GenericFunctions/Landau.cc,Landau.hh,Ln.cc,Ln.hh (Added): * GenericFunctions/ParamToArgAdaptor.hh,ParamToArgAdaptor.icc (Added): * GenericFunctions/Tan.cc,Tan.hh (Added): * GenericFunctions/TrivariateGaussian.cc (Added): * GenericFunctions/TrivariateGaussian.hh (Added): * GenericFunctions/doc/genericFunctions.tex: Bringing the official CLHEP release up to date. The development has been happening within another repository (at Fermilab), now I am putting several months of work back into the CLHEP repository. In addition to routine bug fixes, the major points are: * Automatic derivative computation * Bessel functions, Landau functions, Bivariate and Trivariate Gaussian distributions, Parameter-to-argument adaptors. * Use of GSL where available, and a Meta-proxy library used to limp along without the GSL. * The base classes for Cuts, providing a for functions that return a yes/no decision for a particular data type, BUT.. obeying a boolean algebra. Designed to interoperate with the STL; and templated on the data type which is cut upon. I discussed this a little in HEPVis'01, and just decided to implement it. Wed Apr 11 13:54:51 2001 Mark Fischler * Random/DualRand.cc,Hurd160Engine.cc,Hurd288Engine.cc: * Random/RanecuEngine.cc,TripleRand.cc: Each saveState method ought to output endl after its data. * Random/DRand48Engine.h: __P replaced with __STRICT_ANSI__ (for the case g++ -ansi). Fri Apr 6 11:53:19 2001 Evgueni Tcherniaev * test/Makefile.in: Removed testRandDists and ranRestoreTest: they have been moved to Random/test. * Makefile.in,configure.in: * test/testVectorDists.cc: * RandomObjects/RandMultiGauss.cc,RandomVector.cc,RandomVector.h: "Tools" has been changed to "RandomObjects". Thu Apr 5 10:58:07 2001 Evgueni Tcherniaev * Evaluator/utility.src: Avoidance of clashes with ::pair in GCC. Wed Apr 4 10:06:03 2001 Mark Fischler * Tools/Makefile.in (Removed): * Tools/RandMultiGauss.cc,RandMultiGauss.h (Removed): * Tools/RandomVector.cc,RandomVector.h (Removed): * Tools/RandomVector.icc (Removed): * RandomObjects/Makefile.in (Added): * RandomObjects/RandMultiGauss.cc,RandMultiGauss.h (Added): * RandomObjects/RandomVector.cc,RandomVector.h (Added): * RandomObjects/RandomVector.icc (Added): As agreed, we migrate the Tools involving Random and another CLHEP package into a package which I have chosen to name RandomObjects. RandomObjects in principle depends on Random, Matrix, and Vecgtor (though the tools that depend on Vector are not yet present). * Vector/AxisAngle.h,EulerAngles.h: Eliminated inconsistancy of virtual methods in no-virtual-destructor class. These classes should not be used polymorphically. * test/ranRestoreTest.cc,testRandDists.cc (Removed): * test/testRandDists.input,testRandDists.out.save (Removed): These were moved into Random/test * Random/test/GNUmakefile,gaussSmall.cc (Added): * Random/test/gaussSpeed.cc,ranRestoreTest.cc (Added): * Random/test/testRandDists.cc,testRandDists.dat (Added): * Random/test/testRandDists.input,testRandDists.input-long (Added): * Random/test/testRandDists.out.save (Added): Moved detailed and long tests into package-specific test area as agreed. * Vector/doc/VectorDefs.tex (Added): LaTeX documentation source for details of all the formulas and definitions in the Vector package. Tue Apr 3 11:36:23 2001 Mark Fischler * Vector/LorentzVector.h,LorentzVector.icc: inline operator const Hep3Vector & () const; to avoid errors on solaris CC 4.2 Thu Mar 15 17:42:19 2001 Evgueni Tcherniaev * Evaluator/hash_map.src: Bug fix in clear(): added table[i] = 0; Mon Mar 5 17:09:31 2001 Evgueni Tcherniaev * Units/SystemOfUnits.h: Added 'parsec'. It corresponds to the latest developments going on in Geant4. Mon Jan 29 16:59:00 2001 Evgueni Tcherniaev * Geometry/Transform3D.cc,Transform3D.h: Added subscripting Fri Jan 19 16:07:15 2001 Evgueni Tcherniaev * Vector/Makefile.in: Added new *.cc files. * Vector/EulerAngles.h: Included "CLHEP/config/iostream.h" * Vector/AxisAngle.cc,AxisAngle.h,EulerAngles.h,EulerAngles.cc: * Vector/RotationInterfaces.h,RotationX.cc,RotationY.cc: * Vector/RotationZ.cc,TwoVector.cc,TwoVector.h: Changed std:: to HepStd:: * Vector/LorentzRotation.cc: Removed operators "using"; setw(), setprecision() changed to HepStd::setw(), HepStd::setprecision() ========================================================================== 18.01.01 ZOOM PhysicsVectors Capabilities have become part of CLHEP/Vector ========================================================================== Thu Jan 18 20:30:00 2001 Mark Fischler * ENTIRE_Vector_Package: Code for merge with capabilities of ZOOM PhysicsVectors. Thu Jan 18 19:45:00 2001 Mark Fischler * Random/DRand48Engine.h: Placed ifdef to repair problem which when gcc 2.95.2 is used WITHOUT -ansi, would have caused the header to fail to complie due to mismatch in prototypes of drand48() in header and . Tue Jan 9 15:50:00 2001 Mark Fischler * Random/Random.h: Modified comment for createInstance() to reflect the minor fix of Dec 5. Mon Jan 8 16:24:37 2001 Evgueni Tcherniaev * configure.in: Added -GR to the compiler option list on NT. Thanks to Dave Casper Tue Dec 5 11:18:13 2000 Gabriele Cosmo * Random/Random.cc: Minor fix in HepRandom::createInstance() and removed useless code. Wed Nov 8 11:21:44 2000 Evgueni Tcherniaev * Random/DRand48Engine.cc,DRand48Engine.h: * Random/drand48.src (Added): More accurate code for drand48() on NT. DRand48Engine now produces exactly the same sequences on all platforms. Removed #ifdef in declaration of drand48(), srand48() and seed48(). * configure.in: Added -ansi for g++. After removing #ifdef in declaration of drand48(), srand48() and seed48() it now works fine. Mon Nov 6 16:25:21 2000 Evgueni Tcherniaev * Vector/LorentzVector.h,LorentzVector.icc: * test/testLorentzVector.cc: Correction in const conversion operator. Thanks to Leif.Lonnblad@thep.lu.se. * Evaluator/Evaluator.cc,Evaluator.h: More accurate usage of const. ====================================================================== 24.10.00 Generic Functions by Joe Boudreau have become a part of CLHEP ====================================================================== Tue Oct 24 09:16:12 2000 Evgueni Tcherniaev * Makefile.in,configure.in: * GenericFunctions/Makefile.in (Added): * GenericFunctions/AbsFunction.cc,AbsFunction.hh (Added): * GenericFunctions/AbsFunctional.cc,AbsFunctional.hh (Added): * GenericFunctions/AbsParameter.cc,AbsParameter.hh (Added): * GenericFunctions/AnalyticConvolution.cc (Added): * GenericFunctions/AnalyticConvolution.hh (Added): * GenericFunctions/Argument.hh,ArgumentList.hh (Added): * GenericFunctions/AssociatedLaguerre.cc (Added): * GenericFunctions/AssociatedLaguerre.hh (Added): * GenericFunctions/AssociatedLegendre.cc (Added): * GenericFunctions/AssociatedLegendre.hh (Added): * GenericFunctions/ConstMinusFunction.cc (Added): * GenericFunctions/ConstMinusFunction.hh (Added): * GenericFunctions/ConstMinusParameter.cc (Added): * GenericFunctions/ConstMinusParameter.hh (Added): * GenericFunctions/ConstOverFunction.cc,ConstOverFunction.hh (Added): * GenericFunctions/ConstOverParameter.cc (Added): * GenericFunctions/ConstOverParameter.hh (Added): * GenericFunctions/ConstPlusFunction.cc,ConstPlusFunction.hh (Added): * GenericFunctions/ConstPlusParameter.cc (Added): * GenericFunctions/ConstPlusParameter.hh (Added): * GenericFunctions/ConstTimesFunction.cc (Added): * GenericFunctions/ConstTimesFunction.hh (Added): * GenericFunctions/ConstTimesParameter.cc (Added): * GenericFunctions/ConstTimesParameter.hh (Added): * GenericFunctions/Cos.cc,Cos.hh (Added): * GenericFunctions/CumulativeChiSquare.cc (Added): * GenericFunctions/CumulativeChiSquare.hh (Added): * GenericFunctions/DefiniteIntegral.cc,DefiniteIntegral.hh (Added): * GenericFunctions/Erf.cc,Erf.hh (Added): * GenericFunctions/Exponential.cc,Exponential.hh (Added): * GenericFunctions/FixedConstant.cc,FixedConstant.hh (Added): * GenericFunctions/FloatingConstant.cc,FloatingConstant.hh (Added): * GenericFunctions/FunctionComposition.cc (Added): * GenericFunctions/FunctionComposition.hh (Added): * GenericFunctions/FunctionConvolution.cc (Added): * GenericFunctions/FunctionConvolution.hh (Added): * GenericFunctions/FunctionDifference.cc (Added): * GenericFunctions/FunctionDifference.hh (Added): * GenericFunctions/FunctionDirectProduct.cc (Added): * GenericFunctions/FunctionDirectProduct.hh (Added): * GenericFunctions/FunctionNegation.cc,FunctionNegation.hh (Added): * GenericFunctions/FunctionPlusParameter.cc (Added): * GenericFunctions/FunctionPlusParameter.hh (Added): * GenericFunctions/FunctionProduct.cc,FunctionProduct.hh (Added): * GenericFunctions/FunctionQuotient.cc,FunctionQuotient.hh (Added): * GenericFunctions/FunctionSum.cc,FunctionSum.hh (Added): * GenericFunctions/FunctionTimesParameter.cc (Added): * GenericFunctions/FunctionTimesParameter.hh (Added): * GenericFunctions/Gaussian.cc,Gaussian.hh (Added): * GenericFunctions/GenericFunctions.hh (Added): * GenericFunctions/IncompleteGamma.cc,IncompleteGamma.hh (Added): * GenericFunctions/LikelihoodFunctional.cc (Added): * GenericFunctions/LikelihoodFunctional.hh (Added): * GenericFunctions/LogGamma.cc,LogGamma.hh (Added): * GenericFunctions/Parameter.cc,Parameter.hh (Added): * GenericFunctions/ParameterDifference.cc (Added): * GenericFunctions/ParameterDifference.hh (Added): * GenericFunctions/ParameterNegation.cc,ParameterNegation.hh (Added): * GenericFunctions/ParameterProduct.cc,ParameterProduct.hh (Added): * GenericFunctions/ParameterQuotient.cc,ParameterQuotient.hh (Added): * GenericFunctions/ParameterSum.cc,ParameterSum.hh (Added): * GenericFunctions/PeriodicRectangular.cc (Added): * GenericFunctions/PeriodicRectangular.hh (Added): * GenericFunctions/Power.cc,Power.hh (Added): * GenericFunctions/Rectangular.cc,Rectangular.hh (Added): * GenericFunctions/ReverseExponential.cc (Added): * GenericFunctions/ReverseExponential.hh (Added): * GenericFunctions/Sin.cc,Sin.hh (Added): * GenericFunctions/SphericalBessel.cc,SphericalBessel.hh (Added): * GenericFunctions/SphericalNeumann.cc,SphericalNeumann.hh (Added): * GenericFunctions/Sqrt.cc,Sqrt.hh (Added): * GenericFunctions/Square.cc,Square.hh (Added): * GenericFunctions/Variable.cc,Variable.hh,X.cc,X.hh (Added): * GenericFunctions/doc/Makefile (Added): * GenericFunctions/doc/PartiallyClosed.ps,TotallyClosed.ps (Added): * GenericFunctions/doc/WideOpen.ps,example.ps,hydrogen.ps (Added): * GenericFunctions/doc/genericFunctions.ps (Added): * GenericFunctions/doc/genericFunctions.tex (Added): * test/Makefile.in: * test/testGenericFunctions.cc,testGenericFunctions.out.save (Added): Added new package - GenericFunctions Mon Oct 23 17:54:56 2000 Evgueni Tcherniaev * config/CLHEP.h: Added definition of HepSTL. * docs/Random.html,validation.doc (Removed): * Random/doc/Random.html,validation.doc (Added): Moved docs for Random from docs/ to Random/doc/. ============================== 20.10.00 Release CLHEP-1.6.0.0 ============================== Thu Oct 19 17:22:28 2000 Evgueni Tcherniaev * configure.in: Enabled StdHepC++ on NT Tue Oct 17 14:55:45 2000 Evgueni Tcherniaev * Random/Randomize.h: Added distributions introduced in CLHEP-1.5. * Random/RandPoissonQ.cc,flatToGaussian.cc: * Tools/RandMultiGauss.h: * test/testRandDists.cc,testVectorDists.cc: Corrected warnings on Linux when compile with g++ -pedantic -Wall. Sun Oct 15 18:26:12 2000 Evgueni Tcherniaev * Geometry/Plane3D.h: Bug correction in transform(). Thanks to Helge.Voss@cern.ch. ============================================================================== 12.10.00 Expression Evaluator by Evgueni Tcherniaev has become a part of CLHEP Alist, String and Combination have been disabled ============================================================================== Thu Oct 12 11:28:06 2000 Evgueni Tcherniaev * Makefile.in,configure.in: * test/Makefile.in: Disabled Alist, String and Combination. * Makefile.in,configure.in: * Evaluator/Makefile.in,Evaluator.cc,Evaluator.h (Added): * Evaluator/setStdMath.cc setSystemOfUnits.cc (Added): * Evaluator/hash_map.src,stack.src,string.src,utility.src (Added): * test/Makefile.in: * test/testEvaluator.cc (Added): * test/testEvaluator.in,testEvaluator.out.save (Added): Added new package - Evaluator. Thu Sep 7 08:18:39 2000 Mark Fischler * Random/RandGauss.h,RandGauss.icc,RandGeneral.h,RandPoisson.icc: Correct warnings encountered by Yana Gaponenko. Tue Aug 22 11:33:33 2000 Mark Fischler * Matrix/GenMatrix.cc: Correction to operator==, to use indices 1-3 rather than 0-2. * Random/RandLandau.cc,gaussQTables.cdat: Fix warning by using xx.xxf wherever float arrays are being intialized. Mon Aug 14 09:59:51 2000 Evgueni Tcherniaev * config/config.guess: Added CYGWIN_98 platform. Wed May 10 23:18:17 2000 Lynn Garren * StdHepC++/StdEvent.cc,StdFI.cc: Fix for MVC++ Mon May 8 11:38:59 2000 Lynn Garren * StdHepC++/StdRun.cc: * StdHepC++/include/StdHepVer.h: * StdHepC++/include/stdver.h,stdver.inc (Removed): Keep version number in struct. * StdHepC++/doc/StdHepC++.tex (Added): Add the documentation. * StdHepC++/examples/GNUmakefile,RunXDR.cc,RunXDR.hh (Added): * StdHepC++/examples/StdHepXDR.cc hwghep.F hwtran.F (Added): * StdHepC++/examples/lunhep.F,lutran.F,readCXXXDR.cc (Added): * StdHepC++/examples/readCXXXDR.sh,readcxx.F,readtestF.cc (Added): * StdHepC++/examples/readtestF.sh,readtestFinit.F (Added): * StdHepC++/examples/stdflhwxsec.F,stdflpyxsec.F,stdhwgcxx.F (Added): * StdHepC++/examples/stdpytcxx.F,testHerwigtoCXX.cc (Added): * StdHepC++/examples/testHerwigtoCXX.sh,testPythiatoCXX.cc (Added): * StdHepC++/examples/testPythiatoCXX.sh (Added): Add the examples. * StdHepC++/examples/mcfio/GNUmakefile,mcf_NTuIOFiles.c (Added): * StdHepC++/examples/mcfio/mcf_NTuIOFiles.h,mcf_NTuIOUtils.c (Added): * StdHepC++/examples/mcfio/mcf_NTuIOUtils.h,mcf_StdHep_cxx.c (Added): * StdHepC++/examples/mcfio/mcf_Stdhep_xdr.c,mcf_evt_xdr.c (Added): * StdHepC++/examples/mcfio/mcf_nTupleDescript.h (Added): * StdHepC++/examples/mcfio/mcf_ntuBldDbinc.c (Added): * StdHepC++/examples/mcfio/mcf_ntuBldDbinc.h,mcf_ntubldInit.c (Added): * StdHepC++/examples/mcfio/mcf_ntubld_db.h,mcf_xdr.h (Added): * StdHepC++/examples/mcfio/mcf_xdr_Ntuple.h,mcfio.h mcfio.hh (Added): * StdHepC++/examples/mcfio/mcfio_Block.c,mcfio_Block.h (Added): * StdHepC++/examples/mcfio/mcfio_Dict.h,mcfio_Direct.c (Added): * StdHepC++/examples/mcfio/mcfio_Direct.h,mcfio_FBinding.c (Added): * StdHepC++/examples/mcfio/mcfio_FPrintDictionary.F (Added): * StdHepC++/examples/mcfio/mcfio_SeqDummy.c (Added): * StdHepC++/examples/mcfio/mcfio_Sequential.h (Added): * StdHepC++/examples/mcfio/mcfio_Util1.c,mcfio_Util1.h (Added): * StdHepC++/examples/mcfio/mcfio.inc (Added): Add the examples. ============================== 08.05.00 Release CLHEP-1.5.0.0 ============================== Mon May 8 14:38:15 2000 Evgueni Tcherniaev * configure.in: Recovered DISABLED_SUBDIRS. Sat May 6 08:48:17 2000 Evgueni Tcherniaev * Tools/Random/*.* (Removed): * Tools/Makefile.in,RandMultiGauss.cc,RandMultiGauss.h (Added): * Tools/RandomVector.cc,RandomVector.h,RandomVector.icc (Added): * test/testVectorDists.cc: RandMultiGauss and RandomVector have been moved to CLHEP/Tools. * Random/JamesRandom.cc: Commented unused "HepDouble uni;" * test/testVectorDists.cc: Added #include "CLHEP/config/TemplateFunctions.h" to ensure correct abs(double). * test/ranRestoreTest.cc: Changed std:: to HepStd:: * Makefile.in: * config/Makefile.common.in: Removed call of RANLIB. Fri May 5 14:38:09 2000 Lynn Garren * StdHepC++/Makefile.in,StdEvent.cc,StdEvent.hh: * StdHepC++/StdFI.cc,StdFI.hh (Added): * StdHepC++/inlude/stdhep.h: Clean up the Fortran interface. Fri May 5 10:32:21 2000 Mark Fischler * Random/JamesRandom.cc,JamesRandom.h: 's mods to JamesRandom are in. * Tools/Random/RandMultiGauss.cc: Changed std:: to HepStd:: * test/ranRestoreTest.cc,testRandDists.cc: Last round of minor warning fixes (in Random package) before the 1.5 release. Fri May 5 10:29:33 2000 Evgueni Tcherniaev * configure.in,Makefile.in: The Hist module has been disabled Tue Apr 25 16:09:21 2000 Evgueni Tcherniaev * Alist/Makefile.in,Combination/Makefile.in,Geometry/Makefile.in: * Hist/Makefile.in,Matrix/Makefile.in,Random/Makefile.in: * StdHepC++/Makefile.in,StdHepC++/include/Makefile.in: * String/Makefile.in,Units/Makefile.in,Vector/Makefile.in: * Utilities/Makefile.in: * config/Makefile.common.in,Makefile.in: Added HEADERS for installation of header and data files ============================================================ 24.04.00 StdHepC++ by Lynn Garren has become a part of CLHEP ============================================================ Mon Apr 24 17:50:14 2000 Evgueni Tcherniaev * Makefile.in,configure.in: * StdHepC++/Makefile.in (Added): * StdHepC++/StdCollision.cc,StdCollision.hh (Added): * StdHepC++/StdEvent.cc,StdEvent.hh (Added): * StdHepC++/StdParticle.cc,StdParticle.hh (Added): * StdHepC++/StdParticleData.cc,StdParticleData.hh (Added): * StdHepC++/StdRun.cc,StdRun.hh,StdStreams.hh (Added): * StdHepC++/include/Makefile.in (Added): * StdHepC++/include/herwig.inc,stdcm1.h,stdcm1.inc (Added): * StdHepC++/include/stdcnt.h,stdcnt.inc,stdevent.h (Added): * StdHepC++/include/stdhep.h,stdhep.inc,stdlun.h,stdlun.inc (Added): * StdHepC++/include/stdtmp.h,stdver.h,stdver.inc (Added): Added source files for StdHepC++ * config/Makefile.common.in: *.hh and *.inc have been added to the list of possible extentions for header files Sun Apr 23 18:31:42 2000 Evgueni Tcherniaev * configure.in: * config/CLHEP-target.h.in: * config/iosfwd.h (Added): Added test for HEP_HAVE_IOSFWD Sat Apr 22 11:20:22 2000 Evgueni Tcherniaev * test/Makefile.in: Removed testQuickGauss. Tue Apr 18 15:36:49 2000 Mark Fischler * test/testRandDists.input,testRandDists.out.save: Committing the re-run input and result files. * test/testQuickGauss.cc (Removed): * test/testQuickGauss.input,testQuickGauss.out.save (Removed): Mon Apr 17 18:00:55 2000 Mark Fischler * Random/RandLandau.cc,RandPoissonQ.cc,flatToGaussian.cc: Added explicit convertion from double to int. * Random/erfQ.cc,flatToGaussian.cc: Included "CLHEP/config/TemplateFunctions.h" * Random/Stat.h: Made constructor private; removed private destructor. * Random/gaussQtables.src,gaussTables.src,poissonTables.src: Changed std:: to HepStd:: Sun Apr 16 11:05:32 2000 Evgueni Tcherniaev * test/testCmd.out.save (Added): * test/Makefile.in: Added comparison with control output for testCmd; cosmetic changes Fri Apr 14 16:59:11 2000 Evgueni Tcherniaev * configure.in: Added tests for HEP_HAVE_STL and HEP_USE_STD_STL * config/CLHEP-target.h.in: Added HEP_HAVE_STL and HEP_USE_STD_STL flags * config/CLHEP.h: Added definition of HepStdString, HepStdVector and HepStdList * Makefile.in: * config/Makefile.common.in: * test/Makefile.in: Added for gmake [dist]clean rm -fr cxx_repository Templates.DB SunWS_cache ii_files ti_files Wed Apr 5 10:16:40 2000 Evgueni Tcherniaev * Vector/LorentzVector.cc,ThreeVector.cc: operator(): removed "rdummy" - unnecessary reference to a static variable "dummy" * String/Strings.cc,Strings.h: HepString::operator+() has been declared as const. Thanks to Abi Soffer for the problem report. Added check for whether char* passed to operator= is "this" or not. Fix provided by Stephen J. Gowdy * test/testAList.cc,testComb.cc,testStrings.cc: Fixes of memory leaks provided by BaBar. * test/testCmd.cc: Output bool as with "true" or "false". Tue Apr 4 18:13:08 2000 Evgueni Tcherniaev * Random/RandFlat.cc,RandGauss.cc: restoreEngineStatus(): changed "char* inputword" to "char inputword[]" * Random/Makefile.in: added new files. * test/Makefile.in: added new tests. * test/ranRestoreTest.cc: changed std:: to HepStd:: * test/ranRestoreTest.cc: Changed for( HepInt k=0; ... to HepInt k; for(k=0; ... * test/gaussTables.cc (Removed): * Random/gaussTables.src (Added): Moved test/gaussTables.cc to Random/gaussTables.src * test/validation.doc (Removed): * docs/validation.doc (Added): moved test/validation.doc to docs/validation.doc Tue Mar 28 10:40:19 2000 Mark Fischler * Random/Stat.h (Added): Added the omitted Stat.h * Random/gaussQtables.src,gaussTables.src,poissonTables.src: These files are not run routinely but are part of the package to document how the .cdat tables are created. * Random/RandFlat.cc,RandGauss.cc,RandPoissonQ.cc: Removed use of std::string from files. Corrected bare std:: to HepStd:: * test/ranRestoreTest.cc (Added): Added a brief test of the save/restore mechanism. Mon Mar 13 11:12:41 2000 Mark Fischler * Tools/Random/RandMultiGauss.cc,RandMultiGauss.h (Added): * Tools/Random/RandomVector.cc,RandomVector.h,RandomVector.icc (Added): * test/testVectorDists.cc,testVectorDists.input (Added): * test/testVectorDists.out.save (Added): The vector distribution RandMiultiGauss, this time in its proper place in Tools/Random and with a validity test in test. Fri Mar 10 15:59:57 2000 Mark Fischler * Random/RandFlat.cc,RandFlat.h,RandFlat.icc: * Random/RandGauss.cc,Random/RandGauss.h,RandGauss.icc: Workaround for the save/restore misbehavior bug. * Random/RandPoisson.cc,RandPoisson.h,RandPoisson.icc: Provide for inheritors to have access to defaultMean and other necessities. RandPoisson.cc: gammln is removed from this file. gammln now is in the library on its own merits, via the HepStat class. However, to retain backward compatibility with codes that may incidentally use ::gammln (since it was already in the library due to RandPoisson.cc) we place that (ugly global) definition into RandPoisson.cc, pointing it to HepStat::gammln. * Random/RandBit.cc RandBit.h RandBit.icc (Added): RandBit is equivalent to (and derived from) RandFlat. The only difference is that RandBit is state-free. RandBit::shootBit() and fireBit() will always use ONE uniform random and return just one bit. That is slower than RandFlat::shootBit() but will behave correctly with respect to saving and restoring status. (Surprisingly, the static version RandBit::shootBit() (which uses a JamesRandom engine) appears to be only 2.5 times slower than RandFlat::shootBit() (which caches the word, using the engine more rarely. I would have expected a factor of 8-15.) * Random/RandGaussQ.cc,RandGaussQ.h,RandGaussQ.icc (Added): A quicker but less accurate distribution, inheriting from RandGauss so that it may be used as a drop-in replacement. Stateless. * Random/RandGaussT.cc,RandGaussT.h,RandGaussT.icc (Added): An accurate and stateless (won't exhibit save/restore bug) table-driven distribution, inheriting from RandGauss so that it may be used as a drop-in replacement. * Random/RandLandau.cc,RandLandau.h,RandLandau.icc (Added): Landau distribution, using the method in CERNLIB. * Random/RandPoissonQ.cc,RandPoissonQ.h,RandPoissonQ.icc (Added): A quicker but (for mu > 100) less accurate distribution, inheriting from RandPoisson so that it may be used as a drop-in replacement. Even at mu > 100, 6-digit accurate or better. * Random/RandPoissonT.cc,RandPoissonT.h,RandPoissonT.icc (Added): An accurate and stateless (won't exhibit save/restore bug) table-driven distribution, inheriting from RandPoisson so that it may be used as a drop-in replacement. Below mu = 100, this is 3-7 times faster than RandPoisson. Recommended as a replacement. * Random/erfQ.cc,flatToGaussian.cc,gammln.cc (Added): Various ancillary mathematical functions needed for the distributions. Users may if they wish avail themsleves of this; the list is in the header Stat.h. * Random/gaussQTables.cdat,poissonTables.cdat (Added): Tables for the table-driven forms of Gaussian and Piosson distributions. * test/testRandDists.cc,testRandDists.input,testRandDists.out.save: Include tests of the various new forms of Gaussian and Poisson dists. * test/validation.doc (Added): A file detailing the validation tests, validation levels, and approximate timings of each distribution. Thus far we have validated the gaussian, poisson, and RandGeneral distributions. Thu Jan 27 15:21:27 2000 Evgueni Tcherniaev * Vector/ThreeVector.cc: rotateUz(): fix proposed by the Geant4 team to avoid accuracy problems noticed on DEC-cxx. Mon Oct 25 10:41:20 1999 Evgueni Tcherniaev * Vector/LorentzVector.cc,ThreeVector.cc: Added static in declaration of dummy in operator() * Vector/Rotation.cc: getAngleAxis(): added test for cos(a) < -1 Mon Oct 18 20:09:49 1999 Evgueni Tcherniaev * config/Makefile.common.in: Added installation of *.cdat files * Random/NonRandomEngine.cc,RandGauss.cc: std:: --> HepStd::, some trivial cleaning * Random/Makefile.in: Added NonRandomEngine.cc * test/Makefile.in,gaussTables.cc,testQuickGauss.cc: * test/testRandDists.out.save: * test/testQuickGauss.input testQuickGauss.out.save (Added): Modifications caused by introduction of testQuickGauss.cc and gaussTables.cc Tue Oct 12 11:13:49 1999 Mark Fischler * Random/RandGauss.cc,RandGauss.h,RandGauss.icc: RandGauss is made stateless, repairing the bug of saveEngineStatus not saving enough info to reproduce the sequence correctly. RandGauss now has a method quick() which is the same as fire() but gives deviates which are gaussian to only 6 digit precision -- it runs faster. * Random/NonRandomEngine.cc,NonRandomEngine.h (Added): * test/gaussTables.cc,testQuickGauss.cc,gaussTables.cdat (Added): gaussTables.cdat contains 30K of table data needed for RandGauss. It was generated by gaussTables.cc; that is included just to document how the table was produced. gaussTables.cdat is compiled into RandGauss.cc (by an #include) so that user codes don't have to depend on the table being present (and don't have to waste time reading in the table). A new engine, NonRandomEngine, is included primarily for the use of developers testing their code's behavior - it allows you to dictate the sequence of randoms supplied by the engine. Tue Aug 10 16:52:54 1999 Evgueni Tcherniaev Improvements provided by David Morrison : * Makefile.in,test/Makefile.in: configure --prefix=... * config/Makefile.common.in: No error messages during installation in case of absence of *.icc files Fri Aug 6 12:02:20 1999 Evgueni Tcherniaev * config/CLHEP.h: * Combination/Lockable.cc: * Geometry/Plane3D.cc,Plane3D.h,Transform3D.cc: * Hist/HBookFile.cc,TupleManager.cc: * Matrix/: * DiagMatrix.cc,DiagMatrix.h,GenMatrix.cc,Matrix.cc,Matrix.h: * Pile.h,SymMatrix.cc,SymMatrix.h,Vector.cc,Vector.h: * Random/: * DRand48Engine.cc,DRand48Engine.h,DualRand.cc,DualRand.h: * Hurd160Engine.cc,Hurd160Engine.h,Hurd288Engine.cc: * Hurd288Engine.h,JamesRandom.cc,JamesRandom.h,MTwistEngine.cc: * MTwistEngine.h,RandEngine.cc,RandEngine.h,RandGeneral.cc: * RanecuEngine.cc,RanecuEngine.h,Ranlux64Engine.cc: * Ranlux64Engine.h,RanluxEngine.cc,RanluxEngine.h: * RanshiEngine.cc,RanshiEngine.h,TripleRand.cc,TripleRand.h: * String/: * CmdLine.cc,CmdLine.h,Strings.cc,Strings.h,Strings.icc: * Vector/: * LorentzRotation.cc,LorentzVector.cc,LorentzVector.h: * Rotation.cc,ThreeVector.cc,ThreeVector.h,ThreeVector.icc: * test/: * testAList.cc,testCmd.cc,testComb.cc,testInversion.cc: * testLorentzVector.cc,testMatrix.cc,testRandDists.cc: * testRandom.cc,testStrings.cc,testThreeVector.cc,testUnits.cc: Changed std:: to HepStd:: to avoid problems on OSF Thu Jul 22 16:59:16 1999 Gabriele Cosmo * Alist/ConstAList.icc: Added cast to (const void*) instead of (void*) * Matrix/GenMatrix.cc,GenMatrix.h,GenMatrix.icc: Removed pile-up mechanism and replaced with a simple array-based allocation. It fixes nasty memory leaks. Mon Jul 5 21:15:56 1999 Evgueni Tcherniaev * Vector/LorentzVector.h,LorentzVector.icc: Added 'const' to the parameter of rotateUz() Fri Jul 2 19:02:10 1999 Mark Fischler * Matrix/Vector.h: class HepSymMatrix; class HepDiagMatrix; needed to be forward-declared in Vector.h so that some rather strict compilers would not issue a message. Thu May 27 17:04:02 1999 Mark Fischler * Random/: * DualRand.cc,RandFlat.icc,Ranlux64Engine.cc,SeedTable.h: * TripleRand.cc,TripleRand.h: fixed up things that were causing warnings on pedantic compilers: * order of initialization in RandFlat * added {} around each pair of elements in seedTable * eliminated the funky private accessors in TripleRand * test/testRandDists.cc: Minor modification to work with NT. Modifications to do better validation: Moments up to 6th and pdf at intervals of .5 sigma. Sat May 22 12:02:31 1999 Evgueni Tcherniaev * INSTALL,README: Added reference to the CLHEP Web page: http://wwwinfo.cern.ch/asd/lhc++/clhep/index.html Fri May 21 14:37:52 1999 Evgueni Tcherniaev * Random/: * DRand48Engine.cc,DualRand.cc,Hurd160Engine.cc,Hurd288Engine.cc: * JamesRandom.cc,MTwistEngine.cc,RandEngine.cc,RanecuEngine.cc: * Ranlux64Engine.cc,RanluxEngine.cc,RanshiEngine.cc,TripleRand.cc: All char* beginMarker, char* endMarker have been changed to char beginMarker[], char endMarker[] to avoid warnings on HP-aCC * test/testRandDists.cc: Changed: #include --> #include "CLHEP/config/TemplateFunctions.h" std:exp(...) --> exp(...) bool --> HepBoolean * test/testRandDists.dat (Removed): * testRandDists.input (Added): Renamed: testRandDists.dat to testRandDists.input * test/Makefile.in: * testRandDists.out.save (Added): Modifications needed for automatic run of testRandDists Thu May 20 09:44:06 1999 Mark Fischler * Random/: * DRand48Engine.cc,DRand48Engine.h,DualRand.cc,DualRand.h: * Hurd160Engine.cc,Hurd160Engine.h,Hurd288Engine.cc,Hurd288Engine.h: * JamesRandom.cc,JamesRandom.h,MTwistEngine.cc,MTwistEngine.h: * RandBinomial.cc,RandBinomial.h,RandBinomial.icc: * RandBreitWigner.cc,RandBreitWigner.h,RandBreitWigner.icc: * RandChiSquare.cc,RandChiSquare.h,RandChiSquare.icc: * RandEngine.cc,RandEngine.h,RandExponential.cc,RandExponential.h: * RandExponential.icc,RandFlat.cc,RandFlat.h,RandFlat.icc: * RandGamma.cc,RandGamma.h,RandGamma.icc,RandGauss.cc,RandGauss.h: * RandGauss.icc,RandGeneral.cc,RandGeneral.h,RandGeneral.icc: * RandPoisson.cc,RandPoisson.h,RandPoisson.icc: * RandStudentT.cc,RandStudentT.h,RandStudentT.icc: * Random.cc,Random.h,Random.icc,RandomEngine.cc,RandomEngine.h: * RandomEngine.icc,Randomize.h,RanecuEngine.cc,RanecuEngine.h: * Ranlux64Engine.cc,Ranlux64Engine.h,RanluxEngine.cc,RanluxEngine.h: * RanshiEngine.cc,RanshiEngine.h,TripleRand.cc,TripleRand.h: * SeedTable.h: The merge of G. Cosmos January improvements with the ZOOM enhancements. Details of the modifications: * Hurd160Engine.cc,Hurd288Engine.cc: Made a mod to correct the following flaw -- given N consectutive calls to operator unsigned int() to get N random 32-bit integers, you can deduce the state of a Hurd engine and thus predict the next number. The simple expedient of discarding every Nth number plugs this flaw. Also, the earlier version was able to give identical sequences in two forms of the constructors (very unlikely, but possible). In the newer version, the only way to get the same sequence is to explicitly provide the same seeds in the same way. * Ranlux64Engine.cc: The early version was using an algorithm which differed from that intended by Luscher (though it passes our ergodicity tests). The modified one correctly implements the algorithm, so Luscher's randomness arguments hold rigorously. * RanshiEngine.cc,DualRand.cc,TripleRand.cc: In the early version, the constructor taking explicit seeds still used numEngine to affect the starting state. This was not the intention, and that has been corrected. So any program supplying explicit seeds to one of these engines will deliver a different stream than before. (The default constructor is unaffected - the dependence on numEngines is the proper behavior in that case.) Wed May 19 16:43:17 1999 Mark Fischler * test/testRandDists.cc,testRandDists.dat (Added): Added a validation program for Random distributions. Tue May 11 17:17:43 1999 Evgueni Tcherniaev * Vector/LorentzVector.cc,ThreeVector.cc: Simplified input from a stream. Removed coupling with HepString * test/testLorentzVector.input,testLorentzVector.out.save (Added): * testThreeVector.input testThreeVector.out.save (Added): * test/Makefile.in,testLorentzVector.cc,testThreeVector.cc: Added tests for input/output from/to a stream Sat May 1 11:53:14 1999 Evgueni Tcherniaev * ChangeLog: Information in ChangeLog has been reformated to allow to use enscript for preparing html version of ChangeLog: enscript -E --color -Whtml -pchangelog.html ChangeLog ChangeLog is now available on the Web, see: http://wwwinfo.cern.ch/asd/lhc++/clhep/index.html ============================== 20.04.99 Release CLHEP-1.4.0.0 ============================== Tue Apr 20 09:24:34 1999 Evgueni Tcherniaev * config/CLHEP-target.h.in: Added HEP_HAVE_EXPLICIT and HEP_HAVE_TYPENAME flags * config/CLHEP.h: Added new macros: HEP_TEMPLATE_SPECIALIZATION, HEP_BEGIN_NAMESPACE, HEP_END_NAMESPACE, HEP_USING_NAMESPACE, explicit and typename * configure.in: Added tests for "explicit" and "typename" Sun Apr 18 15:36:46 1999 Evgueni Tcherniaev * Geometry/Transform3D.h: Changes in comments to avoid warnings when compile with g++ -Wall -pedantic Sat Apr 17 10:54:17 1999 Evgueni Tcherniaev * Alist/CList.icc: Memory leakage fix in HepCList::remove(const T & e); by request of G.Cosmo Sun Apr 11 09:03:37 1999 Evgueni Tcherniaev * test/testRotation.cc: Added tolerance DEL in comparisons Tue Apr 6 19:13:35 1999 Evgueni Tcherniaev * Geometry/Normal3D.h,Plane3D.h,Point3D.h,Vector3D.h: Added explicit destructor by request of S.Giani Tue Mar 30 20:52:58 1999 Evgueni Tcherniaev * Random/RandGeneral.cc,RandGeneral.h: Modifications provided by Stefano Magni Mon Mar 22 09:42:55 1999 Evgueni Tcherniaev * configure.in: Added tests for "template<>" and "namespace" * config/CLHEP-target.h.in: Added HEP_HAVE_EMPTY_TEMPLATE_PARAMETER_LIST and HEP_HAVE_NAMESPACE macros Tue Feb 23 19:02:32 1999 Evgueni Tcherniaev * Vector/Rotation.cc: More efficient implementation of rotateX(), rotateY(), rotateZ() Mon Feb 22 15:56:41 1999 Evgueni Tcherniaev * Vector/Rotation.cc: More efficient implementation of rotate(angle, axis) * test/testRotation.cc (Added): * test/Makefile.in: Added test for HepRotation Thu Feb 18 12:19:13 1999 Evgueni Tcherniaev * Vector/ThreeVector.icc: More efficient implementation of setPhi(). Mon Feb 15 19:01:54 1999 Evgueni Tcherniaev * Vector/ThreeVector.cc,ThreeVector.h: Added const in the parameter list Fri Feb 12 11:37:21 1999 Evgueni Tcherniaev * configure.in: Added +DAportable option for CC * test/testUnits.cc: Added check that local variables do not interfere with global ones Thu Feb 4 11:38:32 1999 Evgueni Tcherniaev * test/testMatrix.out.save: Update: the initial random sequence is now different Fri Jan 29 02:33:37 1999 Gabriele Cosmo * Random/: * RandBreitWigner.cc,RandExponential.cc,RandExponential.h: * RandExponential.icc,RandFlat.cc,RandFlat.h,RandFlat.icc: * RandGauss.cc,RandPoisson.cc,Random.cc,Random.h,Randomize.h: *** HEPRandom 2.1.1 *** - Fixes for porting on AIX 4.3.2. No functional changes. - Forced call to HepRandom::createInstance() in Randomize.h. - Minor cosmetic changes. * docs/Random.html: *** HEPRandom 2.1.1 *** - Updated doc. Wed Jan 27 17:14:28 1999 Evgueni Tcherniaev * Vector/LorentzVector.h,LorentzVector.icc: * test/testLorentzVector.cc: Added operator*= and operator* for scaling with HepDouble Thu Jan 21 10:07:21 1999 Evgueni Tcherniaev * configure.in: Added +DAportable option for HP-aCC(f77) by request of ATLAS * Vector/LorentzVector.cc,ThreeVector.cc: Fix in operator >> provided by Gabriele Cosmo. Wed Jan 20 23:57:01 1999 Gabriele Cosmo * Random/RandGauss.h: Methods setFlag(false) and setF(false) if invoked in the client code before shoot/fire will force generation of a new couple of values. Thu Jan 14 15:14:40 1999 Evgueni Tcherniaev * Vector/: * LorentzRotation.h,LorentzRotation.icc,Rotation.h,Rotation.icc: Added missing const in operator[] * config/Makefile.common.in,test/Makefile.in: Removed -DCLHEP_TARGET_H=<...> to avoid problem on Linux Wed Jan 13 09:59:26 1999 Evgueni Tcherniaev * Vector/: * LorentzVector.cc,LorentzVector.h,ThreeVector.cc,ThreeVector.h: Added streaming operator >> * Vector/LorentzVector.h,LorentzVector.icc: Introduced setVectMag() and setVectM() functions. * Matrix/SymMatrix.cc,test/testInversion.cc: Removed declaration of unused variables Tue Jan 12 15:36:41 1999 Evgueni Tcherniaev * Vector/Rotation.h,LorentzRotation.h: Helper classes HepRotation_row and HepLorentzRotation_row moved to public to avoid warnings on SUN. * Vector/: * LorentzVector.cc,LorentzVector.h,ThreeVector.cc,ThreeVector.h: Introduced enum for save indexing of the coordinates. Fri Jan 8 00:16:23 1999 Gabriele Cosmo * Random/: * RandBinomial.h,RandBinomial.icc,RandChiSquare.h: * RandChiSquare.icc,RandGamma.h,RandGamma.icc,RandGauss.cc: * RandGauss.h,RandGeneral.cc,RandPoisson.cc,RandPoisson.h: * RandStudentT.h,RandStudentT.icc,Random.cc,Random.h,Random.icc: *** HEPRandom 2.1.0 *** Random (.h.icc.cc) : relocated Gauss and Poisson data; simplified initialisation of static generator. RandGauss (.h.cc), RandPoisson (.h.cc) : relocated static data from HepRandom. RandBinomial (.h.icc), RandChiSquare (.h.icc), RandGamma (.h.icc), RandStudentT (.h.icc) : cleanup of useless data/methods. RandGeneral (.cc) : fixed bug in initialisation of theIntegralPdf[] in two constructors and added validity check (courtesy of M.G.Pia) * docs/Random.html: *** HEPRandom 2.1.0 *** - Updated version number. No functional changes. Thu Jan 7 15:20:22 1999 Evgueni Tcherniaev * Vector/ThreeVector.icc: More efficient implementation of setMag(). Fixed bug in angle() to protect from acos() of number greater than 1. * Vector/LorentzRotation.h,LorentzRotation.icc: Introduced transform(const HepRotation &) for pure spacelike rotation. Wed Jan 6 17:34:18 1999 Evgueni Tcherniaev * Matrix/SymMatrix.cc,SymMatrix.h: New invert() based on "Bunch-Kaufman" algorithm. * test/Makefile.in: * test/testInversion.cc,testInversion.out.save (Added): Added test for new inversion algorithm. Sun Dec 20 12:05:12 1998 Evgueni Tcherniaev * Random/Randomize.h: Changed RandFlat::shoot() to HepRandom::getTheEngine()->flat() in the definition of HepUniformRand(). Fri Dec 18 11:00:23 1998 Evgueni Tcherniaev * Matrix/Matrix.cc,Matrix.h,SymMatrix.cc,Vector.cc: Changed dfact() and dfinv() to dfact_matrix() and dfinv_matrix() to avoid conflicts with correspondent CERNLIB symbols. * Matrix/GenMatrix.cc,GenMatrix.h: Added operator== * Matrix/GenMatrix.icc: Added implementations of operator[] for GenMatrix_row and GenMatrix_row_const. Commented-out (temporary solution) pile-up mechanism in delete_m() and new_m() since responsible of huge mwmory leaks. * Matrix/Matrix.cc: Fixed bug in dfact_matrix() and introduced "epsilon" constant. * Matrix/Pile.h: Moved private data on bottom and destructor on top: trick needed to fix a bug in VxWorks which requires destructors of template classes to be declared at the begining. Thu Dec 17 10:31:30 1998 Evgueni Tcherniaev * Alist/AList.h,AList.icc,AListBase.cc,AListBase.h,AListBase.icc: Added "const" qualifier in arguments for remove(), hasMember(), index(), fIndex(). * Alist/AListBase.cc: Fixed bug in copy constructor. * Alist/CList.icc: Bug fix in removeAll(); by request of Nobu Katayama. Wed Dec 16 16:53:32 1998 Evgueni Tcherniaev * String/Strings.cc,Strings.h: Fixed bug in both constructors which was causing memory leaks * Utilities/CLHEP.h,fortran.h: Some fixes from BaBar ========================================================================= 16.12.98 Started: merging with BaBar version of CLHEP provided by G.Cosmo ========================================================================= Fri Dec 11 11:58:09 1998 Evgueni Tcherniaev * config/CLHEP.h: * Matrix/Matrix.cc,Matrix.h,Vector.cc,Vector.h: * tests/testMatrix.cc: Introduced HEP_USE_VECTOR_MODULE flag to facilitate disabling dependence between the Matrix and Vector modules * Utilities/CLHEP.h: Added config/TemplateFuntions.h by request of G.Cosmo Thu Dec 10 11:43:47 1998 Evgueni Tcherniaev * config/Makefile.common.in: * test/Makefile.in: Changed COMPILER_FLAG: "" replaced by <> to avoid problems with KCC-3.3e Mon Dec 7 09:44:05 1998 Evgueni Tcherniaev * config/config.guess: Added CYGWIN_NT platform. It has been introduced in CYGNUS 1.20 (see uname -a). Sat Dec 5 19:30:24 1998 Evgueni Tcherniaev * configure.in: Added test for detection of the std namespace. The -DHEP_USE_NEW_STYLE_HEADER option no more exists, the HEP_USE_STD macro has been introduced instead. Compiler options for DEC: cxx -O -std strict_ansi -timplicit_local * config/: * CLHEP-target.h.in,CLHEP.h: * fstream.h,iomanip.h,iostream.h,strstream.h: Macro HEP_USE_STD has been introduced. * Combination/Lockable.cc: * Geometry/Plane3D.cc,Plane3D.h,Transform3D.cc: * Hist/HBookFile.cc,TupleManager.cc: * Matrix/: * DiagMatrix.cc,DiagMatrix.h,GenMatrix.cc,Matrix.cc,Matrix.h: * Pile.h,SymMatrix.cc,SymMatrix.h,Vector.cc,Vector.h: * Random/: * DRand48Engine.cc,DRand48Engine.h,DualRand.cc,DualRand.h: * Hurd160Engine.cc,Hurd160Engine.h,Hurd288Engine.cc: * Hurd288Engine.h,JamesRandom.cc,JamesRandom.h,MTwistEngine.cc: * MTwistEngine.h,RandEngine.cc,RandEngine.h,RanecuEngine.cc: * RanecuEngine.h,Ranlux64Engine.cc,Ranlux64Engine.h: * RanluxEngine.cc,RanluxEngine.h,RanshiEngine.cc,RanshiEngine.h: * TripleRand.cc,TripleRand.h: * String/: * CmdLine.cc,CmdLine.h,Strings.cc,Strings.h,Strings.icc: * Vector/: * LorentzRotation.cc,LorentzVector.cc,LorentzVector.h: * Rotation.cc,ThreeVector.cc,ThreeVector.h: * test/: * testAList.cc,testCmd.cc,testComb.cc,testLorentzVector.cc: * testMatrix.cc,testRandom.cc,testStrings.cc,testUnits.cc: Added std:: for all I/O statements Thu Dec 3 10:59:23 1998 Evgueni Tcherniaev * configure.in: Added test for HEP_QSORT_NEEDS_FUNCTION_WITH_EXTERN_C_LINKAGE macro Compiler options for cxx changed: -O -std strict_ansi -timplicit_local -DHEP_USE_NEW_STYLE_HEADER * Alist/AList.icc,AListBase.h,AListBase.icc,ConstAList.icc: * config/CLHEP-target.h.in: Added HEP_QSORT_NEEDS_FUNCTION_WITH_EXTERN_C_LINKAGE macro * test/testStrings.cc: With introduction of the -std strict_ansi option the problem with core dump on the DEC platform has disappered. Fri Oct 23 14:14:07 1998 Evgueni Tcherniaev * Geometry/Point3D.h: Added const in arguments of distance() and distance2() Fri Oct 9 10:43:33 1998 Evgueni Tcherniaev * Vector/LorentzVector.h,LorentzVector.icc,ThreeVector.cc: Added transverse mass mt=sqrt(perp2()+m2()) Thu Oct 8 15:47:44 1998 Evgueni Tcherniaev * Vector/ThreeVector.h,ThreeVector.cc: Added pseudoRapidity() * Vector/LorentzVector.cc,LorentzVector.h,LorentzVector.icc: Added rapidity() and pseudoRapidity() Mon Sep 28 09:06:56 1998 Evgueni Tcherniaev * configure.in: Some modifications for a case NT & g++ * Matrix/DiagMatrix.icc: Bug fix: ncol has been changed to nrow by request of Nobu Katayama Sun Sep 27 19:58:43 1998 Evgueni Tcherniaev * Vector/: * ThreeVector.h,ThreeVector.icc,ThreeVector.cc: * LorentzVector.h,LorentzVector.icc,LorentzVector.cc: Added operator[] to read/write the vector components by index * Vector/: * LorentzRotation.cc,LorentzRotation.h,LorentzRotation.icc: * Rotation.cc,Rotation.h,Rotation.icc: Added C-style subscripts r[i][j] * test/Makefile.in: * test/testSubscripts.cc (Added): Test for subscripts for the classes from the Vector module Mon Sep 14 15:24:00 1998 Evgueni Tcherniaev * config/TemplateFunctions.h: Included #undef for possible existing min/max/sqr/abs macros * Units/SystemOfUnits.h: Added angstrom, picobarn, microsecond, picosecond, petaelectronvolt * Vector/: * ThreeVector.h,ThreeVector.icc,LorentzVector.h,LorentzVector.icc: Added setPerp() by request of LHCB. Wed Aug 26 11:52:52 1998 Evgueni Tcherniaev * Random/ : * DualRand.cc,Hurd160Engine.cc,Hurd288Engine.cc,MTwistEngine.cc: * RanshiEngine.cc,TripleRand.cc: Some changes to avoid warnings on HP-CC Tue Aug 25 12:13:08 1998 Evgueni Tcherniaev * Random/fc.cc (Removed): * Random/Makefile.in,RandBinomial.cc,RandBinomial.h: fc() has been renamed to StrirlingCorrection() and moved to RandBinomial.cc Sun Aug 23 19:47:09 1998 Evgueni Tcherniaev * Random/: * DRand48Engine.cc,DualRand.cc,Hurd160Engine.cc,Hurd288Engine.cc: * JamesRandom.cc,MTwistEngine.cc,RandEngine.cc,RanecuEngine.cc: * Ranlux64Engine.cc,RanluxEngine.cc,RanshiEngine.cc: * TripleRand.cc: Removed #ifdef IRIX_6_2_CC_7_1. All is.setstate(ios::badbit); replaced by is.clear(ios::badbit | is.rdstate()); Sat Aug 22 16:25:47 1998 Evgueni Tcherniaev * Random/: * DualRand.cc,Hurd160Engine.cc,Hurd288Engine.cc,JamesRandom.cc: * MTwistEngine.cc,RandomEngine.h,Ranlux64Engine.cc: * RanluxEngine.cc,RanshiEngine.cc,TripleRand.cc: #include "CLHEP/config/iomanip.h" moved to RandomEngine.h Fri Aug 21 11:33:33 1998 Evgueni Tcherniaev * Random/: * DualRand.cc,Hurd160Engine.cc,Hurd288Engine.cc,RanshiEngine.cc: * TripleRand.cc: Changed order of the #include macros: config/iomanip.h should be the last. * Random/RandStudentT.cc,fc.cc: Removed #include * test/testMatrix.out.save: Output for testMatrix has been changed after modification of the Random module Fri 21 Aug 03:10:24 1998 Gabriele Cosmo * Random/: * DualRand.cc,DualRand.h,Hurd160Engine.cc,Hurd160Engine.h: * Hurd288Engine.cc,Hurd288Engine.h,MTwistEngine.cc,MTwistEngine.h: * RandBinomial.cc,RandBinomial.h,RandBinomial.icc,RandBreitWigner.icc: * RandChiSquare.cc,RandChiSquare.h,RandChiSquare.icc: * RandExponential.icc,RandGamma.cc,RandGamma.h,RandGamma.icc: * RandGauss.icc,RandGeneral.cc,RandGeneral.h,RandGeneral.icc: * RandPoisson.icc,RandStudentT.cc,RandStudentT.h,RandStudentT.icc: * Ranlux64Engine.cc,Ranlux64Engine.h,RanshiEngine.cc,RanshiEngine.h: * TripleRand.cc,TripleRand.h,fc.cc (Added): * Random/: * DRand48Engine.cc,DRand48Engine.h,JamesRandom.cc,JamesRandom.h: * Makefile.in,RandBreitWigner.cc,RandBreitWigner.h,RandEngine.cc: * RandEngine.h,RandExponential.cc,RandExponential.h,RandFlat.cc: * RandFlat.h,RandFlat.icc,RandGauss.cc,RandGauss.h,RandPoisson.cc: * RandPoisson.h,Random.cc,Random.h,Random.icc,RandomEngine.cc: * RandomEngine.h,RandomEngine.icc,Randomize.h,RanecuEngine.cc: * RanecuEngine.h,RanluxEngine.cc,RanluxEngine.h,SeedTable.h: * test/testRandom.cc,testRandom.input: * docs/Random.html: *** HEPRandom 2.0.0a *** Merged additions and new developments by FNAL-Zoom group. Added RandGeneral class, courtesy of S.Magni and G.Pieri (INFN-Milano). Needs validation on supported compilers. ========================== 28.07.98 Release CLHEP-1.3 ========================== Mon Jul 27 18:01:15 1998 Evgueni Tcherniaev * config/fstream.h,iomanip.h,iostream.h,strstream.h: WIN32 option has been changed to HEP_USE_NEW_STYLE_HEADERS Sat Jul 25 15:55:04 1998 Evgueni Tcherniaev * configure.in: Compiler options for NT: -DWIN32 -Oi -Ot -Oy -Ob1 -Gs -Gf -Gy -GX -MD Thu Jul 23 10:05:36 1998 Evgueni Tcherniaev * test/testFRandom.f,.cvsignore (Removed): * config/TemplateFunctions.h: CLHEP-default.h replaced by CLHEP.h Added HEP_SQR_NEEDS_PARAMETER_WITHOUT_CONST * config/iostream.h: Removed declarations for basic_ios and basic_streambuf * config/CLHEP-target.h.in: Added HEP_SQR_NEEDS_PARAMETER_WITHOUT_CONST * configure.in: Changed options for cl and f77 on NT Added HEP_SQR_NEEDS_PARAMETER_WITHOUT_CONST Fri Jul 17 09:08:52 1998 Evgueni Tcherniaev * Matrix/DiagMatrix.cc: Bug fix in operator+= and operator-= Wed Jul 15 13:28:34 1998 Evgueni Tcherniaev * config/fstream.h,iomanip.h,iostream.h,strstream.h (Added): Localization of I/O * Alist/AListBase.h: * Combination/Chooser.h,Combiner.h,Lock.h,Lockable.cc,Lockable.h: * Geometry/Plane3D.cc,Plane3D.h,Transform3D.cc: * Hist/: * HBookFile.cc,HBookFile.h,HBookHistogram.h,HBookTuple.cc: * HBookTuple.h,Histogram.h,Tuple.h,TupleManager.cc,TupleManager.h: * Matrix/GenMatrix.h,Pile.h: * Random/RandomEngine.h: * String/CmdLine.cc,CmdLine.h,Strings.cc,Strings.h: * Vector/: * LorentzRotation.cc,LorentzVector.cc,LorentzVector.h: * Rotation.cc,ThreeVector.cc,ThreeVector.h: * test/: * testAList.cc,testCmd.cc,testComb.cc,testLorentzVector.cc: * testMatrix.cc,testRandom.cc,testStrings.cc,testThreeVector.cc: * testUnits.cc: All inclusions of have been changed to corresponding "CLHEP/config/..." Tue Jul 14 09:05:20 1998 Evgueni Tcherniaev * config/TemplateFunctions.h (Added): min(), max(), abs(), sqr() moved from CLHEP.h to TemplateFunctions.h * config/CLHEP.h: * Geometry/Transform3D.cc: * Random/RandBreitWigner.cc,RanecuEngine.cc: * String/Strings.cc: * Vector/Rotation.cc: * test/: * testLorentzVector.cc,testMinMaxSqrAbs.cc,testStrings.cc: * testThreeVector.cc: min(), max(), abs(), sqr() moved from CLHEP.h to TemplateFunctions.h Fri Jul 3 15:44:38 1998 Evgueni Tcherniaev * Matrix/DiagMatrix.cc: Added ierr = 0; in void HepDiagMatrix::invert(). Thanks to Andre.Holzner@cern.ch * config/CLHEP.h: Changed definitions of true and false to be consistent with ObjectSpace STL * Units/PhysicalConstants.h,SystemOfUnits.h: Modifications provided by Michel Maire taking into account comments from the STAR group * PersistenIO/: * ClassDescription.cc,ClassDescription.h,ClassDescription.icc: * DescriptionList.cc,DescriptionList.h,GenericLoader.cc: * GenericLoader.h,Makefile.in,PIBinStream.cc,PIBinStream.h: * PICharStream.cc,PICharStream.h,PICharStream.icc,PIOStream.cc: * PIOStream.h,PIStream.cc,PIStream.h,PIStream.icc,PIXdrStream.cc: * PIXdrStream.h,PIXdrStream.icc,POBinStream.cc,POBinStream.h: * POCharStream.cc,POCharStream.h,POCharStream.icc,POStream.cc: * POStream.h,POStream.icc,POXdrStream.cc,POXdrStream.h: * POXdrStream.icc,PersistentBase.cc,PersistentBase.h: * RTTIBase.cc,RTTIBase.h,RTTIBase.icc,TypeInfo.cc,TypeInfo.h: * TypeInfo.icc (Removed): * Combination/: * DecayChannel.h,FloatWithError.h,HepBaseParticle.cc: * HepBaseParticle.h,HepBaseParticle.icc,InterfaceParticle.cc: * InterfaceParticle.h,InterfaceParticle.icc,ParticleData.h (Removed): * test/: * A.cc,A.h,B.cc,B.h,C.cc,C.h,D.cc,D.h,matrixBug.cc,testPIBS.cc: * testPIBSd.cc,testPIBSdc.cc,testPIBSdcb.cc,testPICS.cc: * testPIXS.cc,testPOS.cc,testRTTI.cc (Removed): PersistentIO removal Wed May 13 18:02:38 1998 Evgueni Tcherniaev * Geometry/Normal3D.h,Plane3D.h,Vector3D.h (transform): In transform() the non-const argument changed to const Thu Apr 9 15:47:33 1998 Evgueni Tcherniaev * Geometry/Plane3D.h: Rewritten operator ==, added operator != * Vector/ThreeVector.icc: Removed call of abs() and sqr() * Makefile.in: "distclean" target now does not erase "configure" Wed 25 Mar 23:28:54 1998 Gabriele Cosmo * Random/Random.cc,Random.h: Some unwanted changes went in ... apologize. Tue 24 Mar 20:48:39 1998 Gabriele Cosmo * docs/Random.html: -HepRandom 1.9.2- * Random/: * DRand48Engine.cc,DRand48Engine.h,JamesRandom.h: * RandBreitWigner.cc,RandBreitWigner.h,RandEngine.cc: * RandEngine.h,RandExponential.cc,RandExponential.h,RandFlat.cc: * RandFlat.h,RandFlat.icc,RandGauss.cc,RandGauss.h,Random.cc: * Random.h,Random.icc,RandomEngine.cc,RandomEngine.h: * RandomEngine.icc,RanecuEngine.cc,RanecuEngine.h,RanluxEngine.h: * SeedTable.h: HepRandom: better encapsulation as singleton class; added static table of seeds (moved from HepRandomEngine). RanecuEngine: moved L'Ecuyer coefficients from private to protected to allow seed-skipping mechanism. RandEngine, DRand48Engine: private copy constructor and operator=. Updated documentation and comments. Thu Feb 19 10:19:45 1998 Evgueni Tcherniaev * Matrix/Matrix.cc: Bug fix in dfact() provided by Nobu Katayama. The bug affected calculation of determinant. Thu Feb 12 19:19:06 1998 Evgueni Tcherniaev * configure.in: * config/CLHEP-target.h.in,CLHEP.h: Added CLHEP_ABS_NEEDS_PARAMETER_WITHOUT_CONST Tue Feb 10 17:44:35 1998 Evgueni Tcherniaev * Matrix/Matrix.cc: Changed HepDouble *mm(m); -> HepDouble *mm; mm = m; to avoid problems on Windows NT Mon Feb 9 19:39:35 1998 Evgueni Tcherniaev * config/CLHEP.h: Definitions of sqr() and abs() has been separated * test/testMinMaxSqrAbs.cc: Added tests for const int, const float and const double ========================== 05.02.98 Release CLHEP-1.2 ========================== Thu Feb 5 01:30:02 1998 Gabriele Cosmo * Random/RandPoisson.h,RandPoisson.cc: Fixed small bug occouring when "crazy" values for mean were given to the Poisson algorithm. Mon Feb 2 10:41:39 1998 Evgueni Tcherniaev * Random/RanluxEngine.cc: Changed pow(2,24) -> 0x1000000 * Random/DRand48Engine.h: Added declaration of drand48(), srand48() and seed48() for KCC * configure.in: Added KCC * Makefile.in,configure.in: * Alist/Makefile.in: * Combination/Makefile.in: * Hist/Makefile.in: * Matrix/Makefile.in: * String/Makefile.in: * Vector/Makefile.in: * test/Makefile.in: * config/CLHEP-target.h.in: Removed PersistentIO stuff Fri Jan 30 17:10:59 1998 Evgueni Tcherniaev * Matrix/: * DiagMatrix.cc,DiagMatrix.h,DiagMatrix.icc,GenMatrix.cc: * GenMatrix.h,GenMatrix.icc,Matrix.cc,Matrix.h,Matrix.icc: * MatrixLinear.cc,Pile.h,SymMatrix.cc,SymMatrix.h,SymMatrix.icc: * Vector.cc,Vector.h,Vector.icc: Removed PersistentIO stuff. Changes in comments * Matrix/: * DiagMatrix.cc,DiagMatrix.h,GenMatrix.cc,GenMatrix.h,Matrix.cc: * Matrix.h,SymMatrix.cc,SymMatrix.h,Vector.cc,Vector.h: #include isolated in GenMatrix.h and Pile.h Thu Jan 29 11:28:25 1998 Evgueni Tcherniaev * Makefile.in: Added -n10000 option for xargs to avoid problems on FreeBSD * config/Makefile.common.in: Some corrections to avoid problems on FreeBSD Thanks to Larry Felawka Wed Jan 28 09:55:53 1998 Evgueni Tcherniaev * Matrix/Matrix.cc: Bug fix in HepMatrix::operator=(const HepRotation &m2) Fri Jan 23 16:24:24 1998 Evgueni Tcherniaev * Random/: * DRand48Engine.cc,JamesRandom.cc,RandEngine.cc,RanecuEngine.cc: * RanluxEngine.cc: Removed ios::nocreate; KCC has no such mode * Random/RandEngine.cc: Removed 'dummy' to avoid warnings with KCC * Combination/Combiner.icc: Some corrections to avoid warnings with HP/aCC: done -> HepCombiner::done nlists -> HepCombiner::nlists * Combination/Lock.h: Some corrections to avoid warnings with HP/aCC: added void to HepLockAddList() and HepLockRemoveList() * Geometry/Plane3D.h: * Matrix/DiagMatrix.h,Matrix.h,SymMatrix.h,Vector.h: * String/CmdLine.h: * Vector/LorentzVector.h,ThreeVector.h: Declaration class ostream; changed to #include to avoid problems with KCC Thu Jan 22 10:53:42 1998 Evgueni Tcherniaev * Makefile.in: Added "rm configure Makefile.common CLHEP-*.h" for distclean: target * test/Makefile.in: Added rm *.ii for clean: target * test/testRandom.cc: Removed 'pause' to avoid warnings with KCC * config/Makefile.common.in: Added rm *.a *.ii for clean: target Wed Jan 21 19:05:58 1998 Evgueni Tcherniaev * test/testMinMaxSqrAbs.cc (Added): * test/Makefile.in: Added test for min(), max(), sqr(), abs() templates * test/testMatrix.cc: static dum = 0; changed to static int dum = 0; Fri Dec 19 02:35:57 1997 Gabriele Cosmo * Random/Randomize.h: Added missing ifdef protection to body Thu Dec 18 13:27:16 1997 Evgueni Tcherniaev * config/CLHEP.h: Added protection for redefinition of true and false Thanks to R.D.Schaffer@cern.ch Tue Dec 16 11:24:16 1997 Evgueni Tcherniaev * Vector/LorentzVector.h,LorentzVector.icc: Added another cast operator; bug fix in m() * Geometry/Point3D.h: Added const for distance() and distance2() ======================================================== 08.12.97 Release CLHEP-1.1: Geant4 has migrated to CLHEP ======================================================== Mon Dec 8 14:15:32 1997 Evgueni Tcherniaev * configure.in: Changed CXXFLAGS for WinNT Sat Dec 6 19:04:08 1997 Evgueni Tcherniaev * Makefile.in,configure.in: Added some stuff for correct installation of Units * Units/Makefile.in (Added): Fri Dec 5 09:28:25 1997 Evgueni Tcherniaev * Units/PhysicalConstants.h,SystemOfUnits.h: Removed all HepUnitOf... Redefined pascal Replaced pasc to pascal Added km, km2, km3 and mg * Vector/: * LorentzRotation.cc,LorentzRotation.h,LorentzRotation.icc: * LorentzVector.cc,LorentzVector.h,LorentzVector.icc: New implementation without inheritance from Hep3Vector and HepRotation * test/testLorentzVector.cc: Corrections caused by new implementation of HepLorentzVector and HepLorentzRotation Wed Dec 3 12:48:17 1997 Evgueni Tcherniaev * test/Makefile.in: Removed FLIBS in testRandom * Makefile.in: Added rm *.a for distclean * configure.in: Simpified CXXFLAGS and FFLAGS setting Added -Olimit 5000 for SGI Added postfix to alpha-dec-osf in "case" Tue Dec 2 16:09:51 1997 Evgueni Tcherniaev * config/CLHEP-target.h.in,CLHEP.h: Removed some obsolete macros. Redefined min(),max(),abs(),sqr(). Thu Nov 27 14:59:23 1997 Evgueni Tcherniaev * test/testUnits.cc: exit(0) changed to return 0 * configure.in: Added test for setting of the HEP_CC_NEED_SUB_WITHOUT_CONST flag * config/CLHEP-target.h.in,CLHEP.h: HEP_CC_NEED_SUB_WITHOUT_CONST moved from CLHEP.h to CLHEP-target.h.in Tue Nov 18 10:03:37 1997 Evgueni Tcherniaev * Vector/Rotation.cc: Bug fix in phiX(), phiY() and phiZ() * Vector/: * Rotation.cc,Rotation.h,Rotation.icc,ThreeVector.cc: * ThreeVector.h,ThreeVector.icc: Changes in comments Thu Oct 16 03:28:47 1997 Gabriele Cosmo * Random/Random.h,RandomEngine.h,RanecuEngine.cc,RanecuEngine.h: Fixed default argument for setSeed() and setSeeds(). * docs/Random.html: Added few notes ... Wed Oct 15 00:30:42 1997 Gabriele Cosmo * docs/Random.html: * Random/: * DRand48Engine.cc,JamesRandom.cc,RandEngine.cc, * RandFlat.icc,RanluxEngine.cc: *** HepRandom 1.9.1 *** - Fixed old bug inherited from CLHEP0.15 in the algorithm of RandFlat::shootInt(m,n) (... fireInt(m,n)). Now the method shoots values in the interval [m,n[ as correctly stated in the docs. In the old version the interval was wrongly [m,m+n[ ... Thanks to Massimo Lamanna. - Fixed minor bug still inherited from CLHEP0.15 in setSeeds() methods of concrete engines. Thanks to Peter Stamfest. Sun Oct 12 11:47:36 1997 Evgueni Tcherniaev * Units/PhysicalConstants.h,SystemOfUnits.h: Changes in comments Fri Oct 10 12:10:57 1997 Evgueni Tcherniaev * Geometry/: * Normal3D.h,Plane3D.cc,Plane3D.h,Point3D.h,Transform3D.cc: * Transform3D.h,Vector3D.h: Changes in comments Thu Oct 9 15:08:57 1997 Evgueni Tcherniaev * Hist/: * HBookFile.cc,HBookFile.h,HBookHistogram.cc,HBookHistogram.h: * HBookTuple.cc,HBookTuple.h,Histogram.cc,Histogram.h,Tuple.cc: * Tuple.h,TupleManager.cc,TupleManager.h: Added line with cvs Id Mon Oct 6 18:04:21 1997 Evgueni Tcherniaev * test/testThreeVector.cc,testMatrix.cc: Changes in comments Wed Oct 1 15:46:34 1997 Evgueni Tcherniaev * test/testRandom.cc: Inserted: -*- C++ -*- Tue Sep 30 11:03:32 1997 Evgueni Tcherniaev * String/: * CmdArg.cc,CmdArg.h,CmdArg.icc,CmdLine.cc,CmdLine.h,Strings.cc: * Strings.h,Strings.icc: Changes in comments * test/testStrings.cc,testCmd.cc: Changes in comments Mon Sep 29 10:26:43 1997 Evgueni Tcherniaev * Alist/: * AIterator.h,AIterator.icc,AIteratorBase.cc,AIteratorBase.h: * AIteratorBase.icc,AList.h,AList.icc,AListBase.cc,AListBase.h: * AListBase.icc,CIterator.h,CIterator.icc,CList.h,CList.icc: * ConstAIterator.h,ConstAIterator.icc,ConstAList.h: * ConstAList.icc: Line with cvs Id has been added * Combination/: * Chooser.h,Chooser.icc,Combiner.h,Combiner.icc,Lock.cc,Lock.h: * Lock.icc,Lockable.cc,Lockable.h,Lockable.icc: Changes in comments * test/testAList.cc,testComb.cc: Changes in comments Fri Sep 26 16:35:31 1997 Evgueni Tcherniaev * Vector/Rotation.h,Rotation.icc,Rotation.cc: Added operator(int,int) Removed inline from *.cc Bug fix in getAngleAxis() - Thanks to Joe Boudreau * Vector/ThreeVector.h,ThreeVector.icc,ThreeVector.cc: Removed friend classes HepPOStream, HepPIStream * Geometry/Transform3D.cc: Bug fix in HepTransform3D(double,...,double) Thanks to Brian Heltsley Small optimization in HepTransform3D(Point3D,...,Point3D) Wed Aug 20 16:28:15 1997 Evgueni Tcherniaev * Vector/LorentzRotation.h,LorentzVector.h,Rotation.h,ThreeVector.h: Removed friend HepPOStream & friend HepPIStream Tue Aug 12 02:39:05 1997 Gabriele Cosmo * Random/: * RandBreitWigner.cc,RandBreitWigner.h,RandExponential.cc: * RandExponential.h,RandFlat.cc,RandFlat.h,RandFlat.icc: * RandGauss.cc,RandGauss.h,RandPoisson.cc,RandPoisson.h: * Random.cc,Random.h,Random.icc: * docs/Random.html: Updated to release 1.9 of HepRandom. - introduced default values for shoot()/fire(); - added shootArray()/fireArray() for every distribution; - defined operator()() using default values for each distribution; - updated doc file Random.html. Tue Jul 22 03:17:08 1997 Gabriele Cosmo * Random/RandomEngine.h,RanluxEngine.h: Added missing default second argument value for setSeed() and setSeeds() in RandomEngine and RanluxEngine. If not specified, RanluxEngine luxury is set to 3 by default. Sat Jul 12 23:06:01 1997 Gabriele Cosmo * Random/: * DRand48Engine.cc,DRand48Engine.h,JamesRandom.h,RandEngine.h: * RanecuEngine.cc,RanecuEngine.h: Added abs for setting seed index in RanecuEngine. setSeed() and setSeeds() now have default dummy argument set to zero. Thu Jul 10 22:04:38 1997 Gabriele Cosmo * Random/RanecuEngine.cc: fixed bug in setSeed() and setSeeds() Tue Jul 8 16:10:30 1997 Evgueni Tcherniaev * OldRandom/: * Makefile.in,JamesRandom.cc,JamesRandom.h,Random.cc: * Random.h,Random.icc,RandomEngine.cc,RandomEngine.h (Removed): * test/testOldRandom.cc (Removed): * configure.in: Removed references to OldRandom/ Mon Jul 7 18:19:33 1997 Evgueni Tcherniaev Adaptation for Windows NT * aclocal.m4: removed output to /dev/null * acsite.m4 (Added): some additional macros * configure.in,Makefile.in: modified * config/config.sub,config.guess: added reference on cygnus * config/Makefile.common.in: changed the procedure of creation of the library * String/Strings.h: * test/testAList.cc,testStrings.cc: #ifdef WIN32 #include #else #include #endif * test/Makefile.in: added suffix _EXE in touch commands Mon Jul 7 15:49:28 1997 Evgueni Tcherniaev * config/CLHEP.h: Changed definition of min & max templates to avoid warnings: template< class T > inline const T& min( const T& a, const T& b ) { // Break this into two lines to avoid an incorrect warning with // Cfront-based compilers. const T& retval = b < a ? b : a; return retval; } * config/CLHEP.h: Changed definition of true & false to avoid warnings: #ifdef HEP_HAVE_BOOL typedef bool HepBoolean; #else typedef int HepBoolean; const HepBoolean hep_false = 0; #define false hep_false const HepBoolean hep_true = 1; #define true hep_true #endif * Alist/: * AList.h,AList.icc,AListBase.h,AListBase.icc,CList.h,CList.icc: * ConstAList.h,ConstAList.icc: * String/: * CmdArg.cc,CmdArg.h,CmdArg.icc,Strings.cc,Strings.h,Strings.icc: * Matrix/GenMatrix.cc,GenMatrix.h,Pile.h: * Combination/: * DecayChannel.h,FloatWithError.h,HepBaseParticle.cc: * HepBaseParticle.h,InterfaceParticle.h,InterfaceParticle.icc: * ParticleData.h: * test/testCmd.cc: Changed bool to HepBoolean Mon May 12 10:14:52 1997 Leif Lonnblad * Combination/HepBaseParticle.h: Made 'hasPositionInfo()' virtual Tue Mar 18 09:35:58 1997 Evgueni Tcherniaev * Combination/Combiner.icc: Template HepCombiner::next() has been rewritten to force compilation of the test on HP * Combination/Chooser.icc: Template HepChooser::next() has been rewritten to force compilation of the test on HP * Geometry/Normal3D.h,Point3D.h,Transform3D.cc,Vector3D.h: Some minor changes to avoid warnings on SUN Sat Mar 15 10:22:13 1997 Nobu KATAYAMA * Utilities/CLHEP.h: * config/CLHEP.h: Tests now run on sgi, dec, ibm, hp and sun with native compiler. Skip Istrstream>>String on DEC with cxx 5.3/4 as it gives coredump. Hep_persistent_stream is now disabled as a default. (Was agreed at May 96 workshop.) Use --enable-persistent-streams Fri Mar 14 19:24:41 1997 Nobu KATAYAMA - Added Matrix = Rotation Fri Mar 14 18:19:29 1997 Nobu Katayama - Vector added more functionality from Geant4 and Babar - New Random from Geant4 Wed Mar 12 20:08:15 1997 Nobu KATAYAMA - Removed unused variable names from TupleManager and Histogram. Wed Mar 12 13:03:47 1997 Nobu Katayama - Use HEP_USE_RANDOM instead of USE_RANDOM. Moved Matrix consturctors using HepRandom from .icc into .cc. They are not inline anymore. Wed Mar 12 07:53:31 1997 Nobu KATAYAMA - Added Units from the Geant4 team. - Added HEP_ to HAVE_STL,HAVE_BOOL and BOOL_IS_NOT_INT Tue Mar 11 19:19:36 1997 Nobu KATAYAMA - Update configure/CLHEP header file scheme. Tue Mar 11 17:43:53 1997 Nobu Katayama - Removed CLHEP_HIGH_PRECISION from CLHEP.h - Use HepDouble in Vector, Matrix, Random and their tests. It is defined in CLHEP.h Tue Mar 11 11:25:55 1997 Nobu Katayama - Do not free if the pointer is null (AListBase.icc, Strings.icc) - Removed unnecessary '/' from PersistentIO/PISterm.h and ClassDescription.icc - Test AListSort and ReverseSort in testAList.cc - Added comments to SymMatrix::invert(se). Changed ierr to ifail - Added HEP_CC_NEEDS_SUB_WITHOUT_CONST and HEP_GNU_OPTIMIZED_RETURN - Redefined GCCNAME in test/Makefile.in - Removed unised variable names. (Random.icc, Vector.icc) Mon Mar 10 17:03:13 1997 Nobu Katayama - Use BOOL_IS_NOT_INT in PersistentIO. - Added configure script to check bool is typedefed to int. - Added srcdir and VPATH in Makefile.ins and removed from Makefile.common.in. Minor changes in Makefiles so that one can use build directory. - Added /* */ around the comments after #endif Mon Mar 10 12:31:02 1997 Nobu Katayama - Do not define static constants in the header file, POXdrStream.h. Namely use the ones with #ifdef __DECCXX for all compilers. - Added #include CLHEP-CC.h for sun, sgi and hp in CLHEP.h - Compatibility with HPUX CC 3.76 (Matrix classes) - Fixed bugs pointed by Bob (Babar). Unary minus operator cannot use SIMPLE_BOP. Added faster sym matrix inversion for dim less than 4. - __GNUG__ and __GNUC__ for return optimization using GNU C++ extension has been renamed to HEP_GNU_OPTIMIZED_RETURN. This is not automatically set as it does not compile on HP with 2.7.2. They were in Matrix subdir. Wed Feb 19 16:30:14 1997 Leif Lonnblad * test/Makefile.in (SOMETESTFILES): Removed target TestRTTI in case persistent streams are disabled. * Random/RandomEngine.h: Removed dependencies on persistent IO in case of HEP_NO_PERSISTENT_STREAMS * Random/RandomEngine.cc: Removed dependencies on persistent IO in case of HEP_NO_PERSISTENT_STREAMS * Random/Random.h: Removed dependencies on persistent IO in case of HEP_NO_PERSISTENT_STREAMS * Random/Random.cc: Removed dependencies on persistent IO in case of HEP_NO_PERSISTENT_STREAMS * Random/JamesRandom.h: Removed dependencies on persistent IO in case of HEP_NO_PERSISTENT_STREAMS * Random/JamesRandom.cc: Removed dependencies on persistent IO in case of HEP_NO_PERSISTENT_STREAMS Fri Feb 14 09:38:37 1997 Leif Lonnblad * Random/Random.cc (HepRandom::breitWignerM2): Fixed serious bug. Used to be 'if ( gamma = 0.0 )' which is always false and causes floating exception in next line. Fri Feb 7 12:31:52 1997 Leif Lonnblad * ChangeLog: Added ChangeLog file. * test/testStrings.cc (main): Someone has changed the behavior for the constructor HepString(double, unsigned precision = 6) when running with libg++, I therefore removed the test of this behavior here. * test/Makefile.in (testPIBSdc): Corrected bug in the ../lib$(LIBCLHEP).a dependence. * Hist/hbfinit.c: Removed from the repository. * Utilities/Makefile.common.in: Changed the target .f.o for the case when f2c is used: The .c file is now removed after the compilation. * String/Strings.h: Someone has changed the behavior for the constructor HepString(double, unsigned precision = 6) when running with libg++, so I added a comment about that here. * Matrix/Vector.cc: Wraped the #include of PIStream.h and POStream.h inside a #ifndef HEP_NO_PERSISTENT_STREAMS. * Matrix/SymMatrix.cc: Wraped the #include of PIStream.h and POStream.h inside a #ifndef HEP_NO_PERSISTENT_STREAMS. * Matrix/Matrix.cc: Wraped the #include of PIStream.h and POStream.h inside a #ifndef HEP_NO_PERSISTENT_STREAMS. * Matrix/DiagMatrix.icc (fast): Changed the 'static const double zero = 0.0' statement to 'static double zero = 0.0' to avoid problems on some compilers. * Matrix/DiagMatrix.cc: Wraped the #include of PIStream.h and POStream.h inside a #ifndef HEP_NO_PERSISTENT_STREAMS. * Combination/Makefile.in (SOMEOBJECTS): Removed HepBaseParticle.o and InterfaceParticle.o from the 'SOMEOBJECTS' variable as they were causing trouble when the persistent IO was disabled. * Combination/HepBaseParticle.cc: Added declaration of static member 'HepBaseParticle::noName' * Makefile.in (depend): Added test directory to list of subdirectories for the 'depend' target. clhep-2.1.4.1.orig/CMakeLists.txt0000644000175000017500000000672612241267303015150 0ustar olesoles#------------------------------------------------------------------------------ # Top Level CMakeLists.txt for CLHEP # cmake [-DCMAKE_INSTALL_PREFIX=/install/path] # [-DCMAKE_BUILD_TYPE=Debug|Release|RelWithDebInfo|MinSizeRel] # [-DCMAKE_C_COMPILER=...] [-DCMAKE_CXX_COMPILER=...] # [-DCLHEP_BUILD_DOCS=ON] # [-DLIB_SUFFIX=64] # /path/to/source # make # make test # make install # # mac i386: -DCMAKE_CXX_FLAGS="-m32" -DCMAKE_OSX_ARCHITECTURES="i386" # mac x86_64: -DCMAKE_CXX_FLAGS="-m64" -DCMAKE_OSX_ARCHITECTURES="x86_64" # # Use -DLIB_SUFFIX=64 to install the libraries in a lib64 subdirectory # instead of the default lib subdirectory. # # The default CLHEP build type is CMAKE_BUILD_TYPE=RelWithDebInfo, # which matches the default CLHEP autoconf flags #------------------------------------------------------------------------------ # Ensure out of source build before anything else include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/ClhepOutOfSourceBuild.cmake) clhep_ensure_out_of_source_build() # use cmake 2.6 or later cmake_minimum_required(VERSION 2.6) # project name project(CLHEP) set( VERSION 2.1.4.1 ) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules ${CMAKE_MODULE_PATH} ) # CLHEP_BUILD_DOCS is OFF (false) by default option(CLHEP_BUILD_DOCS "Build and install CLHEP documentation" OFF) if(CLHEP_BUILD_DOCS) # backwards compatibility variable set(build_docs ON) message(STATUS "Enabled build and install of documents") endif() # enable use of LIB_SUFFIX include(ClhepVariables) clhep_lib_suffix() # CLHEP custom modules include(ClhepCopyHeaders) include(ClhepBuildTest) include(ClhepBuildLibrary) include(CheckFunctionExists) include(ClhepToolchain) # because we want to move these libraries about, # do not embed full path in shared libraries or executables set(CMAKE_SKIP_RPATH) ENABLE_TESTING() # include search path include_directories ("${PROJECT_BINARY_DIR}") # add CLHEP/Random to search path so we find gaussTables.cdat include_directories ("${CMAKE_SOURCE_DIR}/Random") # Put all library build products in standard locations under build tree set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) # define common flags set( CMAKE_INCLUDE_PATH ${CLHEP_BINARY_DIR} ) # set our preferred compiler flags clhep_set_compiler_flags() # the main CLHEP config script clhep_config() # check for required functions CHECK_FUNCTION_EXISTS(drand48 found_drand48) # all the packages set( CLHEP_subdirs Units Utility Vector Evaluator GenericFunctions Geometry Random Matrix RandomObjects Cast RefCount Exceptions ) # The Units and Utility packages are just headers. set( CLHEP_libraries Vector Evaluator GenericFunctions Geometry Random Matrix RandomObjects Cast RefCount Exceptions ) clhep_copy_headers( ${CLHEP_subdirs} ) add_subdirectory(Units) add_subdirectory(Utility) add_subdirectory(Vector) add_subdirectory(Evaluator) add_subdirectory(GenericFunctions) add_subdirectory(Geometry) add_subdirectory(Random) add_subdirectory(Matrix) add_subdirectory(RandomObjects) add_subdirectory(Cast) add_subdirectory(RefCount) add_subdirectory(Exceptions) # libCLHEP.a and libCLHEP.so clhep_build_libclhep( ${CLHEP_libraries} ) # provide tools for other packages to include CLHEP easily clhep_toolchain() # Custom Packaging include(ClhepPackaging) clhep-2.1.4.1.orig/makeBinaryTar.in0000755000175000017500000000135307714477051015477 0ustar olesoles#!/bin/sh # make binary tarballs # This script assumes that the bootstrap script has already been run successfully. # makeSourceDist # e.g. might be gcc-2.95.2 for gcc 2.95.2 if [ ! -d @prefix@ ] then echo "@prefix@ does not exist" exit 1 fi if [ ! -d $1 ] then echo "$1 does not exist" exit 1 fi if [ $# -eq 2 ] then extra="-$2" fi ##set -x # make sure we have the full path thisdir=`pwd` cd @prefix@; binarydir=`pwd` cd $thisdir cd $1; tardir=`pwd` if [ -d $binarydir/doc ] then more=doc fi cd $binarydir; # use option z to create compressed tar ball ... (8 MB instead of 28 :-) ) tar -zcf $tardir/clhep-@VERSION@$extra.tgz bin include lib data $more clhep-2.1.4.1.orig/clhep-config.in0000755000175000017500000000354312234340066015273 0ustar olesoles#! /bin/sh # @configure_input@ # we include the paths of the original install directories for reference orig_prefix="@prefix@" orig_exec_prefix="@exec_prefix@" orig_includedir="@includedir@" # use the full name of this script to get the current path configpath=`dirname ${0}` # check for a leading slash to determine if this is a relative path firstc=`expr ${configpath} : "\/"` calldir=`pwd` if [ ${firstc} -eq 0 ] then cd "${calldir}/${configpath}"; newpath=`pwd` binpath=${newpath} else binpath=${configpath} fi # OK - now we have to strip the trailing "/bin" out of the path prefix=`dirname "${binpath}"` includedir=${prefix}/include libdir=${prefix}/lib usage() { cat < absolute path abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ COPY_P = @COPY_P@ $(top_builddir)/CLHEP: temp-package-dirs @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ if test -d "$$pkg" ; then \ (cd $$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d ../"$$pkg"/"$$pkg" ; then \ (cd ../$$pkg/$$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg"; then \ hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ else \ if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/include/CLHEP; then \ if test -d $(CLHEP_DIR)/include/CLHEP/"$$pkg"; then \ hdrs=`ls $(CLHEP_DIR)/include/CLHEP/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEP_DIR)/include/CLHEP/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ fi; \ fi; \ fi; \ fi; \ fi; \ done; temp-package-dirs: $(mkinstalldirs) $(abs_top_builddir)/CLHEP; @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ $(mkinstalldirs) $(abs_top_builddir)/CLHEP/$$pkg; \ done; docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs # extra clean rule clean-local: rm -rf $(top_builddir)/CLHEP clhep-2.1.4.1.orig/Utility/bootstrap0000755000175000017500000000071511406156145016011 0ustar olesoles#! /bin/sh set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 rm -f Makefile.in */Makefile.in */defs.h.in rm -f autotools/config* autotools/depcomp autotools/install-sh autotools/m* rm -f configure config.* # run autotool commands aclocal -I autotools autoheader automake --add-missing --copy autoconf # ready to make a source code distribution tarball clhep-2.1.4.1.orig/Utility/configure.ac0000644000175000017500000002655612241267303016344 0ustar olesoles# ====================================================================== # This is the Utility configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.59) AC_INIT(CLHEP Utility, 2.1.4.1, http://savannah.cern.ch/projects/clhep/, Utility) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # ---------------------------------------------------------------------- # --enable-shared and --enable-static # both shared and static libraries are built by default # ---------------------------------------------------------------------- AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Header containing #defines: AM_CONFIG_HEADER([Utility/defs.h]) # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Utility/Makefile]) AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([Utility-deps]) AC_CONFIG_FILES([Utility/copy-header.pl], [chmod +x Utility/copy-header.pl]) # Configuration inquiry program/script: AC_CONFIG_FILES([Utility-config], [chmod +x Utility-config]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- Utility_CPPFLAGS="-I$includedir" Utility_LDFLAGS=" " Utility_LIBS=" " AC_SUBST(Utility_CPPFLAGS) AC_SUBST(Utility_LIBS) AC_SUBST(Utility_LDFLAGS) # ---------------------------------------------------------------------- # Supply boilerplate for Utility/defs.h source header: # ---------------------------------------------------------------------- AH_TOP([#ifndef UTILITY_DEFS_H #define UTILITY_DEFS_H]) ## the undefs are converted by configure AH_VERBATIM([PACKAGE],[/* Name of package */ #ifndef PACKAGE #undef PACKAGE #endif]) AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif]) AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */ #ifndef PACKAGE_NAME #undef PACKAGE_NAME #endif]) AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #undef PACKAGE_STRING #endif]) AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif]) AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */ #ifndef PACKAGE_VERSION #undef PACKAGE_VERSION #endif]) AH_VERBATIM([VERSION],[/* Version number of package */ #ifndef VERSION #undef VERSION #endif]) AH_BOTTOM([#endif // UTILITY_DEFS_H]) # ---------------------------------------------------------------------- # Account for any user configuration options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; icc) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" MY_SHFLAGS="-fPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Set system-dependent options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed libraries: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed header files: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed typedefs, structures, and compiler characteristics: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed library functions: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/Utility/COPYING.LESSER0000644000175000017500000001674311406156145016105 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/Utility/.cvsignore0000755000175000017500000000007411406156145016047 0ustar olesolesMakefile.in configure aclocal.m4 autom4te.cache config.h.in clhep-2.1.4.1.orig/Utility/Utility-config.in0000644000175000017500000000405112234340066017276 0ustar olesoles#! /bin/sh # @configure_input@ # we include the paths of the original install directories for reference orig_prefix="@prefix@" orig_exec_prefix="@exec_prefix@" orig_includedir="@includedir@" # use the full name of this script to get the current path configpath=`dirname ${0}` # check for a leading slash to determine if this is a relative path firstc=`expr ${configpath} : "\/"` calldir=`pwd` if [ ${firstc} -eq 0 ] then cd "${calldir}/${configpath}"; newpath=`pwd` binpath=${newpath} else binpath=${configpath} fi # OK - now we have to strip the trailing "/bin" out of the path prefix=`dirname "${binpath}"` includedir=${prefix}/include libdir=${prefix}/lib usage() { cat < Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/Utility/test/0000755000175000017500000000000012242515216015017 5ustar olesolesclhep-2.1.4.1.orig/Utility/test/testWeakPtr.cc0000644000175000017500000006221111406156145017610 0ustar olesoles// ====================================================================== // // Test compilability and basic functionality of Utility/memory.h // // Author: W. E. Brown, 2010-03-19, adapted from the boost library's // shared_ptr and related functionality whose internal attributions bear // the following various notices: // // Copyright (c) 2002-2005 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // // ====================================================================== #include "CLHEP/Utility/memory.h" #include #include #include using namespace CLHEP; using CLHEP::shared_ptr; using CLHEP::weak_ptr; #if defined(_MSC_VER) && (_MSC_VER >= 1310) # pragma warning (disable : 4675) // suppress ADL warning #endif namespace n_element_type { void f(int &) { } void test() { typedef weak_ptr::element_type T; T t; f(t); } } // namespace n_element_type class incomplete; shared_ptr create_incomplete(); struct X { int dummy; }; struct Y { int dummy2; }; struct Z : public X, public virtual Y { }; namespace n_constructors { void default_constructor() { { weak_ptr wp; assert(wp.use_count() == 0); } { weak_ptr wp; assert(wp.use_count() == 0); } { weak_ptr wp; assert(wp.use_count() == 0); } } void shared_ptr_constructor() { { shared_ptr sp; weak_ptr wp(sp); assert(wp.use_count() == sp.use_count()); weak_ptr wp2(sp); assert(wp2.use_count() == sp.use_count()); } { shared_ptr sp(static_cast(0)); { weak_ptr wp(sp); assert(wp.use_count() == sp.use_count()); assert(wp.use_count() == 1); shared_ptr sp2(wp); assert(wp.use_count() == 2); assert(!(sp < sp2 || sp2 < sp)); } { weak_ptr wp(sp); assert(wp.use_count() == sp.use_count()); assert(wp.use_count() == 1); shared_ptr sp2(wp); assert(wp.use_count() == 2); assert(!(sp < sp2 || sp2 < sp)); } } { shared_ptr sp(new int); { weak_ptr wp(sp); assert(wp.use_count() == sp.use_count()); assert(wp.use_count() == 1); shared_ptr sp2(wp); assert(wp.use_count() == 2); assert(!(sp < sp2 || sp2 < sp)); } { weak_ptr wp(sp); assert(wp.use_count() == sp.use_count()); assert(wp.use_count() == 1); shared_ptr sp2(wp); assert(wp.use_count() == 2); assert(!(sp < sp2 || sp2 < sp)); } } { shared_ptr sp; weak_ptr wp(sp); assert(wp.use_count() == sp.use_count()); } { shared_ptr sp(static_cast(0)); weak_ptr wp(sp); assert(wp.use_count() == sp.use_count()); assert(wp.use_count() == 1); shared_ptr sp2(wp); assert(wp.use_count() == 2); assert(!(sp < sp2 || sp2 < sp)); } { shared_ptr sp(new int); weak_ptr wp(sp); assert(wp.use_count() == sp.use_count()); assert(wp.use_count() == 1); shared_ptr sp2(wp); assert(wp.use_count() == 2); assert(!(sp < sp2 || sp2 < sp)); } { shared_ptr sp; weak_ptr wp(sp); assert(wp.use_count() == sp.use_count()); weak_ptr wp2(sp); assert(wp2.use_count() == sp.use_count()); } { shared_ptr sp = create_incomplete(); { weak_ptr wp(sp); assert(wp.use_count() == sp.use_count()); assert(wp.use_count() == 1); shared_ptr sp2(wp); assert(wp.use_count() == 2); assert(!(sp < sp2 || sp2 < sp)); } { weak_ptr wp(sp); assert(wp.use_count() == sp.use_count()); assert(wp.use_count() == 1); shared_ptr sp2(wp); assert(wp.use_count() == 2); assert(!(sp < sp2 || sp2 < sp)); } } { shared_ptr sp = create_incomplete(); weak_ptr wp(sp); assert(wp.use_count() == sp.use_count()); assert(wp.use_count() == 1); shared_ptr sp2(wp); assert(wp.use_count() == 2); assert(!(sp < sp2 || sp2 < sp)); } } void copy_constructor() { { weak_ptr wp; weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 0); } { weak_ptr wp; weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 0); } { weak_ptr wp; weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 0); } { shared_ptr sp(static_cast(0)); weak_ptr wp(sp); weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 1); assert(!(wp < wp2 || wp2 < wp)); sp.reset(); assert(!(wp < wp2 || wp2 < wp)); weak_ptr wp3(wp); assert(wp3.use_count() == wp.use_count()); assert(wp3.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); } { shared_ptr sp(new int); weak_ptr wp(sp); weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 1); assert(!(wp < wp2 || wp2 < wp)); sp.reset(); assert(!(wp < wp2 || wp2 < wp)); weak_ptr wp3(wp); assert(wp3.use_count() == wp.use_count()); assert(wp3.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); } { shared_ptr sp(static_cast(0)); weak_ptr wp(sp); weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 1); assert(!(wp < wp2 || wp2 < wp)); sp.reset(); assert(!(wp < wp2 || wp2 < wp)); weak_ptr wp3(wp); assert(wp3.use_count() == wp.use_count()); assert(wp3.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); } { shared_ptr sp(new int); weak_ptr wp(sp); weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 1); assert(!(wp < wp2 || wp2 < wp)); sp.reset(); assert(!(wp < wp2 || wp2 < wp)); weak_ptr wp3(wp); assert(wp3.use_count() == wp.use_count()); assert(wp3.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); } { shared_ptr sp = create_incomplete(); weak_ptr wp(sp); weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 1); assert(!(wp < wp2 || wp2 < wp)); sp.reset(); assert(!(wp < wp2 || wp2 < wp)); weak_ptr wp3(wp); assert(wp3.use_count() == wp.use_count()); assert(wp3.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); } } void conversion_constructor() { { weak_ptr wp; weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 0); } { weak_ptr wp; weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 0); } { weak_ptr wp; weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 0); weak_ptr wp3(wp); assert(wp3.use_count() == wp.use_count()); assert(wp3.use_count() == 0); } { shared_ptr sp(static_cast(0)); weak_ptr wp(sp); weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 1); assert(!(wp < wp2 || wp2 < wp)); sp.reset(); assert(!(wp < wp2 || wp2 < wp)); weak_ptr wp3(wp); assert(wp3.use_count() == wp.use_count()); assert(wp3.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); } { shared_ptr sp(new int); weak_ptr wp(sp); weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 1); assert(!(wp < wp2 || wp2 < wp)); sp.reset(); assert(!(wp < wp2 || wp2 < wp)); weak_ptr wp3(wp); assert(wp3.use_count() == wp.use_count()); assert(wp3.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); } { shared_ptr sp = create_incomplete(); weak_ptr wp(sp); weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 1); assert(!(wp < wp2 || wp2 < wp)); sp.reset(); assert(!(wp < wp2 || wp2 < wp)); weak_ptr wp3(wp); assert(wp3.use_count() == wp.use_count()); assert(wp3.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); } { shared_ptr sp(static_cast(0)); weak_ptr wp(sp); weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 1); assert(!(wp < wp2 || wp2 < wp)); sp.reset(); assert(!(wp < wp2 || wp2 < wp)); weak_ptr wp3(wp); assert(wp3.use_count() == wp.use_count()); assert(wp3.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); } { shared_ptr sp(static_cast(0)); weak_ptr wp(sp); weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 1); assert(!(wp < wp2 || wp2 < wp)); sp.reset(); assert(!(wp < wp2 || wp2 < wp)); weak_ptr wp3(wp); assert(wp3.use_count() == wp.use_count()); assert(wp3.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); } { shared_ptr sp(new Z); weak_ptr wp(sp); weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 1); assert(!(wp < wp2 || wp2 < wp)); sp.reset(); assert(!(wp < wp2 || wp2 < wp)); weak_ptr wp3(wp); assert(wp3.use_count() == wp.use_count()); assert(wp3.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); } { shared_ptr sp(new Z); weak_ptr wp(sp); weak_ptr wp2(wp); assert(wp2.use_count() == wp.use_count()); assert(wp2.use_count() == 1); assert(!(wp < wp2 || wp2 < wp)); sp.reset(); assert(!(wp < wp2 || wp2 < wp)); weak_ptr wp3(wp); assert(wp3.use_count() == wp.use_count()); assert(wp3.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); } } void test() { default_constructor(); shared_ptr_constructor(); copy_constructor(); conversion_constructor(); } } // namespace n_constructors namespace n_assignment { template< class T > void copy_assignment(shared_ptr & sp) { assert(sp.unique()); weak_ptr p1; p1 = p1; assert(p1.use_count() == 0); weak_ptr p2; p1 = p2; assert(p1.use_count() == 0); weak_ptr p3(p1); p1 = p3; assert(p1.use_count() == 0); weak_ptr p4(sp); p4 = p4; assert(p4.use_count() == 1); p1 = p4; assert(p1.use_count() == 1); p4 = p2; assert(p4.use_count() == 0); sp.reset(); p1 = p1; assert(p1.use_count() == 0); p4 = p1; assert(p4.use_count() == 0); } void conversion_assignment() { { weak_ptr p1; weak_ptr p2; p1 = p2; assert(p1.use_count() == 0); shared_ptr sp = create_incomplete(); weak_ptr p3(sp); p1 = p3; assert(p1.use_count() == 1); sp.reset(); p1 = p3; assert(p1.use_count() == 0); p1 = p2; assert(p1.use_count() == 0); } { weak_ptr p1; weak_ptr p2; p1 = p2; assert(p1.use_count() == 0); shared_ptr sp(new Z); weak_ptr p3(sp); p1 = p3; assert(p1.use_count() == 1); sp.reset(); p1 = p3; assert(p1.use_count() == 0); p1 = p2; assert(p1.use_count() == 0); } { weak_ptr p1; weak_ptr p2; p1 = p2; assert(p1.use_count() == 0); shared_ptr sp(new Z); weak_ptr p3(sp); p1 = p3; assert(p1.use_count() == 1); sp.reset(); p1 = p3; assert(p1.use_count() == 0); p1 = p2; assert(p1.use_count() == 0); } } template< class T, class U > void shared_ptr_assignment(shared_ptr & sp, T * = 0) { assert(sp.unique()); weak_ptr p1; weak_ptr p2(p1); weak_ptr p3(sp); weak_ptr p4(p3); p1 = sp; assert(p1.use_count() == 1); p2 = sp; assert(p2.use_count() == 1); p3 = sp; assert(p3.use_count() == 1); p4 = sp; assert(p4.use_count() == 1); sp.reset(); assert(p1.use_count() == 0); assert(p2.use_count() == 0); assert(p3.use_count() == 0); assert(p4.use_count() == 0); p1 = sp; } void test() { { shared_ptr p( new int ); copy_assignment( p ); } { shared_ptr p( new X ); copy_assignment( p ); } { shared_ptr p( new int ); copy_assignment( p ); } { shared_ptr p = create_incomplete(); copy_assignment( p ); } conversion_assignment(); { shared_ptr p( new int ); shared_ptr_assignment( p ); } { shared_ptr p( new int ); shared_ptr_assignment( p ); } { shared_ptr p( new X ); shared_ptr_assignment( p ); } { shared_ptr p( new X ); shared_ptr_assignment( p ); } { shared_ptr p( new int ); shared_ptr_assignment( p ); } { shared_ptr p = create_incomplete(); shared_ptr_assignment( p ); } { shared_ptr p = create_incomplete(); shared_ptr_assignment( p ); } } } // namespace n_assignment namespace n_reset { template< class T, class U > void test2( shared_ptr & sp, T * = 0 ) { assert(sp.unique()); weak_ptr p1; weak_ptr p2(p1); weak_ptr p3(sp); weak_ptr p4(p3); weak_ptr p5(sp); weak_ptr p6(p5); p1.reset(); assert(p1.use_count() == 0); p2.reset(); assert(p2.use_count() == 0); p3.reset(); assert(p3.use_count() == 0); p4.reset(); assert(p4.use_count() == 0); sp.reset(); p5.reset(); assert(p5.use_count() == 0); p6.reset(); assert(p6.use_count() == 0); } void test() { { shared_ptr p( new int ); test2( p ); } { shared_ptr p( new int ); test2( p ); } { shared_ptr p( new X ); test2( p ); } { shared_ptr p( new X ); test2( p ); } { shared_ptr p( new int ); test2( p ); } { shared_ptr p = create_incomplete(); test2( p ); } { shared_ptr p = create_incomplete(); test2( p ); } } } // namespace n_reset namespace n_use_count { void test() { { weak_ptr wp; assert(wp.use_count() == 0); assert(wp.expired()); weak_ptr wp2; assert(wp.use_count() == 0); assert(wp.expired()); weak_ptr wp3(wp); assert(wp.use_count() == 0); assert(wp.expired()); assert(wp3.use_count() == 0); assert(wp3.expired()); } { shared_ptr sp(static_cast(0)); weak_ptr wp(sp); assert(wp.use_count() == 1); assert(!wp.expired()); weak_ptr wp2(sp); assert(wp.use_count() == 1); assert(!wp.expired()); weak_ptr wp3(wp); assert(wp.use_count() == 1); assert(!wp.expired()); assert(wp3.use_count() == 1); assert(!wp3.expired()); shared_ptr sp2(sp); assert(wp.use_count() == 2); assert(!wp.expired()); assert(wp2.use_count() == 2); assert(!wp2.expired()); assert(wp3.use_count() == 2); assert(!wp3.expired()); shared_ptr sp3(sp); assert(wp.use_count() == 3); assert(!wp.expired()); assert(wp2.use_count() == 3); assert(!wp2.expired()); assert(wp3.use_count() == 3); assert(!wp3.expired()); sp.reset(); assert(wp.use_count() == 2); assert(!wp.expired()); assert(wp2.use_count() == 2); assert(!wp2.expired()); assert(wp3.use_count() == 2); assert(!wp3.expired()); sp2.reset(); assert(wp.use_count() == 1); assert(!wp.expired()); assert(wp2.use_count() == 1); assert(!wp2.expired()); assert(wp3.use_count() == 1); assert(!wp3.expired()); sp3.reset(); assert(wp.use_count() == 0); assert(wp.expired()); assert(wp2.use_count() == 0); assert(wp2.expired()); assert(wp3.use_count() == 0); assert(wp3.expired()); } } } // namespace n_use_count namespace n_swap { void test() { { weak_ptr wp; weak_ptr wp2; wp.swap(wp2); assert(wp.use_count() == 0); assert(wp2.use_count() == 0); using std::swap; swap(wp, wp2); assert(wp.use_count() == 0); assert(wp2.use_count() == 0); } { shared_ptr sp(new X); weak_ptr wp; weak_ptr wp2(sp); weak_ptr wp3(sp); wp.swap(wp2); assert(wp.use_count() == 1); assert(wp2.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); using std::swap; swap(wp, wp2); assert(wp.use_count() == 0); assert(wp2.use_count() == 1); assert(!(wp2 < wp3 || wp3 < wp2)); sp.reset(); wp.swap(wp2); assert(wp.use_count() == 0); assert(wp2.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); using std::swap; swap(wp, wp2); assert(wp.use_count() == 0); assert(wp2.use_count() == 0); assert(!(wp2 < wp3 || wp3 < wp2)); } { shared_ptr sp(new X); shared_ptr sp2(new X); weak_ptr wp(sp); weak_ptr wp2(sp2); weak_ptr wp3(sp2); wp.swap(wp2); assert(wp.use_count() == 1); assert(wp2.use_count() == 1); assert(!(wp < wp3 || wp3 < wp)); using std::swap; swap(wp, wp2); assert(wp.use_count() == 1); assert(wp2.use_count() == 1); assert(!(wp2 < wp3 || wp3 < wp2)); sp.reset(); wp.swap(wp2); assert(wp.use_count() == 1); assert(wp2.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); using std::swap; swap(wp, wp2); assert(wp.use_count() == 0); assert(wp2.use_count() == 1); assert(!(wp2 < wp3 || wp3 < wp2)); sp2.reset(); wp.swap(wp2); assert(wp.use_count() == 0); assert(wp2.use_count() == 0); assert(!(wp < wp3 || wp3 < wp)); using std::swap; swap(wp, wp2); assert(wp.use_count() == 0); assert(wp2.use_count() == 0); assert(!(wp2 < wp3 || wp3 < wp2)); } } } // namespace n_swap namespace n_comparison { void test() { { weak_ptr wp; assert(!(wp < wp)); weak_ptr wp2; assert(!(wp < wp2 && wp2 < wp)); weak_ptr wp3(wp); assert(!(wp3 < wp3)); assert(!(wp < wp3 && wp3 < wp)); } { shared_ptr sp(new X); weak_ptr wp(sp); assert(!(wp < wp)); weak_ptr wp2; assert(wp < wp2 || wp2 < wp); assert(!(wp < wp2 && wp2 < wp)); bool b1 = wp < wp2; bool b2 = wp2 < wp; { weak_ptr wp3(wp); assert(!(wp < wp3 || wp3 < wp)); assert(!(wp < wp3 && wp3 < wp)); assert(wp2 < wp3 || wp3 < wp2); assert(!(wp2 < wp3 && wp3 < wp2)); weak_ptr wp4(wp2); assert(wp4 < wp3 || wp3 < wp4); assert(!(wp4 < wp3 && wp3 < wp4)); } sp.reset(); assert(b1 == (wp < wp2)); assert(b2 == (wp2 < wp)); { weak_ptr wp3(wp); assert(!(wp < wp3 || wp3 < wp)); assert(!(wp < wp3 && wp3 < wp)); assert(wp2 < wp3 || wp3 < wp2); assert(!(wp2 < wp3 && wp3 < wp2)); weak_ptr wp4(wp2); assert(wp4 < wp3 || wp3 < wp4); assert(!(wp4 < wp3 && wp3 < wp4)); } } { shared_ptr sp(new X); shared_ptr sp2(new X); weak_ptr wp(sp); weak_ptr wp2(sp2); assert(wp < wp2 || wp2 < wp); assert(!(wp < wp2 && wp2 < wp)); bool b1 = wp < wp2; bool b2 = wp2 < wp; { weak_ptr wp3(wp); assert(!(wp < wp3 || wp3 < wp)); assert(!(wp < wp3 && wp3 < wp)); assert(wp2 < wp3 || wp3 < wp2); assert(!(wp2 < wp3 && wp3 < wp2)); weak_ptr wp4(wp2); assert(wp4 < wp3 || wp3 < wp4); assert(!(wp4 < wp3 && wp3 < wp4)); } sp.reset(); assert(b1 == (wp < wp2)); assert(b2 == (wp2 < wp)); { weak_ptr wp3(wp); assert(!(wp < wp3 || wp3 < wp)); assert(!(wp < wp3 && wp3 < wp)); assert(wp2 < wp3 || wp3 < wp2); assert(!(wp2 < wp3 && wp3 < wp2)); weak_ptr wp4(wp2); assert(wp4 < wp3 || wp3 < wp4); assert(!(wp4 < wp3 && wp3 < wp4)); } sp2.reset(); assert(b1 == (wp < wp2)); assert(b2 == (wp2 < wp)); { weak_ptr wp3(wp); assert(!(wp < wp3 || wp3 < wp)); assert(!(wp < wp3 && wp3 < wp)); assert(wp2 < wp3 || wp3 < wp2); assert(!(wp2 < wp3 && wp3 < wp2)); weak_ptr wp4(wp2); assert(wp4 < wp3 || wp3 < wp4); assert(!(wp4 < wp3 && wp3 < wp4)); } } { shared_ptr sp(new X); shared_ptr sp2(sp); weak_ptr wp(sp); weak_ptr wp2(sp2); assert(!(wp < wp2 || wp2 < wp)); assert(!(wp < wp2 && wp2 < wp)); bool b1 = wp < wp2; bool b2 = wp2 < wp; { weak_ptr wp3(wp); assert(!(wp < wp3 || wp3 < wp)); assert(!(wp < wp3 && wp3 < wp)); assert(!(wp2 < wp3 || wp3 < wp2)); assert(!(wp2 < wp3 && wp3 < wp2)); weak_ptr wp4(wp2); assert(!(wp4 < wp3 || wp3 < wp4)); assert(!(wp4 < wp3 && wp3 < wp4)); } sp.reset(); sp2.reset(); assert(b1 == (wp < wp2)); assert(b2 == (wp2 < wp)); { weak_ptr wp3(wp); assert(!(wp < wp3 || wp3 < wp)); assert(!(wp < wp3 && wp3 < wp)); assert(!(wp2 < wp3 || wp3 < wp2)); assert(!(wp2 < wp3 && wp3 < wp2)); weak_ptr wp4(wp2); assert(!(wp4 < wp3 || wp3 < wp4)); assert(!(wp4 < wp3 && wp3 < wp4)); } } { shared_ptr spx(new X); shared_ptr spy(new Y); shared_ptr spz(new Z); weak_ptr px(spx); weak_ptr py(spy); weak_ptr pz(spz); assert(px < py || py < px); assert(px < pz || pz < px); assert(py < pz || pz < py); assert(!(px < py && py < px)); assert(!(px < pz && pz < px)); assert(!(py < pz && pz < py)); weak_ptr pvx(px); assert(!(pvx < pvx)); weak_ptr pvy(py); assert(!(pvy < pvy)); weak_ptr pvz(pz); assert(!(pvz < pvz)); assert(pvx < pvy || pvy < pvx); assert(pvx < pvz || pvz < pvx); assert(pvy < pvz || pvz < pvy); assert(!(pvx < pvy && pvy < pvx)); assert(!(pvx < pvz && pvz < pvx)); assert(!(pvy < pvz && pvz < pvy)); spx.reset(); spy.reset(); spz.reset(); assert(px < py || py < px); assert(px < pz || pz < px); assert(py < pz || pz < py); assert(!(px < py && py < px)); assert(!(px < pz && pz < px)); assert(!(py < pz && pz < py)); assert(!(pvx < pvx)); assert(!(pvy < pvy)); assert(!(pvz < pvz)); assert(pvx < pvy || pvy < pvx); assert(pvx < pvz || pvz < pvx); assert(pvy < pvz || pvz < pvy); assert(!(pvx < pvy && pvy < pvx)); assert(!(pvx < pvz && pvz < pvx)); assert(!(pvy < pvz && pvz < pvy)); } { shared_ptr spz(new Z); shared_ptr spx(spz); weak_ptr pz(spz); weak_ptr px(spx); weak_ptr py(spz); assert(!(px < px)); assert(!(py < py)); assert(!(px < py || py < px)); assert(!(px < pz || pz < px)); assert(!(py < pz || pz < py)); weak_ptr pvx(px); weak_ptr pvy(py); weak_ptr pvz(pz); assert(!(pvx < pvy || pvy < pvx)); assert(!(pvx < pvz || pvz < pvx)); assert(!(pvy < pvz || pvz < pvy)); spx.reset(); spz.reset(); assert(!(px < px)); assert(!(py < py)); assert(!(px < py || py < px)); assert(!(px < pz || pz < px)); assert(!(py < pz || pz < py)); assert(!(pvx < pvy || pvy < pvx)); assert(!(pvx < pvz || pvz < pvx)); assert(!(pvy < pvz || pvz < pvy)); } } } // namespace n_comparison namespace n_lock { void test() { } } // namespace n_lock namespace n_map { void test() { std::vector< shared_ptr > vi; { shared_ptr pi1(new int); shared_ptr pi2(new int); shared_ptr pi3(new int); vi.push_back(pi1); vi.push_back(pi1); vi.push_back(pi1); vi.push_back(pi2); vi.push_back(pi1); vi.push_back(pi2); vi.push_back(pi1); vi.push_back(pi3); vi.push_back(pi3); vi.push_back(pi2); vi.push_back(pi1); } std::vector< shared_ptr > vx; { shared_ptr px1(new X); shared_ptr px2(new X); shared_ptr px3(new X); vx.push_back(px2); vx.push_back(px2); vx.push_back(px1); vx.push_back(px2); vx.push_back(px1); vx.push_back(px1); vx.push_back(px1); vx.push_back(px2); vx.push_back(px1); vx.push_back(px3); vx.push_back(px2); } std::map< weak_ptr, long > m; { for(std::vector< shared_ptr >::iterator i = vi.begin(); i != vi.end(); ++i) { ++m[*i]; } } { for(std::vector< shared_ptr >::iterator i = vx.begin(); i != vx.end(); ++i) { ++m[*i]; } } { for(std::map< weak_ptr, long >::iterator i = m.begin(); i != m.end(); ++i) { assert(i->first.use_count() == i->second); } } } } // namespace n_map int main() { n_element_type::test(); n_constructors::test(); n_assignment::test(); n_reset::test(); n_use_count::test(); n_swap::test(); n_comparison::test(); n_lock::test(); n_map::test(); return 0; } class incomplete { }; shared_ptr create_incomplete() { shared_ptr px(new incomplete); return px; } clhep-2.1.4.1.orig/Utility/test/testIsConvertible.cc0000644000175000017500000001760711406156145021014 0ustar olesoles// ====================================================================== // -*- C++ -*- // $Id: testIsConvertible.cc,v 1.2 2010/06/16 14:15:01 garren Exp $ // --------------------------------------------------------------------------- // Test is_convertible type trait // // W. E. Brown, 2010-03-19 // based on work by John Maddock // ====================================================================== #include #include #include using namespace CLHEP; // define some test types: enum enum_UDT{ one, two, three }; struct UDT { UDT() { }; ~UDT() { }; UDT(const UDT&); UDT& operator=(const UDT&); int i; void f1(); int f2(); int f3(int); int f4(int, float); }; typedef void(*f1)(); typedef int(*f2)(int); typedef int(*f3)(int, bool); typedef void (UDT::*mf1)(); typedef int (UDT::*mf2)(); typedef int (UDT::*mf3)(int); typedef int (UDT::*mf4)(int, float); typedef int (UDT::*mp); typedef int (UDT::*cmf)(int) const; struct POD_UDT { int x; }; struct empty_UDT { empty_UDT() { }; empty_UDT(const empty_UDT&) { }; ~empty_UDT() { }; empty_UDT& operator=(const empty_UDT&){ return *this; } bool operator==(const empty_UDT&)const { return true; } }; struct empty_POD_UDT { bool operator==(const empty_POD_UDT&)const { return true; } }; union union_UDT { int x; double y; ~union_UDT() { } }; union POD_union_UDT { int x; double y; }; union empty_union_UDT { ~empty_union_UDT() { } }; union empty_POD_union_UDT { }; struct nothrow_copy_UDT { nothrow_copy_UDT(); nothrow_copy_UDT(const nothrow_copy_UDT&)throw(); ~nothrow_copy_UDT() { }; nothrow_copy_UDT& operator=(const nothrow_copy_UDT&){ return *this; } bool operator==(const nothrow_copy_UDT&)const { return true; } }; struct nothrow_assign_UDT { nothrow_assign_UDT(); nothrow_assign_UDT(const nothrow_assign_UDT&); ~nothrow_assign_UDT() { }; nothrow_assign_UDT& operator=(const nothrow_assign_UDT&)throw(){ return *this; } bool operator==(const nothrow_assign_UDT&)const { return true; } }; struct nothrow_construct_UDT { nothrow_construct_UDT()throw(); nothrow_construct_UDT(const nothrow_construct_UDT&); ~nothrow_construct_UDT() { }; nothrow_construct_UDT& operator=(const nothrow_construct_UDT&){ return *this; } bool operator==(const nothrow_construct_UDT&)const { return true; } }; class Base { }; class Derived : public Base { }; class Derived2 : public Base { }; class MultiBase : public Derived, public Derived2 { }; class PrivateBase : private Base { }; class NonDerived { }; enum enum1 { one_,two_ }; enum enum2 { three_,four_ }; struct VB { virtual ~VB() { }; }; struct VD : VB { ~VD() { }; }; // struct non_pointer: // used to verify that is_pointer does not return // true for class types that implement operator void*() // struct non_pointer { operator void*(){return this;} }; struct non_int_pointer { int i; operator int*(){return &i;} }; struct int_constructible { int_constructible(int); }; struct int_convertible { operator int(); }; // // struct non_empty: // used to verify that is_empty does not emit // spurious warnings or errors. // struct non_empty : private noncopyable { int i; }; // // abstract base classes: struct test_abc1 { test_abc1(); virtual ~test_abc1(); test_abc1(const test_abc1&); test_abc1& operator=(const test_abc1&); virtual void foo() = 0; virtual void foo2() = 0; }; struct test_abc2 { virtual ~test_abc2(); virtual void foo() = 0; virtual void foo2() = 0; }; struct test_abc3 : public test_abc1 { virtual void foo3() = 0; }; struct incomplete_type; struct polymorphic_base { virtual ~polymorphic_base(); virtual void method(); }; struct polymorphic_derived1 : polymorphic_base { }; struct polymorphic_derived2 : polymorphic_base { virtual void method(); }; struct virtual_inherit1 : virtual Base { }; struct virtual_inherit2 : virtual_inherit1 { }; struct virtual_inherit3 : private virtual Base { }; struct virtual_inherit4 : virtual noncopyable { }; struct virtual_inherit5 : virtual int_convertible { }; struct virtual_inherit6 : virtual Base { virtual ~virtual_inherit6()throw(); }; typedef void foo0_t(); typedef void foo1_t(int); typedef void foo2_t(int&, double); typedef void foo3_t(int&, bool, int, int); typedef void foo4_t(int, bool, int*, int[], int, int, int, int, int); struct trivial_except_construct { trivial_except_construct(); int i; }; struct trivial_except_destroy { ~trivial_except_destroy(); int i; }; struct trivial_except_copy { trivial_except_copy(trivial_except_copy const&); int i; }; struct trivial_except_assign { trivial_except_assign& operator=(trivial_except_assign const&); int i; }; template< typename T > struct wrap { T t; int j; protected: wrap(); wrap(const wrap&); wrap& operator=(const wrap&); }; template< typename T > struct convertible_from { convertible_from(T); }; struct base2 { }; struct middle2 : virtual base2 { }; struct derived2 : middle2 { }; int main() { #define conversion_claim(From,To) (is_convertible::value) #define does_convert(From,To) assert(conversion_claim(From,To)) #define does_not_convert(From,To) assert(!conversion_claim(From,To)) does_not_convert(NonDerived,Base); does_convert(Base,Base); does_convert(Derived,Base); does_convert(Derived,Derived); does_not_convert(Base,Derived); does_convert(Derived&, Base&); does_convert(const Derived&, const Base&); does_not_convert(Base&, Derived&); does_not_convert(const Base&, const Derived&); does_convert(Derived*, Base*); does_convert(const Derived*, const Base*); does_not_convert(Base*, Derived*); does_not_convert(const Base*, const Derived*); does_convert(polymorphic_derived1,polymorphic_base); does_convert(polymorphic_derived2,polymorphic_base); does_not_convert(polymorphic_base,polymorphic_derived1); does_not_convert(polymorphic_base,polymorphic_derived2); does_convert(virtual_inherit2,virtual_inherit1); does_convert(VD,VB); does_convert(void,void); does_not_convert(void,float); does_convert(float,void); //does_convert(float,int); does_convert(enum1, int); does_not_convert(const int *, int*); does_not_convert(const int&, int&); does_not_convert(const int*, int[3]); does_convert(const int&, int); does_convert(int(&)[4], const int*); does_convert(int(&)(int), int(*)(int)); does_convert(int *, const int*); does_convert(int&, const int&); does_convert(int[2], int*); does_convert(int[2], const int*); does_not_convert(const int[2], int*); does_not_convert(int*, int[3]); //does_convert(test_abc3, const test_abc1&); does_convert(non_pointer, void*); does_not_convert(non_pointer, int*); does_convert(non_int_pointer, int*); does_convert(non_int_pointer, void*); does_not_convert(test_abc1&, test_abc2&); does_not_convert(test_abc1&, int_constructible); does_not_convert(int_constructible, test_abc1&); does_not_convert(test_abc1&, test_abc2); #if defined(__GNUC__) && ((__GNUC__ < 4) || (__GNUC_MINOR__ < 2)) // known to be defective #elif defined(_MSC_VER) && (_MSC_VER <= 1400) // known to be defective #else // let's give it a try does_convert(int, int_constructible); does_convert(float,convertible_from ); does_convert(float,convertible_from ); does_convert(float,convertible_from ); does_convert(float,convertible_from ); does_convert(float,convertible_from ); does_not_convert(float,convertible_from ); does_convert(char,convertible_from ); does_convert(char,convertible_from ); does_convert(char,convertible_from ); does_convert(float&,convertible_from ); does_convert(float const&,convertible_from ); does_convert(float&,convertible_from ); does_convert(float const&,convertible_from ); does_convert(float&,convertible_from ); #endif // compiler return 0; } clhep-2.1.4.1.orig/Utility/test/Makefile.am0000644000175000017500000000377511406156145017072 0ustar olesoles# Applicable to each test program: if USE_GMAKE MAKE = gmake endif INCLUDES = -I../ LDADD = @Utility_LDFLAGS@ @Utility_LIBS@ # libraries to link, and whence if BUILD_VISUAL OUTFLAG = /Fo$@ else CXXFLAGS += -Wno-non-virtual-dtor OUTFLAG = -o $@ endif # normally, CXXLINK is supplied by automake, but we need to use /Fo instead # of -o when compiling with Visual C++ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ $(OUTFLAG) # Identify executables needed during testing: check_PROGRAMS = \ testNoncopyable \ testPrimaryTraits \ testCategories \ testIsSame \ testIsConvertible \ testSharedPtrBasic \ testSharedPtrConvertible \ testSharedPtr \ testWeakPtr # Identify test(s) to run when 'make check' is requested: TESTS = \ testNoncopyable \ testPrimaryTraits \ testCategories \ testIsSame \ testIsConvertible \ testSharedPtrBasic \ testSharedPtrConvertible \ testSharedPtr \ testWeakPtr # Identify the test(s) for which failure is the intended outcome: XFAIL_TESTS = # Identify the dependencies on a per-test basis: testNoncopyable_SOURCES = testNoncopyable.cc testPrimaryTraits_SOURCES = testPrimaryTraits.cc testCategories_SOURCES = testCategories.cc testIsSame_SOURCES = testIsSame.cc testIsConvertible_SOURCES = testIsConvertible.cc testSharedPtrBasic_SOURCES = testSharedPtrBasic.cc testSharedPtrConvertible_SOURCES = testSharedPtrConvertible.cc testSharedPtr_SOURCES = testSharedPtr.cc testWeakPtr_SOURCES = testWeakPtr.cc # Identify input data file(s) and prototype output file(s): EXTRA_DIST = # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = # supply our own suffix rule .cc.obj: if BUILD_VISUAL source='$<' object='$@' libtool=no \ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ $(CXXCOMPILE) -c $(OUTFLAG) `$(CYGPATH_W) '$<'` else if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c $(OUTFLAG) `$(CYGPATH_W) '$<'`; \ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi endif clhep-2.1.4.1.orig/Utility/test/testIsSame.cc0000644000175000017500000000252711406156145017420 0ustar olesoles// ====================================================================== // // Test basic functionality of is_same type trait // // Author: W. E. Brown, 2010-03-24, adapted from the boost library's // type_traits and related functionality whose internal attributions bear // the following various notices: // // (C) Copyright John Maddock 2000. // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // // ====================================================================== #include "CLHEP/Utility/type_traits.h" #include using namespace CLHEP; using CLHEP::is_same; typedef int my_int; #define claim_same(From,To) (is_same::value) #define has_same_type(From,To) assert(claim_same(From,To)) #define has_different_type(From,To) assert(!claim_same(From,To)) int main() { has_same_type(int, int); has_same_type(int, my_int); has_different_type(int , void); has_different_type(int , const int); has_different_type(int , int&); has_different_type(const int, int&); has_different_type(int , const int&); has_different_type(int* , const int*); has_different_type(int* , int*const); has_different_type(int , int[2]); has_different_type(int* , int[2]); has_different_type(int[4] , int[2]); return 0; } clhep-2.1.4.1.orig/Utility/test/testSharedPtr.cc0000644000175000017500000016037711671421477020152 0ustar olesoles// ====================================================================== // // Test compilability and basic functionality of Utility/memory.h // // Author: W. E. Brown, 2010-03-19, adapted from the boost library's // shared_ptr and related functionality whose internal attributions bear // the following various notices: // // Copyright (c) 2002, 2003 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // // ====================================================================== #include "CLHEP/Utility/memory.h" #include #include #include using namespace CLHEP; using CLHEP::shared_ptr; using CLHEP::weak_ptr; #if defined(_MSC_VER) && (_MSC_VER >= 1310) # pragma warning (disable : 4675) // suppress ADL warning #endif namespace n_element_type { void f(int &) { } void test() { typedef shared_ptr::element_type T; T t; f(t); } } // namespace n_element_type namespace n_constructors { class incomplete; void default_constructor() { { shared_ptr pi; assert(pi? false: true); assert(!pi); assert(pi.get() == 0); assert(pi.use_count() == 0); } { shared_ptr pv; assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 0); } { shared_ptr px; assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 0); } } struct A { int dummy; }; struct X { static long instances; X() { ++instances; } ~X() { --instances; } private: X(X const &); X & operator= (X const &); }; long X::instances = 0; // virtual inheritance stresses the implementation struct Y : public A , public virtual X { static long instances; Y() { ++instances; } ~Y() { --instances; } private: Y(Y const &); Y & operator= (Y const &); }; long Y::instances = 0; template< class T > void pc0_test(T * p) { assert(p == 0); shared_ptr pt(p); assert(pt? false: true); assert(!pt); assert(pt.get() == 0); assert(pt.use_count() == 1); assert(pt.unique()); } void pointer_constructor() { pc0_test(static_cast(0)); pc0_test(static_cast(0)); pc0_test(static_cast(0)); pc0_test(static_cast(0)); { shared_ptr pi(static_cast(0)); assert(pi? false: true); assert(!pi); assert(pi.get() == 0); assert(pi.use_count() == 1); assert(pi.unique()); } { shared_ptr pi(static_cast(0)); assert(pi? false: true); assert(!pi); assert(pi.get() == 0); assert(pi.use_count() == 1); assert(pi.unique()); } { shared_ptr pv(static_cast(0)); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); } { shared_ptr pv(static_cast(0)); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); } pc0_test(static_cast(0)); pc0_test(static_cast(0)); pc0_test(static_cast(0)); pc0_test(static_cast(0)); { shared_ptr px(static_cast(0)); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); } { shared_ptr px(static_cast(0)); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); } { shared_ptr px(static_cast(0)); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); } { shared_ptr pv(static_cast(0)); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); } { shared_ptr pv(static_cast(0)); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); } { int * p = new int(7); shared_ptr pi(p); assert(pi? true: false); assert(!!pi); assert(pi.get() == p); assert(pi.use_count() == 1); assert(pi.unique()); assert(*pi == 7); } { int * p = new int(7); shared_ptr pi(p); assert(pi? true: false); assert(!!pi); assert(pi.get() == p); assert(pi.use_count() == 1); assert(pi.unique()); assert(*pi == 7); } { int * p = new int(7); shared_ptr pv(p); assert(pv? true: false); assert(!!pv); assert(pv.get() == p); assert(pv.use_count() == 1); assert(pv.unique()); } { int * p = new int(7); shared_ptr pv(p); assert(pv? true: false); assert(!!pv); assert(pv.get() == p); assert(pv.use_count() == 1); assert(pv.unique()); } assert(X::instances == 0); { X * p = new X; shared_ptr px(p); assert(px? true: false); assert(!!px); assert(px.get() == p); assert(px.use_count() == 1); assert(px.unique()); assert(X::instances == 1); } assert(X::instances == 0); { X * p = new X; shared_ptr px(p); assert(px? true: false); assert(!!px); assert(px.get() == p); assert(px.use_count() == 1); assert(px.unique()); assert(X::instances == 1); } assert(X::instances == 0); { X * p = new X; shared_ptr pv(p); assert(pv? true: false); assert(!!pv); assert(pv.get() == p); assert(pv.use_count() == 1); assert(pv.unique()); assert(X::instances == 1); } assert(X::instances == 0); { X * p = new X; shared_ptr pv(p); assert(pv? true: false); assert(!!pv); assert(pv.get() == p); assert(pv.use_count() == 1); assert(pv.unique()); assert(X::instances == 1); } assert(X::instances == 0); assert(Y::instances == 0); { Y * p = new Y; shared_ptr px(p); assert(px? true: false); assert(!!px); assert(px.get() == p); assert(px.use_count() == 1); assert(px.unique()); assert(X::instances == 1); assert(Y::instances == 1); } assert(X::instances == 0); assert(Y::instances == 0); { Y * p = new Y; shared_ptr px(p); assert(px? true: false); assert(!!px); assert(px.get() == p); assert(px.use_count() == 1); assert(px.unique()); assert(X::instances == 1); assert(Y::instances == 1); } assert(X::instances == 0); assert(Y::instances == 0); } int m = 0; void deleter(int * p) { assert(p == 0); } void deleter2(int * p) { assert(p == &m); ++*p; } struct deleter3 { void operator()(incomplete * p) { assert(p == 0); } }; incomplete * p0 = 0; void deleter_constructor() { { shared_ptr pi(static_cast(0), deleter); assert(pi? false: true); assert(!pi); assert(pi.get() == 0); assert(pi.use_count() == 1); assert(pi.unique()); } { shared_ptr pv(static_cast(0), &deleter); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); } { shared_ptr pv(static_cast(0), deleter); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); } { shared_ptr px(p0, deleter3()); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); } { shared_ptr pv(p0, deleter3()); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); } { shared_ptr pv(p0, deleter3()); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); } assert(m == 0); { shared_ptr pi(&m, deleter2); assert(pi? true: false); assert(!!pi); assert(pi.get() == &m); assert(pi.use_count() == 1); assert(pi.unique()); } assert(m == 1); { shared_ptr pi(&m, &deleter2); assert(pi? true: false); assert(!!pi); assert(pi.get() == &m); assert(pi.use_count() == 1); assert(pi.unique()); } assert(m == 2); { shared_ptr pv(&m, deleter2); assert(pv? true: false); assert(!!pv); assert(pv.get() == &m); assert(pv.use_count() == 1); assert(pv.unique()); } assert(m == 3); { shared_ptr pv(&m, &deleter2); assert(pv? true: false); assert(!!pv); assert(pv.get() == &m); assert(pv.use_count() == 1); assert(pv.unique()); } assert(m == 4); } void copy_constructor() { { shared_ptr pi; shared_ptr pi2(pi); assert(pi2 == pi); assert(pi2? false: true); assert(!pi2); assert(pi2.get() == 0); assert(pi2.use_count() == pi.use_count()); shared_ptr pi3(pi); assert(pi3 == pi); assert(pi3? false: true); assert(!pi3); assert(pi3.get() == 0); assert(pi3.use_count() == pi.use_count()); shared_ptr pi4(pi3); assert(pi4 == pi3); assert(pi4? false: true); assert(!pi4); assert(pi4.get() == 0); assert(pi4.use_count() == pi3.use_count()); } { shared_ptr pv; shared_ptr pv2(pv); assert(pv2 == pv); assert(pv2? false: true); assert(!pv2); assert(pv2.get() == 0); assert(pv2.use_count() == pv.use_count()); } { shared_ptr px; shared_ptr px2(px); assert(px2 == px); assert(px2? false: true); assert(!px2); assert(px2.get() == 0); assert(px2.use_count() == px.use_count()); shared_ptr px3(px); assert(px3 == px); assert(px3? false: true); assert(!px3); assert(px3.get() == 0); assert(px3.use_count() == px.use_count()); } { shared_ptr pi(static_cast(0)); shared_ptr pi2(pi); assert(pi2 == pi); assert(pi2? false: true); assert(!pi2); assert(pi2.get() == 0); assert(pi2.use_count() == 2); assert(!pi2.unique()); assert(pi2.use_count() == pi.use_count()); assert(!(pi < pi2 || pi2 < pi)); // shared ownership test shared_ptr pi3(pi); assert(pi3 == pi); assert(pi3? false: true); assert(!pi3); assert(pi3.get() == 0); assert(pi3.use_count() == 3); assert(!pi3.unique()); assert(pi3.use_count() == pi.use_count()); assert(!(pi < pi3 || pi3 < pi)); // shared ownership test shared_ptr pi4(pi2); assert(pi4 == pi2); assert(pi4? false: true); assert(!pi4); assert(pi4.get() == 0); assert(pi4.use_count() == 4); assert(!pi4.unique()); assert(pi4.use_count() == pi2.use_count()); assert(!(pi2 < pi4 || pi4 < pi2)); // shared ownership test assert(pi3.use_count() == pi4.use_count()); assert(!(pi3 < pi4 || pi4 < pi3)); // shared ownership test } { shared_ptr px(static_cast(0)); shared_ptr px2(px); assert(px2 == px); assert(px2? false: true); assert(!px2); assert(px2.get() == 0); assert(px2.use_count() == 2); assert(!px2.unique()); assert(px2.use_count() == px.use_count()); assert(!(px < px2 || px2 < px)); // shared ownership test shared_ptr px3(px); assert(px3 == px); assert(px3? false: true); assert(!px3); assert(px3.get() == 0); assert(px3.use_count() == 3); assert(!px3.unique()); assert(px3.use_count() == px.use_count()); assert(!(px < px3 || px3 < px)); // shared ownership test shared_ptr px4(px2); assert(px4 == px2); assert(px4? false: true); assert(!px4); assert(px4.get() == 0); assert(px4.use_count() == 4); assert(!px4.unique()); assert(px4.use_count() == px2.use_count()); assert(!(px2 < px4 || px4 < px2)); // shared ownership test assert(px3.use_count() == px4.use_count()); assert(!(px3 < px4 || px4 < px3)); // shared ownership test } { int * p = new int(7); shared_ptr pi(p); shared_ptr pi2(pi); assert(pi2 == pi); assert(pi2? true: false); assert(!!pi2); assert(pi2.get() == p); assert(pi2.use_count() == 2); assert(!pi2.unique()); assert(*pi2 == 7); assert(pi2.use_count() == pi.use_count()); assert(!(pi < pi2 || pi2 < pi)); // shared ownership test } { int * p = new int(7); shared_ptr pv(p); assert(pv.get() == p); shared_ptr pv2(pv); assert(pv2 == pv); assert(pv2? true: false); assert(!!pv2); assert(pv2.get() == p); assert(pv2.use_count() == 2); assert(!pv2.unique()); assert(pv2.use_count() == pv.use_count()); assert(!(pv < pv2 || pv2 < pv)); // shared ownership test } assert(X::instances == 0); { X * p = new X; shared_ptr px(p); assert(px.get() == p); shared_ptr px2(px); assert(px2 == px); assert(px2? true: false); assert(!!px2); assert(px2.get() == p); assert(px2.use_count() == 2); assert(!px2.unique()); assert(X::instances == 1); assert(px2.use_count() == px.use_count()); assert(!(px < px2 || px2 < px)); // shared ownership test shared_ptr px3(px); assert(px3 == px); assert(px3? true: false); assert(!!px3); assert(px3.get() == p); assert(px3.use_count() == 3); assert(!px3.unique()); assert(px3.use_count() == px.use_count()); assert(!(px < px3 || px3 < px)); // shared ownership test shared_ptr px4(px2); assert(px4 == px2); assert(px4? true: false); assert(!!px4); assert(px4.get() == p); assert(px4.use_count() == 4); assert(!px4.unique()); assert(px4.use_count() == px2.use_count()); assert(!(px2 < px4 || px4 < px2)); // shared ownership test assert(px3.use_count() == px4.use_count()); assert(!(px3 < px4 || px4 < px3)); // shared ownership test } assert(X::instances == 0); assert(Y::instances == 0); { Y * p = new Y; shared_ptr py(p); assert(py.get() == p); shared_ptr px(py); assert(px == py); assert(px? true: false); assert(!!px); assert(px.get() == p); assert(px.use_count() == 2); assert(!px.unique()); assert(px.use_count() == py.use_count()); assert(!(px < py || py < px)); // shared ownership test assert(X::instances == 1); assert(Y::instances == 1); shared_ptr pv(px); assert(pv == px); assert(pv? true: false); assert(!!pv); assert(pv.get() == px.get()); assert(pv.use_count() == 3); assert(!pv.unique()); assert(pv.use_count() == px.use_count()); assert(!(px < pv || pv < px)); // shared ownership test shared_ptr pv2(py); assert(pv2 == py); assert(pv2? true: false); assert(!!pv2); assert(pv2.get() == py.get()); assert(pv2.use_count() == 4); assert(!pv2.unique()); assert(pv2.use_count() == py.use_count()); assert(!(py < pv2 || pv2 < py)); // shared ownership test assert(pv.use_count() == pv2.use_count()); assert(!(pv < pv2 || pv2 < pv)); // shared ownership test } assert(X::instances == 0); assert(Y::instances == 0); } void weak_ptr_constructor() { { weak_ptr wp; assert(wp.use_count() == 0); try { shared_ptr p2(wp); throw "shared_ptr p2(wp) failed to throw"; } catch(bad_weak_ptr) { } try { shared_ptr p3(wp); throw "shared_ptr p3(wp) failed to throw"; } catch(bad_weak_ptr) { } } { shared_ptr p; weak_ptr wp(p); if(wp.use_count() != 0) // 0 allowed but not required { shared_ptr p2(wp); assert(p2.use_count() == wp.use_count()); assert(p2.get() == 0); shared_ptr p3(wp); assert(p3.use_count() == wp.use_count()); assert(p3.get() == 0); } } { shared_ptr p(new Y); weak_ptr wp(p); { shared_ptr p2(wp); assert(p2? true: false); assert(!!p2); assert(p2.get() == p.get()); assert(p2.use_count() == 2); assert(!p2.unique()); assert(p2.use_count() == wp.use_count()); assert(p.use_count() == p2.use_count()); assert(!(p < p2 || p2 < p)); // shared ownership test shared_ptr p3(wp); assert(p3? true: false); assert(!!p3); assert(p3.get() == p.get()); assert(p3.use_count() == 3); assert(!p3.unique()); assert(p3.use_count() == wp.use_count()); assert(p.use_count() == p3.use_count()); } p.reset(); assert(wp.use_count() == 0); try { shared_ptr p2(wp); throw "shared_ptr p2(wp) failed to throw"; } catch(bad_weak_ptr) { } try { shared_ptr p3(wp); throw "shared_ptr p3(wp) failed to throw"; } catch(bad_weak_ptr) { } } } void auto_ptr_constructor() { { std::auto_ptr p; shared_ptr pi(p); assert(pi? false: true); assert(!pi); assert(pi.get() == 0); assert(pi.use_count() == 1); assert(pi.unique()); assert(p.get() == 0); } { std::auto_ptr p; shared_ptr pi(p); assert(pi? false: true); assert(!pi); assert(pi.get() == 0); assert(pi.use_count() == 1); assert(pi.unique()); assert(p.get() == 0); } { std::auto_ptr p; shared_ptr pv(p); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); assert(p.get() == 0); } { std::auto_ptr p; shared_ptr pv(p); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); assert(p.get() == 0); } { std::auto_ptr p; shared_ptr px(p); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); assert(p.get() == 0); } { std::auto_ptr p; shared_ptr px(p); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); assert(p.get() == 0); } { std::auto_ptr p; shared_ptr px(p); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); assert(p.get() == 0); } { std::auto_ptr p; shared_ptr px(p); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); assert(p.get() == 0); } { std::auto_ptr p; shared_ptr pv(p); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); assert(p.get() == 0); } { std::auto_ptr p; shared_ptr pv(p); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); assert(p.get() == 0); } { std::auto_ptr p(new int(7)); int * q = p.get(); shared_ptr pi(p); assert(pi? true: false); assert(!!pi); assert(pi.get() == q); assert(pi.use_count() == 1); assert(pi.unique()); assert(*pi == 7); assert(p.get() == 0); } { std::auto_ptr p(new int(7)); int * q = p.get(); shared_ptr pi(p); assert(pi? true: false); assert(!!pi); assert(pi.get() == q); assert(pi.use_count() == 1); assert(pi.unique()); assert(*pi == 7); assert(p.get() == 0); } { std::auto_ptr p(new int(7)); int * q = p.get(); shared_ptr pv(p); assert(pv? true: false); assert(!!pv); assert(pv.get() == q); assert(pv.use_count() == 1); assert(pv.unique()); assert(p.get() == 0); } { std::auto_ptr p(new int(7)); int * q = p.get(); shared_ptr pv(p); assert(pv? true: false); assert(!!pv); assert(pv.get() == q); assert(pv.use_count() == 1); assert(pv.unique()); assert(p.get() == 0); } assert(X::instances == 0); { std::auto_ptr p(new X); X * q = p.get(); shared_ptr px(p); assert(px? true: false); assert(!!px); assert(px.get() == q); assert(px.use_count() == 1); assert(px.unique()); assert(X::instances == 1); assert(p.get() == 0); } assert(X::instances == 0); { std::auto_ptr p(new X); X * q = p.get(); shared_ptr px(p); assert(px? true: false); assert(!!px); assert(px.get() == q); assert(px.use_count() == 1); assert(px.unique()); assert(X::instances == 1); assert(p.get() == 0); } assert(X::instances == 0); { std::auto_ptr p(new X); X * q = p.get(); shared_ptr pv(p); assert(pv? true: false); assert(!!pv); assert(pv.get() == q); assert(pv.use_count() == 1); assert(pv.unique()); assert(X::instances == 1); assert(p.get() == 0); } assert(X::instances == 0); { std::auto_ptr p(new X); X * q = p.get(); shared_ptr pv(p); assert(pv? true: false); assert(!!pv); assert(pv.get() == q); assert(pv.use_count() == 1); assert(pv.unique()); assert(X::instances == 1); assert(p.get() == 0); } assert(X::instances == 0); assert(Y::instances == 0); { std::auto_ptr p(new Y); Y * q = p.get(); shared_ptr px(p); assert(px? true: false); assert(!!px); assert(px.get() == q); assert(px.use_count() == 1); assert(px.unique()); assert(X::instances == 1); assert(Y::instances == 1); assert(p.get() == 0); } assert(X::instances == 0); assert(Y::instances == 0); { std::auto_ptr p(new Y); Y * q = p.get(); shared_ptr px(p); assert(px? true: false); assert(!!px); assert(px.get() == q); assert(px.use_count() == 1); assert(px.unique()); assert(X::instances == 1); assert(Y::instances == 1); assert(p.get() == 0); } assert(X::instances == 0); assert(Y::instances == 0); } void test() { default_constructor(); pointer_constructor(); deleter_constructor(); copy_constructor(); weak_ptr_constructor(); auto_ptr_constructor(); } } // namespace n_constructors namespace n_assignment { class incomplete; struct A { int dummy; }; struct X { static long instances; X() { ++instances; } ~X() { --instances; } private: X(X const &); X & operator= (X const &); }; long X::instances = 0; struct Y : public A , public virtual X { static long instances; Y() { ++instances; } ~Y() { --instances; } private: Y(Y const &); Y & operator= (Y const &); }; long Y::instances = 0; void copy_assignment() { { shared_ptr p1; p1 = p1; assert(p1 == p1); assert(p1? false: true); assert(!p1); assert(p1.get() == 0); shared_ptr p2; p1 = p2; assert(p1 == p2); assert(p1? false: true); assert(!p1); assert(p1.get() == 0); shared_ptr p3(p1); p1 = p3; assert(p1 == p3); assert(p1? false: true); assert(!p1); assert(p1.get() == 0); } { shared_ptr p1; p1 = p1; assert(p1 == p1); assert(p1? false: true); assert(!p1); assert(p1.get() == 0); shared_ptr p2; p1 = p2; assert(p1 == p2); assert(p1? false: true); assert(!p1); assert(p1.get() == 0); shared_ptr p3(p1); p1 = p3; assert(p1 == p3); assert(p1? false: true); assert(!p1); assert(p1.get() == 0); shared_ptr p4(new int); assert(p4.use_count() == 1); p1 = p4; assert(p1 == p4); assert(!(p1 < p4 || p4 < p1)); assert(p1.use_count() == 2); assert(p4.use_count() == 2); p1 = p3; assert(p1 == p3); assert(p4.use_count() == 1); } { shared_ptr p1; p1 = p1; assert(p1 == p1); assert(p1? false: true); assert(!p1); assert(p1.get() == 0); shared_ptr p2; p1 = p2; assert(p1 == p2); assert(p1? false: true); assert(!p1); assert(p1.get() == 0); shared_ptr p3(p1); p1 = p3; assert(p1 == p3); assert(p1? false: true); assert(!p1); assert(p1.get() == 0); assert(X::instances == 0); shared_ptr p4(new X); assert(X::instances == 1); p1 = p4; assert(X::instances == 1); assert(p1 == p4); assert(!(p1 < p4 || p4 < p1)); assert(p1.use_count() == 2); p1 = p2; assert(p1 == p2); assert(X::instances == 1); p4 = p3; assert(p4 == p3); assert(X::instances == 0); } } void conversion_assignment() { { shared_ptr p1; shared_ptr p2; p1 = p2; assert(p1 == p2); assert(p1? false: true); assert(!p1); assert(p1.get() == 0); shared_ptr p4(new int); assert(p4.use_count() == 1); shared_ptr p5(p4); assert(p4.use_count() == 2); p1 = p4; assert(p1 == p4); assert(!(p1 < p5 || p5 < p1)); assert(p1.use_count() == 3); assert(p4.use_count() == 3); p1 = p2; assert(p1 == p2); assert(p4.use_count() == 2); } { shared_ptr p1; shared_ptr p2; p1 = p2; assert(p1 == p2); assert(p1? false: true); assert(!p1); assert(p1.get() == 0); assert(X::instances == 0); assert(Y::instances == 0); shared_ptr p4(new Y); assert(X::instances == 1); assert(Y::instances == 1); assert(p4.use_count() == 1); shared_ptr p5(p4); assert(p4.use_count() == 2); p1 = p4; assert(X::instances == 1); assert(Y::instances == 1); assert(p1 == p4); assert(!(p1 < p5 || p5 < p1)); assert(p1.use_count() == 3); assert(p4.use_count() == 3); p1 = p2; assert(p1 == p2); assert(X::instances == 1); assert(Y::instances == 1); assert(p4.use_count() == 2); p4 = p2; p5 = p2; assert(p4 == p2); assert(X::instances == 0); assert(Y::instances == 0); } } void auto_ptr_assignment() { { shared_ptr p1; std::auto_ptr p2; p1 = p2; assert(p1? false: true); assert(!p1); assert(p1.get() == 0); assert(p1.use_count() == 1); int * p = new int; std::auto_ptr p3(p); p1 = p3; assert(p1.get() == p); assert(p1.use_count() == 1); assert(p3.get() == 0); p1 = p2; assert(p1? false: true); assert(!p1); assert(p1.get() == 0); assert(p1.use_count() == 1); } { shared_ptr p1; std::auto_ptr p2; p1 = p2; assert(p1? false: true); assert(!p1); assert(p1.get() == 0); assert(p1.use_count() == 1); int * p = new int; std::auto_ptr p3(p); p1 = p3; assert(p1.get() == p); assert(p1.use_count() == 1); assert(p3.get() == 0); p1 = p2; assert(p1? false: true); assert(!p1); assert(p1.get() == 0); assert(p1.use_count() == 1); } { shared_ptr p1; std::auto_ptr p2; p1 = p2; assert(p1? false: true); assert(!p1); assert(p1.get() == 0); assert(p1.use_count() == 1); assert(X::instances == 0); assert(Y::instances == 0); Y * p = new Y; std::auto_ptr p3(p); assert(X::instances == 1); assert(Y::instances == 1); p1 = p3; assert(p1.get() == p); assert(p1.use_count() == 1); assert(X::instances == 1); assert(Y::instances == 1); assert(p3.get() == 0); p1 = p2; assert(p1? false: true); assert(!p1); assert(p1.get() == 0); assert(p1.use_count() == 1); assert(X::instances == 0); assert(Y::instances == 0); } } void test() { copy_assignment(); conversion_assignment(); auto_ptr_assignment(); } } // namespace n_assignment namespace n_reset { class incomplete; incomplete * p0 = 0; void deleter(incomplete *) { } struct X { static long instances; X() { ++instances; } ~X() { --instances; } private: X(X const &); X & operator= (X const &); }; long X::instances = 0; void plain_reset() { { shared_ptr pi; pi.reset(); assert(pi? false: true); assert(!pi); assert(pi.get() == 0); assert(pi.use_count() == 0); } { shared_ptr pi(static_cast(0)); pi.reset(); assert(pi? false: true); assert(!pi); assert(pi.get() == 0); assert(pi.use_count() == 0); } { shared_ptr pi(new int); pi.reset(); assert(pi? false: true); assert(!pi); assert(pi.get() == 0); assert(pi.use_count() == 0); } { shared_ptr px; px.reset(); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 0); } { shared_ptr px(p0, deleter); px.reset(); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 0); } { shared_ptr px; px.reset(); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 0); } { assert(X::instances == 0); shared_ptr px(new X); assert(X::instances == 1); px.reset(); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 0); assert(X::instances == 0); } { shared_ptr pv; pv.reset(); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 0); } { assert(X::instances == 0); shared_ptr pv(new X); assert(X::instances == 1); pv.reset(); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 0); assert(X::instances == 0); } } struct A { int dummy; }; struct Y : public A , public virtual X { static long instances; Y() { ++instances; } ~Y() { --instances; } private: Y(Y const &); Y & operator= (Y const &); }; long Y::instances = 0; void pointer_reset() { { shared_ptr pi; pi.reset(static_cast(0)); assert(pi? false: true); assert(!pi); assert(pi.get() == 0); assert(pi.use_count() == 1); assert(pi.unique()); int * p = new int; pi.reset(p); assert(pi? true: false); assert(!!pi); assert(pi.get() == p); assert(pi.use_count() == 1); assert(pi.unique()); pi.reset(static_cast(0)); assert(pi? false: true); assert(!pi); assert(pi.get() == 0); assert(pi.use_count() == 1); assert(pi.unique()); } { shared_ptr px; px.reset(static_cast(0)); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); assert(X::instances == 0); X * p = new X; px.reset(p); assert(px? true: false); assert(!!px); assert(px.get() == p); assert(px.use_count() == 1); assert(px.unique()); assert(X::instances == 1); px.reset(static_cast(0)); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); assert(X::instances == 0); assert(Y::instances == 0); Y * q = new Y; px.reset(q); assert(px? true: false); assert(!!px); assert(px.get() == q); assert(px.use_count() == 1); assert(px.unique()); assert(X::instances == 1); assert(Y::instances == 1); px.reset(static_cast(0)); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); assert(X::instances == 0); assert(Y::instances == 0); } { shared_ptr pv; pv.reset(static_cast(0)); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); assert(X::instances == 0); X * p = new X; pv.reset(p); assert(pv? true: false); assert(!!pv); assert(pv.get() == p); assert(pv.use_count() == 1); assert(pv.unique()); assert(X::instances == 1); pv.reset(static_cast(0)); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); assert(X::instances == 0); assert(Y::instances == 0); Y * q = new Y; pv.reset(q); assert(pv? true: false); assert(!!pv); assert(pv.get() == q); assert(pv.use_count() == 1); assert(pv.unique()); assert(X::instances == 1); assert(Y::instances == 1); pv.reset(static_cast(0)); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); assert(X::instances == 0); assert(Y::instances == 0); } } void * deleted = 0; void deleter2(void * p) { deleted = p; } void deleter_reset() { { shared_ptr pi; pi.reset(static_cast(0), deleter2); assert(pi? false: true); assert(!pi); assert(pi.get() == 0); assert(pi.use_count() == 1); assert(pi.unique()); deleted = π int m = 0; pi.reset(&m, deleter2); assert(deleted == 0); assert(pi? true: false); assert(!!pi); assert(pi.get() == &m); assert(pi.use_count() == 1); assert(pi.unique()); pi.reset(static_cast(0), deleter2); assert(deleted == &m); assert(pi? false: true); assert(!pi); assert(pi.get() == 0); assert(pi.use_count() == 1); assert(pi.unique()); pi.reset(); assert(deleted == 0); } { shared_ptr px; px.reset(static_cast(0), deleter2); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); deleted = &px; X x; px.reset(&x, deleter2); assert(deleted == 0); assert(px? true: false); assert(!!px); assert(px.get() == &x); assert(px.use_count() == 1); assert(px.unique()); px.reset(static_cast(0), deleter2); assert(deleted == &x); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); Y y; px.reset(&y, deleter2); assert(deleted == 0); assert(px? true: false); assert(!!px); assert(px.get() == &y); assert(px.use_count() == 1); assert(px.unique()); px.reset(static_cast(0), deleter2); assert(deleted == &y); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); px.reset(); assert(deleted == 0); } { shared_ptr pv; pv.reset(static_cast(0), deleter2); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); deleted = &pv; X x; pv.reset(&x, deleter2); assert(deleted == 0); assert(pv? true: false); assert(!!pv); assert(pv.get() == &x); assert(pv.use_count() == 1); assert(pv.unique()); pv.reset(static_cast(0), deleter2); assert(deleted == &x); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); Y y; pv.reset(&y, deleter2); assert(deleted == 0); assert(pv? true: false); assert(!!pv); assert(pv.get() == &y); assert(pv.use_count() == 1); assert(pv.unique()); pv.reset(static_cast(0), deleter2); assert(deleted == &y); assert(pv? false: true); assert(!pv); assert(pv.get() == 0); assert(pv.use_count() == 1); assert(pv.unique()); pv.reset(); assert(deleted == 0); } { shared_ptr px; px.reset(p0, deleter2); assert(px? false: true); assert(!px); assert(px.get() == 0); assert(px.use_count() == 1); assert(px.unique()); deleted = &px; px.reset(p0, deleter2); assert(deleted == 0); } } void test() { plain_reset(); pointer_reset(); deleter_reset(); } } // namespace n_reset namespace n_access { struct X { }; void test() { { shared_ptr px; assert(px.get() == 0); assert(px? false: true); assert(!px); assert(get_pointer(px) == px.get()); } { shared_ptr px(static_cast(0)); assert(px.get() == 0); assert(px? false: true); assert(!px); assert(get_pointer(px) == px.get()); } #if 0 { shared_ptr px(static_cast(0), checked_deleter()); assert(px.get() == 0); assert(px? false: true); assert(!px); assert(get_pointer(px) == px.get()); } #endif // 0 { X * p = new X; shared_ptr px(p); assert(px.get() == p); assert(px? true: false); assert(!!px); assert(&*px == px.get()); assert(px.operator ->() == px.get()); assert(get_pointer(px) == px.get()); } #if 0 { X * p = new X; shared_ptr px(p, checked_deleter()); assert(px.get() == p); assert(px? true: false); assert(!!px); assert(&*px == px.get()); assert(px.operator ->() == px.get()); assert(get_pointer(px) == px.get()); } #endif // 0 } } // namespace n_access namespace n_use_count { struct X { }; void test() { { shared_ptr px(static_cast(0)); assert(px.use_count() == 1); assert(px.unique()); shared_ptr px2(px); assert(px2.use_count() == 2); assert(!px2.unique()); assert(px.use_count() == 2); assert(!px.unique()); } { shared_ptr px(new X); assert(px.use_count() == 1); assert(px.unique()); shared_ptr px2(px); assert(px2.use_count() == 2); assert(!px2.unique()); assert(px.use_count() == 2); assert(!px.unique()); } #if 0 { shared_ptr px(new X, checked_deleter()); assert(px.use_count() == 1); assert(px.unique()); shared_ptr px2(px); assert(px2.use_count() == 2); assert(!px2.unique()); assert(px.use_count() == 2); assert(!px.unique()); } #endif // 0 } } // namespace n_use_count namespace n_swap { struct X { }; void test() { { shared_ptr px; shared_ptr px2; px.swap(px2); assert(px.get() == 0); assert(px2.get() == 0); using std::swap; swap(px, px2); assert(px.get() == 0); assert(px2.get() == 0); } { X * p = new X; shared_ptr px; shared_ptr px2(p); shared_ptr px3(px2); px.swap(px2); assert(px.get() == p); assert(px.use_count() == 2); assert(px2.get() == 0); assert(px3.get() == p); assert(px3.use_count() == 2); using std::swap; swap(px, px2); assert(px.get() == 0); assert(px2.get() == p); assert(px2.use_count() == 2); assert(px3.get() == p); assert(px3.use_count() == 2); } { X * p1 = new X; X * p2 = new X; shared_ptr px(p1); shared_ptr px2(p2); shared_ptr px3(px2); px.swap(px2); assert(px.get() == p2); assert(px.use_count() == 2); assert(px2.get() == p1); assert(px2.use_count() == 1); assert(px3.get() == p2); assert(px3.use_count() == 2); using std::swap; swap(px, px2); assert(px.get() == p1); assert(px.use_count() == 1); assert(px2.get() == p2); assert(px2.use_count() == 2); assert(px3.get() == p2); assert(px3.use_count() == 2); } } } // namespace n_swap namespace n_comparison { struct X { int dummy; }; struct Y { int dummy2; }; struct Z : public X , public virtual Y { }; void test() { { shared_ptr px; assert(px == px); assert(!(px != px)); assert(!(px < px)); shared_ptr px2; assert(px.get() == px2.get()); assert(px == px2); assert(!(px != px2)); assert(!(px < px2 && px2 < px)); } { shared_ptr px; shared_ptr px2(px); assert(px2 == px2); assert(!(px2 != px2)); assert(!(px2 < px2)); assert(px.get() == px2.get()); assert(px == px2); assert(!(px != px2)); assert(!(px < px2 && px2 < px)); } { shared_ptr px; shared_ptr px2(new X); assert(px2 == px2); assert(!(px2 != px2)); assert(!(px2 < px2)); assert(px.get() != px2.get()); assert(px != px2); assert(!(px == px2)); assert(px < px2 || px2 < px); assert(!(px < px2 && px2 < px)); } { shared_ptr px(new X); shared_ptr px2(new X); assert(px.get() != px2.get()); assert(px != px2); assert(!(px == px2)); assert(px < px2 || px2 < px); assert(!(px < px2 && px2 < px)); } { shared_ptr px(new X); shared_ptr px2(px); assert(px2 == px2); assert(!(px2 != px2)); assert(!(px2 < px2)); assert(px.get() == px2.get()); assert(px == px2); assert(!(px != px2)); assert(!(px < px2 || px2 < px)); } { shared_ptr px(new X); shared_ptr py(new Y); shared_ptr pz(new Z); assert(px.get() != pz.get()); assert(px != pz); assert(!(px == pz)); assert(py.get() != pz.get()); assert(py != pz); assert(!(py == pz)); assert(px < py || py < px); assert(px < pz || pz < px); assert(py < pz || pz < py); assert(!(px < py && py < px)); assert(!(px < pz && pz < px)); assert(!(py < pz && pz < py)); shared_ptr pvx(px); assert(pvx == pvx); assert(!(pvx != pvx)); assert(!(pvx < pvx)); shared_ptr pvy(py); shared_ptr pvz(pz); assert(pvx < pvy || pvy < pvx); assert(pvx < pvz || pvz < pvx); assert(pvy < pvz || pvz < pvy); assert(!(pvx < pvy && pvy < pvx)); assert(!(pvx < pvz && pvz < pvx)); assert(!(pvy < pvz && pvz < pvy)); } { shared_ptr pz(new Z); shared_ptr px(pz); assert(px == px); assert(!(px != px)); assert(!(px < px)); shared_ptr py(pz); assert(px.get() == pz.get()); assert(px == pz); assert(!(px != pz)); assert(py.get() == pz.get()); assert(py == pz); assert(!(py != pz)); assert(!(px < py || py < px)); assert(!(px < pz || pz < px)); assert(!(py < pz || pz < py)); shared_ptr pvx(px); shared_ptr pvy(py); shared_ptr pvz(pz); // pvx and pvy aren't equal... assert(pvx.get() != pvy.get()); assert(pvx != pvy); assert(!(pvx == pvy)); // ... but they share ownership ... assert(!(pvx < pvy || pvy < pvx)); // ... with pvz assert(!(pvx < pvz || pvz < pvx)); assert(!(pvy < pvz || pvz < pvy)); } } } // namespace n_comparison namespace n_static_cast { struct X { }; struct Y : public X { }; void test() { { shared_ptr pv; shared_ptr pi = static_pointer_cast(pv); assert(pi.get() == 0); shared_ptr px = static_pointer_cast(pv); assert(px.get() == 0); } { shared_ptr pi(new int); shared_ptr pv(pi); shared_ptr pi2 = static_pointer_cast(pv); assert(pi.get() == pi2.get()); assert(!(pi < pi2 || pi2 < pi)); assert(pi.use_count() == 3); assert(pv.use_count() == 3); assert(pi2.use_count() == 3); } { shared_ptr px(new X); shared_ptr pv(px); shared_ptr px2 = static_pointer_cast(pv); assert(px.get() == px2.get()); assert(!(px < px2 || px2 < px)); assert(px.use_count() == 3); assert(pv.use_count() == 3); assert(px2.use_count() == 3); } { shared_ptr px(new Y); shared_ptr py = static_pointer_cast(px); assert(px.get() == py.get()); assert(px.use_count() == 2); assert(py.use_count() == 2); shared_ptr px2(py); assert(!(px < px2 || px2 < px)); } } } // namespace n_static_cast namespace n_const_cast { struct X; void test() { { shared_ptr px; shared_ptr px2 = const_pointer_cast(px); assert(px2.get() == 0); } { shared_ptr px; shared_ptr px2 = const_pointer_cast(px); assert(px2.get() == 0); } { shared_ptr px; shared_ptr px2 = const_pointer_cast(px); assert(px2.get() == 0); } { shared_ptr px(new int); shared_ptr px2 = const_pointer_cast(px); assert(px.get() == px2.get()); assert(!(px < px2 || px2 < px)); assert(px.use_count() == 2); assert(px2.use_count() == 2); } { shared_ptr px(new int); shared_ptr px2 = const_pointer_cast(px); assert(px.get() == px2.get()); assert(!(px < px2 || px2 < px)); assert(px.use_count() == 2); assert(px2.use_count() == 2); } } } // namespace n_const_cast namespace n_dynamic_cast { struct V { virtual ~V() {} }; struct W : public V { }; void test() { { shared_ptr pv; shared_ptr pw = dynamic_pointer_cast(pv); assert(pw.get() == 0); } { shared_ptr pv(static_cast(0)); shared_ptr pw = dynamic_pointer_cast(pv); assert(pw.get() == 0); shared_ptr pv2(pw); assert(pv < pv2 || pv2 < pv); } { shared_ptr pv(static_cast(0)); shared_ptr pw = dynamic_pointer_cast(pv); assert(pw.get() == 0); shared_ptr pv2(pw); assert(pv < pv2 || pv2 < pv); } { shared_ptr pv(new V); shared_ptr pw = dynamic_pointer_cast(pv); assert(pw.get() == 0); shared_ptr pv2(pw); assert(pv < pv2 || pv2 < pv); } { shared_ptr pv(new W); shared_ptr pw = dynamic_pointer_cast(pv); assert(pw.get() == pv.get()); assert(pv.use_count() == 2); assert(pw.use_count() == 2); shared_ptr pv2(pw); assert(!(pv < pv2 || pv2 < pv)); } } } // namespace n_dynamic_cast namespace n_map { struct X { }; void test() { std::vector< shared_ptr > vi; { shared_ptr pi1(new int); shared_ptr pi2(new int); shared_ptr pi3(new int); vi.push_back(pi1); vi.push_back(pi1); vi.push_back(pi1); vi.push_back(pi2); vi.push_back(pi1); vi.push_back(pi2); vi.push_back(pi1); vi.push_back(pi3); vi.push_back(pi3); vi.push_back(pi2); vi.push_back(pi1); } std::vector< shared_ptr > vx; { shared_ptr px1(new X); shared_ptr px2(new X); shared_ptr px3(new X); vx.push_back(px2); vx.push_back(px2); vx.push_back(px1); vx.push_back(px2); vx.push_back(px1); vx.push_back(px1); vx.push_back(px1); vx.push_back(px2); vx.push_back(px1); vx.push_back(px3); vx.push_back(px2); } std::map< shared_ptr, long > m; { for(std::vector< shared_ptr >::iterator i = vi.begin(); i != vi.end(); ++i) { ++m[*i]; } } { for(std::vector< shared_ptr >::iterator i = vx.begin(); i != vx.end(); ++i) { ++m[*i]; } } { for(std::map< shared_ptr, long >::iterator i = m.begin(); i != m.end(); ++i) { assert(i->first.use_count() == i->second + 1); } } } } // namespace n_map namespace n_transitive { struct X { X(): next() {} shared_ptr next; }; void test() { shared_ptr p(new X); p->next = shared_ptr(new X); assert(!p->next->next); p = p->next; assert(!p->next); } } // namespace n_transitive #if 0 namespace n_report_1 { class foo { public: foo(): m_self(this) { } void suicide() { m_self.reset(); } private: shared_ptr m_self; }; void test() { foo * foo_ptr = new foo; foo_ptr->suicide(); } } // namespace n_report_1 #endif // 0 // Test case by Per Kristensen namespace n_report_2 { class foo { public: void setWeak(shared_ptr s) { w = s; } private: weak_ptr w; }; class deleter { public: deleter(): lock(0) { } ~deleter() { assert(lock == 0); } void operator() (foo * p) { ++lock; delete p; --lock; } private: int lock; }; void test() { shared_ptr s(new foo, deleter()); s->setWeak(s); s.reset(); } } // namespace n_report_2 namespace n_spt_incomplete { class file; shared_ptr fopen(char const * name, char const * mode); void fread(shared_ptr f, void * data, long size); int file_instances = 0; void test() { assert(file_instances == 0); { shared_ptr pf = fopen("name", "mode"); assert(file_instances == 1); fread(pf, 0, 17041); } assert(file_instances == 0); } } // namespace n_spt_incomplete namespace n_spt_pimpl { class file { private: class impl; shared_ptr pimpl_; public: file(char const * name, char const * mode); // compiler generated members are fine and useful void read(void * data, long size); long total_size() const; }; int file_instances = 0; void test() { assert(file_instances == 0); { file f("name", "mode"); assert(file_instances == 1); f.read(0, 152); file f2(f); assert(file_instances == 1); f2.read(0, 894); assert(f.total_size() == 152+894); { file f3("name2", "mode2"); assert(file_instances == 2); } assert(file_instances == 1); } assert(file_instances == 0); } } // namespace n_spt_pimpl namespace n_spt_abstract { class X { public: virtual void f(int) = 0; virtual int g() = 0; protected: virtual ~X() {} }; shared_ptr createX(); int X_instances = 0; void test() { assert(X_instances == 0); { shared_ptr px = createX(); assert(X_instances == 1); px->f(18); px->f(152); assert(px->g() == 170); } assert(X_instances == 0); } } // namespace n_spt_abstract namespace n_spt_preventing_delete { int X_instances = 0; class X { private: X() { ++X_instances; } ~X() { --X_instances; } class deleter; friend class deleter; class deleter { public: void operator()(X * p) { delete p; } }; public: static shared_ptr create() { shared_ptr px(new X, X::deleter()); return px; } }; void test() { assert(X_instances == 0); { shared_ptr px = X::create(); assert(X_instances == 1); } assert(X_instances == 0); } } // namespace n_spt_preventing_delete namespace n_spt_array { int X_instances = 0; struct X { X() { ++X_instances; } ~X() { --X_instances; } }; void test() { assert(X_instances == 0); #if 0 { shared_ptr px(new X[4], checked_array_deleter()); assert(X_instances == 4); } #endif // 0 assert(X_instances == 0); } } // namespace n_spt_array namespace n_spt_static { class X { public: X() { } private: void operator delete(void *) { throw "n_spt_static::X::operator delete() called."; } }; struct null_deleter { void operator()(void const *) const { } }; static X x; void test() { shared_ptr px(&x, null_deleter()); } } // namespace n_spt_static namespace n_spt_intrusive { int X_instances = 0; struct X { long count; X(): count(0) { ++X_instances; } ~X() { --X_instances; } }; void intrusive_ptr_add_ref(X * p) { ++p->count; } void intrusive_ptr_release(X * p) { if(--p->count == 0) delete p; } template< class T > struct intrusive_deleter { void operator()(T * p) { if(p != 0) intrusive_ptr_release(p); } }; shared_ptr make_shared_from_intrusive(X * p) { if(p != 0) intrusive_ptr_add_ref(p); shared_ptr px(p, intrusive_deleter()); return px; } void test() { assert(X_instances == 0); { X * p = new X; assert(X_instances == 1); assert(p->count == 0); shared_ptr px = make_shared_from_intrusive(p); assert(px.get() == p); assert(p->count == 1); shared_ptr px2(px); assert(px2.get() == p); assert(p->count == 1); } assert(X_instances == 0); } } // namespace n_spt_intrusive namespace n_spt_another_sp { template< class T > class another_ptr : private shared_ptr { private: typedef shared_ptr base_type; public: explicit another_ptr(T * p = 0): base_type(p) { } void reset() { base_type::reset(); } T * get() const { return base_type::get(); } }; class event_handler { public: virtual ~event_handler() {} virtual void begin() = 0; virtual void handle(int event) = 0; virtual void end() = 0; }; int begin_called = 0; int handle_called = 0; int end_called = 0; class event_handler_impl : public event_handler { public: virtual void begin() { ++begin_called; } virtual void handle(int event) { handle_called = event; } virtual void end() { ++end_called; } }; another_ptr get_event_handler() { another_ptr p(new event_handler_impl); return p; } shared_ptr current_handler; void install_event_handler(shared_ptr p) { p->begin(); current_handler = p; } void handle_event(int event) { current_handler->handle(event); } void remove_event_handler() { current_handler->end(); current_handler.reset(); } template< class P > class smart_pointer_deleter { private: P p_; public: smart_pointer_deleter(P const & p): p_(p) { } void operator()(void const *) { p_.reset(); } }; void test() { another_ptr p = get_event_handler(); shared_ptr q(p.get(), smart_pointer_deleter< another_ptr >(p)); p.reset(); assert(begin_called == 0); install_event_handler(q); assert(begin_called == 1); assert(handle_called == 0); handle_event(17041); assert(handle_called == 17041); assert(end_called == 0); remove_event_handler(); assert(end_called == 1); } } // namespace n_spt_another_sp #if 0 namespace n_spt_shared_from_this { class X { public: virtual void f() = 0; protected: ~X() {} }; class Y { public: virtual shared_ptr getX() = 0; protected: ~Y() {} }; class impl : public X, public Y { private: weak_ptr weak_this; impl(impl const &); impl & operator=(impl const &); impl() {} public: static shared_ptr create() { shared_ptr pi(new impl); pi->weak_this = pi; return pi; } virtual void f() {} virtual shared_ptr getX() { shared_ptr px = weak_this.lock(); return px; } }; void test() { shared_ptr py = impl::create(); assert(py.get() != 0); assert(py.use_count() == 1); shared_ptr px = py->getX(); assert(px.get() != 0); assert(py.use_count() == 2); shared_ptr py2 = dynamic_pointer_cast(px); assert(py.get() == py2.get()); assert(!(py < py2 || py2 < py)); assert(py.use_count() == 3); } } // namespace n_spt_shared_from_this #endif // 0 namespace n_spt_wrap { void test() { } } // namespace n_spt_wrap int main() { n_element_type::test(); n_constructors::test(); n_assignment::test(); n_reset::test(); n_access::test(); n_use_count::test(); n_swap::test(); n_comparison::test(); n_static_cast::test(); n_const_cast::test(); n_dynamic_cast::test(); n_map::test(); n_transitive::test(); #if 0 n_report_1::test(); #endif // 0 n_report_2::test(); n_spt_incomplete::test(); n_spt_pimpl::test(); n_spt_abstract::test(); n_spt_preventing_delete::test(); n_spt_array::test(); n_spt_static::test(); n_spt_intrusive::test(); n_spt_another_sp::test(); //n_spt_shared_from_this::test(); n_spt_wrap::test(); return 0; } namespace n_spt_incomplete { class file { public: file(): fread_called(false) { ++file_instances; } ~file() { assert(fread_called); --file_instances; } bool fread_called; }; shared_ptr fopen(char const *, char const *) { shared_ptr pf(new file); return pf; } void fread(shared_ptr pf, void *, long) { pf->fread_called = true; } } // namespace n_spt_incomplete namespace n_spt_pimpl { class file::impl { private: impl(impl const &); impl & operator=(impl const &); long total_size_; public: impl(char const *, char const *): total_size_(0) { ++file_instances; } ~impl() { --file_instances; } void read(void *, long size) { total_size_ += size; } long total_size() const { return total_size_; } }; file::file(char const * name, char const * mode): pimpl_(new impl(name, mode)) { } void file::read(void * data, long size) { pimpl_->read(data, size); } long file::total_size() const { return pimpl_->total_size(); } } // namespace n_spt_pimpl namespace n_spt_abstract { class X_impl : public X { private: X_impl(X_impl const &); X_impl & operator=(X_impl const &); int n_; public: X_impl(): n_(0) { ++X_instances; } virtual ~X_impl() { --X_instances; } virtual void f(int n) { n_ += n; } virtual int g() { return n_; } }; shared_ptr createX() { shared_ptr px(new X_impl); return px; } } // namespace n_spt_abstract clhep-2.1.4.1.orig/Utility/test/.cvsignore0000755000175000017500000000001411406156145017020 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/Utility/test/testSharedPtrConvertible.cc0000644000175000017500000000232611406156145022325 0ustar olesoles// ====================================================================== // // Test compilability and basic functionality of Utility/memory.h // // Author: W. E. Brown, 2010-03-19, adapted from the boost library's // shared_ptr and related functionality whose internal attributions bear // the following various notices: // // Copyright (c) 2008 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // // ====================================================================== #include "CLHEP/Utility/noncopyable.h" #include "CLHEP/Utility/memory.h" #include using namespace CLHEP; using CLHEP::shared_ptr; class incomplete; struct X { }; struct Y { }; struct Z: public X { }; int f( shared_ptr ) { return 1; } int f( shared_ptr ) { return 2; } int f( shared_ptr ) { return 3; } int g( shared_ptr ) { return 4; } int g( shared_ptr ) { return 5; } int g( shared_ptr ) { return 6; } int main() { shared_ptr p1; assert( 1 == f( p1 ) ); assert( 1 == f( shared_ptr() ) ); shared_ptr p2; assert( 4 == g( p2 ) ); assert( 4 == g( shared_ptr() ) ); return 0; } clhep-2.1.4.1.orig/Utility/test/testNoncopyable.cc0000644000175000017500000000076711406156145020514 0ustar olesoles// ====================================================================== // -*- C++ -*- // $Id: testNoncopyable.cc,v 1.2 2010/06/16 14:15:01 garren Exp $ // --------------------------------------------------------------------------- // Test compilability of Utility/noncopyable.h // // W. E. Brown, 2010-03-19 // ====================================================================== #include "CLHEP/Utility/noncopyable.h" using namespace CLHEP; using CLHEP::noncopyable; int main() { return 0; } clhep-2.1.4.1.orig/Utility/test/CMakeLists.txt0000644000175000017500000000052411606714767017577 0ustar olesoles set( Utility_simple_tests testNoncopyable testPrimaryTraits testCategories testIsSame testIsConvertible testSharedPtrBasic testSharedPtrConvertible testSharedPtr testWeakPtr ) foreach ( test ${Utility_simple_tests} ) clhep_test( ${test} SIMPLE NOLIB ) endforeach ( test ${Utility_simple_tests} ) clhep-2.1.4.1.orig/Utility/test/testCategories.cc0000644000175000017500000004262011406156145020322 0ustar olesoles// ====================================================================== // // Test basic functionality of primary type traits // // Author: W. E. Brown, 2010-03-27, adapted in part from the boost // library's type_traits and related functionality whose internal // attributions bear the following various notices: // // (C) Copyright John Maddock 2000. // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // // ====================================================================== #include "CLHEP/Utility/noncopyable.h" #include "CLHEP/Utility/type_traits.h" #include #include using namespace CLHEP; // primary type category codes: unsigned _unknown = 0uL ; unsigned _void = 1uL << 0; unsigned _integral = 1uL << 1; unsigned _floating_point = 1uL << 2; unsigned _array = 1uL << 3; unsigned _pointer = 1uL << 4; unsigned _lvalue_reference = 1uL << 5; unsigned _rvalue_reference = 1uL << 6; unsigned _member_object_pointer = 1uL << 7; unsigned _member_function_pointer = 1uL << 8; unsigned _enum = 1uL << 9; unsigned _union = 1uL << 10; // Help, compiler! unsigned _class = 1uL << 11; unsigned _function = 1uL << 12; // composite type category codes: unsigned _reference = 1uL << 13; unsigned _arithmetic = 1uL << 14; unsigned _fundamental = 1uL << 15; unsigned _object = 1uL << 16; unsigned _scalar = 1uL << 17; unsigned _compound = 1uL << 18; unsigned _member_pointer = 1uL << 19; // evaluate categories: template< typename T > unsigned evaluate() { unsigned ans = _unknown; if( is_void ::value ) ans += _void; if( is_integral ::value ) ans += _integral; if( is_floating_point ::value ) ans += _floating_point; if( is_array ::value ) ans += _array; if( is_pointer ::value ) ans += _pointer; if( is_lvalue_reference ::value ) ans += _lvalue_reference; if( is_rvalue_reference ::value ) ans += _rvalue_reference; if( is_member_object_pointer ::value ) ans += _member_object_pointer; if( is_member_function_pointer::value ) ans += _member_function_pointer; if( is_enum ::value ) ans += _enum; if( is_union ::value ) ans += _union; if( is_class ::value ) ans += _class; if( is_function ::value ) ans += _function;; if( is_reference ::value ) ans += _reference; if( is_arithmetic ::value ) ans += _arithmetic; if( is_fundamental ::value ) ans += _fundamental; if( is_object ::value ) ans += _object; if( is_scalar ::value ) ans += _scalar; if( is_compound ::value ) ans += _compound; if( is_member_pointer ::value ) ans += _member_pointer; return ans; } unsigned cat_void = _void | _fundamental; unsigned cat_int = _integral | _arithmetic | _object | _fundamental | _scalar; unsigned cat_flt = _floating_point | _arithmetic | _object | _fundamental | _scalar; unsigned cat_arr = _array | _object | _compound; unsigned cat_ptr = _pointer | _object | _compound | _scalar; unsigned cat_lref = _lvalue_reference | _reference | _compound; unsigned cat_rref = _rvalue_reference | _reference | _compound; unsigned cat_mem_obj_ptr = _member_object_pointer | _member_pointer | _object | _compound | _scalar; unsigned cat_mbr_fctn_ptr = _member_function_pointer | _member_pointer | _object | _compound | _scalar; unsigned cat_enum = _enum | _object | _compound | _scalar; unsigned cat_union = _union | _object | _compound; unsigned cat_class = _class | _object | _compound; unsigned cat_fctn = _function | _compound; // define some test types: // class type: struct mytype { int a; int * p; int f(); }; // mytype // enum type: enum myenum { a=12, b=16 }; // union type: union myblend { int a; int * p; int f(); }; enum enum_UDT{ one, two, three }; struct UDT { UDT() { }; ~UDT() { }; UDT(const UDT&); UDT& operator=(const UDT&); int i; void f1(); int f2(); int f3(int); int f4(int, float); }; typedef void(*f1)(); typedef int(*f2)(int); typedef int(*f3)(int, bool); typedef void (UDT::*mf1)(); typedef int (UDT::*mf2)(); typedef int (UDT::*mf3)(int); typedef int (UDT::*mf4)(int, float); typedef int (UDT::*mp); typedef int (UDT::*cmf)(int) const; // cv-qualifiers applied to reference types should have no effect // This is intentional: // r_type and cr_type should be the same type // but some compilers wrongly apply cv-qualifiers // to reference types (this may generate a warning // on some compilers): typedef int& r_type; #if ! defined(_MSC_VER) typedef const r_type cr_type; #endif // _MSC_VER struct POD_UDT { int x; }; struct empty_UDT { empty_UDT() { }; empty_UDT(const empty_UDT&) { }; ~empty_UDT() { }; empty_UDT& operator=(const empty_UDT&){ return *this; } bool operator==(const empty_UDT&)const { return true; } }; struct empty_POD_UDT { bool operator==(const empty_POD_UDT&)const { return true; } }; union union_UDT { int x; double y; ~union_UDT() { } }; union POD_union_UDT { int x; double y; }; union empty_union_UDT { ~empty_union_UDT() { } }; union empty_POD_union_UDT { }; struct nothrow_copy_UDT { nothrow_copy_UDT(); nothrow_copy_UDT(const nothrow_copy_UDT&)throw(); ~nothrow_copy_UDT() { }; nothrow_copy_UDT& operator=(const nothrow_copy_UDT&){ return *this; } bool operator==(const nothrow_copy_UDT&)const { return true; } }; struct nothrow_assign_UDT { nothrow_assign_UDT(); nothrow_assign_UDT(const nothrow_assign_UDT&); ~nothrow_assign_UDT() { }; nothrow_assign_UDT& operator=(const nothrow_assign_UDT&)throw(){ return *this; } bool operator==(const nothrow_assign_UDT&)const { return true; } }; struct nothrow_construct_UDT { nothrow_construct_UDT()throw(); nothrow_construct_UDT(const nothrow_construct_UDT&); ~nothrow_construct_UDT() { }; nothrow_construct_UDT& operator=(const nothrow_construct_UDT&){ return *this; } bool operator==(const nothrow_construct_UDT&)const { return true; } }; class Base { }; class Derived : public Base { }; class Derived2 : public Base { }; class MultiBase : public Derived, public Derived2 { }; class PrivateBase : private Base { }; class NonDerived { }; enum enum1 { one_,two_ }; enum enum2 { three_,four_ }; struct VB { virtual ~VB() { }; }; struct VD : VB { ~VD() { }; }; // struct non_pointer: // used to verify that is_pointer does not return // true for class types that implement operator void*() struct non_pointer { operator void*(){return this;} }; struct non_int_pointer { int i; operator int*(){return &i;} }; struct int_constructible { int_constructible(int); }; struct int_convertible { operator int(); }; // struct non_empty: // used to verify that is_empty does not emit // spurious warnings or errors. struct non_empty : private noncopyable { int i; }; // abstract base classes: struct test_abc1 { test_abc1(); virtual ~test_abc1(); test_abc1(const test_abc1&); test_abc1& operator=(const test_abc1&); virtual void foo() = 0; virtual void foo2() = 0; }; struct test_abc2 { virtual ~test_abc2(); virtual void foo() = 0; virtual void foo2() = 0; }; struct test_abc3 : public test_abc1 { virtual void foo3() = 0; }; struct incomplete_type; struct polymorphic_base { virtual ~polymorphic_base(); virtual void method(); }; struct polymorphic_derived1 : polymorphic_base { }; struct polymorphic_derived2 : polymorphic_base { virtual void method(); }; struct virtual_inherit1 : virtual Base { }; struct virtual_inherit2 : virtual_inherit1 { }; struct virtual_inherit3 : private virtual Base { }; struct virtual_inherit4 : virtual noncopyable { }; struct virtual_inherit5 : virtual int_convertible { }; struct virtual_inherit6 : virtual Base { virtual ~virtual_inherit6()throw(); }; typedef void foo0_t(); typedef void foo1_t(int); typedef void foo2_t(int&, double); typedef void foo3_t(int&, bool, int, int); typedef void foo4_t(int, bool, int*, int[], int, int, int, int, int); struct trivial_except_construct { trivial_except_construct(); int i; }; struct trivial_except_destroy { ~trivial_except_destroy(); int i; }; struct trivial_except_copy { trivial_except_copy(trivial_except_copy const&); int i; }; struct trivial_except_assign { trivial_except_assign& operator=(trivial_except_assign const&); int i; }; template struct wrap { T t; int j; protected: wrap(); wrap(const wrap&); wrap& operator=(const wrap&); }; struct convertible_to_pointer { operator char*() const; }; typedef const double (UDT::*mp2) ; int main() { // void types assert(evaluate() == cat_void); assert(evaluate() == cat_void); assert(evaluate() == cat_void); assert(evaluate() == cat_void); // integral types assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); typedef signed char schar; assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); typedef unsigned char uchar; assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); typedef unsigned short ushort; assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); typedef unsigned int uint; assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); typedef unsigned long ulong; assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); assert(evaluate() == cat_int); // floating-point types assert(evaluate() == cat_flt); assert(evaluate() == cat_flt); assert(evaluate() == cat_flt); assert(evaluate() == cat_flt); assert(evaluate() == cat_flt); assert(evaluate() == cat_flt); assert(evaluate() == cat_flt); assert(evaluate() == cat_flt); typedef long double ldouble; assert(evaluate() == cat_flt); assert(evaluate() == cat_flt); assert(evaluate() == cat_flt); assert(evaluate() == cat_flt); // array types assert(evaluate() == cat_arr); assert(evaluate() == cat_arr); assert(evaluate() == cat_arr); assert(evaluate() == cat_arr); assert(evaluate() == cat_arr); assert(evaluate() == cat_arr); assert(evaluate() == cat_arr); assert(evaluate() == cat_arr); // pointer types assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); assert(evaluate() == cat_ptr); // lvalue reference types assert(evaluate() == cat_lref); assert(evaluate() == cat_lref); assert(evaluate() == cat_lref); assert(evaluate() == cat_lref); assert(evaluate() == cat_lref); assert(evaluate() == cat_lref); assert(evaluate() == cat_lref); assert(evaluate() == cat_lref); #if ! defined(_MSC_VER) assert(evaluate() == cat_lref); #endif // _MSC_VER assert(evaluate() == cat_lref); assert(evaluate() == cat_lref); assert(evaluate() == cat_lref); assert(evaluate() == cat_lref); // member object pointer types assert(evaluate() == cat_mem_obj_ptr); assert(evaluate() == cat_mem_obj_ptr); assert(evaluate() == cat_mem_obj_ptr); assert(evaluate() == cat_mem_obj_ptr); assert(evaluate() == cat_mem_obj_ptr); // member function pointer types assert(evaluate() == cat_mbr_fctn_ptr); assert(evaluate() == cat_mbr_fctn_ptr); assert(evaluate() == cat_mbr_fctn_ptr); assert(evaluate() == cat_mbr_fctn_ptr); assert(evaluate() == cat_mbr_fctn_ptr); assert(evaluate() == cat_mbr_fctn_ptr); assert(evaluate() == cat_mbr_fctn_ptr); assert(evaluate() == cat_mbr_fctn_ptr); // enum types assert(evaluate() == cat_enum); assert(evaluate() == cat_enum); assert(evaluate() == cat_enum); assert(evaluate() == cat_enum); assert(evaluate() == cat_enum); // union types #if 0 assert(evaluate() == cat_union); assert(evaluate() == cat_union); assert(evaluate() == cat_union); assert(evaluate() == cat_union); assert(evaluate() == cat_union); assert(evaluate() == cat_union); assert(evaluate() == cat_union); assert(evaluate() == cat_union); assert(evaluate() == cat_union); assert(evaluate() == cat_union); assert(evaluate() == cat_union); assert(evaluate() == cat_union); #endif // 0 // class types assert(evaluate() == cat_class); assert(evaluate() == cat_class); assert(evaluate() == cat_class); assert(evaluate() == cat_class); assert(evaluate() == cat_class); assert(evaluate() == cat_class); assert(evaluate() == cat_class); assert(evaluate() == cat_class); // function types assert(evaluate() == cat_fctn); assert(evaluate() == cat_fctn); assert(evaluate() == cat_fctn); assert(evaluate() == cat_fctn); assert(evaluate() == cat_fctn); assert(evaluate() == cat_fctn); assert(evaluate() == cat_fctn); return 0; } clhep-2.1.4.1.orig/Utility/test/testPrimaryTraits.cc0000644000175000017500000003403411406156145021047 0ustar olesoles// ====================================================================== // // Test basic functionality of primary type traits // // Author: W. E. Brown, 2010-03-24, adapted from the boost library's // type_traits and related functionality whose internal attributions bear // the following various notices: // // (C) Copyright John Maddock 2000. // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // // ====================================================================== #include "CLHEP/Utility/noncopyable.h" #include "CLHEP/Utility/type_traits.h" #include using namespace CLHEP; // define some test types: enum enum_UDT{ one, two, three }; struct UDT { UDT() { }; ~UDT() { }; UDT(const UDT&); UDT& operator=(const UDT&); int i; void f1(); int f2(); int f3(int); int f4(int, float); }; typedef void(*f1)(); typedef int(*f2)(int); typedef int(*f3)(int, bool); typedef void (UDT::*mf1)(); typedef int (UDT::*mf2)(); typedef int (UDT::*mf3)(int); typedef int (UDT::*mf4)(int, float); typedef int (UDT::*mp); typedef int (UDT::*cmf)(int) const; // cv-qualifiers applied to reference types should have no effect // This is intentional: // r_type and cr_type should be the same type // but some compilers wrongly apply cv-qualifiers // to reference types (this may generate a warning // on some compilers): typedef int& r_type; #if ! defined(_MSC_VER) typedef const r_type cr_type; #endif // _MSC_VER struct POD_UDT { int x; }; struct empty_UDT { empty_UDT() { }; empty_UDT(const empty_UDT&) { }; ~empty_UDT() { }; empty_UDT& operator=(const empty_UDT&){ return *this; } bool operator==(const empty_UDT&)const { return true; } }; struct empty_POD_UDT { bool operator==(const empty_POD_UDT&)const { return true; } }; union union_UDT { int x; double y; ~union_UDT() { } }; union POD_union_UDT { int x; double y; }; union empty_union_UDT { ~empty_union_UDT() { } }; union empty_POD_union_UDT { }; struct nothrow_copy_UDT { nothrow_copy_UDT(); nothrow_copy_UDT(const nothrow_copy_UDT&)throw(); ~nothrow_copy_UDT() { }; nothrow_copy_UDT& operator=(const nothrow_copy_UDT&){ return *this; } bool operator==(const nothrow_copy_UDT&)const { return true; } }; struct nothrow_assign_UDT { nothrow_assign_UDT(); nothrow_assign_UDT(const nothrow_assign_UDT&); ~nothrow_assign_UDT() { }; nothrow_assign_UDT& operator=(const nothrow_assign_UDT&)throw(){ return *this; } bool operator==(const nothrow_assign_UDT&)const { return true; } }; struct nothrow_construct_UDT { nothrow_construct_UDT()throw(); nothrow_construct_UDT(const nothrow_construct_UDT&); ~nothrow_construct_UDT() { }; nothrow_construct_UDT& operator=(const nothrow_construct_UDT&){ return *this; } bool operator==(const nothrow_construct_UDT&)const { return true; } }; class Base { }; class Derived : public Base { }; class Derived2 : public Base { }; class MultiBase : public Derived, public Derived2 { }; class PrivateBase : private Base { }; class NonDerived { }; enum enum1 { one_,two_ }; enum enum2 { three_,four_ }; struct VB { virtual ~VB() { }; }; struct VD : VB { ~VD() { }; }; // struct non_pointer: // used to verify that is_pointer does not return // true for class types that implement operator void*() struct non_pointer { operator void*(){return this;} }; struct non_int_pointer { int i; operator int*(){return &i;} }; struct int_constructible { int_constructible(int); }; struct int_convertible { operator int(); }; // struct non_empty: // used to verify that is_empty does not emit // spurious warnings or errors. struct non_empty : private noncopyable { int i; }; // abstract base classes: struct test_abc1 { test_abc1(); virtual ~test_abc1(); test_abc1(const test_abc1&); test_abc1& operator=(const test_abc1&); virtual void foo() = 0; virtual void foo2() = 0; }; struct test_abc2 { virtual ~test_abc2(); virtual void foo() = 0; virtual void foo2() = 0; }; struct test_abc3 : public test_abc1 { virtual void foo3() = 0; }; struct incomplete_type; struct polymorphic_base { virtual ~polymorphic_base(); virtual void method(); }; struct polymorphic_derived1 : polymorphic_base { }; struct polymorphic_derived2 : polymorphic_base { virtual void method(); }; struct virtual_inherit1 : virtual Base { }; struct virtual_inherit2 : virtual_inherit1 { }; struct virtual_inherit3 : private virtual Base { }; struct virtual_inherit4 : virtual noncopyable { }; struct virtual_inherit5 : virtual int_convertible { }; struct virtual_inherit6 : virtual Base { virtual ~virtual_inherit6()throw(); }; typedef void foo0_t(); typedef void foo1_t(int); typedef void foo2_t(int&, double); typedef void foo3_t(int&, bool, int, int); typedef void foo4_t(int, bool, int*, int[], int, int, int, int, int); struct trivial_except_construct { trivial_except_construct(); int i; }; struct trivial_except_destroy { ~trivial_except_destroy(); int i; }; struct trivial_except_copy { trivial_except_copy(trivial_except_copy const&); int i; }; struct trivial_except_assign { trivial_except_assign& operator=(trivial_except_assign const&); int i; }; template struct wrap { T t; int j; protected: wrap(); wrap(const wrap&); wrap& operator=(const wrap&); }; struct convertible_to_pointer { operator char*() const; }; typedef const double (UDT::*mp2) ; int main() { #define claim_void(Type) (is_void::value) #define has_void_type(Type) assert(claim_void(Type)) #define has_nonvoid_type(Type) assert(!claim_void(Type)) has_void_type(void); has_void_type(void const); has_void_type(void volatile); has_void_type(void const volatile); has_nonvoid_type(void*); has_nonvoid_type(int); has_nonvoid_type(test_abc1); has_nonvoid_type(foo0_t); has_nonvoid_type(foo1_t); has_nonvoid_type(foo2_t); has_nonvoid_type(foo3_t); has_nonvoid_type(foo4_t); has_nonvoid_type(incomplete_type); #define claim_integral(Type) (is_integral::value) #define has_integral_type(Type) assert(claim_integral(Type)) #define has_nonintegral_type(Type) assert(!claim_integral(Type)) has_integral_type(bool); has_integral_type(bool const); has_integral_type(bool volatile); has_integral_type(bool const volatile); has_integral_type(signed char); has_integral_type(signed char const); has_integral_type(signed char volatile); has_integral_type(signed char const volatile); has_integral_type(unsigned char); has_integral_type(char); has_integral_type(unsigned char const); has_integral_type(char const); has_integral_type(unsigned char volatile); has_integral_type(char volatile); has_integral_type(unsigned char const volatile); has_integral_type(char const volatile); has_integral_type(unsigned short); has_integral_type(short); has_integral_type(unsigned short const); has_integral_type(short const); has_integral_type(unsigned short volatile); has_integral_type(short volatile); has_integral_type(unsigned short const volatile); has_integral_type(short const volatile); has_integral_type(unsigned int); has_integral_type(int); has_integral_type(unsigned int const); has_integral_type(int const); has_integral_type(unsigned int volatile); has_integral_type(int volatile); has_integral_type(unsigned int const volatile); has_integral_type(int const volatile); has_integral_type(unsigned long); has_integral_type(long); has_integral_type(unsigned long const); has_integral_type(long const); has_integral_type(unsigned long volatile); has_integral_type(long volatile); has_integral_type(unsigned long const volatile); has_integral_type(long const volatile); has_nonintegral_type(void); has_nonintegral_type(float); has_nonintegral_type(UDT); has_nonintegral_type(test_abc1); has_nonintegral_type(empty_UDT); has_nonintegral_type(int*); has_nonintegral_type(int&); has_nonintegral_type(const int&); has_nonintegral_type(int[2]); has_nonintegral_type(test_abc1); has_nonintegral_type(foo0_t); has_nonintegral_type(foo1_t); has_nonintegral_type(foo2_t); has_nonintegral_type(foo3_t); has_nonintegral_type(foo4_t); has_nonintegral_type(incomplete_type); #define claim_floating(Type) (is_floating_point::value) #define has_floating_type(Type) assert(claim_floating(Type)) #define has_nonfloating_type(Type) assert(!claim_floating(Type)) has_floating_type(float); has_floating_type(float const); has_floating_type(float volatile); has_floating_type(float const volatile); has_floating_type(double); has_floating_type(double const); has_floating_type(double volatile); has_floating_type(double const volatile); has_floating_type(long double); has_floating_type(long double const); has_floating_type(long double volatile); has_floating_type(long double const volatile); has_nonfloating_type(void); has_nonfloating_type(int); has_nonfloating_type(UDT); has_nonfloating_type(test_abc1); has_nonfloating_type(empty_UDT); has_nonfloating_type(float*); has_nonfloating_type(float&); has_nonfloating_type(const float&); has_nonfloating_type(float[2]); has_nonfloating_type(test_abc1); has_nonfloating_type(foo0_t); has_nonfloating_type(foo1_t); has_nonfloating_type(foo2_t); has_nonfloating_type(foo3_t); has_nonfloating_type(foo4_t); has_nonfloating_type(incomplete_type); #define claim_array(Type) (is_array::value) #define has_array_type(Type) assert(claim_array(Type)) #define has_nonarray_type(Type) assert(!claim_array(Type)) has_nonarray_type(int); has_nonarray_type(int*); has_nonarray_type(const int*); has_nonarray_type(const volatile int*); has_nonarray_type(int*const); has_nonarray_type(const int*volatile); has_nonarray_type(const volatile int*const); has_array_type(int[2]); has_array_type(const int[2]); has_array_type(const volatile int[2]); has_array_type(int[2][3]); has_array_type(UDT[2]); has_nonarray_type(int(&)[2]); has_nonarray_type(f1); has_nonarray_type(void); has_nonarray_type(test_abc1); has_nonarray_type(convertible_to_pointer); has_nonarray_type(test_abc1); has_nonarray_type(foo0_t); has_nonarray_type(incomplete_type); #define claim_ptr(Type) (is_pointer::value) #define has_ptr_type(Type) assert(claim_ptr(Type)) #define has_nonptr_type(Type) assert(!claim_ptr(Type)) has_nonptr_type(int); has_nonptr_type(int&); has_ptr_type(int*); has_ptr_type(const int*); has_ptr_type(volatile int*); has_ptr_type(non_pointer*); has_ptr_type(int*const); has_ptr_type(int*volatile); has_ptr_type(int*const volatile); has_nonptr_type(non_pointer); has_nonptr_type(int*&); has_nonptr_type(int(&)[2]); has_nonptr_type(int[2]); has_nonptr_type(char[sizeof(void*)]); has_nonptr_type(void); has_ptr_type(f1); has_ptr_type(f2); has_ptr_type(f3); has_nonptr_type(mf1); has_nonptr_type(mf2); has_nonptr_type(mf3); has_nonptr_type(mf4); has_nonptr_type(test_abc1); has_nonptr_type(foo0_t); has_nonptr_type(foo1_t); has_nonptr_type(foo2_t); has_nonptr_type(foo3_t); has_nonptr_type(foo4_t); has_nonptr_type(test_abc1); #define claim_lref(Type) (is_lvalue_reference::value) #define has_lref_type(Type) assert(claim_lref(Type)) #define has_nonlref_type(Type) assert(!claim_lref(Type)) #define claim_ref(Type) (is_reference::value) #define has_ref_type(Type) assert(claim_ref(Type)) #define has_nonref_type(Type) assert(!claim_ref(Type)) #define lref(Type) has_lref_type(Type); has_ref_type(Type); #define nonref(Type) has_nonlref_type(Type); has_nonref_type(Type); lref(int&); lref(const int&); lref(volatile int &); lref(const volatile int &); lref(r_type); #if ! defined(_MSC_VER) lref(cr_type); #endif // _MSC_VER lref(UDT&); lref(const UDT&); lref(volatile UDT&); lref(const volatile UDT&); lref(int (&)(int)); lref(int (&)[2]); nonref(int [2]); nonref(const int [2]); nonref(volatile int [2]); nonref(const volatile int [2]); nonref(bool); nonref(void); nonref(test_abc1); nonref(foo0_t); nonref(incomplete_type); #define claim_mbrobjptr(Type) (is_member_object_pointer::value) #define has_mbrobjptr_type(Type) assert(claim_mbrobjptr(Type)) #define has_nonmbrobjptr_type(Type) assert(!claim_mbrobjptr(Type)) has_nonmbrobjptr_type(f1); has_nonmbrobjptr_type(f2); has_nonmbrobjptr_type(f3); has_nonmbrobjptr_type(void*); has_nonmbrobjptr_type(mf1); has_nonmbrobjptr_type(mf2); has_nonmbrobjptr_type(mf3); has_nonmbrobjptr_type(mf4); has_nonmbrobjptr_type(cmf); has_mbrobjptr_type(mp); has_mbrobjptr_type(mp2); has_nonmbrobjptr_type(void); has_nonmbrobjptr_type(test_abc1); has_nonmbrobjptr_type(foo0_t); #define claim_mbrfctnptr(Type) (is_member_function_pointer::value) #define has_mbrfctnptr_type(Type) assert(claim_mbrfctnptr(Type)) #define has_nonmbrfctnptr_type(Type) assert(!claim_mbrfctnptr(Type)) has_nonmbrfctnptr_type(f1); has_nonmbrfctnptr_type(f2); has_nonmbrfctnptr_type(f3); has_nonmbrfctnptr_type(void*); has_mbrfctnptr_type(mf1); has_mbrfctnptr_type(mf2); has_mbrfctnptr_type(mf3); has_mbrfctnptr_type(mf4); has_mbrfctnptr_type(cmf); has_nonmbrfctnptr_type(mp); has_nonmbrfctnptr_type(void); has_nonmbrfctnptr_type(test_abc1); has_nonmbrfctnptr_type(foo0_t); has_nonmbrfctnptr_type(int&); has_nonmbrfctnptr_type(const int&); has_nonmbrfctnptr_type(const int[2]); has_nonmbrfctnptr_type(const int[]); has_nonmbrfctnptr_type(void); #define claim_enum(Type) (is_enum::value) #define has_enum_type(Type) assert(claim_enum(Type)) #define has_nonenum_type(Type) assert(!claim_enum(Type)) has_nonenum_type(int); has_nonenum_type(long double); has_enum_type(enum_UDT); has_nonenum_type(int_convertible); has_nonenum_type(int&); has_nonenum_type(noncopyable); has_nonenum_type(void); has_nonenum_type(test_abc1); has_nonenum_type(foo0_t); has_nonenum_type(int&); has_nonenum_type(const int&); has_nonmbrfctnptr_type(const int[2]); has_nonmbrfctnptr_type(const int[]); has_nonmbrfctnptr_type(void); return 0; } clhep-2.1.4.1.orig/Utility/test/testSharedPtrBasic.cc0000644000175000017500000001204511406156145021071 0ustar olesoles// ====================================================================== // // Test compilability and basic functionality of Utility/memory.h // // Author: W. E. Brown, 2010-03-19, adapted from the boost library's // shared_ptr and related functionality whose internal attributions bear // the following various notices: // // Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // // ====================================================================== #include "CLHEP/Utility/noncopyable.h" #include "CLHEP/Utility/memory.h" #include using namespace CLHEP; using CLHEP::shared_ptr; int cnt = 0; struct X : public noncopyable { X() { ++cnt; } ~X() { --cnt; } // virtual destructor deliberately omitted virtual int id() const { return 1; } }; // X struct Y: public X { Y() { ++cnt; } ~Y() { --cnt; } virtual int id() const { return 2; } }; // Y int * get_object() { return &++cnt; } void release_object(int * p) { assert(p == &cnt); --cnt; } template< class T > void test_is_X(shared_ptr const & p) { assert(p->id() == 1); assert((*p).id() == 1); } template< class T > void test_is_X(weak_ptr const & p) { assert(p.get() != 0); assert(p.get()->id() == 1); } template< class T > void test_is_Y(shared_ptr const & p) { assert(p->id() == 2); assert((*p).id() == 2); } template< class T > void test_is_Y(weak_ptr const & p) { shared_ptr q = p.lock(); assert(q.get() != 0); assert(q->id() == 2); } template< class T > void test_eq(T const & a, T const & b) { assert(a == b); assert(!(a != b)); assert(!(a < b)); assert(!(b < a)); } template< class T > void test_ne(T const & a, T const & b) { assert(!(a == b)); assert(a != b); assert(a < b || b < a); assert(!(a < b && b < a)); } template< class T, class U > void test_shared(weak_ptr const & a, weak_ptr const & b) { assert(!(a < b)); assert(!(b < a)); } template< class T, class U > void test_nonshared(weak_ptr const & a, weak_ptr const & b) { assert(a < b || b < a); assert(!(a < b && b < a)); } template< class T, class U > void test_eq2(T const & a, U const & b) { assert(a == b); assert(!(a != b)); } template< class T, class U > void test_ne2(T const & a, U const & b) { assert(!(a == b)); assert(a != b); } template< class T > void test_is_zero(shared_ptr const & p) { assert(!p); assert(p.get() == 0); } template< class T > void test_is_nonzero(shared_ptr const & p) { // p? true: false is used to test p in a boolean context. // assert(p) is not guaranteed to test the conversion, // as the macro might test !!p instead. assert(p? true: false); assert(p.get() != 0); } int main() { { shared_ptr p(new Y); shared_ptr p2(new X); test_is_nonzero(p); test_is_nonzero(p2); test_is_Y(p); test_is_X(p2); test_ne(p, p2); { shared_ptr q(p); test_eq(p, q); } shared_ptr p3 = dynamic_pointer_cast(p); shared_ptr p4 = dynamic_pointer_cast(p2); test_is_nonzero(p3); test_is_zero(p4); assert(p.use_count() == 2); assert(p2.use_count() == 1); assert(p3.use_count() == 2); test_is_Y(p3); test_eq2(p, p3); test_ne2(p2, p4); shared_ptr p5(p); test_is_nonzero(p5); test_eq2(p, p5); weak_ptr wp1(p2); assert(!wp1.expired()); assert(wp1.use_count() != 0); p.reset(); p2.reset(); p3.reset(); p4.reset(); test_is_zero(p); test_is_zero(p2); test_is_zero(p3); test_is_zero(p4); assert(p5.use_count() == 1); assert(wp1.expired()); assert(wp1.use_count() == 0); try { shared_ptr sp1(wp1); throw "shared_ptr sp1(wp1) failed to throw"; } catch(bad_weak_ptr const &) { } test_is_zero(wp1.lock()); weak_ptr wp2 = static_pointer_cast(p5); assert(wp2.use_count() == 1); test_is_Y(wp2); test_nonshared(wp1, wp2); // Scoped to not affect the subsequent use_count() tests. { shared_ptr sp2(wp2); test_is_nonzero(wp2.lock()); } weak_ptr wp3 = dynamic_pointer_cast(wp2.lock()); assert(wp3.use_count() == 1); test_shared(wp2, wp3); weak_ptr wp4(wp3); assert(wp4.use_count() == 1); test_shared(wp2, wp4); wp1 = p2; test_is_zero(wp1.lock()); wp1 = p4; wp1 = wp3; wp1 = wp2; assert(wp1.use_count() == 1); test_shared(wp1, wp2); weak_ptr wp5; bool b1 = wp1 < wp5; bool b2 = wp5 < wp1; p5.reset(); assert(wp1.use_count() == 0); assert(wp2.use_count() == 0); assert(wp3.use_count() == 0); // Test operator< stability for std::set< weak_ptr<> > // Thanks to Joe Gottman for pointing this out assert(b1 == (wp1 < wp5)); assert(b2 == (wp5 < wp1)); { // note that both get_object and release_object deal with int* shared_ptr p6(get_object(), release_object); } } assert(cnt == 0); return 0; } // main() clhep-2.1.4.1.orig/Utility/ChangeLog0000755000175000017500000000410612241267303015616 0ustar olesoles============================== 14.11.13 Release CLHEP-2.1.4.1 ============================== ============================== 05.11.13 Release CLHEP-2.1.4.0 ============================== ============================== 14.11.12 Release CLHEP-2.1.3.1 ============================== ============================== 06.11.12 Release CLHEP-2.1.3.0 ============================== ============================== 16.08.12 Release CLHEP-2.1.2.5 ============================== 2012-08-16 L. Garren * Utility/memory.h: use clang pragma ============================== 09.07.12 Release CLHEP-2.1.2.4 ============================== ============================== 31.05.12 Release CLHEP-2.1.2.3 ============================== ============================== 14.02.12 Release CLHEP-2.1.2.2 ============================== 2012-02-14 L. Garren * CMakeLists.txt: use clhep_package_config_no_lib ============================== 06.02.12 Release CLHEP-2.1.2.1 ============================== ============================== 16.12.11 Release CLHEP-2.1.2.0 ============================== 2011-12-09 L. Garren * test/testSharedPtr.cc: make destructors virtual where appropriate ============================== 29.07.11 Release CLHEP-2.1.1.0 ============================== 2011-07-13 L. Garren * Utility-config: make this match the config files in the other packages 2011-06-30 W. E. Brown - removing C++0X-like keywords constexpr, noexcept, and nullptr to avoid collision with similar symbols in other packages - Utility/keywords.h is now empty ============================== 11.11.10 Release CLHEP-2.1.0.1 ============================== ============================== 23.07.10 Release CLHEP-2.1.0.0 ============================== ============================== 16.06.10 Release CLHEP-2.1.0.0.b01 ============================== ============================== 11.06.10 Release CLHEP-2.0.5.0.b01 ============================== 2010-03-19 W. E. Brown - New package Utility inspired by useful bits of C++0X and Boost clhep-2.1.4.1.orig/Utility/CMakeLists.txt0000644000175000017500000000025111716540263016603 0ustar olesoles# main Utility cmake instructions # automake/autoconf variables set( PACKAGE Utility ) clhep_package_config_no_lib() add_subdirectory(Utility) add_subdirectory(test) clhep-2.1.4.1.orig/Utility/Utility/0000755000175000017500000000000012242515217015504 5ustar olesolesclhep-2.1.4.1.orig/Utility/Utility/cmake-defs.h.in0000644000175000017500000000172511607115601020263 0ustar olesoles/* @PACKAGE@/defs.h Generated by cmake. */ #ifndef @UPACKAGE@_DEFS_H #define @UPACKAGE@_DEFS_H /* Name of package */ #ifndef PACKAGE #define PACKAGE "@PACKAGE@" #endif /* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #define PACKAGE_BUGREPORT "http://savannah.cern.ch/projects/clhep/" #endif /* Define to the full name of this package. */ #ifndef PACKAGE_NAME #define PACKAGE_NAME "@PROJECT_NAME@ @PACKAGE@" #endif /* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #define PACKAGE_STRING "@PROJECT_NAME@ @PACKAGE@ @VERSION@" #endif /* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #define PACKAGE_TARNAME "@PACKAGE@" #endif /* Define to the version of this package. */ #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "@VERSION@" #endif /* Version number of package */ #ifndef VERSION #define VERSION "@VERSION@" #endif #endif // @UPACKAGE@_DEFS_H clhep-2.1.4.1.orig/Utility/Utility/copy-header.pl.in0000644000175000017500000000164111406156145020652 0ustar olesoles#!/usr/bin/env perl # # copy a header into the temporary CLHEP header tree if # a) the header is not already there # b) the source is newer # if ($#ARGV != 1) { print "mungeit requires two arguments - exit\n"; exit; } else { $source_header=$ARGV[0]; $dest_header=$ARGV[1]; &check_header; } exit; sub check_header { # make sure source exists if ( ! -e $source_header ) { print "$source_header does not exist - exit\n"; exit; } # copy if not already there - otherwise, check the time stamp if ( ! -e $dest_header ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } else { $source_header_time = -M $source_header; $dest_header_time = -M $dest_header; # copy only if source is newer if( $source_header_time < $dest_header_time ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } } } clhep-2.1.4.1.orig/Utility/Utility/Makefile.am0000644000175000017500000000136111406156145017543 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@ pkginclude_HEADERS = \ keywords.h \ memory.h \ noncopyable.h \ type_traits.h \ defs.h # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = defs.h # copy headers into $(tempincludedir) install-tmpHEADERS: @echo " install headers in $(tempincludedir) " @list='$(pkginclude_HEADERS)'; \ if test $(tempincludedir); then \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ ./copy-header.pl $$d$$p $(tempincludedir)/$$f; \ done; \ fi; test -z "$$fail" clhep-2.1.4.1.orig/Utility/Utility/noncopyable.h0000644000175000017500000000137311603173323020170 0ustar olesoles#ifndef CLHEP_NONCOPYABLE_H #define CLHEP_NONCOPYABLE_H // ====================================================================== // // noncopyable - classes directly/indirectly inheriting won't be copyable // // Author: W. E. Brown; 2010-03-05 // // ====================================================================== #include "CLHEP/Utility/defs.h" namespace CLHEP { class noncopyable { protected: noncopyable () throw () { } ~noncopyable() throw () { } private: noncopyable ( noncopyable const & ); // = delete; noncopyable & operator = ( noncopyable const & ); // = delete; }; // noncopyable } // namespace CLHEP #endif // CLHEP_NONCOPYABLE_H // // ====================================================================== clhep-2.1.4.1.orig/Utility/Utility/.cvsignore0000755000175000017500000000002611406156145017507 0ustar olesolesMakefile.in defs.h.in clhep-2.1.4.1.orig/Utility/Utility/keywords.h0000644000175000017500000000106011603173323017517 0ustar olesoles#ifndef CLHEP_KEYWORDS_H #define CLHEP_KEYWORDS_H // ====================================================================== // // keywords - allow use of C++0X keywords // // Author: W. E. Brown; 2010-03-19 // // ====================================================================== #include "CLHEP/Utility/defs.h" // C++0X-like keywords: remove once C++0X is here to stay //#define constexpr const //#define noexcept throw() //#define nullptr 0 #endif // CLHEP_KEYWORDS_H // // ====================================================================== clhep-2.1.4.1.orig/Utility/Utility/type_traits.h0000644000175000017500000012461111603173323020227 0ustar olesoles#ifndef CLHEP_TYPE_TRAITS_H #define CLHEP_TYPE_TRAITS_H // ====================================================================== // // type_traits - selected C++0X metaprogramming constructs // // Author: W. E. Brown; 2010-03-05 // // ====================================================================== #include "CLHEP/Utility/defs.h" #include // for auto_ptr #if defined(__GXX_EXPERIMENTAL_CXX0X__) # define CLHEP_HAS_RVALUE_REFERENCE #else # define CLHEP_NO_RVALUE_REFERENCE #endif namespace CLHEP { // ---------------------------------------------------------------------- // Contents: // ---------------------------------------------------------------------- // helper class: template< typename T, T v > struct integral_constant; typedef integral_constant true_type; typedef integral_constant false_type; // primary type categories: template< typename T > struct is_void; template< typename T > struct is_integral; template< typename T > struct is_floating_point; template< typename T > struct is_array; template< typename T > struct is_pointer; template< typename T > struct is_lvalue_reference; template< typename T > struct is_rvalue_reference; template< typename T > struct is_member_object_pointer; template< typename T > struct is_member_function_pointer; template< typename T > struct is_enum; template< typename T > struct is_union; template< typename T > struct is_class; template< typename T > struct is_function; // composite type categories: template< typename T > struct is_reference; template< typename T > struct is_arithmetic; template< typename T > struct is_fundamental; template< typename T > struct is_object; template< typename T > struct is_scalar; template< typename T > struct is_compound; template< typename T > struct is_member_pointer; // type properties: template< typename T > struct is_const; template< typename T > struct is_volatile; #if 0 template< typename T > struct is_trivial; template< typename T > struct is_trivially_copyable; template< typename T > struct is_standard_layout; template< typename T > struct is_pod; template< typename T > struct is_literal_type; template< typename T > struct is_empty; template< typename T > struct is_polymorphic; #endif // 0 template< typename T > struct is_abstract; #if 0 template< typename T, typename... Args > struct is_constructible; template< typename T, typename... Args > struct is_nothrow_constructible; template< typename T > struct has_default_constructor; template< typename T > struct has_copy_constructor; template< typename T > struct has_copy_assign; template< typename T > struct has_move_constructor; template< typename T > struct has_move_assign; template< typename T > struct has_trivial_default_constructor; template< typename T > struct has_trivial_copy_constructor; template< typename T > struct has_trivial_move_constructor; template< typename T > struct has_trivial_copy_assign; template< typename T > struct has_trivial_move_assign; template< typename T > struct has_trivial_destructor; template< typename T > struct has_nothrow_default_constructor; template< typename T > struct has_nothrow_copy_constructor; template< typename T > struct has_nothrow_move_constructor; template< typename T > struct has_nothrow_copy_assign; template< typename T > struct has_nothrow_move_assign; template< typename T > struct has_virtual_destructor; #endif // 0 template< typename T > struct is_signed; template< typename T > struct is_unsigned; #if 0 template< typename T > struct alignment_of; #endif // 0 template< typename T > struct rank; template< typename T, unsigned I = 0 > struct extent; // type relations: template< typename T, typename U > struct is_same; #if 0 template< typename Base, typename Derived > struct is_base_of; #endif // 0 template< typename From, typename To > struct is_convertible; #if 0 template< typename From, typename To > struct is_explicitly_convertible; #endif // 0 // const-volatile modifications: template< typename T > struct remove_const; template< typename T > struct remove_volatile; template< typename T > struct remove_cv; template< typename T > struct add_const; template< typename T > struct add_volatile; template< typename T > struct add_cv; // reference modifications: template< typename T > struct remove_reference; template< typename T > struct add_lvalue_reference; template< typename T > struct add_rvalue_reference; // sign modifications: #if 0 template< typename T > struct make_signed; template< typename T > struct make_unsigned; #endif // 0 // array modifications: template< typename T > struct remove_extent; template< typename T > struct remove_all_extents; // pointer modifications: template< typename T > struct remove_pointer; template< typename T > struct add_pointer; // other transformations: #if 0 template< std::size_t Len, std::size_t Align > struct aligned_storage; template< std::size_t Len, typename... Types > struct aligned_union; template< typename T > struct decay; #endif // 0 template< bool, typename T = void > struct enable_if; template< bool, typename T, typename F > struct conditional; #if 0 template< typename... T > struct common_type; template< typename T > struct underlying_type; template< typename > typename result_of; // undefined template< typename F, typename... ArgTypes > typename result_of; #endif // 0 // non-standard (but useful) extensions: template< typename From, typename To > struct is_ptr_convertible; template< typename From, typename To, typename R=void > struct enable_if_convertible; template< typename From, typename To, typename R=void > struct enable_if_ptr_convertible; template< typename P, typename R=void > struct enable_if_auto_ptr; // ---------------------------------------------------------------------- // integral_constant - a helper class, useful in its own right // ---------------------------------------------------------------------- template< typename T, T v > struct integral_constant { typedef T value_type; typedef integral_constant type; static value_type const value = v; operator value_type() { return value; } }; // integral_constant<,> // ---------------------------------------------------------------------- // yes_t, no_t - unimplemented types with distinct sizeof // ---------------------------------------------------------------------- namespace tt { typedef char (& yes_t); // ref to char typedef char (& no_t ) [2]; // ref to 2-char array } // namespace tt // ---------------------------------------------------------------------- // primary<,> - type classification helper // ---------------------------------------------------------------------- namespace tt { enum primary_code { _unknown = 0u , _void = 1u << 0 , _integral = 1u << 1 , _floating_point = 1u << 2 , _array = 1u << 3 , _pointer = 1u << 4 , _lvalue_reference = 1u << 5 , _rvalue_reference = 1u << 6 , _member_object_pointer = 1u << 7 , _member_function_pointer = 1u << 8 , _enum = 1u << 9 , _union = 1u << 10 // Help, compiler! , _class = 1u << 11 , _function = 1u << 12 }; // primary_code // Helpers to recognize classes: template< typename U > yes_t isAclass( void(U::*)() ); template< typename U > no_t isAclass( ... ); // Helpers to recognize functions: template< typename U > no_t isAfunction( U(*)[1] ); // arrays of non-{fctn/ref/void}s template< typename U > yes_t isAfunction( ... ); // encode via helpers or by elimination: // enum // union // need help, compiler! // class // function template< typename T > struct encode { static primary_code const value = ( sizeof(isAclass (0)) == sizeof(yes_t) ) ? _class : ( ( sizeof(isAfunction(0)) == sizeof(yes_t) ) ? _function : /* by elimination */ _enum ); }; // encode<> // encode cv-qualified type: template< typename T > struct encode : public encode { }; template< typename T > struct encode : public encode { }; template< typename T > struct encode : public encode { }; // encode array: template< typename T > struct encode { static primary_code const value = _array; }; template< typename T > struct encode { static primary_code const value = _array; }; template< typename T > struct encode { static primary_code const value = _array; }; template< typename T > struct encode { static primary_code const value = _array; }; template< typename T, unsigned N > struct encode { static primary_code const value = _array; }; template< typename T, unsigned N > struct encode { static primary_code const value = _array; }; template< typename T, unsigned N > struct encode { static primary_code const value = _array; }; template< typename T, unsigned N > struct encode { static primary_code const value = _array; }; // encode floating_point: template<> struct encode { static primary_code const value = _floating_point; }; template<> struct encode { static primary_code const value = _floating_point; }; template<> struct encode { static primary_code const value = _floating_point; }; // encode integral: template<> struct encode { static primary_code const value = _integral; }; template<> struct encode { static primary_code const value = _integral; }; template<> struct encode { static primary_code const value = _integral; }; template<> struct encode { static primary_code const value = _integral; }; #if 0 template<> struct encode { static primary_code const value = _integral; }; #endif template<> struct encode { static primary_code const value = _integral; }; template<> struct encode { static primary_code const value = _integral; }; template<> struct encode { static primary_code const value = _integral; }; template<> struct encode { static primary_code const value = _integral; }; template<> struct encode { static primary_code const value = _integral; }; template<> struct encode { static primary_code const value = _integral; }; // encode member_function_pointer: template< typename T, typename C > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2, typename A3 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2, typename A3 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2, typename A3 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2, typename A3 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2, typename A3, typename A4 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2, typename A3, typename A4 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2, typename A3, typename A4 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2, typename A3, typename A4 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2, typename A3, typename A4, typename A5 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2, typename A3, typename A4, typename A5 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2, typename A3, typename A4, typename A5 > struct encode { static primary_code const value = _member_function_pointer; }; template< typename T, typename C , typename A1, typename A2, typename A3, typename A4, typename A5 > struct encode { static primary_code const value = _member_function_pointer; }; // encode member_object_pointer: template< typename T, typename C > struct encode { static primary_code const value = _member_object_pointer; }; // encode pointer: template< typename T > struct encode { static primary_code const value = _pointer; }; // encode lvalue_reference: template< typename T > struct encode { static primary_code const value = _lvalue_reference; }; // encode rvalue_reference: #if defined(CLHEP_HAS_RVALUE_REFERENCE) template< typename T > struct encode { static primary_code const value = _rvalue_reference; }; #endif // CLHEP_HAS_RVALUE_REFERENCE // encode void: template<> struct encode { static primary_code const value = _void; }; // apply encoding: template< typename T, unsigned int p > struct primary : integral_constant::value)> { }; } // namespace tt // ---------------------------------------------------------------------- // is_void - metaprogramming type trait detecting void types // ---------------------------------------------------------------------- template< typename T > struct is_void : public tt::primary { }; // ---------------------------------------------------------------------- // is_integral - metaprogramming type trait detecting integer types // ---------------------------------------------------------------------- template< typename T > struct is_integral : public tt::primary { }; // ---------------------------------------------------------------------- // is_floating_point - metaprogramming type trait detecting real types // ---------------------------------------------------------------------- template< typename T > struct is_floating_point : public tt::primary { }; // ---------------------------------------------------------------------- // is_array - metaprogramming type trait detecting T[...] types // ---------------------------------------------------------------------- template< typename T > struct is_array : public tt::primary { }; // ---------------------------------------------------------------------- // is_pointer - metaprogramming type trait detecting T* types // ---------------------------------------------------------------------- template< typename T > struct is_pointer : public tt::primary { }; // ---------------------------------------------------------------------- // is_lvalue_reference - metaprogramming type trait detecting T& types // ---------------------------------------------------------------------- template< typename T > struct is_lvalue_reference : public tt::primary { }; // ---------------------------------------------------------------------- // is_rvalue_reference - metaprogramming type trait detecting T&& types // ---------------------------------------------------------------------- template< typename T > struct is_rvalue_reference : public tt::primary { }; // ---------------------------------------------------------------------- // is_member_object_pointer - metaprogramming type trait // ---------------------------------------------------------------------- template< typename T > struct is_member_object_pointer : public conditional< is_member_function_pointer::value , false_type , tt::primary >::type { }; // ---------------------------------------------------------------------- // is_member_function_pointer - metaprogramming type trait // ---------------------------------------------------------------------- template< typename T > struct is_member_function_pointer : public tt::primary { }; // ---------------------------------------------------------------------- // is_enum - metaprogramming type trait detecting enumeration types // ---------------------------------------------------------------------- template< typename T > struct is_enum : public tt::primary { }; // ---------------------------------------------------------------------- // is_union - metaprogramming type trait detecting union types // ---------------------------------------------------------------------- template< typename T > struct is_union : public tt::primary { }; // ---------------------------------------------------------------------- // is_class - metaprogramming type trait detecting class types // ---------------------------------------------------------------------- template< typename T > struct is_class : public tt::primary { }; // ---------------------------------------------------------------------- // is_function - metaprogramming type trait detecting function types // ---------------------------------------------------------------------- template< typename T > struct is_function : public tt::primary { }; // ---------------------------------------------------------------------- // is_reference - metaprogramming composite type trait // ---------------------------------------------------------------------- template< typename T > struct is_reference : public tt::primary< T, tt::_lvalue_reference | tt::_rvalue_reference > { }; // ---------------------------------------------------------------------- // is_arithmetic - metaprogramming composite type trait // ---------------------------------------------------------------------- template< typename T > struct is_arithmetic : public tt::primary< T, tt::_integral | tt::_floating_point > { }; // ---------------------------------------------------------------------- // is_fundamental - metaprogramming composite type trait // ---------------------------------------------------------------------- template< typename T > struct is_fundamental : public tt::primary< T, tt::_integral | tt::_floating_point | tt::_void > { }; // ---------------------------------------------------------------------- // is_object - metaprogramming composite type trait // ---------------------------------------------------------------------- template< typename T > struct is_object : public tt::primary< T, tt::_array | tt::_class | tt::_enum | tt::_floating_point | tt::_integral | tt::_member_object_pointer | tt::_member_function_pointer | tt::_pointer | tt::_union > { }; // ---------------------------------------------------------------------- // is_scalar - metaprogramming composite type trait // ---------------------------------------------------------------------- template< typename T > struct is_scalar : public tt::primary< T, tt::_integral | tt::_floating_point | tt::_enum | tt::_pointer | tt::_member_object_pointer | tt::_member_function_pointer > { }; // ---------------------------------------------------------------------- // is_compound - metaprogramming composite type trait // ---------------------------------------------------------------------- template< typename T > struct is_compound : public tt::primary< T, tt::_array | tt::_pointer | tt::_lvalue_reference | tt::_rvalue_reference | tt::_member_object_pointer | tt::_member_function_pointer | tt::_enum | tt::_union | tt::_class | tt::_function > { }; // ---------------------------------------------------------------------- // is_member_pointer - metaprogramming composite type trait // ---------------------------------------------------------------------- template< typename T > struct is_member_pointer : public tt::primary< T, tt::_member_object_pointer | tt::_member_function_pointer > { }; // ---------------------------------------------------------------------- // cv<> - helper analyzing a type's cv-qualification(s) // ---------------------------------------------------------------------- namespace tt { template< typename T > struct cv { static bool const is_c = false; static bool const is_v = false; typedef T const add_c_type; typedef T volatile add_v_type; typedef T const volatile add_cv_type; typedef T rem_c_type; typedef T rem_v_type; typedef T rem_cv_type; }; template< typename T > struct cv { static bool const is_c = true; static bool const is_v = false; typedef T const add_c_type; typedef T const volatile add_v_type; typedef T const volatile add_cv_type; typedef T rem_c_type; typedef T const rem_v_type; typedef T rem_cv_type; }; template< typename T > struct cv { static bool const is_c = false; static bool const is_v = true; typedef T const volatile add_c_type; typedef T volatile add_v_type; typedef T const volatile add_cv_type; typedef T volatile rem_c_type; typedef T rem_v_type; typedef T rem_cv_type; }; template< typename T > struct cv { static bool const is_c = true; static bool const is_v = true; typedef T const volatile add_c_type; typedef T const volatile add_v_type; typedef T const volatile add_cv_type; typedef T volatile rem_c_type; typedef T const rem_v_type; typedef T rem_cv_type; }; template< typename T > struct cv { static bool const is_c = false; static bool const is_v = false; typedef T & add_c_type; typedef T & add_v_type; typedef T & add_cv_type; typedef T & rem_c_type; typedef T & rem_v_type; typedef T & rem_cv_type; }; } // namespace tt // ---------------------------------------------------------------------- // is_const - metaprogramming type trait detecting type constness // ---------------------------------------------------------------------- template< typename T > struct is_const : public integral_constant::is_c > { }; // ---------------------------------------------------------------------- // is_volatile - metaprogramming type trait detecting type volatility // ---------------------------------------------------------------------- template< typename T > struct is_volatile : public integral_constant::is_v > { }; // ---------------------------------------------------------------------- // is_abstract_class - helper detecting when a class is abstract // ---------------------------------------------------------------------- namespace tt { template< typename, bool > struct is_abstract_class : public false_type { }; // default: not a class, hence not abstract template< typename C > struct is_abstract_class // C is known to be a class type { protected: template< typename T > static no_t take( T (*)[1] ); // can't form array of abstract T template< typename T > static yes_t take( ... ); public: static bool const value = sizeof( take(0) ) == sizeof(yes_t); }; // is_abstract_class<,true> } // namespace tt // ---------------------------------------------------------------------- // is_abstract - metaprogramming type trait detecting abstract classes // ---------------------------------------------------------------------- template< typename T > struct is_abstract : public tt::is_abstract_class< T , is_class::value > { }; // ---------------------------------------------------------------------- // is_signed - metaprogramming type trait detecting type signedness // ---------------------------------------------------------------------- template< typename > struct is_signed : public false_type { }; template<> struct is_signed : public true_type { }; template<> struct is_signed : public true_type { }; template<> struct is_signed : public true_type { }; template<> struct is_signed : public true_type { }; template< typename T > struct is_signed : public is_signed { }; template< typename T > struct is_signed : public is_signed { }; template< typename T > struct is_signed : public is_signed { }; // ---------------------------------------------------------------------- // is_unsigned - metaprogramming type trait detecting type unsignedness // ---------------------------------------------------------------------- template< typename > struct is_unsigned : public false_type { }; template<> struct is_unsigned : public true_type { }; template<> struct is_unsigned : public true_type { }; template<> struct is_unsigned : public true_type { }; template<> struct is_unsigned : public true_type { }; template< typename T > struct is_unsigned : public is_unsigned { }; template< typename T > struct is_unsigned : public is_unsigned { }; template< typename T > struct is_unsigned : public is_unsigned { }; // ---------------------------------------------------------------------- // arr<> - helper analyzing a type's array qualification(s) // ---------------------------------------------------------------------- namespace tt { template< typename T > struct arr // non-array { typedef T rem_ext_type; typedef T rem_arr_type; static int const rank = 0; template< unsigned I > struct extent { static int const value = 0; }; }; template< typename T, unsigned N > struct arr { typedef T rem_ext_type; typedef typename tt::arr::rem_arr_type rem_arr_type; static int const rank = 1 + tt::arr::rank; template< unsigned I > struct extent { static int const value = (I == rank) ? N : tt::arr::template extent::value; }; }; template< typename T > struct arr { typedef T rem_ext_type; typedef T rem_arr_type; static int const rank = 1; template< unsigned I > struct extent { static int const value = 0; }; }; } // namespace tt // ---------------------------------------------------------------------- // rank - metaprogramming type trait detecting array's rank // ---------------------------------------------------------------------- template< typename T > struct rank : public integral_constant::rank> { }; // ---------------------------------------------------------------------- // extent - metaprogramming type trait detecting array's extent // ---------------------------------------------------------------------- template< typename T, unsigned I > struct extent : public integral_constant::template extent::value> { }; // ---------------------------------------------------------------------- // is_same - metaprogramming type trait detecting type identity // ---------------------------------------------------------------------- template< typename T, typename U > struct is_same : public false_type { }; template< typename T > struct is_same : public true_type { }; // ---------------------------------------------------------------------- // any_conversion - helper to avoid passing a UDT through ... parameter // ---------------------------------------------------------------------- namespace tt { struct any_conversion { template< typename T > any_conversion( T const volatile & ); template< typename T > any_conversion( T & ); // no cv-qual on fctn-refs }; // any_conversion } // namespace tt // ---------------------------------------------------------------------- // converts_to - helper detecting convertability // ---------------------------------------------------------------------- namespace tt { template< typename From, typename To, bool > struct converts : public false_type { }; // default: can't convert to abstract To template< typename From, typename To > struct converts // To is non-abstract { protected: static yes_t take( To, int ); static no_t take( any_conversion, ... ); static From from; public: static bool const value = sizeof( take( from, 0 ) ) == sizeof(yes_t); }; // converts<> } // namespace tt // ---------------------------------------------------------------------- // is_convertible - metaprogramming type trait detecting convertability // ---------------------------------------------------------------------- template< typename From, typename To > struct is_convertible : public tt::converts::value> { }; template< > struct is_convertible : public true_type { }; template< typename T > struct is_convertible : public true_type { }; template< typename T > struct is_convertible : public false_type { }; template< > struct is_convertible : public true_type { }; template< typename T > struct is_convertible : public true_type { }; template< typename T > struct is_convertible : public false_type { }; template< > struct is_convertible : public true_type { }; template< typename T > struct is_convertible : public true_type { }; template< typename T > struct is_convertible : public false_type { }; template< > struct is_convertible : public true_type { }; template< typename T > struct is_convertible : public true_type { }; template< typename T > struct is_convertible : public false_type { }; template< typename From, int N, typename To > struct is_convertible : public is_convertible { }; template< typename From, typename To, int N > struct is_convertible : public false_type { }; // ---------------------------------------------------------------------- // remove_const - metaprogramming type trait ensuring non-constness // ---------------------------------------------------------------------- template< typename T > struct remove_const { typedef typename tt::cv::rem_c_type type; }; // ---------------------------------------------------------------------- // remove_volatile - metaprogramming type trait ensuring non-volatility // ---------------------------------------------------------------------- template< typename T > struct remove_volatile { typedef typename tt::cv::rem_v_type type; }; // ---------------------------------------------------------------------- // remove_cv - metaprogramming type trait ensuring no cv-qualification // ---------------------------------------------------------------------- template< typename T > struct remove_cv { typedef typename tt::cv::rem_cv_type type; }; // ---------------------------------------------------------------------- // add_const - metaprogramming type trait ensuring constness // ---------------------------------------------------------------------- template< typename T > struct add_const { typedef typename tt::cv::add_c_type type; }; // ---------------------------------------------------------------------- // add_volatile - metaprogramming type trait ensuring volatility // ---------------------------------------------------------------------- template< typename T > struct add_volatile { typedef typename tt::cv::add_v_type type; }; // ---------------------------------------------------------------------- // add_cv - metaprogramming type trait ensuring constness & volatility // ---------------------------------------------------------------------- template< typename T > struct add_cv { typedef typename tt::cv::add_cv_type type; }; // ---------------------------------------------------------------------- // ref<> - helper analyzing a type's reference qualification // ---------------------------------------------------------------------- namespace tt { template< typename T , primary_code = encode::value > struct ref // non-lref && non-rref && non-void { typedef T& add_lref_type; #if defined(CLHEP_HAS_RVALUE_REFERENCE) typedef T&& add_rref_type; #endif // CLHEP_HAS_RVALUE_REFERENCE typedef T rem_ref_type; }; template< typename T > struct ref { typedef T& add_lref_type; typedef T& add_rref_type; typedef T rem_ref_type; }; #if defined(CLHEP_HAS_RVALUE_REFERENCE) template< typename T > struct ref { typedef T& add_lref_type; typedef T&& add_rref_type; typedef T rem_ref_type; }; #endif // CLHEP_HAS_RVALUE_REFERENCE template< typename T > struct ref { typedef T add_lref_type; typedef T add_rref_type; typedef T rem_ref_type; }; } // namespace tt // ---------------------------------------------------------------------- // remove_reference - metaprogramming type trait ensuring non-reference // ---------------------------------------------------------------------- template< typename T > struct remove_reference { typedef typename tt::ref::rem_ref_type type; }; // ---------------------------------------------------------------------- // add_lvalue_reference - metaprogramming type trait ensuring lvalue-ref // ---------------------------------------------------------------------- template< typename T > struct add_lvalue_reference { typedef typename tt::ref::add_lref_type type; }; // ---------------------------------------------------------------------- // add_rvalue_reference - metaprogramming type trait ensuring rvalue-ref // ---------------------------------------------------------------------- template< typename T > struct add_rvalue_reference { typedef typename tt::ref::add_rref_type type; }; // ---------------------------------------------------------------------- // ptr<> - helper analyzing a type's pointer qualification // ---------------------------------------------------------------------- namespace tt { template< typename T > struct ptr { typedef typename tt::ref::rem_ref_type * add_ptr_type; typedef T rem_ptr_type; }; template< typename T > struct ptr { typedef T * * add_ptr_type; typedef T rem_ptr_type; }; template< typename T > struct ptr { typedef T * const * add_ptr_type; typedef T rem_ptr_type; }; template< typename T > struct ptr { typedef T * volatile * add_ptr_type; typedef T rem_ptr_type; }; template< typename T > struct ptr { typedef T * const volatile * add_ptr_type; typedef T rem_ptr_type; }; } // namespace tt // ---------------------------------------------------------------------- // remove_extent - metaprogramming type trait reducing an array's extent // ---------------------------------------------------------------------- template< typename T > struct remove_extent { typedef typename tt::arr::rem_ext_type type; }; // ---------------------------------------------------------------------- // remove_all_extents - metaprogramming type trait yielding a non-array // ---------------------------------------------------------------------- template< typename T > struct remove_all_extents { typedef typename tt::arr::rem_arr_type type; }; // ---------------------------------------------------------------------- // remove_pointer - metaprogramming type trait ensuring non-pointer // ---------------------------------------------------------------------- template< typename T > struct remove_pointer { typedef typename tt::ptr::rem_ptr_type type; }; // ---------------------------------------------------------------------- // add_pointer - metaprogramming type trait ensuring pointer // ---------------------------------------------------------------------- template< typename T > struct add_pointer { typedef typename tt::ptr::add_ptr_type type; }; // ---------------------------------------------------------------------- // enable_if - metaprogramming construct for applied SFINAE // ---------------------------------------------------------------------- template< typename T > struct enable_if { typedef T type; }; template< typename T > struct enable_if { }; // ---------------------------------------------------------------------- // conditional - metaprogramming construct for type selection // ---------------------------------------------------------------------- template< typename T, typename F > struct conditional { typedef T type; }; template< typename T, typename F > struct conditional { typedef F type; }; // ---------------------------------------------------------------------- // is_ptr_convertible - variant of is_convertible, based on ptrs to types // ---------------------------------------------------------------------- template< typename From, typename To > struct is_ptr_convertible { protected: static tt::yes_t take( To * ); static tt::no_t take( ... ); public: static bool const value = sizeof( take( static_cast(0) ) ) == sizeof(tt::yes_t); }; // is_ptr_convertible<,> // ---------------------------------------------------------------------- // enable_if_convertible - convenience metaprogramming type trait // ---------------------------------------------------------------------- template< typename From // type of conversion's source , typename To // type of conversion's target , typename R // result type if conversion is valid > struct enable_if_convertible : public enable_if< is_convertible::value, R > { }; // ---------------------------------------------------------------------- // enable_if_ptr_convertible - convenience metaprogramming type trait // ---------------------------------------------------------------------- template< typename From // type of conversion's source , typename To // type of conversion's target , typename R // result type if conversion is valid > struct enable_if_ptr_convertible : public enable_if< is_ptr_convertible::value, R > { }; // ---------------------------------------------------------------------- // enable_if_auto_ptr - convenience metaprogramming type trait // ---------------------------------------------------------------------- template< typename P // pointee type , typename R // result type > struct enable_if_auto_ptr { }; template< typename P, typename R > struct enable_if_auto_ptr< std::auto_ptr

    , R > { typedef R type; }; // ---------------------------------------------------------------------- } // namespace CLHEP #endif // CLHEP_TYPE_TRAITS_H // ====================================================================== clhep-2.1.4.1.orig/Utility/Utility/CMakeLists.txt0000644000175000017500000000035311606714767020263 0ustar olesoles set( pkginclude_HEADERS keywords.h memory.h noncopyable.h type_traits.h ) # notice that defs.h is not referenced here INSTALL (FILES ${pkginclude_HEADERS} DESTINATION include/CLHEP/Utility ) clhep-2.1.4.1.orig/Utility/Utility/memory.h0000644000175000017500000011643412046767077017215 0ustar olesoles#ifndef CLHEP_MEMORY_H #define CLHEP_MEMORY_H // ====================================================================== // // memory - memory management utilities // // Note: the following adaptation of the C++0X std::shared_ptr/weak_ptr // interface and semantics has been customized for the specific internal // needs of CLHEP/Random; it neither has nor needs the full generality // of its namesake. // // Author: W. E. Brown, 2010-03-19, adapted from the boost library's // shared_ptr and related functionality whose internal attributions bear // the following various notices: // // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. // Copyright (c) 2001, 2002, 2003 Peter Dimov // Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. // Copyright (c) 2001-2008 Peter Dimov // Copyright (c) 2001-2009 Peter Dimov // Copyright 2002, 2009 Peter Dimov // Copyright 2004-2005 Peter Dimov // Copyright 2004-2008 Peter Dimov // Copyright 2005, 2006 Peter Dimov // Copyright 2008 Frank Mori Hess // Copyright 2008 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // // ====================================================================== // don't generate unnecessary warnings #if defined __GNUC__ #if __GNUC__ > 3 && __GNUC_MINOR__ > 6 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor" #endif #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdelete-non-virtual-dtor" #endif #include "CLHEP/Utility/defs.h" #include "CLHEP/Utility/noncopyable.h" #include "CLHEP/Utility/type_traits.h" #include // for swap #include // for assert macro #include // for size_t #include // for exception #include // for less #include // for basic_ostream #include // for allocator, auto_ptr #include // for bad_cast, type_info namespace CLHEP { // ---------------------------------------------------------------------- // forward declarations // ---------------------------------------------------------------------- template< typename T > class shared_ptr; template< typename T > class weak_ptr; template< typename T > class enable_shared_from_this; template< typename T > class enable_shared_from_this2; // ---------------------------------------------------------------------- // bad_weak_ptr - exception thrown when a stale weak_ptr is encountered // ---------------------------------------------------------------------- class bad_weak_ptr : public std::exception { public: inline virtual char const * what() const throw(); }; // bad_weak_ptr char const * bad_weak_ptr::what() const throw() { return "bad_weak_ptr"; } namespace sp { // ---------------------------------------------------------------------- // abstract_ctrl_block - shared_ptr's counters and type-erased deleter // ---------------------------------------------------------------------- class abstract_ctrl_block : public noncopyable { public: inline void class_invariant() const throw(); // class class_invariant inline abstract_ctrl_block(); inline virtual ~abstract_ctrl_block() throw(); // constructor and destructor inline void add_ref(); inline bool add_ref_lock(); inline void weak_add_ref() throw(); virtual void * get_deleter( std::type_info const & ti ) = 0; inline void release() throw(); inline void weak_release() throw(); virtual void dispose() throw() = 0; inline virtual void destroy() throw(); // resource management functions inline long use_count() const throw(); // accessor private: int n_shared_ptrs; int n_weak_ptrs; }; // abstract_ctrl_block void abstract_ctrl_block::class_invariant() const throw() { assert( n_shared_ptrs == 0 || n_weak_ptrs >= 1 ); } abstract_ctrl_block::abstract_ctrl_block() : n_shared_ptrs( 1 ) , n_weak_ptrs ( 1 ) { class_invariant(); } abstract_ctrl_block::~abstract_ctrl_block() throw() { class_invariant(); } void abstract_ctrl_block::add_ref() { class_invariant(); ++n_shared_ptrs; } bool abstract_ctrl_block::add_ref_lock() // true on success { class_invariant(); return n_shared_ptrs ? ++n_shared_ptrs : false; } void abstract_ctrl_block::weak_add_ref() throw() { class_invariant(); ++n_weak_ptrs; } void abstract_ctrl_block::release() throw() { class_invariant(); if( 0 == --n_shared_ptrs ) dispose(), weak_release(); } void abstract_ctrl_block::weak_release() throw() { class_invariant(); if( 0 == --n_weak_ptrs ) destroy(); } void abstract_ctrl_block::destroy() throw() { assert( n_weak_ptrs == 0 ); delete this; } long abstract_ctrl_block::use_count() const throw() { class_invariant(); return n_shared_ptrs; } // ---------------------------------------------------------------------- // concrete ctrl_block_* variations: // ctrl_block_p : owned pointer only; no deleter, no allocator // ctrl_block_pd : owned pointer and deleter only; no allocator // ctrl_block_pda: owned pointer, deleter, and allocator // ---------------------------------------------------------------------- template< typename P > // P is pointee type class ctrl_block_p : public abstract_ctrl_block { typedef ctrl_block_p

    this_type; public: inline explicit ctrl_block_p( P * ); inline ~ctrl_block_p() throw(); // constructor and destructor inline void * operator new ( std::size_t ); inline void operator delete ( void * ); // allocation functions inline virtual void * get_deleter( std::type_info const & ); inline virtual void dispose() throw(); // resource management functions private: P * owned_ptr; }; // ctrl_block_p template< typename P > ctrl_block_p

    ::ctrl_block_p( P * p ) : abstract_ctrl_block( ) , owned_ptr( p ) { } template< typename P > ctrl_block_p

    ::~ctrl_block_p() throw() { } template< typename P > void ctrl_block_p

    ::dispose() throw() { delete owned_ptr; } template< typename P > void * ctrl_block_p

    ::get_deleter( std::type_info const & ) { return 0; } template< typename P > void * ctrl_block_p

    ::operator new ( std::size_t ) { return std::allocator().allocate( 1 ); } template< typename P > void ctrl_block_p

    ::operator delete ( void * p ) { std::allocator().deallocate( static_cast(p), 1 ); } template< typename P // pointee type , typename D // deleter type > class ctrl_block_pd : public abstract_ctrl_block { typedef ctrl_block_pd this_type; public: inline ctrl_block_pd( P *, D ); inline ~ctrl_block_pd() throw(); // constructor and destructor inline void * operator new ( std::size_t ); inline void operator delete ( void * ); // allocation functions inline virtual void * get_deleter( std::type_info const & ); inline virtual void dispose() throw(); // resource management functions private: P * owned_ptr; D deleter; // D's copy constructor must not throw, and // call to deleter( owned_ptr ) must not throw }; // ctrl_block_pd template< typename P, typename D > ctrl_block_pd::ctrl_block_pd( P * p, D d ) : abstract_ctrl_block( ) , owned_ptr( p ) , deleter ( d ) { } template< typename P, typename D > ctrl_block_pd::~ctrl_block_pd() throw() { } template< typename P, typename D > void ctrl_block_pd::dispose() throw() { deleter( owned_ptr ); } template< typename P, typename D > void * ctrl_block_pd::get_deleter( std::type_info const & ti ) { return ti == typeid(D) ? &reinterpret_cast( deleter ) : 0; } template< typename P, typename D > void * ctrl_block_pd::operator new ( std::size_t ) { return std::allocator().allocate( 1 ); } template< typename P, typename D > void ctrl_block_pd::operator delete ( void * p ) { std::allocator().deallocate( static_cast(p), 1 ); } template< typename P // pointee type , typename D // deleter type , typename A // allocator type > class ctrl_block_pda : public abstract_ctrl_block { typedef ctrl_block_pda this_type; public: inline ctrl_block_pda( P *, D, A ); inline ~ctrl_block_pda() throw(); // constructor and destructor inline virtual void * get_deleter( std::type_info const & ); inline virtual void dispose() throw(); inline virtual void destroy() throw(); // resource management functions private: P * owned_ptr; D deleter; // D's copy constructor must not throw, and // call to deleter( owned_ptr ) must not throw A allocator; // A's copy constructor must not throw }; // ctrl_block_pda template< typename P, typename D, typename A > ctrl_block_pda::ctrl_block_pda( P * p, D d, A a ) : abstract_ctrl_block( ) , owned_ptr( p ) , deleter ( d ) , allocator( a ) { } template< typename P, typename D, typename A > ctrl_block_pda::~ctrl_block_pda() throw() { } template< typename P, typename D, typename A > void ctrl_block_pda::dispose() throw() { deleter( owned_ptr ); } template< typename P, typename D, typename A > void ctrl_block_pda::destroy() throw() { typename A::template rebind< this_type >::other this_allocator( allocator ); this_allocator.destroy( this ); // this->~this_type(); this_allocator.deallocate( this, 1 ); } template< typename P, typename D, typename A > void * ctrl_block_pda::get_deleter( std::type_info const & ti ) { return ti == typeid( D ) ? &reinterpret_cast( deleter ) : 0; } // ---------------------------------------------------------------------- // shared_ctrl_handle, weak_ctrl_handle - ctrl block handles // ---------------------------------------------------------------------- class shared_ctrl_handle; class weak_ctrl_handle; struct sp_nothrow_tag { }; class shared_ctrl_handle { friend class weak_ctrl_handle; public: inline shared_ctrl_handle() throw(); template< typename P > inline explicit shared_ctrl_handle( P * ); template< typename P, typename D > inline shared_ctrl_handle( P *, D ); template< typename P, typename D, typename A > inline shared_ctrl_handle( P *, D, A ); template< typename P > inline explicit shared_ctrl_handle( std::auto_ptr

    & ); inline ~shared_ctrl_handle() throw(); // constructors and destructor inline void swap( shared_ctrl_handle & ) throw(); inline shared_ctrl_handle( shared_ctrl_handle const & ) throw(); inline shared_ctrl_handle & operator = ( shared_ctrl_handle const & ) throw(); // copy functions inline explicit shared_ctrl_handle( weak_ctrl_handle const & ); inline shared_ctrl_handle( weak_ctrl_handle const &, sp_nothrow_tag ); // copy-like functions inline void * get_deleter( std::type_info const & ) const; inline bool unique() const throw(); inline bool empty() const throw(); inline long use_count() const throw(); // accessors friend inline bool operator == ( shared_ctrl_handle const &, shared_ctrl_handle const & ); friend inline bool operator < ( shared_ctrl_handle const &, shared_ctrl_handle const & ); // comparisons private: abstract_ctrl_block * acb_ptr; }; // shared_ctrl_handle shared_ctrl_handle::shared_ctrl_handle() throw() : acb_ptr( 0 ) { } template< typename P > shared_ctrl_handle::shared_ctrl_handle( P * p ) // a fctn-try block would be slightly more efficient here, // but some older compilers don't understand it : acb_ptr( 0 ) { try { acb_ptr = new ctrl_block_p

    (p); } catch(...) { delete p; throw; } } template< typename P, typename D > shared_ctrl_handle::shared_ctrl_handle( P * p, D d ) // a fctn-try block would be slightly more efficient here, // but some older compilers don't understand it : acb_ptr( 0 ) { try { acb_ptr = new ctrl_block_pd(p, d); } catch(...) { d( p ); throw; } } template< typename P, typename D, typename A > shared_ctrl_handle::shared_ctrl_handle( P * p, D d, A a ) : acb_ptr( 0 ) { typedef ctrl_block_pda ctrl_block; typedef typename A::template rebind::other ctrl_block_allocator; ctrl_block_allocator cba( a ); try { acb_ptr = cba.allocate( 1 ); new( static_cast(acb_ptr) ) ctrl_block(p, d, a); } catch(...) { d( p ); if( acb_ptr != 0 ) cba.deallocate( static_cast( acb_ptr ), 1 ); throw; } } template< typename P > shared_ctrl_handle::shared_ctrl_handle( std::auto_ptr

    & p ) : acb_ptr( new ctrl_block_p

    ( p.get() ) ) { p.release(); } shared_ctrl_handle::~shared_ctrl_handle() throw() { if( acb_ptr != 0 ) acb_ptr->release(); } void shared_ctrl_handle::swap( shared_ctrl_handle & other ) throw() { abstract_ctrl_block * tmp = other.acb_ptr; other.acb_ptr = acb_ptr; acb_ptr = tmp; } shared_ctrl_handle::shared_ctrl_handle( shared_ctrl_handle const & other ) throw() : acb_ptr( other.acb_ptr ) { if( acb_ptr != 0 ) acb_ptr->add_ref(); } shared_ctrl_handle & shared_ctrl_handle::operator = ( shared_ctrl_handle const & other ) throw() { abstract_ctrl_block * tmp = other.acb_ptr; if( tmp != acb_ptr ) { if( tmp != 0 ) tmp->add_ref(); if( acb_ptr != 0 ) acb_ptr->release(); acb_ptr = tmp; } return *this; } void * shared_ctrl_handle::get_deleter( std::type_info const & ti ) const { return acb_ptr ? acb_ptr->get_deleter( ti ) : 0; } bool shared_ctrl_handle::unique() const throw() { return 1L == use_count(); } bool shared_ctrl_handle::empty() const throw() { return acb_ptr == 0; } long shared_ctrl_handle::use_count() const throw() { return acb_ptr == 0 ? 0L : acb_ptr->use_count(); } bool operator == ( shared_ctrl_handle const & lhs, shared_ctrl_handle const & rhs ) { return lhs.acb_ptr == rhs.acb_ptr; } bool operator < ( shared_ctrl_handle const & lhs, shared_ctrl_handle const & rhs ) { return std::less()( lhs.acb_ptr, rhs.acb_ptr ); } class weak_ctrl_handle { friend class shared_ctrl_handle; public: inline weak_ctrl_handle() throw(); inline weak_ctrl_handle( shared_ctrl_handle const & ) throw(); inline ~weak_ctrl_handle() throw(); // constructors and destructor inline void swap( weak_ctrl_handle & ) throw(); inline weak_ctrl_handle( weak_ctrl_handle const & ) throw(); inline weak_ctrl_handle & operator = ( shared_ctrl_handle const & ) throw(); // copy functions inline weak_ctrl_handle & operator = ( weak_ctrl_handle const & ) throw(); // copy-like functions inline bool empty() const throw(); inline long use_count() const throw(); // accessors friend inline bool operator == ( weak_ctrl_handle const &, weak_ctrl_handle const & ); friend inline bool operator < ( weak_ctrl_handle const &, weak_ctrl_handle const & ); // comparisons private: abstract_ctrl_block * acb_ptr; }; // weak_ctrl_handle weak_ctrl_handle::weak_ctrl_handle() throw() : acb_ptr( 0 ) { } weak_ctrl_handle::weak_ctrl_handle( shared_ctrl_handle const & other ) throw() : acb_ptr( other.acb_ptr ) { if( acb_ptr != 0 ) acb_ptr->weak_add_ref(); } weak_ctrl_handle::~weak_ctrl_handle() throw() { if( acb_ptr != 0 ) acb_ptr->weak_release(); } void weak_ctrl_handle::swap( weak_ctrl_handle & other ) throw() { abstract_ctrl_block * tmp = other.acb_ptr; other.acb_ptr = acb_ptr; acb_ptr = tmp; } weak_ctrl_handle::weak_ctrl_handle( weak_ctrl_handle const & other ) throw() : acb_ptr( other.acb_ptr ) { if( acb_ptr != 0 ) acb_ptr->weak_add_ref(); } weak_ctrl_handle & weak_ctrl_handle::operator = ( shared_ctrl_handle const & other ) throw() { abstract_ctrl_block * tmp = other.acb_ptr; if( tmp != acb_ptr ) { if( tmp != 0 ) tmp->weak_add_ref(); if( acb_ptr != 0 ) acb_ptr->weak_release(); acb_ptr = tmp; } return *this; } weak_ctrl_handle & weak_ctrl_handle::operator = ( weak_ctrl_handle const & other ) throw() { abstract_ctrl_block * tmp = other.acb_ptr; if( tmp != acb_ptr ) { if( tmp != 0 ) tmp->weak_add_ref(); if( acb_ptr != 0 ) acb_ptr->weak_release(); acb_ptr = tmp; } return *this; } bool weak_ctrl_handle::empty() const throw() { return acb_ptr == 0; } long weak_ctrl_handle::use_count() const throw() { return acb_ptr == 0 ? 0L : acb_ptr->use_count(); } bool operator == ( weak_ctrl_handle const & lhs, weak_ctrl_handle const & rhs ) { return lhs.acb_ptr == rhs.acb_ptr; } bool operator < ( weak_ctrl_handle const & lhs, weak_ctrl_handle const & rhs ) { return std::less()( lhs.acb_ptr, rhs.acb_ptr ); } shared_ctrl_handle::shared_ctrl_handle( weak_ctrl_handle const & other ) : acb_ptr( other.acb_ptr ) { if( acb_ptr == 0 || ! acb_ptr->add_ref_lock() ) throw bad_weak_ptr(); } shared_ctrl_handle::shared_ctrl_handle( weak_ctrl_handle const & other , sp_nothrow_tag ) : acb_ptr( other.acb_ptr ) { if( acb_ptr != 0 && ! acb_ptr->add_ref_lock() ) acb_ptr = 0; } // ---------------------------------------------------------------------- // cast tags // ---------------------------------------------------------------------- struct static_cast_tag { }; struct const_cast_tag { }; struct dynamic_cast_tag { }; struct polymorphic_cast_tag { }; // ---------------------------------------------------------------------- // shared_ptr_traits - specify dependent types // ---------------------------------------------------------------------- template< typename T > struct shared_ptr_traits { typedef T & reference; }; template<> struct shared_ptr_traits { typedef void reference; }; template<> struct shared_ptr_traits { typedef void reference; }; template<> struct shared_ptr_traits { typedef void reference; }; template<> struct shared_ptr_traits { typedef void reference; }; // ---------------------------------------------------------------------- // enable_shared_from_this support // ---------------------------------------------------------------------- template< typename X, typename Y, typename T > inline void sp_enable_shared_from_this( shared_ptr const * ppx , Y const * py , enable_shared_from_this const * pe ) { if( pe != 0 ) pe->_internal_accept_owner( ppx, const_cast( py ) ); } template< typename X, typename Y, typename T > inline void sp_enable_shared_from_this( shared_ptr * ppx , Y const * py , enable_shared_from_this2 const * pe ) { if( pe != 0 ) pe->_internal_accept_owner( ppx, const_cast( py ) ); } inline void sp_enable_shared_from_this( ... ) { } } // namespace sp // ---------------------------------------------------------------------- // shared_ptr - "if you are the last person, please turn out the light" // ---------------------------------------------------------------------- template< typename P > // pointee type class shared_ptr { typedef shared_ptr

    this_type; typedef typename sp::shared_ptr_traits

    ::reference reference; template< typename > friend class shared_ptr; template< typename > friend class weak_ptr; public: typedef P element_type; // pointee type shared_ptr() throw(); template< typename P2 > inline explicit shared_ptr( P2 * ); template< typename P2, typename D > inline shared_ptr( P2 *, D ); template< typename P2, typename D, typename A > inline shared_ptr( P2 *, D, A ); // constructors inline void swap( shared_ptr

    & ) throw(); inline shared_ptr & operator = ( shared_ptr const & ) throw(); // copy functions; generated copy constructor, destructor are fine template< typename P2 > inline explicit shared_ptr( weak_ptr const & ); template< typename P2 > inline shared_ptr( weak_ptr const &, sp::sp_nothrow_tag ) throw(); template< typename P2 > inline shared_ptr( shared_ptr const &, P * ) throw(); template< typename P2 > inline shared_ptr( shared_ptr const &, sp::static_cast_tag ); template< typename P2 > inline shared_ptr( shared_ptr const &, sp::const_cast_tag ); template< typename P2 > inline shared_ptr( shared_ptr const &, sp::dynamic_cast_tag ); template< typename P2 > inline shared_ptr( shared_ptr const &, sp::polymorphic_cast_tag ); template< typename P2 > inline explicit shared_ptr( std::auto_ptr & ); template< typename AP > inline explicit shared_ptr( AP , typename enable_if_auto_ptr::type = 0 ); template< typename P2 > inline shared_ptr( shared_ptr const & , typename enable_if_ptr_convertible::type = 0 ) throw(); template< typename P2 > inline shared_ptr & operator = ( shared_ptr const & ) throw(); template< typename P2 > inline shared_ptr & operator = ( std::auto_ptr & ); template< typename AP > inline typename enable_if_auto_ptr< AP, shared_ptr & >::type operator = ( AP ); // copy-like functions inline void reset() throw(); template< typename P2 > inline void reset( P2 * ); template< typename P2, typename D > inline void reset( P2 *, D ); template< typename P2, typename D, typename A > inline void reset( P2 *, D, A ); template< typename P2 > inline void reset( shared_ptr const &, P * ); // reset functions inline operator bool () const throw(); inline reference operator * () const throw(); inline P * operator -> () const throw(); // pointer-like behavior inline P * get() const throw(); inline bool unique() const throw(); inline long use_count() const throw(); // accessors template< typename P2 > inline bool _internal_less( shared_ptr const & ) const; inline void * _internal_get_deleter( std::type_info const & ) const; inline bool _internal_equiv( shared_ptr const & ) const; // implementation helpers -- do not use private: P * px; // contained pointer sp::shared_ctrl_handle pn; // control information }; // shared_ptr template< typename P, typename P2 > inline bool operator == ( shared_ptr

    const &, shared_ptr const & ); template< typename P, typename P2 > inline bool operator != ( shared_ptr

    const &, shared_ptr const & ); template< typename P, typename P2 > inline bool operator < ( shared_ptr

    const &, shared_ptr const & ); template< typename P > inline void swap( shared_ptr

    &, shared_ptr

    & ); template< typename P, typename P2 > inline shared_ptr

    static_pointer_cast( shared_ptr const & ); template< typename P, typename P2 > inline shared_ptr

    const_pointer_cast( shared_ptr const & ); template< typename P, typename P2 > inline shared_ptr

    dynamic_pointer_cast( shared_ptr const & ); template< typename P > inline P * get_pointer( shared_ptr

    const & ); template< typename D, typename P > inline D * get_deleter( shared_ptr

    const & ); template< typename C, typename T, typename P > inline std::basic_ostream & operator << ( std::basic_ostream & , shared_ptr

    const & ); template< typename P > shared_ptr

    ::shared_ptr() throw() : px( 0 ) , pn( ) { } template< typename P > template< typename P2 > // P2 must be a complete type shared_ptr

    ::shared_ptr( P2 * p ) : px( p ) , pn( p ) { sp::sp_enable_shared_from_this( this, p, p ); } template< typename P > template< typename P2, typename D > // D's copy c'tor must not throw shared_ptr

    ::shared_ptr( P2 * p, D d ) : px( p ) , pn( p, d ) { sp::sp_enable_shared_from_this( this, p, p ); } template< typename P > template< typename P2, typename D, typename A > // D's, A's copy c'tors must not throw shared_ptr

    ::shared_ptr( P2 * p, D d, A a ) : px( p ) , pn( p, d, a ) { sp::sp_enable_shared_from_this( this, p, p ); } template< typename P > void shared_ptr

    ::swap( shared_ptr

    & other ) throw() { std::swap( px, other.px ); pn.swap( other.pn ); } template< typename P > shared_ptr

    & shared_ptr

    ::operator = ( shared_ptr const & other ) throw() { this_type( other ).swap( *this ); return *this; } template< typename P > template< typename P2 > shared_ptr

    ::shared_ptr( weak_ptr const & other ) : px( 0 ) // temporarily , pn( other.pn ) // may throw { px = other.px; // safe to copy other.px, as pn(other.pn) did not throw } template< typename P > template< typename P2 > shared_ptr

    ::shared_ptr( weak_ptr const & other , sp::sp_nothrow_tag ) throw() : px( 0 ) // temporarily , pn( other.pn, sp::sp_nothrow_tag() ) { if( ! pn.empty() ) px = other.px; } template< typename P > template< typename P2 > shared_ptr

    ::shared_ptr( shared_ptr const & other , P * p ) throw() : px( p ) , pn( other.pn ) { } template< typename P > template< typename P2 > shared_ptr

    ::shared_ptr( shared_ptr const & other , sp::static_cast_tag ) : px( static_cast( other.px ) ) , pn( other.pn ) { } template< typename P > template< typename P2 > shared_ptr

    ::shared_ptr( shared_ptr const & other , sp::const_cast_tag ) : px( const_cast( other.px ) ) , pn( other.pn ) { } template< typename P > template< typename P2 > shared_ptr

    ::shared_ptr( shared_ptr const & other , sp::dynamic_cast_tag ) : px( dynamic_cast( other.px ) ) , pn( other.pn ) { if( px == 0 ) // cast failed? pn = sp::shared_ctrl_handle(); // yes; need our own control information } template< typename P > template< typename P2 > shared_ptr

    ::shared_ptr( shared_ptr const & other , sp::polymorphic_cast_tag ) : px( dynamic_cast( other.px ) ) , pn( other.pn ) { if( px == 0 ) throw std::bad_cast(); } template< typename P > template< typename P2 > shared_ptr

    ::shared_ptr( std::auto_ptr & other ) : px( other.get() ) , pn( ) // temporarily { P2 * tmp = other.get(); pn = sp::shared_ctrl_handle( other ); sp::sp_enable_shared_from_this( this, tmp, tmp ); } template< typename P > template< typename AP > shared_ptr

    ::shared_ptr( AP other , typename enable_if_auto_ptr::type ) : px( other.get() ) , pn( ) // temporarily { typename AP::element_type * tmp = other.get(); pn = sp::shared_ctrl_handle( other ); sp::sp_enable_shared_from_this( this, tmp, tmp ); } template< typename P > template< typename P2 > shared_ptr

    ::shared_ptr( shared_ptr const & other , typename enable_if_ptr_convertible::type ) throw() : px( other.px ) , pn( other.pn ) { } template< typename P > template< typename P2 > shared_ptr

    & shared_ptr

    ::operator = ( shared_ptr const & other ) throw() { this_type( other ).swap( *this ); return *this; } template< typename P > template< typename P2 > shared_ptr

    & shared_ptr

    ::operator = ( std::auto_ptr & other ) { this_type( other ).swap( *this ); return *this; } template< typename P > template< typename AP > typename enable_if_auto_ptr< AP, shared_ptr

    & >::type shared_ptr

    ::operator = ( AP other ) { this_type( other ).swap( *this ); return *this; } template< typename P > void shared_ptr

    ::reset() throw() { this_type().swap( *this ); } template< typename P > template< typename P2 > void shared_ptr

    ::reset( P2 * p ) // P2 must be a complete type { assert( p == 0 || p != px ); // oughtn't reset oneself this_type( p ).swap( *this ); } template< typename P > template< typename P2, typename D > void shared_ptr

    ::reset( P2 * p, D d ) { this_type( p, d ).swap( *this ); } template< typename P > template< typename P2, typename D, typename A > void shared_ptr

    ::reset( P2 * p, D d, A a ) { this_type( p, d, a ).swap( *this ); } template< typename P > template< typename P2 > void shared_ptr

    ::reset( shared_ptr const & other, P * p ) { this_type( other, p ).swap( *this ); } template< typename P > shared_ptr

    ::operator bool () const throw() { return px; } template< typename P > typename sp::shared_ptr_traits

    ::reference //typename shared_ptr

    ::reference shared_ptr

    ::operator * () const throw() { assert( px != 0 ); return *px; } template< typename P > P * shared_ptr

    ::operator -> () const throw() { assert( px != 0 ); return px; } template< typename P > P * shared_ptr

    ::get() const throw() { return px; } template< typename P > bool shared_ptr

    ::unique() const throw() { return pn.unique(); } template< typename P > long shared_ptr

    ::use_count() const throw() { return pn.use_count(); } template< typename P > template< typename P2 > bool shared_ptr

    ::_internal_less( shared_ptr const & rhs ) const { return pn < rhs.pn; } template< typename P > void * shared_ptr

    ::_internal_get_deleter( std::type_info const & ti ) const { return pn.get_deleter( ti ); } template< typename P > bool shared_ptr

    ::_internal_equiv( shared_ptr const & other ) const { return px == other.px && pn == other.pn; } template< typename P, typename P2 > bool operator == ( shared_ptr

    const & a, shared_ptr const & b ) { return a.get() == b.get(); } template< typename P, typename P2 > bool operator != ( shared_ptr

    const & a, shared_ptr const & b ) { return a.get() != b.get(); } template< typename P, typename P2 > bool operator < ( shared_ptr

    const & a, shared_ptr const & b ) { return a._internal_less(b); } template< typename P > void swap( shared_ptr

    & a, shared_ptr

    & b ) { a.swap( b ); } template< typename P, typename P2 > shared_ptr

    static_pointer_cast( shared_ptr const & other ) { return shared_ptr

    ( other, sp::static_cast_tag() ); } template< typename P, typename P2 > shared_ptr

    const_pointer_cast( shared_ptr const & other ) { return shared_ptr

    ( other, sp::const_cast_tag() ); } template< typename P, typename P2 > shared_ptr

    dynamic_pointer_cast( shared_ptr const & other ) { return shared_ptr

    ( other, sp::dynamic_cast_tag() ); } template< typename P > P * get_pointer( shared_ptr

    const & p ) { return p.get(); } template< typename D, typename P > D * get_deleter( shared_ptr

    const & p ) { return static_cast( p._internal_get_deleter( typeid(D)) ); } template< typename C, typename T, typename P > std::basic_ostream & operator << ( std::basic_ostream & os, shared_ptr

    const & p ) { os << p.get(); return os; } // ---------------------------------------------------------------------- // weak_ptr - non-owning handle from which a shared_ptr can be obtained // ---------------------------------------------------------------------- template< typename P > class weak_ptr { typedef weak_ptr

    this_type; template< typename > friend class shared_ptr; template< typename > friend class weak_ptr; public: typedef P element_type; inline weak_ptr() throw(); // generated copy constructor, assignment, destructor are fine inline void swap( this_type & other ) throw(); template< typename P2 > inline weak_ptr( weak_ptr const & r , typename enable_if_ptr_convertible::type = 0 ) throw(); template< typename P2 > inline weak_ptr( shared_ptr const & r , typename enable_if_ptr_convertible::type = 0 ) throw(); template< typename P2 > inline weak_ptr & operator = (weak_ptr const & r) throw(); template< typename P2 > inline weak_ptr & operator = (shared_ptr const & r) throw(); // copy-like functions inline shared_ptr

    lock() const throw(); inline long use_count() const throw(); inline bool expired() const throw(); inline bool _empty() const; // extension, not in std::weak_ptr inline void reset() throw(); // accessors inline void _internal_assign( P * px2, sp::shared_ctrl_handle const & pn2 ); template< typename P2 > inline bool _internal_less( weak_ptr const & rhs ) const; private: P * px; // contained pointer sp::weak_ctrl_handle pn; // control information }; // weak_ptr template< typename P, typename P2 > inline bool operator < ( weak_ptr

    const & a, weak_ptr const & b ); template< typename P > inline void swap( weak_ptr

    & a, weak_ptr

    & b ); template< typename P > weak_ptr

    ::weak_ptr() throw() : px( 0 ) , pn( ) { } template< typename P > template< typename P2 > weak_ptr

    ::weak_ptr( weak_ptr const & r , typename enable_if_ptr_convertible::type ) throw() : px( r.lock().get() ) // same as r.px, but doesn't risk invalidation , pn( r.pn ) { } template< typename P > template< typename P2 > weak_ptr

    ::weak_ptr( shared_ptr const & r , typename enable_if_ptr_convertible::type ) throw() : px( r.px ) , pn( r.pn ) { } template< typename P > template< typename P2 > weak_ptr

    & weak_ptr

    ::operator = (weak_ptr const & r) throw() { px = r.lock().get(); pn = r.pn; return *this; } template< typename P > template< typename P2 > weak_ptr

    & weak_ptr

    ::operator = (shared_ptr const & r) throw() { px = r.px; pn = r.pn; return *this; } template< typename P > shared_ptr

    weak_ptr

    ::lock() const throw() { return shared_ptr( *this, sp::sp_nothrow_tag() ); } template< typename P > long weak_ptr

    ::use_count() const throw() { return pn.use_count(); } template< typename P > bool weak_ptr

    ::expired() const throw() { return pn.use_count() == 0; } template< typename P > bool weak_ptr

    ::_empty() const // extension, not in std::weak_ptr { return pn.empty(); } template< typename P > void weak_ptr

    ::reset() throw() { this_type().swap(*this); } template< typename P > void weak_ptr

    ::swap( this_type & other ) throw() { std::swap(px, other.px); pn.swap(other.pn); } template< typename P > void weak_ptr

    ::_internal_assign( P * px2, sp::shared_ctrl_handle const & pn2 ) { px = px2; pn = pn2; } template< typename P > template< typename P2 > bool weak_ptr

    ::_internal_less( weak_ptr const & rhs ) const { return pn < rhs.pn; } template< typename P, typename P2 > bool operator < ( weak_ptr

    const & a, weak_ptr const & b ) { return a._internal_less(b); } template< typename P > void swap( weak_ptr

    & a, weak_ptr

    & b ) { a.swap(b); } // ---------------------------------------------------------------------- // do_nothing_deleter - for shared_ptrs not taking ownership // ---------------------------------------------------------------------- struct do_nothing_deleter { inline void operator () ( void const * ) const; }; void do_nothing_deleter::operator () ( void const * ) const { } } // namespace CLHEP #if defined __GNUC__ #if __GNUC__ > 3 && __GNUC_MINOR__ > 6 #pragma GCC diagnostic pop #endif #endif #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CLHEP_MEMORY_H // // ====================================================================== #if 0 // enable_shared_from_this.hpp template< typename T > class enable_shared_from_this { protected: enable_shared_from_this() { } ~enable_shared_from_this() { } enable_shared_from_this( enable_shared_from_this const & ) { } enable_shared_from_this & operator = ( enable_shared_from_this const & ) { return *this; } public: shared_ptr shared_from_this() { shared_ptr p( weak_this_ ); assert( p.get() == this ); return p; } shared_ptr shared_from_this() const { shared_ptr p( weak_this_ ); assert( p.get() == this ); return p; } public: // actually private, but avoids compiler template friendship issues // Note: invoked automatically by shared_ptr; do not call template< typename X, typename Y > void _internal_accept_owner( shared_ptr const * ppx, Y * py ) const { if( weak_this_.expired() ) weak_this_ = shared_ptr( *ppx, py ); } private: mutable weak_ptr weak_this_; }; // enable_shared_from_this<> // enable_shared_from_this2.hpp namespace detail { class esft2_deleter_wrapper { private: shared_ptr deleter_; public: esft2_deleter_wrapper() { } template< typename T > void set_deleter( shared_ptr const & deleter ) { deleter_ = deleter; } template< typename T > void operator () ( T* ) { assert( deleter_.use_count() <= 1 ); deleter_.reset(); } }; } // namespace detail template< typename T > class enable_shared_from_this2 { protected: enable_shared_from_this2() { } enable_shared_from_this2( enable_shared_from_this2 const & ) { } enable_shared_from_this2 & operator = ( enable_shared_from_this2 const & ) { return *this; } ~enable_shared_from_this2() { assert( shared_this_.use_count() <= 1 ); // ensure no dangling shared_ptrs } private: mutable weak_ptr weak_this_; mutable shared_ptr shared_this_; public: shared_ptr shared_from_this() { init_weak_once(); return shared_ptr( weak_this_ ); } shared_ptr shared_from_this() const { init_weak_once(); return shared_ptr( weak_this_ ); } private: void init_weak_once() const { if( weak_this_._empty() ) { shared_this_.reset( static_cast< T* >( 0 ) , detail::esft2_deleter_wrapper() ); weak_this_ = shared_this_; } } public: // actually private, but avoids compiler template friendship issues // Note: invoked automatically by shared_ptr; do not call template< typename X, typename Y > void _internal_accept_owner( shared_ptr * ppx, Y * py ) const { assert( ppx != 0 ); if( weak_this_.use_count() == 0 ) weak_this_ = shared_ptr( *ppx, py ); else if( shared_this_.use_count() != 0 ) { assert( ppx->unique() ); // no weak_ptrs should exist either, but there's no way to check that detail::esft2_deleter_wrapper * pd = boost::get_deleter( shared_this_ ); assert( pd != 0 ); pd->set_deleter( *ppx ); ppx->reset( shared_this_, ppx->get() ); shared_this_.reset(); } } }; // enable_shared_from_this2<> #endif // 0 clhep-2.1.4.1.orig/Utility/autotools/0000755000175000017500000000000012242515217016072 5ustar olesolesclhep-2.1.4.1.orig/Utility/autotools/.cvsignore0000755000175000017500000000010111406156145020067 0ustar olesolesconfig.sub config.guess depcomp install-sh missing mkinstalldirs clhep-2.1.4.1.orig/RandomObjects/0000755000175000017500000000000012242515143015126 5ustar olesolesclhep-2.1.4.1.orig/RandomObjects/RandomObjects-deps.in0000755000175000017500000000045511406203315021144 0ustar olesolesCLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Matrix-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Random-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Vector-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Utility-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Units-@VERSION@ clhep-2.1.4.1.orig/RandomObjects/INSTALL0000755000175000017500000000772111406203315016165 0ustar olesoles#------------------------------------------------------------- # platform specific issues #------------------------------------------------------------- This package requires autoconf 2.59 or later and automake 1.9.1 or later. If you bootstrap, you will probably have to build these yourself. See "building autotools" below. The new libtool no longer properly supports shared libraries for gcc 2.95.2. If you build CLHEP with gcc 2.95.2, you must configure --disable-shared. To build for Solaris CC, configure with CXX=CC CC=cc and use gmake. On MacOSX, you need to define MACOSX_DEPLOYMENT_TARGET appropriately. For instance, set MACOSX_DEPLOYMENT_TARGET to "10.4" if you have MacOS 10.4 installed on your system. #------------------------------------------------------------- # installing from a source code tar ball #------------------------------------------------------------- Unwind the source code tar ball in some relevant directory. Autoconf and automake will aready have been run. Determine where the files will be installed. Create a build directory that is NOT in the source code directory tree. cd /configure --prefix= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make check (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # configure options #------------------------------------------------------------- A variety of options can be given to configure. Below is a list of the options that you are likely to find most useful. --help provides a partial list of options --prefix=PREFIX install architecture-independent files in PREFIX [default is /usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [default is the same as PREFIX] --disable-shared build only static libraries --disable-static build only shared libraries --enable-exceptions use the CLHEP/Exceptions package --disable-exceptions DO NOT use the CLHEP/Exceptions package [--disable-exceptions is the default] #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are neither built nor installed automatically. Use the following commands to build and install documents: make docs make install-docs #------------------------------------------------------------- # building from cvs #------------------------------------------------------------- You will need current versions of automake, autoconf, and libtool. See building autotools below. cvs co CLHEP/package OR cvs co package cd [CLHEP/]package ./bootstrap Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building autotools #------------------------------------------------------------- If you do not have at least autoconf 2.59 and automake 1.9.1, you will need to build autoconf, automake, and libtool. On some platforms, you may also need to build m4 and texinfo. Download the relevant tarballs from gnu.org (http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/, and http://www.gnu.org/software/libtool/) Untar them in a common source code tree. Decide whether you want to install them in /usr/local or your own install directory. If you use your own install directory, use --prefix= with configure. For each autotool package: /configure [--prefix=] make make install Make sure that /bin is at the front of your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/RandomObjects/Makefile.am0000755000175000017500000000451310234001037017157 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP # put . first so that CLHEP directory is built before anything else SUBDIRS = RandomObjects . src test # list all subdirectories - for distribution and cleaning DIST_SUBDIRS = RandomObjects . src test bin_SCRIPTS = RandomObjects-config all-local: $(top_builddir)/CLHEP # create temporary CLHEP header tree # we only copy headers for packages listed in @PACKAGE@-deps # search for header directories in the following order: # 1. $(top_builddir)/this-package # 2. $(top_builddir)/../other-packages # 3. $(CLHEPSOURCE_DIR)/CLHEP # 4. $(CLHEP_DIR)/include/CLHEP # # abs_ => absolute path abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ COPY_P = @COPY_P@ $(top_builddir)/CLHEP: temp-package-dirs @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ if test -d "$$pkg" ; then \ (cd $$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d ../"$$pkg"/"$$pkg" ; then \ (cd ../$$pkg/$$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg"; then \ hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ else \ if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/include/CLHEP; then \ if test -d $(CLHEP_DIR)/include/CLHEP/"$$pkg"; then \ hdrs=`ls $(CLHEP_DIR)/include/CLHEP/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEP_DIR)/include/CLHEP/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ fi; \ fi; \ fi; \ fi; \ fi; \ done; temp-package-dirs: $(mkinstalldirs) $(abs_top_builddir)/CLHEP; @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ $(mkinstalldirs) $(abs_top_builddir)/CLHEP/$$pkg; \ done; docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs # extra clean rule clean-local: rm -rf $(top_builddir)/CLHEP clhep-2.1.4.1.orig/RandomObjects/bootstrap0000755000175000017500000000071510234001037017063 0ustar olesoles#! /bin/sh set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 rm -f Makefile.in */Makefile.in */defs.h.in rm -f autotools/config* autotools/depcomp autotools/install-sh autotools/m* rm -f configure config.* # run autotool commands aclocal -I autotools autoheader automake --add-missing --copy autoconf # ready to make a source code distribution tarball clhep-2.1.4.1.orig/RandomObjects/configure.ac0000755000175000017500000002754512241267303017435 0ustar olesoles# ====================================================================== # This is the RandomObjects configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.59) AC_INIT(CLHEP RandomObjects, 2.1.4.1, http://savannah.cern.ch/projects/clhep/, RandomObjects) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([src/RandMultiGauss.cc]) AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # ---------------------------------------------------------------------- # --enable-shared and --enable-static # both shared and static libraries are built by default # ---------------------------------------------------------------------- AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Header containing #defines: AM_CONFIG_HEADER([RandomObjects/defs.h]) # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([RandomObjects/Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([test/Makefile]) AC_CONFIG_FILES([RandomObjects-deps]) AC_CONFIG_FILES([RandomObjects/copy-header.pl], [chmod +x RandomObjects/copy-header.pl]) # Configuration inquiry program/script: AC_CONFIG_FILES([RandomObjects-config], [chmod +x RandomObjects-config]) # Test driver program/script: AC_CONFIG_FILES([test/testVectorDists.sh], [chmod +x test/testVectorDists.sh]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- RandomObjects_CPPFLAGS="-I$includedir" RandomObjects_LDFLAGS="-L$libdir" RandomObjects_LIBS="-lCLHEP-$PACKAGE-$VERSION -lCLHEP-Random-$VERSION -lCLHEP-Matrix-$VERSION -lCLHEP-Vector-$VERSION" AC_SUBST(RandomObjects_CPPFLAGS) AC_SUBST(RandomObjects_LIBS) AC_SUBST(RandomObjects_LDFLAGS) # ---------------------------------------------------------------------- # Supply boilerplate for RandomObjects/defs.h source header: # ---------------------------------------------------------------------- AH_TOP([#ifndef RANDOMOBJECTS_DEFS_H #define RANDOMOBJECTS_DEFS_H]) ## the undefs are converted by configure AH_VERBATIM([PACKAGE],[/* Name of package */ #ifndef PACKAGE #undef PACKAGE #endif]) AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif]) AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */ #ifndef PACKAGE_NAME #undef PACKAGE_NAME #endif]) AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #undef PACKAGE_STRING #endif]) AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif]) AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */ #ifndef PACKAGE_VERSION #undef PACKAGE_VERSION #endif]) AH_VERBATIM([VERSION],[/* Version number of package */ #ifndef VERSION #undef VERSION #endif]) AH_BOTTOM([#endif // RANDOMOBJECTS_DEFS_H]) # ---------------------------------------------------------------------- # Account for any user configuration options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; icc) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Set system-dependent options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed libraries: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed header files: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed typedefs, structures, and compiler characteristics: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed library functions: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/RandomObjects/COPYING.LESSER0000644000175000017500000001674311406203315017164 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/RandomObjects/.cvsignore0000755000175000017500000000007407746044120017137 0ustar olesolesMakefile.in configure aclocal.m4 autom4te.cache config.h.in clhep-2.1.4.1.orig/RandomObjects/COPYING0000644000175000017500000010451311406203315016161 0ustar olesoles GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/RandomObjects/test/0000755000175000017500000000000012242515142016104 5ustar olesolesclhep-2.1.4.1.orig/RandomObjects/test/testVectorDists.input0000755000175000017500000000017707707311440022353 0ustar olesoles2457913 20000 5 5 -200 -100 0 100 200 3 0 .1 -.1 .2 12 -.2 -.1 .1 .5 0 .05 20 1 10 1 clhep-2.1.4.1.orig/RandomObjects/test/Makefile.am0000755000175000017500000000530611406203315020144 0ustar olesoles# run gaussSpeed and gaussSmall interactively if USE_GMAKE MAKE = gmake endif # Applicable to each test program: INCLUDES = -I$(top_builddir)/ # libraries to link, and whence if BUILD_STATIC LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.a \ ${top_builddir}/../Random/src/libCLHEP-Random-@VERSION@.a \ ${top_builddir}/../Matrix/src/libCLHEP-Matrix-@VERSION@.a \ ${top_builddir}/../Vector/src/libCLHEP-Vector-@VERSION@.a OUTFLAG = -o $@ else if BUILD_VISUAL LDADD = $(top_builddir)/src/CLHEP-@PACKAGE@-@VERSION@.$(SHEXT) \ ${top_builddir}/../Random/src/CLHEP-Random-@VERSION@.$(SHEXT) \ ${top_builddir}/../Matrix/src/CLHEP-Matrix-@VERSION@.$(SHEXT) \ ${top_builddir}/../Vector/src/CLHEP-Vector-@VERSION@.$(SHEXT) OUTFLAG = /Fo$@ else LIBS += $(MY_LD)$(top_builddir)/src \ $(MY_LD)${top_builddir}/../Random/src \ $(MY_LD)${top_builddir}/../Matrix/src \ $(MY_LD)${top_builddir}/../Vector/src LDADD = $(top_builddir)/src/libCLHEP-@PACKAGE@-@VERSION@.$(SHEXT) \ ${top_builddir}/../Random/src/libCLHEP-Random-@VERSION@.$(SHEXT) \ ${top_builddir}/../Matrix/src/libCLHEP-Matrix-@VERSION@.$(SHEXT) \ ${top_builddir}/../Vector/src/libCLHEP-Vector-@VERSION@.$(SHEXT) OUTFLAG = -o $@ endif endif # normally, CXXLINK is supplied by automake, but we need to use /Fo instead # of -o when compiling with Visual C++ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ $(OUTFLAG) # Identify executables needed during testing: check_PROGRAMS = \ testVectorDists check_SCRIPTS = \ testVectorDists.sh # Identify test(s) to run when 'make check' is requested: TESTS = \ testVectorDists.sh # Identify the test(s) for which failure is the intended outcome: XFAIL_TESTS = # Identify the dependencies on a per-test basis: testVectorDists_SOURCES = testVectorDists.cc # Identify input data file(s) and prototype output file(s): EXTRA_DIST = \ testVectorDists.input testVectorDists.output # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = testVectorDists.sh # supply our own suffix rule .cc.obj: if BUILD_VISUAL # $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c $(OUTFLAG) `$(CYGPATH_W) '$<'` # mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po source='$<' object='$@' libtool=no \ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ $(CXXCOMPILE) -c $(OUTFLAG) `$(CYGPATH_W) '$<'` else if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c $(OUTFLAG) `$(CYGPATH_W) '$<'`; \ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi # source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ # $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` endif clhep-2.1.4.1.orig/RandomObjects/test/testVectorDists.sh.in0000755000175000017500000000023511776622027022235 0ustar olesoles#! /bin/sh # @configure_input@ ./testVectorDists@EXEEXT@ < "@srcdir@/testVectorDists.input" \ | @DIFF_Q@ - "@srcdir@/testVectorDists.output" > /dev/null clhep-2.1.4.1.orig/RandomObjects/test/testVectorDists.cc0000755000175000017500000002267607716514316021620 0ustar olesoles// $Id: testVectorDists.cc,v 1.2 2003/08/13 20:00:13 garren Exp $ // -*- C++ -*- // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // // testVectorDists -- tests of the correctness of vector random distributions // // Currently tested: // RandMultiGauss // // ---------------------------------------------------------------------- #include "CLHEP/RandomObjects/defs.h" #include "CLHEP/Random/Randomize.h" #include "CLHEP/RandomObjects/RandMultiGauss.h" #include "CLHEP/Matrix/SymMatrix.h" #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/Vector.h" #include using namespace std; using namespace CLHEP; static const int MultiGaussBAD = 1 << 0; static HepMatrix modifiedOutput(const HepMatrix& D) { HepMatrix DD (D); int n = DD.num_row(); int m = DD.num_col(); int i; int j; for ( i = 1; i <= n; ++i ) { for ( j = 1; j <= m; ++j ) { if ( DD(i,j)*DD(i,j) < 1.0e-24 * DD(i,i) * DD(j,j) ) DD (i,j) = 0; } } return DD; } // -------------- // RandMultiGauss // -------------- int testRandMultiGauss( ) { cout << "\n--------------------------------------------\n"; cout << "Test of RandMultiGauss distribution \n\n"; long seed; cout << "Please enter an integer seed: "; cin >> seed; int nvectors; cout << "How many vectors should we generate: "; cin >> nvectors; double rootn = sqrt((double)nvectors); int nMu; int nS; cout << "Enter the dimensions of mu, then S (normally the same): "; cin >> nMu >> nS; if ( nMu != nS ) { cout << "Usually mu and S will be of equal dimensions.\n"; cout << "You may be testing the behavior when that is not the case.\n"; cout << "Please verify by re-entering the correct dimensions: "; cin >> nMu >> nS; } int dim = (nMu >= nS) ? nMu : nS; HepVector mu(nMu); HepSymMatrix S(nS); cout << "Enter mu, one component at a time: \n"; int imu; double muElement; for (imu = 1; imu <= nMu; imu++) { cout << imu << ": "; cin >> muElement; mu(imu) = muElement; } cout << "Enter S, one white-space-separated row at a time. \n"; cout << "The length needed for each row is given in {braces}.\n"; cout << "The diagonal elements of S will be the first numbers on each line:\n"; int row, col; double sij; for (row = 1; row <= nS; row++) { cout << row << " {" << nS - row + 1 << " numbers}: "; for (col = row; col <= nS; col++) { cin >> sij; S(row, col) = sij; } } cout << "mu is: \n"; cout << mu; cout << endl; cout << "S is: \n"; cout << S << endl; HepSymMatrix tempS ( S ); // Since diagonalize does not take a const s // we have to copy S. HepMatrix U = diagonalize ( &tempS ); HepSymMatrix D = S.similarityT(U); cout << "D = Diagonalized S is " << modifiedOutput(D) << endl; bool pd = true; for ( int npd = 1; npd <= dim; npd++) { if ( D(npd,npd) < 0 ) { pd = false; } } if (!pd) { cout << "S is not positive definite.\n" << "The negative elements of D will have been raised to zero.\n" << "The second moment matrix at the end will not match S.\n"; } cout << "\nInstantiating distribution utilizing TripleRand engine...\n"; TripleRand eng (seed); RandMultiGauss dist (eng, mu, S); HepVector x(dim); cout << "\n Sample fire(): \n"; x = dist.fire(); cout << x; int ntrials; cout << "Normal operation will try a single group of " << nvectors << " random vectors.\n" << "Enter 1 for a single trial with " << nvectors << " random vectors.\n" << "Alternatively some number of groups of " << nvectors << " vectors can be produced to accumulate deviation statistics.\n" << "Enter " << 5000/(dim*(dim+1))+1 << " or some other number of trials to do this: "; cin >> ntrials; if (ntrials < 1) return 0; cout << "\n Testing fire() ... \n"; // I'm going to accumulate correlation matrix by equation (28.9) RPP // and compare to the specified matrix S. That is, E(x-)(y-) should // be Sxy. // // For off-diagonal terms, Sxy = - . // // For diagonal terms, Sxx = - ^2. HepSymMatrix Sumxy(nS); HepSymMatrix Dprime(dim); HepSymMatrix VarD(dim); HepSymMatrix Delta(dim); int ipr = nvectors / 10; if (ipr < 1) ipr = 1; int in1 = 0; int in2 = 0; int in3 = 0; int nentries = 0; float binno; int nbin; int bins[30]; int ix, iy; // double root2 = sqrt(2.0); double sumDelta = 0.0; double sumDelta2 = 0.0; int nunder = 0; int nover = 0; double worstDeviation=0; int k; for(k=0; k<30; ++k) { bins[k] = 0; } for(k=0; k abs(worstDeviation)) { worstDeviation = Delta(ix,iy); } } } } if( k == 0 ) { cout << "\nDifferences between each element and its normative value,\n" << "scaled by the expected deviation (sqrt(variance)) are: \n" << Delta << endl; } if( k == 0 ) { cout << "About 5% of the above values should have absolute value more than 2.\n" << "Deviations of more than 4 sigma would probably indicate a problem.\n"; } // Do a little counting for( ix=1; ix<=dim; ++ix ) { for( iy=ix; iy<=dim; ++iy ) { if( Delta(ix,iy) >= -1.0 && Delta(ix,iy) <= 1.0 ) in1++; if( Delta(ix,iy) >= -2.0 && Delta(ix,iy) <= 2.0 ) in2++; if( Delta(ix,iy) >= -3.0 && Delta(ix,iy) <= 3.0 ) in3++; sumDelta += Delta(ix,iy); sumDelta2 += Delta(ix,iy)*Delta(ix,iy); binno = 5.0*(Delta(ix,iy)+3.0); if( binno < 0.0 ) ++nunder; if( binno > 30.0 ) ++nover; if( binno >= 0.0 && binno < 30.0 ) { nbin = (int)binno; ++nentries; ++bins[nbin]; } } } } if (ntrials == 1) { cout << "The worst deviation of any element of D in this trial was " << worstDeviation << "\n"; if (abs(worstDeviation) > 4) { cout << "\nREJECT this distribution: \n" << "This value indicates a PROBLEM!!!!\n\n"; return MultiGaussBAD; } else { return 0; } } float ndf = ntrials*dim*(dim+1)/2.0; cout << "\nOut of a total of " << ndf << " entries" << endl; cout << "There are " << in1 << " within 1 sigma or " << 100.0*(float)in1/ndf << "%" << endl; cout << "There are " << in2 << " within 2 sigma or " << 100.0*(float)in2/ndf << "%" << endl; cout << "There are " << in3 << " within 3 sigma or " << 100.0*(float)in3/ndf << "%" << endl; double aveDelta = sumDelta/(double)ndf; double rmsDelta = sumDelta2/(double)ndf - aveDelta*aveDelta; cout << "\nFor dim = " << dim << " Average(Delta) = " << aveDelta << " RMS(Delta) = " << rmsDelta << endl; cout << "\nPoor man's histogram of deviations in 30 bins from -3.0 to 3.0" << endl; cout << "This should be a standard unit Gaussian.\n" << endl; for(k=0; k<30; ++k ) { cout << setw(3) << k+1 << " " << setw(4) << bins[k] << endl; } cout << "\nTotal number of entries in this histogram is " << nentries << endl; cout << "\twith " << nunder << " underflow(s) and " << nover << " overflow(s)" << endl; int status; cout << "The mean squared delta should be between .85 and 1.15; it is " << rmsDelta << "\n"; if( abs(rmsDelta-1.0) <= 0.15 ) { status = false; } else { cout << "REJECT this distribution based on improper spread of delta!\n"; status = MultiGaussBAD; } if (abs(worstDeviation)>4) { cout << "REJECT this distribution: Bad correlation in first trial!\n"; status = MultiGaussBAD; } return status; } // testRandMultiGauss() int main() { int mask = 0; mask |= testRandMultiGauss(); return mask; } clhep-2.1.4.1.orig/RandomObjects/test/.cvsignore0000755000175000017500000000001407707311440020107 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/RandomObjects/test/testVectorDists.output0000755000175000017500000000751507707311440022557 0ustar olesoles -------------------------------------------- Test of RandMultiGauss distribution Please enter an integer seed: How many vectors should we generate: Enter the dimensions of mu, then S (normally the same): Enter mu, one component at a time: 1: 2: 3: 4: 5: Enter S, one white-space-separated row at a time. The length needed for each row is given in {braces}. The diagonal elements of S will be the first numbers on each line: 1 {5 numbers}: 2 {4 numbers}: 3 {3 numbers}: 4 {2 numbers}: 5 {1 numbers}: mu is: -200 -100 0 100 200 S is: 3 0 0.1 -0.1 0.2 0 12 -0.2 -0.1 0.1 0.1 -0.2 0.5 0 0.05 -0.1 -0.1 0 20 1 0.2 0.1 0.05 1 10 D = Diagonalized S is 2.99718 0 0 0 0 0 0.492334 0 0 0 0 0 20.1004 0 0 0 0 0 9.90202 0 0 0 0 0 12.0081 Instantiating distribution utilizing TripleRand engine... Sample fire(): -199.86 -103.267 -0.53712 98.4656 203.077 Normal operation will try a single group of 20000 random vectors. Enter 1 for a single trial with 20000 random vectors. Alternatively some number of groups of 20000 vectors can be produced to accumulate deviation statistics. Enter 167 or some other number of trials to do this: Testing fire() ... 2000, 4000, 6000, 8000, 10000, 12000, 14000, 16000, 18000, 20000, Statistics for the first (or only) trial of 20000 vectors: Average (should match mu): -200.006 -99.9749 -0.00693214 100.036 200.006 Second Moments (should match S) 3.02249 -0.0287874 0.0932166 -0.208071 0.151289 -0.0287874 12.0915 -0.195875 -0.159708 0.0372991 0.0932166 -0.195875 0.501449 -0.00926436 0.0522026 -0.208071 -0.159708 -0.00926436 20.0929 0.944762 0.151289 0.0372991 0.0522026 0.944762 9.78683 Dprime = Second moment matrix transformed by the same matrix that diagonalized S 3.02011 -0.00802925 -0.109499 -0.0299176 -0.0297384 -0.00802925 0.494527 -0.00538167 0.00395511 0.00725938 -0.109499 -0.00538167 20.182 -0.0832379 -0.0697035 -0.0299176 0.00395511 -0.0832379 9.70731 -0.0730188 -0.0297384 0.00725938 -0.0697035 -0.0730188 12.0912 The expected variance for Dprime elements is 0.128991 0.0105608 0.430995 0.207303 0.258213 0.0105608 0.00345856 0.0705732 0.0339448 0.042281 0.430995 0.0705732 5.7603 1.38532 1.72552 0.207303 0.0339448 1.38532 1.33264 0.829954 0.258213 0.042281 1.72552 0.829954 2.06754 Differences between each element and its normative value, scaled by the expected deviation (sqrt(variance)) are: -0.759194 0.929145 1.98349 0.781415 0.695964 0.929145 -0.443391 0.24091 -0.255287 -0.419841 1.98349 0.24091 -0.404545 0.841016 0.631033 0.781415 -0.255287 0.841016 2.00585 0.953158 0.695964 -0.419841 0.631033 0.953158 -0.687596 About 5% of the above values should have absolute value more than 2. Deviations of more than 4 sigma would probably indicate a problem. The worst deviation of any element of D in this trial was 2.00585 clhep-2.1.4.1.orig/RandomObjects/test/CMakeLists.txt0000644000175000017500000000003711606714767020665 0ustar olesoles clhep_test( testVectorDists ) clhep-2.1.4.1.orig/RandomObjects/RandomObjects-config.in0000755000175000017500000000411112234340066021454 0ustar olesoles#! /bin/sh # @configure_input@ # we include the paths of the original install directories for reference orig_prefix="@prefix@" orig_exec_prefix="@exec_prefix@" orig_includedir="@includedir@" # use the full name of this script to get the current path configpath=`dirname ${0}` # check for a leading slash to determine if this is a relative path firstc=`expr ${configpath} : "\/"` calldir=`pwd` if [ ${firstc} -eq 0 ] then cd "${calldir}/${configpath}"; newpath=`pwd` binpath=${newpath} else binpath=${configpath} fi # OK - now we have to strip the trailing "/bin" out of the path prefix=`dirname "${binpath}"` includedir=${prefix}/include libdir=${prefix}/lib usage() { cat < * src/Makefile.am, test/Makefile.am: Build libraries for Windows Visual C++ without lib prefix. ============================== 22.06.05 Release CLHEP-2.0.2.1 ============================== Wed Jun 22 2005 Andreas Pfeiffer * configure.in: changed soname to install_name for darwin targets, dylibs still don't build properly on 10.3/10.4, static libs ok. 2005-06-19 Lynn Garren * configure.in, Makefile.am: Use lib when building Visual C++ libraries. Disable shared library build for Solaris CC. ============================== 22.04.05 Release CLHEP-2.0.2.0 ============================== 2005-04-07 Lynn Garren * configure.in: set AR and ARFLAGS 2005-02-18 Lynn Garren * configure.in, Makefile.am: Stop using libtool. The newer releases of libtool seem to have dropped support for Windows Visual C++. 2005-02-14 Lynn Garren * configure.in: Visual C++ flags are now "-EHsc -nologo -GR -GX -MD" 2005-02-03 Lynn Garren * configure.in: install step creates libCLHEP.a, libCLHEP.so, and/or libCLHEP.dylib by adding a symbolic link. 2005-02-02 Andreas PFEIFFER * configure.in: modified compiler flags for windows: added "-O -GR -GX -MD" as this is needed for the multi-thread environments used. ============================== 30.11.04 Release CLHEP-2.0.1.2 ============================== ============================== 27.10.04 Release CLHEP-2.0.1.1 ============================== Fri Sep 24 2004 Lynn Garren * use AM_CXXFLAGS * require autoconf 2.59, automake 1.9.1, and libtool 1.9b Tue Aug 31 2004 Lynn Garren * change Solaris CC compile flags from "-O -mt" to "-O" * libtools 1.9b or later is required for Solaris CC ============================== 23.07.04 Release CLHEP-2.0.1.0 ============================== ============================== 11.05.04 Release CLHEP-2.0.0.2 ============================== ============================== 11.05.04 Release CLHEP-1.9.0.2 ============================== ============================== 21.04.04 Release CLHEP-2.0.0.1 ============================== ============================== 24.10.03 Release CLHEP-2.0.0.0 ============================== ============================== 23.10.03 Release CLHEP-1.9.0.0 ============================== ============================== 01.06.02 Release CLHEP-1.8.0.0 ============================== ========================================= 25.04.02 revised StdHep uses HepMC ========================================= ========================================= 08.03.02 HepMC has become a part of CLHEP ========================================= ========================================== 09.11.01 HepPDT has become a part of CLHEP ========================================== ============================== 15.06.01 Release CLHEP-1.7.0.0 ============================== Fri Apr 6 11:53:19 2001 Evgueni Tcherniaev * test/Makefile.in: Removed testRandDists and ranRestoreTest: they have been moved to Random/test. * Makefile.in,configure.in: * test/testVectorDists.cc: * RandomObjects/RandMultiGauss.cc,RandomVector.cc,RandomVector.h: "Tools" has been changed to "RandomObjects". Wed Apr 4 10:06:03 2001 Mark Fischler * Tools/Makefile.in (Removed): * Tools/RandMultiGauss.cc,RandMultiGauss.h (Removed): * Tools/RandomVector.cc,RandomVector.h (Removed): * Tools/RandomVector.icc (Removed): * RandomObjects/Makefile.in (Added): * RandomObjects/RandMultiGauss.cc,RandMultiGauss.h (Added): * RandomObjects/RandomVector.cc,RandomVector.h (Added): * RandomObjects/RandomVector.icc (Added): As agreed, we migrate the Tools involving Random and another CLHEP package into a package which I have chosen to name RandomObjects. RandomObjects in principle depends on Random, Matrix, and Vecgtor (though the tools that depend on Vector are not yet present). ========================================================================== 18.01.01 ZOOM PhysicsVectors Capabilities have become part of CLHEP/Vector ========================================================================== ====================================================================== 24.10.00 Generic Functions by Joe Boudreau have become a part of CLHEP ====================================================================== ============================== 20.10.00 Release CLHEP-1.6.0.0 ============================== ============================================================================== 12.10.00 Expression Evaluator by Evgueni Tcherniaev has become a part of CLHEP Alist, String and Combination have been disabled ============================================================================== ============================== 08.05.00 Release CLHEP-1.5.0.0 ============================== ============================================================ 24.04.00 StdHepC++ by Lynn Garren has become a part of CLHEP ============================================================ ============================== 20.04.99 Release CLHEP-1.4.0.0 ============================== ========================================================================= 16.12.98 Started: merging with BaBar version of CLHEP provided by G.Cosmo ========================================================================= Fri Dec 11 11:58:09 1998 Evgueni Tcherniaev * config/CLHEP.h: * Matrix/Matrix.cc,Matrix.h,Vector.cc,Vector.h: * tests/testMatrix.cc: Introduced HEP_USE_VECTOR_MODULE flag to facilitate disabling dependence between the Matrix and Vector modules * Utilities/CLHEP.h: Added config/TemplateFuntions.h by request of G.Cosmo ========================== 28.07.98 Release CLHEP-1.3 ========================== ========================== 05.02.98 Release CLHEP-1.2 ========================== ======================================================== 08.12.97 Release CLHEP-1.1: Geant4 has migrated to CLHEP ======================================================== clhep-2.1.4.1.orig/RandomObjects/CMakeLists.txt0000644000175000017500000000047211607417635017704 0ustar olesoles# main RandomObjects cmake instructions # automake/autoconf variables set( PACKAGE RandomObjects ) # define dependency list that will be used in several places list(APPEND ${PACKAGE}_DEPS Random Matrix Vector ) clhep_package_config() add_subdirectory(RandomObjects) add_subdirectory(src) add_subdirectory(test) clhep-2.1.4.1.orig/RandomObjects/autotools/0000755000175000017500000000000012242515142017156 5ustar olesolesclhep-2.1.4.1.orig/RandomObjects/autotools/.cvsignore0000755000175000017500000000010107705060311021152 0ustar olesolesconfig.sub config.guess depcomp install-sh missing mkinstalldirs clhep-2.1.4.1.orig/RandomObjects/autotools/ltmain.sh0000755000175000017500000057547210234001037021015 0ustar olesoles# Generated from ltmain.in; do not edit by hand # ltmain.sh (GNU libtool) 1.9b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: powerpc-apple-darwin7.5.0 # shell: $SHELL # compiler: $LTCC # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 1.9b # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST elif test -n "${BASH_VERSION+set}${KSH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh dirname="s,/[^/]*$,," basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: PROGRAM=ltmain.sh progname=`echo "$progpath" | $SED "$basename"` # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *) progdir=`echo "$progpath" | $SED "$dirname"` progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; esac # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.9b TIMESTAMP="" package_revision=1.1571 # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $echo $progname${mode+: }$mode: warning: ${1+"$@"} 1>&2 } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } # func_version # Echo version message to standard output and exit. func_version () { $SED '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# //; s/^# *$//; s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED '/^# Usage:/,/# -h/ { s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" echo echo "run \`$progname --help | more' for full usage" exit $EXIT_SUCCESS } # func_help # Echo long help message to standard output and exit. func_help () { $SED '/^# Usage:/,/# Report bugs to/ { s/^# //; s/^# *$//; s:\$progname:'$progname':; s:\$SHELL:'"$SHELL"':; s:\$LTCC:'"$LTCC"':; s:\$LD:'"$LD"':; s/\$with_gnu_ld/'"$with_gnu_ld"'/; s/\$automake_version/'"`automake --version 2>/dev/null |$SED 1q`"'/; s/\$autoconf_version/'"`autoconf --version 2>/dev/null |$SED 1q`"'/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $EXIT_SUCCESS } # func_features # Display the features supported by this script. func_features () { $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable "`\"foo\"`", so we have to do # it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $echo \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $echo $echo "Try \`$progname --help' for more information about other modes." exit $EXIT_SUCCESS } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # sed scripts: my_sed_single_opt='1s/^\(..\).*$/\1/;q' my_sed_single_rest='1s/^..\(.*\)$/\1/;q' my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' exit_cmd=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set -- --mode clean ${1+"$@"} ;; compile|compil|compi|comp|com|co|c) shift; set -- --mode compile ${1+"$@"} ;; execute|execut|execu|exec|exe|ex|e) shift; set -- --mode execute ${1+"$@"} ;; finish|finis|fini|fin|fi|f) shift; set -- --mode finish ${1+"$@"} ;; install|instal|insta|inst|ins|in|i) shift; set -- --mode install ${1+"$@"} ;; link|lin|li|l) shift; set -- --mode link ${1+"$@"} ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set -- --mode uninstall ${1+"$@"} ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" set -x ;; --dlopen) test $# -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" ;; --dry-run | -n) run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test $# -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" show=: ;; --tag) test $# -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: --dlopen=*|--mode=*|--tag=*) arg=`echo "$opt" | $SED "$my_sed_long_arg"` opt=`echo "$opt" | $SED "$my_sed_long_opt"` set -- "$opt" "$arg" ${1+"$@"} ;; # Separate optargs to short options: # -x*|-y*) # arg=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "$arg" ${1+"$@"} # ;; # Separate non-argument short options: # -z*|-z*|-y*) # rest=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "-$rest" ${1+"$@"} # ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`echo "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$my_dlsyms" test -z "$run" && $echo > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do $show "extracting global C symbols from \`$progfile'" $run eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for dlprefile in $dlprefiles; do $show "extracting global C symbols from \`$dlprefile'" name=`$echo "$dlprefile" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ const struct { const char *originator; const struct { const char *name; void *address; } symbols[]; } lt_${my_prefix}_LTX_preloaded_symbols = {\ \"$my_originator\", { " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" $echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} } }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" status=$? if test "$status" -ne 0 && test ! -d "$my_xdir"; then exit $status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename $darwin_archive` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" # Remove the table of contents from the thin files. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" $AR -xo "${darwin_base_archive}" rm "${darwin_base_archive}" cd "$darwin_curdir" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist rm -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir (cd $my_xdir && $AR x $my_xabs) || exit $? fi # $darwin_arches fi # $run ;; *) # We will extract separately just the conflicting names and we will # no longer touch any unique names. It is faster to leave these # extract automatically by $AR in one run. $show "(cd $my_xdir && $AR x $my_xabs)" $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; renaming object files" func_warning "to ensure that they will not overwrite" $AR t "$my_xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_mode_compile arg... func_mode_compile () { # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1 || \ func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi } # func_mode_finish arg... func_mode_finish () { libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit $EXIT_SUCCESS } # func_mode_install arg... func_mode_install () { # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files test "$#" -gt 2 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. (${SED} -e '2q' $file | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1 || \ func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" $show "$relink_command" $run eval "$relink_command" || \ func_fatal_error "error: relink \`$file' with the above command before installing it" fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | $GREP "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. test -z "$notinst_deplibs" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask func_error "error: cannot create temporary directory \`$tmpdir'" continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" ${rm}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } # func_mode_link arg... func_mode_link () { case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static # See comment for -static flag below, for more details. compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" || \ func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else func_fatal_error "link input file \`$save_arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) # The effects of -all-static are defined in a previous loop. continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs $inherited_linker_flags" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *[\\/]*.la) . $lib ;; *.la) . ./$lib ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`echo "$deplib" |$SED "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$inherited_linker_flags " in *" $deplib "*) ;; * ) inherited_linker_flags="$inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $lib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not use here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib'" fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then : else func_fatal_error "\`$lib' is not a valid libtool archive" fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac case $host in *-*-darwin*) # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then inherited_linker_flags=`$echo "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` fi dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP "bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $echo "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "*** And there doesn't seem to be a static archive available" $echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs $inherited_linker_flags; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" eval darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//' | xargs` compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for archives" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath test "$#" -gt 2 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" test -n "$8" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "AGE \`$age' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | ${SED} 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null | ${SED} 10q | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` inherited_linker_flags=`$echo "X $inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$echo "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`echo "$output" | $SED $basename` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnk $echo "creating GNU ld script: $output" $echo 'INPUT (' > $output for obj in $save_libobjs do $echo \""$obj"\" >> $output done $echo ')' >> $output else $echo "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for objects" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; struct stat st; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$dlsymsobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; overriding AR_FLAGS to 'cq'" func_warning "to ensure that POSIX-compatible ar will work" AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS } # func_mode_uninstall arg... func_mode_uninstall () { rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done test -z "$rm" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 || (test -h "$file") >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status } ## ----------- ## ## Main. ## ## ----------- ## { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." case $mode in compile) func_mode_compile ${1+"$@"} ;; execute) func_mode_execute ${1+"$@"} ;; finish) func_mode_finish ${1+"$@"} ;; install) func_mode_install ${1+"$@"} ;; link|relink) func_mode_link ${1+"$@"} ;; uninstall|clean) func_mode_uninstall ${1+"$@"} ;; "") help="$generic_help" func_fatal_help "you must specify a MODE" ;; esac test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi } exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: clhep-2.1.4.1.orig/RandomObjects/RandomObjects/0000755000175000017500000000000012242515143017660 5ustar olesolesclhep-2.1.4.1.orig/RandomObjects/RandomObjects/cmake-defs.h.in0000644000175000017500000000172511607115601022441 0ustar olesoles/* @PACKAGE@/defs.h Generated by cmake. */ #ifndef @UPACKAGE@_DEFS_H #define @UPACKAGE@_DEFS_H /* Name of package */ #ifndef PACKAGE #define PACKAGE "@PACKAGE@" #endif /* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #define PACKAGE_BUGREPORT "http://savannah.cern.ch/projects/clhep/" #endif /* Define to the full name of this package. */ #ifndef PACKAGE_NAME #define PACKAGE_NAME "@PROJECT_NAME@ @PACKAGE@" #endif /* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #define PACKAGE_STRING "@PROJECT_NAME@ @PACKAGE@ @VERSION@" #endif /* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #define PACKAGE_TARNAME "@PACKAGE@" #endif /* Define to the version of this package. */ #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "@VERSION@" #endif /* Version number of package */ #ifndef VERSION #define VERSION "@VERSION@" #endif #endif // @UPACKAGE@_DEFS_H clhep-2.1.4.1.orig/RandomObjects/RandomObjects/RandomVector.icc0000755000175000017500000000477607705700163022772 0ustar olesoles// -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- HepRandomVector --- // inlined functions implementation file // ----------------------------------------------------------------------- // ======================================================================= // Mark Fischler - Created: 19th October 1998 // ======================================================================= namespace CLHEP { inline void HepRandomVector::setSeed(long seed, int lux) { theEngine->setSeed(seed,lux); } inline void HepRandomVector::setSeeds(const long* seeds, int aux) { theEngine->setSeeds(seeds,aux); } inline long HepRandomVector::getSeed() const { return theEngine->getSeed(); } inline const long* HepRandomVector::getSeeds() const { return theEngine->getSeeds(); } inline void HepRandomVector::saveStatus( const char filename[] ) const { theEngine->saveStatus( filename ); } inline void HepRandomVector::restoreStatus( const char filename[] ) { theEngine->restoreStatus( filename ); } inline void HepRandomVector::showStatus() const { theEngine->showStatus(); } // In analogy to the HepRandom class, we inline the following, even though now // they contain a loop to fill a vector and are thus more complicated. inline HepVector HepRandomVector::flat() { HepVector v; int i; for ( i = 0; i < v.num_row(); i++ ) { v[i] = theEngine->flat(); } // Instead of this loop, the engine's flatArray routine could be // used if there were a guarantee that the memory for the HepVector // is merely its members in order. But there is no such guarantee. return v; } inline void HepRandomVector::flatArray(const int size, HepVector* vect) { int n; int i; for ( n = 0; n < size; n++ ) { for ( i = 0; i < vect[n].num_row(); i++ ) { vect[n][i] = theEngine->flat(); // Here, the engine's flatArray routine is not good // to use because each element of vect is std:vector } } } inline HepVector HepRandomVector::flat(HepRandomEngine* theNewEngine) { HepVector v; int i; for ( i = 0; i < v.num_row(); i++ ) { v[i] = theNewEngine->flat(); } return v; } inline void HepRandomVector::flatArray(HepRandomEngine* theNewEngine, const int size, HepVector* vect) { int n; int i; for ( n = 0; n < size; n++ ) { for ( i = 0; i < vect[n].num_row(); i++ ) { vect[n][i] = theNewEngine->flat(); } } } } // namespace CLHEP clhep-2.1.4.1.orig/RandomObjects/RandomObjects/copy-header.pl.in0000755000175000017500000000164110043477203023030 0ustar olesoles#!/usr/bin/env perl # # copy a header into the temporary CLHEP header tree if # a) the header is not already there # b) the source is newer # if ($#ARGV != 1) { print "mungeit requires two arguments - exit\n"; exit; } else { $source_header=$ARGV[0]; $dest_header=$ARGV[1]; &check_header; } exit; sub check_header { # make sure source exists if ( ! -e $source_header ) { print "$source_header does not exist - exit\n"; exit; } # copy if not already there - otherwise, check the time stamp if ( ! -e $dest_header ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } else { $source_header_time = -M $source_header; $dest_header_time = -M $dest_header; # copy only if source is newer if( $source_header_time < $dest_header_time ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } } } clhep-2.1.4.1.orig/RandomObjects/RandomObjects/Makefile.am0000755000175000017500000000140210234001037021703 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@ COPY_P = @COPY_P@ pkginclude_HEADERS = \ RandMultiGauss.h \ RandomVector.h \ RandomVector.icc \ defs.h # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = defs.h # copy headers into $(tempincludedir) install-tmpHEADERS: @echo " install headers in $(tempincludedir) " @list='$(pkginclude_HEADERS)'; \ if test $(tempincludedir); then \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ ./copy-header.pl $$d$$p $(tempincludedir)/$$f; \ done; \ fi; test -z "$$fail" clhep-2.1.4.1.orig/RandomObjects/RandomObjects/RandMultiGauss.h0000755000175000017500000001214607746044120022747 0ustar olesoles// $Id: RandMultiGauss.h,v 1.3 2003/10/23 21:29:51 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandMultiGauss --- // class header file // ----------------------------------------------------------------------- // Class defining methods for firing multivariate gaussian distributed // random values, given a vector of means and a covariance matrix // Definitions are those from 1998 Review of Particle Physics, section 28.3.3. // // This utilizes the following other comonents of CLHEP: // RandGauss from the Random package to get individual deviates // HepVector, HepSymMatrix and HepMatrix from the Matrix package // HepSymMatrix::similarity(HepMatrix) // diagonalize(HepSymMatrix *s) // The author of this distribution relies on diagonalize() being correct. // // Although original distribution classes in the Random package return a // double when fire() (or operator()) is done, RandMultiGauss returns a // HepVector of values. // // ======================================================================= // Mark Fischler - Created: 19th September 1999 // ======================================================================= #ifndef RandMultiGauss_h #define RandMultiGauss_h 1 #include "CLHEP/RandomObjects/defs.h" #include "CLHEP/Random/RandomEngine.h" #include "CLHEP/RandomObjects/RandomVector.h" #include "CLHEP/Matrix/Vector.h" #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/SymMatrix.h" namespace CLHEP { /** * @author Mark Fischler * @ingroup robjects */ class RandMultiGauss : public HepRandomVector { public: RandMultiGauss ( HepRandomEngine& anEngine, const HepVector& mu, const HepSymMatrix& S ); // The symmetric matrix S MUST BE POSITIVE DEFINITE // and MUST MATCH THE SIZE OF MU. RandMultiGauss ( HepRandomEngine* anEngine, const HepVector& mu, const HepSymMatrix& S ); // The symmetric matrix S MUST BE POSITIVE DEFINITE // and MUST MATCH THE SIZE OF MU. // These constructors should be used to instantiate a RandMultiGauss // distribution object defining a local engine for it. // The static generator will be skipped using the non-static methods // defined below. // If the engine is passed by pointer the corresponding engine object // will be deleted by the RandMultiGauss destructor. // If the engine is passed by reference the corresponding engine object // will not be deleted by the RandGauss destructor. // The following are provided for convenience in the case where each // random fired will have a different mu and S. They set the default mu // to the zero 2-vector, and the default S to the Unit 2x2 matrix. RandMultiGauss ( HepRandomEngine& anEngine ); RandMultiGauss ( HepRandomEngine* anEngine ); virtual ~RandMultiGauss(); // Destructor HepVector fire(); HepVector fire( const HepVector& mu, const HepSymMatrix& S ); // The symmetric matrix S MUST BE POSITIVE DEFINITE // and MUST MATCH THE SIZE OF MU. // A note on efficient usage when firing many vectors of Multivariate // Gaussians: For n > 2 the work needed to diagonalize S is significant. // So if you only want a collection of uncorrelated Gaussians, it will be // quicker to generate them one at a time. // // The class saves the diagonalizing matrix for the default S. // Thus generating vectors with that same S can be quite efficient. // If you require a small number of different S's, known in // advance, consider instantiating RandMulitGauss for each different S, // sharing the same engine. // // If you require a random using the default S for a distribution but a // different mu, it is most efficient to imply use the default fire() and // add the difference of the mu's to the returned HepVector. void fireArray ( const int size, HepVector* array); void fireArray ( const int size, HepVector* array, const HepVector& mu, const HepSymMatrix& S ); HepVector operator()(); HepVector operator()( const HepVector& mu, const HepSymMatrix& S ); // The symmetric matrix S MUST BE POSITIVE DEFINITE // and MUST MATCH THE SIZE OF MU. private: // Private copy constructor. Defining it here disallows use. RandMultiGauss(const RandMultiGauss &d); HepRandomEngine* localEngine; bool deleteEngine; HepVector defaultMu; HepMatrix defaultU; HepVector defaultSigmas; // Each sigma is sqrt(D[i,i]) bool set; double nextGaussian; static void prepareUsigmas ( const HepSymMatrix & S, HepMatrix & U, HepVector & sigmas ); static HepVector deviates ( const HepMatrix & U, const HepVector & sigmas, HepRandomEngine * engine, bool& available, double& next); // Returns vector of gaussian randoms based on sigmas, rotated by U, // with means of 0. }; } // namespace CLHEP #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif // RandMultiGauss_h clhep-2.1.4.1.orig/RandomObjects/RandomObjects/.cvsignore0000755000175000017500000000002607705453233021672 0ustar olesolesMakefile.in defs.h.in clhep-2.1.4.1.orig/RandomObjects/RandomObjects/RandomVector.h0000755000175000017500000001022507746044120022444 0ustar olesoles// -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- HepRandomVector --- // class header file // ----------------------------------------------------------------------- // This file is part of CLHEP, extended to match the distributions in RPP. // // It's exactly analogous to HepRandom except that the return types for // the fire() and related methods are std::vector instead of // double. // // Distribution classes returning HepVectors of results inherit from // HepRandomVector instead of HepRandom. // // HepVector is used instead of the more modern looking // std::vector because the motivating sub-class // RandMultiGauss uses HepMatrix to supply the correlation // matrix S anyway. Given that, we might as well stick to // HepVector when a vector of numbers is needed, as well. // // ======================================================================= // Mark Fischler - Created: 19 Oct, 1998 // 10/20/98 - Removed all shoot-related material // ======================================================================= #ifndef HepRandomVector_h #define HepRandomVector_h 1 #include "CLHEP/RandomObjects/defs.h" #include "CLHEP/Random/RandomEngine.h" #include "CLHEP/Matrix/Vector.h" namespace CLHEP { /** * @author Mark Fischler * @ingroup robjects */ class HepRandomVector { public: HepRandomVector(); HepRandomVector(long seed); // Contructors with and without a seed using a default engine // (JamesRandom) which is instantiated for use of this distribution // instance. If the seed is omitted, multiple instantiations will // each get unique seeds. HepRandomVector(HepRandomEngine & engine); HepRandomVector(HepRandomEngine * engine); // Constructor taking an alternative engine as argument. If a pointer is // given the corresponding object will be deleted by the HepRandom // destructor. virtual ~HepRandomVector(); // Destructor inline HepVector flat(); // Returns vector of flat values ( interval ]0.1[ ). inline HepVector flat (HepRandomEngine* theNewEngine); // Returns a vector of flat values, given a defined Random Engine. inline void flatArray(const int size, HepVector* vect); // Fills "vect" array of flat random values, given the size. // Included for consistency with the HepRandom class. inline void flatArray(HepRandomEngine* theNewEngine, const int size, HepVector* vect); // Fills "vect" array of flat random values, given the size // and a defined Random Engine. virtual HepVector operator()(); // To get a flat random number using the operator (). private: // -------- Private methods --------- inline void setSeed(long seed, int lux); // (Re)Initializes the generator with a seed. inline long getSeed() const; // Gets the current seed of the current generator. inline void setSeeds(const long* seeds, int aux); // (Re)Initializes the generator with a zero terminated list of seeds. inline const long* getSeeds () const; // Gets the current array of seeds of the current generator. void setEngine (HepRandomEngine* engine) { theEngine = engine; } // To set the underlying algorithm object HepRandomEngine * getEngine() const { return theEngine; } // Returns a pointer to the underlying algorithm object. void saveStatus( const char filename[] = "Config.conf" ) const; // Saves to file the current status of the current engine. void restoreStatus( const char filename[] = "Config.conf" ); // Restores a saved status (if any) for the current engine. void showStatus() const; // Dumps the current engine status on screen. protected: // -------- Data members --------- HepRandomEngine * theEngine; // The corresponding algorithm. private: // -------- Data members --------- bool deleteEngine; // True if the engine should be deleted on destruction. }; } // namespace CLHEP #include "CLHEP/RandomObjects/RandomVector.icc" #ifdef ENABLE_BACKWARDS_COMPATIBILITY // backwards compatibility will be enabled ONLY in CLHEP 1.9 using namespace CLHEP; #endif #endif clhep-2.1.4.1.orig/RandomObjects/RandomObjects/CMakeLists.txt0000644000175000017500000000035411606714767022442 0ustar olesoles set( pkginclude_HEADERS RandMultiGauss.h RandomVector.h RandomVector.icc ) # notice that defs.h is not referenced here INSTALL (FILES ${pkginclude_HEADERS} DESTINATION include/CLHEP/RandomObjects ) clhep-2.1.4.1.orig/RandomObjects/src/0000755000175000017500000000000012242515142015714 5ustar olesolesclhep-2.1.4.1.orig/RandomObjects/src/Makefile.am0000755000175000017500000000371711406203315017760 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir) -I$(top_srcdir) libCLHEP_RandomObjects_@VERSION@_a_SOURCES = \ RandMultiGauss.cc \ RandomVector.cc libCLHEP_RandomObjects_@VERSION@_so_OBJECTS = $(patsubst %.cc,$(shareddir)/%.$(OBJEXT),$(libCLHEP_RandomObjects_@VERSION@_a_SOURCES)) # these if/else blocks will be parsed by automake and translated if BUILD_SHARED shareddir = shared if BUILD_VISUAL lib_shared = CLHEP-RandomObjects-@VERSION@.$(SHEXT) else lib_shared = libCLHEP-RandomObjects-@VERSION@.$(SHEXT) LDADD = -L${top_builddir}/../Random/src -lCLHEP-Random-@VERSION@ \ -L${top_builddir}/../Matrix/src -lCLHEP-Matrix-@VERSION@ \ -L${top_builddir}/../Vector/src -lCLHEP-Vector-@VERSION@ endif SHFLAGS = @MY_SHFLAGS@ SHLINK = @MY_SHLINK@ @MY_SHEXTRA@ SHNAME = @MY_SHNAME@ endif if BUILD_STATIC lib_LIBRARIES = libCLHEP-RandomObjects-@VERSION@.a endif CLEANFILES = $(lib_shared) all-local: $(shareddir) $(lib_shared) $(shareddir): test -d $(shareddir) || mkdir $(shareddir) if BUILD_VISUAL $(lib_shared): $(libCLHEP_RandomObjects_@VERSION@_so_OBJECTS) $(SHLINK) $(SHNAME)$@ $(libCLHEP_RandomObjects_@VERSION@_so_OBJECTS) $(LDADD) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) /c /Fo$@ $< else $(lib_shared): $(libCLHEP_RandomObjects_@VERSION@_so_OBJECTS) $(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_RandomObjects_@VERSION@_so_OBJECTS) $(LDADD) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) -c -o $@ $< endif install-exec-local: $(lib_shared) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_shared)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$p'"; \ $(INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done clean-local: -test -d $(shareddir) && rm -f $(shareddir)/*.$(OBJEXT) distclean-local: -test -d $(shareddir) && rm -rf ./$(shareddir) clhep-2.1.4.1.orig/RandomObjects/src/.cvsignore0000755000175000017500000000001407705453233017724 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/RandomObjects/src/RandMultiGauss.cc0000755000175000017500000002062307716514316021147 0ustar olesoles// $Id: RandMultiGauss.cc,v 1.3 2003/08/13 20:00:13 garren Exp $ // -*- C++ -*- // // ----------------------------------------------------------------------- // HEP Random // --- RandMultiGauss --- // class implementation file // ----------------------------------------------------------------------- // ======================================================================= // Mark Fischler - Created: 17th September 1998 // ======================================================================= // Some theory about how to get the Multivariate Gaussian from a bunch // of Gaussian deviates. For the purpose of this discussion, take mu = 0. // // We want an n-vector x with distribution (See table 28.1 of Review of PP) // // exp ( .5 * x.T() * S.inverse() * x ) // f(x;S) = ------------------------------------ // sqrt ( (2*pi)^n * S.det() ) // // Suppose S = U * D * U.T() with U orthogonal ( U*U.T() = 1 ) and D diagonal. // Consider a random n-vector y such that each element y(i)is distributed as a // Gaussian with sigma = sqrt(D(i,i)). Then the distribution of y is the // product of n Gaussains which can be written as // // exp ( .5 * y.T() * D.inverse() * y ) // f(y;D) = ------------------------------------ // sqrt ( (2*pi)^n * D.det() ) // // Now take an n-vector x = U * y (or y = U.T() * x ). Then substituting, // // exp ( .5 * x * U * D.inverse() U.T() * x ) // f(x;D,U) = ------------------------------------------ // sqrt ( (2*pi)^n * D.det() ) // // and this simplifies to the desired f(x;S) when we note that // D.det() = S.det() and U * D.inverse() * U.T() = S.inverse() // // So the strategy is to diagonalize S (finding U and D), form y with each // element a Gaussian random with sigma of sqrt(D(i,i)), and form x = U*y. // (It turns out that the D information needed is the sigmas.) // Since for moderate or large n the work needed to diagonalize S can be much // greater than the work to generate n Gaussian variates, we save the U and // sigmas for both the default S and the latest S value provided. #include "CLHEP/RandomObjects/RandMultiGauss.h" #include "CLHEP/RandomObjects/defs.h" #include // for log() namespace CLHEP { // ------------ // Constructors // ------------ RandMultiGauss::RandMultiGauss( HepRandomEngine & anEngine, const HepVector & mu, const HepSymMatrix & S ) : localEngine(&anEngine), deleteEngine(false), set(false), nextGaussian(0.0) { if (S.num_row() != mu.num_row()) { std::cerr << "In constructor of RandMultiGauss distribution: \n" << " Dimension of mu (" << mu.num_row() << ") does not match dimension of S (" << S.num_row() << ")\n"; std::cerr << "---Exiting to System\n"; exit(1); } defaultMu = mu; defaultSigmas = HepVector(S.num_row()); prepareUsigmas (S, defaultU, defaultSigmas); } RandMultiGauss::RandMultiGauss( HepRandomEngine * anEngine, const HepVector & mu, const HepSymMatrix & S ) : localEngine(anEngine), deleteEngine(true), set(false), nextGaussian(0.0) { if (S.num_row() != mu.num_row()) { std::cerr << "In constructor of RandMultiGauss distribution: \n" << " Dimension of mu (" << mu.num_row() << ") does not match dimension of S (" << S.num_row() << ")\n"; std::cerr << "---Exiting to System\n"; exit(1); } defaultMu = mu; defaultSigmas = HepVector(S.num_row()); prepareUsigmas (S, defaultU, defaultSigmas); } RandMultiGauss::RandMultiGauss( HepRandomEngine & anEngine ) : localEngine(&anEngine), deleteEngine(false), set(false), nextGaussian(0.0) { defaultMu = HepVector(2,0); defaultU = HepMatrix(2,1); defaultSigmas = HepVector(2); defaultSigmas(1) = 1.; defaultSigmas(2) = 1.; } RandMultiGauss::RandMultiGauss( HepRandomEngine * anEngine ) : localEngine(anEngine), deleteEngine(true), set(false), nextGaussian(0.0) { defaultMu = HepVector(2,0); defaultU = HepMatrix(2,1); defaultSigmas = HepVector(2); defaultSigmas(1) = 1.; defaultSigmas(2) = 1.; } RandMultiGauss::~RandMultiGauss() { if ( deleteEngine ) delete localEngine; } // ---------------------------- // prepareUsigmas() // ---------------------------- void RandMultiGauss::prepareUsigmas( const HepSymMatrix & S, HepMatrix & U, HepVector & sigmas ) { HepSymMatrix tempS ( S ); // Since diagonalize does not take a const s // we have to copy S. U = diagonalize ( &tempS ); // S = U Sdiag U.T() HepSymMatrix D = S.similarityT(U); // D = U.T() S U = Sdiag for (int i = 1; i <= S.num_row(); i++) { double s2 = D(i,i); if ( s2 > 0 ) { sigmas(i) = sqrt ( s2 ); } else { std::cerr << "In RandMultiGauss distribution: \n" << " Matrix S is not positive definite. Eigenvalues are:\n"; for (int ixx = 1; ixx <= S.num_row(); ixx++) { std::cerr << " " << D(ixx,ixx) << std::endl; } std::cerr << "---Exiting to System\n"; exit(1); } } } // prepareUsigmas // ----------- // deviates() // ----------- HepVector RandMultiGauss::deviates ( const HepMatrix & U, const HepVector & sigmas, HepRandomEngine * engine, bool& available, double& next) { // Returns vector of gaussian randoms based on sigmas, rotated by U, // with means of 0. int n = sigmas.num_row(); HepVector v(n); // The vector to be returned double r,v1,v2,fac; int i = 1; if (available) { v(1) = next; i = 2; available = false; } while ( i <= n ) { do { v1 = 2.0 * engine->flat() - 1.0; v2 = 2.0 * engine->flat() - 1.0; r = v1*v1 + v2*v2; } while ( r > 1.0 ); fac = sqrt(-2.0*log(r)/r); v(i++) = v1*fac; if ( i <= n ) { v(i++) = v2*fac; } else { next = v2*fac; available = true; } } for ( i = 1; i <= n; i++ ) { v(i) *= sigmas(i); } return U*v; } // deviates() // --------------- // fire signatures // --------------- HepVector RandMultiGauss::fire() { // Returns a pair of unit normals, using the S and mu set in constructor, // utilizing the engine belonging to this instance of RandMultiGauss. return defaultMu + deviates ( defaultU, defaultSigmas, localEngine, set, nextGaussian ); } // fire(); HepVector RandMultiGauss::fire( const HepVector& mu, const HepSymMatrix& S ) { HepMatrix U; HepVector sigmas; if (mu.num_row() == S.num_row()) { prepareUsigmas ( S, U, sigmas ); return mu + deviates ( U, sigmas, localEngine, set, nextGaussian ); } else { std::cerr << "In firing RandMultiGauss distribution with explicit mu and S: \n" << " Dimension of mu (" << mu.num_row() << ") does not match dimension of S (" << S.num_row() << ")\n"; std::cerr << "---Exiting to System\n"; exit(1); } return mu; // This line cannot be reached. But without returning // some HepVector here, KCC 3.3 complains. } // fire(mu, S); // -------------------- // fireArray signatures // -------------------- void RandMultiGauss::fireArray( const int size, HepVector* array ) { int i; for (i = 0; i < size; ++i) { array[i] = defaultMu + deviates ( defaultU, defaultSigmas, localEngine, set, nextGaussian ); } } // fireArray ( size, vect ) void RandMultiGauss::fireArray( const int size, HepVector* array, const HepVector& mu, const HepSymMatrix& S ) { // For efficiency, we diagonalize S once and generate all the vectors based // on that U and sigmas. HepMatrix U; HepVector sigmas; HepVector mu_ (mu); if (mu.num_row() == S.num_row()) { prepareUsigmas ( S, U, sigmas ); } else { std::cerr << "In fireArray for RandMultiGauss distribution with explicit mu and S: \n" << " Dimension of mu (" << mu.num_row() << ") does not match dimension of S (" << S.num_row() << ")\n"; std::cerr << "---Exiting to System\n"; exit(1); } int i; for (i=0; i /configure --prefix= (Note that files will be installed under /usr/local if you do not specify a prefix.) make (Build temporary copies of libraries and executables.) make check (Run the tests.) make install (Copy libraries, headers, executables, etc. to relevant subdirectories under .) #------------------------------------------------------------- # configure options #------------------------------------------------------------- A variety of options can be given to configure. Below is a list of the options that you are likely to find most useful. --help provides a partial list of options --prefix=PREFIX install architecture-independent files in PREFIX [default is /usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [default is the same as PREFIX] --disable-shared build only static libraries --disable-static build only shared libraries --enable-exceptions use the CLHEP/Exceptions package --disable-exceptions DO NOT use the CLHEP/Exceptions package [--disable-exceptions is the default] #------------------------------------------------------------- # building documents #------------------------------------------------------------- Documents are neither built nor installed automatically. Use the following commands to build and install documents: make docs make install-docs #------------------------------------------------------------- # building from cvs #------------------------------------------------------------- You will need current versions of automake, autoconf, and libtool. See building autotools below. cvs co CLHEP/package OR cvs co package cd [CLHEP/]package ./bootstrap Now continue with directions as if you unpacked a source code tarball. #------------------------------------------------------------- # building autotools #------------------------------------------------------------- If you do not have at least autoconf 2.59 and automake 1.9.1, you will need to build autoconf, automake, and libtool. On some platforms, you may also need to build m4 and texinfo. Download the relevant tarballs from gnu.org (http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/, and http://www.gnu.org/software/libtool/) Untar them in a common source code tree. Decide whether you want to install them in /usr/local or your own install directory. If you use your own install directory, use --prefix= with configure. For each autotool package: /configure [--prefix=] make make install Make sure that /bin is at the front of your path. #------------------------------------------------------------- clhep-2.1.4.1.orig/RefCount/Makefile.am0000755000175000017500000000446210233774336016177 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP # put . first so that CLHEP directory is built before anything else SUBDIRS = RefCount . src # list all subdirectories - for distribution and cleaning DIST_SUBDIRS = RefCount . src bin_SCRIPTS = RefCount-config all-local: $(top_builddir)/CLHEP # create temporary CLHEP header tree # we only copy headers for packages listed in @PACKAGE@-deps # search for header directories in the following order: # 1. $(top_builddir)/this-package # 2. $(top_builddir)/../other-packages # 3. $(CLHEPSOURCE_DIR)/CLHEP # 4. $(CLHEP_DIR)/include/CLHEP # # abs_ => absolute path abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ COPY_P = @COPY_P@ $(top_builddir)/CLHEP: temp-package-dirs @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ if test -d "$$pkg" ; then \ (cd $$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d ../"$$pkg"/"$$pkg" ; then \ (cd ../$$pkg/$$pkg && $(MAKE) $(AM_MAKEFLAGS) TEMPDIR=$(abs_top_builddir) install-tmpHEADERS) || exit 1 ; \ else \ if test -d $(CLHEPSOURCE_DIR)/CLHEP/"$$pkg"/"$$pkg"; then \ hdrs=`ls $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEPSOURCE_DIR)/CLHEP/$$pkg/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ else \ if test -n "$(CLHEP_DIR)" && test -d $(CLHEP_DIR)/include/CLHEP; then \ if test -d $(CLHEP_DIR)/include/CLHEP/"$$pkg"; then \ hdrs=`ls $(CLHEP_DIR)/include/CLHEP/$$pkg`; \ for hdr in $$hdrs; do $(COPY_P) $(CLHEP_DIR)/include/CLHEP/$$pkg/$$hdr $(abs_top_builddir)/CLHEP/$$pkg/$$hdr; done; \ fi; \ fi; \ fi; \ fi; \ fi; \ done; temp-package-dirs: $(mkinstalldirs) $(abs_top_builddir)/CLHEP; @list="`cat @PACKAGE@-deps | sed s/CLHEP-@PACKAGE@-@VERSION@// | sed s/CLHEP-// | sed s/-@VERSION@//`"; \ for pkg in $$list; do \ $(mkinstalldirs) $(abs_top_builddir)/CLHEP/$$pkg; \ done; docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs: cd doc; $(MAKE) $(AM_MAKEFLAGS) install-docs # extra clean rule clean-local: rm -rf $(top_builddir)/CLHEP clhep-2.1.4.1.orig/RefCount/bootstrap0000755000175000017500000000071510233774336016100 0ustar olesoles#! /bin/sh set -x # cleanup should not be necessary # however, in some cases strange results are found if you do not start clean rm -rf autom4te.cache rm -f aclocal.m4 rm -f Makefile.in */Makefile.in */defs.h.in rm -f autotools/config* autotools/depcomp autotools/install-sh autotools/m* rm -f configure config.* # run autotool commands aclocal -I autotools autoheader automake --add-missing --copy autoconf # ready to make a source code distribution tarball clhep-2.1.4.1.orig/RefCount/configure.ac0000755000175000017500000002677512241267303016434 0ustar olesoles# ====================================================================== # This is the RefCount configuration input file # Process this file with autoconf to produce a configure script. # ====================================================================== # ---------------------------------------------------------------------- # Identify the package and initialize the autotools: # ---------------------------------------------------------------------- AC_PREREQ(2.59) AC_INIT(CLHEP RefCount, 2.1.4.1, http://savannah.cern.ch/projects/clhep/, RefCount) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([src/ZMuseCount.cc]) AM_INIT_AUTOMAKE(1.9 foreign) AC_PROG_LN_S AC_PROG_INSTALL AC_PROG_RANLIB # ---------------------------------------------------------------------- # --enable-shared and --enable-static # both shared and static libraries are built by default # ---------------------------------------------------------------------- AC_ARG_ENABLE(shared, AC_HELP_STRING([--disable-shared],[do not build shared libraries]), [case "${enableval}" in yes) build_shared="yes";; no) build_shared="no";; *) build_shared="yes";; esac], [build_shared="yes"]) AC_ARG_ENABLE(static, AC_HELP_STRING([--disable-static],[do not build static libraries]), [case "${enableval}" in yes) build_static="yes";; no) build_static="no";; *) build_static="yes";; esac], [build_static="yes"]) AC_ARG_ENABLE(visual, AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]), [case "${enableval}" in yes) build_visual="yes";; no) build_visual="no";; *) build_visual="no";; esac], [build_visual="no"]) AC_ARG_ENABLE(gmake, AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]), [case "${enableval}" in yes) use_gmake="yes";; no) use_gmake="no";; *) use_gmake="no";; esac], [use_gmake="no"]) # ---------------------------------------------------------------------- # Identify the files that 'configure' is to produce: # ---------------------------------------------------------------------- # Header containing #defines: AM_CONFIG_HEADER([RefCount/defs.h]) # Makefiles: AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([RefCount/Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([RefCount-deps]) AC_CONFIG_FILES([RefCount/copy-header.pl], [chmod +x RefCount/copy-header.pl]) # Configuration inquiry program/script: AC_CONFIG_FILES([RefCount-config], [chmod +x RefCount-config]) # ---------------------------------------------------------------------- # Capture post-install information: # ---------------------------------------------------------------------- RefCount_CPPFLAGS="-I$includedir" RefCount_LDFLAGS="-L$libdir" RefCount_LIBS="-lCLHEP-$PACKAGE-$VERSION" AC_SUBST(RefCount_CPPFLAGS) AC_SUBST(RefCount_LIBS) AC_SUBST(RefCount_LDFLAGS) # ---------------------------------------------------------------------- # Supply boilerplate for RefCount/defs.h source header: # ---------------------------------------------------------------------- AH_TOP([#ifndef REFCOUNT_DEFS_H #define REFCOUNT_DEFS_H]) ## the undefs are converted by configure AH_VERBATIM([PACKAGE],[/* Name of package */ #ifndef PACKAGE #undef PACKAGE #endif]) AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif]) AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */ #ifndef PACKAGE_NAME #undef PACKAGE_NAME #endif]) AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #undef PACKAGE_STRING #endif]) AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #undef PACKAGE_TARNAME #endif]) AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */ #ifndef PACKAGE_VERSION #undef PACKAGE_VERSION #endif]) AH_VERBATIM([VERSION],[/* Version number of package */ #ifndef VERSION #undef VERSION #endif]) AH_BOTTOM([#endif // REFCOUNT_DEFS_H]) # ---------------------------------------------------------------------- # Account for any user configuration options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed programs: # ---------------------------------------------------------------------- # Locate a C++ compiler: AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp) # Use it hereinafter: AC_LANG(C++) # Ensure we've found a preprocessor: AC_REQUIRE_CPP # copy and diff case "$target" in *-*-win32*) COPY_P="copy -p";DIFF_Q="diff -q -b" ;; *-*-cygwin*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *-*-solaris*) COPY_P="cp -p";DIFF_Q="diff -b" use_gmake="yes" ;; *-*-linux*) COPY_P="cp -p";DIFF_Q="diff -q -b" ;; *) COPY_P="cp -p";DIFF_Q="diff -q -b" esac AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes) AC_SUBST(COPY_P) AC_SUBST(DIFF_Q) # worry about compiler flags case "$CXX" in g++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; g++4) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; c++) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" ;; *-*-darwin*) AM_CXXFLAGS="-O -pedantic -Wall" MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" ;; *-*-cygwin*) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-DPIC"; SHEXT=dll MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive" MY_SHLINKEXTRA="-Wl,--no-whole-archive" MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl," AR="ar"; ARFLAGS="cru" build_static="yes" build_shared="no" ;; *) AM_CXXFLAGS="-O -ansi -pedantic -Wall" MY_SHFLAGS="-fPIC -DPIC" MY_SHLINK="-shared -Wl,--no-undefined" MY_SHNAME="-Wl,-soname," MY_LD="-Wl,--rpath -Wl," SHEXT=so AR="ar"; ARFLAGS="cru" esac;; icc) case "$target" in *-*-linux*) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" ;; *) AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1" AM_LDFLAGS="-lstdc++" MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl," AR="xiar"; ARFLAGS="cru" esac;; cl) AM_CXXFLAGS="-EHsc -nologo -GR -MD" AR="ar"; ARFLAGS="cru" MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib MY_SHNAME="/OUT:"; MY_LD=" " build_static="no" build_shared="yes" build_visual="yes" CXXFLAGS=" " AC_SUBST(CXXFLAGS) ;; CC) case "$target" in *-*-solaris*) AM_CXXFLAGS="-O" MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so MY_SHNAME="-h"; MY_LD="-R" AM_LDFLAGS="-lsunmath" AR="CC"; ARFLAGS="-xar -o" build_shared="no" ;; *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target esac;; aCC) AM_CXXFLAGS="-O -Aa +DAportable +Onolimit" AR="ar"; ARFLAGS="cru" build_shared="no" ;; cxx) AM_CXXFLAGS="-O -std strict_ansi -timplicit_local" AR="ar"; ARFLAGS="cru" build_shared="no" ;; xlC) AM_CXXFLAGS="-O3 -qtwolink -+" AR="ar"; ARFLAGS="cru" build_shared="no" ;; *) echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX esac AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes) AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes) AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_LDFLAGS) AC_SUBST(MY_SHFLAGS) AC_SUBST(MY_SHLINK) AC_SUBST(MY_SHNAME) AC_SUBST(MY_LD) AC_SUBST(SHEXT) AC_SUBST(AR) AC_SUBST(ARFLAGS) # ---------------------------------------------------------------------- # Check for supported link flags # ---------------------------------------------------------------------- AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"]) AC_SUBST(MY_SHEXTRA) # ---------------------------------------------------------------------- # Set system-dependent options: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed libraries: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed header files: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed typedefs, structures, and compiler characteristics: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Check for needed library functions: # ---------------------------------------------------------------------- # ---------------------------------------------------------------------- # Finish up: # ---------------------------------------------------------------------- AC_OUTPUT # ====================================================================== clhep-2.1.4.1.orig/RefCount/COPYING.LESSER0000644000175000017500000001674311406203315016157 0ustar olesoles GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. clhep-2.1.4.1.orig/RefCount/RefCount-deps.in0000755000175000017500000000023110043522306017122 0ustar olesolesCLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-Cast-@VERSION@ CLHEP-@PACKAGE@-@VERSION@ CLHEP-RefCount-@VERSION@ clhep-2.1.4.1.orig/RefCount/.cvsignore0000755000175000017500000000007407767704601016144 0ustar olesolesMakefile.in configure aclocal.m4 autom4te.cache config.h.in clhep-2.1.4.1.orig/RefCount/COPYING0000644000175000017500000010451311406203315015154 0ustar olesoles GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 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. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . clhep-2.1.4.1.orig/RefCount/RefCount-config.in0000755000175000017500000000405212234340066017446 0ustar olesoles#! /bin/sh # @configure_input@ # we include the paths of the original install directories for reference orig_prefix="@prefix@" orig_exec_prefix="@exec_prefix@" orig_includedir="@includedir@" # use the full name of this script to get the current path configpath=`dirname ${0}` # check for a leading slash to determine if this is a relative path firstc=`expr ${configpath} : "\/"` calldir=`pwd` if [ ${firstc} -eq 0 ] then cd "${calldir}/${configpath}"; newpath=`pwd` binpath=${newpath} else binpath=${configpath} fi # OK - now we have to strip the trailing "/bin" out of the path prefix=`dirname "${binpath}"` includedir=${prefix}/include libdir=${prefix}/lib usage() { cat <, 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: powerpc-apple-darwin7.5.0 # shell: $SHELL # compiler: $LTCC # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 1.9b # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST elif test -n "${BASH_VERSION+set}${KSH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh dirname="s,/[^/]*$,," basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: PROGRAM=ltmain.sh progname=`echo "$progpath" | $SED "$basename"` # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *) progdir=`echo "$progpath" | $SED "$dirname"` progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; esac # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.9b TIMESTAMP="" package_revision=1.1571 # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $echo $progname${mode+: }$mode: warning: ${1+"$@"} 1>&2 } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } # func_version # Echo version message to standard output and exit. func_version () { $SED '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# //; s/^# *$//; s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED '/^# Usage:/,/# -h/ { s/^# //; s/^# *$//; s/\$progname/'$progname'/; p; }; d' < "$progpath" echo echo "run \`$progname --help | more' for full usage" exit $EXIT_SUCCESS } # func_help # Echo long help message to standard output and exit. func_help () { $SED '/^# Usage:/,/# Report bugs to/ { s/^# //; s/^# *$//; s:\$progname:'$progname':; s:\$SHELL:'"$SHELL"':; s:\$LTCC:'"$LTCC"':; s:\$LD:'"$LD"':; s/\$with_gnu_ld/'"$with_gnu_ld"'/; s/\$automake_version/'"`automake --version 2>/dev/null |$SED 1q`"'/; s/\$autoconf_version/'"`autoconf --version 2>/dev/null |$SED 1q`"'/; p; }; d' < "$progpath" exit $EXIT_SUCCESS } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $EXIT_SUCCESS } # func_features # Display the features supported by this script. func_features () { $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable "`\"foo\"`", so we have to do # it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $echo \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $echo $echo "Try \`$progname --help' for more information about other modes." exit $EXIT_SUCCESS } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # sed scripts: my_sed_single_opt='1s/^\(..\).*$/\1/;q' my_sed_single_rest='1s/^..\(.*\)$/\1/;q' my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' exit_cmd=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set -- --mode clean ${1+"$@"} ;; compile|compil|compi|comp|com|co|c) shift; set -- --mode compile ${1+"$@"} ;; execute|execut|execu|exec|exe|ex|e) shift; set -- --mode execute ${1+"$@"} ;; finish|finis|fini|fin|fi|f) shift; set -- --mode finish ${1+"$@"} ;; install|instal|insta|inst|ins|in|i) shift; set -- --mode install ${1+"$@"} ;; link|lin|li|l) shift; set -- --mode link ${1+"$@"} ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set -- --mode uninstall ${1+"$@"} ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" set -x ;; --dlopen) test $# -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" ;; --dry-run | -n) run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test $# -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" show=: ;; --tag) test $# -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: --dlopen=*|--mode=*|--tag=*) arg=`echo "$opt" | $SED "$my_sed_long_arg"` opt=`echo "$opt" | $SED "$my_sed_long_opt"` set -- "$opt" "$arg" ${1+"$@"} ;; # Separate optargs to short options: # -x*|-y*) # arg=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "$arg" ${1+"$@"} # ;; # Separate non-argument short options: # -z*|-z*|-y*) # rest=`echo "$opt" |$SED "$my_sed_single_rest"` # opt=`echo "$opt" |$SED "$my_sed_single_opt"` # set -- "$opt" "-$rest" ${1+"$@"} # ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`echo "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$my_dlsyms" test -z "$run" && $echo > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do $show "extracting global C symbols from \`$progfile'" $run eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for dlprefile in $dlprefiles; do $show "extracting global C symbols from \`$dlprefile'" name=`$echo "$dlprefile" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $dlprefile | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ const struct { const char *originator; const struct { const char *name; void *address; } symbols[]; } lt_${my_prefix}_LTX_preloaded_symbols = {\ \"$my_originator\", { " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" $echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} } }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$my_dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$my_dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" status=$? if test "$status" -ne 0 && test ! -d "$my_xdir"; then exit $status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename $darwin_archive` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" # Remove the table of contents from the thin files. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" $AR -xo "${darwin_base_archive}" rm "${darwin_base_archive}" cd "$darwin_curdir" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist rm -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir (cd $my_xdir && $AR x $my_xabs) || exit $? fi # $darwin_arches fi # $run ;; *) # We will extract separately just the conflicting names and we will # no longer touch any unique names. It is faster to leave these # extract automatically by $AR in one run. $show "(cd $my_xdir && $AR x $my_xabs)" $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; renaming object files" func_warning "to ensure that they will not overwrite" $AR t "$my_xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_mode_compile arg... func_mode_compile () { # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1 || \ func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi } # func_mode_finish arg... func_mode_finish () { libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" exit $EXIT_SUCCESS } # func_mode_install arg... func_mode_install () { # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files test "$#" -gt 2 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. (${SED} -e '2q' $file | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1 || \ func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" $show "$relink_command" $run eval "$relink_command" || \ func_fatal_error "error: relink \`$file' with the above command before installing it" fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | $GREP "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. test -z "$notinst_deplibs" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask func_error "error: cannot create temporary directory \`$tmpdir'" continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" ${rm}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } # func_mode_link arg... func_mode_link () { case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static # See comment for -static flag below, for more details. compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" || \ func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else func_fatal_error "link input file \`$save_arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) # The effects of -all-static are defined in a previous loop. continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then func_fatal_error "\`$arg' is not a valid libtool object" else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs $inherited_linker_flags" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *[\\/]*.la) . $lib ;; *.la) . ./$lib ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`echo "$deplib" |$SED "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$inherited_linker_flags " in *" $deplib "*) ;; * ) inherited_linker_flags="$inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $lib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not use here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib'" fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | $GREP "^# Generated by ltmain.sh ") >/dev/null 2>&1; then : else func_fatal_error "\`$lib' is not a valid libtool archive" fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac case $host in *-*-darwin*) # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then inherited_linker_flags=`$echo "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` fi dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP "bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $echo "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "*** And there doesn't seem to be a static archive available" $echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs $inherited_linker_flags; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" eval darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//' | xargs` compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for archives" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath test "$#" -gt 2 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" test -n "$8" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) func_error "AGE \`$age' is not a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | ${SED} 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null | ${SED} 10q | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` inherited_linker_flags=`$echo "X $inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$echo "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`echo "$output" | $SED $basename` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnk $echo "creating GNU ld script: $output" $echo 'INPUT (' > $output for obj in $save_libobjs do $echo \""$obj"\" >> $output done $echo ')' >> $output else $echo "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi test -n "$deplibs" && \ func_warning "\`-l' and \`-L' are ignored for objects" test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; struct stat st; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$dlsymsobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else func_warning "object name conflicts; overriding AR_FLAGS to 'cq'" func_warning "to ensure that POSIX-compatible ar will work" AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS } # func_mode_uninstall arg... func_mode_uninstall () { rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done test -z "$rm" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 || (test -h "$file") >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status } ## ----------- ## ## Main. ## ## ----------- ## { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." case $mode in compile) func_mode_compile ${1+"$@"} ;; execute) func_mode_execute ${1+"$@"} ;; finish) func_mode_finish ${1+"$@"} ;; install) func_mode_install ${1+"$@"} ;; link|relink) func_mode_link ${1+"$@"} ;; uninstall|clean) func_mode_uninstall ${1+"$@"} ;; "") help="$generic_help" func_fatal_help "you must specify a MODE" ;; esac test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi } exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: clhep-2.1.4.1.orig/RefCount/src/0000755000175000017500000000000012242515141014706 5ustar olesolesclhep-2.1.4.1.orig/RefCount/src/Makefile.am0000755000175000017500000000336611406203315016753 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif INCLUDES = -I$(top_builddir) libCLHEP_RefCount_@VERSION@_a_SOURCES = \ ZMuseCount.cc libCLHEP_RefCount_@VERSION@_so_OBJECTS = $(patsubst %.cc,$(shareddir)/%.$(OBJEXT),$(libCLHEP_RefCount_@VERSION@_a_SOURCES)) # these if/else blocks will be parsed by automake and translated if BUILD_SHARED shareddir = shared if BUILD_VISUAL lib_shared = CLHEP-RefCount-@VERSION@.$(SHEXT) else lib_shared = libCLHEP-RefCount-@VERSION@.$(SHEXT) LDADD = -L${top_builddir}/../Cast/src -lCLHEP-Cast-@VERSION@ endif SHFLAGS = @MY_SHFLAGS@ SHLINK = @MY_SHLINK@ @MY_SHEXTRA@ SHNAME = @MY_SHNAME@ endif if BUILD_STATIC lib_LIBRARIES = libCLHEP-RefCount-@VERSION@.a endif CLEANFILES = $(lib_shared) all-local: $(shareddir) $(lib_shared) $(shareddir): test -d $(shareddir) || mkdir $(shareddir) if BUILD_VISUAL $(lib_shared): $(libCLHEP_RefCount_@VERSION@_so_OBJECTS) $(SHLINK) $(SHNAME)$@ $(libCLHEP_RefCount_@VERSION@_so_OBJECTS) $(LDADD) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) /c /Fo$@ $< else $(lib_shared): $(libCLHEP_RefCount_@VERSION@_so_OBJECTS) $(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_RefCount_@VERSION@_so_OBJECTS) $(LDADD) $(shareddir)/%.$(OBJEXT): %.cc $(CXXCOMPILE) $(SHFLAGS) -c -o $@ $< endif install-exec-local: $(lib_shared) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_shared)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$p'"; \ $(INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done clean-local: -test -d $(shareddir) && rm -f $(shareddir)/*.$(OBJEXT) distclean-local: -test -d $(shareddir) && rm -rf ./$(shareddir) clhep-2.1.4.1.orig/RefCount/src/.cvsignore0000755000175000017500000000001407767704601016725 0ustar olesolesMakefile.in clhep-2.1.4.1.orig/RefCount/src/CMakeLists.txt0000644000175000017500000000005711606714767017472 0ustar olesoles clhep_build_library( RefCount ZMuseCount.cc ) clhep-2.1.4.1.orig/RefCount/src/ZMuseCount.cc0000755000175000017500000000144407767704601017320 0ustar olesoles// ---------------------------------------------------------------------- // // ZMuseCount.cc - utility class for use in reference-counting // // // History: // 19-Sep-1997 WEB Design stolen, and code adapted, from pp 70-73 of // Koenig & Moo: "Ruminations on C++" (1996) // // ---------------------------------------------------------------------- #ifndef ZMUSECOUNT_H #include "CLHEP/RefCount/ZMuseCount.h" #include "CLHEP/RefCount/ZMuseCount.icc" #endif bool ZMuseCount::makeonly() { bool result = ( ! only() ); if ( result ) { --*p; p = new int(1); } return result; } // makeonly() bool ZMuseCount::reattach( const ZMuseCount & u ) { ++*u.p; bool result = ( --*p == 0 ); if ( result ) delete p; p = u.p; return result; } // reattach() clhep-2.1.4.1.orig/RefCount/RefCount/0000755000175000017500000000000012242515141015644 5ustar olesolesclhep-2.1.4.1.orig/RefCount/RefCount/cmake-defs.h.in0000644000175000017500000000172511607115601020427 0ustar olesoles/* @PACKAGE@/defs.h Generated by cmake. */ #ifndef @UPACKAGE@_DEFS_H #define @UPACKAGE@_DEFS_H /* Name of package */ #ifndef PACKAGE #define PACKAGE "@PACKAGE@" #endif /* Define to the address where bug reports for this package should be sent. */ #ifndef PACKAGE_BUGREPORT #define PACKAGE_BUGREPORT "http://savannah.cern.ch/projects/clhep/" #endif /* Define to the full name of this package. */ #ifndef PACKAGE_NAME #define PACKAGE_NAME "@PROJECT_NAME@ @PACKAGE@" #endif /* Define to the full name and version of this package. */ #ifndef PACKAGE_STRING #define PACKAGE_STRING "@PROJECT_NAME@ @PACKAGE@ @VERSION@" #endif /* Define to the one symbol short name of this package. */ #ifndef PACKAGE_TARNAME #define PACKAGE_TARNAME "@PACKAGE@" #endif /* Define to the version of this package. */ #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "@VERSION@" #endif /* Version number of package */ #ifndef VERSION #define VERSION "@VERSION@" #endif #endif // @UPACKAGE@_DEFS_H clhep-2.1.4.1.orig/RefCount/RefCount/copy-header.pl.in0000755000175000017500000000164110043522306021011 0ustar olesoles#!/usr/bin/env perl # # copy a header into the temporary CLHEP header tree if # a) the header is not already there # b) the source is newer # if ($#ARGV != 1) { print "mungeit requires two arguments - exit\n"; exit; } else { $source_header=$ARGV[0]; $dest_header=$ARGV[1]; &check_header; } exit; sub check_header { # make sure source exists if ( ! -e $source_header ) { print "$source_header does not exist - exit\n"; exit; } # copy if not already there - otherwise, check the time stamp if ( ! -e $dest_header ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } else { $source_header_time = -M $source_header; $dest_header_time = -M $dest_header; # copy only if source is newer if( $source_header_time < $dest_header_time ) { $cmd = "cp -p ".$source_header." ".$dest_header; print "$cmd\n"; system($cmd); } } } clhep-2.1.4.1.orig/RefCount/RefCount/Makefile.am0000755000175000017500000000141710233774336017721 0ustar olesoles## Process this file with automake to produce Makefile.in if USE_GMAKE MAKE = gmake endif includedir = $(prefix)/include/CLHEP tempincludedir = $(TEMPDIR)/CLHEP/@PACKAGE@ COPY_P = @COPY_P@ pkginclude_HEADERS = \ ZMhandleTo.h \ ZMhandleTo.icc \ ZMuseCount.h \ ZMuseCount.icc \ defs.h # Identify generated file(s) to be removed when 'make clean' is requested: CLEANFILES = defs.h # copy headers into $(tempincludedir) install-tmpHEADERS: @echo " install headers in $(tempincludedir) " @list='$(pkginclude_HEADERS)'; \ if test $(tempincludedir); then \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ ./copy-header.pl $$d$$p $(tempincludedir)/$$f; \ done; \ fi; test -z "$$fail" clhep-2.1.4.1.orig/RefCount/RefCount/ZMuseCount.h0000755000175000017500000000346407767704601020124 0ustar olesoles#ifndef ZMUSECOUNT_H #define ZMUSECOUNT_H // ---------------------------------------------------------------------- // // ZMuseCount.h - utility class for use in reference-counting // // // History: // 19-Sep-1997 WEB Design stolen, and code adapted, from pp 70-73 of // Koenig & Moo: "Ruminations on C++" (1996) // // ---------------------------------------------------------------------- class ZMuseCount { public: // -------------------------- // Constructors & destructor: // -------------------------- ZMuseCount(); // Constructor ZMuseCount( const ZMuseCount & u ); // Copy constructor ~ZMuseCount(); // Destructor // ----------------------------------- // Functions useful to a handle class: // ----------------------------------- bool only(); // Is there exactly one copy of the referent? bool makeonly(); // Enables the handle (to a ClassType) to refer to a unique (copy of) // the referent via the following usage: // if ( u.makeonly() ) /* ZMuseCount u; */ // p = new ClassType( *p ); /* ClassType * p; */ // This is useful in implementing copy-on-write semantics // (i.e., non-shared or value semantics), and would appear just before // updating (any part of) *p in such a context. bool reattach( const ZMuseCount & u ); // Simplifies a handle's implementation of assignment via the following // usage: // if ( u.reattach(h.u) ) /* Handle h; */ // delete p; /* p and u as above */ // p = h.p; private: int * p; // *p is the reference counter itself ZMuseCount & operator=( const ZMuseCount & ); // Forbidden operation on a ZMuseCount object }; // ZMuseCount //#include "CLHEP/RefCount/ZMuseCount.icc" #endif // ZMUSECOUNT_H clhep-2.1.4.1.orig/RefCount/RefCount/ZMhandleTo.icc0000755000175000017500000000263307767704601020361 0ustar olesoles// ---------------------------------------------------------------------- // // ZMhandleTo.icc - generic handle class for objects that need to be // reference-counted // // History: // 19-Sep-1997 WEB Design stolen, and code adapted, from // Stroustrup: "The C++ Programming Language, 3rd ed" (1997), p 783 // Koenig & Moo: "Ruminations on C++" (1996), ch 7 // 22-Sep-1997 WEB Updated to require (& use) clone() operator // for reference-counted objects; this is to insure against a user's // destroying the object while one or more handles are still pointing // to it // // ---------------------------------------------------------------------- template< class T> inline ZMhandleTo::ZMhandleTo() : u_() , rep_( new T ) { ; } template< class T> inline ZMhandleTo::ZMhandleTo( const ZMhandleTo & h ) : u_ ( h.u_ ) , rep_( h.rep_ ) { ; } // copy constructor, share the representation template< class T> inline ZMhandleTo::~ZMhandleTo() { if ( u_.only() ) delete rep_; } // destructor template< class T> inline ZMhandleTo & ZMhandleTo::operator=( const ZMhandleTo & rhs ) { if ( u_.reattach( rhs.u_) ) delete rep_; rep_ = rhs.rep_; return *this; } // operator=() template< class T> inline ZMhandleTo::ZMhandleTo( const T & t ) : rep_( t.clone() ) { ; } template< class T> inline ZMhandleTo::ZMhandleTo( const T * t ) : rep_( t->clone() ) { ; } clhep-2.1.4.1.orig/RefCount/RefCount/.cvsignore0000755000175000017500000000002607767704601017666 0ustar olesolesMakefile.in defs.h.in clhep-2.1.4.1.orig/RefCount/RefCount/ZMhandleTo.h0000755000175000017500000000165307767704601020053 0ustar olesoles#ifndef ZMHANDLETO_H #define ZMHANDLETO_H // ---------------------------------------------------------------------- // // ZMhandleTo.h - generic handle class for objects that need to be // reference-counted // // History: // 19-Sep-1997 WEB Design stolen, and code adapted, from // Stroustrup: "The C++ Programming Language, 3rd edition" (1997), p 783 // Koenig & Moo: "Ruminations on C++" (1996), ch 7 // // ---------------------------------------------------------------------- #ifndef ZMUSECOUNT_H #include "CLHEP/RefCount/ZMuseCount.h" #endif template< class T > class ZMhandleTo { public: ZMhandleTo(); ZMhandleTo( const ZMhandleTo & h ); ~ZMhandleTo(); ZMhandleTo & operator=( const ZMhandleTo & rhs ); protected: ZMhandleTo( const T & t ); ZMhandleTo( const T * t ); ZMuseCount u_; T * rep_; }; // ZMhandleTo<> #include "CLHEP/RefCount/ZMhandleTo.icc" #endif // ZMHANDLETO_H clhep-2.1.4.1.orig/RefCount/RefCount/CMakeLists.txt0000644000175000017500000000040511606714767020425 0ustar olesoles set( pkginclude_HEADERS ZMhandleTo.h ZMhandleTo.icc ZMuseCount.h ZMuseCount.icc ) # notice that defs.h is not referenced here INSTALL (FILES ${pkginclude_HEADERS} DESTINATION include/CLHEP/RefCount ) clhep-2.1.4.1.orig/RefCount/RefCount/ZMuseCount.icc0000755000175000017500000000140707767704601020426 0ustar olesoles// ---------------------------------------------------------------------- // // ZMuseCount.icc - utility class for use in reference-counting // // // History: // 19-Sep-1997 WEB Design stolen, and code adapted, from pp 70-73 of // Koenig & Moo: "Ruminations on C++" (1996) // 23-Sep-1997 WEB Furnished overlooked body of copy constructor. // // ---------------------------------------------------------------------- ZMuseCount::ZMuseCount() : p( new int(1) ) { // DEBUG if ( p == 0 ) // DEBUG std::cerr << "ZMuseCount memory allocation failure!" << std::endl; } ZMuseCount::ZMuseCount( const ZMuseCount & u ) : p( u.p ) { ++*p; } ZMuseCount::~ZMuseCount() { if ( --*p == 0 ) delete p; } bool ZMuseCount::only() { return *p == 1; }

  • Additional Constructors
    • The default constructors for random engines tracks starting seeds, so that multiple instances of engine instantiated by default constructors give different starting points in the random sequence. The following code will work and give to each distribution an independent engines with a unique starting seed:
        RandGauss g1 (JamesRandom j1);
        RandGauss g2 (JamesRandom j2);
        RandGauss g3 (JamesRandom j3);

    • The constructors for all engines now follow the same pattern. Along with the default constructor and a copy consturctor to duplicate the state,
      • Each engine has a constructor taking a single long argument. This exhibits the identical behavior to that constructor in CLHEP; in new engines the long is used in a direct way to form the state.
      • Each egine has a constructor taking two int arguments. For engines in CLHEP that already had such a constructor (top access a seed table) the behavior is left intact. For all other engines, this constructor establishes the starting state based on those ints.
      In generators with 64-bits of state or more, the states which can be established by default constructor, by supplying one
      long, and by supplying two ints are all distinct from one another.

    • Each distribution class has a default constructor, which instantiates its own (default) instance of RanLuxEngine. The following code would give an array of standard-parameter Gaussian distributions, with independent engines with different starting seeds for each distribution:
        ZMRandGauss gs [100];

    • Distributions have a form of constructor that accepts a set a parameters to use as defaults for that distribution instance, when fire() is done without supplying parameters.
        ZMRandGauss g(5.0,2.5);
        double x = g.fire();
        // x is distrbuted with mean = 5, sigma = 2.5
        double y = g.fire(3, 2);
        // y is distrbuted with mean = 3, sigma = 2
      Of course, if parameters are explicitly supplied to an invocation of fire(), those supplied parameters are used. And if no parameters are provided when constructing the distribution instance, the standard values are used as before.
        ZMRandGauss g(e, 0.0, 1.0);
        // same as:
        ZMRandGauss g(e);