blob: 7dd3b9fd03d4cb49987ca3b664ae90878b393537 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001/* vi:set ts=8 sts=4 sw=4:
2 *
3 * VIM - Vi IMproved by Bram Moolenaar
4 *
5 * Do ":help uganda" in Vim to read copying and usage conditions.
6 * Do ":help credits" in Vim to see a list of people who contributed.
7 */
8
9/*
10 * Win16 (Windows 3.1x) machine-dependent things.
11 */
12
13#include "os_dos.h" /* common MS-DOS and Windows stuff */
14
15#define BINARY_FILE_IO
16#define USE_EXE_NAME /* use argv[0] for $VIM */
Bram Moolenaar071d4272004-06-13 20:20:40 +000017#define SYNC_DUP_CLOSE /* sync() a file with dup() and close() */
18#define USE_TERM_CONSOLE
19#define HAVE_STRING_H
20#define HAVE_STRCSPN
21#define HAVE_STRICMP
22#define HAVE_STRNICMP
23#define HAVE_STRFTIME /* guessed */
24#define HAVE_MEMSET
25#define USE_TMPNAM /* use tmpnam() instead of mktemp() */
26#define HAVE_LOCALE_H
27#define HAVE_FCNTL_H
28#define HAVE_QSORT
29#define HAVE_ST_MODE /* have stat.st_mode */
30//#define USE_FNAME_CASE /* adjust case of file names */
31#ifndef FEAT_CLIPBOARD
32# define FEAT_CLIPBOARD /* include clipboard support */
33#endif
34#if defined(__DATE__) && defined(__TIME__)
35# define HAVE_DATE_TIME
36#endif
37#define HAVE_AVAIL_MEM
38
39#define SHORT_FNAME /* always 8.3 file name */
40
41#define SMALL_MALLOC /* 16 bit storage allocation */
42
43#ifdef __BORLANDC__
44# define HAVE_PUTENV /* at least Bcc 5.2 has it */
45#endif
46
47#ifdef FEAT_GUI_W16
48# define NO_CONSOLE /* don't included console-only code */
49#endif
50
51/* toupper() is not really broken, but it's very slow. Probably because of
52 * using unicde characters on Windows NT */
53#define BROKEN_TOUPPER
54
55#define FNAME_ILLEGAL "\"*?><|" /* illegal characters in a file name */
56
57#ifndef SIZEOF_INT
58# define SIZEOF_INT 2
59#endif
60
61typedef long off_t;
62
63#include <stdlib.h>
64#include <time.h>
65#include <dos.h>
66#include <dir.h>
67
68#ifndef STRICT
69# define STRICT
70#endif
71#ifndef COBJMACROS
72# define COBJMACROS /* For OLE: Enable "friendlier" access to objects */
73#endif
74#include <windows.h>
75
76/*
77 * plenty of memory, use large buffers
78 */
79#define CMDBUFFSIZE 1024 /* size of the command processing buffer */
80
81
82#define BASENAMELEN (MAXPATHL-5) /* length of base of file name */
83
84#ifndef DFLT_MAXMEM
85# define DFLT_MAXMEM (256) /* use up to 256K for a buffer*/
86#endif
87
88#ifndef DFLT_MAXMEMTOT
89# define DFLT_MAXMEMTOT (5*1024) /* use up to 5 Mbyte for Vim */
90#endif
91
92/*
93 * Some simple debugging macros that look and behave a lot like their
94 * namesakes in MFC.
95 */
96
97#ifdef _DEBUG
98
99# if defined(_MSC_VER) && (_MSC_VER >= 1000)
100 /* Use the new debugging tools in Visual C++ 4.x */
101# include <crtdbg.h>
102# define ASSERT(f) _ASSERT(f)
103# else
104# include <assert.h>
105# define ASSERT(f) assert(f)
106# endif
107
Bram Moolenaar071d4272004-06-13 20:20:40 +0000108# define TRACE Trace
109# define TRACE0(sz) Trace(_T("%s"), _T(sz))
110# define TRACE1(sz, p1) Trace(_T(sz), p1)
111# define TRACE2(sz, p1, p2) Trace(_T(sz), p1, p2)
112# define TRACE3(sz, p1, p2, p3) Trace(_T(sz), p1, p2, p3)
113
114/* In debug version, writes trace messages to debug stream */
115void __cdecl
116Trace(char *pszFormat, ...);
117
118#else /* !_DEBUG */
119
120 /* These macros should all compile away to nothing */
121# define ASSERT(f) ((void)0)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000122# define TRACE 1 ? (void)0 : printf
123# define TRACE0(sz)
124# define TRACE1(sz, p1)
125# define TRACE2(sz, p1, p2)
126# define TRACE3(sz, p1, p2, p3)
127
128#endif /* !_DEBUG */
129
130
131#define ASSERT_POINTER(p, type) \
132 ASSERT(((p) != NULL) && IsValidAddress((p), sizeof(type), FALSE))
133
134#define ASSERT_NULL_OR_POINTER(p, type) \
135 ASSERT(((p) == NULL) || IsValidAddress((p), sizeof(type), FALSE))
136
137#define mch_setenv(name, val, x) setenv(name, val, x)