diff options
author | joye <joye> | 2013-09-05 19:02:37 (GMT) |
---|---|---|
committer | joye <joye> | 2013-09-05 19:02:37 (GMT) |
commit | c6e0e8f787459f8727b4140a7341dcc5cd6ea1c3 (patch) | |
tree | 3ac07c44792688be100153955f9c086116a2ede0 /src | |
parent | 5cfdc8fc60e6e2729f7ec6752916edc06b408984 (diff) | |
download | blt-c6e0e8f787459f8727b4140a7341dcc5cd6ea1c3.zip blt-c6e0e8f787459f8727b4140a7341dcc5cd6ea1c3.tar.gz blt-c6e0e8f787459f8727b4140a7341dcc5cd6ea1c3.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r-- | src/bltGrElemLine.C | 186 | ||||
-rw-r--r-- | src/bltGrMisc.C | 10 | ||||
-rw-r--r-- | src/bltGrPSOutput.C | 82 | ||||
-rw-r--r-- | src/bltGrText.C | 67 | ||||
-rw-r--r-- | src/bltGraph.C | 179 | ||||
-rw-r--r-- | src/bltInt.C | 34 |
6 files changed, 0 insertions, 558 deletions
diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C index 18c63c6..41a0eb8 100644 --- a/src/bltGrElemLine.C +++ b/src/bltGrElemLine.C @@ -765,30 +765,6 @@ static DistanceProc DistanceToXProc; static DistanceProc DistanceToLineProc; static Blt_BackgroundChangedProc BackgroundChangedProc; -#ifdef WIN32 - -static int tkpWinRopModes[] = -{ - R2_BLACK, /* GXclear */ - R2_MASKPEN, /* GXand */ - R2_MASKPENNOT, /* GXandReverse */ - R2_COPYPEN, /* GXcopy */ - R2_MASKNOTPEN, /* GXandInverted */ - R2_NOT, /* GXnoop */ - R2_XORPEN, /* GXxor */ - R2_MERGEPEN, /* GXor */ - R2_NOTMERGEPEN, /* GXnor */ - R2_NOTXORPEN, /* GXequiv */ - R2_NOT, /* GXinvert */ - R2_MERGEPENNOT, /* GXorReverse */ - R2_NOTCOPYPEN, /* GXcopyInverted */ - R2_MERGENOTPEN, /* GXorInverted */ - R2_NOTMASKPEN, /* GXnand */ - R2_WHITE /* GXset */ -}; - -#endif - INLINE static int Round(double x) { @@ -3492,61 +3468,6 @@ ClosestLineProc(Graph *graphPtr, Element *basePtr, ClosestSearch *searchPtr) #define MAX_DRAWRECTANGLES(d) Blt_MaxRequestSize(d, sizeof(XRectangle)) #define MAX_DRAWARCS(d) Blt_MaxRequestSize(d, sizeof(XArc)) -#ifdef WIN32 - -static void -DrawCircles( - Display *display, - Drawable drawable, - LineElement *elemPtr, - LinePen *penPtr, - int nSymbolPts, - Point2d *symbolPts, - int radius) -{ - HBRUSH brush, oldBrush; - HPEN pen, oldPen; - HDC dc; - TkWinDCState state; - - if (drawable == None) { - return; /* Huh? */ - } - if ((penPtr->symbol.fillGC == NULL) && - (penPtr->symbol.outlineWidth == 0)) { - return; - } - dc = TkWinGetDrawableDC(display, drawable, &state); - /* SetROP2(dc, tkpWinRopModes[penPtr->symbol.fillGC->function]); */ - if (penPtr->symbol.fillGC != NULL) { - brush = CreateSolidBrush(penPtr->symbol.fillGC->foreground); - } else { - brush = GetStockBrush(NULL_BRUSH); - } - if (penPtr->symbol.outlineWidth > 0) { - pen = Blt_GCToPen(dc, penPtr->symbol.outlineGC); - } else { - pen = GetStockPen(NULL_PEN); - } - oldPen = SelectPen(dc, pen); - oldBrush = SelectBrush(dc, brush); - { - Point2d *pp, *pend; - - for (pp = symbolPts, pend = pp + nSymbolPts; pp < pend; pp++) { - int rndx, rndy; - rndx = Round(pp->x), rndy = Round(pp->y); - Ellipse(dc, rndx - radius, rndy - radius, rndx + radius + 1, - rndy + radius + 1); - } - } - DeleteBrush(SelectBrush(dc, oldBrush)); - DeletePen(SelectPen(dc, oldPen)); - TkWinReleaseDrawableDC(drawable, dc, &state); -} - -#else - static void DrawCircles(Display *display, Drawable drawable, LineElement *elemPtr, LinePen *penPtr, int nSymbolPts, Point2d *symbolPts, int radius) @@ -3607,8 +3528,6 @@ DrawCircles(Display *display, Drawable drawable, LineElement *elemPtr, free(arcs); } -#endif - static void DrawSquares(Display *display, Drawable drawable, LineElement *elemPtr, LinePen *penPtr, int nSymbolPts, Point2d *symbolPts, int r) @@ -4265,110 +4184,6 @@ DrawSymbolProc( } } -#ifdef WIN32 - -static void -DrawTraces( - Graph *graphPtr, - Drawable drawable, /* Pixmap or window to draw into */ - LineElement *elemPtr, - LinePen *penPtr) -{ - Blt_ChainLink link; - HBRUSH brush, oldBrush; - HDC dc; - HPEN pen, oldPen; - POINT *points; - TkWinDCState state; - int np; - - /* - * Depending if the line is wide (> 1 pixel), arbitrarily break the line in - * sections of 100 points. This bit of weirdness has to do with wide - * geometric pens. The longer the polyline, the slower it draws. The trade - * off is that we lose dash and cap uniformity for unbearably slow polyline - * draws. - */ - if (penPtr->traceGC->line_width > 1) { - np = 100; - } else { - np = Blt_MaxRequestSize(graphPtr->display, sizeof(POINT)) - 1; - } - points = malloc((np + 1) * sizeof(POINT)); - - dc = TkWinGetDrawableDC(graphPtr->display, drawable, &state); - - pen = Blt_GCToPen(dc, penPtr->traceGC); - oldPen = SelectPen(dc, pen); - brush = CreateSolidBrush(penPtr->traceGC->foreground); - oldBrush = SelectBrush(dc, brush); - SetROP2(dc, tkpWinRopModes[penPtr->traceGC->function]); - - for (link = Blt_Chain_FirstLink(elemPtr->traces); link != NULL; - link = Blt_Chain_NextLink(link)) { - POINT *p; - Trace *tracePtr; - int count, remaining; - - tracePtr = Blt_Chain_GetValue(link); - - /* - * If the trace has to be split into separate XDrawLines calls, then the - * end point of the current trace is also the starting point of the new - * split. - */ - - /* Step 1. Convert and draw the first section of the trace. - * It may contain the entire trace. */ - - for (p = points, count = 0; - count < MIN(np, tracePtr->screenPts.length); - count++, p++) { - p->x = Round(tracePtr->screenPts.points[count].x); - p->y = Round(tracePtr->screenPts.points[count].y); - } - Polyline(dc, points, count); - - /* Step 2. Next handle any full-size chunks left. */ - - while ((count + np) < tracePtr->screenPts.length) { - int j; - - /* Start with the last point of the previous trace. */ - points[0].x = points[np - 1].x; - points[0].y = points[np - 1].y; - - for (p = points + 1, j = 0; j < np; j++, count++, p++) { - p->x = Round(tracePtr->screenPts.points[count].x); - p->y = Round(tracePtr->screenPts.points[count].y); - } - Polyline(dc, points, np + 1); - } - - /* Step 3. Convert and draw the remaining points. */ - - remaining = tracePtr->screenPts.length - count; - if (remaining > 0) { - /* Start with the last point of the previous trace. */ - points[0].x = points[np - 1].x; - points[0].y = points[np - 1].y; - - for (p = points + 1; count < tracePtr->screenPts.length; - count++, p++) { - p->x = Round(tracePtr->screenPts.points[count].x); - p->y = Round(tracePtr->screenPts.points[count].y); - } - Polyline(dc, points, remaining + 1); - } - } - free(points); - DeletePen(SelectPen(dc, oldPen)); - DeleteBrush(SelectBrush(dc, oldBrush)); - TkWinReleaseDrawableDC(drawable, dc, &state); -} - -#else - static void DrawTraces(Graph *graphPtr, Drawable drawable, LineElement *elemPtr, LinePen *penPtr) @@ -4440,7 +4255,6 @@ DrawTraces(Graph *graphPtr, Drawable drawable, LineElement *elemPtr, } free(points); } -#endif /* WIN32 */ static void DrawValues(Graph *graphPtr, Drawable drawable, LineElement *elemPtr, diff --git a/src/bltGrMisc.C b/src/bltGrMisc.C index 47fa77a..c8b5c21 100644 --- a/src/bltGrMisc.C +++ b/src/bltGrMisc.C @@ -933,11 +933,7 @@ Blt_GetPrivateGCFromDrawable( { GC newGC; -#ifdef WIN32 - newGC = Blt_EmulateXCreateGC(display, drawable, gcMask, valuePtr); -#else newGC = XCreateGC(display, drawable, gcMask, valuePtr); -#endif return newGC; } @@ -1000,14 +996,12 @@ Blt_FreePrivateGC(Display *display, GC gc) XFreeGC(display, gc); } -#ifndef WIN32 void Blt_SetDashes(Display *display, GC gc, Blt_Dashes *dashesPtr) { XSetDashes(display, gc, dashesPtr->offset, (const char *)dashesPtr->values, (int)strlen((char *)dashesPtr->values)); } -#endif void Blt_ScreenDPI(Tk_Window tkwin, unsigned int *xPtr, unsigned int *yPtr) @@ -1172,14 +1166,10 @@ Blt_MaxRequestSize(Display *display, size_t elemSize) if (maxSizeBytes == 0L) { long size; -#ifndef WIN32 size = XExtendedMaxRequestSize(display); if (size == 0) { size = XMaxRequestSize(display); } -#else - size = XMaxRequestSize(display); -#endif size -= (4 * elemSize); /* maxSizeBytes = (size * 4); */ maxSizeBytes = size; diff --git a/src/bltGrPSOutput.C b/src/bltGrPSOutput.C index 80794ff..420a361 100644 --- a/src/bltGrPSOutput.C +++ b/src/bltGrPSOutput.C @@ -533,86 +533,6 @@ ByteToHex(unsigned char byte, char *string) string[1] = hexDigits[byte & 0x0F]; } -#ifdef WIN32 -/* - *--------------------------------------------------------------------------- - * - * Blt_Ps_XSetBitmapData -- - * - * Output a PostScript image string of the given bitmap image. It is - * assumed the image is one bit deep and a zero value indicates an - * off-pixel. To convert to PostScript, the bits need to be reversed - * from the X11 image order. - * - * Results: - * None. - * - * Side Effects: - * The PostScript image string is appended. - * - *--------------------------------------------------------------------------- - */ -void -Blt_Ps_XSetBitmapData( - PostScript *psPtr, - Display *display, - Pixmap bitmap, - int width, int height) -{ - unsigned char byte; - int x, y, bitPos; - unsigned long pixel; - int byteCount; - char string[10]; - unsigned char *srcBits, *srcPtr; - int bytesPerRow; - - srcBits = Blt_GetBitmapData(display, bitmap, width, height, &bytesPerRow); - if (srcBits == NULL) { - OutputDebugString("Can't get bitmap data"); - return; - } - Blt_Ps_Append(psPtr, "\t<"); - byteCount = bitPos = 0; /* Suppress compiler warning */ - for (y = height - 1; y >= 0; y--) { - srcPtr = srcBits + (bytesPerRow * y); - byte = 0; - for (x = 0; x < width; x++) { - bitPos = x % 8; - pixel = (*srcPtr & (0x80 >> bitPos)); - if (pixel) { - byte |= (unsigned char)(1 << bitPos); - } - if (bitPos == 7) { - byte = ReverseBits(byte); - ByteToHex(byte, string); - string[2] = '\0'; - byteCount++; - srcPtr++; - byte = 0; - if (byteCount >= 30) { - string[2] = '\n'; - string[3] = '\t'; - string[4] = '\0'; - byteCount = 0; - } - Blt_Ps_Append(psPtr, string); - } - } /* x */ - if (bitPos != 7) { - byte = ReverseBits(byte); - ByteToHex(byte, string); - string[2] = '\0'; - Blt_Ps_Append(psPtr, string); - byteCount++; - } - } /* y */ - free(srcBits); - Blt_Ps_Append(psPtr, ">\n"); -} - -#else - /* *--------------------------------------------------------------------------- * @@ -680,8 +600,6 @@ Blt_Ps_XSetBitmapData(Blt_Ps ps, Display *display, Pixmap bitmap, int w, int h) XDestroyImage(imagePtr); } -#endif /* WIN32 */ - typedef struct { const char *alias; const char *fontName; diff --git a/src/bltGrText.C b/src/bltGrText.C index 73ad39f..6eedea2 100644 --- a/src/bltGrText.C +++ b/src/bltGrText.C @@ -746,72 +746,6 @@ Blt_DrawLayout(Tk_Window tkwin, Drawable drawable, GC gc, Blt_Font font, } -#ifdef WIN32 -/* - *--------------------------------------------------------------------------- - * - * Blt_Ts_Bitmap -- - * - * Draw a bitmap, using the the given window coordinates as an anchor for - * the text bounding box. - * - * Results: - * Returns the bitmap representing the text string. - * - * Side Effects: - * Bitmap is drawn using the given font and GC in the drawable at the - * given coordinates, anchor, and rotation. - * - *--------------------------------------------------------------------------- - */ -Pixmap -Blt_Ts_Bitmap( - Tk_Window tkwin, - TextLayout *layoutPtr, /* Text string to draw */ - TextStyle *stylePtr, /* Text attributes: rotation, color, - * font, linespacing, justification, - * etc. */ - int *bmWidthPtr, - int *bmHeightPtr) /* Extents of rotated text string */ -{ - Pixmap bitmap; - Window root; - GC gc; - HDC hDC; - TkWinDCState state; - - /* Create a temporary bitmap to contain the text string */ - root = Tk_RootWindow(tkwin); - bitmap = Tk_GetPixmap(Tk_Display(tkwin), root, layoutPtr->width, - layoutPtr->height, 1); - assert(bitmap != None); - if (bitmap == None) { - return None; /* Can't allocate pixmap. */ - } - gc = Blt_GetBitmapGC(tkwin); - - /* Clear the pixmap and draw the text string into it */ - hDC = TkWinGetDrawableDC(Tk_Display(tkwin), bitmap, &state); - PatBlt(hDC, 0, 0, layoutPtr->width, layoutPtr->height, WHITENESS); - TkWinReleaseDrawableDC(bitmap, hDC, &state); - - XSetFont(Tk_Display(tkwin), gc, Blt_FontId(stylePtr->font)); - XSetForeground(Tk_Display(tkwin), gc, 1); - Blt_DrawLayout(tkwin, bitmap, gc, stylePtr->font, 1, 0.0f, 0, 0, layoutPtr, - stylePtr->maxLength); - - /* - * Under Win32, 1 is off and 0 is on. That's why we're inverting the - * bitmap here. - */ - hDC = TkWinGetDrawableDC(Tk_Display(tkwin), bitmap, &state); - PatBlt(hDC, 0, 0, layoutPtr->width, layoutPtr->height, DSTINVERT); - TkWinReleaseDrawableDC(bitmap, hDC, &state); - - *bmWidthPtr = layoutPtr->width, *bmHeightPtr = layoutPtr->height; - return bitmap; -} -#else /* *--------------------------------------------------------------------------- * @@ -864,7 +798,6 @@ Blt_Ts_Bitmap( *bmWidthPtr = layoutPtr->width, *bmHeightPtr = layoutPtr->height; return bitmap; } -#endif /* WIN32 */ void Blt_Ts_SetDrawStyle( diff --git a/src/bltGraph.C b/src/bltGraph.C index aba18c1..073f6b2 100644 --- a/src/bltGraph.C +++ b/src/bltGraph.C @@ -1281,115 +1281,14 @@ ObjToFormat( *formatPtr = FORMAT_PHOTO; } else if ((c == 'p') && (strcmp(string, "photo") == 0)) { *formatPtr = FORMAT_PHOTO; -#ifdef WIN32 - } else if ((c == 'e') && (strcmp(string, "emf") == 0)) { - *formatPtr = FORMAT_EMF; - } else if ((c == 'w') && (strcmp(string, "wmf") == 0)) { - *formatPtr = FORMAT_WMF; -#endif /* WIN32 */ } else { -#ifdef WIN32 - Tcl_AppendResult(interp, "bad format \"", string, - "\": should be picture, photo, emf, or wmf.", (char *)NULL); -#else Tcl_AppendResult(interp, "bad format \"", string, "\": should be picture or photo.", (char *)NULL); -#endif /* WIN32 */ return TCL_ERROR; } return TCL_OK; } -#ifdef WIN32 -static int InitMetaFileHeader( - Tk_Window tkwin, - int width, int height, - APMHEADER *mfhPtr) -{ - unsigned int *p; - unsigned int sum; -#define MM_INCH 25.4 - int xdpi, ydpi; - - mfhPtr->key = 0x9ac6cdd7L; - mfhPtr->hmf = 0; - mfhPtr->inch = 1440; - - Blt_ScreenDPI(tkwin, &xdpi, &ydpi); - mfhPtr->bbox.Left = mfhPtr->bbox.Top = 0; - mfhPtr->bbox.Bottom = (SHORT)((width * 1440)/ (float)xdpi); - mfhPtr->bbox.Right = (SHORT)((height * 1440) / (float)ydpi); - mfhPtr->reserved = 0; - sum = 0; - for (p = (unsigned int *)mfhPtr; - p < (unsigned int *)&(mfhPtr->checksum); p++) { - sum ^= *p; - } - mfhPtr->checksum = sum; - return TCL_OK; -} - -static int -CreateAPMetaFile(Tcl_Interp *interp, HANDLE hMetaFile, HDC hDC, - APMHEADER *mfhPtr, const char *fileName) -{ - HANDLE hFile; - HANDLE hMem; - LPVOID buffer; - int result; - DWORD count, nBytes; - - result = TCL_ERROR; - hMem = NULL; - hFile = CreateFile( - fileName, /* File path */ - GENERIC_WRITE, /* Access mode */ - 0, /* No sharing. */ - NULL, /* Security attributes */ - CREATE_ALWAYS, /* Overwrite any existing file */ - FILE_ATTRIBUTE_NORMAL, - NULL); /* No template file */ - if (hFile == INVALID_HANDLE_VALUE) { - Tcl_AppendResult(interp, "can't create metafile \"", fileName, - "\":", Blt_LastError(), (char *)NULL); - return TCL_ERROR; - } - if ((!WriteFile(hFile, (LPVOID)mfhPtr, sizeof(APMHEADER), &count, - NULL)) || (count != sizeof(APMHEADER))) { - Tcl_AppendResult(interp, "can't create metafile header to \"", - fileName, "\":", Blt_LastError(), (char *)NULL); - goto error; - } - nBytes = GetWinMetaFileBits(hMetaFile, 0, NULL, MM_ANISOTROPIC, hDC); - hMem = GlobalAlloc(GHND, nBytes); - if (hMem == NULL) { - Tcl_AppendResult(interp, "can't create allocate global memory:", - Blt_LastError(), (char *)NULL); - goto error; - } - buffer = (LPVOID)GlobalLock(hMem); - if (!GetWinMetaFileBits(hMetaFile, nBytes, buffer, MM_ANISOTROPIC, hDC)) { - Tcl_AppendResult(interp, "can't get metafile bits:", - Blt_LastError(), (char *)NULL); - goto error; - } - if ((!WriteFile(hFile, buffer, nBytes, &count, NULL)) || - (count != nBytes)) { - Tcl_AppendResult(interp, "can't write metafile bits:", - Blt_LastError(), (char *)NULL); - goto error; - } - result = TCL_OK; - error: - CloseHandle(hFile); - if (hMem != NULL) { - GlobalUnlock(hMem); - GlobalFree(hMem); - } - return result; -} -#endif /*WIN32*/ - /* *--------------------------------------------------------------------------- * @@ -1453,9 +1352,6 @@ SnapOp(Graph *graphPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) case FORMAT_PHOTO: drawable = Tk_GetPixmap(graphPtr->display, drawable, graphPtr->width, graphPtr->height, Tk_Depth(graphPtr->tkwin)); -#ifdef WIN32 - assert(drawable != None); -#endif graphPtr->flags |= RESET_WORLD; Blt_DrawGraph(graphPtr, drawable); if (switches.format == FORMAT_PICTURE) { @@ -1470,78 +1366,6 @@ SnapOp(Graph *graphPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) Tk_FreePixmap(graphPtr->display, drawable); break; -#ifdef WIN32 - case FORMAT_WMF: - case FORMAT_EMF: - { - TkWinDC drawableDC; - TkWinDCState state; - HDC hRefDC, hDC; - HENHMETAFILE hMetaFile; - Tcl_DString dString; - const char *title; - - hRefDC = TkWinGetDrawableDC(graphPtr->display, drawable, &state); - - Tcl_DStringInit(&dString); - Tcl_DStringAppend(&dString, "BLT Graph ", -1); - Tcl_DStringAppend(&dString, BLT_VERSION, -1); - Tcl_DStringAppend(&dString, "\0", -1); - Tcl_DStringAppend(&dString, Tk_PathName(graphPtr->tkwin), -1); - Tcl_DStringAppend(&dString, "\0", -1); - title = Tcl_DStringValue(&dString); - hDC = CreateEnhMetaFile(hRefDC, NULL, NULL, title); - Tcl_DStringFree(&dString); - - if (hDC == NULL) { - Tcl_AppendResult(interp, "can't create metafile: ", - Blt_LastError(), (char *)NULL); - return TCL_ERROR; - } - - drawableDC.hdc = hDC; - drawableDC.type = TWD_WINDC; - - graphPtr->width = switches.width; - graphPtr->height = switches.height; - Blt_MapGraph(graphPtr); - graphPtr->flags |= RESET_WORLD; - Blt_DrawGraph(graphPtr, (Drawable)&drawableDC); - hMetaFile = CloseEnhMetaFile(hDC); - if (strcmp(switches.name, "CLIPBOARD") == 0) { - HWND hWnd; - - hWnd = Tk_GetHWND(drawable); - OpenClipboard(hWnd); - EmptyClipboard(); - SetClipboardData(CF_ENHMETAFILE, hMetaFile); - CloseClipboard(); - result = TCL_OK; - } else { - result = TCL_ERROR; - if (switches.format == FORMAT_WMF) { - APMHEADER mfh; - - assert(sizeof(mfh) == 22); - InitMetaFileHeader(graphPtr->tkwin, switches.width, - switches.height, &mfh); - result = CreateAPMetaFile(interp, hMetaFile, hRefDC, &mfh, - switches.name); - } else { - HENHMETAFILE hMetaFile2; - - hMetaFile2 = CopyEnhMetaFile(hMetaFile, switches.name); - if (hMetaFile2 != NULL) { - result = TCL_OK; - DeleteEnhMetaFile(hMetaFile2); - } - } - DeleteEnhMetaFile(hMetaFile); - } - TkWinReleaseDrawableDC(drawable, hRefDC, &state); - } - break; -#endif /*WIN32*/ default: Tcl_AppendResult(interp, "bad snapshot format", (char *)NULL); return TCL_ERROR; @@ -2013,9 +1837,6 @@ DisplayGraph(ClientData clientData) graphPtr->flags |= CACHE_DIRTY; } } -#ifdef WIN32 - assert(drawable != None); -#endif if (graphPtr->backingStore) { if (graphPtr->flags & CACHE_DIRTY) { /* The backing store is new or out-of-date. */ diff --git a/src/bltInt.C b/src/bltInt.C index a5213ca..616cd3d 100644 --- a/src/bltInt.C +++ b/src/bltInt.C @@ -32,11 +32,7 @@ #include "bltMath.h" #ifndef BLT_LIBRARY -# ifdef WIN32 -# define BLT_LIBRARY "c:/Program Files/Tcl/lib/blt"##BLT_VERSION -# else # define BLT_LIBRARY "unknown" -# endif #endif #if (_TCL_VERSION >= _VERSION(8,5,0)) @@ -129,36 +125,6 @@ SetLibraryPath(Tcl_Interp *interp) Tcl_DStringInit(&dString); Tcl_DStringAppend(&dString, libPath, -1); -#ifdef WIN32 - { - HKEY key; - DWORD result; -# ifndef BLT_REGISTRY_KEY -# define BLT_REGISTRY_KEY "Software\\BLT\\" BLT_VERSION "\\" TCL_VERSION -# endif - result = RegOpenKeyEx( - HKEY_LOCAL_MACHINE, /* Parent key. */ - BLT_REGISTRY_KEY, /* Path to sub-key. */ - 0, /* Reserved. */ - KEY_READ, /* Security access mask. */ - &key); /* Resulting key.*/ - - if (result == ERROR_SUCCESS) { - DWORD size; - - /* Query once to get the size of the string needed */ - result = RegQueryValueEx(key, "BLT_LIBRARY", NULL, NULL, NULL, - &size); - if (result == ERROR_SUCCESS) { - Tcl_DStringSetLength(&dString, size); - /* And again to collect the string. */ - RegQueryValueEx(key, "BLT_LIBRARY", NULL, NULL, - (LPBYTE)Tcl_DStringValue(&dString), &size); - RegCloseKey(key); - } - } - } -#endif /* WIN32 */ value = Tcl_SetVar(interp, "blt_libPath", Tcl_DStringValue(&dString), TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG); Tcl_DStringFree(&dString); |