Fixes for OpenBSD
[oweals/cde.git] / cde / programs / dtudcfonted / libfal / include / os.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: os.h /main/6 1996/05/28 15:33:04 ageorge $ */
24 /***********************************************************
25 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
26 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
27
28                         All Rights Reserved
29
30 Permission to use, copy, modify, and distribute this software and its 
31 documentation for any purpose and without fee is hereby granted, 
32 provided that the above copyright notice appear in all copies and that
33 both that copyright notice and this permission notice appear in 
34 supporting documentation, and that the names of Digital or MIT not be
35 used in advertising or publicity pertaining to distribution of the
36 software without specific, written prior permission.  
37
38 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44 SOFTWARE.
45
46 (c) Copyright 1995 FUJITSU LIMITED
47 This is source code modified by FUJITSU LIMITED under the Joint
48 Development Agreement for the CDEnext PST.
49 This is unpublished proprietary source code of FUJITSU LIMITED
50
51 ******************************************************************/
52
53
54 #ifndef OS_H
55 #define OS_H
56 #include "misc.h"
57
58 #ifdef INCLUDE_ALLOCA_H
59 #include <alloca.h>
60 #endif
61
62 #define NullFID ((FID) 0)
63
64 #define SCREEN_SAVER_ON   0
65 #define SCREEN_SAVER_OFF  1
66 #define SCREEN_SAVER_FORCER 2
67
68 #if defined(stellar)
69 #define MAX_REQUEST_SIZE 65535
70 #else
71 #define MAX_REQUEST_SIZE 16384
72 #endif
73
74 typedef pointer FID;
75 typedef struct _FontPathRec *FontPathPtr;
76 typedef struct _NewClientRec *NewClientPtr;
77
78 #ifndef NO_ALLOCA
79 /*
80  * os-dependent definition of local allocation and deallocation
81  * If you want something other than Xalloc/Xfree for ALLOCATE/DEALLOCATE
82  * LOCAL then you add that in here.
83  */
84 #if defined(__HIGHC__)
85
86 extern char *alloca();
87
88 #if HCVERSION < 21003
89 #define ALLOCATE_LOCAL(size)    alloca((int)(size))
90 pragma on(alloca);
91 #else /* HCVERSION >= 21003 */
92 #define ALLOCATE_LOCAL(size)    _Alloca((int)(size))
93 #endif /* HCVERSION < 21003 */
94
95 #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
96
97 #endif /* defined(__HIGHC__) */
98
99
100 #if defined(__GNUC__)
101 #if !defined(__linux__)
102 #define alloca ___builtin_alloca
103 #endif
104 #define ALLOCATE_LOCAL(size) alloca((int)(size))
105 #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
106 #else /* ! __GNUC__ */
107 /*
108  * warning: mips alloca is unsuitable in the server, do not use.
109  */
110 #if defined(vax) || defined(sun) || defined(apollo) || defined(stellar)
111 /*
112  * Some System V boxes extract alloca.o from /lib/libPW.a; if you
113  * decide that you don't want to use alloca, you might want to fix 
114  * ../os/4.2bsd/Imakefile
115  */
116 char *alloca();
117 #define ALLOCATE_LOCAL(size) alloca((int)(size))
118 #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
119 #endif /* who does alloca */
120 #endif /* __GNUC__ */
121
122 #endif /* NO_ALLOCA */
123
124 #ifndef ALLOCATE_LOCAL
125 #define ALLOCATE_LOCAL(size) Xalloc((unsigned long)(size))
126 #define DEALLOCATE_LOCAL(ptr) Xfree((pointer)(ptr))
127 #endif /* ALLOCATE_LOCAL */
128
129
130 #define xalloc(size) Xalloc((unsigned long)(size))
131 #define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size))
132 #define xfree(ptr) Xfree((pointer)(ptr))
133
134 int             ReadRequestFromClient();
135 #ifndef strcat
136 char            *strcat();
137 #endif
138 #ifndef strncat
139 char            *strncat();
140 #endif
141 #ifndef strcpy
142 char            *strcpy();
143 #endif
144 #ifndef strncpy
145 char            *strncpy();
146 #endif
147 Bool            CloseDownConnection();
148 FontPathPtr     GetFontPath();
149 FontPathPtr     ExpandFontNamePattern();
150 FID             FiOpenForRead();
151 void            CreateWellKnownSockets();
152 int             SetDefaultFontPath();
153 void            FreeFontRecord();
154 int             SetFontPath();
155 void            ErrorF();
156 void            Error();
157 void            FatalError();
158 void            ProcessCommandLine();
159 void            Xfree();
160 void            FlushAllOutput();
161 void            FlushIfCriticalOutputPending();
162 unsigned long   *Xalloc();
163 unsigned long   *Xrealloc();
164 long            GetTimeInMillis();
165
166 #endif /* OS_H */