Pratt 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.exrc +61 -0
- data/.gitignore +4 -0
- data/History.txt +6 -0
- data/Manifest.txt +46 -0
- data/Pratt.gemspec +351 -0
- data/README.txt +66 -0
- data/Rakefile +85 -0
- data/TODO +54 -0
- data/VERSION +1 -0
- data/bin/pratt.rb +13 -0
- data/config.rb +34 -0
- data/lib/pratt.rb +527 -0
- data/lib/pratt/array.rb +11 -0
- data/lib/pratt/string.rb +18 -0
- data/models/app.rb +40 -0
- data/models/customer.rb +24 -0
- data/models/payment.rb +22 -0
- data/models/pratt.rb +19 -0
- data/models/project.rb +82 -0
- data/models/whence.rb +70 -0
- data/pkgs/tile-0.8.2.tar.gz +0 -0
- data/pkgs/tile-0.8.2/ANNOUNCE.txt +95 -0
- data/pkgs/tile-0.8.2/ChangeLog +4651 -0
- data/pkgs/tile-0.8.2/Makefile +250 -0
- data/pkgs/tile-0.8.2/Makefile.in +250 -0
- data/pkgs/tile-0.8.2/README.txt +86 -0
- data/pkgs/tile-0.8.2/aclocal.m4 +2 -0
- data/pkgs/tile-0.8.2/altTheme.o +0 -0
- data/pkgs/tile-0.8.2/blink.o +0 -0
- data/pkgs/tile-0.8.2/button.o +0 -0
- data/pkgs/tile-0.8.2/cache.o +0 -0
- data/pkgs/tile-0.8.2/clamTheme.o +0 -0
- data/pkgs/tile-0.8.2/classicTheme.o +0 -0
- data/pkgs/tile-0.8.2/config.log +1330 -0
- data/pkgs/tile-0.8.2/config.status +795 -0
- data/pkgs/tile-0.8.2/configure +15248 -0
- data/pkgs/tile-0.8.2/configure.in +89 -0
- data/pkgs/tile-0.8.2/demos/autocomplete.tcl +59 -0
- data/pkgs/tile-0.8.2/demos/demo.tcl +870 -0
- data/pkgs/tile-0.8.2/demos/dirbrowser.tcl +167 -0
- data/pkgs/tile-0.8.2/demos/dlgtest.tcl +97 -0
- data/pkgs/tile-0.8.2/demos/iconlib.tcl +110 -0
- data/pkgs/tile-0.8.2/demos/repeater.tcl +117 -0
- data/pkgs/tile-0.8.2/demos/toolbutton.tcl +101 -0
- data/pkgs/tile-0.8.2/doc/Geometry.3 +230 -0
- data/pkgs/tile-0.8.2/doc/INDEX.MAP +153 -0
- data/pkgs/tile-0.8.2/doc/Makefile +36 -0
- data/pkgs/tile-0.8.2/doc/TILE.XML +45 -0
- data/pkgs/tile-0.8.2/doc/Theme.3 +34 -0
- data/pkgs/tile-0.8.2/doc/button.n +75 -0
- data/pkgs/tile-0.8.2/doc/checkbutton.n +61 -0
- data/pkgs/tile-0.8.2/doc/combobox.n +98 -0
- data/pkgs/tile-0.8.2/doc/converting.txt +97 -0
- data/pkgs/tile-0.8.2/doc/dialog.n +122 -0
- data/pkgs/tile-0.8.2/doc/entry.n +438 -0
- data/pkgs/tile-0.8.2/doc/frame.n +43 -0
- data/pkgs/tile-0.8.2/doc/html/Geometry.html +304 -0
- data/pkgs/tile-0.8.2/doc/html/Theme.html +48 -0
- data/pkgs/tile-0.8.2/doc/html/button.html +120 -0
- data/pkgs/tile-0.8.2/doc/html/category-index.html +18 -0
- data/pkgs/tile-0.8.2/doc/html/checkbutton.html +94 -0
- data/pkgs/tile-0.8.2/doc/html/combobox.html +164 -0
- data/pkgs/tile-0.8.2/doc/html/converting.txt +97 -0
- data/pkgs/tile-0.8.2/doc/html/dialog.html +159 -0
- data/pkgs/tile-0.8.2/doc/html/entry.html +613 -0
- data/pkgs/tile-0.8.2/doc/html/frame.html +76 -0
- data/pkgs/tile-0.8.2/doc/html/image.html +100 -0
- data/pkgs/tile-0.8.2/doc/html/index.html +25 -0
- data/pkgs/tile-0.8.2/doc/html/keyword-index.html +228 -0
- data/pkgs/tile-0.8.2/doc/html/label.html +133 -0
- data/pkgs/tile-0.8.2/doc/html/labelframe.html +91 -0
- data/pkgs/tile-0.8.2/doc/html/manpage.css +212 -0
- data/pkgs/tile-0.8.2/doc/html/menubutton.html +63 -0
- data/pkgs/tile-0.8.2/doc/html/notebook.html +280 -0
- data/pkgs/tile-0.8.2/doc/html/paned.html +149 -0
- data/pkgs/tile-0.8.2/doc/html/progressbar.html +138 -0
- data/pkgs/tile-0.8.2/doc/html/radiobutton.html +89 -0
- data/pkgs/tile-0.8.2/doc/html/scrollbar.html +221 -0
- data/pkgs/tile-0.8.2/doc/html/separator.html +48 -0
- data/pkgs/tile-0.8.2/doc/html/sizegrip.html +62 -0
- data/pkgs/tile-0.8.2/doc/html/style.html +172 -0
- data/pkgs/tile-0.8.2/doc/html/tile-intro.html +164 -0
- data/pkgs/tile-0.8.2/doc/html/treeview.html +634 -0
- data/pkgs/tile-0.8.2/doc/html/widget.html +342 -0
- data/pkgs/tile-0.8.2/doc/image.n +81 -0
- data/pkgs/tile-0.8.2/doc/internals.txt +409 -0
- data/pkgs/tile-0.8.2/doc/label.n +75 -0
- data/pkgs/tile-0.8.2/doc/labelframe.n +64 -0
- data/pkgs/tile-0.8.2/doc/man.macros +239 -0
- data/pkgs/tile-0.8.2/doc/menubutton.n +41 -0
- data/pkgs/tile-0.8.2/doc/notebook.n +188 -0
- data/pkgs/tile-0.8.2/doc/paned.n +95 -0
- data/pkgs/tile-0.8.2/doc/progressbar.n +79 -0
- data/pkgs/tile-0.8.2/doc/radiobutton.n +57 -0
- data/pkgs/tile-0.8.2/doc/scrollbar.n +160 -0
- data/pkgs/tile-0.8.2/doc/separator.n +30 -0
- data/pkgs/tile-0.8.2/doc/sizegrip.n +53 -0
- data/pkgs/tile-0.8.2/doc/style.n +119 -0
- data/pkgs/tile-0.8.2/doc/tile-intro.n +165 -0
- data/pkgs/tile-0.8.2/doc/tmml.options +4 -0
- data/pkgs/tile-0.8.2/doc/treeview.n +415 -0
- data/pkgs/tile-0.8.2/doc/widget.n +227 -0
- data/pkgs/tile-0.8.2/doc/xml/Geometry.tmml +379 -0
- data/pkgs/tile-0.8.2/doc/xml/INDEX.MAP +153 -0
- data/pkgs/tile-0.8.2/doc/xml/Theme.tmml +63 -0
- data/pkgs/tile-0.8.2/doc/xml/button.tmml +134 -0
- data/pkgs/tile-0.8.2/doc/xml/checkbutton.tmml +119 -0
- data/pkgs/tile-0.8.2/doc/xml/combobox.tmml +184 -0
- data/pkgs/tile-0.8.2/doc/xml/dialog.tmml +195 -0
- data/pkgs/tile-0.8.2/doc/xml/entry.tmml +630 -0
- data/pkgs/tile-0.8.2/doc/xml/frame.tmml +98 -0
- data/pkgs/tile-0.8.2/doc/xml/image.tmml +101 -0
- data/pkgs/tile-0.8.2/doc/xml/label.tmml +154 -0
- data/pkgs/tile-0.8.2/doc/xml/labelframe.tmml +116 -0
- data/pkgs/tile-0.8.2/doc/xml/menubutton.tmml +80 -0
- data/pkgs/tile-0.8.2/doc/xml/notebook.tmml +306 -0
- data/pkgs/tile-0.8.2/doc/xml/paned.tmml +154 -0
- data/pkgs/tile-0.8.2/doc/xml/progressbar.tmml +151 -0
- data/pkgs/tile-0.8.2/doc/xml/radiobutton.tmml +109 -0
- data/pkgs/tile-0.8.2/doc/xml/scrollbar.tmml +233 -0
- data/pkgs/tile-0.8.2/doc/xml/separator.tmml +59 -0
- data/pkgs/tile-0.8.2/doc/xml/sizegrip.tmml +82 -0
- data/pkgs/tile-0.8.2/doc/xml/style.tmml +171 -0
- data/pkgs/tile-0.8.2/doc/xml/tile-intro.tmml +192 -0
- data/pkgs/tile-0.8.2/doc/xml/treeview.tmml +604 -0
- data/pkgs/tile-0.8.2/doc/xml/widget.tmml +372 -0
- data/pkgs/tile-0.8.2/entry.o +0 -0
- data/pkgs/tile-0.8.2/frame.o +0 -0
- data/pkgs/tile-0.8.2/generic/Makefile.in +221 -0
- data/pkgs/tile-0.8.2/generic/TODO +493 -0
- data/pkgs/tile-0.8.2/generic/altTheme.c +1172 -0
- data/pkgs/tile-0.8.2/generic/blink.c +168 -0
- data/pkgs/tile-0.8.2/generic/button.c +858 -0
- data/pkgs/tile-0.8.2/generic/cache.c +354 -0
- data/pkgs/tile-0.8.2/generic/clamTheme.c +974 -0
- data/pkgs/tile-0.8.2/generic/classicTheme.c +518 -0
- data/pkgs/tile-0.8.2/generic/configure +10334 -0
- data/pkgs/tile-0.8.2/generic/configure.in +100 -0
- data/pkgs/tile-0.8.2/generic/entry.c +1922 -0
- data/pkgs/tile-0.8.2/generic/frame.c +648 -0
- data/pkgs/tile-0.8.2/generic/gunk.h +44 -0
- data/pkgs/tile-0.8.2/generic/image.c +416 -0
- data/pkgs/tile-0.8.2/generic/label.c +663 -0
- data/pkgs/tile-0.8.2/generic/layout.c +1215 -0
- data/pkgs/tile-0.8.2/generic/manager.c +554 -0
- data/pkgs/tile-0.8.2/generic/manager.h +91 -0
- data/pkgs/tile-0.8.2/generic/notebook.c +1380 -0
- data/pkgs/tile-0.8.2/generic/paned.c +958 -0
- data/pkgs/tile-0.8.2/generic/pkgIndex.tcl.in +7 -0
- data/pkgs/tile-0.8.2/generic/progress.c +549 -0
- data/pkgs/tile-0.8.2/generic/scale.c +526 -0
- data/pkgs/tile-0.8.2/generic/scroll.c +253 -0
- data/pkgs/tile-0.8.2/generic/scrollbar.c +346 -0
- data/pkgs/tile-0.8.2/generic/separator.c +132 -0
- data/pkgs/tile-0.8.2/generic/square.c +306 -0
- data/pkgs/tile-0.8.2/generic/tagset.c +147 -0
- data/pkgs/tile-0.8.2/generic/tile.c +296 -0
- data/pkgs/tile-0.8.2/generic/tkElements.c +1280 -0
- data/pkgs/tile-0.8.2/generic/tkTheme.c +1708 -0
- data/pkgs/tile-0.8.2/generic/tkTheme.h +419 -0
- data/pkgs/tile-0.8.2/generic/tkThemeInt.h +45 -0
- data/pkgs/tile-0.8.2/generic/tkstate.c +268 -0
- data/pkgs/tile-0.8.2/generic/trace.c +145 -0
- data/pkgs/tile-0.8.2/generic/track.c +174 -0
- data/pkgs/tile-0.8.2/generic/treeview.c +3211 -0
- data/pkgs/tile-0.8.2/generic/ttk.decls +154 -0
- data/pkgs/tile-0.8.2/generic/ttkDecls.h +340 -0
- data/pkgs/tile-0.8.2/generic/ttkStubInit.c +61 -0
- data/pkgs/tile-0.8.2/generic/ttkStubLib.c +70 -0
- data/pkgs/tile-0.8.2/generic/widget.c +785 -0
- data/pkgs/tile-0.8.2/generic/widget.h +263 -0
- data/pkgs/tile-0.8.2/image.o +0 -0
- data/pkgs/tile-0.8.2/label.o +0 -0
- data/pkgs/tile-0.8.2/layout.o +0 -0
- data/pkgs/tile-0.8.2/library/altTheme.tcl +101 -0
- data/pkgs/tile-0.8.2/library/aquaTheme.tcl +62 -0
- data/pkgs/tile-0.8.2/library/button.tcl +85 -0
- data/pkgs/tile-0.8.2/library/clamTheme.tcl +139 -0
- data/pkgs/tile-0.8.2/library/classicTheme.tcl +108 -0
- data/pkgs/tile-0.8.2/library/combobox.tcl +439 -0
- data/pkgs/tile-0.8.2/library/cursors.tcl +36 -0
- data/pkgs/tile-0.8.2/library/defaults.tcl +118 -0
- data/pkgs/tile-0.8.2/library/dialog.tcl +274 -0
- data/pkgs/tile-0.8.2/library/entry.tcl +580 -0
- data/pkgs/tile-0.8.2/library/fonts.tcl +153 -0
- data/pkgs/tile-0.8.2/library/icons.tcl +105 -0
- data/pkgs/tile-0.8.2/library/keynav.tcl +192 -0
- data/pkgs/tile-0.8.2/library/menubutton.tcl +171 -0
- data/pkgs/tile-0.8.2/library/notebook.tcl +193 -0
- data/pkgs/tile-0.8.2/library/paned.tcl +87 -0
- data/pkgs/tile-0.8.2/library/progress.tcl +51 -0
- data/pkgs/tile-0.8.2/library/scale.tcl +54 -0
- data/pkgs/tile-0.8.2/library/scrollbar.tcl +125 -0
- data/pkgs/tile-0.8.2/library/sizegrip.tcl +77 -0
- data/pkgs/tile-0.8.2/library/tile.tcl +211 -0
- data/pkgs/tile-0.8.2/library/treeview.tcl +382 -0
- data/pkgs/tile-0.8.2/library/utils.tcl +254 -0
- data/pkgs/tile-0.8.2/library/winTheme.tcl +77 -0
- data/pkgs/tile-0.8.2/library/xpTheme.tcl +63 -0
- data/pkgs/tile-0.8.2/libtile0.8.2.so +0 -0
- data/pkgs/tile-0.8.2/libttkstub.a +0 -0
- data/pkgs/tile-0.8.2/license.terms +24 -0
- data/pkgs/tile-0.8.2/macosx/aquaTheme.c +1076 -0
- data/pkgs/tile-0.8.2/manager.o +0 -0
- data/pkgs/tile-0.8.2/notebook.o +0 -0
- data/pkgs/tile-0.8.2/paned.o +0 -0
- data/pkgs/tile-0.8.2/pkgIndex.tcl +3 -0
- data/pkgs/tile-0.8.2/progress.o +0 -0
- data/pkgs/tile-0.8.2/scale.o +0 -0
- data/pkgs/tile-0.8.2/scroll.o +0 -0
- data/pkgs/tile-0.8.2/scrollbar.o +0 -0
- data/pkgs/tile-0.8.2/separator.o +0 -0
- data/pkgs/tile-0.8.2/tagset.o +0 -0
- data/pkgs/tile-0.8.2/tclconfig/install-sh +119 -0
- data/pkgs/tile-0.8.2/tclconfig/tcl.m4 +4069 -0
- data/pkgs/tile-0.8.2/tclconfig/teax.m4 +109 -0
- data/pkgs/tile-0.8.2/tests/all.tcl +18 -0
- data/pkgs/tile-0.8.2/tests/bwidget.test +103 -0
- data/pkgs/tile-0.8.2/tests/cbtest.tcl +125 -0
- data/pkgs/tile-0.8.2/tests/combobox.test +51 -0
- data/pkgs/tile-0.8.2/tests/compound.tcl +92 -0
- data/pkgs/tile-0.8.2/tests/entry.test +285 -0
- data/pkgs/tile-0.8.2/tests/entrytest.tcl +78 -0
- data/pkgs/tile-0.8.2/tests/image.test +94 -0
- data/pkgs/tile-0.8.2/tests/labelframe.tcl +41 -0
- data/pkgs/tile-0.8.2/tests/labelframe.test +137 -0
- data/pkgs/tile-0.8.2/tests/layout.test +33 -0
- data/pkgs/tile-0.8.2/tests/misc.test +35 -0
- data/pkgs/tile-0.8.2/tests/nbtest.tcl +66 -0
- data/pkgs/tile-0.8.2/tests/notebook.test +500 -0
- data/pkgs/tile-0.8.2/tests/paned.test +298 -0
- data/pkgs/tile-0.8.2/tests/progress.test +92 -0
- data/pkgs/tile-0.8.2/tests/pwtest.tcl +90 -0
- data/pkgs/tile-0.8.2/tests/sbtest.tcl +79 -0
- data/pkgs/tile-0.8.2/tests/scrollbar.test +77 -0
- data/pkgs/tile-0.8.2/tests/sgtest.tcl +52 -0
- data/pkgs/tile-0.8.2/tests/testutils.tcl +20 -0
- data/pkgs/tile-0.8.2/tests/tile.test +674 -0
- data/pkgs/tile-0.8.2/tests/treetags.test +78 -0
- data/pkgs/tile-0.8.2/tests/treeview.test +563 -0
- data/pkgs/tile-0.8.2/tests/tvtest.tcl +332 -0
- data/pkgs/tile-0.8.2/tests/validate.test +278 -0
- data/pkgs/tile-0.8.2/tile.o +0 -0
- data/pkgs/tile-0.8.2/tkElements.o +0 -0
- data/pkgs/tile-0.8.2/tkTheme.o +0 -0
- data/pkgs/tile-0.8.2/tkstate.o +0 -0
- data/pkgs/tile-0.8.2/tools/genStubs.tcl +861 -0
- data/pkgs/tile-0.8.2/trace.o +0 -0
- data/pkgs/tile-0.8.2/track.o +0 -0
- data/pkgs/tile-0.8.2/treeview.o +0 -0
- data/pkgs/tile-0.8.2/ttkStubInit.o +0 -0
- data/pkgs/tile-0.8.2/ttkStubLib.o +0 -0
- data/pkgs/tile-0.8.2/widget.o +0 -0
- data/pkgs/tile-0.8.2/win/Tile.dsp +261 -0
- data/pkgs/tile-0.8.2/win/makefile.vc +527 -0
- data/pkgs/tile-0.8.2/win/monitor.c +164 -0
- data/pkgs/tile-0.8.2/win/nmakehlp.c +483 -0
- data/pkgs/tile-0.8.2/win/rules.vc +512 -0
- data/pkgs/tile-0.8.2/win/tile.rc +40 -0
- data/pkgs/tile-0.8.2/win/winTheme.c +734 -0
- data/pkgs/tile-0.8.2/win/xpTheme.c +1029 -0
- data/spec/app_spec.rb +48 -0
- data/spec/customer_spec.rb +31 -0
- data/spec/fixtures/graph.expectation +18 -0
- data/spec/payment_spec.rb +19 -0
- data/spec/pratt_spec.rb +148 -0
- data/spec/project_spec.rb +163 -0
- data/spec/rcov.opts +0 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/whence_spec.rb +54 -0
- data/tasks/pratt.rb +84 -0
- data/templates/model.eruby +12 -0
- data/templates/spec.eruby +8 -0
- data/views/env.rb +22 -0
- data/views/graph.eruby +20 -0
- data/views/invoice.eruby +148 -0
- data/views/main.rb +92 -0
- data/views/pid.eruby +3 -0
- data/views/pop.rb +94 -0
- data/views/pop2.rb +75 -0
- data/views/raw.eruby +11 -0
- metadata +390 -0
@@ -0,0 +1,164 @@
|
|
1
|
+
/* monitor.c,v 1.17 2006/11/19 19:35:28 jenglish Exp
|
2
|
+
*/
|
3
|
+
|
4
|
+
#ifdef _MSC_VER
|
5
|
+
#define WIN32_LEAN_AND_MEAN
|
6
|
+
#endif
|
7
|
+
|
8
|
+
#include <windows.h>
|
9
|
+
#include <tcl.h>
|
10
|
+
#include <tk.h>
|
11
|
+
#include <tkPlatDecls.h>
|
12
|
+
#include "tkTheme.h"
|
13
|
+
|
14
|
+
#if !defined(WM_THEMECHANGED)
|
15
|
+
#define WM_THEMECHANGED 0x031A
|
16
|
+
#endif
|
17
|
+
|
18
|
+
static LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
|
19
|
+
|
20
|
+
/*
|
21
|
+
* RegisterSystemColors --
|
22
|
+
* Register all known Windows system colors (as per GetSysColor)
|
23
|
+
* as Tk named colors.
|
24
|
+
*/
|
25
|
+
|
26
|
+
typedef struct {
|
27
|
+
const char *name;
|
28
|
+
int index;
|
29
|
+
} SystemColorEntry;
|
30
|
+
|
31
|
+
static SystemColorEntry sysColors[] = {
|
32
|
+
{ "System3dDarkShadow", COLOR_3DDKSHADOW },
|
33
|
+
{ "System3dLight", COLOR_3DLIGHT },
|
34
|
+
{ "SystemActiveBorder", COLOR_ACTIVEBORDER },
|
35
|
+
{ "SystemActiveCaption", COLOR_ACTIVECAPTION },
|
36
|
+
{ "SystemAppWorkspace", COLOR_APPWORKSPACE },
|
37
|
+
{ "SystemBackground", COLOR_BACKGROUND },
|
38
|
+
{ "SystemButtonFace", COLOR_BTNFACE },
|
39
|
+
{ "SystemButtonHighlight", COLOR_BTNHIGHLIGHT },
|
40
|
+
{ "SystemButtonShadow", COLOR_BTNSHADOW },
|
41
|
+
{ "SystemButtonText", COLOR_BTNTEXT },
|
42
|
+
{ "SystemCaptionText", COLOR_CAPTIONTEXT },
|
43
|
+
{ "SystemDisabledText", COLOR_GRAYTEXT },
|
44
|
+
{ "SystemGrayText", COLOR_GRAYTEXT },
|
45
|
+
{ "SystemHighlight", COLOR_HIGHLIGHT },
|
46
|
+
{ "SystemHighlightText", COLOR_HIGHLIGHTTEXT },
|
47
|
+
{ "SystemInactiveBorder", COLOR_INACTIVEBORDER },
|
48
|
+
{ "SystemInactiveCaption", COLOR_INACTIVECAPTION },
|
49
|
+
{ "SystemInactiveCaptionText", COLOR_INACTIVECAPTIONTEXT },
|
50
|
+
{ "SystemInfoBackground", COLOR_INFOBK },
|
51
|
+
{ "SystemInfoText", COLOR_INFOTEXT },
|
52
|
+
{ "SystemMenu", COLOR_MENU },
|
53
|
+
{ "SystemMenuText", COLOR_MENUTEXT },
|
54
|
+
{ "SystemScrollbar", COLOR_SCROLLBAR },
|
55
|
+
{ "SystemWindow", COLOR_WINDOW },
|
56
|
+
{ "SystemWindowFrame", COLOR_WINDOWFRAME },
|
57
|
+
{ "SystemWindowText", COLOR_WINDOWTEXT },
|
58
|
+
{ NULL, 0 }
|
59
|
+
};
|
60
|
+
|
61
|
+
static void RegisterSystemColors(Tcl_Interp *interp)
|
62
|
+
{
|
63
|
+
Ttk_ResourceCache cache = Ttk_GetResourceCache(interp);
|
64
|
+
SystemColorEntry *sysColor;
|
65
|
+
|
66
|
+
for (sysColor = sysColors; sysColor->name; ++sysColor) {
|
67
|
+
DWORD pixel = GetSysColor(sysColor->index);
|
68
|
+
XColor colorSpec;
|
69
|
+
colorSpec.red = GetRValue(pixel) * 257;
|
70
|
+
colorSpec.green = GetGValue(pixel) * 257;
|
71
|
+
colorSpec.blue = GetBValue(pixel) * 257;
|
72
|
+
Ttk_RegisterNamedColor(cache, sysColor->name, &colorSpec);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
static HWND
|
77
|
+
CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp)
|
78
|
+
{
|
79
|
+
WNDCLASSEX wc;
|
80
|
+
HWND hwnd = NULL;
|
81
|
+
CHAR title[32] = "TtkMonitorWindow";
|
82
|
+
CHAR name[32] = "TtkMonitorClass";
|
83
|
+
|
84
|
+
wc.cbSize = sizeof(WNDCLASSEX);
|
85
|
+
wc.style = CS_HREDRAW | CS_VREDRAW;
|
86
|
+
wc.lpfnWndProc = (WNDPROC)WndProc;
|
87
|
+
wc.cbClsExtra = 0;
|
88
|
+
wc.cbWndExtra = 0;
|
89
|
+
wc.hInstance = hinst;
|
90
|
+
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
91
|
+
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
|
92
|
+
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
93
|
+
wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
|
94
|
+
wc.lpszMenuName = name;
|
95
|
+
wc.lpszClassName = name;
|
96
|
+
|
97
|
+
if (RegisterClassEx(&wc)) {
|
98
|
+
hwnd = CreateWindow( name, title, WS_OVERLAPPEDWINDOW,
|
99
|
+
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
100
|
+
NULL, NULL, hinst, NULL );
|
101
|
+
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG)interp);
|
102
|
+
ShowWindow(hwnd, SW_HIDE);
|
103
|
+
UpdateWindow(hwnd);
|
104
|
+
}
|
105
|
+
return hwnd;
|
106
|
+
}
|
107
|
+
|
108
|
+
static void
|
109
|
+
DestroyThemeMonitorWindow(void *clientData)
|
110
|
+
{
|
111
|
+
HWND hwnd = (HWND)clientData;
|
112
|
+
DestroyWindow(hwnd);
|
113
|
+
}
|
114
|
+
|
115
|
+
static LRESULT WINAPI
|
116
|
+
WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
|
117
|
+
{
|
118
|
+
Tcl_Interp *interp = (Tcl_Interp *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
119
|
+
Ttk_Theme theme;
|
120
|
+
|
121
|
+
switch (msg) {
|
122
|
+
case WM_DESTROY:
|
123
|
+
break;
|
124
|
+
|
125
|
+
case WM_SYSCOLORCHANGE:
|
126
|
+
RegisterSystemColors(interp);
|
127
|
+
break;
|
128
|
+
|
129
|
+
case WM_THEMECHANGED:
|
130
|
+
/*
|
131
|
+
* Reset the application theme to 'xpnative' if present,
|
132
|
+
* which will in turn fall back to 'winnative' if XP theming
|
133
|
+
* is disabled.
|
134
|
+
*/
|
135
|
+
theme = Ttk_GetTheme(interp, "xpnative");
|
136
|
+
if (theme) {
|
137
|
+
Ttk_UseTheme(interp, theme);
|
138
|
+
/* @@@ What to do about errors here? */
|
139
|
+
}
|
140
|
+
break;
|
141
|
+
}
|
142
|
+
return DefWindowProc(hwnd, msg, wp, lp);
|
143
|
+
}
|
144
|
+
|
145
|
+
/*
|
146
|
+
* Windows-specific platform initialization:
|
147
|
+
*/
|
148
|
+
|
149
|
+
extern int TtkWinTheme_Init(Tcl_Interp *, HWND hwnd);
|
150
|
+
extern int TtkXPTheme_Init(Tcl_Interp *, HWND hwnd);
|
151
|
+
|
152
|
+
int Ttk_WinPlatformInit(Tcl_Interp *interp)
|
153
|
+
{
|
154
|
+
HWND hwnd;
|
155
|
+
|
156
|
+
hwnd = CreateThemeMonitorWindow(Tk_GetHINSTANCE(), interp);
|
157
|
+
Ttk_RegisterCleanup(interp, (ClientData)hwnd, DestroyThemeMonitorWindow);
|
158
|
+
|
159
|
+
TtkWinTheme_Init(interp, hwnd);
|
160
|
+
TtkXPTheme_Init(interp, hwnd);
|
161
|
+
|
162
|
+
return TCL_OK;
|
163
|
+
}
|
164
|
+
|
@@ -0,0 +1,483 @@
|
|
1
|
+
/* ----------------------------------------------------------------------------
|
2
|
+
* nmakehlp.c --
|
3
|
+
*
|
4
|
+
* This is used to fix limitations within nmake and the environment.
|
5
|
+
*
|
6
|
+
* Copyright (c) 2002 by David Gravereaux.
|
7
|
+
* Copyright (c) 2003 by Patrick Thoyts
|
8
|
+
*
|
9
|
+
* See the file "license.terms" for information on usage and redistribution
|
10
|
+
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
11
|
+
*
|
12
|
+
* ----------------------------------------------------------------------------
|
13
|
+
* RCS: @(#) nmakehlp.c,v 1.2 2006/07/11 21:36:26 patthoyts Exp
|
14
|
+
* ----------------------------------------------------------------------------
|
15
|
+
*/
|
16
|
+
|
17
|
+
#define _CRT_SECURE_NO_DEPRECATE
|
18
|
+
#include <windows.h>
|
19
|
+
#pragma comment (lib, "user32.lib")
|
20
|
+
#pragma comment (lib, "kernel32.lib")
|
21
|
+
#include <stdio.h>
|
22
|
+
|
23
|
+
/* protos */
|
24
|
+
|
25
|
+
int CheckForCompilerFeature(const char *option);
|
26
|
+
int CheckForLinkerFeature(const char *option);
|
27
|
+
int IsIn(const char *string, const char *substring);
|
28
|
+
int GetVersionFromHeader(const char *tclh, const char *tkh);
|
29
|
+
DWORD WINAPI ReadFromPipe(LPVOID args);
|
30
|
+
|
31
|
+
/* globals */
|
32
|
+
|
33
|
+
#define CHUNK 25
|
34
|
+
#define STATICBUFFERSIZE 1000
|
35
|
+
typedef struct {
|
36
|
+
HANDLE pipe;
|
37
|
+
char buffer[STATICBUFFERSIZE];
|
38
|
+
} pipeinfo;
|
39
|
+
|
40
|
+
pipeinfo Out = {INVALID_HANDLE_VALUE, '\0'};
|
41
|
+
pipeinfo Err = {INVALID_HANDLE_VALUE, '\0'};
|
42
|
+
|
43
|
+
/*
|
44
|
+
* exitcodes: 0 == no, 1 == yes, 2 == error
|
45
|
+
*/
|
46
|
+
|
47
|
+
int
|
48
|
+
main (int argc, char *argv[])
|
49
|
+
{
|
50
|
+
char msg[300];
|
51
|
+
DWORD dwWritten;
|
52
|
+
int chars;
|
53
|
+
|
54
|
+
/*
|
55
|
+
* Make sure children (cl.exe and link.exe) are kept quiet.
|
56
|
+
*/
|
57
|
+
|
58
|
+
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
|
59
|
+
|
60
|
+
/*
|
61
|
+
* Make sure the compiler and linker aren't effected by the outside world.
|
62
|
+
*/
|
63
|
+
|
64
|
+
SetEnvironmentVariable("CL", "");
|
65
|
+
SetEnvironmentVariable("LINK", "");
|
66
|
+
|
67
|
+
if (argc > 1 && *argv[1] == '-') {
|
68
|
+
switch (*(argv[1]+1)) {
|
69
|
+
case 'c':
|
70
|
+
if (argc != 3) {
|
71
|
+
chars = wsprintf(msg, "usage: %s -c <compiler option>\n"
|
72
|
+
"Tests for whether cl.exe supports an option\n"
|
73
|
+
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
|
74
|
+
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
|
75
|
+
return 2;
|
76
|
+
}
|
77
|
+
return CheckForCompilerFeature(argv[2]);
|
78
|
+
case 'l':
|
79
|
+
if (argc != 3) {
|
80
|
+
chars = wsprintf(msg, "usage: %s -l <linker option>\n"
|
81
|
+
"Tests for whether link.exe supports an option\n"
|
82
|
+
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
|
83
|
+
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
|
84
|
+
return 2;
|
85
|
+
}
|
86
|
+
return CheckForLinkerFeature(argv[2]);
|
87
|
+
case 'f':
|
88
|
+
if (argc == 2) {
|
89
|
+
chars = wsprintf(msg, "usage: %s -f <string> <substring>\n"
|
90
|
+
"Find a substring within another\n"
|
91
|
+
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
|
92
|
+
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
|
93
|
+
return 2;
|
94
|
+
} else if (argc == 3) {
|
95
|
+
/*
|
96
|
+
* If the string is blank, there is no match.
|
97
|
+
*/
|
98
|
+
|
99
|
+
return 0;
|
100
|
+
} else {
|
101
|
+
return IsIn(argv[2], argv[3]);
|
102
|
+
}
|
103
|
+
case 'v':
|
104
|
+
if (argc != 4) {
|
105
|
+
chars = wsprintf(msg, "usage: %s -v <tcl.h> <tk.h>\n"
|
106
|
+
"Search for versions from the tcl and tk headers.",
|
107
|
+
argv[0]);
|
108
|
+
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
|
109
|
+
return 0;
|
110
|
+
}
|
111
|
+
return GetVersionFromHeader(argv[2], argv[3]);
|
112
|
+
}
|
113
|
+
}
|
114
|
+
chars = wsprintf(msg, "usage: %s -c|-l|-f ...\n"
|
115
|
+
"This is a little helper app to equalize shell differences between WinNT and\n"
|
116
|
+
"Win9x and get nmake.exe to accomplish its job.\n",
|
117
|
+
argv[0]);
|
118
|
+
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
|
119
|
+
return 2;
|
120
|
+
}
|
121
|
+
|
122
|
+
int
|
123
|
+
CheckForCompilerFeature(
|
124
|
+
const char *option)
|
125
|
+
{
|
126
|
+
STARTUPINFO si;
|
127
|
+
PROCESS_INFORMATION pi;
|
128
|
+
SECURITY_ATTRIBUTES sa;
|
129
|
+
DWORD threadID;
|
130
|
+
char msg[300];
|
131
|
+
BOOL ok;
|
132
|
+
HANDLE hProcess, h, pipeThreads[2];
|
133
|
+
char cmdline[100];
|
134
|
+
|
135
|
+
hProcess = GetCurrentProcess();
|
136
|
+
|
137
|
+
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
|
138
|
+
ZeroMemory(&si, sizeof(STARTUPINFO));
|
139
|
+
si.cb = sizeof(STARTUPINFO);
|
140
|
+
si.dwFlags = STARTF_USESTDHANDLES;
|
141
|
+
si.hStdInput = INVALID_HANDLE_VALUE;
|
142
|
+
|
143
|
+
ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
|
144
|
+
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
|
145
|
+
sa.lpSecurityDescriptor = NULL;
|
146
|
+
sa.bInheritHandle = FALSE;
|
147
|
+
|
148
|
+
/*
|
149
|
+
* Create a non-inheritible pipe.
|
150
|
+
*/
|
151
|
+
|
152
|
+
CreatePipe(&Out.pipe, &h, &sa, 0);
|
153
|
+
|
154
|
+
/*
|
155
|
+
* Dupe the write side, make it inheritible, and close the original.
|
156
|
+
*/
|
157
|
+
|
158
|
+
DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE,
|
159
|
+
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
|
160
|
+
|
161
|
+
/*
|
162
|
+
* Same as above, but for the error side.
|
163
|
+
*/
|
164
|
+
|
165
|
+
CreatePipe(&Err.pipe, &h, &sa, 0);
|
166
|
+
DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE,
|
167
|
+
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
|
168
|
+
|
169
|
+
/*
|
170
|
+
* Base command line.
|
171
|
+
*/
|
172
|
+
|
173
|
+
strcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X ");
|
174
|
+
|
175
|
+
/*
|
176
|
+
* Append our option for testing
|
177
|
+
*/
|
178
|
+
|
179
|
+
strcat(cmdline, option);
|
180
|
+
|
181
|
+
/*
|
182
|
+
* Filename to compile, which exists, but is nothing and empty.
|
183
|
+
*/
|
184
|
+
|
185
|
+
strcat(cmdline, " .\\nul");
|
186
|
+
|
187
|
+
ok = CreateProcess(
|
188
|
+
NULL, /* Module name. */
|
189
|
+
cmdline, /* Command line. */
|
190
|
+
NULL, /* Process handle not inheritable. */
|
191
|
+
NULL, /* Thread handle not inheritable. */
|
192
|
+
TRUE, /* yes, inherit handles. */
|
193
|
+
DETACHED_PROCESS, /* No console for you. */
|
194
|
+
NULL, /* Use parent's environment block. */
|
195
|
+
NULL, /* Use parent's starting directory. */
|
196
|
+
&si, /* Pointer to STARTUPINFO structure. */
|
197
|
+
&pi); /* Pointer to PROCESS_INFORMATION structure. */
|
198
|
+
|
199
|
+
if (!ok) {
|
200
|
+
DWORD err = GetLastError();
|
201
|
+
int chars = wsprintf(msg,
|
202
|
+
"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);
|
203
|
+
|
204
|
+
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
|
205
|
+
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
|
206
|
+
(300-chars), 0);
|
207
|
+
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, strlen(msg), &err,NULL);
|
208
|
+
return 2;
|
209
|
+
}
|
210
|
+
|
211
|
+
/*
|
212
|
+
* Close our references to the write handles that have now been inherited.
|
213
|
+
*/
|
214
|
+
|
215
|
+
CloseHandle(si.hStdOutput);
|
216
|
+
CloseHandle(si.hStdError);
|
217
|
+
|
218
|
+
WaitForInputIdle(pi.hProcess, 5000);
|
219
|
+
CloseHandle(pi.hThread);
|
220
|
+
|
221
|
+
/*
|
222
|
+
* Start the pipe reader threads.
|
223
|
+
*/
|
224
|
+
|
225
|
+
pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID);
|
226
|
+
pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID);
|
227
|
+
|
228
|
+
/*
|
229
|
+
* Block waiting for the process to end.
|
230
|
+
*/
|
231
|
+
|
232
|
+
WaitForSingleObject(pi.hProcess, INFINITE);
|
233
|
+
CloseHandle(pi.hProcess);
|
234
|
+
|
235
|
+
/*
|
236
|
+
* Wait for our pipe to get done reading, should it be a little slow.
|
237
|
+
*/
|
238
|
+
|
239
|
+
WaitForMultipleObjects(2, pipeThreads, TRUE, 500);
|
240
|
+
CloseHandle(pipeThreads[0]);
|
241
|
+
CloseHandle(pipeThreads[1]);
|
242
|
+
|
243
|
+
#ifdef _DEBUG
|
244
|
+
{
|
245
|
+
DWORD err = 0;
|
246
|
+
WriteFile(GetStdHandle(STD_ERROR_HANDLE), Out.buffer,
|
247
|
+
strlen(Out.buffer), &err,NULL);
|
248
|
+
WriteFile(GetStdHandle(STD_ERROR_HANDLE), Err.buffer,
|
249
|
+
strlen(Out.buffer), &err,NULL);
|
250
|
+
}
|
251
|
+
#endif
|
252
|
+
|
253
|
+
/*
|
254
|
+
* Look for the commandline warning code in both streams.
|
255
|
+
* - in MSVC 6 & 7 we get D4002, in MSVC 8 we get D9002.
|
256
|
+
*/
|
257
|
+
|
258
|
+
return !(strstr(Out.buffer, "D4002") != NULL
|
259
|
+
|| strstr(Err.buffer, "D4002") != NULL
|
260
|
+
|| strstr(Out.buffer, "D9002") != NULL
|
261
|
+
|| strstr(Err.buffer, "D9002") != NULL);
|
262
|
+
}
|
263
|
+
|
264
|
+
int
|
265
|
+
CheckForLinkerFeature(
|
266
|
+
const char *option)
|
267
|
+
{
|
268
|
+
STARTUPINFO si;
|
269
|
+
PROCESS_INFORMATION pi;
|
270
|
+
SECURITY_ATTRIBUTES sa;
|
271
|
+
DWORD threadID;
|
272
|
+
char msg[300];
|
273
|
+
BOOL ok;
|
274
|
+
HANDLE hProcess, h, pipeThreads[2];
|
275
|
+
char cmdline[100];
|
276
|
+
|
277
|
+
hProcess = GetCurrentProcess();
|
278
|
+
|
279
|
+
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
|
280
|
+
ZeroMemory(&si, sizeof(STARTUPINFO));
|
281
|
+
si.cb = sizeof(STARTUPINFO);
|
282
|
+
si.dwFlags = STARTF_USESTDHANDLES;
|
283
|
+
si.hStdInput = INVALID_HANDLE_VALUE;
|
284
|
+
|
285
|
+
ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
|
286
|
+
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
|
287
|
+
sa.lpSecurityDescriptor = NULL;
|
288
|
+
sa.bInheritHandle = TRUE;
|
289
|
+
|
290
|
+
/*
|
291
|
+
* Create a non-inheritible pipe.
|
292
|
+
*/
|
293
|
+
|
294
|
+
CreatePipe(&Out.pipe, &h, &sa, 0);
|
295
|
+
|
296
|
+
/*
|
297
|
+
* Dupe the write side, make it inheritible, and close the original.
|
298
|
+
*/
|
299
|
+
|
300
|
+
DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE,
|
301
|
+
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
|
302
|
+
|
303
|
+
/*
|
304
|
+
* Same as above, but for the error side.
|
305
|
+
*/
|
306
|
+
|
307
|
+
CreatePipe(&Err.pipe, &h, &sa, 0);
|
308
|
+
DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE,
|
309
|
+
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
|
310
|
+
|
311
|
+
/*
|
312
|
+
* Base command line.
|
313
|
+
*/
|
314
|
+
|
315
|
+
strcpy(cmdline, "link.exe -nologo ");
|
316
|
+
|
317
|
+
/*
|
318
|
+
* Append our option for testing.
|
319
|
+
*/
|
320
|
+
|
321
|
+
strcat(cmdline, option);
|
322
|
+
|
323
|
+
ok = CreateProcess(
|
324
|
+
NULL, /* Module name. */
|
325
|
+
cmdline, /* Command line. */
|
326
|
+
NULL, /* Process handle not inheritable. */
|
327
|
+
NULL, /* Thread handle not inheritable. */
|
328
|
+
TRUE, /* yes, inherit handles. */
|
329
|
+
DETACHED_PROCESS, /* No console for you. */
|
330
|
+
NULL, /* Use parent's environment block. */
|
331
|
+
NULL, /* Use parent's starting directory. */
|
332
|
+
&si, /* Pointer to STARTUPINFO structure. */
|
333
|
+
&pi); /* Pointer to PROCESS_INFORMATION structure. */
|
334
|
+
|
335
|
+
if (!ok) {
|
336
|
+
DWORD err = GetLastError();
|
337
|
+
int chars = wsprintf(msg,
|
338
|
+
"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);
|
339
|
+
|
340
|
+
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
|
341
|
+
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
|
342
|
+
(300-chars), 0);
|
343
|
+
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, strlen(msg), &err,NULL);
|
344
|
+
return 2;
|
345
|
+
}
|
346
|
+
|
347
|
+
/*
|
348
|
+
* Close our references to the write handles that have now been inherited.
|
349
|
+
*/
|
350
|
+
|
351
|
+
CloseHandle(si.hStdOutput);
|
352
|
+
CloseHandle(si.hStdError);
|
353
|
+
|
354
|
+
WaitForInputIdle(pi.hProcess, 5000);
|
355
|
+
CloseHandle(pi.hThread);
|
356
|
+
|
357
|
+
/*
|
358
|
+
* Start the pipe reader threads.
|
359
|
+
*/
|
360
|
+
|
361
|
+
pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID);
|
362
|
+
pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID);
|
363
|
+
|
364
|
+
/*
|
365
|
+
* Block waiting for the process to end.
|
366
|
+
*/
|
367
|
+
|
368
|
+
WaitForSingleObject(pi.hProcess, INFINITE);
|
369
|
+
CloseHandle(pi.hProcess);
|
370
|
+
|
371
|
+
/*
|
372
|
+
* Wait for our pipe to get done reading, should it be a little slow.
|
373
|
+
*/
|
374
|
+
|
375
|
+
WaitForMultipleObjects(2, pipeThreads, TRUE, 500);
|
376
|
+
CloseHandle(pipeThreads[0]);
|
377
|
+
CloseHandle(pipeThreads[1]);
|
378
|
+
|
379
|
+
/*
|
380
|
+
* Look for the commandline warning code in the stderr stream.
|
381
|
+
*/
|
382
|
+
|
383
|
+
return !(strstr(Out.buffer, "LNK1117") != NULL ||
|
384
|
+
strstr(Err.buffer, "LNK1117") != NULL);
|
385
|
+
}
|
386
|
+
|
387
|
+
#if USE_DG_CODE
|
388
|
+
DWORD WINAPI
|
389
|
+
ReadFromPipe(
|
390
|
+
LPVOID args)
|
391
|
+
{
|
392
|
+
pipeinfo *pi = (pipeinfo *) args;
|
393
|
+
char *lastBuf = pi->buffer;
|
394
|
+
DWORD dwRead;
|
395
|
+
BOOL ok;
|
396
|
+
|
397
|
+
again:
|
398
|
+
if (lastBuf - pi->buffer + CHUNK > STATICBUFFERSIZE) {
|
399
|
+
CloseHandle(pi->pipe);
|
400
|
+
return -1;
|
401
|
+
}
|
402
|
+
ok = ReadFile(pi->pipe, lastBuf, CHUNK, &dwRead, 0L);
|
403
|
+
if (!ok || dwRead == 0) {
|
404
|
+
CloseHandle(pi->pipe);
|
405
|
+
return 0;
|
406
|
+
}
|
407
|
+
lastBuf += dwRead;
|
408
|
+
goto again;
|
409
|
+
|
410
|
+
return 0; /* makes the compiler happy */
|
411
|
+
}
|
412
|
+
#else
|
413
|
+
DWORD WINAPI
|
414
|
+
ReadFromPipe (LPVOID args)
|
415
|
+
{
|
416
|
+
pipeinfo *pi = (pipeinfo *) args;
|
417
|
+
char *lastBuf = pi->buffer;
|
418
|
+
DWORD dwRead;
|
419
|
+
BOOL ok;
|
420
|
+
|
421
|
+
again:
|
422
|
+
ok = ReadFile(pi->pipe, lastBuf, 25, &dwRead, 0L);
|
423
|
+
if (!ok || dwRead == 0) {
|
424
|
+
CloseHandle(pi->pipe);
|
425
|
+
return 0;
|
426
|
+
}
|
427
|
+
lastBuf += dwRead;
|
428
|
+
goto again;
|
429
|
+
|
430
|
+
return 0; /* makes the compiler happy */
|
431
|
+
}
|
432
|
+
#endif
|
433
|
+
|
434
|
+
int
|
435
|
+
IsIn (const char *string, const char *substring)
|
436
|
+
{
|
437
|
+
return (strstr(string, substring) != NULL);
|
438
|
+
}
|
439
|
+
|
440
|
+
static double
|
441
|
+
ReadVersionFromHeader(const char *file, const char *macro)
|
442
|
+
{
|
443
|
+
double d = 0.0;
|
444
|
+
CHAR szBuffer[100];
|
445
|
+
LPSTR p;
|
446
|
+
DWORD cbBuffer = 100;
|
447
|
+
FILE *fp = fopen(file, "r");
|
448
|
+
if (fp != NULL) {
|
449
|
+
while (fgets(szBuffer, cbBuffer, fp) != NULL) {
|
450
|
+
if ((p = strstr(szBuffer, macro)) != NULL) {
|
451
|
+
while (*p && !isdigit(*p)) ++p;
|
452
|
+
d = strtod(p, NULL);
|
453
|
+
break;
|
454
|
+
}
|
455
|
+
}
|
456
|
+
fclose(fp);
|
457
|
+
}
|
458
|
+
return d;
|
459
|
+
}
|
460
|
+
|
461
|
+
int
|
462
|
+
GetVersionFromHeader(const char *tclh, const char *tkh)
|
463
|
+
{
|
464
|
+
double dTcl = 0.0, dTk = 0.0;
|
465
|
+
|
466
|
+
if (tclh != NULL)
|
467
|
+
dTcl = ReadVersionFromHeader(tclh, "TCL_VERSION");
|
468
|
+
if (tkh != NULL)
|
469
|
+
dTk = ReadVersionFromHeader(tkh, "TK_VERSION");
|
470
|
+
|
471
|
+
if (dTcl > 0 || dTk > 0) {
|
472
|
+
FILE *ofp = fopen("version.vc", "w");
|
473
|
+
if (dTcl > 0)
|
474
|
+
fprintf(ofp, "TCL_DOTVERSION\t= %0.1f\nTCL_VERSION\t= %u\n",
|
475
|
+
dTcl, (int)(dTcl * 10.0));
|
476
|
+
if (dTk > 0)
|
477
|
+
fprintf(ofp, "TK_DOTVERSION\t= %0.1f\nTK_VERSION\t= %u\n",
|
478
|
+
dTk, (int)(dTk * 10.0));
|
479
|
+
fclose(ofp);
|
480
|
+
return 0;
|
481
|
+
}
|
482
|
+
return 1;
|
483
|
+
}
|