1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
-
+
|
/*
* tclWinTest.c --
*
* Contains commands for platform specific tests on Windows.
*
* Copyright (c) 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclWinTest.c,v 1.8.2.1 2003/04/12 20:11:34 kennykb Exp $
* RCS: @(#) $Id: tclWinTest.c,v 1.8.2.2 2004/06/05 17:25:40 kennykb Exp $
*/
#define USE_COMPAT_CONST
#include "tclWinInt.h"
/*
* Forward declarations of procedures defined later in this file:
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
+
+
+
+
|
int objc,
Tcl_Obj *CONST objv[] ));
static int TestwinsleepCmd _ANSI_ARGS_(( ClientData dummy,
Tcl_Interp* interp,
int objc,
Tcl_Obj *CONST objv[] ));
static Tcl_ObjCmdProc TestExceptionCmd;
static int TestwincpuidCmd _ANSI_ARGS_(( ClientData dummy,
Tcl_Interp* interp,
int objc,
Tcl_Obj *CONST objv[] ));
/*
*----------------------------------------------------------------------
*
* TclplatformtestInit --
*
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
+
+
|
Tcl_CreateCommand(interp, "testeventloop", TesteventloopCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testvolumetype", TestvolumetypeCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testwinclock", TestwinclockCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "testwincpuid", TestwincpuidCmd,
(ClientData) 0, (Tcl_CmdDeleteProc*) NULL );
Tcl_CreateObjCommand( interp,
"testwinsleep",
TestwinsleepCmd,
(ClientData) 0,
(Tcl_CmdDeleteProc *) NULL );
Tcl_CreateObjCommand(interp, "testexcept", TestExceptionCmd, NULL, NULL);
return TCL_OK;
|
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
|
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TestwincpuidCmd --
*
* Retrieves CPU ID information.
*
* Usage:
* testwincpuid <eax>
*
* Parameters:
* eax - The value to pass in the EAX register to a CPUID instruction.
*
* Results:
* Returns a four-element list containing the values from the
* EAX, EBX, ECX and EDX registers returned from the CPUID instruction.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static int
TestwincpuidCmd( ClientData dummy,
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj *CONST * objv ) /* Parameter vector */
{
int status;
int index;
unsigned int regs[4];
Tcl_Obj * regsObjs[4];
int i;
if ( objc != 2 ) {
Tcl_WrongNumArgs( interp, 1, objv, "eax" );
return TCL_ERROR;
}
if ( Tcl_GetIntFromObj( interp, objv[1], &index ) != TCL_OK ) {
return TCL_ERROR;
}
status = TclWinCPUID( (unsigned int) index, regs );
if ( status != TCL_OK ) {
Tcl_SetObjResult( interp, Tcl_NewStringObj( "operation not available",
-1 ) );
return status;
}
for ( i = 0; i < 4; ++i ) {
regsObjs[i] = Tcl_NewIntObj( (int) regs[i] );
}
Tcl_SetObjResult( interp, Tcl_NewListObj( 4, regsObjs ) );
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* Testwinsleepcmd --
* TestwinsleepCmd --
*
* Causes this process to wait for the given number of milliseconds
* by means of a direct call to Sleep.
*
* Usage:
* testwinsleep <n>
*
|