<commit_before>/*! \file PerspectiveSensor.cpp
 *  \author Jared Hoberock
 *  \brief Implementation of PerspectiveSensor class.
 */

#include "PerspectiveSensor.h"

PerspectiveSensor
  ::PerspectiveSensor(void)
{
  ;
} // end PerspectiveSensor::PerspectiveSensor()

PerspectiveSensor
  ::PerspectiveSensor(const Spectrum &response,
                      const float aspect,
                      const Point &origin,
                      const Vector3 &right,
                      const Vector3 &up)
    :mAspectRatio(aspect),
     mInverseWindowSurfaceArea(1.0f/(2.0f*2.0f*aspect)),
     mWindowOrigin(origin),
     mRight(right),
     mUp(up),
     mResponse(response)
{
  ;
} // end PerspectiveSensor::PerspectiveSensor()

void PerspectiveSensor
  ::set(const float aspect,
        const Point &origin)
{
  mAspectRatio = aspect;
  mWindowOrigin = origin;
  mInverseWindowSurfaceArea = (1.0f/(2.0f*2.0f*mAspectRatio));
} // end PerspectiveSensor::set()

Spectrum PerspectiveSensor
  ::sample(const DifferentialGeometry &dg,
           const float u0,
           const float u1,
           const float u2,
           Vector3 &ws,
           float &pdf,
           bool &delta) const
{
  delta = false;
  Point q;
  sampleWindow(u0,u1,
               mRight,
               mUp,
               dg.getNormal(),
               q,
               pdf);
  ws = q - dg.getPoint();
  float d2 = ws.norm2();
  ws /= sqrt(d2);

  // compute surface area pdf to solid angle pdf
  pdf *= d2;

  // this removes the vignetting effect, but is it correct?
  pdf *= dg.getNormal().dot(ws);

  //// divide the response by the dot product to remove the vignette effect
  //return mResponse / dg.getNormal().dot(ws);
  return mResponse;
} // end PerspectiveSensor::sample()

void PerspectiveSensor
  ::invert(const Vector &w,
           const DifferentialGeometry &dg,
           float &u0,
           float &u1) const
{
  // a ray from the dg in direction w intersects the window at
  // time t
  // remember that the normal points in the -look direction
  float t =
    -dg.getNormal().dot(mWindowOrigin - dg.getPoint()) /
    -dg.getNormal().dot(w);

  // compute q the intersection with the ray and the plane
  Point q = dg.getPoint() + t * w;

  // this is the inverse operation of sampleFilmPlane():
  // get the film plane coordinates of q
  q -= mWindowOrigin;
  q *= 0.5f;

  u0 = q.dot(mRight) / mAspectRatio;
  u1 = q.dot(mUp);
} // end PerspectiveSensor::invert()

void PerspectiveSensor
  ::sampleWindow(const float u,
                 const float v,
                 const Vector3 &xAxis,
                 const Vector3 &yAxis,
                 const Vector3 &zAxis,
                 Point &p,
                 float &pdf) const
{
  p = mWindowOrigin;
  p += 2.0f * mAspectRatio * u * xAxis;
  p += 2.0f * v * yAxis;
  pdf = mInverseWindowSurfaceArea;
} // end PerspectiveSensor::sampleWindow()

float PerspectiveSensor
  ::evaluatePdf(const Vector3 &ws,
                const DifferentialGeometry &dg) const
{
  // intersect a ray through dg in direction ws with the sensor window
  // remember that the normal points in the -look direction
  float t = -dg.getNormal().dot(mWindowOrigin - dg.getPoint()) /
            -dg.getNormal().dot(ws);

  // compute q the intersection with the ray and the window
  Point q = dg.getPoint() + t * ws;
  Point coords = q - mWindowOrigin;
  coords *= 0.5f;

  float u = coords.dot(mRight) / mAspectRatio;
  float v = coords.dot(mUp);

  // if the ray does not pass through the window,
  // then there is zero probability of having generated it
  if(u < 0.0f || u >= 1.0f) return 0.0f;
  if(v < 0.0f || v >= 1.0f) return 0.0f;

  // compute solid angle pdf
  Vector3 wi = q - dg.getPoint();
  float pdf = wi.norm2();
  pdf *= mInverseWindowSurfaceArea;

  // this removes the vignetting effect, but is it correct?
  pdf *= dg.getNormal().absDot(ws);

  return pdf;
} // end PerspectiveSensor::evaluatePdf()

Spectrum PerspectiveSensor
  ::evaluate(const Vector &ws,
             const DifferentialGeometry &dg) const
{
  // evaluate the pdf at ws, and if it is not zero, return mResponse
  // divide by dot product to remove the vignetting effect
  //return evaluatePdf(ws, dg) > 0 ? (mResponse / dg.getNormal().absDot(ws)) : Spectrum::black();

  return evaluatePdf(ws, dg) > 0 ? (mResponse) : Spectrum::black();
} // end PerspectiveSensor::evaluate()

Vector PerspectiveSensor
  ::getRight(void) const
{
  return mRight;
} // end PerspectiveSensor::getRight()

Vector PerspectiveSensor
  ::getUp(void) const
{
  return mUp;
} // end PerspectiveSensor::getUp()

<commit_msg>Fix a bug where if a ray is coming from "behind" the sensor, it still has non-zero response.<commit_after>/*! \file PerspectiveSensor.cpp
 *  \author Jared Hoberock
 *  \brief Implementation of PerspectiveSensor class.
 */

#include "PerspectiveSensor.h"

PerspectiveSensor
  ::PerspectiveSensor(void)
{
  ;
} // end PerspectiveSensor::PerspectiveSensor()

PerspectiveSensor
  ::PerspectiveSensor(const Spectrum &response,
                      const float aspect,
                      const Point &origin,
                      const Vector3 &right,
                      const Vector3 &up)
    :mAspectRatio(aspect),
     mInverseWindowSurfaceArea(1.0f/(2.0f*2.0f*aspect)),
     mWindowOrigin(origin),
     mRight(right),
     mUp(up),
     mResponse(response)
{
  ;
} // end PerspectiveSensor::PerspectiveSensor()

void PerspectiveSensor
  ::set(const float aspect,
        const Point &origin)
{
  mAspectRatio = aspect;
  mWindowOrigin = origin;
  mInverseWindowSurfaceArea = (1.0f/(2.0f*2.0f*mAspectRatio));
} // end PerspectiveSensor::set()

Spectrum PerspectiveSensor
  ::sample(const DifferentialGeometry &dg,
           const float u0,
           const float u1,
           const float u2,
           Vector3 &ws,
           float &pdf,
           bool &delta) const
{
  delta = false;
  Point q;
  sampleWindow(u0,u1,
               mRight,
               mUp,
               dg.getNormal(),
               q,
               pdf);
  ws = q - dg.getPoint();
  float d2 = ws.norm2();
  ws /= sqrt(d2);

  // compute surface area pdf to solid angle pdf
  pdf *= d2;

  // this removes the vignetting effect, but is it correct?
  pdf *= dg.getNormal().dot(ws);

  //// divide the response by the dot product to remove the vignette effect
  //return mResponse / dg.getNormal().dot(ws);
  return mResponse;
} // end PerspectiveSensor::sample()

void PerspectiveSensor
  ::invert(const Vector &w,
           const DifferentialGeometry &dg,
           float &u0,
           float &u1) const
{
  // a ray from the dg in direction w intersects the window at
  // time t
  // remember that the normal points in the -look direction
  float t =
    -dg.getNormal().dot(mWindowOrigin - dg.getPoint()) /
    -dg.getNormal().dot(w);

  // compute q the intersection with the ray and the plane
  Point q = dg.getPoint() + t * w;

  // this is the inverse operation of sampleFilmPlane():
  // get the film plane coordinates of q
  q -= mWindowOrigin;
  q *= 0.5f;

  u0 = q.dot(mRight) / mAspectRatio;
  u1 = q.dot(mUp);
} // end PerspectiveSensor::invert()

void PerspectiveSensor
  ::sampleWindow(const float u,
                 const float v,
                 const Vector3 &xAxis,
                 const Vector3 &yAxis,
                 const Vector3 &zAxis,
                 Point &p,
                 float &pdf) const
{
  p = mWindowOrigin;
  p += 2.0f * mAspectRatio * u * xAxis;
  p += 2.0f * v * yAxis;
  pdf = mInverseWindowSurfaceArea;
} // end PerspectiveSensor::sampleWindow()

float PerspectiveSensor
  ::evaluatePdf(const Vector3 &ws,
                const DifferentialGeometry &dg) const
{
  // intersect a ray through dg in direction ws with the sensor window
  // remember that the normal points in the -look direction
  float t = -dg.getNormal().dot(mWindowOrigin - dg.getPoint()) /
            -dg.getNormal().dot(ws);

  // if t is negative, then ws came from 'behind the camera',
  // and there is zero pdf of generating such directions
  if(t < 0) return 0;

  // compute q the intersection with the ray and the window
  Point q = dg.getPoint() + t * ws;
  Point coords = q - mWindowOrigin;
  coords *= 0.5f;

  float u = coords.dot(mRight) / mAspectRatio;
  float v = coords.dot(mUp);

  // if the ray does not pass through the window,
  // then there is zero probability of having generated it
  if(u < 0.0f || u >= 1.0f) return 0.0f;
  if(v < 0.0f || v >= 1.0f) return 0.0f;

  // compute solid angle pdf
  Vector3 wi = q - dg.getPoint();
  float pdf = wi.norm2();
  pdf *= mInverseWindowSurfaceArea;

  // this removes the vignetting effect, but is it correct?
  pdf *= dg.getNormal().absDot(ws);

  return pdf;
} // end PerspectiveSensor::evaluatePdf()

Spectrum PerspectiveSensor
  ::evaluate(const Vector &ws,
             const DifferentialGeometry &dg) const
{
  // evaluate the pdf at ws, and if it is not zero, return mResponse
  // divide by dot product to remove the vignetting effect
  //return evaluatePdf(ws, dg) > 0 ? (mResponse / dg.getNormal().absDot(ws)) : Spectrum::black();
  Spectrum result = evaluatePdf(ws, dg) > 0 ? (mResponse) : Spectrum::black();

  return result;
} // end PerspectiveSensor::evaluate()

Vector PerspectiveSensor
  ::getRight(void) const
{
  return mRight;
} // end PerspectiveSensor::getRight()

Vector PerspectiveSensor
  ::getUp(void) const
{
  return mUp;
} // end PerspectiveSensor::getUp()

<|endoftext|>


<commit_before>#pragma once
// adapt_integer_and_posit.hpp: adapter functions to convert integer<size> type and posit<nbits,es> types
//
// Copyright (C) 2017-2020 Stillwater Supercomputing, Inc.
//
// This file is part of the UNIVERSAL project, which is released under an MIT Open Source license.
#include <iostream>

// include this adapter before the src/tgt types that you want to connect

// if included, set the compilation flag that will enable the operator=(const TargetType&) in the SourceType.
#ifndef ADAPTER_POSIT_AND_INTEGER
#define ADAPTER_POSIT_AND_INTEGER 1
#else
#define ADAPTER_POSIT_AND_INTEGER 0
#endif // ADAPTER_POSIT_AND_INTEGER

namespace sw {
namespace unum {

// forward references
template<size_t nbits> class bitblock;
template<size_t nbits> class value;
template<size_t nbits, size_t es> class posit;
template<size_t nbits, size_t es> int scale(const posit<nbits, es>&);
template<size_t nbits, size_t es, size_t fbits> bitblock<fbits+1> significant(const posit<nbits, es>&);
template<size_t nbits, typename BlockType> class integer;

/*
  Why is the convert function not part of the Integer or Posit types?
  It would tightly couple the types, which we want to avoid.
  If we want to productize these convertions we would need a new
  layer in the module design that sits above the Universal types. TODO
 */

// convert a Posit to an Integer
template<size_t nbits, size_t es, size_t ibits, typename BlockType>
inline void convert_p2i(const sw::unum::posit<nbits, es>& p, sw::unum::integer<ibits, BlockType>& v) {
	// get the scale of the posit value
	int scale = sw::unum::scale(p);
	if (scale < 0) {
		v = 0;
		return;
	}
	if (scale == 0) {
		v = 1;
	}
	else {
		// gather all the fraction bits
		// sw::unum::bitblock<p.fhbits> significant = sw::unum::significant<p.nbits, p.es, p.fbits>(p);
                sw::unum::bitblock<Posit::fhbits> significant = sw::unum::significant<Posit::nbits, Posit::es, Posit::fbits>(p);
		// the radix point is at fbits, to make an integer out of this
		// we shift that radix point fbits to the right.
		// that is equivalent to a scale of 2^fbits
		v.clear();
		int msb = (v.nbits < p.fbits + 1) ? v.nbits : p.fbits + 1;
		for (int i = msb-1; i >= 0; --i) {
			v.set(i, significant[i]);
		}
		int shift = scale - p.fbits;  // if scale > fbits we need to shift left
		v <<= shift;
		if (p.isneg()) {
			v.flip();
			v += 1;
		}
	}
}

/////////////////////////////////////////////////////////////////////////
// convert an Integer to a Posit
template<size_t ibits, typename BlockType, size_t nbits, size_t es>
inline void convert_i2p(const sw::unum::integer<ibits, BlockType>& w, sw::unum::posit<nbits, es>& p) {
	using namespace std;
	using namespace sw::unum;

	bool sign = w < 0;
	bool isZero = w == 0;
	bool isInf = false;
	bool isNan = false;
	long _scale = scale(w);
	integer<ibits, BlockType> w2 = sign ? twos_complement(w) : w;
	int msb = findMsb(w2);
	bitblock<nbits> fraction_without_hidden_bit;
	int fbit = nbits - 1;
	for (int i = msb - 1; i >= 0; --i) {
		fraction_without_hidden_bit.set(fbit, w2.at(i));
		--fbit;
	}
	value<nbits> v;
	v.set(sign, _scale, fraction_without_hidden_bit, isZero, isInf, isNan);
	p = v;
}

} // namespace unum
} // namespace sw
<commit_msg>compilation fixes for gcc<commit_after>#pragma once
// adapt_integer_and_posit.hpp: adapter functions to convert integer<size> type and posit<nbits,es> types
//
// Copyright (C) 2017-2020 Stillwater Supercomputing, Inc.
//
// This file is part of the UNIVERSAL project, which is released under an MIT Open Source license.
#include <iostream>

// include this adapter before the src/tgt types that you want to connect

// if included, set the compilation flag that will enable the operator=(const TargetType&) in the SourceType.
#ifndef ADAPTER_POSIT_AND_INTEGER
#define ADAPTER_POSIT_AND_INTEGER 1
#else
#define ADAPTER_POSIT_AND_INTEGER 0
#endif // ADAPTER_POSIT_AND_INTEGER

namespace sw {
namespace unum {

// forward references
template<size_t nbits> class bitblock;
template<size_t nbits> class value;
template<size_t nbits, size_t es> class posit;
template<size_t nbits, size_t es> int scale(const posit<nbits, es>&);
template<size_t nbits, size_t es, size_t fbits> bitblock<fbits+1> significant(const posit<nbits, es>&);
template<size_t nbits, typename BlockType> class integer;

/*
  Why is the convert function not part of the Integer or Posit types?
  It would tightly couple the types, which we want to avoid.
  If we want to productize these convertions we would need a new
  layer in the module design that sits above the Universal types. TODO
 */

// convert a Posit to an Integer
template<size_t nbits, size_t es, size_t ibits, typename BlockType>
inline void convert_p2i(const sw::unum::posit<nbits, es>& p, sw::unum::integer<ibits, BlockType>& v) {
	// get the scale of the posit value
	int scale = sw::unum::scale(p);
	if (scale < 0) {
		v = 0;
		return;
	}
	if (scale == 0) {
		v = 1;
	}
	else {
		// gather all the fraction bits
		// sw::unum::bitblock<p.fhbits> significant = sw::unum::significant<p.nbits, p.es, p.fbits>(p);
		sw::unum::bitblock<sw::unum::posit<nbits, es>::fhbits> significant = sw::unum::significant<nbits, es, sw::unum::posit<nbits, es>::fbits>(p);
		// the radix point is at fbits, to make an integer out of this
		// we shift that radix point fbits to the right.
		// that is equivalent to a scale of 2^fbits
		v.clear();
		int msb = (v.nbits < p.fbits + 1) ? v.nbits : p.fbits + 1;
		for (int i = msb-1; i >= 0; --i) {
			v.set(i, significant[i]);
		}
		int shift = scale - p.fbits;  // if scale > fbits we need to shift left
		v <<= shift;
		if (p.isneg()) {
			v.flip();
			v += 1;
		}
	}
}

/////////////////////////////////////////////////////////////////////////
// convert an Integer to a Posit
template<size_t ibits, typename BlockType, size_t nbits, size_t es>
inline void convert_i2p(const sw::unum::integer<ibits, BlockType>& w, sw::unum::posit<nbits, es>& p) {
	using namespace std;
	using namespace sw::unum;

	bool sign = w < 0;
	bool isZero = w == 0;
	bool isInf = false;
	bool isNan = false;
	long _scale = scale(w);
	integer<ibits, BlockType> w2 = sign ? twos_complement(w) : w;
	int msb = findMsb(w2);
	bitblock<nbits> fraction_without_hidden_bit;
	int fbit = nbits - 1;
	for (int i = msb - 1; i >= 0; --i) {
		fraction_without_hidden_bit.set(fbit, w2.at(i));
		--fbit;
	}
	value<nbits> v;
	v.set(sign, _scale, fraction_without_hidden_bit, isZero, isInf, isNan);
	p = v;
}

} // namespace unum
} // namespace sw
<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: sbintern.hxx,v $
 *
 *  $Revision: 1.5 $
 *
 *  last change: $Author: obo $ $Date: 2004-03-17 13:34:46 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library 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
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#ifndef _SB_INTERN_HXX
#define _SB_INTERN_HXX

#include <svtools/sbxfac.hxx>
#ifndef _UNOTOOLS_TRANSLITERATIONWRAPPER_HXX
#include <unotools/transliterationwrapper.hxx>
#endif
#include "sb.hxx"

class ::utl::TransliterationWrapper;
class SbUnoFactory;
class SbTypeFactory;
class SbOLEFactory;
class SbiInstance;
class SbModule;

class SbiFactory : public SbxFactory
{
public:
    virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX );
    virtual SbxObject* CreateObject( const String& );
};

// Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette
class SbErrorStackEntry
{
public:
    SbErrorStackEntry(SbMethodRef aM, xub_StrLen nL, xub_StrLen nC1, xub_StrLen nC2)
        : aMethod(aM), nLine(nL), nCol1(nC1), nCol2(nC2) {}
    SbMethodRef aMethod;
    xub_StrLen nLine;
    xub_StrLen nCol1, nCol2;
};

SV_DECL_PTRARR_DEL(SbErrorStack, SbErrorStackEntry*, 1, 1)

struct SbiGlobals
{
    SbiInstance*    pInst;          // alle aktiven Runtime-Instanzen
    SbiFactory*     pSbFac;         // StarBASIC-Factory
    SbUnoFactory*   pUnoFac;        // Factory fuer Uno-Structs bei DIM AS NEW
    SbTypeFactory*  pTypeFac;       // Factory for user defined types
    SbOLEFactory*   pOLEFac;        // Factory for OLE types
    SbModule*       pMod;           // aktuell aktives Modul
    SbModule*       pCompMod;       // aktuell compiliertes Modul
    short           nInst;          // Anzahl BASICs
    Link            aErrHdl;        // globaler Error-Handler
    Link            aBreakHdl;      // globaler Break-Handler
    SbError         nCode;          // aktueller Fehlercode
    xub_StrLen      nLine;          // aktuelle Zeile
    xub_StrLen      nCol1,nCol2;    // aktuelle Spalten (von,bis)
    BOOL            bCompiler;      // Flag fuer Compiler-Error
    BOOL            bGlobalInitErr; // Beim GlobalInit trat ein Compiler-Fehler auf
    BOOL            bRunInit;       // TRUE, wenn RunInit vom Basic aktiv ist
    String          aErrMsg;        // Puffer fuer GetErrorText()
    SbLanguageMode  eLanguageMode;  // Flag fuer Visual-Basic-Script-Modus
    SbErrorStack*   pErrStack;      // Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette
    ::utl::TransliterationWrapper* pTransliterationWrapper;    // For StrComp
    BOOL            bBlockCompilerError;

    SbiGlobals();
    ~SbiGlobals();
};

// Utility-Makros und -Routinen

SbiGlobals* GetSbData();

#define pINST       GetSbData()->pInst
#define pMOD        GetSbData()->pMod
#define pCMOD       GetSbData()->pCompMod
#define pSBFAC      GetSbData()->pSbFac
#define pUNOFAC     GetSbData()->pUnoFac
#define pTYPEFAC    GetSbData()->pTypeFac
#define pOLEFAC     GetSbData()->pOLEFac

#endif

<commit_msg>INTEGRATION: CWS ab11clonepp4 (1.5.62); FILE MERGED 2004/10/15 08:39:08 ab 1.5.62.1: #118083# #118084# Class support PP4 -> SO 8<commit_after>/*************************************************************************
 *
 *  $RCSfile: sbintern.hxx,v $
 *
 *  $Revision: 1.6 $
 *
 *  last change: $Author: pjunck $ $Date: 2004-11-02 11:56:34 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library 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
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#ifndef _SB_INTERN_HXX
#define _SB_INTERN_HXX

#include <svtools/sbxfac.hxx>
#ifndef _UNOTOOLS_TRANSLITERATIONWRAPPER_HXX
#include <unotools/transliterationwrapper.hxx>
#endif
#include "sb.hxx"

class ::utl::TransliterationWrapper;
class SbUnoFactory;
class SbTypeFactory;
class SbOLEFactory;
class SbiInstance;
class SbModule;

class SbiFactory : public SbxFactory
{
public:
    virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX );
    virtual SbxObject* CreateObject( const String& );
};

// #115824: Factory class to create class objects (type command)
// Implementation: sb.cxx
class SbClassFactory : public SbxFactory
{
    SbxObjectRef    xClassModules;

public:
    SbClassFactory( void );

    void AddClassModule( SbModule* pClassModule );
    void RemoveClassModule( SbModule* pClassModule );

    virtual SbxBase* Create( UINT16 nSbxId, UINT32 = SBXCR_SBX );
    virtual SbxObject* CreateObject( const String& );
};

// Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette
class SbErrorStackEntry
{
public:
    SbErrorStackEntry(SbMethodRef aM, xub_StrLen nL, xub_StrLen nC1, xub_StrLen nC2)
        : aMethod(aM), nLine(nL), nCol1(nC1), nCol2(nC2) {}
    SbMethodRef aMethod;
    xub_StrLen nLine;
    xub_StrLen nCol1, nCol2;
};

SV_DECL_PTRARR_DEL(SbErrorStack, SbErrorStackEntry*, 1, 1)

struct SbiGlobals
{
    SbiInstance*    pInst;          // alle aktiven Runtime-Instanzen
    SbiFactory*     pSbFac;         // StarBASIC-Factory
    SbUnoFactory*   pUnoFac;        // Factory fuer Uno-Structs bei DIM AS NEW
    SbTypeFactory*  pTypeFac;       // Factory for user defined types
    SbClassFactory* pClassFac;      // Factory for user defined classes (based on class modules)
    SbOLEFactory*   pOLEFac;        // Factory for OLE types
    SbModule*       pMod;           // aktuell aktives Modul
    SbModule*       pCompMod;       // aktuell compiliertes Modul
    short           nInst;          // Anzahl BASICs
    Link            aErrHdl;        // globaler Error-Handler
    Link            aBreakHdl;      // globaler Break-Handler
    SbError         nCode;          // aktueller Fehlercode
    xub_StrLen      nLine;          // aktuelle Zeile
    xub_StrLen      nCol1,nCol2;    // aktuelle Spalten (von,bis)
    BOOL            bCompiler;      // Flag fuer Compiler-Error
    BOOL            bGlobalInitErr; // Beim GlobalInit trat ein Compiler-Fehler auf
    BOOL            bRunInit;       // TRUE, wenn RunInit vom Basic aktiv ist
    String          aErrMsg;        // Puffer fuer GetErrorText()
    SbLanguageMode  eLanguageMode;  // Flag fuer Visual-Basic-Script-Modus
    SbErrorStack*   pErrStack;      // Stack fuer die im Fehlerfall abgebaute SbiRuntime Kette
    ::utl::TransliterationWrapper* pTransliterationWrapper;    // For StrComp
    BOOL            bBlockCompilerError;

    SbiGlobals();
    ~SbiGlobals();
};

// Utility-Makros und -Routinen

SbiGlobals* GetSbData();

#define pINST       GetSbData()->pInst
#define pMOD        GetSbData()->pMod
#define pCMOD       GetSbData()->pCompMod
#define pSBFAC      GetSbData()->pSbFac
#define pUNOFAC     GetSbData()->pUnoFac
#define pTYPEFAC    GetSbData()->pTypeFac
#define pCLASSFAC   GetSbData()->pClassFac
#define pOLEFAC     GetSbData()->pOLEFac

#endif

<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: graphicproperties.cxx,v $
 *
 *  $Revision: 1.11 $
 *
 *  last change: $Author: hr $ $Date: 2007-06-27 18:52:23 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library 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
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"

#ifndef _SDR_PROPERTIES_GRAPHICPROPERTIES_HXX
#include <svx/sdr/properties/graphicproperties.hxx>
#endif

#ifndef _SFXITEMSET_HXX
#include <svtools/itemset.hxx>
#endif

#ifndef _SFXSTYLE_HXX
#include <svtools/style.hxx>
#endif

#ifndef _SVDDEF_HXX
#include <svx/svddef.hxx>
#endif

#ifndef _EEITEM_HXX
#include <svx/eeitem.hxx>
#endif

#ifndef _SVDOGRAF_HXX
#include <svx/svdograf.hxx>
#endif

#ifndef _SDGCPITM_HXX
#include <svx/sdgcpitm.hxx>
#endif

//////////////////////////////////////////////////////////////////////////////

namespace sdr
{
    namespace properties
    {
        // create a new itemset
        SfxItemSet& GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
        {
            return *(new SfxItemSet(rPool,

                // range from SdrAttrObj
                SDRATTR_START, SDRATTR_SHADOW_LAST,
                SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
                SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,

                // range from SdrGrafObj
                SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,

                // range from SdrTextObj
                EE_ITEMS_START, EE_ITEMS_END,

                // end
                0, 0));
        }

        GraphicProperties::GraphicProperties(SdrObject& rObj)
        :   RectangleProperties(rObj)
        {
        }

        GraphicProperties::GraphicProperties(const GraphicProperties& rProps, SdrObject& rObj)
        :   RectangleProperties(rProps, rObj)
        {
        }

        GraphicProperties::~GraphicProperties()
        {
        }

        BaseProperties& GraphicProperties::Clone(SdrObject& rObj) const
        {
            return *(new GraphicProperties(*this, rObj));
        }

        void GraphicProperties::ItemSetChanged(const SfxItemSet& rSet)
        {
            SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject();

            // local changes
            rObj.SetXPolyDirty();

            // #i29367# Update GraphicAttr, too. This was formerly
            // triggered by SdrGrafObj::SFX_NOTIFY, which is no longer
            // called nowadays. BTW: strictly speaking, the whole
            // ImpSetAttrToGrafInfo/ImpSetGrafInfoToAttr stuff could
            // be dumped, when SdrGrafObj::aGrafInfo is removed and
            // always created on the fly for repaint.
            rObj.ImpSetAttrToGrafInfo();

            // call parent
            RectangleProperties::ItemSetChanged(rSet);
        }

        void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
        {
            SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject();

            // local changes
            rObj.SetXPolyDirty();

            // call parent
            RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);

            // local changes
            rObj.ImpSetAttrToGrafInfo();
        }

        void GraphicProperties::ForceDefaultAttributes()
        {
            // call parent
            RectangleProperties::ForceDefaultAttributes();

            // force ItemSet
            GetObjectItemSet();

            mpItemSet->Put( SdrGrafLuminanceItem( 0 ) );
            mpItemSet->Put( SdrGrafContrastItem( 0 ) );
            mpItemSet->Put( SdrGrafRedItem( 0 ) );
            mpItemSet->Put( SdrGrafGreenItem( 0 ) );
            mpItemSet->Put( SdrGrafBlueItem( 0 ) );
            mpItemSet->Put( SdrGrafGamma100Item( 100 ) );
            mpItemSet->Put( SdrGrafTransparenceItem( 0 ) );
            mpItemSet->Put( SdrGrafInvertItem( FALSE ) );
            mpItemSet->Put( SdrGrafModeItem( GRAPHICDRAWMODE_STANDARD ) );
            mpItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) );

            // #i25616#
            mpItemSet->Put( XFillStyleItem(XFILL_NONE) );
            mpItemSet->Put( XLineStyleItem(XLINE_NONE) );
        }
    } // end of namespace properties
} // end of namespace sdr

//////////////////////////////////////////////////////////////////////////////
// eof
<commit_msg>INTEGRATION: CWS changefileheader (1.11.368); FILE MERGED 2008/04/01 15:51:32 thb 1.11.368.3: #i85898# Stripping all external header guards 2008/04/01 12:49:43 thb 1.11.368.2: #i85898# Stripping all external header guards 2008/03/31 14:23:15 rt 1.11.368.1: #i87441# Change license header to LPGL v3.<commit_after>/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2008 by Sun Microsystems, Inc.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * $RCSfile: graphicproperties.cxx,v $
 * $Revision: 1.12 $
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org 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 Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
#include <svx/sdr/properties/graphicproperties.hxx>
#include <svtools/itemset.hxx>
#include <svtools/style.hxx>
#include <svx/svddef.hxx>
#include <svx/eeitem.hxx>
#include <svx/svdograf.hxx>
#include <svx/sdgcpitm.hxx>

//////////////////////////////////////////////////////////////////////////////

namespace sdr
{
    namespace properties
    {
        // create a new itemset
        SfxItemSet& GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
        {
            return *(new SfxItemSet(rPool,

                // range from SdrAttrObj
                SDRATTR_START, SDRATTR_SHADOW_LAST,
                SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
                SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,

                // range from SdrGrafObj
                SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,

                // range from SdrTextObj
                EE_ITEMS_START, EE_ITEMS_END,

                // end
                0, 0));
        }

        GraphicProperties::GraphicProperties(SdrObject& rObj)
        :   RectangleProperties(rObj)
        {
        }

        GraphicProperties::GraphicProperties(const GraphicProperties& rProps, SdrObject& rObj)
        :   RectangleProperties(rProps, rObj)
        {
        }

        GraphicProperties::~GraphicProperties()
        {
        }

        BaseProperties& GraphicProperties::Clone(SdrObject& rObj) const
        {
            return *(new GraphicProperties(*this, rObj));
        }

        void GraphicProperties::ItemSetChanged(const SfxItemSet& rSet)
        {
            SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject();

            // local changes
            rObj.SetXPolyDirty();

            // #i29367# Update GraphicAttr, too. This was formerly
            // triggered by SdrGrafObj::SFX_NOTIFY, which is no longer
            // called nowadays. BTW: strictly speaking, the whole
            // ImpSetAttrToGrafInfo/ImpSetGrafInfoToAttr stuff could
            // be dumped, when SdrGrafObj::aGrafInfo is removed and
            // always created on the fly for repaint.
            rObj.ImpSetAttrToGrafInfo();

            // call parent
            RectangleProperties::ItemSetChanged(rSet);
        }

        void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
        {
            SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject();

            // local changes
            rObj.SetXPolyDirty();

            // call parent
            RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);

            // local changes
            rObj.ImpSetAttrToGrafInfo();
        }

        void GraphicProperties::ForceDefaultAttributes()
        {
            // call parent
            RectangleProperties::ForceDefaultAttributes();

            // force ItemSet
            GetObjectItemSet();

            mpItemSet->Put( SdrGrafLuminanceItem( 0 ) );
            mpItemSet->Put( SdrGrafContrastItem( 0 ) );
            mpItemSet->Put( SdrGrafRedItem( 0 ) );
            mpItemSet->Put( SdrGrafGreenItem( 0 ) );
            mpItemSet->Put( SdrGrafBlueItem( 0 ) );
            mpItemSet->Put( SdrGrafGamma100Item( 100 ) );
            mpItemSet->Put( SdrGrafTransparenceItem( 0 ) );
            mpItemSet->Put( SdrGrafInvertItem( FALSE ) );
            mpItemSet->Put( SdrGrafModeItem( GRAPHICDRAWMODE_STANDARD ) );
            mpItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) );

            // #i25616#
            mpItemSet->Put( XFillStyleItem(XFILL_NONE) );
            mpItemSet->Put( XLineStyleItem(XLINE_NONE) );
        }
    } // end of namespace properties
} // end of namespace sdr

//////////////////////////////////////////////////////////////////////////////
// eof
<|endoftext|>


<commit_before>//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
// author:  Manasij Mukherjee  <manasij7479@gmail.com>
// author:  Vassil Vassilev <vvasilev@cern.ch>
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------

#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Path.h"
#include "clang/Sema/Sema.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/AST/AST.h"
#include "clang/AST/ASTContext.h" // for operator new[](unsigned long, ASTCtx..)
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/DeclVisitor.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Frontend/CompilerInstance.h"

#include "cling/Interpreter/Interpreter.h"
#include "cling/Interpreter/InterpreterCallbacks.h"
#include "cling/Interpreter/AutoloadCallback.h"
#include "cling/Interpreter/Transaction.h"

using namespace clang;

namespace cling {

  void AutoloadCallback::report(clang::SourceLocation l, llvm::StringRef name,
                                llvm::StringRef header) {
    Sema& sema= m_Interpreter->getSema();

    unsigned id
      = sema.getDiagnostics().getCustomDiagID (DiagnosticsEngine::Level::Warning,
                                                 "Note: '%0' can be found in %1");
/*    unsigned idn //TODO: To be enabled after we have a way to get the full path
      = sema.getDiagnostics().getCustomDiagID(DiagnosticsEngine::Level::Note,
                                                "Type : %0 , Full Path: %1")*/;

    sema.Diags.Report(l, id) << name << header;

  }

  bool AutoloadCallback::LookupObject (TagDecl *t) {
    if (t->hasAttr<AnnotateAttr>())
      report(t->getLocation(),t->getNameAsString(),t->getAttr<AnnotateAttr>()->getAnnotation());
    return false;
  }

  class AutoloadingVisitor: public RecursiveASTVisitor<AutoloadingVisitor> {
  private:
    bool m_IsStoringState;
    AutoloadCallback::FwdDeclsMap* m_Map;
    clang::Preprocessor* m_PP;
  private:
    void InsertIntoAutoloadingState (Decl* decl, std::string annotation) {

      assert(annotation != "" && "Empty annotation!");
      assert(m_PP);

      const FileEntry* FE = 0;
      SourceLocation fileNameLoc;
      bool isAngled = false;
      const DirectoryLookup* LookupFrom = 0;
      const DirectoryLookup* CurDir = 0;

      FE = m_PP->LookupFile(fileNameLoc, annotation, isAngled, LookupFrom,
                            CurDir, /*SearchPath*/0, /*RelativePath*/ 0,
                            /*suggestedModule*/0, /*SkipCache*/false,
                            /*OpenFile*/ false, /*CacheFail*/ false);

      assert(FE && "Must have a valid FileEntry");

      if (m_Map->find(FE) == m_Map->end())
        (*m_Map)[FE] = std::vector<Decl*>();

      (*m_Map)[FE].push_back(decl);
    }

  public:
    AutoloadingVisitor() : m_IsStoringState(false), m_Map(0) {}
    void RemoveDefaultArgsOf(Decl* D) {
      //D = D->getMostRecentDecl();
      TraverseDecl(D);
      //while ((D = D->getPreviousDecl()))
      //  TraverseDecl(D);
    }

    void TrackDefaultArgStateOf(Decl* D, AutoloadCallback::FwdDeclsMap& map,
                                Preprocessor& PP) {
      m_IsStoringState = true;
      m_Map = ↦
      m_PP = &PP;
      TraverseDecl(D);
      m_PP = 0;
      m_Map = 0;
      m_IsStoringState = false;
    }

    bool shouldVisitTemplateInstantiations() { return true; }

    bool VisitDecl(Decl* D) {
      if (!m_IsStoringState)
        return true;

      if (!D->hasAttr<AnnotateAttr>())
        return true;

      AnnotateAttr* attr = D->getAttr<AnnotateAttr>();
      if (!attr)
        return true;

      switch (D->getKind()) {
      default:
        InsertIntoAutoloadingState(D, attr->getAnnotation());
        break;
      case Decl::Enum:
        // EnumDecls have extra information 2 chars after the filename used
        // for extra fixups.
          EnumDecl* ED = cast<EnumDecl>(D);
          if (ED->isFixed()) {
            StringRef str = ED->getAttr<AnnotateAttr>()->getAnnotation();
            char ch = str.back();
//            str.drop_back(2);
            ED->getAttr<AnnotateAttr>()->setAnnotation(ED->getASTContext(), str);
            struct EnumDeclDerived: public EnumDecl {
              static void setFixed(EnumDecl* ED, bool value = true) {
                ((EnumDeclDerived*)ED)->IsFixed = value;
              }
            };

            if (ch != '1')
              EnumDeclDerived::setFixed(ED, false);
          }
        InsertIntoAutoloadingState(D, attr->getAnnotation().drop_back(2));
        break;
      }

      return true;
    }

    bool VisitCXXRecordDecl(CXXRecordDecl* D) {
      if (!D->hasAttr<AnnotateAttr>())
        return true;

      VisitDecl(D);

      if (ClassTemplateDecl* TmplD = D->getDescribedClassTemplate())
        return VisitTemplateDecl(TmplD);
      return true;
    }

    bool VisitTemplateTypeParmDecl(TemplateTypeParmDecl* D) {
      VisitDecl(D);

      if (m_IsStoringState)
        return true;

      if (D->hasDefaultArgument())
        D->removeDefaultArgument();
      return true;
    }

    bool VisitTemplateDecl(TemplateDecl* D) {
      if (D->getTemplatedDecl() &&
          !D->getTemplatedDecl()->hasAttr<AnnotateAttr>())
        return true;

      VisitDecl(D);

      for(auto P: D->getTemplateParameters()->asArray())
        TraverseDecl(P);
      return true;
    }

    bool VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl* D) {
      VisitDecl(D);

      if (m_IsStoringState)
        return true;

      if (D->hasDefaultArgument())
        D->removeDefaultArgument();
      return true;
    }

    bool VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl* D) {
      VisitDecl(D);

      if (m_IsStoringState)
        return true;

      if (D->hasDefaultArgument())
        D->removeDefaultArgument();
      return true;
    }

    bool VisitParmVarDecl(ParmVarDecl* D) {
      VisitDecl(D);

      if (m_IsStoringState)
        return true;

      if (D->hasDefaultArg())
        D->setDefaultArg(nullptr);
      return true;
    }
  };

  void AutoloadCallback::InclusionDirective(clang::SourceLocation HashLoc,
                          const clang::Token &IncludeTok,
                          llvm::StringRef FileName,
                          bool IsAngled,
                          clang::CharSourceRange FilenameRange,
                          const clang::FileEntry *File,
                          llvm::StringRef SearchPath,
                          llvm::StringRef RelativePath,
                          const clang::Module *Imported) {
    // If File is 0 this means that the #included file doesn't exist.
    if (!File)
      return;

    auto found = m_Map.find(File);
    if (found == m_Map.end())
     return; // nothing to do, file not referred in any annotation

    AutoloadingVisitor defaultArgsCleaner;
    for (auto D : found->second) {
      defaultArgsCleaner.RemoveDefaultArgsOf(D);
    }
    // Don't need to keep track of cleaned up decls from file.
    m_Map.erase(found);
  }

  AutoloadCallback::~AutoloadCallback() {
  }

  void AutoloadCallback::TransactionCommitted(const Transaction &T) {
    if (T.decls_begin() == T.decls_end())
      return;
    if (T.decls_begin()->m_DGR.isNull())
      return;

    if (const NamedDecl* ND = dyn_cast<NamedDecl>(*T.decls_begin()->m_DGR.begin()))
      if (ND->getIdentifier() && ND->getName().equals("__Cling_Autoloading_Map")) {
        AutoloadingVisitor defaultArgsStateCollector;
        Preprocessor& PP = m_Interpreter->getCI()->getPreprocessor();
        for (Transaction::const_iterator I = T.decls_begin(), E = T.decls_end();
             I != E; ++I) {
          Transaction::DelayCallInfo DCI = *I;

          // if (DCI.m_Call != Transaction::kCCIHandleTopLevelDecl)
          //   continue;
          if (DCI.m_DGR.isNull())
            continue;

          if (const NamedDecl* ND = dyn_cast<NamedDecl>(*T.decls_begin()->m_DGR.begin()))
            if (ND->getIdentifier()
                && ND->getName().equals("__Cling_Autoloading_Map")) {

              for (Transaction::const_iterator I = T.decls_begin(),
                     E = T.decls_end(); I != E; ++I) {
                Transaction::DelayCallInfo DCI = *I;
                for (DeclGroupRef::iterator J = DCI.m_DGR.begin(),
                       JE = DCI.m_DGR.end(); J != JE; ++J) {
                    defaultArgsStateCollector.TrackDefaultArgStateOf(*J, m_Map, PP);
                }
              }
            }

        }
      }
  }

} //end namespace cling
<commit_msg>Disable default cling-autoload callback (diag) for now.<commit_after>//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
// author:  Manasij Mukherjee  <manasij7479@gmail.com>
// author:  Vassil Vassilev <vvasilev@cern.ch>
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------

#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Path.h"
#include "clang/Sema/Sema.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/AST/AST.h"
#include "clang/AST/ASTContext.h" // for operator new[](unsigned long, ASTCtx..)
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/DeclVisitor.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Frontend/CompilerInstance.h"

#include "cling/Interpreter/Interpreter.h"
#include "cling/Interpreter/InterpreterCallbacks.h"
#include "cling/Interpreter/AutoloadCallback.h"
#include "cling/Interpreter/Transaction.h"

using namespace clang;

namespace cling {

  void AutoloadCallback::report(clang::SourceLocation l, llvm::StringRef name,
                                llvm::StringRef header) {
    Sema& sema= m_Interpreter->getSema();

    unsigned id
      = sema.getDiagnostics().getCustomDiagID (DiagnosticsEngine::Level::Warning,
                                                 "Note: '%0' can be found in %1");
/*    unsigned idn //TODO: To be enabled after we have a way to get the full path
      = sema.getDiagnostics().getCustomDiagID(DiagnosticsEngine::Level::Note,
                                                "Type : %0 , Full Path: %1")*/;

    sema.Diags.Report(l, id) << name << header;

  }

  bool AutoloadCallback::LookupObject (TagDecl *t) {
#if 0
    if (t->hasAttr<AnnotateAttr>())
      report(t->getLocation(),t->getNameAsString(),t->getAttr<AnnotateAttr>()->getAnnotation());
#endif
    return false;
  }

  class AutoloadingVisitor: public RecursiveASTVisitor<AutoloadingVisitor> {
  private:
    bool m_IsStoringState;
    AutoloadCallback::FwdDeclsMap* m_Map;
    clang::Preprocessor* m_PP;
  private:
    void InsertIntoAutoloadingState (Decl* decl, std::string annotation) {

      assert(annotation != "" && "Empty annotation!");
      assert(m_PP);

      const FileEntry* FE = 0;
      SourceLocation fileNameLoc;
      bool isAngled = false;
      const DirectoryLookup* LookupFrom = 0;
      const DirectoryLookup* CurDir = 0;

      FE = m_PP->LookupFile(fileNameLoc, annotation, isAngled, LookupFrom,
                            CurDir, /*SearchPath*/0, /*RelativePath*/ 0,
                            /*suggestedModule*/0, /*SkipCache*/false,
                            /*OpenFile*/ false, /*CacheFail*/ false);

      assert(FE && "Must have a valid FileEntry");

      if (m_Map->find(FE) == m_Map->end())
        (*m_Map)[FE] = std::vector<Decl*>();

      (*m_Map)[FE].push_back(decl);
    }

  public:
    AutoloadingVisitor() : m_IsStoringState(false), m_Map(0) {}
    void RemoveDefaultArgsOf(Decl* D) {
      //D = D->getMostRecentDecl();
      TraverseDecl(D);
      //while ((D = D->getPreviousDecl()))
      //  TraverseDecl(D);
    }

    void TrackDefaultArgStateOf(Decl* D, AutoloadCallback::FwdDeclsMap& map,
                                Preprocessor& PP) {
      m_IsStoringState = true;
      m_Map = ↦
      m_PP = &PP;
      TraverseDecl(D);
      m_PP = 0;
      m_Map = 0;
      m_IsStoringState = false;
    }

    bool shouldVisitTemplateInstantiations() { return true; }

    bool VisitDecl(Decl* D) {
      if (!m_IsStoringState)
        return true;

      if (!D->hasAttr<AnnotateAttr>())
        return true;

      AnnotateAttr* attr = D->getAttr<AnnotateAttr>();
      if (!attr)
        return true;

      switch (D->getKind()) {
      default:
        InsertIntoAutoloadingState(D, attr->getAnnotation());
        break;
      case Decl::Enum:
        // EnumDecls have extra information 2 chars after the filename used
        // for extra fixups.
          EnumDecl* ED = cast<EnumDecl>(D);
          if (ED->isFixed()) {
            StringRef str = ED->getAttr<AnnotateAttr>()->getAnnotation();
            char ch = str.back();
//            str.drop_back(2);
            ED->getAttr<AnnotateAttr>()->setAnnotation(ED->getASTContext(), str);
            struct EnumDeclDerived: public EnumDecl {
              static void setFixed(EnumDecl* ED, bool value = true) {
                ((EnumDeclDerived*)ED)->IsFixed = value;
              }
            };

            if (ch != '1')
              EnumDeclDerived::setFixed(ED, false);
          }
        InsertIntoAutoloadingState(D, attr->getAnnotation().drop_back(2));
        break;
      }

      return true;
    }

    bool VisitCXXRecordDecl(CXXRecordDecl* D) {
      if (!D->hasAttr<AnnotateAttr>())
        return true;

      VisitDecl(D);

      if (ClassTemplateDecl* TmplD = D->getDescribedClassTemplate())
        return VisitTemplateDecl(TmplD);
      return true;
    }

    bool VisitTemplateTypeParmDecl(TemplateTypeParmDecl* D) {
      VisitDecl(D);

      if (m_IsStoringState)
        return true;

      if (D->hasDefaultArgument())
        D->removeDefaultArgument();
      return true;
    }

    bool VisitTemplateDecl(TemplateDecl* D) {
      if (D->getTemplatedDecl() &&
          !D->getTemplatedDecl()->hasAttr<AnnotateAttr>())
        return true;

      VisitDecl(D);

      for(auto P: D->getTemplateParameters()->asArray())
        TraverseDecl(P);
      return true;
    }

    bool VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl* D) {
      VisitDecl(D);

      if (m_IsStoringState)
        return true;

      if (D->hasDefaultArgument())
        D->removeDefaultArgument();
      return true;
    }

    bool VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl* D) {
      VisitDecl(D);

      if (m_IsStoringState)
        return true;

      if (D->hasDefaultArgument())
        D->removeDefaultArgument();
      return true;
    }

    bool VisitParmVarDecl(ParmVarDecl* D) {
      VisitDecl(D);

      if (m_IsStoringState)
        return true;

      if (D->hasDefaultArg())
        D->setDefaultArg(nullptr);
      return true;
    }
  };

  void AutoloadCallback::InclusionDirective(clang::SourceLocation HashLoc,
                          const clang::Token &IncludeTok,
                          llvm::StringRef FileName,
                          bool IsAngled,
                          clang::CharSourceRange FilenameRange,
                          const clang::FileEntry *File,
                          llvm::StringRef SearchPath,
                          llvm::StringRef RelativePath,
                          const clang::Module *Imported) {
    // If File is 0 this means that the #included file doesn't exist.
    if (!File)
      return;

    auto found = m_Map.find(File);
    if (found == m_Map.end())
     return; // nothing to do, file not referred in any annotation

    AutoloadingVisitor defaultArgsCleaner;
    for (auto D : found->second) {
      defaultArgsCleaner.RemoveDefaultArgsOf(D);
    }
    // Don't need to keep track of cleaned up decls from file.
    m_Map.erase(found);
  }

  AutoloadCallback::~AutoloadCallback() {
  }

  void AutoloadCallback::TransactionCommitted(const Transaction &T) {
    if (T.decls_begin() == T.decls_end())
      return;
    if (T.decls_begin()->m_DGR.isNull())
      return;

    if (const NamedDecl* ND = dyn_cast<NamedDecl>(*T.decls_begin()->m_DGR.begin()))
      if (ND->getIdentifier() && ND->getName().equals("__Cling_Autoloading_Map")) {
        AutoloadingVisitor defaultArgsStateCollector;
        Preprocessor& PP = m_Interpreter->getCI()->getPreprocessor();
        for (Transaction::const_iterator I = T.decls_begin(), E = T.decls_end();
             I != E; ++I) {
          Transaction::DelayCallInfo DCI = *I;

          // if (DCI.m_Call != Transaction::kCCIHandleTopLevelDecl)
          //   continue;
          if (DCI.m_DGR.isNull())
            continue;

          if (const NamedDecl* ND = dyn_cast<NamedDecl>(*T.decls_begin()->m_DGR.begin()))
            if (ND->getIdentifier()
                && ND->getName().equals("__Cling_Autoloading_Map")) {

              for (Transaction::const_iterator I = T.decls_begin(),
                     E = T.decls_end(); I != E; ++I) {
                Transaction::DelayCallInfo DCI = *I;
                for (DeclGroupRef::iterator J = DCI.m_DGR.begin(),
                       JE = DCI.m_DGR.end(); J != JE; ++J) {
                    defaultArgsStateCollector.TrackDefaultArgStateOf(*J, m_Map, PP);
                }
              }
            }

        }
      }
  }

} //end namespace cling
<|endoftext|>


<commit_before>#include "HardFloat.hpp"
#include <xmmintrin.h>
#include <cassert>

// Debug checks
// checks performed via softfloat
#if defined(_DEBUG) && 0
#include "../deps/softfloat/softfloat.hpp"
#define CHECKED_IMPL_BEGIN(x, q) \
	{ \
		SoftFloat::Float theirs = q(SoftFloat::Float(x.f)); \
		HardFloat ours = ([x]() mutable
#define CHECKED_IMPL_BEGIN2(a, b, q) \
	{ \
		SoftFloat::Float theirs = q(SoftFloat::Float(a.f), SoftFloat::Float(b.f)); \
		HardFloat ours = ([a, b]() mutable
#define CHECKED_IMPL_BEGIN_OP2(a, b, op) \
	{ \
		SoftFloat::Float theirs = SoftFloat::Float(a.f) op SoftFloat::Float(b.f); \
		HardFloat ours = ([a, b]() mutable
#define CHECKED_IMPL_END() \
	)(); \
		assert(theirs.getInternalUint32() == ours.getInternalUint32()); \
		return ours; \
	}
#define CHECKED_IMPL_BEGIN_OP0(op) \
	{ \
		op theirs = (op)SoftFloat::Float(f); \
		op ours = ([=]()
#define CHECKED_IMPL_END_OP0() \
	)(); \
		assert(theirs == ours); \
		return ours; \
	}
#define CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, op) \
	{ \
		bool theirs = SoftFloat::Float(a.f) op SoftFloat::Float(b.f); \
		bool ours = ([a, b]() mutable
#else
#define CHECKED_IMPL_BEGIN(x, f)
#define CHECKED_IMPL_BEGIN2(a, b, f)
#define CHECKED_IMPL_BEGIN_OP2(a, b, op)
#define CHECKED_IMPL_END()
#define CHECKED_IMPL_BEGIN_OP0(op)
#define CHECKED_IMPL_END_OP0()
#define CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, op)
#endif

BEGIN_INANITY_MATH

const HardFloat HardFloat::pi = HardFloat::fromUint32Const(0x40490fdb);
const HardFloat HardFloat::pi2 = HardFloat::fromUint32Const(0x40c90fdb);
const HardFloat HardFloat::pi_2 = HardFloat::fromUint32Const(0x3fc90fdb);

HardFloat::HardFloat() : f(0) {}

HardFloat::HardFloat(int32_t n)
{
	_mm_store_ss(&f, _mm_cvt_si2ss(_mm_setzero_ps(), (int)n));
}

HardFloat::HardFloat(uint32_t n)
{
	_mm_store_ss(&f, _mm_cvt_si2ss(_mm_setzero_ps(), (int)n));
}

HardFloat::HardFloat(float n) : f(n) {}

HardFloat HardFloat::operator-() const
{
	float q = f;
	*(uint32_t*)&q ^= 0x80000000U;
	return HardFloat(q);
}

HardFloat operator+(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2(a, b, +)
{
	return HardFloat(_mm_cvtss_f32(_mm_add_ss(_mm_set_ss(a.f), _mm_set_ss(b.f))));
} CHECKED_IMPL_END()

HardFloat operator-(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2(a, b, -)
{
	return HardFloat(_mm_cvtss_f32(_mm_sub_ss(_mm_set_ss(a.f), _mm_set_ss(b.f))));
} CHECKED_IMPL_END()

HardFloat operator*(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2(a, b, *)
{
	return HardFloat(_mm_cvtss_f32(_mm_mul_ss(_mm_set_ss(a.f), _mm_set_ss(b.f))));
} CHECKED_IMPL_END()

HardFloat operator/(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2(a, b, /)
{
	return HardFloat(_mm_cvtss_f32(_mm_div_ss(_mm_set_ss(a.f), _mm_set_ss(b.f))));
} CHECKED_IMPL_END()

HardFloat fmod(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN2(a, b, fmod)
{
	__m128 p = _mm_set_ss(a.f);
	__m128 q = _mm_set_ss(b.f);
	return HardFloat(_mm_cvtss_f32(_mm_sub_ss(p, _mm_mul_ss(_mm_cvt_si2ss(p, _mm_cvtt_ss2si(_mm_div_ss(p, q))), q))));
} CHECKED_IMPL_END()

HardFloat& HardFloat::operator+=(HardFloat b)
{
	_mm_store_ss(&f, _mm_add_ss(_mm_set_ss(f), _mm_set_ss(b.f)));
	return *this;
}

HardFloat& HardFloat::operator-=(HardFloat b)
{
	_mm_store_ss(&f, _mm_sub_ss(_mm_set_ss(f), _mm_set_ss(b.f)));
	return *this;
}

HardFloat& HardFloat::operator*=(HardFloat b)
{
	_mm_store_ss(&f, _mm_mul_ss(_mm_set_ss(f), _mm_set_ss(b.f)));
	return *this;
}

HardFloat& HardFloat::operator/=(HardFloat b)
{
	_mm_store_ss(&f, _mm_div_ss(_mm_set_ss(f), _mm_set_ss(b.f)));
	return *this;
}

bool operator==(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, ==)
{
	return (bool)_mm_comieq_ss(_mm_set_ss(a.f), _mm_set_ss(b.f));
} CHECKED_IMPL_END_OP0()

bool operator!=(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, !=)
{
	return (bool)_mm_comineq_ss(_mm_set_ss(a.f), _mm_set_ss(b.f));
} CHECKED_IMPL_END_OP0()

bool operator<(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, <)
{
	return (bool)_mm_comilt_ss(_mm_set_ss(a.f), _mm_set_ss(b.f));
} CHECKED_IMPL_END_OP0()

bool operator<=(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, <=)
{
	return (bool)_mm_comile_ss(_mm_set_ss(a.f), _mm_set_ss(b.f));
} CHECKED_IMPL_END_OP0()

bool operator>(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, >)
{
	return (bool)_mm_comigt_ss(_mm_set_ss(a.f), _mm_set_ss(b.f));
} CHECKED_IMPL_END_OP0()

bool operator>=(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, >=)
{
	return (bool)_mm_comige_ss(_mm_set_ss(a.f), _mm_set_ss(b.f));
} CHECKED_IMPL_END_OP0()

HardFloat abs(HardFloat a) CHECKED_IMPL_BEGIN(a, abs)
{
	float f = a.f;
	*(uint32_t*)&f &= 0x7FFFFFFFU;
	return HardFloat(f);
} CHECKED_IMPL_END()

HardFloat floor(HardFloat a) CHECKED_IMPL_BEGIN(a, floor)
{
	__m128 p = _mm_set_ss(a.f);
	__m128 t = _mm_cvtepi32_ps(_mm_cvttps_epi32(p));
	return HardFloat(_mm_cvtss_f32(_mm_sub_ps(t, _mm_and_ps(_mm_cmplt_ps(p, t), _mm_set_ss(1.0f)))));
} CHECKED_IMPL_END()

HardFloat ceil(HardFloat a) CHECKED_IMPL_BEGIN(a, ceil)
{
	__m128 p = _mm_set_ss(a.f);
	__m128 t = _mm_cvtepi32_ps(_mm_cvttps_epi32(p));
	return HardFloat(_mm_cvtss_f32(_mm_add_ps(t, _mm_and_ps(_mm_cmpgt_ps(p, t), _mm_set_ss(1.0f)))));
} CHECKED_IMPL_END()

HardFloat trunc(HardFloat a) CHECKED_IMPL_BEGIN(a, trunc)
{
	return HardFloat(_mm_cvtss_f32(_mm_cvtepi32_ps(_mm_cvttps_epi32(_mm_set_ss(a.f)))));
} CHECKED_IMPL_END()

HardFloat sqrt(HardFloat a) CHECKED_IMPL_BEGIN(a, sqrt)
{
	return HardFloat(_mm_cvtss_f32(_mm_sqrt_ss(_mm_set_ss(a.f))));
} CHECKED_IMPL_END()

HardFloat sin(HardFloat a) CHECKED_IMPL_BEGIN(a, sin)
{
	// handle negative values
	if(a < HardFloat()) return -sin(-a);

	// reduce to range [0, pi]
	HardFloat n;
	if(a > HardFloat::pi)
	{
		n = trunc(a / HardFloat::pi);
		a -= n * HardFloat::pi;
	}
	// reduce to range [0, pi/2]
	if(a > HardFloat::pi_2) a = HardFloat::pi - a;

	static const HardFloat
		k1 = HardFloat::fromUint32Const(0x3f7ff052), //  0.99976073735983227f
		k3 = HardFloat::fromUint32Const(0xbe29c7cc), // -0.16580121984779175f
		k5 = HardFloat::fromUint32Const(0x3bf7d14a); //  0.00756279111686865f

	HardFloat a2 = a * a, a3 = a2 * a, a5 = a3 * a2;

	a = a * k1 + a3 * k3 + a5 * k5;

	return ((int)n % 2 == 0) ? a : -a;
} CHECKED_IMPL_END()

HardFloat cos(HardFloat a) CHECKED_IMPL_BEGIN(a, cos)
{
	return sin(a + HardFloat::pi_2);
} CHECKED_IMPL_END()

HardFloat atan(HardFloat a) CHECKED_IMPL_BEGIN(a, atan)
{
	// handle negative values
	if(a < HardFloat()) return -atan(-a);

	if(a > HardFloat(1.0f)) return HardFloat::pi_2 - atan(HardFloat(1.0f) / a);

	static const HardFloat
		k1 = HardFloat::fromUint32Const(0x3f7ff50e), //  0.9998329769337240f
		k3 = HardFloat::fromUint32Const(0xbea75d21), // -0.3268824051434949f
		k5 = HardFloat::fromUint32Const(0x3e22d89e), //  0.1590294514698240f
		k7 = HardFloat::fromUint32Const(0xbd407012); // -0.0469818803609288f

	HardFloat a2 = a * a, a4 = a2 * a2, a6 = a4 * a2;

	return a * (k1 + a2 * k3 + a4 * k5 + a6 * k7);
} CHECKED_IMPL_END()

HardFloat atan2(HardFloat y, HardFloat x) CHECKED_IMPL_BEGIN2(y, x, atan2)
{
	bool xs = x >= HardFloat();
	if(y == HardFloat()) return xs ? HardFloat() : HardFloat::pi;

	bool ys = y >= HardFloat();
	if(x == HardFloat()) return ys ? HardFloat::pi_2 : (-HardFloat::pi_2);

	HardFloat a = atan(y / x);
	return (xs == ys) ? (xs ? a : (a - HardFloat::pi)) : (xs ? a : (a + HardFloat::pi));
} CHECKED_IMPL_END()

HardFloat::operator int32_t() const CHECKED_IMPL_BEGIN_OP0(int32_t)
{
	return (int32_t)_mm_cvtt_ss2si(_mm_set_ss(f));
} CHECKED_IMPL_END_OP0()

HardFloat::operator uint32_t() const CHECKED_IMPL_BEGIN_OP0(uint32_t)
{
	return (uint32_t)_mm_cvtt_ss2si(_mm_set_ss(f));
} CHECKED_IMPL_END_OP0()

HardFloat::operator float() const CHECKED_IMPL_BEGIN_OP0(float)
{
	return f;
} CHECKED_IMPL_END_OP0()

uint32_t HardFloat::getInternalUint32() const
{
	return *(uint32_t*)&f;
}

HardFloat HardFloat::fromUint32Const(uint32_t a)
{
	HardFloat f;
	*(uint32_t*)&f.f = a;
	return f;
}

END_INANITY_MATH

namespace std
{
	Inanity::Math::HardFloat numeric_limits<Inanity::Math::HardFloat>::min()
	{
		return Inanity::Math::HardFloat(numeric_limits<float>::min());
	}

	Inanity::Math::HardFloat numeric_limits<Inanity::Math::HardFloat>::lowest()
	{
		return Inanity::Math::HardFloat(numeric_limits<float>::lowest());
	}

	Inanity::Math::HardFloat numeric_limits<Inanity::Math::HardFloat>::max()
	{
		return Inanity::Math::HardFloat(numeric_limits<float>::max());
	}
}
<commit_msg>fix warnings in msvc<commit_after>#include "HardFloat.hpp"
#include <xmmintrin.h>
#include <cassert>

// Debug checks
// checks performed via softfloat
#if defined(_DEBUG) && 0
#include "../deps/softfloat/softfloat.hpp"
#define CHECKED_IMPL_BEGIN(x, q) \
	{ \
		SoftFloat::Float theirs = q(SoftFloat::Float(x.f)); \
		HardFloat ours = ([x]() mutable
#define CHECKED_IMPL_BEGIN2(a, b, q) \
	{ \
		SoftFloat::Float theirs = q(SoftFloat::Float(a.f), SoftFloat::Float(b.f)); \
		HardFloat ours = ([a, b]() mutable
#define CHECKED_IMPL_BEGIN_OP2(a, b, op) \
	{ \
		SoftFloat::Float theirs = SoftFloat::Float(a.f) op SoftFloat::Float(b.f); \
		HardFloat ours = ([a, b]() mutable
#define CHECKED_IMPL_END() \
	)(); \
		assert(theirs.getInternalUint32() == ours.getInternalUint32()); \
		return ours; \
	}
#define CHECKED_IMPL_BEGIN_OP0(op) \
	{ \
		op theirs = (op)SoftFloat::Float(f); \
		op ours = ([=]()
#define CHECKED_IMPL_END_OP0() \
	)(); \
		assert(theirs == ours); \
		return ours; \
	}
#define CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, op) \
	{ \
		bool theirs = SoftFloat::Float(a.f) op SoftFloat::Float(b.f); \
		bool ours = ([a, b]() mutable
#else
#define CHECKED_IMPL_BEGIN(x, f)
#define CHECKED_IMPL_BEGIN2(a, b, f)
#define CHECKED_IMPL_BEGIN_OP2(a, b, op)
#define CHECKED_IMPL_END()
#define CHECKED_IMPL_BEGIN_OP0(op)
#define CHECKED_IMPL_END_OP0()
#define CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, op)
#endif

BEGIN_INANITY_MATH

const HardFloat HardFloat::pi = HardFloat::fromUint32Const(0x40490fdb);
const HardFloat HardFloat::pi2 = HardFloat::fromUint32Const(0x40c90fdb);
const HardFloat HardFloat::pi_2 = HardFloat::fromUint32Const(0x3fc90fdb);

HardFloat::HardFloat() : f(0) {}

HardFloat::HardFloat(int32_t n)
{
	_mm_store_ss(&f, _mm_cvt_si2ss(_mm_setzero_ps(), (int)n));
}

HardFloat::HardFloat(uint32_t n)
{
	_mm_store_ss(&f, _mm_cvt_si2ss(_mm_setzero_ps(), (int)n));
}

HardFloat::HardFloat(float n) : f(n) {}

HardFloat HardFloat::operator-() const
{
	float q = f;
	*(uint32_t*)&q ^= 0x80000000U;
	return HardFloat(q);
}

HardFloat operator+(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2(a, b, +)
{
	return HardFloat(_mm_cvtss_f32(_mm_add_ss(_mm_set_ss(a.f), _mm_set_ss(b.f))));
} CHECKED_IMPL_END()

HardFloat operator-(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2(a, b, -)
{
	return HardFloat(_mm_cvtss_f32(_mm_sub_ss(_mm_set_ss(a.f), _mm_set_ss(b.f))));
} CHECKED_IMPL_END()

HardFloat operator*(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2(a, b, *)
{
	return HardFloat(_mm_cvtss_f32(_mm_mul_ss(_mm_set_ss(a.f), _mm_set_ss(b.f))));
} CHECKED_IMPL_END()

HardFloat operator/(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2(a, b, /)
{
	return HardFloat(_mm_cvtss_f32(_mm_div_ss(_mm_set_ss(a.f), _mm_set_ss(b.f))));
} CHECKED_IMPL_END()

HardFloat fmod(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN2(a, b, fmod)
{
	__m128 p = _mm_set_ss(a.f);
	__m128 q = _mm_set_ss(b.f);
	return HardFloat(_mm_cvtss_f32(_mm_sub_ss(p, _mm_mul_ss(_mm_cvt_si2ss(p, _mm_cvtt_ss2si(_mm_div_ss(p, q))), q))));
} CHECKED_IMPL_END()

HardFloat& HardFloat::operator+=(HardFloat b)
{
	_mm_store_ss(&f, _mm_add_ss(_mm_set_ss(f), _mm_set_ss(b.f)));
	return *this;
}

HardFloat& HardFloat::operator-=(HardFloat b)
{
	_mm_store_ss(&f, _mm_sub_ss(_mm_set_ss(f), _mm_set_ss(b.f)));
	return *this;
}

HardFloat& HardFloat::operator*=(HardFloat b)
{
	_mm_store_ss(&f, _mm_mul_ss(_mm_set_ss(f), _mm_set_ss(b.f)));
	return *this;
}

HardFloat& HardFloat::operator/=(HardFloat b)
{
	_mm_store_ss(&f, _mm_div_ss(_mm_set_ss(f), _mm_set_ss(b.f)));
	return *this;
}

bool operator==(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, ==)
{
	return !!_mm_comieq_ss(_mm_set_ss(a.f), _mm_set_ss(b.f));
} CHECKED_IMPL_END_OP0()

bool operator!=(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, !=)
{
	return !!_mm_comineq_ss(_mm_set_ss(a.f), _mm_set_ss(b.f));
} CHECKED_IMPL_END_OP0()

bool operator<(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, <)
{
	return !!_mm_comilt_ss(_mm_set_ss(a.f), _mm_set_ss(b.f));
} CHECKED_IMPL_END_OP0()

bool operator<=(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, <=)
{
	return !!_mm_comile_ss(_mm_set_ss(a.f), _mm_set_ss(b.f));
} CHECKED_IMPL_END_OP0()

bool operator>(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, >)
{
	return !!_mm_comigt_ss(_mm_set_ss(a.f), _mm_set_ss(b.f));
} CHECKED_IMPL_END_OP0()

bool operator>=(HardFloat a, HardFloat b) CHECKED_IMPL_BEGIN_OP2_BOOL(a, b, >=)
{
	return !!_mm_comige_ss(_mm_set_ss(a.f), _mm_set_ss(b.f));
} CHECKED_IMPL_END_OP0()

HardFloat abs(HardFloat a) CHECKED_IMPL_BEGIN(a, abs)
{
	float f = a.f;
	*(uint32_t*)&f &= 0x7FFFFFFFU;
	return HardFloat(f);
} CHECKED_IMPL_END()

HardFloat floor(HardFloat a) CHECKED_IMPL_BEGIN(a, floor)
{
	__m128 p = _mm_set_ss(a.f);
	__m128 t = _mm_cvtepi32_ps(_mm_cvttps_epi32(p));
	return HardFloat(_mm_cvtss_f32(_mm_sub_ps(t, _mm_and_ps(_mm_cmplt_ps(p, t), _mm_set_ss(1.0f)))));
} CHECKED_IMPL_END()

HardFloat ceil(HardFloat a) CHECKED_IMPL_BEGIN(a, ceil)
{
	__m128 p = _mm_set_ss(a.f);
	__m128 t = _mm_cvtepi32_ps(_mm_cvttps_epi32(p));
	return HardFloat(_mm_cvtss_f32(_mm_add_ps(t, _mm_and_ps(_mm_cmpgt_ps(p, t), _mm_set_ss(1.0f)))));
} CHECKED_IMPL_END()

HardFloat trunc(HardFloat a) CHECKED_IMPL_BEGIN(a, trunc)
{
	return HardFloat(_mm_cvtss_f32(_mm_cvtepi32_ps(_mm_cvttps_epi32(_mm_set_ss(a.f)))));
} CHECKED_IMPL_END()

HardFloat sqrt(HardFloat a) CHECKED_IMPL_BEGIN(a, sqrt)
{
	return HardFloat(_mm_cvtss_f32(_mm_sqrt_ss(_mm_set_ss(a.f))));
} CHECKED_IMPL_END()

HardFloat sin(HardFloat a) CHECKED_IMPL_BEGIN(a, sin)
{
	// handle negative values
	if(a < HardFloat()) return -sin(-a);

	// reduce to range [0, pi]
	HardFloat n;
	if(a > HardFloat::pi)
	{
		n = trunc(a / HardFloat::pi);
		a -= n * HardFloat::pi;
	}
	// reduce to range [0, pi/2]
	if(a > HardFloat::pi_2) a = HardFloat::pi - a;

	static const HardFloat
		k1 = HardFloat::fromUint32Const(0x3f7ff052), //  0.99976073735983227f
		k3 = HardFloat::fromUint32Const(0xbe29c7cc), // -0.16580121984779175f
		k5 = HardFloat::fromUint32Const(0x3bf7d14a); //  0.00756279111686865f

	HardFloat a2 = a * a, a3 = a2 * a, a5 = a3 * a2;

	a = a * k1 + a3 * k3 + a5 * k5;

	return ((int)n % 2 == 0) ? a : -a;
} CHECKED_IMPL_END()

HardFloat cos(HardFloat a) CHECKED_IMPL_BEGIN(a, cos)
{
	return sin(a + HardFloat::pi_2);
} CHECKED_IMPL_END()

HardFloat atan(HardFloat a) CHECKED_IMPL_BEGIN(a, atan)
{
	// handle negative values
	if(a < HardFloat()) return -atan(-a);

	if(a > HardFloat(1.0f)) return HardFloat::pi_2 - atan(HardFloat(1.0f) / a);

	static const HardFloat
		k1 = HardFloat::fromUint32Const(0x3f7ff50e), //  0.9998329769337240f
		k3 = HardFloat::fromUint32Const(0xbea75d21), // -0.3268824051434949f
		k5 = HardFloat::fromUint32Const(0x3e22d89e), //  0.1590294514698240f
		k7 = HardFloat::fromUint32Const(0xbd407012); // -0.0469818803609288f

	HardFloat a2 = a * a, a4 = a2 * a2, a6 = a4 * a2;

	return a * (k1 + a2 * k3 + a4 * k5 + a6 * k7);
} CHECKED_IMPL_END()

HardFloat atan2(HardFloat y, HardFloat x) CHECKED_IMPL_BEGIN2(y, x, atan2)
{
	bool xs = x >= HardFloat();
	if(y == HardFloat()) return xs ? HardFloat() : HardFloat::pi;

	bool ys = y >= HardFloat();
	if(x == HardFloat()) return ys ? HardFloat::pi_2 : (-HardFloat::pi_2);

	HardFloat a = atan(y / x);
	return (xs == ys) ? (xs ? a : (a - HardFloat::pi)) : (xs ? a : (a + HardFloat::pi));
} CHECKED_IMPL_END()

HardFloat::operator int32_t() const CHECKED_IMPL_BEGIN_OP0(int32_t)
{
	return (int32_t)_mm_cvtt_ss2si(_mm_set_ss(f));
} CHECKED_IMPL_END_OP0()

HardFloat::operator uint32_t() const CHECKED_IMPL_BEGIN_OP0(uint32_t)
{
	return (uint32_t)_mm_cvtt_ss2si(_mm_set_ss(f));
} CHECKED_IMPL_END_OP0()

HardFloat::operator float() const CHECKED_IMPL_BEGIN_OP0(float)
{
	return f;
} CHECKED_IMPL_END_OP0()

uint32_t HardFloat::getInternalUint32() const
{
	return *(uint32_t*)&f;
}

HardFloat HardFloat::fromUint32Const(uint32_t a)
{
	HardFloat f;
	*(uint32_t*)&f.f = a;
	return f;
}

END_INANITY_MATH

namespace std
{
	Inanity::Math::HardFloat numeric_limits<Inanity::Math::HardFloat>::min()
	{
		return Inanity::Math::HardFloat(numeric_limits<float>::min());
	}

	Inanity::Math::HardFloat numeric_limits<Inanity::Math::HardFloat>::lowest()
	{
		return Inanity::Math::HardFloat(numeric_limits<float>::lowest());
	}

	Inanity::Math::HardFloat numeric_limits<Inanity::Math::HardFloat>::max()
	{
		return Inanity::Math::HardFloat(numeric_limits<float>::max());
	}
}
<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: bastype3.hxx,v $
 *
 *  $Revision: 1.3 $
 *
 *  last change: $Author: rt $ $Date: 2005-09-07 20:01:01 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library 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
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/
#ifndef _BASTYPE3_HXX
#define _BASTYPE3_HXX

#ifndef _SVHEADER_HXX
#include <svheader.hxx>
#endif

#include <svtools/svmedit.hxx>

#include <iderid.hxx>

class EditorWindow;

#ifndef NO_SPECIALEDIT

class ExtendedEdit : public Edit
{
private:
    Accelerator     aAcc;
    Link            aAccHdl;
    Link            aGotFocusHdl;
    Link            aLoseFocusHdl;

protected:
    DECL_LINK( EditAccHdl, Accelerator * );
    DECL_LINK( ImplGetFocusHdl, Control* );
    DECL_LINK( ImplLoseFocusHdl, Control* );

public:
                    ExtendedEdit( Window* pParent, IDEResId nRes );

    void            SetAccHdl( const Link& rLink )          { aAccHdl = rLink; }
    void            SetLoseFocusHdl( const Link& rLink )    { aLoseFocusHdl = rLink; }
    void            SetGotFocusHdl( const Link& rLink )     { aGotFocusHdl = rLink; }
    Accelerator&    GetAccelerator()                        { return aAcc; }
};

class ExtendedMultiLineEdit : public MultiLineEdit
{
private:
    Accelerator     aAcc;
    Link            aAccHdl;

protected:
    DECL_LINK( EditAccHdl, Accelerator * );
    DECL_LINK( ImplGetFocusHdl, Control* );
    DECL_LINK( ImplLoseFocusHdl, Control* );

public:
                    ExtendedMultiLineEdit( Window* pParent, IDEResId nRes );

    void            SetAccHdl( const Link& rLink )          { aAccHdl = rLink; }
    Accelerator&    GetAccelerator()                        { return aAcc; }
};

#endif  //NO_SPECIALEDIT

#endif  // _BASTYPE3_HXX
<commit_msg>INTEGRATION: CWS changefileheader (1.3.244); FILE MERGED 2008/04/01 10:47:45 thb 1.3.244.2: #i85898# Stripping all external header guards 2008/03/28 16:04:43 rt 1.3.244.1: #i87441# Change license header to LPGL v3.<commit_after>/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2008 by Sun Microsystems, Inc.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * $RCSfile: bastype3.hxx,v $
 * $Revision: 1.4 $
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org 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 Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/
#ifndef _BASTYPE3_HXX
#define _BASTYPE3_HXX

#include <svheader.hxx>

#include <svtools/svmedit.hxx>

#include <iderid.hxx>

class EditorWindow;

#ifndef NO_SPECIALEDIT

class ExtendedEdit : public Edit
{
private:
    Accelerator     aAcc;
    Link            aAccHdl;
    Link            aGotFocusHdl;
    Link            aLoseFocusHdl;

protected:
    DECL_LINK( EditAccHdl, Accelerator * );
    DECL_LINK( ImplGetFocusHdl, Control* );
    DECL_LINK( ImplLoseFocusHdl, Control* );

public:
                    ExtendedEdit( Window* pParent, IDEResId nRes );

    void            SetAccHdl( const Link& rLink )          { aAccHdl = rLink; }
    void            SetLoseFocusHdl( const Link& rLink )    { aLoseFocusHdl = rLink; }
    void            SetGotFocusHdl( const Link& rLink )     { aGotFocusHdl = rLink; }
    Accelerator&    GetAccelerator()                        { return aAcc; }
};

class ExtendedMultiLineEdit : public MultiLineEdit
{
private:
    Accelerator     aAcc;
    Link            aAccHdl;

protected:
    DECL_LINK( EditAccHdl, Accelerator * );
    DECL_LINK( ImplGetFocusHdl, Control* );
    DECL_LINK( ImplLoseFocusHdl, Control* );

public:
                    ExtendedMultiLineEdit( Window* pParent, IDEResId nRes );

    void            SetAccHdl( const Link& rLink )          { aAccHdl = rLink; }
    Accelerator&    GetAccelerator()                        { return aAcc; }
};

#endif  //NO_SPECIALEDIT

#endif  // _BASTYPE3_HXX
<|endoftext|>


<commit_before>/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2008 by Sun Microsystems, Inc.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * $RCSfile: iderdll2.hxx,v $
 * $Revision: 1.5 $
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org 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 Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

#ifndef _IDERDLL2_HXX
#define _IDERDLL2_HXX

class StarBASIC;
class SvxSearchItem;
class Accelerator;

#include <tools/string.hxx>
#include <tools/gen.hxx>
#include <tools/link.hxx>

#include <bastypes.hxx>
#include <bastype2.hxx>

#define INVPOSITION 0x7fff

class BasicIDEData
{
private:
    Accelerator*    pAccelerator;
    SvxSearchItem*  pSearchItem;

    LibInfos        aLibInfos;

    BasicEntryDescriptor    m_aLastEntryDesc;

    Point           aObjCatPos;
    Size            aObjCatSize;

    String          aAddLibPath;
    String          aAddLibFilter;

    USHORT          nBasicDialogCount;

    BOOL            OLD_bRelMacroRecording;
    BOOL            bChoosingMacro;
    BOOL            bShellInCriticalSection;

    void            InitAccelerator();

protected:
    DECL_LINK( GlobalBasicBreakHdl, StarBASIC * );

public:
                            BasicIDEData();
                            ~BasicIDEData();

    LibInfos&               GetLibInfos() { return aLibInfos; }

    BasicEntryDescriptor&   GetLastEntryDescriptor()    { return m_aLastEntryDesc; }
    void                    SetLastEntryDescriptor( BasicEntryDescriptor& rDesc ) { m_aLastEntryDesc = rDesc; }

    BOOL&                   ChoosingMacro()             { return bChoosingMacro; }
    BOOL&                   ShellInCriticalSection()    { return bShellInCriticalSection; }

    USHORT                  GetBasicDialogCount() const { return nBasicDialogCount; }
    void                    IncBasicDialogCount()       { nBasicDialogCount++; }
    void                    DecBasicDialogCount()       { nBasicDialogCount--; }

    SvxSearchItem&          GetSearchItem() const;
    void                    SetSearchItem( const SvxSearchItem& rItem );

    void                    SetObjectCatalogPos( const Point& rPnt )
                                { aObjCatPos = rPnt; }
    const Point&            GetObjectCatalogPos() const
                                { return aObjCatPos; }

    void                    SetObjectCatalogSize( const Size& rSize )
                                { aObjCatSize = rSize; }
    const Size&             GetObjectCatalogSize() const
                                { return aObjCatSize; }

    const String&           GetAddLibPath() const   { return aAddLibPath; }
    void                    SetAddLibPath( const String& rPath ) { aAddLibPath = rPath; }

    const String&           GetAddLibFilter() const { return aAddLibFilter; }
    void                    SetAddLibFilter( const String& rFilter )  { aAddLibFilter = rFilter; }

    Accelerator*            GetAccelerator()
                            {
                                if ( !pAccelerator )
                                    InitAccelerator();
                                return pAccelerator;
                            }

    DECL_LINK( ExecuteMacroEvent, void * );
};

#endif //_IDERDLL2_HXX
<commit_msg>INTEGRATION: CWS ab53 (1.5.10); FILE MERGED 2008/06/06 13:13:17 ab 1.5.10.1: #i89523# Removed unused code<commit_after>/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2008 by Sun Microsystems, Inc.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * $RCSfile: iderdll2.hxx,v $
 * $Revision: 1.6 $
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org 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 Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

#ifndef _IDERDLL2_HXX
#define _IDERDLL2_HXX

class StarBASIC;
class SvxSearchItem;
class Accelerator;

#include <tools/string.hxx>
#include <tools/gen.hxx>
#include <tools/link.hxx>

#include <bastypes.hxx>
#include <bastype2.hxx>

#define INVPOSITION 0x7fff

class BasicIDEData
{
private:
    Accelerator*    pAccelerator;
    SvxSearchItem*  pSearchItem;

    LibInfos        aLibInfos;

    BasicEntryDescriptor    m_aLastEntryDesc;

    Point           aObjCatPos;
    Size            aObjCatSize;

    String          aAddLibPath;
    String          aAddLibFilter;

    USHORT          nBasicDialogCount;

    BOOL            OLD_bRelMacroRecording;
    BOOL            bChoosingMacro;
    BOOL            bShellInCriticalSection;

protected:
    DECL_LINK( GlobalBasicBreakHdl, StarBASIC * );

public:
                            BasicIDEData();
                            ~BasicIDEData();

    LibInfos&               GetLibInfos() { return aLibInfos; }

    BasicEntryDescriptor&   GetLastEntryDescriptor()    { return m_aLastEntryDesc; }
    void                    SetLastEntryDescriptor( BasicEntryDescriptor& rDesc ) { m_aLastEntryDesc = rDesc; }

    BOOL&                   ChoosingMacro()             { return bChoosingMacro; }
    BOOL&                   ShellInCriticalSection()    { return bShellInCriticalSection; }

    USHORT                  GetBasicDialogCount() const { return nBasicDialogCount; }
    void                    IncBasicDialogCount()       { nBasicDialogCount++; }
    void                    DecBasicDialogCount()       { nBasicDialogCount--; }

    SvxSearchItem&          GetSearchItem() const;
    void                    SetSearchItem( const SvxSearchItem& rItem );

    void                    SetObjectCatalogPos( const Point& rPnt )
                                { aObjCatPos = rPnt; }
    const Point&            GetObjectCatalogPos() const
                                { return aObjCatPos; }

    void                    SetObjectCatalogSize( const Size& rSize )
                                { aObjCatSize = rSize; }
    const Size&             GetObjectCatalogSize() const
                                { return aObjCatSize; }

    const String&           GetAddLibPath() const   { return aAddLibPath; }
    void                    SetAddLibPath( const String& rPath ) { aAddLibPath = rPath; }

    const String&           GetAddLibFilter() const { return aAddLibFilter; }
    void                    SetAddLibFilter( const String& rFilter )  { aAddLibFilter = rFilter; }

    DECL_LINK( ExecuteMacroEvent, void * );
};

#endif //_IDERDLL2_HXX
<|endoftext|>