Skip to content

Commit 7388737

Browse files
author
khomoutov
committed
tests/winpm.test: removed [package require winpm] since the library
is actually [load]ed by the Makefile. doc/winpm.man: misc fixes. misc/notes.txt: added PT's explanations regarding tcltest and makefile.vc. TODO: tasks updated.
1 parent 357e339 commit 7388737

File tree

4 files changed

+80
-17
lines changed

4 files changed

+80
-17
lines changed

TODO

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ HIGH:
66
wish/tclsh but fails with "Class already registered"
77
from within tcltest suite.
88

9-
* Check the format of [winpm info power] return value:
10-
it seems that some info (number of secs of batt life is
11-
different that of stated in the documentation).
9+
* Think of possible threading issues (since now we're
10+
using the process-global state.
11+
12+
* Bring MinGW version in sync.
13+
14+
* Write INSTALL and a short README files.
1215

1316
NORMAL:
1417

1518
* Implement %-expansion of bound scripts.
1619

20+
* Create simple release packaging facilities.
21+
1722
LOW:
1823

1924
* Substitute Tk binding handling with regular hashes

doc/winpm.man

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,19 @@ be abbreviated while such an abbreviation is not ambiguous.
138138

139139
[call [cmd winpm] [method info] [method lastmessage]]
140140
Returns a list of three integers corresponding to the [arg uMsg],
141-
[arg wParam] and [arg lParam] parameters of the last processed
142-
power management or session management event, in that order.
141+
[arg wParam] and [arg lParam] parameters, in that order, of the
142+
last processed power management or session management event.
143143
This command is most useful to be used by a script bound to an event
144144
when the author of such a script for some reason wants to get his/her
145145
hands on the raw message that script is processing.
146146
[nl]
147147
You must observe several things when using this facility:
148148
[list_begin bullet]
149149
[bullet]
150-
Only those Windows messages that are handled by this package
151-
are processed and can be inspected.
150+
Only the information from those Windows messages that can be
151+
processed using this library is recorded and can be inspected,
152+
i.e. not all messages that reach the monitoring window are noticed
153+
by it.
152154
[bullet]
153155
Only the last message processed is available for inspection,
154156
i.e. each message processed overwrites this data with its
@@ -240,16 +242,17 @@ be abbreviated while such an abbreviation is not ambiguous.
240242

241243
[enum]
242244
The percentage of full battery life remaining.
243-
This integer value can take values from 0 to 100,
245+
This integer parameter can take values from 0 to 100,
244246
or -1 when this information is unavailable.
245247

246248
[enum]
247-
The estimated number of seconds of the remaining battery life.
249+
The integer number of seconds of the estimated remaining
250+
battery life.
248251
If this value is -1, the information is unavailable.
249252

250253
[enum]
251-
The number of seconds of the full battery life (when at full
252-
charge) or -1 if it's unknown.
254+
The integer number of seconds of the full battery life (when
255+
at full capacity) or -1 if it's unknown.
253256
[list_end]
254257

255258
This form of the command is a wrapper around the
@@ -322,7 +325,8 @@ its work.)
322325

323326
[section EXAMPLES]
324327

325-
Binding to the WM_ENDSESSION event:
328+
Binding to the WM_ENDSESSION event
329+
and inspecting the session information:
326330
[example {
327331
winpm bind WM_ENDSESSION {
328332
lassign [winpm info session] final flags
@@ -353,11 +357,12 @@ Binding to a specific WM_POWERBROADCAST event classes:
353357
}
354358
}]
355359

356-
Binding to the WM_POWERBROADCAST event:
360+
Binding to the WM_POWERBROADCAST event
361+
and inspecting the last message parameters:
357362
[example {
358363
winpm bind WM_POWERBROADCAST {
359364
lassign [winpm info lastmessage] uMsg wParam lParam
360-
if {$lParam == 666} { # Some undocumented vendor event class
365+
if {$wParam == 666} { # Some undocumented vendor event class
361366
# Do special processing...
362367
} else {
363368
# Just bail out -- known event classes will trigger
@@ -366,7 +371,8 @@ Binding to the WM_POWERBROADCAST event:
366371
}
367372
}]
368373

369-
Watching the battery:
374+
Watching the battery
375+
using the introspection of the system's power status:
370376
[example {
371377
winpm bind PBT_APMPOWERSTATUSCHANGE {
372378
lassign [winpm info power] ac batt capa sec full

misc/notes.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,57 @@ PBT_APMPOWERSTATUSCHANGE:
7070

7171
%A -- AC status.
7272
%B -- Battery status.
73+
74+
75+
Pat Thoyts on tcltest and stuff (24-Oct-2007):
76+
77+
[02:34]<kostix> I thought all tests are being run in one interp by default
78+
[02:34]<patthoyts> no
79+
[02:35]<patthoyts> the default is that it launches a new process for each file and quite a lot of them create interps for various things
80+
[02:35]<kostix> hmm
81+
[02:36]<kostix> I have just one test file
82+
[02:36]<kostix> but this probably doesn't matter
83+
[02:36]<patthoyts> if you want a single process you add -singleproc 1
84+
[02:36]<patthoyts> I use that for debugging tcl from visual studio
85+
[02:37]<patthoyts> create a test that crashes, set the debug app to tcltest -singleproc 1 -file ... and go.
86+
[02:38]<kostix> and multiple interps are just "some instances" in that wery shell process, in the same thread, right?
87+
[02:39]<kostix> (unless I use Thread and stuff, of course)
88+
[02:39]<patthoyts> yes
89+
[02:39]<kostix> thanks
90+
[02:39]<kostix> ah
91+
[02:39]<kostix> two more questions
92+
[02:39]<kostix> 1) is it possible to link procs from MSVCRT statically?
93+
[02:40]<patthoyts> No
94+
[02:40]<patthoyts> why would you want to.
95+
[02:41]<patthoyts> If you needs a static c runtime you link to libc
96+
[02:41]<kostix> 2) when I run "nmake -f makefile.vc test" from where the library to test is taken? from the build place or from the usual places (auto_path)?
97+
[02:41]<patthoyts> -MD links to msvcrt, -MT is libc multithreaded, -ML is libc -non-multithread
98+
[02:41]<kostix> I have tried VC8 and it links the extension against msvcrt8.dll which is not ubiquituous yet
99+
[02:41]<patthoyts> Ah
100+
[02:42]<patthoyts> thats why you use msvc 6
101+
[02:42]<patthoyts> MS decided to make everyone ship msvcrt8 with their apps.
102+
[02:42]<kostix> Ati video drivers for example event bundle that dll and it's an option to be installed
103+
[02:42]<kostix> yeah
104+
[02:42]<patthoyts> That way your application uses the msvcrt that it was built with.
105+
[02:42]<patthoyts> crappy plan
106+
[02:43]<patthoyts> If you link in the manifest then it will find the system msvcrt8 -- but XP or older might not have that
107+
[02:43]<patthoyts> This is why activestate build with msvc6 for instance.
108+
[02:44]<kostix> actually it's not that I'm very fond of VC8 but when I got failing Trf when built with -Ox using VC6 I thought it's time to try more recent compiler
109+
[02:44]<patthoyts> You always must run nmake -f makefile.vc from the directory that makefile.vc lives in. It actually checks that itself.
110+
[02:45]<kostix> so does it use .\Release\whatever.dll or finds in in the Tcl library (installed) when running tests?
111+
[02:46]<kostix> this one I don't quite get yet
112+
[02:46]<kostix> and it might shed some light on my RegisterClassEx trouble
113+
[02:47]<patthoyts> I write the test section to load the library explicitly as built and then arrange to source the test files. The tile win/makefile.vc is a good example i think
114+
[02:48]<patthoyts> Sometimes you have to change directory to the test dir in the tcl script that launches the tests
115+
[02:48]<kostix> ah, you mean I should not do "package require mylib" but rather load blahblah\mylib.dll?
116+
[02:48]<patthoyts> tls needs that
117+
[02:48]<patthoyts> yeah
118+
[02:48]<kostix> ah, thanks
119+
[02:48]<patthoyts> load $(PRJLIB:\=/)
120+
[02:49]<patthoyts> or maybe tile's version is safer : load [file join [file normalize {$(OUT_DIR)}] $(PRJLIBNAME)] Tile
121+
[02:49]<patthoyts> Might work better if there is a space in the build path
122+
[02:51]<kostix> ideally it should also work with mingw builds
123+
[02:52]<patthoyts> err - look at the tile makefile.vc
124+
[02:52]<patthoyts> I do the load in a script _before_ we source the all.tcl from the tests folder
125+
[02:53]<kostix> hmm, ok
126+
[02:53]<patthoyts> configure/make fiddles with the environment instead to get tcl to look in the right place

tests/winpm.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
1616
namespace import ::tcltest::*
1717
}
1818

19-
package require winpm
20-
2119
# Basic syntax:
2220

2321
test winpm-syntax-1.1 {Calling w/o options results to an error} -body {

0 commit comments

Comments
 (0)