home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / Languages / python / PyObjC-0.47-MIHS / pyobjc-0.47-src / Modules / OC_PythonInt.m < prev    next >
Encoding:
Text File  |  1996-10-04  |  1.0 KB  |  53 lines

  1. /* Copyright (c) 1996 by Lele Gaifax.  All Rights Reserved
  2.  *
  3.  * This software may be used and distributed freely for any purpose
  4.  * provided that this notice is included unchanged on any and all
  5.  * copies. The author does not warrant or guarantee this software in
  6.  * any way.
  7.  *
  8.  * This file is part of the PyObjC package.
  9.  *
  10.  * $RCSfile: OC_PythonInt.m,v $
  11.  * $Revision: 1.1.1.2 $
  12.  * $Date: 1996/10/04 20:59:02 $
  13.  *
  14.  * Created Thu Sep  5 20:29:52 1996.
  15.  */
  16.  
  17. #include "OC_PythonInt.h"
  18.  
  19. #define CLASS_VERSION 0
  20.  
  21. @implementation OC_PythonInt
  22.  
  23. + (void) initialize
  24. {
  25.   if (self == [OC_PythonInt class])
  26.     {
  27.       [OC_PythonInt setVersion:CLASS_VERSION];
  28.     }
  29. }
  30.  
  31. + (id <PythonObject>) fromLong:(long) i
  32. {
  33.   PyObject *pyint = PyInt_FromLong (i);
  34.   id <PythonObject> result = [self newWithObject:pyint];
  35.  
  36.   Py_DECREF(pyint);
  37.   return result;
  38. }
  39.  
  40. - (long) asLong
  41. {
  42.   return PyInt_AsLong ([self object]);
  43. }
  44.  
  45.  
  46. @end /* OC_PythonInt class implementation */
  47.  
  48. /*
  49. ** Local Variables:
  50. ** change-log-default-name:"../ChangeLog.PyObjC"
  51. ** End:
  52. */
  53.