home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / gnusmalltalk / memory.st < prev    next >
Text File  |  1992-02-15  |  3KB  |  142 lines

  1. "======================================================================
  2. |
  3. |   Memory definitions
  4. |
  5.  ======================================================================"
  6.  
  7.  
  8. "======================================================================
  9. |
  10. | Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
  11. | Written by Steve Byrne.
  12. |
  13. | This file is part of GNU Smalltalk.
  14. |
  15. | GNU Smalltalk is free software; you can redistribute it and/or modify it
  16. | under the terms of the GNU General Public License as published by the Free
  17. | Software Foundation; either version 1, or (at your option) any later version.
  18. | GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT
  19. | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  20. | FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  21. | details.
  22. | You should have received a copy of the GNU General Public License along with
  23. | GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
  24. | Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  
  25. |
  26.  ======================================================================"
  27.  
  28.  
  29. "
  30. |     Change Log
  31. | ============================================================================
  32. | Author       Date       Change 
  33. | sbb         16 Mar 91      Class creation now separate statement.
  34. |
  35. | sbyrne     29 May 89      created.
  36. |
  37. "
  38. Object variableWordSubclass: #Memory
  39.        instanceVariableNames: ''
  40.        classVariableNames: ''
  41.        poolDictionaries: ''
  42.        category: nil
  43. !
  44.  
  45. Memory comment:
  46. 'I provide access to actual machine addresses of OOPS and objects.  I
  47. have no instances; you send messages to my class to map between an object
  48. and the address of its OOP or object.'  !
  49.  
  50.  
  51. !Memory class methodsFor: 'accessing'!
  52.  
  53. "Note that the types could be given symbolic names and installed in a 
  54. class variable, or could be methods that return the proper values (such as
  55. the priorities for processes)."
  56.  
  57. charAt: anAddress
  58.     ^self type: 0 at: anAddress
  59. !
  60.  
  61. unsignedCharAt: anAddress
  62.     ^self type: 1 at: anAddress
  63. !
  64.  
  65. shortAt: anAddress
  66.     ^self type: 2 at: anAddress
  67. !
  68.  
  69. unsignedShortAt: anAddress
  70.     ^self type: 3 at: anAddress
  71. !
  72.  
  73. intAt: anAddress
  74.     ^self type: 4 at: anAddress
  75. !
  76.  
  77. unsignedIntAt: anAddress
  78.     ^self type: 5 at: anAddress
  79. !
  80.  
  81. floatAt: anAddress
  82.     ^self type: 6 at: anAddress
  83. !
  84.  
  85. doubleAt: anAddress
  86.     ^self type: 7 at: anAddress
  87. !
  88.  
  89. stringAt: anAddress
  90.     ^self type: 8 at: anAddress
  91. !
  92.  
  93. deref: anAddress
  94.     ^self intAt: anAddress
  95.  
  96.  
  97. "Storing methods"
  98.  
  99. charAt: anAddress put: aValue
  100.     ^self type: 0 at: anAddress put: aValue
  101. !
  102.  
  103. unsignedCharAt: anAddress put: aValue
  104.     ^self type: 1 at: anAddress put: aValue
  105. !
  106.  
  107. shortAt: anAddress put: aValue
  108.     ^self type: 2 at: anAddress put: aValue
  109. !
  110.  
  111. unsignedShortAt: anAddress put: aValue
  112.     ^self type: 3 at: anAddress put: aValue
  113. !
  114.  
  115. intAt: anAddress put: aValue
  116.     ^self type: 4 at: anAddress put: aValue
  117. !
  118.  
  119. unsignedIntAt: anAddress put: aValue
  120.     ^self type: 5 at: anAddress put: aValue
  121. !
  122.  
  123. floatAt: anAddress put: aValue
  124.     ^self type: 6 at: anAddress put: aValue
  125. !
  126.  
  127. doubleAt: anAddress put: aValue
  128.     ^self type: 7 at: anAddress put: aValue
  129. !
  130.  
  131. stringAt: anAddress put: aValue
  132.     ^self type: 8 at: anAddress put: aValue
  133. !!
  134.  
  135.  
  136. !Memory methodsFor: 'basic'!
  137.  
  138. !
  139.