home *** CD-ROM | disk | FTP | other *** search
/ CLIX - Fazer Clix Custa Nix / CLIX-CD.cdr / mac / lib / Mac / Memory.pm < prev    next >
Encoding:
Perl POD Document  |  1998-04-05  |  2.8 KB  |  152 lines  |  [TEXT/McPL]

  1. =head1 NAME
  2.  
  3. MacOS Memory Manager
  4.  
  5. Provide the MacPerl interface to the memory management routines in the MacOS.
  6.  
  7. Access to Inside Macintosh is essential for proper use of these functions.
  8. Explanations of terms, processes and procedures are provided there.
  9. Any attempt to use these functions without guidance can cause severe errors in 
  10. your machine, including corruption of data. B<You have been warned.>
  11.  
  12. =head1 SYNOPSIS
  13.  
  14. The Memory module defines Ptr and Handle classes, and function interfaces to the 
  15. memory management.
  16.  
  17.     use Mac::Memory;
  18.     $handle = new Handle;
  19.     $handle2 = NewHandle;
  20.  
  21. =head1 DESCRIPTION
  22.  
  23. The following packages and functions provide low level access to the memory
  24. management functions.
  25.  
  26. =cut
  27.  
  28. use strict;
  29.  
  30. package Mac::Memory;
  31.  
  32. BEGIN {
  33.     use Exporter   ();
  34.     use DynaLoader ();
  35.     
  36.     use vars qw(@ISA @EXPORT);
  37.     
  38.     @ISA = qw(Exporter DynaLoader);
  39.     @EXPORT = qw(
  40.         GetApplLimit
  41.         TopMem
  42.         MemError
  43.         NewHandle
  44.         NewHandleSys
  45.         NewHandleClear
  46.         NewHandleSysClear
  47.         RecoverHandle
  48.         RecoverHandleSys
  49.         NewPtr
  50.         NewPtrSys
  51.         NewPtrClear
  52.         NewPtrSysClear
  53.         MaxBlock
  54.         MaxBlockSys
  55.         StackSpace
  56.         NewEmptyHandle
  57.         NewEmptyHandleSys
  58.         HLock
  59.         HUnlock
  60.         HPurge
  61.         HNoPurge
  62.         HLockHi
  63.         TempNewHandle
  64.         TempMaxMem
  65.         TempFreeMem
  66.         CompactMem
  67.         CompactMemSys
  68.         PurgeMem
  69.         PurgeMemSys
  70.         FreeMem
  71.         FreeMemSys
  72.         ReserveMem
  73.         ReserveMemSys
  74.         MaxMem
  75.         MaxMemSys
  76.         MoveHHi
  77.         DisposePtr
  78.         GetPtrSize
  79.         SetPtrSize
  80.         DisposeHandle
  81.         SetHandleSize
  82.         GetHandleSize
  83.         ReallocateHandle
  84.         EmptyHandle
  85.         MoreMasters
  86.         BlockMove
  87.         BlockMoveData
  88.         PurgeSpace
  89.         HGetState
  90.         HSetState
  91.         HandToHand
  92.         PtrToHand
  93.         PtrToXHand
  94.         HandAndHand
  95.         PtrAndHand
  96.     );
  97. }
  98.  
  99. =include Memory.xs
  100.  
  101. =cut
  102.  
  103. bootstrap Mac::Memory;
  104.  
  105. package Handle;
  106.  
  107. BEGIN {
  108.     use Fcntl;
  109.     use IO::Handle qw(_IONBF);
  110. }
  111.  
  112. sub open {
  113.     my($handle,$modestr) = @_;
  114.     my($mode,$fd,$fh);
  115.     
  116.     if ($modestr =~ s/\+//) {
  117.         $mode = O_RDWR;
  118.     } elsif ($modestr =~ /[aw>]/) {
  119.         $mode = O_WRONLY;
  120.     } else {
  121.         $mode = O_RDONLY;
  122.     }
  123.     
  124.     if ($modestr =~ />>|a/) {
  125.         $mode += O_APPEND;
  126.     }
  127.     
  128.     if ($fd = $handle->_open($mode)) {
  129.         $fh = new_from_fd IO::Handle(($fd+0), $modestr);
  130.         $fh->setvbuf(undef, _IONBF, 0);
  131.         return $fh;
  132.     } else {
  133.         return undef;
  134.     }
  135. }
  136.  
  137. =pod
  138.  
  139. The low level interface is not likely to be needed, except for the HLock() function.
  140.  
  141. =head1 Author
  142.  
  143. Matthias Ulrich Neeracher neeri@iis.ee.ethz.ch "Programs"
  144.  
  145. Bob Dalgleish <bob.dalgleish@sasknet.sk.ca> "Documentation"
  146.  
  147. =cut
  148.  
  149. 1;
  150.  
  151. __END__
  152.