blob: 4c2677264bad50e00e50ecd35aff4041986481e9 [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 */
Bram Moolenaar8c8de832008-06-24 22:58:06 +000030#define HAVE_MATH_H
Bram Moolenaar071d4272004-06-13 20:20:40 +000031//#define USE_FNAME_CASE /* adjust case of file names */
32#ifndef FEAT_CLIPBOARD
33# define FEAT_CLIPBOARD /* include clipboard support */
34#endif
35#if defined(__DATE__) && defined(__TIME__)
36# define HAVE_DATE_TIME
37#endif
38#define HAVE_AVAIL_MEM
39
40#define SHORT_FNAME /* always 8.3 file name */
41
42#define SMALL_MALLOC /* 16 bit storage allocation */
43
44#ifdef __BORLANDC__
45# define HAVE_PUTENV /* at least Bcc 5.2 has it */
46#endif
47
48#ifdef FEAT_GUI_W16
49# define NO_CONSOLE /* don't included console-only code */
50#endif
51
52/* toupper() is not really broken, but it's very slow. Probably because of
Bram Moolenaar84a05ac2013-05-06 04:24:17 +020053 * using unicode characters on Windows NT */
Bram Moolenaar071d4272004-06-13 20:20:40 +000054#define BROKEN_TOUPPER
55
56#define FNAME_ILLEGAL "\"*?><|" /* illegal characters in a file name */
57
Bram Moolenaara2aa31a2014-02-23 22:52:40 +010058#ifndef VIM_SIZEOF_INT
59# define VIM_SIZEOF_INT 2
Bram Moolenaar071d4272004-06-13 20:20:40 +000060#endif
61
62typedef long off_t;
63
64#include <stdlib.h>
65#include <time.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +000066
Bram Moolenaar82881492012-11-20 16:53:39 +010067/* cproto fails on missing include files */
68#ifndef PROTO
69# include <dos.h>
70# include <dir.h>
71
72# ifndef STRICT
73# define STRICT
74# endif
75# ifndef COBJMACROS
76# define COBJMACROS /* For OLE: Enable "friendlier" access to objects */
77# endif
78# include <windows.h>
79
80#endif /* PROTO */
Bram Moolenaar071d4272004-06-13 20:20:40 +000081
82/*
83 * plenty of memory, use large buffers
84 */
85#define CMDBUFFSIZE 1024 /* size of the command processing buffer */
86
87
88#define BASENAMELEN (MAXPATHL-5) /* length of base of file name */
89
90#ifndef DFLT_MAXMEM
91# define DFLT_MAXMEM (256) /* use up to 256K for a buffer*/
92#endif
93
94#ifndef DFLT_MAXMEMTOT
95# define DFLT_MAXMEMTOT (5*1024) /* use up to 5 Mbyte for Vim */
96#endif
97
98/*
99 * Some simple debugging macros that look and behave a lot like their
100 * namesakes in MFC.
101 */
102
103#ifdef _DEBUG
104
105# if defined(_MSC_VER) && (_MSC_VER >= 1000)
106 /* Use the new debugging tools in Visual C++ 4.x */
107# include <crtdbg.h>
108# define ASSERT(f) _ASSERT(f)
109# else
110# include <assert.h>
111# define ASSERT(f) assert(f)
112# endif
113
Bram Moolenaar071d4272004-06-13 20:20:40 +0000114# define TRACE Trace
115# define TRACE0(sz) Trace(_T("%s"), _T(sz))
116# define TRACE1(sz, p1) Trace(_T(sz), p1)
117# define TRACE2(sz, p1, p2) Trace(_T(sz), p1, p2)
118# define TRACE3(sz, p1, p2, p3) Trace(_T(sz), p1, p2, p3)
119
120/* In debug version, writes trace messages to debug stream */
121void __cdecl
122Trace(char *pszFormat, ...);
123
124#else /* !_DEBUG */
125
126 /* These macros should all compile away to nothing */
127# define ASSERT(f) ((void)0)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000128# define TRACE 1 ? (void)0 : printf
129# define TRACE0(sz)
130# define TRACE1(sz, p1)
131# define TRACE2(sz, p1, p2)
132# define TRACE3(sz, p1, p2, p3)
133
134#endif /* !_DEBUG */
135
136
137#define ASSERT_POINTER(p, type) \
138 ASSERT(((p) != NULL) && IsValidAddress((p), sizeof(type), FALSE))
139
140#define ASSERT_NULL_OR_POINTER(p, type) \
141 ASSERT(((p) == NULL) || IsValidAddress((p), sizeof(type), FALSE))
142
143#define mch_setenv(name, val, x) setenv(name, val, x)