[PD-cvs] externals/grill/flext/source flsupport.cpp,1.28,1.29

xovo at projects.sourceforge.net xovo at projects.sourceforge.net
Sat Jan 31 04:31:18 CET 2004


Update of /cvsroot/pure-data/externals/grill/flext/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27465/source

Modified Files:
	flsupport.cpp 
Log Message:
 ""

Index: flsupport.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsupport.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** flsupport.cpp	29 Jan 2004 03:32:03 -0000	1.28
--- flsupport.cpp	31 Jan 2004 03:31:16 -0000	1.29
***************
*** 17,20 ****
--- 17,21 ----
  #include <stdio.h>
  #include <stdarg.h>
+ #include <new>
  
  const t_symbol *flext::sym_float = NULL;
***************
*** 116,125 ****
  
  
! #if defined(FLEXT_THREADED) && defined(FLEXT_PDLOCK)
  #define SYSLOCK() sys_lock()
  #define SYSUNLOCK() sys_unlock()
  #else
! #define SYSLOCK(on) (void)0
! #define SYSUNLOCK(on) (void)0
  #endif
  
--- 117,127 ----
  
  
! #if FLEXT_SYS == FLEXT_SYS_PD && defined(FLEXT_THREADED) && defined(FLEXT_PDLOCK)
! #error
  #define SYSLOCK() sys_lock()
  #define SYSUNLOCK() sys_unlock()
  #else
! #define SYSLOCK() (void)0
! #define SYSUNLOCK() (void)0
  #endif
  
***************
*** 137,149 ****
  
      char *blk;
- #ifdef FLEXT_NOGLOBALNEW
      if(bytes >= LARGEALLOC) {
          // use C library function for large memory blocks
!         blk = (char *)::operator new(bytes);
!     }
!     else 
  #endif
!     {
! 	//! \todo We need system locking here for secondary threads!
  
  #if FLEXT_SYS == FLEXT_SYS_JMAX
--- 139,153 ----
  
      char *blk;
      if(bytes >= LARGEALLOC) {
+ #if FLEXT_SYS == FLEXT_SYS_MAX
+         blk = (char *)::sysmem_newptr(bytes);
+ #else
          // use C library function for large memory blocks
!         blk = (char *)::malloc(bytes);
  #endif
!     }
!     else {
! 	//! We need system locking here for secondary threads!
!         SYSLOCK();
  
  #if FLEXT_SYS == FLEXT_SYS_JMAX
***************
*** 152,155 ****
--- 156,160 ----
  	    blk = (char *)::getbytes(bytes);
  #endif
+         SYSUNLOCK();
      }
  
***************
*** 163,181 ****
  	size_t bytes = *(size_t *)ori;
  
- #ifdef FLEXT_NOGLOBALNEW
      if(bytes >= LARGEALLOC) {
          // use C library function for large memory blocks
!         ::operator delete(ori);
!     }
!     else 
  #endif
!     {
! 	//! \todo We need system locking here for secondary threads!
  
  #if FLEXT_SYS == FLEXT_SYS_JMAX
!     	fts_free(ori);
  #else
  	    ::freebytes(ori,bytes);
  #endif
      }
  }
--- 168,189 ----
  	size_t bytes = *(size_t *)ori;
  
      if(bytes >= LARGEALLOC) {
+ #if FLEXT_SYS == FLEXT_SYS_MAX
+         ::sysmem_freeptr(ori);
+ #else
          // use C library function for large memory blocks
!         ::free(ori);
  #endif
!     }
!     else {
! 	//! We need system locking here for secondary threads!
!         SYSLOCK();
  
  #if FLEXT_SYS == FLEXT_SYS_JMAX
!         ::fts_free(ori);
  #else
  	    ::freebytes(ori,bytes);
  #endif
+         SYSUNLOCK();
      }
  }
***************
*** 188,200 ****
  
      char *blk;
- #ifdef FLEXT_NOGLOBALNEW
      if(bytes >= LARGEALLOC) {
          // use C library function for large memory blocks
!         blk = (char *)::operator new(bytes);
!     }
!     else 
  #endif
!     {
! 	//! \todo We need system locking here for secondary threads!
  
  #if FLEXT_SYS == FLEXT_SYS_JMAX
--- 196,210 ----
  
      char *blk;
      if(bytes >= LARGEALLOC) {
+ #if FLEXT_SYS == FLEXT_SYS_MAX
+         blk = (char *)::sysmem_newptr(bytes);
+ #else
          // use C library function for large memory blocks
!         blk = (char *)::malloc(bytes);
  #endif
!     }
!     else {
! 	//! We need system locking here for secondary threads!
!         SYSLOCK();
  
  #if FLEXT_SYS == FLEXT_SYS_JMAX
***************
*** 203,206 ****
--- 213,217 ----
  	    blk = (char *)::getbytes(bytes);
  #endif
+         SYSUNLOCK();
      }
  
***************
*** 216,234 ****
  	size_t bytes = *(size_t *)((char *)blk-sizeof(size_t));
  
- #ifdef FLEXT_NOGLOBALNEW
      if(bytes >= LARGEALLOC) {
          // use C library function for large memory blocks
!         ::operator delete(ori);
!     }
!     else 
  #endif
!     {
! 	//! \todo We need system locking here for secondary threads!
  
  #if FLEXT_SYS == FLEXT_SYS_JMAX
!     	fts_free(ori);
  #else
  	    ::freebytes(ori,bytes);
  #endif
      }
  }
--- 227,248 ----
  	size_t bytes = *(size_t *)((char *)blk-sizeof(size_t));
  
      if(bytes >= LARGEALLOC) {
+ #if FLEXT_SYS == FLEXT_SYS_MAX
+         ::sysmem_freeptr(ori);
+ #else
          // use C library function for large memory blocks
!         ::free(ori);
  #endif
!     }
!     else {
! 	//! We need system locking here for secondary threads!
!         SYSLOCK();
  
  #if FLEXT_SYS == FLEXT_SYS_JMAX
!         ::fts_free(ori);
  #else
  	    ::freebytes(ori,bytes);
  #endif
+         SYSUNLOCK();
      }
  }





More information about the Pd-cvs mailing list