sync master with lastest vba changes
[ooovba.git] / dmake / extern.h
blob22d4a146823a042e74495833097869fc3c681a9a
1 /* $RCSfile: extern.h,v $
2 -- $Revision: 1.13 $
3 -- last change: $Author: kz $ $Date: 2008-03-05 18:28:27 $
4 --
5 -- SYNOPSIS
6 -- External declarations for dmake functions.
7 --
8 -- DESCRIPTION
9 -- ANSI is a macro that allows the proper handling of ANSI style
10 -- function declarations.
11 --
12 -- AUTHOR
13 -- Dennis Vadura, dvadura@dmake.wticorp.com
15 -- WWW
16 -- http://dmake.wticorp.com/
18 -- COPYRIGHT
19 -- Copyright (c) 1996,1997 by WTI Corp. All rights reserved.
20 --
21 -- This program is NOT free software; you can redistribute it and/or
22 -- modify it under the terms of the Software License Agreement Provided
23 -- in the file <distribution-root>/readme/license.txt.
25 -- LOG
26 -- Use cvs log to obtain detailed change logs.
29 #ifndef EXTERN_h
30 #define EXTERN_h
32 /* For MSVC++ needs to include windows.h first to avoid problems with
33 * type redefinitions. Include it also for MinGW for consistency. */
34 #if defined(__MINGW32__) || defined(_MSC_VER)
35 #include <windows.h>
36 #endif
38 #include "config.h"
40 /* Define this for the RS/6000 if it breaks something then we have to put a
41 * #ifdef around it. */
42 #if defined(rs6000)
43 #define _POSIX_SOURCE
44 #endif
46 #include <stdio.h>
47 #ifdef HAVE_LIMITS_H
48 # include <limits.h>
49 #endif
50 #include <stdlib.h>
51 #ifdef HAVE_UNISTD_H
52 # include <unistd.h>
53 #endif
54 #include <string.h>
55 #include <ctype.h>
56 #ifdef HAVE_FCNTL_H
57 # include <fcntl.h>
58 #endif
60 #if TIME_WITH_SYS_TIME
61 # include <sys/time.h>
62 # include <time.h>
63 #else
64 # if HAVE_SYS_TIME_H
65 # include <sys/time.h>
66 # else
67 # include <time.h>
68 # endif
69 #endif
71 #if HAVE_SYS_TYPES_H
72 # include <sys/types.h>
73 #else
74 # include <types.h>
75 #endif
76 #if HAVE_SYS_STAT_H
77 # include <sys/stat.h>
78 #endif
79 #if HAVE_UTIME_H
80 # include <utime.h>
81 #endif
83 #define DMPVOID void *
85 #include <signal.h>
86 #include "itypes.h"
87 #include "stdmacs.h"
88 #include "alloc.h"
89 #include "db.h"
90 #include "dstdarg.h"
91 #include "dmake.h"
92 #include "struct.h"
93 #include "vextern.h"
94 #include "public.h"
96 /* Include this last as it invalidates some functions that are defined
97 * externally above and turns them into no-ops. Have to do this after
98 * the extern declarations however. */
99 #include "posix.h"
103 /* Common declarations
104 * ===================
105 * are better made here then in local public.h. So far dmake didn't follow
106 * this strategy but new functions will be added here. */
108 /* Use our own implementation if no library function is present. */
109 #ifndef HAVE_STRLWR
110 /* from dmstring.c */
111 char *strlwr(char *p);
112 #endif
114 /* from function.c */
115 char *exec_normpath(char *args);
117 /* from make.c */
118 void Unmake(CELLPTR cp);
120 /* from path.c */
121 void Clean_path(char *path);
122 char *normalize_path(char *path);
124 /* from sysintf.c */
125 /* cygdospath()/DO_WINPATH() are only needed for the .WINPATH attribute
126 * on cygwin. */
127 #if __CYGWIN__
128 char *cygdospath(char *src, int winpath);
129 # define DO_WINPATH(p) cygdospath(p, UseWinpath)
130 #else
131 # define DO_WINPATH(p) p
132 #endif
135 /* Define some usefull macros. This is done here and not in config.h
136 * to keep this changes usefull even when not using the autotools based
137 * build, i.e. using config.h files that are local to the architecture. */
138 #if defined(_WIN32) || defined(__CYGWIN__) || defined(MSDOS) || defined(OS2) || defined(__EMX__)
139 # define HAVE_DRIVE_LETTERS 1
140 #endif
142 #if defined(_WIN32) || defined(MSDOS) || defined(OS2) && !defined(__CYGWIN__)
143 # define NULLDEV "NUL"
144 #else
145 # define NULLDEV "/dev/null"
146 #endif
148 /* For MSVC 6.0 and newer and MinGW use the CreateProcess() function. */
149 #if defined(__MINGW32__) || defined(_MSC_VER) && _MSC_VER >= 1200
150 # define USE_CREATEPROCESS 1
151 #else
152 /* #undef USE_CREATEPROCESS */
153 #endif
155 /* CreateProcess() is spawn-like. */
156 #if ENABLE_SPAWN && ( HAVE_SPAWN_H || __CYGWIN__ || __EMX__) || defined(USE_CREATEPROCESS)
157 # define USE_SPAWN 1
158 #else
159 /* #undef USE_SPAWN */
160 #endif
162 /* Work around some of the functions that may or may not exist */
163 #if ! HAVE_TZSET
164 #if HAVE_SETTZ
165 # define tzset() settz()
166 #else
167 # warn "tzset is not supported, null out"
168 # define tzset()
169 #endif
170 #endif
172 /* Get the working directory fall back code */
173 #if ! HAVE_GETCWD
174 #if HAVE_GETWD
175 # define getcwd(buf,len) getwd(buf)
176 #else
177 # error "You have no supported way of getting working directory"
178 #endif
179 #endif
181 /* If setvbuf is not available set output to unbuffered */
182 #if ! HAVE_SETVBUF
183 # define setvbuf(fp,bp,type,len) setbuf(fp,NULL)
184 #endif
186 /* coreleft is used in some debug macros. Only Turbo C seems to provide
187 * this function. Define it here so that the code compiles. */
188 #ifdef DBUG
189 #define coreleft() 0L
190 #endif
192 #endif