HandleRegistry.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 17 Jun 2015 06:22:00 +0100
branchjv
changeset 18487 8735bd9eee2f
parent 17911 a99f15c5efa5
child 20079 8d884971c2ed
permissions -rw-r--r--
Use inlined FNV1a hash for String ...and do not use __symbolHash(). Although currently the VM also uses FNV1a hash for Symbols, the __symbolHash() does not handle properly character with codepoint 0 (because '\0' is used as a string terminator). This causes problems with Unicode16/32Strigs whose version of FNV1a hash is using object size from header to determine string's end. Added Symbol>>hash that actually *uses* the __symbolHash() to make sure it's hash is the the same as used bu the VM. Symbols with zeroes are rare and there's no Unicode16/32Symbol. This commit fixes issue #65.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
375
claus
parents:
diff changeset
     1
"
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents:
diff changeset
     3
	      All Rights Reserved
claus
parents:
diff changeset
     4
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    10
 hereby transferred.
claus
parents:
diff changeset
    11
"
6442
541e6035e979 Nobody implements #changed:with:from:
Stefan Vogel <sv@exept.de>
parents: 1961
diff changeset
    12
"{ Package: 'stx:libbasic' }"
541e6035e979 Nobody implements #changed:with:from:
Stefan Vogel <sv@exept.de>
parents: 1961
diff changeset
    13
375
claus
parents:
diff changeset
    14
Registry subclass:#HandleRegistry
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    15
	instanceVariableNames:''
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    16
	classVariableNames:''
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    17
	poolDictionaries:''
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    18
	category:'System-Support'
375
claus
parents:
diff changeset
    19
!
claus
parents:
diff changeset
    20
claus
parents:
diff changeset
    21
!HandleRegistry class methodsFor:'documentation'!
claus
parents:
diff changeset
    22
claus
parents:
diff changeset
    23
copyright
claus
parents:
diff changeset
    24
"
claus
parents:
diff changeset
    25
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents:
diff changeset
    26
	      All Rights Reserved
claus
parents:
diff changeset
    27
claus
parents:
diff changeset
    28
 This software is furnished under a license and may be used
claus
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    33
 hereby transferred.
claus
parents:
diff changeset
    34
"
claus
parents:
diff changeset
    35
!
claus
parents:
diff changeset
    36
claus
parents:
diff changeset
    37
documentation
claus
parents:
diff changeset
    38
"
claus
parents:
diff changeset
    39
    HandleRegistries are like Registries, in that they watch for the death of
claus
parents:
diff changeset
    40
    a registered object. However, they send a self-change notification, passing the registered
claus
parents:
diff changeset
    41
    handle as argument, instead of creating a shallow copy and letting it do the finalization.
claus
parents:
diff changeset
    42
    Use Registry for objects which know themself how to clean up;
claus
parents:
diff changeset
    43
    use HandleRegistry, if someone else does the cleanup.
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    44
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    45
    [author:]
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    46
        Claus Gittinger
375
claus
parents:
diff changeset
    47
"
claus
parents:
diff changeset
    48
! !
claus
parents:
diff changeset
    49
claus
parents:
diff changeset
    50
!HandleRegistry methodsFor:'dispose handling'!
claus
parents:
diff changeset
    51
claus
parents:
diff changeset
    52
informDispose:someHandle
1961
7fb6e9d2abea commentary
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
    53
    "an element was disposed; let my dependents know about this"
7fb6e9d2abea commentary
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
    54
6442
541e6035e979 Nobody implements #changed:with:from:
Stefan Vogel <sv@exept.de>
parents: 1961
diff changeset
    55
    self changed:#finalize with:someHandle
375
claus
parents:
diff changeset
    56
! !
claus
parents:
diff changeset
    57
claus
parents:
diff changeset
    58
!HandleRegistry methodsFor:'redefined to block'!
claus
parents:
diff changeset
    59
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    60
register:anObject
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    61
    "not useful for HandleRegistry - use #register:as:"
375
claus
parents:
diff changeset
    62
claus
parents:
diff changeset
    63
    self shouldNotImplement
claus
parents:
diff changeset
    64
!
claus
parents:
diff changeset
    65
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    66
registerChange:anObject
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    67
    "not useful for HandleRegistry"
375
claus
parents:
diff changeset
    68
claus
parents:
diff changeset
    69
    self shouldNotImplement
claus
parents:
diff changeset
    70
! !
615
e9d0e782206d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    71
630
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
    72
!HandleRegistry class methodsFor:'documentation'!
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
    73
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 615
diff changeset
    74
version
17892
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
    75
    ^ '$Header: /cvs/stx/stx/libbasic/HandleRegistry.st,v 1.9 2002/03/04 19:15:09 stefan Exp $'
17865
598963c6ff8e Recommited from itself
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17846
diff changeset
    76
!
598963c6ff8e Recommited from itself
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17846
diff changeset
    77
598963c6ff8e Recommited from itself
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17846
diff changeset
    78
version_SVN
17911
a99f15c5efa5 Updated with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17910
diff changeset
    79
    ^ '$Id: HandleRegistry.st 10761 2012-01-19 11:46:00Z vranyj1 $'
17846
24edc476ac18 Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17845
diff changeset
    80
! !
17892
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
    81
17910
8d796ca8bd1d Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17892
diff changeset
    82
17911
a99f15c5efa5 Updated with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17910
diff changeset
    83