rename ssl -> openssl, cv -> opencv

This commit is contained in:
David Rose 2005-09-21 23:50:36 +00:00
parent a4680750b6
commit f91ee87026
15 changed files with 263 additions and 107 deletions

View File

@ -362,12 +362,12 @@
#define HAVE_STL_HASH
// Is OpenSSL installed, and where?
#define SSL_IPATH /usr/local/ssl/include
#define SSL_LPATH /usr/local/ssl/lib
#define SSL_LIBS ssl crypto
#defer HAVE_SSL $[libtest $[SSL_LPATH],$[SSL_LIBS]]
#define OPENSSL_IPATH /usr/local/ssl/include
#define OPENSSL_LPATH /usr/local/ssl/lib
#define OPENSSL_LIBS ssl crypto
#defer HAVE_OPENSSL $[libtest $[OPENSSL_LPATH],$[OPENSSL_LIBS]]
// Define this nonempty if your version of OpenSSL is 0.9.7 or better.
#define SSL_097
#define OPENSSL_097
// Define this true to include the OpenSSL code to report verbose
// error messages when they occur.
@ -511,10 +511,10 @@
#defer HAVE_DX $[libtest $[DX_LPATH],$[DX_LIBS]]
// Is OpenCV installed, and where?
#define CV_IPATH /usr/local/include/opencv
#define CV_LPATH /usr/local/lib
#define CV_LIBS $[if $[WINDOWS_PLATFORM],cv.lib highgui.lib cxcore.lib,cv highgui cxcore]
#defer HAVE_CV $[libtest $[CV_LPATH],$[CV_LIBS]]
#define OPENCV_IPATH /usr/local/include/opencv
#define OPENCV_LPATH /usr/local/lib
#define OPENCV_LIBS $[if $[WINDOWS_PLATFORM],cv.lib highgui.lib cxcore.lib,cv highgui cxcore]
#defer HAVE_OPENCV $[libtest $[OPENCV_LPATH],$[OPENCV_LIBS]]
// Do you want to build the DirectD tools for starting Panda clients
// remotely? This only affects the direct tree. Enabling this may

View File

@ -16,7 +16,7 @@
#else
#print - Did not find NSPR
#endif
#if $[HAVE_SSL]
#if $[HAVE_OPENSSL]
#print + OpenSSL
#else
#print - Did not find OpenSSL
@ -86,7 +86,7 @@
#else
#print - Did not find DirectX
#endif
#if $[HAVE_CV]
#if $[HAVE_OPENCV]
#print + OpenCV
#else
#print - Did not find OpenCV
@ -144,8 +144,8 @@ $[cdefine HAVE_SOFTIMAGE]
$[cdefine HAVE_NSPR]
/* Define if we have OpenSSL installed. */
$[cdefine HAVE_SSL]
$[cdefine SSL_097]
$[cdefine HAVE_OPENSSL]
$[cdefine OPENSSL_097]
$[cdefine REPORT_OPENSSL_ERRORS]
/* Define if we have libjpeg installed. */
@ -182,7 +182,7 @@ $[cdefine HAVE_ZLIB]
$[cdefine HAVE_GL]
/* Define if we have OpenCV installed and want to build for OpenCV. */
$[cdefine HAVE_CV]
$[cdefine HAVE_OPENCV]
/* Define if we have Mesa installed and want to build mesadisplay. */

View File

@ -113,10 +113,10 @@
#set NSPR_LIBS $[NSPR_LIBS]
#set HAVE_NSPR $[HAVE_NSPR]
#set SSL_IPATH $[unixfilename $[SSL_IPATH]]
#set SSL_LPATH $[unixfilename $[SSL_LPATH]]
#set SSL_LIBS $[SSL_LIBS]
#set HAVE_SSL $[HAVE_SSL]
#set OPENSSL_IPATH $[unixfilename $[OPENSSL_IPATH]]
#set OPENSSL_LPATH $[unixfilename $[OPENSSL_LPATH]]
#set OPENSSL_LIBS $[OPENSSL_LIBS]
#set HAVE_OPENSSL $[HAVE_OPENSSL]
#set JPEG_IPATH $[unixfilename $[JPEG_IPATH]]
#set JPEG_LPATH $[unixfilename $[JPEG_LPATH]]
@ -192,10 +192,10 @@
#set DX_LIBS $[DX_LIBS]
#set HAVE_DX $[HAVE_DX]
#set CV_IPATH $[unixfilename $[CV_IPATH]]
#set CV_LPATH $[unixfilename $[CV_LPATH]]
#set CV_LIBS $[CV_LIBS]
#set HAVE_CV $[HAVE_CV]
#set OPENCV_IPATH $[unixfilename $[OPENCV_IPATH]]
#set OPENCV_LPATH $[unixfilename $[OPENCV_LPATH]]
#set OPENCV_LIBS $[OPENCV_LIBS]
#set HAVE_OPENCV $[HAVE_OPENCV]
#set HAVE_THREADS $[HAVE_THREADS]

View File

@ -104,11 +104,11 @@
#define nspr_libs $[NSPR_LIBS]
#endif
#if $[HAVE_SSL]
#define ssl_ipath $[wildcard $[SSL_IPATH]]
#define ssl_lpath $[wildcard $[SSL_LPATH]]
#define ssl_cflags $[SSL_CFLAGS]
#define ssl_libs $[SSL_LIBS]
#if $[HAVE_OPENSSL]
#define openssl_ipath $[wildcard $[OPENSSL_IPATH]]
#define openssl_lpath $[wildcard $[OPENSSL_LPATH]]
#define openssl_cflags $[OPENSSL_CFLAGS]
#define openssl_libs $[OPENSSL_LIBS]
#endif
#if $[HAVE_ZLIB]
@ -160,11 +160,11 @@
#define dx_libs $[DX_LIBS]
#endif
#if $[HAVE_CV]
#define cv_ipath $[wildcard $[CV_IPATH]]
#define cv_lpath $[wildcard $[CV_LPATH]]
#define cv_cflags $[CV_CFLAGS]
#define cv_libs $[CV_LIBS]
#if $[HAVE_OPENCV]
#define opencv_ipath $[wildcard $[OPENCV_IPATH]]
#define opencv_lpath $[wildcard $[OPENCV_LPATH]]
#define opencv_cflags $[OPENCV_CFLAGS]
#define opencv_libs $[OPENCV_LIBS]
#endif
#if $[HAVE_JPEG]

View File

@ -16,52 +16,74 @@
//
////////////////////////////////////////////////////////////////////
//Windows has isnan in a different place and with a different name
//than everyone else. Sheesh
#ifdef _WIN32
#include <float.h>
#endif
#ifdef __APPLE__
#define isnan( x ) ( ( sizeof ( x ) == sizeof(double) ) ? \
__isnand ( x ) : \
( sizeof ( x ) == sizeof( float) ) ? \
__isnanf ( x ) : \
__isnan ( x ) )
#define isnan(x) \
((sizeof(x) == sizeof(double)) ? \
__isnand(x) : \
(sizeof(x) == sizeof(float)) ? __isnanf(x) : __isnan(x))
#endif
INLINE float csqrt(float v) {
#ifdef __INTEL_COMPILER
// see float.h
#define FPU_CONTROLWORD_WRITEMASK 0xFFFFF // if you look at defn of _CW_DEFAULT, all settings fall within 0xFFFFF
#define FPU_CONTROLWORD_NEW_SETTING _CW_DEFAULT
#endif
////////////////////////////////////////////////////////////////////
// Function: csqrt
// Description:
////////////////////////////////////////////////////////////////////
INLINE float
csqrt(float v) {
return sqrtf(v);
}
INLINE float csin(float v) {
////////////////////////////////////////////////////////////////////
// Function: csin
// Description:
////////////////////////////////////////////////////////////////////
INLINE float
csin(float v) {
return sinf(v);
}
INLINE float ccos(float v) {
////////////////////////////////////////////////////////////////////
// Function: ccos
// Description:
////////////////////////////////////////////////////////////////////
INLINE float
ccos(float v) {
return cosf(v);
}
////////////////////////////////////////////////////////////////////
// Function: ctan
// Description:
////////////////////////////////////////////////////////////////////
INLINE float ctan(float v) {
return tanf(v);
}
////////////////////////////////////////////////////////////////////
// Function: csincos
// Description:
////////////////////////////////////////////////////////////////////
INLINE void
csincos(float v, float *pSinResult, float *pCosResult) {
csincos(float v, float *sin_result, float *cos_result) {
// MS VC defines _M_IX86 for x86. gcc should define _X86_
#if defined(_M_IX86) || defined(_X86_)
//#define fsincos_opcode __asm _emit 0xd9 __asm _emit 0xfb
__asm {
mov eax, pSinResult
mov edx, pCosResult
mov eax, sin_result
mov edx, cos_result
fld v
fsincos
fstp DWORD ptr [edx]
fstp DWORD ptr [eax]
}
#else //!_X86_
*pSinResult = sinf(v);
*pCosResult = cosf(v);
*sin_result = sinf(v);
*cos_result = cosf(v);
#endif //!_X86_
}
@ -78,33 +100,68 @@ csin_over_x(float v) {
}
}
INLINE float cabs(float v) {
////////////////////////////////////////////////////////////////////
// Function: cabs
// Description:
////////////////////////////////////////////////////////////////////
INLINE float
cabs(float v) {
return fabs(v);
}
INLINE float catan(float v) {
////////////////////////////////////////////////////////////////////
// Function: catan
// Description:
////////////////////////////////////////////////////////////////////
INLINE float
catan(float v) {
return atanf(v);
}
INLINE float catan2(float y, float x) {
////////////////////////////////////////////////////////////////////
// Function: catan2
// Description:
////////////////////////////////////////////////////////////////////
INLINE float
catan2(float y, float x) {
return atan2f(y, x);
}
INLINE float casin(float v) {
////////////////////////////////////////////////////////////////////
// Function: casin
// Description:
////////////////////////////////////////////////////////////////////
INLINE float
casin(float v) {
return asinf(v);
}
INLINE float cacos(float v) {
////////////////////////////////////////////////////////////////////
// Function: cacos
// Description:
////////////////////////////////////////////////////////////////////
INLINE float
cacos(float v) {
return acosf(v);
}
#ifdef __INTEL_COMPILER
// see float.h
#define FPU_CONTROLWORD_WRITEMASK 0xFFFFF // if you look at defn of _CW_DEFAULT, all settings fall within 0xFFFFF
#define FPU_CONTROLWORD_NEW_SETTING _CW_DEFAULT
#endif
////////////////////////////////////////////////////////////////////
// Function: cmod
// Description: This is similar to fmod(), but it behaves properly
// when x is negative: that is, it always returns a
// value in the range [0, y), assuming y is positive.
////////////////////////////////////////////////////////////////////
INLINE float
cmod(float x, float y) {
return x - cfloor(x / y) * y;
}
INLINE double cfloor(double f) {
////////////////////////////////////////////////////////////////////
// Function: cfloor
// Description:
////////////////////////////////////////////////////////////////////
INLINE double
cfloor(double f) {
#ifdef __INTEL_COMPILER
// intel floor doesnt work right if fpu mode is not double, so make double-prec mode is on
unsigned int saved_fpu_control_word=_controlfp(0x0,0x0);
@ -117,7 +174,12 @@ INLINE double cfloor(double f) {
#endif
}
INLINE double cceil(double f) {
////////////////////////////////////////////////////////////////////
// Function: cceil
// Description:
////////////////////////////////////////////////////////////////////
INLINE double
cceil(double f) {
#ifdef __INTEL_COMPILER
// intel ceil doesnt work right if fpu mode is not double, so make double-prec mode is on
unsigned int saved_fpu_control_word=_controlfp(0x0,0x0);
@ -130,37 +192,61 @@ INLINE double cceil(double f) {
#endif
}
INLINE double csqrt(double v) {
////////////////////////////////////////////////////////////////////
// Function: csqrt
// Description:
////////////////////////////////////////////////////////////////////
INLINE double
csqrt(double v) {
return sqrt(v);
}
INLINE double csin(double v) {
////////////////////////////////////////////////////////////////////
// Function: csin
// Description:
////////////////////////////////////////////////////////////////////
INLINE double
csin(double v) {
return sin(v);
}
INLINE double ccos(double v) {
////////////////////////////////////////////////////////////////////
// Function: ccos
// Description:
////////////////////////////////////////////////////////////////////
INLINE double
ccos(double v) {
return cos(v);
}
INLINE double ctan(double v) {
////////////////////////////////////////////////////////////////////
// Function: ctan
// Description:
////////////////////////////////////////////////////////////////////
INLINE double
ctan(double v) {
return tan(v);
}
////////////////////////////////////////////////////////////////////
// Function: csincos
// Description:
////////////////////////////////////////////////////////////////////
INLINE void
csincos(double v, double *pSinResult, double *pCosResult) {
csincos(double v, double *sin_result, double *cos_result) {
#if defined(_M_IX86) || defined(_X86_)
//#define fsincos_opcode __asm _emit 0xd9 __asm _emit 0xfb
__asm {
mov eax, pSinResult
mov edx, pCosResult
mov eax, sin_result
mov edx, cos_result
fld v
fsincos
fstp QWORD ptr [edx]
fstp QWORD ptr [eax]
}
#else //!_X86_
*pSinResult = sin(v);
*pCosResult = cos(v);
*sin_result = sin(v);
*cos_result = cos(v);
#endif //!_X86_
}
@ -177,27 +263,68 @@ csin_over_x(double v) {
}
}
INLINE double cabs(double v) {
////////////////////////////////////////////////////////////////////
// Function: cabs
// Description:
////////////////////////////////////////////////////////////////////
INLINE double
cabs(double v) {
return fabs(v);
}
INLINE double catan(double v) {
////////////////////////////////////////////////////////////////////
// Function: catan
// Description:
////////////////////////////////////////////////////////////////////
INLINE double
catan(double v) {
return atan(v);
}
INLINE double catan2(double y, double x) {
////////////////////////////////////////////////////////////////////
// Function: catan2
// Description:
////////////////////////////////////////////////////////////////////
INLINE double
catan2(double y, double x) {
return atan2(y, x);
}
INLINE double casin(double v) {
////////////////////////////////////////////////////////////////////
// Function: casin
// Description:
////////////////////////////////////////////////////////////////////
INLINE double
casin(double v) {
return asin(v);
}
INLINE double cacos(double v) {
////////////////////////////////////////////////////////////////////
// Function: cacos
// Description:
////////////////////////////////////////////////////////////////////
INLINE double
cacos(double v) {
return acos(v);
}
INLINE bool cnan(double v) {
////////////////////////////////////////////////////////////////////
// Function: cmod
// Description: This is similar to fmod(), but it behaves properly
// when x is negative: that is, it always returns a
// value in the range [0, y), assuming y is positive.
////////////////////////////////////////////////////////////////////
INLINE double
cmod(double x, double y) {
return x - cfloor(x / y) * y;
}
////////////////////////////////////////////////////////////////////
// Function: cnan
// Description:
////////////////////////////////////////////////////////////////////
INLINE bool
cnan(double v) {
#ifndef _WIN32
return (isnan(v) != 0);
#else
@ -206,3 +333,21 @@ INLINE bool cnan(double v) {
}
////////////////////////////////////////////////////////////////////
// Function: cmod
// Description: This is similar to fmod(), but it behaves properly
// when x is negative: that is, it always returns a
// value in the range [0, y), assuming y is positive.
//
// This integer-valued function is provided since the
// built-in modulo operator % does not work properly for
// negative x.
////////////////////////////////////////////////////////////////////
INLINE int
cmod(int x, int y) {
if (x < 0) {
return y - 1 - ((-x - 1) % y);
} else {
return x % y;
}
}

View File

@ -19,28 +19,34 @@
#ifndef CMATH_H
#define CMATH_H
#include "dtoolbase.h"
#include <math.h>
// This file declares a number of C++-style overloading wrappers
// around the standard math library functions, so we can use
// overloading to differentiate on type instead of having to know
// explicitly whether we need to call, for instance, sqrtf() or
// sqrt().
#include "dtoolbase.h"
#include <math.h>
// Windows defines isnan() in a different place and with a different
// name than everyone else. Sheesh.
#ifdef _WIN32
#include <float.h>
#endif
INLINE float csqrt(float v);
INLINE float csin(float v);
INLINE float ccos(float v);
INLINE float ctan(float v);
INLINE void csincos(float v, float *pSinResult, float *pCosResult); // does both at once (faster on x86)
INLINE void csincos(float v, float *sin_result, float *cos_result);
INLINE float csin_over_x(float v);
INLINE float cabs(float v);
INLINE float catan(float v);
INLINE float catan2(float y, float x);
INLINE float casin(float v);
//INLINE float cfloor(float f);
//INLINE float cceil(float f);
INLINE float cacos(float v);
INLINE float cmod(float x, float y);
INLINE double cfloor(double f);
INLINE double cceil(double f);
@ -48,16 +54,20 @@ INLINE double csqrt(double v);
INLINE double csin(double v);
INLINE double ccos(double v);
INLINE double ctan(double v);
INLINE void csincos(double v, double *pSinResult, double *pCosResult); // does both at once (faster on x86)
INLINE void csincos(double v, double *sin_result, double *cos_result);
INLINE double cabs(double v);
INLINE double catan(double v);
INLINE double catan2(double y, double x);
INLINE double casin(double y, double x);
INLINE double casin(double v);
INLINE double cacos(double v);
INLINE double cmod(double x, double y);
// Returns true if the number is nan, false if it's a genuine number
// or infinity.
INLINE bool cnan(double v);
INLINE int cmod(int x, int y);
#include "cmath.I"
#endif

View File

@ -1,7 +1,7 @@
#define BUILD_DIRECTORY $[HAVE_INTERROGATE]
#define LOCAL_LIBS cppParser pystub interrogatedb dconfig dtoolutil dtoolbase
#define USE_PACKAGES ssl
#define USE_PACKAGES openssl
#begin bin_target
#define TARGET interrogate

View File

@ -1,5 +1,5 @@
#define LOCAL_LIBS dtoolutil dtoolbase
#define USE_PACKAGES ssl
#define USE_PACKAGES openssl
#begin lib_target
#define TARGET prc

View File

@ -25,7 +25,7 @@
#include <ctype.h>
#ifdef HAVE_SSL
#ifdef HAVE_OPENSSL
#include <openssl/evp.h>
#endif
@ -133,7 +133,7 @@ read_prc(istream &in) {
static const size_t buffer_size = 1024;
char buffer[buffer_size];
#ifdef HAVE_SSL
#ifdef HAVE_OPENSSL
// Set up the evp context for verifying the signature, if we find
// one.
#ifdef SSL_097
@ -142,7 +142,7 @@ read_prc(istream &in) {
_md_ctx = new EVP_MD_CTX;
#endif
EVP_VerifyInit((EVP_MD_CTX *)_md_ctx, EVP_sha1());
#endif // HAVE_SSL
#endif // HAVE_OPENSSL
string prev_line;
@ -194,7 +194,7 @@ read_prc(istream &in) {
read_prc_line(prev_line);
}
#ifdef HAVE_SSL
#ifdef HAVE_OPENSSL
// Now validate the signature and free the SSL structures.
if (!_signature.empty()) {
PrcKeyRegistry *pkr = PrcKeyRegistry::get_global_ptr();
@ -221,7 +221,7 @@ read_prc(istream &in) {
#else
delete (EVP_MD_CTX *)_md_ctx;
#endif
#endif // HAVE_SSL
#endif // HAVE_OPENSSL
bool failed = (in.fail() && !in.eof());
@ -381,11 +381,11 @@ read_prc_line(const string &line) {
return;
}
#ifdef HAVE_SSL
#ifdef HAVE_OPENSSL
// Accumulate any line that's not itself a signature into the hash,
// so we can validate the signature at the end.
EVP_VerifyUpdate((EVP_MD_CTX *)_md_ctx, line.data(), line.size());
#endif // HAVE_SSL
#endif // HAVE_OPENSSL
// Separate the line into a variable and a value.
size_t p = 0;

View File

@ -86,11 +86,11 @@ private:
string _signature;
#ifdef HAVE_SSL
#ifdef HAVE_OPENSSL
// This maintains the hash of the prc file as we are scanning it, so
// we can compare its signature which we discover at the end.
void *_md_ctx;
#endif // HAVE_SSL
#endif // HAVE_OPENSSL
static ConfigPage *_default_page;
static ConfigPage *_local_page;

View File

@ -86,6 +86,7 @@ make_variable(const string &name) {
_variables_by_name[name] = variable;
_variables.push_back(variable);
return variable;
}

View File

@ -23,7 +23,7 @@
// the OpenSSL library to manage keys and to sign and validate
// signatures.
#ifdef HAVE_SSL
#ifdef HAVE_OPENSSL
#include <openssl/pem.h>
@ -183,4 +183,4 @@ get_global_ptr() {
return _global_ptr;
}
#endif // HAVE_SSL
#endif // HAVE_OPENSSL

View File

@ -25,7 +25,7 @@
// the OpenSSL library to manage keys and to sign and validate
// signatures.
#ifdef HAVE_SSL
#ifdef HAVE_OPENSSL
#include "pvector.h"
#include <openssl/evp.h>
@ -82,7 +82,7 @@ private:
#include "prcKeyRegistry.I"
#endif // HAVE_SSL
#endif // HAVE_OPENSSL
#endif

View File

@ -1,8 +1,8 @@
#define LOCAL_LIBS pystub dtoolutil dtoolbase prc dconfig interrogatedb
#begin bin_target
#define BUILD_TARGET $[HAVE_SSL]
#define USE_PACKAGES ssl
#define BUILD_TARGET $[HAVE_OPENSSL]
#define USE_PACKAGES openssl
#define TARGET make-prc-key
@ -15,8 +15,8 @@
#end bin_target
// #begin bin_target
// #define BUILD_TARGET $[HAVE_SSL]
// #define USE_PACKAGES ssl
// #define BUILD_TARGET $[HAVE_OPENSSL]
// #define USE_PACKAGES openssl
//
// #define TARGET panda-sign1
//

View File

@ -1,5 +1,5 @@
#define LOCAL_LIBS pystub interrogatedb dconfig dtoolutil dtoolbase
#define USE_PACKAGES ssl
#define USE_PACKAGES openssl
#begin bin_target
#define TARGET test_interrogate