home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / printing / ghostscrip / source / _gs / h / memory_ < prev    next >
Encoding:
Text File  |  1991-10-27  |  2.5 KB  |  73 lines

  1. /* Copyright (C) 1989, 1990 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* memory_.h */
  21. /* Generic substitute for Unix memory.h */
  22.  
  23. /****** Note: the System V bcmp routine only returns zero or non-zero, ******/
  24. /****** unlike memcmp which returns -1, 0, or 1. ******/
  25.  
  26. #ifdef __MSDOS__
  27. /* The Turbo C implementation of memset swaps the arguments and calls */
  28. /* the non-standard routine setmem.  We may as well do it in advance. */
  29. #  undef memset                /* just in case */
  30. #  include <mem.h>
  31. #  define memset(dest,chr,cnt) setmem(dest,cnt,chr)
  32. #else
  33. #  ifdef VMS
  34.     extern char *memcpy(), *memset();
  35.     extern int memcmp();
  36. #  else
  37. #    ifdef BSD4_2
  38.     extern bcopy(), bcmp(), bzero();
  39. #       define memcpy(dest,src,len) bcopy(src,dest,len)
  40. #       define memcmp(b1,b2,len) bcmp(b1,b2,len)
  41.     /* Define our own version of memset */
  42. #    ifdef __STDC__
  43.     static void memset(void *dest, register char ch, unsigned len)
  44. #    else
  45.     static void memset(dest, ch, len)
  46.       char *dest; register char ch; unsigned len;
  47. #    endif                /* (!)__STDC__ */
  48.        {    if ( ch == 0 )
  49.             bzero(dest, len);
  50.         else if ( len > 0 )
  51.            {    register char *p = (char *)dest;
  52.             register unsigned count = len;
  53.             do { *p++ = ch; } while ( --count );
  54.            }
  55.        }
  56. #    else                /* !BSD4_2 */
  57. #      ifdef _POSIX_SOURCE
  58. #        include <string.h>
  59. #      else
  60. #        ifdef _HPUX_SOURCE
  61. #          include <string.h>
  62. #        else
  63. #         ifdef ARC
  64. #           include <string.h>
  65. #          else
  66. #            include <memory.h>
  67. #          endif /* !ARC */
  68. #        endif                /* !_HPUX_SOURCE */
  69. #      endif                /* !_POSIX_SOURCE */
  70. #    endif                /* !BSD4_2 */
  71. #  endif                /* !VMS */
  72. #endif                    /* !__MSDOS__ */
  73.