Fix warnings on FreeBSD
[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 #ifdef alloca
103 #undef alloca
104 #endif
105 #define alloca ___builtin_alloca
106 #endif
107 #define ALLOCATE_LOCAL(size) alloca((int)(size))
108 #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
109 #else /* ! __GNUC__ */
110 /*
111  * warning: mips alloca is unsuitable in the server, do not use.
112  */
113 #if defined(vax) || defined(sun) || defined(apollo) || defined(stellar)
114 /*
115  * Some System V boxes extract alloca.o from /lib/libPW.a; if you
116  * decide that you don't want to use alloca, you might want to fix 
117  * ../os/4.2bsd/Imakefile
118  */
119 char *alloca();
120 #define ALLOCATE_LOCAL(size) alloca((int)(size))
121 #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
122 #endif /* who does alloca */
123 #endif /* __GNUC__ */
124
125 #endif /* NO_ALLOCA */
126
127 #ifndef ALLOCATE_LOCAL
128 #define ALLOCATE_LOCAL(size) Xalloc((unsigned long)(size))
129 #define DEALLOCATE_LOCAL(ptr) Xfree((pointer)(ptr))
130 #endif /* ALLOCATE_LOCAL */
131
132
133 #define xalloc(size) Xalloc((unsigned long)(size))
134 #define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size))
135 #define xfree(ptr) Xfree((pointer)(ptr))
136
137 int             ReadRequestFromClient();
138 #ifndef strcat
139 char            *strcat();
140 #endif
141 #ifndef strncat
142 char            *strncat();
143 #endif
144 #ifndef strcpy
145 char            *strcpy();
146 #endif
147 #ifndef strncpy
148 char            *strncpy();
149 #endif
150 Bool            CloseDownConnection();
151 FontPathPtr     GetFontPath();
152 FontPathPtr     ExpandFontNamePattern();
153 FID             FiOpenForRead();
154 void            CreateWellKnownSockets();
155 int             SetDefaultFontPath();
156 void            FreeFontRecord();
157 int             SetFontPath();
158 void            ErrorF();
159 void            Error();
160 void            FatalError();
161 void            ProcessCommandLine();
162 void            Xfree();
163 void            FlushAllOutput();
164 void            FlushIfCriticalOutputPending();
165 unsigned long   *Xalloc();
166 unsigned long   *Xrealloc();
167 long            GetTimeInMillis();
168
169 #endif /* OS_H */