equal
deleted
inserted
replaced
1 " |
1 " |
2 COPYRIGHT (c) 2003 by eXept Software AG |
2 COPYRIGHT (c) 2003 by eXept Software AG |
3 All Rights Reserved |
3 All Rights Reserved |
4 |
4 |
5 This software is furnished under a license and may be used |
5 This software is furnished under a license and may be used |
6 only in accordance with the terms of that license and with the |
6 only in accordance with the terms of that license and with the |
7 inclusion of the above copyright notice. This software may not |
7 inclusion of the above copyright notice. This software may not |
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
22 !MappedExternalBytes class methodsFor:'documentation'! |
22 !MappedExternalBytes class methodsFor:'documentation'! |
23 |
23 |
24 copyright |
24 copyright |
25 " |
25 " |
26 COPYRIGHT (c) 2003 by eXept Software AG |
26 COPYRIGHT (c) 2003 by eXept Software AG |
27 All Rights Reserved |
27 All Rights Reserved |
28 |
28 |
29 This software is furnished under a license and may be used |
29 This software is furnished under a license and may be used |
30 only in accordance with the terms of that license and with the |
30 only in accordance with the terms of that license and with the |
31 inclusion of the above copyright notice. This software may not |
31 inclusion of the above copyright notice. This software may not |
32 be provided or otherwise made available to, or used by, any |
32 be provided or otherwise made available to, or used by, any |
37 |
37 |
38 documentation |
38 documentation |
39 " |
39 " |
40 Much like externalBytes - however, instances of MappedExternalBytes are created |
40 Much like externalBytes - however, instances of MappedExternalBytes are created |
41 by mapping virtual memory (i.e. mmap). |
41 by mapping virtual memory (i.e. mmap). |
42 For now, this class provides only the minimum required protocol to support |
42 For now, this class provides only the minimum required protocol to support |
43 the VideoForLinux API for video grabbing. |
43 the VideoForLinux API for video grabbing. |
44 (actually, all that is found here is a redefined finalization method, as my instances |
44 (actually, all that is found here is a redefined finalization method, as my instances |
45 must be freed by unmapping the underlying memory, as opposed to instances of my superclass, |
45 must be freed by unmapping the underlying memory, as opposed to instances of my superclass, |
46 which must be freed w.r.t. malloc). |
46 which must be freed w.r.t. malloc). |
47 |
47 |
48 More will (might be required) be added in the future. |
48 More will (might be required) be added in the future. |
49 |
49 |
50 [authors:] |
50 [authors:] |
51 Claus Gittinger |
51 Claus Gittinger |
52 " |
52 " |
53 ! ! |
53 ! ! |
54 |
54 |
55 !MappedExternalBytes methodsFor:'freeing'! |
55 !MappedExternalBytes methodsFor:'freeing'! |
56 |
56 |
63 |
63 |
64 char *_mem = (char *)(__INST(address_)); |
64 char *_mem = (char *)(__INST(address_)); |
65 OBJ sz = __INST(size); |
65 OBJ sz = __INST(size); |
66 |
66 |
67 # ifdef SUPERDEBUG |
67 # ifdef SUPERDEBUG |
68 fprintf(stderr, "finalize\n"); |
68 console_fprintf(stderr, "MappedExternalBytes finalize\n"); |
69 # endif |
69 # endif |
70 if (__isSmallInteger(sz)) { |
70 if (__isSmallInteger(sz)) { |
71 if (_mem && (OBJ)_mem != nil) { |
71 if (_mem && (OBJ)_mem != nil) { |
72 # ifdef SUPERDEBUG |
72 # ifdef SUPERDEBUG |
73 fprintf(stderr, "munmap (%x, %d)\n", _mem, __intVal(sz)); |
73 console_fprintf(stderr, "MappedExternalBytes munmap (%x, %d)\n", _mem, __intVal(sz)); |
74 # endif |
74 # endif |
75 munmap (_mem, __intVal(sz)); |
75 munmap (_mem, __intVal(sz)); |
76 } |
76 } |
77 __INST(address_) = __INST(size) = nil; |
77 __INST(address_) = __INST(size) = nil; |
78 } |
78 } |
79 #endif /* HAS_MMAP */ |
79 #endif /* HAS_MMAP */ |
80 %} |
80 %} |
81 ! ! |
81 ! ! |
82 |
82 |
83 !MappedExternalBytes class methodsFor:'documentation'! |
83 !MappedExternalBytes class methodsFor:'documentation'! |
84 |
84 |
85 version |
85 version |
86 ^ '$Header: /cvs/stx/stx/libbasic/MappedExternalBytes.st,v 1.2 2003-04-11 00:22:42 cg Exp $' |
86 ^ '$Header: /cvs/stx/stx/libbasic/MappedExternalBytes.st,v 1.3 2007-02-22 15:27:19 cg Exp $' |
87 ! ! |
87 ! ! |