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

  1. "======================================================================
  2. |
  3. |   SystemDictionary Method 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         22 Jan 91      Added putenv.
  34. |
  35. | sbyrne      8 Jul 89      Created.
  36. |
  37. "
  38.  
  39. Object variableSubclass: #CFunctionDescriptor
  40.        instanceVariableNames: 'cFunction cFunctionName returnType numFixedArgs'
  41.        classVariableNames: ''
  42.        poolDictionaries: ''
  43.        category: nil
  44. !
  45.  
  46. CFunctionDescriptor comment: 
  47. 'I am not part of the Smalltalk definition.  My instances contain information
  48. about C functions that can be called from within Smalltalk, such as number
  49. and type of parameters.  This information is used by the C callout mechanism
  50. to perform the actual call-out to C routines.' !
  51.  
  52.  
  53. "A couple of simple, but useful callout functions, as examples."
  54.  
  55. Behavior defineCFunc: 'system'
  56.          withSelectorArgs: 'system: aString'
  57.      forClass: SystemDictionary
  58.      returning: #int
  59.      args: #(string)!
  60.  
  61. Behavior defineCFunc: 'getenv'
  62.          withSelectorArgs: 'getenv: aString'
  63.      forClass: SystemDictionary
  64.      returning: #string
  65.      args: #(string)!
  66.  
  67. Behavior defineCFunc: 'putenv'
  68.          withSelectorArgs: 'putenv: aString'
  69.      forClass: SystemDictionary
  70.      returning: #int
  71.      args: #(string)!
  72.  
  73.