/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* gos420 src/gos/2d/XTOP/server/include/os.h                             */
/*                                                                        */
/* Licensed Materials - Property of IBM                                   */
/*                                                                        */
/* (C) COPYRIGHT International Business Machines Corp. 1987,1993          */
/* All Rights Reserved                                                    */
/*                                                                        */
/* US Government Users Restricted Rights - Use, duplication or            */
/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.      */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/* @(#)67	1.1.1.3  src/gos/2d/XTOP/server/include/os.h, xserver, gos420, 9613T 9/2/94 11:38:16 */
/*
 * COMPONENT_NAME: XSERVER
 *
 * FUNCTIONS:
 *
 * ORIGINS: 27, 16, 40
 *
 * (C) COPYRIGHT International Business Machines Corp. 1987, 1993
 * All Rights Reserved
 * Licensed Materials - Property of IBM
 *
 * US Government Users Restricted Rights - Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
*/
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.

                        All Rights Reserved

Permission to use, copy, modify, and distribute this software and its 
documentation for any purpose and without fee is hereby granted, 
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in 
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.  

DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

******************************************************************/

#ifndef OS_H
#define OS_H
#include "misc.h"

#define NullFID ((FID) 0)

#define SCREEN_SAVER_ON   0
#define SCREEN_SAVER_OFF  1
#define SCREEN_SAVER_FORCER 2
#define SCREEN_SAVER_CYCLE  3
#define SCREEN_SAVER_POWER_MANAGER 4

#ifndef MAX_REQUEST_SIZE
#define MAX_REQUEST_SIZE 65535
#endif

typedef pointer	FID;
typedef struct _FontPathRec *FontPathPtr;
typedef struct _NewClientRec *NewClientPtr;

#ifndef IBM_MEMBUG

/*
#ifndef alloca
#pragma alloca
char *alloca();
#endif
#ifndef ALLOCATE_LOCAL
#define ALLOCATE_LOCAL(size) alloca((int)(size))
#define DEALLOCATE_LOCAL(ptr)
#endif
*/

#ifdef AIX_PERF
#define ALLOCATE_LOCAL(size) allocate_local((unsigned long)(size))
#define DEALLOCATE_LOCAL(ptr) deallocate_local((pointer)(ptr))
#else
#define ALLOCATE_LOCAL(size) Xalloc((unsigned long)(size))
#define DEALLOCATE_LOCAL(ptr) Xfree((pointer)(ptr))
#endif

#define xalloc(size) Xalloc((unsigned long)(size))
#define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size))
#define xfree(ptr) Xfree((pointer)(ptr))
#define DUMP_MEM_IN_USE
#define MARK_MEM_TIME
#define DUMP_MEM_SINCE

#define VALIDATE_MEM(ptr)
#define VALIDATE_ALL_MEM

#else /* IBM_MEMBUG */
 #ifndef ALLOCATE_LOCAL
    #define ALLOCATE_LOCAL(size)        \
                membug_alloc((unsigned long)(size), __FILE__, __LINE__)
    #define DEALLOCATE_LOCAL(ptr)       \
                membug_free((pointer)(ptr), __FILE__, __LINE__)
  #endif /* ALLOCATE_LOCAL */

  #define xalloc(size) membug_alloc((unsigned long)(size), __FILE__, __LINE__)
  #define xrealloc(ptr, size)   membug_realloc((pointer)(ptr),\
                                (unsigned long)(size), __FILE__, __LINE__)
  #define xfree(ptr) membug_free((pointer)(ptr), __FILE__, __LINE__)

  #define DUMP_MEM_IN_USE       DumpAllMemoryInUse(__FILE__, __LINE__)
  #define MARK_MEM_TIME         MarkMemoryTime()
  #define DUMP_MEM_SINCE        DumpMemorySince()

  #define VALIDATE_MEM(ptr)     \
        ValidateNode(ptr, __FILE__, __LINE__, "ValidateNode")

  #define VALIDATE_ALL_MEM      \
        ValidateAllActiveMemory(__FILE__, __LINE__, "ValidateAllActiveMemory")

  extern void DumpAllMemoryInUse(), ValidateNode(), ValidateAllActiveMemory(),
        MarkMemoryTime(), DumpMemorySince();
#endif

#ifndef X_NOT_STDC_ENV
#include <string.h>
#else
#ifdef SYSV
#include <string.h>
#else
#include <strings.h>
#endif
#endif

int		ReadRequestFromClient();
Bool		CloseDownConnection();
FontPathPtr	ExpandFontNamePattern();
FID		FiOpenForRead();
void		CreateWellKnownSockets();
int		SetDefaultFontPath();
void		FreeFontRecord();
int		SetFontPath();
void		ErrorF();
void		Error();
void		FatalError();
void		ProcessCommandLine();
void		Xfree();
void		FlushAllOutput();
void		FlushIfCriticalOutputPending();
unsigned long	*Xalloc();
unsigned long	*Xrealloc();
long		GetTimeInMillis();

#endif /* OS_H */
