[Python-checkins] python/dist/src/Mac/Contrib/osam OSAm.c,1.1.1.1,1.2 OSAm.prj,1.3,1.4 ScriptRunner.c,1.2,1.3

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Wed, 08 Jan 2003 08:28:10 -0800


Update of /cvsroot/python/python/dist/src/Mac/Contrib/osam
In directory sc8-pr-cvs1:/tmp/cvs-serv27782/Mac/Contrib/osam

Modified Files:
	OSAm.c OSAm.prj ScriptRunner.c 
Log Message:
Merging the various tweaks for MacPython-OS9 2.3a1 back into the trunk.


Index: OSAm.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Contrib/osam/OSAm.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** OSAm.c	18 Aug 1998 14:56:35 -0000	1.1.1.1
--- OSAm.c	8 Jan 2003 16:27:38 -0000	1.2
***************
*** 50,64 ****
        DescType typeCode;
        long dataSize = 0;
  
!       HLock (temp.dataHandle);
! 
!       dataSize = GetHandleSize (temp.dataHandle);
  
        if (dataSize > 0)
  	{
! 	  PyObject *result = PyString_FromStringAndSize ((*temp.dataHandle), 
  							 dataSize);
! 
! 	  AEDisposeDesc (&temp);
  
  	  if (!result)
--- 50,62 ----
        DescType typeCode;
        long dataSize = 0;
+       OSErr err;
  
!       dataSize = AEGetDescDataSize (&temp);
  
        if (dataSize > 0)
  	{
! 	  PyObject *result = PyString_FromStringAndSize (NULL, 
  							 dataSize);
! 	
  
  	  if (!result)
***************
*** 66,72 ****
--- 64,77 ----
  	      printf ("OSAm.error Out of memory.\n");
  	      Py_INCREF (Py_None);
+ 		  AEDisposeDesc (&temp);
  	      return Py_None;
  	    }
+ 	  if ( (err=AEGetDescData(&temp, PyString_AS_STRING(result), dataSize)) < 0 )
+ 	    {
+ 			AEDisposeDesc(&temp);
+ 			return PyMac_Error(err);
+ 		}	
  
+ 	  AEDisposeDesc(&temp);
  	  return result;
  	}
***************
*** 111,125 ****
        DescType typeCode;
        long dataSize = 0;
  
!       HLock (temp.dataHandle);
! 
!       dataSize = GetHandleSize (temp.dataHandle);
  
        if (dataSize > 0)
  	{
! 	  PyObject *result = PyString_FromStringAndSize ((*temp.dataHandle), 
  							 dataSize);
! 
! 	  AEDisposeDesc (&temp);
  
  	  if (!result)
--- 116,128 ----
        DescType typeCode;
        long dataSize = 0;
+       OSErr err;
  
!       dataSize = AEGetDescDataSize (&temp);
  
        if (dataSize > 0)
  	{
! 	  PyObject *result = PyString_FromStringAndSize (NULL, 
  							 dataSize);
! 	
  
  	  if (!result)
***************
*** 127,136 ****
  	      printf ("OSAm.error Out of memory.\n");
  	      Py_INCREF (Py_None);
  	      return Py_None;
  	    }
  
  	  return result;
  	}
- 
      }
  
--- 130,145 ----
  	      printf ("OSAm.error Out of memory.\n");
  	      Py_INCREF (Py_None);
+ 		  AEDisposeDesc (&temp);
  	      return Py_None;
  	    }
+ 	  if ( (err=AEGetDescData(&temp, PyString_AS_STRING(result), dataSize)) < 0 )
+ 	    {
+ 			AEDisposeDesc(&temp);
+ 			return PyMac_Error(err);
+ 		}	
  
+ 	  AEDisposeDesc(&temp);
  	  return result;
  	}
      }
  
***************
*** 171,185 ****
        DescType typeCode;
        long dataSize = 0;
  
!       HLock (temp.dataHandle);
! 
!       dataSize = GetHandleSize (temp.dataHandle);
  
        if (dataSize > 0)
  	{
! 	  PyObject *result = PyString_FromStringAndSize ((*temp.dataHandle), 
  							 dataSize);
! 
! 	  AEDisposeDesc (&temp);
  
  	  if (!result)
--- 180,192 ----
        DescType typeCode;
        long dataSize = 0;
+       OSErr err;
  
!       dataSize = AEGetDescDataSize (&temp);
  
        if (dataSize > 0)
  	{
! 	  PyObject *result = PyString_FromStringAndSize (NULL, 
  							 dataSize);
! 	
  
  	  if (!result)
***************
*** 187,193 ****
--- 194,207 ----
  	      printf ("OSAm.error Out of memory.\n");
  	      Py_INCREF (Py_None);
+ 		  AEDisposeDesc (&temp);
  	      return Py_None;
  	    }
+ 	  if ( (err=AEGetDescData(&temp, PyString_AS_STRING(result), dataSize)) < 0 )
+ 	    {
+ 			AEDisposeDesc(&temp);
+ 			return PyMac_Error(err);
+ 		}	
  
+ 	  AEDisposeDesc(&temp);
  	  return result;
  	}
***************
*** 217,221 ****
     METH_VARARGS,
     OSAm_DoCommand__doc__},
! 
    {"CompileAndSave", 
     (PyCFunction) OSAm_CompileAndSave,
--- 231,235 ----
     METH_VARARGS,
     OSAm_DoCommand__doc__},
! #if 0
    {"CompileAndSave", 
     (PyCFunction) OSAm_CompileAndSave,
***************
*** 227,230 ****
--- 241,245 ----
     METH_VARARGS,
     OSAm_DoCommand__doc__},
+ #endif
  
    {NULL, (PyCFunction) NULL, 0, NULL}

Index: OSAm.prj
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Contrib/osam/OSAm.prj,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
Binary files /tmp/cvsCnQwhG and /tmp/cvsAtwl8d differ

Index: ScriptRunner.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Contrib/osam/ScriptRunner.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ScriptRunner.c	3 Aug 2001 13:31:34 -0000	1.2
--- ScriptRunner.c	8 Jan 2003 16:27:38 -0000	1.3
***************
*** 45,49 ****
  OSAError LoadScriptingComponent (ComponentInstance * scriptingComponent);
  
! 
  /*
   * store the script as a compile script so that OSA 
--- 45,49 ----
  OSAError LoadScriptingComponent (ComponentInstance * scriptingComponent);
  
! #if 0
  /*
   * store the script as a compile script so that OSA 
***************
*** 144,147 ****
--- 144,148 ----
    return err2;
  }
+ #endif
  
  
***************
*** 195,199 ****
  }
  
! 
  /*
   * This routine reads in a saved script file and executes 
--- 196,200 ----
  }
  
! #if 0
  /*
   * This routine reads in a saved script file and executes 
***************
*** 292,295 ****
--- 293,297 ----
    return err2;
  }
+ #endif