Debian Codegraph @

generic/bltWinUtil.c

raw symbols SCIP
1 /*
2 * bltWinUtil.c --
3 *
4 * This module contains WIN32 routines not included in the Tcl/Tk
5 * libraries.
6 *
7 * Copyright 1998 by Bell Labs Innovations for Lucent Technologies.
8 *
9 * Permission to use, copy, modify, and distribute this software and its
10 * documentation for any purpose and without fee is hereby granted, provided
11 * that the above copyright notice appear in all copies and that both that the
12 * copyright notice and warranty disclaimer appear in supporting documentation,
13 * and that the names of Lucent Technologies any of their entities not be used
14 * in advertising or publicity pertaining to distribution of the software
15 * without specific, written prior permission.
16 *
17 * Lucent Technologies disclaims all warranties with regard to this software,
18 * including all implied warranties of merchantability and fitness. In no event
19 * shall Lucent Technologies be liable for any special, indirect or
20 * consequential damages or any damages whatsoever resulting from loss of use,
21 * data or profits, whether in an action of contract, negligence or other
22 * tortuous action, arising out of or in connection with the use or performance
23 * of this software.
24 *
25 */
26
27 #include <bltInt.h>
28
29 double
30 drand48(void)
31 {
32 return (double) rand() / (double)RAND_MAX;
33 }
34
35 void
36 srand48(long int seed)
37 {
38 srand(seed);
39 }
40
41 int
42 Blt_GetPlatformId(void)
43 {
44 static int platformId = 0;
45
46 if (platformId == 0) {
47 OSVERSIONINFO opsysInfo;
48
49 opsysInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
50 if (GetVersionEx(&opsysInfo)) {
51 platformId = opsysInfo.dwPlatformId;
52 }
53 }
54 return platformId;
55 }
56
57 char *
58 Blt_LastError(void)
59 {
60 static char buffer[1024];
61 int length;
62
63 FormatMessage(
64 FORMAT_MESSAGE_FROM_SYSTEM,
65 NULL,
66 GetLastError(),
67 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
68 buffer,
69 1024,
70 NULL);
71 length = strlen(buffer);
72 if (buffer[length - 2] == '\r') {
73 buffer[length - 2] = '\0';
74 }
75 return buffer;
76 }
77