equal
deleted
inserted
replaced
34 " |
34 " |
35 ! |
35 ! |
36 |
36 |
37 documentation |
37 documentation |
38 " |
38 " |
39 mostly added for odbc |
39 mostly added for odbc, which uses instances of me as container in which values |
|
40 (pointers) are returned. The name is misleading: it should be ExternalPointer, |
|
41 because on machines where sizeof(long) !!= sizeof(void *), that makes a difference. |
|
42 However, over time, others started to use this class, and renaming it would break some code. |
40 " |
43 " |
41 ! ! |
44 ! ! |
42 |
45 |
43 !ExternalLong class methodsFor:'instance creation'! |
46 !ExternalLong class methodsFor:'instance creation'! |
44 |
47 |
56 |
59 |
57 DANGER ALERT: the memory is NOT automatically freed until it is either |
60 DANGER ALERT: the memory is NOT automatically freed until it is either |
58 MANUALLY freed (see #free) or the returned externalBytes object |
61 MANUALLY freed (see #free) or the returned externalBytes object |
59 is unprotected or the classes releaseAllMemory method is called." |
62 is unprotected or the classes releaseAllMemory method is called." |
60 |
63 |
61 ^ super new:4 |
64 ^ super new:(ExternalAddress pointerSize) |
62 |
65 |
63 " |
66 " |
64 ExternalLong new |
67 ExternalLong new |
65 " |
68 " |
66 |
69 |
76 as soon as the reference to the returned externalBytes object |
79 as soon as the reference to the returned externalBytes object |
77 is gone (by the next garbage collect). |
80 is gone (by the next garbage collect). |
78 If the memory has been passed to a C-function which |
81 If the memory has been passed to a C-function which |
79 remembers this pointer, bad things may happen ...." |
82 remembers this pointer, bad things may happen ...." |
80 |
83 |
81 ^ super unprotectedNew:4 |
84 ^ super unprotectedNew:(ExternalAddress pointerSize) |
82 |
85 |
83 " |
86 " |
84 ExternalLong new |
87 ExternalLong new |
85 " |
88 " |
86 |
89 |
150 bool ifTrue:[self byteAt:1 put:1]. |
153 bool ifTrue:[self byteAt:1 put:1]. |
151 self byteAt:1 put:0. |
154 self byteAt:1 put:0. |
152 ! |
155 ! |
153 |
156 |
154 value |
157 value |
155 ^ self doubleWordAt:1 |
158 ^ self pointerAt:1 |
156 |
159 |
157 " |
160 " |
158 ExternalLong new value:10 |
161 ExternalLong new value:10 |
159 " |
162 " |
160 |
163 |
174 ! ! |
177 ! ! |
175 |
178 |
176 !ExternalLong class methodsFor:'documentation'! |
179 !ExternalLong class methodsFor:'documentation'! |
177 |
180 |
178 version |
181 version |
179 ^ '$Header: /cvs/stx/stx/libbasic2/ExternalLong.st,v 1.10 2011-01-05 15:08:41 cg Exp $' |
182 ^ '$Header: /cvs/stx/stx/libbasic2/ExternalLong.st,v 1.11 2013-03-29 09:02:34 cg Exp $' |
180 ! |
183 ! |
181 |
184 |
182 version_CVS |
185 version_CVS |
183 ^ '$Header: /cvs/stx/stx/libbasic2/ExternalLong.st,v 1.10 2011-01-05 15:08:41 cg Exp $' |
186 ^ '$Header: /cvs/stx/stx/libbasic2/ExternalLong.st,v 1.11 2013-03-29 09:02:34 cg Exp $' |
184 ! ! |
187 ! ! |
|
188 |