summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bltConfig.h4
-rw-r--r--src/bltGrPSOutput.C2
-rw-r--r--src/bltGrText.C4
-rw-r--r--src/bltOp.C8
-rw-r--r--src/bltParse.C148
-rw-r--r--src/bltVecMath.C378
-rw-r--r--src/bltVector.C10
7 files changed, 80 insertions, 474 deletions
diff --git a/src/bltConfig.h b/src/bltConfig.h
index 286b1e6..4210c92 100644
--- a/src/bltConfig.h
+++ b/src/bltConfig.h
@@ -38,8 +38,6 @@
extern const char* fillObjOption[];
extern Tk_ObjCustomOption dashesObjOption;
extern Tk_ObjCustomOption listObjOption;
-extern "C" {
- Tk_CustomOptionRestoreProc RestoreProc;
-};
+extern Tk_CustomOptionRestoreProc RestoreProc;
#endif
diff --git a/src/bltGrPSOutput.C b/src/bltGrPSOutput.C
index 6e62147..c4dfb92 100644
--- a/src/bltGrPSOutput.C
+++ b/src/bltGrPSOutput.C
@@ -31,10 +31,8 @@
#include <math.h>
#include <stdarg.h>
-extern "C" {
#include <tkPort.h>
#include <tk3d.h>
-};
#include "bltGraph.h"
#include "bltGrPostscript.h"
diff --git a/src/bltGrText.C b/src/bltGrText.C
index fe5bb28..8e64606 100644
--- a/src/bltGrText.C
+++ b/src/bltGrText.C
@@ -29,11 +29,11 @@
#include <math.h>
-extern "C" {
+//extern "C" {
#include <tk.h>
#include <tkPort.h>
#include <tkInt.h>
-};
+//};
#include "bltGrText.h"
#include "bltGraph.h"
diff --git a/src/bltOp.C b/src/bltOp.C
index c30aded..b4a9d7e 100644
--- a/src/bltOp.C
+++ b/src/bltOp.C
@@ -31,8 +31,8 @@
#include "bltOp.h"
-static int BinaryOpSearch(Blt_OpSpec *specs, int nSpecs,
- const char *string, int length)
+static int BinaryOpSearch(Blt_OpSpec *specs, int nSpecs, const char *string,
+ int length)
{
int low = 0;
int high = nSpecs - 1;
@@ -63,8 +63,8 @@ static int BinaryOpSearch(Blt_OpSpec *specs, int nSpecs,
return -1; /* Can't find operation */
}
-static int LinearOpSearch(Blt_OpSpec *specs, int nSpecs,
- const char *string, int length)
+static int LinearOpSearch(Blt_OpSpec *specs, int nSpecs, const char *string,
+ int length)
{
char c = string[0];
int nMatches = 0;
diff --git a/src/bltParse.C b/src/bltParse.C
index f968cf0..14fb262 100644
--- a/src/bltParse.C
+++ b/src/bltParse.C
@@ -184,81 +184,15 @@ static unsigned char tclTypeTable[] =
#define CHAR_TYPE(src,last) \
(((src)==(last))?TCL_COMMAND_END:(tclTypeTable+128)[(int)*(src)])
-/*
- *---------------------------------------------------------------------------
- *
- * Blt_ParseNestedCmd --
- *
- * This procedure parses a nested TCL command between
- * brackets, returning the result of the command.
- *
- * Results:
- * The return value is a standard TCL result, which is
- * TCL_OK unless there was an error while executing the
- * nested command. If an error occurs then interp->result
- * contains a standard error message. *TermPtr is filled
- * in with the address of the character just after the
- * last one processed; this is usually the character just
- * after the matching close-bracket, or the null character
- * at the end of the string if the close-bracket was missing
- * (a missing close bracket is an error). The result returned
- * by the command is stored in standard fashion in *parsePtr,
- * null-terminated, with parsePtr->next pointing to the null
- * character.
- *
- * Side effects:
- * The storage space at *parsePtr may be expanded.
- *
- *---------------------------------------------------------------------------
- */
+int Blt_ParseNestedCmd(Tcl_Interp* interp, const char *string,
+ int flags, const char **termPtr, ParseValue *parsePtr)
-int Blt_ParseNestedCmd(
- Tcl_Interp* interp, /* Interpreter to use for nested command
- * evaluations and error messages. */
- const char *string, /* Character just after opening bracket. */
- int flags, /* Flags to pass to nested Tcl_Eval. */
- const char **termPtr, /* Store address of terminating character
- * here. */
- ParseValue *parsePtr) /* Information about where to place
- * result of command. */
{
return TCL_ERROR;
}
-/*
- *---------------------------------------------------------------------------
- *
- * Blt_ParseBraces --
- *
- * This procedure scans the information between matching
- * curly braces.
- *
- * Results:
- * The return value is a standard TCL result, which is
- * TCL_OK unless there was an error while parsing string.
- * If an error occurs then interp->result contains a
- * standard error message. *TermPtr is filled
- * in with the address of the character just after the
- * last one successfully processed; this is usually the
- * character just after the matching close-brace. The
- * information between curly braces is stored in standard
- * fashion in *parsePtr, null-terminated with parsePtr->next
- * pointing to the terminating null character.
- *
- * Side effects:
- * The storage space at *parsePtr may be expanded.
- *
- *---------------------------------------------------------------------------
- */
-
-int Blt_ParseBraces(
- Tcl_Interp* interp, /* Interpreter to use for nested command
- * evaluations and error messages. */
- const char *string, /* Character just after opening bracket. */
- const char **termPtr, /* Store address of terminating character
- * here. */
- ParseValue *parsePtr) /* Information about where to place
- * result of command. */
+int Blt_ParseBraces(Tcl_Interp* interp, const char *string,
+ const char **termPtr, ParseValue *parsePtr)
{
int level;
const char *src;
@@ -339,34 +273,8 @@ int Blt_ParseBraces(
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * Blt_ExpandParseValue --
- *
- * This procedure is commonly used as the value of the
- * expandProc in a ParseValue. It uses malloc to allocate
- * more space for the result of a parse.
- *
- * Results:
- * The buffer space in *parsePtr is reallocated to something
- * larger, and if parsePtr->clientData is non-zero the old
- * buffer is freed. Information is copied from the old
- * buffer to the new one.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-void Blt_ExpandParseValue(
- ParseValue *parsePtr, /* Information about buffer that
- * must be expanded. If the clientData
- * in the structure is non-zero, it
- * means that the current buffer is
- * dynamically allocated. */
- int needed) /* Minimum amount of additional space
- * to allocate. */
+void Blt_ExpandParseValue(ParseValue *parsePtr, int needed)
+
{
/*
* Either double the size of the buffer or add enough new space
@@ -395,48 +303,8 @@ void Blt_ExpandParseValue(
parsePtr->clientData = (ClientData)1;
}
-/*
- *---------------------------------------------------------------------------
- *
- * Blt_ParseQuotes --
- *
- * This procedure parses a double-quoted string such as a
- * quoted TCL command argument or a quoted value in a Tcl
- * expression. This procedure is also used to parse array
- * element names within parentheses, or anything else that
- * needs all the substitutions that happen in quotes.
- *
- * Results:
- * The return value is a standard TCL result, which is
- * TCL_OK unless there was an error while parsing the
- * quoted string. If an error occurs then interp->result
- * contains a standard error message. *TermPtr is filled
- * in with the address of the character just after the
- * last one successfully processed; this is usually the
- * character just after the matching close-quote. The
- * fully-substituted contents of the quotes are stored in
- * standard fashion in *parsePtr, null-terminated with
- * parsePtr->next pointing to the terminating null character.
- *
- * Side effects:
- * The buffer space in parsePtr may be enlarged by calling its
- * expandProc.
- *
- *---------------------------------------------------------------------------
- */
-int Blt_ParseQuotes(
- Tcl_Interp* interp, /* Interpreter to use for nested command
- * evaluations and error messages. */
- const char *string, /* Character just after opening double-
- * quote. */
- int termChar, /* Character that terminates "quoted" string
- * (usually double-quote, but sometimes
- * right-paren or something else). */
- int flags, /* Flags to pass to nested Tcl_Eval calls. */
- const char **termPtr, /* Store address of terminating character
- * here. */
- ParseValue *parsePtr) /* Information about where to place
- * fully-substituted result of parse. */
+int Blt_ParseQuotes(Tcl_Interp* interp, const char *string, int termChar,
+ int flags, const char **termPtr, ParseValue *parsePtr)
{
const char *src;
char *dest, c;
diff --git a/src/bltVecMath.C b/src/bltVecMath.C
index cdcb5e8..90b527e 100644
--- a/src/bltVecMath.C
+++ b/src/bltVecMath.C
@@ -163,24 +163,7 @@ static int precTable[] =
static int NextValue(Tcl_Interp* interp, ParseInfo *piPtr, int prec,
Value *valuePtr);
-/*
- *---------------------------------------------------------------------------
- *
- * Sort --
- *
- * A vector math function. Sorts the values of the given
- * vector.
- *
- * Results:
- * Always TCL_OK.
- *
- * Side Effects:
- * The vector is sorted.
- *
- *---------------------------------------------------------------------------
- */
-static int
-Sort(Vector *vPtr)
+static int Sort(Vector *vPtr)
{
size_t *map;
double *values;
@@ -199,33 +182,25 @@ Sort(Vector *vPtr)
return TCL_OK;
}
-static double
-Length(Blt_Vector *vectorPtr)
+static double Length(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
-
return (double)(vPtr->last - vPtr->first + 1);
}
-double
-Blt_VecMax(Blt_Vector *vectorPtr)
+double Blt_VecMax(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
-
return Blt_Vec_Max(vPtr);
}
-double
-Blt_VecMin(Blt_Vector *vectorPtr)
+double Blt_VecMin(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
-
return Blt_Vec_Min(vPtr);
}
-
-static double
-Product(Blt_Vector *vectorPtr)
+static double Product(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
double prod;
@@ -239,8 +214,7 @@ Product(Blt_Vector *vectorPtr)
return prod;
}
-static double
-Sum(Blt_Vector *vectorPtr)
+static double Sum(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
double sum, c;
@@ -266,8 +240,7 @@ Sum(Blt_Vector *vectorPtr)
return sum;
}
-static double
-Mean(Blt_Vector *vectorPtr)
+static double Mean(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
double sum;
@@ -278,11 +251,8 @@ Mean(Blt_Vector *vectorPtr)
return sum / (double)n;
}
-/*
- * var = 1/N Sum( (x[i] - mean)^2 )
- */
-static double
-Variance(Blt_Vector *vectorPtr)
+// var = 1/N Sum( (x[i] - mean)^2 )
+static double Variance(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
double var, mean;
@@ -307,11 +277,8 @@ Variance(Blt_Vector *vectorPtr)
return var;
}
-/*
- * skew = Sum( (x[i] - mean)^3 ) / (var^3/2)
- */
-static double
-Skew(Blt_Vector *vectorPtr)
+// skew = Sum( (x[i] - mean)^3 ) / (var^3/2)
+static double Skew(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
double diff, var, skew, mean, diffsq;
@@ -338,8 +305,7 @@ Skew(Blt_Vector *vectorPtr)
return skew;
}
-static double
-StdDeviation(Blt_Vector *vectorPtr)
+static double StdDeviation(Blt_Vector *vectorPtr)
{
double var;
@@ -350,9 +316,7 @@ StdDeviation(Blt_Vector *vectorPtr)
return 0.0;
}
-
-static double
-AvgDeviation(Blt_Vector *vectorPtr)
+static double AvgDeviation(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
double diff, avg, mean;
@@ -375,9 +339,7 @@ AvgDeviation(Blt_Vector *vectorPtr)
return avg;
}
-
-static double
-Kurtosis(Blt_Vector *vectorPtr)
+static double Kurtosis(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
double diff, diffsq, kurt, var, mean;
@@ -406,9 +368,7 @@ Kurtosis(Blt_Vector *vectorPtr)
return kurt - 3.0; /* Fisher Kurtosis */
}
-
-static double
-Median(Blt_Vector *vectorPtr)
+static double Median(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
size_t *map;
@@ -436,8 +396,7 @@ Median(Blt_Vector *vectorPtr)
return q2;
}
-static double
-Q1(Blt_Vector *vectorPtr)
+static double Q1(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
double q1;
@@ -472,8 +431,7 @@ Q1(Blt_Vector *vectorPtr)
return q1;
}
-static double
-Q3(Blt_Vector *vectorPtr)
+static double Q3(Blt_Vector *vectorPtr)
{
Vector *vPtr = (Vector *)vectorPtr;
double q3;
@@ -509,9 +467,7 @@ Q3(Blt_Vector *vectorPtr)
return q3;
}
-
-static int
-Norm(Blt_Vector *vector)
+static int Norm(Blt_Vector *vector)
{
Vector *vPtr = (Vector *)vector;
double norm, range, min, max;
@@ -527,49 +483,39 @@ Norm(Blt_Vector *vector)
return TCL_OK;
}
-
-static double
-Nonzeros(Blt_Vector *vector)
+static double Nonzeros(Blt_Vector *vector)
{
Vector *vPtr = (Vector *)vector;
int count;
double *vp, *vend;
count = 0;
- for(vp = vPtr->valueArr + vPtr->first,
- vend = vPtr->valueArr + vPtr->last; vp <= vend; vp++) {
- if (*vp == 0.0) {
+ for(vp = vPtr->valueArr + vPtr->first, vend = vPtr->valueArr + vPtr->last; vp <= vend; vp++) {
+ if (*vp == 0.0)
count++;
- }
}
return (double) count;
}
-static double
-Fabs(double value)
+static double Fabs(double value)
{
- if (value < 0.0) {
+ if (value < 0.0)
return -value;
- }
return value;
}
-static double
-Round(double value)
+static double Round(double value)
{
- if (value < 0.0) {
+ if (value < 0.0)
return ceil(value - 0.5);
- } else {
+ else
return floor(value + 0.5);
- }
}
-static double
-Fmod(double x, double y)
+static double Fmod(double x, double y)
{
- if (y == 0.0) {
+ if (y == 0.0)
return 0.0;
- }
return x - (floor(x / y) * y);
}
@@ -590,33 +536,31 @@ Fmod(double x, double y)
*
*---------------------------------------------------------------------------
*/
-static void
-MathError(
- Tcl_Interp* interp, /* Where to store error message. */
- double value) /* Value returned after error; used to
- * distinguish underflows from
- * overflows. */
+static void MathError(Tcl_Interp* interp, double value)
{
if ((errno == EDOM) || (value != value)) {
Tcl_AppendResult(interp, "domain error: argument not in valid range",
(char *)NULL);
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN",
Tcl_GetStringResult(interp), (char *)NULL);
- } else if ((errno == ERANGE) || isinf(value)) {
+ }
+ else if ((errno == ERANGE) || isinf(value)) {
if (value == 0.0) {
Tcl_AppendResult(interp,
"floating-point value too small to represent",
(char *)NULL);
Tcl_SetErrorCode(interp, "ARITH", "UNDERFLOW",
Tcl_GetStringResult(interp), (char *)NULL);
- } else {
+ }
+ else {
Tcl_AppendResult(interp,
"floating-point value too large to represent",
(char *)NULL);
Tcl_SetErrorCode(interp, "ARITH", "OVERFLOW",
Tcl_GetStringResult(interp), (char *)NULL);
}
- } else {
+ }
+ else {
Tcl_AppendResult(interp, "unknown floating-point error, ",
"errno = ", Blt_Itoa(errno), (char *)NULL);
Tcl_SetErrorCode(interp, "ARITH", "UNKNOWN",
@@ -624,34 +568,7 @@ MathError(
}
}
-/*
- *---------------------------------------------------------------------------
- *
- * ParseString --
- *
- * Given a string (such as one coming from command or variable
- * substitution), make a Value based on the string. The value
- * will be a floating-point or integer, if possible, or else it
- * will just be a copy of the string.
- *
- * Results:
- * TCL_OK is returned under normal circumstances, and TCL_ERROR
- * is returned if a floating-point overflow or underflow occurred
- * while reading in a number. The value at *valuePtr is modified
- * to hold a number, if possible.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-static int
-ParseString(
- Tcl_Interp* interp, /* Where to store error message. */
- const char *string, /* String to turn into value. */
- Value *valuePtr) /* Where to store value information.
- * Caller must have initialized pv field. */
+static int ParseString(Tcl_Interp* interp, const char *string, Value *valuePtr)
{
const char *endPtr;
double value;
@@ -699,43 +616,8 @@ ParseString(
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * ParseMathFunction --
- *
- * This procedure is invoked to parse a math function from an
- * expression string, carry out the function, and return the
- * value computed.
- *
- * Results:
- * TCL_OK is returned if all went well and the function's value
- * was computed successfully. If the name doesn't match any
- * known math function, returns TCL_RETURN. And if a format error
- * was found, TCL_ERROR is returned and an error message is left
- * in interp->result.
- *
- * After a successful return piPtr will be updated to point to
- * the character just after the function call, the token is set
- * to VALUE, and the value is stored in valuePtr.
- *
- * Side effects:
- * Embedded commands could have arbitrary side-effects.
- *
- *---------------------------------------------------------------------------
- */
-static int
-ParseMathFunction(
- Tcl_Interp* interp, /* Interpreter to use for error reporting. */
- const char *start, /* Start of string to parse */
- ParseInfo *piPtr, /* Describes the state of the parse.
- * piPtr->nextPtr must point to the
- * first character of the function's
- * name. */
- Value *valuePtr) /* Where to store value, if that is
- * what's parsed from string. Caller
- * must have initialized pv field
- * correctly. */
+static int ParseMathFunction(Tcl_Interp* interp, const char *start,
+ ParseInfo *piPtr, Value *valuePtr)
{
Tcl_HashEntry *hPtr;
MathFunction *mathPtr; /* Info about math function. */
@@ -786,37 +668,7 @@ ParseMathFunction(
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * NextToken --
- *
- * Lexical analyzer for expression parser: parses a single value,
- * operator, or other syntactic element from an expression string.
- *
- * Results:
- * TCL_OK is returned unless an error occurred while doing lexical
- * analysis or executing an embedded command. In that case a
- * standard TCL error is returned, using interp->result to hold
- * an error message. In the event of a successful return, the token
- * and field in piPtr is updated to refer to the next symbol in
- * the expression string, and the expr field is advanced past that
- * token; if the token is a value, then the value is stored at
- * valuePtr.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-static int
-NextToken(
- Tcl_Interp* interp, /* Interpreter to use for error reporting. */
- ParseInfo *piPtr, /* Describes the state of the parse. */
- Value *valuePtr) /* Where to store value, if that is
- * what's parsed from string. Caller
- * must have initialized pv field
- * correctly. */
+static int NextToken(Tcl_Interp* interp, ParseInfo *piPtr, Value *valuePtr)
{
const char *p;
const char *endPtr;
@@ -1035,37 +887,8 @@ NextToken(
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * NextValue --
- *
- * Parse a "value" from the remainder of the expression in piPtr.
- *
- * Results:
- * Normally TCL_OK is returned. The value of the expression is
- * returned in *valuePtr. If an error occurred, then interp->result
- * contains an error message and TCL_ERROR is returned.
- * InfoPtr->token will be left pointing to the token AFTER the
- * expression, and piPtr->nextPtr will point to the character just
- * after the terminating token.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-static int
-NextValue(
- Tcl_Interp* interp, /* Interpreter to use for error reporting. */
- ParseInfo *piPtr, /* Describes the state of the parse
- * just before the value (i.e. NextToken will
- * be called to get first token of value). */
- int prec, /* Treat any un-parenthesized operator
- * with precedence <= this as the end
- * of the expression. */
- Value *valuePtr) /* Where to store the value of the expression.
- * Caller must have initialized pv field. */
+static int NextValue(Tcl_Interp* interp, ParseInfo *piPtr,
+ int prec, Value *valuePtr)
{
Value value2; /* Second operand for current operator. */
int oper; /* Current operator (either unary or binary). */
@@ -1579,35 +1402,8 @@ NextValue(
return TCL_ERROR;
}
-/*
- *---------------------------------------------------------------------------
- *
- * EvaluateExpression --
- *
- * This procedure provides top-level functionality shared by
- * procedures like Tcl_ExprInt, Tcl_ExprDouble, etc.
- *
- * Results:
- * The result is a standard TCL return value. If an error
- * occurs then an error message is left in interp->result.
- * The value of the expression is returned in *valuePtr, in
- * whatever form it ends up in (could be string or integer
- * or double). Caller may need to convert result. Caller
- * is also responsible for freeing string memory in *valuePtr,
- * if any was allocated.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-static int
-EvaluateExpression(
- Tcl_Interp* interp, /* Context in which to evaluate the
- * expression. */
- char *string, /* Expression to evaluate. */
- Value *valuePtr) /* Where to store result. Should
- * not be initialized by caller. */
+static int EvaluateExpression(Tcl_Interp* interp, char *string,
+ Value *valuePtr)
{
ParseInfo info;
int result;
@@ -1644,31 +1440,8 @@ EvaluateExpression(
return TCL_OK;
}
-/*
- *---------------------------------------------------------------------------
- *
- * Math Functions --
- *
- * This page contains the procedures that implement all of the
- * built-in math functions for expressions.
- *
- * Results:
- * Each procedure returns TCL_OK if it succeeds and places result
- * information at *resultPtr. If it fails it returns TCL_ERROR
- * and leaves an error message in interp->result.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-static int
-ComponentFunc(
- ClientData clientData, /* Contains address of procedure that
- * takes one double argument and
- * returns a double result. */
- Tcl_Interp* interp,
- Vector *vPtr)
+static int ComponentFunc(ClientData clientData, Tcl_Interp* interp,
+ Vector *vPtr)
{
ComponentProc *procPtr = (ComponentProc *) clientData;
double *vp, *vend;
@@ -1692,8 +1465,7 @@ ComponentFunc(
return TCL_OK;
}
-static int
-ScalarFunc(ClientData clientData, Tcl_Interp* interp, Vector *vPtr)
+static int ScalarFunc(ClientData clientData, Tcl_Interp* interp, Vector *vPtr)
{
double value;
ScalarProc *procPtr = (ScalarProc *) clientData;
@@ -1711,9 +1483,7 @@ ScalarFunc(ClientData clientData, Tcl_Interp* interp, Vector *vPtr)
return TCL_OK;
}
-/*ARGSUSED*/
-static int
-VectorFunc(ClientData clientData, Tcl_Interp* interp, Vector *vPtr)
+static int VectorFunc(ClientData clientData, Tcl_Interp* interp, Vector *vPtr)
{
VectorProc *procPtr = (VectorProc *) clientData;
@@ -1761,8 +1531,7 @@ static MathFunction mathFunctions[] =
{(char *)NULL,},
};
-void
-Blt_Vec_InstallMathFunctions(Tcl_HashTable *tablePtr)
+void Blt_Vec_InstallMathFunctions(Tcl_HashTable *tablePtr)
{
MathFunction *mathPtr;
@@ -1775,8 +1544,7 @@ Blt_Vec_InstallMathFunctions(Tcl_HashTable *tablePtr)
}
}
-void
-Blt_Vec_UninstallMathFunctions(Tcl_HashTable *tablePtr)
+void Blt_Vec_UninstallMathFunctions(Tcl_HashTable *tablePtr)
{
Tcl_HashEntry *hPtr;
Tcl_HashSearch cursor;
@@ -1789,30 +1557,20 @@ Blt_Vec_UninstallMathFunctions(Tcl_HashTable *tablePtr)
}
}
-
-static void
-InstallIndexProc(
- Tcl_HashTable *tablePtr,
- const char *string,
- Blt_VectorIndexProc *procPtr) /* Pointer to function to be called
- * when the vector finds the named index.
- * If NULL, this indicates to remove
- * the index from the table.
- */
+static void InstallIndexProc(Tcl_HashTable *tablePtr, const char *string,
+ Blt_VectorIndexProc *procPtr)
{
Tcl_HashEntry *hPtr;
int dummy;
hPtr = Tcl_CreateHashEntry(tablePtr, string, &dummy);
- if (procPtr == NULL) {
+ if (procPtr == NULL)
Tcl_DeleteHashEntry(hPtr);
- } else {
+ else
Tcl_SetHashValue(hPtr, (ClientData)procPtr);
- }
}
-void
-Blt_Vec_InstallSpecialIndices(Tcl_HashTable *tablePtr)
+void Blt_Vec_InstallSpecialIndices(Tcl_HashTable *tablePtr)
{
InstallIndexProc(tablePtr, "min", Blt_VecMin);
InstallIndexProc(tablePtr, "max", Blt_VecMax);
@@ -1821,33 +1579,7 @@ Blt_Vec_InstallSpecialIndices(Tcl_HashTable *tablePtr)
InstallIndexProc(tablePtr, "prod", Product);
}
-
-/*
- *---------------------------------------------------------------------------
- *
- * Blt_ExprVector --
- *
- * Evaluates an vector expression and returns its value(s).
- *
- * Results:
- * Each of the procedures below returns a standard TCL result.
- * If an error occurs then an error message is left in
- * interp->result. Otherwise the value of the expression,
- * in the appropriate form, is stored at *resultPtr. If
- * the expression had a result that was incompatible with the
- * desired form then an error is returned.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-int
-Blt_ExprVector(
- Tcl_Interp* interp, /* Context in which to evaluate the
- * expression. */
- char *string, /* Expression to evaluate. */
- Blt_Vector *vector) /* Where to store result. */
+int Blt_ExprVector(Tcl_Interp* interp, char *string, Blt_Vector *vector)
{
VectorInterpData *dataPtr; /* Interpreter-specific data. */
Vector *vPtr = (Vector *)vector;
diff --git a/src/bltVector.C b/src/bltVector.C
index 4baf7ea..735f382 100644
--- a/src/bltVector.C
+++ b/src/bltVector.C
@@ -48,6 +48,7 @@
#include <time.h>
#include <string.h>
#include <stdlib.h>
+#include <stdio.h>
#include <ctype.h>
#include "bltVecInt.h"
@@ -113,6 +114,14 @@ static Blt_SwitchSpec createSwitches[] =
typedef int (VectorCmdProc)(Vector* vecObjPtr, Tcl_Interp* interp,
int objc, Tcl_Obj* const objv[]);
+static char stringRep[200];
+
+const char *Blt_Itoa(int value)
+{
+ snprintf(stringRep, 200, "%d", value);
+ return stringRep;
+}
+
static char* Blt_Strdup(const char *string)
{
size_t size = strlen(string) + 1;
@@ -1893,3 +1902,4 @@ int Blt_SimplifyLine(Point2d *inputPts, int low, int high, double tolerance,
free(stack);
return count;
}
+