author | Claus Gittinger <cg@exept.de> |
Fri, 17 Dec 1999 12:35:57 +0100 | |
changeset 5120 | 13143fbcbdf8 |
parent 4764 | 25777afc9f85 |
permissions | -rw-r--r-- |
4764 | 1 |
OSFileHandle subclass:#Win32Handle |
2 |
instanceVariableNames:'' |
|
3 |
classVariableNames:'' |
|
4 |
poolDictionaries:'' |
|
5 |
category:'OS-Windows' |
|
6 |
! |
|
7 |
||
8 |
!Win32Handle primitiveDefinitions! |
|
9 |
%{ |
|
10 |
||
11 |
/* |
|
12 |
* sigh - must undef those (from stc.h-definitions); |
|
13 |
* they are also defined in windows.h |
|
14 |
*/ |
|
15 |
# undef INT |
|
16 |
# undef Array |
|
17 |
# undef Number |
|
18 |
# undef Method |
|
19 |
# undef Point |
|
20 |
# undef Rectangle |
|
21 |
# undef Block |
|
22 |
# undef String |
|
23 |
# undef Message |
|
24 |
# undef Object |
|
25 |
# undef Context |
|
26 |
# undef Time |
|
27 |
# undef Date |
|
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
28 |
# undef Set |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
29 |
# undef Signal |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
30 |
# undef Delay |
4764 | 31 |
|
32 |
# include <windows.h> |
|
33 |
||
34 |
/* |
|
35 |
* sigh - must redef those as st/x defs; |
|
36 |
*/ |
|
37 |
# ifdef __DEF_Array |
|
38 |
# define Array __DEF_Array |
|
39 |
# endif |
|
40 |
# ifdef __DEF_Number |
|
41 |
# define Number __DEF_Number |
|
42 |
# endif |
|
43 |
# ifdef __DEF_Method |
|
44 |
# define Method __DEF_Method |
|
45 |
# endif |
|
46 |
# ifdef __DEF_Point |
|
47 |
# define Point __DEF_Point |
|
48 |
# endif |
|
49 |
# ifdef __DEF_Block |
|
50 |
# define Block __DEF_Block |
|
51 |
# endif |
|
52 |
# ifdef __DEF_String |
|
53 |
# define String __DEF_String |
|
54 |
# endif |
|
55 |
# ifdef __DEF_Message |
|
56 |
# define Message __DEF_Message |
|
57 |
# endif |
|
58 |
# ifdef __DEF_Object |
|
59 |
# define Object __DEF_Object |
|
60 |
# endif |
|
61 |
# ifdef __DEF_Context |
|
62 |
# define Context __DEF_Context |
|
63 |
# endif |
|
64 |
# ifdef __DEF_Date |
|
65 |
# define Date __DEF_Date |
|
66 |
# endif |
|
67 |
# ifdef __DEF_Time |
|
68 |
# define Time __DEF_Time |
|
69 |
# endif |
|
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
70 |
# ifdef __DEF_Set |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
71 |
# define Set __DEF_Set |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
72 |
# endif |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
73 |
# ifdef __DEF_Signal |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
74 |
# define Signal __DEF_Signal |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
75 |
# endif |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
76 |
# ifdef __DEF_Delay |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
77 |
# define Delay __DEF_Delay |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
78 |
# endif |
4764 | 79 |
|
80 |
# define INT int |
|
81 |
%} |
|
82 |
||
83 |
! ! |
|
84 |
||
85 |
||
86 |
!Win32Handle methodsFor:'finalization'! |
|
87 |
||
88 |
disposed |
|
89 |
"a file handle was garbage collected - close the underlying file" |
|
90 |
||
91 |
%{ |
|
92 |
HANDLE h = (HANDLE)(__externalAddressVal(self)); |
|
93 |
||
94 |
if (h) { |
|
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
95 |
__externalAddressVal(self) = (HANDLE)0; |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
96 |
CloseHandle(h); |
4764 | 97 |
} |
98 |
%} |
|
99 |
||
100 |
||
101 |
! ! |
|
102 |
||
103 |
!Win32Handle methodsFor:'release'! |
|
104 |
||
105 |
close |
|
106 |
"close the handle" |
|
107 |
||
108 |
%{ |
|
109 |
HANDLE h = (HANDLE)(__externalAddressVal(self)); |
|
110 |
||
111 |
if (h) { |
|
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
112 |
__externalAddressVal(self) = (HANDLE)0; |
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
113 |
CloseHandle(h); |
4764 | 114 |
} |
115 |
%}. |
|
116 |
Lobby unregister:self |
|
117 |
||
118 |
||
119 |
! ! |
|
120 |
||
121 |
!Win32Handle class methodsFor:'documentation'! |
|
122 |
||
123 |
version |
|
5120
13143fbcbdf8
introduced __threadErrno (for native threads)
Claus Gittinger <cg@exept.de>
parents:
4764
diff
changeset
|
124 |
^ '$Header: /cvs/stx/stx/libbasic/Win32Handle.st,v 1.2 1999-12-17 11:35:56 cg Exp $' |
4764 | 125 |
! ! |