Index: /trunk/doc/pslib/psLibSDRS.tex
===================================================================
--- /trunk/doc/pslib/psLibSDRS.tex	(revision 345)
+++ /trunk/doc/pslib/psLibSDRS.tex	(revision 346)
@@ -1,10 +1,9 @@
-%%% $Id: psLibSDRS.tex,v 1.18 2004-04-01 03:45:02 price Exp $
+%%% $Id: psLibSDRS.tex,v 1.19 2004-04-01 04:11:34 eugene Exp $
 \documentclass[panstarrs]{panstarrs}
 
 % basic document variables
-\title{Pan-STARRS IPP Library\\
-Supplementary Design Requirements}
+\title{Pan-STARRS IPP Library SDR} % Supplementary Design Requirements
 \author{Paul Price, Eugene Magnier, Robert Lupton}
-\shorttitle{PSLib Design}
+\shorttitle{PSLib SDR}
 \group{Pan-STARRS Algorithm Group}
 \project{Pan-STARRS Image Processing Pipeline}
@@ -15,4 +14,6 @@
 % the complete PSDC document number is given by
 % \thedocnumber-\theversion
+
+\setlength{\topsep}{-2pt}
 
 \begin{document}
@@ -33,16 +34,9 @@
 
 \DocumentsInternal
-PSCD-430-xxx  &   PS-1 Design Reference Mission \\
-\hline
-PSCD-430-004  &   Pan-STARRS IPP C Code Conventions \\
-\hline
-PSCD-430-005  &   Pan-STARRS IPP SRS \\
-\hline
-PSCD-430-006  &   Pan-STARRS IPP ADD \\
-\hline
-PSCD-430-007  &   Pan-STARRS IPP PSLib SDR \\
-\hline
-PSCD-430-008  &   Pan-STARRS IPP Architecture SDR \\
-
+PSCD-430-xxx  &   PS-1 Design Reference Mission \\ \hline
+PSCD-430-004  &   Pan-STARRS IPP C Code Conventions \\ \hline
+PSCD-430-005  &   Pan-STARRS IPP SRS \\ \hline
+PSCD-430-006  &   Pan-STARRS IPP ADD \\ \hline
+PSCD-430-008  &   Pan-STARRS IPP Architecture SDR \\ 
 \DocumentsExternal
 Posix Standard & Open Group Based Specifications Issue 6, IEEE Std 1003.1, 2003 \\
@@ -173,9 +167,10 @@
 memory segments.  The segment preceeding the user-memory contains data
 describing the allocated block, using the \code{psMemBlock} structure.
-The final element of this structure is a \code{void} pointer called
-\code{magic} and is assigned a special value, \code{PS_MEM_MAGIC}.
-The segment following the user-memory block consists of a single
-\code{void} pointer, and is also assigned the special value of
-\code{PS_MEM_MAGIC}.
+The first and last elements of this structure \code{void} pointers
+called \code{startblock} and \code{endblock}, which are assigned a
+special value, \code{PS_MEM_MAGIC}.  The segment following the
+user-memory block consists of a single \code{void} pointer, and is
+also assigned the special value of \code{PS_MEM_MAGIC}.  This address
+is pointed to by the structure elements \code{endpost}.
 
 In practice, these bounding memory blocks mean that when a user is
@@ -193,9 +188,9 @@
 \code{sizeof(psMemBlock)} from the pointer address.
 
-The purpose of the two boundary markers is to catch corruption and to
-act as an aid in low-level debugging.  In the first case, memory over-
-and under-run errors are likely to overwrite the special values in
-either the leading or trailing boundaries.  The typical situation is
-one where the coder mis-counts the range and either fills the data
+The purpose of the three boundary markers is to catch corruption and
+to act as an aid in low-level debugging.  In the first case, memory
+over- and under-run errors are likely to overwrite the special values
+in either the leading or trailing boundaries.  The typical situation
+is one where the coder mis-counts the range and either fills the data
 just before the start of the valid memory or just after the end of the
 valid memory.  These actions will (hopefully) alter the boundary-post
@@ -212,14 +207,15 @@
 \begin{verbatim}
 typedef struct {
+    const void *startblock;             ///< initialised to PS_MEM_MAGIC
     const unsigned long id;             ///< a unique ID for this allocation
     const char *file;                   ///< set from __FILE__ in e.g. p_psAlloc
     const int lineno;                   ///< set from __LINE__ in e.g. p_psAlloc
     int refCounter;                     ///< how many times pointer is referenced
-    int state;                          ///< current state of memory block
-    const void *magic;                  ///< initialised to PS_MEM_MAGIC
+    const void **endpost;               ///< pointer to endpost, initialised to PS_MEM_MAGIC
+    const void *endblock;              ///< initialised to PS_MEM_MAGIC
 } psMemBlock;
 \end{verbatim}
 %
-The first element in the structure is a sequential memory block ID.
+The second element in the structure is a sequential memory block ID.
 The memory management system must maintain an internal memory block ID
 counter from which a new ID may be supplied to each newly allocated
@@ -242,8 +238,10 @@
 strongly encouraged, but not enforced by the memory management system.
 
-The element \code{state} defines the state of the memory block.  In
-order to trace double frees and other memory errors, the memory block
-reference is not automatically deleted when the assocated memory is
-deleted.  Valid states are \code{PS_MEM_FREE} and \code{PS_MEM_ALLOC}.
+In order to trace double frees and other memory errors, the memory
+block reference is not automatically deleted when the assocated memory
+is deleted.  Rather, the \code{psMemBlock} data and the \code{endpost}
+data are left behind.  If endpost points to the memory location
+immediately following the \code{psMemBlock} data, then the memory
+block has been freed.  This state shall be enforces by \code{psFree}.
 
 \subsubsection{APIs for Allocating and Freeing}
