Annotation of pgp/src/memmgr.h, revision 1.1.1.1

1.1       root        1: /*
                      2: **     include file for memory manager routines
                      3: **     (c) 1988 Philip Zimmermann
                      4: */
                      5: 
                      6: /* Elaborate protection mechanisms to assure no redefinitions of types...*/
                      7: #ifndef BYTESTUFF
                      8: #define BYTESTUFF
                      9: typedef unsigned char byte;    /* values are 0-255 */
                     10: typedef byte *byteptr; /* pointer to byte */
                     11: typedef char *string;  /* pointer to ASCII character string */
                     12: #endif /* if BYTESTUFF not already defined */
                     13: #ifndef WORDSTUFF
                     14: #define WORDSTUFF
                     15: typedef unsigned short word16; /* values are 0-65536 */
                     16: typedef unsigned long word32;  /* values are 0-4294967296 */
                     17: #endif /* if WORDSTUFF not already defined */
                     18: 
                     19: typedef byte *ptr;             /* pointer type definition */
                     20: 
                     21: #define nil (void *)0          /* nil pointer */
                     22: #ifndef NULL
                     23: #define NULL (void *)0         /* nil pointer--UNIX nomenclature */
                     24: #endif
                     25: 
                     26: typedef unsigned short p_range;        /* values are 0-65536 */
                     27: /*     Note that the p_range type may be expanded to 32 bits 
                     28:        for larger partitions, if 64K is not big enough.
                     29: */
                     30: 
                     31: /*
                     32: **     partsize - returns size of partition in bytes
                     33: **     Used to declare storage for a memory partition array of bytes.
                     34: **     Computed from the block size, the number of blocks, plus overhead.
                     35: */
                     36: /* alignptr operator aligns storage to ptr boundary */
                     37: #define alignptr(bsize) ( (((bsize)+sizeof(ptr)-1)/sizeof(ptr))*sizeof(ptr) )
                     38: /* partheadsize is overhead storage required for partition */
                     39: #define partheadsize alignptr(sizeof(ptr)+sizeof(short))
                     40: #define        partsize(bsize,nblocks) (alignptr(bsize)*(nblocks)+partheadsize)
                     41: 
                     42: void pcreat2(ptr part, word16 bsize, word16 nblocks);
                     43:        /* Initialize a memory manager partition. */
                     44: 
                     45: /* pcreate is similar to pcreat2, but with slightly different arguments. */
                     46: #define pcreate(part,psize,bsize) \
                     47:        pcreat2(part,alignptr(bsize),(psize-partheadsize)/alignptr(bsize))
                     48: 
                     49: #ifndef _NOMALLOC      /* malloc library routine available */
                     50: ptr partalloc(word16 bsize, word16 nblocks);
                     51:        /* Allocate and initialize a memory partition. */
                     52: #endif
                     53: 
                     54: ptr gblock(register ptr part);
                     55:        /* Get a memory block from partition. */
                     56: 
                     57: ptr rblock(register ptr part, register ptr addr);
                     58:        /* Release a memory block to partition. */
                     59: 
                     60: #ifndef _NOPRINTF      /* printf available */
                     61: void dumpfree(ptr part);
                     62:        /* Dump partition free list in hex. */
                     63: #endif
                     64: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.