diff options
author | joye <joye> | 2015-06-25 15:46:42 (GMT) |
---|---|---|
committer | joye <joye> | 2015-06-25 15:46:42 (GMT) |
commit | 945c8cd8efad48786d7fb8c5fcb88ca00c230977 (patch) | |
tree | 4fcbf73146aa081351cb7e64f446d0edd7417808 /src | |
parent | 0a2c6340848a423fd27745507f467c13d73eba98 (diff) | |
download | blt-945c8cd8efad48786d7fb8c5fcb88ca00c230977.zip blt-945c8cd8efad48786d7fb8c5fcb88ca00c230977.tar.gz blt-945c8cd8efad48786d7fb8c5fcb88ca00c230977.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r-- | src/bltGrPSOutput.C | 7 | ||||
-rw-r--r-- | src/bltVecCmd.C | 4 | ||||
-rw-r--r-- | src/bltVecInt.h | 4 | ||||
-rw-r--r-- | src/bltVecMath.C | 26 | ||||
-rw-r--r-- | src/bltVector.C | 2 |
5 files changed, 18 insertions, 25 deletions
diff --git a/src/bltGrPSOutput.C b/src/bltGrPSOutput.C index 8ef802b..6d7f2e1 100644 --- a/src/bltGrPSOutput.C +++ b/src/bltGrPSOutput.C @@ -31,6 +31,7 @@ #include <math.h> #include <stdlib.h> #include <string.h> +#include <time.h> #include "tk.h" @@ -458,16 +459,12 @@ int PSOutput::preamble(const char* fileName) format("%%%%Creator: (%s %s %s)\n", PACKAGE_NAME, PACKAGE_VERSION, Tk_Class(graphPtr_->tkwin_)); - char date[200]; -#ifndef _WIN32 time_t ticks = time((time_t *) NULL); + char date[200]; strcpy(date, ctime(&ticks)); char* newline = date + strlen(date) - 1; if (*newline == '\n') *newline = '\0'; -#else - strcpy(date,"Unknown"); -#endif format("%%%%CreationDate: (%s)\n", date); format("%%%%Title: (%s)\n", fileName); diff --git a/src/bltVecCmd.C b/src/bltVecCmd.C index e9af214..e4581dc 100644 --- a/src/bltVecCmd.C +++ b/src/bltVecCmd.C @@ -1239,11 +1239,7 @@ static int RandomOp(Vector *vPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[]) { for (int i = 0; i < vPtr->length; i++) -#ifdef _WIN32 - vPtr->valueArr[i] = double(rand())/RAND_MAX; -#else vPtr->valueArr[i] = drand48(); -#endif if (vPtr->flush) Vec_FlushCache(vPtr); diff --git a/src/bltVecInt.h b/src/bltVecInt.h index cfe290b..ca90228 100644 --- a/src/bltVecInt.h +++ b/src/bltVecInt.h @@ -195,3 +195,7 @@ namespace Blt { extern Tcl_IdleProc Blt_Vec_NotifyClients; +#ifdef _WIN32 +double drand48(void); +void srand48(long int seed); +#endif diff --git a/src/bltVecMath.C b/src/bltVecMath.C index 06881d4..1e79a7b 100644 --- a/src/bltVecMath.C +++ b/src/bltVecMath.C @@ -1471,16 +1471,6 @@ static int VectorFunc(ClientData clientData, Tcl_Interp* interp, Vector *vPtr) return (*procPtr) (vPtr); } -#ifdef _WIN32 -static int Rand(Blt_Vector *vectorPtr) -{ - Vector *vPtr = (Vector *)vectorPtr; - for(double *vp=vPtr->valueArr+vPtr->first, *vend=vPtr->valueArr+vPtr->last; - vp <= vend; vp++) - *vp = double(rand())/RAND_MAX; - return TCL_OK; -} -#endif static MathFunction mathFunctions[] = { @@ -1507,11 +1497,7 @@ static MathFunction mathFunctions[] = {"q1", (void*)ScalarFunc, (ClientData)Q1}, {"q3", (void*)ScalarFunc, (ClientData)Q3}, {"prod", (void*)ScalarFunc, (ClientData)Product}, -#ifdef _WIN32 - {"random", (void*)VectorFunc, (ClientData)Rand}, -#else {"random", (void*)ComponentFunc, (ClientData)drand48}, -#endif {"round", (void*)ComponentFunc, (ClientData)Round}, {"sdev", (void*)ScalarFunc, (ClientData)StdDeviation}, {"sin", (void*)ComponentFunc, (ClientData)sin}, @@ -1603,3 +1589,15 @@ int Blt::ExprVector(Tcl_Interp* interp, char *string, Blt_Vector *vector) Vec_Free(value.vPtr); return TCL_OK; } + +#ifdef _WIN32 +double drand48(void) +{ + return (double)rand() / (double)RAND_MAX; +} + +void srand48(long int seed) +{ + srand(seed); +} +#endif diff --git a/src/bltVector.C b/src/bltVector.C index e637204..51a2596 100644 --- a/src/bltVector.C +++ b/src/bltVector.C @@ -1240,9 +1240,7 @@ VectorInterpData* Blt::Vec_GetInterpData(Tcl_Interp* interp) Tcl_InitHashTable(&dataPtr->indexProcTable, TCL_STRING_KEYS); Vec_InstallMathFunctions(&dataPtr->mathProcTable); Vec_InstallSpecialIndices(&dataPtr->indexProcTable); -#ifndef _WIN32 srand48(time((time_t *) NULL)); -#endif } return dataPtr; } |