summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bltChain.C2
-rw-r--r--src/bltConfig.C9
-rw-r--r--src/bltGrAxis.C43
-rw-r--r--src/bltGrBind.C2
-rw-r--r--src/bltGrElemBar.C1
-rw-r--r--src/bltGrElemLine.C142
-rw-r--r--src/bltGrElemLineSpline.C2
-rw-r--r--src/bltGrElemOp.C16
-rw-r--r--src/bltGrHairs.C2
-rw-r--r--src/bltGrLegd.C2
-rw-r--r--src/bltGrMarker.C6
-rw-r--r--src/bltGrMarkerLine.C2
-rw-r--r--src/bltGrMarkerPolygon.C2
-rw-r--r--src/bltGrMarkerText.C1
-rw-r--r--src/bltGrMisc.C2
-rw-r--r--src/bltGrPSOutput.C2
-rw-r--r--src/bltGrPenOp.C2
-rw-r--r--src/bltGrText.C1
-rw-r--r--src/bltGraph.C1
-rw-r--r--src/bltInt.C2
-rw-r--r--src/bltNsUtil.C2
-rw-r--r--src/bltParse.C3
-rw-r--r--src/bltSwitch.C2
23 files changed, 140 insertions, 109 deletions
diff --git a/src/bltChain.C b/src/bltChain.C
index 50d3421..16e372d 100644
--- a/src/bltChain.C
+++ b/src/bltChain.C
@@ -27,6 +27,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include "bltC.h"
+
extern "C" {
#include "bltInt.h"
#include "bltChain.h"
diff --git a/src/bltConfig.C b/src/bltConfig.C
index 3d185ab..2f7b211 100644
--- a/src/bltConfig.C
+++ b/src/bltConfig.C
@@ -38,9 +38,12 @@
#include <stdarg.h>
+#include "bltC.h"
+
extern "C" {
#include "bltInt.h"
};
+
#include "bltConfig.h"
void RestoreProc(ClientData clientData, Tk_Window tkwin,
@@ -218,6 +221,9 @@ static int ListSetProc(ClientData clientData, Tcl_Interp *interp,
const char*** listPtr = (const char***)(widgRec + offset);
*(double*)savePtr = *(double*)listPtr;
+ if (!listPtr)
+ return TCL_OK;
+
const char** argv;
int argc;
if (Tcl_SplitList(interp, Tcl_GetString(*objPtr), &argc, &argv) != TCL_OK)
@@ -233,6 +239,9 @@ static Tcl_Obj* ListGetProc(ClientData clientData, Tk_Window tkwin,
{
const char*** listPtr = (const char***)(widgRec + offset);
+ if (!listPtr)
+ return Tcl_NewListObj(0, NULL);
+
// count how many
int cnt=0;
for (const char** p = *listPtr; *p != NULL; p++,cnt++) {}
diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C
index ef9d31e..33db4b4 100644
--- a/src/bltGrAxis.C
+++ b/src/bltGrAxis.C
@@ -30,9 +30,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-#include <iostream>
-using namespace std;
-
+#include "bltC.h"
#include "bltMath.h"
extern "C" {
@@ -127,6 +125,9 @@ static int AxisSetProc(ClientData clientData, Tcl_Interp* interp,
Axis** axisPtrPtr = (Axis**)(widgRec + offset);
*(double*)savePtr = *(double*)axisPtrPtr;
+ if (!axisPtrPtr)
+ return TCL_OK;
+
Graph* graphPtr = Blt_GetGraphFromWindowData(tkwin);
ClassId classId = (ClassId)(long(clientData));
Axis* axisPtr;
@@ -142,9 +143,10 @@ static Tcl_Obj* AxisGetProc(ClientData clientData, Tk_Window tkwin,
char *widgRec, int offset)
{
Axis* axisPtr = *(Axis**)(widgRec + offset);
- const char* name = (axisPtr ? axisPtr->obj.name : "");
+ if (!axisPtr)
+ return Tcl_NewStringObj("", -1);
- return Tcl_NewStringObj(name, -1);
+ return Tcl_NewStringObj(axisPtr->obj.name, -1);
};
static void AxisFreeProc(ClientData clientData, Tk_Window tkwin, char *ptr)
@@ -204,6 +206,9 @@ static int TicksSetProc(ClientData clientData, Tcl_Interp* interp,
Ticks** ticksPtrPtr = (Ticks**)(widgRec + offset);
*(double*)savePtr = *(double*)ticksPtrPtr;
+ if (!ticksPtrPtr)
+ return TCL_OK;
+
int objc;
Tcl_Obj** objv;
if (Tcl_ListObjGetElements(interp, *objPtr, &objc, &objv) != TCL_OK)
@@ -233,18 +238,17 @@ static Tcl_Obj* TicksGetProc(ClientData clientData, Tk_Window tkwin,
{
Ticks* ticksPtr = *(Ticks**)(widgRec + offset);
- if (ticksPtr) {
- int cnt = ticksPtr->nTicks;
- Tcl_Obj** ll = (Tcl_Obj**)calloc(cnt, sizeof(Tcl_Obj*));
- for (int ii = 0; ii<cnt; ii++)
- ll[ii] = Tcl_NewDoubleObj(ticksPtr->values[ii]);
-
- Tcl_Obj* listObjPtr = Tcl_NewListObj(cnt, ll);
- free(ll);
- return listObjPtr;
- }
- else
+ if (!ticksPtr)
return Tcl_NewListObj(0, NULL);
+
+ int cnt = ticksPtr->nTicks;
+ Tcl_Obj** ll = (Tcl_Obj**)calloc(cnt, sizeof(Tcl_Obj*));
+ for (int ii = 0; ii<cnt; ii++)
+ ll[ii] = Tcl_NewDoubleObj(ticksPtr->values[ii]);
+
+ Tcl_Obj* listObjPtr = Tcl_NewListObj(cnt, ll);
+ free(ll);
+ return listObjPtr;
}
static void TicksFreeProc(ClientData clientData, Tk_Window tkwin,
@@ -270,6 +274,9 @@ static int ObjectSetProc(ClientData clientData, Tcl_Interp* interp,
Tcl_Obj** objectPtrPtr = (Tcl_Obj**)(widgRec + offset);
*(double*)savePtr = *(double*)objectPtrPtr;
+ if (!objectPtrPtr)
+ return TCL_OK;
+
Tcl_IncrRefCount(*objPtr);
*objectPtrPtr = *objPtr;
@@ -280,6 +287,10 @@ static Tcl_Obj* ObjectGetProc(ClientData clientData, Tk_Window tkwin,
char *widgRec, int offset)
{
Tcl_Obj** objectPtrPtr = (Tcl_Obj**)(widgRec + offset);
+
+ if (!objectPtrPtr)
+ return Tcl_NewObj();
+
return *objectPtrPtr;
}
diff --git a/src/bltGrBind.C b/src/bltGrBind.C
index 8ebeea0..d2fa15d 100644
--- a/src/bltGrBind.C
+++ b/src/bltGrBind.C
@@ -27,6 +27,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include "bltC.h"
+
extern "C" {
#include "bltInt.h"
#include "bltBind.h"
diff --git a/src/bltGrElemBar.C b/src/bltGrElemBar.C
index 2a46148..7487450 100644
--- a/src/bltGrElemBar.C
+++ b/src/bltGrElemBar.C
@@ -30,6 +30,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include "bltC.h"
#include "bltMath.h"
extern "C" {
diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C
index 71d676a..c25410a 100644
--- a/src/bltGrElemLine.C
+++ b/src/bltGrElemLine.C
@@ -30,6 +30,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include "bltC.h"
#include "bltMath.h"
extern "C" {
@@ -575,7 +576,7 @@ static Tk_OptionSpec linePenOptionSpecs[] = {
// Create
-Element * Blt_LineElement(Graph* graphPtr)
+Element* Blt_LineElement(Graph* graphPtr)
{
LineElement* elemPtr = (LineElement*)calloc(1, sizeof(LineElement));
elemPtr->procsPtr = &lineProcs;
@@ -712,8 +713,7 @@ static int ConfigurePenProc(Graph* graphPtr, Pen* basePtr)
{
LinePen* lpPtr = (LinePen*)basePtr;
- // Set the outline GC for this pen: GCForeground is outline color.
- // GCBackground is the fill color (only used for bitmap symbols).
+ // symbol outline
unsigned long gcMask = (GCLineWidth | GCForeground);
XColor* colorPtr = lpPtr->symbol.outlineColor;
if (!colorPtr)
@@ -726,15 +726,6 @@ static int ConfigurePenProc(Graph* graphPtr, Pen* basePtr)
if (!colorPtr)
colorPtr = lpPtr->traceColor;
- /*
- * Set a clip mask if either
- * 1) no background color was designated or
- * 2) a masking bitmap was specified.
- *
- * These aren't necessarily the bitmaps we'll be using for clipping. But
- * this makes it unlikely that anyone else will be sharing this GC when
- * we set the clip origin (at the time the bitmap is drawn).
- */
if (colorPtr) {
gcValues.background = colorPtr->pixel;
gcMask |= GCBackground;
@@ -754,7 +745,7 @@ static int ConfigurePenProc(Graph* graphPtr, Pen* basePtr)
}
lpPtr->symbol.outlineGC = newGC;
- // Fill GC for symbols: GCForeground is fill color
+ // symbol fill
gcMask = (GCLineWidth | GCForeground);
colorPtr = lpPtr->symbol.fillColor;
if (!colorPtr)
@@ -765,12 +756,11 @@ static int ConfigurePenProc(Graph* graphPtr, Pen* basePtr)
gcValues.foreground = colorPtr->pixel;
newGC = Tk_GetGC(graphPtr->tkwin, gcMask, &gcValues);
}
- if (lpPtr->symbol.fillGC) {
+ if (lpPtr->symbol.fillGC)
Tk_FreeGC(graphPtr->display, lpPtr->symbol.fillGC);
- }
lpPtr->symbol.fillGC = newGC;
- // Line segments
+ // trace
gcMask = (GCLineWidth | GCForeground | GCLineStyle | GCCapStyle |
GCJoinStyle);
gcValues.cap_style = CapButt;
@@ -778,30 +768,27 @@ static int ConfigurePenProc(Graph* graphPtr, Pen* basePtr)
gcValues.line_style = LineSolid;
gcValues.line_width = LineWidth(lpPtr->traceWidth);
+ gcValues.foreground = lpPtr->traceColor->pixel;
colorPtr = lpPtr->traceOffColor;
- if (!colorPtr)
- colorPtr = lpPtr->traceColor;
-
if (colorPtr) {
gcMask |= GCBackground;
gcValues.background = colorPtr->pixel;
}
- gcValues.foreground = lpPtr->traceColor->pixel;
if (LineIsDashed(lpPtr->traceDashes)) {
gcValues.line_width = lpPtr->traceWidth;
- gcValues.line_style =
- (colorPtr == NULL) ? LineOnOffDash : LineDoubleDash;
+ gcValues.line_style = !colorPtr ? LineOnOffDash : LineDoubleDash;
}
newGC = Blt_GetPrivateGC(graphPtr->tkwin, gcMask, &gcValues);
- if (lpPtr->traceGC) {
+ if (lpPtr->traceGC)
Blt_FreePrivateGC(graphPtr->display, lpPtr->traceGC);
- }
+
if (LineIsDashed(lpPtr->traceDashes)) {
lpPtr->traceDashes.offset = lpPtr->traceDashes.values[0] / 2;
Blt_SetDashes(graphPtr->display, newGC, &lpPtr->traceDashes);
}
lpPtr->traceGC = newGC;
+ // errorbar
gcMask = (GCLineWidth | GCForeground);
colorPtr = lpPtr->errorBarColor;
if (!colorPtr)
@@ -833,15 +820,9 @@ static void DestroySymbol(Display *display, Symbol *symbolPtr)
symbolPtr->type = SYMBOL_NONE;
}
-/*
- * Reset the number of points and segments, in case there are no segments or
- * points
- */
static void ResetStylePalette(Blt_Chain styles)
{
- Blt_ChainLink link;
-
- for (link = Blt_Chain_FirstLink(styles); link;
+ for (Blt_ChainLink link = Blt_Chain_FirstLink(styles); link;
link = Blt_Chain_NextLink(link)) {
LineStyle *stylePtr = (LineStyle*)Blt_Chain_GetValue(link);
stylePtr->lines.length = stylePtr->symbolPts.length = 0;
@@ -851,43 +832,32 @@ static void ResetStylePalette(Blt_Chain styles)
static int ScaleSymbol(LineElement* elemPtr, int normalSize)
{
- int maxSize;
- double scale;
- int newSize;
-
- scale = 1.0;
+ double scale = 1.0;
if (elemPtr->scaleSymbols) {
- double xRange, yRange;
-
- xRange = (elemPtr->axes.x->max - elemPtr->axes.x->min);
- yRange = (elemPtr->axes.y->max - elemPtr->axes.y->min);
+ double xRange = (elemPtr->axes.x->max - elemPtr->axes.x->min);
+ double yRange = (elemPtr->axes.y->max - elemPtr->axes.y->min);
if (elemPtr->flags & SCALE_SYMBOL) {
- /* Save the ranges as a baseline for future scaling. */
elemPtr->xRange = xRange;
elemPtr->yRange = yRange;
elemPtr->flags &= ~SCALE_SYMBOL;
- } else {
- double xScale, yScale;
-
- /* Scale the symbol by the smallest change in the X or Y axes */
- xScale = elemPtr->xRange / xRange;
- yScale = elemPtr->yRange / yRange;
+ }
+ else {
+ // Scale the symbol by the smallest change in the X or Y axes
+ double xScale = elemPtr->xRange / xRange;
+ double yScale = elemPtr->yRange / yRange;
scale = MIN(xScale, yScale);
}
}
- newSize = Round(normalSize * scale);
+ int newSize = Round(normalSize * scale);
- /*
- * Don't let the size of symbols go unbounded. Both X and Win32 drawing
- * routines assume coordinates to be a signed short int.
- */
- maxSize = (int)MIN(elemPtr->obj.graphPtr->hRange,
+ // Don't let the size of symbols go unbounded. Both X and Win32 drawing
+ // routines assume coordinates to be a signed short int.
+ int maxSize = (int)MIN(elemPtr->obj.graphPtr->hRange,
elemPtr->obj.graphPtr->vRange);
- if (newSize > maxSize) {
+ if (newSize > maxSize)
newSize = maxSize;
- }
- /* Make the symbol size odd so that its center is a single pixel. */
+ // Make the symbol size odd so that its center is a single pixel.
newSize |= 0x01;
return newSize;
}
@@ -1844,32 +1814,25 @@ static void MapErrorBars(Graph* graphPtr, LineElement* elemPtr,
static void MapLineProc(Graph* graphPtr, Element *basePtr)
{
LineElement* elemPtr = (LineElement *)basePtr;
- MapInfo mi;
- int size, np;
- LineStyle **styleMap;
- Blt_ChainLink link;
ResetLine(elemPtr);
if (!elemPtr->coords.x || !elemPtr->coords.y ||
!elemPtr->coords.x->nValues || !elemPtr->coords.y->nValues)
return;
- np = NUMBEROFPOINTS(elemPtr);
+ int np = NUMBEROFPOINTS(elemPtr);
+ MapInfo mi;
GetScreenPoints(graphPtr, elemPtr, &mi);
MapSymbols(graphPtr, elemPtr, &mi);
- if ((elemPtr->flags & ACTIVE_PENDING) && (elemPtr->nActiveIndices > 0)) {
+ if ((elemPtr->flags & ACTIVE_PENDING) && (elemPtr->nActiveIndices > 0))
MapActiveSymbols(graphPtr, elemPtr);
- }
- /*
- * Map connecting line segments if they are to be displayed.
- */
+
+ // Map connecting line segments if they are to be displayed.
elemPtr->smooth = elemPtr->reqSmooth;
if ((np > 1) && (elemPtr->builtinPen.traceWidth > 0)) {
- /*
- * Do smoothing if necessary. This can extend the coordinate array,
- * so both mi.points and mi.nPoints may change.
- */
+ // Do smoothing if necessary. This can extend the coordinate array,
+ // so both mi.points and mi.nPoints may change.
switch (elemPtr->smooth) {
case PEN_SMOOTH_STEP:
GenerateSteps(&mi);
@@ -1877,21 +1840,19 @@ static void MapLineProc(Graph* graphPtr, Element *basePtr)
case PEN_SMOOTH_NATURAL:
case PEN_SMOOTH_QUADRATIC:
- if (mi.nScreenPts < 3) {
- /* Can't interpolate with less than three points. */
+ // Can't interpolate with less than three points
+ if (mi.nScreenPts < 3)
elemPtr->smooth = PEN_SMOOTH_LINEAR;
- } else {
+ else
GenerateSpline(graphPtr, elemPtr, &mi);
- }
break;
case PEN_SMOOTH_CATROM:
- if (mi.nScreenPts < 3) {
- /* Can't interpolate with less than three points. */
+ // Can't interpolate with less than three points
+ if (mi.nScreenPts < 3)
elemPtr->smooth = PEN_SMOOTH_LINEAR;
- } else {
+ else
GenerateParametricSpline(graphPtr, elemPtr, &mi);
- }
break;
default:
@@ -1908,18 +1869,20 @@ static void MapLineProc(Graph* graphPtr, Element *basePtr)
free(mi.screenPts);
free(mi.map);
- /* Set the symbol size of all the pen styles. */
- for (link = Blt_Chain_FirstLink(elemPtr->stylePalette); link;
+ // Set the symbol size of all the pen styles
+ for (Blt_ChainLink link = Blt_Chain_FirstLink(elemPtr->stylePalette); link;
link = Blt_Chain_NextLink(link)) {
LineStyle *stylePtr = (LineStyle*)Blt_Chain_GetValue(link);
LinePen* penPtr = (LinePen *)stylePtr->penPtr;
- size = ScaleSymbol(elemPtr, penPtr->symbol.size);
+ int size = ScaleSymbol(elemPtr, penPtr->symbol.size);
+ // cerr << size << ' ' << penPtr->symbol.size << endl;
stylePtr->symbolSize = size;
stylePtr->errorBarCapWidth = (penPtr->errorBarCapWidth > 0)
? penPtr->errorBarCapWidth : Round(size * 0.6666666);
stylePtr->errorBarCapWidth /= 2;
}
- styleMap = (LineStyle **)Blt_StyleMap((Element *)elemPtr);
+
+ LineStyle **styleMap = (LineStyle **)Blt_StyleMap((Element *)elemPtr);
if (((elemPtr->yHigh && elemPtr->yHigh->nValues > 0) &&
(elemPtr->yLow && elemPtr->yLow->nValues > 0)) ||
((elemPtr->xHigh && elemPtr->xHigh->nValues > 0) &&
@@ -1928,6 +1891,7 @@ static void MapLineProc(Graph* graphPtr, Element *basePtr)
(elemPtr->yError && elemPtr->yError->nValues > 0)) {
MapErrorBars(graphPtr, elemPtr, styleMap);
}
+
MergePens(elemPtr, styleMap);
free(styleMap);
}
@@ -3026,12 +2990,11 @@ static void DrawActiveLineProc(Graph* graphPtr, Drawable drawable,
{
LineElement* elemPtr = (LineElement *)basePtr;
LinePen* penPtr = (LinePen *)elemPtr->activePenPtr;
- int symbolSize;
- if (penPtr == NULL) {
+ if (!penPtr)
return;
- }
- symbolSize = ScaleSymbol(elemPtr, penPtr->symbol.size);
+
+ int symbolSize = ScaleSymbol(elemPtr, penPtr->symbol.size);
/*
* nActiveIndices
@@ -3379,12 +3342,11 @@ static void ActiveLineToPostScriptProc(Graph* graphPtr, Blt_Ps ps,
{
LineElement* elemPtr = (LineElement *)basePtr;
LinePen* penPtr = (LinePen *)elemPtr->activePenPtr;
- int symbolSize;
- if (penPtr == NULL) {
+ if (!penPtr)
return;
- }
- symbolSize = ScaleSymbol(elemPtr, penPtr->symbol.size);
+
+ int symbolSize = ScaleSymbol(elemPtr, penPtr->symbol.size);
if (elemPtr->nActiveIndices > 0) {
if (elemPtr->flags & ACTIVE_PENDING) {
MapActiveSymbols(graphPtr, elemPtr);
diff --git a/src/bltGrElemLineSpline.C b/src/bltGrElemLineSpline.C
index fda5bf5..c8e1cb7 100644
--- a/src/bltGrElemLineSpline.C
+++ b/src/bltGrElemLineSpline.C
@@ -31,6 +31,8 @@
#include <float.h>
#include <math.h>
+#include "bltC.h"
+
extern "C" {
#include "bltInt.h"
#include "bltSpline.h"
diff --git a/src/bltGrElemOp.C b/src/bltGrElemOp.C
index 8a42f48..fac3c72 100644
--- a/src/bltGrElemOp.C
+++ b/src/bltGrElemOp.C
@@ -32,6 +32,8 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include "bltC.h"
+
extern "C" {
#include "bltInt.h"
#include "bltGraph.h"
@@ -82,6 +84,9 @@ static int ValuesSetProc(ClientData clientData, Tcl_Interp* interp,
*(double*)savePtr = *(double*)valuesPtrPtr;
Element* elemPtr = (Element*)widgRec;
+ if (!valuesPtrPtr)
+ return TCL_OK;
+
Tcl_Obj** objv;
int objc;
if (Tcl_ListObjGetElements(interp, *objPtr, &objc, &objv) != TCL_OK)
@@ -123,6 +128,9 @@ static Tcl_Obj* ValuesGetProc(ClientData clientData, Tk_Window tkwin,
{
ElemValues* valuesPtr = *(ElemValues**)(widgRec + offset);
+ if (!valuesPtr)
+ return Tcl_NewStringObj("", -1);
+
switch (valuesPtr->type) {
case ELEM_SOURCE_VECTOR:
{
@@ -145,7 +153,7 @@ static Tcl_Obj* ValuesGetProc(ClientData clientData, Tk_Window tkwin,
return listObjPtr;
}
default:
- return Tcl_NewStringObj("", 0);
+ return Tcl_NewStringObj("", -1);
}
}
@@ -230,10 +238,12 @@ static Tcl_Obj* PairsGetProc(ClientData clientData, Tk_Window tkwin,
{
ElemCoords* coordsPtr = (ElemCoords*)(widgRec + offset);
- if (!coordsPtr->x || !coordsPtr->x->nValues)
+ if (!coordsPtr ||
+ !coordsPtr->x || !coordsPtr->y ||
+ !coordsPtr->x->nValues || !coordsPtr->y->nValues)
return Tcl_NewListObj(0, (Tcl_Obj**)NULL);
- int cnt = coordsPtr->x->nValues;
+ int cnt = MIN(coordsPtr->x->nValues, coordsPtr->y->nValues);
Tcl_Obj** ll = (Tcl_Obj**)calloc(2*cnt,sizeof(Tcl_Obj*));
for (int ii=0, jj=0; ii<cnt; ii++) {
ll[jj++] = Tcl_NewDoubleObj(coordsPtr->x->values[ii]);
diff --git a/src/bltGrHairs.C b/src/bltGrHairs.C
index d08b7eb..c747de6 100644
--- a/src/bltGrHairs.C
+++ b/src/bltGrHairs.C
@@ -30,6 +30,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include "bltC.h"
+
extern "C" {
#include "bltInt.h"
#include "bltGraph.h"
diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C
index 0b83257..f61d4e7 100644
--- a/src/bltGrLegd.C
+++ b/src/bltGrLegd.C
@@ -31,6 +31,8 @@
#include <X11/Xutil.h>
#include <X11/Xatom.h>
+#include "bltC.h"
+
extern "C" {
#include "bltInt.h"
#include "bltGraph.h"
diff --git a/src/bltGrMarker.C b/src/bltGrMarker.C
index ce450d6..cd995da 100644
--- a/src/bltGrMarker.C
+++ b/src/bltGrMarker.C
@@ -27,6 +27,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include "bltC.h"
#include "bltMath.h"
extern "C" {
@@ -89,6 +90,10 @@ static int CoordsSetProc(ClientData clientData, Tcl_Interp* interp,
{
Coords** coordsPtrPtr = (Coords**)(widgRec + offset);
*(double*)savePtr = *(double*)coordsPtrPtr;
+
+ if (!coordsPtrPtr)
+ return TCL_OK;
+
*coordsPtrPtr = NULL;
int objc;
@@ -127,6 +132,7 @@ static Tcl_Obj* CoordsGetProc(ClientData clientData, Tk_Window tkwin,
char *widgRec, int offset)
{
Coords* coordsPtr = *(Coords**)(widgRec + offset);
+
if (!coordsPtr)
return Tcl_NewListObj(0, NULL);
diff --git a/src/bltGrMarkerLine.C b/src/bltGrMarkerLine.C
index 035e7d3..12c9713 100644
--- a/src/bltGrMarkerLine.C
+++ b/src/bltGrMarkerLine.C
@@ -27,6 +27,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include "bltC.h"
+
extern "C" {
#include "bltGraph.h"
};
diff --git a/src/bltGrMarkerPolygon.C b/src/bltGrMarkerPolygon.C
index 1a86d8e..55af0cf 100644
--- a/src/bltGrMarkerPolygon.C
+++ b/src/bltGrMarkerPolygon.C
@@ -27,6 +27,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include "bltC.h"
+
extern "C" {
#include "bltGraph.h"
};
diff --git a/src/bltGrMarkerText.C b/src/bltGrMarkerText.C
index d0597c1..8892447 100644
--- a/src/bltGrMarkerText.C
+++ b/src/bltGrMarkerText.C
@@ -27,6 +27,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include "bltC.h"
#include "bltMath.h"
extern "C" {
diff --git a/src/bltGrMisc.C b/src/bltGrMisc.C
index 59d26f3..4f5a85b 100644
--- a/src/bltGrMisc.C
+++ b/src/bltGrMisc.C
@@ -32,6 +32,8 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include "bltC.h"
+
extern "C" {
#include "bltInt.h"
#include "bltGraph.h"
diff --git a/src/bltGrPSOutput.C b/src/bltGrPSOutput.C
index bfad8c1..84b146c 100644
--- a/src/bltGrPSOutput.C
+++ b/src/bltGrPSOutput.C
@@ -34,6 +34,8 @@
#include <X11/Xutil.h>
#include <X11/Xatom.h>
+#include "bltC.h"
+
extern "C" {
#include <tkPort.h>
#include <tkInt.h>
diff --git a/src/bltGrPenOp.C b/src/bltGrPenOp.C
index b27f9dc..fc302f2 100644
--- a/src/bltGrPenOp.C
+++ b/src/bltGrPenOp.C
@@ -30,6 +30,8 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include "bltC.h"
+
extern "C" {
#include "bltInt.h"
#include "bltGraph.h"
diff --git a/src/bltGrText.C b/src/bltGrText.C
index c4235c4..9c484fe 100644
--- a/src/bltGrText.C
+++ b/src/bltGrText.C
@@ -30,6 +30,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include "bltC.h"
#include "bltMath.h"
extern "C" {
diff --git a/src/bltGraph.C b/src/bltGraph.C
index af0d758..c4cf074 100644
--- a/src/bltGraph.C
+++ b/src/bltGraph.C
@@ -30,6 +30,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include "bltC.h"
#include "bltMath.h"
extern "C" {
diff --git a/src/bltInt.C b/src/bltInt.C
index f70339c..641ae0a 100644
--- a/src/bltInt.C
+++ b/src/bltInt.C
@@ -27,6 +27,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include "bltC.h"
+
extern "C" {
#include "bltInt.h"
diff --git a/src/bltNsUtil.C b/src/bltNsUtil.C
index 902c050..b4abfb2 100644
--- a/src/bltNsUtil.C
+++ b/src/bltNsUtil.C
@@ -27,6 +27,8 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include "bltC.h"
+
extern "C" {
#include <tclPort.h>
#include <tclInt.h>
diff --git a/src/bltParse.C b/src/bltParse.C
index 930a2b1..6fcd812 100644
--- a/src/bltParse.C
+++ b/src/bltParse.C
@@ -23,6 +23,8 @@
* since the compiled code typically runs only one time.
*/
+#include "bltC.h"
+
extern "C" {
#include "bltInt.h"
#include "bltParse.h"
@@ -204,6 +206,7 @@ static unsigned char tclTypeTable[] =
*
*---------------------------------------------------------------------------
*/
+
int Blt_ParseNestedCmd(
Tcl_Interp* interp, /* Interpreter to use for nested command
* evaluations and error messages. */
diff --git a/src/bltSwitch.C b/src/bltSwitch.C
index 323a761..29404f2 100644
--- a/src/bltSwitch.C
+++ b/src/bltSwitch.C
@@ -29,6 +29,8 @@
#include <stdarg.h>
+#include "bltC.h"
+
extern "C" {
#include "bltInt.h"
#include "bltSwitch.h"